32 applyBasicCuts_(cfg.getParameter<bool>(
"applyBasicCuts")),
33 applyNHighestPt_(cfg.getParameter<bool>(
"applyNHighestPt")),
34 applyMultiplicityFilter_(cfg.getParameter<bool>(
"applyMultiplicityFilter")),
35 seedOnlyFromAbove_(cfg.getParameter<int>(
"seedOnlyFrom")),
36 applyIsolation_(cfg.getParameter<bool>(
"applyIsolationCut")),
37 chargeCheck_(cfg.getParameter<bool>(
"applyChargeCheck")),
38 nHighestPt_(cfg.getParameter<int>(
"nHighestPt")),
39 minMultiplicity_(cfg.getParameter<int>(
"minMultiplicity")),
40 maxMultiplicity_(cfg.getParameter<int>(
"maxMultiplicity")),
41 multiplicityOnInput_(cfg.getParameter<bool>(
"multiplicityOnInput")),
42 ptMin_(cfg.getParameter<double>(
"ptMin")),
43 ptMax_(cfg.getParameter<double>(
"ptMax")),
44 pMin_(cfg.getParameter<double>(
"pMin")),
45 pMax_(cfg.getParameter<double>(
"pMax")),
46 etaMin_(cfg.getParameter<double>(
"etaMin")),
47 etaMax_(cfg.getParameter<double>(
"etaMax")),
48 phiMin_(cfg.getParameter<double>(
"phiMin")),
49 phiMax_(cfg.getParameter<double>(
"phiMax")),
50 nHitMin_(cfg.getParameter<double>(
"nHitMin")),
51 nHitMax_(cfg.getParameter<double>(
"nHitMax")),
52 chi2nMax_(cfg.getParameter<double>(
"chi2nMax")),
53 d0Min_(cfg.getParameter<double>(
"d0Min")),
54 d0Max_(cfg.getParameter<double>(
"d0Max")),
55 dzMin_(cfg.getParameter<double>(
"dzMin")),
56 dzMax_(cfg.getParameter<double>(
"dzMax")),
57 theCharge_(cfg.getParameter<int>(
"theCharge")),
58 minHitChargeStrip_(cfg.getParameter<double>(
"minHitChargeStrip")),
59 minHitIsolation_(cfg.getParameter<double>(
"minHitIsolation")),
60 countStereoHitAs2D_(cfg.getParameter<bool>(
"countStereoHitAs2D")),
61 nHitMin2D_(cfg.getParameter<unsigned int>(
"nHitMin2D")),
63 minHitsinTIB_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTIB")),
64 minHitsinTOB_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTOB")),
65 minHitsinTID_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTID")),
66 minHitsinTEC_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTEC")),
67 minHitsinBPIX_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inBPIX")),
68 minHitsinFPIX_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inFPIX")),
69 minHitsinPIX_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inPIXEL")),
70 minHitsinTIDplus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTIDplus")),
71 minHitsinTIDminus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTIDminus")),
72 minHitsinTECplus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTECplus")),
73 minHitsinTECminus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inTECminus")),
74 minHitsinFPIXplus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inFPIXplus")),
75 minHitsinFPIXminus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inFPIXminus")),
76 minHitsinENDCAP_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inENDCAP")),
77 minHitsinENDCAPplus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inENDCAPplus")),
78 minHitsinENDCAPminus_(cfg.getParameter<edm::
ParameterSet>(
"minHitsPerSubDet").getParameter<int>(
"inENDCAPminus")),
79 maxHitDiffEndcaps_(cfg.getParameter<double>(
"maxHitDiffEndcaps")),
80 nLostHitMax_(cfg.getParameter<double>(
"nLostHitMax")),
81 RorZofFirstHitMin_(cfg.getParameter<std::
vector<double> >(
"RorZofFirstHitMin")),
82 RorZofFirstHitMax_(cfg.getParameter<std::
vector<double> >(
"RorZofFirstHitMax")),
83 RorZofLastHitMin_(cfg.getParameter<std::
vector<double> >(
"RorZofLastHitMin")),
84 RorZofLastHitMax_(cfg.getParameter<std::
vector<double> >(
"RorZofLastHitMax")),
85 clusterValueMapTag_(cfg.getParameter<edm::
InputTag>(
"hitPrescaleMapTag")),
86 minPrescaledHits_(cfg.getParameter<int>(
"minPrescaledHits")),
87 applyPrescaledHitsFilter_(!clusterValueMapTag_.
encode().
empty() && minPrescaledHits_ > 0) {
99 std::vector<std::string> trkQualityStrings(cfg.
getParameter<std::vector<std::string> >(
"trackQualities"));
101 if (!trkQualityStrings.empty()) {
103 for (
unsigned int i = 0;
i < trkQualityStrings.size(); ++
i) {
104 (qualities += trkQualityStrings[
i]) +=
", ";
110 std::vector<std::string> trkIterStrings(cfg.
getParameter<std::vector<std::string> >(
"iterativeTrackingSteps"));
111 if (!trkIterStrings.empty()) {
114 for (
unsigned int i = 0;
i < trkIterStrings.size(); ++
i) {
115 (tracksteps += trkIterStrings[
i]) +=
", ";
123 <<
"applying basic track cuts ..."
128 <<
" counting hits on SiStrip stereo modules as 2D"
133 <<
"only retain tracks isolated at least by " <<
minHitIsolation_ <<
" cm from other rechits";
137 <<
"only retain hits with at least " <<
minHitChargeStrip_ <<
" ADC counts of total cluster charge";
145 <<
"Minimum number of hits in TID+/TID-/TEC+/TEC-/FPIX+/FPIX- = " <<
minHitsinTIDplus_ <<
"/"
150 <<
"Minimum number of hits in EndCap (TID+TEC)/EndCap+/EndCap- = " <<
minHitsinENDCAP_ <<
"/"
156 if (!trkQualityStrings.empty()) {
157 edm::LogInfo(
"AlignmentTrackSelector") <<
"Select tracks with these qualities: " << qualities;
176 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
177 <<
"Wrong configuration of 'RorZofFirstHitMin'."
178 <<
" Must have exactly 2 values instead of configured "
185 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
186 <<
"Wrong configuration of 'RorZofFirstHitMax'."
187 <<
" Must have exactly 2 values instead of configured "
194 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
195 <<
"Wrong configuration of 'RorZofLastHitMin'."
196 <<
" Must have exactly 2 values instead of configured "
203 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
204 <<
"Wrong configuration of 'RorZofLastHitMax'."
205 <<
" Must have exactly 2 values instead of configured "
213 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentTrackSelector::AlignmentTrackSelector"
214 <<
"Position of the first hit is set to larger distance than the last hit:."
239 result = this->
basicCuts(result, evt, eSetup);
272 for (Tracks::const_iterator it = tracks.begin(); it != tracks.end(); ++it) {
274 float pt = trackp->
pt();
275 float p = trackp->
p();
276 float eta = trackp->
eta();
277 float phi = trackp->
phi();
283 bool isChargeOk =
false;
291 float d0 = trackp->
d0();
292 float dz = trackp->
dz();
300 bool trkQualityOk =
false;
308 if (trkQualityOk && hitsCheckOk)
309 result.push_back(trackp);
334 int nhitinTIB = 0, nhitinTOB = 0, nhitinTID = 0;
335 int nhitinTEC = 0, nhitinBPIX = 0, nhitinFPIX = 0, nhitinPIXEL = 0;
336 int nhitinENDCAP = 0, nhitinENDCAPplus = 0, nhitinENDCAPminus = 0;
337 int nhitinTIDplus = 0, nhitinTIDminus = 0;
338 int nhitinFPIXplus = 0, nhitinFPIXminus = 0;
339 int nhitinTECplus = 0, nhitinTECminus = 0;
340 unsigned int nHit2D = 0;
341 unsigned int thishit = 0;
345 const DetId detId(
hit->geographicalId());
346 const int subdetId = detId.
subdetId();
365 <<
"@SUB=AlignmentTrackSelector::detailedHitsCheck"
366 <<
"DetId.det() != DetId::Tracker (=" <<
DetId::Tracker <<
"), but " << detId.det() <<
".";
398 }
else if (
kBPIX == subdetId) {
401 }
else if (
kFPIX == subdetId) {
405 if (tTopo->
pxfSide(detId) == 1)
407 else if (tTopo->
pxfSide(detId) == 2)
411 if (nHit2D < nHitMin2D_ && this->
isHit2D(*
hit))
416 bool passedLastHitPositionR =
true;
417 bool passedLastHitPositionZ =
true;
418 bool passedFirstHitPositionR =
true;
419 bool passedFirstHitPositionZ =
true;
426 passedFirstHitPositionR =
false;
428 passedFirstHitPositionR =
false;
430 passedFirstHitPositionZ =
false;
432 passedFirstHitPositionZ =
false;
440 passedLastHitPositionR =
false;
442 passedLastHitPositionR =
false;
444 passedLastHitPositionZ =
false;
446 passedLastHitPositionZ =
false;
449 bool passedFirstHitPosition = passedFirstHitPositionR || passedFirstHitPositionZ;
450 bool passedLastHitPosition = passedLastHitPositionR || passedLastHitPositionZ;
460 nHit2D >=
nHitMin2D_ && passedFirstHitPosition && passedLastHitPosition);
476 if (detId.subdetId() ==
kBPIX || detId.subdetId() ==
kFPIX) {
482 else if (dynamic_cast<const SiStripRecHit1D*>(&hit) ||
dynamic_cast<const SiStripRecHit2D*
>(&hit))
485 else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit))
487 else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
491 edm::LogError(
"UnknownType") <<
"@SUB=AlignmentTrackSelector::isHit2D"
492 <<
"Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
493 <<
"SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
498 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=AlignmentTrackSelector::isHit2D"
499 <<
"Hit not in tracker with 'official' dimension >=2.";
516 <<
"Hit not in tracker!";
519 if (
id.subdetId() ==
kFPIX ||
id.subdetId() ==
kBPIX) {
524 const std::type_info&
type =
typeid(*hit);
552 <<
"Unknown type of a valid tracker hit in Strips "
553 <<
" SubDet = " <<
id.subdetId();
560 <<
"Unknown valid tracker hit not in pixel, subdet " <<
id.subdetId()
562 <<
", BaseTrackerRecHit " << dynamic_cast<const BaseTrackerRecHit*>(hit);
573 const auto& amplitudes = cluster->amplitudes();
575 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
576 charge += amplitudes[ia];
588 const auto& amplitudes = cluster->amplitudes();
590 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
591 charge += amplitudes[ia];
620 for (istripSt = stripcollSt.begin(); istripSt != stripcollSt.end(); ++istripSt) {
632 for (istripStm = stripcollStm.begin(); istripStm != stripcollStm.end(); ++istripStm) {
652 std::sort(sortedTracks.begin(), sortedTracks.end(),
ptComparator);
656 for (Tracks::const_iterator it = sortedTracks.begin(); it != sortedTracks.end(); ++it) {
658 result.push_back(*it);
678 for (
auto const& trackp : tracks) {
682 for (
auto const&
hit : trackp->recHits()) {
685 DetId detid =
hit->geographicalId();
689 bool isPixelHit = (subDet ==
kFPIX || subDet ==
kBPIX);
692 const std::type_info&
type =
typeid(*hit);
696 if (striphit !=
nullptr) {
698 flag = flagMap[stripclust];
702 if (striphit !=
nullptr) {
704 flag = flagMap[stripclust];
708 <<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Strip RecHit failed!"
709 <<
" Skipping this hit.";
716 if (pixelhit !=
nullptr) {
718 flag = flagMap[pixclust];
721 <<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Pixel RecHit failed! ";
730 result.push_back(trackp);
739 bool qualityOk =
false;
740 bool iterStepOk =
false;
762 return qualityOk && iterStepOk;
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
ClusterRef cluster() const
double p() const
momentum vector magnitude
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const int minHitsinFPIXminus_
const bool applyNHighestPt_
virtual int dimension() const =0
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)
uint16_t *__restrict__ id
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_
static constexpr auto TID
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_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
auto const & tracks
cannot be loose
const unsigned int nHitMin2D_
Log< level::Error, false > LogError
etaMax_(conf.getParameter< double >("etaMax"))
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
bool getData(T &iHolder) const
const int seedOnlyFromAbove_
bool isHit2D(const TrackingRecHit &hit) const
ptMin_(conf.getParameter< double >("ptMin"))
const int minHitsinENDCAPplus_
double eta() const
pseudorapidity of momentum vector
pMin_(conf.getParameter< double >("pMin"))
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) ...
const double minHitChargeStrip_
auto recHits() const
Access to reconstructed hits on the track.
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
std::vector< double > RorZofLastHitMin_
static constexpr auto TOB
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
Log< level::Info, false > LogInfo
Detector identifier class for the strip tracker.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
static constexpr float d0
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
T getParameter(std::string const &) const
bool quality(const TrackQuality) const
Track quality.
static constexpr auto TIB
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 ...
LocalPoint localPosition() const override
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
Log< level::Warning, false > LogWarning
virtual LocalPoint localPosition() const =0
AlignmentTrackSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
constructor
const bool applyPrescaledHitsFilter_
etaMin_(conf.getParameter< double >("etaMin"))
const bool multiplicityOnInput_
static constexpr auto TEC
bool useThisFilter()
returns if any of the Filters is used.