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; }
85 <<
"Beam parameters: E(GeV)= " << m_ener
86 <<
" pdgID= " << m_PDG[0]
87 <<
"\n eta= " << m_eta
93 <<
"\n EcalFactor= " << m_factEcal
94 <<
" EcalWidth= " << m_widthEcal <<
" GeV" 95 <<
"\n HcalFactor= " << m_factHcal
96 <<
" HcalWidth= " << m_widthHcal <<
" GeV" 97 <<
"\n TimeLimit= " << m_timeLimit <<
" ns" <<
"\n";
106 edm::LogInfo(
"HcalTB06Analysis") <<
" =====> Begin of Run";
111 <<
" =====> End of Run; Total number of events: " <<
count;
124 std::vector<double> eCalo(6,0), eTrig(7,0);
126 const std::vector<PCaloHit>* EcalHits =
nullptr;
132 const std::vector<PCaloHit>* HcalHits = Hcal.
product();
134 const std::vector<PCaloHit>* BeamHits = Beam.
product();
143 ne = EcalHits->size();
144 for (
unsigned int i=0;
i<
ne; ++
i) {
145 EBDetId ecalid((*EcalHits)[
i].
id());
150 << (*EcalHits)[
i].energy() << std::endl;
156 eCalo[0] += (*EcalHits)[
i].energy();
165 nh = HcalHits->size();
166 for (
unsigned int i=0;
i<nh; ++
i) {
173 << (*HcalHits)[
i].energy() << std::endl;
180 eCalo[2] += (*HcalHits)[
i].energy();
182 eCalo[4] += (*HcalHits)[
i].energy();
192 double etots = eecals + ehcals;
194 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Etot(MeV)= " << etots
195 <<
" E(Ecal)= " << eecals
196 <<
" E(Hcal)= " << ehcals
197 <<
" Nhits(ECAL)= " << ne
198 <<
" Nhits(HCAL)= " << nh;
202 for (
unsigned int i=0;
i<BeamHits->size(); ++
i) {
203 unsigned int id = ((*BeamHits)[
i].id());
204 int det, lay, ix, iy;
207 if (lay > 0 && lay <= 4) {
208 eTrig[lay-1] += (*BeamHits)[
i].energy();
209 }
else if (lay == 7 || lay == 8) {
210 eTrig[lay-2] += (*BeamHits)[
i].energy();
211 }
else if (lay >= 11 && lay <= 14) {
212 eTrig[4] += (*BeamHits)[
i].energy();
218 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Trigger Info: " 219 << eTrig[0] <<
":" << eTrig[1] <<
":" << eTrig[2]
220 <<
":" << eTrig[3] <<
":" << eTrig[4] <<
":" 221 << 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