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

#include <TrackProducerWithSCAssociation.h>

Inheritance diagram for TrackProducerWithSCAssociation:
TrackProducerBase< reco::Track > edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

std::vector< reco::TransientTrackgetTransient (edm::Event &, const edm::EventSetup &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 TrackProducerWithSCAssociation (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from TrackProducerBase< reco::Track >
const edm::ParameterSetgetConf () const
 
virtual void getFromES (const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
 Get needed services from the Event Setup. More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
 Get TrackCandidateCollection from the Event (needed by TrackProducer) More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackCollection > &, reco::BeamSpot &)
 Get TrackCollection from the Event (needed by TrackRefitter) More...
 
void setAlias (std::string alias)
 set the aliases of produced collections More...
 
void setClusterRemovalInfo (const edm::InputTag &clusterRemovalInfo)
 Sets the information on cluster removal, and turns it on. More...
 
void setConf (edm::ParameterSet conf)
 Set parameter set. More...
 
void setSecondHitPattern (Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTracker *measTk)
 
void setSrc (edm::InputTag src, edm::InputTag bsSrc)
 set label of source collection More...
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

void putInEvt (edm::Event &evt, const Propagator *thePropagator, const MeasurementTracker *theMeasTk, std::auto_ptr< TrackingRecHitCollection > &selHits, std::auto_ptr< reco::TrackCollection > &selTracks, std::auto_ptr< reco::TrackExtraCollection > &selTrackExtras, std::auto_ptr< std::vector< Trajectory > > &selTrajectories, AlgoProductCollection &algoResults)
 

Private Attributes

std::string conversionTrackCandidateProducer_
 
std::string myname_
 
bool myTrajectoryInEvent_
 
edm::OrphanHandle
< reco::TrackCollection
rTracks_
 
TrackProducerAlgorithm
< reco::Track
theAlgo
 
std::string trackCSuperClusterAssociationCollection_
 
std::string trackSuperClusterAssociationCollection_
 
bool validTrackCandidateSCAssociationInput_
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::Track >
typedef std::pair< Trajectory
*, std::pair< reco::Track
*, PropagationDirection > > 
AlgoProduct
 
typedef std::vector< AlgoProductAlgoProductCollection
 
typedef std::vector< reco::TrackTrackCollection
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from TrackProducerBase< reco::Track >
std::string alias_
 
edm::InputTag bsSrc_
 
edm::InputTag clusterRemovalInfo_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Id:
TrackProducerWithSCAssociation.h,v 1.5 2010/09/29 12:20:16 mangano Exp
Date:
2010/09/29 12:20:16
Revision:
1.5
Author
Nancy Marinelli, U. of Notre Dame, US Modified version of TrackProducer by Giuseppe Cerati to have super cluster - conversion track association

Definition at line 20 of file TrackProducerWithSCAssociation.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file TrackProducerWithSCAssociation.cc.

References TrackProducerBase< reco::Track >::alias_, conversionTrackCandidateProducer_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), myname_, myTrajectoryInEvent_, TrackProducerBase< reco::Track >::setAlias(), TrackProducerBase< reco::Track >::setClusterRemovalInfo(), TrackProducerBase< reco::Track >::setConf(), TrackProducerBase< reco::Track >::setSrc(), GlobalPosition_Frontier_DevDB_cff::tag, trackCSuperClusterAssociationCollection_, and trackSuperClusterAssociationCollection_.

20  :
21  TrackProducerBase<reco::Track>(iConfig.getParameter<bool>("TrajectoryInEvent")),
22  theAlgo(iConfig)
23 {
24  setConf(iConfig);
25  setSrc( iConfig.getParameter<edm::InputTag>( "src" ),
26  iConfig.getParameter<edm::InputTag>( "beamSpot" ));
27  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
28 
29  if ( iConfig.exists("clusterRemovalInfo") ) {
30  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
31  if (!(tag == edm::InputTag())) { setClusterRemovalInfo( tag ); }
32  }
33 
34 
35  myname_ = iConfig.getParameter<std::string>("ComponentName");
36  conversionTrackCandidateProducer_ = iConfig.getParameter<std::string>("producer");
37  trackCSuperClusterAssociationCollection_ = iConfig.getParameter<std::string>("trackCandidateSCAssociationCollection");
38  trackSuperClusterAssociationCollection_ = iConfig.getParameter<std::string>("recoTrackSCAssociationCollection");
39  myTrajectoryInEvent_ = iConfig.getParameter<bool>("TrajectoryInEvent");
40 
41 
42  //register your products
43  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
44  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
45  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
46  produces<std::vector<Trajectory> >() ;
47  produces<TrajTrackAssociationCollection>();
48  // produces< reco::TrackSuperClusterAssociationCollection > (trackSuperClusterAssociationCollection_ );
49  produces< reco::TrackCaloClusterPtrAssociation > (trackSuperClusterAssociationCollection_ );
50 
51 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setClusterRemovalInfo(const edm::InputTag &clusterRemovalInfo)
Sets the information on cluster removal, and turns it on.
void setAlias(std::string alias)
set the aliases of produced collections
void setConf(edm::ParameterSet conf)
Set parameter set.
void setSrc(edm::InputTag src, edm::InputTag bsSrc)
set label of source collection
TrackProducerAlgorithm< reco::Track > theAlgo

Member Function Documentation

std::vector< reco::TransientTrack > TrackProducerWithSCAssociation::getTransient ( edm::Event theEvent,
const edm::EventSetup setup 
)

Definition at line 200 of file TrackProducerWithSCAssociation.cc.

References alignCSCRings::e, TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::EventBase::id(), parseEventContent::prod, edm::ESHandle< class >::product(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.

201 {
202  edm::LogInfo("TrackProducerWithSCAssociation") << "Analyzing event number: " << theEvent.id() << "\n";
203  //
204  // create empty output collections
205  //
206  std::vector<reco::TransientTrack> ttks;
207 
208  //
209  //declare and get stuff to be retrieved from ES
210  //
214  edm::ESHandle<Propagator> thePropagator;
217  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
218 
219  //
220  //declare and get TrackColection to be retrieved from the event
221  //
222  AlgoProductCollection algoResults;
223  reco::BeamSpot bs;
224 
225  try{
227  getFromEvt(theEvent,theTCCollection,bs);
228 
229  //
230  //run the algorithm
231  //
232  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation run the algorithm" << "\n";
233  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
234  theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
235 
236  } catch (cms::Exception &e){ edm::LogInfo("TrackProducerWithSCAssociation") << "cms::Exception caught!!!" << "\n" << e << "\n";}
237 
238 
239  for (AlgoProductCollection::iterator prod=algoResults.begin();prod!=algoResults.end(); prod++){
240  ttks.push_back( reco::TransientTrack(*(((*prod).second).first),thePropagator.product()->magneticField() ));
241  }
242 
243  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation end" << "\n";
244 
245  return ttks;
246 }
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
std::vector< AlgoProduct > AlgoProductCollection
TrackProducerAlgorithm< reco::Track > theAlgo
T const * product() const
Definition: ESHandle.h:62
edm::EventID id() const
Definition: EventBase.h:56
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const TrackCandidateCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking TrackCandidates as input.
virtual void getFromES(const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
Get needed services from the Event Setup.
void TrackProducerWithSCAssociation::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
virtual

Implements edm::EDProducer.

Definition at line 54 of file TrackProducerWithSCAssociation.cc.

References TrackProducerAlgorithm< T >::buildTrack(), cont, conversionTrackCandidateProducer_, PTrajectoryStateOnDet::detId(), alignCSCRings::e, edm::HandleBase::failedToGet(), edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), i, edm::helper::Filler< Map >::insert(), edm::HandleBase::isValid(), convertSQLiteXML::ok, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), putInEvt(), TrackCandidate::recHits(), rTracks_, TrackCandidate::seed(), TrackCandidate::seedRef(), edm::ValueMap< T >::size(), evf::utils::state, theAlgo, trackCSuperClusterAssociationCollection_, trackSuperClusterAssociationCollection_, TrackCandidate::trajectoryStateOnDet(), trajectoryStateTransform::transientState(), and validTrackCandidateSCAssociationInput_.

55 {
56  //edm::LogInfo("TrackProducerWithSCAssociation") << "Analyzing event number: " << theEvent.id() << "\n";
57 
58  //LogDebug("TrackProducerWithSCAssociation") << "Analyzing event number: " << theEvent.id() << "\n";
59  // std::cout << " TrackProducerWithSCAssociation Analyzing event number: " << theEvent.id() << "\n";
60 
61 
62  //
63  // create empty output collections
64  //
65  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
66  std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
67  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
68  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
69  // Reco Track - Super Cluster Association
70  std::auto_ptr<reco::TrackCaloClusterPtrAssociation> scTrkAssoc_p(new reco::TrackCaloClusterPtrAssociation);
71 
72  //
73  //declare and get stuff to be retrieved from ES
74  //
78  edm::ESHandle<Propagator> thePropagator;
81  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
82 
83 
84 
85  //
86  //declare and get TrackColection to be retrieved from the event
92  if ( !trkCandidateSCAssocHandle.isValid() ) {
93  // std::cout << "Error! Can't get the product "<<trackCSuperClusterAssociationCollection_.c_str() << " but keep running. Empty collection will be produced " << "\n";
94  edm::LogError("TrackProducerWithSCAssociation") << "Error! Can't get the product "<<trackCSuperClusterAssociationCollection_.c_str() << " but keep running. Empty collection will be produced " << "\n";
96  }
97  reco::TrackCandidateCaloClusterPtrAssociation scTrkCandAssCollection = *(trkCandidateSCAssocHandle.product());
98  if ( scTrkCandAssCollection.size() ==0 ) validTrackCandidateSCAssociationInput_=false;
99 
100 
101  std::vector<int> tccLocations;
102  AlgoProductCollection algoResults;
103  reco::BeamSpot bs;
104 
105 
106  getFromEvt(theEvent,theTCCollection,bs);
107 
108  if (theTCCollection.failedToGet()){
109  edm::LogError("TrackProducerWithSCAssociation") <<"TrackProducerWithSCAssociation could not get the TrackCandidateCollection.";}
110  else{
111  //
112  //run the algorithm
113  //
114  // LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation run the algorithm" << "\n";
115  // theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
116  // theFitter.product(), thePropagator.product(), theBuilder.product(), algoResults);
117  // we have to copy this method from the algo in order to get the association track-seed
118  // this is ugly temporary code that should be replaced!!!!!
119  // start of copied code ======================================================
120 
121  // std::cout << "TrackProducerWithSCAssociation Number of TrackCandidates: " << theTCCollection->size() << "\n";
122  try{
123  int cont = 0;
124  int tcc=0;
125 
126  for (TrackCandidateCollection::const_iterator i=theTCCollection->begin(); i!=theTCCollection->end();i++)
127  {
128 
129  const TrackCandidate * theTC = &(*i);
131  const TrackCandidate::range& recHitVec=theTC->recHits();
132  const TrajectorySeed& seed = theTC->seed();
133 
134  //convert PTrajectoryStateOnDet to TrajectoryStateOnSurface
135 
136 
137  DetId detId(state.detId());
139  &(theG.product()->idToDet(detId)->surface()),
140  theMF.product());
141 
142  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation Initial TSOS\n" << theTSOS << "\n";
143 
144  //convert the TrackingRecHit vector to a TransientTrackingRecHit vector
145  //meanwhile computes the number of degrees of freedom
147 
148  float ndof=0;
149 
151  i!=recHitVec.second; i++){
152  hits.push_back(theBuilder.product()->build(&(*i) ));
153  }
154 
155 
156  //build Track
157  // LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation going to buildTrack"<< "\n";
158  bool ok = theAlgo.buildTrack(theFitter.product(),thePropagator.product(),algoResults, hits, theTSOS, seed, ndof, bs, theTC->seedRef());
159  // LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation buildTrack result: " << ok << "\n";
160  if(ok) {
161  cont++;
162  tccLocations.push_back(tcc);
163  }
164  tcc++;
165  }
166  edm::LogInfo("TrackProducerWithSCAssociation") << "Number of Tracks found: " << cont << "\n";
167  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation Number of Tracks found: " << cont << "\n";
168  // end of copied code ======================================================
169 
170  } catch (cms::Exception &e){ edm::LogInfo("TrackProducerWithSCAssociation") << "cms::Exception caught!!!" << "\n" << e << "\n";}
171  //
172  //put everything in the event
173  // we copy putInEvt to get OrphanHandle filled...
174  putInEvt(theEvent,thePropagator.product(),theMeasTk.product(),
175  outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults);
176 
177  // now construct associationmap and put it in the event
179  int itrack=0;
180  std::vector<edm::Ptr<reco::CaloCluster> > caloPtrVec;
181  for(AlgoProductCollection::iterator i=algoResults.begin(); i!=algoResults.end();i++){
182  edm::Ref<TrackCandidateCollection> trackCRef(theTCCollection,tccLocations[itrack]);
183  const edm::Ptr<reco::CaloCluster>& aClus = (*trkCandidateSCAssocHandle)[trackCRef];
184  caloPtrVec.push_back( aClus );
185  itrack++;
186  }
187 
188 
189  edm::ValueMap<reco::CaloClusterPtr>::Filler filler(*scTrkAssoc_p);
190  filler.insert(rTracks_, caloPtrVec.begin(), caloPtrVec.end());
191  filler.fill();
192  }
193 
194  theEvent.put(scTrkAssoc_p,trackSuperClusterAssociationCollection_ );
195 
196  }
197 
198 }
int i
Definition: DBlmapReader.cc:9
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
range recHits() const
edm::OrphanHandle< reco::TrackCollection > rTracks_
TrajectorySeed const & seed() const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
std::pair< const_iterator, const_iterator > range
std::vector< ConstRecHitPointer > RecHitContainer
bool buildTrack(const TrajectoryFitter *, const Propagator *, AlgoProductCollection &, TransientTrackingRecHit::RecHitContainer &, TrajectoryStateOnSurface &, const TrajectorySeed &, float, const reco::BeamSpot &, SeedRef seedRef=SeedRef(), int qualityMask=0, signed char nLoops=0)
Construct Tracks to be put in the event.
void putInEvt(edm::Event &evt, const Propagator *thePropagator, const MeasurementTracker *theMeasTk, std::auto_ptr< TrackingRecHitCollection > &selHits, std::auto_ptr< reco::TrackCollection > &selTracks, std::auto_ptr< reco::TrackExtraCollection > &selTrackExtras, std::auto_ptr< std::vector< Trajectory > > &selTrajectories, AlgoProductCollection &algoResults)
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
unsigned int detId() const
bool isValid() const
Definition: HandleBase.h:76
std::vector< AlgoProduct > AlgoProductCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
TrackProducerAlgorithm< reco::Track > theAlgo
bool failedToGet() const
Definition: HandleBase.h:80
Definition: DetId.h:20
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
int cont
char state
Definition: procUtils.cc:75
size_t size() const
Definition: ValueMap.h:152
edm::RefToBase< TrajectorySeed > seedRef() const
virtual void getFromES(const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
Get needed services from the Event Setup.
void TrackProducerWithSCAssociation::putInEvt ( edm::Event evt,
const Propagator thePropagator,
const MeasurementTracker theMeasTk,
std::auto_ptr< TrackingRecHitCollection > &  selHits,
std::auto_ptr< reco::TrackCollection > &  selTracks,
std::auto_ptr< reco::TrackExtraCollection > &  selTrackExtras,
std::auto_ptr< std::vector< Trajectory > > &  selTrajectories,
AlgoProductCollection algoResults 
)
private

Definition at line 251 of file TrackProducerWithSCAssociation.cc.

References reco::TrackExtraBase::add(), alongMomentum, TrajectoryStateOnSurface::curvilinearError(), Trajectory::direction(), Trajectory::firstMeasurement(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalParameters(), i, edm::ESHandleBase::isValid(), j, gen::k, Trajectory::lastMeasurement(), GlobalTrajectoryParameters::momentum(), myTrajectoryInEvent_, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::position(), edm::Event::put(), TrajectoryMeasurement::recHit(), Trajectory::recHits(), rTracks_, Trajectory::seedRef(), reco::Track::setExtra(), reco::TrackBase::setHitPattern(), TrackProducerBase< reco::Track >::setSecondHitPattern(), lumiQTWidget::t, TrackProducerBase< reco::Track >::theSchool, TrackProducerBase< reco::Track >::trajectoryInEvent_, TrajectoryMeasurement::updatedState(), v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

259 {
260 
263 
267  edm::Ref< std::vector<Trajectory> >::key_type iTjRef = 0;
268  std::map<unsigned int, unsigned int> tjTkMap;
269 
270  for(AlgoProductCollection::iterator i=algoResults.begin(); i!=algoResults.end();i++){
271  Trajectory * theTraj = (*i).first;
273  selTrajectories->push_back(*theTraj);
274  iTjRef++;
275  }
276  const TrajectoryFitter::RecHitContainer& transHits = theTraj->recHits();
277 
278  reco::Track * theTrack = (*i).second.first;
279  PropagationDirection seedDir = (*i).second.second;
280 
281  //LogDebug("TrackProducer") << "In KfTrackProducerBase::putInEvt - seedDir=" << seedDir;
282 
283  reco::Track t = * theTrack;
284  selTracks->push_back( t );
285  iTkRef++;
286 
287  // Store indices in local map (starts at 0)
288  if(trajectoryInEvent_) tjTkMap[iTjRef-1] = iTkRef-1;
289 
290  //sets the outermost and innermost TSOSs
291 
292  TrajectoryStateOnSurface outertsos;
293  TrajectoryStateOnSurface innertsos;
294  unsigned int innerId, outerId;
295 
296  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
297  // This is consistent with innermost and outermost labels only for tracks from LHC collision
298  if (theTraj->direction() == alongMomentum) {
299  outertsos = theTraj->lastMeasurement().updatedState();
300  innertsos = theTraj->firstMeasurement().updatedState();
301  outerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
302  innerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
303  } else {
304  outertsos = theTraj->firstMeasurement().updatedState();
305  innertsos = theTraj->lastMeasurement().updatedState();
306  outerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
307  innerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
308  }
309  // ---
310  //build the TrackExtra
311  GlobalPoint v = outertsos.globalParameters().position();
312  GlobalVector p = outertsos.globalParameters().momentum();
313  math::XYZVector outmom( p.x(), p.y(), p.z() );
314  math::XYZPoint outpos( v.x(), v.y(), v.z() );
315  v = innertsos.globalParameters().position();
316  p = innertsos.globalParameters().momentum();
317  math::XYZVector inmom( p.x(), p.y(), p.z() );
318  math::XYZPoint inpos( v.x(), v.y(), v.z() );
319 
320  reco::TrackExtraRef teref= reco::TrackExtraRef ( rTrackExtras, idx ++ );
321  reco::Track & track = selTracks->back();
322  track.setExtra( teref );
323 
324  //======= I want to set the second hitPattern here =============
325  if (theSchool.isValid())
326  {
327  NavigationSetter setter( *theSchool );
328  setSecondHitPattern(theTraj,track,thePropagator,theMeasTk);
329  }
330  //==============================================================
331 
332 
333  selTrackExtras->push_back( reco::TrackExtra (outpos, outmom, true, inpos, inmom, true,
334  outertsos.curvilinearError(), outerId,
335  innertsos.curvilinearError(), innerId,
336  seedDir,theTraj->seedRef()));
337 
338 
339  reco::TrackExtra & tx = selTrackExtras->back();
340  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
341  // This is consistent with innermost and outermost labels only for tracks from LHC collisions
342  size_t k = 0;
343  if (theTraj->direction() == alongMomentum) {
344  for( TrajectoryFitter::RecHitContainer::const_iterator j = transHits.begin();
345  j != transHits.end(); j ++ ) {
346  if ((**j).hit()!=0){
347  TrackingRecHit * hit = (**j).hit()->clone();
348  track.setHitPattern( * hit, k++ );
349  selHits->push_back( hit );
350  tx.add( TrackingRecHitRef( rHits, hidx ++ ) );
351  }
352  }
353  }else{
354  for( TrajectoryFitter::RecHitContainer::const_iterator j = transHits.end()-1;
355  j != transHits.begin()-1; --j ) {
356  if ((**j).hit()!=0){
357  TrackingRecHit * hit = (**j).hit()->clone();
358  track.setHitPattern( * hit, k++ );
359  selHits->push_back( hit );
360  tx.add( TrackingRecHitRef( rHits, hidx ++ ) );
361  }
362  }
363  }
364  // ----
365 
366  delete theTrack;
367  delete theTraj;
368  }
369 
370  //LogTrace("TrackingRegressionTest") << "========== TrackProducer Info ===================";
371  //LogDebug("TrackProducerWithSCAssociation") << "number of finalTracks: " << selTracks->size() << std::endl;
372  //for (reco::TrackCollection::const_iterator it = selTracks->begin(); it != selTracks->end(); it++) {
373  //LogDebug("TrackProducerWithSCAssociation") << "track's n valid and invalid hit, chi2, pt : "
374  // << it->found() << " , "
375  // << it->lost() <<" , "
376  // << it->normalizedChi2() << " , "
377  // << it->pt() << std::endl;
378  // }
379  //LogTrace("TrackingRegressionTest") << "=================================================";
380 
381 
382  rTracks_ = evt.put( selTracks );
383 
384 
385  evt.put( selTrackExtras );
386  evt.put( selHits );
387 
389  edm::OrphanHandle<std::vector<Trajectory> > rTrajs = evt.put(selTrajectories);
390 
391  // Now Create traj<->tracks association map
392  std::auto_ptr<TrajTrackAssociationCollection> trajTrackMap( new TrajTrackAssociationCollection() );
393  for ( std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin();
394  i != tjTkMap.end(); i++ ) {
395  edm::Ref<std::vector<Trajectory> > trajRef( rTrajs, (*i).first );
396  edm::Ref<reco::TrackCollection> tkRef( rTracks_, (*i).second );
397  trajTrackMap->insert( edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
398  edm::Ref<reco::TrackCollection>( rTracks_, (*i).second ) );
399  }
400  evt.put( trajTrackMap );
401  }
402 
403 
404 
405 
406 
407 
408 }
int i
Definition: DBlmapReader.cc:9
edm::OrphanHandle< reco::TrackCollection > rTracks_
void setSecondHitPattern(Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTracker *measTk)
const CurvilinearTrajectoryError & curvilinearError() const
T y() const
Definition: PV3DBase.h:62
ConstRecHitPointer recHit() const
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:13
PropagationDirection
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
T z() const
Definition: PV3DBase.h:63
int j
Definition: DBlmapReader.cc:9
TrajectoryStateOnSurface updatedState() const
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:296
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
RefProd< PROD > getRefBeforePut()
Definition: Event.h:97
int k[5][pyjets_maxn]
virtual TrackingRecHit * clone() const =0
void setHitPattern(const C &c)
set hit patterns from vector of hit references
Definition: TrackBase.h:246
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
void setExtra(const TrackExtraRef &ref)
set reference to &quot;extra&quot; object
Definition: Track.h:95
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
void add(const TrackingRecHitRef &r)
add a reference to a RecHit
edm::ESHandle< NavigationSchool > theSchool
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:170
bool isValid() const
Definition: ESHandle.h:37
T x() const
Definition: PV3DBase.h:61
Trajectory::RecHitContainer RecHitContainer
mathSSE::Vec4< T > v

