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" ) ),
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")),
93 applyPrescaledHitsFilter_(clusterValueMapTag_.
encode().
size() && minPrescaledHits_ > 0)
97 std::vector<std::string> trkQualityStrings(cfg.
getParameter<std::vector<std::string> >(
"trackQualities"));
99 if(trkQualityStrings.size()>0){
101 for (
unsigned int i = 0;
i < trkQualityStrings.size(); ++
i) {
102 (qualities += trkQualityStrings[
i]) +=
", ";
108 std::vector<std::string> trkIterStrings(cfg.
getParameter<std::vector<std::string> >(
"iterativeTrackingSteps"));
109 if(trkIterStrings.size()>0){
112 for (
unsigned int i = 0;
i < trkIterStrings.size(); ++
i) {
113 (tracksteps += trkIterStrings[
i]) +=
", ";
121 <<
"applying basic track cuts ..."
129 << (
countStereoHitAs2D_ ?
"," :
", not") <<
" counting hits on SiStrip stereo modules as 2D"
135 " cm from other rechits";
140 " ADC counts of total cluster charge";
143 <<
"Minimum number of hits in TIB/TID/TOB/TEC/BPIX/FPIX/PIXEL = "
148 <<
"Minimum number of hits in TID+/TID-/TEC+/TEC-/FPIX+/FPIX- = "
154 <<
"Minimum number of hits in EndCap (TID+TEC)/EndCap+/EndCap- = "
158 <<
"Max value of |nHitsinENDCAPplus - nHitsinENDCAPminus| = "
161 if (trkQualityStrings.size()) {
163 <<
"Select tracks with these qualities: " << qualities;
169 <<
"filter N tracks with highest Pt N=" <<
nHighestPt_;
185 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
186 <<
"Wrong configuration of 'RorZofFirstHitMin'."
187 <<
" Must have exactly 2 values instead of configured " <<
RorZofFirstHitMin_.size() <<
")";
193 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
194 <<
"Wrong configuration of 'RorZofFirstHitMax'."
195 <<
" Must have exactly 2 values instead of configured " <<
RorZofFirstHitMax_.size() <<
")";
201 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
202 <<
"Wrong configuration of 'RorZofLastHitMin'."
203 <<
" Must have exactly 2 values instead of configured " <<
RorZofLastHitMin_.size() <<
")";
209 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
210 <<
"Wrong configuration of 'RorZofLastHitMax'."
211 <<
" Must have exactly 2 values instead of configured " <<
RorZofLastHitMax_.size() <<
")";
218 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
219 <<
"Position of the first hit is set to larger distance than the last hit:."
282 for (Tracks::const_iterator it=tracks.begin(); it != tracks.end(); ++it) {
284 float pt=trackp->
pt();
293 bool isChargeOk =
false;
295 else if (
theCharge_==1 && q>0) isChargeOk =
true;
298 float d0 = trackp->
d0();
299 float dz = trackp->
dz();
314 bool trkQualityOk=
false ;
320 if (trkQualityOk && hitsCheckOk ) result.push_back(trackp);
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;
360 const DetId detId((*iHit)->geographicalId());
361 const int subdetId = detId.
subdetId();
376 if (!(*iHit)->isValid())
continue;
378 edm::LogError(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::detailedHitsCheck"
380 <<
"), but " << detId.det() <<
".";
413 else if (
kBPIX == subdetId) {++nhitinBPIX;++nhitinPIXEL;}
414 else if (
kFPIX == subdetId) {
418 if (tTopo->
pxfSide(detId)==1) ++nhitinFPIXminus;
419 else if (tTopo->
pxfSide(detId)==2) ++nhitinFPIXplus;
422 if (nHit2D < nHitMin2D_ && this->
isHit2D(**iHit)) ++nHit2D;
427 bool passedLastHitPositionR =
true;
428 bool passedLastHitPositionZ =
true;
429 bool passedFirstHitPositionR =
true;
430 bool passedFirstHitPositionZ =
true;
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;
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;
454 bool passedFirstHitPosition = passedFirstHitPositionR || passedFirstHitPositionZ;
455 bool passedLastHitPosition = passedLastHitPositionR || passedLastHitPositionZ;
468 && nHit2D >=
nHitMin2D_ && passedFirstHitPosition && passedLastHitPosition);
487 if (detId.subdetId() ==
kBPIX || detId.subdetId() ==
kFPIX) {
492 else if (dynamic_cast<const SiStripRecHit1D*>(&hit)
493 ||
dynamic_cast<const SiStripRecHit2D*
>(&hit))
return false;
495 else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit))
return true;
496 else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
497 const ProjectedSiStripRecHit2D* pH =
static_cast<const ProjectedSiStripRecHit2D*
>(&hit);
500 edm::LogError(
"UnkownType") <<
"@SUB=AlignmentTrackSelector::isHit2D"
501 <<
"Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
502 <<
"SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
507 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::isHit2D"
508 <<
"Hit not in tracker with 'official' dimension >=2.";
519 if (!hit || !hit->
isValid())
return true;
524 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=isOkCharge" <<
"Hit not in tracker!";
527 if (
id.subdetId() ==
kFPIX ||
id.subdetId() ==
kBPIX) {
532 const std::type_info &
type =
typeid(*hit);
535 if (type ==
typeid(SiStripRecHit2D)) {
536 const SiStripRecHit2D *stripHit2D =
dynamic_cast<const SiStripRecHit2D*
>(hit);
541 else if(type ==
typeid(SiStripRecHit1D)){
542 const SiStripRecHit1D *stripHit1D =
dynamic_cast<const SiStripRecHit1D*
>(hit);
548 else if(type ==
typeid(SiStripMatchedRecHit2D)){
549 const SiStripMatchedRecHit2D *matchedHit =
dynamic_cast<const SiStripMatchedRecHit2D*
>(hit);
555 else if(type ==
typeid(ProjectedSiStripRecHit2D)){
557 const ProjectedSiStripRecHit2D *projHit =
dynamic_cast<const ProjectedSiStripRecHit2D*
>(hit);
563 edm::LogError(
"AlignmentTrackSelector")<<
"@SUB=isOkCharge" <<
"Unknown type of a valid tracker hit in Strips "
564 <<
" SubDet = "<<
id.subdetId();
573 <<
"@SUB=isOkCharge" <<
"Unknown valid tracker hit not in pixel, subdet " <<
id.subdetId()
575 <<
", BaseTrackerRecHit " << dynamic_cast<const BaseTrackerRecHit*>(hit);
587 SiStripRecHit2D::ClusterRef cluster(siStripRecHit2D.cluster());
588 const std::vector<uint8_t> &litudes = cluster->amplitudes();
590 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
591 charge += amplitudes[ia];
603 SiStripRecHit1D::ClusterRef cluster(siStripRecHit1D.cluster());
604 const std::vector<uint8_t> &litudes = cluster->amplitudes();
606 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
607 charge += amplitudes[ia];
637 for( istripSt=stripcollSt.begin(); istripSt!=stripcollSt.end(); ++istripSt ) {
638 const SiStripRecHit2D *aHit = &*(istripSt);
639 DetId mydet1 = aHit->geographicalId();
641 float theDistance = ( therechit->
localPosition() - aHit->localPosition() ).
mag();
647 for( istripStm=stripcollStm.begin(); istripStm!=stripcollStm.end(); ++istripStm ) {
648 const SiStripMatchedRecHit2D *aHit = &*(istripStm);
649 DetId mydet2 = aHit->geographicalId();
651 float theDistance = (therechit->
localPosition() - aHit->localPosition()).
mag();
671 for (Tracks::const_iterator it=sortedTracks.begin();
672 it!=sortedTracks.end(); ++it) {
692 for (Tracks::const_iterator ittrk=tracks.begin(); ittrk != tracks.end(); ++ittrk) {
704 bool isPixelHit=(subDet ==
kFPIX || subDet ==
kBPIX);
707 const std::type_info &
type =
typeid(*hit);
709 if (type ==
typeid(SiStripRecHit2D)) {
710 const SiStripRecHit2D* striphit=
dynamic_cast<const SiStripRecHit2D*
>(hit);
712 SiStripRecHit2D::ClusterRef stripclust(striphit->cluster());
713 flag = flagMap[stripclust];
716 else if(type ==
typeid(SiStripRecHit1D)){
717 const SiStripRecHit1D* striphit =
dynamic_cast<const SiStripRecHit1D*
>(hit);
719 SiStripRecHit1D::ClusterRef stripclust(striphit->cluster());
720 flag = flagMap[stripclust];
724 edm::LogError(
"AlignmentTrackSelector")<<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Strip RecHit failed!"
725 <<
" Skipping this hit.";
735 SiPixelRecHit::ClusterRef pixclust(pixelhit->cluster());
736 flag = flagMap[pixclust];
739 edm::LogError(
"AlignmentTrackSelector")<<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Pixel RecHit failed! ";
743 if(flag.
isTaken())ntakenhits++;
756 bool qualityOk=
false;
757 bool iterStepOk=
false;
767 else iterStepOk=
true;
779 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
std::vector< double > RorZofFirstHitMax_
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_
const math::XYZPoint & outerPosition() const
position of the outermost hit
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
const math::XYZPoint & innerPosition() const
position of the innermost hit
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_
math::XYZPoint Point
point in the space
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
const edm::InputTag matchedrecHitsTag_
std::vector< double > RorZofLastHitMin_
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...
std::vector< double > RorZofFirstHitMin_
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
std::vector< double > RorZofLastHitMax_
const int minHitsinTIDminus_
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
virtual LocalPoint localPosition() const =0
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.