42 #include "Randomize.hh"
45 #include <CLHEP/Units/GlobalSystemOfUnits.h>
46 #include <CLHEP/Units/GlobalPhysicalConstants.h>
92 usesResource(
"TFileService");
109 double beamEta = (maxEta + minEta) * 0.5;
110 double beamPhi = (maxPhi +
minPhi) * 0.5;
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
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"
149 edm::LogInfo(
"HcalTB06Analysis") <<
" =====> End of Run; Total number of events: " <<
count;
161 std::vector<double> eCalo(6, 0), eTrig(7, 0);
163 const std::vector<PCaloHit>* EcalHits =
nullptr;
169 const std::vector<PCaloHit>* HcalHits = Hcal.
product();
171 const std::vector<PCaloHit>* BeamHits = Beam.
product();
180 ne = EcalHits->size();
181 for (
unsigned int i = 0;
i < ne; ++
i) {
182 EBDetId ecalid((*EcalHits)[
i].
id());
191 eCalo[0] += (*EcalHits)[
i].energy();
200 nh = HcalHits->size();
201 for (
unsigned int i = 0;
i <
nh; ++
i) {
206 << (*HcalHits)[
i].time() <<
":" <<
m_timeLimit <<
" " << (*HcalHits)[
i].energy();
212 eCalo[2] += (*HcalHits)[
i].energy();
214 eCalo[4] += (*HcalHits)[
i].energy();
224 double etots = eecals + ehcals;
226 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Etot(MeV)= " << etots <<
" E(Ecal)= " << eecals
227 <<
" E(Hcal)= " << ehcals <<
" Nhits(ECAL)= " << ne <<
" Nhits(HCAL)= " <<
nh;
231 for (
unsigned int i = 0;
i < BeamHits->size(); ++
i) {
232 unsigned int id = ((*BeamHits)[
i].id());
233 int 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();
247 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Trigger Info: " << eTrig[0] <<
":" << eTrig[1] <<
":" << eTrig[2]
248 <<
":" << eTrig[3] <<
":" << eTrig[4] <<
":" << eTrig[5] <<
":" << eTrig[6];
const HcalTB06Analysis & operator=(const HcalTB06Analysis &)=delete
Log< level::Info, true > LogVerbatim
const edm::EventSetup & c
edm::EDGetTokenT< edm::PCaloHitContainer > m_BeamToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
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
constexpr HcalSubdetector subdet() const
get the subdetector
void fillTree(std::vector< double > &ecalo, std::vector< double > &etrig)
constexpr int iphi() const
get the cell iphi
edm::EDGetTokenT< edm::PCaloHitContainer > m_HcalToken
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
int ieta() const
get the crystal ieta
Log< level::Info, false > LogInfo
T const * product() const
T getParameter(std::string const &) 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