CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
EcalSimHitStudy Class Reference
Inheritance diagram for EcalSimHitStudy:
edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  EcalHit
 

Public Member Functions

 EcalSimHitStudy (const edm::ParameterSet &ps)
 
 ~EcalSimHitStudy () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void analyzeHits (std::vector< PCaloHit > &, int)
 
void beginJob () override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Attributes

TH1F * edep_ [ndets_]
 
TH1F * edepAll_ [ndets_]
 
TH1F * edepEM_ [ndets_]
 
TH1F * edepHad_ [ndets_]
 
TH1F * eneInc_
 
TH1F * etaInc_
 
TH1F * etot_ [ndets_]
 
TH1F * etotg_ [ndets_]
 
const std::string g4Label_
 
const CaloGeometrygeometry_
 
TH1F * hit_ [ndets_]
 
const std::vector< std::string > hitLab_
 
const double maxEnergy_
 
TH1F * phiInc_
 
TH2F * poszn_ [ndets_]
 
TH2F * poszp_ [ndets_]
 
TH1F * ptInc_
 
TH1F * r1by25_ [ndets_]
 
TH1F * r1by9_ [ndets_]
 
TH1F * r9by25_ [ndets_]
 
const int selX_
 
TH1F * sEtaEta_ [ndets_]
 
TH1F * sEtaPhi_ [ndets_]
 
TH1F * sPhiPhi_ [ndets_]
 
TH1F * time_ [ndets_]
 
TH1F * timeAll_ [ndets_]
 
const double tmax_
 
const edm::EDGetTokenT< edm::HepMCProducttok_evt_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordtokGeom_
 
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > toks_calo_
 
const double w0_
 

Static Private Attributes

static const int ndets_ = 2
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Detailed Description

Definition at line 46 of file EcalSimHitStudy.cc.

Constructor & Destructor Documentation

◆ EcalSimHitStudy()

EcalSimHitStudy::EcalSimHitStudy ( const edm::ParameterSet ps)

Definition at line 83 of file EcalSimHitStudy.cc.

References g4Label_, hitLab_, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and edm::vector_transform().

84  : tokGeom_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
85  g4Label_(ps.getUntrackedParameter<std::string>("ModuleLabel", "g4SimHits")),
86  hitLab_(ps.getUntrackedParameter<std::vector<std::string>>("CaloCollection")),
87  maxEnergy_(ps.getUntrackedParameter<double>("MaxEnergy", 200.0)),
88  tmax_(ps.getUntrackedParameter<double>("TimeCut", 100.0)),
89  w0_(ps.getUntrackedParameter<double>("W0", 4.7)),
90  selX_(ps.getUntrackedParameter<int>("SelectX", -1)),
91  tok_evt_(consumes<edm::HepMCProduct>(
92  edm::InputTag(ps.getUntrackedParameter<std::string>("SourceLabel", "VtxSmeared")))),
94  return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
95  })} {
96  usesResource(TFileService::kSharedResource);
97 
98  edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " Hits: " << hitLab_[0] << ", " << hitLab_[1]
99  << " MaxEnergy: " << maxEnergy_ << " Tmax: " << tmax_ << " Select " << selX_;
100 }
static const std::string kSharedResource
Definition: TFileService.h:76
Log< level::Info, true > LogVerbatim
const std::string g4Label_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
const edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > toks_calo_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tokGeom_
const std::vector< std::string > hitLab_
const double maxEnergy_
const double tmax_
const double w0_

◆ ~EcalSimHitStudy()

EcalSimHitStudy::~EcalSimHitStudy ( )
inlineoverride

Definition at line 49 of file EcalSimHitStudy.cc.

49 {}

Member Function Documentation

◆ analyze()

void EcalSimHitStudy::analyze ( edm::Event const &  e,
edm::EventSetup const &  iS 
)
overrideprotectedvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 256 of file EcalSimHitStudy.cc.

