CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
EcalMixingModuleValidation Class Reference

#include <EcalMixingModuleValidation.h>

Inheritance diagram for EcalMixingModuleValidation:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalMixingModuleValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalMixingModuleValidation ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &c)
 Analyze. More...
 
void beginRun (edm::Run const &, edm::EventSetup const &c)
 
void endJob (void)
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 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)
 

Private Types

typedef std::map< uint32_t,
float, std::less< uint32_t > > 
MapType
 

Private Member Functions

void bunchSumTest (std::vector< MonitorElement * > &theBunches, MonitorElement *&theTotal, MonitorElement *&theRatio, int nSample)
 
void checkCalibrations (edm::EventSetup const &c)
 
void checkPedestals (const edm::EventSetup &c)
 
void computeSDBunchDigi (const edm::EventSetup &eventSetup, MixCollection< PCaloHit > &theHits, MapType &ebSignalSimMap, const EcalSubdetector &thisDet, const double &theSimThreshold)
 
void findPedestal (const DetId &detId, int gainId, double &ped) const
 

Private Attributes

double barrelADCtoGeV_
 
DQMStoredbe_
 
edm::InputTag EBdigiCollection_
 
edm::InputTag EEdigiCollection_
 
double endcapADCtoGeV_
 
double esADCtokeV_
 
double esBaseline_
 
edm::InputTag ESdigiCollection_
 
double esThreshold_
 
std::map< int, double,
std::less< int > > 
gainConv_
 
std::string HepMCLabel
 
std::string hitsProducer_
 
double m_ESeffwei
 
int m_ESgain
 
const ESIntercalibConstantsm_ESmips
 
const ESPedestalsm_ESpeds
 
MonitorElementmeEBbunchCrossing_
 
MonitorElementmeEBBunchShape_ [nBunch]
 
MonitorElementmeEBDigiMixRatiogt100ADC_
 
MonitorElementmeEBDigiMixRatioOriggt50pc_
 
MonitorElementmeEBShape_
 
MonitorElementmeEBShapeRatio_
 
MonitorElementmeEEbunchCrossing_
 
MonitorElementmeEEBunchShape_ [nBunch]
 
MonitorElementmeEEDigiMixRatiogt100ADC_
 
MonitorElementmeEEDigiMixRatioOriggt40pc_
 
MonitorElementmeEEShape_
 
MonitorElementmeEEShapeRatio_
 
MonitorElementmeESbunchCrossing_
 
MonitorElementmeESBunchShape_ [nBunch]
 
MonitorElementmeESShape_
 
MonitorElementmeESShapeRatio_
 
std::string outputFile_
 
CaloHitResponsetheEBResponse
 
const EBShapetheEBShape
 
CaloHitResponsetheEEResponse
 
const EEShapetheEEShape
 
CaloHitResponsetheESResponse
 
ESShapetheESShape
 
const CaloGeometrytheGeometry
 
int theMaxBunch
 
int theMinBunch
 
const EcalSimParameterMaptheParameterMap
 
const EcalPedestalsthePedestals
 
bool verbose_
 

Static Private Attributes

static const int nBunch = 21
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 68 of file EcalMixingModuleValidation.h.

Member Typedef Documentation

typedef std::map<uint32_t,float,std::less<uint32_t> > EcalMixingModuleValidation::MapType
private

Definition at line 70 of file EcalMixingModuleValidation.h.

Constructor & Destructor Documentation

EcalMixingModuleValidation::EcalMixingModuleValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 24 of file EcalMixingModuleValidation.cc.

References barrelADCtoGeV_, ecalTPGAnalyzer_cfg::binOfMaximum, dbe_, endcapADCtoGeV_, gainConv_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::histo, i, meEBbunchCrossing_, meEBBunchShape_, meEBDigiMixRatiogt100ADC_, meEBDigiMixRatioOriggt50pc_, meEBShape_, meEBShapeRatio_, meEEbunchCrossing_, meEEBunchShape_, meEEDigiMixRatiogt100ADC_, meEEDigiMixRatioOriggt40pc_, meEEShape_, meEEShapeRatio_, meESbunchCrossing_, meESBunchShape_, meESShape_, meESShapeRatio_, nBunch, cppFunctionSkipper::operator, theEBResponse, theEBShape, theEEResponse, theEEShape, theESResponse, theESShape, theMaxBunch, theMinBunch, theParameterMap, and verbose_.

