15 std::cout <<
"~PizeroMCTruthFinder" << std::endl;
19 const std::vector<SimVertex>& theSimVertices) {
20 std::cout <<
" PizeroMCTruthFinder::find " << std::endl;
24 std::vector<PizeroMCTruth>
result;
25 std::vector<PhotonMCTruth> photonsFromPizero;
26 std::vector<ElectronMCTruth> electronsFromPizero;
39 std::vector<SimTrack> pizeroTracks;
42 fill(theSimTracks, theSimVertices);
47 std::vector<SimTrack>::const_iterator iFirstSimTk = theSimTracks.begin();
48 if (!(*iFirstSimTk).noVertex()) {
49 iPV = (*iFirstSimTk).vertIndex();
51 int vtxId = (*iFirstSimTk).vertIndex();
52 primVtx = theSimVertices[vtxId];
55 std::cout <<
" Primary vertex id " << iPV <<
" first track type " << (*iFirstSimTk).type() << std::endl;
57 std::cout <<
" First track has no vertex " << std::endl;
66 if (iFirstSimTk != theSimTracks.end()) {
67 if ((*iFirstSimTk).vertIndex() == iPV) {
69 std::cout <<
" second track type " << (*iFirstSimTk).type() <<
" vertex " << (*iFirstSimTk).vertIndex()
73 std::cout <<
" Only one kine track from Primary Vertex " << std::endl;
79 for (std::vector<SimTrack>::const_iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk) {
80 if ((*iSimTk).noVertex())
83 int vertexId = (*iSimTk).vertIndex();
86 std::cout <<
" Particle type " << (*iSimTk).type() <<
" Sim Track ID " << (*iSimTk).trackId() <<
" momentum " 87 << (*iSimTk).momentum() <<
" vertex position " <<
vertex.position() << std::endl;
89 if ((*iSimTk).vertIndex() == iPV) {
91 if (
std::abs((*iSimTk).type()) == 111) {
92 std::cout <<
" Found a primary pizero with ID " << (*iSimTk).trackId() <<
" momentum " << (*iSimTk).momentum()
95 pizeroTracks.push_back(*iSimTk);
99 (*iSimTk).momentum().x(), (*iSimTk).momentum().y(), (*iSimTk).momentum().z(), (*iSimTk).momentum().e());
104 std::cout <<
" There are " << npv <<
" particles originating in the PV " << std::endl;
126 for (std::vector<SimTrack>::iterator iPizTk = pizeroTracks.begin(); iPizTk != pizeroTracks.end(); ++iPizTk) {
127 std::cout <<
" Looping on the primary pizero pt " <<
sqrt((*iPizTk).momentum().perp2()) <<
" pizero track ID " 128 << (*iPizTk).trackId() << std::endl;
130 photonsFromPizero.clear();
131 std::cout <<
" mcPhotons.size " << mcPhotons.size() << std::endl;
132 for (std::vector<PhotonMCTruth>::iterator iPho = mcPhotons.begin(); iPho != mcPhotons.end(); ++iPho) {
133 int phoVtxIndex = (*iPho).vertexInd();
134 SimVertex phoVtx = theSimVertices[phoVtxIndex];
136 std::cout <<
" photon parent vertex index " << phoParentInd << std::endl;
138 if (phoParentInd == (*iPizTk).trackId()) {
139 std::cout <<
"Matched Photon ID " << (*iPho).trackId() <<
" vtx " << phoParentInd <<
" with pizero " 140 << (*iPizTk).trackId() << std::endl;
141 photonsFromPizero.push_back(*iPho);
144 std::cout <<
" Photon matching the pizero vertex " << photonsFromPizero.size() << std::endl;
147 CLHEP::HepLorentzVector tmpMom(
148 (*iPizTk).momentum().px(), (*iPizTk).momentum().py(), (*iPizTk).momentum().pz(), (*iPizTk).momentum().e());
149 CLHEP::HepLorentzVector tmpPos(
170 for (
unsigned it = 0; it < nTks; ++it) {
172 std::cout <<
" PizeroMCTruthFinder::fill it " << it <<
" simTracks[it].trackId() " <<
simTracks[it].trackId()
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual ~PizeroMCTruthFinder()
const math::XYZTLorentzVectorD & position() const
PhotonMCTruthFinder * thePhotonMCTruthFinder_
ElectronMCTruthFinder * theElectronMCTruthFinder_
Abs< T >::type abs(const T &t)
std::map< unsigned, unsigned > geantToIndex_
std::vector< PizeroMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
std::vector< PhotonMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
void fill(const std::vector< SimTrack > &theSimTracks, const std::vector< SimVertex > &theSimVertices)