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
 
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

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

Member Typedef Documentation

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

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

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  if (dbe_) {
32  if (verbose_) {
33  dbe_->setVerbose(1);
34  } else {
35  dbe_->setVerbose(0);
36  }
37  }
38 
39  if (dbe_) {
40  if (verbose_)
41  dbe_->showDirStructure();
42  }
43 
44  meEEzpHits_ = nullptr;
45  meEEzmHits_ = nullptr;
46  meEEzpCrystals_ = nullptr;
47  meEEzmCrystals_ = nullptr;
48  meEEzpOccupancy_ = nullptr;
49  meEEzmOccupancy_ = nullptr;
50  meEELongitudinalShower_ = nullptr;
51  meEEHitEnergy_ = nullptr;
52  meEEhitLog10Energy_ = nullptr;
53  meEEhitLog10EnergyNorm_ = nullptr;
54  meEEhitLog10Energy25Norm_ = nullptr;
55  meEEHitEnergy2_ = nullptr;
56  meEEcrystalEnergy_ = nullptr;
57  meEEcrystalEnergy2_ = nullptr;
58 
59  meEEe1_ = nullptr;
60  meEEe4_ = nullptr;
61  meEEe9_ = nullptr;
62  meEEe16_ = nullptr;
63  meEEe25_ = nullptr;
64 
65  meEEe1oe4_ = nullptr;
66  meEEe1oe9_ = nullptr;
67  meEEe4oe9_ = nullptr;
68  meEEe9oe16_ = nullptr;
69  meEEe1oe25_ = nullptr;
70  meEEe9oe25_ = nullptr;
71  meEEe16oe25_ = nullptr;
72 
73  myEntries = 0;
74  for (int myStep = 0; myStep < 26; myStep++) {
75  eRLength[myStep] = 0.0;
76  }
77 
78  Char_t histo[200];
79 
80  if (dbe_) {
81  dbe_->setCurrentFolder("EcalHitsV/EcalSimHitsValidation");
82 
83  sprintf(histo, "EE+ hits multiplicity");
84  meEEzpHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.);
85 
86  sprintf(histo, "EE- hits multiplicity");
87  meEEzmHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.);
88 
89  sprintf(histo, "EE+ crystals multiplicity");
90  meEEzpCrystals_ = dbe_->book1D(histo, histo, 200, 0., 2000.);
91 
92  sprintf(histo, "EE- crystals multiplicity");
93  meEEzmCrystals_ = dbe_->book1D(histo, histo, 200, 0., 2000.);
94 
95  sprintf(histo, "EE+ occupancy");
96  meEEzpOccupancy_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
97 
98  sprintf(histo, "EE- occupancy");
99  meEEzmOccupancy_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
100 
101  sprintf(histo, "EE longitudinal shower profile");
102  meEELongitudinalShower_ = dbe_->bookProfile(histo, histo, 26, 0, 26, 100, 0, 20000);
103 
104  sprintf(histo, "EE hits energy spectrum");
105  meEEHitEnergy_ = dbe_->book1D(histo, histo, 4000, 0., 400.);
106 
107  sprintf(histo, "EE hits log10energy spectrum");
108  meEEhitLog10Energy_ = dbe_->book1D(histo, histo, 140, -10., 4.);
109 
110  sprintf(histo, "EE hits log10energy spectrum vs normalized energy");
111  meEEhitLog10EnergyNorm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
112 
113  sprintf(histo, "EE hits log10energy spectrum vs normalized energy25");
114  meEEhitLog10Energy25Norm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
115 
116  sprintf(histo, "EE hits energy spectrum 2");
117  meEEHitEnergy2_ = dbe_->book1D(histo, histo, 1000, 0., 0.001);
118 
119  sprintf(histo, "EE crystal energy spectrum");
120  meEEcrystalEnergy_ = dbe_->book1D(histo, histo, 5000, 0., 50.);
121 
122  sprintf(histo, "EE crystal energy spectrum 2");
123  meEEcrystalEnergy2_ = dbe_->book1D(histo, histo, 1000, 0., 0.001);
124 
125  sprintf(histo, "EE E1");
126  meEEe1_ = dbe_->book1D(histo, histo, 400, 0., 400.);
127 
128  sprintf(histo, "EE E4");
129  meEEe4_ = dbe_->book1D(histo, histo, 400, 0., 400.);
130 
131  sprintf(histo, "EE E9");
132  meEEe9_ = dbe_->book1D(histo, histo, 400, 0., 400.);
133 
134  sprintf(histo, "EE E16");
135  meEEe16_ = dbe_->book1D(histo, histo, 400, 0., 400.);
136 
137  sprintf(histo, "EE E25");
138  meEEe25_ = dbe_->book1D(histo, histo, 400, 0., 400.);
139 
140  sprintf(histo, "EE E1oE4");
141  meEEe1oe4_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
142 
143  sprintf(histo, "EE E1oE9");
144  meEEe1oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
145 
146  sprintf(histo, "EE E4oE9");
147  meEEe4oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
148 
149  sprintf(histo, "EE E9oE16");
150  meEEe9oe16_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
151 
152  sprintf(histo, "EE E1oE25");
153  meEEe1oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
154 
155  sprintf(histo, "EE E9oE25");
156  meEEe9oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
157 
158  sprintf(histo, "EE E16oE25");
159  meEEe16oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
160  }
161 }
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 163 of file EcalEndcapSimHitsValidation.cc.

