CMS 3D CMS Logo

List of all members | Public Member Functions
EcalTrivialObjectAnalyzer Class Reference

#include <EcalTrivialObjectAnalyzer.h>

Inheritance diagram for EcalTrivialObjectAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
 EcalTrivialObjectAnalyzer (edm::ParameterSet const &p)
 
 EcalTrivialObjectAnalyzer (int i)
 
 ~EcalTrivialObjectAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 10 of file EcalTrivialObjectAnalyzer.h.

Constructor & Destructor Documentation

EcalTrivialObjectAnalyzer::EcalTrivialObjectAnalyzer ( edm::ParameterSet const &  p)
inlineexplicit

Definition at line 13 of file EcalTrivialObjectAnalyzer.h.

14  { }
EcalTrivialObjectAnalyzer::EcalTrivialObjectAnalyzer ( int  i)
inlineexplicit

Definition at line 15 of file EcalTrivialObjectAnalyzer.h.

16  { }
EcalTrivialObjectAnalyzer::~EcalTrivialObjectAnalyzer ( )
inlineoverride

Definition at line 17 of file EcalTrivialObjectAnalyzer.h.

References analyze(), EnergyCorrector::c, and MillePedeFileConverter_cfg::e.

17 { }

Member Function Documentation

void EcalTrivialObjectAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 81 of file EcalTrivialObjectAnalyzer.cc.

References EcalCondObjectContainer< T >::end(), edm::EventID::event(), EcalCondObjectContainer< T >::find(), EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), edm::EventSetup::get(), EcalTimeOffsetConstant::getEBValue(), EcalADCToGeVConstant::getEBValue(), EcalSampleMask::getEcalSampleMaskRecordEB(), EcalSampleMask::getEcalSampleMaskRecordEE(), EcalTimeOffsetConstant::getEEValue(), EcalADCToGeVConstant::getEEValue(), EcalLaserAPDPNRatios::getLaserMap(), EcalTBWeights::getMap(), EcalCondObjectContainer< T >::getMap(), EcalChannelStatusCode::getStatusCode(), EcalLaserAPDPNRatios::getTimeMap(), mps_fire::i, EcalXtalGroupId::id(), edm::EventBase::id(), createfilelist::int, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, EcalFunParams::params(), edm::ESHandle< T >::product(), diffTwoXMLs::r1, rand(), DetId::rawId(), edm::EventID::run(), EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, and edm::Timestamp::value().

Referenced by ~EcalTrivialObjectAnalyzer().

