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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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::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_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
crossingFramePCaloHitEBToken_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
crossingFramePCaloHitEEToken_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
crossingFramePCaloHitESToken_
 
DQMStoredbe_
 
edm::EDGetTokenT
< EBDigiCollection
EBdigiCollectionToken_
 
edm::EDGetTokenT
< EEDigiCollection
EEdigiCollectionToken_
 
double endcapADCtoGeV_
 
double esADCtokeV_
 
double esBaseline_
 
edm::EDGetTokenT
< ESDigiCollection
ESdigiCollectionToken_
 
double esThreshold_
 
std::map< int, double,
std::less< int > > 
gainConv_
 
edm::EDGetTokenT
< edm::HepMCProduct
HepMCToken_
 
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
 
- 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 66 of file EcalMixingModuleValidation.h.

Member Typedef Documentation

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

Definition at line 68 of file EcalMixingModuleValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 16 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_.

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

Destructor.

Definition at line 209 of file EcalMixingModuleValidation.cc.

209 {}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 304 of file EcalMixingModuleValidation.cc.

References ESSample::adc(), EcalMGPASample::adc(), barrelADCtoGeV_, checkPedestals(), computeSDBunchDigi(), crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, EBdigiCollectionToken_, EcalBarrel, EcalEndcap, EcalPreshower, EEdigiCollectionToken_, endcapADCtoGeV_, esADCtokeV_, esBaseline_, ESdigiCollectionToken_, esThreshold_, MonitorElement::Fill(), ESCondObjectContainer< T >::find(), findPedestal(), gainConv_, EcalMGPASample::gainId(), edm::Event::getByToken(), ESCondObjectContainer< T >::getMap(), HepMCToken_, 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(), ESDetId::strip(), ESDetId::zside(), and EEDetId::zside().

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

References checkCalibrations().

211  {
212 
214 
215 }
void checkCalibrations(edm::EventSetup const &c)
void EcalMixingModuleValidation::bunchSumTest ( std::vector< MonitorElement * > &  theBunches,
MonitorElement *&  theTotal,
MonitorElement *&  theRatio,
int  nSample 
)
private

Definition at line 246 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().

247 {
248 
249  std::vector<double> bunchSum;
250  bunchSum.reserve(nSample);
251  std::vector<double> bunchSumErro;
252  bunchSumErro.reserve(nSample);
253  std::vector<double> total;
254  total.reserve(nSample);
255  std::vector<double> totalErro;
256  totalErro.reserve(nSample);
257  std::vector<double> ratio;
258  ratio.reserve(nSample);
259  std::vector<double> ratioErro;
260  ratioErro.reserve(nSample);
261 
262 
263  for ( int iEl = 0 ; iEl < nSample ; iEl++ ) {
264  bunchSum[iEl] = 0.;
265  bunchSumErro[iEl] = 0.;
266  total[iEl] = 0.;
267  totalErro[iEl] = 0.;
268  ratio[iEl] = 0.;
269  ratioErro[iEl] = 0.;
270  }
271 
272  for ( int iSample = 0 ; iSample < nSample ; iSample++ ) {
273 
274  total[iSample] += theTotal->getBinContent(iSample+1);
275  totalErro[iSample] += theTotal->getBinError(iSample+1);
276 
277  for ( int iBunch = theMinBunch; iBunch <= theMaxBunch; iBunch++ ) {
278 
279  int iHisto = iBunch - theMinBunch;
280 
281  bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample+1);
282  bunchSumErro[iSample] += pow(theBunches[iHisto]->getBinError(iSample+1),2);
283 
284  }
285  bunchSumErro[iSample] = sqrt(bunchSumErro[iSample]);
286 
287  if ( bunchSum[iSample] > 0. ) {
288  ratio[iSample] = total[iSample]/bunchSum[iSample];
289  ratioErro[iSample] = sqrt(pow(totalErro[iSample]/bunchSum[iSample],2)+
290  pow((total[iSample]*bunchSumErro[iSample])/(bunchSum[iSample]*bunchSum[iSample]),2));
291  }
292 
293  std::cout << " Sample = " << iSample << " Total = " << total[iSample] << " +- " << totalErro[iSample] << "\n"
294  << " Sum = " << bunchSum[iSample] << " +- " << bunchSumErro[iSample] << "\n"
295  << " Ratio = " << ratio[iSample] << " +- " << ratioErro[iSample] << std::endl;
296 
297  theRatio->setBinContent(iSample+1, (float)ratio[iSample]);
298  theRatio->setBinError(iSample+1, (float)ratioErro[iSample]);
299 
300  }
301 
302 }
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 652 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().

