CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
NuclearInteractionEDProducer Class Reference

#include <RecoVertex/NuclearInteractionProducer/interface/NuclearInteractionEDProducer.h>

Inheritance diagram for NuclearInteractionEDProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::RefVector
< TrajectorySeedCollection
TrajectorySeedRefVector
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 NuclearInteractionEDProducer (const edm::ParameterSet &)
 
 ~NuclearInteractionEDProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

edm::ParameterSet conf_
 
std::auto_ptr< NuclearLikelihoodlikelihoodCalculator
 
edm::ESWatcher
< IdealMagneticFieldRecord
magFieldWatcher_
 
edm::EDGetTokenT
< reco::TrackCollection
token_additionalSecTracks
 
edm::EDGetTokenT
< TrajectoryToSeedsMap
token_nuclMapH
 
edm::EDGetTokenT
< reco::TrackCollection
token_primaryTrack
 
edm::EDGetTokenT
< TrajectoryCollection
token_primaryTrajectory
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
token_refMapH
 
edm::EDGetTokenT
< reco::TrackCollection
token_secondaryTrack
 
edm::ESWatcher
< TransientTrackRecord
transientTrackWatcher_
 
std::auto_ptr
< NuclearVertexBuilder
vertexBuilder
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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.

Member Typedef Documentation

Definition at line 52 of file NuclearInteractionEDProducer.h.

Constructor & Destructor Documentation

NuclearInteractionEDProducer::NuclearInteractionEDProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 13 of file NuclearInteractionEDProducer.cc.

References edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, token_additionalSecTracks, token_nuclMapH, token_primaryTrack, token_primaryTrajectory, token_refMapH, and token_secondaryTrack.

13  :
14 conf_(iConfig)
15 {
16  token_primaryTrack = consumes<reco::TrackCollection>(iConfig.getParameter<std::string>("primaryProducer"));
17  token_secondaryTrack = consumes<reco::TrackCollection>(iConfig.getParameter<std::string>("secondaryProducer"));
18  token_additionalSecTracks = consumes<reco::TrackCollection>(iConfig.getParameter<std::string>("additionalSecondaryProducer"));
19  token_primaryTrajectory = consumes<TrajectoryCollection>(iConfig.getParameter<std::string>("primaryProducer"));
20  token_refMapH = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<std::string>("primaryProducer"));
21  token_nuclMapH = consumes<TrajectoryToSeedsMap>(iConfig.getParameter<std::string>("seedsProducer"));
22 
23  produces<reco::NuclearInteractionCollection>();
24 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > token_additionalSecTracks
edm::EDGetTokenT< TrajTrackAssociationCollection > token_refMapH
edm::EDGetTokenT< TrajectoryCollection > token_primaryTrajectory
edm::EDGetTokenT< reco::TrackCollection > token_secondaryTrack
edm::EDGetTokenT< reco::TrackCollection > token_primaryTrack
edm::EDGetTokenT< TrajectoryToSeedsMap > token_nuclMapH
NuclearInteractionEDProducer::~NuclearInteractionEDProducer ( )

Definition at line 26 of file NuclearInteractionEDProducer.cc.

27 {
28 }

Member Function Documentation

void NuclearInteractionEDProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 130 of file NuclearInteractionEDProducer.cc.

131 {
132 }
void NuclearInteractionEDProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 134 of file NuclearInteractionEDProducer.cc.

134 {}
void NuclearInteractionEDProducer::findAdditionalSecondaryTracks ( reco::NuclearInteraction nucl,
const edm::Handle< reco::TrackCollection > &  additionalSecTracks 
)
private

Definition at line 143 of file NuclearInteractionEDProducer.cc.

References i, likelihoodCalculator, LogDebug, reco::NuclearInteraction::seeds(), and vertexBuilder.

Referenced by produce().

