61 const std::map<unsigned int, SimTrack>& selectedSimTrackMap);
74 trackerHitAssociatorConfig_(iConfig, consumesCollector()),
75 simtrackminpt_(iConfig.getParameter<double>(
"SimTrackMinPt")),
78 edm::LogInfo(
"Phase2ITValidateRecHit") <<
">>> Construct Phase2ITValidateRecHit ";
85 edm::LogInfo(
"Phase2ITValidateRecHit") <<
">>> Destroy Phase2ITValidateRecHit ";
89 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
91 const auto& simHitHandle =
iEvent.getHandle(itoken);
92 if (!simHitHandle.isValid())
94 simHits.emplace_back(simHitHandle);
99 std::map<unsigned int, SimTrack> selectedSimTrackMap;
100 for (
const auto& simTrackIt : *
simTracks) {
102 selectedSimTrackMap.emplace(simTrackIt.trackId(), simTrackIt);
112 const std::map<unsigned int, SimTrack>& selectedSimTrackMap) {
117 std::map<std::string, unsigned int> nrechitLayerMap_primary;
119 for (
const auto& DSViter : *
rechits) {
121 unsigned int rawid(DSViter.detId());
125 if (nrechitLayerMap_primary.find(
key) == nrechitLayerMap_primary.end()) {
126 nrechitLayerMap_primary.emplace(
key, DSViter.size());
128 nrechitLayerMap_primary[
key] += DSViter.size();
131 for (
const auto& rechit : DSViter) {
133 const std::vector<SimHitIdpr>& matchedId = associateRecHit.
associateHitId(rechit);
134 const PSimHit* simhitClosest =
nullptr;
137 for (
const auto& simHitCol :
simHits) {
138 for (
const auto& simhitIt : *simHitCol) {
139 if (detId.rawId() != simhitIt.detUnitId())
141 for (
const auto& mId : matchedId) {
142 if (simhitIt.trackId() == mId.first) {
143 if (!simhitClosest ||
abs(simhitIt.localPosition().x() - lp.
x()) < minx) {
144 minx =
std::abs(simhitIt.localPosition().x() - lp.
x());
145 simhitClosest = &simhitIt;
155 fillRechitHistos(simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMap_primary);
161 for (
const auto& lme : nrechitLayerMap_primary) {
162 layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]);
174 desc.add<
bool>(
"associatePixel",
true);
175 desc.add<
bool>(
"associateStrip",
false);
176 desc.add<
bool>(
"usePhase2Tracker",
true);
177 desc.add<
bool>(
"associateRecoTracks",
false);
178 desc.add<
bool>(
"associateHitbySimTrack",
true);
180 desc.add<std::vector<std::string>>(
"ROUList",
182 "TrackerHitsPixelBarrelLowTof",
183 "TrackerHitsPixelBarrelHighTof",
184 "TrackerHitsPixelEndcapLowTof",
185 "TrackerHitsPixelEndcapHighTof",
190 desc.add<
double>(
"SimTrackMinPt", 2.0);
193 desc.add<
bool>(
"Verbosity",
false);
194 descriptions.
add(
"Phase2ITValidateRecHit",
desc);