CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 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_
 
const bool countStereoHitAs2D_
 
const double d0Max_
 
const double d0Min_
 
const double dzMax_
 
const double dzMin_
 
const double etaMax_
 
const double etaMin_
 
const edm::InputTag matchedrecHitsTag_
 
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_
 
const edm::InputTag rphirecHitsTag_
 
const bool seedOnlyFromAbove_
 
const int theCharge_
 
std::vector
< reco::TrackBase::TrackQuality
trkQualities_
 
std::vector
< reco::TrackBase::TrackAlgorithm
trkSteps_
 

Detailed Description

Definition at line 18 of file AlignmentTrackSelector.h.

Member Typedef Documentation

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

Definition at line 23 of file AlignmentTrackSelector.h.

Constructor & Destructor Documentation

AlignmentTrackSelector::AlignmentTrackSelector ( const edm::ParameterSet cfg)

constructor

Definition at line 35 of file AlignmentTrackSelector.cc.

References reco::TrackBase::algoByName(), applyBasicCuts_, applyIsolation_, applyIterStepCheck_, applyMultiplicityFilter_, applyNHighestPt_, applyPrescaledHitsFilter_, applyTrkQualityCheck_, chargeCheck_, chi2nMax_, clusterValueMapTag_, countStereoHitAs2D_, etaMax_, etaMin_, edm::hlt::Exception, edm::ParameterSet::getParameter(), i, 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_, AlCaHLTBitMon_QueryRunRegistry::string, trkQualities_, and trkSteps_.

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

destructor

Definition at line 228 of file AlignmentTrackSelector.cc.

229 {}

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 278 of file AlignmentTrackSelector.cc.

References applyIterStepCheck_, applyTrkQualityCheck_, reco::TrackBase::charge(), chi2nMax_, reco::TrackBase::d0(), d0Max_, d0Min_, detailedHitsCheck(), reco::TrackBase::dz(), dzMax_, dzMin_, eta(), reco::TrackBase::eta(), etaMax_, etaMin_, edm::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, query::result, theCharge_, and funct::true.

Referenced by select().

279 {
280  Tracks result;
281 
282  for (Tracks::const_iterator it=tracks.begin(); it != tracks.end(); ++it) {
283  const reco::Track* trackp=*it;
284  float pt=trackp->pt();
285  float p=trackp->p();
286  float eta=trackp->eta();
287  float phi=trackp->phi();
288  int nhit = trackp->numberOfValidHits();
289  int nlosthit = trackp->numberOfLostHits();
290  float chi2n = trackp->normalizedChi2();
291 
292  int q = trackp->charge();
293  bool isChargeOk = false;
294  if(theCharge_==-1 && q<0) isChargeOk = true;
295  else if (theCharge_==1 && q>0) isChargeOk = true;
296  else if (theCharge_==0) isChargeOk = true;
297 
298  float d0 = trackp->d0();
299  float dz = trackp->dz();
300 
301  // edm::LogDebug("AlignmentTrackSelector") << " pt,eta,phi,nhit: "
302  // <<pt<<","<<eta<<","<<phi<<","<<nhit;
303 
304  if (pt>ptMin_ && pt<ptMax_
305  && p>pMin_ && p<pMax_
306  && eta>etaMin_ && eta<etaMax_
307  && phi>phiMin_ && phi<phiMax_
308  && nhit>=nHitMin_ && nhit<=nHitMax_
309  && nlosthit<=nLostHitMax_
310  && chi2n<chi2nMax_
311  && isChargeOk
312  && d0>=d0Min_ && d0<=d0Max_
313  && dz>=dzMin_ && dz<=dzMax_) {
314  bool trkQualityOk=false ;
315  if (!applyTrkQualityCheck_ &&!applyIterStepCheck_)trkQualityOk=true ; // nothing required
316  else trkQualityOk = this->isOkTrkQuality(trackp);
317 
318  bool hitsCheckOk=this->detailedHitsCheck(trackp, evt, eSetup);
319 
320  if (trkQualityOk && hitsCheckOk ) result.push_back(trackp);
321  }
322  }
323 
324  return result;
325 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:663
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:645
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:609
std::vector< const reco::Track * > Tracks
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:693
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:874
T eta() const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:699
double pt() const
track transverse momentum
Definition: TrackBase.h:669
tuple result
Definition: query.py:137
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:868
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:657
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
tuple tracks
Definition: testEve_cfg.py:39
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:615
volatile std::atomic< bool > shutdown_flag false
Definition: DDAxes.h:10
AlignmentTrackSelector::Tracks AlignmentTrackSelector::checkPrescaledHits ( const Tracks tracks,
const edm::Event evt 
) const
private

Definition at line 682 of file AlignmentTrackSelector.cc.

References SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), clusterValueMapTag_, cond::rpcobgas::detid, archive::flag, TrackingRecHit::geographicalId(), edm::Event::getByLabel(), AlignmentClusterFlag::isTaken(), TrackingRecHit::isValid(), kBPIX, kFPIX, minPrescaledHits_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), query::result, and DetId::subdetId().

