CMS 3D CMS Logo

List of all members | Public Types | 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 Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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

- 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 35 of file EcalEndcapSimHitsValidation.h.

Member Typedef Documentation

Definition at line 39 of file EcalEndcapSimHitsValidation.h.

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

Definition at line 36 of file EcalEndcapSimHitsValidation.h.

Definition at line 40 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(), timingPdfMaker::histo, HLT_2018_cff::InputTag, 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_.

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

Destructor.

Definition at line 156 of file EcalEndcapSimHitsValidation.cc.

156 {}

Member Function Documentation

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

Analyze.

Definition at line 167 of file EcalEndcapSimHitsValidation.cc.

References l1GtPatternGenerator_cfi::bx, eCluster2x2(), eCluster4x4(), PEcalValidInfo::ee1x1(), EEHitsToken, HCALHighEnergyHPDFilter_cfi::energy, energyInMatrixEE(), eRLength, edm::EventID::event(), PEcalValidInfo::eX0(), dqm::impl::MonitorElement::Fill(), fillEEMatrix(), edm::Event::getByToken(), getIdsAroundMax(), getUnitWithMaxEnergy(), mps_fire::i, edm::EventBase::id(), createfilelist::int, edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), dqmiolumiharvest::j, 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, dqm::impl::MonitorElement::Reset(), edm::EventID::run(), ValidationCollectionToken, and EEDetId::zside().

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

158 {}
float EcalEndcapSimHitsValidation::eCluster2x2 ( MapType themap)
private

Definition at line 439 of file EcalEndcapSimHitsValidation.cc.

Referenced by analyze().

439  {
440  float E22 = 0.;
441  float e012 = themap[0] + themap[1] + themap[2];
442  float e036 = themap[0] + themap[3] + themap[6];
443  float e678 = themap[6] + themap[7] + themap[8];
444  float e258 = themap[2] + themap[5] + themap[8];
445 
446  if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
447  return E22 = themap[0] + themap[1] + themap[3] + themap[4];
448  else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
449  return E22 = themap[1] + themap[2] + themap[4] + themap[5];
450  else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
451  return E22 = themap[3] + themap[4] + themap[6] + themap[7];
452  else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
453  return E22 = themap[4] + themap[5] + themap[7] + themap[8];
454  else {
455  return E22;
456  }
457 }
float EcalEndcapSimHitsValidation::eCluster4x4 ( float  e33,
MapType themap 
)
private

Definition at line 459 of file EcalEndcapSimHitsValidation.cc.

Referenced by analyze().

459  {
460  float E44 = 0.;
461  float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
462  float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
463  float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
464  float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
465 
466  if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
467  return E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
468  else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
469  return E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
470  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
471  return E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
472  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
473  return E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
474  else {
475  return E44;
476  }
477 }
void EcalEndcapSimHitsValidation::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file EcalEndcapSimHitsValidation.cc.

160  {
161  // for ( int myStep = 0; myStep<26; myStep++){
162  // if (meEELongitudinalShower_) meEELongitudinalShower_->Fill(float(myStep),
163  // eRLength[myStep]/myEntries);
164  //}
165 }
float EcalEndcapSimHitsValidation::energyInMatrixEE ( int  nCellInX,
int  nCellInY,
int  centralX,
int  centralY,
int  centralZ,
MapType themap 
)
privatevirtual

Definition at line 352 of file EcalEndcapSimHitsValidation.cc.

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

Referenced by analyze().

353  {
354  int ncristals = 0;
355  float totalEnergy = 0.;
356 
357  int goBackInX = nCellInX / 2;
358  int goBackInY = nCellInY / 2;
359  int startX = centralX - goBackInX;
360  int startY = centralY - goBackInY;
361 
362  for (int ix = startX; ix < startX + nCellInX; ix++) {
363  for (int iy = startY; iy < startY + nCellInY; iy++) {
364  uint32_t index;
365 
366  if (EEDetId::validDetId(ix, iy, centralZ)) {
367  index = EEDetId(ix, iy, centralZ).rawId();
368  } else {
369  continue;
370  }
371 
372  totalEnergy += themap[index];
373  ncristals += 1;
374  }
375  }
376 
377  LogDebug("GeomInfo") << nCellInX << " x " << nCellInY << " EE matrix energy = " << totalEnergy << " for " << ncristals
378  << " crystals";
379  return totalEnergy;
380 }
#define LogDebug(id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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 410 of file EcalEndcapSimHitsValidation.cc.

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

