79 : detectorEE_(iConfig.getParameter<std::
string>(
"DetectorEE")),
80 detectorBeam_(iConfig.getParameter<std::
string>(
"DetectorBeam")),
83 usesResource(
"TFileService");
95 std::ostringstream st1;
96 st1 <<
"HGCalTimingAnalyzer:: Group Hits " <<
groupHits_ <<
" in " << timeUnit_ <<
" IdBeam " << idBeams_.size()
98 for (
const auto&
id : idBeams_)
102 if (idBeams_.empty())
103 idBeams_.push_back(1001);
106 tok_hepMC_ = consumes<edm::HepMCProduct>(tmp0);
108 edm::LogVerbatim(
"HGCSim") <<
"HGCalTimingAnalyzer:: GeneratorSource = " << tmp0;
130 desc.
add<
bool>(
"GroupHits",
false);
131 desc.
add<
double>(
"TimeUnit", 0.001);
132 std::vector<int> ids = {1001, 1002, 1003, 1004, 1005};
133 desc.
add<std::vector<int>>(
"IDBeams", ids);
138 descriptions.
add(
"HGCalTimingAnalyzer", desc);
177 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
179 edm::LogVerbatim(
"HGCSim") <<
"Particle[" << k <<
"] with p " << (*p)->momentum().rho() <<
" theta "
180 << (*p)->momentum().theta() <<
" phi " << (*p)->momentum().phi();
200 std::vector<PCaloHit> caloHits;
202 if (theCaloHitContainers.
isValid()) {
208 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
217 if (theCaloHitContainers.
isValid()) {
223 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
238 std::map<std::pair<uint32_t, uint64_t>, std::pair<double, double>> map_hits;
239 for (
const auto&
hit : hits) {
241 double time =
hit.time();
242 uint32_t
id =
hit.
id();
244 int subdet,
zside,
layer, sector, subsector, cell;
246 std::pair<int, int> recoLayerCell =
hgcons_->
simToReco(cell, layer, sector,
true);
250 edm::LogVerbatim(
"HGCSim") <<
"SimHit:Hit[" << i <<
"] Id " << subdet <<
":" << zside <<
":" << layer <<
":"
251 << sector <<
":" << subsector <<
":" << recoLayerCell.first <<
":"
252 << recoLayerCell.second <<
" Energy " << energy <<
" Time " << time;
258 edm::LogVerbatim(
"HGCSim") <<
"SimHit:Hit[" << i <<
"] Beam Subdet " << subdet <<
" Layer " << layer <<
" x|y "
259 << x <<
":" << y <<
" Energy " << energy <<
" Time " << time;
263 std::pair<uint32_t, uint64_t>
key(
id, tid);
264 auto itr = map_hits.find(key);
265 if (itr == map_hits.end()) {
266 map_hits[
key] = std::pair<double, double>(time, 0.0);
267 itr = map_hits.find(key);
269 energy += (itr->second).
second;
270 map_hits[
key] = std::pair<double, double>((itr->second).
first, energy);
277 edm::LogVerbatim(
"HGCSim") <<
"analyzeSimHits: Finds " << map_hits.size() <<
" hits "
278 <<
" from the Hit Vector of size " << hits.size() <<
" for type " <<
type;
280 for (
const auto& itr : map_hits) {
281 uint32_t
id = (itr.first).
first;
282 double time = (itr.second).
first;
303 for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) {
305 edm::LogVerbatim(
"HGCSim") <<
"Track " << simTrkItr->trackId() <<
" Vertex " << simTrkItr->vertIndex() <<
" Type "
306 << simTrkItr->type() <<
" Charge " << simTrkItr->charge() <<
" momentum "
307 << simTrkItr->momentum() <<
" " << simTrkItr->momentum().P();
309 if (vertIndex == -1) {
310 vertIndex = simTrkItr->vertIndex();
311 pBeam_ = simTrkItr->momentum().P();
314 if (vertIndex != -1 && vertIndex < (
int)SimVtx->size()) {
315 edm::SimVertexContainer::const_iterator simVtxItr = SimVtx->begin();
316 for (
int iv = 0;
iv < vertIndex;
iv++)
319 edm::LogVerbatim(
"HGCSim") <<
"Vertex " << vertIndex <<
" position " << simVtxItr->position();
321 xBeam_ = simVtxItr->position().X();
322 yBeam_ = simVtxItr->position().Y();
323 zBeam_ = simVtxItr->position().Z();
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const HGCalDDDConstants * hgcons_
uint16_t *__restrict__ id
~HGCalTimingAnalyzer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void analyze(edm::Event const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tokDDD_
constexpr uint32_t rawId() const
get the raw id
edm::EDGetTokenT< edm::SimTrackContainer > tok_simTk_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hitsEE_
T * make(const Args &...args) const
make new ROOT object
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr std::array< uint8_t, layerIndexSize > layer
bool getData(T &iHolder) const
U second(std::pair< T, U > const &p)
HGCalTimingAnalyzer(edm::ParameterSet const &)
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
std::vector< float > simHitCellEnEE_
unsigned int layers(bool reco) const
tuple key
prepare the HTCondor submission files and eventually submit them
std::vector< float > simHitCellTmBeam_
const std::string detectorBeam_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< int > idBeams_
std::vector< float > simHitCellEnBeam_
std::vector< uint32_t > simHitCellIdBeam_
std::vector< float > simHitCellTmEE_
std::vector< uint32_t > simHitCellIdEE_
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::Service< TFileService > fs_
unsigned long long uint64_t
edm::EDGetTokenT< edm::SimVertexContainer > tok_simVtx_
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const std::string detectorEE_
void beginRun(edm::Run const &, edm::EventSetup const &) override
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
Log< level::Warning, false > LogWarning
void analyzeSimHits(int type, std::vector< PCaloHit > const &hits)
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
void analyzeSimTracks(edm::Handle< edm::SimTrackContainer > const &SimTk, edm::Handle< edm::SimVertexContainer > const &SimVtx)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hitsBeam_