CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/SimDataFormats/TrackingAnalysis/interface/TrackingDataPrint.h

Go to the documentation of this file.
00001 #ifndef SimDataFormats_TrackingDataPrint_h
00002 #define SimDataFormats_TrackingDataPrint_h
00003 
00007 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
00008 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h"
00009 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
00010 #include <iostream>
00011 
00012 std::ostream& operator<< (std::ostream& s, const TrackingParticle & tp)
00013 {
00014 
00015     // Compare momenta from sources
00016     s << "T.P.   Track Momentum, q , ID, & Event # "
00017     << tp.p4()    << " " << tp.charge() << " "
00018     << tp.pdgId() << " "
00019     << tp.eventId().bunchCrossing() << "." << tp.eventId().event()
00020     << std::endl;
00021     s << " Hits for this track: " << tp.trackPSimHit().size()
00022     << std::endl;
00023 
00024     for (TrackingParticle::genp_iterator hepT = tp.genParticle_begin();
00025             hepT !=  tp.genParticle_end(); ++hepT)
00026     {
00027         s << " HepMC Track Momentum " << (*hepT)->momentum().mag() << std::endl;
00028     }
00029     for (TrackingParticle::g4t_iterator g4T = tp.g4Track_begin();
00030             g4T !=  tp.g4Track_end(); ++g4T)
00031     {
00032         s << " Geant Track Momentum  " << g4T->momentum() << std::endl;
00033         s << " Geant Track ID & type " << g4T->trackId() << " "
00034         << g4T->type() << std::endl;
00035         if (g4T->type() !=  tp.pdgId())
00036         {
00037             s << " Mismatch b/t TrackingParticle and Geant types"
00038             << std::endl;
00039         }
00040     }
00041     return s;
00042 }
00043 
00044 #endif // SimDataFormats_TrackingDataPrint_H