CMS 3D CMS Logo

SiPixelPhase1MonitorRecHitsSoA.cc
Go to the documentation of this file.
1 // -*- C++ -*-
3 // Package: SiPixelPhase1MonitorRecHitsSoA
4 // Class: SiPixelPhase1MonitorRecHitsSoA
5 //
8 //
9 // Author: Suvankar Roy Chowdhury, Alessandro Rossi
10 //
18 // DQM Histograming
23 // Geometry
30 
32 public:
34  ~SiPixelPhase1MonitorRecHitsSoA() override = default;
35  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
36  void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
37  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
38  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
39 
40 private:
45  const TrackerGeometry* tkGeom_ = nullptr;
46  const TrackerTopology* tTopo_ = nullptr;
68 };
69 
70 //
71 // constructors
72 //
73 
76  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()),
77  tokenSoAHitsCPU_(consumes<TrackingRecHit2DCPU>(iConfig.getParameter<edm::InputTag>("pixelHitsSrc"))),
78  topFolderName_(iConfig.getParameter<std::string>("TopFolderName")) {}
79 //
80 // Begin Run
81 //
83  tkGeom_ = &iSetup.getData(geomToken_);
84  tTopo_ = &iSetup.getData(topoToken_);
85 }
86 
87 //
88 // -- Analyze
89 //
91  const auto& rhsoaHandle = iEvent.getHandle(tokenSoAHitsCPU_);
92  if (!rhsoaHandle.isValid()) {
93  edm::LogWarning("SiPixelPhase1MonitorRecHitsSoA") << "No RecHits SoA found \n returning!" << std::endl;
94  return;
95  }
96  auto const& rhsoa = *rhsoaHandle;
97  const TrackingRecHit2DSOAView* soa2d = rhsoa.view();
98 
99  uint32_t nHits_ = soa2d->nHits();
100  hnHits->Fill(nHits_);
101  auto detIds = tkGeom_->detUnitIds();
102  for (uint32_t i = 0; i < nHits_; i++) {
103  DetId id = detIds[soa2d->detectorIndex(i)];
104  float xG = soa2d->xGlobal(i);
105  float yG = soa2d->yGlobal(i);
106  float zG = soa2d->zGlobal(i);
107  float rG = soa2d->rGlobal(i);
108  float fphi = short2phi(soa2d->iphi(i));
109  uint32_t charge = soa2d->charge(i);
110  int16_t sizeX = std::ceil(float(std::abs(soa2d->clusterSizeX(i)) / 8.));
111  int16_t sizeY = std::ceil(float(std::abs(soa2d->clusterSizeY(i)) / 8.));
112  hBFposZP->Fill(zG, fphi);
113  int16_t ysign = yG >= 0 ? 1 : -1;
114  hBFposZR->Fill(zG, rG * ysign);
115  switch (id.subdetId()) {
117  hBposXY->Fill(xG, yG);
118  hBposZP->Fill(zG, fphi);
119  hBcharge->Fill(charge);
120  hBsizex->Fill(sizeX);
121  hBsizey->Fill(sizeY);
122  hBposZPL[tTopo_->pxbLayer(id) - 1]->Fill(zG, fphi);
123  hBchargeL[tTopo_->pxbLayer(id) - 1]->Fill(charge);
124  hBsizexL[tTopo_->pxbLayer(id) - 1]->Fill(sizeX);
125  hBsizeyL[tTopo_->pxbLayer(id) - 1]->Fill(sizeY);
126  break;
128  hFposXY->Fill(xG, yG);
129  hFposZP->Fill(zG, fphi);
130  hFcharge->Fill(charge);
131  hFsizex->Fill(sizeX);
132  hFsizey->Fill(sizeY);
133  hFposXYD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(xG, yG);
134  hFchargeD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(charge);
135  hFsizexD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(sizeX);
136  hFsizeyD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(sizeY);
137  break;
138  }
139  }
140 }
141 
142 //
143 // -- Book Histograms
144 //
146  edm::Run const& iRun,
147  edm::EventSetup const& iSetup) {
148  iBook.cd();
150 
151  // clang-format off
152  //Global
153  hnHits = iBook.book1D("nHits", "RecHits per event;RecHits;#events", 200, 0, 5000);
154  hBFposZP = iBook.book2D("recHitsGlobalPosZP", "RecHits position Global;Z;#phi", 1000, -60, 60, 200,-3.2,3.2);
155  hBFposZR = iBook.book2D("recHitsGlobalPosZR", "RecHits position Global;Z;R", 1000, -60, 60, 200,-20,20);
156  //Barrel
157  hBposXY = iBook.book2D("recHitsBarrelPosXY", "RecHits position Barrel;X;Y", 200, -20, 20, 200,-20,20);
158  hBposZP = iBook.book2D("recHitsBarrelPosZP", "RecHits position Barrel;Z;#phi", 300, -30, 30, 200,-3.2,3.2);
159  hBcharge = iBook.book1D("recHitsBarrelCharge", "RecHits Charge Barrel;Charge;#events", 250, 0, 100000);
160  hBsizex = iBook.book1D("recHitsBarrelSizex", "RecHits SizeX Barrel;SizeX;#events", 50, 0, 50);
161  hBsizey = iBook.book1D("recHitsBarrelSizey", "RecHits SizeY Barrel;SizeY;#events", 50, 0, 50);
162  //Barrel Layer
163  for(unsigned int il=0;il<tkGeom_->numberOfLayers(PixelSubdetector::PixelBarrel);il++){
164  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);
165  hBchargeL[il] = iBook.book1D(Form("recHitsBLay%dCharge",il+1), Form("RecHits Charge Barrel Layer%d;Charge;#events",il+1), 250, 0, 100000);
166  hBsizexL[il] = iBook.book1D(Form("recHitsBLay%dSizex",il+1), Form("RecHits SizeX Barrel Layer%d;SizeX;#events",il+1), 50, 0, 50);
167  hBsizeyL[il] = iBook.book1D(Form("recHitsBLay%dSizey",il+1), Form("RecHits SizeY Barrel Layer%d;SizeY;#events",il+1), 50, 0, 50);
168  }
169  //Endcaps
170  hFposXY = iBook.book2D("recHitsEndcapsPosXY", "RecHits position Endcaps;X;Y", 200, -20, 20, 200,-20, 20);
171  hFposZP = iBook.book2D("recHitsEndcapsPosZP", "RecHits position Endcaps;Z;#phi", 600, -60, 60, 200,-3.2,3.2);
172  hFcharge = iBook.book1D("recHitsEndcapsCharge", "RecHits Charge Endcaps;Charge;#events", 250, 0, 100000);
173  hFsizex = iBook.book1D("recHitsEndcapsSizex", "RecHits SizeX Endcaps;SizeX;#events", 50, 0, 50);
174  hFsizey = iBook.book1D("recHitsEndcapsSizey", "RecHits SizeY Endcaps;SizeY;#events", 50, 0, 50);
175  //Endcaps Disk
176  for(int is=0;is<2;is++){
177  int sign=is==0? -1:1;
178  for(unsigned int id=0;id<tkGeom_->numberOfLayers(PixelSubdetector::PixelEndcap);id++){
179  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);
180  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);
181  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);
182  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);
183  }
184  }
185 }
186 
188  // monitorpixelRecHitsSoA
190  desc.add<edm::InputTag>("pixelHitsSrc", edm::InputTag("siPixelRecHitsPreSplittingSoA"));
191  desc.add<std::string>("TopFolderName", "SiPixelHeterogeneous/PixelRecHitsSoA");
192  descriptions.addWithDefaultLabel(desc);
193 }
const edm::EDGetTokenT< TrackingRecHit2DCPU > tokenSoAHitsCPU_
constexpr int32_t ceil(float num)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
unsigned int pxbLayer(const DetId &id) const
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
unsigned int numberOfLayers(int subdet) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
void Fill(long long x)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
int iEvent
Definition: GenABIO.cc:224
unsigned int pxfDisk(const DetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
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.
SiPixelPhase1MonitorRecHitsSoA(const edm::ParameterSet &)
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 DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: Run.h:45
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
~SiPixelPhase1MonitorRecHitsSoA() override=default