CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlignmentTrackSelector Class Reference

#include <AlignmentTrackSelector.h>

Classes

struct  ComparePt
 compare two tracks in pt (used by theNHighestPtTracks) More...
 

Public Types

typedef std::vector< const reco::Track * > Tracks
 

Public Member Functions

 AlignmentTrackSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 constructor More...
 
Tracks select (const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
 select tracks More...
 
bool useThisFilter ()
 returns if any of the Filters is used. More...
 
 ~AlignmentTrackSelector ()
 destructor More...
 

Private Member Functions

Tracks basicCuts (const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
 apply basic cuts on pt,eta,phi,nhit More...
 
Tracks checkPrescaledHits (const Tracks &tracks, const edm::Event &evt) const
 
bool detailedHitsCheck (const reco::Track *track, const edm::Event &evt, const edm::EventSetup &eSetup) const
 checking hit requirements beyond simple number of valid hits More...
 
bool isHit2D (const TrackingRecHit &hit) const
 
bool isIsolated (const TrackingRecHit *therechit, const edm::Event &evt) const
 
bool isOkCharge (const TrackingRecHit *therechit) const
 if valid, check for minimum charge (currently only in strip), if invalid give true More...
 
bool isOkChargeStripHit (const SiStripRecHit1D &siStripRecHit1D) const
 
bool isOkChargeStripHit (const SiStripRecHit2D &siStripRecHit2D) const
 
bool isOkTrkQuality (const reco::Track *track) const
 
Tracks theNHighestPtTracks (const Tracks &tracks) const
 filter the n highest pt tracks More...
 

Private Attributes

const bool applyBasicCuts_
 
const bool applyIsolation_
 
bool applyIterStepCheck_
 
const bool applyMultiplicityFilter_
 
const bool applyNHighestPt_
 
const bool applyPrescaledHitsFilter_
 
bool applyTrkQualityCheck_
 
const bool chargeCheck_
 
const double chi2nMax_
 
const edm::InputTag clusterValueMapTag_
 
edm::EDGetTokenT< AliClusterValueMapclusterValueMapToken_
 
const bool countStereoHitAs2D_
 
const double d0Max_
 
const double d0Min_
 
const double dzMax_
 
const double dzMin_
 
const double etaMax_
 
const double etaMin_
 
edm::EDGetTokenT< SiStripMatchedRecHit2DCollectionmatchedrecHitsToken_
 
const double maxHitDiffEndcaps_
 
const int maxMultiplicity_
 
const double minHitChargeStrip_
 
const double minHitIsolation_
 
const int minHitsinBPIX_
 
const int minHitsinENDCAP_
 
const int minHitsinENDCAPminus_
 
const int minHitsinENDCAPplus_
 
const int minHitsinFPIX_
 
const int minHitsinFPIXminus_
 
const int minHitsinFPIXplus_
 
const int minHitsinPIX_
 
const int minHitsinTEC_
 
const int minHitsinTECminus_
 
const int minHitsinTECplus_
 
const int minHitsinTIB_
 
const int minHitsinTID_
 
const int minHitsinTIDminus_
 
const int minHitsinTIDplus_
 
const int minHitsinTOB_
 
const int minMultiplicity_
 
const int minPrescaledHits_
 
const bool multiplicityOnInput_
 
const int nHighestPt_
 
const double nHitMax_
 
const unsigned int nHitMin2D_
 
const double nHitMin_
 
const double nLostHitMax_
 
const double phiMax_
 
const double phiMin_
 
const double pMax_
 
const double pMin_
 
ComparePt ptComparator
 
const double ptMax_
 
const double ptMin_
 if true, cut min/maxMultiplicity on input instead of on final result More...
 
std::vector< double > RorZofFirstHitMax_
 
std::vector< double > RorZofFirstHitMin_
 
std::vector< double > RorZofLastHitMax_
 
std::vector< double > RorZofLastHitMin_
 
edm::EDGetTokenT< SiStripRecHit2DCollectionrphirecHitsToken_
 
const int seedOnlyFromAbove_
 
const int theCharge_
 
std::vector< reco::TrackBase::TrackQualitytrkQualities_
 
std::vector< reco::TrackBase::TrackAlgorithmtrkSteps_
 

Detailed Description

Definition at line 23 of file AlignmentTrackSelector.h.

Member Typedef Documentation

typedef std::vector<const reco::Track*> AlignmentTrackSelector::Tracks

Definition at line 28 of file AlignmentTrackSelector.h.

Constructor & Destructor Documentation

AlignmentTrackSelector::AlignmentTrackSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)

constructor

Definition at line 33 of file AlignmentTrackSelector.cc.

References reco::TrackBase::algoByName(), applyBasicCuts_, applyIsolation_, applyIterStepCheck_, applyMultiplicityFilter_, applyNHighestPt_, applyPrescaledHitsFilter_, applyTrkQualityCheck_, chargeCheck_, chi2nMax_, clusterValueMapTag_, clusterValueMapToken_, edm::ConsumesCollector::consumes(), countStereoHitAs2D_, etaMax_, etaMin_, Exception, edm::ParameterSet::getParameter(), mps_fire::i, matchedrecHitsToken_, maxHitDiffEndcaps_, maxMultiplicity_, minHitChargeStrip_, minHitIsolation_, minHitsinBPIX_, minHitsinENDCAP_, minHitsinENDCAPminus_, minHitsinENDCAPplus_, minHitsinFPIX_, minHitsinFPIXminus_, minHitsinFPIXplus_, minHitsinPIX_, minHitsinTEC_, minHitsinTECminus_, minHitsinTECplus_, minHitsinTIB_, minHitsinTID_, minHitsinTIDminus_, minHitsinTIDplus_, minHitsinTOB_, minMultiplicity_, minPrescaledHits_, multiplicityOnInput_, nHighestPt_, nHitMax_, nHitMin2D_, nHitMin_, nLostHitMax_, phiMax_, phiMin_, pMax_, pMin_, ptMax_, ptMin_, reco::TrackBase::qualityByName(), RorZofFirstHitMax_, RorZofFirstHitMin_, RorZofLastHitMax_, RorZofLastHitMin_, rphirecHitsToken_, AlCaHLTBitMon_QueryRunRegistry::string, trkQualities_, and trkSteps_.

33  :
34  applyBasicCuts_( cfg.getParameter<bool>( "applyBasicCuts" ) ),
35  applyNHighestPt_( cfg.getParameter<bool>( "applyNHighestPt" ) ),
36  applyMultiplicityFilter_( cfg.getParameter<bool>( "applyMultiplicityFilter" ) ),
37  seedOnlyFromAbove_( cfg.getParameter<int>( "seedOnlyFrom" ) ),
38  applyIsolation_( cfg.getParameter<bool>( "applyIsolationCut" ) ),
39  chargeCheck_( cfg.getParameter<bool>( "applyChargeCheck" ) ),
40  nHighestPt_( cfg.getParameter<int>( "nHighestPt" ) ),
41  minMultiplicity_ ( cfg.getParameter<int>( "minMultiplicity" ) ),
42  maxMultiplicity_ ( cfg.getParameter<int>( "maxMultiplicity" ) ),
43  multiplicityOnInput_ ( cfg.getParameter<bool>( "multiplicityOnInput" ) ),
44  ptMin_( cfg.getParameter<double>( "ptMin" ) ),
45  ptMax_( cfg.getParameter<double>( "ptMax" ) ),
46  pMin_( cfg.getParameter<double>( "pMin" ) ),
47  pMax_( cfg.getParameter<double>( "pMax" ) ),
48  etaMin_( cfg.getParameter<double>( "etaMin" ) ),
49  etaMax_( cfg.getParameter<double>( "etaMax" ) ),
50  phiMin_( cfg.getParameter<double>( "phiMin" ) ),
51  phiMax_( cfg.getParameter<double>( "phiMax" ) ),
52  nHitMin_( cfg.getParameter<double>( "nHitMin" ) ),
53  nHitMax_( cfg.getParameter<double>( "nHitMax" ) ),
54  chi2nMax_( cfg.getParameter<double>( "chi2nMax" ) ),
55  d0Min_( cfg.getParameter<double>( "d0Min" ) ),
56  d0Max_( cfg.getParameter<double>( "d0Max" ) ),
57  dzMin_( cfg.getParameter<double>( "dzMin" ) ),
58  dzMax_( cfg.getParameter<double>( "dzMax" ) ),
59  theCharge_( cfg.getParameter<int>( "theCharge" ) ),
60  minHitChargeStrip_( cfg.getParameter<double>( "minHitChargeStrip" ) ),
61  minHitIsolation_( cfg.getParameter<double>( "minHitIsolation" ) ),
62  countStereoHitAs2D_( cfg.getParameter<bool>( "countStereoHitAs2D" ) ),
63  nHitMin2D_( cfg.getParameter<unsigned int>( "nHitMin2D" ) ),
64  // Ugly to use the same getParameter n times, but this allows const cut variables...
65  minHitsinTIB_(cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTIB" ) ),
66  minHitsinTOB_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTOB" ) ),
67  minHitsinTID_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTID" ) ),
68  minHitsinTEC_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTEC" ) ),
69  minHitsinBPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inBPIX" ) ),
70  minHitsinFPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inFPIX" ) ),
71  minHitsinPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inPIXEL" ) ),
72  minHitsinTIDplus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTIDplus" ) ),
73  minHitsinTIDminus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTIDminus" ) ),
74  minHitsinTECplus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTECplus" ) ),
75  minHitsinTECminus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTECminus" ) ),
76  minHitsinFPIXplus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inFPIXplus" ) ),
77  minHitsinFPIXminus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inFPIXminus" ) ),
78  minHitsinENDCAP_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inENDCAP" ) ),
79  minHitsinENDCAPplus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inENDCAPplus" ) ),
80  minHitsinENDCAPminus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inENDCAPminus" ) ),
81  maxHitDiffEndcaps_( cfg.getParameter<double>( "maxHitDiffEndcaps" ) ),
82  nLostHitMax_( cfg.getParameter<double>( "nLostHitMax" ) ),
83  RorZofFirstHitMin_( cfg.getParameter<std::vector<double> >( "RorZofFirstHitMin" ) ),
84  RorZofFirstHitMax_( cfg.getParameter<std::vector<double> >( "RorZofFirstHitMax" ) ),
85  RorZofLastHitMin_( cfg.getParameter<std::vector<double> >( "RorZofLastHitMin" ) ),
86  RorZofLastHitMax_( cfg.getParameter<std::vector<double> >( "RorZofLastHitMax" ) ),
87  clusterValueMapTag_(cfg.getParameter<edm::InputTag>("hitPrescaleMapTag")),
88  minPrescaledHits_( cfg.getParameter<int>("minPrescaledHits")),
90 {
91  if(applyIsolation_) {
94  }
95 
98  }
99 
100  //convert track quality from string to enum
101  std::vector<std::string> trkQualityStrings(cfg.getParameter<std::vector<std::string> >("trackQualities"));
102  std::string qualities;
103  if(!trkQualityStrings.empty()){
105  for (unsigned int i = 0; i < trkQualityStrings.size(); ++i) {
106  (qualities += trkQualityStrings[i]) += ", ";
107  trkQualities_.push_back(reco::TrackBase::qualityByName(trkQualityStrings[i]));
108  }
109  }
110  else applyTrkQualityCheck_=false;
111 
112  std::vector<std::string> trkIterStrings(cfg.getParameter<std::vector<std::string> >("iterativeTrackingSteps"));
113  if(!trkIterStrings.empty()){
114  applyIterStepCheck_=true;
115  std::string tracksteps;
116  for (unsigned int i = 0; i < trkIterStrings.size(); ++i) {
117  (tracksteps += trkIterStrings[i]) += ", ";
118  trkSteps_.push_back(reco::TrackBase::algoByName(trkIterStrings[i]));
119  }
120  }
121  else applyIterStepCheck_=false;
122 
123  if (applyBasicCuts_){
124  edm::LogInfo("AlignmentTrackSelector")
125  << "applying basic track cuts ..."
126  << "\nptmin,ptmax: " << ptMin_ << "," << ptMax_
127  << "\npmin,pmax: " << pMin_ << "," << pMax_
128  << "\netamin,etamax: " << etaMin_ << "," << etaMax_
129  << "\nphimin,phimax: " << phiMin_ << "," << phiMax_
130  << "\nnhitmin,nhitmax: " << nHitMin_ << "," << nHitMax_
131  << "\nnlosthitmax: " << nLostHitMax_
132  << "\nnhitmin2D: " << nHitMin2D_
133  << (countStereoHitAs2D_ ? "," : ", not") << " counting hits on SiStrip stereo modules as 2D"
134  << "\nchi2nmax: " << chi2nMax_;
135 
136  if (applyIsolation_)
137  edm::LogInfo("AlignmentTrackSelector")
138  << "only retain tracks isolated at least by " << minHitIsolation_ <<
139  " cm from other rechits";
140 
141  if (chargeCheck_)
142  edm::LogInfo("AlignmentTrackSelector")
143  << "only retain hits with at least " << minHitChargeStrip_ <<
144  " ADC counts of total cluster charge";
145 
146  edm::LogInfo("AlignmentTrackSelector")
147  << "Minimum number of hits in TIB/TID/TOB/TEC/BPIX/FPIX/PIXEL = "
148  << minHitsinTIB_ << "/" << minHitsinTID_ << "/" << minHitsinTOB_
149  << "/" << minHitsinTEC_ << "/" << minHitsinBPIX_ << "/" << minHitsinFPIX_ << "/" << minHitsinPIX_;
150 
151  edm::LogInfo("AlignmentTrackSelector")
152  << "Minimum number of hits in TID+/TID-/TEC+/TEC-/FPIX+/FPIX- = "
154  << "/" << minHitsinTECplus_ << "/" << minHitsinTECminus_
155  << "/" << minHitsinFPIXplus_ << "/" << minHitsinFPIXminus_;
156 
157  edm::LogInfo("AlignmentTrackSelector")
158  << "Minimum number of hits in EndCap (TID+TEC)/EndCap+/EndCap- = "
160 
161  edm::LogInfo("AlignmentTrackSelector")
162  << "Max value of |nHitsinENDCAPplus - nHitsinENDCAPminus| = "
164 
165  if (!trkQualityStrings.empty()) {
166  edm::LogInfo("AlignmentTrackSelector")
167  << "Select tracks with these qualities: " << qualities;
168  }
169  }
170 
171  if (applyNHighestPt_)
172  edm::LogInfo("AlignmentTrackSelector")
173  << "filter N tracks with highest Pt N=" << nHighestPt_;
174 
176  edm::LogInfo("AlignmentTrackSelector")
177  << "apply multiplicity filter N>= " << minMultiplicity_ << "and N<= " << maxMultiplicity_
178  << " on " << (multiplicityOnInput_ ? "input" : "output");
179 
181  edm::LogInfo("AlignmentTrackSelector")
182  << "apply cut on number of prescaled hits N>= " << minPrescaledHits_
183  << " (prescale info from " << clusterValueMapTag_ << ")";
184 
185  }
186 
187  // Checking whether cuts on positions of first and last track hits are defined properly
188  if(RorZofFirstHitMin_.size() != 2){
189  throw cms::Exception("BadConfig") << "@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
190  << "Wrong configuration of 'RorZofFirstHitMin'."
191  << " Must have exactly 2 values instead of configured " << RorZofFirstHitMin_.size() << ")";
192  } else {
193  RorZofFirstHitMin_.at(0)=std::fabs(RorZofFirstHitMin_.at(0));
194  RorZofFirstHitMin_.at(1)=std::fabs(RorZofFirstHitMin_.at(1));
195  }
196  if(RorZofFirstHitMax_.size() != 2){
197  throw cms::Exception("BadConfig") << "@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
198  << "Wrong configuration of 'RorZofFirstHitMax'."
199  << " Must have exactly 2 values instead of configured " << RorZofFirstHitMax_.size() << ")";
200  } else {
201  RorZofFirstHitMax_.at(0) = std::fabs(RorZofFirstHitMax_.at(0));
202  RorZofFirstHitMax_.at(1) = std::fabs(RorZofFirstHitMax_.at(1));
203  }
204  if(RorZofLastHitMin_.size() != 2){
205  throw cms::Exception("BadConfig") << "@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
206  << "Wrong configuration of 'RorZofLastHitMin'."
207  << " Must have exactly 2 values instead of configured " << RorZofLastHitMin_.size() << ")";
208  } else {
209  RorZofLastHitMin_.at(0) = std::fabs(RorZofLastHitMin_.at(0));
210  RorZofLastHitMin_.at(1) = std::fabs(RorZofLastHitMin_.at(1));
211  }
212  if(RorZofLastHitMax_.size() != 2){
213  throw cms::Exception("BadConfig") << "@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
214  << "Wrong configuration of 'RorZofLastHitMax'."
215  << " Must have exactly 2 values instead of configured " << RorZofLastHitMax_.size() << ")";
216  } else {
217  RorZofLastHitMax_.at(0) = std::fabs(RorZofLastHitMax_.at(0));
218  RorZofLastHitMax_.at(1) = std::fabs(RorZofLastHitMax_.at(1));
219  }
220  // If first hit set to be at larger distance then the last hit
222  throw cms::Exception("BadConfig") << "@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
223  << "Position of the first hit is set to larger distance than the last hit:."
224  << " First hit(min): [" << RorZofFirstHitMin_.at(0) << ", " << RorZofFirstHitMin_.at(1) << "]; Last hit(max): ["
225  << RorZofLastHitMax_.at(0) << ", " << RorZofLastHitMax_.at(1) << "];";
226  }
227 
228 }
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< double > RorZofFirstHitMax_
std::vector< reco::TrackBase::TrackAlgorithm > trkSteps_
std::vector< reco::TrackBase::TrackQuality > trkQualities_
const unsigned int nHitMin2D_
std::string encode() const
Definition: InputTag.cc:166
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
std::vector< double > RorZofLastHitMin_
edm::EDGetTokenT< AliClusterValueMap > clusterValueMapToken_
std::vector< double > RorZofFirstHitMin_
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:134
const edm::InputTag clusterValueMapTag_
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:146
std::vector< double > RorZofLastHitMax_
AlignmentTrackSelector::~AlignmentTrackSelector ( )

