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 ";
133 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
136 iEvent.getByToken(itoken, simHitHandle);
139 simHits.emplace_back(simHitHandle);
147 for (edm::SimTrackContainer::const_iterator simTrackIt(simTracksRaw->begin()); simTrackIt != simTracksRaw->end();
150 simTracks.emplace(simTrackIt->trackId(), *simTrackIt);
158 const std::map<unsigned int, SimTrack>&
simTracks) {
167 for (
const auto& DSVItr : *clusterHandle) {
169 uint32_t rawid = DSVItr.detId();
176 for (
const auto& clusterItr : DSVItr) {
178 Local3DPoint localPosCluster = geomDetUnit->topology().localPosition(mpCluster);
180 std::vector<unsigned int> clusterSimTrackIds;
181 for (
int irow = clusterItr.minPixelRow(); irow <= clusterItr.maxPixelRow(); ++irow) {
182 for (
int icol = clusterItr.minPixelCol(); icol <= clusterItr.maxPixelCol(); ++icol) {
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);
197 std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end());
198 const PSimHit* closestSimHit =
nullptr;
201 for (
const auto& psimhitCont :
simHits) {
202 for (
const auto& simhitIt : *psimhitCont) {
203 if (rawid == simhitIt.detUnitId()) {
204 auto it =
std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId());
205 if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) {
206 float dx = simhitIt.localPosition().x() - localPosCluster.x();
207 float dy = simhitIt.localPosition().y() - localPosCluster.y();
209 if (!closestSimHit || dist < mind) {
211 closestSimHit = &simhitIt;
221 auto simTrackIt(
simTracks.find(closestSimHit->trackId()));
224 Local3DPoint localPosSimHit(closestSimHit->localPosition());
228 auto layerMEIt =
layerMEs_.find(folderkey);
251 edm::LogInfo(
"Phase2ITValidateCluster") <<
" Booking Histograms in: " << top_folder;
254 if (theTkDigiGeomWatcher.
check(iSetup)) {
260 uint32_t detId_raw = det_u->geographicalId().rawId();
270 edm::LogWarning(
"Phase2ITValidateCluster") <<
">>>> Invalid histo_id ";
300 std::vector<unsigned int> retvec;
302 if (DSViter == pixelSimLinks->end())
305 if (channel == it->channel()) {
306 retvec.push_back(it->SimTrackId());
318 psd0.
add<
std::string>(
"title",
"#Delta X;Cluster resolution X coordinate [#mum]");
319 psd0.
add<
bool>(
"switch",
true);
320 psd0.
add<
double>(
"xmax", 250.);
321 psd0.
add<
double>(
"xmin", -250.);
322 psd0.
add<
int>(
"NxBins", 100);
328 psd0.
add<
std::string>(
"title",
"#Delta Y ;Cluster resolution Y coordinate [#mum]");
329 psd0.
add<
double>(
"xmin", -250.);
330 psd0.
add<
double>(
"xmax", 250.);
331 psd0.
add<
bool>(
"switch",
true);
332 psd0.
add<
int>(
"NxBins", 100);
338 psd0.
add<
std::string>(
"title",
"#Delta X ;cluster resolution X coordinate [#mum]");
339 psd0.
add<
double>(
"xmin", -250.);
340 psd0.
add<
double>(
"xmax", 250.);
341 psd0.
add<
bool>(
"switch",
true);
342 psd0.
add<
int>(
"NxBins", 100);
348 psd0.
add<
std::string>(
"title",
"#Delta Y ;cluster resolution Y coordinate [#mum]");
349 psd0.
add<
double>(
"xmin", -250.);
350 psd0.
add<
double>(
"xmax", 250.);
351 psd0.
add<
bool>(
"switch",
true);
352 psd0.
add<
int>(
"NxBins", 100);
360 desc.add<
double>(
"SimTrackMinPt", 0.0);
361 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
368 descriptions.
add(
"Phase2ITValidateCluster",
desc);