New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PPS reco patch for bad pot #38553
PPS reco patch for bad pot #38553
Changes from all commits
08fa0d2
9805a7e
a17bb82
effefa3
f65b862
ad73f5a
f837c5f
04d1617
a34b07e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,15 @@ | |
#include "RecoPPS/Local/interface/RPixRoadFinder.h" | ||
#include "RecoPPS/Local/interface/RPixPlaneCombinatoryTracking.h" | ||
|
||
#include "CondFormats/PPSObjects/interface/CTPPSPixelAnalysisMask.h" | ||
#include "CondFormats/DataRecord/interface/CTPPSPixelAnalysisMaskRcd.h" | ||
|
||
namespace { | ||
constexpr int rocMask = 0xE000; | ||
constexpr int rocOffset = 13; | ||
constexpr int rocSizeInPixels = 4160; | ||
} // namespace | ||
|
||
class CTPPSPixelLocalTrackProducer : public edm::stream::EDProducer<> { | ||
public: | ||
explicit CTPPSPixelLocalTrackProducer(const edm::ParameterSet ¶meterSet); | ||
|
@@ -58,13 +67,16 @@ class CTPPSPixelLocalTrackProducer : public edm::stream::EDProducer<> { | |
edm::EDGetTokenT<edm::DetSetVector<CTPPSPixelRecHit>> tokenCTPPSPixelRecHit_; | ||
edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> tokenCTPPSGeometry_; | ||
edm::ESWatcher<VeryForwardRealGeometryRecord> geometryWatcher_; | ||
|
||
edm::ESGetToken<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd> tokenCTPPSPixelAnalysisMask_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be |
||
|
||
uint32_t numberOfPlanesPerPot_; | ||
std::vector<uint32_t> listOfAllPlanes_; | ||
|
||
std::unique_ptr<RPixDetPatternFinder> patternFinder_; | ||
std::unique_ptr<RPixDetTrackFinder> trackFinder_; | ||
|
||
void run(const edm::DetSetVector<CTPPSPixelRecHit> &input, edm::DetSetVector<CTPPSPixelLocalTrack> &output); | ||
// void run(const edm::DetSetVector<CTPPSPixelRecHit> &input, edm::DetSetVector<CTPPSPixelLocalTrack> &output); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete unused code |
||
}; | ||
|
||
//------------------------------------------------------------------------------------------------// | ||
|
@@ -106,6 +118,7 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS | |
|
||
tokenCTPPSPixelRecHit_ = consumes<edm::DetSetVector<CTPPSPixelRecHit>>(inputTag_); | ||
tokenCTPPSGeometry_ = esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>(); | ||
tokenCTPPSPixelAnalysisMask_ = esConsumes<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd>(); | ||
Comment on lines
119
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these should be moved to the constructor |
||
|
||
produces<edm::DetSetVector<CTPPSPixelLocalTrack>>(); | ||
} | ||
|
@@ -143,6 +156,9 @@ void CTPPSPixelLocalTrackProducer::fillDescriptions(edm::ConfigurationDescriptio | |
desc.add<double>("roadRadius", 1.0)->setComment("radius of pattern search window"); | ||
desc.add<int>("minRoadSize", 3)->setComment("minimum number of points in a pattern"); | ||
desc.add<int>("maxRoadSize", 20)->setComment("maximum number of points in a pattern"); | ||
//parameters for bad pot reconstruction patch 45-220-fr 2022 | ||
desc.add<double>("roadRadiusBadPot", 0.5)->setComment("radius of pattern search window for bad Pot"); | ||
// desc.add<bool>("isBadPot", true)->setComment("flag to enable road search for bad pot"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete |
||
|
||
descriptions.add("ctppsPixelLocalTracks", desc); | ||
} | ||
|
@@ -161,6 +177,32 @@ void CTPPSPixelLocalTrackProducer::produce(edm::Event &iEvent, const edm::EventS | |
const CTPPSGeometry &geometry = *geometryHandler; | ||
geometryWatcher_.check(iSetup); | ||
|
||
// get mask | ||
bool isBadPot_45_220 = false; | ||
if (!recHits->empty()) { | ||
const auto &mask = iSetup.getData(tokenCTPPSPixelAnalysisMask_); | ||
|
||
// Read Mask checking if 45-220-far is masked as bad and needs special treatment | ||
std::map<uint32_t, CTPPSPixelROCAnalysisMask> const &maschera = mask.analysisMask; | ||
|
||
bool mask_45_220[6][6] = {{false}}; | ||
for (auto const &det : maschera) { | ||
CTPPSPixelDetId detId(det.first); | ||
unsigned int rocNum = (det.first & rocMask) >> rocOffset; | ||
if (rocNum > 5 || detId.plane() > 5) | ||
throw cms::Exception("InvalidRocOrPlaneNumber") << "roc number from mask: " << rocNum; | ||
|
||
if (detId.arm() == 0 && detId.station() == 2 && detId.rp() == 3) { // pot 45-220-far | ||
if (det.second.maskedPixels.size() == rocSizeInPixels) { // roc fully masked | ||
mask_45_220[detId.plane()][rocNum] = true; | ||
} | ||
} | ||
} | ||
|
||
// search for specific pattern that requires special reconstruction (isBadPot) | ||
isBadPot_45_220 = mask_45_220[1][4] && mask_45_220[1][5] && mask_45_220[2][4] && mask_45_220[2][5] && | ||
mask_45_220[3][4] && mask_45_220[3][5] && mask_45_220[4][4] && mask_45_220[4][5]; | ||
} | ||
std::vector<CTPPSPixelDetId> listOfPotWithHighOccupancyPlanes; | ||
std::map<CTPPSPixelDetId, uint32_t> mapHitPerPot; | ||
|
||
|
@@ -206,7 +248,7 @@ void CTPPSPixelLocalTrackProducer::produce(edm::Event &iEvent, const edm::EventS | |
patternFinder_->clear(); | ||
patternFinder_->setHits(&recHitVector); | ||
patternFinder_->setGeometry(&geometry); | ||
patternFinder_->findPattern(); | ||
patternFinder_->findPattern(isBadPot_45_220); | ||
std::vector<RPixDetPatternFinder::Road> patternVector = patternFinder_->getPatterns(); | ||
|
||
//loop on all the patterns | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,11 @@ | |
# local track producer | ||
from RecoPPS.Local.ctppsPixelLocalTracks_cfi import ctppsPixelLocalTracks | ||
|
||
#from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 | ||
#from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 | ||
#from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 | ||
#(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelLocalTracks, isBadPot = cms.bool(False)) | ||
|
||
Comment on lines
+12
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete |
||
ctppsPixelLocalReconstructionTask = cms.Task( | ||
ctppsPixelClusters,ctppsPixelRecHits,ctppsPixelLocalTracks | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,6 @@ | |
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EDProducer.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
//needed for the geometry: | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
|
||
#include "TMath.h" | ||
#include "DataFormats/Math/interface/Error.h" | ||
|
@@ -31,6 +20,8 @@ RPixRoadFinder::RPixRoadFinder(edm::ParameterSet const& parameterSet) : RPixDetP | |
roadRadius_ = parameterSet.getParameter<double>("roadRadius"); | ||
minRoadSize_ = parameterSet.getParameter<int>("minRoadSize"); | ||
maxRoadSize_ = parameterSet.getParameter<int>("maxRoadSize"); | ||
roadRadiusBadPot_ = parameterSet.getParameter<double>("roadRadiusBadPot"); | ||
// isBadPot_ = parameterSet.getParameter<bool>("isBadPot"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. del |
||
} | ||
|
||
//------------------------------------------------------------------------------------------------// | ||
|
@@ -39,10 +30,13 @@ RPixRoadFinder::~RPixRoadFinder() {} | |
|
||
//------------------------------------------------------------------------------------------------// | ||
|
||
void RPixRoadFinder::findPattern() { | ||
void RPixRoadFinder::findPattern(bool isBadPot) { | ||
Road temp_all_hits; | ||
temp_all_hits.clear(); | ||
|
||
Road temp_all_hits_badPot; | ||
temp_all_hits_badPot.clear(); | ||
|
||
// convert local hit sto global and push them to a vector | ||
for (const auto& ds_rh2 : *hitVector_) { | ||
const auto myid = CTPPSPixelDetId(ds_rh2.id); | ||
|
@@ -75,6 +69,14 @@ void RPixRoadFinder::findPattern() { | |
theRotationTMatrix(2, 2)); | ||
|
||
math::Error<3>::type globalError = ROOT::Math::SimilarityT(theRotationTMatrix, localError); | ||
|
||
// create new collection for planes 0 and 5 of pot 45-220-fr | ||
|
||
if (isBadPot == true && myid.arm() == 0 && myid.station() == 2 && localV.x() > 0 && | ||
(myid.plane() == 0 || myid.plane() == 5)) { // 45-220-far | ||
|
||
temp_all_hits_badPot.emplace_back(PointInPlane{globalV, globalError, it_rh, myid}); | ||
} | ||
temp_all_hits.emplace_back(PointInPlane{globalV, globalError, it_rh, myid}); | ||
} | ||
} | ||
|
@@ -113,4 +115,31 @@ void RPixRoadFinder::findPattern() { | |
patternVector_.push_back(temp_road); | ||
} | ||
// end of algorithm | ||
|
||
// badPot algorithm | ||
Road::iterator it_gh1_bP = temp_all_hits_badPot.begin(); | ||
Road::iterator it_gh2_bP; | ||
|
||
while (it_gh1_bP != temp_all_hits_badPot.end() && temp_all_hits_badPot.size() >= 2) { | ||
Road temp_road; | ||
|
||
it_gh2_bP = it_gh1_bP; | ||
|
||
const auto currPoint = it_gh1_bP->globalPoint; | ||
|
||
while (it_gh2_bP != temp_all_hits_badPot.end()) { | ||
const auto subtraction = currPoint - it_gh2_bP->globalPoint; | ||
|
||
if (subtraction.Rho() < roadRadiusBadPot_) { | ||
temp_road.push_back(*it_gh2_bP); | ||
temp_all_hits_badPot.erase(it_gh2_bP); | ||
} else { | ||
++it_gh2_bP; | ||
} | ||
} | ||
|
||
if (temp_road.size() == 2) { // look for isolated tracks | ||
patternVector_.push_back(temp_road); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,16 @@ | |
import Validation.CTPPS.simu_config.year_$CONFIG_cff as config | ||
process.load("Validation.CTPPS.simu_config.year_$CONFIG_cff") | ||
|
||
process.load("CondCore.CondDB.CondDB_cfi") | ||
process.CondDB.connect = 'frontier://FrontierProd/CMS_CONDITIONS' | ||
process.PoolDBESSource = cms.ESSource("PoolDBESSource", | ||
process.CondDB, | ||
toGet = cms.VPSet(cms.PSet( | ||
record = cms.string('CTPPSPixelAnalysisMaskRcd'), | ||
tag = cms.string("CTPPSPixelAnalysisMask_Run3_v1_hlt") | ||
)) | ||
) | ||
Comment on lines
+12
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is fine for a test, but in the end the record will be provided from the GT, so this will be unnecessary |
||
|
||
# minimal logger settings | ||
process.MessageLogger = cms.Service("MessageLogger", | ||
statistics = cms.untracked.vstring(), | ||
|
@@ -63,4 +73,4 @@ | |
* process.ctppsLHCInfoPlotter | ||
* process.ctppsTrackDistributionPlotter | ||
* process.ctppsProtonReconstructionPlotter | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also should be deleted, if not needed