destructor

Definition at line 232 of file AlignmentTrackSelector.cc.

233 {}

Member Function Documentation

AlignmentTrackSelector::Tracks AlignmentTrackSelector::basicCuts ( const Tracks tracks,
const edm::Event evt,
const edm::EventSetup eSetup 
) const
private

apply basic cuts on pt,eta,phi,nhit

Definition at line 282 of file AlignmentTrackSelector.cc.

References applyIterStepCheck_, applyTrkQualityCheck_, reco::TrackBase::charge(), chi2n, chi2nMax_, allConversions_cfi::d0, reco::TrackBase::d0(), d0Max_, d0Min_, detailedHitsCheck(), PVValHelper::dz, reco::TrackBase::dz(), dzMax_, dzMin_, PVValHelper::eta, reco::TrackBase::eta(), etaMax_, etaMin_, funct::false, isOkTrkQuality(), nHitMax_, nHitMin_, nLostHitMax_, reco::TrackBase::normalizedChi2(), reco::TrackBase::numberOfLostHits(), reco::TrackBase::numberOfValidHits(), AlCaHLTBitMon_ParallelJobs::p, reco::TrackBase::p(), phi, reco::TrackBase::phi(), phiMax_, phiMin_, pMax_, pMin_, EnergyCorrector::pt, reco::TrackBase::pt(), ptMax_, ptMin_, lumiQueryAPI::q, mps_fire::result, theCharge_, and funct::true.