Referenced by select().

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

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

Definition at line 477 of file AlignmentTrackSelector.cc.

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

Referenced by detailedHitsCheck().

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

References TrackingRecHit::geographicalId(), edm::Event::getByLabel(), BaseTrackerRecHit::localPosition(), TrackingRecHit::localPosition(), mag(), matchedrecHitsTag_, minHitIsolation_, DetId::rawId(), and rphirecHitsTag_.

Referenced by detailedHitsCheck().

616 {
617  // FIXME:
618  // adapt to changes after introduction of SiStripRecHit1D...
619  //
620  // edm::ESHandle<TrackerGeometry> tracker;
623  // es.get<TrackerDigiGeometryRecord>().get(tracker);
624  evt.getByLabel( rphirecHitsTag_, rphirecHits );
625  evt.getByLabel( matchedrecHitsTag_, matchedrecHits );
626 
629  const SiStripRecHit2DCollection::DataContainer& stripcollSt = rphirecHits->data();
630  const SiStripMatchedRecHit2DCollection::DataContainer& stripcollStm = matchedrecHits->data();
631 
632  DetId idet = therechit->geographicalId();
633 
634  // FIXME: instead of looping the full hit collection, we should explore the features of
635  // SiStripRecHit2DCollection::rangeRphi = rphirecHits.get(idet) and loop
636  // only from rangeRphi.first until rangeRphi.second
637  for( istripSt=stripcollSt.begin(); istripSt!=stripcollSt.end(); ++istripSt ) {
638  const SiStripRecHit2D *aHit = &*(istripSt);
639  DetId mydet1 = aHit->geographicalId();
640  if (idet.rawId() != mydet1.rawId()) continue;
641  float theDistance = ( therechit->localPosition() - aHit->localPosition() ).mag();
642  // std::cout << "theDistance1 = " << theDistance << "\n";
643  if (theDistance > 0.001 && theDistance < minHitIsolation_) return false;
644  }
645 
646  // FIXME: see above
647  for( istripStm=stripcollStm.begin(); istripStm!=stripcollStm.end(); ++istripStm ) {
648  const SiStripMatchedRecHit2D *aHit = &*(istripStm);
649  DetId mydet2 = aHit->geographicalId();
650  if (idet.rawId() != mydet2.rawId()) continue;
651  float theDistance = (therechit->localPosition() - aHit->localPosition()).mag();
652  // std::cout << "theDistance1 = " << theDistance << "\n";
653  if (theDistance > 0.001 && theDistance < minHitIsolation_) return false;
654  }
655  return true;
656 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
std::vector< data_type > DataContainer
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const edm::InputTag matchedrecHitsTag_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
Definition: DetId.h:18
const edm::InputTag rphirecHitsTag_
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
virtual LocalPoint localPosition() 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 517 of file AlignmentTrackSelector.cc.

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

Referenced by detailedHitsCheck().

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

References SiStripRecHit1D::cluster(), and minHitChargeStrip_.

Referenced by isOkCharge().

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

Definition at line 583 of file AlignmentTrackSelector.cc.

References SiStripRecHit2D::cluster(), and minHitChargeStrip_.

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

Definition at line 754 of file AlignmentTrackSelector.cc.

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

Referenced by basicCuts().

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

select tracks

Definition at line 235 of file AlignmentTrackSelector.cc.

References applyBasicCuts_, applyMultiplicityFilter_, applyNHighestPt_, applyPrescaledHitsFilter_, basicCuts(), checkPrescaledHits(), maxMultiplicity_, minMultiplicity_, multiplicityOnInput_, query::result, theNHighestPtTracks(), and testEve_cfg::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().

236 {
237 
239  (tracks.size() < static_cast<unsigned int>(minMultiplicity_)
240  || tracks.size() > static_cast<unsigned int>(maxMultiplicity_))) {
241  return Tracks(); // empty collection
242  }
243 
244  Tracks result = tracks;
245  // apply basic track cuts (if selected)
246  if (applyBasicCuts_) result= this->basicCuts(result, evt, eSetup);
247 
248  // filter N tracks with highest Pt (if selected)
249  if (applyNHighestPt_) result = this->theNHighestPtTracks(result);
250 
251  // apply minimum multiplicity requirement (if selected)
253  if (result.size() < static_cast<unsigned int>(minMultiplicity_)
254  || result.size() > static_cast<unsigned int>(maxMultiplicity_) ) {
255 
256  result.clear();
257  }
258  }
259 
261  result = this->checkPrescaledHits(result, evt);
262  }
263 
264  return result;
265 }
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
tuple result
Definition: query.py:137
tuple tracks
Definition: testEve_cfg.py:39
AlignmentTrackSelector::Tracks AlignmentTrackSelector::theNHighestPtTracks ( const Tracks tracks) const
private

