File indexing completed on 2024-05-20 22:40:10
0001 #include "SimDataFormats/CaloAnalysis/interface/MtdSimLayerCluster.h"
0002
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004
0005 #include <numeric>
0006
0007 MtdSimLayerCluster::MtdSimLayerCluster() {
0008
0009 }
0010
0011 MtdSimLayerCluster::MtdSimLayerCluster(const SimTrack &simtrk) {
0012 addG4Track(simtrk);
0013 event_ = simtrk.eventId();
0014 particleId_ = simtrk.trackId();
0015
0016 theMomentum_.SetPxPyPzE(
0017 simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E());
0018 }
0019
0020 MtdSimLayerCluster::MtdSimLayerCluster(EncodedEventId eventID, uint32_t particleID) {
0021 event_ = eventID;
0022 particleId_ = particleID;
0023 }
0024
0025 MtdSimLayerCluster::~MtdSimLayerCluster() {}
0026
0027 std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp) {
0028 s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
0029 << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
0030 s << " Offset " << tp.trackIdOffset() << " "
0031 << " LC time " << tp.simLCTime() << " LC energy " << tp.simLCEnergy() << std::endl;
0032
0033 for (MtdSimLayerCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) {
0034 s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl;
0035 }
0036
0037 for (MtdSimLayerCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) {
0038 s << " Geant Track Momentum " << g4T->momentum() << std::endl;
0039 s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl;
0040 if (g4T->type() != tp.pdgId()) {
0041 s << " Mismatch b/t MtdSimLayerCluster and Geant types" << std::endl;
0042 }
0043 }
0044 s << " # of cells = " << tp.mtdHits_.size()
0045 << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl;
0046 return s;
0047 }