CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackInfoProducer.cc
Go to the documentation of this file.
2 // system include files
3 #include <memory>
4 // user include files
16  conf_(iConfig),
17  theAlgo_(iConfig)
18 {
19  produces<reco::TrackInfoCollection>();
20  produces<reco::TrackInfoTrackAssociationCollection>();
21 
22 
23 }
24 
25 
27 {
28  //
29  // create empty output collections
30  //
31 
32  std::auto_ptr<reco::TrackInfoCollection> outputColl (new reco::TrackInfoCollection);
33  std::auto_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl (new reco::TrackInfoTrackAssociationCollection);
34 
35  edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("cosmicTracks");
36 
40 
42  setup.get<TrackerDigiGeometryRecord>().get( tkgeom );
43  const TrackerGeometry * tracker=&(* tkgeom);
44 
45  theEvent.getByLabel(TkTag,TrajectoryCollection);
46  theEvent.getByLabel(TkTag,trackCollection);
47  theEvent.getByLabel(TkTag,assoMap);
48 
49  //
50  //run the algorithm
51  //
53 
54  std::vector<Trajectory>::const_iterator traj_iterator;
55  edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
56  std::map<reco::TrackRef,unsigned int> trackid;
57  int i=0;
58 
59  for(TrajTrackAssociationCollection::const_iterator it = assoMap->begin();it != assoMap->end(); ++it){
60  const edm::Ref<std::vector<Trajectory> > traj = it->key;
61  const reco::TrackRef track = it->val;
62  trackid.insert(make_pair(track,i));
63  i++;
64  theAlgo_.run(traj,track,output,tracker);
65  outputColl->push_back(*(new reco::TrackInfo(output)));
66 
67  }
68 
69 
70  //put everything in the event
72 
73 // if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(outputFwdColl,forwardPredictedStateTag_ );
74 // if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(outputBwdColl,backwardPredictedStateTag_);
75 // if(updatedStateTag_!="") rTrackInfou = theEvent.put(outputUpdatedColl,updatedStateTag_ );
76 // if(combinedStateTag_!="") rTrackInfoc = theEvent.put(outputCombinedColl,combinedStateTag_ );
77  rTrackInfo=theEvent.put(outputColl);
78 
79  for(std::map<reco::TrackRef,unsigned int>::iterator ref_iter=trackid.begin();ref_iter!=trackid.end();ref_iter++){
80 
81  TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
82  }
83 
84  theEvent.put(TIassociationColl);
85 }
86 
87 
88 
89 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
TrackInfoProducer(const edm::ParameterSet &iConfig)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< TrackInfo > TrackInfoCollection
collection of TrackInfos
Definition: TrackInfoFwd.h:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
TrackInfoProducerAlgorithm theAlgo_
edm::ParameterSet conf_
const T & get() const
Definition: EventSetup.h:55
key_type key() const
Accessor for product key.
Definition: Ref.h:265
std::vector< Trajectory > TrajectoryCollection
void run(const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")