filter the n highest pt tracks

Definition at line 661 of file AlignmentTrackSelector.cc.

References gen::n, nHighestPt_, ptComparator, query::result, python.multivaluedict::sort(), and testEve_cfg::tracks.

Referenced by select().

662 {
663  Tracks sortedTracks=tracks;
664  Tracks result;
665 
666  // sort in pt
667  std::sort(sortedTracks.begin(),sortedTracks.end(),ptComparator);
668 
669  // copy theTrackMult highest pt tracks to result vector
670  int n=0;
671  for (Tracks::const_iterator it=sortedTracks.begin();
672  it!=sortedTracks.end(); ++it) {
673  if (n<nHighestPt_) { result.push_back(*it); n++; }
674  }
675 
676  return result;
677 }
std::vector< const reco::Track * > Tracks
tuple result
Definition: query.py:137
tuple tracks
Definition: testEve_cfg.py:39
bool AlignmentTrackSelector::useThisFilter ( )

Member Data Documentation

const bool AlignmentTrackSelector::applyBasicCuts_
private

Definition at line 65 of file AlignmentTrackSelector.h.

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

const bool AlignmentTrackSelector::applyIsolation_
private

Definition at line 66 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

bool AlignmentTrackSelector::applyIterStepCheck_
private

Definition at line 97 of file AlignmentTrackSelector.h.

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

const bool AlignmentTrackSelector::applyMultiplicityFilter_
private

Definition at line 65 of file AlignmentTrackSelector.h.

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

const bool AlignmentTrackSelector::applyNHighestPt_
private

Definition at line 65 of file AlignmentTrackSelector.h.

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

const bool AlignmentTrackSelector::applyPrescaledHitsFilter_
private

Definition at line 91 of file AlignmentTrackSelector.h.

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

bool AlignmentTrackSelector::applyTrkQualityCheck_
private

Definition at line 96 of file AlignmentTrackSelector.h.

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

const bool AlignmentTrackSelector::chargeCheck_
private

