Skip to content

Commit 69e5a23

Browse files
committed
Merge pull request cms-sw#2333 from mschrode/LABPinTkAl_71X
Alignment/CommonAlignmentProducer -- Update on Lorentz-Anlge and Backplane correction related developments (7_1_X)
2 parents 42011e2 + a8bb4e4 commit 69e5a23

File tree

4 files changed

+105
-2
lines changed

4 files changed

+105
-2
lines changed

Alignment/CommonAlignmentProducer/bin/aligncond_split_iov.cc

+12
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "CondFormats/Alignment/interface/Alignments.h"
2727
#include "CondFormats/Alignment/interface/AlignmentErrors.h"
2828
#include "CondFormats/Alignment/interface/AlignmentSurfaceDeformations.h"
29+
#include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h"
30+
#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
31+
#include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h"
2932

3033
#include <iterator>
3134
#include <iostream>
@@ -131,6 +134,15 @@ int cond::AlignSplitIOV::execute()
131134
else if (payloadContainerName=="AlignmentSurfaceDeformations")
132135
objToken = processPayloadContainer<AlignmentSurfaceDeformations>(sourcedb, destdb,
133136
ioviterator->token(), payloadContainerName);
137+
else if (payloadContainerName=="SiPixelLorentzAngle")
138+
objToken = processPayloadContainer<SiPixelLorentzAngle>(sourcedb, destdb,
139+
ioviterator->token(), payloadContainerName);
140+
else if (payloadContainerName=="SiStripLorentzAngle")
141+
objToken = processPayloadContainer<SiStripLorentzAngle>(sourcedb, destdb,
142+
ioviterator->token(), payloadContainerName);
143+
else if (payloadContainerName=="SiStripBackPlaneCorrection")
144+
objToken = processPayloadContainer<SiStripBackPlaneCorrection>(sourcedb, destdb,
145+
ioviterator->token(), payloadContainerName);
134146
else {
135147
return 1;
136148
}

Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ class AlignmentTrackSelector
8181
const int minHitsinENDCAP_, minHitsinENDCAPplus_, minHitsinENDCAPminus_;
8282
const double maxHitDiffEndcaps_;
8383
const double nLostHitMax_;
84+
std::vector<double> RorZofFirstHitMin_;
85+
std::vector<double> RorZofFirstHitMax_;
86+
std::vector<double> RorZofLastHitMin_;
87+
std::vector<double> RorZofLastHitMax_;
8488

8589
const edm::InputTag clusterValueMapTag_; // ValueMap containing association cluster - flag
8690
const int minPrescaledHits_;

Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
nHitMax = cms.double(999.0),
2727
nLostHitMax = cms.double(999.0),
2828
nHitMin2D = cms.uint32(0),
29+
RorZofFirstHitMin = cms.vdouble(0.0,0.0),
30+
RorZofFirstHitMax = cms.vdouble(999.0,999.0),
31+
RorZofLastHitMin = cms.vdouble(0.0,0.0),
32+
RorZofLastHitMax = cms.vdouble(999.0,999.0),
2933
countStereoHitAs2D = cms.bool(True),
3034
minHitsPerSubDet = cms.PSet(
3135
inTEC = cms.int32(0),

Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc

+85-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
2525
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
2626
#include "Geometry/Records/interface/IdealGeometryRecord.h"
27+
28+
#include <cmath>
29+
2730
const int kBPIX = PixelSubdetector::PixelBarrel;
2831
const int kFPIX = PixelSubdetector::PixelEndcap;
2932

@@ -81,6 +84,10 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet & cfg) :
8184
minHitsinENDCAPminus_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inENDCAPminus" ) ),
8285
maxHitDiffEndcaps_( cfg.getParameter<double>( "maxHitDiffEndcaps" ) ),
8386
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" ) ),
8491
clusterValueMapTag_(cfg.getParameter<edm::InputTag>("hitPrescaleMapTag")),
8592
minPrescaledHits_( cfg.getParameter<int>("minPrescaledHits")),
8693
applyPrescaledHitsFilter_(clusterValueMapTag_.encode().size() && minPrescaledHits_ > 0)
@@ -173,6 +180,47 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet & cfg) :
173180

174181
}
175182

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+
176224
}
177225

178226
// destructor -----------------------------------------------------------------
@@ -294,7 +342,8 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track *trackp, const
294342
|| minHitsinFPIXplus_ || minHitsinFPIXminus_
295343
|| minHitsinTECplus_ || minHitsinTECminus_
296344
|| 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 ) {
298347
// any detailed hit cut is active, so have to check
299348

300349
int nhitinTIB = 0, nhitinTOB = 0, nhitinTID = 0;
@@ -372,6 +421,40 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track *trackp, const
372421
// Do not call isHit2D(..) if already enough 2D hits for performance reason:
373422
if (nHit2D < nHitMin2D_ && this->isHit2D(**iHit)) ++nHit2D;
374423
} // 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+
375458

376459
return (nhitinTIB >= minHitsinTIB_ && nhitinTOB >= minHitsinTOB_
377460
&& nhitinTID >= minHitsinTID_ && nhitinTEC >= minHitsinTEC_
@@ -382,7 +465,7 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track *trackp, const
382465
&& nhitinTECplus >= minHitsinTECplus_ && nhitinTECminus >= minHitsinTECminus_
383466
&& nhitinBPIX >= minHitsinBPIX_
384467
&& nhitinFPIX >= minHitsinFPIX_ && nhitinPIXEL>=minHitsinPIX_
385-
&& nHit2D >= nHitMin2D_);
468+
&& nHit2D >= nHitMin2D_ && passedFirstHitPosition && passedLastHitPosition);
386469
} else { // no cuts set, so we are just fine and can avoid loop on hits
387470
return true;
388471
}

0 commit comments

Comments
 (0)