Referenced by select().

283 {
284  Tracks result;
285 
286  for (Tracks::const_iterator it=tracks.begin(); it != tracks.end(); ++it) {
287  const reco::Track* trackp=*it;
288  float pt=trackp->pt();
289  float p=trackp->p();
290  float eta=trackp->eta();
291  float phi=trackp->phi();
292  int nhit = trackp->numberOfValidHits();
293  int nlosthit = trackp->numberOfLostHits();
294  float chi2n = trackp->normalizedChi2();
295 
296  int q = trackp->charge();
297  bool isChargeOk = false;
298  if(theCharge_==-1 && q<0) isChargeOk = true;
299  else if (theCharge_==1 && q>0) isChargeOk = true;
300  else if (theCharge_==0) isChargeOk = true;
301 
302  float d0 = trackp->d0();
303  float dz = trackp->dz();
304 
305  // edm::LogDebug("AlignmentTrackSelector") << " pt,eta,phi,nhit: "
306  // <<pt<<","<<eta<<","<<phi<<","<<nhit;
307 
308  if (pt>ptMin_ && pt<ptMax_
309  && p>pMin_ && p<pMax_
310  && eta>etaMin_ && eta<etaMax_
311  && phi>phiMin_ && phi<phiMax_
312  && nhit>=nHitMin_ && nhit<=nHitMax_
313  && nlosthit<=nLostHitMax_
314  && chi2n<chi2nMax_
315  && isChargeOk
316  && d0>=d0Min_ && d0<=d0Max_
317  && dz>=dzMin_ && dz<=dzMax_) {
318  bool trkQualityOk=false ;
319  if (!applyTrkQualityCheck_ &&!applyIterStepCheck_)trkQualityOk=true ; // nothing required
320  else trkQualityOk = this->isOkTrkQuality(trackp);
321 
322  bool hitsCheckOk=this->detailedHitsCheck(trackp, evt, eSetup);
323 
324  if (trkQualityOk && hitsCheckOk ) result.push_back(trackp);
325  }
326  }
327 
328  return result;
329 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:648
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:630
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:594
std::vector< const reco::Track * > Tracks
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:678
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:895
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:684
double pt() const
track transverse momentum
Definition: TrackBase.h:654
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:889
bool isOkTrkQuality(const reco::Track *track) const
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:642
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
bool detailedHitsCheck(const reco::Track *track, const edm::Event &evt, const edm::EventSetup &eSetup) const
checking hit requirements beyond simple number of valid hits
int charge() const
track electric charge
Definition: TrackBase.h:600
AlignmentTrackSelector::Tracks AlignmentTrackSelector::checkPrescaledHits ( const Tracks tracks,
const edm::Event evt 
) const
private

Definition at line 686 of file AlignmentTrackSelector.cc.

References SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), clusterValueMapToken_, RemoveAddSevLevel::flag, TrackingRecHit::geographicalId(), edm::Event::getByToken(), AlignmentClusterFlag::isTaken(), TrackingRecHit::isValid(), kBPIX, kFPIX, minPrescaledHits_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), mps_fire::result, and DetId::subdetId().

