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")),
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) {
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()) {
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:." 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)
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;
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) {
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);
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.";
509 if (!
hit || !
hit->isValid())
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) {
588 const auto& amplitudes = cluster->amplitudes();
590 for (
size_t ia = 0; ia < amplitudes.size(); ++ia) {
620 for (istripSt = stripcollSt.begin(); istripSt != stripcollSt.end(); ++istripSt) {
632 for (istripStm = stripcollStm.begin(); istripStm != stripcollStm.end(); ++istripStm) {
656 for (Tracks::const_iterator
it = sortedTracks.begin();
it != sortedTracks.end(); ++
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.";
718 flag = flagMap[pixclust];
721 <<
"ERROR in <AlignmentTrackSelector::checkPrescaledHits>: Dynamic cast of Pixel RecHit failed! ";
739 bool qualityOk =
false;
740 bool iterStepOk =
false;
762 return qualityOk && iterStepOk;
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool isIsolated(const TrackingRecHit *therechit, const edm::Event &evt) const
const int minHitsinFPIXminus_
const bool applyNHighestPt_
bool tidIsZPlusSide(const DetId &id) const
std::vector< double > RorZofFirstHitMax_
const int minHitsinTECplus_
const double nLostHitMax_
SiStripRecHit2D stereoHit() const
const bool applyIsolation_
const int minHitsinFPIXplus_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Tracks checkPrescaledHits(const Tracks &tracks, const edm::Event &evt) const
unsigned short numberOfValidHits() const
number of valid hits found
const math::XYZPoint & outerPosition() const
position of the outermost hit
std::vector< data_type > DataContainer
const int minHitsinTIDplus_
static constexpr auto TID
Tracks select(const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
select tracks
double p() const
momentum vector magnitude
Tracks theNHighestPtTracks(const Tracks &tracks) const
filter the n highest pt tracks
const double maxHitDiffEndcaps_
Tracks basicCuts(const Tracks &tracks, const edm::Event &evt, const edm::EventSetup &eSetup) const
apply basic cuts on pt,eta,phi,nhit
const double minHitIsolation_
std::vector< const reco::Track * > Tracks
~AlignmentTrackSelector()
destructor
std::vector< reco::TrackBase::TrackAlgorithm > trkSteps_
std::vector< reco::TrackBase::TrackQuality > trkQualities_
bool tecIsZMinusSide(const DetId &id) const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const unsigned int nHitMin2D_
Log< level::Error, false > LogError
const bool applyMultiplicityFilter_
ClusterRef cluster() const
const bool countStereoHitAs2D_
bool tidIsZMinusSide(const DetId &id) const
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
const int seedOnlyFromAbove_
double pt() const
track transverse momentum
auto recHits() const
Access to reconstructed hits on the track.
int charge() const
track electric charge
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...
const int minHitsinENDCAPplus_
const int minHitsinTECminus_
const int minHitsinENDCAPminus_
const double minHitChargeStrip_
Abs< T >::type abs(const T &t)
double phi() const
azimuthal angle of momentum vector
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const int minMultiplicity_
math::XYZPoint Point
point in the space
bool detailedHitsCheck(const reco::Track *track, const edm::Event &evt, const edm::EventSetup &eSetup) const
checking hit requirements beyond simple number of valid hits
std::vector< double > RorZofLastHitMin_
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
static constexpr auto TOB
edm::EDGetTokenT< AliClusterValueMap > clusterValueMapToken_
const char * qualities[3]
std::vector< double > RorZofFirstHitMin_
Log< level::Info, false > LogInfo
Detector identifier class for the strip tracker.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
double eta() const
pseudorapidity of momentum vector
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
static constexpr float d0
unsigned int pxfSide(const DetId &id) const
const int minHitsinENDCAP_
static TrackQuality qualityByName(const std::string &name)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
DetId geographicalId() const
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
const int minPrescaledHits_
constexpr uint32_t rawId() const
get the raw id
const edm::InputTag clusterValueMapTag_
bool isOkCharge(const TrackingRecHit *therechit) const
if valid, check for minimum charge (currently only in strip), if invalid give true ...
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
bool tecIsZPlusSide(const DetId &id) const
static constexpr auto TIB
bool isHit2D(const TrackingRecHit &hit) const
const bool applyBasicCuts_
bool isOkTrkQuality(const reco::Track *track) const
bool applyTrkQualityCheck_
SiStripRecHit2D originalHit() const
LocalPoint localPosition() const override
static TrackAlgorithm algoByName(const std::string &name)
SiStripRecHit2D monoHit() const
const int maxMultiplicity_
std::vector< double > RorZofLastHitMax_
const int minHitsinTIDminus_
Log< level::Warning, false > LogWarning
const math::XYZPoint & innerPosition() const
position of the innermost hit
ClusterRef cluster() const
AlignmentTrackSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
constructor
const bool applyPrescaledHitsFilter_
const bool multiplicityOnInput_
static constexpr auto TEC
bool useThisFilter()
returns if any of the Filters is used.
bool isOkChargeStripHit(const SiStripRecHit1D &siStripRecHit1D) const