CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelRecHitModule.cc
Go to the documentation of this file.
6 // STL
7 #include <vector>
8 #include <memory>
9 #include <string>
10 #include <iostream>
11 #include <stdlib.h>
12 
13 // Data Formats
18 //
19 // Constructors
20 //
24  id_(id)
25 {
26 }
27 
28 //
29 // Destructor
30 //
32 //
33 // Book histograms
34 //
36  bool twoD, bool reducedSet) {
37 
38  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
39  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
40  bool isHalfModule = false;
41  if(barrel){
42  isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule();
43  }
44 
45  std::string hid;
46  // Get collection name and instantiate Histo Id builder
47  edm::InputTag src = iConfig.getParameter<edm::InputTag>( "src" );
48  // Get DQM interface
49  DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
50 
51 
52  if(type==0){
53  SiPixelHistogramId* theHistogramId = new SiPixelHistogramId( src.label() );
54  if(!reducedSet)
55  {
56  if(twoD){
57  // XYPosition
58  hid = theHistogramId->setHistoId("xypos",id_);
59  meXYPos_ = theDMBE->book2D(hid,"XY Position",100,-1.,1,100,-4,4);
60  meXYPos_->setAxisTitle("X Position",1);
61  meXYPos_->setAxisTitle("Y Position",2);
62  }
63  else{
64  // projections of XYPosition
65  hid = theHistogramId->setHistoId("xypos",id_);
66  meXYPos_px_ = theDMBE->book1D(hid+"_px","X Position",100,-1.,1);
67  meXYPos_px_->setAxisTitle("X Position",1);
68  meXYPos_py_ = theDMBE->book1D(hid+"_py","Y Position",100,-4,4);
69  meXYPos_py_->setAxisTitle("Y Position",1);
70  }
71  }
72  hid = theHistogramId->setHistoId("ClustX",id_);
73  meClustX_ = theDMBE->book1D(hid, "RecHit X size", 10, 0., 10.);
74  meClustX_->setAxisTitle("RecHit size X dimension", 1);
75  hid = theHistogramId->setHistoId("ClustY",id_);
76  meClustY_ = theDMBE->book1D(hid, "RecHit Y size", 15, 0., 15.);
77  meClustY_->setAxisTitle("RecHit size Y dimension", 1);
78 
79  hid = theHistogramId->setHistoId("ErrorX",id_);
80  meErrorX_ = theDMBE->book1D(hid, "RecHit error X", 100,0.,0.02);
81  meErrorX_->setAxisTitle("RecHit error X", 1);
82  hid = theHistogramId->setHistoId("ErrorY",id_);
83  meErrorY_ = theDMBE->book1D(hid, "RecHit error Y", 100,0.,0.02);
84  meErrorY_->setAxisTitle("RecHit error Y", 1);
85 
86  //Removed to save offline memory
87  //hid = theHistogramId->setHistoId("nRecHits",id_);
88  //menRecHits_ = theDMBE->book1D(hid, "# of rechits in this module", 8, 0, 8);
89  //menRecHits_->setAxisTitle("number of rechits",1);
90  delete theHistogramId;
91  }
92 
93  if(type==1 && barrel){
94  uint32_t DBladder = PixelBarrelName(DetId(id_)).ladderName();
95  char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
96  hid = src.label() + "_" + sladder;
97  if(isHalfModule) hid += "H";
98  else hid += "F";
99  if(!reducedSet)
100  {
101  if(twoD){
102  meXYPosLad_ = theDMBE->book2D("xypos_" + hid,"XY Position",100,-1.,1,100,-4,4);
103  meXYPosLad_->setAxisTitle("X Position",1);
104  meXYPosLad_->setAxisTitle("Y Position",2);
105  }
106  else{
107  // projections of XYPosition
108  meXYPosLad_px_ = theDMBE->book1D("xypos_"+hid+"_px","X Position",100,-1.,1);
109  meXYPosLad_px_->setAxisTitle("X Position",1);
110  meXYPosLad_py_ = theDMBE->book1D("xypos_"+hid+"_py","Y Position",100,-4,4);
111  meXYPosLad_py_->setAxisTitle("Y Position",1);
112  }
113  }
114  meClustXLad_ = theDMBE->book1D("ClustX_" +hid, "RecHit X size", 10, 0., 10.);
115  meClustXLad_->setAxisTitle("RecHit size X dimension", 1);
116  meClustYLad_ = theDMBE->book1D("ClustY_" +hid,"RecHit Y size", 15, 0.,15.);
117  meClustYLad_->setAxisTitle("RecHit size Y dimension", 1);
118  meErrorXLad_ = theDMBE->book1D("ErrorX_"+hid, "RecHit error X", 100,0.,0.02);
119  meErrorXLad_->setAxisTitle("RecHit error X", 1);
120  meErrorYLad_ = theDMBE->book1D("ErrorY_"+hid, "RecHit error Y", 100,0.,0.02);
121  meErrorYLad_->setAxisTitle("RecHit error Y", 1);
122  menRecHitsLad_ = theDMBE->book1D("nRecHits_"+hid, "# of rechits in this module", 8, 0, 8);
123  menRecHitsLad_->setAxisTitle("number of rechits",1);
124 
125  }
126 
127  if(type==2 && barrel){
128 
129  uint32_t DBlayer = PixelBarrelName(DetId(id_)).layerName();
130  char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
131  hid = src.label() + "_" + slayer;
132 
133  if(!reducedSet)
134  {
135  if(twoD){
136  meXYPosLay_ = theDMBE->book2D("xypos_" + hid,"XY Position",100,-1.,1,100,-4,4);
137  meXYPosLay_->setAxisTitle("X Position",1);
138  meXYPosLay_->setAxisTitle("Y Position",2);
139  }
140  else{
141  // projections of XYPosition
142  meXYPosLay_px_ = theDMBE->book1D("xypos_"+hid+"_px","X Position",100,-1.,1);
143  meXYPosLay_px_->setAxisTitle("X Position",1);
144  meXYPosLay_py_ = theDMBE->book1D("xypos_"+hid+"_py","Y Position",100,-4,4);
145  meXYPosLay_py_->setAxisTitle("Y Position",1);
146  }
147  }
148 
149  meClustXLay_ = theDMBE->book1D("ClustX_" +hid, "RecHit X size", 10, 0., 10.);
150  meClustXLay_->setAxisTitle("RecHit size X dimension", 1);
151  meClustYLay_ = theDMBE->book1D("ClustY_" +hid,"RecHit Y size", 15, 0.,15.);
152  meClustYLay_->setAxisTitle("RecHit size Y dimension", 1);
153  meErrorXLay_ = theDMBE->book1D("ErrorX_"+hid, "RecHit error X", 100,0.,0.02);
154  meErrorXLay_->setAxisTitle("RecHit error X", 1);
155  meErrorYLay_ = theDMBE->book1D("ErrorY_"+hid, "RecHit error Y", 100,0.,0.02);
156  meErrorYLay_->setAxisTitle("RecHit error Y", 1);
157  menRecHitsLay_ = theDMBE->book1D("nRecHits_"+hid, "# of rechits in this module", 8, 0, 8);
158  menRecHitsLay_->setAxisTitle("number of rechits",1);
159 
160  }
161 
162  if(type==3 && barrel){
163  uint32_t DBmodule = PixelBarrelName(DetId(id_)).moduleName();
164  char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
165  hid = src.label() + "_" + smodule;
166 
167  if(!reducedSet)
168  {
169  if(twoD){
170  meXYPosPhi_ = theDMBE->book2D("xypos_" + hid,"XY Position",100,-1.,1,100,-4,4);
171  meXYPosPhi_->setAxisTitle("X Position",1);
172  meXYPosPhi_->setAxisTitle("Y Position",2);
173  }
174  else{
175  // projections of XYPosition
176  meXYPosPhi_px_ = theDMBE->book1D("xypos_"+hid+"_px","X Position",100,-1.,1);
177  meXYPosPhi_px_->setAxisTitle("X Position",1);
178  meXYPosPhi_py_ = theDMBE->book1D("xypos_"+hid+"_py","Y Position",100,-4,4);
179  meXYPosPhi_py_->setAxisTitle("Y Position",1);
180  }
181  }
182  meClustXPhi_ = theDMBE->book1D("ClustX_" +hid, "RecHit X size", 10, 0., 10.);
183  meClustXPhi_->setAxisTitle("RecHit size X dimension", 1);
184  meClustYPhi_ = theDMBE->book1D("ClustY_" +hid,"RecHit Y size", 15, 0.,15.);
185  meClustYPhi_->setAxisTitle("RecHit size Y dimension", 1);
186  meErrorXPhi_ = theDMBE->book1D("ErrorX_"+hid, "RecHit error X", 100,0.,0.02);
187  meErrorXPhi_->setAxisTitle("RecHit error X", 1);
188  meErrorYPhi_ = theDMBE->book1D("ErrorY_"+hid, "RecHit error Y", 100,0.,0.02);
189  meErrorYPhi_->setAxisTitle("RecHit error Y", 1);
190  menRecHitsPhi_ = theDMBE->book1D("nRecHits_"+hid, "# of rechits in this module", 8, 0, 8);
191  menRecHitsPhi_->setAxisTitle("number of rechits",1);
192 
193  }
194 
195  if(type==4 && endcap){
196  uint32_t blade= PixelEndcapName(DetId(id_)).bladeName();
197 
198  char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
199  hid = src.label() + "_" + sblade;
200 // meXYPosBlade_ = theDMBE->book2D("xypos_" + hid,"XY Position",100,-1.,1,100,-4,4);
201 // meXYPosBlade_->setAxisTitle("X Position",1);
202 // meXYPosBlade_->setAxisTitle("Y Position",2);
203 
204  meClustXBlade_ = theDMBE->book1D("ClustX_" +hid, "RecHit X size", 10, 0., 10.);
205  meClustXBlade_->setAxisTitle("RecHit size X dimension", 1);
206  meClustYBlade_ = theDMBE->book1D("ClustY_" +hid,"RecHit Y size", 15, 0.,15.);
207  meClustYBlade_->setAxisTitle("RecHit size Y dimension", 1);
208  meErrorXBlade_ = theDMBE->book1D("ErrorX_"+hid, "RecHit error X", 100,0.,0.02);
209  meErrorXBlade_->setAxisTitle("RecHit error X", 1);
210  meErrorYBlade_ = theDMBE->book1D("ErrorY_"+hid, "RecHit error Y", 100,0.,0.02);
211  meErrorYBlade_->setAxisTitle("RecHit error Y", 1);
212  menRecHitsBlade_ = theDMBE->book1D("nRecHits_"+hid, "# of rechits in this module", 8, 0, 8);
213  menRecHitsBlade_->setAxisTitle("number of rechits",1);
214 
215  }
216  if(type==5 && endcap){
217  uint32_t disk = PixelEndcapName(DetId(id_)).diskName();
218 
219  char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
220  hid = src.label() + "_" + sdisk;
221 // meXYPosDisk_ = theDMBE->book2D("xypos_" + hid,"XY Position",100,-1.,1,100,-4,4);
222 // meXYPosDisk_->setAxisTitle("X Position",1);
223 // meXYPosDisk_->setAxisTitle("Y Position",2);
224 
225  meClustXDisk_ = theDMBE->book1D("ClustX_" +hid, "RecHit X size", 10, 0., 10.);
226  meClustXDisk_->setAxisTitle("RecHit size X dimension", 1);
227  meClustYDisk_ = theDMBE->book1D("ClustY_" +hid,"RecHit Y size", 15, 0.,15.);
228  meClustYDisk_->setAxisTitle("RecHit size Y dimension", 1);
229  meErrorXDisk_ = theDMBE->book1D("ErrorX_"+hid, "RecHit error X", 100,0.,0.02);
230  meErrorXDisk_->setAxisTitle("RecHit error X", 1);
231  meErrorYDisk_ = theDMBE->book1D("ErrorY_"+hid, "RecHit error Y", 100,0.,0.02);
232  meErrorYDisk_->setAxisTitle("RecHit error Y", 1);
233  menRecHitsDisk_ = theDMBE->book1D("nRecHits_"+hid, "# of rechits in this module", 8, 0, 8);
234  menRecHitsDisk_->setAxisTitle("number of rechits",1);
235 
236  }
237 
238  if(type==6 && endcap){
239  uint32_t panel= PixelEndcapName(DetId(id_)).pannelName();
241  char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
242  hid = src.label() + "_" + slab;
243 
244  if(!reducedSet)
245  {
246  if(twoD){
247  meXYPosRing_ = theDMBE->book2D("xypos_" + hid,"XY Position",100,-1.,1,100,-4,4);
248  meXYPosRing_->setAxisTitle("X Position",1);
249  meXYPosRing_->setAxisTitle("Y Position",2);
250  }
251  else{
252  // projections of XYPosition
253  meXYPosRing_px_ = theDMBE->book1D("xypos_"+hid+"_px","X Position",100,-1.,1);
254  meXYPosRing_px_->setAxisTitle("X Position",1);
255  meXYPosRing_py_ = theDMBE->book1D("xypos_"+hid+"_py","Y Position",100,-4,4);
256  meXYPosRing_py_->setAxisTitle("Y Position",1);
257  }
258  }
259  meClustXRing_ = theDMBE->book1D("ClustX_" +hid, "RecHit X size", 10, 0., 10.);
260  meClustXRing_->setAxisTitle("RecHit size X dimension", 1);
261  meClustYRing_ = theDMBE->book1D("ClustY_" +hid,"RecHit Y size", 15, 0.,15.);
262  meClustYRing_->setAxisTitle("RecHit size Y dimension", 1);
263  meErrorXRing_ = theDMBE->book1D("ErrorX_"+hid, "RecHit error X", 100,0.,0.02);
264  meErrorXRing_->setAxisTitle("RecHit error X", 1);
265  meErrorYRing_ = theDMBE->book1D("ErrorY_"+hid, "RecHit error Y", 100,0.,0.02);
266  meErrorYRing_->setAxisTitle("RecHit error Y", 1);
267  menRecHitsRing_ = theDMBE->book1D("nRecHits_"+hid, "# of rechits in this module", 8, 0, 8);
268  menRecHitsRing_->setAxisTitle("number of rechits",1);
269 
270  }
271 
272 }
273 //
274 // Fill histograms
275 //
276 void SiPixelRecHitModule::fill(const float& rechit_x, const float& rechit_y,
277  const int& sizeX, const int& sizeY,
278  const float& lerr_x, const float& lerr_y,
279  bool modon, bool ladon, bool layon, bool phion,
280  bool bladeon, bool diskon, bool ringon,
281  bool twoD, bool reducedSet) {
282 
283  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
284  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
285 
286  //std::cout << rechit_x << " " << rechit_y << " " << sizeX << " " << sizeY << std::endl;
287  if(modon){
288  meClustX_->Fill(sizeX);
289  meClustY_->Fill(sizeY);
290  meErrorX_->Fill(lerr_x);
291  meErrorY_->Fill(lerr_y);
292  if(!reducedSet)
293  {
294  if(twoD) meXYPos_->Fill(rechit_x, rechit_y);
295  else {
296  meXYPos_px_->Fill(rechit_x);
297  meXYPos_py_->Fill(rechit_y);
298  }
299  }
300  }
301  //std::cout<<"number of detector units="<<numberOfDetUnits<<std::endl;
302 
303  if(ladon && barrel){
304  meClustXLad_->Fill(sizeX);
305  meClustYLad_->Fill(sizeY);
306  meErrorXLad_->Fill(lerr_x);
307  meErrorYLad_->Fill(lerr_y);
308  if(!reducedSet)
309  {
310  if(twoD) meXYPosLad_->Fill(rechit_x, rechit_y);
311  else{
312  meXYPosLad_px_->Fill(rechit_x);
313  meXYPosLad_py_->Fill(rechit_y);
314  }
315  }
316  }
317 
318  if(layon && barrel){
319  meClustXLay_->Fill(sizeX);
320  meClustYLay_->Fill(sizeY);
321  meErrorXLay_->Fill(lerr_x);
322  meErrorYLay_->Fill(lerr_y);
323  if(!reducedSet)
324  {
325  if(twoD) meXYPosLay_->Fill(rechit_x, rechit_y);
326  else{
327  meXYPosLay_px_->Fill(rechit_x);
328  meXYPosLay_py_->Fill(rechit_y);
329  }
330  }
331  }
332 
333  if(phion && barrel){
334  meClustXPhi_->Fill(sizeX);
335  meClustYPhi_->Fill(sizeY);
336  meErrorXPhi_->Fill(lerr_x);
337  meErrorYPhi_->Fill(lerr_y);
338  if(!reducedSet)
339  {
340  if(twoD) meXYPosPhi_->Fill(rechit_x, rechit_y);
341  else{
342  meXYPosPhi_px_->Fill(rechit_x);
343  meXYPosPhi_py_->Fill(rechit_y);
344  }
345  }
346  }
347 
348  if(bladeon && endcap){
349  //meXYPosBlade_->Fill(rechit_x, rechit_y);
350  meClustXBlade_->Fill(sizeX);
351  meClustYBlade_->Fill(sizeY);
352  meErrorXBlade_->Fill(lerr_x);
353  meErrorYBlade_->Fill(lerr_y);
354  }
355 
356  if(diskon && endcap){
357  //meXYPosDisk_->Fill(rechit_x, rechit_y);
358  meClustXDisk_->Fill(sizeX);
359  meClustYDisk_->Fill(sizeY);
360  meErrorXDisk_->Fill(lerr_x);
361  meErrorYDisk_->Fill(lerr_y);
362  }
363 
364  if(ringon && endcap){
365  meClustXRing_->Fill(sizeX);
366  meClustYRing_->Fill(sizeY);
367  meErrorXRing_->Fill(lerr_x);
368  meErrorYRing_->Fill(lerr_y);
369  if(!reducedSet)
370  {
371  if(twoD) meXYPosRing_->Fill(rechit_x, rechit_y);
372  else{
373  meXYPosRing_px_->Fill(rechit_x);
374  meXYPosRing_py_->Fill(rechit_y);
375  }
376  }
377  }
378 }
379 
380 void SiPixelRecHitModule::nfill(const int& nrec, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
381 
382  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
383  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
384 
385  //if(modon) menRecHits_->Fill(nrec);
386  //barrel
387  if(ladon && barrel) menRecHitsLad_->Fill(nrec);
388  if(layon && barrel) menRecHitsLay_->Fill(nrec);
389  if(phion && barrel) menRecHitsPhi_->Fill(nrec);
390  //endcap
391  if(bladeon && endcap) menRecHitsBlade_->Fill(nrec);
392  if(diskon && endcap) menRecHitsDisk_->Fill(nrec);
393  if(ringon && endcap) menRecHitsRing_->Fill(nrec);
394 }
int plaquetteName() const
plaquetteId (in pannel)
MonitorElement * menRecHitsLay_
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
MonitorElement * meXYPosPhi_px_
MonitorElement * meClustYRing_
MonitorElement * meClustXLay_
MonitorElement * meXYPosPhi_
void nfill(const int &nrec, bool modon=true, bool ladon=false, bool layon=false, bool phion=false, bool bladeon=false, bool diskon=false, bool ringon=false)
MonitorElement * meXYPosPhi_py_
MonitorElement * meErrorXDisk_
MonitorElement * meClustYPhi_
SiPixelRecHitModule()
Default constructor.
int moduleName() const
module id (index in z)
MonitorElement * meXYPosLay_py_
MonitorElement * meClustXDisk_
MonitorElement * meClustYDisk_
MonitorElement * meErrorY_
MonitorElement * meErrorYRing_
~SiPixelRecHitModule()
Destructor.
MonitorElement * meClustXLad_
MonitorElement * meErrorYPhi_
MonitorElement * meXYPosRing_px_
MonitorElement * meXYPosLay_
MonitorElement * meErrorXLad_
MonitorElement * meClustX_
void Fill(long long x)
MonitorElement * meClustXBlade_
MonitorElement * meClustXPhi_
MonitorElement * meXYPosLad_px_
int bladeName() const
blade id
MonitorElement * meErrorXBlade_
bool isHalfModule() const
full or half module
MonitorElement * meXYPosRing_
MonitorElement * meErrorYLad_
MonitorElement * menRecHitsRing_
MonitorElement * meXYPosLay_px_
MonitorElement * meClustXRing_
MonitorElement * meXYPos_py_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
MonitorElement * meErrorYLay_
MonitorElement * meXYPos_
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
Definition: DetId.h:18
int ladderName() const
ladder id (index in phi)
MonitorElement * meXYPosLad_
int layerName() const
layer id
MonitorElement * meErrorYDisk_
MonitorElement * menRecHitsDisk_
std::string const & label() const
Definition: InputTag.h:42
MonitorElement * meErrorX_
MonitorElement * menRecHitsPhi_
void book(const edm::ParameterSet &iConfig, int type=0, bool twoD=true, bool reducedSet=false)
Book histograms.
int pannelName() const
pannel id
MonitorElement * menRecHitsLad_
MonitorElement * meClustYLad_
MonitorElement * meClustY_
MonitorElement * meXYPosRing_py_
int diskName() const
disk id
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: vlib.h:208
MonitorElement * meXYPosLad_py_
MonitorElement * meErrorXLay_
MonitorElement * menRecHitsBlade_
MonitorElement * meClustYBlade_
void fill(const float &rechit_x, const float &rechit_y, const int &sizeX, const int &sizeY, const float &lerr_x, const float &lerr_y, bool modon=true, bool ladon=false, bool layon=false, bool phion=false, bool bladeon=false, bool diskon=false, bool ringon=false, bool twoD=true, bool reducedSet=false)
Fill histograms.
MonitorElement * meClustYLay_
MonitorElement * meXYPos_px_
MonitorElement * meErrorXRing_
MonitorElement * meErrorYBlade_
MonitorElement * meErrorXPhi_