CMS 3D CMS Logo

CaloGeometryDBWriter.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOEVENTSETUP_CALOGEOMETRYDBWRITER_H
2 #define GEOMETRY_CALOEVENTSETUP_CALOGEOMETRYDBWRITER_H 1
3 
7 
9 
11 {
12  public:
13 
17 
18  static bool writeFlag() { return true ; }
19 
20  static void write( const TrVec& tvec,
21  const DimVec& dvec,
22  const IVec& ivec,
23  const std::string& tag )
24  {
25  const IVec dins;
26  PCaloGeometry* peg = new PCaloGeometry( tvec, dvec, ivec, dins );
27 
29  if( !mydbservice.isAvailable() )
30  {
31  edm::LogError("PCaloDBGeometryBuilder")<<"PoolDBOutputService unavailable";
32  }
33  else
34  {
35  if ( mydbservice->isNewTagRequest( tag ) )
36  {
37  mydbservice->createNewIOV<PCaloGeometry>(
38  peg,
39  mydbservice->beginOfTime(),
40  mydbservice->endOfTime(),
41  tag ) ;
42  }
43  else
44  {
45  mydbservice->appendSinceTime<PCaloGeometry>(
46  peg,
47  mydbservice->currentTime(),
48  tag ) ;
49  }
50  }
51  }
52 
53  static void writeIndexed( const TrVec& tvec,
54  const DimVec& dvec,
55  const IVec& ivec,
56  const IVec& dins,
57  const std::string& tag )
58  {
59  PCaloGeometry* peg = new PCaloGeometry( tvec, dvec, ivec, dins );
60 
62  if( !mydbservice.isAvailable() )
63  {
64  edm::LogError("PCaloDBGeometryBuilder")<<"PoolDBOutputService unavailable";
65  }
66  else
67  {
68  if ( mydbservice->isNewTagRequest( tag ) )
69  {
70  mydbservice->createNewIOV<PCaloGeometry>(
71  peg,
72  mydbservice->beginOfTime(),
73  mydbservice->endOfTime(),
74  tag ) ;
75  }
76  else
77  {
78  mydbservice->appendSinceTime<PCaloGeometry>(
79  peg,
80  mydbservice->currentTime(),
81  tag ) ;
82  }
83  }
84  }
85 
87  virtual ~CaloGeometryDBWriter() {}
88 };
89 
90 #endif
std::vector< CCGFloat > DimVec
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, const std::string &tag)
std::vector< unsigned int > IVec
std::vector< CCGFloat > TrVec
static void write(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const std::string &tag)
CaloSubdetectorGeometry::TrVec TrVec
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
CaloSubdetectorGeometry::DimVec DimVec
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
CaloSubdetectorGeometry::IVec IVec