CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
31 class SiPixelPhase1MonitorRecHitsSoA : public DQMEDAnalyzer {
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;
70 };
71 
72 //
73 // constructors
74 //
75 
77  : geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>()),
78  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()),
79  tokenSoAHitsCPU_(consumes<TrackingRecHit2DCPU>(iConfig.getParameter<edm::InputTag>("pixelHitsSrc"))),
80  topFolderName_(iConfig.getParameter<std::string>("TopFolderName")) {}
81 //
82 // Begin Run
83 //
85  tkGeom_ = &iSetup.getData(geomToken_);
86  tTopo_ = &iSetup.getData(topoToken_);
87 }
88 
89 //
90 // -- Analyze
91 //
93  const auto& rhsoaHandle = iEvent.getHandle(tokenSoAHitsCPU_);
94  if (!rhsoaHandle.isValid()) {
95  edm::LogWarning("SiPixelPhase1MonitorRecHitsSoA") << "No RecHits SoA found \n returning!" << std::endl;
96  return;
97  }
98  auto const& rhsoa = *rhsoaHandle;
99  const TrackingRecHit2DSOAView* soa2d = rhsoa.view();
100 
101  uint32_t nHits_ = soa2d->nHits();
102  hnHits->Fill(nHits_);
103  auto detIds = tkGeom_->detUnitIds();
104  for (uint32_t i = 0; i < nHits_; i++) {
105  DetId id = detIds[soa2d->detectorIndex(i)];
106  float xG = soa2d->xGlobal(i);
107  float yG = soa2d->yGlobal(i);
108  float zG = soa2d->zGlobal(i);
109  float rG = soa2d->rGlobal(i);
110  float fphi = short2phi(soa2d->iphi(i));
111  uint32_t charge = soa2d->charge(i);
112  int16_t sizeX = std::ceil(float(std::abs(soa2d->clusterSizeX(i)) / 8.));
113  int16_t sizeY = std::ceil(float(std::abs(soa2d->clusterSizeY(i)) / 8.));
114  hBFposZP->Fill(zG, fphi);
115  int16_t ysign = yG >= 0 ? 1 : -1;
116  hBFposZR->Fill(zG, rG * ysign);
117  switch (id.subdetId()) {
119  hBposXY->Fill(xG, yG);
120  hBposZP->Fill(zG, fphi);
121  hBcharge->Fill(charge);
122  hBsizex->Fill(sizeX);
123  hBsizey->Fill(sizeY);
124  hBposXYL[tTopo_->pxbLayer(id) - 1]->Fill(xG, yG);
125  hBposZPL[tTopo_->pxbLayer(id) - 1]->Fill(zG, fphi);
126  hBchargeL[tTopo_->pxbLayer(id) - 1]->Fill(charge);
127  hBsizexL[tTopo_->pxbLayer(id) - 1]->Fill(sizeX);
128  hBsizeyL[tTopo_->pxbLayer(id) - 1]->Fill(sizeY);
129  break;
131  hFposXY->Fill(xG, yG);
132  hFposZP->Fill(zG, fphi);
133  hFcharge->Fill(charge);
134  hFsizex->Fill(sizeX);
135  hFsizey->Fill(sizeY);
136  hFposXYD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(xG, yG);
137  hFposZPD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(zG, fphi);
138  hFchargeD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(charge);
139  hFsizexD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(sizeX);
140  hFsizeyD[tTopo_->pxfSide(id) - 1][tTopo_->pxfDisk(id) - 1]->Fill(sizeY);
141  break;
142  }
143  }
144 }
145 
146 //
147 // -- Book Histograms
148 //
150  edm::Run const& iRun,
151  edm::EventSetup const& iSetup) {
152  iBook.cd();
154 
155  // clang-format off
156  //Global
157  hnHits = iBook.book1D("nHits", "RecHits per event;RecHits;#events", 200, 0, 5000);
158  hBFposZP = iBook.book2D("recHitsGlobalPosZP", "RecHits position Global;Z;#phi", 1000, -60, 60, 200,-3.2,3.2);
159  hBFposZR = iBook.book2D("recHitsGlobalPosZR", "RecHits position Global;Z;R", 1000, -60, 60, 200,-20,20);
160  //Barrel
161  hBposXY = iBook.book2D("recHitsBarrelPosXY", "RecHits position Barrel;X;Y", 200, -20, 20, 200,-20,20);
162  hBposZP = iBook.book2D("recHitsBarrelPosZP", "RecHits position Barrel;Z;#phi", 300, -30, 30, 200,-3.2,3.2);
163  hBcharge = iBook.book1D("recHitsBarrelCharge", "RecHits Charge Barrel;Charge;#events", 250, 0, 100000);
164  hBsizex = iBook.book1D("recHitsBarrelSizex", "RecHits SizeX Barrel;SizeX;#events", 50, 0, 50);
165  hBsizey = iBook.book1D("recHitsBarrelSizey", "RecHits SizeY Barrel;SizeY;#events", 50, 0, 50);
166  //Barrel Layer
167  for(unsigned int il=0;il<tkGeom_->numberOfLayers(PixelSubdetector::PixelBarrel);il++){
168  hBposXYL[il] = iBook.book2D(Form("recHitsBLay%dPosXY",il+1), Form("RecHits position Barrel Layer%d;X;Y",il+1), 200, -20, 20, 200,-20,20);
169  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);
170  hBchargeL[il] = iBook.book1D(Form("recHitsBLay%dCharge",il+1), Form("RecHits Charge Barrel Layer%d;Charge;#events",il+1), 250, 0, 100000);
171  hBsizexL[il] = iBook.book1D(Form("recHitsBLay%dSizex",il+1), Form("RecHits SizeX Barrel Layer%d;SizeX;#events",il+1), 50, 0, 50);
172  hBsizeyL[il] = iBook.book1D(Form("recHitsBLay%dSizey",il+1), Form("RecHits SizeY Barrel Layer%d;SizeY;#events",il+1), 50, 0, 50);
173  }
174  //Endcaps
175  hFposXY = iBook.book2D("recHitsEndcapsPosXY", "RecHits position Endcaps;X;Y", 200, -20, 20, 200,-20,-20);
176  hFposZP = iBook.book2D("recHitsEndcapsPosZP", "RecHits position Endcaps;Z;#phi", 600, -60, 60, 200,-3.2,3.2);
177  hFcharge = iBook.book1D("recHitsEndcapsCharge", "RecHits Charge Endcaps;Charge;#events", 250, 0, 100000);
178  hFsizex = iBook.book1D("recHitsEndcapsSizex", "RecHits SizeX Endcaps;SizeX;#events", 50, 0, 50);
179  hFsizey = iBook.book1D("recHitsEndcapsSizey", "RecHits SizeY Endcaps;SizeY;#events", 50, 0, 50);
180  //Endcaps Disk
181  for(int is=0;is<2;is++){
182  int sign=is==0? -1:1;
183  for(unsigned int id=0;id<tkGeom_->numberOfLayers(PixelSubdetector::PixelEndcap);id++){
184  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);
185  hFposZPD[is][id] = iBook.book2D(Form("recHitsFDisk%+dPosZP",id*sign+sign), Form("RecHits position Endcaps Disk%+d;Z;#phi",id*sign+sign), 600, -60, 60, 200,-3.2,3.2);
186  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);
187  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);
188  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);
189  }
190  }
191 }
192 
194  // monitorpixelRecHitsSoA
196  desc.add<edm::InputTag>("pixelHitsSrc", edm::InputTag("siPixelRecHitsPreSplitting"));
197  desc.add<std::string>("TopFolderName", "SiPixelHeterogeneous/PixelRecHitsSoA");
198  descriptions.addWithDefaultLabel(desc);
199 }
const edm::EDGetTokenT< TrackingRecHit2DCPU > tokenSoAHitsCPU_
constexpr int32_t ceil(float num)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
uint16_t *__restrict__ id
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
unsigned int pxfDisk(const DetId &id) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double sign(double x)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
unsigned int numberOfLayers(int subdet) const
void Fill(long long x)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:17
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:177
constexpr float short2phi(short x)
Definition: approx_atan2.h:285
unsigned int pxfSide(const DetId &id) const
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.
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Definition: Run.h:45
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
~SiPixelPhase1MonitorRecHitsSoA() override=default