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 | Static Private Member Functions | Private Attributes
NuclearInteractionEDProducer Class Reference

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

Inheritance diagram for NuclearInteractionEDProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::RefVector
< TrajectorySeedCollection
TrajectorySeedRefVector
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 NuclearInteractionEDProducer (const edm::ParameterSet &)
 
 ~NuclearInteractionEDProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void findAdditionalSecondaryTracks (reco::NuclearInteraction &nucl, const edm::Handle< reco::TrackCollection > &additionalSecTracks) const
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Static Private Member Functions

static bool isInside (const reco::TrackRef &track, const TrajectorySeedRefVector &seeds)
 

Private Attributes

edm::ParameterSet conf_
 
std::unique_ptr
< NuclearLikelihood
likelihoodCalculator
 
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::unique_ptr
< NuclearVertexBuilder
vertexBuilder
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 17 of file NuclearInteractionEDProducer.cc.

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

17  :
18 conf_(iConfig)
19 {
20  token_primaryTrack = consumes<reco::TrackCollection>(iConfig.getParameter<std::string>("primaryProducer"));
21  token_secondaryTrack = consumes<reco::TrackCollection>(iConfig.getParameter<std::string>("secondaryProducer"));
22  token_additionalSecTracks = consumes<reco::TrackCollection>(iConfig.getParameter<std::string>("additionalSecondaryProducer"));
23  token_primaryTrajectory = consumes<TrajectoryCollection>(iConfig.getParameter<std::string>("primaryProducer"));
24  token_refMapH = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<std::string>("primaryProducer"));
25  token_nuclMapH = consumes<TrajectoryToSeedsMap>(iConfig.getParameter<std::string>("seedsProducer"));
26 
27  produces<reco::NuclearInteractionCollection>();
28 }
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 30 of file NuclearInteractionEDProducer.cc.

31 {
32 }

Member Function Documentation

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

Definition at line 139 of file NuclearInteractionEDProducer.cc.

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

Referenced by produce().

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

Definition at line 133 of file NuclearInteractionEDProducer.cc.

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

Referenced by produce().

133  {
134  unsigned int seedKey = track->seedRef().key();
135  for (unsigned int i=0; i< seeds.size(); i++) { if( seeds[i].key() == seedKey ) return true; }
136  return false;
137 }
int i
Definition: DBlmapReader.cc:9
key_type key() const
Accessor for product key.
Definition: Ref.h:264
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
void NuclearInteractionEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

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::stream::EDProducerBase.

Definition at line 40 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(), relval_2017::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.

