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 if (!closestSimHit || fabs(simhitIt.localPosition().x() - localPosCluster.
x()) < minx) {
214 minx =
abs(simhitIt.localPosition().x() - localPosCluster.
x());
215 closestSimHit = &simhitIt;
225 auto simTrackIt(
simTracks.find(closestSimHit->trackId()));
229 Local3DPoint localPosSimHit(closestSimHit->localPosition());
230 const float deltaX = localPosCluster.
x() - localPosSimHit.x();
231 const float deltaY = localPosCluster.
y() - localPosSimHit.y();
233 auto layerMEit =
layerMEs_.find(folderkey);
266 edm::LogInfo(
"Phase2OTValidateCluster") <<
" Booking Histograms in: " << top_folder;
269 if (theTkDigiGeomWatcher.
check(iSetup)) {
275 uint32_t detId_raw = det_u->geographicalId().rawId();
285 edm::LogWarning(
"Phase2OTValidateCluster") <<
">>>> Invalid histo_id ";
334 std::vector<unsigned int> retvec;
336 if (DSViter == pixelSimLinks->end())
339 if (channel == it->channel()) {
340 retvec.push_back(it->SimTrackId());
354 psd0.
add<
std::string>(
"title",
"#Delta X " + mptag +
";Cluster resolution X dimension");
355 psd0.
add<
bool>(
"switch",
true);
356 psd0.
add<
double>(
"xmax", 5.0);
357 psd0.
add<
double>(
"xmin", -5.0);
358 psd0.
add<
int>(
"NxBins", 100);
364 psd0.
add<
std::string>(
"title",
"#Delta Y " + mptag +
";Cluster resolution Y dimension");
365 psd0.
add<
double>(
"xmin", -5.0);
366 psd0.
add<
bool>(
"switch",
true);
367 psd0.
add<
double>(
"xmax", 5.0);
368 psd0.
add<
int>(
"NxBins", 100);
374 psd0.
add<
std::string>(
"title",
"#Delta X " + mptag +
";cluster resolution X dimension");
375 psd0.
add<
double>(
"xmin", -5.0);
376 psd0.
add<
bool>(
"switch",
true);
377 psd0.
add<
double>(
"xmax", 5.0);
378 psd0.
add<
int>(
"NxBins", 100);
384 psd0.
add<
std::string>(
"title",
"#Delta Y " + mptag +
";cluster resolution Y dimension");
385 psd0.
add<
double>(
"xmin", -5.0);
386 psd0.
add<
bool>(
"switch",
true);
387 psd0.
add<
double>(
"xmax", 5.0);
388 psd0.
add<
int>(
"NxBins", 100);
396 psd0.
add<
std::string>(
"title",
"#Delta X " + striptag +
";Cluster resolution X dimension");
397 psd0.
add<
double>(
"xmin", -5.0);
398 psd0.
add<
bool>(
"switch",
true);
399 psd0.
add<
double>(
"xmax", 5.0);
400 psd0.
add<
int>(
"NxBins", 100);
406 psd0.
add<
std::string>(
"title",
"#Delta Y " + striptag +
";Cluster resolution Y dimension");
407 psd0.
add<
double>(
"xmin", -5.0);
408 psd0.
add<
bool>(
"switch",
true);
409 psd0.
add<
double>(
"xmax", 5.0);
410 psd0.
add<
int>(
"NxBins", 100);
416 psd0.
add<
std::string>(
"title",
"#Delta X " + striptag +
";Cluster resolution X dimension");
417 psd0.
add<
double>(
"xmin", -5.0);
418 psd0.
add<
bool>(
"switch",
true);
419 psd0.
add<
double>(
"xmax", 5.0);
420 psd0.
add<
int>(
"NxBins", 100);
426 psd0.
add<
std::string>(
"title",
"#Delta Y " + striptag +
";Cluster resolution Y dimension");
427 psd0.
add<
double>(
"xmin", -5.0);
428 psd0.
add<
bool>(
"switch",
true);
429 psd0.
add<
double>(
"xmax", 5.0);
430 psd0.
add<
int>(
"NxBins", 100);
437 desc.add<
double>(
"SimTrackMinPt", 0.0);
438 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
453 descriptions.
add(
"Phase2OTValidateCluster",
desc);