652  {
653 
654  // ADC -> GeV Scale
656  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
657  const EcalADCToGeVConstant* agc = pAgc.product();
658 
659  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
660 
661  gainConv_[1] = 1.;
662  gainConv_[2] = defaultRatios->gain12Over6() ;
663  gainConv_[3] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
664  gainConv_[0] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
665 
666  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " g1 = " << gainConv_[1] << "\n" << " g2 = " << gainConv_[2] << "\n" << " g3 = " << gainConv_[3];
667 
668  delete defaultRatios;
669 
670  const double barrelADCtoGeV_ = agc->getEBValue();
671  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
672  const double endcapADCtoGeV_ = agc->getEEValue();
673  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
674 
675 
676  // ES condition objects
677  edm::ESHandle<ESGain> esgain_;
679  edm::ESHandle<ESPedestals> esPedestals_;
681 
682  eventSetup.get<ESGainRcd>().get(esgain_);
683  eventSetup.get<ESMIPToGeVConstantRcd>().get(esMIPToGeV_);
684  eventSetup.get<ESPedestalsRcd>().get(esPedestals_);
685  eventSetup.get<ESIntercalibConstantsRcd>().get(esMIPs_);
686 
687  const ESGain *esgain = esgain_.product();
688  m_ESpeds = esPedestals_.product();
689  m_ESmips = esMIPs_.product();
690  const ESMIPToGeVConstant *esMipToGeV = esMIPToGeV_.product();
691  m_ESgain = (int) esgain->getESGain();
692  const double valESMIPToGeV = (m_ESgain == 1) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh();
693 
695 
696  esADCtokeV_ = 1000000.*valESMIPToGeV ;
697 
698  m_ESeffwei = ( 0 == m_ESgain ? 1.45 :
699  ( 1 == m_ESgain ? 0.9066 :
700  ( 2 == m_ESgain ? 0.8815 : 1.0 ) ) ) ;
701 
702 }
#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 704 of file EcalMixingModuleValidation.cc.

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

Referenced by analyze().

705 {
706 
707  // Pedestals from event setup
708 
710  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
711  thePedestals=dbPed.product();
712 
713 }
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 745 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().

