CMS 3D CMS Logo

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

#include <EcalBarrelSimHitsValidation.h>

Inheritance diagram for EcalBarrelSimHitsValidation:
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

 EcalBarrelSimHitsValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalBarrelSimHitsValidation () 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 energyInMatrixEB (int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap)
 
bool fillEBMatrix (int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
 
std::vector< uint32_t > getIdsAroundMax (int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap)
 
uint32_t getUnitWithMaxEnergy (MapType &themap)
 

Private Attributes

DQMStoredbe_
 
std::string EBHitsCollection
 
edm::EDGetTokenT< edm::PCaloHitContainerEBHitsToken
 
float eRLength [26]
 
std::string g4InfoLabel
 
MonitorElementmeEBcrystalEnergy2_
 
MonitorElementmeEBcrystalEnergy_
 
MonitorElementmeEBe16_
 
MonitorElementmeEBe16oe25_
 
MonitorElementmeEBe1_
 
MonitorElementmeEBe1oe25_
 
MonitorElementmeEBe1oe4_
 
MonitorElementmeEBe1oe9_
 
MonitorElementmeEBe25_
 
MonitorElementmeEBe4_
 
MonitorElementmeEBe4oe9_
 
MonitorElementmeEBe9_
 
MonitorElementmeEBe9oe16_
 
MonitorElementmeEBe9oe25_
 
MonitorElementmeEBhitEnergy2_
 
MonitorElementmeEBhitEnergy_
 
MonitorElementmeEBhitLog10Energy25Norm_
 
MonitorElementmeEBhitLog10Energy_
 
MonitorElementmeEBhitLog10EnergyNorm_
 
MonitorElementmeEBLongitudinalShower_
 
MonitorElementmeEBOccupancy_
 
MonitorElementmenEBCrystals_
 
MonitorElementmenEBHits_
 
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 33 of file EcalBarrelSimHitsValidation.h.

Member Typedef Documentation

Definition at line 37 of file EcalBarrelSimHitsValidation.h.

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

Definition at line 34 of file EcalBarrelSimHitsValidation.h.

Definition at line 38 of file EcalBarrelSimHitsValidation.h.

Constructor & Destructor Documentation

EcalBarrelSimHitsValidation::EcalBarrelSimHitsValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 17 of file EcalBarrelSimHitsValidation.cc.

References dbe_, EBHitsCollection, EBHitsToken, eRLength, g4InfoLabel, edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::histo, HLT_2018_cff::InputTag, meEBcrystalEnergy2_, meEBcrystalEnergy_, meEBe16_, meEBe16oe25_, meEBe1_, meEBe1oe25_, meEBe1oe4_, meEBe1oe9_, meEBe25_, meEBe4_, meEBe4oe9_, meEBe9_, meEBe9oe16_, meEBe9oe25_, meEBhitEnergy2_, meEBhitEnergy_, meEBhitLog10Energy25Norm_, meEBhitLog10Energy_, meEBhitLog10EnergyNorm_, meEBLongitudinalShower_, meEBOccupancy_, menEBCrystals_, menEBHits_, myEntries, Utilities::operator, AlCaHLTBitMon_QueryRunRegistry::string, ValidationCollection, ValidationCollectionToken, and verbose_.

18  : g4InfoLabel(ps.getParameter<std::string>("moduleLabelG4")),
19  EBHitsCollection(ps.getParameter<std::string>("EBHitsCollection")),
20  ValidationCollection(ps.getParameter<std::string>("ValidationCollection")) {
21  EBHitsToken =
22  consumes<edm::PCaloHitContainer>(edm::InputTag(std::string(g4InfoLabel), std::string(EBHitsCollection)));
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  menEBHits_ = nullptr;
38  menEBCrystals_ = nullptr;
39  meEBOccupancy_ = nullptr;
40  meEBLongitudinalShower_ = nullptr;
41  meEBhitEnergy_ = nullptr;
42  meEBhitLog10Energy_ = nullptr;
43  meEBhitLog10EnergyNorm_ = nullptr;
44  meEBhitLog10Energy25Norm_ = nullptr;
45  meEBhitEnergy2_ = nullptr;
46  meEBcrystalEnergy_ = nullptr;
47  meEBcrystalEnergy2_ = nullptr;
48 
49  meEBe1_ = nullptr;
50  meEBe4_ = nullptr;
51  meEBe9_ = nullptr;
52  meEBe16_ = nullptr;
53  meEBe25_ = nullptr;
54 
55  meEBe1oe4_ = nullptr;
56  meEBe1oe9_ = nullptr;
57  meEBe4oe9_ = nullptr;
58  meEBe9oe16_ = nullptr;
59  meEBe1oe25_ = nullptr;
60  meEBe9oe25_ = nullptr;
61  meEBe16oe25_ = nullptr;
62 
63  myEntries = 0;
64  for (int myStep = 0; myStep < 26; myStep++) {
65  eRLength[myStep] = 0.0;
66  }
67 
68  Char_t histo[200];
69 
70  if (dbe_) {
71  dbe_->setCurrentFolder("EcalHitsV/EcalSimHitsValidation");
72 
73  sprintf(histo, "EB hits multiplicity");
74  menEBHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.);
75 
76  sprintf(histo, "EB crystals multiplicity");
77  menEBCrystals_ = dbe_->book1D(histo, histo, 200, 0., 2000.);
78 
79  sprintf(histo, "EB occupancy");
80  meEBOccupancy_ = dbe_->book2D(histo, histo, 360, 0., 360., 170, -85., 85.);
81 
82  sprintf(histo, "EB longitudinal shower profile");
83  meEBLongitudinalShower_ = dbe_->bookProfile(histo, histo, 26, 0., 26., 100, 0., 20000.);
84 
85  sprintf(histo, "EB hits energy spectrum");
86  meEBhitEnergy_ = dbe_->book1D(histo, histo, 4000, 0., 400.);
87 
88  sprintf(histo, "EB hits log10energy spectrum");
89  meEBhitLog10Energy_ = dbe_->book1D(histo, histo, 140, -10., 4.);
90 
91  sprintf(histo, "EB hits log10energy spectrum vs normalized energy");
92  meEBhitLog10EnergyNorm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
93 
94  sprintf(histo, "EB hits log10energy spectrum vs normalized energy25");
95  meEBhitLog10Energy25Norm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
96 
97  sprintf(histo, "EB hits energy spectrum 2");
98  meEBhitEnergy2_ = dbe_->book1D(histo, histo, 1000, 0., 0.001);
99 
100  sprintf(histo, "EB crystal energy spectrum");
101  meEBcrystalEnergy_ = dbe_->book1D(histo, histo, 5000, 0., 50.);
102 
103  sprintf(histo, "EB crystal energy spectrum 2");
104  meEBcrystalEnergy2_ = dbe_->book1D(histo, histo, 1000, 0., 0.001);
105 
106  sprintf(histo, "EB E1");
107  meEBe1_ = dbe_->book1D(histo, histo, 400, 0., 400.);
108 
109  sprintf(histo, "EB E4");
110  meEBe4_ = dbe_->book1D(histo, histo, 400, 0., 400.);
111 
112  sprintf(histo, "EB E9");
113  meEBe9_ = dbe_->book1D(histo, histo, 400, 0., 400.);
114 
115  sprintf(histo, "EB E16");
116  meEBe16_ = dbe_->book1D(histo, histo, 400, 0., 400.);
117 
118  sprintf(histo, "EB E25");
119  meEBe25_ = dbe_->book1D(histo, histo, 400, 0., 400.);
120 
121  sprintf(histo, "EB E1oE4");
122  meEBe1oe4_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
123 
124  sprintf(histo, "EB E1oE9");
125  meEBe1oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
126 
127  sprintf(histo, "EB E4oE9");
128  meEBe4oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
129 
130  sprintf(histo, "EB E9oE16");
131  meEBe9oe16_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
132 
133  sprintf(histo, "EB E1oE25");
134  meEBe1oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
135 
136  sprintf(histo, "EB E9oE25");
137  meEBe9oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
138 
139  sprintf(histo, "EB E16oE25");
140  meEBe16oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
141  }
142 }
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
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 > EBHitsToken
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
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
EcalBarrelSimHitsValidation::~EcalBarrelSimHitsValidation ( )
override