Referenced by select().

687 {
688  Tracks result;
689 
690  //take Cluster-Flag Assomap
692  evt.getByToken( clusterValueMapToken_, fMap);
693  const AliClusterValueMap &flagMap=*fMap;
694 
695  //for each track loop on hits and count the number of taken hits
696  for (Tracks::const_iterator ittrk=tracks.begin(); ittrk != tracks.end(); ++ittrk) {
697  const reco::Track* trackp=*ittrk;
698  int ntakenhits=0;
699  // float pt=trackp->pt();
700 
701  for (trackingRecHit_iterator ith = trackp->recHitsBegin(), edh = trackp->recHitsEnd(); ith != edh; ++ith) {
702  const TrackingRecHit *hit = (*ith); // ith is an iterator on edm::Ref to rechit
703  if(! hit->isValid())continue;
704  DetId detid = hit->geographicalId();
705  int subDet = detid.subdetId();
707 
708  bool isPixelHit=(subDet == kFPIX || subDet == kBPIX);
709 
710  if (!isPixelHit){
711  const std::type_info &type = typeid(*hit);
712 
713  if (type == typeid(SiStripRecHit2D)) {
714  const SiStripRecHit2D* striphit=dynamic_cast<const SiStripRecHit2D*>(hit);
715  if(striphit!=nullptr){
716  SiStripRecHit2D::ClusterRef stripclust(striphit->cluster());
717  flag = flagMap[stripclust];
718  }
719  }
720  else if(type == typeid(SiStripRecHit1D)){
721  const SiStripRecHit1D* striphit = dynamic_cast<const SiStripRecHit1D*>(hit);
722  if(striphit!=nullptr){
723  SiStripRecHit1D::ClusterRef stripclust(striphit->cluster());
724  flag = flagMap[stripclust];
725  }
726  }
727  else{
728  edm::LogError("AlignmentTrackSelector")<<"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Strip RecHit failed!"
729  <<" Skipping this hit.";
730  continue;
731  }
732 
733 
734 
735  }//end if hit in Strips
736  else{ // test explicitely BPIX/FPIX
737  const SiPixelRecHit* pixelhit= dynamic_cast<const SiPixelRecHit*>(hit);
738  if(pixelhit!=nullptr){
739  SiPixelRecHit::ClusterRef pixclust(pixelhit->cluster());
740  flag = flagMap[pixclust];
741  }
742  else{
743  edm::LogError("AlignmentTrackSelector")<<"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Pixel RecHit failed! ";
744  }
745  }//end else hit is in Pixel
746 
747  if(flag.isTaken())ntakenhits++;
748 
749  }//end loop on hits
750  if(ntakenhits >= minPrescaledHits_)result.push_back(trackp);
751  }//end loop on tracks
752 
753  return result;
754 }//end checkPrescaledHits
ClusterRef cluster() const
type
Definition: HCALResponse.h:21
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< const reco::Track * > Tracks
const int kFPIX
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
ClusterRef cluster() const
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:106
edm::EDGetTokenT< AliClusterValueMap > clusterValueMapToken_
Definition: DetId.h:18
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
bool isValid() const
DetId geographicalId() const
Our base class.
Definition: SiPixelRecHit.h:23
const int kBPIX
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:111
bool AlignmentTrackSelector::detailedHitsCheck ( const reco::Track track,
const edm::Event evt,
const edm::EventSetup eSetup 
) const
private

checking hit requirements beyond simple number of valid hits

Definition at line 333 of file AlignmentTrackSelector.cc.

References funct::abs(), applyIsolation_, chargeCheck_, edm::EventSetup::get(), reco::Track::innerPosition(), isHit2D(), isIsolated(), isOkCharge(), kBPIX, kFPIX, maxHitDiffEndcaps_, minHitsinBPIX_, minHitsinENDCAP_, minHitsinENDCAPminus_, minHitsinENDCAPplus_, minHitsinFPIX_, minHitsinFPIXminus_, minHitsinFPIXplus_, minHitsinPIX_, minHitsinTEC_, minHitsinTECminus_, minHitsinTECplus_, minHitsinTIB_, minHitsinTID_, minHitsinTIDminus_, minHitsinTIDplus_, minHitsinTOB_, nHitMin2D_, reco::Track::outerPosition(), edm::ESHandle< T >::product(), TrackerTopology::pxfSide(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), RorZofFirstHitMax_, RorZofFirstHitMin_, RorZofLastHitMax_, RorZofLastHitMin_, seedOnlyFromAbove_, DetId::subdetId(), SiStripDetId::TEC, TrackerTopology::tecIsZMinusSide(), TrackerTopology::tecIsZPlusSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidIsZMinusSide(), TrackerTopology::tidIsZPlusSide(), SiStripDetId::TOB, and DetId::Tracker.

Referenced by basicCuts().

