33 applyBasicCuts_( cfg.getParameter<bool>(
"applyBasicCuts" ) ),
34 applyNHighestPt_( cfg.getParameter<bool>(
"applyNHighestPt" ) ),
35 applyMultiplicityFilter_( cfg.getParameter<bool>(
"applyMultiplicityFilter" ) ),
36 seedOnlyFromAbove_( cfg.getParameter<int>(
"seedOnlyFrom" ) ),
37 applyIsolation_( cfg.getParameter<bool>(
"applyIsolationCut" ) ),
38 chargeCheck_( cfg.getParameter<bool>(
"applyChargeCheck" ) ),
39 nHighestPt_( cfg.getParameter<int>(
"nHighestPt" ) ),
40 minMultiplicity_ ( cfg.getParameter<int>(
"minMultiplicity" ) ),
41 maxMultiplicity_ ( cfg.getParameter<int>(
"maxMultiplicity" ) ),
42 multiplicityOnInput_ ( cfg.getParameter<bool>(
"multiplicityOnInput" ) ),
43 ptMin_( cfg.getParameter<double>(
"ptMin" ) ),
44 ptMax_( cfg.getParameter<double>(
"ptMax" ) ),
45 pMin_( cfg.getParameter<double>(
"pMin" ) ),
46 pMax_( cfg.getParameter<double>(
"pMax" ) ),
47 etaMin_( cfg.getParameter<double>(
"etaMin" ) ),
48 etaMax_( cfg.getParameter<double>(
"etaMax" ) ),
49 phiMin_( cfg.getParameter<double>(
"phiMin" ) ),
50 phiMax_( cfg.getParameter<double>(
"phiMax" ) ),
51 nHitMin_( cfg.getParameter<double>(
"nHitMin" ) ),
52 nHitMax_( cfg.getParameter<double>(
"nHitMax" ) ),
53 chi2nMax_( cfg.getParameter<double>(
"chi2nMax" ) ),
54 d0Min_( cfg.getParameter<double>(
"d0Min" ) ),
55 d0Max_( cfg.getParameter<double>(
"d0Max" ) ),
56 dzMin_( cfg.getParameter<double>(
"dzMin" ) ),
57 dzMax_( cfg.getParameter<double>(
"dzMax" ) ),
58 theCharge_( cfg.getParameter<int>(
"theCharge" ) ),
59 minHitChargeStrip_( cfg.getParameter<double>(
"minHitChargeStrip" ) ),
60 minHitIsolation_( cfg.getParameter<double>(
"minHitIsolation" ) ),
61 rphirecHitsTag_( cfg.getParameter<edm::InputTag>(
"rphirecHits") ),
62 matchedrecHitsTag_( cfg.getParameter<edm::InputTag>(
"matchedrecHits") ),
63 countStereoHitAs2D_( cfg.getParameter<bool>(
"countStereoHitAs2D" ) ),
64 nHitMin2D_( cfg.getParameter<unsigned int>(
"nHitMin2D" ) ),
66 minHitsinTIB_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTIB" ) ),
67 minHitsinTOB_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTOB" ) ),
68 minHitsinTID_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTID" ) ),
69 minHitsinTEC_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTEC" ) ),
70 minHitsinBPIX_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inBPIX" ) ),
71 minHitsinFPIX_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inFPIX" ) ),
72 minHitsinPIX_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inPIXEL" ) ),
73 minHitsinTIDplus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTIDplus" ) ),
74 minHitsinTIDminus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTIDminus" ) ),
75 minHitsinTECplus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTECplus" ) ),
76 minHitsinTECminus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inTECminus" ) ),
77 minHitsinFPIXplus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inFPIXplus" ) ),
78 minHitsinFPIXminus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inFPIXminus" ) ),
79 minHitsinENDCAP_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inENDCAP" ) ),
80 minHitsinENDCAPplus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inENDCAPplus" ) ),
81 minHitsinENDCAPminus_ (cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet" ).getParameter<int>(
"inENDCAPminus" ) ),
82 maxHitDiffEndcaps_( cfg.getParameter<double>(
"maxHitDiffEndcaps" ) ),
83 nLostHitMax_( cfg.getParameter<double>(
"nLostHitMax" ) ),
84 clusterValueMapTag_(cfg.getParameter<edm::InputTag>(
"hitPrescaleMapTag")),
85 minPrescaledHits_( cfg.getParameter<int>(
"minPrescaledHits")),
86 applyPrescaledHitsFilter_(clusterValueMapTag_.
encode().
size() && minPrescaledHits_ > 0)
90 std::vector<std::string> trkQualityStrings(cfg.
getParameter<std::vector<std::string> >(
"trackQualities"));
92 if(trkQualityStrings.size()>0){
94 for (
unsigned int i = 0;
i < trkQualityStrings.size(); ++
i) {
95 (qualities += trkQualityStrings[
i]) +=
", ";
101 std::vector<std::string> trkIterStrings(cfg.
getParameter<std::vector<std::string> >(
"iterativeTrackingSteps"));
102 if(trkIterStrings.size()>0){
105 for (
unsigned int i = 0;
i < trkIterStrings.size(); ++
i) {
106 (tracksteps += trkIterStrings[
i]) +=
", ";
114 <<
"applying basic track cuts ..."
122 << (
countStereoHitAs2D_ ?
"," :
", not") <<
" counting hits on SiStrip stereo modules as 2D"
128 " cm from other rechits";
133 " ADC counts of total cluster charge";
136 <<
"Minimum number of hits in TIB/TID/TOB/TEC/BPIX/FPIX/PIXEL = "
141 <<
"Minimum number of hits in TID+/TID-/TEC+/TEC-/FPIX+/FPIX- = "
147 <<
"Minimum number of hits in EndCap (TID+TEC)/EndCap+/EndCap- = "
151 <<
"Max value of |nHitsinENDCAPplus - nHitsinENDCAPminus| = "
154 if (trkQualityStrings.size()) {
156 <<
"Select tracks with these qualities: " << qualities;
162 <<
"filter N tracks with highest Pt N=" <<
nHighestPt_;
234 for (Tracks::const_iterator it=tracks.begin(); it != tracks.end(); ++it) {
236 float pt=trackp->
pt();
245 bool isChargeOk =
false;
247 else if (
theCharge_==1 && q>0) isChargeOk =
true;
250 float d0 = trackp->
d0();
251 float dz = trackp->
dz();
266 bool trkQualityOk=
false ;
272 if (trkQualityOk && hitsCheckOk ) result.push_back(trackp);
300 int nhitinTIB = 0, nhitinTOB = 0, nhitinTID = 0;
301 int nhitinTEC = 0, nhitinBPIX = 0, nhitinFPIX = 0, nhitinPIXEL=0;
302 int nhitinENDCAP = 0, nhitinENDCAPplus = 0, nhitinENDCAPminus = 0;
303 int nhitinTIDplus = 0, nhitinTIDminus = 0;
304 int nhitinFPIXplus = 0, nhitinFPIXminus = 0;
305 int nhitinTECplus = 0, nhitinTECminus = 0;
306 unsigned int nHit2D = 0;
307 unsigned int thishit = 0;
311 const DetId detId((*iHit)->geographicalId());
312 const int subdetId = detId.
subdetId();
327 if (!(*iHit)->isValid())
continue;
329 edm::LogError(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::detailedHitsCheck"
331 <<
"), but " << detId.det() <<
".";
364 else if (
kBPIX == subdetId) {++nhitinBPIX;++nhitinPIXEL;}
365 else if (
kFPIX == subdetId) {
369 if (tTopo->
pxfSide(detId)==1) ++nhitinFPIXminus;
370 else if (tTopo->
pxfSide(detId)==2) ++nhitinFPIXplus;
373 if (nHit2D < nHitMin2D_ && this->
isHit2D(**iHit)) ++nHit2D;
404 if (detId.subdetId() ==
kBPIX || detId.subdetId() ==
kFPIX) {
409 else if (dynamic_cast<const SiStripRecHit1D*>(&hit)
410 ||
dynamic_cast<const SiStripRecHit2D*
>(&hit))
return false;
412 else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit))
return true;
413 else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
417 edm::LogError(
"UnkownType") <<
"@SUB=AlignmentTrackSelector::isHit2D"
418 <<
"Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
419 <<
"SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
424 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::isHit2D"
425 <<
"Hit not in tracker with 'official' dimension >=2.";
436 if (!hit || !hit->
isValid())
return true;
441 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=isOkCharge" <<
"Hit not in tracker!";
444 if (
id.subdetId() ==
kFPIX ||
id.subdetId() ==
kBPIX) {
449 const std::type_info &
type =
typeid(*hit);
452 if (type ==
typeid(SiStripRecHit2D)) {
453 const SiStripRecHit2D *stripHit2D =
dynamic_cast<const SiStripRecHit2D*
>(hit);
458 else if(type ==
typeid(SiStripRecHit1D)){
459 const SiStripRecHit1D *stripHit1D =
dynamic_cast<const SiStripRecHit1D*
>(hit);
465 else if(type ==
typeid(SiStripMatchedRecHit2D)){
466 const SiStripMatchedRecHit2D *matchedHit =
dynamic_cast<const SiStripMatchedRecHit2D*
>(hit);
480 edm::LogError(
"AlignmentTrackSelector")<<
"@SUB=isOkCharge" <<
"Unknown type of a valid tracker hit in Strips "
481 <<
" SubDet = "<<
id.subdetId();
490 <<
"@SUB=isOkCharge" <<
"Unknown valid tracker hit not in pixel, subdet " <<
id.subdetId()
492 <<
", BaseTrackerRecHit " << dynamic_cast<const BaseTrackerRecHit*>(hit);
504 SiStripRecHit2D::ClusterRef cluster(siStripRecHit2D.cluster());
505 const std::vector<uint8_t> &litudes = cluster->amplitudes();
507 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
508 charge += amplitudes[ia];
520 SiStripRecHit1D::ClusterRef cluster(siStripRecHit1D.cluster());
521 const std::vector<uint8_t> &litudes = cluster->amplitudes();
523 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
524 charge += amplitudes[ia];
554 for( istripSt=stripcollSt.begin(); istripSt!=stripcollSt.end(); ++istripSt ) {
555 const SiStripRecHit2D *aHit = &*(istripSt);
556 DetId mydet1 = aHit->geographicalId();
558 float theDistance = ( therechit->
localPosition() - aHit->localPosition() ).
mag();
564 for( istripStm=stripcollStm.begin(); istripStm!=stripcollStm.end(); ++istripStm ) {
565 const SiStripMatchedRecHit2D *aHit = &*(istripStm);
566 DetId mydet2 = aHit->geographicalId();
568 float theDistance = (therechit->
localPosition() - aHit->localPosition()).
mag();
588 for (Tracks::const_iterator it=sortedTracks.begin();
589 it!=sortedTracks.end(); ++it) {
609 for (Tracks::const_iterator ittrk=tracks.begin(); ittrk != tracks.end(); ++ittrk) {
621 bool isPixelHit=(subDet ==
kFPIX || subDet ==
kBPIX);
624 const std::type_info &
type =
typeid(*hit);
626 if (type ==
typeid(SiStripRecHit2D)) {
627 const SiStripRecHit2D* striphit=
dynamic_cast<const SiStripRecHit2D*
>(hit);
629 SiStripRecHit2D::ClusterRef stripclust(striphit->cluster());
630 flag = flagMap[stripclust];
633 else if(type ==
typeid(SiStripRecHit1D)){
634 const SiStripRecHit1D* striphit =
dynamic_cast<const SiStripRecHit1D*
>(hit);
636 SiStripRecHit1D::ClusterRef stripclust(striphit->cluster());
637 flag = flagMap[stripclust];
641 edm::LogError(
"AlignmentTrackSelector")<<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Strip RecHit failed!"
642 <<
" Skipping this hit.";
652 SiPixelRecHit::ClusterRef pixclust(pixelhit->cluster());
653 flag = flagMap[pixclust];
656 edm::LogError(
"AlignmentTrackSelector")<<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Pixel RecHit failed! ";
660 if(flag.
isTaken())ntakenhits++;
673 bool qualityOk=
false;
674 bool iterStepOk=
false;
684 else iterStepOk=
true;
696 return qualityOk&&iterStepOk;
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
const int minHitsinFPIXminus_
const bool applyNHighestPt_
virtual int dimension() const =0
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const int minHitsinTECplus_
const double nLostHitMax_
const bool applyIsolation_
const int minHitsinFPIXplus_
Tracks basicCuts(const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
apply basic cuts on pt,eta,phi,nhit
bool isIsolated(const TrackingRecHit *therechit, const edm::Event &evt) const
double d0() const
dxy parameter in perigee convention (d0 = - dxy)
std::vector< data_type > DataContainer
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
const int minHitsinTIDplus_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const double maxHitDiffEndcaps_
const double minHitIsolation_
std::vector< const reco::Track * > Tracks
Tracks checkPrescaledHits(const Tracks &tracks, const edm::Event &evt) const
~AlignmentTrackSelector()
destructor
std::vector< reco::TrackBase::TrackAlgorithm > trkSteps_
Tracks theNHighestPtTracks(const Tracks &tracks) const
filter the n highest pt tracks
double phi() const
azimuthal angle of momentum vector
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
std::vector< reco::TrackBase::TrackQuality > trkQualities_
const unsigned int nHitMin2D_
bool isOkChargeStripHit(const SiStripRecHit1D &siStripRecHit1D) const
const bool applyMultiplicityFilter_
bool tecIsZMinusSide(const DetId &id) const
const bool countStereoHitAs2D_
AlignmentTrackSelector(const edm::ParameterSet &cfg)
constructor
bool tidIsZMinusSide(const DetId &id) const
TrackAlgorithm algo() const
uint32_t rawId() const
get the raw id
bool isHit2D(const TrackingRecHit &hit) const
const int minHitsinENDCAPplus_
double eta() const
pseudorapidity of momentum vector
const bool seedOnlyFromAbove_
double pt() const
track transverse momentum
const int minHitsinTECminus_
const int minHitsinENDCAPminus_
const double minHitChargeStrip_
Abs< T >::type abs(const T &t)
unsigned short numberOfValidHits() const
number of valid hits found
const int minMultiplicity_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
const edm::InputTag matchedrecHitsTag_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool isOkTrkQuality(const reco::Track *track) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) 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...
Detector identifier class for the strip tracker.
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
const int minHitsinENDCAP_
static TrackQuality qualityByName(const std::string &name)
bool tidIsZPlusSide(const DetId &id) const
const int minPrescaledHits_
const edm::InputTag clusterValueMapTag_
T const * product() const
bool quality(const TrackQuality) const
Track quality.
bool detailedHitsCheck(const reco::Track *track, const edm::Event &evt, const edm::EventSetup &eSetup) const
checking hit requirements beyond simple number of valid hits
const bool applyBasicCuts_
bool tecIsZPlusSide(const DetId &id) const
Tracks select(const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
select tracks
bool applyTrkQualityCheck_
const edm::InputTag rphirecHitsTag_
bool isOkCharge(const TrackingRecHit *therechit) const
if valid, check for minimum charge (currently only in strip), if invalid give true ...
static TrackAlgorithm algoByName(const std::string &name)
unsigned int pxfSide(const DetId &id) const
const int maxMultiplicity_
int charge() const
track electric charge
const int minHitsinTIDminus_
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
virtual LocalPoint localPosition() const =0
const SiStripRecHit2D & originalHit() const
const bool applyPrescaledHitsFilter_
tuple size
Write out results.
const bool multiplicityOnInput_
bool useThisFilter()
returns if any of the Filters is used.
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.