ATLAS Offline Software
RtRelationFactory.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRTCond_RtRelationFactory_h
6 #define TRTCond_RtRelationFactory_h
7 
11 
12 namespace TRTCond
13 {
14 
19  {
20  public:
28  static RtRelation* readFromFile(std::istream& is) ;
30  static void writeToFile(std::ostream& os, const RtRelation& rt) ;
31  } ;
32 
33  inline RtRelation* RtRelationFactory::readFromFile(std::istream& is) {
34  RtRelation* rt(0) ;
35  int type ;
36  is >> type ;
37  switch(type) {
38  case EBasicRtRelation:
39  rt = new BasicRtRelation() ;
40  is >> *rt ;
41  break;
42  case EBinnedRtRelation:
43  rt = new BinnedRtRelation() ;
44  is >> *rt ;
45  break;
46  case EDinesRtRelation:
47  rt = new DinesRtRelation() ;
48  is >> *rt ;
49  break;
50  }
51  return rt ;
52  }
53 
54  inline void RtRelationFactory::writeToFile(std::ostream& os, const RtRelation& rt) {
55  int type(-1) ;
56  if( dynamic_cast<const BasicRtRelation*>(&rt) ) type=EBasicRtRelation ;
57  else if( dynamic_cast<const BinnedRtRelation*>(&rt) ) type=EBinnedRtRelation ;
58  else if( dynamic_cast<const DinesRtRelation*>(&rt) ) type=EDinesRtRelation ;
59  os << type << " " << rt ;
60  }
61 
62 }
63 
64 
65 #endif
TRTCond::DinesRtRelation
Definition: DinesRtRelation.h:26
DinesRtRelation.h
BasicRtRelation.h
TRTCond::RtRelation
Definition: RtRelation.h:27
TRTCond::RtRelationFactory::EBinnedRtRelation
@ EBinnedRtRelation
Definition: RtRelationFactory.h:22
TRTCond::RtRelationFactory::EBasicRtRelation
@ EBasicRtRelation
Definition: RtRelationFactory.h:22
TRTCond::RtRelationFactory::writeToFile
static void writeToFile(std::ostream &os, const RtRelation &rt)
write method
Definition: RtRelationFactory.h:54
TRTCond::BasicRtRelation
Definition: BasicRtRelation.h:26
TRTCond::RtRelationFactory::readFromFile
static RtRelation * readFromFile(std::istream &is)
read method
Definition: RtRelationFactory.h:33
BinnedRtRelation.h
TRTCond::RtRelationFactory::RtRelationType
RtRelationType
enumerates 3rd deg polynomial coefficients or table
Definition: RtRelationFactory.h:22
TRTCond::RtRelationFactory::~RtRelationFactory
~RtRelationFactory()
destructor
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TRTCond::RtRelationFactory::EDinesRtRelation
@ EDinesRtRelation
Definition: RtRelationFactory.h:22
TRTCond
Definition: BasicRtRelation.cxx:8
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRTCond::RtRelationFactory::RtRelationFactory
RtRelationFactory()
constructor
TRTCond::BinnedRtRelation
Definition: BinnedRtRelation.h:27
TRTCond::RtRelationFactory
Definition: RtRelationFactory.h:19