144  {
145 
146  LogDebug("NuclearInteractionMaker") << "Check if one of the " << additionalSecTracks->size()
147  << " additional secondary track is compatible";
148  reco::TrackRefVector allSecondary;
149  for(unsigned int i=0; i< additionalSecTracks->size(); i++) {
150  reco::TrackRef sec(additionalSecTracks, i);
151  if( vertexBuilder->isCompatible( sec ) ) {
152  // check if sec is already a secondary track (with id = tkId)
153  // else add this new track
154  vertexBuilder->addSecondaryTrack( sec );
155  }
156  }
157  likelihoodCalculator->calculate( vertexBuilder->getVertex() );
158 
159  nucl = reco::NuclearInteraction(nucl.seeds(), vertexBuilder->getVertex(), likelihoodCalculator->result() );
160 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const TrajectorySeedRefVector & seeds()
return the seeds
std::auto_ptr< NuclearLikelihood > likelihoodCalculator
std::auto_ptr< NuclearVertexBuilder > vertexBuilder
bool NuclearInteractionEDProducer::isInside ( const reco::TrackRef track,
const TrajectorySeedRefVector seeds 
)
private

Definition at line 137 of file NuclearInteractionEDProducer.cc.

References i, combine::key, edm::Ref< C, T, F >::key(), and edm::RefVector< C, T, F >::size().

Referenced by produce().

137  {
138  unsigned int seedKey = track->seedRef().key();
139  for (unsigned int i=0; i< seeds.size(); i++) { if( seeds[i].key() == seedKey ) return true; }
140  return false;
141 }
int i
Definition: DBlmapReader.cc:9
key_type key() const
Accessor for product key.
Definition: Ref.h:266
list key
Definition: combine.py:13
void NuclearInteractionEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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 36 of file NuclearInteractionEDProducer.cc.

References edm::ESWatcher< T >::check(), conf_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), findAdditionalSecondaryTracks(), edm::EventSetup::get(), edm::Event::getByToken(), i, isInside(), edm::HandleBase::isValid(), gen::k, likelihoodCalculator, LogDebug, magFieldWatcher_, reco::print(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), token_additionalSecTracks, token_nuclMapH, token_primaryTrack, token_primaryTrajectory, token_refMapH, token_secondaryTrack, transientTrackWatcher_, edm::helpers::KeyVal< K, V >::val, and vertexBuilder.