41 {
42  if ( magFieldWatcher_.check(iSetup) || transientTrackWatcher_.check(iSetup) ) {
45  iSetup.get<IdealMagneticFieldRecord>().get(magField);
46 
48  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",builder);
49 
50  vertexBuilder = std::make_unique< NuclearVertexBuilder >(magField.product(), builder.product(), conf_);
51  likelihoodCalculator = std::make_unique< NuclearLikelihood >();
52  }
53 
55  edm::Handle<reco::TrackCollection> primaryTrackCollection;
56  iEvent.getByToken(token_primaryTrack, primaryTrackCollection);
57 
59  edm::Handle< TrajectoryCollection > primaryTrajectoryCollection;
60  iEvent.getByToken(token_primaryTrajectory, primaryTrajectoryCollection);
61 
64  iEvent.getByToken(token_refMapH, refMapH);
65  const TrajTrackAssociationCollection& refMap = *(refMapH.product());
66 
69  iEvent.getByToken(token_nuclMapH, nuclMapH);
70  const TrajectoryToSeedsMap& nuclMap = *(nuclMapH.product());
71 
73  edm::Handle<reco::TrackCollection> secondaryTrackCollection;
74  iEvent.getByToken(token_secondaryTrack, secondaryTrackCollection);
75 
76  // Get eventual additional secondary tracks
77  edm::Handle<reco::TrackCollection> additionalSecTracks;
78  iEvent.getByToken(token_additionalSecTracks, additionalSecTracks);
79 
81  std::auto_ptr<reco::NuclearInteractionCollection> theNuclearInteractions(new reco::NuclearInteractionCollection);
82 
83  typedef edm::Ref<TrajectoryCollection> TrajectoryRef;
84 
86  for(unsigned int i = 0; i < primaryTrajectoryCollection->size() ; i++) {
87 
88  TrajectoryRef trajRef( primaryTrajectoryCollection, i );
89 
91  TrajTrackAssociationCollection::const_iterator itPrimTrack = refMap.find( trajRef );
92  if( itPrimTrack == refMap.end() || (itPrimTrack->val).isNull() ) continue;
93  const reco::TrackRef& primary_track = itPrimTrack->val;
94 
96  TrajectoryToSeedsMap::const_iterator itSeeds = nuclMap.find( trajRef );
97  if( itSeeds == nuclMap.end() || (itSeeds->val).isNull()) continue;
98  const TrajectorySeedRefVector& seeds = itSeeds->val;
99 
101  std::vector<reco::TrackRef> secondary_tracks;
102  for( unsigned int k=0; k < secondaryTrackCollection->size(); k++) {
103  reco::TrackRef currentTrk(secondaryTrackCollection, k);
104  if( isInside( currentTrk, seeds ) ) secondary_tracks.push_back(currentTrk);
105  }
106 
108  vertexBuilder->build(primary_track, secondary_tracks);
109  likelihoodCalculator->calculate( vertexBuilder->getVertex() );
110 
112  reco::NuclearInteraction nuclInter(seeds, vertexBuilder->getVertex(), likelihoodCalculator->result() );
113 
116  if( additionalSecTracks.isValid() )
117  findAdditionalSecondaryTracks(nuclInter, additionalSecTracks);
118 
119  theNuclearInteractions->push_back( nuclInter );
120 
121  std::ostringstream str;
122  print(str, nuclInter, *vertexBuilder);
123  edm::LogInfo("NuclearInteractionMaker") << str.str();
124 
125  }
126 
127 
128  LogDebug("NuclearInteractionMaker") << "End of NuclearInteractionMaker - Number of nuclear interactions found :" << theNuclearInteractions->size();
129  iEvent.put(theNuclearInteractions);
130 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::unique_ptr< NuclearLikelihood > likelihoodCalculator
static 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:462
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:10
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:121
std::unique_ptr< NuclearVertexBuilder > vertexBuilder
std::vector< NuclearInteraction > NuclearInteractionCollection
collection of NuclearInteractions
edm::EDGetTokenT< TrajectoryCollection > token_primaryTrajectory
void findAdditionalSecondaryTracks(reco::NuclearInteraction &nucl, const edm::Handle< reco::TrackCollection > &additionalSecTracks) const
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
edm::ESWatcher< IdealMagneticFieldRecord > magFieldWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::EDGetTokenT< reco::TrackCollection > token_secondaryTrack
edm::RefVector< TrajectorySeedCollection > TrajectorySeedRefVector
edm::EDGetTokenT< reco::TrackCollection > token_primaryTrack
edm::EDGetTokenT< TrajectoryToSeedsMap > token_nuclMapH

Member Data Documentation

edm::ParameterSet NuclearInteractionEDProducer::conf_
private

Definition at line 65 of file NuclearInteractionEDProducer.h.

Referenced by produce().

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

Definition at line 74 of file NuclearInteractionEDProducer.h.

Referenced by findAdditionalSecondaryTracks(), and produce().

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

Definition at line 76 of file NuclearInteractionEDProducer.h.

Referenced by produce().

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

Definition at line 68 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

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

Definition at line 71 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

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

Definition at line 66 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

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

Definition at line 69 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

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

Definition at line 70 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

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

Definition at line 67 of file NuclearInteractionEDProducer.h.

Referenced by NuclearInteractionEDProducer(), and produce().

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

Definition at line 77 of file NuclearInteractionEDProducer.h.

Referenced by produce().

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

Definition at line 73 of file NuclearInteractionEDProducer.h.

Referenced by findAdditionalSecondaryTracks(), and produce().