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);
T getParameter(std::string const &) const
std::map< unsigned int, std::vector< PSimHit > > SimHitsMap
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
~Phase2OTValidateCluster() override
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
static constexpr float cmtomicron
virtual void setCurrentFolder(std::string const &fullpath)
bool isPrimary(const SimTrack &simTrk, const PSimHit *simHit)
Phase2OTValidateCluster(const edm::ParameterSet &)
MonitorElement * deltaY_P
MonitorElement * deltaX_S_primary
std::map< unsigned int, SimTrack > SimTracksMap
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
MonitorElement * deltaX_P
std::vector< edm::InputTag > pSimHitSrc_
edm::ParameterSet config_
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
const TrackerGeometry * tkGeom_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simOTLinksToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
void fillOTHistos(const edm::Event &iEvent, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &simTracks)
const TrackerTopology * tTopo_
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
void bookLayerHistos(DQMStore::IBooker &ibooker, uint32_t det_it, const std::string &subdir)
ModuleType getDetectorType(DetId) const
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * book1DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
MonitorElement * deltaX_S
Log< level::Info, false > LogInfo
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
std::map< std::string, ClusterMEs > layerMEs_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * deltaX_P_primary
bool check(const edm::EventSetup &iSetup)
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
MonitorElement * deltaY_S
MonitorElement * deltaY_P_primary
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
MonitorElement * deltaY_S_primary
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNew > clustersToken_
std::vector< unsigned int > getSimTrackId(const edm::Handle< edm::DetSetVector< PixelDigiSimLink >> &pixelSimLinks, const DetId &detId, unsigned int channel)
Log< level::Warning, false > LogWarning
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simITLinksToken_
std::vector< SimTrack > SimTrackContainer