24  :
25  HepMCLabel(ps.getParameter<std::string>("moduleLabelMC")),
26  hitsProducer_(ps.getParameter<std::string>("hitsProducer")),
27  EBdigiCollection_(ps.getParameter<edm::InputTag>("EBdigiCollection")),
28  EEdigiCollection_(ps.getParameter<edm::InputTag>("EEdigiCollection")),
29  ESdigiCollection_(ps.getParameter<edm::InputTag>("ESdigiCollection")){
30 
31 
32  // needed for MixingModule checks
33 
34  double simHitToPhotoelectronsBarrel = ps.getParameter<double>("simHitToPhotoelectronsBarrel");
35  double simHitToPhotoelectronsEndcap = ps.getParameter<double>("simHitToPhotoelectronsEndcap");
36  double photoelectronsToAnalogBarrel = ps.getParameter<double>("photoelectronsToAnalogBarrel");
37  double photoelectronsToAnalogEndcap = ps.getParameter<double>("photoelectronsToAnalogEndcap");
38  double samplingFactor = ps.getParameter<double>("samplingFactor");
39  double timePhase = ps.getParameter<double>("timePhase");
40  int readoutFrameSize = ps.getParameter<int>("readoutFrameSize");
41  int binOfMaximum = ps.getParameter<int>("binOfMaximum");
42  bool doPhotostatistics = ps.getParameter<bool>("doPhotostatistics");
43  bool syncPhase = ps.getParameter<bool>("syncPhase");
44 
45  doPhotostatistics = false;
46 
47  theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel, simHitToPhotoelectronsEndcap,
48  photoelectronsToAnalogBarrel, photoelectronsToAnalogEndcap,
49  samplingFactor, timePhase, readoutFrameSize, binOfMaximum,
50  doPhotostatistics, syncPhase);
51  //theEcalShape = new EcalShape(timePhase);
52 
53  //theEcalResponse = new CaloHitResponse(theParameterMap, theEcalShape);
54 
55 /*
56  int ESGain = ps.getParameter<int>("ESGain");
57  double ESNoiseSigma = ps.getParameter<double> ("ESNoiseSigma");
58  int ESBaseline = ps.getParameter<int>("ESBaseline");
59  double ESMIPADC = ps.getParameter<double>("ESMIPADC");
60  double ESMIPkeV = ps.getParameter<double>("ESMIPkeV");
61 */
62 
63  theESShape = new ESShape();
64  theEBShape = new EBShape();
65  theEEShape = new EEShape();
66 
70 
71 // double effwei = 1.;
72 
73 /*
74  if (ESGain == 0)
75  effwei = 1.45;
76  else if (ESGain == 1)
77  effwei = 0.9066;
78  else if (ESGain == 2)
79  effwei = 0.8815;
80 
81  esBaseline_ = (double)ESBaseline;
82  esADCtokeV_ = 1000000.*ESMIPADC/ESMIPkeV;
83  esThreshold_ = 3.*effwei*ESNoiseSigma/esADCtokeV_;
84 */
85  theMinBunch = -10;
86  theMaxBunch = 10;
87 
88 
89  // verbosity switch
90  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
91 
92  dbe_ = 0;
93 
94  // get hold of back-end interface
95  dbe_ = edm::Service<DQMStore>().operator->();
96 
97  if ( dbe_ ) {
98  if ( verbose_ ) {
99  dbe_->setVerbose(1);
100  } else {
101  dbe_->setVerbose(0);
102  }
103  }
104 
105  if ( dbe_ ) {
106  if ( verbose_ ) dbe_->showDirStructure();
107  }
108 
109  gainConv_[1] = 1.;
110  gainConv_[2] = 2.;
111  gainConv_[3] = 12.;
112  gainConv_[0] = 12.;
113  barrelADCtoGeV_ = 0.035;
114  endcapADCtoGeV_ = 0.06;
115 
118 
121 
122  meEBbunchCrossing_ = 0;
123  meEEbunchCrossing_ = 0;
124  meESbunchCrossing_ = 0;
125 
126  for ( int i = 0 ; i < nBunch ; i++ ) {
127  meEBBunchShape_[i] = 0;
128  meEEBunchShape_[i] = 0;
129  meESBunchShape_[i] = 0;
130  }
131 
132  meEBShape_ = 0;
133  meEEShape_ = 0;
134  meESShape_ = 0;
135 
136  meEBShapeRatio_ = 0;
137  meEEShapeRatio_ = 0;
138  meESShapeRatio_ = 0;
139 
140 
141  Char_t histo[200];
142 
143 
144  if ( dbe_ ) {
145  dbe_->setCurrentFolder("EcalDigisV/EcalDigiTask");
146 
147  sprintf (histo, "EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC" ) ;
148  meEBDigiMixRatiogt100ADC_ = dbe_->book1D(histo, histo, 200, 0., 100.) ;
149 
150  sprintf (histo, "EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC" ) ;
151  meEEDigiMixRatiogt100ADC_ = dbe_->book1D(histo, histo, 200, 0., 100.) ;
152 
153  sprintf (histo, "EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun" ) ;
154  meEBDigiMixRatioOriggt50pc_ = dbe_->book1D(histo, histo, 200, 0., 100.) ;
155 
156  sprintf (histo, "EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun" ) ;
157  meEEDigiMixRatioOriggt40pc_ = dbe_->book1D(histo, histo, 200, 0., 100.) ;
158 
159  sprintf (histo, "EcalDigiTask Barrel bunch crossing" ) ;
160  meEBbunchCrossing_ = dbe_->book1D(histo, histo, 20, -10., 10.) ;
161 
162  sprintf (histo, "EcalDigiTask Endcap bunch crossing" ) ;
163  meEEbunchCrossing_ = dbe_->book1D(histo, histo, 20, -10., 10.) ;
164 
165  sprintf (histo, "EcalDigiTask Preshower bunch crossing" ) ;
166  meESbunchCrossing_ = dbe_->book1D(histo, histo, 20, -10., 10.) ;
167 
168  for ( int i = 0 ; i < nBunch ; i++ ) {
169 
170  sprintf (histo, "EcalDigiTask Barrel shape bunch crossing %02d", i-10 );
171  meEBBunchShape_[i] = dbe_->bookProfile(histo, histo, 10, 0, 10, 4000, 0., 400.);
172 
173  sprintf (histo, "EcalDigiTask Endcap shape bunch crossing %02d", i-10 );
174  meEEBunchShape_[i] = dbe_->bookProfile(histo, histo, 10, 0, 10, 4000, 0., 400.);
175 
176  sprintf (histo, "EcalDigiTask Preshower shape bunch crossing %02d", i-10 );
177  meESBunchShape_[i] = dbe_->bookProfile(histo, histo, 3, 0, 3, 4000, 0., 400.);
178 
179  }
180 
181  sprintf (histo, "EcalDigiTask Barrel shape digi");
182  meEBShape_ = dbe_->bookProfile(histo, histo, 10, 0, 10, 4000, 0., 2000.);
183 
184  sprintf (histo, "EcalDigiTask Endcap shape digi");
185  meEEShape_ = dbe_->bookProfile(histo, histo, 10, 0, 10, 4000, 0., 2000.);
186 
187  sprintf (histo, "EcalDigiTask Preshower shape digi");
188  meESShape_ = dbe_->bookProfile(histo, histo, 3, 0, 3, 4000, 0., 2000.);
189 
190  sprintf (histo, "EcalDigiTask Barrel shape digi ratio");
191  meEBShapeRatio_ = dbe_->book1D(histo, histo, 10, 0, 10.);
192 
193  sprintf (histo, "EcalDigiTask Endcap shape digi ratio");
194  meEEShapeRatio_ = dbe_->book1D(histo, histo, 10, 0, 10.);
195 
196  sprintf (histo, "EcalDigiTask Preshower shape digi ratio");
197  meESShapeRatio_ = dbe_->book1D(histo, histo, 3, 0, 3.);
198 
199  }
200 
201 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
MonitorElement * meESBunchShape_[nBunch]
Creates electronics signals from hits.
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1036
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
Definition: EBShape.h:6
std::map< int, double, std::less< int > > gainConv_
const EcalSimParameterMap * theParameterMap
void showDirStructure(void) const
Definition: DQMStore.cc:2766
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: EEShape.h:6
EcalMixingModuleValidation::~EcalMixingModuleValidation ( )