References funct::abs(), analyzeHits(), MillePedeFileConverter_cfg::e, eneInc_, etaInc_, geometry_, edm::EventSetup::getData(), edm::HepMCProduct::GetEvent(), edm::HandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, phiInc_, ptInc_, tok_evt_, tokGeom_, and toks_calo_.

256  {
257 #ifdef EDM_ML_DEBUG
258  edm::LogVerbatim("HitStudy") << "Run = " << e.id().run() << " Event = " << e.id().event();
259 #endif
260  // get handles to calogeometry
261  geometry_ = &iS.getData(tokGeom_);
262 
263  double eInc = 0, etaInc = 0, phiInc = 0;
264  int type(-1);
266  e.getByToken(tok_evt_, EvtHandle);
267  if (EvtHandle.isValid()) {
268  const HepMC::GenEvent* myGenEvent = EvtHandle->GetEvent();
269 
270  HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
271  if (p != myGenEvent->particles_end()) {
272  eInc = (*p)->momentum().e();
273  etaInc = (*p)->momentum().eta();
274  phiInc = (*p)->momentum().phi();
275  }
276  double ptInc = eInc / std::cosh(etaInc);
277  ptInc_->Fill(ptInc);
278  eneInc_->Fill(eInc);
279  etaInc_->Fill(etaInc);
280  phiInc_->Fill(phiInc);
281 
282  if (std::abs(etaInc) < 1.46)
283  type = 0;
284  else if (std::abs(etaInc) > 1.49 && std::abs(etaInc) < 3.0)
285  type = 1;
286  }
287 
288  int typeMin = (type < 0) ? 0 : type;
289  int typeMax = (type < 0) ? 1 : type;
290  for (int type = typeMin; type <= typeMax; ++type) {
292  e.getByToken(toks_calo_[type], hitsCalo);
293  bool getHits = (hitsCalo.isValid());
294 #ifdef EDM_ML_DEBUG
295  edm::LogVerbatim("HitStudy") << "EcalSimHitStudy: Input flags Hits " << getHits << " with " << hitsCalo->size()
296  << " hits";
297 #endif
298  if (getHits) {
299  std::vector<PCaloHit> caloHits;
300  caloHits.insert(caloHits.end(), hitsCalo->begin(), hitsCalo->end());
301  if (!caloHits.empty())
302  analyzeHits(caloHits, type);
303  }
304  }
305 }
Log< level::Info, true > LogVerbatim
const CaloGeometry * geometry_
const edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > toks_calo_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tokGeom_
void analyzeHits(std::vector< PCaloHit > &, int)
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
bool isValid() const
Definition: HandleBase.h:70

◆ analyzeHits()

void EcalSimHitStudy::analyzeHits ( std::vector< PCaloHit > &  hits,
int  indx 
)
protected

Definition at line 307 of file EcalSimHitStudy.cc.

References funct::abs(), TauDecayModes::dec, makePileupJSON::denom, HLT_2024v14_cff::dEta, HLT_2024v14_cff::dPhi, PVValHelper::dz, edep_, edepAll_, edepEM_, edepHad_, hcalRecHitTable_cff::energy, etot_, etotg_, geometry_, CaloGeometry::getGeometry(), hit_, hfClusterShapes_cfi::hits, l1ctLayer2EG_cff::id, hit::id, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::ietaAbs(), hcalRecHitTable_cff::iphi, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), dqmdumpme::k, dqm-mbProfile::log, M_PI, SiStripPI::max, position, poszn_, poszp_, r1by25_, r1by9_, r9by25_, singleTopDQM_cfi::select, selX_, sEtaEta_, sEtaPhi_, sPhiPhi_, hcalRecHitTable_cff::time, time_, timeAll_, tmax_, w(), w0_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and ecaldqm::zside().

Referenced by analyze().