Destructor.

Definition at line 144 of file EcalBarrelSimHitsValidation.cc.

144 {}

Member Function Documentation

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

Analyze.

Definition at line 155 of file EcalBarrelSimHitsValidation.cc.

References l1GtPatternGenerator_cfi::bx, PEcalValidInfo::bX0(), PEcalValidInfo::eb1x1(), EBHitsToken, eCluster2x2(), eCluster4x4(), HCALHighEnergyHPDFilter_cfi::energy, energyInMatrixEB(), eRLength, edm::EventID::event(), dqm::impl::MonitorElement::Fill(), fillEBMatrix(), edm::Event::getByToken(), getIdsAroundMax(), getUnitWithMaxEnergy(), mps_fire::i, edm::EventBase::id(), EBDetId::ietaAbs(), createfilelist::int, EBDetId::iphi(), edm::HandleBase::isValid(), dqmiolumiharvest::j, LogDebug, genParticles_cff::map, meEBcrystalEnergy2_, meEBcrystalEnergy_, meEBe16_, meEBe16oe25_, meEBe1_, meEBe1oe25_, meEBe1oe4_, meEBe1oe9_, meEBe25_, meEBe4_, meEBe4oe9_, meEBe9_, meEBe9oe16_, meEBe9oe25_, meEBhitEnergy2_, meEBhitEnergy_, meEBhitLog10Energy25Norm_, meEBhitLog10Energy_, meEBhitLog10EnergyNorm_, meEBLongitudinalShower_, meEBOccupancy_, menEBCrystals_, menEBHits_, myEntries, dqm::impl::MonitorElement::Reset(), edm::EventID::run(), ValidationCollectionToken, and EBDetId::zside().

