CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalTB06Analysis Class Reference
Inheritance diagram for HcalTB06Analysis:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
void endJob () override
 
 HcalTB06Analysis (const edm::ParameterSet &p)
 
 HcalTB06Analysis (const HcalTB06Analysis &)=delete
 
const HcalTB06Analysisoperator= (const HcalTB06Analysis &)=delete
 
 ~HcalTB06Analysis () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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)
 

Private Attributes

int count
 
const edm::EDGetTokenT< edm::PCaloHitContainerm_BeamToken
 
const bool m_ECAL
 
edm::EDGetTokenT< edm::PCaloHitContainerm_EcalToken
 
const double m_eMIP
 
const double m_ener
 
const double m_eta
 
const double m_factEcal
 
const double m_factHcal
 
const edm::EDGetTokenT< edm::PCaloHitContainerm_HcalToken
 
std::unique_ptr< HcalTB06Histom_histo
 
int m_idxetaEcal
 
int m_idxetaHcal
 
int m_idxphiEcal
 
int m_idxphiHcal
 
const std::vector< int > m_PDG
 
const double m_phi
 
const edm::ParameterSet m_ptb
 
const double m_timeLimit
 
const double m_widthEcal
 
const double m_widthHcal
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 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)
 

Detailed Description

Definition at line 58 of file HcalTB06Analysis.cc.

Constructor & Destructor Documentation

◆ HcalTB06Analysis() [1/2]

HcalTB06Analysis::HcalTB06Analysis ( const edm::ParameterSet p)
explicit

Definition at line 98 of file HcalTB06Analysis.cc.

References ProducerED_cfi::InputTag, m_ECAL, m_EcalToken, m_eMIP, m_ener, m_eta, m_factEcal, m_factHcal, m_histo, m_idxetaEcal, m_idxetaHcal, m_idxphiEcal, m_idxphiHcal, m_PDG, m_phi, m_ptb, m_timeLimit, m_widthEcal, m_widthHcal, razorScouting_cff::maxEta, HLT_2024v14_cff::maxPhi, EgHLTOffEleSelection_cfi::minEta, HLT_2024v14_cff::minPhi, and AlCaHLTBitMon_ParallelJobs::p.

