42 #include "CLHEP/Units/GlobalSystemOfUnits.h" 43 #include "CLHEP/Units/GlobalPhysicalConstants.h" 45 #include "Randomize.hh" 94 usesResource(
"TFileService");
111 double beamEta = (maxEta +
minEta) * 0.5;
112 double beamPhi = (maxPhi +
minPhi) * 0.5;
134 edm::LogInfo(
"HcalTB06Analysis") <<
"Beam parameters: E(GeV)= " << m_ener <<
" pdgID= " << m_PDG[0]
135 <<
"\n eta= " << m_eta <<
" idx_etaEcal= " <<
m_idxetaEcal 136 <<
" idx_etaHcal= " <<
m_idxetaHcal <<
" phi= " << m_phi
138 <<
"\n EcalFactor= " << m_factEcal <<
" EcalWidth= " << m_widthEcal <<
" GeV" 139 <<
"\n HcalFactor= " << m_factHcal <<
" HcalWidth= " << m_widthHcal <<
" GeV" 140 <<
" MIP= " << eMIP <<
" GeV" 141 <<
"\n TimeLimit= " << m_timeLimit <<
" ns" 151 edm::LogInfo(
"HcalTB06Analysis") <<
" =====> End of Run; Total number of events: " <<
count;
163 std::vector<double> eCalo(6, 0), eTrig(7, 0);
165 const std::vector<PCaloHit>* EcalHits =
nullptr;
171 const std::vector<PCaloHit>* HcalHits = Hcal.
product();
173 const std::vector<PCaloHit>* BeamHits = Beam.
product();
182 ne = EcalHits->size();
183 for (
unsigned int i = 0;
i <
ne; ++
i) {
184 EBDetId ecalid((*EcalHits)[
i].
id());
188 << (*EcalHits)[
i].energy() << std::endl;
193 eCalo[0] += (*EcalHits)[
i].energy();
202 nh = HcalHits->size();
203 for (
unsigned int i = 0;
i < nh; ++
i) {
208 << (*HcalHits)[
i].energy() << std::endl;
214 eCalo[2] += (*HcalHits)[
i].energy();
216 eCalo[4] += (*HcalHits)[
i].energy();
226 double etots = eecals + ehcals;
228 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Etot(MeV)= " << etots <<
" E(Ecal)= " << eecals
229 <<
" E(Hcal)= " << ehcals <<
" Nhits(ECAL)= " << ne <<
" Nhits(HCAL)= " << nh;
233 for (
unsigned int i = 0;
i < BeamHits->size(); ++
i) {
234 unsigned int id = ((*BeamHits)[
i].id());
235 int det, lay, ix, iy;
238 if (lay > 0 && lay <= 4) {
239 eTrig[lay - 1] += (*BeamHits)[
i].energy();
240 }
else if (lay == 7 || lay == 8) {
241 eTrig[lay - 2] += (*BeamHits)[
i].energy();
242 }
else if (lay >= 11 && lay <= 14) {
243 eTrig[4] += (*BeamHits)[
i].energy();
249 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Trigger Info: " << eTrig[0] <<
":" << eTrig[1] <<
":" << eTrig[2]
250 <<
":" << eTrig[3] <<
":" << eTrig[4] <<
":" << eTrig[5] <<
":" << eTrig[6];
const HcalTB06Analysis & operator=(const HcalTB06Analysis &)=delete
T getParameter(std::string const &) const
HcalSubdetector subdet() const
get the subdetector
edm::EDGetTokenT< edm::PCaloHitContainer > m_BeamToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void fillEdep(double etots, double eecals, double ehcals)
int iphi() const
get the crystal iphi
void fillTree(std::vector< double > &ecalo, std::vector< double > &etrig)
#define DEFINE_FWK_MODULE(type)
int ieta() const
get the cell ieta
edm::EDGetTokenT< edm::PCaloHitContainer > m_HcalToken
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
int iphi() const
get the cell iphi
T const * product() const
~HcalTB06Analysis() override
HcalTB06Analysis(const edm::ParameterSet &p)
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