Destructor.

Definition at line 203 of file EcalMixingModuleValidation.cc.

203 {}

Member Function Documentation

void EcalMixingModuleValidation::analyze ( edm::Event const &  e,
edm::EventSetup const &  c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 298 of file EcalMixingModuleValidation.cc.

References ESSample::adc(), EcalMGPASample::adc(), barrelADCtoGeV_, checkPedestals(), computeSDBunchDigi(), EBdigiCollection_, EcalBarrel, EcalEndcap, EcalPreshower, EEdigiCollection_, endcapADCtoGeV_, esADCtokeV_, esBaseline_, ESdigiCollection_, esThreshold_, MonitorElement::Fill(), ESCondObjectContainer< T >::find(), findPedestal(), gainConv_, EcalMGPASample::gainId(), edm::Event::getByLabel(), ESCondObjectContainer< T >::getMap(), HepMCLabel, hitsProducer_, i, ESDataFrame::id(), EEDataFrame::id(), EBDataFrame::id(), EBDetId::ieta(), EBDetId::iphi(), edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), LogDebug, m_ESeffwei, m_ESmips, m_ESpeds, ESDataFrame::MAXSAMPLES, EcalDataFrame::MAXSAMPLES, meEBbunchCrossing_, meEBDigiMixRatiogt100ADC_, meEBDigiMixRatioOriggt50pc_, meEBShape_, meEEbunchCrossing_, meEEDigiMixRatiogt100ADC_, meEEDigiMixRatioOriggt40pc_, meEEShape_, meESbunchCrossing_, meESShape_, ecalTB2006H4_GenSimDigiReco_cfg::mySample, AlCaHLTBitMon_ParallelJobs::p, ESDetId::plane(), edm::Handle< T >::product(), DetId::rawId(), compare_using_db::sample, ESDetId::six(), ESDetId::siy(), ESDataFrame::size(), EcalDataFrame::size(), edm::DataFrameContainer::size(), AlCaHLTBitMon_QueryRunRegistry::string, ESDetId::strip(), ESDetId::zside(), and EEDetId::zside().

