test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorDbProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CastorDbProducer
4 // Class: CastorDbProducer
5 //
13 //
14 // Original Author: Fedor Ratnikov
15 // Created: Tue Aug 9 19:10:10 CDT 2005
16 // Adapted for CASTOR by L. Mundim
17 //
18 //
19 
20 
21 // system include files
22 #include <iostream>
23 #include <fstream>
24 
26 
30 
31 
33 
34 #include "CastorDbProducer.h"
35 
37  : ESProducer(),
38  mService (new CastorDbService (fConfig)),
39  mDumpRequest (),
40  mDumpStream(0)
41 {
42  //the following line is needed to tell the framework what
43  // data is being produced
51  )
52  );
53 
54  //now do what ever other initialization is needed
55 
56  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
57  if (!mDumpRequest.empty()) {
58  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
59  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
60  }
61 }
62 
63 
65 {
66 
67  // do anything here that needs to be done at desctruction time
68  // (e.g. close files, deallocate resources etc.)
69  if (mDumpStream != &std::cout) delete mDumpStream;
70 }
71 
72 
73 //
74 // member functions
75 //
76 
77 // ------------ method called to produce the data ------------
78 boost::shared_ptr<CastorDbService> CastorDbProducer::produce( const CastorDbRecord&)
79 {
80  return mService;
81 }
82 
84 
86  fRecord.get (item);
87 
88  mService->setData (item.product ());
89  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
90  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
92  }
93 }
94 
97  fRecord.get (item);
98  mService->setData (item.product ());
99  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
100  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
102  }
103 }
104 
105 
108  fRecord.get (item);
109  mService->setData (item.product ());
110  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
111  *mDumpStream << "New HCAL/CASTOR Gains set" << std::endl;
113  }
114 }
115 
116 
119  fRecord.get (item);
120  mService->setData (item.product ());
121  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
122  *mDumpStream << "New HCAL/CASTOR GainWidths set" << std::endl;
124  }
125 }
126 
129  fRecord.get (item);
130  mService->setData (item.product ());
131  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
132  *mDumpStream << "New HCAL/CASTOR QIEData set" << std::endl;
134  }
135 }
136 
139  fRecord.get (item);
140  mService->setData (item.product ());
141  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
142  *mDumpStream << "New HCAL/CASTOR ChannelQuality set" << std::endl;
144  }
145 }
146 
149  fRecord.get (item);
150  mService->setData (item.product ());
151  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
152  *mDumpStream << "New HCAL/CASTOR Electronics Map set" << std::endl;
154  }
155 }
156 
157 
158 
T getUntrackedParameter(std::string const &, T const &) const
depends_on::OneHolder< T, TDependsOnRecord > dependsOn(void(T::*iT)(const TDependsOnRecord &))
void QIEDataCallback(const CastorQIEDataRcd &fRecord)
std::vector< std::string > mDumpRequest
boost::shared_ptr< CastorDbService > mService
void gainWidthsCallback(const CastorGainWidthsRcd &fRecord)
void pedestalsCallback(const CastorPedestalsRcd &fRecord)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
boost::shared_ptr< CastorDbService > produce(const CastorDbRecord &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void channelQualityCallback(const CastorChannelQualityRcd &fRecord)
void get(HolderT &iHolder) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
T const * product() const
Definition: ESHandle.h:62
void electronicsMapCallback(const CastorElectronicsMapRcd &fRecord)
tuple cout
Definition: gather_cfg.py:121
std::ostream * mDumpStream
void gainsCallback(const CastorGainsRcd &fRecord)
void pedestalWidthsCallback(const CastorPedestalWidthsRcd &fRecord)
CastorDbProducer(const edm::ParameterSet &)