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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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, CLHEP::HepRandomEngine *)
 
void findPedestal (const DetId &detId, int gainId, double &ped) const
 
CLHEP::HepRandomEngine * randomEngine (edm::StreamID const &streamID)
 

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_
 
std::vector
< CLHEP::HepRandomEngine * > 
randomEngines_
 
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 74 of file EcalMixingModuleValidation.h.

Member Typedef Documentation

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

Definition at line 76 of file EcalMixingModuleValidation.h.

Constructor & Destructor Documentation

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

Constructor.

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

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

Destructor.

Definition at line 212 of file EcalMixingModuleValidation.cc.

212 {}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 307 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(), randomEngine(), DetId::rawId(), compare_using_db::sample, ESDetId::six(), ESDetId::siy(), ESDataFrame::size(), EcalDataFrame::size(), edm::DataFrameContainer::size(), edm::Event::streamID(), ESDetId::strip(), ESDetId::zside(), and EEDetId::zside().

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

References checkCalibrations().

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

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

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

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

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

Referenced by analyze().

708 {
709 
710  // Pedestals from event setup
711 
713  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
714  thePedestals=dbPed.product();
715 
716 }
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,
CLHEP::HepRandomEngine *  engine 
)
private

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

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 223 of file EcalMixingModuleValidation.cc.

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

223  {
224 
225  // add shapes for each bunch crossing and divide the digi by the result
226 
227  std::vector<MonitorElement *> theBunches;
228  for ( int i = 0 ; i < nBunch ; i++ ) {
229  theBunches.push_back(meEBBunchShape_[i]);
230  }
232 
233  theBunches.clear();
234 
235  for ( int i = 0 ; i < nBunch ; i++ ) {
236  theBunches.push_back(meEEBunchShape_[i]);
237  }
239 
240  theBunches.clear();
241 
242  for ( int i = 0 ; i < nBunch ; i++ ) {
243  theBunches.push_back(meESBunchShape_[i]);
244  }
246 
247 }
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 718 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().

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

Definition at line 842 of file EcalMixingModuleValidation.cc.

References edm::RandomNumberGenerator::getEngine(), cmsHarvester::index, randomEngines_, and edm::StreamID::value().

Referenced by analyze().

842  {
843  unsigned int index = streamID.value();
844  if(index >= randomEngines_.size()) {
845  randomEngines_.resize(index + 1, nullptr);
846  }
847  CLHEP::HepRandomEngine* ptr = randomEngines_[index];
848  if(!ptr) {
850  ptr = &rng->getEngine(streamID);
851  randomEngines_[index] = ptr;
852  }
853  return ptr;
854 }
std::vector< CLHEP::HepRandomEngine * > randomEngines_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.

Member Data Documentation

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

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze().

DQMStore* EcalMixingModuleValidation::dbe_
private

Definition at line 110 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

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

Definition at line 116 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 117 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 170 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

double EcalMixingModuleValidation::esBaseline_
private

Definition at line 169 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 118 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::esThreshold_
private

Definition at line 171 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 114 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::m_ESeffwei
private

Definition at line 184 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

int EcalMixingModuleValidation::m_ESgain
private

Definition at line 181 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations().

const ESIntercalibConstants* EcalMixingModuleValidation::m_ESmips
private

Definition at line 183 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

const ESPedestals* EcalMixingModuleValidation::m_ESpeds
private

Definition at line 182 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

MonitorElement* EcalMixingModuleValidation::meEBbunchCrossing_
private

Definition at line 133 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

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

Definition at line 127 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBDigiMixRatioOriggt50pc_
private

Definition at line 130 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEBShape_
private

Definition at line 143 of file EcalMixingModuleValidation.h.

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

MonitorElement* EcalMixingModuleValidation::meEBShapeRatio_
private

Definition at line 147 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meEEbunchCrossing_
private

Definition at line 134 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

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

Definition at line 128 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEDigiMixRatioOriggt40pc_
private

Definition at line 131 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

MonitorElement* EcalMixingModuleValidation::meEEShape_
private

Definition at line 144 of file EcalMixingModuleValidation.h.

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

MonitorElement* EcalMixingModuleValidation::meEEShapeRatio_
private

Definition at line 148 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

MonitorElement* EcalMixingModuleValidation::meESbunchCrossing_
private

Definition at line 135 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and EcalMixingModuleValidation().

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

Definition at line 145 of file EcalMixingModuleValidation.h.

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

MonitorElement* EcalMixingModuleValidation::meESShapeRatio_
private

Definition at line 149 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

const int EcalMixingModuleValidation::nBunch = 21
staticprivate

Definition at line 137 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation(), and endRun().

std::string EcalMixingModuleValidation::outputFile_
private

Definition at line 112 of file EcalMixingModuleValidation.h.

std::vector<CLHEP::HepRandomEngine*> EcalMixingModuleValidation::randomEngines_
private

Definition at line 186 of file EcalMixingModuleValidation.h.

Referenced by randomEngine().

CaloHitResponse* EcalMixingModuleValidation::theEBResponse
private

Definition at line 160 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EBShape* EcalMixingModuleValidation::theEBShape
private

Definition at line 154 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theEEResponse
private

Definition at line 161 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EEShape* EcalMixingModuleValidation::theEEShape
private

Definition at line 155 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theESResponse
private

Definition at line 159 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

ESShape* EcalMixingModuleValidation::theESShape
private

Definition at line 153 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations(), and EcalMixingModuleValidation().

const CaloGeometry* EcalMixingModuleValidation::theGeometry
private

Definition at line 176 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi().

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

Definition at line 151 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EcalPedestals* EcalMixingModuleValidation::thePedestals
private

Definition at line 179 of file EcalMixingModuleValidation.h.

Referenced by checkPedestals(), and findPedestal().

bool EcalMixingModuleValidation::verbose_
private

Definition at line 108 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().