Referenced by analyze().

411  {
412  int goBackInX = nCellInX / 2;
413  int goBackInY = nCellInY / 2;
414 
415  int startX = CentralX - goBackInX;
416  int startY = CentralY - goBackInY;
417 
418  int i = 0;
419  for (int ix = startX; ix < startX + nCellInX; ix++) {
420  for (int iy = startY; iy < startY + nCellInY; iy++) {
421  uint32_t index;
422 
423  if (EEDetId::validDetId(ix, iy, CentralZ)) {
424  index = EEDetId(ix, iy, CentralZ).rawId();
425  } else {
426  continue;
427  }
428  fillmap[i++] = themap[index];
429  }
430  }
431  uint32_t centerid = getUnitWithMaxEnergy(themap);
432 
433  if (fillmap[i / 2] == themap[centerid])
434  return true;
435  else
436  return false;
437 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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 382 of file EcalEndcapSimHitsValidation.cc.

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

Referenced by analyze().

383  {
384  int ncristals = 0;
385  std::vector<uint32_t> ids(nCellInX * nCellInY);
386 
387  int goBackInX = nCellInX / 2;
388  int goBackInY = nCellInY / 2;
389  int startX = centralX - goBackInX;
390  int startY = centralY - goBackInY;
391 
392  for (int ix = startX; ix < startX + nCellInX; ix++) {
393  for (int iy = startY; iy < startY + nCellInY; iy++) {
394  uint32_t index;
395 
396  if (EEDetId::validDetId(ix, iy, centralZ)) {
397  index = EEDetId(ix, iy, centralZ).rawId();
398  } else {
399  continue;
400  }
401 
402  ids[ncristals] = index;
403  ncristals += 1;
404  }
405  }
406 
407  return ids;
408 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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 479 of file EcalEndcapSimHitsValidation.cc.

References LogDebug, and particleFlowClusterECALTimeSelected_cfi::maxEnergy.

Referenced by analyze(), and fillEEMatrix().

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

Member Data Documentation

DQMStore* EcalEndcapSimHitsValidation::dbe_
private

Definition at line 81 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::EEHitsCollection
private

Definition at line 73 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

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

Definition at line 76 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

float EcalEndcapSimHitsValidation::eRLength[26]
private

Definition at line 86 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::g4InfoLabel
private

Definition at line 72 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEcrystalEnergy2_
private

Definition at line 110 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEcrystalEnergy_
private

Definition at line 109 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe16_
private

Definition at line 115 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe16oe25_
private

Definition at line 124 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1_
private

Definition at line 112 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe25_
private

Definition at line 122 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe4_
private

Definition at line 118 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe9_
private

Definition at line 119 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe25_
private

Definition at line 116 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe4_
private

Definition at line 113 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe4oe9_
private

Definition at line 120 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9_
private

Definition at line 114 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9oe16_
private

Definition at line 121 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9oe25_
private

Definition at line 123 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEHitEnergy2_
private

Definition at line 107 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEHitEnergy_
private

Definition at line 99 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10Energy25Norm_
private

Definition at line 105 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10Energy_
private

Definition at line 101 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10EnergyNorm_
private

Definition at line 103 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEELongitudinalShower_
private

Definition at line 97 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmCrystals_
private

Definition at line 92 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmHits_
private

Definition at line 89 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmOccupancy_
private

Definition at line 95 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpCrystals_
private

Definition at line 91 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpHits_
private

Definition at line 88 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpOccupancy_
private

Definition at line 94 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

int EcalEndcapSimHitsValidation::myEntries
private

Definition at line 85 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::outputFile_
private

Definition at line 83 of file EcalEndcapSimHitsValidation.h.

std::string EcalEndcapSimHitsValidation::ValidationCollection
private

Definition at line 74 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

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

Definition at line 77 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

bool EcalEndcapSimHitsValidation::verbose_
private

Definition at line 79 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().