79 usesResource(
"TFileService");
103 tok_hepMC_ = consumes<edm::HepMCProduct>(tmp0);
105 std::cout <<
"HGCalTimingAnalyzer:: GeneratorSource = " << tmp0 << std::endl;
112 std::cout <<
"HGCalTimingAnalyzer:: Detector " <<
detectorEE_ <<
" with tags " << tmp1 << std::endl;
127 desc.add<
bool>(
"GroupHits",
false);
128 desc.add<
double>(
"TimeUnit", 0.001);
129 std::vector<int> ids = {1001, 1002, 1003, 1004, 1005};
130 desc.add<std::vector<int>>(
"IDBeams", ids);
131 desc.addUntracked<
bool>(
"DoTree",
true);
135 descriptions.
add(
"HGCalTimingAnalyzer",
desc);
176 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
178 std::cout <<
"Particle[" <<
k <<
"] with p " << (*p)->momentum().rho() <<
" theta " << (*p)->momentum().theta()
179 <<
" phi " << (*p)->momentum().phi() << std::endl;
199 std::vector<PCaloHit> caloHits;
201 if (theCaloHitContainers.
isValid()) {
203 std::cout <<
"PcalohitContainer for " <<
detectorEE_ <<
" has " << theCaloHitContainers->size() <<
" hits"
207 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
216 if (theCaloHitContainers.
isValid()) {
218 std::cout <<
"PcalohitContainer for " <<
detectorBeam_ <<
" has " << theCaloHitContainers->size() <<
" hits"
222 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
237 std::map<std::pair<uint32_t, uint64_t>, std::pair<double, double>> map_hits;
241 uint32_t
id =
hit.
id();
243 int subdet,
zside, layer, sector, subsector, cell;
245 std::pair<int, int> recoLayerCell =
hgcons_->
simToReco(cell, layer, sector,
true);
249 std::cout <<
"SimHit:Hit[" <<
i <<
"] Id " << subdet <<
":" <<
zside <<
":" << layer <<
":" << sector <<
":"
250 << subsector <<
":" << recoLayerCell.first <<
":" << recoLayerCell.second <<
" Energy " <<
energy
251 <<
" Time " <<
time << std::endl;
255 int subdet, layer,
x,
y;
257 std::cout <<
"SimHit:Hit[" <<
i <<
"] Beam Subdet " << subdet <<
" Layer " << layer <<
" x|y " <<
x <<
":" <<
y
258 <<
" Energy " <<
energy <<
" Time " <<
time << std::endl;
262 std::pair<uint32_t, uint64_t>
key(
id, tid);
263 auto itr = map_hits.find(
key);
264 if (
itr == map_hits.end()) {
265 map_hits[
key] = std::pair<double, double>(
time, 0.0);
269 map_hits[
key] = std::pair<double, double>((
itr->second).first,
energy);
276 std::cout <<
"analyzeSimHits: Finds " << map_hits.size() <<
" hits "
277 <<
" from the Hit Vector of size " <<
hits.size() <<
" for type " <<
type << std::endl;
279 for (
const auto&
itr : map_hits) {
302 for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) {
304 std::cout <<
"Track " << simTrkItr->trackId() <<
" Vertex " << simTrkItr->vertIndex() <<
" Type "
305 << simTrkItr->type() <<
" Charge " << simTrkItr->charge() <<
" momentum " << simTrkItr->momentum() <<
" "
306 << simTrkItr->momentum().P() << std::endl;
308 if (vertIndex == -1) {
309 vertIndex = simTrkItr->vertIndex();
310 pBeam_ = simTrkItr->momentum().P();
313 if (vertIndex != -1 && vertIndex < (
int)SimVtx->size()) {
314 edm::SimVertexContainer::const_iterator simVtxItr = SimVtx->begin();
315 for (
int iv = 0; iv < vertIndex; iv++)
318 std::cout <<
"Vertex " << vertIndex <<
" position " << simVtxItr->position() << std::endl;
320 xBeam_ = simVtxItr->position().X();
321 yBeam_ = simVtxItr->position().Y();
322 zBeam_ = simVtxItr->position().Z();