82 {
83  using namespace edm::eventsetup;
84  // Context is not used.
85  edm::LogInfo(">>> EcalTrivialObjectAnalyzer: processing run ")<<e.id().run() << " event: " << e.id().event();
86 
88  context.get<EcalPedestalsRcd>().get(pPeds);
89 
90  // ADC -> GeV Scale
92  context.get<EcalADCToGeVConstantRcd>().get(pAgc);
93  const EcalADCToGeVConstant* agc = pAgc.product();
94  edm::LogInfo("Global ADC->GeV scale: EB ") << std::setprecision(6) << agc->getEBValue() << " GeV/ADC count"
95  " EE " << std::setprecision(6) << agc->getEEValue() << " GeV/ADC count";
96 
97  // use a channel to fetch values from DB
98  double r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
99  int ieta = int( 1 + r1*85 );
100  r1 = (double)std::rand()/( double(RAND_MAX)+double(1) );
101  int iphi = int( 1 + r1*20 );
102 
103  EBDetId ebid(ieta,iphi); //eta,phi
104  edm::LogInfo("EcalTrivialObjectAnalyzer: using EBDetId: ") << ebid;
105 
106  const EcalPedestals* myped=pPeds.product();
107  EcalPedestals::const_iterator it = myped->find(ebid.rawId());
108  if( it!=myped->end() ){
109  edm::LogInfo("EcalPedestal: ")
110  << " mean_x1: " << std::setprecision(8) << (*it).mean_x1 << " rms_x1: " << (*it).rms_x1
111  << " mean_x6: " <<(*it).mean_x6 << " rms_x6: " << (*it).rms_x6
112  << " mean_x12: " <<(*it).mean_x12 << " rms_x12: " << (*it).rms_x12
113  ;
114  } else {
115  edm::LogInfo("No pedestal found for this xtal! something wrong with EcalPedestals in your DB? ")
116  ;
117  }
118 
119  // fetch map of groups of xtals
121  context.get<EcalWeightXtalGroupsRcd>().get(pGrp);
122  const EcalWeightXtalGroups* grp = pGrp.product();
123 
124  EcalXtalGroupsMap::const_iterator git = grp->getMap().find( ebid.rawId() );
125  EcalXtalGroupId gid;
126  if( git != grp->getMap().end() ) {
127  edm::LogInfo("XtalGroupId.id() = ") << std::setprecision(3) << (*git).id() ;
128  gid = (*git);
129  } else {
130  edm::LogInfo("No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?")
131  ;
132  }
133 
134  // Gain Ratios
136  context.get<EcalGainRatiosRcd>().get(pRatio);
137  const EcalGainRatios* gr = pRatio.product();
138 
139  EcalGainRatioMap::const_iterator grit=gr->getMap().find(ebid.rawId());
140  EcalMGPAGainRatio mgpa;
141  if( grit!=gr->getMap().end() ){
142  mgpa = (*grit);
143 
144  edm::LogInfo("EcalMGPAGainRatio: ")
145  << "gain 12/6 : " << std::setprecision(4) << mgpa.gain12Over6() << " gain 6/1: " << mgpa.gain6Over1()
146  ;
147  } else {
148  edm::LogInfo("No MGPA Gain Ratio found for this xtal! something wrong with EcalGainRatios in your DB? ")
149  ;
150  }
151 
152  // Intercalib constants
154  context.get<EcalIntercalibConstantsRcd>().get(pIcal);
155  const EcalIntercalibConstants* ical = pIcal.product();
156 
157  EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(ebid.rawId());
158  EcalIntercalibConstant icalconst;
159  if( icalit!=ical->getMap().end() ){
160  icalconst = (*icalit);
161 
162  edm::LogInfo("EcalIntercalibConstant: ")
163  <<std::setprecision(6)
164  << icalconst
165  ;
166  } else {
167  edm::LogInfo("No intercalib const found for this xtal! something wrong with EcalIntercalibConstants in your DB? ")
168  ;
169  }
170 
171  // Intercalib errors
173  context.get<EcalIntercalibErrorsRcd>().get(pIcalErr);
174  const EcalIntercalibErrors* icalErr = pIcalErr.product();
175 
176  EcalIntercalibErrorMap::const_iterator icalitErr=icalErr->getMap().find(ebid.rawId());
177  EcalIntercalibError icalconstErr;
178  if( icalitErr!=icalErr->getMap().end() ){
179  icalconstErr = (*icalitErr);
180 
181  edm::LogInfo("EcalIntercalibError: ")
182  <<std::setprecision(6)
183  << icalconstErr
184  ;
185  } else {
186  edm::LogInfo("No intercalib const found for this xtal! something wrong with EcalIntercalibErrors in your DB? ")
187  ;
188  }
189 
190 
191 
192  { // quick and dirty for cut and paste ;) it is a test program...
193  // TimeCalib constants
195  context.get<EcalTimeCalibConstantsRcd>().get(pIcal);
196  const EcalTimeCalibConstants* ical = pIcal.product();
197 
198  EcalTimeCalibConstantMap::const_iterator icalit=ical->getMap().find(ebid.rawId());
199  EcalTimeCalibConstant icalconst;
200  if( icalit!=ical->getMap().end() ){
201  icalconst = (*icalit);
202 
203  edm::LogInfo("EcalTimeCalibConstant: ")
204  <<std::setprecision(6)
205  << icalconst
206  ;
207  } else {
208  edm::LogInfo("No intercalib const found for this xtal! something wrong with EcalTimeCalibConstants in your DB? ")
209  ;
210  }
211 
212  // TimeCalib errors
214  context.get<EcalTimeCalibErrorsRcd>().get(pIcalErr);
215  const EcalTimeCalibErrors* icalErr = pIcalErr.product();
216 
217  EcalTimeCalibErrorMap::const_iterator icalitErr=icalErr->getMap().find(ebid.rawId());
218  EcalTimeCalibError icalconstErr;
219  if( icalitErr!=icalErr->getMap().end() ){
220  icalconstErr = (*icalitErr);
221 
222  edm::LogInfo("EcalTimeCalibError: ")
223  <<std::setprecision(6)
224  << icalconstErr
225  ;
226  } else {
227  edm::LogInfo("No intercalib const found for this xtal! something wrong with EcalTimeCalibErrors in your DB? ")
228  ;
229  }
230  }
231 
232  // fetch Time Offset
233  //std::cout <<"Fetching TimeOffsetConstant from DB " << std::endl;
234 
235  // Time Offset constants
237  context.get<EcalTimeOffsetConstantRcd>().get(pTOff);
238  const EcalTimeOffsetConstant* TOff = pTOff.product();
239 
240  edm::LogInfo("EcalTimeOffsetConstant: ")
241  << " EB " << TOff->getEBValue()
242  << " EE " << TOff->getEEValue()
243  ;
244 
245  // fetch TB weights
246  edm::LogInfo("Fetching EcalTBWeights from DB ");
248  context.get<EcalTBWeightsRcd>().get(pWgts);
249  const EcalTBWeights* wgts = pWgts.product();
250  edm::LogInfo("EcalTBWeightMap.size(): ") << std::setprecision(3) << wgts->getMap().size();
251 
252 
253  // look up the correct weights for this xtal
254  //EcalXtalGroupId gid( (*git) );
255  EcalTBWeights::EcalTDCId tdcid(1);
256 
257  edm::LogInfo("Lookup EcalWeightSet for groupid: ") << std::setprecision(3)
258  << gid.id() << " and TDC id " << tdcid ;
259  EcalTBWeights::EcalTBWeightMap::const_iterator wit = wgts->getMap().find( std::make_pair(gid,tdcid) );
260  EcalWeightSet wset;
261  if( wit != wgts->getMap().end() ) {
262  wset = wit->second;
263  edm::LogInfo("check size of data members in EcalWeightSet") ;
264  //wit->second.print(std::cout);
265 
266 
267  //typedef std::vector< std::vector<EcalWeight> > EcalWeightMatrix;
268  const EcalWeightSet::EcalWeightMatrix& mat1 = wit->second.getWeightsBeforeGainSwitch();
269  const EcalWeightSet::EcalWeightMatrix& mat2 = wit->second.getWeightsAfterGainSwitch();
270 
271 // std::cout << "WeightsBeforeGainSwitch.size: " << mat1.size()
272 // << ", WeightsAfterGainSwitch.size: " << mat2.size() << std::endl;
273 
274 
275  CLHEP::HepMatrix clmat1(3,10,0);
276  CLHEP::HepMatrix clmat2(3,10,0);
277  for(int irow=0; irow<3; irow++) {
278  for(int icol=0; icol<10; icol++) {
279  clmat1[irow][icol] = mat1(irow,icol);
280  clmat2[irow][icol] = mat2(irow,icol);
281  }
282  }
283  edm::LogInfo("weight matrix before gain switch:") << clmat1;
284  edm::LogInfo("weight matrix after gain switch:") << clmat2;
285 
286  } else {
287  edm::LogInfo("No weights found for EcalGroupId: ") << gid.id() << " and EcalTDCId: " << tdcid ;
288  }
289 
290  // cluster functions/corrections
292  context.get<EcalClusterLocalContCorrParametersRcd>().get(pLocalCont);
293  const EcalClusterLocalContCorrParameters* paramLocalCont = pLocalCont.product();
294  edm::LogInfo("LocalContCorrParameters:");
295  for ( EcalFunctionParameters::const_iterator it = paramLocalCont->params().begin(); it != paramLocalCont->params().end(); ++it ) {
296  edm::LogInfo(" ") << *it;
297  }
298  // std::cout << "\n";
300  context.get<EcalClusterCrackCorrParametersRcd>().get(pCrack);
301  const EcalClusterCrackCorrParameters* paramCrack = pCrack.product();
302  edm::LogInfo("CrackCorrParameters:");
303  for ( EcalFunctionParameters::const_iterator it = paramCrack->params().begin(); it != paramCrack->params().end(); ++it ) {
304  edm::LogInfo(" ") << *it;
305  }
306  // std::cout << "\n";
308  context.get<EcalClusterEnergyCorrectionParametersRcd>().get(pEnergyCorrection);
309  const EcalClusterEnergyCorrectionParameters* paramEnergyCorrection = pEnergyCorrection.product();
310  edm::LogInfo("EnergyCorrectionParameters:");
311  for ( EcalFunctionParameters::const_iterator it = paramEnergyCorrection->params().begin(); it != paramEnergyCorrection->params().end(); ++it ) {
312  edm::LogInfo(" ") << *it;
313  }
314  // std::cout << "\n";
316  context.get<EcalClusterEnergyUncertaintyParametersRcd>().get(pEnergyUncertainty);
317  const EcalClusterEnergyUncertaintyParameters* paramEnergyUncertainty = pEnergyUncertainty.product();
318  edm::LogInfo("EnergyCorrectionParameters:");
319  for ( EcalFunctionParameters::const_iterator it = paramEnergyUncertainty->params().begin(); it != paramEnergyUncertainty->params().end(); ++it ) {
320  edm::LogInfo(" ") << *it;
321  }
322  // std::cout << "\n";
324  context.get<EcalClusterEnergyCorrectionObjectSpecificParametersRcd>().get(pEnergyCorrectionObjectSpecific);
325  const EcalClusterEnergyCorrectionObjectSpecificParameters* paramEnergyCorrectionObjectSpecific = pEnergyCorrectionObjectSpecific.product();
326  edm::LogInfo("EnergyCorrectionObjectSpecificParameters:");
327  for ( EcalFunctionParameters::const_iterator it = paramEnergyCorrectionObjectSpecific->params().begin(); it != paramEnergyCorrectionObjectSpecific->params().end(); ++it ) {
328  edm::LogInfo(" ") << *it;
329  }
330  // std::cout << "\n";
331 
332 
333  // laser correction
334 
335  // laser alphas
337  context.get<EcalLaserAlphasRcd>().get(pAlpha);
338  const EcalLaserAlphas* lalpha = pAlpha.product();
339 
341  lalphait = lalpha->getMap().find(ebid.rawId());
342  if( lalphait!=lalpha->getMap().end() ){
343  edm::LogInfo("EcalLaserAlpha: ")
344  <<std::setprecision(6)
345  << (*lalphait)
346  ;
347  } else {
348  edm::LogInfo("No laser alpha found for this xtal! something wrong with EcalLaserAlphas in your DB? ")
349  ;
350  }
351 
352  // laser apdpnref
354  context.get<EcalLaserAPDPNRatiosRefRcd>().get(pAPDPNRatiosRef);
355  const EcalLaserAPDPNRatiosRef* lref = pAPDPNRatiosRef.product();
356 
358  lrefit = lref->getMap().find(ebid.rawId());
359  if( lrefit!=lref->getMap().end() ){
360  edm::LogInfo("EcalLaserAPDPNRatiosRef: ")
361  <<std::setprecision(6)
362  << (*lrefit)
363  ;
364  } else {
365  edm::LogInfo("No laser apd/pn ref found for this xtal! something wrong with EcalLaserAPDPNRatiosRef in your DB? ")
366  ;
367  }
368 
369  // laser apdpn ratios
371  context.get<EcalLaserAPDPNRatiosRcd>().get(pAPDPNRatios);
372  const EcalLaserAPDPNRatios* lratio = pAPDPNRatios.product();
373 
375  lratioit = lratio->getLaserMap().find(ebid.rawId());
377 
378  if( lratioit!=lratio->getLaserMap().end() ){
379  lratioconst = (*lratioit);
380 
381  edm::LogInfo("EcalLaserAPDPNRatios: ")
382  // <<e.id().run() << " " << e.id().event() << " "
383  << std::setprecision(6)
384  << lratioconst.p1 << " " << lratioconst.p2
385  ;
386  } else {
387  edm::LogInfo("No laser apd/pn ratio found for this xtal! something wrong with EcalLaserAPDPNRatios in your DB? ")
388  ;
389  }
390 
391  // laser timestamps
393  // EcalLaserAPDPNRatios::EcalLaserTimeStampMap::const_iterator ltimeit;
394  for (int i=1; i<=92; i++) {
395  ltimestamp = lratio->getTimeMap()[i];
396  edm::LogInfo("i = ") << std::setprecision(6) << i
397  << ltimestamp.t1.value() << " " << ltimestamp.t2.value() << " : " ;
398  }
399  edm::LogInfo("Tests finished.");
400 
401  // channel status
402  edm::ESHandle<EcalChannelStatus> pChannelStatus;
403  context.get<EcalChannelStatusRcd>().get(pChannelStatus);
404  const EcalChannelStatus *ch_status = pChannelStatus.product();
405 
407  chit = ch_status->getMap().find(ebid.rawId());
408  if( chit != ch_status->getMap().end() ){
409  EcalChannelStatusCode ch_code = (*chit);
410  edm::LogInfo("EcalChannelStatus: ")
411  <<std::setprecision(6)
412  << ch_code.getStatusCode()
413  ;
414  } else {
415  edm::LogInfo("No channel status found for this xtal! something wrong with EcalChannelStatus in your DB? ")
416  ;
417  }
418 
419 
420  // laser transparency correction
421 
422  // Mask to ignore sample
424  context.get<EcalSampleMaskRcd>().get(pSMask);
425  const EcalSampleMask* smask = pSMask.product();
426  edm::LogInfo("Sample Mask EB ") << std::hex << smask->getEcalSampleMaskRecordEB()
427  << " EE " << std::hex << smask->getEcalSampleMaskRecordEE();
428 
429 
430 /*
431  std::cout << "make CLHEP matrices from vector<vector<Ecalweight>>" << std::endl;
432  CLHEP::HepMatrix clmat1(3,8,0);
433  CLHEP::HepMatrix clmat2(3,8,0);
434  for(int irow=0; irow<3; irow++) {
435  for(int icol=0; icol<8; icol++) {
436  clmat1[irow][icol] = (mat1[irow])[icol]();
437  clmat2[irow][icol] = (mat2[irow])[icol]();
438  }
439  }
440  std::cout << clmat1 << std::endl;
441  std::cout << clmat2 << std::endl;
442 */
443 
444 } //end of ::Analyze()
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
const self & getMap() const
Code getStatusCode() const
return decoded status
float EcalTimeCalibError
const unsigned int id() const
const EcalLaserAPDPNRatiosMap & getLaserMap() const
EcalFunctionParameters & params()
float getEcalSampleMaskRecordEE() const
float gain6Over1() const
float EcalIntercalibError
const EcalLaserTimeStampMap & getTimeMap() const
std::vector< Item >::const_iterator const_iterator
float gain12Over6() const
edm::EventID id() const
Definition: EventBase.h:59
float EcalTimeCalibConstant
float getEcalSampleMaskRecordEB() const
Signal rand(Signal arg)
Definition: vlib.cc:442
const_iterator find(uint32_t rawId) const
const EcalTBWeightMap & getMap() const
Definition: EcalTBWeights.h:31
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22
const_iterator end() const
T const * product() const
Definition: ESHandle.h:86
TimeValue_t value() const
Definition: Timestamp.h:56
float EcalIntercalibConstant