ATLAS Offline Software
Loading...
Searching...
No Matches
ForwardTracker/ForwardTracker/STLHelpers.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef FORWARDTRACKER_STLHELPERS_H
6#define FORWARDTRACKER_STLHELPERS_H
7
8#include <cmath>
9#include <stdexcept>
10#include <iostream>
11
12namespace ForwardTracker {
13
14 template <class PtrType> bool absZGreater(const PtrType rhs, const PtrType lhs) { return std::fabs(lhs->position().z()) > std::fabs(rhs->position().z()); }
15
16 template <class streamptr>
17 inline void openFile(const std::string& fname, streamptr& strm) {
18
19 strm->open(fname.c_str());
20
21 if (strm->good()) std::cout << "Open file: " << fname << std::endl;
22 else {
23
24 std::string msg = "Error opening file " + fname;
25 throw std::runtime_error(msg);
26 }
27 }
28}
29
30#endif
bool absZGreater(const PtrType rhs, const PtrType lhs)
void openFile(const std::string &fname, streamptr &strm)
MsgStream & msg
Definition testRead.cxx:32