298  {
299 
300  //LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
301 
302  checkPedestals(c);
303 
304  std::vector<SimTrack> theSimTracks;
305  std::vector<SimVertex> theSimVertexes;
306 
308  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
312 
313 
314  bool skipMC = false;
315  e.getByLabel(HepMCLabel, MCEvt);
316  if (!MCEvt.isValid()) { skipMC = true; }
317 
318  const EBDigiCollection* EBdigis =0;
319  const EEDigiCollection* EEdigis =0;
320  const ESDigiCollection* ESdigis =0;
321 
322  bool isBarrel = true;
323  e.getByLabel( EBdigiCollection_, EcalDigiEB );
324  if (EcalDigiEB.isValid()) {
325  EBdigis = EcalDigiEB.product();
326  LogDebug("DigiInfo") << "total # EBdigis: " << EBdigis->size() ;
327  if ( EBdigis->size() == 0 ) isBarrel = false;
328  } else {
329  isBarrel = false;
330  }
331 
332  bool isEndcap = true;
333  e.getByLabel( EEdigiCollection_, EcalDigiEE );
334  if (EcalDigiEE.isValid()) {
335  EEdigis = EcalDigiEE.product();
336  LogDebug("DigiInfo") << "total # EEdigis: " << EEdigis->size() ;
337  if ( EEdigis->size() == 0 ) isEndcap = false;
338  } else {
339  isEndcap = false;
340  }
341 
342  bool isPreshower = true;
343  e.getByLabel( ESdigiCollection_, EcalDigiES );
344  if (EcalDigiES.isValid()) {
345  ESdigis = EcalDigiES.product();
346  LogDebug("DigiInfo") << "total # ESdigis: " << ESdigis->size() ;
347  if ( ESdigis->size() == 0 ) isPreshower = false;
348  } else {
349  isPreshower = false;
350  }
351 
352  double theGunEnergy = 0.;
353  if ( ! skipMC ) {
354  for ( HepMC::GenEvent::particle_const_iterator p = MCEvt->GetEvent()->particles_begin();
355  p != MCEvt->GetEvent()->particles_end(); ++p ) {
356 
357  theGunEnergy = (*p)->momentum().e();
358  }
359  }
360  // in case no HepMC available, assume an arbitrary average energy for an interesting "gun"
361  else {
362  edm::LogWarning("DigiInfo") << "No HepMC available, using 30 GeV as giun energy";
363  theGunEnergy = 30.;
364  }
365 
366  // BARREL
367 
368  // loop over simHits
369 
370  if ( isBarrel ) {
371 
372  const std::string barrelHitsName(hitsProducer_+"EcalHitsEB");
373  e.getByLabel("mix",barrelHitsName,crossingFrame);
374  std::auto_ptr<MixCollection<PCaloHit> >
375  barrelHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
376 
377  MapType ebSignalSimMap;
378 
379  double ebSimThreshold = 0.5*theGunEnergy;
380 
381  for (MixCollection<PCaloHit>::MixItr hitItr = barrelHits->begin () ;
382  hitItr != barrelHits->end () ;
383  ++hitItr) {
384 
385  EBDetId ebid = EBDetId(hitItr->id()) ;
386 
387  LogDebug("HitInfo")
388  << " CaloHit " << hitItr->getName() << "\n"
389  << " DetID = "<<hitItr->id()<< " EBDetId = " << ebid.ieta() << " " << ebid.iphi() << "\n"
390  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
391  << " Track Id = " << hitItr->geantTrackId() << "\n"
392  << " Energy = " << hitItr->energy();
393 
394  uint32_t crystid = ebid.rawId();
395 
396  if ( hitItr->eventId().rawId() == 0 ) ebSignalSimMap[crystid] += hitItr->energy();
397 
398  if ( meEBbunchCrossing_ ) meEBbunchCrossing_->Fill(hitItr->eventId().bunchCrossing());
399 
400  }
401 
402  // loop over Digis
403 
404  const EBDigiCollection * barrelDigi = EcalDigiEB.product () ;
405 
406  std::vector<double> ebAnalogSignal ;
407  std::vector<double> ebADCCounts ;
408  std::vector<double> ebADCGains ;
409  ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
410  ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
411  ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
412 
413  for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis) {
414 
415  EBDataFrame ebdf=(*barrelDigi)[digis];
416  int nrSamples=ebdf.size();
417 
418  EBDetId ebid = ebdf.id () ;
419 
420  double Emax = 0. ;
421  int Pmax = 0 ;
422 
423  for (int sample = 0 ; sample < nrSamples; ++sample) {
424  ebAnalogSignal[sample] = 0.;
425  ebADCCounts[sample] = 0.;
426  ebADCGains[sample] = -1.;
427  }
428 
429  for (int sample = 0 ; sample < nrSamples; ++sample) {
430 
432 
433  ebADCCounts[sample] = (mySample.adc()) ;
434  ebADCGains[sample] = (mySample.gainId ()) ;
435  ebAnalogSignal[sample] = (ebADCCounts[sample]*gainConv_[(int)ebADCGains[sample]]*barrelADCtoGeV_);
436  if (Emax < ebAnalogSignal[sample] ) {
437  Emax = ebAnalogSignal[sample] ;
438  Pmax = sample ;
439  }
440  LogDebug("DigiInfo") << "EB sample " << sample << " ADC counts = " << ebADCCounts[sample] << " Gain Id = " << ebADCGains[sample] << " Analog eq = " << ebAnalogSignal[sample];
441  }
442  double pedestalPreSampleAnalog = 0.;
443  findPedestal( ebid, (int)ebADCGains[Pmax] , pedestalPreSampleAnalog);
444  pedestalPreSampleAnalog *= gainConv_[(int)ebADCGains[Pmax]]*barrelADCtoGeV_;
445  double Erec = Emax - pedestalPreSampleAnalog;
446 
447  if ( ebSignalSimMap[ebid.rawId()] != 0. ) {
448  LogDebug("DigiInfo") << " Digi / Signal Hit = " << Erec << " / " << ebSignalSimMap[ebid.rawId()] << " gainConv " << gainConv_[(int)ebADCGains[Pmax]];
449  if ( Erec > 100.*barrelADCtoGeV_ && meEBDigiMixRatiogt100ADC_ ) meEBDigiMixRatiogt100ADC_->Fill( Erec/ebSignalSimMap[ebid.rawId()] );
450  if ( ebSignalSimMap[ebid.rawId()] > ebSimThreshold && meEBDigiMixRatioOriggt50pc_ ) meEBDigiMixRatioOriggt50pc_->Fill( Erec/ebSignalSimMap[ebid.rawId()] );
451  if ( ebSignalSimMap[ebid.rawId()] > ebSimThreshold && meEBShape_ ) {
452  for ( int i = 0; i < 10 ; i++ ) {
453  pedestalPreSampleAnalog = 0.;
454  findPedestal( ebid, (int)ebADCGains[i] , pedestalPreSampleAnalog);
455  pedestalPreSampleAnalog *= gainConv_[(int)ebADCGains[i]]*barrelADCtoGeV_;
456  meEBShape_->Fill(i, ebAnalogSignal[i]-pedestalPreSampleAnalog );
457  }
458  }
459  }
460 
461  }
462 
463  EcalSubdetector thisDet = EcalBarrel;
464  computeSDBunchDigi(c, *barrelHits, ebSignalSimMap, thisDet, ebSimThreshold);
465  }
466 
467 
468  // ENDCAP
469 
470  // loop over simHits
471 
472  if ( isEndcap ) {
473 
474  const std::string endcapHitsName(hitsProducer_+"EcalHitsEE");
475  e.getByLabel("mix",endcapHitsName,crossingFrame);
476  std::auto_ptr<MixCollection<PCaloHit> >
477  endcapHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
478 
479  MapType eeSignalSimMap;
480 
481  double eeSimThreshold = 0.4*theGunEnergy;
482 
483  for (MixCollection<PCaloHit>::MixItr hitItr = endcapHits->begin () ;
484  hitItr != endcapHits->end () ;
485  ++hitItr) {
486 
487  EEDetId eeid = EEDetId(hitItr->id()) ;
488 
489  LogDebug("HitInfo")
490  << " CaloHit " << hitItr->getName() << "\n"
491  << " DetID = "<<hitItr->id()<< " EEDetId side = " << eeid.zside() << " = " << eeid.ix() << " " << eeid.iy() << "\n"
492  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
493  << " Track Id = " << hitItr->geantTrackId() << "\n"
494  << " Energy = " << hitItr->energy();
495 
496  uint32_t crystid = eeid.rawId();
497 
498  if ( hitItr->eventId().rawId() == 0 ) eeSignalSimMap[crystid] += hitItr->energy();
499 
500  if ( meEEbunchCrossing_ ) meEEbunchCrossing_->Fill(hitItr->eventId().bunchCrossing());
501 
502  }
503 
504  // loop over Digis
505 
506  const EEDigiCollection * endcapDigi = EcalDigiEE.product () ;
507 
508  std::vector<double> eeAnalogSignal ;
509  std::vector<double> eeADCCounts ;
510  std::vector<double> eeADCGains ;
511  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
512  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
513  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
514 
515  for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis) {
516 
517  EEDataFrame eedf=(*endcapDigi)[digis];
518  int nrSamples=eedf.size();
519 
520  EEDetId eeid = eedf.id () ;
521 
522  double Emax = 0. ;
523  int Pmax = 0 ;
524 
525  for (int sample = 0 ; sample < nrSamples; ++sample) {
526  eeAnalogSignal[sample] = 0.;
527  eeADCCounts[sample] = 0.;
528  eeADCGains[sample] = -1.;
529  }
530 
531  for (int sample = 0 ; sample < nrSamples; ++sample) {
532 
533  EcalMGPASample mySample = eedf[sample];
534 
535  eeADCCounts[sample] = (mySample.adc()) ;
536  eeADCGains[sample] = (mySample.gainId()) ;
537  eeAnalogSignal[sample] = (eeADCCounts[sample]*gainConv_[(int)eeADCGains[sample]]*endcapADCtoGeV_);
538  if (Emax < eeAnalogSignal[sample] ) {
539  Emax = eeAnalogSignal[sample] ;
540  Pmax = sample ;
541  }
542  LogDebug("DigiInfo") << "EE sample " << sample << " ADC counts = " << eeADCCounts[sample] << " Gain Id = " << eeADCGains[sample] << " Analog eq = " << eeAnalogSignal[sample];
543  }
544  double pedestalPreSampleAnalog = 0.;
545  findPedestal( eeid, (int)eeADCGains[Pmax] , pedestalPreSampleAnalog);
546  pedestalPreSampleAnalog *= gainConv_[(int)eeADCGains[Pmax]]*endcapADCtoGeV_;
547  double Erec = Emax - pedestalPreSampleAnalog;
548 
549  if ( eeSignalSimMap[eeid.rawId()] != 0. ) {
550  LogDebug("DigiInfo") << " Digi / Signal Hit = " << Erec << " / " << eeSignalSimMap[eeid.rawId()] << " gainConv " << gainConv_[(int)eeADCGains[Pmax]];
551  if ( Erec > 100.*endcapADCtoGeV_ && meEEDigiMixRatiogt100ADC_ ) meEEDigiMixRatiogt100ADC_->Fill( Erec/eeSignalSimMap[eeid.rawId()] );
552  if ( eeSignalSimMap[eeid.rawId()] > eeSimThreshold && meEEDigiMixRatioOriggt40pc_ ) meEEDigiMixRatioOriggt40pc_->Fill( Erec/eeSignalSimMap[eeid.rawId()] );
553  if ( eeSignalSimMap[eeid.rawId()] > eeSimThreshold && meEBShape_ ) {
554  for ( int i = 0; i < 10 ; i++ ) {
555  pedestalPreSampleAnalog = 0.;
556  findPedestal( eeid, (int)eeADCGains[i] , pedestalPreSampleAnalog);
557  pedestalPreSampleAnalog *= gainConv_[(int)eeADCGains[i]]*endcapADCtoGeV_;
558  meEEShape_->Fill(i, eeAnalogSignal[i]-pedestalPreSampleAnalog );
559  }
560  }
561  }
562  }
563 
564  EcalSubdetector thisDet = EcalEndcap;
565  computeSDBunchDigi(c, *endcapHits, eeSignalSimMap, thisDet, eeSimThreshold);
566  }
567 
568  if ( isPreshower) {
569 
570  const std::string preshowerHitsName(hitsProducer_+"EcalHitsES");
571  e.getByLabel("mix",preshowerHitsName,crossingFrame);
572  std::auto_ptr<MixCollection<PCaloHit> >
573  preshowerHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
574 
575  MapType esSignalSimMap;
576 
577  for (MixCollection<PCaloHit>::MixItr hitItr = preshowerHits->begin () ;
578  hitItr != preshowerHits->end () ;
579  ++hitItr) {
580 
581  ESDetId esid = ESDetId(hitItr->id()) ;
582 
583  LogDebug("HitInfo")
584  << " CaloHit " << hitItr->getName() << "\n"
585  << " DetID = "<<hitItr->id()<< "ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
586  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
587  << " Track Id = " << hitItr->geantTrackId() << "\n"
588  << " Energy = " << hitItr->energy();
589 
590  uint32_t stripid = esid.rawId();
591 
592  if ( hitItr->eventId().rawId() == 0 ) esSignalSimMap[stripid] += hitItr->energy();
593 
594  if ( meESbunchCrossing_ ) meESbunchCrossing_->Fill(hitItr->eventId().bunchCrossing());
595 
596  // loop over Digis
597 
598  const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
599 
600  std::vector<double> esADCCounts ;
601  std::vector<double> esADCAnalogSignal ;
602  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
603  esADCAnalogSignal.reserve(ESDataFrame::MAXSAMPLES);
604 
605  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
606 
607  ESDataFrame esdf=(*preshowerDigi)[digis];
608  int nrSamples=esdf.size();
609 
610  ESDetId esid = esdf.id () ;
611 
612  for (int sample = 0 ; sample < nrSamples; ++sample) {
613  esADCCounts[sample] = 0.;
614  esADCAnalogSignal[sample] = 0.;
615  }
616 
617  for (int sample = 0 ; sample < nrSamples; ++sample) {
618 
619  ESSample mySample = esdf[sample];
620 
621  esADCCounts[sample] = (mySample.adc()) ;
622  esBaseline_ = m_ESpeds->find(esid)->getMean() ;
623  const double factor ( esADCtokeV_/(*(m_ESmips->getMap().find(esid)) ) ) ;
624  esThreshold_ = 3.*m_ESeffwei*( (*m_ESpeds->find(esid)).getRms())/factor;
625  esADCAnalogSignal[sample] = (esADCCounts[sample]-esBaseline_)/factor;
626  }
627  LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip();
628  for ( int i = 0; i < 3 ; i++ ) {
629  LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i] << " Analog eq = " << esADCAnalogSignal[i];
630  }
631 
632  if ( esSignalSimMap[esid.rawId()] > esThreshold_ && meESShape_ ) {
633  for ( int i = 0; i < 3 ; i++ ) {
634  meESShape_->Fill(i, esADCAnalogSignal[i] );
635  }
636  }
637 
638  }
639 
640  }
641 
642  EcalSubdetector thisDet = EcalPreshower;
643  computeSDBunchDigi(c, *preshowerHits, esSignalSimMap, thisDet, esThreshold_);
644 
645  }
646 
647 }
#define LogDebug(id)
void checkPedestals(const edm::EventSetup &c)
int i
Definition: DBlmapReader.cc:9
int strip() const
Definition: ESDetId.h:41
const ESIntercalibConstants * m_ESmips
int ix() const
Definition: EEDetId.h:77
void computeSDBunchDigi(const edm::EventSetup &eventSetup, MixCollection< PCaloHit > &theHits, MapType &ebSignalSimMap, const EcalSubdetector &thisDet, const double &theSimThreshold)
key_type id() const
Definition: EBDataFrame.h:32
void findPedestal(const DetId &detId, int gainId, double &ped) const
const ESDetId & id() const
Definition: ESDataFrame.h:21
const self & getMap() const
int six() const
Definition: ESDetId.h:37
int size() const
Definition: ESDataFrame.h:23
int gainId() const
get the gainId (2 bits)
int size() const
Definition: EcalDataFrame.h:27
void Fill(long long x)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:54
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int siy() const
Definition: ESDetId.h:39
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
const_iterator find(uint32_t rawId) const
int zside() const
Definition: EEDetId.h:71
int iy() const
Definition: EEDetId.h:83
int ieta() const
get the crystal ieta
Definition: EBDetId.h:52
int zside() const
Definition: ESDetId.h:33
bool isValid() const
Definition: HandleBase.h:76
key_type id() const
Definition: EEDataFrame.h:29
std::map< int, double, std::less< int > > gainConv_
std::map< uint32_t, float, std::less< uint32_t > > MapType
T const * product() const
Definition: Handle.h:74
int plane() const
Definition: ESDetId.h:35
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
EcalSubdetector
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49
int adc() const
get the ADC sample (12 bits)
void EcalMixingModuleValidation::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file EcalMixingModuleValidation.cc.

