Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:40

0001 #include "SimDataFormats/CaloAnalysis/interface/MtdCaloParticle.h"
0002 
0003 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0004 
0005 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0006 
0007 #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h"
0008 
0009 MtdCaloParticle::MtdCaloParticle() {
0010   // No operation
0011 }
0012 
0013 MtdCaloParticle::MtdCaloParticle(const SimTrack &simtrk) {
0014   addG4Track(simtrk);
0015   event_ = simtrk.eventId();
0016   particleId_ = simtrk.trackId();
0017   theMomentum_.SetPxPyPzE(
0018       simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E());
0019 }
0020 
0021 MtdCaloParticle::MtdCaloParticle(EncodedEventId eventID, uint32_t particleID) {
0022   event_ = eventID;
0023   particleId_ = particleID;
0024 }
0025 
0026 MtdCaloParticle::~MtdCaloParticle() {}
0027 
0028 std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp) {
0029   s << "Calo Particle:" << std::endl;
0030   s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
0031     << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
0032 
0033   for (MtdCaloParticle::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 (MtdCaloParticle::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 MtdCaloParticle and Geant types" << std::endl;
0042     }
0043   }
0044   s << "SimClusters in this MtdCaloParticle: " << std::endl;
0045   for (auto itr = tp.simClusters_.begin(); itr != tp.simClusters_.end(); ++itr) {
0046     s << **itr;
0047   }
0048   s << std::endl;
0049   return s;
0050 }