Member Data Documentation

std::string TrackProducerWithSCAssociation::conversionTrackCandidateProducer_
private

Definition at line 33 of file TrackProducerWithSCAssociation.h.

Referenced by produce(), and TrackProducerWithSCAssociation().

std::string TrackProducerWithSCAssociation::myname_
private

Definition at line 31 of file TrackProducerWithSCAssociation.h.

Referenced by TrackProducerWithSCAssociation().

bool TrackProducerWithSCAssociation::myTrajectoryInEvent_
private

Definition at line 37 of file TrackProducerWithSCAssociation.h.

Referenced by putInEvt(), and TrackProducerWithSCAssociation().

edm::OrphanHandle<reco::TrackCollection> TrackProducerWithSCAssociation::rTracks_
private

Definition at line 36 of file TrackProducerWithSCAssociation.h.

Referenced by produce(), and putInEvt().

TrackProducerAlgorithm<reco::Track> TrackProducerWithSCAssociation::theAlgo
private

Definition at line 32 of file TrackProducerWithSCAssociation.h.

Referenced by getTransient(), and produce().

std::string TrackProducerWithSCAssociation::trackCSuperClusterAssociationCollection_
private

Definition at line 34 of file TrackProducerWithSCAssociation.h.

Referenced by produce(), and TrackProducerWithSCAssociation().

std::string TrackProducerWithSCAssociation::trackSuperClusterAssociationCollection_
private

Definition at line 35 of file TrackProducerWithSCAssociation.h.

Referenced by produce(), and TrackProducerWithSCAssociation().

bool TrackProducerWithSCAssociation::validTrackCandidateSCAssociationInput_
private

Definition at line 38 of file TrackProducerWithSCAssociation.h.

Referenced by produce().