CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
- 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 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

int count
 
edm::EDGetTokenT
< edm::PCaloHitContainer
m_BeamToken
 
bool m_ECAL
 
edm::EDGetTokenT
< edm::PCaloHitContainer
m_EcalToken
 
double m_ener
 
double m_eta
 
double m_factEcal
 
double m_factHcal
 
edm::EDGetTokenT
< edm::PCaloHitContainer
m_HcalToken
 
HcalTB06Histom_histo
 
int m_idxetaEcal
 
int m_idxetaHcal
 
int m_idxphiEcal
 
int m_idxphiHcal
 
std::vector< int > m_PDG
 
double m_phi
 
double m_timeLimit
 
double m_widthEcal
 
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< B > consumes (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 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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 54 of file HcalTB06Analysis.cc.

Constructor & Destructor Documentation

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

Definition at line 91 of file HcalTB06Analysis.cc.

References edm::ParameterSet::getParameter(), HLT_FULL_cff::InputTag, 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_PDG, m_phi, m_timeLimit, m_widthEcal, m_widthHcal, maxEta, HLT_FULL_cff::maxPhi, and HLT_FULL_cff::minPhi.

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

Definition at line 144 of file HcalTB06Analysis.cc.

References m_histo.

144 { delete m_histo; }
HcalTB06Histo * m_histo
HcalTB06Analysis::HcalTB06Analysis ( const HcalTB06Analysis )
delete

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 152 of file HcalTB06Analysis.cc.

References funct::abs(), count, HcalTB06Histo::fillEdep(), HcalTB06Histo::fillPrimary(), HcalTB06Histo::fillTree(), edm::Event::getByToken(), HcalOuter, mps_fire::i, EBDetId::ieta(), HcalDetId::ieta(), EBDetId::iphi(), HcalDetId::iphi(), 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, cms::cuda::nh, edm::Handle< T >::product(), HcalDetId::subdet(), and HcalTestBeamNumbering::unpackIndex().

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 146 of file HcalTB06Analysis.cc.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 148 of file HcalTB06Analysis.cc.

References count.

148  {
149  edm::LogInfo("HcalTB06Analysis") << " =====> End of Run; Total number of events: " << count;
150 }
Log< level::Info, false > LogInfo
const HcalTB06Analysis& HcalTB06Analysis::operator= ( const HcalTB06Analysis )
delete

Member Data Documentation

int HcalTB06Analysis::count
private

Definition at line 72 of file HcalTB06Analysis.cc.

Referenced by analyze(), and endJob().

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

Definition at line 69 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

bool HcalTB06Analysis::m_ECAL
private

Definition at line 70 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

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

Definition at line 67 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_ener
private

Definition at line 80 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_eta
private

Definition at line 78 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_factEcal
private

Definition at line 84 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_factHcal
private

Definition at line 85 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

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

Definition at line 68 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

HcalTB06Histo* HcalTB06Analysis::m_histo
private

Definition at line 88 of file HcalTB06Analysis.cc.

Referenced by analyze(), HcalTB06Analysis(), and ~HcalTB06Analysis().

int HcalTB06Analysis::m_idxetaEcal
private

Definition at line 73 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

int HcalTB06Analysis::m_idxetaHcal
private

Definition at line 75 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

int HcalTB06Analysis::m_idxphiEcal
private

Definition at line 74 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

int HcalTB06Analysis::m_idxphiHcal
private

Definition at line 76 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

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

Definition at line 86 of file HcalTB06Analysis.cc.

Referenced by HcalTB06Analysis().

double HcalTB06Analysis::m_phi
private

Definition at line 79 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_timeLimit
private

Definition at line 81 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_widthEcal
private

Definition at line 82 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_widthHcal
private

Definition at line 83 of file HcalTB06Analysis.cc.

Referenced by analyze(), and HcalTB06Analysis().