CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
EcalEndcapSimHitsValidation Class Reference

#include <EcalEndcapSimHitsValidation.h>

Inheritance diagram for EcalEndcapSimHitsValidation:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

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

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void beginJob () override
 
void endJob (void) override
 
- 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

float eCluster2x2 (MapType &themap)
 
float eCluster4x4 (float e33, MapType &themap)
 
virtual float energyInMatrixEE (int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
 
bool fillEEMatrix (int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &fillmap, MapType &themap)
 
std::vector< uint32_t > getIdsAroundMax (int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
 
uint32_t getUnitWithMaxEnergy (MapType &themap)
 

Private Attributes

DQMStoredbe_
 
std::string EEHitsCollection
 
edm::EDGetTokenT< edm::PCaloHitContainerEEHitsToken
 
float eRLength [26]
 
std::string g4InfoLabel
 
MonitorElementmeEEcrystalEnergy2_
 
MonitorElementmeEEcrystalEnergy_
 
MonitorElementmeEEe16_
 
MonitorElementmeEEe16oe25_
 
MonitorElementmeEEe1_
 
MonitorElementmeEEe1oe25_
 
MonitorElementmeEEe1oe4_
 
MonitorElementmeEEe1oe9_
 
MonitorElementmeEEe25_
 
MonitorElementmeEEe4_
 
MonitorElementmeEEe4oe9_
 
MonitorElementmeEEe9_
 
MonitorElementmeEEe9oe16_
 
MonitorElementmeEEe9oe25_
 
MonitorElementmeEEHitEnergy2_
 
MonitorElementmeEEHitEnergy_
 
MonitorElementmeEEhitLog10Energy25Norm_
 
MonitorElementmeEEhitLog10Energy_
 
MonitorElementmeEEhitLog10EnergyNorm_
 
MonitorElementmeEELongitudinalShower_
 
MonitorElementmeEEzmCrystals_
 
MonitorElementmeEEzmHits_
 
MonitorElementmeEEzmOccupancy_
 
MonitorElementmeEEzpCrystals_
 
MonitorElementmeEEzpHits_
 
MonitorElementmeEEzpOccupancy_
 
int myEntries
 
std::string outputFile_
 
std::string ValidationCollection
 
edm::EDGetTokenT< PEcalValidInfoValidationCollectionToken
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 37 of file EcalEndcapSimHitsValidation.h.

Member Typedef Documentation

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

Definition at line 39 of file EcalEndcapSimHitsValidation.h.

Constructor & Destructor Documentation

EcalEndcapSimHitsValidation::EcalEndcapSimHitsValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 17 of file EcalEndcapSimHitsValidation.cc.

References dbe_, EEHitsCollection, EEHitsToken, eRLength, g4InfoLabel, edm::ParameterSet::getUntrackedParameter(), trackerHits::histo, meEEcrystalEnergy2_, meEEcrystalEnergy_, meEEe16_, meEEe16oe25_, meEEe1_, meEEe1oe25_, meEEe1oe4_, meEEe1oe9_, meEEe25_, meEEe4_, meEEe4oe9_, meEEe9_, meEEe9oe16_, meEEe9oe25_, meEEHitEnergy2_, meEEHitEnergy_, meEEhitLog10Energy25Norm_, meEEhitLog10Energy_, meEEhitLog10EnergyNorm_, meEELongitudinalShower_, meEEzmCrystals_, meEEzmHits_, meEEzmOccupancy_, meEEzpCrystals_, meEEzpHits_, meEEzpOccupancy_, myEntries, Utilities::operator, AlCaHLTBitMon_QueryRunRegistry::string, ValidationCollection, ValidationCollectionToken, and verbose_.

17  :
18  g4InfoLabel(ps.getParameter<std::string>("moduleLabelG4")),
19  EEHitsCollection(ps.getParameter<std::string>("EEHitsCollection")),
20  ValidationCollection(ps.getParameter<std::string>("ValidationCollection")){
21 
22  EEHitsToken = consumes <edm::PCaloHitContainer> (edm::InputTag(std::string(g4InfoLabel),std::string(EEHitsCollection)));
24  // verbosity switch
25  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
26 
27  // get hold of back-end interface
28  dbe_ = nullptr;
29  dbe_ = edm::Service<DQMStore>().operator->();
30  if ( dbe_ ) {
31  if ( verbose_ ) { dbe_->setVerbose(1); }
32  else { dbe_->setVerbose(0); }
33  }
34 
35  if ( dbe_ ) {
36  if ( verbose_ ) dbe_->showDirStructure();
37  }
38 
39 
40  meEEzpHits_ = nullptr;
41  meEEzmHits_ = nullptr;
42  meEEzpCrystals_ = nullptr;
43  meEEzmCrystals_ = nullptr;
44  meEEzpOccupancy_ = nullptr;
45  meEEzmOccupancy_ = nullptr;
46  meEELongitudinalShower_ = nullptr;
47  meEEHitEnergy_ = nullptr;
48  meEEhitLog10Energy_ = nullptr;
49  meEEhitLog10EnergyNorm_ = nullptr;
50  meEEhitLog10Energy25Norm_ = nullptr;
51  meEEHitEnergy2_ = nullptr;
52  meEEcrystalEnergy_ = nullptr;
53  meEEcrystalEnergy2_ = nullptr;
54 
55  meEEe1_ = nullptr;
56  meEEe4_ = nullptr;
57  meEEe9_ = nullptr;
58  meEEe16_ = nullptr;
59  meEEe25_ = nullptr;
60 
61  meEEe1oe4_ = nullptr;
62  meEEe1oe9_ = nullptr;
63  meEEe4oe9_ = nullptr;
64  meEEe9oe16_ = nullptr;
65  meEEe1oe25_ = nullptr;
66  meEEe9oe25_ = nullptr;
67  meEEe16oe25_ = nullptr;
68 
69  myEntries = 0;
70  for ( int myStep = 0; myStep<26; myStep++) { eRLength[myStep] = 0.0; }
71 
72  Char_t histo[200];
73 
74  if ( dbe_ ) {
75  dbe_->setCurrentFolder("EcalHitsV/EcalSimHitsValidation");
76 
77  sprintf (histo, "EE+ hits multiplicity" ) ;
78  meEEzpHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.) ;
79 
80  sprintf (histo, "EE- hits multiplicity" ) ;
81  meEEzmHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.) ;
82 
83  sprintf (histo, "EE+ crystals multiplicity" ) ;
84  meEEzpCrystals_ = dbe_->book1D(histo, histo, 200, 0., 2000.) ;
85 
86  sprintf (histo, "EE- crystals multiplicity" ) ;
87  meEEzmCrystals_ = dbe_->book1D(histo, histo, 200, 0., 2000.) ;
88 
89  sprintf (histo, "EE+ occupancy" ) ;
90  meEEzpOccupancy_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
91 
92  sprintf (histo, "EE- occupancy" ) ;
93  meEEzmOccupancy_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
94 
95  sprintf (histo, "EE longitudinal shower profile" ) ;
96  meEELongitudinalShower_ = dbe_->bookProfile(histo, histo, 26,0,26, 100, 0, 20000);
97 
98  sprintf (histo, "EE hits energy spectrum" );
99  meEEHitEnergy_ = dbe_->book1D(histo, histo, 4000, 0., 400.);
100 
101  sprintf (histo, "EE hits log10energy spectrum" );
102  meEEhitLog10Energy_ = dbe_->book1D(histo, histo, 140, -10., 4.);
103 
104  sprintf (histo, "EE hits log10energy spectrum vs normalized energy" );
105  meEEhitLog10EnergyNorm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
106 
107  sprintf (histo, "EE hits log10energy spectrum vs normalized energy25" );
108  meEEhitLog10Energy25Norm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
109 
110  sprintf (histo, "EE hits energy spectrum 2" );
111  meEEHitEnergy2_ = dbe_->book1D(histo, histo, 1000, 0., 0.001);
112 
113  sprintf (histo, "EE crystal energy spectrum" );
114  meEEcrystalEnergy_ = dbe_->book1D(histo, histo, 5000, 0., 50.);
115 
116  sprintf (histo, "EE crystal energy spectrum 2" );
117  meEEcrystalEnergy2_ = dbe_->book1D(histo, histo, 1000, 0., 0.001);
118 
119  sprintf (histo, "EE E1" ) ;
120  meEEe1_ = dbe_->book1D(histo, histo, 400, 0., 400.);
121 
122  sprintf (histo, "EE E4" ) ;
123  meEEe4_ = dbe_->book1D(histo, histo, 400, 0., 400.);
124 
125  sprintf (histo, "EE E9" ) ;
126  meEEe9_ = dbe_->book1D(histo, histo, 400, 0., 400.);
127 
128  sprintf (histo, "EE E16" ) ;
129  meEEe16_ = dbe_->book1D(histo, histo, 400, 0., 400.);
130 
131  sprintf (histo, "EE E25" ) ;
132  meEEe25_ = dbe_->book1D(histo, histo, 400, 0., 400.);
133 
134  sprintf (histo, "EE E1oE4" ) ;
135  meEEe1oe4_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
136 
137  sprintf (histo, "EE E1oE9" ) ;
138  meEEe1oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
139 
140  sprintf (histo, "EE E4oE9" ) ;
141  meEEe4oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
142 
143  sprintf (histo, "EE E9oE16" ) ;
144  meEEe9oe16_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
145 
146  sprintf (histo, "EE E1oE25" ) ;
147  meEEe1oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
148 
149  sprintf (histo, "EE E9oE25" ) ;
150  meEEe9oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
151 
152  sprintf (histo, "EE E16oE25" ) ;
153  meEEe16oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
154  }
155 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsToken
EcalEndcapSimHitsValidation::~EcalEndcapSimHitsValidation ( )
override

Destructor.

Definition at line 157 of file EcalEndcapSimHitsValidation.cc.

157  {
158 
159 }

Member Function Documentation

void EcalEndcapSimHitsValidation::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Analyze.

Definition at line 173 of file EcalEndcapSimHitsValidation.cc.

References eCluster2x2(), eCluster4x4(), PEcalValidInfo::ee1x1(), EEHitsToken, energyInMatrixEE(), eRLength, edm::EventID::event(), PEcalValidInfo::eX0(), MonitorElement::Fill(), fillEEMatrix(), edm::Event::getByToken(), getIdsAroundMax(), getUnitWithMaxEnergy(), mps_fire::i, edm::EventBase::id(), createfilelist::int, edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), LogDebug, genParticles_cff::map, meEEcrystalEnergy2_, meEEcrystalEnergy_, meEEe16_, meEEe16oe25_, meEEe1_, meEEe1oe25_, meEEe1oe4_, meEEe1oe9_, meEEe25_, meEEe4_, meEEe4oe9_, meEEe9_, meEEe9oe16_, meEEe9oe25_, meEEHitEnergy2_, meEEHitEnergy_, meEEhitLog10Energy25Norm_, meEEhitLog10Energy_, meEEhitLog10EnergyNorm_, meEELongitudinalShower_, meEEzmCrystals_, meEEzmHits_, meEEzmOccupancy_, meEEzpCrystals_, meEEzpHits_, meEEzpOccupancy_, myEntries, MonitorElement::Reset(), edm::EventID::run(), ValidationCollectionToken, and EEDetId::zside().