334 {
335 
336  //Retrieve tracker topology from geometry
337  edm::ESHandle<TrackerTopology> tTopoHandle;
338  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
339  const TrackerTopology* const tTopo = tTopoHandle.product();
340 
341  // checking hit requirements beyond simple number of valid hits
342 
350  || !RorZofFirstHitMin_.empty() || !RorZofFirstHitMax_.empty() || !RorZofLastHitMin_.empty() || !RorZofLastHitMax_.empty() ) {
351  // any detailed hit cut is active, so have to check
352 
353  int nhitinTIB = 0, nhitinTOB = 0, nhitinTID = 0;
354  int nhitinTEC = 0, nhitinBPIX = 0, nhitinFPIX = 0, nhitinPIXEL=0;
355  int nhitinENDCAP = 0, nhitinENDCAPplus = 0, nhitinENDCAPminus = 0;
356  int nhitinTIDplus = 0, nhitinTIDminus = 0;
357  int nhitinFPIXplus = 0, nhitinFPIXminus = 0;
358  int nhitinTECplus = 0, nhitinTECminus = 0;
359  unsigned int nHit2D = 0;
360  unsigned int thishit = 0;
361 
362  for (trackingRecHit_iterator iHit = trackp->recHitsBegin(); iHit != trackp->recHitsEnd(); ++iHit) {
363  thishit++;
364  const DetId detId((*iHit)->geographicalId());
365  const int subdetId = detId.subdetId();
366 
367  // *** thishit == 1 means last hit in CTF ***
368  // (FIXME: assumption might change or not be valid for all tracking algorthms)
369  // ==> for cosmics
370  // seedOnlyFrom = 1 is TIB-TOB-TEC tracks only
371  // seedOnlyFrom = 2 is TOB-TEC tracks only
372  if (seedOnlyFromAbove_ == 1 && thishit == 1
373  && (subdetId == int(SiStripDetId::TOB) || subdetId == int(SiStripDetId::TEC))){
374  return false;
375  }
376  if (seedOnlyFromAbove_ == 2 && thishit == 1 && subdetId == int(SiStripDetId::TIB)) {
377  return false;
378  }
379 
380  if (!(*iHit)->isValid()) continue; // only real hits count as in trackp->numberOfValidHits()
381  if (detId.det() != DetId::Tracker) {
382  edm::LogError("DetectorMismatch") << "@SUB=AlignmentTrackSelector::detailedHitsCheck"
383  << "DetId.det() != DetId::Tracker (=" << DetId::Tracker
384  << "), but " << detId.det() << ".";
385  }
386  const TrackingRecHit* therechit = (*iHit);
387  if (chargeCheck_ && !(this->isOkCharge(therechit))) return false;
388  if (applyIsolation_ && (!this->isIsolated(therechit, evt))) return false;
389  if (SiStripDetId::TIB == subdetId) ++nhitinTIB;
390  else if (SiStripDetId::TOB == subdetId) ++nhitinTOB;
391  else if (SiStripDetId::TID == subdetId) {
392  ++nhitinTID;
393  ++nhitinENDCAP;
394 
395  if (tTopo->tidIsZMinusSide(detId)) {
396  ++nhitinTIDminus;
397  ++nhitinENDCAPminus;
398  }
399  else if (tTopo->tidIsZPlusSide(detId)) {
400  ++nhitinTIDplus;
401  ++nhitinENDCAPplus;
402  }
403  }
404  else if (SiStripDetId::TEC == subdetId) {
405  ++nhitinTEC;
406  ++nhitinENDCAP;
407 
408  if (tTopo->tecIsZMinusSide(detId)) {
409  ++nhitinTECminus;
410  ++nhitinENDCAPminus;
411  }
412  else if (tTopo->tecIsZPlusSide(detId)) {
413  ++nhitinTECplus;
414  ++nhitinENDCAPplus;
415  }
416  }
417  else if ( kBPIX == subdetId) {++nhitinBPIX;++nhitinPIXEL;}
418  else if ( kFPIX == subdetId) {
419  ++nhitinFPIX;
420  ++nhitinPIXEL;
421 
422  if (tTopo->pxfSide(detId)==1) ++nhitinFPIXminus;
423  else if (tTopo->pxfSide(detId)==2) ++nhitinFPIXplus;
424  }
425  // Do not call isHit2D(..) if already enough 2D hits for performance reason:
426  if (nHit2D < nHitMin2D_ && this->isHit2D(**iHit)) ++nHit2D;
427  } // end loop on hits
428 
429 
430  // Checking whether the track satisfies requirement of the first and last hit positions
431  bool passedLastHitPositionR = true;
432  bool passedLastHitPositionZ = true;
433  bool passedFirstHitPositionR = true;
434  bool passedFirstHitPositionZ = true;
435 
436  if( RorZofFirstHitMin_.at(0) != 0.0 || RorZofFirstHitMin_.at(1) != 0.0
437  || RorZofFirstHitMax_.at(0) != 999.0 || RorZofFirstHitMax_.at(1) != 999.0 ) {
438 
439  const reco::TrackBase::Point& firstPoint(trackp->innerPosition());
440 
441  if( (std::fabs(firstPoint.R()) < RorZofFirstHitMin_.at(0) )) passedFirstHitPositionR = false;
442  if( (std::fabs(firstPoint.R()) > RorZofFirstHitMax_.at(0) )) passedFirstHitPositionR = false;
443  if( (std::fabs(firstPoint.Z()) < RorZofFirstHitMin_.at(1) )) passedFirstHitPositionZ = false;
444  if( (std::fabs(firstPoint.Z()) > RorZofFirstHitMax_.at(1) )) passedFirstHitPositionZ = false;
445  }
446 
447  if( RorZofLastHitMin_.at(0) != 0.0 || RorZofLastHitMin_.at(1) != 0.0
448  || RorZofLastHitMax_.at(0) != 999.0 || RorZofLastHitMax_.at(1) != 999.0 ) {
449 
450  const reco::TrackBase::Point& lastPoint(trackp->outerPosition());
451 
452  if( (std::fabs(lastPoint.R()) < RorZofLastHitMin_.at(0) )) passedLastHitPositionR = false;
453  if( (std::fabs(lastPoint.R()) > RorZofLastHitMax_.at(0) )) passedLastHitPositionR = false;
454  if( (std::fabs(lastPoint.Z()) < RorZofLastHitMin_.at(1) )) passedLastHitPositionZ = false;
455  if( (std::fabs(lastPoint.Z()) > RorZofLastHitMax_.at(1) )) passedLastHitPositionZ = false;
456  }
457 
458  bool passedFirstHitPosition = passedFirstHitPositionR || passedFirstHitPositionZ;
459  bool passedLastHitPosition = passedLastHitPositionR || passedLastHitPositionZ;
460 
461 
462 
463  return (nhitinTIB >= minHitsinTIB_ && nhitinTOB >= minHitsinTOB_
464  && nhitinTID >= minHitsinTID_ && nhitinTEC >= minHitsinTEC_
465  && nhitinENDCAP >= minHitsinENDCAP_ && nhitinENDCAPplus >= minHitsinENDCAPplus_ && nhitinENDCAPminus >= minHitsinENDCAPminus_
466  && std::abs(nhitinENDCAPplus-nhitinENDCAPminus) <= maxHitDiffEndcaps_
467  && nhitinTIDplus >= minHitsinTIDplus_ && nhitinTIDminus >= minHitsinTIDminus_
468  && nhitinFPIXplus >= minHitsinFPIXplus_ && nhitinFPIXminus >= minHitsinFPIXminus_
469  && nhitinTECplus >= minHitsinTECplus_ && nhitinTECminus >= minHitsinTECminus_
470  && nhitinBPIX >= minHitsinBPIX_
471  && nhitinFPIX >= minHitsinFPIX_ && nhitinPIXEL>=minHitsinPIX_
472  && nHit2D >= nHitMin2D_ && passedFirstHitPosition && passedLastHitPosition);
473  } else { // no cuts set, so we are just fine and can avoid loop on hits
474  return true;
475  }
476 
477 }
std::vector< double > RorZofFirstHitMax_
bool isIsolated(const TrackingRecHit *therechit, const edm::Event &evt) const
const unsigned int nHitMin2D_
bool tecIsZMinusSide(const DetId &id) const
bool tidIsZMinusSide(const DetId &id) const
const int kFPIX
bool isHit2D(const TrackingRecHit &hit) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
std::vector< double > RorZofLastHitMin_
std::vector< double > RorZofFirstHitMin_
Definition: DetId.h:18
bool tidIsZPlusSide(const DetId &id) const
bool tecIsZPlusSide(const DetId &id) const
bool isOkCharge(const TrackingRecHit *therechit) const
if valid, check for minimum charge (currently only in strip), if invalid give true ...
T get() const
Definition: EventSetup.h:68
unsigned int pxfSide(const DetId &id) const
std::vector< double > RorZofLastHitMax_
T const * product() const
Definition: ESHandle.h:84
const int kBPIX
bool AlignmentTrackSelector::isHit2D ( const TrackingRecHit hit) const
private