155  {
156  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
157 
159  e.getByToken(EBHitsToken, EcalHitsEB);
160 
161  // Do nothing if no Barrel data available
162  if (!EcalHitsEB.isValid())
163  return;
164 
165  edm::Handle<PEcalValidInfo> MyPEcalValidInfo;
166  e.getByToken(ValidationCollectionToken, MyPEcalValidInfo);
167 
168  std::vector<PCaloHit> theEBCaloHits;
169  theEBCaloHits.insert(theEBCaloHits.end(), EcalHitsEB->begin(), EcalHitsEB->end());
170 
171  myEntries++;
172 
173  double EBEnergy_ = 0.;
174  std::map<unsigned int, std::vector<PCaloHit *>, std::less<unsigned int>> CaloHitMap;
175 
176  double eb1 = 0.0;
177  double eb4 = 0.0;
178  double eb9 = 0.0;
179  double eb16 = 0.0;
180  double eb25 = 0.0;
181  std::vector<double> econtr(140, 0.);
182  std::vector<double> econtr25(140, 0.);
183 
184  MapType ebmap;
185  uint32_t nEBHits = 0;
186 
187  for (std::vector<PCaloHit>::iterator isim = theEBCaloHits.begin(); isim != theEBCaloHits.end(); ++isim) {
188  if (isim->time() > 500.) {
189  continue;
190  }
191 
192  CaloHitMap[isim->id()].push_back(&(*isim));
193 
194  EBDetId ebid(isim->id());
195 
196  LogDebug("HitInfo") << " CaloHit " << isim->getName() << "\n"
197  << " DetID = " << isim->id() << " EBDetId = " << ebid.ieta() << " " << ebid.iphi() << "\n"
198  << " Time = " << isim->time() << "\n"
199  << " Track Id = " << isim->geantTrackId() << "\n"
200  << " Energy = " << isim->energy();
201 
202  if (meEBOccupancy_)
203  meEBOccupancy_->Fill(ebid.iphi(), ebid.ieta());
204 
205  uint32_t crystid = ebid.rawId();
206  ebmap[crystid] += isim->energy();
207 
208  EBEnergy_ += isim->energy();
209  nEBHits++;
210  meEBhitEnergy_->Fill(isim->energy());
211  if (isim->energy() > 0) {
212  meEBhitLog10Energy_->Fill(log10(isim->energy()));
213  int log10i = int((log10(isim->energy()) + 10.) * 10.);
214  if (log10i >= 0 && log10i < 140)
215  econtr[log10i] += isim->energy();
216  }
217  meEBhitEnergy2_->Fill(isim->energy());
218  }
219 
220  if (menEBCrystals_)
221  menEBCrystals_->Fill(ebmap.size());
222  if (meEBcrystalEnergy_) {
223  for (std::map<uint32_t, float, std::less<uint32_t>>::iterator it = ebmap.begin(); it != ebmap.end(); ++it)
224  meEBcrystalEnergy_->Fill((*it).second);
225  }
226  if (meEBcrystalEnergy2_) {
227  for (std::map<uint32_t, float, std::less<uint32_t>>::iterator it = ebmap.begin(); it != ebmap.end(); ++it)
228  meEBcrystalEnergy2_->Fill((*it).second);
229  }
230 
231  if (menEBHits_)
232  menEBHits_->Fill(nEBHits);
233 
234  if (nEBHits > 0) {
235  uint32_t ebcenterid = getUnitWithMaxEnergy(ebmap);
236  EBDetId myEBid(ebcenterid);
237  int bx = myEBid.ietaAbs();
238  int by = myEBid.iphi();
239  int bz = myEBid.zside();
240  eb1 = energyInMatrixEB(1, 1, bx, by, bz, ebmap);
241  if (meEBe1_)
242  meEBe1_->Fill(eb1);
243  eb9 = energyInMatrixEB(3, 3, bx, by, bz, ebmap);
244  if (meEBe9_)
245  meEBe9_->Fill(eb9);
246  eb25 = energyInMatrixEB(5, 5, bx, by, bz, ebmap);
247  if (meEBe25_)
248  meEBe25_->Fill(eb25);
249 
250  std::vector<uint32_t> ids25;
251  ids25 = getIdsAroundMax(5, 5, bx, by, bz, ebmap);
252 
253  for (unsigned i = 0; i < 25; i++) {
254  for (unsigned int j = 0; j < CaloHitMap[ids25[i]].size(); j++) {
255  if (CaloHitMap[ids25[i]][j]->energy() > 0) {
256  int log10i = int((log10(CaloHitMap[ids25[i]][j]->energy()) + 10.) * 10.);
257  if (log10i >= 0 && log10i < 140)
258  econtr25[log10i] += CaloHitMap[ids25[i]][j]->energy();
259  }
260  }
261  }
262 
263  MapType newebmap;
264  if (fillEBMatrix(3, 3, bx, by, bz, newebmap, ebmap)) {
265  eb4 = eCluster2x2(newebmap);
266  if (meEBe4_)
267  meEBe4_->Fill(eb4);
268  }
269  if (fillEBMatrix(5, 5, bx, by, bz, newebmap, ebmap)) {
270  eb16 = eCluster4x4(eb9, newebmap);
271  if (meEBe16_)
272  meEBe16_->Fill(eb16);
273  }
274 
275  if (meEBe1oe4_ && eb4 > 0.1)
276  meEBe1oe4_->Fill(eb1 / eb4);
277  if (meEBe1oe9_ && eb9 > 0.1)
278  meEBe1oe9_->Fill(eb1 / eb9);
279  if (meEBe4oe9_ && eb9 > 0.1)
280  meEBe4oe9_->Fill(eb4 / eb9);
281  if (meEBe9oe16_ && eb16 > 0.1)
282  meEBe9oe16_->Fill(eb9 / eb16);
283  if (meEBe1oe25_ && eb25 > 0.1)
284  meEBe1oe25_->Fill(eb1 / eb25);
285  if (meEBe9oe25_ && eb25 > 0.1)
286  meEBe9oe25_->Fill(eb9 / eb25);
287  if (meEBe16oe25_ && eb25 > 0.1)
288  meEBe16oe25_->Fill(eb16 / eb25);
289 
290  if (meEBhitLog10EnergyNorm_ && EBEnergy_ != 0) {
291  for (int i = 0; i < 140; i++) {
292  meEBhitLog10EnergyNorm_->Fill(-10. + (float(i) + 0.5) / 10., econtr[i] / EBEnergy_);
293  }
294  }
295 
296  if (meEBhitLog10Energy25Norm_ && eb25 != 0) {
297  for (int i = 0; i < 140; i++) {
298  meEBhitLog10Energy25Norm_->Fill(-10. + (float(i) + 0.5) / 10., econtr25[i] / eb25);
299  }
300  }
301  }
302 
303  if (MyPEcalValidInfo.isValid()) {
304  if (MyPEcalValidInfo->eb1x1() > 0.) {
305  std::vector<float> BX0 = MyPEcalValidInfo->bX0();
308  for (int myStep = 0; myStep < 26; myStep++) {
309  eRLength[myStep] += BX0[myStep];
311  meEBLongitudinalShower_->Fill(float(myStep), eRLength[myStep] / myEntries);
312  }
313  }
314  }
315 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
std::vector< uint32_t > getIdsAroundMax(int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
float eb1x1() const
void Fill(long long x)
virtual void Reset()
reset ME (ie. contents, errors, etc)
float eCluster4x4(float e33, MapType &themap)
std::map< uint32_t, float, std::less< uint32_t > > MapType
edm::EDGetTokenT< edm::PCaloHitContainer > EBHitsToken
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
uint32_t getUnitWithMaxEnergy(MapType &themap)
virtual float energyInMatrixEB(int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap)
edm::EventID id() const
Definition: EventBase.h:59
bool fillEBMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
FloatVector bX0() const
void EcalBarrelSimHitsValidation::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 146 of file EcalBarrelSimHitsValidation.cc.

146 {}
float EcalBarrelSimHitsValidation::eCluster2x2 ( MapType themap)
private

Definition at line 416 of file EcalBarrelSimHitsValidation.cc.

Referenced by analyze().

416  {
417  float E22 = 0.;
418  float e012 = themap[0] + themap[1] + themap[2];
419  float e036 = themap[0] + themap[3] + themap[6];
420  float e678 = themap[6] + themap[7] + themap[8];
421  float e258 = themap[2] + themap[5] + themap[8];
422 
423  if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
424  return E22 = themap[0] + themap[1] + themap[3] + themap[4];
425  else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
426  return E22 = themap[1] + themap[2] + themap[4] + themap[5];
427  else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
428  return E22 = themap[3] + themap[4] + themap[6] + themap[7];
429  else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
430  return E22 = themap[4] + themap[5] + themap[7] + themap[8];
431  else {
432  return E22;
433  }
434 }
float EcalBarrelSimHitsValidation::eCluster4x4 ( float  e33,
MapType themap 
)
private

Definition at line 436 of file EcalBarrelSimHitsValidation.cc.

Referenced by analyze().

436  {
437  float E44 = 0.;
438  float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
439  float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
440  float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
441  float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
442 
443  if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
444  return E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
445  else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
446  return E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
447  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
448  return E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
449  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
450  return E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
451  else {
452  return E44;
453  }
454 }
void EcalBarrelSimHitsValidation::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file EcalBarrelSimHitsValidation.cc.

148  {
149  // for (int myStep=0; myStep<26; myStep++){
150  // if (meEBLongitudinalShower_) meEBLongitudinalShower_->Fill(float(myStep),
151  // eRLength[myStep]/myEntries);
152  //}
153 }
float EcalBarrelSimHitsValidation::energyInMatrixEB ( int  nCellInEta,
int  nCellInPhi,
int  centralEta,
int  centralPhi,
int  centralZ,
MapType themap 
)
privatevirtual

Definition at line 317 of file EcalBarrelSimHitsValidation.cc.

References funct::abs(), LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, LogDebug, and DetId::rawId().

Referenced by analyze().

318  {
319  int ncristals = 0;
320  float totalEnergy = 0.;
321 
322  int goBackInEta = nCellInEta / 2;
323  int goBackInPhi = nCellInPhi / 2;
324  int startEta = centralZ * centralEta - goBackInEta;
325  int startPhi = centralPhi - goBackInPhi;
326 
327  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
328  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
329  uint32_t index;
330  if (abs(ieta) > 85 || abs(ieta) < 1) {
331  continue;
332  }
333  if (iphi < 1) {
334  index = EBDetId(ieta, iphi + 360).rawId();
335  } else if (iphi > 360) {
336  index = EBDetId(ieta, iphi - 360).rawId();
337  } else {
338  index = EBDetId(ieta, iphi).rawId();
339  }
340 
341  totalEnergy += themap[index];
342  ncristals += 1;
343  }
344  }
345 
346  LogDebug("GeomInfo") << nCellInEta << " x " << nCellInPhi << " EB matrix energy = " << totalEnergy << " for "
347  << ncristals << " crystals";
348  return totalEnergy;
349 }
#define LogDebug(id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool EcalBarrelSimHitsValidation::fillEBMatrix ( int  nCellInEta,
int  nCellInPhi,
int  CentralEta,
int  CentralPhi,
int  CentralZ,
MapType fillmap,
MapType themap 
)
private

