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" ) ),
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")),
89 applyPrescaledHitsFilter_(!clusterValueMapTag_.
encode().
empty() && minPrescaledHits_ > 0)
101 std::vector<std::string> trkQualityStrings(cfg.
getParameter<std::vector<std::string> >(
"trackQualities"));
103 if(!trkQualityStrings.empty()){
105 for (
unsigned int i = 0;
i < trkQualityStrings.size(); ++
i) {
106 (qualities += trkQualityStrings[
i]) +=
", ";
112 std::vector<std::string> trkIterStrings(cfg.
getParameter<std::vector<std::string> >(
"iterativeTrackingSteps"));
113 if(!trkIterStrings.empty()){
116 for (
unsigned int i = 0;
i < trkIterStrings.size(); ++
i) {
117 (tracksteps += trkIterStrings[
i]) +=
", ";
125 <<
"applying basic track cuts ..." 133 << (
countStereoHitAs2D_ ?
"," :
", not") <<
" counting hits on SiStrip stereo modules as 2D" 139 " cm from other rechits";
144 " ADC counts of total cluster charge";
147 <<
"Minimum number of hits in TIB/TID/TOB/TEC/BPIX/FPIX/PIXEL = " 152 <<
"Minimum number of hits in TID+/TID-/TEC+/TEC-/FPIX+/FPIX- = " 158 <<
"Minimum number of hits in EndCap (TID+TEC)/EndCap+/EndCap- = " 162 <<
"Max value of |nHitsinENDCAPplus - nHitsinENDCAPminus| = " 165 if (!trkQualityStrings.empty()) {
167 <<
"Select tracks with these qualities: " << qualities;
173 <<
"filter N tracks with highest Pt N=" <<
nHighestPt_;
189 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector" 190 <<
"Wrong configuration of 'RorZofFirstHitMin'." 191 <<
" Must have exactly 2 values instead of configured " <<
RorZofFirstHitMin_.size() <<
")";
197 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector" 198 <<
"Wrong configuration of 'RorZofFirstHitMax'." 199 <<
" Must have exactly 2 values instead of configured " <<
RorZofFirstHitMax_.size() <<
")";
205 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector" 206 <<
"Wrong configuration of 'RorZofLastHitMin'." 207 <<
" Must have exactly 2 values instead of configured " <<
RorZofLastHitMin_.size() <<
")";
213 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector" 214 <<
"Wrong configuration of 'RorZofLastHitMax'." 215 <<
" Must have exactly 2 values instead of configured " <<
RorZofLastHitMax_.size() <<
")";
222 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector" 223 <<
"Position of the first hit is set to larger distance than the last hit:." 286 for (Tracks::const_iterator it=tracks.begin(); it != tracks.end(); ++it) {
288 float pt=trackp->
pt();
297 bool isChargeOk =
false;
299 else if (
theCharge_==1 && q>0) isChargeOk =
true;
302 float d0 = trackp->
d0();
303 float dz = trackp->
dz();
318 bool trkQualityOk=
false ;
324 if (trkQualityOk && hitsCheckOk ) result.push_back(trackp);
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;
364 const DetId detId((*iHit)->geographicalId());
365 const int subdetId = detId.
subdetId();
380 if (!(*iHit)->isValid())
continue;
382 edm::LogError(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::detailedHitsCheck" 384 <<
"), but " << detId.det() <<
".";
417 else if (
kBPIX == subdetId) {++nhitinBPIX;++nhitinPIXEL;}
418 else if (
kFPIX == subdetId) {
422 if (tTopo->
pxfSide(detId)==1) ++nhitinFPIXminus;
423 else if (tTopo->
pxfSide(detId)==2) ++nhitinFPIXplus;
426 if (nHit2D < nHitMin2D_ && this->
isHit2D(**iHit)) ++nHit2D;
431 bool passedLastHitPositionR =
true;
432 bool passedLastHitPositionZ =
true;
433 bool passedFirstHitPositionR =
true;
434 bool passedFirstHitPositionZ =
true;
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;
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;
458 bool passedFirstHitPosition = passedFirstHitPositionR || passedFirstHitPositionZ;
459 bool passedLastHitPosition = passedLastHitPositionR || passedLastHitPositionZ;
472 && nHit2D >=
nHitMin2D_ && passedFirstHitPosition && passedLastHitPosition);
491 if (detId.subdetId() ==
kBPIX || detId.subdetId() ==
kFPIX) {
496 else if (dynamic_cast<const SiStripRecHit1D*>(&hit)
499 else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit))
return true;
500 else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
504 edm::LogError(
"UnkownType") <<
"@SUB=AlignmentTrackSelector::isHit2D" 505 <<
"Tracker hit not in pixel, neither SiStripRecHit[12]D nor " 506 <<
"SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
511 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::isHit2D" 512 <<
"Hit not in tracker with 'official' dimension >=2.";
523 if (!hit || !hit->
isValid())
return true;
528 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=isOkCharge" <<
"Hit not in tracker!";
531 if (
id.subdetId() ==
kFPIX ||
id.subdetId() ==
kBPIX) {
536 const std::type_info &
type =
typeid(*hit);
567 edm::LogError(
"AlignmentTrackSelector")<<
"@SUB=isOkCharge" <<
"Unknown type of a valid tracker hit in Strips " 568 <<
" SubDet = "<<
id.subdetId();
577 <<
"@SUB=isOkCharge" <<
"Unknown valid tracker hit not in pixel, subdet " <<
id.subdetId()
579 <<
", BaseTrackerRecHit " << dynamic_cast<const BaseTrackerRecHit*>(hit);
592 const auto &litudes = cluster->amplitudes();
594 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
595 charge += amplitudes[ia];
608 const auto &litudes = cluster->amplitudes();
610 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
611 charge += amplitudes[ia];
641 for( istripSt=stripcollSt.begin(); istripSt!=stripcollSt.end(); ++istripSt ) {
651 for( istripStm=stripcollStm.begin(); istripStm!=stripcollStm.end(); ++istripStm ) {
671 std::sort(sortedTracks.begin(),sortedTracks.end(),
ptComparator);
675 for (Tracks::const_iterator it=sortedTracks.begin();
676 it!=sortedTracks.end(); ++it) {
696 for (Tracks::const_iterator ittrk=tracks.begin(); ittrk != tracks.end(); ++ittrk) {
708 bool isPixelHit=(subDet ==
kFPIX || subDet ==
kBPIX);
711 const std::type_info &
type =
typeid(*hit);
715 if(striphit!=
nullptr){
717 flag = flagMap[stripclust];
722 if(striphit!=
nullptr){
724 flag = flagMap[stripclust];
728 edm::LogError(
"AlignmentTrackSelector")<<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Strip RecHit failed!" 729 <<
" Skipping this hit.";
738 if(pixelhit!=
nullptr){
740 flag = flagMap[pixclust];
743 edm::LogError(
"AlignmentTrackSelector")<<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Pixel RecHit failed! ";
747 if(flag.
isTaken())ntakenhits++;
760 bool qualityOk=
false;
761 bool iterStepOk=
false;
771 else iterStepOk=
true;
783 return qualityOk&&iterStepOk;
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
ClusterRef cluster() const
double p() const
momentum vector magnitude
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
const int minHitsinFPIXminus_
const bool applyNHighestPt_
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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
constexpr uint32_t rawId() const
get the raw id
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_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
bool tidIsZMinusSide(const DetId &id) const
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackAlgorithm algo() const
const int seedOnlyFromAbove_
bool isHit2D(const TrackingRecHit &hit) const
const int minHitsinENDCAPplus_
double eta() const
pseudorapidity of momentum vector
virtual int dimension() const =0
double pt() const
track transverse momentum
const int minHitsinTECminus_
const int minHitsinENDCAPminus_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
data_type const * data(size_t cell) const
const double minHitChargeStrip_
Abs< T >::type abs(const T &t)
ClusterRef cluster() const
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.
virtual LocalPoint localPosition() const =0
std::vector< double > RorZofLastHitMin_
bool isOkTrkQuality(const reco::Track *track) const
edm::EDGetTokenT< AliClusterValueMap > clusterValueMapToken_
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_
SiStripRecHit2D originalHit() const
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)
SiStripRecHit2D stereoHit() const
bool tidIsZPlusSide(const DetId &id) const
const int minPrescaledHits_
const edm::InputTag clusterValueMapTag_
ClusterRef cluster() 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
SiStripRecHit2D monoHit() const
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_
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
LocalPoint localPosition() const final
const int maxMultiplicity_
int charge() const
track electric charge
std::vector< double > RorZofLastHitMax_
const int minHitsinTIDminus_
DetId geographicalId() const
AlignmentTrackSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
constructor
T const * product() const
const bool applyPrescaledHitsFilter_
const bool multiplicityOnInput_
bool useThisFilter()
returns if any of the Filters is used.
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.