Definition at line 481 of file AlignmentTrackSelector.cc.

References countStereoHitAs2D_, TrackingRecHit::dimension(), TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), kBPIX, kFPIX, ProjectedSiStripRecHit2D::originalHit(), SiStripDetId::stereo(), and DetId::Tracker.

Referenced by detailedHitsCheck().

482 {
483  // we count SiStrip stereo modules as 2D if selected via countStereoHitAs2D_
484  // (since they provide theta information)
485  if (!hit.isValid() ||
486  (hit.dimension() < 2 && !countStereoHitAs2D_ && !dynamic_cast<const SiStripRecHit1D*>(&hit))){
487  return false; // real RecHit1D - but SiStripRecHit1D depends on countStereoHitAs2D_
488  } else {
489  const DetId detId(hit.geographicalId());
490  if (detId.det() == DetId::Tracker) {
491  if (detId.subdetId() == kBPIX || detId.subdetId() == kFPIX) {
492  return true; // pixel is always 2D
493  } else { // should be SiStrip now
494  const SiStripDetId stripId(detId);
495  if (stripId.stereo()) return countStereoHitAs2D_; // stereo modules
496  else if (dynamic_cast<const SiStripRecHit1D*>(&hit)
497  || dynamic_cast<const SiStripRecHit2D*>(&hit)) return false; // rphi modules hit
498  //the following two are not used any more since ages...
499  else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit)) return true; // matched is 2D
500  else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
501  const ProjectedSiStripRecHit2D* pH = static_cast<const ProjectedSiStripRecHit2D*>(&hit);
502  return (countStereoHitAs2D_ && this->isHit2D(pH->originalHit())); // depends on original...
503  } else {
504  edm::LogError("UnkownType") << "@SUB=AlignmentTrackSelector::isHit2D"
505  << "Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
506  << "SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
507  return false;
508  }
509  }
510  } else { // not tracker??
511  edm::LogWarning("DetectorMismatch") << "@SUB=AlignmentTrackSelector::isHit2D"
512  << "Hit not in tracker with 'official' dimension >=2.";
513  return true; // dimension() >= 2 so accept that...
514  }
515  }
516  // never reached...
517 }
const int kFPIX
bool isHit2D(const TrackingRecHit &hit) const
virtual int dimension() const =0
SiStripRecHit2D originalHit() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
bool isValid() const
DetId geographicalId() const
const int kBPIX
bool AlignmentTrackSelector::isIsolated ( const TrackingRecHit therechit,
const edm::Event evt 
) const
private

Definition at line 619 of file AlignmentTrackSelector.cc.

References edmNew::DetSetVector< T >::data(), TrackingRecHit::geographicalId(), edm::Event::getByToken(), BaseTrackerRecHit::localPosition(), TrackingRecHit::localPosition(), mag(), AlignmentTrackSelector_cfi::matchedrecHits, matchedrecHitsToken_, minHitIsolation_, DetId::rawId(), AlignmentTrackSelector_cfi::rphirecHits, and rphirecHitsToken_.

Referenced by detailedHitsCheck().

620 {
621  // FIXME:
622  // adapt to changes after introduction of SiStripRecHit1D...
623  //
624  // edm::ESHandle<TrackerGeometry> tracker;
627  // es.get<TrackerDigiGeometryRecord>().get(tracker);
628  evt.getByToken( rphirecHitsToken_, rphirecHits );
629  evt.getByToken( matchedrecHitsToken_, matchedrecHits );
630 
633  const SiStripRecHit2DCollection::DataContainer& stripcollSt = rphirecHits->data();
634  const SiStripMatchedRecHit2DCollection::DataContainer& stripcollStm = matchedrecHits->data();
635 
636  DetId idet = therechit->geographicalId();
637 
638  // FIXME: instead of looping the full hit collection, we should explore the features of
639  // SiStripRecHit2DCollection::rangeRphi = rphirecHits.get(idet) and loop
640  // only from rangeRphi.first until rangeRphi.second
641  for( istripSt=stripcollSt.begin(); istripSt!=stripcollSt.end(); ++istripSt ) {
642  const SiStripRecHit2D *aHit = &*(istripSt);
643  DetId mydet1 = aHit->geographicalId();
644  if (idet.rawId() != mydet1.rawId()) continue;
645  float theDistance = ( therechit->localPosition() - aHit->localPosition() ).mag();
646  // std::cout << "theDistance1 = " << theDistance << "\n";
647  if (theDistance > 0.001 && theDistance < minHitIsolation_) return false;
648  }
649 
650  // FIXME: see above
651  for( istripStm=stripcollStm.begin(); istripStm!=stripcollStm.end(); ++istripStm ) {
652  const SiStripMatchedRecHit2D *aHit = &*(istripStm);
653  DetId mydet2 = aHit->geographicalId();
654  if (idet.rawId() != mydet2.rawId()) continue;
655  float theDistance = (therechit->localPosition() - aHit->localPosition()).mag();
656  // std::cout << "theDistance1 = " << theDistance << "\n";
657  if (theDistance > 0.001 && theDistance < minHitIsolation_) return false;
658  }
659  return true;
660 }
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
std::vector< data_type > DataContainer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
data_type const * data(size_t cell) const
virtual LocalPoint localPosition() const =0
Definition: DetId.h:18
LocalPoint localPosition() const final
DetId geographicalId() const
bool AlignmentTrackSelector::isOkCharge ( const TrackingRecHit therechit) const
private