References checkCalibrations().

205  {
206 
208 
209 }
void checkCalibrations(edm::EventSetup const &c)
void EcalMixingModuleValidation::bunchSumTest ( std::vector< MonitorElement * > &  theBunches,
MonitorElement *&  theTotal,
MonitorElement *&  theRatio,
int  nSample 
)
private

Definition at line 240 of file EcalMixingModuleValidation.cc.

References gather_cfg::cout, MonitorElement::getBinContent(), MonitorElement::getBinError(), funct::pow(), MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), theMaxBunch, theMinBunch, and pileupDistInMC::total.

Referenced by endRun().

241 {
242 
243  std::vector<double> bunchSum;
244  bunchSum.reserve(nSample);
245  std::vector<double> bunchSumErro;
246  bunchSumErro.reserve(nSample);
247  std::vector<double> total;
248  total.reserve(nSample);
249  std::vector<double> totalErro;
250  totalErro.reserve(nSample);
251  std::vector<double> ratio;
252  ratio.reserve(nSample);
253  std::vector<double> ratioErro;
254  ratioErro.reserve(nSample);
255 
256 
257  for ( int iEl = 0 ; iEl < nSample ; iEl++ ) {
258  bunchSum[iEl] = 0.;
259  bunchSumErro[iEl] = 0.;
260  total[iEl] = 0.;
261  totalErro[iEl] = 0.;
262  ratio[iEl] = 0.;
263  ratioErro[iEl] = 0.;
264  }
265 
266  for ( int iSample = 0 ; iSample < nSample ; iSample++ ) {
267 
268  total[iSample] += theTotal->getBinContent(iSample+1);
269  totalErro[iSample] += theTotal->getBinError(iSample+1);
270 
271  for ( int iBunch = theMinBunch; iBunch <= theMaxBunch; iBunch++ ) {
272 
273  int iHisto = iBunch - theMinBunch;
274 
275  bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample+1);
276  bunchSumErro[iSample] += pow(theBunches[iHisto]->getBinError(iSample+1),2);
277 
278  }
279  bunchSumErro[iSample] = sqrt(bunchSumErro[iSample]);
280 
281  if ( bunchSum[iSample] > 0. ) {
282  ratio[iSample] = total[iSample]/bunchSum[iSample];
283  ratioErro[iSample] = sqrt(pow(totalErro[iSample]/bunchSum[iSample],2)+
284  pow((total[iSample]*bunchSumErro[iSample])/(bunchSum[iSample]*bunchSum[iSample]),2));
285  }
286 
287  std::cout << " Sample = " << iSample << " Total = " << total[iSample] << " +- " << totalErro[iSample] << "\n"
288  << " Sum = " << bunchSum[iSample] << " +- " << bunchSumErro[iSample] << "\n"
289  << " Ratio = " << ratio[iSample] << " +- " << ratioErro[iSample] << std::endl;
290 
291  theRatio->setBinContent(iSample+1, (float)ratio[iSample]);
292  theRatio->setBinError(iSample+1, (float)ratioErro[iSample]);
293 
294  }
295 
296 }
void setBinContent(int binx, double content)
set content of bin (1-D)
T sqrt(T t)
Definition: SSEVec.h:48
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
double getBinContent(int binx) const
get content of bin (1-D)
tuple cout
Definition: gather_cfg.py:121
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalMixingModuleValidation::checkCalibrations ( edm::EventSetup const &  c)
private

