CMS 3D CMS Logo

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

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

Member Typedef Documentation

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

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

Destructor.

Definition at line 151 of file EcalBarrelSimHitsValidation.cc.

151 {}

Member Function Documentation

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

Analyze.

Definition at line 162 of file EcalBarrelSimHitsValidation.cc.

References PEcalValidInfo::bX0(), PEcalValidInfo::eb1x1(), EBHitsToken, eCluster2x2(), eCluster4x4(), energyInMatrixEB(), eRLength, edm::EventID::event(), MonitorElement::Fill(), fillEBMatrix(), edm::Event::getByToken(), getIdsAroundMax(), getUnitWithMaxEnergy(), mps_fire::i, edm::EventBase::id(), EBDetId::ietaAbs(), createfilelist::int, EBDetId::iphi(), edm::HandleBase::isValid(), 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, MonitorElement::Reset(), edm::EventID::run(), ValidationCollectionToken, and EBDetId::zside().

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

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

Definition at line 423 of file EcalBarrelSimHitsValidation.cc.

Referenced by analyze().

423  {
424  float E22 = 0.;
425  float e012 = themap[0] + themap[1] + themap[2];
426  float e036 = themap[0] + themap[3] + themap[6];
427  float e678 = themap[6] + themap[7] + themap[8];
428  float e258 = themap[2] + themap[5] + themap[8];
429 
430  if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
431  return E22 = themap[0] + themap[1] + themap[3] + themap[4];
432  else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
433  return E22 = themap[1] + themap[2] + themap[4] + themap[5];
434  else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
435  return E22 = themap[3] + themap[4] + themap[6] + themap[7];
436  else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
437  return E22 = themap[4] + themap[5] + themap[7] + themap[8];
438  else {
439  return E22;
440  }
441 }
float EcalBarrelSimHitsValidation::eCluster4x4 ( float  e33,
MapType themap 
)
private

Definition at line 443 of file EcalBarrelSimHitsValidation.cc.

Referenced by analyze().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 155 of file EcalBarrelSimHitsValidation.cc.

155  {
156  // for (int myStep=0; myStep<26; myStep++){
157  // if (meEBLongitudinalShower_) meEBLongitudinalShower_->Fill(float(myStep),
158  // eRLength[myStep]/myEntries);
159  //}
160 }
float EcalBarrelSimHitsValidation::energyInMatrixEB ( int  nCellInEta,
int  nCellInPhi,
int  centralEta,
int  centralPhi,
int  centralZ,
MapType themap 
)
privatevirtual

Definition at line 324 of file EcalBarrelSimHitsValidation.cc.

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

Referenced by analyze().

325  {
326  int ncristals = 0;
327  float totalEnergy = 0.;
328 
329  int goBackInEta = nCellInEta / 2;
330  int goBackInPhi = nCellInPhi / 2;
331  int startEta = centralZ * centralEta - goBackInEta;
332  int startPhi = centralPhi - goBackInPhi;
333 
334  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
335  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
336  uint32_t index;
337  if (abs(ieta) > 85 || abs(ieta) < 1) {
338  continue;
339  }
340  if (iphi < 1) {
341  index = EBDetId(ieta, iphi + 360).rawId();
342  } else if (iphi > 360) {
343  index = EBDetId(ieta, iphi - 360).rawId();
344  } else {
345  index = EBDetId(ieta, iphi).rawId();
346  }
347 
348  totalEnergy += themap[index];
349  ncristals += 1;
350  }
351  }
352 
353  LogDebug("GeomInfo") << nCellInEta << " x " << nCellInPhi << " EB matrix energy = " << totalEnergy << " for "
354  << ncristals << " crystals";
355  return totalEnergy;
356 }
#define LogDebug(id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
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 389 of file EcalBarrelSimHitsValidation.cc.

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

Referenced by analyze().