99  : m_ECAL(p.getParameter<bool>("ECAL")),
100  m_eta(p.getParameter<double>("MinEta")),
101  m_phi(p.getParameter<double>("MinPhi")),
102  m_ener(p.getParameter<double>("MinE")),
103  m_PDG(p.getParameter<std::vector<int> >("PartID")),
104  m_HcalToken(consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "HcalHits"))),
105  m_BeamToken(consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "HcalTB06BeamHits"))),
106  m_ptb(p.getParameter<edm::ParameterSet>("TestBeamAnalysis")),
107  m_timeLimit(m_ptb.getParameter<double>("TimeLimit")),
108  m_widthEcal(m_ptb.getParameter<double>("EcalWidth")),
109  m_widthHcal(m_ptb.getParameter<double>("HcalWidth")),
110  m_factEcal(m_ptb.getParameter<double>("EcalFactor")),
111  m_factHcal(m_ptb.getParameter<double>("HcalFactor")),
112  m_eMIP(m_ptb.getParameter<double>("MIP")),
113  count(0) {
114  usesResource("TFileService");
115  if (m_ECAL)
116  m_EcalToken = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalHitsEB"));
117  double minEta = p.getParameter<double>("MinEta");
118  double maxEta = p.getParameter<double>("MaxEta");
119  double minPhi = p.getParameter<double>("MinPhi");
120  double maxPhi = p.getParameter<double>("MaxPhi");
121  double beamEta = (maxEta + minEta) * 0.5;
122  double beamPhi = (maxPhi + minPhi) * 0.5;
123  if (beamPhi < 0) {
124  beamPhi += twopi;
125  }
126 
127  m_idxetaEcal = 13;
128  m_idxphiEcal = 13;
129 
130  m_idxetaHcal = static_cast<int>(beamEta / 0.087) + 1;
131  m_idxphiHcal = static_cast<int>(beamPhi / 0.087) + 6;
132  if (m_idxphiHcal > 72) {
133  m_idxphiHcal -= 73;
134  }
135 
136  edm::LogInfo("HcalTB06Analysis") << "Beam parameters: E(GeV)= " << m_ener << " pdgID= " << m_PDG[0]
137  << "\n eta= " << m_eta << " idx_etaEcal= " << m_idxetaEcal
138  << " idx_etaHcal= " << m_idxetaHcal << " phi= " << m_phi
139  << " idx_phiEcal= " << m_idxphiEcal << " idx_phiHcal= " << m_idxphiHcal
140  << "\n EcalFactor= " << m_factEcal << " EcalWidth= " << m_widthEcal << " GeV"
141  << "\n HcalFactor= " << m_factHcal << " HcalWidth= " << m_widthHcal << " GeV"
142  << " MIP= " << m_eMIP << " GeV"
143  << "\n TimeLimit= " << m_timeLimit << " ns"
144  << "\n";
145  m_histo = std::make_unique<HcalTB06Histo>(m_ptb);
146 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::vector< int > m_PDG
const double m_timeLimit
const double m_eta
const double m_eMIP
const edm::ParameterSet m_ptb
const edm::EDGetTokenT< edm::PCaloHitContainer > m_HcalToken
std::unique_ptr< HcalTB06Histo > m_histo
const edm::EDGetTokenT< edm::PCaloHitContainer > m_BeamToken
const double m_widthEcal
const double m_factHcal
Log< level::Info, false > LogInfo
const double m_widthHcal
const double m_ener
const double m_phi
const double m_factEcal
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken

◆ ~HcalTB06Analysis()

HcalTB06Analysis::~HcalTB06Analysis ( )
overridedefault

◆ HcalTB06Analysis() [2/2]

HcalTB06Analysis::HcalTB06Analysis ( const HcalTB06Analysis )
delete

Member Function Documentation

◆ analyze()

void HcalTB06Analysis::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 154 of file HcalTB06Analysis.cc.

References funct::abs(), count, edm::Event::getHandle(), HcalOuter, mps_fire::i, EBDetId::ieta(), HcalDetId::ieta(), EBDetId::iphi(), HcalDetId::iphi(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), m_BeamToken, m_ECAL, m_EcalToken, m_ener, m_eta, m_factEcal, m_factHcal, m_HcalToken, m_histo, m_idxetaEcal, m_idxetaHcal, m_idxphiEcal, m_idxphiHcal, m_phi, m_timeLimit, m_widthEcal, m_widthHcal, compareTotals::ne, cms::cuda::nh, edm::Handle< T >::product(), HcalDetId::subdet(), hcalRecHitTable_cff::time, and HcalTestBeamNumbering::unpackIndex().

154  {
155  ++count;
156 
157  //Beam Information
158  m_histo->fillPrimary(m_ener, m_eta, m_phi);
159 
160  std::vector<double> eCalo(6, 0), eTrig(7, 0);
161 
162  const std::vector<PCaloHit>* EcalHits = nullptr;
163  if (m_ECAL) {
164  const edm::Handle<edm::PCaloHitContainer>& Ecal = evt.getHandle(m_EcalToken);
165  EcalHits = Ecal.product();
166  }
167  const edm::Handle<edm::PCaloHitContainer>& Hcal = evt.getHandle(m_HcalToken);
168  const std::vector<PCaloHit>* HcalHits = Hcal.product();
169  const edm::Handle<edm::PCaloHitContainer>& Beam = evt.getHandle(m_BeamToken);
170  const std::vector<PCaloHit>* BeamHits = Beam.product();
171 
172  // Total Energy
173  double eecals = 0.;
174  double ehcals = 0.;
175 
176  unsigned int ne = 0;
177  unsigned int nh = 0;
178  if (m_ECAL) {
179  ne = EcalHits->size();
180  for (unsigned int i = 0; i < ne; ++i) {
181  EBDetId ecalid((*EcalHits)[i].id());
182 #ifdef EDM_ML_DEBUG
183  edm::LogVerbatim("HcalTBSim") << "EB " << i << " " << ecalid.ieta() << ":" << m_idxetaEcal << " "
184  << ecalid.iphi() << ":" << m_idxphiEcal << " " << (*EcalHits)[i].time() << ":"
185  << m_timeLimit << " " << (*EcalHits)[i].energy();
186 #endif
187  // 7x7 crystal selection
188  if (std::abs(m_idxetaEcal - ecalid.ieta()) <= 3 && std::abs(m_idxphiEcal - ecalid.iphi()) <= 3 &&
189  (*EcalHits)[i].time() < m_timeLimit) {
190  eCalo[0] += (*EcalHits)[i].energy();
191  }
192  }
193  if (m_widthEcal > 0.0) {
194  eCalo[1] = G4RandGauss::shoot(0.0, m_widthEcal);
195  }
196  eecals = m_factEcal * (eCalo[0] + eCalo[1]);
197  }
198  if (HcalHits) {
199  nh = HcalHits->size();
200  for (unsigned int i = 0; i < nh; ++i) {
201  HcalDetId hcalid((*HcalHits)[i].id());
202 #ifdef EDM_ML_DEBUG
203  edm::LogVerbatim("HcalTBSim") << "HC " << i << " " << hcalid.subdet() << " " << hcalid.ieta() << ":"
204  << m_idxetaHcal << " " << hcalid.iphi() << ":" << m_idxphiHcal << " "
205  << (*HcalHits)[i].time() << ":" << m_timeLimit << " " << (*HcalHits)[i].energy();
206 #endif
207  // 3x3 towers selection
208  if (std::abs(m_idxetaHcal - hcalid.ieta()) <= 1 && std::abs(m_idxphiHcal - hcalid.iphi()) <= 1 &&
209  (*HcalHits)[i].time() < m_timeLimit) {
210  if (hcalid.subdet() != HcalOuter) {
211  eCalo[2] += (*HcalHits)[i].energy();
212  } else {
213  eCalo[4] += (*HcalHits)[i].energy();
214  }
215  }
216  }
217  if (m_widthHcal > 0.0) {
218  eCalo[3] = G4RandGauss::shoot(0.0, m_widthHcal);
219  eCalo[5] = G4RandGauss::shoot(0.0, m_widthHcal);
220  }
221  ehcals = m_factHcal * eCalo[2] + eCalo[3];
222  }
223  double etots = eecals + ehcals;
224 
225  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis:: Etot(MeV)= " << etots << " E(Ecal)= " << eecals
226  << " E(Hcal)= " << ehcals << " Nhits(ECAL)= " << ne << " Nhits(HCAL)= " << nh;
227  m_histo->fillEdep(etots, eecals, ehcals);
228 
229  if (BeamHits) {
230  for (unsigned int i = 0; i < BeamHits->size(); ++i) {
231  unsigned int id = ((*BeamHits)[i].id());
232  int det, lay, ix, iy;
233  HcalTestBeamNumbering::unpackIndex(id, det, lay, ix, iy);
234  if ((det == 1) && ((*BeamHits)[i].time() < m_timeLimit)) {
235  if (lay > 0 && lay <= 4) {
236  eTrig[lay - 1] += (*BeamHits)[i].energy();
237  } else if (lay == 7 || lay == 8) {
238  eTrig[lay - 2] += (*BeamHits)[i].energy();
239  } else if (lay >= 11 && lay <= 14) {
240  eTrig[4] += (*BeamHits)[i].energy();
241  }
242  }
243  }
244  }
245 
246  edm::LogInfo("HcalTBSim") << "HcalTB06Analysis:: Trigger Info: " << eTrig[0] << ":" << eTrig[1] << ":" << eTrig[2]
247  << ":" << eTrig[3] << ":" << eTrig[4] << ":" << eTrig[5] << ":" << eTrig[6];
248 
249  m_histo->fillTree(eCalo, eTrig);
250 }
Log< level::Info, true > LogVerbatim
const double m_timeLimit
T const * product() const
Definition: Handle.h:70
const double m_eta
const edm::EDGetTokenT< edm::PCaloHitContainer > m_HcalToken
std::unique_ptr< HcalTB06Histo > m_histo
const edm::EDGetTokenT< edm::PCaloHitContainer > m_BeamToken
const double m_widthEcal
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double m_factHcal
uint32_t nh
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
const double m_widthHcal
const double m_ener
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
const double m_phi
const double m_factEcal
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken

◆ beginJob()

void HcalTB06Analysis::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 148 of file HcalTB06Analysis.cc.

148 { edm::LogInfo("HcalTB06Analysis") << " =====> Begin of Run"; }
Log< level::Info, false > LogInfo

◆ endJob()

void HcalTB06Analysis::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 150 of file HcalTB06Analysis.cc.

References count.

150  {
151  edm::LogInfo("HcalTB06Analysis") << " =====> End of Run; Total number of events: " << count;
152 }
Log< level::Info, false > LogInfo

◆ operator=()

const HcalTB06Analysis& HcalTB06Analysis::operator= ( const HcalTB06Analysis )
delete

Member Data Documentation

◆ count

int HcalTB06Analysis::count
private

Definition at line 89 of file HcalTB06Analysis.cc.

Referenced by analyze(), and endJob().

◆ m_BeamToken

const edm::EDGetTokenT<edm::PCaloHitContainer> HcalTB06Analysis::m_BeamToken
private

Definition at line 79 of file HcalTB06Analysis.cc.

Referenced by analyze().

◆ m_ECAL

const bool HcalTB06Analysis::m_ECAL
private

Definition at line 71 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_EcalToken

edm::EDGetTokenT<edm::PCaloHitContainer> HcalTB06Analysis::m_EcalToken
private

Definition at line 77 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_eMIP

const double HcalTB06Analysis::m_eMIP
private

Definition at line 87 of file HcalTB06Analysis.cc.

Referenced by HcalTB06Analysis().

◆ m_ener

const double HcalTB06Analysis::m_ener
private

Definition at line 74 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_eta

const double HcalTB06Analysis::m_eta
private

Definition at line 72 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_factEcal

const double HcalTB06Analysis::m_factEcal
private

Definition at line 85 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_factHcal

const double HcalTB06Analysis::m_factHcal
private

Definition at line 86 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_HcalToken

const edm::EDGetTokenT<edm::PCaloHitContainer> HcalTB06Analysis::m_HcalToken
private

Definition at line 78 of file HcalTB06Analysis.cc.

Referenced by analyze().

◆ m_histo

std::unique_ptr<HcalTB06Histo> HcalTB06Analysis::m_histo
private

Definition at line 95 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_idxetaEcal

int HcalTB06Analysis::m_idxetaEcal
private

Definition at line 90 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_idxetaHcal

int HcalTB06Analysis::m_idxetaHcal
private

Definition at line 92 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_idxphiEcal

int HcalTB06Analysis::m_idxphiEcal
private

Definition at line 91 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_idxphiHcal

int HcalTB06Analysis::m_idxphiHcal
private

Definition at line 93 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_PDG

const std::vector<int> HcalTB06Analysis::m_PDG
private

Definition at line 75 of file HcalTB06Analysis.cc.

Referenced by HcalTB06Analysis().

◆ m_phi

const double HcalTB06Analysis::m_phi
private

Definition at line 73 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_ptb

const edm::ParameterSet HcalTB06Analysis::m_ptb
private

Definition at line 81 of file HcalTB06Analysis.cc.

Referenced by HcalTB06Analysis().

◆ m_timeLimit

const double HcalTB06Analysis::m_timeLimit
private

Definition at line 82 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_widthEcal

const double HcalTB06Analysis::m_widthEcal
private

Definition at line 83 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

◆ m_widthHcal

const double HcalTB06Analysis::m_widthHcal
private

Definition at line 84 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().