#include <RecoVertex/NuclearInteractionProducer/interface/NuclearInteractionEDProducer.h>
Public Types | |
typedef edm::RefVector < TrajectorySeedCollection > | TrajectorySeedRefVector |
Public Member Functions | |
NuclearInteractionEDProducer (const edm::ParameterSet &) | |
~NuclearInteractionEDProducer () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
void | findAdditionalSecondaryTracks (reco::NuclearInteraction &nucl, const edm::Handle< reco::TrackCollection > &additionalSecTracks) |
bool | isInside (const reco::TrackRef &track, const TrajectorySeedRefVector &seeds) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::string | additionalSecondaryProducer_ |
edm::ParameterSet | conf_ |
std::auto_ptr< NuclearLikelihood > | likelihoodCalculator |
edm::ESWatcher < IdealMagneticFieldRecord > | magFieldWatcher_ |
std::string | primaryProducer_ |
std::string | secondaryProducer_ |
std::string | seedsProducer_ |
edm::ESWatcher < TransientTrackRecord > | transientTrackWatcher_ |
std::auto_ptr < NuclearVertexBuilder > | vertexBuilder |
Description: Associate nuclear seeds to primary tracks and associate secondary tracks to primary tracks
Implementation: <Notes on="" implementation>="">
Definition at line 49 of file NuclearInteractionEDProducer.h.
typedef edm::RefVector<TrajectorySeedCollection> NuclearInteractionEDProducer::TrajectorySeedRefVector |
Definition at line 52 of file NuclearInteractionEDProducer.h.
NuclearInteractionEDProducer::NuclearInteractionEDProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 15 of file NuclearInteractionEDProducer.cc.
: conf_(iConfig), primaryProducer_(iConfig.getParameter<std::string>("primaryProducer")), seedsProducer_(iConfig.getParameter<std::string>("seedsProducer")), secondaryProducer_(iConfig.getParameter<std::string>("secondaryProducer")), additionalSecondaryProducer_(iConfig.getParameter<std::string>("additionalSecondaryProducer")) { produces<reco::NuclearInteractionCollection>(); }
NuclearInteractionEDProducer::~NuclearInteractionEDProducer | ( | ) |
Definition at line 25 of file NuclearInteractionEDProducer.cc.
{ }
void NuclearInteractionEDProducer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 129 of file NuclearInteractionEDProducer.cc.
{ }
void NuclearInteractionEDProducer::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 133 of file NuclearInteractionEDProducer.cc.
{}
void NuclearInteractionEDProducer::findAdditionalSecondaryTracks | ( | reco::NuclearInteraction & | nucl, |
const edm::Handle< reco::TrackCollection > & | additionalSecTracks | ||
) | [private] |
Definition at line 142 of file NuclearInteractionEDProducer.cc.
References i, likelihoodCalculator, LogDebug, reco::NuclearInteraction::seeds(), and vertexBuilder.
Referenced by produce().
{ LogDebug("NuclearInteractionMaker") << "Check if one of the " << additionalSecTracks->size() << " additional secondary track is compatible"; reco::TrackRefVector allSecondary; for(unsigned int i=0; i< additionalSecTracks->size(); i++) { reco::TrackRef sec(additionalSecTracks, i); if( vertexBuilder->isCompatible( sec ) ) { // check if sec is already a secondary track (with id = tkId) // else add this new track vertexBuilder->addSecondaryTrack( sec ); } } likelihoodCalculator->calculate( vertexBuilder->getVertex() ); nucl = reco::NuclearInteraction(nucl.seeds(), vertexBuilder->getVertex(), likelihoodCalculator->result() ); }
bool NuclearInteractionEDProducer::isInside | ( | const reco::TrackRef & | track, |
const TrajectorySeedRefVector & | seeds | ||
) | [private] |
Definition at line 136 of file NuclearInteractionEDProducer.cc.
References i, edm::Ref< C, T, F >::key(), combine::key, and edm::RefVector< C, T, F >::size().
Referenced by produce().
void NuclearInteractionEDProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Get magnetic field
Get the primary tracks
Get the primary trajectories (produced by the Refitter)
Get the AssociationMap between primary tracks and trajectories
Get the AssociationMap between seeds and primary trajectories
Get the secondary tracks
Definition of the output
Loop on all primary trajectories
1. Get the primary track from the trajectory
2. Get the seeds from the trajectory
3. Get the secondary tracks
4. Get the vertex and the likelihood
5. Build the nuclear interaction
6. Search for additional secondary tracks in an other track collection and recompute the nuclear interaction
Implements edm::EDProducer.
Definition at line 35 of file NuclearInteractionEDProducer.cc.
References additionalSecondaryProducer_, edm::ESWatcher< T >::check(), conf_, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), findAdditionalSecondaryTracks(), edm::EventSetup::get(), edm::Event::getByLabel(), i, isInside(), edm::HandleBase::isValid(), gen::k, likelihoodCalculator, LogDebug, magFieldWatcher_, primaryProducer_, reco::print(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::Event::put(), secondaryProducer_, seedsProducer_, transientTrackWatcher_, and vertexBuilder.
{ if ( magFieldWatcher_.check(iSetup) || transientTrackWatcher_.check(iSetup) ) { edm::ESHandle<MagneticField> magField; iSetup.get<IdealMagneticFieldRecord>().get(magField); edm::ESHandle<TransientTrackBuilder> builder; iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",builder); vertexBuilder = std::auto_ptr< NuclearVertexBuilder >(new NuclearVertexBuilder( magField.product(), builder.product(), conf_) ); likelihoodCalculator = std::auto_ptr< NuclearLikelihood >(new NuclearLikelihood); } edm::Handle<reco::TrackCollection> primaryTrackCollection; iEvent.getByLabel( primaryProducer_, primaryTrackCollection ); edm::Handle< TrajectoryCollection > primaryTrajectoryCollection; iEvent.getByLabel( primaryProducer_, primaryTrajectoryCollection ); edm::Handle< TrajTrackAssociationCollection > refMapH; iEvent.getByLabel( primaryProducer_, refMapH ); const TrajTrackAssociationCollection& refMap = *(refMapH.product()); edm::Handle<TrajectoryToSeedsMap> nuclMapH; iEvent.getByLabel(seedsProducer_, nuclMapH); const TrajectoryToSeedsMap& nuclMap = *(nuclMapH.product()); edm::Handle<reco::TrackCollection> secondaryTrackCollection; iEvent.getByLabel( secondaryProducer_, secondaryTrackCollection ); // Get eventual additional secondary tracks edm::Handle<reco::TrackCollection> additionalSecTracks; iEvent.getByLabel( additionalSecondaryProducer_, additionalSecTracks); std::auto_ptr<reco::NuclearInteractionCollection> theNuclearInteractions(new reco::NuclearInteractionCollection); typedef edm::Ref<TrajectoryCollection> TrajectoryRef; for(unsigned int i = 0; i < primaryTrajectoryCollection->size() ; i++) { TrajectoryRef trajRef( primaryTrajectoryCollection, i ); TrajTrackAssociationCollection::const_iterator itPrimTrack = refMap.find( trajRef ); if( itPrimTrack == refMap.end() || (itPrimTrack->val).isNull() ) continue; const reco::TrackRef& primary_track = itPrimTrack->val; TrajectoryToSeedsMap::const_iterator itSeeds = nuclMap.find( trajRef ); if( itSeeds == nuclMap.end() || (itSeeds->val).isNull()) continue; const TrajectorySeedRefVector& seeds = itSeeds->val; std::vector<reco::TrackRef> secondary_tracks; for( unsigned int k=0; k < secondaryTrackCollection->size(); k++) { reco::TrackRef currentTrk(secondaryTrackCollection, k); if( isInside( currentTrk, seeds ) ) secondary_tracks.push_back(currentTrk); } vertexBuilder->build(primary_track, secondary_tracks); likelihoodCalculator->calculate( vertexBuilder->getVertex() ); reco::NuclearInteraction nuclInter(seeds, vertexBuilder->getVertex(), likelihoodCalculator->result() ); if( additionalSecTracks.isValid() ) findAdditionalSecondaryTracks(nuclInter, additionalSecTracks); theNuclearInteractions->push_back( nuclInter ); std::ostringstream str; print(str, nuclInter, vertexBuilder); edm::LogInfo("NuclearInteractionMaker") << str.str(); } LogDebug("NuclearInteractionMaker") << "End of NuclearInteractionMaker - Number of nuclear interactions found :" << theNuclearInteractions->size(); iEvent.put(theNuclearInteractions); }
std::string NuclearInteractionEDProducer::additionalSecondaryProducer_ [private] |
Definition at line 71 of file NuclearInteractionEDProducer.h.
Referenced by produce().
Definition at line 67 of file NuclearInteractionEDProducer.h.
Referenced by produce().
std::auto_ptr< NuclearLikelihood > NuclearInteractionEDProducer::likelihoodCalculator [private] |
Definition at line 74 of file NuclearInteractionEDProducer.h.
Referenced by findAdditionalSecondaryTracks(), and produce().
Definition at line 76 of file NuclearInteractionEDProducer.h.
Referenced by produce().
std::string NuclearInteractionEDProducer::primaryProducer_ [private] |
Definition at line 68 of file NuclearInteractionEDProducer.h.
Referenced by produce().
std::string NuclearInteractionEDProducer::secondaryProducer_ [private] |
Definition at line 70 of file NuclearInteractionEDProducer.h.
Referenced by produce().
std::string NuclearInteractionEDProducer::seedsProducer_ [private] |
Definition at line 69 of file NuclearInteractionEDProducer.h.
Referenced by produce().
Definition at line 77 of file NuclearInteractionEDProducer.h.
Referenced by produce().
std::auto_ptr< NuclearVertexBuilder > NuclearInteractionEDProducer::vertexBuilder [private] |
Definition at line 73 of file NuclearInteractionEDProducer.h.
Referenced by findAdditionalSecondaryTracks(), and produce().