Definition at line 382 of file EcalBarrelSimHitsValidation.cc.

References funct::abs(), getUnitWithMaxEnergy(), mps_fire::i, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and DetId::rawId().

Referenced by analyze().

383  {
384  int goBackInEta = nCellInEta / 2;
385  int goBackInPhi = nCellInPhi / 2;
386 
387  int startEta = CentralZ * CentralEta - goBackInEta;
388  int startPhi = CentralPhi - goBackInPhi;
389 
390  int i = 0;
391  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
392  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
393  uint32_t index;
394  if (abs(ieta) > 85 || abs(ieta) < 1) {
395  continue;
396  }
397  if (iphi < 1) {
398  index = EBDetId(ieta, iphi + 360).rawId();
399  } else if (iphi > 360) {
400  index = EBDetId(ieta, iphi - 360).rawId();
401  } else {
402  index = EBDetId(ieta, iphi).rawId();
403  }
404  fillmap[i++] = themap[index];
405  }
406  }
407 
408  uint32_t ebcenterid = getUnitWithMaxEnergy(themap);
409 
410  if (fillmap[i / 2] == themap[ebcenterid])
411  return true;
412  else
413  return false;
414 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
uint32_t getUnitWithMaxEnergy(MapType &themap)
std::vector< uint32_t > EcalBarrelSimHitsValidation::getIdsAroundMax ( int  nCellInEta,
int  nCellInPhi,
int  centralEta,
int  centralPhi,
int  centralZ,
MapType themap 
)
private