173  {
174 
175  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
176 
178  e.getByToken(EEHitsToken,EcalHitsEE);
179 
180  // Do nothing if no EndCap data available
181  if( ! EcalHitsEE.isValid() ) return;
182 
183  edm::Handle<PEcalValidInfo> MyPEcalValidInfo;
184  e.getByToken(ValidationCollectionToken,MyPEcalValidInfo);
185 
186  std::vector<PCaloHit> theEECaloHits;
187  theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
188 
189  myEntries++;
190 
191  std::map<unsigned int, std::vector<PCaloHit*>,std::less<unsigned int> > CaloHitMap;
192 
193  double EEetzp_ = 0.;
194  double EEetzm_ = 0.;
195 
196  double ee1 = 0.0;
197  double ee4 = 0.0;
198  double ee9 = 0.0;
199  double ee16 = 0.0;
200  double ee25 = 0.0;
201  std::vector<double> econtr(140, 0. );
202  std::vector<double> econtr25(140, 0. );
203 
204  MapType eemap;
205  MapType eemapzp;
206  MapType eemapzm;
207  uint32_t nEEzpHits = 0;
208  uint32_t nEEzmHits = 0;
209 
210  for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin();
211  isim != theEECaloHits.end(); ++isim){
212 
213  if ( isim->time() > 500. ) { continue; }
214 
215  CaloHitMap[ isim->id()].push_back(&(*isim));
216 
217  EEDetId eeid (isim->id()) ;
218 
219  LogDebug("HitInfo")
220  << " CaloHit " << isim->getName() << "\n"
221  << " DetID = "<<isim->id()<< " EEDetId = " << eeid.ix() << " " << eeid.iy() << "\n"
222  << " Time = " << isim->time() << "\n"
223  << " Track Id = " << isim->geantTrackId() << "\n"
224  << " Energy = " << isim->energy();
225 
226  uint32_t crystid = eeid.rawId();
227 
228  if (eeid.zside() > 0 ) {
229  nEEzpHits++;
230  EEetzp_ += isim->energy();
231  eemapzp[crystid] += isim->energy();
232  if (meEEzpOccupancy_) meEEzpOccupancy_->Fill(eeid.ix(), eeid.iy());
233  }
234  else if (eeid.zside() < 0 ) {
235  nEEzmHits++;
236  EEetzm_ += isim->energy();
237  eemapzm[crystid] += isim->energy();
238  if (meEEzmOccupancy_) meEEzmOccupancy_->Fill(eeid.ix(), eeid.iy());
239  }
240 
241  if (meEEHitEnergy_) meEEHitEnergy_->Fill(isim->energy());
242  if( isim->energy() > 0 ) {
243  if( meEEhitLog10Energy_ ) meEEhitLog10Energy_->Fill(log10(isim->energy()));
244  int log10i = int( ( log10(isim->energy()) + 10. ) * 10. );
245  if( log10i >=0 && log10i < 140 ) econtr[log10i] += isim->energy();
246  }
247  if (meEEHitEnergy2_) meEEHitEnergy2_->Fill(isim->energy());
248  eemap[crystid] += isim->energy();
249 
250 
251  }
252 
253  if (meEEzpCrystals_) meEEzpCrystals_->Fill(eemapzp.size());
254  if (meEEzmCrystals_) meEEzmCrystals_->Fill(eemapzm.size());
255 
256  if (meEEcrystalEnergy_) {
257  for (std::map<uint32_t,float,std::less<uint32_t> >::iterator it = eemap.begin(); it != eemap.end(); ++it ) meEEcrystalEnergy_->Fill((*it).second);
258  }
259  if (meEEcrystalEnergy2_) {
260  for (std::map<uint32_t,float,std::less<uint32_t> >::iterator it = eemap.begin(); it != eemap.end(); ++it ) meEEcrystalEnergy2_->Fill((*it).second);
261  }
262 
263  if (meEEzpHits_) meEEzpHits_->Fill(nEEzpHits);
264  if (meEEzmHits_) meEEzmHits_->Fill(nEEzmHits);
265 
266 
267  int nEEHits = nEEzmHits + nEEzpHits;
268  if (nEEHits > 0) {
269 
270  uint32_t eecenterid = getUnitWithMaxEnergy(eemap);
271  EEDetId myEEid(eecenterid);
272  int bx = myEEid.ix();
273  int by = myEEid.iy();
274  int bz = myEEid.zside();
275  ee1 = energyInMatrixEE(1,1,bx,by,bz,eemap);
276  if (meEEe1_) meEEe1_->Fill(ee1);
277  ee9 = energyInMatrixEE(3,3,bx,by,bz,eemap);
278  if (meEEe9_) meEEe9_->Fill(ee9);
279  ee25= energyInMatrixEE(5,5,bx,by,bz,eemap);
280  if (meEEe25_) meEEe25_->Fill(ee25);
281 
282  std::vector<uint32_t> ids25; ids25 = getIdsAroundMax(5,5,bx,by,bz,eemap);
283 
284  for( unsigned i=0; i<25; i++ ) {
285  for( unsigned int j=0; j<CaloHitMap[ids25[i]].size(); j++ ) {
286  if( CaloHitMap[ids25[i]][j]->energy() > 0 ) {
287  int log10i = int( ( log10( CaloHitMap[ids25[i]][j]->energy()) + 10. ) * 10. );
288  if( log10i >=0 && log10i < 140 ) econtr25[log10i] += CaloHitMap[ids25[i]][j]->energy();
289  }
290  }
291  }
292 
293  MapType neweemap;
294  if( fillEEMatrix(3,3,bx,by,bz,neweemap, eemap)){
295  ee4 = eCluster2x2(neweemap);
296  if (meEEe4_) meEEe4_->Fill(ee4);
297  }
298  if( fillEEMatrix(5,5,bx,by,bz,neweemap, eemap)){
299  ee16 = eCluster4x4(ee9,neweemap);
300  if (meEEe16_) meEEe16_->Fill(ee16);
301  }
302 
303  if (meEEe1oe4_ && ee4 > 0.1 ) meEEe1oe4_ ->Fill(ee1/ee4);
304  if (meEEe1oe9_ && ee9 > 0.1 ) meEEe1oe9_ ->Fill(ee1/ee9);
305  if (meEEe4oe9_ && ee9 > 0.1 ) meEEe4oe9_ ->Fill(ee4/ee9);
306  if (meEEe9oe16_ && ee16 > 0.1 ) meEEe9oe16_ ->Fill(ee9/ee16);
307  if (meEEe16oe25_ && ee25 > 0.1 ) meEEe16oe25_->Fill(ee16/ee25);
308  if (meEEe1oe25_ && ee25 > 0.1 ) meEEe1oe25_ ->Fill(ee1/ee25);
309  if (meEEe9oe25_ && ee25 > 0.1 ) meEEe9oe25_ ->Fill(ee9/ee25);
310 
311  if( meEEhitLog10EnergyNorm_ && (EEetzp_+EEetzm_) != 0 ) {
312  for( int i=0; i<140; i++ ) {
313  meEEhitLog10EnergyNorm_->Fill( -10.+(float(i)+0.5)/10., econtr[i]/(EEetzp_+EEetzm_) );
314  }
315  }
316 
317  if( meEEhitLog10Energy25Norm_ && ee25 != 0 ) {
318  for( int i=0; i<140; i++ ) {
319  meEEhitLog10Energy25Norm_->Fill( -10.+(float(i)+0.5)/10., econtr25[i]/ee25 );
320  }
321  }
322 
323  }
324 
325  if( MyPEcalValidInfo.isValid() ) {
326  if ( MyPEcalValidInfo->ee1x1() > 0. ) {
327  std::vector<float> EX0 = MyPEcalValidInfo->eX0();
329  for (int myStep=0; myStep< 26; myStep++ ) {
330  eRLength[myStep] += EX0[myStep];
332  }
333  }
334  }
335 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
virtual float energyInMatrixEE(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
void Fill(long long x)
float eCluster4x4(float e33, MapType &themap)
void Reset()
reset ME (ie. contents, errors, etc)
bool isValid() const
Definition: HandleBase.h:74
bool fillEEMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &fillmap, MapType &themap)
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsToken
edm::EventID id() const
Definition: EventBase.h:60
uint32_t getUnitWithMaxEnergy(MapType &themap)
FloatVector eX0() const
std::map< uint32_t, float, std::less< uint32_t > > MapType
float ee1x1() const
std::vector< uint32_t > getIdsAroundMax(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
void EcalEndcapSimHitsValidation::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 161 of file EcalEndcapSimHitsValidation.cc.

161  {
162 
163 }
float EcalEndcapSimHitsValidation::eCluster2x2 ( MapType themap)
private

Definition at line 431 of file EcalEndcapSimHitsValidation.cc.

Referenced by analyze().

431  {
432  float E22=0.;
433  float e012 = themap[0]+themap[1]+themap[2];
434  float e036 = themap[0]+themap[3]+themap[6];
435  float e678 = themap[6]+themap[7]+themap[8];
436  float e258 = themap[2]+themap[5]+themap[8];
437 
438  if ( (e012>e678 || e012==e678) && (e036>e258 || e036==e258))
439  return E22=themap[0]+themap[1]+themap[3]+themap[4];
440  else if ( (e012>e678 || e012==e678) && (e036<e258 || e036==e258) )
441  return E22=themap[1]+themap[2]+themap[4]+themap[5];
442  else if ( (e012<e678 || e012==e678) && (e036>e258 || e036==e258))
443  return E22=themap[3]+themap[4]+themap[6]+themap[7];
444  else if ( (e012<e678|| e012==e678) && (e036<e258|| e036==e258) )
445  return E22=themap[4]+themap[5]+themap[7]+themap[8];
446  else {
447  return E22;
448  }
449 }
float EcalEndcapSimHitsValidation::eCluster4x4 ( float  e33,
MapType themap 
)
private

Definition at line 451 of file EcalEndcapSimHitsValidation.cc.

Referenced by analyze().

451  {
452  float E44=0.;
453  float e0_4 = themap[0]+themap[1]+themap[2]+themap[3]+themap[4];
454  float e0_20 = themap[0]+themap[5]+themap[10]+themap[15]+themap[20];
455  float e4_24 = themap[4]+themap[9]+themap[14]+themap[19]+themap[24];
456  float e0_24 = themap[20]+themap[21]+themap[22]+themap[23]+themap[24];
457 
458  if ((e0_4>e0_24 || e0_4==e0_24) && (e0_20>e4_24|| e0_20==e4_24))
459  return E44=e33+themap[0]+themap[1]+themap[2]+themap[3]+themap[5]+themap[10]+themap[15];
460  else if ((e0_4>e0_24 || e0_4==e0_24) && (e0_20<e4_24 || e0_20==e4_24))
461  return E44=e33+themap[1]+themap[2]+themap[3]+themap[4]+themap[9]+themap[14]+themap[19];
462  else if ((e0_4<e0_24|| e0_4==e0_24) && (e0_20>e4_24 || e0_20==e4_24))
463  return E44=e33+themap[5]+themap[10]+themap[15]+themap[20]+themap[21]+themap[22]+themap[23];
464  else if ((e0_4<e0_24|| e0_4==e0_24) && (e0_20<e4_24 || e0_20==e4_24))
465  return E44=e33+themap[21]+themap[22]+themap[23]+themap[24]+themap[9]+themap[14]+themap[19];
466  else{
467  return E44;
468  }
469 }
void EcalEndcapSimHitsValidation::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 165 of file EcalEndcapSimHitsValidation.cc.

165  {
166 
167  //for ( int myStep = 0; myStep<26; myStep++){
168  // if (meEELongitudinalShower_) meEELongitudinalShower_->Fill(float(myStep), eRLength[myStep]/myEntries);
169  //}
170 
171 }
float EcalEndcapSimHitsValidation::energyInMatrixEE ( int  nCellInX,
int  nCellInY,
int  centralX,
int  centralY,
int  centralZ,
MapType themap 
)
privatevirtual

Definition at line 337 of file EcalEndcapSimHitsValidation.cc.

References LogDebug, DetId::rawId(), and EEDetId::validDetId().

Referenced by analyze().

339  {
340 
341  int ncristals = 0;
342  float totalEnergy = 0.;
343 
344  int goBackInX = nCellInX/2;
345  int goBackInY = nCellInY/2;
346  int startX = centralX-goBackInX;
347  int startY = centralY-goBackInY;
348 
349  for (int ix=startX; ix<startX+nCellInX; ix++) {
350  for (int iy=startY; iy<startY+nCellInY; iy++) {
351  uint32_t index ;
352 
353  if(EEDetId::validDetId(ix,iy,centralZ)) {
354  index = EEDetId(ix,iy,centralZ).rawId();
355  }
356  else { continue; }
357 
358  totalEnergy += themap[index];
359  ncristals += 1;
360  }
361  }
362 
363  LogDebug("GeomInfo")
364  << nCellInX << " x " << nCellInY
365  << " EE matrix energy = " << totalEnergy
366  << " for " << ncristals << " crystals";
367  return totalEnergy;
368 
369 }
#define LogDebug(id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
bool EcalEndcapSimHitsValidation::fillEEMatrix ( int  nCellInX,
int  nCellInY,
int  CentralX,
int  CentralY,
int  CentralZ,
MapType fillmap,
MapType themap 
)
private

Definition at line 398 of file EcalEndcapSimHitsValidation.cc.

References getUnitWithMaxEnergy(), mps_fire::i, DetId::rawId(), and EEDetId::validDetId().

Referenced by analyze().

401 {
402  int goBackInX = nCellInX/2;
403  int goBackInY = nCellInY/2;
404 
405  int startX = CentralX - goBackInX;
406  int startY = CentralY - goBackInY;
407 
408  int i = 0 ;
409  for ( int ix = startX; ix < startX+nCellInX; ix ++ ) {
410 
411  for( int iy = startY; iy < startY + nCellInY; iy++ ) {
412 
413  uint32_t index ;
414 
415  if(EEDetId::validDetId(ix,iy,CentralZ)) {
416  index = EEDetId(ix,iy,CentralZ).rawId();
417  }
418  else { continue; }
419  fillmap[i++] = themap[index];
420  }
421  }
422  uint32_t centerid = getUnitWithMaxEnergy(themap);
423 
424  if ( fillmap[i/2] == themap[centerid] )
425  return true;
426  else
427  return false;
428 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
uint32_t getUnitWithMaxEnergy(MapType &themap)
std::vector< uint32_t > EcalEndcapSimHitsValidation::getIdsAroundMax ( int  nCellInX,
int  nCellInY,
int  centralX,
int  centralY,
int  centralZ,
MapType themap 
)
private

Definition at line 371 of file EcalEndcapSimHitsValidation.cc.

References DetId::rawId(), and EEDetId::validDetId().

Referenced by analyze().

371  {
372 
373  int ncristals = 0;
374  std::vector<uint32_t> ids( nCellInX*nCellInY );
375 
376  int goBackInX = nCellInX/2;
377  int goBackInY = nCellInY/2;
378  int startX = centralX-goBackInX;
379  int startY = centralY-goBackInY;
380 
381  for (int ix=startX; ix<startX+nCellInX; ix++) {
382  for (int iy=startY; iy<startY+nCellInY; iy++) {
383  uint32_t index ;
384 
385  if(EEDetId::validDetId(ix,iy,centralZ)) {
386  index = EEDetId(ix,iy,centralZ).rawId();
387  }
388  else { continue; }
389 
390  ids[ncristals] = index;
391  ncristals += 1;
392  }
393  }
394 
395  return ids;
396 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
uint32_t EcalEndcapSimHitsValidation::getUnitWithMaxEnergy ( MapType themap)
private

Definition at line 471 of file EcalEndcapSimHitsValidation.cc.

References LogDebug, and particleFlowClusterECALTimeSelected_cfi::maxEnergy.

Referenced by analyze(), and fillEEMatrix().

471  {
472 
473  //look for max
474  uint32_t unitWithMaxEnergy = 0;
475  float maxEnergy = 0.;
476 
477  MapType::iterator iter;
478  for (iter = themap.begin(); iter != themap.end(); iter++) {
479 
480  if (maxEnergy < (*iter).second) {
481  maxEnergy = (*iter).second;
482  unitWithMaxEnergy = (*iter).first;
483  }
484  }
485 
486  LogDebug("GeomInfo")
487  << " max energy of " << maxEnergy
488  << " GeV in Unit id " << unitWithMaxEnergy;
489  return unitWithMaxEnergy;
490 }
#define LogDebug(id)

Member Data Documentation

DQMStore* EcalEndcapSimHitsValidation::dbe_
private

Definition at line 88 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::EEHitsCollection
private

Definition at line 80 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> EcalEndcapSimHitsValidation::EEHitsToken
private

Definition at line 83 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

float EcalEndcapSimHitsValidation::eRLength[26]
private

Definition at line 93 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::g4InfoLabel
private

Definition at line 79 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEcrystalEnergy2_
private

Definition at line 118 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEcrystalEnergy_
private

Definition at line 117 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe16_
private

Definition at line 123 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe16oe25_
private

Definition at line 132 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1_
private

Definition at line 120 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe25_
private

Definition at line 130 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe4_
private

Definition at line 126 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe9_
private

Definition at line 127 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe25_
private

Definition at line 124 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe4_
private

Definition at line 121 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe4oe9_
private

Definition at line 128 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9_
private

Definition at line 122 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9oe16_
private

Definition at line 129 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9oe25_
private

Definition at line 131 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEHitEnergy2_
private

Definition at line 115 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEHitEnergy_
private

Definition at line 106 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10Energy25Norm_
private

Definition at line 112 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10Energy_
private

Definition at line 108 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10EnergyNorm_
private

Definition at line 110 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEELongitudinalShower_
private

Definition at line 104 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmCrystals_
private

Definition at line 99 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmHits_
private

Definition at line 96 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmOccupancy_
private

Definition at line 102 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpCrystals_
private

Definition at line 98 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpHits_
private

Definition at line 95 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpOccupancy_
private

Definition at line 101 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

int EcalEndcapSimHitsValidation::myEntries
private

Definition at line 92 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::outputFile_
private

Definition at line 90 of file EcalEndcapSimHitsValidation.h.

std::string EcalEndcapSimHitsValidation::ValidationCollection
private

Definition at line 81 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

edm::EDGetTokenT<PEcalValidInfo> EcalEndcapSimHitsValidation::ValidationCollectionToken
private

Definition at line 84 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

bool EcalEndcapSimHitsValidation::verbose_
private

Definition at line 86 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().