307  {
308  unsigned int nEC(0);
309  std::map<unsigned int, EcalHit> hitMap;
310  double etot(0), etotG(0);
311  for (auto hit : hits) {
312  double edep = hit.energy();
313  double time = hit.time();
314  unsigned int id_ = hit.id();
315  double edepEM = hit.energyEM();
316  double edepHad = hit.energyHad();
317  if (indx == 0) {
318  if ((hit.depth() == 1) || (hit.depth() == 2))
319  continue;
320  }
321  if (time <= tmax_) {
322  auto it = hitMap.find(id_);
323  if (it == hitMap.end()) {
324  uint16_t dep = hit.depth();
325  hitMap[id_] = EcalHit(dep, time, edep);
326  } else {
327  (it->second).energy += edep;
328  }
329  etotG += edep;
330  ++nEC;
331  }
332  time_[indx]->Fill(time);
333  edep_[indx]->Fill(edep);
334  edepEM_[indx]->Fill(edepEM);
335  edepHad_[indx]->Fill(edepHad);
336  etot += edep;
337  }
338 
339  double edepM(0);
340  unsigned int idM(0);
341  uint16_t depM(0);
342  for (auto it : hitMap) {
343  if (it.second.energy > edepM) {
344  idM = it.first;
345  edepM = it.second.energy;
346  depM = it.second.id;
347  }
348  }
349 
350  bool select(true);
351  if (selX_ >= 0) {
352  if ((depM & 0X4) != 0)
353  select = (selX_ > 0);
354  else
355  select = (selX_ == 0);
356  }
357 #ifdef EDM_ML_DEBUG
358  edm::LogVerbatim("HitStudy") << "EcalSimHitStudy::analyzeHits: Index " << indx << " Emax " << edepM << " IDMax "
359  << std::hex << idM << ":" << depM << std::dec << " Select " << select << ":" << selX_
360  << " Hits " << hits.size() << ":" << nEC << ":" << hitMap.size() << " ETotal " << etot
361  << ":" << etotG;
362 #endif
363  if (select) {
364  etot_[indx]->Fill(etot);
365  etotg_[indx]->Fill(etotG);
366  hit_[indx]->Fill(double(nEC));
367  for (auto it : hitMap) {
368  timeAll_[indx]->Fill((it.second).time);
369  edepAll_[indx]->Fill((it.second).energy);
370  DetId id(it.first);
371  if (indx == 0) {
372  if (EBDetId(id).zside() >= 0)
373  poszp_[indx]->Fill(EBDetId(id).ietaAbs(), EBDetId(id).iphi());
374  else
375  poszn_[indx]->Fill(EBDetId(id).ietaAbs(), EBDetId(id).iphi());
376  } else {
377  GlobalPoint gpos = geometry_->getGeometry(id)->getPosition();
378  if (EEDetId(id).zside() >= 0)
379  poszp_[indx]->Fill(gpos.x(), gpos.y());
380  else
381  poszn_[indx]->Fill(gpos.x(), gpos.y());
382  }
383  }
384 
385  math::XYZVector meanPosition(0.0, 0.0, 0.0);
386  std::vector<math::XYZVector> position;
387  std::vector<double> energy;
388  double e9(0), e25(0);
389  for (auto it : hitMap) {
390  DetId id(it.first);
391  int deta(99), dphi(99), dz(0);
392  if (indx == 0) {
393  deta = std::abs(EBDetId(id).ietaAbs() - EBDetId(idM).ietaAbs());
394  dphi = std::abs(EBDetId(id).iphi() - EBDetId(idM).iphi());
395  if (dphi > 180)
396  dphi = std::abs(dphi - 360);
397  dz = std::abs(EBDetId(id).zside() - EBDetId(idM).zside());
398  } else {
399  deta = std::abs(EEDetId(id).ix() - EEDetId(idM).ix());
400  dphi = std::abs(EEDetId(id).iy() - EEDetId(idM).iy());
401  dz = std::abs(EEDetId(id).zside() - EEDetId(idM).zside());
402  }
403  if (deta <= 1 && dphi <= 1 && dz < 1)
404  e9 += (it.second).energy;
405  if (deta <= 2 && dphi <= 2 && dz < 1) {
406  e25 += (it.second).energy;
407  GlobalPoint gpos = geometry_->getGeometry(id)->getPosition();
408  math::XYZVector pos(gpos.x(), gpos.y(), gpos.z());
409  meanPosition += (it.second).energy * pos;
410  position.push_back(pos);
411  energy.push_back((it.second).energy);
412  }
413  }
414  double r1by9 = (e9 > 0) ? (edepM / e9) : -1;
415  double r1by25 = (e25 > 0) ? (edepM / e25) : -1;
416  double r9by25 = (e25 > 0) ? (e9 / e25) : -1;
417 
418  meanPosition /= e25;
419  double denom(0), numEtaEta(0), numEtaPhi(0), numPhiPhi(0);
420  for (unsigned int k = 0; k < position.size(); ++k) {
421  double dEta = position[k].eta() - meanPosition.eta();
422  double dPhi = position[k].phi() - meanPosition.phi();
423  if (dPhi > +M_PI) {
424  dPhi = 2 * M_PI - dPhi;
425  }
426  if (dPhi < -M_PI) {
427  dPhi = 2 * M_PI + dPhi;
428  }
429 
430  double w = std::max(0.0, (w0_ + std::log(energy[k] / e25)));
431  denom += w;
432  numEtaEta += std::abs(w * dEta * dEta);
433  numEtaPhi += std::abs(w * dEta * dPhi);
434  numPhiPhi += std::abs(w * dPhi * dPhi);
435 #ifdef EDM_ML_DEBUG
436  edm::LogVerbatim("HitStudy") << "[" << k << "] dEta " << dEta << " dPhi " << dPhi << " Wt " << energy[k] / e25
437  << ":" << std::log(energy[k] / e25) << ":" << w;
438 #endif
439  }
440  double sEtaEta = (denom > 0) ? (numEtaEta / denom) : -1.0;
441  double sEtaPhi = (denom > 0) ? (numEtaPhi / denom) : -1.0;
442  double sPhiPhi = (denom > 0) ? (numPhiPhi / denom) : -1.0;
443 
444 #ifdef EDM_ML_DEBUG
445  edm::LogVerbatim("HitStudy") << "EcalSimHitStudy::Ratios " << r1by9 << " : " << r1by25 << " : " << r9by25
446  << " Covariances " << sEtaEta << " : " << sEtaPhi << " : " << sPhiPhi;
447 #endif
448  r1by9_[indx]->Fill(r1by9);
449  r1by25_[indx]->Fill(r1by25);
450  r9by25_[indx]->Fill(r9by25);
451  sEtaEta_[indx]->Fill(sEtaEta);
452  sEtaPhi_[indx]->Fill(sEtaPhi);
453  sPhiPhi_[indx]->Fill(sPhiPhi);
454  }
455 }
Log< level::Info, true > LogVerbatim
TH1F * etotg_[ndets_]
TH1F * hit_[ndets_]
TH1F * time_[ndets_]
T w() const
T z() const
Definition: PV3DBase.h:61
const CaloGeometry * geometry_
TH1F * r1by25_[ndets_]
int zside(DetId const &)
TH1F * sPhiPhi_[ndets_]
TH1F * edepEM_[ndets_]
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ietaAbs(uint32_t id)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
TH1F * edepHad_[ndets_]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TH2F * poszp_[ndets_]
TH1F * sEtaPhi_[ndets_]
#define M_PI
unsigned int id
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
Definition: DetId.h:17
TH1F * edep_[ndets_]
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
TH1F * sEtaEta_[ndets_]
TH1F * edepAll_[ndets_]
TH1F * timeAll_[ndets_]
static int position[264][3]
Definition: ReadPGInfo.cc:289
TH2F * poszn_[ndets_]
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
TH1F * r9by25_[ndets_]
TH1F * r1by9_[ndets_]
TH1F * etot_[ndets_]
const double tmax_
const double w0_

