42 #include "Randomize.hh" 45 #include <CLHEP/Units/GlobalSystemOfUnits.h> 46 #include <CLHEP/Units/GlobalPhysicalConstants.h> 96 : m_ECAL(
p.getParameter<
bool>(
"ECAL")),
97 m_eta(
p.getParameter<double>(
"MinEta")),
98 m_phi(
p.getParameter<double>(
"MinPhi")),
99 m_ener(
p.getParameter<double>(
"MinE")),
104 m_timeLimit(m_ptb.getParameter<double>(
"TimeLimit")),
105 m_widthEcal(m_ptb.getParameter<double>(
"EcalWidth")),
106 m_widthHcal(m_ptb.getParameter<double>(
"HcalWidth")),
107 m_factEcal(m_ptb.getParameter<double>(
"EcalFactor")),
108 m_factHcal(m_ptb.getParameter<double>(
"HcalFactor")),
109 m_eMIP(m_ptb.getParameter<double>(
"MIP")),
111 usesResource(
"TFileService");
114 double minEta =
p.getParameter<
double>(
"MinEta");
115 double maxEta =
p.getParameter<
double>(
"MaxEta");
116 double minPhi =
p.getParameter<
double>(
"MinPhi");
117 double maxPhi =
p.getParameter<
double>(
"MaxPhi");
139 <<
" MIP= " <<
m_eMIP <<
" GeV" 148 edm::LogInfo(
"HcalTB06Analysis") <<
" =====> End of Run; Total number of events: " <<
count;
157 std::vector<double> eCalo(6, 0), eTrig(7, 0);
159 const std::vector<PCaloHit>* EcalHits =
nullptr;
165 const std::vector<PCaloHit>* HcalHits = Hcal.
product();
167 const std::vector<PCaloHit>* BeamHits = Beam.
product();
176 ne = EcalHits->size();
177 for (
unsigned int i = 0;
i <
ne; ++
i) {
178 EBDetId ecalid((*EcalHits)[
i].
id());
187 eCalo[0] += (*EcalHits)[
i].energy();
196 nh = HcalHits->size();
197 for (
unsigned int i = 0;
i <
nh; ++
i) {
202 << (*HcalHits)[
i].time() <<
":" <<
m_timeLimit <<
" " << (*HcalHits)[
i].energy();
208 eCalo[2] += (*HcalHits)[
i].energy();
210 eCalo[4] += (*HcalHits)[
i].energy();
220 double etots = eecals + ehcals;
222 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Etot(MeV)= " << etots <<
" E(Ecal)= " << eecals
223 <<
" E(Hcal)= " << ehcals <<
" Nhits(ECAL)= " <<
ne <<
" Nhits(HCAL)= " <<
nh;
224 m_histo->fillEdep(etots, eecals, ehcals);
227 for (
unsigned int i = 0;
i < BeamHits->size(); ++
i) {
228 unsigned int id = ((*BeamHits)[
i].id());
229 int det, lay, ix, iy;
232 if (lay > 0 && lay <= 4) {
233 eTrig[lay - 1] += (*BeamHits)[
i].energy();
234 }
else if (lay == 7 || lay == 8) {
235 eTrig[lay - 2] += (*BeamHits)[
i].energy();
236 }
else if (lay >= 11 && lay <= 14) {
237 eTrig[4] += (*BeamHits)[
i].energy();
243 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Trigger Info: " << eTrig[0] <<
":" << eTrig[1] <<
":" << eTrig[2]
244 <<
":" << eTrig[3] <<
":" << eTrig[4] <<
":" << eTrig[5] <<
":" << eTrig[6];
246 m_histo->fillTree(eCalo, eTrig);
const HcalTB06Analysis & operator=(const HcalTB06Analysis &)=delete
Log< level::Info, true > LogVerbatim
const std::vector< int > m_PDG
std::vector< PCaloHit > PCaloHitContainer
#define DEFINE_FWK_MODULE(type)
int iphi() const
get the crystal iphi
T const * product() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
~HcalTB06Analysis() override=default
const edm::ParameterSet m_ptb
int ieta() const
get the crystal ieta
const edm::EDGetTokenT< edm::PCaloHitContainer > m_HcalToken
std::unique_ptr< HcalTB06Histo > m_histo
constexpr HcalSubdetector subdet() const
get the subdetector
const edm::EDGetTokenT< edm::PCaloHitContainer > m_BeamToken
constexpr int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
Log< level::Info, false > LogInfo
HcalTB06Analysis(const edm::ParameterSet &p)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
edm::EDGetTokenT< edm::PCaloHitContainer > m_EcalToken
constexpr int iphi() const
get the cell iphi