390  {
391  int goBackInEta = nCellInEta / 2;
392  int goBackInPhi = nCellInPhi / 2;
393 
394  int startEta = CentralZ * CentralEta - goBackInEta;
395  int startPhi = CentralPhi - goBackInPhi;
396 
397  int i = 0;
398  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
399  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
400  uint32_t index;
401  if (abs(ieta) > 85 || abs(ieta) < 1) {
402  continue;
403  }
404  if (iphi < 1) {
405  index = EBDetId(ieta, iphi + 360).rawId();
406  } else if (iphi > 360) {
407  index = EBDetId(ieta, iphi - 360).rawId();
408  } else {
409  index = EBDetId(ieta, iphi).rawId();
410  }
411  fillmap[i++] = themap[index];
412  }
413  }
414 
415  uint32_t ebcenterid = getUnitWithMaxEnergy(themap);
416 
417  if (fillmap[i / 2] == themap[ebcenterid])
418  return true;
419  else
420  return false;
421 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
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 358 of file EcalBarrelSimHitsValidation.cc.

References funct::abs(), and DetId::rawId().

Referenced by analyze().

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

Definition at line 463 of file EcalBarrelSimHitsValidation.cc.

References LogDebug, and particleFlowClusterECALTimeSelected_cfi::maxEnergy.

Referenced by analyze(), and fillEBMatrix().

463  {
464  // look for max
465  uint32_t unitWithMaxEnergy = 0;
466  float maxEnergy = 0.;
467 
468  MapType::iterator iter;
469  for (iter = themap.begin(); iter != themap.end(); iter++) {
470  if (maxEnergy < (*iter).second) {
471  maxEnergy = (*iter).second;
472  unitWithMaxEnergy = (*iter).first;
473  }
474  }
475 
476  LogDebug("GeomInfo") << " max energy of " << maxEnergy << " GeV in Unit id " << unitWithMaxEnergy;
477  return unitWithMaxEnergy;
478 }
#define LogDebug(id)

Member Data Documentation

DQMStore* EcalBarrelSimHitsValidation::dbe_
private

Definition at line 79 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

std::string EcalBarrelSimHitsValidation::EBHitsCollection
private

Definition at line 71 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

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

Definition at line 74 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

float EcalBarrelSimHitsValidation::eRLength[26]
private

Definition at line 84 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

std::string EcalBarrelSimHitsValidation::g4InfoLabel
private

Definition at line 70 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBcrystalEnergy2_
private

Definition at line 106 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBcrystalEnergy_
private

Definition at line 104 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe16_
private

Definition at line 111 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe16oe25_
private

Definition at line 120 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1_
private

Definition at line 108 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1oe25_
private

Definition at line 118 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1oe4_
private

Definition at line 114 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe1oe9_
private

Definition at line 115 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe25_
private

Definition at line 112 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe4_
private

Definition at line 109 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe4oe9_
private

Definition at line 116 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe9_
private

Definition at line 110 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe9oe16_
private

Definition at line 117 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBe9oe25_
private

Definition at line 119 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitEnergy2_
private

Definition at line 102 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitEnergy_
private

Definition at line 94 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitLog10Energy25Norm_
private

Definition at line 100 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitLog10Energy_
private

Definition at line 96 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBhitLog10EnergyNorm_
private

Definition at line 98 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBLongitudinalShower_
private

Definition at line 92 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::meEBOccupancy_
private

Definition at line 90 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::menEBCrystals_
private

Definition at line 88 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

MonitorElement* EcalBarrelSimHitsValidation::menEBHits_
private

Definition at line 86 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

int EcalBarrelSimHitsValidation::myEntries
private

Definition at line 83 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

std::string EcalBarrelSimHitsValidation::outputFile_
private

Definition at line 81 of file EcalBarrelSimHitsValidation.h.

std::string EcalBarrelSimHitsValidation::ValidationCollection
private

Definition at line 72 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().

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

Definition at line 75 of file EcalBarrelSimHitsValidation.h.

Referenced by analyze(), and EcalBarrelSimHitsValidation().

bool EcalBarrelSimHitsValidation::verbose_
private

Definition at line 77 of file EcalBarrelSimHitsValidation.h.

Referenced by EcalBarrelSimHitsValidation().