Skip to content

Commit

Permalink
fix GeneralPurposeTrackAnalyzer in the phase-2 case, due to missing S…
Browse files Browse the repository at this point in the history
…iPixelFedCablingMap for Phase-2
  • Loading branch information
mmusich committed Sep 19, 2023
1 parent 83ab113 commit 907aba6
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
latencyToken_ = esConsumes<edm::Transition::BeginRun>();
}

coord_ = std::nullopt;
usesResource(TFileService::kSharedResource);

TkTag_ = pset.getParameter<edm::InputTag>("TkTag");
Expand Down Expand Up @@ -165,7 +166,7 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR

edm::ESHandle<MagneticField> magneticField_;

SiPixelCoordinates coord_;
std::optional<SiPixelCoordinates> coord_;

edm::Service<TFileService> fs;

Expand Down Expand Up @@ -391,11 +392,11 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
continue;
auto const &cluster = *clustp;
int row = cluster.x() - 0.5, col = cluster.y() - 0.5;
int rocId = coord_.roc(detId, std::make_pair(row, col));

if (phase_ == SiPixelPI::phase::zero) {
pmap->fill(detid_db, 1);
} else if (phase_ == SiPixelPI::phase::one) {
int rocId = coord_->roc(detId, std::make_pair(row, col));
rocsToMask.set(rocId);
pixelrocsmap_->fillSelectedRocs(detid_db, rocsToMask, 1);

Expand Down Expand Up @@ -775,12 +776,17 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
conditionsMap_[run.run()].first = mode;
conditionsMap_[run.run()].second = B_;

// if phase-2 return, there is no phase-2 implementation of SiPixelCoordinates
if (phase_ > SiPixelPI::phase::one)
return;

// init the sipixel coordinates
const TrackerTopology *trackerTopology = &setup.getData(trackerTopologyTokenBR_);
const SiPixelFedCablingMap *siPixelFedCablingMap = &setup.getData(siPixelFedCablingMapTokenBR_);

coord_ = coord_.value_or(SiPixelCoordinates());
// Pixel Phase-1 helper class
coord_.init(trackerTopology, trackerGeometry, siPixelFedCablingMap);
coord_->init(trackerTopology, trackerGeometry, siPixelFedCablingMap);
}

//*************************************************************
Expand Down

0 comments on commit 907aba6

Please sign in to comment.