◆ beginJob()

void EcalSimHitStudy::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 114 of file EcalSimHitStudy.cc.

References edep_, edepAll_, edepEM_, edepHad_, eneInc_, etaInc_, etot_, etotg_, hit_, mps_fire::i, maxEnergy_, Skims_PA_cff::name, ndets_, phiInc_, poszn_, poszp_, ptInc_, r1by25_, r1by9_, r9by25_, sEtaEta_, sEtaPhi_, sPhiPhi_, AlCaHLTBitMon_QueryRunRegistry::string, compare::tfile, time_, timeAll_, runGCPTkAlMap::title, and L1TOccupancyClient_cfi::ymax.

114  {
116  if (!tfile.isAvailable())
117  throw cms::Exception("BadConfig") << "TFileService unavailable: "
118  << "please add it to config file";
119  char name[20], title[120];
120  sprintf(title, "Incident PT (GeV)");
121  ptInc_ = tfile->make<TH1F>("PtInc", title, 1000, 0., maxEnergy_);
122  ptInc_->GetXaxis()->SetTitle(title);
123  ptInc_->GetYaxis()->SetTitle("Events");
124  sprintf(title, "Incident Energy (GeV)");
125  eneInc_ = tfile->make<TH1F>("EneInc", title, 1000, 0., maxEnergy_);
126  eneInc_->GetXaxis()->SetTitle(title);
127  eneInc_->GetYaxis()->SetTitle("Events");
128  sprintf(title, "Incident #eta");
129  etaInc_ = tfile->make<TH1F>("EtaInc", title, 200, -5., 5.);
130  etaInc_->GetXaxis()->SetTitle(title);
131  etaInc_->GetYaxis()->SetTitle("Events");
132  sprintf(title, "Incident #phi");
133  phiInc_ = tfile->make<TH1F>("PhiInc", title, 200, -3.1415926, 3.1415926);
134  phiInc_->GetXaxis()->SetTitle(title);
135  phiInc_->GetYaxis()->SetTitle("Events");
136  std::string dets[ndets_] = {"EB", "EE"};
137  for (int i = 0; i < ndets_; i++) {
138  sprintf(name, "Hit%d", i);
139  sprintf(title, "Number of hits in %s", dets[i].c_str());
140  hit_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 1000, 0., 20000.);
141  hit_[i]->GetXaxis()->SetTitle(title);
142  hit_[i]->GetYaxis()->SetTitle("Events");
143  hit_[i]->Sumw2();
144  sprintf(name, "Time%d", i);
145  sprintf(title, "Time of the hit (ns) in %s", dets[i].c_str());
146  time_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 1000, 0., 1000.);
147  time_[i]->GetXaxis()->SetTitle(title);
148  time_[i]->GetYaxis()->SetTitle("Hits");
149  time_[i]->Sumw2();
150  sprintf(name, "TimeAll%d", i);
151  sprintf(title, "Hit time (ns) in %s (for first hit in the cell)", dets[i].c_str());
152  timeAll_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 1000, 0., 1000.);
153  timeAll_[i]->GetXaxis()->SetTitle(title);
154  timeAll_[i]->GetYaxis()->SetTitle("Hits");
155  timeAll_[i]->Sumw2();
156  sprintf(name, "Edep%d", i);
157  sprintf(title, "Energy deposit (GeV) in %s", dets[i].c_str());
158  edep_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 5000, 0., maxEnergy_);
159  edep_[i]->GetXaxis()->SetTitle(title);
160  edep_[i]->GetYaxis()->SetTitle("Hits");
161  edep_[i]->Sumw2();
162  sprintf(name, "EdepAll%d", i);
163  sprintf(title, "Total Energy deposit in the cell (GeV) in %s", dets[i].c_str());
164  edepAll_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 5000, 0., maxEnergy_);
165  edepAll_[i]->GetXaxis()->SetTitle(title);
166  edepAll_[i]->GetYaxis()->SetTitle("Hits");
167  edepAll_[i]->Sumw2();
168  sprintf(name, "EdepEM%d", i);
169  sprintf(title, "Energy deposit (GeV) by EM particles in %s", dets[i].c_str());
170  edepEM_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 5000, 0., maxEnergy_);
171  edepEM_[i]->GetXaxis()->SetTitle(title);
172  edepEM_[i]->GetYaxis()->SetTitle("Hits");
173  edepEM_[i]->Sumw2();
174  sprintf(name, "EdepHad%d", i);
175  sprintf(title, "Energy deposit (GeV) by hadrons in %s", dets[i].c_str());
176  edepHad_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 5000, 0., maxEnergy_);
177  edepHad_[i]->GetXaxis()->SetTitle(title);
178  edepHad_[i]->GetYaxis()->SetTitle("Hits");
179  edepHad_[i]->Sumw2();
180  sprintf(name, "Etot%d", i);
181  sprintf(title, "Total energy deposit (GeV) in %s", dets[i].c_str());
182  etot_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 5000, 0., maxEnergy_);
183  etot_[i]->GetXaxis()->SetTitle(title);
184  etot_[i]->GetYaxis()->SetTitle("Events");
185  etot_[i]->Sumw2();
186  sprintf(name, "EtotG%d", i);
187  sprintf(title, "Total energy deposit (GeV) in %s (t < 100 ns)", dets[i].c_str());
188  etotg_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 5000, 0., maxEnergy_);
189  etotg_[i]->GetXaxis()->SetTitle(title);
190  etotg_[i]->GetYaxis()->SetTitle("Events");
191  etotg_[i]->Sumw2();
192  sprintf(name, "r1by9%d", i);
193  sprintf(title, "E1/E9 in %s", dets[i].c_str());
194  r1by9_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 100, 0.0, 1.0);
195  r1by9_[i]->GetXaxis()->SetTitle(title);
196  r1by9_[i]->GetYaxis()->SetTitle("Events");
197  r1by9_[i]->Sumw2();
198  sprintf(name, "r1by25%d", i);
199  sprintf(title, "E1/E25 in %s", dets[i].c_str());
200  r1by25_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 100, 0.0, 1.0);
201  r1by25_[i]->GetXaxis()->SetTitle(title);
202  r1by25_[i]->GetYaxis()->SetTitle("Events");
203  r1by25_[i]->Sumw2();
204  sprintf(name, "r9by25%d", i);
205  sprintf(title, "E9/E25 in %s", dets[i].c_str());
206  r9by25_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 100, 0.0, 1.0);
207  r9by25_[i]->GetXaxis()->SetTitle(title);
208  r9by25_[i]->GetYaxis()->SetTitle("Events");
209  r9by25_[i]->Sumw2();
210  double ymax = (i == 0) ? 0.0005 : 0.005;
211  sprintf(name, "sEtaEta%d", i);
212  sprintf(title, "Cov(#eta,#eta) in %s", dets[i].c_str());
213  sEtaEta_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 1000, 0.0, ymax);
214  sEtaEta_[i]->GetXaxis()->SetTitle(title);
215  sEtaEta_[i]->GetYaxis()->SetTitle("Events");
216  sEtaEta_[i]->Sumw2();
217  sprintf(name, "sEtaPhi%d", i);
218  sprintf(title, "Cov(#eta,#phi) in %s", dets[i].c_str());
219  sEtaPhi_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 1000, 0.0, ymax);
220  sEtaPhi_[i]->GetXaxis()->SetTitle(title);
221  sEtaPhi_[i]->GetYaxis()->SetTitle("Events");
222  sEtaPhi_[i]->Sumw2();
223  ymax = (i == 0) ? 0.001 : 0.01;
224  sprintf(name, "sPhiPhi%d", i);
225  sprintf(title, "Cov(#phi,#phi) in %s", dets[i].c_str());
226  sPhiPhi_[i] = tfile->make<TH1F>(name, dets[i].c_str(), 1000, 0.0, ymax);
227  sPhiPhi_[i]->GetXaxis()->SetTitle(title);
228  sPhiPhi_[i]->GetYaxis()->SetTitle("Events");
229  sPhiPhi_[i]->Sumw2();
230  if (i == 0) {
231  sprintf(title, "%s+", dets[i].c_str());
232  poszp_[i] = tfile->make<TH2F>("poszp0", title, 100, 0, 100, 360, 0, 360);
233  poszp_[i]->GetXaxis()->SetTitle("i#eta");
234  poszp_[i]->GetYaxis()->SetTitle("i#phi");
235  sprintf(title, "%s-", dets[i].c_str());
236  poszn_[i] = tfile->make<TH2F>("poszn0", title, 100, 0, 100, 360, 0, 360);
237  poszn_[i]->GetXaxis()->SetTitle("i#eta");
238  poszn_[i]->GetYaxis()->SetTitle("i#phi");
239  } else {
240  sprintf(title, "%s+", dets[i].c_str());
241  poszp_[i] = tfile->make<TH2F>("poszp1", title, 100, -200, 200, 100, -200, 200);
242  poszp_[i]->GetXaxis()->SetTitle("x (cm)");
243  poszp_[i]->GetYaxis()->SetTitle("y (cm)");
244  sprintf(title, "%s-", dets[i].c_str());
245  poszn_[i] = tfile->make<TH2F>("poszn1", title, 100, -200, 200, 100, -200, 200);
246  poszn_[i]->GetXaxis()->SetTitle("x (cm)");
247  poszn_[i]->GetYaxis()->SetTitle("y (cm)");
248  }
249  poszp_[i]->GetYaxis()->SetTitleOffset(1.2);
250  poszp_[i]->Sumw2();
251  poszn_[i]->GetYaxis()->SetTitleOffset(1.2);
252  poszn_[i]->Sumw2();
253  }
254 }
TH1F * etotg_[ndets_]
TH1F * hit_[ndets_]
TH1F * time_[ndets_]
TH1F * r1by25_[ndets_]
TH1F * sPhiPhi_[ndets_]
TH1F * edepEM_[ndets_]
TH1F * edepHad_[ndets_]
Definition: tfile.py:1
TH2F * poszp_[ndets_]
TH1F * sEtaPhi_[ndets_]
static const int ndets_
TH1F * edep_[ndets_]
TH1F * sEtaEta_[ndets_]
TH1F * edepAll_[ndets_]
TH1F * timeAll_[ndets_]
TH2F * poszn_[ndets_]
const double maxEnergy_
TH1F * r9by25_[ndets_]
TH1F * r1by9_[ndets_]
TH1F * etot_[ndets_]

