Skip to content

Commit 8e150d4

Browse files
authored
Merge pull request cms-sw#40683 from fabferro/allBadPots_130
PPS pixel track reco in bad pots
2 parents cd4e36d + b71c4b7 commit 8e150d4

File tree

6 files changed

+96
-47
lines changed

6 files changed

+96
-47
lines changed

RecoPPS/Local/interface/RPixDetPatternFinder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class RPixDetPatternFinder {
3838
typedef std::vector<PointInPlane> Road;
3939

4040
void setHits(const edm::DetSetVector<CTPPSPixelRecHit> *hitVector) { hitVector_ = hitVector; }
41-
virtual void findPattern(bool isbadpot) = 0;
41+
virtual void findPattern(bool *is2planepot) = 0;
4242
void clear() { patternVector_.clear(); }
4343
std::vector<Road> const &getPatterns() const { return patternVector_; }
4444
void setGeometry(const CTPPSGeometry *geometry) { geometry_ = geometry; }

RecoPPS/Local/interface/RPixRoadFinder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RPixRoadFinder : public RPixDetPatternFinder {
3535
public:
3636
explicit RPixRoadFinder(const edm::ParameterSet &param);
3737
~RPixRoadFinder() override;
38-
void findPattern(bool isbadpot) override;
38+
void findPattern(bool *is2planepot) override;
3939

4040
private:
4141
int verbosity_;

RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ void CTPPSPixelLocalTrackProducer::fillDescriptions(edm::ConfigurationDescriptio
149149
desc.add<double>("roadRadius", 1.0)->setComment("radius of pattern search window");
150150
desc.add<int>("minRoadSize", 3)->setComment("minimum number of points in a pattern");
151151
desc.add<int>("maxRoadSize", 20)->setComment("maximum number of points in a pattern");
152-
//parameter for bad pot reconstruction patch 45-220-fr 2022
153-
desc.add<double>("roadRadiusBadPot", 0.5)->setComment("radius of pattern search window for bad Pot");
152+
//parameter for 2-plane-pot reconstruction patch in run 3
153+
desc.add<double>("roadRadiusBadPot", 0.5)->setComment("radius of pattern search window for 2 plane pot");
154154

155155
descriptions.add("ctppsPixelLocalTracks", desc);
156156
}
@@ -170,30 +170,62 @@ void CTPPSPixelLocalTrackProducer::produce(edm::Event &iEvent, const edm::EventS
170170
geometryWatcher_.check(iSetup);
171171

172172
// get mask
173-
bool isBadPot_45_220 = false;
173+
174+
// 2 planes pot flag vector 0=45-220, 1=45-210, 2=56-210, 3=56-220
175+
bool is2PlanePotV[4] = {false};
176+
174177
if (!recHits->empty()) {
175178
const auto &mask = iSetup.getData(tokenCTPPSPixelAnalysisMask_);
176179

177-
// Read Mask checking if 45-220-far is masked as bad and needs special treatment
180+
// Read Mask checking if 4 planes are masked and pot needs special treatment
178181
std::map<uint32_t, CTPPSPixelROCAnalysisMask> const &maschera = mask.analysisMask;
179182

180-
bool mask_45_220[6][6] = {{false}};
183+
// vector of masked rocs
184+
bool maskV[4][6][6] = {{{false}}};
185+
181186
for (auto const &det : maschera) {
182187
CTPPSPixelDetId detId(det.first);
183188
unsigned int rocNum = (det.first & rocMask) >> rocOffset;
184189
if (rocNum > 5 || detId.plane() > 5)
185190
throw cms::Exception("InvalidRocOrPlaneNumber") << "roc number from mask: " << rocNum;
186191

187-
if (detId.arm() == 0 && detId.station() == 2 && detId.rp() == 3) { // pot 45-220-far
188-
if (det.second.maskedPixels.size() == rocSizeInPixels) { // roc fully masked
189-
mask_45_220[detId.plane()][rocNum] = true;
192+
if (detId.arm() == 0 && detId.rp() == 3) {
193+
if (detId.station() == 2) { // pot 45-220-far
194+
if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask == true) { // roc fully masked
195+
maskV[0][detId.plane()][rocNum] = true;
196+
}
197+
} else if (detId.station() == 0) { // pot 45-210-far
198+
if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask == true) { // roc fully masked
199+
maskV[1][detId.plane()][rocNum] = true;
200+
}
201+
}
202+
} else if (detId.arm() == 1 && detId.rp() == 3) {
203+
if (detId.station() == 0) { // pot 56-210-far
204+
if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask == true) { // roc fully masked
205+
maskV[2][detId.plane()][rocNum] = true;
206+
}
207+
} else if (detId.station() == 2) { // pot 56-220-far
208+
if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask == true) { // roc fully masked
209+
maskV[3][detId.plane()][rocNum] = true;
210+
}
190211
}
191212
}
192213
}
214+
// search for specific pattern that requires special reconstruction (use of two plane tracks)
193215

194-
// search for specific pattern that requires special reconstruction (isBadPot)
195-
isBadPot_45_220 = mask_45_220[1][4] && mask_45_220[1][5] && mask_45_220[2][4] && mask_45_220[2][5] &&
196-
mask_45_220[3][4] && mask_45_220[3][5] && mask_45_220[4][4] && mask_45_220[4][5];
216+
for (unsigned int i = 0; i < 4; i++) {
217+
unsigned int numberOfMaskedPlanes = 0;
218+
for (unsigned int j = 0; j < 6; j++) {
219+
if (maskV[i][j][0] && maskV[i][j][1] && maskV[i][j][4] && maskV[i][j][5])
220+
numberOfMaskedPlanes++;
221+
}
222+
if (numberOfMaskedPlanes == 4)
223+
is2PlanePotV[i] = true; // search for exactly 4 planes fully masked
224+
edm::LogInfo("CTPPSPixelLocalTrackProducer") << " Masked planes in Pot #" << i << " = " << numberOfMaskedPlanes;
225+
if (is2PlanePotV[i])
226+
edm::LogInfo("CTPPSPixelLocalTrackProducer")
227+
<< " Enabling 2 plane track reconstruction for pot #" << i << " (0=45-220, 1=45-210, 2=56-210, 3=56-220) ";
228+
}
197229
}
198230
std::vector<CTPPSPixelDetId> listOfPotWithHighOccupancyPlanes;
199231
std::map<CTPPSPixelDetId, uint32_t> mapHitPerPot;
@@ -215,7 +247,7 @@ void CTPPSPixelLocalTrackProducer::produce(edm::Event &iEvent, const edm::EventS
215247
if (maxHitPerPlane_ >= 0 && hitOnPlane > (uint32_t)maxHitPerPlane_) {
216248
if (verbosity_ > 2)
217249
edm::LogInfo("CTPPSPixelLocalTrackProducer")
218-
<< " ---> To many hits in the plane, pot will be excluded from tracking cleared";
250+
<< " ---> Too many hits in the plane, pot will be excluded from tracking cleared";
219251
listOfPotWithHighOccupancyPlanes.push_back(tmpRomanPotId);
220252
}
221253
}
@@ -240,7 +272,7 @@ void CTPPSPixelLocalTrackProducer::produce(edm::Event &iEvent, const edm::EventS
240272
patternFinder_->clear();
241273
patternFinder_->setHits(&recHitVector);
242274
patternFinder_->setGeometry(&geometry);
243-
patternFinder_->findPattern(isBadPot_45_220);
275+
patternFinder_->findPattern(is2PlanePotV);
244276
std::vector<RPixDetPatternFinder::Road> patternVector = patternFinder_->getPatterns();
245277

246278
//loop on all the patterns

RecoPPS/Local/src/RPixDetClusterizer.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ void RPixDetClusterizer::buildClusters(unsigned int detId,
3333
std::map<uint32_t, CTPPSPixelROCAnalysisMask> const &mask = maskera->analysisMask;
3434
std::set<std::pair<unsigned char, unsigned char> > maskedPixels;
3535

36+
bool fullyMaskedRoc[6][6] = {{false}};
37+
CTPPSPixelDetId currentId(detId);
38+
3639
// read and store masked pixels after converting ROC numbering into module numbering
3740
CTPPSPixelIndices pI;
3841
for (auto const &det : mask) {
@@ -42,6 +45,8 @@ void RPixDetClusterizer::buildClusters(unsigned int detId,
4245
unsigned int rocNum = (det.first & rocMask) >> rocOffset;
4346
if (rocNum > 5)
4447
throw cms::Exception("InvalidRocNumber") << "roc number from mask: " << rocNum;
48+
if (det.second.fullMask)
49+
fullyMaskedRoc[currentId.plane()][rocNum] = true;
4550
for (auto const &paio : det.second.maskedPixels) {
4651
std::pair<unsigned char, unsigned char> pa = paio;
4752
int modCol, modRow;
@@ -76,7 +81,12 @@ void RPixDetClusterizer::buildClusters(unsigned int detId,
7681

7782
// check if pixel is noisy or dead (i.e. in the mask)
7883
const bool is_in = maskedPixels.find(pixel) != maskedPixels.end();
79-
if (!is_in) {
84+
85+
// check if pixel inside a fully masked roc
86+
int piano = currentId.plane();
87+
int rocId = pI.getROCId(column, row);
88+
89+
if (!is_in && !fullyMaskedRoc[piano][rocId]) {
8090
//calibrate digi and store the new ones
8191
electrons = calibrate(detId, adc, row, column, pcalibrations);
8292
if (electrons < SeedADCThreshold_ * ElectronADCGain_)

RecoPPS/Local/src/RPixPlaneCombinatoryTracking.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void RPixPlaneCombinatoryTracking::findTracks(int run) {
163163
//The loop stops when the number of planes with recorded hits is less than the minimum number of planes required
164164
//or if the track with minimum chiSquare found has a chiSquare higher than the maximum required
165165

166-
// bad Pot patch 45-220-fr 2022 -- beginning
166+
// bad Pot patch -- beginning
167167
// check number of hits in road
168168
unsigned int hitNum = 0;
169169
for (const auto &plane : *hitMap_) {
@@ -213,7 +213,7 @@ void RPixPlaneCombinatoryTracking::findTracks(int run) {
213213
// save track in collection
214214
localTrackVector_.push_back(track);
215215
}
216-
// bad Pot patch 45-220-fr 2022 -- end
216+
// bad Pot patch -- end
217217

218218
while (hitMap_->size() >= trackMinNumberOfPoints_) {
219219
if (verbosity_ >= 1)

RecoPPS/Local/src/RPixRoadFinder.cc

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ RPixRoadFinder::~RPixRoadFinder() {}
2929

3030
//------------------------------------------------------------------------------------------------//
3131

32-
void RPixRoadFinder::findPattern(bool isBadPot) {
32+
void RPixRoadFinder::findPattern(bool* is2PlanePot) {
3333
Road temp_all_hits;
34-
temp_all_hits.clear();
35-
36-
Road temp_all_hits_badPot;
37-
temp_all_hits_badPot.clear();
34+
Road temp_all_hits_2PlanePot[4];
3835

3936
// convert local hit sto global and push them to a vector
4037
for (const auto& ds_rh2 : *hitVector_) {
@@ -69,14 +66,19 @@ void RPixRoadFinder::findPattern(bool isBadPot) {
6966

7067
math::Error<3>::type globalError = ROOT::Math::SimilarityT(theRotationTMatrix, localError);
7168

72-
// create new collection for planes 0 and 5 of pot 45-220-fr
73-
74-
if (isBadPot == true && myid.arm() == 0 && myid.station() == 2 && localV.x() > 0 &&
75-
(myid.plane() == 0 || myid.plane() == 5)) { // 45-220-far
69+
// create new collections for bad (2 planes) and good pots
7670

77-
temp_all_hits_badPot.emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
71+
if (is2PlanePot[0] == true && myid.arm() == 0 && myid.station() == 2) { // 45-220
72+
temp_all_hits_2PlanePot[0].emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
73+
} else if (is2PlanePot[1] == true && myid.arm() == 0 && myid.station() == 0) { // 45-210
74+
temp_all_hits_2PlanePot[1].emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
75+
} else if (is2PlanePot[2] == true && myid.arm() == 1 && myid.station() == 0) { // 56-210
76+
temp_all_hits_2PlanePot[2].emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
77+
} else if (is2PlanePot[3] == true && myid.arm() == 1 && myid.station() == 2) { // 56-220
78+
temp_all_hits_2PlanePot[3].emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
79+
} else {
80+
temp_all_hits.emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
7881
}
79-
temp_all_hits.emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
8082
}
8183
}
8284

@@ -115,30 +117,35 @@ void RPixRoadFinder::findPattern(bool isBadPot) {
115117
}
116118
// end of algorithm
117119

118-
// badPot algorithm
119-
Road::iterator it_gh1_bP = temp_all_hits_badPot.begin();
120-
Road::iterator it_gh2_bP;
120+
// 2PlanePot algorithm
121121

122-
while (it_gh1_bP != temp_all_hits_badPot.end() && temp_all_hits_badPot.size() >= 2) {
123-
Road temp_road;
122+
for (unsigned int i = 0; i < 4; i++) {
123+
if (is2PlanePot[i]) {
124+
Road::iterator it_gh1_bP = temp_all_hits_2PlanePot[i].begin();
125+
Road::iterator it_gh2_bP;
124126

125-
it_gh2_bP = it_gh1_bP;
127+
while (it_gh1_bP != temp_all_hits_2PlanePot[i].end() && temp_all_hits_2PlanePot[i].size() >= 2) {
128+
Road temp_road;
126129

127-
const auto currPoint = it_gh1_bP->globalPoint;
130+
it_gh2_bP = it_gh1_bP;
128131

129-
while (it_gh2_bP != temp_all_hits_badPot.end()) {
130-
const auto subtraction = currPoint - it_gh2_bP->globalPoint;
132+
const auto currPoint = it_gh1_bP->globalPoint;
131133

132-
if (subtraction.Rho() < roadRadiusBadPot_) {
133-
temp_road.push_back(*it_gh2_bP);
134-
temp_all_hits_badPot.erase(it_gh2_bP);
135-
} else {
136-
++it_gh2_bP;
137-
}
138-
}
134+
while (it_gh2_bP != temp_all_hits_2PlanePot[i].end()) {
135+
const auto subtraction = currPoint - it_gh2_bP->globalPoint;
139136

140-
if (temp_road.size() == 2) { // look for isolated tracks
141-
patternVector_.push_back(temp_road);
137+
if (subtraction.Rho() < roadRadiusBadPot_) {
138+
temp_road.push_back(*it_gh2_bP);
139+
temp_all_hits_2PlanePot[i].erase(it_gh2_bP);
140+
} else {
141+
++it_gh2_bP;
142+
}
143+
}
144+
145+
if (temp_road.size() == 2) { // look for isolated tracks
146+
patternVector_.push_back(temp_road);
147+
}
148+
}
142149
}
143150
}
144151
}

0 commit comments

Comments
 (0)