CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackAssociatorByChi2.h
Go to the documentation of this file.
1 #ifndef TrackAssociatorByChi2_h
2 #define TrackAssociatorByChi2_h
3 
26 
27 #include<map>
28 
29 //Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
30 //the track with the lowest association chi2 will be the first in the output map.
31 
32 namespace reco{
39 }
40 
41 
43 
44  public:
45  typedef std::map<double, SimTrack> Chi2SimMap;
46  typedef std::pair< reco::Track, Chi2SimMap> RecoToSimPair;
47  typedef std::vector< RecoToSimPair > RecoToSimPairAssociation;
48 
51  chi2cut(conf.getParameter<double>("chi2cut")),
52  onlyDiagonal(conf.getParameter<bool>("onlyDiagonal")),
53  bsSrc(conf.getParameter<edm::InputTag>("beamSpot")) {
54  theMF=mF;
55  if (onlyDiagonal)
56  edm::LogInfo("TrackAssociator") << " ---- Using Off Diagonal Covariance Terms = 0 ---- " << "\n";
57  else
58  edm::LogInfo("TrackAssociator") << " ---- Using Off Diagonal Covariance Terms != 0 ---- " << "\n";
59  }
60 
62  TrackAssociatorByChi2(const edm::ESHandle<MagneticField> mF, double chi2Cut, bool onlyDiag, edm::InputTag beamspotSrc){
63  chi2cut=chi2Cut;
64  onlyDiagonal=onlyDiag;
65  theMF=mF;
66  bsSrc = beamspotSrc;
67  }
68 
71 
73  double compareTracksParam(reco::TrackCollection::const_iterator,
74  edm::SimTrackContainer::const_iterator,
78  const reco::BeamSpot&) const;
79 
82  const edm::SimTrackContainer&,
84  const reco::BeamSpot&) const;
85 
87  double getChi2(reco::TrackBase::ParameterVector& rParameters,
88  reco::TrackBase::CovarianceMatrix& recoTrackCovMatrix,
89  Basic3DVector<double>& momAtVtx,
91  int& charge,
92  const reco::BeamSpot&) const;
93 
95  double associateRecoToSim(reco::TrackCollection::const_iterator,
96  TrackingParticleCollection::const_iterator,
97  const reco::BeamSpot&) const;
98 
100  std::pair<bool,reco::TrackBase::ParameterVector> parametersAtClosestApproach(Basic3DVector<double>,// vertex
101  Basic3DVector<double>,// momAtVtx
102  float,// charge
103  const reco::BeamSpot&) const;//beam spot
107  const edm::Event * event = 0,
108  const edm::EventSetup * setup = 0 ) const ;
112  const edm::Event * event = 0,
113  const edm::EventSetup * setup = 0 ) const ;
114 
118  const edm::Event * event = 0,
119  const edm::EventSetup * setup = 0) const {
121  }
122 
126  const edm::Event * event = 0,
127  const edm::EventSetup * setup = 0) const {
129  }
130 
134  const edm::Event * event = 0,
135  const edm::EventSetup * setup = 0 ) const ;
139  const edm::Event * event = 0,
140  const edm::EventSetup * setup = 0 ) const ;
141 
145  const edm::Event * event = 0,
146  const edm::EventSetup * setup = 0) const {
148  for (unsigned int j=0; j<tCH->size();j++)
150 
152  for (unsigned int j=0; j<tPCH->size();j++)
154 
155  return associateRecoToGen(tc,tpc,event,setup);
156  }
157 
161  const edm::Event * event = 0,
162  const edm::EventSetup * setup = 0) const {
164  for (unsigned int j=0; j<tCH->size();j++)
166 
168  for (unsigned int j=0; j<tPCH->size();j++)
170 
171  return associateGenToReco(tc,tpc,event,setup);
172  }
173 
174 
175  private:
177  double chi2cut;
180 };
181 
182 #endif
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:15
ProductID id() const
Definition: HandleBase.cc:15
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
virtual reco::RecoToGenCollection associateRecoToGen(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< reco::GenParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and GenParticle collections
std::pair< bool, reco::TrackBase::ParameterVector > parametersAtClosestApproach(Basic3DVector< double >, Basic3DVector< double >, float, const reco::BeamSpot &) const
propagate the track parameters of TrackinParticle from production vertex to the point of closest appr...
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:70
double charge(const std::vector< uint8_t > &Ampls)
double compareTracksParam(reco::TrackCollection::const_iterator, edm::SimTrackContainer::const_iterator, const math::XYZTLorentzVectorD, GlobalVector, reco::TrackBase::CovarianceMatrix, const reco::BeamSpot &) const
compare reco::TrackCollection and edm::SimTrackContainer iterators: returns the chi2 ...
~TrackAssociatorByChi2()
Destructor.
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::GenParticleCollection, edm::View< reco::Track >, double > > GenToRecoCollection
TrackAssociatorByChi2(const edm::ESHandle< MagneticField > mF, edm::ParameterSet conf)
Constructor with PSet.
int j
Definition: DBlmapReader.cc:9
reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double getChi2(reco::TrackBase::ParameterVector &rParameters, reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, Basic3DVector< double > &momAtVtx, Basic3DVector< double > &vert, int &charge, const reco::BeamSpot &) const
basic method where chi2 is computed
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
double associateRecoToSim(reco::TrackCollection::const_iterator, TrackingParticleCollection::const_iterator, const reco::BeamSpot &) const
compare reco::TrackCollection and TrackingParticleCollection iterators: returns the chi2 ...
edm::ESHandle< MagneticField > theMF
tuple conf
Definition: dbtoconf.py:185
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
virtual reco::GenToRecoCollection associateGenToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< reco::GenParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and GenParticle collections
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections (Gen Particle version)
std::vector< SimVertex > SimVertexContainer
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections (Gen Particle version)
reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::map< double, SimTrack > Chi2SimMap
std::vector< RecoToSimPair > RecoToSimPairAssociation
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
TrackAssociatorByChi2(const edm::ESHandle< MagneticField > mF, double chi2Cut, bool onlyDiag, edm::InputTag beamspotSrc)
Constructor with magnetic field, double, bool and InputTag.
std::vector< SimTrack > SimTrackContainer
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, reco::GenParticleCollection, double > > RecoToGenCollection
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:72