33 #include "CLHEP/Units/GlobalSystemOfUnits.h" 34 #include "CLHEP/Units/GlobalPhysicalConstants.h" 36 #include "Randomize.hh" 49 usesResource(
"TFileService");
66 double beamEta = (maxEta+
minEta)*0.5;
67 double beamPhi = (maxPhi+
minPhi)*0.5;
68 if (beamPhi < 0) { beamPhi += twopi; }
86 <<
"Beam parameters: E(GeV)= " << m_ener
87 <<
" pdgID= " << m_PDG[0]
88 <<
"\n eta= " << m_eta
94 <<
"\n EcalFactor= " << m_factEcal
95 <<
" EcalWidth= " << m_widthEcal <<
" GeV" 96 <<
"\n HcalFactor= " << m_factHcal
97 <<
" HcalWidth= " << m_widthHcal <<
" GeV" 98 <<
" MIP= " << eMIP <<
" GeV" 99 <<
"\n TimeLimit= " << m_timeLimit <<
" ns" <<
"\n";
108 edm::LogInfo(
"HcalTB06Analysis") <<
" =====> Begin of Run";
113 <<
" =====> End of Run; Total number of events: " <<
count;
126 std::vector<double> eCalo(6,0), eTrig(7,0);
128 const std::vector<PCaloHit>* EcalHits =
nullptr;
134 const std::vector<PCaloHit>* HcalHits = Hcal.
product();
136 const std::vector<PCaloHit>* BeamHits = Beam.
product();
145 ne = EcalHits->size();
146 for (
unsigned int i=0;
i<
ne; ++
i) {
147 EBDetId ecalid((*EcalHits)[
i].
id());
152 << (*EcalHits)[
i].energy() << std::endl;
158 eCalo[0] += (*EcalHits)[
i].energy();
167 nh = HcalHits->size();
168 for (
unsigned int i=0;
i<nh; ++
i) {
175 << (*HcalHits)[
i].energy() << std::endl;
182 eCalo[2] += (*HcalHits)[
i].energy();
184 eCalo[4] += (*HcalHits)[
i].energy();
194 double etots = eecals + ehcals;
196 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Etot(MeV)= " << etots
197 <<
" E(Ecal)= " << eecals
198 <<
" E(Hcal)= " << ehcals
199 <<
" Nhits(ECAL)= " << ne
200 <<
" Nhits(HCAL)= " << nh;
204 for (
unsigned int i=0;
i<BeamHits->size(); ++
i) {
205 unsigned int id = ((*BeamHits)[
i].id());
206 int det, lay, ix, iy;
209 if (lay > 0 && lay <= 4) {
210 eTrig[lay-1] += (*BeamHits)[
i].energy();
211 }
else if (lay == 7 || lay == 8) {
212 eTrig[lay-2] += (*BeamHits)[
i].energy();
213 }
else if (lay >= 11 && lay <= 14) {
214 eTrig[4] += (*BeamHits)[
i].energy();
220 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Trigger Info: " 221 << eTrig[0] <<
":" << eTrig[1] <<
":" << eTrig[2]
222 <<
":" << eTrig[3] <<
":" << eTrig[4] <<
":" 223 << eTrig[5] <<
":" << eTrig[6];
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)
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