61 const std::map<unsigned int, SimTrack>& selectedSimTrackMap);
75 trackerHitAssociatorConfig_(iConfig, consumesCollector()),
76 simtrackminpt_(iConfig.getParameter<double>(
"SimTrackMinPt")),
79 edm::LogInfo(
"Phase2OTValidateRecHit") <<
">>> Construct Phase2OTValidateRecHit ";
81 simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
90 edm::LogInfo(
"Phase2OTValidateRecHit") <<
">>> Destroy Phase2OTValidateRecHit ";
97 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
99 const auto& simHitHandle =
iEvent.getHandle(itoken);
100 if (!simHitHandle.isValid())
102 simHits.emplace_back(simHitHandle);
106 std::map<unsigned int, SimTrack> selectedSimTrackMap;
107 for (
const auto& simTrackIt : *
simTracks)
109 selectedSimTrackMap.insert(std::make_pair(simTrackIt.trackId(), simTrackIt));
118 const std::map<unsigned int, SimTrack>& selectedSimTrackMap) {
123 std::map<std::string, unsigned int> nrechitLayerMapP_primary;
124 std::map<std::string, unsigned int> nrechitLayerMapS_primary;
127 for (
const auto& DSViter : *
rechits) {
129 unsigned int rawid(DSViter.detId());
135 if (nrechitLayerMapP_primary.find(
key) == nrechitLayerMapP_primary.end()) {
136 nrechitLayerMapP_primary.insert(std::make_pair(
key, DSViter.size()));
138 nrechitLayerMapP_primary[
key] += DSViter.size();
141 if (nrechitLayerMapS_primary.find(
key) == nrechitLayerMapS_primary.end()) {
142 nrechitLayerMapS_primary.insert(std::make_pair(
key, DSViter.size()));
144 nrechitLayerMapS_primary[
key] += DSViter.size();
148 for (
const auto& rechit : DSViter) {
150 const std::vector<SimHitIdpr>& matchedId = associateRecHit.
associateHitId(rechit);
151 const PSimHit* simhitClosest =
nullptr;
154 for (
const auto& simHitCol :
simHits) {
155 for (
const auto& simhitIt : *simHitCol) {
156 if (detId.rawId() != simhitIt.detUnitId())
158 for (
auto& mId : matchedId) {
159 if (simhitIt.trackId() == mId.first) {
160 float dx = simhitIt.localPosition().x() - lp.
x();
161 float dy = simhitIt.localPosition().y() - lp.
y();
163 if (!simhitClosest || dist < mind) {
165 simhitClosest = &simhitIt;
174 simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMapP_primary, nrechitLayerMapS_primary);
181 for (
auto& lme : nrechitLayerMapP_primary) {
182 layerMEs_[lme.first].numberRecHitsprimary_P->Fill(nrechitLayerMapP_primary[lme.first]);
184 for (
auto& lme : nrechitLayerMapS_primary) {
185 layerMEs_[lme.first].numberRecHitsprimary_S->Fill(nrechitLayerMapS_primary[lme.first]);
197 desc.add<
bool>(
"associatePixel",
false);
199 desc.add<
bool>(
"associateHitbySimTrack",
true);
200 desc.add<
bool>(
"Verbosity",
false);
201 desc.add<
bool>(
"associateStrip",
true);
203 desc.add<
bool>(
"associateRecoTracks",
false);
205 desc.add<
bool>(
"usePhase2Tracker",
true);
208 desc.add<
double>(
"SimTrackMinPt", 2.0);
209 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
225 desc.add<std::vector<std::string>>(
"ROUList",
226 {
"TrackerHitsPixelBarrelLowTof",
227 "TrackerHitsPixelBarrelHighTof",
228 "TrackerHitsTIBLowTof",
229 "TrackerHitsTIBHighTof",
230 "TrackerHitsTIDLowTof",
231 "TrackerHitsTIDHighTof",
232 "TrackerHitsTOBLowTof",
233 "TrackerHitsTOBHighTof",
234 "TrackerHitsPixelEndcapLowTof",
235 "TrackerHitsPixelEndcapHighTof",
236 "TrackerHitsTECLowTof",
237 "TrackerHitsTECHighTof"});
239 descriptions.
add(
"Phase2OTValidateRecHit",
desc);