◆ beginRun()

void EcalSimHitStudy::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprotected

Definition at line 55 of file EcalSimHitStudy.cc.

55 {}

◆ endRun()

void EcalSimHitStudy::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprotected

Definition at line 56 of file EcalSimHitStudy.cc.

56 {}

◆ fillDescriptions()

void EcalSimHitStudy::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 102 of file EcalSimHitStudy.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

102  {
104  std::vector<std::string> calonames;
105  desc.addUntracked<std::string>("ModuleLabel", "g4SimHits");
106  desc.addUntracked<std::vector<std::string>>("CaloCollection", calonames);
107  desc.addUntracked<std::string>("SourceLabel", "VtxSmeared");
108  desc.addUntracked<double>("MaxEnergy", 200.0);
109  desc.addUntracked<double>("TimeCut", 100.0);
110  desc.addUntracked<int>("SelectX", -1);
111  descriptions.add("EcalSimHitStudy", desc);
112 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ edep_

TH1F * EcalSimHitStudy::edep_[ndets_]
private

Definition at line 76 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ edepAll_

TH1F * EcalSimHitStudy::edepAll_[ndets_]
private

Definition at line 77 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ edepEM_

TH1F* EcalSimHitStudy::edepEM_[ndets_]
private

Definition at line 76 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ edepHad_

TH1F * EcalSimHitStudy::edepHad_[ndets_]
private

Definition at line 76 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ eneInc_

TH1F * EcalSimHitStudy::eneInc_
private

Definition at line 74 of file EcalSimHitStudy.cc.

Referenced by analyze(), and beginJob().

◆ etaInc_

TH1F * EcalSimHitStudy::etaInc_
private

Definition at line 74 of file EcalSimHitStudy.cc.

Referenced by analyze(), and beginJob().

◆ etot_

TH1F* EcalSimHitStudy::etot_[ndets_]
private

Definition at line 77 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ etotg_

TH1F * EcalSimHitStudy::etotg_[ndets_]
private

Definition at line 77 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ g4Label_

const std::string EcalSimHitStudy::g4Label_
private

Definition at line 67 of file EcalSimHitStudy.cc.

Referenced by EcalSimHitStudy().

◆ geometry_

const CaloGeometry* EcalSimHitStudy::geometry_
private

Definition at line 73 of file EcalSimHitStudy.cc.

Referenced by analyze(), and analyzeHits().

◆ hit_

TH1F* EcalSimHitStudy::hit_[ndets_]
private

Definition at line 75 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ hitLab_

const std::vector<std::string> EcalSimHitStudy::hitLab_
private

Definition at line 68 of file EcalSimHitStudy.cc.

Referenced by EcalSimHitStudy().

◆ maxEnergy_

const double EcalSimHitStudy::maxEnergy_
private

Definition at line 69 of file EcalSimHitStudy.cc.

Referenced by beginJob().

◆ ndets_

const int EcalSimHitStudy::ndets_ = 2
staticprivate

Definition at line 65 of file EcalSimHitStudy.cc.

Referenced by beginJob().

◆ phiInc_

TH1F * EcalSimHitStudy::phiInc_
private

Definition at line 74 of file EcalSimHitStudy.cc.

Referenced by analyze(), and beginJob().

◆ poszn_

TH2F * EcalSimHitStudy::poszn_[ndets_]
private

Definition at line 80 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ poszp_

TH2F* EcalSimHitStudy::poszp_[ndets_]
private

Definition at line 80 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ ptInc_

TH1F* EcalSimHitStudy::ptInc_
private

Definition at line 74 of file EcalSimHitStudy.cc.

Referenced by analyze(), and beginJob().

◆ r1by25_

TH1F * EcalSimHitStudy::r1by25_[ndets_]
private

Definition at line 78 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ r1by9_

TH1F* EcalSimHitStudy::r1by9_[ndets_]
private

Definition at line 78 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ r9by25_

TH1F * EcalSimHitStudy::r9by25_[ndets_]
private

Definition at line 78 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ selX_

const int EcalSimHitStudy::selX_
private

Definition at line 70 of file EcalSimHitStudy.cc.

Referenced by analyzeHits().

◆ sEtaEta_

TH1F* EcalSimHitStudy::sEtaEta_[ndets_]
private

Definition at line 79 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ sEtaPhi_

TH1F * EcalSimHitStudy::sEtaPhi_[ndets_]
private

Definition at line 79 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ sPhiPhi_

TH1F * EcalSimHitStudy::sPhiPhi_[ndets_]
private

Definition at line 79 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ time_

TH1F * EcalSimHitStudy::time_[ndets_]
private

Definition at line 75 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ timeAll_

TH1F * EcalSimHitStudy::timeAll_[ndets_]
private

Definition at line 75 of file EcalSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ tmax_

const double EcalSimHitStudy::tmax_
private

Definition at line 69 of file EcalSimHitStudy.cc.

Referenced by analyzeHits().

◆ tok_evt_

const edm::EDGetTokenT<edm::HepMCProduct> EcalSimHitStudy::tok_evt_
private

Definition at line 71 of file EcalSimHitStudy.cc.

Referenced by analyze().

◆ tokGeom_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EcalSimHitStudy::tokGeom_
private

Definition at line 66 of file EcalSimHitStudy.cc.

Referenced by analyze().

◆ toks_calo_

const std::vector<edm::EDGetTokenT<edm::PCaloHitContainer> > EcalSimHitStudy::toks_calo_
private

Definition at line 72 of file EcalSimHitStudy.cc.

Referenced by analyze().

◆ w0_

const double EcalSimHitStudy::w0_
private

Definition at line 69 of file EcalSimHitStudy.cc.

Referenced by analyzeHits().