Definition at line 351 of file EcalBarrelSimHitsValidation.cc.

References funct::abs(), photons_cff::ids, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and DetId::rawId().

Referenced by analyze().

352  {
353  int ncristals = 0;
354  std::vector<uint32_t> ids(nCellInEta * nCellInPhi);
355 
356  int goBackInEta = nCellInEta / 2;
357  int goBackInPhi = nCellInPhi / 2;
358  int startEta = centralZ * centralEta - goBackInEta;
359  int startPhi = centralPhi - goBackInPhi;
360 
361  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
362  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
363  uint32_t index;
364  if (abs(ieta) > 85 || abs(ieta) < 1) {
365  continue;
366  }
367  if (iphi < 1) {
368  index = EBDetId(ieta, iphi + 360).rawId();
369  } else if (iphi > 360) {
370  index = EBDetId(ieta, iphi - 360).rawId();
371  } else {
372  index = EBDetId(ieta, iphi).rawId();
373  }
374  ids[ncristals] = index;
375  ncristals += 1;
376  }
377  }
378 
379  return ids;
380 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
uint32_t EcalBarrelSimHitsValidation::getUnitWithMaxEnergy ( MapType themap)
private

Definition at line 456 of file EcalBarrelSimHitsValidation.cc.

References LogDebug, and particleFlowClusterECALTimeSelected_cfi::maxEnergy.