163 {}

Member Function Documentation

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

Analyze.

Definition at line 174 of file EcalEndcapSimHitsValidation.cc.

References eCluster2x2(), eCluster4x4(), PEcalValidInfo::ee1x1(), EEHitsToken, randomXiThetaGunProducer_cfi::energy, 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().

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())
182  return;
183 
184  edm::Handle<PEcalValidInfo> MyPEcalValidInfo;
185  e.getByToken(ValidationCollectionToken, MyPEcalValidInfo);
186 
187  std::vector<PCaloHit> theEECaloHits;
188  theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
189 
190  myEntries++;
191 
192  std::map<unsigned int, std::vector<PCaloHit *>, std::less<unsigned int>> CaloHitMap;
193 
194  double EEetzp_ = 0.;
195  double EEetzm_ = 0.;
196 
197  double ee1 = 0.0;
198  double ee4 = 0.0;
199  double ee9 = 0.0;
200  double ee16 = 0.0;
201  double ee25 = 0.0;
202  std::vector<double> econtr(140, 0.);
203  std::vector<double> econtr25(140, 0.);
204 
205  MapType eemap;
206  MapType eemapzp;
207  MapType eemapzm;
208  uint32_t nEEzpHits = 0;
209  uint32_t nEEzmHits = 0;
210 
211  for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim) {
212  if (isim->time() > 500.) {
213  continue;
214  }
215 
216  CaloHitMap[isim->id()].push_back(&(*isim));
217 
218  EEDetId eeid(isim->id());
219 
220  LogDebug("HitInfo") << " 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_)
233  meEEzpOccupancy_->Fill(eeid.ix(), eeid.iy());
234  } else if (eeid.zside() < 0) {
235  nEEzmHits++;
236  EEetzm_ += isim->energy();
237  eemapzm[crystid] += isim->energy();
238  if (meEEzmOccupancy_)
239  meEEzmOccupancy_->Fill(eeid.ix(), eeid.iy());
240  }
241 
242  if (meEEHitEnergy_)
243  meEEHitEnergy_->Fill(isim->energy());
244  if (isim->energy() > 0) {
246  meEEhitLog10Energy_->Fill(log10(isim->energy()));
247  int log10i = int((log10(isim->energy()) + 10.) * 10.);
248  if (log10i >= 0 && log10i < 140)
249  econtr[log10i] += isim->energy();
250  }
251  if (meEEHitEnergy2_)
252  meEEHitEnergy2_->Fill(isim->energy());
253  eemap[crystid] += isim->energy();
254  }
255 
256  if (meEEzpCrystals_)
257  meEEzpCrystals_->Fill(eemapzp.size());
258  if (meEEzmCrystals_)
259  meEEzmCrystals_->Fill(eemapzm.size());
260 
261  if (meEEcrystalEnergy_) {
262  for (std::map<uint32_t, float, std::less<uint32_t>>::iterator it = eemap.begin(); it != eemap.end(); ++it)
263  meEEcrystalEnergy_->Fill((*it).second);
264  }
265  if (meEEcrystalEnergy2_) {
266  for (std::map<uint32_t, float, std::less<uint32_t>>::iterator it = eemap.begin(); it != eemap.end(); ++it)
267  meEEcrystalEnergy2_->Fill((*it).second);
268  }
269 
270  if (meEEzpHits_)
271  meEEzpHits_->Fill(nEEzpHits);
272  if (meEEzmHits_)
273  meEEzmHits_->Fill(nEEzmHits);
274 
275  int nEEHits = nEEzmHits + nEEzpHits;
276  if (nEEHits > 0) {
277  uint32_t eecenterid = getUnitWithMaxEnergy(eemap);
278  EEDetId myEEid(eecenterid);
279  int bx = myEEid.ix();
280  int by = myEEid.iy();
281  int bz = myEEid.zside();
282  ee1 = energyInMatrixEE(1, 1, bx, by, bz, eemap);
283  if (meEEe1_)
284  meEEe1_->Fill(ee1);
285  ee9 = energyInMatrixEE(3, 3, bx, by, bz, eemap);
286  if (meEEe9_)
287  meEEe9_->Fill(ee9);
288  ee25 = energyInMatrixEE(5, 5, bx, by, bz, eemap);
289  if (meEEe25_)
290  meEEe25_->Fill(ee25);
291 
292  std::vector<uint32_t> ids25;
293  ids25 = getIdsAroundMax(5, 5, bx, by, bz, eemap);
294 
295  for (unsigned i = 0; i < 25; i++) {
296  for (unsigned int j = 0; j < CaloHitMap[ids25[i]].size(); j++) {
297  if (CaloHitMap[ids25[i]][j]->energy() > 0) {
298  int log10i = int((log10(CaloHitMap[ids25[i]][j]->energy()) + 10.) * 10.);
299  if (log10i >= 0 && log10i < 140)
300  econtr25[log10i] += CaloHitMap[ids25[i]][j]->energy();
301  }
302  }
303  }
304 
305  MapType neweemap;
306  if (fillEEMatrix(3, 3, bx, by, bz, neweemap, eemap)) {
307  ee4 = eCluster2x2(neweemap);
308  if (meEEe4_)
309  meEEe4_->Fill(ee4);
310  }
311  if (fillEEMatrix(5, 5, bx, by, bz, neweemap, eemap)) {
312  ee16 = eCluster4x4(ee9, neweemap);
313  if (meEEe16_)
314  meEEe16_->Fill(ee16);
315  }
316 
317  if (meEEe1oe4_ && ee4 > 0.1)
318  meEEe1oe4_->Fill(ee1 / ee4);
319  if (meEEe1oe9_ && ee9 > 0.1)
320  meEEe1oe9_->Fill(ee1 / ee9);
321  if (meEEe4oe9_ && ee9 > 0.1)
322  meEEe4oe9_->Fill(ee4 / ee9);
323  if (meEEe9oe16_ && ee16 > 0.1)
324  meEEe9oe16_->Fill(ee9 / ee16);
325  if (meEEe16oe25_ && ee25 > 0.1)
326  meEEe16oe25_->Fill(ee16 / ee25);
327  if (meEEe1oe25_ && ee25 > 0.1)
328  meEEe1oe25_->Fill(ee1 / ee25);
329  if (meEEe9oe25_ && ee25 > 0.1)
330  meEEe9oe25_->Fill(ee9 / ee25);
331 
332  if (meEEhitLog10EnergyNorm_ && (EEetzp_ + EEetzm_) != 0) {
333  for (int i = 0; i < 140; i++) {
334  meEEhitLog10EnergyNorm_->Fill(-10. + (float(i) + 0.5) / 10., econtr[i] / (EEetzp_ + EEetzm_));
335  }
336  }
337 
338  if (meEEhitLog10Energy25Norm_ && ee25 != 0) {
339  for (int i = 0; i < 140; i++) {
340  meEEhitLog10Energy25Norm_->Fill(-10. + (float(i) + 0.5) / 10., econtr25[i] / ee25);
341  }
342  }
343  }
344 
345  if (MyPEcalValidInfo.isValid()) {
346  if (MyPEcalValidInfo->ee1x1() > 0.) {
347  std::vector<float> EX0 = MyPEcalValidInfo->eX0();
350  for (int myStep = 0; myStep < 26; myStep++) {
351  eRLength[myStep] += EX0[myStep];
353  meEELongitudinalShower_->Fill(float(myStep), eRLength[myStep] / myEntries);
354  }
355  }
356  }
357 }
#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:517
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
virtual float energyInMatrixEE(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
void Fill(long long x)
std::map< uint32_t, float, std::less< uint32_t > > MapType
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: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 165 of file EcalEndcapSimHitsValidation.cc.

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

Definition at line 446 of file EcalEndcapSimHitsValidation.cc.

Referenced by analyze().

446  {
447  float E22 = 0.;
448  float e012 = themap[0] + themap[1] + themap[2];
449  float e036 = themap[0] + themap[3] + themap[6];
450  float e678 = themap[6] + themap[7] + themap[8];
451  float e258 = themap[2] + themap[5] + themap[8];
452 
453  if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
454  return E22 = themap[0] + themap[1] + themap[3] + themap[4];
455  else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
456  return E22 = themap[1] + themap[2] + themap[4] + themap[5];
457  else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
458  return E22 = themap[3] + themap[4] + themap[6] + themap[7];
459  else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
460  return E22 = themap[4] + themap[5] + themap[7] + themap[8];
461  else {
462  return E22;
463  }
464 }
float EcalEndcapSimHitsValidation::eCluster4x4 ( float  e33,
MapType themap 
)
private

Definition at line 466 of file EcalEndcapSimHitsValidation.cc.

Referenced by analyze().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 167 of file EcalEndcapSimHitsValidation.cc.

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

Definition at line 359 of file EcalEndcapSimHitsValidation.cc.

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

Referenced by analyze().

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

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

Referenced by analyze().

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

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

Referenced by analyze().

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

References LogDebug, and particleFlowClusterECALTimeSelected_cfi::maxEnergy.

Referenced by analyze(), and fillEEMatrix().

486  {
487  // look for max
488  uint32_t unitWithMaxEnergy = 0;
489  float maxEnergy = 0.;
490 
491  MapType::iterator iter;
492  for (iter = themap.begin(); iter != themap.end(); iter++) {
493  if (maxEnergy < (*iter).second) {
494  maxEnergy = (*iter).second;
495  unitWithMaxEnergy = (*iter).first;
496  }
497  }
498 
499  LogDebug("GeomInfo") << " max energy of " << maxEnergy << " GeV in Unit id " << unitWithMaxEnergy;
500  return unitWithMaxEnergy;
501 }
#define LogDebug(id)

Member Data Documentation

DQMStore* EcalEndcapSimHitsValidation::dbe_
private

Definition at line 79 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::EEHitsCollection
private

Definition at line 71 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

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

Definition at line 74 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

float EcalEndcapSimHitsValidation::eRLength[26]
private

Definition at line 84 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::g4InfoLabel
private

Definition at line 70 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEcrystalEnergy2_
private

Definition at line 108 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEcrystalEnergy_
private

Definition at line 107 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe16_
private

Definition at line 113 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe16oe25_
private

Definition at line 122 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1_
private

Definition at line 110 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe25_
private

Definition at line 120 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe4_
private

Definition at line 116 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe1oe9_
private

Definition at line 117 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe25_
private

Definition at line 114 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe4_
private

Definition at line 111 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe4oe9_
private

Definition at line 118 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9_
private

Definition at line 112 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9oe16_
private

Definition at line 119 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEe9oe25_
private

Definition at line 121 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEHitEnergy2_
private

Definition at line 105 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEHitEnergy_
private

Definition at line 97 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10Energy25Norm_
private

Definition at line 103 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10Energy_
private

Definition at line 99 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEhitLog10EnergyNorm_
private

Definition at line 101 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEELongitudinalShower_
private

Definition at line 95 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmCrystals_
private

Definition at line 90 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmHits_
private

Definition at line 87 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzmOccupancy_
private

Definition at line 93 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpCrystals_
private

Definition at line 89 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpHits_
private

Definition at line 86 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

MonitorElement* EcalEndcapSimHitsValidation::meEEzpOccupancy_
private

Definition at line 92 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

int EcalEndcapSimHitsValidation::myEntries
private

Definition at line 83 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

std::string EcalEndcapSimHitsValidation::outputFile_
private

Definition at line 81 of file EcalEndcapSimHitsValidation.h.

std::string EcalEndcapSimHitsValidation::ValidationCollection
private

Definition at line 72 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().

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

Definition at line 75 of file EcalEndcapSimHitsValidation.h.

Referenced by analyze(), and EcalEndcapSimHitsValidation().

bool EcalEndcapSimHitsValidation::verbose_
private

Definition at line 77 of file EcalEndcapSimHitsValidation.h.

Referenced by EcalEndcapSimHitsValidation().