if valid, check for minimum charge (currently only in strip), if invalid give true

Definition at line 521 of file AlignmentTrackSelector.cc.

References TrackingRecHit::geographicalId(), triggerObjects_cff::id, isOkChargeStripHit(), TrackingRecHit::isValid(), kBPIX, kFPIX, SiStripMatchedRecHit2D::monoHit(), ProjectedSiStripRecHit2D::originalHit(), SiStripMatchedRecHit2D::stereoHit(), and DetId::Tracker.

Referenced by detailedHitsCheck().

522 {
523  if (!hit || !hit->isValid()) return true;
524 
525  // check det and subdet
526  const DetId id(hit->geographicalId());
527  if (id.det() != DetId::Tracker) {
528  edm::LogWarning("DetectorMismatch") << "@SUB=isOkCharge" << "Hit not in tracker!";
529  return true;
530  }
531  if (id.subdetId() == kFPIX || id.subdetId() == kBPIX) {
532  return true; // might add some requirement...
533  }
534 
535  // We are in SiStrip now, so test normal hit:
536  const std::type_info &type = typeid(*hit);
537 
538 
539  if (type == typeid(SiStripRecHit2D)) {
540  const SiStripRecHit2D *stripHit2D = dynamic_cast<const SiStripRecHit2D*>(hit);
541  if (stripHit2D) {
542  return this->isOkChargeStripHit(*stripHit2D);
543  }
544  }
545  else if(type == typeid(SiStripRecHit1D)){
546  const SiStripRecHit1D *stripHit1D = dynamic_cast<const SiStripRecHit1D*>(hit);
547  if (stripHit1D) {
548  return this->isOkChargeStripHit(*stripHit1D);
549  }
550  }
551 
552  else if(type == typeid(SiStripMatchedRecHit2D)){ // or matched (should not occur anymore due to hit splitting since 20X)
553  const SiStripMatchedRecHit2D *matchedHit = dynamic_cast<const SiStripMatchedRecHit2D*>(hit);
554  if (matchedHit) {
555  return (this->isOkChargeStripHit(matchedHit->monoHit())
556  && this->isOkChargeStripHit(matchedHit->stereoHit()));
557  }
558  }
559  else if(type == typeid(ProjectedSiStripRecHit2D)){
560  // or projected (should not occur anymore due to hit splitting since 20X):
561  const ProjectedSiStripRecHit2D *projHit = dynamic_cast<const ProjectedSiStripRecHit2D*>(hit);
562  if (projHit) {
563  return this->isOkChargeStripHit(projHit->originalHit());
564  }
565  }
566  else{
567  edm::LogError("AlignmentTrackSelector")<< "@SUB=isOkCharge" <<"Unknown type of a valid tracker hit in Strips "
568  << " SubDet = "<<id.subdetId();
569  return false;
570  }
571 
572 
573 
574  // and now? SiTrackerMultiRecHit? Not here I guess!
575  // Should we throw instead?
576  edm::LogError("AlignmentTrackSelector")
577  << "@SUB=isOkCharge" << "Unknown valid tracker hit not in pixel, subdet " << id.subdetId()
578  << ", SiTrackerMultiRecHit " << dynamic_cast<const SiTrackerMultiRecHit*>(hit)
579  << ", BaseTrackerRecHit " << dynamic_cast<const BaseTrackerRecHit*>(hit);
580 
581  return true;
582 }
type
Definition: HCALResponse.h:21
bool isOkChargeStripHit(const SiStripRecHit1D &siStripRecHit1D) const
const int kFPIX
SiStripRecHit2D originalHit() const
Definition: DetId.h:18
SiStripRecHit2D stereoHit() const
SiStripRecHit2D monoHit() const
const int kBPIX
bool AlignmentTrackSelector::isOkChargeStripHit ( const SiStripRecHit1D siStripRecHit1D) const
private

Definition at line 603 of file AlignmentTrackSelector.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, SiStripRecHit1D::cluster(), and minHitChargeStrip_.

Referenced by isOkCharge().

604 {
605  double charge = 0.;
606 
607  SiStripRecHit1D::ClusterRef cluster(siStripRecHit1D.cluster());
608  const auto &amplitudes = cluster->amplitudes();
609 
610  for (size_t ia = 0; ia < amplitudes.size(); ++ia) {
611  charge += amplitudes[ia];
612  }
613 
614  return (charge >= minHitChargeStrip_);
615 }
ClusterRef cluster() const
bool AlignmentTrackSelector::isOkChargeStripHit ( const SiStripRecHit2D siStripRecHit2D) const
private

Definition at line 587 of file AlignmentTrackSelector.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, SiStripRecHit2D::cluster(), and minHitChargeStrip_.

588 {
589  double charge = 0.;
590 
591  SiStripRecHit2D::ClusterRef cluster(siStripRecHit2D.cluster());
592  const auto &amplitudes = cluster->amplitudes();
593 
594  for (size_t ia = 0; ia < amplitudes.size(); ++ia) {
595  charge += amplitudes[ia];
596  }
597 
598  return (charge >= minHitChargeStrip_);
599 }
ClusterRef cluster() const
bool AlignmentTrackSelector::isOkTrkQuality ( const reco::Track track) const
private

Definition at line 758 of file AlignmentTrackSelector.cc.

References reco::TrackBase::algo(), applyIterStepCheck_, applyTrkQualityCheck_, mps_fire::i, reco::TrackBase::quality(), trkQualities_, and trkSteps_.

Referenced by basicCuts().

759 {
760  bool qualityOk=false;
761  bool iterStepOk=false;
762 
763  //check iterative step
765  for (unsigned int i = 0; i < trkSteps_.size(); ++i) {
766  if (track->algo()==(trkSteps_[i])) {
767  iterStepOk=true;
768  }
769  }
770  }
771  else iterStepOk=true;
772 
773  //check track quality
775  for (unsigned int i = 0; i < trkQualities_.size(); ++i) {
776  if (track->quality(trkQualities_[i])) {
777  qualityOk=true;
778  }
779  }
780  }
781  else qualityOk=true;
782 
783  return qualityOk&&iterStepOk;
784 }//end check on track quality
std::vector< reco::TrackBase::TrackAlgorithm > trkSteps_
std::vector< reco::TrackBase::TrackQuality > trkQualities_
TrackAlgorithm algo() const
Definition: TrackBase.h:530
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:543
AlignmentTrackSelector::Tracks AlignmentTrackSelector::select ( const Tracks tracks,
const edm::Event evt,
const edm::EventSetup eSetup 
) const

select tracks

Definition at line 239 of file AlignmentTrackSelector.cc.

References applyBasicCuts_, applyMultiplicityFilter_, applyNHighestPt_, applyPrescaledHitsFilter_, basicCuts(), checkPrescaledHits(), maxMultiplicity_, minMultiplicity_, multiplicityOnInput_, mps_fire::result, theNHighestPtTracks(), and l1t::tracks.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.AbstractView.AbstractView::restoreSelection(), and TrackConfigSelector::select().