Definition at line 649 of file EcalMixingModuleValidation.cc.

References barrelADCtoGeV_, endcapADCtoGeV_, esADCtokeV_, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainConv_, edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), ESGain::getESGain(), ESMIPToGeVConstant::getESValueHigh(), ESMIPToGeVConstant::getESValueLow(), LogDebug, m_ESeffwei, m_ESgain, m_ESmips, m_ESpeds, edm::ESHandle< class >::product(), ESShape::setGain(), and theESShape.

Referenced by beginRun().

649  {
650 
651  // ADC -> GeV Scale
653  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
654  const EcalADCToGeVConstant* agc = pAgc.product();
655 
656  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
657 
658  gainConv_[1] = 1.;
659  gainConv_[2] = defaultRatios->gain12Over6() ;
660  gainConv_[3] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
661  gainConv_[0] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
662 
663  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " g1 = " << gainConv_[1] << "\n" << " g2 = " << gainConv_[2] << "\n" << " g3 = " << gainConv_[3];
664 
665  delete defaultRatios;
666 
667  const double barrelADCtoGeV_ = agc->getEBValue();
668  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
669  const double endcapADCtoGeV_ = agc->getEEValue();
670  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
671 
672 
673  // ES condition objects
674  edm::ESHandle<ESGain> esgain_;
676  edm::ESHandle<ESPedestals> esPedestals_;
678 
679  eventSetup.get<ESGainRcd>().get(esgain_);
680  eventSetup.get<ESMIPToGeVConstantRcd>().get(esMIPToGeV_);
681  eventSetup.get<ESPedestalsRcd>().get(esPedestals_);
682  eventSetup.get<ESIntercalibConstantsRcd>().get(esMIPs_);
683 
684  const ESGain *esgain = esgain_.product();
685  m_ESpeds = esPedestals_.product();
686  m_ESmips = esMIPs_.product();
687  const ESMIPToGeVConstant *esMipToGeV = esMIPToGeV_.product();
688  m_ESgain = (int) esgain->getESGain();
689  const double valESMIPToGeV = (m_ESgain == 1) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh();
690 
692 
693  esADCtokeV_ = 1000000.*valESMIPToGeV ;
694 
695  m_ESeffwei = ( 0 == m_ESgain ? 1.45 :
696  ( 1 == m_ESgain ? 0.9066 :
697  ( 2 == m_ESgain ? 0.8815 : 1.0 ) ) ) ;
698 
699 }
#define LogDebug(id)
const ESIntercalibConstants * m_ESmips
Definition: ESGain.h:5
void setGain(const int gain)
Definition: ESShape.h:26
float getESValueLow() const
float gain6Over1() const
std::map< int, double, std::less< int > > gainConv_
float getESGain() const
Definition: ESGain.h:11
T const * product() const
Definition: ESHandle.h:62
float gain12Over6() const
float getESValueHigh() const
void EcalMixingModuleValidation::checkPedestals ( const edm::EventSetup c)
private

