42 #include "Randomize.hh" 45 #include <CLHEP/Units/SystemOfUnits.h> 46 #include <CLHEP/Units/PhysicalConstants.h> 99 : m_ECAL(
p.getParameter<
bool>(
"ECAL")),
100 m_eta(
p.getParameter<double>(
"MinEta")),
101 m_phi(
p.getParameter<double>(
"MinPhi")),
102 m_ener(
p.getParameter<double>(
"MinE")),
107 m_timeLimit(m_ptb.getParameter<double>(
"TimeLimit")),
108 m_widthEcal(m_ptb.getParameter<double>(
"EcalWidth")),
109 m_widthHcal(m_ptb.getParameter<double>(
"HcalWidth")),
110 m_factEcal(m_ptb.getParameter<double>(
"EcalFactor")),
111 m_factHcal(m_ptb.getParameter<double>(
"HcalFactor")),
112 m_eMIP(m_ptb.getParameter<double>(
"MIP")),
114 usesResource(
"TFileService");
117 double minEta =
p.getParameter<
double>(
"MinEta");
118 double maxEta =
p.getParameter<
double>(
"MaxEta");
119 double minPhi =
p.getParameter<
double>(
"MinPhi");
120 double maxPhi =
p.getParameter<
double>(
"MaxPhi");
142 <<
" MIP= " <<
m_eMIP <<
" GeV" 151 edm::LogInfo(
"HcalTB06Analysis") <<
" =====> End of Run; Total number of events: " <<
count;
160 std::vector<double> eCalo(6, 0), eTrig(7, 0);
162 const std::vector<PCaloHit>* EcalHits =
nullptr;
168 const std::vector<PCaloHit>* HcalHits = Hcal.
product();
170 const std::vector<PCaloHit>* BeamHits = Beam.
product();
179 ne = EcalHits->size();
180 for (
unsigned int i = 0;
i <
ne; ++
i) {
181 EBDetId ecalid((*EcalHits)[
i].
id());
190 eCalo[0] += (*EcalHits)[
i].energy();
199 nh = HcalHits->size();
200 for (
unsigned int i = 0;
i <
nh; ++
i) {
205 << (*HcalHits)[
i].time() <<
":" <<
m_timeLimit <<
" " << (*HcalHits)[
i].energy();
211 eCalo[2] += (*HcalHits)[
i].energy();
213 eCalo[4] += (*HcalHits)[
i].energy();
223 double etots = eecals + ehcals;
225 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Etot(MeV)= " << etots <<
" E(Ecal)= " << eecals
226 <<
" E(Hcal)= " << ehcals <<
" Nhits(ECAL)= " <<
ne <<
" Nhits(HCAL)= " <<
nh;
227 m_histo->fillEdep(etots, eecals, ehcals);
230 for (
unsigned int i = 0;
i < BeamHits->size(); ++
i) {
231 unsigned int id = ((*BeamHits)[
i].id());
232 int det, lay,
ix,
iy;
235 if (lay > 0 && lay <= 4) {
236 eTrig[lay - 1] += (*BeamHits)[
i].energy();
237 }
else if (lay == 7 || lay == 8) {
238 eTrig[lay - 2] += (*BeamHits)[
i].energy();
239 }
else if (lay >= 11 && lay <= 14) {
240 eTrig[4] += (*BeamHits)[
i].energy();
246 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06Analysis:: Trigger Info: " << eTrig[0] <<
":" << eTrig[1] <<
":" << eTrig[2]
247 <<
":" << eTrig[3] <<
":" << eTrig[4] <<
":" << eTrig[5] <<
":" << eTrig[6];
249 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
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)
#define DEFINE_FWK_MODULE(type)
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
HcalTB06Analysis(const edm::ParameterSet &p)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
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