24
24
#include " DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
25
25
#include " DataFormats/TrackerCommon/interface/TrackerTopology.h"
26
26
#include " Geometry/Records/interface/IdealGeometryRecord.h"
27
+
28
+ #include < cmath>
29
+
27
30
const int kBPIX = PixelSubdetector::PixelBarrel;
28
31
const int kFPIX = PixelSubdetector::PixelEndcap;
29
32
@@ -81,6 +84,10 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet & cfg) :
81
84
minHitsinENDCAPminus_ (cfg.getParameter<edm::ParameterSet>( " minHitsPerSubDet" ).getParameter<int>( " inENDCAPminus" ) ),
82
85
maxHitDiffEndcaps_( cfg.getParameter<double >( " maxHitDiffEndcaps" ) ),
83
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" ) ),
84
91
clusterValueMapTag_(cfg.getParameter<edm::InputTag>(" hitPrescaleMapTag" )),
85
92
minPrescaledHits_( cfg.getParameter<int >(" minPrescaledHits" )),
86
93
applyPrescaledHitsFilter_(clusterValueMapTag_.encode().size() && minPrescaledHits_ > 0)
@@ -173,6 +180,47 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet & cfg) :
173
180
174
181
}
175
182
183
+ // Checking whether cuts on positions of first and last track hits are defined properly
184
+ if (RorZofFirstHitMin_.size () != 2 ){
185
+ throw cms::Exception (" BadConfig" ) << " @SUB=AlignmentTrackSelector::AlignmentTrackSelector"
186
+ << " Wrong configuration of 'RorZofFirstHitMin'."
187
+ << " Must have exactly 2 values instead of configured " << RorZofFirstHitMin_.size () << " )" ;
188
+ } else {
189
+ RorZofFirstHitMin_.at (0 )=std::fabs (RorZofFirstHitMin_.at (0 ));
190
+ RorZofFirstHitMin_.at (1 )=std::fabs (RorZofFirstHitMin_.at (1 ));
191
+ }
192
+ if (RorZofFirstHitMax_.size () != 2 ){
193
+ throw cms::Exception (" BadConfig" ) << " @SUB=AlignmentTrackSelector::AlignmentTrackSelector"
194
+ << " Wrong configuration of 'RorZofFirstHitMax'."
195
+ << " Must have exactly 2 values instead of configured " << RorZofFirstHitMax_.size () << " )" ;
196
+ } else {
197
+ RorZofFirstHitMax_.at (0 ) = std::fabs (RorZofFirstHitMax_.at (0 ));
198
+ RorZofFirstHitMax_.at (1 ) = std::fabs (RorZofFirstHitMax_.at (1 ));
199
+ }
200
+ if (RorZofLastHitMin_.size () != 2 ){
201
+ throw cms::Exception (" BadConfig" ) << " @SUB=AlignmentTrackSelector::AlignmentTrackSelector"
202
+ << " Wrong configuration of 'RorZofLastHitMin'."
203
+ << " Must have exactly 2 values instead of configured " << RorZofLastHitMin_.size () << " )" ;
204
+ } else {
205
+ RorZofLastHitMin_.at (0 ) = std::fabs (RorZofLastHitMin_.at (0 ));
206
+ RorZofLastHitMin_.at (1 ) = std::fabs (RorZofLastHitMin_.at (1 ));
207
+ }
208
+ if (RorZofLastHitMax_.size () != 2 ){
209
+ throw cms::Exception (" BadConfig" ) << " @SUB=AlignmentTrackSelector::AlignmentTrackSelector"
210
+ << " Wrong configuration of 'RorZofLastHitMax'."
211
+ << " Must have exactly 2 values instead of configured " << RorZofLastHitMax_.size () << " )" ;
212
+ } else {
213
+ RorZofLastHitMax_.at (0 ) = std::fabs (RorZofLastHitMax_.at (0 ));
214
+ RorZofLastHitMax_.at (1 ) = std::fabs (RorZofLastHitMax_.at (1 ));
215
+ }
216
+ // If first hit set to be at larger distance then the last hit
217
+ if (RorZofFirstHitMin_.at (0 ) > RorZofLastHitMax_.at (0 ) && RorZofFirstHitMin_.at (1 ) > RorZofLastHitMax_.at (1 )){
218
+ throw cms::Exception (" BadConfig" ) << " @SUB=AlignmentTrackSelector::AlignmentTrackSelector"
219
+ << " Position of the first hit is set to larger distance than the last hit:."
220
+ << " First hit(min): [" << RorZofFirstHitMin_.at (0 ) << " , " << RorZofFirstHitMin_.at (1 ) << " ]; Last hit(max): ["
221
+ << RorZofLastHitMax_.at (0 ) << " , " << RorZofLastHitMax_.at (1 ) << " ];" ;
222
+ }
223
+
176
224
}
177
225
178
226
// destructor -----------------------------------------------------------------
@@ -294,7 +342,8 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track *trackp, const
294
342
|| minHitsinFPIXplus_ || minHitsinFPIXminus_
295
343
|| minHitsinTECplus_ || minHitsinTECminus_
296
344
|| minHitsinFPIX_ || minHitsinBPIX_ || minHitsinPIX_ ||nHitMin2D_ || chargeCheck_
297
- || applyIsolation_ || (seedOnlyFromAbove_ == 1 || seedOnlyFromAbove_ == 2 )) {
345
+ || applyIsolation_ || (seedOnlyFromAbove_ == 1 || seedOnlyFromAbove_ == 2 )
346
+ || RorZofFirstHitMin_.size () > 0 || RorZofFirstHitMax_.size () > 0 || RorZofLastHitMin_.size () > 0 || RorZofLastHitMax_.size () > 0 ) {
298
347
// any detailed hit cut is active, so have to check
299
348
300
349
int nhitinTIB = 0 , nhitinTOB = 0 , nhitinTID = 0 ;
@@ -372,6 +421,40 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track *trackp, const
372
421
// Do not call isHit2D(..) if already enough 2D hits for performance reason:
373
422
if (nHit2D < nHitMin2D_ && this ->isHit2D (**iHit)) ++nHit2D;
374
423
} // end loop on hits
424
+
425
+
426
+ // Checking whether the track satisfies requirement of the first and last hit positions
427
+ bool passedLastHitPositionR = true ;
428
+ bool passedLastHitPositionZ = true ;
429
+ bool passedFirstHitPositionR = true ;
430
+ bool passedFirstHitPositionZ = true ;
431
+
432
+ if ( RorZofFirstHitMin_.at (0 ) != 0.0 || RorZofFirstHitMin_.at (1 ) != 0.0
433
+ || RorZofFirstHitMax_.at (0 ) != 999.0 || RorZofFirstHitMax_.at (1 ) != 999.0 ) {
434
+
435
+ const reco::TrackBase::Point firstPoint (trackp->innerPosition ());
436
+
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 ;
441
+ }
442
+
443
+ if ( RorZofLastHitMin_.at (0 ) != 0.0 || RorZofLastHitMin_.at (1 ) != 0.0
444
+ || RorZofLastHitMax_.at (0 ) != 999.0 || RorZofLastHitMax_.at (1 ) != 999.0 ) {
445
+
446
+ const reco::TrackBase::Point lastPoint (trackp->outerPosition ());
447
+
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 ;
452
+ }
453
+
454
+ bool passedFirstHitPosition = passedFirstHitPositionR || passedFirstHitPositionZ;
455
+ bool passedLastHitPosition = passedLastHitPositionR || passedLastHitPositionZ;
456
+
457
+
375
458
376
459
return (nhitinTIB >= minHitsinTIB_ && nhitinTOB >= minHitsinTOB_
377
460
&& nhitinTID >= minHitsinTID_ && nhitinTEC >= minHitsinTEC_
@@ -382,7 +465,7 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track *trackp, const
382
465
&& nhitinTECplus >= minHitsinTECplus_ && nhitinTECminus >= minHitsinTECminus_
383
466
&& nhitinBPIX >= minHitsinBPIX_
384
467
&& nhitinFPIX >= minHitsinFPIX_ && nhitinPIXEL>=minHitsinPIX_
385
- && nHit2D >= nHitMin2D_);
468
+ && nHit2D >= nHitMin2D_ && passedFirstHitPosition && passedLastHitPosition );
386
469
} else { // no cuts set, so we are just fine and can avoid loop on hits
387
470
return true ;
388
471
}
0 commit comments