Referenced by analyze(), and fillEBMatrix().

456  {
457  // look for max
458  uint32_t unitWithMaxEnergy = 0;
459  float maxEnergy = 0.;
460 
461  MapType::iterator iter;
462  for (iter = themap.begin(); iter != themap.end(); iter++) {
463  if (maxEnergy < (*iter).second) {
464  maxEnergy = (*iter).second;
465  unitWithMaxEnergy = (*iter).first;
466  }
467  }
468 
469  LogDebug("GeomInfo") << " max energy of " << maxEnergy << " GeV in Unit id " << unitWithMaxEnergy;
470  return unitWithMaxEnergy;
471 }
#define LogDebug(id)

Member Data Documentation

DQMStore* EcalBarrelSimHitsValidation::dbe_
private

Definition at line 80 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

std::string EcalBarrelSimHitsValidation::EBHitsCollection
private

Definition at line 72 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> EcalBarrelSimHitsValidation::EBHitsToken
private

Definition at line 75 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

float EcalBarrelSimHitsValidation::eRLength[26]
private

Definition at line 85 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

std::string EcalBarrelSimHitsValidation::g4InfoLabel
private

Definition at line 71 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBcrystalEnergy2_
private

Definition at line 107 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBcrystalEnergy_
private

Definition at line 105 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe16_
private

