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 ";
135 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
137 const auto& simHitHandle =
iEvent.getHandle(itoken);
138 if (!simHitHandle.isValid())
140 simHits.emplace_back(simHitHandle);
146 for (edm::SimTrackContainer::const_iterator simTrackIt(simTracksRaw->begin()); simTrackIt != simTracksRaw->end();
149 simTracks.emplace(simTrackIt->trackId(), *simTrackIt);
157 const std::map<unsigned int, SimTrack>&
simTracks) {
164 std::map<std::string, unsigned int> nPrimarySimHits[3];
165 std::map<std::string, unsigned int> nOtherSimHits[3];
166 for (
const auto& DSVItr : *clusterHandle) {
168 uint32_t rawid = DSVItr.detId();
176 for (
const auto& clusterItr : DSVItr) {
178 Local3DPoint localPosCluster = geomDetUnit->topology().localPosition(mpCluster);
181 std::vector<unsigned int> clusterSimTrackIds;
182 for (
unsigned int i(0);
i < clusterItr.size(); ++
i) {
184 std::vector<unsigned int> simTrackIds(
getSimTrackId(pixelSimLinksHandle, detId, channel));
185 for (
auto it : simTrackIds) {
187 for (
unsigned int j = 0;
j < clusterSimTrackIds.size(); ++
j) {
189 if (it == clusterSimTrackIds.at(
j))
193 clusterSimTrackIds.push_back(it);
196 std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end());
197 const PSimHit* closestSimHit =
nullptr;
200 for (
const auto& psimhitCont :
simHits) {
201 for (
const auto& simhitIt : *psimhitCont) {
202 if (rawid == simhitIt.detUnitId()) {
203 auto it =
std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId());
204 if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) {
205 float dx = simhitIt.localPosition().x() - localPosCluster.
x();
206 float dy = simhitIt.localPosition().y() - localPosCluster.
y();
208 if (!closestSimHit || dist < mind) {
210 closestSimHit = &simhitIt;
220 auto simTrackIt(
simTracks.find(closestSimHit->trackId()));
224 Local3DPoint localPosSimHit(closestSimHit->localPosition());
225 const float deltaX = localPosCluster.
x() - localPosSimHit.x();
226 const float deltaY = localPosCluster.
y() - localPosSimHit.y();
228 auto layerMEit =
layerMEs_.find(folderkey);
261 edm::LogInfo(
"Phase2OTValidateCluster") <<
" Booking Histograms in: " << top_folder;
264 if (theTkDigiGeomWatcher.
check(iSetup)) {
270 uint32_t detId_raw = det_u->geographicalId().rawId();
280 edm::LogWarning(
"Phase2OTValidateCluster") <<
">>>> Invalid histo_id ";
329 std::vector<unsigned int> retvec;
331 if (DSViter == pixelSimLinks->end())
334 if (channel == it->channel()) {
335 retvec.push_back(it->SimTrackId());
349 psd0.
add<
std::string>(
"title",
"#Delta X " + mptag +
";Cluster resolution X coordinate [#mum]");
350 psd0.
add<
bool>(
"switch",
true);
351 psd0.
add<
double>(
"xmax", 250);
352 psd0.
add<
double>(
"xmin", -250);
353 psd0.
add<
int>(
"NxBins", 100);
359 psd0.
add<
std::string>(
"title",
"#Delta Y " + mptag +
";Cluster resolution Y coordinate [#mum]");
360 psd0.
add<
bool>(
"switch",
true);
361 psd0.
add<
double>(
"xmin", -1500);
362 psd0.
add<
double>(
"xmax", 1500);
363 psd0.
add<
int>(
"NxBins", 100);
369 psd0.
add<
std::string>(
"title",
"#Delta X " + mptag +
";cluster resolution X coordinate [#mum]");
370 psd0.
add<
bool>(
"switch",
true);
371 psd0.
add<
double>(
"xmin", -250);
372 psd0.
add<
double>(
"xmax", 250);
373 psd0.
add<
int>(
"NxBins", 100);
379 psd0.
add<
std::string>(
"title",
"#Delta Y " + mptag +
";cluster resolution Y coordinate [#mum]");
380 psd0.
add<
bool>(
"switch",
true);
381 psd0.
add<
double>(
"xmin", -1500);
382 psd0.
add<
double>(
"xmax", 1500);
383 psd0.
add<
int>(
"NxBins", 100);
391 psd0.
add<
std::string>(
"title",
"#Delta X " + striptag +
";Cluster resolution X coordinate [#mum]");
392 psd0.
add<
bool>(
"switch",
true);
393 psd0.
add<
double>(
"xmin", -250);
394 psd0.
add<
double>(
"xmax", 250);
395 psd0.
add<
int>(
"NxBins", 100);
401 psd0.
add<
std::string>(
"title",
"#Delta Y " + striptag +
";Cluster resolution Y coordinate [cm]");
402 psd0.
add<
double>(
"xmin", -5.0);
403 psd0.
add<
bool>(
"switch",
true);
404 psd0.
add<
double>(
"xmax", 5.0);
405 psd0.
add<
int>(
"NxBins", 100);
411 psd0.
add<
std::string>(
"title",
"#Delta X " + striptag +
";Cluster resolution X coordinate [#mum]");
412 psd0.
add<
bool>(
"switch",
true);
413 psd0.
add<
double>(
"xmin", -250);
414 psd0.
add<
double>(
"xmax", 250);
415 psd0.
add<
int>(
"NxBins", 100);
421 psd0.
add<
std::string>(
"title",
"#Delta Y " + striptag +
";Cluster resolution Y coordinate [cm]");
422 psd0.
add<
double>(
"xmin", -5.0);
423 psd0.
add<
bool>(
"switch",
true);
424 psd0.
add<
double>(
"xmax", 5.0);
425 psd0.
add<
int>(
"NxBins", 100);
432 desc.add<
double>(
"SimTrackMinPt", 0.0);
433 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
448 descriptions.
add(
"Phase2OTValidateCluster",
desc);