51 typedef std::map<unsigned int, std::vector<PSimHit>>
SimHitsMap;
71 const std::map<unsigned int, SimTrack>&
simTracks);
75 unsigned int channel);
100 simtrackminpt_(config_.getParameter<double>(
"SimTrackMinPt")),
102 config_.getParameter<
edm::
InputTag>(
"InnerTrackerDigiSimLinkSource"))),
109 edm::LogInfo(
"Phase2ITValidateCluster") <<
">>> Construct Phase2ITValidateCluster ";
111 simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
117 edm::LogInfo(
"Phase2ITValidateCluster") <<
">>> Destroy Phase2ITValidateCluster ";
131 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
133 const auto& simHitHandle =
iEvent.getHandle(itoken);
134 if (!simHitHandle.isValid())
136 simHits.emplace_back(simHitHandle);
142 for (edm::SimTrackContainer::const_iterator simTrackIt(simTracksRaw->begin()); simTrackIt != simTracksRaw->end();
145 simTracks.emplace(simTrackIt->trackId(), *simTrackIt);
153 const std::map<unsigned int, SimTrack>&
simTracks) {
159 for (
const auto& DSVItr : *clusterHandle) {
161 uint32_t rawid = DSVItr.detId();
168 for (
const auto& clusterItr : DSVItr) {
170 Local3DPoint localPosCluster = geomDetUnit->topology().localPosition(mpCluster);
172 std::vector<unsigned int> clusterSimTrackIds;
173 for (
int irow = clusterItr.minPixelRow(); irow <= clusterItr.maxPixelRow(); ++irow) {
174 for (
int icol = clusterItr.minPixelCol(); icol <= clusterItr.maxPixelCol(); ++icol) {
176 std::vector<unsigned int> simTrackIds(
getSimTrackId(pixelSimLinksHandle, detId, channel));
177 for (
auto it : simTrackIds) {
179 for (
unsigned int j = 0;
j < clusterSimTrackIds.size(); ++
j) {
181 if (it == clusterSimTrackIds.at(
j))
185 clusterSimTrackIds.push_back(it);
189 std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end());
190 const PSimHit* closestSimHit =
nullptr;
193 for (
const auto& psimhitCont :
simHits) {
194 for (
const auto& simhitIt : *psimhitCont) {
195 if (rawid == simhitIt.detUnitId()) {
196 auto it =
std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId());
197 if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) {
198 float dx = simhitIt.localPosition().x() - localPosCluster.x();
199 float dy = simhitIt.localPosition().y() - localPosCluster.y();
201 if (!closestSimHit || dist < mind) {
203 closestSimHit = &simhitIt;
213 auto simTrackIt(
simTracks.find(closestSimHit->trackId()));
216 Local3DPoint localPosSimHit(closestSimHit->localPosition());
220 auto layerMEIt =
layerMEs_.find(folderkey);
243 edm::LogInfo(
"Phase2ITValidateCluster") <<
" Booking Histograms in: " << top_folder;
246 if (theTkDigiGeomWatcher.
check(iSetup)) {
252 uint32_t detId_raw = det_u->geographicalId().rawId();
262 edm::LogWarning(
"Phase2ITValidateCluster") <<
">>>> Invalid histo_id ";
292 std::vector<unsigned int> retvec;
294 if (DSViter == pixelSimLinks->end())
297 if (channel == it->channel()) {
298 retvec.push_back(it->SimTrackId());
310 psd0.
add<
std::string>(
"title",
"#Delta X;Cluster resolution X coordinate [#mum]");
311 psd0.
add<
bool>(
"switch",
true);
312 psd0.
add<
double>(
"xmax", 250.);
313 psd0.
add<
double>(
"xmin", -250.);
314 psd0.
add<
int>(
"NxBins", 100);
320 psd0.
add<
std::string>(
"title",
"#Delta Y ;Cluster resolution Y coordinate [#mum]");
321 psd0.
add<
double>(
"xmin", -250.);
322 psd0.
add<
double>(
"xmax", 250.);
323 psd0.
add<
bool>(
"switch",
true);
324 psd0.
add<
int>(
"NxBins", 100);
330 psd0.
add<
std::string>(
"title",
"#Delta X ;cluster resolution X coordinate [#mum]");
331 psd0.
add<
double>(
"xmin", -250.);
332 psd0.
add<
double>(
"xmax", 250.);
333 psd0.
add<
bool>(
"switch",
true);
334 psd0.
add<
int>(
"NxBins", 100);
340 psd0.
add<
std::string>(
"title",
"#Delta Y ;cluster resolution Y coordinate [#mum]");
341 psd0.
add<
double>(
"xmin", -250.);
342 psd0.
add<
double>(
"xmax", 250.);
343 psd0.
add<
bool>(
"switch",
true);
344 psd0.
add<
int>(
"NxBins", 100);
352 desc.add<
double>(
"SimTrackMinPt", 0.0);
353 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
360 descriptions.
add(
"Phase2ITValidateCluster",
desc);