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);
std::map< std::string, ClusterMEs > layerMEs_
const TrackerGeometry * tkGeom_
T getParameter(std::string const &) const
std::vector< edm::InputTag > pSimHitSrc_
MonitorElement * deltaX_P_primary
MonitorElement * deltaX_P
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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)
const TrackerTopology * tTopo_
bool isPrimary(const SimTrack &simTrk, const PSimHit *simHit)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simITLinksToken_
MonitorElement * deltaY_P_primary
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::string getITHistoId(uint32_t det_id, const TrackerTopology *tTopo)
std::map< unsigned int, std::vector< PSimHit > > SimHitsMap
MonitorElement * deltaY_P
edm::ParameterSet config_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * book1DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
Log< level::Info, false > LogInfo
~Phase2ITValidateCluster() override
std::vector< unsigned int > getSimTrackId(const edm::Handle< edm::DetSetVector< PixelDigiSimLink >> &pixelSimLinks, const DetId &detId, unsigned int channel)
void fillITHistos(const edm::Event &iEvent, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &simTracks)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersToken_
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
bool check(const edm::EventSetup &iSetup)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Pixel cluster – collection of neighboring pixels above threshold.
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
std::map< unsigned int, SimTrack > SimTracksMap
static int pixelToChannel(int row, int col)
void bookLayerHistos(DQMStore::IBooker &ibooker, uint32_t det_it, const std::string &subdir)
Phase2ITValidateCluster(const edm::ParameterSet &)
Log< level::Warning, false > LogWarning
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
std::vector< SimTrack > SimTrackContainer
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override