746 {
747 
748  if ( thisDet != EcalBarrel && thisDet != EcalEndcap && thisDet != EcalPreshower ) {
749  edm::LogError("EcalMMValid") << "Invalid subdetector type";
750  return;
751  }
752  //bool isCrystal = true;
753  //if ( thisDet == EcalPreshower ) isCrystal = false;
754 
755  // load the geometry
756 
757  edm::ESHandle<CaloGeometry> hGeometry;
758  eventSetup.get<CaloGeometryRecord>().get(hGeometry);
759 
760  const CaloGeometry * pGeometry = &*hGeometry;
761 
762  // see if we need to update
763  if(pGeometry != theGeometry) {
764  theGeometry = pGeometry;
765  //theEcalResponse->setGeometry(theGeometry);
769 
770  }
771 
772  // vector of DetId with energy above a fraction of the gun's energy
773 
774  const std::vector<DetId>& theSDId = theGeometry->getValidDetIds( DetId::Ecal, thisDet );
775 
776  std::vector<DetId> theOverThresholdId;
777  for ( unsigned int i = 0 ; i < theSDId.size() ; i++ ) {
778 
779  int sdId = theSDId[i].rawId();
780  if ( SignalSimMap[sdId] > theSimThreshold ) theOverThresholdId.push_back( theSDId[i] );
781 
782  }
783 
785  if ( thisDet == EcalPreshower ) limit = ESDataFrame::MAXSAMPLES;
786 
787  for (int iBunch = theMinBunch ; iBunch <= theMaxBunch ; iBunch++ ) {
788 
789  //if ( isCrystal ) {
790  if( thisDet == EcalBarrel ) {
791  theEBResponse->setBunchRange(iBunch, iBunch);
792  theEBResponse->clear();
793  theEBResponse->run(theHits);
794  }
795  else if( thisDet == EcalEndcap ) {
796  theEEResponse->setBunchRange(iBunch, iBunch);
797  theEEResponse->clear();
798  theEEResponse->run(theHits);
799  }
800  else {
801  theESResponse->setBunchRange(iBunch, iBunch);
802  theESResponse->clear();
803  theESResponse->run(theHits);
804  }
805 
806  int iHisto = iBunch - theMinBunch;
807 
808  for ( std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin() ; idItr != theOverThresholdId.end() ; ++idItr ) {
809 
810  CaloSamples * analogSignal;
811  //if ( isCrystal )
812  if( thisDet == EcalBarrel ) {
813  analogSignal = theEBResponse->findSignal(*idItr);
814  }
815  else if( thisDet == EcalEndcap ) {
816  analogSignal = theEEResponse->findSignal(*idItr);
817  }
818  else {
819  analogSignal = theESResponse->findSignal(*idItr);
820  }
821 
822  if ( analogSignal ) {
823 
824  (*analogSignal) *= theParameterMap->simParameters(analogSignal->id()).photoelectronsToAnalog();
825 
826  for ( int i = 0 ; i < limit ; i++ ) {
827  if ( thisDet == EcalBarrel ) { meEBBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
828  else if ( thisDet == EcalEndcap ) { meEEBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
829  else if ( thisDet == EcalPreshower ) { meESBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
830  }
831  }
832 
833  }
834 
835  }
836 
837  }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
int i
Definition: DBlmapReader.cc:9
static const int MAXSAMPLES
Definition: CaloSamples.h:73
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:21
void EcalMixingModuleValidation::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 217 of file EcalMixingModuleValidation.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 220 of file EcalMixingModuleValidation.cc.

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

220  {
221 
222  // add shapes for each bunch crossing and divide the digi by the result
223 
224  std::vector<MonitorElement *> theBunches;
225  for ( int i = 0 ; i < nBunch ; i++ ) {
226  theBunches.push_back(meEBBunchShape_[i]);
227  }
229 
230  theBunches.clear();
231 
232  for ( int i = 0 ; i < nBunch ; i++ ) {
233  theBunches.push_back(meEEBunchShape_[i]);
234  }
236 
237  theBunches.clear();
238 
239  for ( int i = 0 ; i < nBunch ; i++ ) {
240  theBunches.push_back(meESBunchShape_[i]);
241  }
243 
244 }
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:48
void EcalMixingModuleValidation::findPedestal ( const DetId detId,
int  gainId,
double &  ped 
) const
private

Definition at line 715 of file EcalMixingModuleValidation.cc.

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

Referenced by analyze().

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

Member Data Documentation

double EcalMixingModuleValidation::barrelADCtoGeV_
private
edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalMixingModuleValidation::crossingFramePCaloHitEBToken_
private

Definition at line 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalMixingModuleValidation::crossingFramePCaloHitEEToken_
private

Definition at line 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalMixingModuleValidation::crossingFramePCaloHitESToken_
private

Definition at line 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

DQMStore* EcalMixingModuleValidation::dbe_
private

Definition at line 102 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

edm::EDGetTokenT<EBDigiCollection> EcalMixingModuleValidation::EBdigiCollectionToken_
private

Definition at line 108 of file EcalMixingModuleValidation.h.

Referenced by analyze().

edm::EDGetTokenT<EEDigiCollection> EcalMixingModuleValidation::EEdigiCollectionToken_
private

Definition at line 109 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 160 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

double EcalMixingModuleValidation::esBaseline_
private

Definition at line 159 of file EcalMixingModuleValidation.h.

Referenced by analyze().

edm::EDGetTokenT<ESDigiCollection> EcalMixingModuleValidation::ESdigiCollectionToken_
private

Definition at line 110 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::esThreshold_
private

Definition at line 161 of file EcalMixingModuleValidation.h.

Referenced by analyze().

std::map<int, double, std::less<int> > EcalMixingModuleValidation::gainConv_
private
edm::EDGetTokenT<edm::HepMCProduct> EcalMixingModuleValidation::HepMCToken_
private

Definition at line 106 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::m_ESeffwei
private

Definition at line 174 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

int EcalMixingModuleValidation::m_ESgain
private

Definition at line 171 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations().

const ESIntercalibConstants* EcalMixingModuleValidation::m_ESmips
private

Definition at line 173 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

const ESPedestals* EcalMixingModuleValidation::m_ESpeds
private

Definition at line 172 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

MonitorElement* EcalMixingModuleValidation::meEBbunchCrossing_
private

Definition at line 125 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

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

Definition at line 119 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBDigiMixRatioOriggt50pc_
private

Definition at line 122 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBShape_
private

Definition at line 135 of file EcalMixingModuleValidation.h.

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

MonitorElement* EcalMixingModuleValidation::meEBShapeRatio_
private

Definition at line 139 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meEEbunchCrossing_
private

Definition at line 126 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

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

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEDigiMixRatioOriggt40pc_
private

Definition at line 123 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEShape_
private

Definition at line 136 of file EcalMixingModuleValidation.h.

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

MonitorElement* EcalMixingModuleValidation::meEEShapeRatio_
private

Definition at line 140 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meESbunchCrossing_
private

Definition at line 127 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

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

Definition at line 137 of file EcalMixingModuleValidation.h.

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

MonitorElement* EcalMixingModuleValidation::meESShapeRatio_
private

Definition at line 141 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

const int EcalMixingModuleValidation::nBunch = 21
staticprivate

Definition at line 129 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

std::string EcalMixingModuleValidation::outputFile_
private

Definition at line 104 of file EcalMixingModuleValidation.h.

CaloHitResponse* EcalMixingModuleValidation::theEBResponse
private

Definition at line 152 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EBShape* EcalMixingModuleValidation::theEBShape
private

Definition at line 146 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theEEResponse
private

Definition at line 153 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EEShape* EcalMixingModuleValidation::theEEShape
private

Definition at line 147 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theESResponse
private

Definition at line 151 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

ESShape* EcalMixingModuleValidation::theESShape
private

Definition at line 145 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations(), and EcalMixingModuleValidation().

const CaloGeometry* EcalMixingModuleValidation::theGeometry
private

Definition at line 166 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi().

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

Definition at line 143 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EcalPedestals* EcalMixingModuleValidation::thePedestals
private

Definition at line 169 of file EcalMixingModuleValidation.h.

Referenced by checkPedestals(), and findPedestal().

bool EcalMixingModuleValidation::verbose_
private

Definition at line 100 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().