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 // $Id: CastorDbProducer.cc,v 1.4 2012/11/12 21:06:22 dlange Exp $
18 //
19 //
20 
21 
22 // system include files
23 #include <iostream>
24 #include <fstream>
25 
27 
31 
32 
34 
35 #include "CastorDbProducer.h"
36 
38  : ESProducer(),
39  mService (new CastorDbService (fConfig)),
40  mDumpRequest (),
41  mDumpStream(0)
42 {
43  //the following line is needed to tell the framework what
44  // data is being produced
52  )
53  );
54 
55  //now do what ever other initialization is needed
56 
57  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
58  if (!mDumpRequest.empty()) {
59  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
60  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
61  }
62 }
63 
64 
66 {
67 
68  // do anything here that needs to be done at desctruction time
69  // (e.g. close files, deallocate resources etc.)
70  if (mDumpStream != &std::cout) delete mDumpStream;
71 }
72 
73 
74 //
75 // member functions
76 //
77 
78 // ------------ method called to produce the data ------------
79 boost::shared_ptr<CastorDbService> CastorDbProducer::produce( const CastorDbRecord&)
80 {
81  return mService;
82 }
83 
85 
87  fRecord.get (item);
88 
89  mService->setData (item.product ());
90  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
91  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
93  }
94 }
95 
98  fRecord.get (item);
99  mService->setData (item.product ());
100  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
101  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
103  }
104 }
105 
106 
109  fRecord.get (item);
110  mService->setData (item.product ());
111  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
112  *mDumpStream << "New HCAL/CASTOR Gains set" << std::endl;
114  }
115 }
116 
117 
120  fRecord.get (item);
121  mService->setData (item.product ());
122  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
123  *mDumpStream << "New HCAL/CASTOR GainWidths set" << std::endl;
125  }
126 }
127 
130  fRecord.get (item);
131  mService->setData (item.product ());
132  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
133  *mDumpStream << "New HCAL/CASTOR QIEData set" << std::endl;
135  }
136 }
137 
140  fRecord.get (item);
141  mService->setData (item.product ());
142  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
143  *mDumpStream << "New HCAL/CASTOR ChannelQuality set" << std::endl;
145  }
146 }
147 
150  fRecord.get (item);
151  mService->setData (item.product ());
152  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
153  *mDumpStream << "New HCAL/CASTOR Electronics Map set" << std::endl;
155  }
156 }
157 
158 
159 
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 &)