Skip to content
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 clean code for bad pot #38740

Merged
merged 4 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion RecoPPS/Local/interface/RPixRoadFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class RPixRoadFinder : public RPixDetPatternFinder {
unsigned int minRoadSize_;
unsigned int maxRoadSize_;
double roadRadiusBadPot_;
// bool isBadPot_;
void run(const edm::DetSetVector<CTPPSPixelRecHit> &input, const CTPPSGeometry &geometry, std::vector<Road> &roads);
};

Expand Down
54 changes: 23 additions & 31 deletions RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,41 +57,40 @@ class CTPPSPixelLocalTrackProducer : public edm::stream::EDProducer<> {
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);

private:
int verbosity_;
int maxHitPerPlane_;
int maxHitPerRomanPot_;
int maxTrackPerRomanPot_;
int maxTrackPerPattern_;

edm::InputTag inputTag_;
edm::EDGetTokenT<edm::DetSetVector<CTPPSPixelRecHit>> tokenCTPPSPixelRecHit_;
edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> tokenCTPPSGeometry_;
const int verbosity_;
const int maxHitPerPlane_;
const int maxHitPerRomanPot_;
const int maxTrackPerRomanPot_;
const int maxTrackPerPattern_;

const edm::EDGetTokenT<edm::DetSetVector<CTPPSPixelRecHit>> tokenCTPPSPixelRecHit_;
const edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> tokenCTPPSGeometry_;
edm::ESWatcher<VeryForwardRealGeometryRecord> geometryWatcher_;

edm::ESGetToken<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd> tokenCTPPSPixelAnalysisMask_;
const edm::ESGetToken<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd> tokenCTPPSPixelAnalysisMask_;

uint32_t numberOfPlanesPerPot_;
std::vector<uint32_t> listOfAllPlanes_;
const uint32_t numberOfPlanesPerPot_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @fabferro
To be fully compliant with the CMS style, since this is not a class member any more, you should remove the trailing underscore from the name.
Moreover, I'd move this definition right before when it is used, i.e before L103

(I know, this is not fundamental... But since tests weren't started yet, I think you can finish the cleaning before we launch them)


std::unique_ptr<RPixDetPatternFinder> patternFinder_;
std::unique_ptr<RPixDetTrackFinder> trackFinder_;

// void run(const edm::DetSetVector<CTPPSPixelRecHit> &input, edm::DetSetVector<CTPPSPixelLocalTrack> &output);
};

//------------------------------------------------------------------------------------------------//

CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterSet &parameterSet) {
inputTag_ = parameterSet.getParameter<edm::InputTag>("tag");
verbosity_ = parameterSet.getUntrackedParameter<int>("verbosity");
maxHitPerRomanPot_ = parameterSet.getParameter<int>("maxHitPerRomanPot");
maxHitPerPlane_ = parameterSet.getParameter<int>("maxHitPerPlane");
maxTrackPerRomanPot_ = parameterSet.getParameter<int>("maxTrackPerRomanPot");
maxTrackPerPattern_ = parameterSet.getParameter<int>("maxTrackPerPattern");
numberOfPlanesPerPot_ = parameterSet.getParameter<int>("numberOfPlanesPerPot");

CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterSet &parameterSet)
: verbosity_(parameterSet.getUntrackedParameter<int>("verbosity")),
maxHitPerPlane_(parameterSet.getParameter<int>("maxHitPerPlane")),
maxHitPerRomanPot_(parameterSet.getParameter<int>("maxHitPerRomanPot")),
maxTrackPerRomanPot_(parameterSet.getParameter<int>("maxTrackPerRomanPot")),
maxTrackPerPattern_(parameterSet.getParameter<int>("maxTrackPerPattern")),
tokenCTPPSPixelRecHit_(
consumes<edm::DetSetVector<CTPPSPixelRecHit>>(parameterSet.getParameter<edm::InputTag>("tag"))),
tokenCTPPSGeometry_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>()),
tokenCTPPSPixelAnalysisMask_(esConsumes<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd>()),
numberOfPlanesPerPot_(parameterSet.getParameter<int>("numberOfPlanesPerPot")) {
std::string patternFinderAlgorithm = parameterSet.getParameter<std::string>("patternFinderAlgorithm");
std::string trackFitterAlgorithm = parameterSet.getParameter<std::string>("trackFinderAlgorithm");
std::vector<uint32_t> listOfAllPlanes_;

// pattern algorithm selector
if (patternFinderAlgorithm == "RPixRoadFinder") {
Expand All @@ -101,7 +100,6 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS
<< "Pattern finder algorithm" << patternFinderAlgorithm << " does not exist";
}

listOfAllPlanes_.reserve(6);
for (uint32_t i = 0; i < numberOfPlanesPerPot_; ++i) {
listOfAllPlanes_.push_back(i);
}
Expand All @@ -115,11 +113,6 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS
}
trackFinder_->setListOfPlanes(listOfAllPlanes_);
trackFinder_->initialize();

tokenCTPPSPixelRecHit_ = consumes<edm::DetSetVector<CTPPSPixelRecHit>>(inputTag_);
tokenCTPPSGeometry_ = esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>();
tokenCTPPSPixelAnalysisMask_ = esConsumes<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd>();

produces<edm::DetSetVector<CTPPSPixelLocalTrack>>();
}

Expand Down Expand Up @@ -156,9 +149,8 @@ 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
//parameter 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");

descriptions.add("ctppsPixelLocalTracks", desc);
}
Expand Down
5 changes: 1 addition & 4 deletions RecoPPS/Local/python/ctppsPixelLocalReconstruction_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
# 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))


ctppsPixelLocalReconstructionTask = cms.Task(
ctppsPixelClusters,ctppsPixelRecHits,ctppsPixelLocalTracks
Expand Down
1 change: 0 additions & 1 deletion RecoPPS/Local/src/RPixRoadFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RPixRoadFinder::RPixRoadFinder(edm::ParameterSet const& parameterSet) : RPixDetP
minRoadSize_ = parameterSet.getParameter<int>("minRoadSize");
maxRoadSize_ = parameterSet.getParameter<int>("maxRoadSize");
roadRadiusBadPot_ = parameterSet.getParameter<double>("roadRadiusBadPot");
// isBadPot_ = parameterSet.getParameter<bool>("isBadPot");
}

//------------------------------------------------------------------------------------------------//
Expand Down