Definition at line 701 of file EcalMixingModuleValidation.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), and thePedestals.

Referenced by analyze().

702 {
703 
704  // Pedestals from event setup
705 
707  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
708  thePedestals=dbPed.product();
709 
710 }
T const * product() const
Definition: ESHandle.h:62
void EcalMixingModuleValidation::computeSDBunchDigi ( const edm::EventSetup eventSetup,
MixCollection< PCaloHit > &  theHits,
MapType ebSignalSimMap,
const EcalSubdetector thisDet,
const double &  theSimThreshold 
)
private

Definition at line 742 of file EcalMixingModuleValidation.cc.

References CaloHitResponse::clear(), DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, MonitorElement::Fill(), CaloHitResponse::findSignal(), edm::EventSetup::get(), CaloGeometry::getValidDetIds(), i, CaloSamples::id(), MessageLogger_cff::limit, ESDataFrame::MAXSAMPLES, CaloSamples::MAXSAMPLES, meEBBunchShape_, meEEBunchShape_, meESBunchShape_, CaloHitResponse::run(), CaloHitResponse::setBunchRange(), CaloHitResponse::setGeometry(), EcalSimParameterMap::simParameters(), theEBResponse, theEEResponse, theESResponse, theGeometry, theMaxBunch, theMinBunch, and theParameterMap.

Referenced by analyze().