Definition at line 66 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const double AlignmentTrackSelector::chi2nMax_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const edm::InputTag AlignmentTrackSelector::clusterValueMapTag_
private

Definition at line 89 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and checkPrescaledHits().

const bool AlignmentTrackSelector::countStereoHitAs2D_
private

Definition at line 75 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isHit2D().

const double AlignmentTrackSelector::d0Max_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::d0Min_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::dzMax_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::dzMin_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

const double AlignmentTrackSelector::etaMax_
private

Definition at line 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::etaMin_
private

Definition at line 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const edm::InputTag AlignmentTrackSelector::matchedrecHitsTag_
private

Definition at line 74 of file AlignmentTrackSelector.h.

Referenced by isIsolated().

const double AlignmentTrackSelector::maxHitDiffEndcaps_
private

Definition at line 82 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::maxMultiplicity_
private

Definition at line 67 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and select().

const double AlignmentTrackSelector::minHitChargeStrip_
private

Definition at line 72 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isOkChargeStripHit().

const double AlignmentTrackSelector::minHitIsolation_
private

Definition at line 72 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isIsolated().

const int AlignmentTrackSelector::minHitsinBPIX_
private

Definition at line 78 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinENDCAP_
private

Definition at line 81 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinENDCAPminus_
private

Definition at line 81 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinENDCAPplus_
private

Definition at line 81 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinFPIX_
private

Definition at line 78 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinFPIXminus_
private

Definition at line 80 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinFPIXplus_
private

Definition at line 80 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinPIX_
private

Definition at line 78 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTEC_
private

Definition at line 77 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTECminus_
private

Definition at line 79 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTECplus_
private

Definition at line 79 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTIB_
private

Definition at line 77 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTID_
private

Definition at line 77 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTIDminus_
private

Definition at line 79 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTIDplus_
private

Definition at line 79 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minHitsinTOB_
private

Definition at line 77 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const int AlignmentTrackSelector::minMultiplicity_
private

Definition at line 67 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and select().

const int AlignmentTrackSelector::minPrescaledHits_
private

Definition at line 90 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and checkPrescaledHits().

const bool AlignmentTrackSelector::multiplicityOnInput_
private

Definition at line 68 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and select().

const int AlignmentTrackSelector::nHighestPt_
private

Definition at line 67 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and theNHighestPtTracks().

const double AlignmentTrackSelector::nHitMax_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const unsigned int AlignmentTrackSelector::nHitMin2D_
private

Definition at line 76 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const double AlignmentTrackSelector::nHitMin_
private

Definition at line 70 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::nLostHitMax_
private

Definition at line 83 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::phiMax_
private

Definition at line 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::phiMin_
private

Definition at line 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::pMax_
private

Definition at line 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

const double AlignmentTrackSelector::pMin_
private

Definition at line 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

ComparePt AlignmentTrackSelector::ptComparator
private

Definition at line 63 of file AlignmentTrackSelector.h.

Referenced by theNHighestPtTracks().

const double AlignmentTrackSelector::ptMax_
private

Definition at line 69 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 69 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and basicCuts().

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

Definition at line 85 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

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

Definition at line 84 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

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

Definition at line 87 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

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

Definition at line 86 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and detailedHitsCheck().

const edm::InputTag AlignmentTrackSelector::rphirecHitsTag_
private

Definition at line 73 of file AlignmentTrackSelector.h.

Referenced by isIsolated().

const bool AlignmentTrackSelector::seedOnlyFromAbove_
private

Definition at line 66 of file AlignmentTrackSelector.h.

Referenced by detailedHitsCheck().

const int AlignmentTrackSelector::theCharge_
private

Definition at line 71 of file AlignmentTrackSelector.h.

Referenced by basicCuts().

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

Definition at line 93 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isOkTrkQuality().

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

Definition at line 95 of file AlignmentTrackSelector.h.

Referenced by AlignmentTrackSelector(), and isOkTrkQuality().