69 struct DecayChainTrack
72 struct DecayChainVertex* pParentVertex;
74 std::vector<struct DecayChainVertex*> daughterVertices;
75 DecayChainTrack* pMergedBremSource;
76 DecayChainTrack() : simTrackIndex(-1), pParentVertex(
NULL), pMergedBremSource(
NULL) {}
77 DecayChainTrack(
int newSimTrackIndex ) : simTrackIndex(newSimTrackIndex), pParentVertex(
NULL), pMergedBremSource() {}
84 struct DecayChainVertex
87 DecayChainTrack* pParentTrack;
88 std::vector<DecayChainTrack*> daughterTracks;
89 DecayChainVertex* pMergedBremSource;
90 DecayChainVertex() : simVertexIndex(-1), pParentTrack(
NULL), pMergedBremSource(
NULL) {}
91 DecayChainVertex(
int newIndex ) : simVertexIndex(newIndex), pParentTrack(
NULL), pMergedBremSource(
NULL) {}
107 DecayChain(
const std::vector<SimTrack>& trackCollection,
const std::vector<SimVertex>&
vertexCollection );
108 const size_t decayTracksSize;
109 const size_t decayVerticesSize;
115 void integrityCheck();
116 const SimTrack& getSimTrack( const ::DecayChainTrack* pDecayTrack )
const {
return simTrackCollection_.at( pDecayTrack->simTrackIndex ); }
117 const SimVertex& getSimVertex( const ::DecayChainVertex* pDecayVertex )
const {
return simVertexCollection_.at( pDecayVertex->simVertexIndex ); }
119 void findBrem(
const std::vector<SimTrack>& trackCollection,
const std::vector<SimVertex>&
vertexCollection );
120 std::unique_ptr< ::DecayChainTrack[]> decayTracks_;
121 std::unique_ptr< ::DecayChainVertex[]> decayVertices_;
124 std::vector< ::DecayChainVertex*> rootVertices_;
127 const std::vector<SimTrack>& simTrackCollection_;
128 const std::vector<SimVertex>& simVertexCollection_;
130 const std::unique_ptr< ::DecayChainTrack[]>& decayTracks;
131 const std::unique_ptr< ::DecayChainVertex[]>& decayVertices;
132 const std::vector< ::DecayChainVertex*>& rootVertices;
139 class TrackingParticleFactory
142 TrackingParticleFactory( const ::DecayChain& decayChain,
const edm::Handle< std::vector<reco::GenParticle> >& hGenParticles,
143 const edm::Handle< std::vector<int> >& hHepMCGenParticleIndices,
const std::vector<const PSimHit*>&
simHits,
144 double volumeRadius,
double volumeZ,
bool allowDifferentProcessTypes );
145 TrackingParticle createTrackingParticle(
const DecayChainTrack* pTrack )
const;
146 TrackingVertex createTrackingVertex(
const DecayChainVertex* pVertex )
const;
149 const ::DecayChain& decayChain_;
151 std::vector<int> genParticleIndices_;
152 const std::vector<const PSimHit*>& simHits_;
153 const double volumeRadius_;
154 const double volumeZ_;
155 std::multimap<unsigned int, size_t> trackIdToHitIndex_;
156 bool allowDifferentProcessTypeForDifferentDetectors_;
163 class OutputCollectionWrapper
169 TrackingParticle* getTrackingParticle( const ::DecayChainTrack* pDecayTrack );
171 void setProxy( const ::DecayChainTrack* pOriginalTrack, const ::DecayChainTrack* pProxyTrack );
172 void setProxy( const ::DecayChainVertex* pOriginalVertex, const ::DecayChainVertex* pProxyVertex );
173 TrackingVertex* getTrackingVertex( const ::DecayChainVertex* pDecayVertex );
177 void associateToExistingObjects( const ::DecayChainVertex* pChainVertex );
178 void associateToExistingObjects( const ::DecayChainTrack* pChainTrack );
180 std::vector<int> trackingParticleIndices_;
181 std::vector<int> trackingVertexIndices_;
198 void addTrack( ::DecayChainTrack* pDecayChainTrack,
const TrackingParticleSelector* pSelector, ::OutputCollectionWrapper* pUnmergedOutput, ::OutputCollectionWrapper* pMergedOutput, const ::TrackingParticleFactory& objectFactory,
bool addAncestors );
217 messageCategory_(
"TrackingTruthAccumulator"),
218 volumeRadius_( config.getParameter<double>(
"volumeRadius") ),
219 volumeZ_( config.getParameter<double>(
"volumeZ") ),
220 ignoreTracksOutsideVolume_( config.getParameter<bool>(
"ignoreTracksOutsideVolume") ),
221 maximumPreviousBunchCrossing_( config.getParameter<unsigned int>(
"maximumPreviousBunchCrossing") ),
222 maximumSubsequentBunchCrossing_( config.getParameter<unsigned int>(
"maximumSubsequentBunchCrossing") ),
223 createUnmergedCollection_( config.getParameter<bool>(
"createUnmergedCollection") ),
224 createMergedCollection_(config.getParameter<bool>(
"createMergedBremsstrahlung") ),
225 addAncestors_( config.getParameter<bool>(
"alwaysAddAncestors") ),
226 removeDeadModules_( config.getParameter<bool>(
"removeDeadModules") ),
227 simTrackLabel_( config.getParameter<edm::InputTag>(
"simTrackCollection") ),
228 simVertexLabel_( config.getParameter<edm::InputTag>(
"simVertexCollection") ),
229 simHitCollectionConfig_( config.getParameter<edm::
ParameterSet>(
"simHitCollections") ),
230 genParticleLabel_( config.getParameter<edm::InputTag>(
"genParticleCollection") ),
231 allowDifferentProcessTypeForDifferentDetectors_( config.getParameter<bool>(
"allowDifferentSimHitProcesses") )
239 <<
"set to false, which means no collections will be created";
245 if( config.
exists(
"select" ) )
332 <<
" TrackingVertexs to the event.";
341 <<
" merged TrackingVertexs to the event.";
383 DecayChain decayChain( *hSimTracks, *hSimVertices );
386 std::auto_ptr< ::OutputCollectionWrapper> pUnmergedCollectionWrapper;
387 std::auto_ptr< ::OutputCollectionWrapper> pMergedCollectionWrapper;
391 std::vector<const PSimHit*> simHitPointers;
409 ::DecayChainTrack* pDecayTrack=&decayChain.decayTracks[
index];
410 const SimTrack& simTrack=hSimTracks->at(pDecayTrack->simTrackIndex);
423 const SimVertex& simVertex=hSimVertices->at( pDecayTrack->pParentVertex->simVertexIndex );
424 if( !objectFactory.vectorIsInsideVolume( simVertex.
position() ) )
continue;
431 ::addTrack( pDecayTrack, pSelector, pUnmergedCollectionWrapper.get(), pMergedCollectionWrapper.get(), objectFactory,
addAncestors_ );
441 for(
const auto& parameterName : parameterNames )
445 for(
const auto& collectionTag : collectionTags )
448 event.getByLabel( collectionTag, hSimHits );
451 for(
const auto& simHit : *hSimHits )
453 returnValue.push_back( &simHit );
483 ::TrackingParticleFactory::TrackingParticleFactory( const ::DecayChain& decayChain,
const edm::Handle< std::vector<reco::GenParticle> >& hGenParticles,
484 const edm::Handle< std::vector<int> >& hHepMCGenParticleIndices,
const std::vector<const PSimHit*>&
simHits,
485 double volumeRadius,
double volumeZ,
bool allowDifferentProcessTypes )
486 : decayChain_(decayChain), hGenParticles_(hGenParticles), simHits_(simHits), volumeRadius_(volumeRadius),
487 volumeZ_(volumeZ), allowDifferentProcessTypeForDifferentDetectors_(allowDifferentProcessTypes)
493 trackIdToHitIndex_.insert( std::make_pair( simHits_[
index]->trackId(),
index ) );
496 if( hHepMCGenParticleIndices.isValid() )
498 genParticleIndices_.resize( hHepMCGenParticleIndices->size()+1 );
502 for(
size_t recoGenParticleIndex=0; recoGenParticleIndex<hHepMCGenParticleIndices->size(); ++recoGenParticleIndex )
504 size_t hepMCGenParticleIndex=(*hHepMCGenParticleIndices)[recoGenParticleIndex];
507 if( genParticleIndices_.size()<hepMCGenParticleIndex ) genParticleIndices_.resize(hepMCGenParticleIndex);
509 genParticleIndices_[ hepMCGenParticleIndex ]=recoGenParticleIndex;
514 TrackingParticle TrackingParticleFactory::createTrackingParticle( const ::DecayChainTrack* pChainTrack )
const
519 const SimTrack& simTrack=decayChain_.getSimTrack( pChainTrack );
520 const SimVertex& parentSimVertex=decayChain_.getSimVertex( pChainTrack->pParentVertex );
522 LorentzVector
position( 0, 0, 0, 0 );
539 if( hepMCGenParticleIndex>=0 && hGenParticles_.isValid() )
541 int recoGenParticleIndex=genParticleIndices_[hepMCGenParticleIndex];
543 pdgId=generatorParticleRef->pdgId();
553 size_t matchedHits=0;
554 size_t numberOfHits=0;
555 size_t numberOfTrackerHits=0;
565 for( std::multimap<unsigned int,size_t>::const_iterator iHitIndex=trackIdToHitIndex_.lower_bound( simTrack.
trackId() );
566 iHitIndex!=trackIdToHitIndex_.upper_bound( simTrack.
trackId() );
569 const auto& pSimHit=simHits_[ iHitIndex->second ];
574 processType=pSimHit->processType();
575 particleType=pSimHit->particleType();
576 newDetector=
DetId( pSimHit->detUnitId() );
580 oldDetector=newDetector;
581 newDetector=
DetId( pSimHit->detUnitId() );
585 if( allowDifferentProcessTypeForDifferentDetectors_ && newDetector.
det()!=oldDetector.
det() ) processType=pSimHit->processType();
588 if( processType==pSimHit->processType() && particleType==pSimHit->particleType() && pdgId==pSimHit->particleType() )
594 newLayer=LayerFromDetid( newDetector );
598 if( (oldLayer!=newLayer || (oldLayer==newLayer && oldDetector.
subdetId()!=newDetector.
subdetId())) && newLayer!=0 ) ++matchedHits;
609 TrackingVertex TrackingParticleFactory::createTrackingVertex( const ::DecayChainVertex* pChainVertex )
const
611 const SimVertex& simVertex=decayChain_.getSimVertex( pChainVertex );
613 bool isInVolume=this->vectorIsInsideVolume( simVertex.
position() );
623 return ( vector.Pt()<volumeRadius_ && vector.z()<volumeZ_ );
632 ::DecayChain::DecayChain(
const std::vector<SimTrack>& trackCollection,
const std::vector<SimVertex>&
vertexCollection )
633 : decayTracksSize( trackCollection.
size() ),
634 decayVerticesSize( vertexCollection.
size() ),
635 decayTracks_( new DecayChainTrack[decayTracksSize] ),
636 decayVertices_( new DecayChainVertex[decayVerticesSize] ),
637 simTrackCollection_( trackCollection ),
638 simVertexCollection_( vertexCollection ),
639 decayTracks( decayTracks_ ),
640 decayVertices( decayVertices_ ),
641 rootVertices( rootVertices_ )
644 std::map<int,::DecayChainTrack*> trackIdToDecayTrack;
645 std::map<int,::DecayChainVertex*> vertexIdToDecayVertex;
651 size_t decayVertexIndex=0;
654 ::DecayChainTrack* pDecayTrack=&decayTracks_[
index];
659 pDecayTrack->simTrackIndex=
index;
661 trackIdToDecayTrack[ trackCollection[
index].trackId() ]=pDecayTrack;
663 int parentVertexIndex=trackCollection[
index].vertIndex();
664 if( parentVertexIndex>=0 )
667 ::DecayChainVertex*& pParentVertex=vertexIdToDecayVertex[parentVertexIndex];
668 if( pParentVertex==
NULL )
671 pParentVertex=&decayVertices_[decayVertexIndex];
673 pParentVertex->simVertexIndex=parentVertexIndex;
675 pParentVertex->daughterTracks.push_back(pDecayTrack);
676 pDecayTrack->pParentVertex=pParentVertex;
678 else throw std::runtime_error(
"TrackingTruthAccumulator: Found a track with an invalid parent vertex index." );
690 for(
auto& decayVertexMapPair : vertexIdToDecayVertex )
692 ::DecayChainVertex* pDecayVertex=decayVertexMapPair.second;
693 int parentTrackIndex=vertexCollection[pDecayVertex->simVertexIndex].parentIndex();
694 if( parentTrackIndex!=-1 )
696 std::map<int,::DecayChainTrack*>::iterator iParentTrackMapPair=trackIdToDecayTrack.find(parentTrackIndex);
697 if( iParentTrackMapPair==trackIdToDecayTrack.end() )
699 std::stringstream errorStream;
700 errorStream <<
"TrackingTruthAccumulator: Something has gone wrong with the indexing. Parent track index is " << parentTrackIndex <<
".";
701 throw std::runtime_error( errorStream.str() );
704 ::DecayChainTrack* pParentTrackHierarchy=iParentTrackMapPair->second;
706 pParentTrackHierarchy->daughterVertices.push_back( pDecayVertex );
707 pDecayVertex->pParentTrack=pParentTrackHierarchy;
709 else rootVertices_.push_back(pDecayVertex);
712 findBrem( trackCollection, vertexCollection );
717 void ::DecayChain::integrityCheck()
724 const auto& decayTrack=decayTracks[
index];
728 if( decayTrack.pParentVertex==
NULL )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack with no parent vertex." );
733 size_t numberOfTimesListed=0;
734 for(
const auto pSiblingTrack : decayTrack.pParentVertex->daughterTracks )
736 if( pSiblingTrack==&decayTrack ) ++numberOfTimesListed;
738 if( numberOfTimesListed!=1 )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack whose parent does not have it listed once and only once as a child." );
743 for(
const auto pDaughterVertex : decayTrack.daughterVertices )
745 if( pDaughterVertex->pParentTrack!=&decayTrack )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack whose child does not have it listed as the parent." );
751 const DecayChainVertex* pAncestorVertex=decayTrack.pParentVertex;
752 while( pAncestorVertex->pParentTrack!=
NULL )
754 if( pAncestorVertex->pParentTrack->pParentVertex==
NULL )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack with no parent vertex higher in the decay chain." );
755 pAncestorVertex=pAncestorVertex->pParentTrack->pParentVertex;
757 if(
std::find( rootVertices.begin(), rootVertices.end(), pAncestorVertex )==rootVertices.end() )
759 throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack whose root vertex is not recorded anywhere." );
768 const auto& decayVertex=decayVertices[
index];
773 const DecayChainVertex* pAncestorVertex=&decayVertex;
774 while( pAncestorVertex->pParentTrack!=
NULL )
776 if( pAncestorVertex->pParentTrack->pParentVertex==
NULL )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack with no parent vertex higher in the vertex decay chain." );
777 pAncestorVertex=pAncestorVertex->pParentTrack->pParentVertex;
779 if(
std::find( rootVertices.begin(), rootVertices.end(), pAncestorVertex )==rootVertices.end() )
781 throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainTrack whose root vertex is not recorded anywhere." );
787 if( decayVertex.pParentTrack!=
NULL )
789 size_t numberOfTimesListed=0;
790 for(
const auto pSibling : decayVertex.pParentTrack->daughterVertices )
792 if( pSibling==&decayVertex ) ++numberOfTimesListed;
794 if( numberOfTimesListed!=1 )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainVertex whose parent does not have it listed once and only once as a child." );
800 for(
const auto pDaughter : decayVertex.daughterTracks )
802 if( pDaughter->pParentVertex!=&decayVertex )
throw std::runtime_error(
"TrackingTruthAccumulator.cc integrityCheck(): Found DecayChainVertex whose child does not have it listed as the parent." );
806 std::cout <<
"TrackingTruthAccumulator.cc integrityCheck() completed successfully" << std::endl;
809 void ::DecayChain::findBrem(
const std::vector<SimTrack>& trackCollection,
const std::vector<SimVertex>& vertexCollection )
813 auto& vertex=decayVertices_[
index];
816 if( vertex.pParentTrack==
NULL )
continue;
817 int parentTrackPDG=trackCollection[vertex.pParentTrack->simTrackIndex].type();
818 if(
std::abs( parentTrackPDG )!=11 )
continue;
820 size_t numberOfElectrons=0;
821 size_t numberOfNonElectronsOrPhotons=0;
822 for(
auto& pDaughterTrack : vertex.daughterTracks )
824 const auto& simTrack=trackCollection[pDaughterTrack->simTrackIndex];
825 if( simTrack.
type()==11 || simTrack.
type()==-11 ) ++numberOfElectrons;
826 else if( simTrack.
type()!=22 ) ++numberOfNonElectronsOrPhotons;
828 if( numberOfElectrons==1 && numberOfNonElectronsOrPhotons==0 )
832 for(
auto& pDaughterTrack : vertex.daughterTracks ) pDaughterTrack->pMergedBremSource=vertex.pParentTrack;
833 vertex.pMergedBremSource=vertex.pParentTrack->pParentVertex;
846 : output_(outputCollections),
847 trackingParticleIndices_(decayChain.decayTracksSize,-1),
848 trackingVertexIndices_(decayChain.decayVerticesSize,-1)
855 if( trackingParticleIndices_[pDecayTrack->simTrackIndex]!=-1 )
throw std::runtime_error(
"OutputCollectionWrapper::addTrackingParticle - trying to add a particle twice" );
857 trackingParticleIndices_[pDecayTrack->simTrackIndex]=output_.pTrackingParticles->size();
858 output_.pTrackingParticles->push_back( trackingParticle );
861 output_.pTrackingParticles->back().clearDecayVertices();
862 output_.pTrackingParticles->back().clearParentVertex();
865 associateToExistingObjects( pDecayTrack );
867 return &output_.pTrackingParticles->back();
870 TrackingVertex* ::OutputCollectionWrapper::addTrackingVertex( const ::DecayChainVertex* pDecayVertex,
const TrackingVertex& trackingVertex )
872 if( trackingVertexIndices_[pDecayVertex->simVertexIndex]!=-1 )
throw std::runtime_error(
"OutputCollectionWrapper::addTrackingVertex - trying to add a vertex twice" );
874 trackingVertexIndices_[pDecayVertex->simVertexIndex]=output_.pTrackingVertices->size();
875 output_.pTrackingVertices->push_back( trackingVertex );
878 associateToExistingObjects( pDecayVertex );
880 return &output_.pTrackingVertices->back();
883 TrackingParticle* ::OutputCollectionWrapper::getTrackingParticle( const ::DecayChainTrack* pDecayTrack )
885 const int index=trackingParticleIndices_[pDecayTrack->simTrackIndex];
886 if( index==-1 )
return NULL;
887 else return &(*output_.pTrackingParticles)[index];
890 TrackingVertex* ::OutputCollectionWrapper::getTrackingVertex( const ::DecayChainVertex* pDecayVertex )
892 const int index=trackingVertexIndices_[pDecayVertex->simVertexIndex];
893 if( index==-1 )
return NULL;
894 else return &(*output_.pTrackingVertices)[index];
899 const int index=trackingParticleIndices_[pDecayTrack->simTrackIndex];
900 if( index==-1 )
throw std::runtime_error(
"OutputCollectionWrapper::getRefTrackingParticle - ref requested for a non existent TrackingParticle" );
906 const int index=trackingVertexIndices_[pDecayVertex->simVertexIndex];
907 if( index==-1 )
throw std::runtime_error(
"OutputCollectionWrapper::getRefTrackingParticle - ref requested for a non existent TrackingVertex" );
911 void ::OutputCollectionWrapper::setProxy( const ::DecayChainTrack* pOriginalTrack, const ::DecayChainTrack* pProxyTrack )
913 int& index=trackingParticleIndices_[pOriginalTrack->simTrackIndex];
914 if( index!=-1 )
throw std::runtime_error(
"OutputCollectionWrapper::setProxy() was called for a TrackingParticle that has already been created" );
916 index=trackingParticleIndices_[pProxyTrack->simTrackIndex];
919 void ::OutputCollectionWrapper::setProxy( const ::DecayChainVertex* pOriginalVertex, const ::DecayChainVertex* pProxyVertex )
921 int& index=trackingVertexIndices_[pOriginalVertex->simVertexIndex];
922 const int newIndex=trackingVertexIndices_[pProxyVertex->simVertexIndex];
924 if( index!=-1 && index!=newIndex )
throw std::runtime_error(
"OutputCollectionWrapper::setProxy() was called for a TrackingVertex that has already been created" );
930 void ::OutputCollectionWrapper::associateToExistingObjects( const ::DecayChainVertex* pChainVertex )
933 TrackingVertex* pTrackingVertex=getTrackingVertex( pChainVertex );
934 if( pTrackingVertex==
NULL )
throw std::runtime_error(
"associateToExistingObjects was passed a non existent TrackingVertex" );
939 ::DecayChainTrack* pParentChainTrack=pChainVertex->pParentTrack;
940 if( pParentChainTrack!=
NULL )
943 TrackingParticle* pParentTrackingParticle=getTrackingParticle(pParentChainTrack);
944 if( pParentTrackingParticle!=
NULL )
961 void ::OutputCollectionWrapper::associateToExistingObjects( const ::DecayChainTrack* pChainTrack )
967 if( pTrackingParticle==
NULL )
throw std::runtime_error(
"associateToExistingObjects was passed a non existent TrackingParticle" );
971 ::DecayChainVertex* pParentChainVertex=pChainTrack->pParentVertex;
972 TrackingVertex* pParentTrackingVertex=getTrackingVertex( pParentChainVertex );
984 for(
auto pDaughterChainVertex : pChainTrack->daughterVertices )
986 TrackingVertex* pDaughterTrackingVertex=getTrackingVertex( pDaughterChainVertex );
987 if( pDaughterTrackingVertex!=
NULL )
1003 int LayerFromDetid(
const DetId& detId )
1008 unsigned int subdetId=
static_cast<unsigned int>( detId.
subdetId() );
1013 layerNumber=tibid.
layer();
1018 layerNumber=tobid.
layer();
1023 layerNumber=tidid.
wheel();
1028 layerNumber=tecid.
wheel();
1033 layerNumber=pxbid.
layer();
1038 layerNumber=pxfid.
disk();
1040 else edm::LogVerbatim(
"TrackingTruthAccumulator" )<<
"Unknown subdetid: "<<subdetId;
1049 TrackingParticle* pTrackingParticle=pOutput->getTrackingParticle( pDecayTrack );
1050 if( pTrackingParticle==
NULL )
1053 TrackingVertex* pProductionVertex=pOutput->getTrackingVertex( pDecayTrack->pParentVertex );
1054 if( pProductionVertex==
NULL )
1061 pProductionVertex=pOutput->addTrackingVertex( pDecayTrack->pParentVertex, *trackingParticle.
parentVertex() );
1065 pTrackingParticle=pOutput->addTrackingParticle( pDecayTrack, trackingParticle );
1068 return pTrackingParticle;
1071 void addTrack( ::DecayChainTrack* pDecayChainTrack,
const TrackingParticleSelector* pSelector, ::OutputCollectionWrapper* pUnmergedOutput, ::OutputCollectionWrapper* pMergedOutput, const ::TrackingParticleFactory& objectFactory,
bool addAncestors )
1073 if( pDecayChainTrack==
NULL )
return;
1079 bool alreadyProcessed=
true;
1080 if( pUnmergedOutput!=
NULL )
1082 if( pUnmergedOutput->getTrackingParticle( pDecayChainTrack )==
NULL ) alreadyProcessed=
false;
1084 if( pMergedOutput!=
NULL )
1086 if( pMergedOutput->getTrackingParticle( pDecayChainTrack )==
NULL ) alreadyProcessed=
false;
1088 if( alreadyProcessed )
return;
1092 TrackingParticle newTrackingParticle=objectFactory.createTrackingParticle( pDecayChainTrack );
1102 dummyCollection.push_back( objectFactory.createTrackingVertex( pDecayChainTrack->pParentVertex ) );
1109 if( !(*pSelector)( newTrackingParticle ) )
return;
1116 if( addAncestors ) addTrack( pDecayChainTrack->pParentVertex->pParentTrack,
NULL, pUnmergedOutput, pMergedOutput, objectFactory, addAncestors );
1120 if( pUnmergedOutput!=
NULL ) addTrackAndParentVertex( pDecayChainTrack, newTrackingParticle, pUnmergedOutput );
1124 if( pMergedOutput!=
NULL )
1126 ::DecayChainTrack* pBremParentChainTrack=pDecayChainTrack;
1127 while( pBremParentChainTrack->pMergedBremSource!=
NULL ) pBremParentChainTrack=pBremParentChainTrack->pMergedBremSource;
1129 if( pBremParentChainTrack!=pDecayChainTrack )
1131 TrackingParticle* pBremParentTrackingParticle=addTrackAndParentVertex( pBremParentChainTrack, newTrackingParticle, pMergedOutput );
1144 pMergedOutput->setProxy( pDecayChainTrack->pParentVertex, pBremParentChainTrack->pParentVertex );
1149 addTrackAndParentVertex( pDecayChainTrack, newTrackingParticle, pMergedOutput );
1154 for(
const auto& trackSegment : newTrackingParticle.
g4Tracks() )
1156 pBremParentTrackingParticle->
addG4Track( trackSegment );
1160 for(
const auto& genParticleRef : newTrackingParticle.
genParticles() )
1171 pMergedOutput->setProxy( pDecayChainTrack, pBremParentChainTrack );
1177 addTrackAndParentVertex( pDecayChainTrack, newTrackingParticle, pMergedOutput );
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
int bunchCrossing() const
T getParameter(std::string const &) const
TrackingTruthAccumulator(const edm::ParameterSet &config, edm::EDProducer &mixMod)
EncodedEventId eventId() const
const bool ignoreTracksOutsideVolume_
int event() const
get the contents of the subdetector field (should be protected?)
unsigned int layer() const
layer id
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual void initializeEvent(const edm::Event &event, const edm::EventSetup &setup)
std::vector< TrackingParticle > TrackingParticleCollection
ROOT::Math::Plane3D::Vector Vector
TrackingParticleRefProd refTrackingParticles
int pdgId() const
PDG ID.
const bool addAncestors_
Whether or not to add the full parentage of any TrackingParticle that is inserted in the collection...
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void addDaughterTrack(const TrackingParticleRef &)
void accumulateEvent(const T &event, const edm::EventSetup &setup)
Both forms of accumulate() delegate to this templated method.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void addParentTrack(const TrackingParticleRef &)
float charge() const
charge
bool signalOnly_
Uses the same config as selector_, but can be used to drop out early since selector_ requires the Tra...
static int position[TOTALCHAMBERS][3]
unsigned int layer() const
layer id
void fillSimHits(std::vector< const PSimHit * > &returnValue, const T &event, const edm::EventSetup &setup)
Fills the supplied vector with pointers to the SimHits, checking for bad modules if required...
const unsigned int maximumSubsequentBunchCrossing_
uint32_t rawId() const
get the raw id
void setParentVertex(const TrackingVertexRef &ref)
void addGenParticle(const reco::GenParticleRef &ref)
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
const reco::GenParticleRefVector & genParticles() const
int bunchCrossing() const
get the detector field from this detid
void addG4Track(const SimTrack &t)
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
int numberOfTrackerLayers() const
The number of tracker layers with a hit.
virtual void finalizeEvent(edm::Event &event, const edm::EventSetup &setup)
const std::string messageCategory_
The message category used to send messages to MessageLogger.
const math::XYZTLorentzVectorD & position() const
std::vector< std::string > getParameterNames() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
edm::InputTag genParticleLabel_
TrackingVertexRefProd refTrackingVertexes
unsigned int disk() const
disk id
OutputCollections mergedOutput_
const edm::InputTag simTrackLabel_
bool allowDifferentProcessTypeForDifferentDetectors_
When counting hits, allows hits in different detectors to have a different process type...
std::auto_ptr< TrackingParticleCollection > pTrackingParticles
virtual void accumulate(const edm::Event &event, const edm::EventSetup &setup)
edm::Ref< TrackingVertexCollection > TrackingVertexRef
unsigned int trackId() const
std::auto_ptr< TrackingVertexCollection > pTrackingVertices
XYZPointD XYZPoint
point in space with cartesian internal representation
void addDecayVertex(const TrackingVertexRef &ref)
std::vector< TrackingVertex > TrackingVertexCollection
const std::vector< SimTrack > & g4Tracks() const
edm::ParameterSet simHitCollectionConfig_
unsigned int layerNumber(align::ID, const TrackerTopology *)
Layer number increases with rho from 1 to 8.
int numberOfHits() const
Gives the total number of hits, including muon hits. Hits on overlaps in the same layer count separat...
unsigned int wheel() const
wheel id
const unsigned int maximumPreviousBunchCrossing_
const edm::InputTag simVertexLabel_
unsigned int layer() const
layer id
void setNumberOfTrackerHits(int numberOfTrackerHits)
int type() const
particle type (HEP PDT convension)
const TrackingVertexRef & parentVertex() const
EncodedEventId eventId() const
#define DEFINE_DIGI_ACCUMULATOR(type)
bool chargedOnly_
Uses the same config as selector_, but can be used to drop out early since selector_ requires the Tra...
const bool createUnmergedCollection_
If bremsstrahlung merging, whether to also add the unmerged collection to the event or not...
TrackingParticleSelector selector_
Monte Carlo truth information used for tracking validation.
OutputCollections unmergedOutput_
int numberOfTrackerHits() const
The number of hits in the tracker. Hits on overlaps in the same layer count separately.
void setNumberOfTrackerLayers(const int numberOfTrackerLayers)
Replacement for TrackingTruthProducer in the new pileup mixing setup.
Detector det() const
get the detector field from this detid
const bool createMergedCollection_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
edm::Ref< TrackingParticleCollection > TrackingParticleRef
math::PtEtaPhiELorentzVectorF LorentzVector
unsigned int wheel() const
wheel id
void setNumberOfHits(int numberOfHits)
const double volumeRadius_