743 {
744 
745  if ( thisDet != EcalBarrel && thisDet != EcalEndcap && thisDet != EcalPreshower ) {
746  edm::LogError("EcalMMValid") << "Invalid subdetector type";
747  return;
748  }
749  //bool isCrystal = true;
750  //if ( thisDet == EcalPreshower ) isCrystal = false;
751 
752  // load the geometry
753 
754  edm::ESHandle<CaloGeometry> hGeometry;
755  eventSetup.get<CaloGeometryRecord>().get(hGeometry);
756 
757  const CaloGeometry * pGeometry = &*hGeometry;
758 
759  // see if we need to update
760  if(pGeometry != theGeometry) {
761  theGeometry = pGeometry;
762  //theEcalResponse->setGeometry(theGeometry);
766 
767  }
768 
769  // vector of DetId with energy above a fraction of the gun's energy
770 
771  const std::vector<DetId>& theSDId = theGeometry->getValidDetIds( DetId::Ecal, thisDet );
772 
773  std::vector<DetId> theOverThresholdId;
774  for ( unsigned int i = 0 ; i < theSDId.size() ; i++ ) {
775 
776  int sdId = theSDId[i].rawId();
777  if ( SignalSimMap[sdId] > theSimThreshold ) theOverThresholdId.push_back( theSDId[i] );
778 
779  }
780 
782  if ( thisDet == EcalPreshower ) limit = ESDataFrame::MAXSAMPLES;
783 
784  for (int iBunch = theMinBunch ; iBunch <= theMaxBunch ; iBunch++ ) {
785 
786  //if ( isCrystal ) {
787  if( thisDet == EcalBarrel ) {
788  theEBResponse->setBunchRange(iBunch, iBunch);
789  theEBResponse->clear();
790  theEBResponse->run(theHits);
791  }
792  else if( thisDet == EcalEndcap ) {
793  theEEResponse->setBunchRange(iBunch, iBunch);
794  theEEResponse->clear();
795  theEEResponse->run(theHits);
796  }
797  else {
798  theESResponse->setBunchRange(iBunch, iBunch);
799  theESResponse->clear();
800  theESResponse->run(theHits);
801  }
802 
803  int iHisto = iBunch - theMinBunch;
804 
805  for ( std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin() ; idItr != theOverThresholdId.end() ; ++idItr ) {
806 
807  CaloSamples * analogSignal;
808  //if ( isCrystal )
809  if( thisDet == EcalBarrel ) {
810  analogSignal = theEBResponse->findSignal(*idItr);
811  }
812  else if( thisDet == EcalEndcap ) {
813  analogSignal = theEEResponse->findSignal(*idItr);
814  }
815  else {
816  analogSignal = theESResponse->findSignal(*idItr);
817  }
818 
819  if ( analogSignal ) {
820 
821  (*analogSignal) *= theParameterMap->simParameters(analogSignal->id()).photoelectronsToAnalog();
822 
823  for ( int i = 0 ; i < limit ; i++ ) {
824  if ( thisDet == EcalBarrel ) { meEBBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
825  else if ( thisDet == EcalEndcap ) { meEEBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
826  else if ( thisDet == EcalPreshower ) { meESBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
827  }
828  }
829 
830  }
831 
832  }
833 
834  }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
int i
Definition: DBlmapReader.cc:9
static const int MAXSAMPLES
Definition: CaloSamples.h:75
virtual const CaloSimParameters & simParameters(const DetId &id) const
return the sim parameters relative to the right subdet
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
void Fill(long long x)
MonitorElement * meESBunchShape_[nBunch]
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
virtual void run(MixCollection< PCaloHit > &hits)
Complete cell digitization.
const EcalSimParameterMap * theParameterMap
const T & get() const
Definition: EventSetup.h:55
void setBunchRange(int minBunch, int maxBunch)
tells it which pileup bunches to do
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
void clear()
frees up memory
DetId id() const
get the (generic) id
Definition: CaloSamples.h:23
void EcalMixingModuleValidation::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 211 of file EcalMixingModuleValidation.cc.

211  {
212 }
void EcalMixingModuleValidation::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 214 of file EcalMixingModuleValidation.cc.

References bunchSumTest(), i, ESDataFrame::MAXSAMPLES, EcalDataFrame::MAXSAMPLES, meEBBunchShape_, meEBShape_, meEBShapeRatio_, meEEBunchShape_, meEEShape_, meEEShapeRatio_, meESBunchShape_, meESShape_, meESShapeRatio_, and nBunch.

214  {
215 
216  // add shapes for each bunch crossing and divide the digi by the result
217 
218  std::vector<MonitorElement *> theBunches;
219  for ( int i = 0 ; i < nBunch ; i++ ) {
220  theBunches.push_back(meEBBunchShape_[i]);
221  }
223 
224  theBunches.clear();
225 
226  for ( int i = 0 ; i < nBunch ; i++ ) {
227  theBunches.push_back(meEEBunchShape_[i]);
228  }
230 
231  theBunches.clear();
232 
233  for ( int i = 0 ; i < nBunch ; i++ ) {
234  theBunches.push_back(meESBunchShape_[i]);
235  }
237 
238 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
void bunchSumTest(std::vector< MonitorElement * > &theBunches, MonitorElement *&theTotal, MonitorElement *&theRatio, int nSample)
MonitorElement * meESBunchShape_[nBunch]
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49
void EcalMixingModuleValidation::findPedestal ( const DetId detId,
int  gainId,
double &  ped 
) const
private

Definition at line 712 of file EcalMixingModuleValidation.cc.

References EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), ecalMGPA::gainId(), EcalCondObjectContainer< T >::getMap(), LogDebug, DetId::rawId(), EcalCondObjectContainer< T >::size(), and thePedestals.

Referenced by analyze().

713 {
715  = thePedestals->getMap().find(detId);
716  // should I care if it doesn't get found?
717  if(mapItr == thePedestals->getMap().end()) {
718  edm::LogError("EcalMMValid") << "Could not find pedestal for " << detId.rawId() << " among the " << thePedestals->getMap().size();
719  } else {
720  EcalPedestals::Item item = (*mapItr);
721 
722  switch(gainId) {
723  case 0:
724  ped = item.mean_x1;
725  case 1:
726  ped = item.mean_x12;
727  break;
728  case 2:
729  ped = item.mean_x6;
730  break;
731  case 3:
732  ped = item.mean_x1;
733  break;
734  default:
735  edm::LogError("EcalMMValid") << "Bad Pedestal " << gainId;
736  break;
737  }
738  LogDebug("EcalMMValid") << "Pedestals for " << detId.rawId() << " gain range " << gainId << " : \n" << "Mean = " << ped;
739  }
740 }
#define LogDebug(id)
int gainId(sample_type sample)
get the gainId (2 bits)
const self & getMap() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:37
const_iterator find(uint32_t rawId) const
const_iterator end() const

Member Data Documentation

double EcalMixingModuleValidation::barrelADCtoGeV_
private
DQMStore* EcalMixingModuleValidation::dbe_
private

Definition at line 107 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

edm::InputTag EcalMixingModuleValidation::EBdigiCollection_
private

Definition at line 111 of file EcalMixingModuleValidation.h.

Referenced by analyze().

edm::InputTag EcalMixingModuleValidation::EEdigiCollection_
private

Definition at line 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::endcapADCtoGeV_
private
double EcalMixingModuleValidation::esADCtokeV_
private

Definition at line 161 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

double EcalMixingModuleValidation::esBaseline_
private

Definition at line 160 of file EcalMixingModuleValidation.h.

Referenced by analyze().

edm::InputTag EcalMixingModuleValidation::ESdigiCollection_
private

Definition at line 113 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::esThreshold_
private

Definition at line 162 of file EcalMixingModuleValidation.h.

Referenced by analyze().

std::map<int, double, std::less<int> > EcalMixingModuleValidation::gainConv_
private
std::string EcalMixingModuleValidation::HepMCLabel
private

Definition at line 102 of file EcalMixingModuleValidation.h.

Referenced by analyze().

std::string EcalMixingModuleValidation::hitsProducer_
private

Definition at line 103 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::m_ESeffwei
private

Definition at line 175 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

int EcalMixingModuleValidation::m_ESgain
private

Definition at line 172 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations().

const ESIntercalibConstants* EcalMixingModuleValidation::m_ESmips
private

Definition at line 174 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

const ESPedestals* EcalMixingModuleValidation::m_ESpeds
private

Definition at line 173 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

MonitorElement* EcalMixingModuleValidation::meEBbunchCrossing_
private

Definition at line 126 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBBunchShape_[nBunch]
private
MonitorElement* EcalMixingModuleValidation::meEBDigiMixRatiogt100ADC_
private

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBDigiMixRatioOriggt50pc_
private

Definition at line 123 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBShape_
private

Definition at line 136 of file EcalMixingModuleValidation.h.

Referenced by analyze(), EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meEBShapeRatio_
private

Definition at line 140 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meEEbunchCrossing_
private

Definition at line 127 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEBunchShape_[nBunch]
private
MonitorElement* EcalMixingModuleValidation::meEEDigiMixRatiogt100ADC_
private

Definition at line 121 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEDigiMixRatioOriggt40pc_
private

Definition at line 124 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEShape_
private

Definition at line 137 of file EcalMixingModuleValidation.h.

Referenced by analyze(), EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meEEShapeRatio_
private

Definition at line 141 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meESbunchCrossing_
private

Definition at line 128 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meESBunchShape_[nBunch]
private
MonitorElement* EcalMixingModuleValidation::meESShape_
private

Definition at line 138 of file EcalMixingModuleValidation.h.

Referenced by analyze(), EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meESShapeRatio_
private

Definition at line 142 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

const int EcalMixingModuleValidation::nBunch = 21
staticprivate

Definition at line 130 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

std::string EcalMixingModuleValidation::outputFile_
private

Definition at line 109 of file EcalMixingModuleValidation.h.

CaloHitResponse* EcalMixingModuleValidation::theEBResponse
private

Definition at line 153 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EBShape* EcalMixingModuleValidation::theEBShape
private

Definition at line 147 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theEEResponse
private

Definition at line 154 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EEShape* EcalMixingModuleValidation::theEEShape
private

Definition at line 148 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theESResponse
private

Definition at line 152 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

ESShape* EcalMixingModuleValidation::theESShape
private

Definition at line 146 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations(), and EcalMixingModuleValidation().

const CaloGeometry* EcalMixingModuleValidation::theGeometry
private

Definition at line 167 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi().

int EcalMixingModuleValidation::theMaxBunch
private
int EcalMixingModuleValidation::theMinBunch
private
const EcalSimParameterMap* EcalMixingModuleValidation::theParameterMap
private

Definition at line 144 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EcalPedestals* EcalMixingModuleValidation::thePedestals
private

Definition at line 170 of file EcalMixingModuleValidation.h.

Referenced by checkPedestals(), and findPedestal().

bool EcalMixingModuleValidation::verbose_
private

Definition at line 105 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().