Skip to content

Commit

Permalink
Matching in Validation and CondFormats packages
Browse files Browse the repository at this point in the history
  • Loading branch information
forthommel committed Oct 24, 2019
1 parent 0ebcc27 commit 761f06a
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CTPPSRPAlignmentCorrectionData CTPPSRPAlignmentCorrectionsData::getFullSensorCor
CTPPSRPAlignmentCorrectionData align_corr;

// try to get alignment correction of the full RP
auto rpIt = rps_.find(CTPPSDetId(id).getRPId());
auto rpIt = rps_.find(CTPPSDetId(id).rpId());
if (rpIt != rps_.end())
align_corr = rpIt->second;

Expand Down Expand Up @@ -132,4 +132,4 @@ std::ostream& operator<<(std::ostream& s, const CTPPSRPAlignmentCorrectionsData&
return s;
}

//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void CTPPSRPAlignmentCorrectionsMethods::writeXMLBlock(const CTPPSRPAlignmentCor

for (auto it = sensors.begin(); it != sensors.end(); ++it) {
CTPPSDetId sensorId(it->first);
unsigned int rpId = sensorId.getRPId();
unsigned int rpId = sensorId.rpId();
unsigned int decRPId = sensorId.arm() * 100 + sensorId.station() * 10 + sensorId.rp();

// start a RP block
Expand Down
2 changes: 1 addition & 1 deletion Validation/CTPPS/plugins/CTPPSAcceptancePlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void CTPPSAcceptancePlotter::analyze(const edm::Event &iEvent, const edm::EventS
// process tracks
map<unsigned int, bool> trackPresent;
for (const auto &trk : *hTracks) {
CTPPSDetId rpId(trk.getRPId());
CTPPSDetId rpId(trk.rpId());
unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
trackPresent[rpDecId] = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ void CTPPSDirectProtonSimulation::processProton(const HepMC::GenVertex* in_vtx,
continue;

// loop over all sensors in the RP
for (const auto& detIdInt : geometry.getSensorsInRP(rpId)) {
for (const auto& detIdInt : geometry.sensorsInRP(rpId)) {
CTPPSDetId detId(detIdInt);

// determine the track impact point (in global coordinates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ void CTPPSDirectProtonSimulationValidator::analyze(const edm::Event& iEvent, con

// process tracks
for (const auto& simuTrack : *simuTracks) {
const CTPPSDetId rpId(simuTrack.getRPId());
const CTPPSDetId rpId(simuTrack.rpId());
for (const auto& recoTrack : *recoTracks) {
if (simuTrack.getRPId() == recoTrack.getRPId()) {
if (simuTrack.rpId() == recoTrack.rpId()) {
unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
rpPlots_[rpDecId].fill(simuTrack.getX(), simuTrack.getY(), recoTrack.getX(), recoTrack.getY());
rpPlots_[rpDecId].fill(simuTrack.x(), simuTrack.y(), recoTrack.x(), recoTrack.y());
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions Validation/CTPPS/plugins/CTPPSProtonReconstructionPlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CTPPSProtonReconstructionPlotter : public edm::one::EDAnalyzer<> {

unsigned int n_tracking_RPs = 0, n_timing_RPs = 0;
for (const auto &tr : p.contributingLocalTracks()) {
CTPPSDetId detId(tr->getRPId());
CTPPSDetId detId(tr->rpId());
if (detId.subdetId() == CTPPSDetId::sdTrackingStrip || detId.subdetId() == CTPPSDetId::sdTrackingPixel)
n_tracking_RPs++;
if (detId.subdetId() == CTPPSDetId::sdTimingDiamond || detId.subdetId() == CTPPSDetId::sdTimingFastSilicon)
Expand Down Expand Up @@ -376,7 +376,7 @@ void CTPPSProtonReconstructionPlotter::analyze(const edm::Event &event, const ed
const CTPPSLocalTrackLite *tr_R_F = nullptr;

for (const auto &tr : *hTracks) {
CTPPSDetId rpId(tr.getRPId());
CTPPSDetId rpId(tr.rpId());
unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();

if (decRPId == rpId_45_N_)
Expand All @@ -390,25 +390,25 @@ void CTPPSProtonReconstructionPlotter::analyze(const edm::Event &event, const ed
}

if (tr_L_N && tr_L_F) {
p_x_L_diffNF_vs_x_L_N_->Fill(tr_L_N->getX(), tr_L_F->getX() - tr_L_N->getX());
p_y_L_diffNF_vs_y_L_N_->Fill(tr_L_N->getY(), tr_L_F->getY() - tr_L_N->getY());
p_x_L_diffNF_vs_x_L_N_->Fill(tr_L_N->x(), tr_L_F->x() - tr_L_N->x());
p_y_L_diffNF_vs_y_L_N_->Fill(tr_L_N->y(), tr_L_F->y() - tr_L_N->y());
}

if (tr_R_N && tr_R_F) {
p_x_R_diffNF_vs_x_R_N_->Fill(tr_R_N->getX(), tr_R_F->getX() - tr_R_N->getX());
p_y_R_diffNF_vs_y_R_N_->Fill(tr_R_N->getY(), tr_R_F->getY() - tr_R_N->getY());
p_x_R_diffNF_vs_x_R_N_->Fill(tr_R_N->x(), tr_R_F->x() - tr_R_N->x());
p_y_R_diffNF_vs_y_R_N_->Fill(tr_R_N->y(), tr_R_F->y() - tr_R_N->y());
}

// make single-RP-reco plots
for (const auto &proton : *hRecoProtonsSingleRP) {
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
singleRPPlots_[decRPId].fill(proton);
}

// make multi-RP-reco plots
for (const auto &proton : *hRecoProtonsMultiRP) {
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
unsigned int armId = rpId.arm();
multiRPPlots_[armId].fill(proton);
}
Expand All @@ -417,8 +417,8 @@ void CTPPSProtonReconstructionPlotter::analyze(const edm::Event &event, const ed
for (const auto &proton_s : *hRecoProtonsSingleRP) {
for (const auto &proton_m : *hRecoProtonsMultiRP) {
// only compare object from the same arm
CTPPSDetId rpId_s((*proton_s.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId_m((*proton_m.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId_s((*proton_s.contributingLocalTracks().begin())->rpId());
CTPPSDetId rpId_m((*proton_m.contributingLocalTracks().begin())->rpId());

if (rpId_s.arm() != rpId_m.arm())
continue;
Expand All @@ -436,7 +436,7 @@ void CTPPSProtonReconstructionPlotter::analyze(const edm::Event &event, const ed
const reco::ForwardProton *p_arm1_s_N = nullptr, *p_arm1_s_F = nullptr, *p_arm1_m = nullptr;

for (const auto &proton : *hRecoProtonsSingleRP) {
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
const unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();

if (rpDecId == rpId_45_N_)
Expand All @@ -451,7 +451,7 @@ void CTPPSProtonReconstructionPlotter::analyze(const edm::Event &event, const ed
}

for (const auto &proton : *hRecoProtonsMultiRP) {
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
const unsigned int arm = rpId.arm();

if (arm == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void CTPPSProtonReconstructionSimulationValidator::analyze(const edm::Event &iEv
if (rec_pr.method() == reco::ForwardProton::ReconstructionMethod::singleRP) {
meth_idx = 0;

CTPPSDetId rpId((*rec_pr.contributingLocalTracks().begin())->getRPId());
CTPPSDetId rpId((*rec_pr.contributingLocalTracks().begin())->rpId());
idx = 100 * rpId.arm() + 10 * rpId.station() + rpId.rp();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void CTPPSProtonReconstructionValidator::analyze(const edm::Event& iEvent, const
continue;

for (const auto& tr : pr.contributingLocalTracks()) {
CTPPSDetId rpId(tr->getRPId());
CTPPSDetId rpId(tr->rpId());
unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();

auto it = hOpticalFunctions->find(rpId);
Expand All @@ -111,8 +111,8 @@ void CTPPSProtonReconstructionValidator::analyze(const edm::Event& iEvent, const
LHCInterpolatedOpticalFunctionsSet::Kinematics k_out;
it->second.transport(k_in, k_out);

const double de_x = (k_out.x - k_out_beam.x) * 10. - tr->getX(); // conversions: cm --> mm
const double de_y = (k_out.y - k_out_beam.y) * 10. - tr->getY(); // conversions: cm --> mm
const double de_x = (k_out.x - k_out_beam.x) * 10. - tr->x(); // conversions: cm --> mm
const double de_y = (k_out.y - k_out_beam.y) * 10. - tr->y(); // conversions: cm --> mm

rp_plots_[rpDecId].fill(de_x, de_y);
}
Expand Down
10 changes: 5 additions & 5 deletions Validation/CTPPS/plugins/CTPPSTrackDistributionPlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ void CTPPSTrackDistributionPlotter::analyze(const edm::Event& iEvent, const edm:

// process tracks
for (const auto& trk : *tracks) {
CTPPSDetId rpId(trk.getRPId());
CTPPSDetId rpId(trk.rpId());
unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
rpPlots[rpDecId].fill(trk.getX(), trk.getY());
rpPlots[rpDecId].fill(trk.x(), trk.y());
}

for (const auto& t1 : *tracks) {
CTPPSDetId rpId1(t1.getRPId());
CTPPSDetId rpId1(t1.rpId());

for (const auto& t2 : *tracks) {
CTPPSDetId rpId2(t2.getRPId());
CTPPSDetId rpId2(t2.rpId());

if (rpId1.arm() != rpId2.arm())
continue;

if (rpId1.station() == 0 && rpId2.station() == 2)
armPlots[rpId1.arm()].fill(t1.getX(), t1.getY(), t2.getX(), t2.getY());
armPlots[rpId1.arm()].fill(t1.x(), t1.y(), t2.x(), t2.y());
}
}
}
Expand Down

0 comments on commit 761f06a

Please sign in to comment.