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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string backwardPredictedStateTag_
 
std::string combinedStateTag_
 
edm::ParameterSet conf_
 
std::string forwardPredictedStateTag_
 
TrackInfoProducerAlgorithm theAlgo_
 
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
 
- 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

Definition at line 22 of file TrackInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file TrackInfoProducer.cc.

13  :
14  conf_(iConfig),
15  theAlgo_(iConfig)
16 {
17  produces<reco::TrackInfoCollection>();
18  produces<reco::TrackInfoTrackAssociationCollection>();
19 
20 
21 }
TrackInfoProducerAlgorithm theAlgo_
edm::ParameterSet conf_
virtual TrackInfoProducer::~TrackInfoProducer ( )
inlinevirtual

Definition at line 28 of file TrackInfoProducer.h.

28 {};

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 conf_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, edm::Ref< C, T, F >::key(), convertSQLitetoXML_cfg::output, edm::Event::put(), TrackInfoProducerAlgorithm::run(), theAlgo_, and patCandidatesForDimuonsSequences_cff::tracker.

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  std::auto_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl (new reco::TrackInfoTrackAssociationCollection);
32 
33  edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("cosmicTracks");
34 
38 
40  setup.get<TrackerDigiGeometryRecord>().get( tkgeom );
41  const TrackerGeometry * tracker=&(* tkgeom);
42 
43  theEvent.getByLabel(TkTag,TrajectoryCollection);
44  theEvent.getByLabel(TkTag,trackCollection);
45  theEvent.getByLabel(TkTag,assoMap);
46 
47  //
48  //run the algorithm
49  //
51 
52  std::vector<Trajectory>::const_iterator traj_iterator;
53  edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
54  std::map<reco::TrackRef,unsigned int> trackid;
55  int i=0;
56 
57  for(TrajTrackAssociationCollection::const_iterator it = assoMap->begin();it != assoMap->end(); ++it){
58  const edm::Ref<std::vector<Trajectory> > traj = it->key;
59  const reco::TrackRef track = it->val;
60  trackid.insert(make_pair(track,i));
61  i++;
62  theAlgo_.run(traj,track,output,tracker);
63  outputColl->push_back(*(new reco::TrackInfo(output)));
64 
65  }
66 
67 
68  //put everything in the event
70 
71 // if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(outputFwdColl,forwardPredictedStateTag_ );
72 // if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(outputBwdColl,backwardPredictedStateTag_);
73 // if(updatedStateTag_!="") rTrackInfou = theEvent.put(outputUpdatedColl,updatedStateTag_ );
74 // if(combinedStateTag_!="") rTrackInfoc = theEvent.put(outputCombinedColl,combinedStateTag_ );
75  rTrackInfo=theEvent.put(outputColl);
76 
77  for(std::map<reco::TrackRef,unsigned int>::iterator ref_iter=trackid.begin();ref_iter!=trackid.end();ref_iter++){
78 
79  TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
80  }
81 
82  theEvent.put(TIassociationColl);
83 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< TrackInfo > TrackInfoCollection
collection of TrackInfos
Definition: TrackInfoFwd.h:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
TrackInfoProducerAlgorithm theAlgo_
edm::ParameterSet conf_
const T & get() const
Definition: EventSetup.h:55
key_type key() const
Accessor for product key.
Definition: Ref.h:266
std::vector< Trajectory > TrajectoryCollection
void run(const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)

Member Data Documentation

std::string TrackInfoProducer::backwardPredictedStateTag_
private

Definition at line 36 of file TrackInfoProducer.h.

std::string TrackInfoProducer::combinedStateTag_
private

Definition at line 36 of file TrackInfoProducer.h.

edm::ParameterSet TrackInfoProducer::conf_
private

Definition at line 34 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::forwardPredictedStateTag_
private

Definition at line 36 of file TrackInfoProducer.h.

TrackInfoProducerAlgorithm TrackInfoProducer::theAlgo_
private

Definition at line 35 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::updatedStateTag_
private

Definition at line 36 of file TrackInfoProducer.h.