52 typedef std::map<unsigned int, std::vector<PSimHit>>
SimHitsMap;
76 const std::map<unsigned int, SimTrack>&
simTracks);
80 unsigned int channel);
104 simtrackminpt_(config_.getParameter<double>(
"SimTrackMinPt")),
106 config_.getParameter<
edm::
InputTag>(
"OuterTrackerDigiSimLinkSource"))),
113 edm::LogInfo(
"Phase2OTValidateCluster") <<
">>> Construct Phase2OTValidateCluster ";
115 simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
121 edm::LogInfo(
"Phase2OTValidateCluster") <<
">>> Destroy Phase2OTValidateCluster ";
137 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
140 iEvent.getByToken(itoken, simHitHandle);
143 simHits.emplace_back(simHitHandle);
151 for (edm::SimTrackContainer::const_iterator simTrackIt(simTracksRaw->begin()); simTrackIt != simTracksRaw->end();
154 simTracks.emplace(simTrackIt->trackId(), *simTrackIt);
162 const std::map<unsigned int, SimTrack>&
simTracks) {
172 std::map<std::string, unsigned int> nPrimarySimHits[3];
173 std::map<std::string, unsigned int> nOtherSimHits[3];
174 for (
const auto& DSVItr : *clusterHandle) {
176 uint32_t rawid = DSVItr.detId();
184 for (
const auto& clusterItr : DSVItr) {
186 Local3DPoint localPosCluster = geomDetUnit->topology().localPosition(mpCluster);
189 std::vector<unsigned int> clusterSimTrackIds;
190 for (
unsigned int i(0);
i < clusterItr.size(); ++
i) {
192 std::vector<unsigned int> simTrackIds(
getSimTrackId(pixelSimLinksHandle, detId, channel));
193 for (
auto it : simTrackIds) {
195 for (
unsigned int j = 0;
j < clusterSimTrackIds.size(); ++
j) {
197 if (it == clusterSimTrackIds.at(
j))
201 clusterSimTrackIds.push_back(it);
204 std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end());
205 const PSimHit* closestSimHit =
nullptr;
208 for (
const auto& psimhitCont :
simHits) {
209 for (
const auto& simhitIt : *psimhitCont) {
210 if (rawid == simhitIt.detUnitId()) {
211 auto it =
std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId());
212 if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) {
213 float dx = simhitIt.localPosition().x() - localPosCluster.
x();
214 float dy = simhitIt.localPosition().y() - localPosCluster.
y();
216 if (!closestSimHit || dist < mind) {
218 closestSimHit = &simhitIt;
228 auto simTrackIt(
simTracks.find(closestSimHit->trackId()));
232 Local3DPoint localPosSimHit(closestSimHit->localPosition());
233 const float deltaX = localPosCluster.
x() - localPosSimHit.x();
234 const float deltaY = localPosCluster.
y() - localPosSimHit.y();
236 auto layerMEit =
layerMEs_.find(folderkey);
269 edm::LogInfo(
"Phase2OTValidateCluster") <<
" Booking Histograms in: " << top_folder;
272 if (theTkDigiGeomWatcher.
check(iSetup)) {
278 uint32_t detId_raw = det_u->geographicalId().rawId();
288 edm::LogWarning(
"Phase2OTValidateCluster") <<
">>>> Invalid histo_id ";
337 std::vector<unsigned int> retvec;
339 if (DSViter == pixelSimLinks->end())
342 if (channel == it->channel()) {
343 retvec.push_back(it->SimTrackId());
357 psd0.
add<
std::string>(
"title",
"#Delta X " + mptag +
";Cluster resolution X coordinate [#mum]");
358 psd0.
add<
bool>(
"switch",
true);
359 psd0.
add<
double>(
"xmax", 250);
360 psd0.
add<
double>(
"xmin", -250);
361 psd0.
add<
int>(
"NxBins", 100);
367 psd0.
add<
std::string>(
"title",
"#Delta Y " + mptag +
";Cluster resolution Y coordinate [#mum]");
368 psd0.
add<
bool>(
"switch",
true);
369 psd0.
add<
double>(
"xmin", -1500);
370 psd0.
add<
double>(
"xmax", 1500);
371 psd0.
add<
int>(
"NxBins", 100);
377 psd0.
add<
std::string>(
"title",
"#Delta X " + mptag +
";cluster resolution X coordinate [#mum]");
378 psd0.
add<
bool>(
"switch",
true);
379 psd0.
add<
double>(
"xmin", -250);
380 psd0.
add<
double>(
"xmax", 250);
381 psd0.
add<
int>(
"NxBins", 100);
387 psd0.
add<
std::string>(
"title",
"#Delta Y " + mptag +
";cluster resolution Y coordinate [#mum]");
388 psd0.
add<
bool>(
"switch",
true);
389 psd0.
add<
double>(
"xmin", -500);
390 psd0.
add<
double>(
"xmax", 500);
391 psd0.
add<
int>(
"NxBins", 100);
399 psd0.
add<
std::string>(
"title",
"#Delta X " + striptag +
";Cluster resolution X coordinate [#mum]");
400 psd0.
add<
bool>(
"switch",
true);
401 psd0.
add<
double>(
"xmin", -250);
402 psd0.
add<
double>(
"xmax", 250);
403 psd0.
add<
int>(
"NxBins", 100);
409 psd0.
add<
std::string>(
"title",
"#Delta Y " + striptag +
";Cluster resolution Y coordinate [cm]");
410 psd0.
add<
double>(
"xmin", -5.0);
411 psd0.
add<
bool>(
"switch",
true);
412 psd0.
add<
double>(
"xmax", 5.0);
413 psd0.
add<
int>(
"NxBins", 100);
419 psd0.
add<
std::string>(
"title",
"#Delta X " + striptag +
";Cluster resolution X coordinate [#mum]");
420 psd0.
add<
bool>(
"switch",
true);
421 psd0.
add<
double>(
"xmin", -250);
422 psd0.
add<
double>(
"xmax", 250);
423 psd0.
add<
int>(
"NxBins", 100);
429 psd0.
add<
std::string>(
"title",
"#Delta Y " + striptag +
";Cluster resolution Y coordinate [cm]");
430 psd0.
add<
double>(
"xmin", -5.0);
431 psd0.
add<
bool>(
"switch",
true);
432 psd0.
add<
double>(
"xmax", 5.0);
433 psd0.
add<
int>(
"NxBins", 100);
440 desc.add<
double>(
"SimTrackMinPt", 0.0);
441 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
456 descriptions.
add(
"Phase2OTValidateCluster",
desc);