240 {
241 
243  (tracks.size() < static_cast<unsigned int>(minMultiplicity_)
244  || tracks.size() > static_cast<unsigned int>(maxMultiplicity_))) {
245  return Tracks(); // empty collection
246  }
247 
248  Tracks result = tracks;
249  // apply basic track cuts (if selected)
250  if (applyBasicCuts_) result= this->basicCuts(result, evt, eSetup);
251 
252  // filter N tracks with highest Pt (if selected)
253  if (applyNHighestPt_) result = this->theNHighestPtTracks(result);
254 
255  // apply minimum multiplicity requirement (if selected)
257  if (result.size() < static_cast<unsigned int>(minMultiplicity_)
258  || result.size() > static_cast<unsigned int>(maxMultiplicity_) ) {
259 
260  result.clear();
261  }
262  }
263 
265  result = this->checkPrescaledHits(result, evt);
266  }
267 
268  return result;
269 }
Tracks basicCuts(const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
apply basic cuts on pt,eta,phi,nhit
std::vector< const reco::Track * > Tracks
Tracks checkPrescaledHits(const Tracks &tracks, const edm::Event &evt) const
Tracks theNHighestPtTracks(const Tracks &tracks) const
filter the n highest pt tracks
AlignmentTrackSelector::Tracks AlignmentTrackSelector::theNHighestPtTracks ( const Tracks tracks) const
private

filter the n highest pt tracks

Definition at line 665 of file AlignmentTrackSelector.cc.

References gen::n, nHighestPt_, ptComparator, mps_fire::result, and l1t::tracks.

Referenced by select().

666 {
667  Tracks sortedTracks=tracks;
668  Tracks result;
669 
670  // sort in pt
671  std::sort(sortedTracks.begin(),sortedTracks.end(),ptComparator);
672 
673  // copy theTrackMult highest pt tracks to result vector
674  int n=0;
675  for (Tracks::const_iterator it=sortedTracks.begin();
676  it!=sortedTracks.end(); ++it) {
677  if (n<nHighestPt_) { result.push_back(*it); n++; }
678  }
679 
680  return result;
681 }
std::vector< const reco::Track * > Tracks
bool AlignmentTrackSelector::useThisFilter ( )

Member Data Documentation

const bool AlignmentTrackSelector::applyBasicCuts_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), select(), and useThisFilter().

const bool AlignmentTrackSelector::applyIsolation_
private

Definition at line 72 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

bool AlignmentTrackSelector::applyIterStepCheck_
private

Definition at line 104 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), basicCuts(), and isOkTrkQuality().

const bool AlignmentTrackSelector::applyMultiplicityFilter_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), select(), and useThisFilter().

const bool AlignmentTrackSelector::applyNHighestPt_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), select(), and useThisFilter().

const bool AlignmentTrackSelector::applyPrescaledHitsFilter_
private

Definition at line 98 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), select(), and useThisFilter().

bool AlignmentTrackSelector::applyTrkQualityCheck_
private

Definition at line 103 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), basicCuts(), and isOkTrkQuality().

const bool AlignmentTrackSelector::chargeCheck_
private

Definition at line 72 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const double AlignmentTrackSelector::chi2nMax_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const edm::InputTag AlignmentTrackSelector::clusterValueMapTag_
private

Definition at line 95 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector().

edm::EDGetTokenT<AliClusterValueMap> AlignmentTrackSelector::clusterValueMapToken_
private

Definition at line 96 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and checkPrescaledHits().

const bool AlignmentTrackSelector::countStereoHitAs2D_
private

Definition at line 81 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isHit2D().

const double AlignmentTrackSelector::d0Max_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::d0Min_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::dzMax_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::dzMin_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::etaMax_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::etaMin_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> AlignmentTrackSelector::matchedrecHitsToken_
private

Definition at line 80 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isIsolated().

const double AlignmentTrackSelector::maxHitDiffEndcaps_
private

Definition at line 88 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::maxMultiplicity_
private

Definition at line 73 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and select().

const double AlignmentTrackSelector::minHitChargeStrip_
private

Definition at line 78 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isOkChargeStripHit().

const double AlignmentTrackSelector::minHitIsolation_
private

Definition at line 78 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isIsolated().

const int AlignmentTrackSelector::minHitsinBPIX_
private

Definition at line 84 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinENDCAP_
private

Definition at line 87 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinENDCAPminus_
private

Definition at line 87 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinENDCAPplus_
private

Definition at line 87 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinFPIX_
private

Definition at line 84 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinFPIXminus_
private

Definition at line 86 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinFPIXplus_
private

Definition at line 86 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinPIX_
private

Definition at line 84 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTEC_
private

Definition at line 83 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTECminus_
private

Definition at line 85 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTECplus_
private

Definition at line 85 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTIB_
private

Definition at line 83 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTID_
private

Definition at line 83 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTIDminus_
private

Definition at line 85 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTIDplus_
private

Definition at line 85 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTOB_
private

Definition at line 83 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minMultiplicity_
private

Definition at line 73 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and select().

const int AlignmentTrackSelector::minPrescaledHits_
private

Definition at line 97 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and checkPrescaledHits().

const bool AlignmentTrackSelector::multiplicityOnInput_
private

Definition at line 74 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and select().

const int AlignmentTrackSelector::nHighestPt_
private

Definition at line 73 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and theNHighestPtTracks().

const double AlignmentTrackSelector::nHitMax_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const unsigned int AlignmentTrackSelector::nHitMin2D_
private

Definition at line 82 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const double AlignmentTrackSelector::nHitMin_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::nLostHitMax_
private

Definition at line 89 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::phiMax_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::phiMin_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::pMax_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::pMin_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

ComparePt AlignmentTrackSelector::ptComparator
private

Definition at line 68 of file AlignmentTrackSelector.h.

Referenced by theNHighestPtTracks().

const double AlignmentTrackSelector::ptMax_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::ptMin_
private

if true, cut min/maxMultiplicity on input instead of on final result

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

std::vector<double> AlignmentTrackSelector::RorZofFirstHitMax_
private

Definition at line 91 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

std::vector<double> AlignmentTrackSelector::RorZofFirstHitMin_
private

Definition at line 90 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

std::vector<double> AlignmentTrackSelector::RorZofLastHitMax_
private

Definition at line 93 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

std::vector<double> AlignmentTrackSelector::RorZofLastHitMin_
private

Definition at line 92 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

edm::EDGetTokenT<SiStripRecHit2DCollection> AlignmentTrackSelector::rphirecHitsToken_
private

Definition at line 79 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isIsolated().

const int AlignmentTrackSelector::seedOnlyFromAbove_
private

Definition at line 71 of file AlignmentTrackSelector.h.

Referenced by detailedHitsCheck().

const int AlignmentTrackSelector::theCharge_
private

Definition at line 77 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

std::vector<reco::TrackBase::TrackQuality> AlignmentTrackSelector::trkQualities_
private

Definition at line 100 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isOkTrkQuality().

std::vector<reco::TrackBase::TrackAlgorithm> AlignmentTrackSelector::trkSteps_
private

Definition at line 102 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isOkTrkQuality().