Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:17

0001 // -*- C++ -*-
0002 //
0003 // Package:    SiPixelMonitorCluster
0004 // Class:      SiPixelClusterSource
0005 //
0006 /**\class
0007 
0008  Description: Pixel DQM source for Clusters
0009 
0010  Implementation:
0011      Note that the x- and y-directions referred to in the cluster description
0012  refer to local x- and y-values given by the clusterizer.  Local x corresponds
0013  to row value and local y corresponds to column value.
0014 */
0015 //
0016 // Original Author:  Vincenzo Chiochia & Andrew York
0017 //         Created:
0018 //
0019 //
0020 // Updated by: Lukas Wehrli
0021 // for pixel offline DQM
0022 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
0023 #include "DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h"
0024 #include "DQMServices/Core/interface/DQMStore.h"
0025 /// Framework
0026 #include "FWCore/ServiceRegistry/interface/Service.h"
0027 // STL
0028 #include <cstdlib>
0029 #include <iostream>
0030 #include <memory>
0031 #include <string>
0032 #include <vector>
0033 
0034 // Data Formats
0035 #include "DataFormats/DetId/interface/DetId.h"
0036 #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h"
0037 #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h"
0038 #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h"
0039 #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h"
0040 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0041 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0042 //
0043 // Constructors
0044 //
0045 SiPixelClusterModule::SiPixelClusterModule() : id_(0), ncols_(416), nrows_(160) {}
0046 ///
0047 SiPixelClusterModule::SiPixelClusterModule(const uint32_t &id) : id_(id), ncols_(416), nrows_(160) {}
0048 ///
0049 SiPixelClusterModule::SiPixelClusterModule(const uint32_t &id, const int &ncols, const int &nrows)
0050     : id_(id), ncols_(ncols), nrows_(nrows) {}
0051 //
0052 // Destructor
0053 //
0054 SiPixelClusterModule::~SiPixelClusterModule() {}
0055 //
0056 // Book histograms
0057 //
0058 void SiPixelClusterModule::book(const edm::ParameterSet &iConfig,
0059                                 const TrackerTopology *pTT,
0060                                 DQMStore::IBooker &iBooker,
0061                                 int type,
0062                                 bool twoD,
0063                                 bool reducedSet,
0064                                 bool isUpgrade) {
0065   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
0066   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
0067   bool isHalfModule = false;
0068   if (barrel) {
0069     isHalfModule = PixelBarrelName(DetId(id_), pTT, isUpgrade).isHalfModule();
0070   }
0071   int nbinx = ncols_ / 2;
0072   int nbiny = nrows_ / 2;
0073 
0074   std::string hid;
0075   // Get collection name and instantiate Histo Id builder
0076   edm::InputTag src = iConfig.getParameter<edm::InputTag>("src");
0077   if (type == 0) {
0078     SiPixelHistogramId *theHistogramId = new SiPixelHistogramId(src.label());
0079     // Number of clusters
0080     hid = theHistogramId->setHistoId("nclusters", id_);
0081     meNClusters_ = iBooker.book1D(hid, "Number of Clusters", 8, 0., 8.);
0082     meNClusters_->setAxisTitle("Number of Clusters", 1);
0083     // Total cluster charge in MeV
0084     hid = theHistogramId->setHistoId("charge", id_);
0085     meCharge_ = iBooker.book1D(hid, "Cluster charge", 100, 0., 200.);
0086     meCharge_->setAxisTitle("Charge [kilo electrons]", 1);
0087     // Total cluster size (in pixels)
0088     hid = theHistogramId->setHistoId("size", id_);
0089     meSize_ = iBooker.book1D(hid, "Total cluster size", 30, 0., 30.);
0090     meSize_->setAxisTitle("Cluster size [number of pixels]", 1);
0091     if (!reducedSet) {
0092       // Lowest cluster row
0093       hid = theHistogramId->setHistoId("minrow", id_);
0094       meMinRow_ = iBooker.book1D(hid, "Lowest cluster row", 200, 0., 200.);
0095       meMinRow_->setAxisTitle("Lowest cluster row", 1);
0096       // Highest cluster row
0097       hid = theHistogramId->setHistoId("maxrow", id_);
0098       meMaxRow_ = iBooker.book1D(hid, "Highest cluster row", 200, 0., 200.);
0099       meMaxRow_->setAxisTitle("Highest cluster row", 1);
0100       // Lowest cluster column
0101       hid = theHistogramId->setHistoId("mincol", id_);
0102       meMinCol_ = iBooker.book1D(hid, "Lowest cluster column", 500, 0., 500.);
0103       meMinCol_->setAxisTitle("Lowest cluster column", 1);
0104       // Highest cluster column
0105       hid = theHistogramId->setHistoId("maxcol", id_);
0106       meMaxCol_ = iBooker.book1D(hid, "Highest cluster column", 500, 0., 500.);
0107       meMaxCol_->setAxisTitle("Highest cluster column", 1);
0108       // Cluster barycenter X position
0109       hid = theHistogramId->setHistoId("x", id_);
0110       meX_ = iBooker.book1D(hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0111       meX_->setAxisTitle("Barycenter x-position [row #]", 1);
0112       // Cluster barycenter Y position
0113       hid = theHistogramId->setHistoId("y", id_);
0114       meY_ = iBooker.book1D(hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0115       meY_->setAxisTitle("Barycenter y-position [column #]", 1);
0116       // Cluster width on the x-axis
0117       hid = theHistogramId->setHistoId("sizeX", id_);
0118       meSizeX_ = iBooker.book1D(hid, "Cluster x-width (rows)", 10, 0., 10.);
0119       meSizeX_->setAxisTitle("Cluster x-size [rows]", 1);
0120       // Cluster width on the y-axis
0121       hid = theHistogramId->setHistoId("sizeY", id_);
0122       meSizeY_ = iBooker.book1D(hid, "Cluster y-width (columns)", 15, 0., 15.);
0123       meSizeY_->setAxisTitle("Cluster y-size [columns]", 1);
0124       int nbinx = ncols_ / 2;
0125       int nbiny = nrows_ / 2;
0126       hid = theHistogramId->setHistoId("hitmap", id_);
0127       if (twoD) {
0128         // 2D hit map
0129         mePixClusters_ = iBooker.book2D(
0130             hid, "Number of Clusters (1bin=four pixels)", nbinx, 0., float(ncols_), nbiny, 0., float(nrows_));
0131         mePixClusters_->setAxisTitle("Columns", 1);
0132         mePixClusters_->setAxisTitle("Rows", 2);
0133       } else {
0134         // projections of hitmap
0135         mePixClusters_px_ =
0136             iBooker.book1D(hid + "_px", "Number of Clusters (1bin=two columns)", nbinx, 0., float(ncols_));
0137         mePixClusters_py_ = iBooker.book1D(hid + "_py", "Number of Clusters (1bin=two rows)", nbiny, 0., float(nrows_));
0138         mePixClusters_px_->setAxisTitle("Columns", 1);
0139         mePixClusters_py_->setAxisTitle("Rows", 1);
0140       }
0141     }
0142     delete theHistogramId;
0143   }
0144 
0145   //**
0146   if (barrel && type == 7) {
0147     hid = src.label() + "_Barrel";
0148     meSizeYvsEtaBarrel_ = iBooker.book2D(
0149         "sizeYvsEta_" + hid, "Cluster size along beamline vs. Cluster position #eta", 60, -3., 3., 40, 0., 40.);
0150     meSizeYvsEtaBarrel_->setAxisTitle("Cluster #eta", 1);
0151     meSizeYvsEtaBarrel_->setAxisTitle("Cluster size along beamline [number of pixels]", 2);
0152   }
0153   if (type == 1 && barrel) {
0154     uint32_t DBladder;
0155     DBladder = PixelBarrelName(DetId(id_), pTT, isUpgrade).ladderName();
0156     char sladder[80];
0157     sprintf(sladder, "Ladder_%02i", DBladder);
0158     hid = src.label() + "_" + sladder;
0159     if (isHalfModule)
0160       hid += "H";
0161     else
0162       hid += "F";
0163     // Number of clusters
0164     meNClustersLad_ = iBooker.book1D("nclusters_" + hid, "Number of Clusters", 8, 0., 8.);
0165     meNClustersLad_->setAxisTitle("Number of Clusters", 1);
0166     // Total cluster charge in MeV
0167     meChargeLad_ = iBooker.book1D("charge_" + hid, "Cluster charge", 100, 0., 200.);
0168     meChargeLad_->setAxisTitle("Charge [kilo electrons]", 1);
0169     // Total cluster size (in pixels)
0170     meSizeLad_ = iBooker.book1D("size_" + hid, "Total cluster size", 30, 0., 30.);
0171     meSizeLad_->setAxisTitle("Cluster size [number of pixels]", 1);
0172     if (!reducedSet) {
0173       // Lowest cluster row
0174       meMinRowLad_ = iBooker.book1D("minrow_" + hid, "Lowest cluster row", 200, 0., 200.);
0175       meMinRowLad_->setAxisTitle("Lowest cluster row", 1);
0176       // Highest cluster row
0177       meMaxRowLad_ = iBooker.book1D("maxrow_" + hid, "Highest cluster row", 200, 0., 200.);
0178       meMaxRowLad_->setAxisTitle("Highest cluster row", 1);
0179       // Lowest cluster column
0180       meMinColLad_ = iBooker.book1D("mincol_" + hid, "Lowest cluster column", 500, 0., 500.);
0181       meMinColLad_->setAxisTitle("Lowest cluster column", 1);
0182       // Highest cluster column
0183       meMaxColLad_ = iBooker.book1D("maxcol_" + hid, "Highest cluster column", 500, 0., 500.);
0184       meMaxColLad_->setAxisTitle("Highest cluster column", 1);
0185       // Cluster barycenter X position
0186       meXLad_ = iBooker.book1D("x_" + hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0187       meXLad_->setAxisTitle("Barycenter x-position [row #]", 1);
0188       // Cluster barycenter Y position
0189       meYLad_ = iBooker.book1D("y_" + hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0190       meYLad_->setAxisTitle("Barycenter y-position [column #]", 1);
0191       // Cluster width on the x-axis
0192       meSizeXLad_ = iBooker.book1D("sizeX_" + hid, "Cluster x-width (rows)", 10, 0., 10.);
0193       meSizeXLad_->setAxisTitle("Cluster x-size [rows]", 1);
0194       // Cluster width on the y-axis
0195       meSizeYLad_ = iBooker.book1D("sizeY_" + hid, "Cluster y-width (columns)", 15, 0., 15.);
0196       meSizeYLad_->setAxisTitle("Cluster y-size [columns]", 1);
0197       if (twoD) {
0198         // 2D hit map
0199         mePixClustersLad_ = iBooker.book2D("hitmap_" + hid,
0200                                            "Number of Clusters (1bin=four pixels)",
0201                                            nbinx,
0202                                            0.,
0203                                            float(ncols_),
0204                                            nbiny,
0205                                            0.,
0206                                            float(nrows_));
0207         mePixClustersLad_->setAxisTitle("Columns", 1);
0208         mePixClustersLad_->setAxisTitle("Rows", 2);
0209       } else {
0210         // projections of hitmap
0211         mePixClustersLad_px_ =
0212             iBooker.book1D("hitmap_" + hid + "_px", "Number of Clusters (1bin=two columns)", nbinx, 0., float(ncols_));
0213         mePixClustersLad_py_ =
0214             iBooker.book1D("hitmap_" + hid + "_py", "Number of Clusters (1bin=two rows)", nbiny, 0., float(nrows_));
0215         mePixClustersLad_px_->setAxisTitle("Columns", 1);
0216         mePixClustersLad_py_->setAxisTitle("Rows", 1);
0217       }
0218     }
0219   }
0220 
0221   if (type == 2 && barrel) {
0222     uint32_t DBlayer;
0223     DBlayer = PixelBarrelName(DetId(id_), pTT, isUpgrade).layerName();
0224     char slayer[80];
0225     sprintf(slayer, "Layer_%i", DBlayer);
0226     hid = src.label() + "_" + slayer;
0227     // Number of clusters
0228     meNClustersLay_ = iBooker.book1D("nclusters_" + hid, "Number of Clusters", 8, 0., 8.);
0229     meNClustersLay_->setAxisTitle("Number of Clusters", 1);
0230     // Total cluster charge in MeV
0231     meChargeLay_ = iBooker.book1D("charge_" + hid, "Cluster charge", 100, 0., 200.);
0232     meChargeLay_->setAxisTitle("Charge [kilo electrons]", 1);
0233     // Total cluster size (in pixels)
0234     meSizeLay_ = iBooker.book1D("size_" + hid, "Total cluster size", 30, 0., 30.);
0235     meSizeLay_->setAxisTitle("Cluster size [in pixels]", 1);
0236     if (!reducedSet) {
0237       // Lowest cluster row
0238       meMinRowLay_ = iBooker.book1D("minrow_" + hid, "Lowest cluster row", 200, 0., 200.);
0239       meMinRowLay_->setAxisTitle("Lowest cluster row", 1);
0240       // Highest cluster row
0241       meMaxRowLay_ = iBooker.book1D("maxrow_" + hid, "Highest cluster row", 200, 0., 200.);
0242       meMaxRowLay_->setAxisTitle("Highest cluster row", 1);
0243       // Lowest cluster column
0244       meMinColLay_ = iBooker.book1D("mincol_" + hid, "Lowest cluster column", 500, 0., 500.);
0245       meMinColLay_->setAxisTitle("Lowest cluster column", 1);
0246       // Highest cluster column
0247       meMaxColLay_ = iBooker.book1D("maxcol_" + hid, "Highest cluster column", 500, 0., 500.);
0248       meMaxColLay_->setAxisTitle("Highest cluster column", 1);
0249       // Cluster barycenter X position
0250       meXLay_ = iBooker.book1D("x_" + hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0251       meXLay_->setAxisTitle("Barycenter x-position [row #]", 1);
0252       // Cluster barycenter Y position
0253       meYLay_ = iBooker.book1D("y_" + hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0254       meYLay_->setAxisTitle("Barycenter y-position [column #]", 1);
0255       // Cluster width on the x-axis
0256       meSizeXLay_ = iBooker.book1D("sizeX_" + hid, "Cluster x-width (rows)", 10, 0., 10.);
0257       meSizeXLay_->setAxisTitle("Cluster x-size [rows]", 1);
0258       // Cluster width on the y-axis
0259       meSizeYLay_ = iBooker.book1D("sizeY_" + hid, "Cluster y-width (columns)", 15, 0., 15.);
0260       meSizeYLay_->setAxisTitle("Cluster y-size [columns]", 1);
0261       if (twoD) {
0262         // 2D hit map
0263         if (isHalfModule) {
0264           mePixClustersLay_ = iBooker.book2D("hitmap_" + hid,
0265                                              "Number of Clusters (1bin=four pixels)",
0266                                              nbinx,
0267                                              0.,
0268                                              float(ncols_),
0269                                              2 * nbiny,
0270                                              0.,
0271                                              float(2 * nrows_));
0272         } else {
0273           mePixClustersLay_ = iBooker.book2D("hitmap_" + hid,
0274                                              "Number of Clusters (1bin=four pixels)",
0275                                              nbinx,
0276                                              0.,
0277                                              float(ncols_),
0278                                              nbiny,
0279                                              0.,
0280                                              float(nrows_));
0281         }
0282         mePixClustersLay_->setAxisTitle("Columns", 1);
0283         mePixClustersLay_->setAxisTitle("Rows", 2);
0284       } else {
0285         // projections of hitmap
0286         mePixClustersLay_px_ =
0287             iBooker.book1D("hitmap_" + hid + "_px", "Number of Clusters (1bin=two columns)", nbinx, 0., float(ncols_));
0288         if (isHalfModule) {
0289           mePixClustersLay_py_ = iBooker.book1D(
0290               "hitmap_" + hid + "_py", "Number of Clusters (1bin=two rows)", 2 * nbiny, 0., float(2 * nrows_));
0291         } else {
0292           mePixClustersLay_py_ =
0293               iBooker.book1D("hitmap_" + hid + "_py", "Number of Clusters (1bin=two rows)", nbiny, 0., float(nrows_));
0294         }
0295         mePixClustersLay_px_->setAxisTitle("Columns", 1);
0296         mePixClustersLay_py_->setAxisTitle("Rows", 1);
0297       }
0298     }
0299   }
0300   if (type == 3 && barrel) {
0301     uint32_t DBmodule;
0302     DBmodule = PixelBarrelName(DetId(id_), pTT, isUpgrade).moduleName();
0303     char smodule[80];
0304     sprintf(smodule, "Ring_%i", DBmodule);
0305     hid = src.label() + "_" + smodule;
0306     // Number of clusters
0307     meNClustersPhi_ = iBooker.book1D("nclusters_" + hid, "Number of Clusters", 8, 0., 8.);
0308     meNClustersPhi_->setAxisTitle("Number of Clusters", 1);
0309     // Total cluster charge in MeV
0310     meChargePhi_ = iBooker.book1D("charge_" + hid, "Cluster charge", 100, 0., 200.);
0311     meChargePhi_->setAxisTitle("Charge [kilo electrons]", 1);
0312     // Total cluster size (in pixels)
0313     meSizePhi_ = iBooker.book1D("size_" + hid, "Total cluster size", 30, 0., 30.);
0314     meSizePhi_->setAxisTitle("Cluster size [number of pixels]", 1);
0315     if (!reducedSet) {
0316       // Lowest cluster row
0317       meMinRowPhi_ = iBooker.book1D("minrow_" + hid, "Lowest cluster row", 200, 0., 200.);
0318       meMinRowPhi_->setAxisTitle("Lowest cluster row", 1);
0319       // Highest cluster row
0320       meMaxRowPhi_ = iBooker.book1D("maxrow_" + hid, "Highest cluster row", 200, 0., 200.);
0321       meMaxRowPhi_->setAxisTitle("Highest cluster row", 1);
0322       // Lowest cluster column
0323       meMinColPhi_ = iBooker.book1D("mincol_" + hid, "Lowest cluster column", 500, 0., 500.);
0324       meMinColPhi_->setAxisTitle("Lowest cluster column", 1);
0325       // Highest cluster column
0326       meMaxColPhi_ = iBooker.book1D("maxcol_" + hid, "Highest cluster column", 500, 0., 500.);
0327       meMaxColPhi_->setAxisTitle("Highest cluster column", 1);
0328       // Cluster barycenter X position
0329       meXPhi_ = iBooker.book1D("x_" + hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0330       meXPhi_->setAxisTitle("Barycenter x-position [row #]", 1);
0331       // Cluster barycenter Y position
0332       meYPhi_ = iBooker.book1D("y_" + hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0333       meYPhi_->setAxisTitle("Barycenter y-position [column #]", 1);
0334       // Cluster width on the x-axis
0335       meSizeXPhi_ = iBooker.book1D("sizeX_" + hid, "Cluster x-width (rows)", 10, 0., 10.);
0336       meSizeXPhi_->setAxisTitle("Cluster x-size [rows]", 1);
0337       // Cluster width on the y-axis
0338       meSizeYPhi_ = iBooker.book1D("sizeY_" + hid, "Cluster y-width (columns)", 15, 0., 15.);
0339       meSizeYPhi_->setAxisTitle("Cluster y-size [columns]", 1);
0340       if (twoD) {
0341         // 2D hit map
0342         if (isHalfModule) {
0343           mePixClustersPhi_ = iBooker.book2D("hitmap_" + hid,
0344                                              "Number of Clusters (1bin=four pixels)",
0345                                              nbinx,
0346                                              0.,
0347                                              float(ncols_),
0348                                              2 * nbiny,
0349                                              0.,
0350                                              float(2 * nrows_));
0351         } else {
0352           mePixClustersPhi_ = iBooker.book2D("hitmap_" + hid,
0353                                              "Number of Clusters (1bin=four pixels)",
0354                                              nbinx,
0355                                              0.,
0356                                              float(ncols_),
0357                                              nbiny,
0358                                              0.,
0359                                              float(nrows_));
0360         }
0361         mePixClustersPhi_->setAxisTitle("Columns", 1);
0362         mePixClustersPhi_->setAxisTitle("Rows", 2);
0363       } else {
0364         // projections of hitmap
0365         mePixClustersPhi_px_ =
0366             iBooker.book1D("hitmap_" + hid + "_px", "Number of Clusters (1bin=two columns)", nbinx, 0., float(ncols_));
0367         if (isHalfModule) {
0368           mePixClustersPhi_py_ = iBooker.book1D(
0369               "hitmap_" + hid + "_py", "Number of Clusters (1bin=two rows)", 2 * nbiny, 0., float(2 * nrows_));
0370         } else {
0371           mePixClustersPhi_py_ =
0372               iBooker.book1D("hitmap_" + hid + "_py", "Number of Clusters (1bin=two rows)", nbiny, 0., float(nrows_));
0373         }
0374         mePixClustersPhi_px_->setAxisTitle("Columns", 1);
0375         mePixClustersPhi_py_->setAxisTitle("Rows", 1);
0376       }
0377     }
0378   }
0379 
0380   if (type == 4 && endcap) {
0381     uint32_t blade;
0382     blade = PixelEndcapName(DetId(id_), pTT, isUpgrade).bladeName();
0383 
0384     char sblade[80];
0385     sprintf(sblade, "Blade_%02i", blade);
0386     hid = src.label() + "_" + sblade;
0387     // Number of clusters
0388     meNClustersBlade_ = iBooker.book1D("nclusters_" + hid, "Number of Clusters", 8, 0., 8.);
0389     meNClustersBlade_->setAxisTitle("Number of Clusters", 1);
0390     // Total cluster charge in MeV
0391     meChargeBlade_ = iBooker.book1D("charge_" + hid, "Cluster charge", 100, 0., 200.);
0392     meChargeBlade_->setAxisTitle("Charge [kilo electrons]", 1);
0393     // Total cluster size (in pixels)
0394     meSizeBlade_ = iBooker.book1D("size_" + hid, "Total cluster size", 30, 0., 30.);
0395     meSizeBlade_->setAxisTitle("Cluster size [number of pixels]", 1);
0396     if (!reducedSet) {
0397       // Lowest cluster row
0398       meMinRowBlade_ = iBooker.book1D("minrow_" + hid, "Lowest cluster row", 200, 0., 200.);
0399       meMinRowBlade_->setAxisTitle("Lowest cluster row", 1);
0400       // Highest cluster row
0401       meMaxRowBlade_ = iBooker.book1D("maxrow_" + hid, "Highest cluster row", 200, 0., 200.);
0402       meMaxRowBlade_->setAxisTitle("Highest cluster row", 1);
0403       // Lowest cluster column
0404       meMinColBlade_ = iBooker.book1D("mincol_" + hid, "Lowest cluster column", 500, 0., 500.);
0405       meMinColBlade_->setAxisTitle("Lowest cluster column", 1);
0406       // Highest cluster column
0407       meMaxColBlade_ = iBooker.book1D("maxcol_" + hid, "Highest cluster column", 500, 0., 500.);
0408       meMaxColBlade_->setAxisTitle("Highest cluster column", 1);
0409       // Cluster barycenter X position
0410       meXBlade_ = iBooker.book1D("x_" + hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0411       meXBlade_->setAxisTitle("Barycenter x-position [row #]", 1);
0412       // Cluster barycenter Y position
0413       meYBlade_ = iBooker.book1D("y_" + hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0414       meYBlade_->setAxisTitle("Barycenter y-position [column #]", 1);
0415       // Cluster width on the x-axis
0416       meSizeXBlade_ = iBooker.book1D("sizeX_" + hid, "Cluster x-width (rows)", 10, 0., 10.);
0417       meSizeXBlade_->setAxisTitle("Cluster x-size [rows]", 1);
0418       // Cluster width on the y-axis
0419       meSizeYBlade_ = iBooker.book1D("sizeY_" + hid, "Cluster y-width (columns)", 15, 0., 15.);
0420       meSizeYBlade_->setAxisTitle("Cluster y-size [columns]", 1);
0421     }
0422   }
0423   if (type == 5 && endcap) {
0424     uint32_t disk;
0425     disk = PixelEndcapName(DetId(id_), pTT, isUpgrade).diskName();
0426 
0427     char sdisk[80];
0428     sprintf(sdisk, "Disk_%i", disk);
0429     hid = src.label() + "_" + sdisk;
0430     // Number of clusters
0431     meNClustersDisk_ = iBooker.book1D("nclusters_" + hid, "Number of Clusters", 8, 0., 8.);
0432     meNClustersDisk_->setAxisTitle("Number of Clusters", 1);
0433     // Total cluster charge in MeV
0434     meChargeDisk_ = iBooker.book1D("charge_" + hid, "Cluster charge", 100, 0., 200.);
0435     meChargeDisk_->setAxisTitle("Charge [kilo electrons]", 1);
0436     // Total cluster size (in pixels)
0437     meSizeDisk_ = iBooker.book1D("size_" + hid, "Total cluster size", 30, 0., 30.);
0438     meSizeDisk_->setAxisTitle("Cluster size [number of pixels]", 1);
0439     if (!reducedSet) {
0440       // Lowest cluster row
0441       meMinRowDisk_ = iBooker.book1D("minrow_" + hid, "Lowest cluster row", 200, 0., 200.);
0442       meMinRowDisk_->setAxisTitle("Lowest cluster row", 1);
0443       // Highest cluster row
0444       meMaxRowDisk_ = iBooker.book1D("maxrow_" + hid, "Highest cluster row", 200, 0., 200.);
0445       meMaxRowDisk_->setAxisTitle("Highest cluster row", 1);
0446       // Lowest cluster column
0447       meMinColDisk_ = iBooker.book1D("mincol_" + hid, "Lowest cluster column", 500, 0., 500.);
0448       meMinColDisk_->setAxisTitle("Lowest cluster column", 1);
0449       // Highest cluster column
0450       meMaxColDisk_ = iBooker.book1D("maxcol_" + hid, "Highest cluster column", 500, 0., 500.);
0451       meMaxColDisk_->setAxisTitle("Highest cluster column", 1);
0452       // Cluster barycenter X position
0453       meXDisk_ = iBooker.book1D("x_" + hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0454       meXDisk_->setAxisTitle("Barycenter x-position [row #]", 1);
0455       // Cluster barycenter Y position
0456       meYDisk_ = iBooker.book1D("y_" + hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0457       meYDisk_->setAxisTitle("Barycenter y-position [column #]", 1);
0458       // Cluster width on the x-axis
0459       meSizeXDisk_ = iBooker.book1D("sizeX_" + hid, "Cluster x-width (rows)", 10, 0., 10.);
0460       meSizeXDisk_->setAxisTitle("Cluster x-size [rows]", 1);
0461       // Cluster width on the y-axis
0462       meSizeYDisk_ = iBooker.book1D("sizeY_" + hid, "Cluster y-width (columns)", 15, 0., 15.);
0463       meSizeYDisk_->setAxisTitle("Cluster y-size [columns]", 1);
0464     }
0465   }
0466 
0467   if (type == 6 && endcap) {
0468     uint32_t panel;
0469     uint32_t module;
0470     panel = PixelEndcapName(DetId(id_), pTT, isUpgrade).pannelName();
0471     module = PixelEndcapName(DetId(id_), pTT, isUpgrade).plaquetteName();
0472 
0473     char slab[80];
0474     sprintf(slab, "Panel_%i_Ring_%i", panel, module);
0475     hid = src.label() + "_" + slab;
0476     // Number of clusters
0477     meNClustersRing_ = iBooker.book1D("nclusters_" + hid, "Number of Clusters", 8, 0., 8.);
0478     meNClustersRing_->setAxisTitle("Number of Clusters", 1);
0479     // Total cluster charge in MeV
0480     meChargeRing_ = iBooker.book1D("charge_" + hid, "Cluster charge", 100, 0., 200.);
0481     meChargeRing_->setAxisTitle("Charge [kilo electrons]", 1);
0482     // Total cluster size (in pixels)
0483     meSizeRing_ = iBooker.book1D("size_" + hid, "Total cluster size", 30, 0., 30.);
0484     meSizeRing_->setAxisTitle("Cluster size [number of pixels]", 1);
0485     if (!reducedSet) {
0486       // Lowest cluster row
0487       meMinRowRing_ = iBooker.book1D("minrow_" + hid, "Lowest cluster row", 200, 0., 200.);
0488       meMinRowRing_->setAxisTitle("Lowest cluster row", 1);
0489       // Highest cluster row
0490       meMaxRowRing_ = iBooker.book1D("maxrow_" + hid, "Highest cluster row", 200, 0., 200.);
0491       meMaxRowRing_->setAxisTitle("Highest cluster row", 1);
0492       // Lowest cluster column
0493       meMinColRing_ = iBooker.book1D("mincol_" + hid, "Lowest cluster column", 500, 0., 500.);
0494       meMinColRing_->setAxisTitle("Lowest cluster column", 1);
0495       // Highest cluster column
0496       meMaxColRing_ = iBooker.book1D("maxcol_" + hid, "Highest cluster column", 500, 0., 500.);
0497       meMaxColRing_->setAxisTitle("Highest cluster column", 1);
0498       // Cluster barycenter X position
0499       meXRing_ = iBooker.book1D("x_" + hid, "Cluster barycenter X (row #)", 200, 0., 200.);
0500       meXRing_->setAxisTitle("Barycenter x-position [row #]", 1);
0501       // Cluster barycenter Y position
0502       meYRing_ = iBooker.book1D("y_" + hid, "Cluster barycenter Y (column #)", 500, 0., 500.);
0503       meYRing_->setAxisTitle("Barycenter y-position [column #]", 1);
0504       // Cluster width on the x-axis
0505       meSizeXRing_ = iBooker.book1D("sizeX_" + hid, "Cluster x-width (rows)", 10, 0., 10.);
0506       meSizeXRing_->setAxisTitle("Cluster x-size [rows]", 1);
0507       // Cluster width on the y-axis
0508       meSizeYRing_ = iBooker.book1D("sizeY_" + hid, "Cluster y-width (columns)", 15, 0., 15.);
0509       meSizeYRing_->setAxisTitle("Cluster y-size [columns]", 1);
0510       if (twoD) {
0511         // 2D hit map
0512         mePixClustersRing_ = iBooker.book2D("hitmap_" + hid,
0513                                             "Number of Clusters (1bin=four pixels)",
0514                                             nbinx,
0515                                             0.,
0516                                             float(ncols_),
0517                                             nbiny,
0518                                             0.,
0519                                             float(nrows_));
0520         mePixClustersRing_->setAxisTitle("Columns", 1);
0521         mePixClustersRing_->setAxisTitle("Rows", 2);
0522       } else {
0523         // projections of hitmap
0524         mePixClustersRing_px_ =
0525             iBooker.book1D("hitmap_" + hid + "_px", "Number of Clusters (1bin=two columns)", nbinx, 0., float(ncols_));
0526         mePixClustersRing_py_ =
0527             iBooker.book1D("hitmap_" + hid + "_py", "Number of Clusters (1bin=two rows)", nbiny, 0., float(nrows_));
0528         mePixClustersRing_px_->setAxisTitle("Columns", 1);
0529         mePixClustersRing_py_->setAxisTitle("Rows", 1);
0530       }
0531     }
0532   }
0533 }
0534 //
0535 // Fill histograms
0536 //
0537 int SiPixelClusterModule::fill(const edmNew::DetSetVector<SiPixelCluster> &input,
0538                                const TrackerTopology *pTT,
0539                                const TrackerGeometry *tracker,
0540                                int *barrelClusterTotal,
0541                                int *fpixPClusterTotal,
0542                                int *fpixMClusterTotal,
0543                                std::vector<MonitorElement *> &layers,
0544                                std::vector<MonitorElement *> &diskspz,
0545                                std::vector<MonitorElement *> &disksmz,
0546                                bool modon,
0547                                bool ladon,
0548                                bool layon,
0549                                bool phion,
0550                                bool bladeon,
0551                                bool diskon,
0552                                bool ringon,
0553                                bool twoD,
0554                                bool reducedSet,
0555                                bool smileyon,
0556                                bool isUpgrade) {
0557   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
0558   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
0559 
0560   edmNew::DetSetVector<SiPixelCluster>::const_iterator isearch = input.find(id_);  // search  clusters of detid
0561   unsigned int numberOfClusters = 0;
0562   unsigned int numberOfFpixClusters = 0;
0563 
0564   if (isearch != input.end()) {  // Not an empty iterator
0565 
0566     // Look at clusters now
0567     edmNew::DetSet<SiPixelCluster>::const_iterator di;
0568     for (di = isearch->begin(); di != isearch->end(); di++) {
0569       numberOfClusters++;
0570       if (endcap)
0571         numberOfFpixClusters++;
0572       if (barrel)
0573         (*barrelClusterTotal)++;
0574       float charge = 0.001 * (di->charge());  // total charge of cluster
0575       float x = di->x();                      // barycenter x position
0576       float y = di->y();                      // barycenter y position
0577       int size = di->size();                  // total size of cluster (in pixels)
0578       int sizeX = di->sizeX();                // size of cluster in x-direction
0579       int sizeY = di->sizeY();                // size of cluster in y-direction
0580       int minPixelRow = di->minPixelRow();    // min x index
0581       int maxPixelRow = di->maxPixelRow();    // max x index
0582       int minPixelCol = di->minPixelCol();    // min y index
0583       int maxPixelCol = di->maxPixelCol();    // max y index
0584 
0585       const PixelGeomDetUnit *theGeomDet = dynamic_cast<const PixelGeomDetUnit *>(tracker->idToDet(DetId(id_)));
0586 
0587       const PixelTopology *topol = &(theGeomDet->specificTopology());
0588       LocalPoint clustlp = topol->localPosition(MeasurementPoint(x, y));
0589       GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
0590       if (modon)
0591         meCharge_->Fill((float)charge);
0592       if (modon)
0593         meSize_->Fill((float)size);
0594 
0595       if (barrel) {
0596         uint32_t DBlayer = PixelBarrelName(DetId(id_), pTT, isUpgrade).layerName();
0597         if (!(DBlayer > layers.size()) && (layers[DBlayer - 1]))
0598           layers[DBlayer - 1]->Fill(clustgp.z(), clustgp.phi());
0599       } else if (endcap) {
0600         uint32_t DBdisk = PixelEndcapName(DetId(id_), pTT, isUpgrade).diskName();
0601         if (clustgp.z() > 0) {
0602           (*fpixPClusterTotal)++;
0603           if (!(DBdisk > diskspz.size()) && (diskspz[DBdisk - 1]))
0604             diskspz[DBdisk - 1]->Fill(clustgp.x(), clustgp.y());
0605         } else {
0606           (*fpixMClusterTotal)++;
0607           if (!(DBdisk > disksmz.size()) && (disksmz[DBdisk - 1]))
0608             disksmz[DBdisk - 1]->Fill(clustgp.x(), clustgp.y());
0609         }
0610       }
0611       if (!reducedSet) {
0612         (meMinRow_)->Fill((int)minPixelRow);
0613         (meMaxRow_)->Fill((int)maxPixelRow);
0614         (meMinCol_)->Fill((int)minPixelCol);
0615         (meMaxCol_)->Fill((int)maxPixelCol);
0616         (meSizeX_)->Fill((int)sizeX);
0617         (meSizeY_)->Fill((int)sizeY);
0618         (meX_)->Fill((float)x);
0619         (meY_)->Fill((float)y);
0620         if (twoD)
0621           (mePixClusters_)->Fill((float)y, (float)x);
0622         else {
0623           (mePixClusters_px_)->Fill((float)y);
0624           (mePixClusters_py_)->Fill((float)x);
0625         }
0626       }
0627 
0628       if (barrel && smileyon) {
0629         (meSizeYvsEtaBarrel_)->Fill(clustgp.eta(), sizeY);
0630         // std::cout << "Cluster Global x y z theta eta " << clustgp.x() << " "
0631         // << clustgp.y() << " " << clustgp.z() << " " << clustgp.theta() << " "
0632         // << clustgp.eta() << std::endl;
0633       }
0634       if (ladon && barrel) {
0635         (meChargeLad_)->Fill((float)charge);
0636         (meSizeLad_)->Fill((int)size);
0637         if (!reducedSet) {
0638           (meMinRowLad_)->Fill((int)minPixelRow);
0639           (meMaxRowLad_)->Fill((int)maxPixelRow);
0640           (meMinColLad_)->Fill((int)minPixelCol);
0641           (meMaxColLad_)->Fill((int)maxPixelCol);
0642           (meXLad_)->Fill((float)x);
0643           (meYLad_)->Fill((float)y);
0644           (meSizeXLad_)->Fill((int)sizeX);
0645           (meSizeYLad_)->Fill((int)sizeY);
0646           if (twoD)
0647             (mePixClustersLad_)->Fill((float)y, (float)x);
0648           else {
0649             (mePixClustersLad_px_)->Fill((float)y);
0650             (mePixClustersLad_py_)->Fill((float)x);
0651           }
0652         }
0653       }
0654       if (layon && barrel) {
0655         (meChargeLay_)->Fill((float)charge);
0656         (meSizeLay_)->Fill((int)size);
0657         if (!reducedSet) {
0658           (meMinRowLay_)->Fill((int)minPixelRow);
0659           (meMaxRowLay_)->Fill((int)maxPixelRow);
0660           (meMinColLay_)->Fill((int)minPixelCol);
0661           (meMaxColLay_)->Fill((int)maxPixelCol);
0662           (meXLay_)->Fill((float)x);
0663           (meYLay_)->Fill((float)y);
0664           (meSizeXLay_)->Fill((int)sizeX);
0665           (meSizeYLay_)->Fill((int)sizeY);
0666           if (twoD)
0667             (mePixClustersLay_)->Fill((float)y, (float)x);
0668           else {
0669             (mePixClustersLay_px_)->Fill((float)y);
0670             (mePixClustersLay_py_)->Fill((float)x);
0671           }
0672         }
0673       }
0674       if (phion && barrel) {
0675         (meChargePhi_)->Fill((float)charge);
0676         (meSizePhi_)->Fill((int)size);
0677         if (!reducedSet) {
0678           (meMinRowPhi_)->Fill((int)minPixelRow);
0679           (meMaxRowPhi_)->Fill((int)maxPixelRow);
0680           (meMinColPhi_)->Fill((int)minPixelCol);
0681           (meMaxColPhi_)->Fill((int)maxPixelCol);
0682           (meXPhi_)->Fill((float)x);
0683           (meYPhi_)->Fill((float)y);
0684           (meSizeXPhi_)->Fill((int)sizeX);
0685           (meSizeYPhi_)->Fill((int)sizeY);
0686           if (twoD)
0687             (mePixClustersPhi_)->Fill((float)y, (float)x);
0688           else {
0689             (mePixClustersPhi_px_)->Fill((float)y);
0690             (mePixClustersPhi_py_)->Fill((float)x);
0691           }
0692         }
0693       }
0694       if (bladeon && endcap) {
0695         (meChargeBlade_)->Fill((float)charge);
0696         (meSizeBlade_)->Fill((int)size);
0697         if (!reducedSet) {
0698           (meMinRowBlade_)->Fill((int)minPixelRow);
0699           (meMaxRowBlade_)->Fill((int)maxPixelRow);
0700           (meMinColBlade_)->Fill((int)minPixelCol);
0701           (meMaxColBlade_)->Fill((int)maxPixelCol);
0702           (meXBlade_)->Fill((float)x);
0703           (meYBlade_)->Fill((float)y);
0704           (meSizeXBlade_)->Fill((int)sizeX);
0705           (meSizeYBlade_)->Fill((int)sizeY);
0706         }
0707       }
0708       if (diskon && endcap) {
0709         (meChargeDisk_)->Fill((float)charge);
0710         (meSizeDisk_)->Fill((int)size);
0711         if (!reducedSet) {
0712           (meMinRowDisk_)->Fill((int)minPixelRow);
0713           (meMaxRowDisk_)->Fill((int)maxPixelRow);
0714           (meMinColDisk_)->Fill((int)minPixelCol);
0715           (meMaxColDisk_)->Fill((int)maxPixelCol);
0716           (meXDisk_)->Fill((float)x);
0717           (meYDisk_)->Fill((float)y);
0718           (meSizeXDisk_)->Fill((int)sizeX);
0719           (meSizeYDisk_)->Fill((int)sizeY);
0720         }
0721       }
0722 
0723       if (ringon && endcap) {
0724         (meChargeRing_)->Fill((float)charge);
0725         (meSizeRing_)->Fill((int)size);
0726         if (!reducedSet) {
0727           (meMinRowRing_)->Fill((int)minPixelRow);
0728           (meMaxRowRing_)->Fill((int)maxPixelRow);
0729           (meMinColRing_)->Fill((int)minPixelCol);
0730           (meMaxColRing_)->Fill((int)maxPixelCol);
0731           (meXRing_)->Fill((float)x);
0732           (meYRing_)->Fill((float)y);
0733           (meSizeXRing_)->Fill((int)sizeX);
0734           (meSizeYRing_)->Fill((int)sizeY);
0735           if (twoD)
0736             (mePixClustersRing_)->Fill((float)y, (float)x);
0737           else {
0738             (mePixClustersRing_px_)->Fill((float)y);
0739             (mePixClustersRing_py_)->Fill((float)x);
0740           }
0741         }
0742       }
0743     }
0744     if (modon)
0745       (meNClusters_)->Fill((float)numberOfClusters);
0746     if (ladon && barrel)
0747       (meNClustersLad_)->Fill((float)numberOfClusters);
0748     if (layon && barrel)
0749       (meNClustersLay_)->Fill((float)numberOfClusters);
0750     if (phion && barrel)
0751       (meNClustersPhi_)->Fill((float)numberOfClusters);
0752     if (bladeon && endcap)
0753       (meNClustersBlade_)->Fill((float)numberOfClusters);
0754     if (diskon && endcap)
0755       (meNClustersDisk_)->Fill((float)numberOfClusters);
0756     if (ringon && endcap)
0757       (meNClustersRing_)->Fill((float)numberOfClusters);
0758   }
0759 
0760   // std::cout<<"number of detector units="<<numberOfDetUnits<<std::endl;
0761   return numberOfFpixClusters;
0762 }