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.22 2009/03/24 16:11:35 rofierzy 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 
86  fRecord.get (item);
87  mService->setData (item.product ());
88  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
89  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
91  }
92 }
93 
96  fRecord.get (item);
97  mService->setData (item.product ());
98  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
99  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
101  }
102 }
103 
104 
107  fRecord.get (item);
108  mService->setData (item.product ());
109  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
110  *mDumpStream << "New HCAL/CASTOR Gains set" << std::endl;
112  }
113 }
114 
115 
118  fRecord.get (item);
119  mService->setData (item.product ());
120  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
121  *mDumpStream << "New HCAL/CASTOR GainWidths set" << std::endl;
123  }
124 }
125 
128  fRecord.get (item);
129  mService->setData (item.product ());
130  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
131  *mDumpStream << "New HCAL/CASTOR QIEData set" << std::endl;
133  }
134 }
135 
138  fRecord.get (item);
139  mService->setData (item.product ());
140  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
141  *mDumpStream << "New HCAL/CASTOR ChannelQuality set" << std::endl;
143  }
144 }
145 
148  fRecord.get (item);
149  mService->setData (item.product ());
150  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
151  *mDumpStream << "New HCAL/CASTOR Electronics Map set" << std::endl;
153  }
154 }
155 
156 
157 
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:41
std::ostream * mDumpStream
void gainsCallback(const CastorGainsRcd &fRecord)
void pedestalWidthsCallback(const CastorPedestalWidthsRcd &fRecord)
CastorDbProducer(const edm::ParameterSet &)