Definition at line 112 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe16oe25_
private

Definition at line 121 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1_
private

Definition at line 109 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1oe25_
private

Definition at line 119 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1oe4_
private

Definition at line 115 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1oe9_
private

Definition at line 116 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe25_
private

Definition at line 113 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe4_
private

Definition at line 110 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe4oe9_
private

Definition at line 117 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe9_
private

Definition at line 111 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe9oe16_
private

Definition at line 118 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe9oe25_
private

Definition at line 120 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitEnergy2_
private

Definition at line 103 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitEnergy_
private

Definition at line 95 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitLog10Energy25Norm_
private

Definition at line 101 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitLog10Energy_
private

Definition at line 97 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitLog10EnergyNorm_
private

Definition at line 99 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBLongitudinalShower_
private

Definition at line 93 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBOccupancy_
private

Definition at line 91 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::menEBCrystals_
private

Definition at line 89 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::menEBHits_
private

Definition at line 87 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

int EcalBarrelSimHitsValidation::myEntries
private

Definition at line 84 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

std::string EcalBarrelSimHitsValidation::outputFile_
private

Definition at line 82 of file EcalBarrelSimHitsValidation.h.

std::string EcalBarrelSimHitsValidation::ValidationCollection
private

Definition at line 73 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

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

Definition at line 76 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

bool EcalBarrelSimHitsValidation::verbose_
private

Definition at line 78 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().