37 {
38  if ( magFieldWatcher_.check(iSetup) || transientTrackWatcher_.check(iSetup) ) {
41  iSetup.get<IdealMagneticFieldRecord>().get(magField);
42 
44  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",builder);
45 
46  vertexBuilder = std::auto_ptr< NuclearVertexBuilder >(new NuclearVertexBuilder( magField.product(), builder.product(), conf_) );
47  likelihoodCalculator = std::auto_ptr< NuclearLikelihood >(new NuclearLikelihood);
48  }
49 
51  edm::Handle<reco::TrackCollection> primaryTrackCollection;
52  iEvent.getByToken(token_primaryTrack, primaryTrackCollection);
53 
55  edm::Handle< TrajectoryCollection > primaryTrajectoryCollection;
56  iEvent.getByToken(token_primaryTrajectory, primaryTrajectoryCollection);
57 
60  iEvent.getByToken(token_refMapH, refMapH);
61  const TrajTrackAssociationCollection& refMap = *(refMapH.product());
62 
65  iEvent.getByToken(token_nuclMapH, nuclMapH);
66  const TrajectoryToSeedsMap& nuclMap = *(nuclMapH.product());
67 
69  edm::Handle<reco::TrackCollection> secondaryTrackCollection;
70  iEvent.getByToken(token_secondaryTrack, secondaryTrackCollection);
71 
72  // Get eventual additional secondary tracks
73  edm::Handle<reco::TrackCollection> additionalSecTracks;
74  iEvent.getByToken(token_additionalSecTracks, additionalSecTracks);
75 
77  std::auto_ptr<reco::NuclearInteractionCollection> theNuclearInteractions(new reco::NuclearInteractionCollection);
78 
79  typedef edm::Ref<TrajectoryCollection> TrajectoryRef;
80 
82  for(unsigned int i = 0; i < primaryTrajectoryCollection->size() ; i++) {
83 
84  TrajectoryRef trajRef( primaryTrajectoryCollection, i );
85 
87  TrajTrackAssociationCollection::const_iterator itPrimTrack = refMap.find( trajRef );
88  if( itPrimTrack == refMap.end() || (itPrimTrack->val).isNull() ) continue;
89  const reco::TrackRef& primary_track = itPrimTrack->val;
90 
92  TrajectoryToSeedsMap::const_iterator itSeeds = nuclMap.find( trajRef );
93  if( itSeeds == nuclMap.end() || (itSeeds->val).isNull()) continue;
94  const TrajectorySeedRefVector& seeds = itSeeds->val;
95 
97  std::vector<reco::TrackRef> secondary_tracks;
98  for( unsigned int k=0; k < secondaryTrackCollection->size(); k++) {
99  reco::TrackRef currentTrk(secondaryTrackCollection, k);
100  if( isInside( currentTrk, seeds ) ) secondary_tracks.push_back(currentTrk);
101  }
102 
104  vertexBuilder->build(primary_track, secondary_tracks);
105  likelihoodCalculator->calculate( vertexBuilder->getVertex() );
106 
108  reco::NuclearInteraction nuclInter(seeds, vertexBuilder->getVertex(), likelihoodCalculator->result() );
109 
112  if( additionalSecTracks.isValid() )
113  findAdditionalSecondaryTracks(nuclInter, additionalSecTracks);
114 
115  theNuclearInteractions->push_back( nuclInter );
116 
117  std::ostringstream str;
118  print(str, nuclInter, vertexBuilder);
119  edm::LogInfo("NuclearInteractionMaker") << str.str();
120 
121  }
122 
123 
124  LogDebug("NuclearInteractionMaker") << "End of NuclearInteractionMaker - Number of nuclear interactions found :" << theNuclearInteractions->size();
125  iEvent.put(theNuclearInteractions);
126 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool isInside(const reco::TrackRef &track, const TrajectorySeedRefVector &seeds)
edm::ESWatcher< TransientTrackRecord > transientTrackWatcher_
edm::EDGetTokenT< reco::TrackCollection > token_additionalSecTracks
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:8
const_iterator find(const key_type &k) const
find element with specified reference key
edm::EDGetTokenT< TrajTrackAssociationCollection > token_refMapH
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< NuclearInteraction > NuclearInteractionCollection
collection of NuclearInteractions
edm::EDGetTokenT< TrajectoryCollection > token_primaryTrajectory
bool isValid() const
Definition: HandleBase.h:76
int k[5][pyjets_maxn]
void findAdditionalSecondaryTracks(reco::NuclearInteraction &nucl, const edm::Handle< reco::TrackCollection > &additionalSecTracks)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:81
edm::ESWatcher< IdealMagneticFieldRecord > magFieldWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:58
edm::EDGetTokenT< reco::TrackCollection > token_secondaryTrack
std::auto_ptr< NuclearLikelihood > likelihoodCalculator
edm::RefVector< TrajectorySeedCollection > TrajectorySeedRefVector
edm::EDGetTokenT< reco::TrackCollection > token_primaryTrack
edm::EDGetTokenT< TrajectoryToSeedsMap > token_nuclMapH
std::auto_ptr< NuclearVertexBuilder > vertexBuilder

Member Data Documentation

edm::ParameterSet NuclearInteractionEDProducer::conf_
private

Definition at line 67 of file NuclearInteractionEDProducer.h.

Referenced by produce().

std::auto_ptr< NuclearLikelihood > NuclearInteractionEDProducer::likelihoodCalculator
private

Definition at line 76 of file NuclearInteractionEDProducer.h.

Referenced by findAdditionalSecondaryTracks(), and produce().

edm::ESWatcher<IdealMagneticFieldRecord> NuclearInteractionEDProducer::magFieldWatcher_
private

Definition at line 78 of file NuclearInteractionEDProducer.h.

Referenced by produce().

edm::EDGetTokenT<reco::TrackCollection> NuclearInteractionEDProducer::token_additionalSecTracks
private

Definition at line 70 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

edm::EDGetTokenT<TrajectoryToSeedsMap> NuclearInteractionEDProducer::token_nuclMapH
private

Definition at line 73 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

edm::EDGetTokenT<reco::TrackCollection> NuclearInteractionEDProducer::token_primaryTrack
private

Definition at line 68 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

edm::EDGetTokenT<TrajectoryCollection> NuclearInteractionEDProducer::token_primaryTrajectory
private

Definition at line 71 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

edm::EDGetTokenT<TrajTrackAssociationCollection> NuclearInteractionEDProducer::token_refMapH
private

Definition at line 72 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

edm::EDGetTokenT<reco::TrackCollection> NuclearInteractionEDProducer::token_secondaryTrack
private

Definition at line 69 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

edm::ESWatcher<TransientTrackRecord> NuclearInteractionEDProducer::transientTrackWatcher_
private

Definition at line 79 of file NuclearInteractionEDProducer.h.

Referenced by produce().

std::auto_ptr< NuclearVertexBuilder > NuclearInteractionEDProducer::vertexBuilder
private

Definition at line 75 of file NuclearInteractionEDProducer.h.

Referenced by findAdditionalSecondaryTracks(), and produce().