CMS 3D CMS Logo

SiPixelMonitorRecHitsSoAAlpaka.cc
Go to the documentation of this file.
18 
19 template <typename T>
21 public:
23 
25  ~SiPixelMonitorRecHitsSoAAlpaka() override = default;
26  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
27  void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
28  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
29  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
30 
31 private:
36  const TrackerGeometry* tkGeom_ = nullptr;
37  const TrackerTopology* tTopo_ = nullptr;
46  MonitorElement* hBposZPL[4]; // max 4 barrel hits
55  MonitorElement* hFposXYD[2][12]; // max 12 endcap disks
59 };
60 
61 //
62 // constructors
63 //
64 template <typename T>
67  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()),
68  tokenSoAHits_(consumes(iConfig.getParameter<edm::InputTag>("pixelHitsSrc"))),
69  topFolderName_(iConfig.getParameter<std::string>("TopFolderName")) {}
70 
71 //
72 // Begin Run
73 //
74 template <typename T>
76  tkGeom_ = &iSetup.getData(geomToken_);
77  tTopo_ = &iSetup.getData(topoToken_);
78 }
79 
80 //
81 // -- Analyze
82 //
83 template <typename T>
85  const auto& rhsoaHandle = iEvent.getHandle(tokenSoAHits_);
86  if (!rhsoaHandle.isValid()) {
87  edm::LogWarning("SiPixelMonitorRecHitsSoAAlpaka") << "No RecHits SoA found \n returning!";
88  return;
89  }
90  auto const& rhsoa = *rhsoaHandle;
91  auto const& soa2d = rhsoa.const_view();
92 
93  uint32_t nHits_ = soa2d.metadata().size();
94  hnHits->Fill(nHits_);
95  auto detIds = tkGeom_->detUnitIds();
96  for (uint32_t i = 0; i < nHits_; i++) {
97  DetId id = detIds[soa2d[i].detectorIndex()];
98  float xG = soa2d[i].xGlobal();
99  float yG = soa2d[i].yGlobal();
100  float zG = soa2d[i].zGlobal();
101  float rG = soa2d[i].rGlobal();
102  float fphi = short2phi(soa2d[i].iphi());
103  uint32_t charge = soa2d[i].chargeAndStatus().charge;
104  int16_t sizeX = std::ceil(float(std::abs(soa2d[i].clusterSizeX()) / 8.));
105  int16_t sizeY = std::ceil(float(std::abs(soa2d[i].clusterSizeY()) / 8.));
106  hBFposZP->Fill(zG, fphi);
107  int16_t ysign = yG >= 0 ? 1 : -1;
108  hBFposZR->Fill(zG, rG * ysign);
109  switch (id.subdetId()) {
111  hBposXY->Fill(xG, yG);
112  hBposZP->Fill(zG, fphi);
113  hBcharge->Fill(charge);
114  hBsizex->Fill(sizeX);
115  hBsizey->Fill(sizeY);
116  hBposZPL[tTopo_->pxbLayer(id) - 1]->Fill(zG, fphi);
117  hBchargeL[tTopo_->pxbLayer(id) - 1]->Fill(charge);
118  hBsizexL[tTopo_->pxbLayer(id) - 1]->Fill(sizeX);
119  hBsizeyL[tTopo_->pxbLayer(id) - 1]->Fill(sizeY);
120  break;
122  hFposXY->Fill(xG, yG);
123  hFposZP->Fill(zG, fphi);
124  hFcharge->Fill(charge);
125  hFsizex->Fill(sizeX);
126  hFsizey->Fill(sizeY);
127  hFposXYD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(xG, yG);
128  hFchargeD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(charge);
129  hFsizexD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(sizeX);
130  hFsizeyD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(sizeY);
131  break;
132  }
133  }
134 }
135 
136 //
137 // -- Book Histograms
138 //
139 template <typename T>
141  edm::Run const& iRun,
142  edm::EventSetup const& iSetup) {
143  iBook.cd();
144  iBook.setCurrentFolder(topFolderName_);
145 
146  // clang-format off
147  //Global
148  hnHits = iBook.book1D("nHits", "RecHits per event;RecHits;#events", 200, 0, 5000);
149  hBFposZP = iBook.book2D("recHitsGlobalPosZP", "RecHits position Global;Z;#phi", 1000, -60, 60, 200,-3.2,3.2);
150  hBFposZR = iBook.book2D("recHitsGlobalPosZR", "RecHits position Global;Z;R", 1000, -60, 60, 200,-20,20);
151  //Barrel
152  hBposXY = iBook.book2D("recHitsBarrelPosXY", "RecHits position Barrel;X;Y", 200, -20, 20, 200,-20,20);
153  hBposZP = iBook.book2D("recHitsBarrelPosZP", "RecHits position Barrel;Z;#phi", 300, -30, 30, 200,-3.2,3.2);
154  hBcharge = iBook.book1D("recHitsBarrelCharge", "RecHits Charge Barrel;Charge;#events", 250, 0, 100000);
155  hBsizex = iBook.book1D("recHitsBarrelSizex", "RecHits SizeX Barrel;SizeX;#events", 50, 0, 50);
156  hBsizey = iBook.book1D("recHitsBarrelSizey", "RecHits SizeY Barrel;SizeY;#events", 50, 0, 50);
157  //Barrel Layer
158  for(unsigned int il=0;il<tkGeom_->numberOfLayers(PixelSubdetector::PixelBarrel);il++){
159  hBposZPL[il] = iBook.book2D(Form("recHitsBLay%dPosZP",il+1), Form("RecHits position Barrel Layer%d;Z;#phi",il+1), 300, -30, 30, 200,-3.2,3.2);
160  hBchargeL[il] = iBook.book1D(Form("recHitsBLay%dCharge",il+1), Form("RecHits Charge Barrel Layer%d;Charge;#events",il+1), 250, 0, 100000);
161  hBsizexL[il] = iBook.book1D(Form("recHitsBLay%dSizex",il+1), Form("RecHits SizeX Barrel Layer%d;SizeX;#events",il+1), 50, 0, 50);
162  hBsizeyL[il] = iBook.book1D(Form("recHitsBLay%dSizey",il+1), Form("RecHits SizeY Barrel Layer%d;SizeY;#events",il+1), 50, 0, 50);
163  }
164  //Endcaps
165  hFposXY = iBook.book2D("recHitsEndcapsPosXY", "RecHits position Endcaps;X;Y", 200, -20, 20, 200,-20, 20);
166  hFposZP = iBook.book2D("recHitsEndcapsPosZP", "RecHits position Endcaps;Z;#phi", 600, -60, 60, 200,-3.2,3.2);
167  hFcharge = iBook.book1D("recHitsEndcapsCharge", "RecHits Charge Endcaps;Charge;#events", 250, 0, 100000);
168  hFsizex = iBook.book1D("recHitsEndcapsSizex", "RecHits SizeX Endcaps;SizeX;#events", 50, 0, 50);
169  hFsizey = iBook.book1D("recHitsEndcapsSizey", "RecHits SizeY Endcaps;SizeY;#events", 50, 0, 50);
170  //Endcaps Disk
171  for(int is=0;is<2;is++){
172  int sign=is==0? -1:1;
173  for(unsigned int id=0;id<tkGeom_->numberOfLayers(PixelSubdetector::PixelEndcap);id++){
174  hFposXYD[is][id] = iBook.book2D(Form("recHitsFDisk%+dPosXY",id*sign+sign), Form("RecHits position Endcaps Disk%+d;X;Y",id*sign+sign), 200, -20, 20, 200,-20,20);
175  hFchargeD[is][id] = iBook.book1D(Form("recHitsFDisk%+dCharge",id*sign+sign), Form("RecHits Charge Endcaps Disk%+d;Charge;#events",id*sign+sign), 250, 0, 100000);
176  hFsizexD[is][id] = iBook.book1D(Form("recHitsFDisk%+dSizex",id*sign+sign), Form("RecHits SizeX Endcaps Disk%+d;SizeX;#events",id*sign+sign), 50, 0, 50);
177  hFsizeyD[is][id] = iBook.book1D(Form("recHitsFDisk%+dSizey",id*sign+sign), Form("RecHits SizeY Endcaps Disk%+d;SizeY;#events",id*sign+sign), 50, 0, 50);
178  }
179  }
180 }
181 
182 template<typename T>
184  // monitorpixelRecHitsSoA
186  desc.add<edm::InputTag>("pixelHitsSrc", edm::InputTag("siPixelRecHitsPreSplittingAlpaka"));
187  desc.add<std::string>("TopFolderName", "SiPixelHeterogeneous/PixelRecHitsAlpaka");
188  descriptions.addWithDefaultLabel(desc);
189 }
190 
194 
constexpr int32_t ceil(float num)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
SiPixelMonitorRecHitsSoAAlpaka(const edm::ParameterSet &)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
~SiPixelMonitorRecHitsSoAAlpaka() override=default
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:224
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
Definition: DetId.h:17
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
constexpr float short2phi(short x)
Definition: approx_atan2.h:285
HLT enums.
const edm::EDGetTokenT< HitsOnHost > tokenSoAHits_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: Run.h:45