CMS 3D CMS Logo

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

#include <TrackInfoProducer.h>

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

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 TrackInfoProducer (const edm::ParameterSet &iConfig)
 
virtual ~TrackInfoProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 Attributes

edm::EDGetTokenT
< TrajTrackAssociationCollection
assoMapToken_
 
std::string backwardPredictedStateTag_
 
std::string combinedStateTag_
 
std::string forwardPredictedStateTag_
 
TrackInfoProducerAlgorithm theAlgo_
 
edm::EDGetTokenT
< reco::TrackCollection
trackCollectionToken_
 
edm::EDGetTokenT< std::vector
< Trajectory > > 
TrajectoryToken_
 
std::string updatedStateTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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

Definition at line 25 of file TrackInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file TrackInfoProducer.cc.

11  :
12  theAlgo_(iConfig),
13  TrajectoryToken_(consumes<std::vector<Trajectory> >(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
14  trackCollectionToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
15  assoMapToken_(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks")))
16 {
17  produces<reco::TrackInfoCollection>();
18  produces<reco::TrackInfoTrackAssociationCollection>();
19 
20 
21 }
T getParameter(std::string const &) const
edm::EDGetTokenT< TrajTrackAssociationCollection > assoMapToken_
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
TrackInfoProducerAlgorithm theAlgo_
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
virtual TrackInfoProducer::~TrackInfoProducer ( )
inlinevirtual

Definition at line 31 of file TrackInfoProducer.h.

31 {};

Member Function Documentation

void TrackInfoProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
virtual

Implements edm::EDProducer.

Definition at line 24 of file TrackInfoProducer.cc.

References assoMapToken_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::EventSetup::get(), edm::Event::getByToken(), i, edm::Ref< C, T, F >::key(), convertSQLitetoXML_cfg::output, HLT_25ns10e33_v2_cff::outputColl, edm::Event::put(), TrackInfoProducerAlgorithm::run(), theAlgo_, HLT_25ns10e33_v2_cff::trackCollection, trackCollectionToken_, patCandidatesForDimuonsSequences_cff::tracker, and TrajectoryToken_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

25 {
26  //
27  // create empty output collections
28  //
29 
30  std::auto_ptr<reco::TrackInfoCollection> outputColl (new reco::TrackInfoCollection);
31 
35 
37  setup.get<TrackerDigiGeometryRecord>().get( tkgeom );
38  const TrackerGeometry * tracker=&(* tkgeom);
39 
40  theEvent.getByToken(TrajectoryToken_,TrajectoryCollection);
41  theEvent.getByToken(trackCollectionToken_,trackCollection);
42  theEvent.getByToken(assoMapToken_,assoMap);
43 
44  //
45  //run the algorithm
46  //
48 
49  std::vector<Trajectory>::const_iterator traj_iterator;
50  edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
51  std::map<reco::TrackRef,unsigned int> trackid;
52  int i=0;
53 
54  for(TrajTrackAssociationCollection::const_iterator it = assoMap->begin();it != assoMap->end(); ++it){
55  const edm::Ref<std::vector<Trajectory> > traj = it->key;
56  const reco::TrackRef track = it->val;
57  trackid.insert(make_pair(track,i));
58  i++;
59  theAlgo_.run(traj,track,output,tracker);
60  outputColl->push_back(*(new reco::TrackInfo(output)));
61 
62  }
63 
64 
65  //put everything in the event
67 
68 // if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(outputFwdColl,forwardPredictedStateTag_ );
69 // if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(outputBwdColl,backwardPredictedStateTag_);
70 // if(updatedStateTag_!="") rTrackInfou = theEvent.put(outputUpdatedColl,updatedStateTag_ );
71 // if(combinedStateTag_!="") rTrackInfoc = theEvent.put(outputCombinedColl,combinedStateTag_ );
72  rTrackInfo=theEvent.put(outputColl);
73  std::auto_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl (new reco::TrackInfoTrackAssociationCollection(assoMap->refProd().val, rTrackInfo));
74 
75  for(std::map<reco::TrackRef,unsigned int>::iterator ref_iter=trackid.begin();ref_iter!=trackid.end();++ref_iter){
76 
77  TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
78  }
79 
80  theEvent.put(TIassociationColl);
81 }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< TrajTrackAssociationCollection > assoMapToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
key_type key() const
Accessor for product key.
Definition: Ref.h:264
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::vector< TrackInfo > TrackInfoCollection
collection of TrackInfos
Definition: TrackInfoFwd.h:9
TrackInfoProducerAlgorithm theAlgo_
const T & get() const
Definition: EventSetup.h:56
std::vector< Trajectory > TrajectoryCollection
void run(const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_

Member Data Documentation

edm::EDGetTokenT<TrajTrackAssociationCollection> TrackInfoProducer::assoMapToken_
private

Definition at line 40 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::backwardPredictedStateTag_
private

Definition at line 41 of file TrackInfoProducer.h.

std::string TrackInfoProducer::combinedStateTag_
private

Definition at line 41 of file TrackInfoProducer.h.

std::string TrackInfoProducer::forwardPredictedStateTag_
private

Definition at line 41 of file TrackInfoProducer.h.

TrackInfoProducerAlgorithm TrackInfoProducer::theAlgo_
private

Definition at line 37 of file TrackInfoProducer.h.

Referenced by produce().

edm::EDGetTokenT<reco::TrackCollection> TrackInfoProducer::trackCollectionToken_
private

Definition at line 39 of file TrackInfoProducer.h.

Referenced by produce().

edm::EDGetTokenT<std::vector<Trajectory> > TrackInfoProducer::TrajectoryToken_
private

Definition at line 38 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::updatedStateTag_
private

Definition at line 41 of file TrackInfoProducer.h.