CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/SiPixelMonitorCluster/src/SiPixelClusterModule.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    SiPixelMonitorCluster
00004 // Class:      SiPixelClusterSource
00005 // 
00013 //
00014 // Original Author:  Vincenzo Chiochia & Andrew York
00015 //         Created:  
00016 // $Id: SiPixelClusterModule.cc,v 1.32 2012/02/20 12:42:03 duggan Exp $
00017 //
00018 //
00019 // Updated by: Lukas Wehrli
00020 // for pixel offline DQM 
00021 #include "DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h"
00022 #include "DQMServices/Core/interface/DQMStore.h"
00023 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
00025 #include "FWCore/ServiceRegistry/interface/Service.h"
00026 // STL
00027 #include <vector>
00028 #include <memory>
00029 #include <string>
00030 #include <iostream>
00031 #include <stdlib.h>
00032 
00033 // Data Formats
00034 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00035 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00036 #include "DataFormats/DetId/interface/DetId.h"
00037 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00038 //
00039 // Constructors
00040 //
00041 SiPixelClusterModule::SiPixelClusterModule() : id_(0),
00042                                          ncols_(416),
00043                                          nrows_(160) { }
00045 SiPixelClusterModule::SiPixelClusterModule(const uint32_t& id) : 
00046   id_(id),
00047   ncols_(416),
00048   nrows_(160)
00049 { 
00050 }
00052 SiPixelClusterModule::SiPixelClusterModule(const uint32_t& id, const int& ncols, const int& nrows) : 
00053   id_(id),
00054   ncols_(ncols),
00055   nrows_(nrows)
00056 { 
00057 }
00058 //
00059 // Destructor
00060 //
00061 SiPixelClusterModule::~SiPixelClusterModule() {}
00062 //
00063 // Book histograms
00064 //
00065 void SiPixelClusterModule::book(const edm::ParameterSet& iConfig, int type, bool twoD, bool reducedSet) {
00066   
00067   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00068   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00069   bool isHalfModule = false;
00070   if(barrel){
00071     isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule(); 
00072   }
00073   int nbinx = ncols_/2;
00074   int nbiny = nrows_/2;
00075 
00076   std::string hid;
00077   // Get collection name and instantiate Histo Id builder
00078   edm::InputTag src = iConfig.getParameter<edm::InputTag>( "src" );
00079   // Get DQM interface
00080   DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
00081   if(type==0){
00082     SiPixelHistogramId* theHistogramId = new SiPixelHistogramId( src.label() );
00083     // Number of clusters
00084     //hid = theHistogramId->setHistoId("nclusters",id_);
00085     //meNClusters_ = theDMBE->book1D(hid,"Number of Clusters",8,0.,8.);
00086     //meNClusters_->setAxisTitle("Number of Clusters",1);
00087     // Total cluster charge in MeV
00088     //hid = theHistogramId->setHistoId("charge",id_);
00089     //meCharge_ = theDMBE->book1D(hid,"Cluster charge",100,0.,200.);
00090     //meCharge_->setAxisTitle("Charge [kilo electrons]",1);
00091     // Total cluster size (in pixels)
00092     //hid = theHistogramId->setHistoId("size",id_);
00093     //meSize_ = theDMBE->book1D(hid,"Total cluster size",30,0.,30.);
00094     //meSize_->setAxisTitle("Cluster size [number of pixels]",1);
00095     if(!reducedSet){
00096       // Lowest cluster row
00097       hid = theHistogramId->setHistoId("minrow",id_);
00098       meMinRow_ = theDMBE->book1D(hid,"Lowest cluster row",200,0.,200.);
00099       meMinRow_->setAxisTitle("Lowest cluster row",1);
00100       // Highest cluster row
00101       hid = theHistogramId->setHistoId("maxrow",id_);
00102       meMaxRow_ = theDMBE->book1D(hid,"Highest cluster row",200,0.,200.);
00103       meMaxRow_->setAxisTitle("Highest cluster row",1);
00104       // Lowest cluster column
00105       hid = theHistogramId->setHistoId("mincol",id_);
00106       meMinCol_ = theDMBE->book1D(hid,"Lowest cluster column",500,0.,500.);
00107       meMinCol_->setAxisTitle("Lowest cluster column",1);
00108       // Highest cluster column
00109       hid = theHistogramId->setHistoId("maxcol",id_);
00110       meMaxCol_ = theDMBE->book1D(hid,"Highest cluster column",500,0.,500.);
00111       meMaxCol_->setAxisTitle("Highest cluster column",1);
00112       // Cluster barycenter X position
00113       hid = theHistogramId->setHistoId("x",id_);
00114       meX_ = theDMBE->book1D(hid,"Cluster barycenter X (row #)",200,0.,200.);
00115       meX_->setAxisTitle("Barycenter x-position [row #]",1);
00116       // Cluster barycenter Y position
00117       hid = theHistogramId->setHistoId("y",id_);
00118       meY_ = theDMBE->book1D(hid,"Cluster barycenter Y (column #)",500,0.,500.);
00119       meY_->setAxisTitle("Barycenter y-position [column #]",1);
00120       // Cluster width on the x-axis
00121       hid = theHistogramId->setHistoId("sizeX",id_);
00122       meSizeX_ = theDMBE->book1D(hid,"Cluster x-width (rows)",10,0.,10.);
00123       meSizeX_->setAxisTitle("Cluster x-size [rows]",1);
00124       // Cluster width on the y-axis
00125       hid = theHistogramId->setHistoId("sizeY",id_);
00126       meSizeY_ = theDMBE->book1D(hid,"Cluster y-width (columns)",15,0.,15.);
00127       meSizeY_->setAxisTitle("Cluster y-size [columns]",1);
00128       int nbinx = ncols_/2;
00129       int nbiny = nrows_/2;
00130       hid = theHistogramId->setHistoId("hitmap",id_);
00131       if(twoD){
00132         // 2D hit map
00133         mePixClusters_ = theDMBE->book2D(hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00134         mePixClusters_->setAxisTitle("Columns",1);
00135         mePixClusters_->setAxisTitle("Rows",2);
00136       }else{
00137         // projections of hitmap
00138         mePixClusters_px_ = theDMBE->book1D(hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00139         mePixClusters_py_ = theDMBE->book1D(hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00140         mePixClusters_px_->setAxisTitle("Columns",1);
00141         mePixClusters_py_->setAxisTitle("Rows",1);
00142       }
00143     }
00144     delete theHistogramId;
00145   }
00146 
00147   //**
00148   if(barrel && type==7){
00149     hid = src.label() + "_Barrel";
00150     meSizeYvsEtaBarrel_= theDMBE->book2D("sizeYvsEta_" + hid,"Cluster size along beamline vs. Cluster position #eta",60,-3.,3.,40,0.,40.);
00151     meSizeYvsEtaBarrel_->setAxisTitle("Cluster #eta",1);
00152     meSizeYvsEtaBarrel_->setAxisTitle("Cluster size along beamline [number of pixels]",2);
00153   }
00154   if(type==1 && barrel){
00155     uint32_t DBladder = PixelBarrelName(DetId(id_)).ladderName();
00156     char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
00157     hid = src.label() + "_" + sladder;
00158     if(isHalfModule) hid += "H";
00159     else hid += "F";
00160     // Number of clusters
00161     meNClustersLad_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",8,0.,8.);
00162     meNClustersLad_->setAxisTitle("Number of Clusters",1);
00163     // Total cluster charge in MeV
00164     meChargeLad_ = theDMBE->book1D("charge_" + hid,"Cluster charge",100,0.,200.);
00165     meChargeLad_->setAxisTitle("Charge [kilo electrons]",1);
00166     // Total cluster size (in pixels)
00167     meSizeLad_ = theDMBE->book1D("size_" + hid,"Total cluster size",30,0.,30.);
00168     meSizeLad_->setAxisTitle("Cluster size [number of pixels]",1);
00169     if(!reducedSet){
00170       // Lowest cluster row
00171       meMinRowLad_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00172       meMinRowLad_->setAxisTitle("Lowest cluster row",1);
00173       // Highest cluster row
00174       meMaxRowLad_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00175       meMaxRowLad_->setAxisTitle("Highest cluster row",1);
00176       // Lowest cluster column
00177       meMinColLad_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00178       meMinColLad_->setAxisTitle("Lowest cluster column",1);
00179       // Highest cluster column
00180       meMaxColLad_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00181       meMaxColLad_->setAxisTitle("Highest cluster column",1);
00182       // Cluster barycenter X position
00183       meXLad_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00184       meXLad_->setAxisTitle("Barycenter x-position [row #]",1);
00185       // Cluster barycenter Y position
00186       meYLad_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00187       meYLad_->setAxisTitle("Barycenter y-position [column #]",1);
00188       // Cluster width on the x-axis
00189       meSizeXLad_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00190       meSizeXLad_->setAxisTitle("Cluster x-size [rows]",1);
00191       // Cluster width on the y-axis
00192       meSizeYLad_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",15,0.,15.);
00193       meSizeYLad_->setAxisTitle("Cluster y-size [columns]",1);
00194       if(twoD){
00195         // 2D hit map
00196         mePixClustersLad_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00197         mePixClustersLad_->setAxisTitle("Columns",1);
00198         mePixClustersLad_->setAxisTitle("Rows",2);
00199       }else{
00200         // projections of hitmap
00201         mePixClustersLad_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00202         mePixClustersLad_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00203         mePixClustersLad_px_->setAxisTitle("Columns",1);
00204         mePixClustersLad_py_->setAxisTitle("Rows",1);
00205       }
00206     }
00207   }
00208 
00209   if(type==2 && barrel){
00210     
00211     uint32_t DBlayer = PixelBarrelName(DetId(id_)).layerName();
00212     char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
00213     hid = src.label() + "_" + slayer;
00214     // Number of clusters
00215     meNClustersLay_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",8,0.,8.);
00216     meNClustersLay_->setAxisTitle("Number of Clusters",1);
00217     // Total cluster charge in MeV
00218     meChargeLay_ = theDMBE->book1D("charge_" + hid,"Cluster charge",100,0.,200.);
00219     meChargeLay_->setAxisTitle("Charge [kilo electrons]",1);
00220     // Total cluster size (in pixels)
00221     meSizeLay_ = theDMBE->book1D("size_" + hid,"Total cluster size",30,0.,30.);
00222     meSizeLay_->setAxisTitle("Cluster size [in pixels]",1);
00223     if(!reducedSet){
00224       // Lowest cluster row
00225       meMinRowLay_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00226       meMinRowLay_->setAxisTitle("Lowest cluster row",1);
00227       // Highest cluster row
00228       meMaxRowLay_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00229       meMaxRowLay_->setAxisTitle("Highest cluster row",1);
00230       // Lowest cluster column
00231       meMinColLay_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00232       meMinColLay_->setAxisTitle("Lowest cluster column",1);
00233       // Highest cluster column
00234       meMaxColLay_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00235       meMaxColLay_->setAxisTitle("Highest cluster column",1);
00236       // Cluster barycenter X position
00237       meXLay_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00238       meXLay_->setAxisTitle("Barycenter x-position [row #]",1);
00239       // Cluster barycenter Y position
00240       meYLay_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00241       meYLay_->setAxisTitle("Barycenter y-position [column #]",1);
00242       // Cluster width on the x-axis
00243       meSizeXLay_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00244       meSizeXLay_->setAxisTitle("Cluster x-size [rows]",1);
00245       // Cluster width on the y-axis
00246       meSizeYLay_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",15,0.,15.);
00247       meSizeYLay_->setAxisTitle("Cluster y-size [columns]",1);
00248       if(twoD){
00249         // 2D hit map
00250         if(isHalfModule){
00251           mePixClustersLay_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),2*nbiny,0.,float(2*nrows_));
00252         }else{
00253           mePixClustersLay_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00254         }
00255         mePixClustersLay_->setAxisTitle("Columns",1);
00256         mePixClustersLay_->setAxisTitle("Rows",2);
00257       }else{
00258         // projections of hitmap
00259         mePixClustersLay_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00260         if(isHalfModule){
00261           mePixClustersLay_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",2*nbiny,0.,float(2*nrows_));
00262         }else{
00263           mePixClustersLay_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00264         }
00265         mePixClustersLay_px_->setAxisTitle("Columns",1);
00266         mePixClustersLay_py_->setAxisTitle("Rows",1);
00267       }
00268     }
00269   }
00270   if(type==3 && barrel){
00271     uint32_t DBmodule = PixelBarrelName(DetId(id_)).moduleName();
00272     char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
00273     hid = src.label() + "_" + smodule;
00274     // Number of clusters
00275     meNClustersPhi_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",8,0.,8.);
00276     meNClustersPhi_->setAxisTitle("Number of Clusters",1);
00277     // Total cluster charge in MeV
00278     meChargePhi_ = theDMBE->book1D("charge_" + hid,"Cluster charge",100,0.,200.);
00279     meChargePhi_->setAxisTitle("Charge [kilo electrons]",1);
00280     // Total cluster size (in pixels)
00281     meSizePhi_ = theDMBE->book1D("size_" + hid,"Total cluster size",30,0.,30.);
00282     meSizePhi_->setAxisTitle("Cluster size [number of pixels]",1);
00283     if(!reducedSet){
00284       // Lowest cluster row
00285       meMinRowPhi_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00286       meMinRowPhi_->setAxisTitle("Lowest cluster row",1);
00287       // Highest cluster row
00288       meMaxRowPhi_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00289       meMaxRowPhi_->setAxisTitle("Highest cluster row",1);
00290       // Lowest cluster column
00291       meMinColPhi_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00292       meMinColPhi_->setAxisTitle("Lowest cluster column",1);
00293       // Highest cluster column
00294       meMaxColPhi_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00295       meMaxColPhi_->setAxisTitle("Highest cluster column",1);
00296       // Cluster barycenter X position
00297       meXPhi_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00298       meXPhi_->setAxisTitle("Barycenter x-position [row #]",1);
00299       // Cluster barycenter Y position
00300       meYPhi_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00301       meYPhi_->setAxisTitle("Barycenter y-position [column #]",1);
00302       // Cluster width on the x-axis
00303       meSizeXPhi_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00304       meSizeXPhi_->setAxisTitle("Cluster x-size [rows]",1);
00305       // Cluster width on the y-axis
00306       meSizeYPhi_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",15,0.,15.);
00307       meSizeYPhi_->setAxisTitle("Cluster y-size [columns]",1);
00308       if(twoD){
00309         // 2D hit map
00310         if(isHalfModule){
00311           mePixClustersPhi_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),2*nbiny,0.,float(2*nrows_));
00312         }else{
00313           mePixClustersPhi_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00314         }
00315         mePixClustersPhi_->setAxisTitle("Columns",1);
00316         mePixClustersPhi_->setAxisTitle("Rows",2);
00317       }else{
00318         // projections of hitmap
00319         mePixClustersPhi_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00320         if(isHalfModule){
00321           mePixClustersPhi_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",2*nbiny,0.,float(2*nrows_));
00322         }else{
00323           mePixClustersPhi_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00324         }
00325         mePixClustersPhi_px_->setAxisTitle("Columns",1);
00326         mePixClustersPhi_py_->setAxisTitle("Rows",1);
00327       }
00328     }
00329   }
00330 
00331   if(type==4 && endcap){
00332     uint32_t blade= PixelEndcapName(DetId(id_)).bladeName();
00333     
00334     char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
00335     hid = src.label() + "_" + sblade;
00336     // Number of clusters
00337     meNClustersBlade_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",8,0.,8.);
00338     meNClustersBlade_->setAxisTitle("Number of Clusters",1);
00339     // Total cluster charge in MeV
00340     meChargeBlade_ = theDMBE->book1D("charge_" + hid,"Cluster charge",100,0.,200.);
00341     meChargeBlade_->setAxisTitle("Charge [kilo electrons]",1);
00342     // Total cluster size (in pixels)
00343     meSizeBlade_ = theDMBE->book1D("size_" + hid,"Total cluster size",30,0.,30.);
00344     meSizeBlade_->setAxisTitle("Cluster size [number of pixels]",1);
00345     if(!reducedSet){
00346       // Lowest cluster row
00347       meMinRowBlade_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00348       meMinRowBlade_->setAxisTitle("Lowest cluster row",1);
00349       // Highest cluster row
00350       meMaxRowBlade_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00351       meMaxRowBlade_->setAxisTitle("Highest cluster row",1);
00352       // Lowest cluster column
00353       meMinColBlade_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00354       meMinColBlade_->setAxisTitle("Lowest cluster column",1);
00355       // Highest cluster column
00356       meMaxColBlade_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00357       meMaxColBlade_->setAxisTitle("Highest cluster column",1);
00358       // Cluster barycenter X position
00359       meXBlade_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00360       meXBlade_->setAxisTitle("Barycenter x-position [row #]",1);
00361       // Cluster barycenter Y position
00362       meYBlade_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00363       meYBlade_->setAxisTitle("Barycenter y-position [column #]",1);
00364       // Cluster width on the x-axis
00365       meSizeXBlade_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00366       meSizeXBlade_->setAxisTitle("Cluster x-size [rows]",1);
00367       // Cluster width on the y-axis
00368       meSizeYBlade_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",15,0.,15.);
00369       meSizeYBlade_->setAxisTitle("Cluster y-size [columns]",1);
00370     }
00371   }
00372   if(type==5 && endcap){
00373     uint32_t disk = PixelEndcapName(DetId(id_)).diskName();
00374     
00375     char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
00376     hid = src.label() + "_" + sdisk;
00377     // Number of clusters
00378     meNClustersDisk_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",8,0.,8.);
00379     meNClustersDisk_->setAxisTitle("Number of Clusters",1);
00380     // Total cluster charge in MeV
00381     meChargeDisk_ = theDMBE->book1D("charge_" + hid,"Cluster charge",100,0.,200.);
00382     meChargeDisk_->setAxisTitle("Charge [kilo electrons]",1);
00383     // Total cluster size (in pixels)
00384     meSizeDisk_ = theDMBE->book1D("size_" + hid,"Total cluster size",30,0.,30.);
00385     meSizeDisk_->setAxisTitle("Cluster size [number of pixels]",1);
00386     if(!reducedSet){
00387       // Lowest cluster row
00388       meMinRowDisk_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00389       meMinRowDisk_->setAxisTitle("Lowest cluster row",1);
00390       // Highest cluster row
00391       meMaxRowDisk_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00392       meMaxRowDisk_->setAxisTitle("Highest cluster row",1);
00393       // Lowest cluster column
00394       meMinColDisk_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00395       meMinColDisk_->setAxisTitle("Lowest cluster column",1);
00396       // Highest cluster column
00397       meMaxColDisk_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00398       meMaxColDisk_->setAxisTitle("Highest cluster column",1);
00399       // Cluster barycenter X position
00400       meXDisk_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00401       meXDisk_->setAxisTitle("Barycenter x-position [row #]",1);
00402       // Cluster barycenter Y position
00403       meYDisk_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00404       meYDisk_->setAxisTitle("Barycenter y-position [column #]",1);
00405       // Cluster width on the x-axis
00406       meSizeXDisk_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00407       meSizeXDisk_->setAxisTitle("Cluster x-size [rows]",1);
00408       // Cluster width on the y-axis
00409       meSizeYDisk_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",15,0.,15.);
00410       meSizeYDisk_->setAxisTitle("Cluster y-size [columns]",1);
00411     }
00412   }
00413 
00414   if(type==6 && endcap){
00415     uint32_t panel= PixelEndcapName(DetId(id_)).pannelName();
00416     uint32_t module= PixelEndcapName(DetId(id_)).plaquetteName();
00417     char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
00418     hid = src.label() + "_" + slab;
00419     // Number of clusters
00420     meNClustersRing_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",8,0.,8.);
00421     meNClustersRing_->setAxisTitle("Number of Clusters",1);
00422     // Total cluster charge in MeV
00423     meChargeRing_ = theDMBE->book1D("charge_" + hid,"Cluster charge",100,0.,200.);
00424     meChargeRing_->setAxisTitle("Charge [kilo electrons]",1);
00425     // Total cluster size (in pixels)
00426     meSizeRing_ = theDMBE->book1D("size_" + hid,"Total cluster size",30,0.,30.);
00427     meSizeRing_->setAxisTitle("Cluster size [number of pixels]",1);
00428     if(!reducedSet){
00429       // Lowest cluster row
00430       meMinRowRing_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00431       meMinRowRing_->setAxisTitle("Lowest cluster row",1);
00432       // Highest cluster row
00433       meMaxRowRing_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00434       meMaxRowRing_->setAxisTitle("Highest cluster row",1);
00435       // Lowest cluster column
00436       meMinColRing_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00437       meMinColRing_->setAxisTitle("Lowest cluster column",1);
00438       // Highest cluster column
00439       meMaxColRing_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00440       meMaxColRing_->setAxisTitle("Highest cluster column",1);
00441       // Cluster barycenter X position
00442       meXRing_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00443       meXRing_->setAxisTitle("Barycenter x-position [row #]",1);
00444       // Cluster barycenter Y position
00445       meYRing_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00446       meYRing_->setAxisTitle("Barycenter y-position [column #]",1);
00447       // Cluster width on the x-axis
00448       meSizeXRing_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00449       meSizeXRing_->setAxisTitle("Cluster x-size [rows]",1);
00450       // Cluster width on the y-axis
00451       meSizeYRing_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",15,0.,15.);
00452       meSizeYRing_->setAxisTitle("Cluster y-size [columns]",1);
00453       if(twoD){
00454         // 2D hit map
00455         mePixClustersRing_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00456         mePixClustersRing_->setAxisTitle("Columns",1);
00457         mePixClustersRing_->setAxisTitle("Rows",2);
00458       }else{
00459         // projections of hitmap
00460         mePixClustersRing_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00461         mePixClustersRing_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00462         mePixClustersRing_px_->setAxisTitle("Columns",1);
00463         mePixClustersRing_py_->setAxisTitle("Rows",1);
00464       }
00465     }
00466   }
00467   
00468 }
00469 //
00470 // Fill histograms
00471 //
00472 int SiPixelClusterModule::fill(const edmNew::DetSetVector<SiPixelCluster>& input, const TrackerGeometry* tracker,bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon, bool twoD, bool reducedSet, bool smileyon) {
00473   
00474   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00475   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00476   
00477   edmNew::DetSetVector<SiPixelCluster>::const_iterator isearch = input.find(id_); // search  clusters of detid
00478   unsigned int numberOfClusters = 0;
00479   unsigned int numberOfFpixClusters = 0;
00480   
00481   if( isearch != input.end() ) {  // Not an empty iterator
00482 
00483     
00484     // Look at clusters now
00485     edmNew::DetSet<SiPixelCluster>::const_iterator  di;
00486     //for(di = isearch->data.begin(); di != isearch->data.end(); di++) {
00487     for(di = isearch->begin(); di != isearch->end(); di++) {
00488       numberOfClusters++;
00489       if(endcap) numberOfFpixClusters++;
00490       float charge = 0.001*(di->charge()); // total charge of cluster
00491       float x = di->x();                   // barycenter x position
00492       float y = di->y();                   // barycenter y position
00493       int size = di->size();               // total size of cluster (in pixels)
00494       int sizeX = di->sizeX();             // size of cluster in x-direction
00495       int sizeY = di->sizeY();             // size of cluster in y-direction
00496       int minPixelRow = di->minPixelRow(); // min x index
00497       int maxPixelRow = di->maxPixelRow(); // max x index
00498       int minPixelCol = di->minPixelCol(); // min y index
00499       int maxPixelCol = di->maxPixelCol(); // max y index
00500       //      bool edgeHitX = di->edgeHitX();      // records if a cluster is at the x-edge of the detector
00501       //      bool edgeHitY = di->edgeHitY();      // records if a cluster is at the y-edge of the detector
00502       
00503 
00504       //**
00505      // edm::ESHandle<TrackerGeometry> pDD;
00506      // es.get<TrackerDigiGeometryRecord> ().get (pDD);
00507      // const TrackerGeometry* tracker = &(* pDD);
00508       const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(DetId(id_)) );
00509       //**
00510       const PixelTopology * topol = &(theGeomDet->specificTopology());
00511       LocalPoint clustlp = topol->localPosition( MeasurementPoint(x, y) );
00512       GlobalPoint clustgp = theGeomDet->surface().toGlobal( clustlp );
00513       //**end
00514       if(modon){
00515         //(meCharge_)->Fill((float)charge);
00516         //(meSize_)->Fill((int)size);
00517         DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
00518         std::string currDir = theDMBE->pwd();
00519         theDMBE->cd("Pixel/Clusters/OffTrack/");
00520         MonitorElement * me;
00521         if(barrel){
00522           uint32_t DBlayer = PixelBarrelName(DetId(id_)).layerName();
00523           switch(DBlayer){
00524           case 1: {
00525             me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_Layer_1");
00526             if(me) me->Fill(clustgp.z(),clustgp.phi());
00527             break;
00528           } case 2: {
00529             me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_Layer_2");
00530             if(me) me->Fill(clustgp.z(),clustgp.phi());
00531             break;
00532           } case 3: {
00533             me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_Layer_3");
00534             if(me) me->Fill(clustgp.z(),clustgp.phi());
00535             break;
00536           }} 
00537         }else if(endcap){
00538           uint32_t DBdisk = PixelEndcapName(DetId(id_)).diskName();
00539           if(clustgp.z()>0){
00540             switch(DBdisk){
00541             case 1: {
00542               me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_pz_Disk_1");
00543               if(me) me->Fill(clustgp.x(),clustgp.y());
00544               break;
00545             } case 2: {
00546               me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_pz_Disk_2");
00547               if(me) me->Fill(clustgp.x(),clustgp.y());
00548               break;
00549             }}
00550          }else{
00551             switch(DBdisk){
00552             case 1: {
00553               me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_mz_Disk_1");
00554               if(me) me->Fill(clustgp.x(),clustgp.y());
00555               break;
00556             } case 2: {
00557               me = theDMBE->get("Pixel/Clusters/OffTrack/position_siPixelClusters_mz_Disk_2");
00558               if(me) me->Fill(clustgp.x(),clustgp.y());
00559               break;
00560             }}
00561           } 
00562         }
00563         theDMBE->cd(currDir);
00564         if(!reducedSet)
00565         {
00566           (meMinRow_)->Fill((int)minPixelRow);
00567           (meMaxRow_)->Fill((int)maxPixelRow);
00568           (meMinCol_)->Fill((int)minPixelCol);
00569           (meMaxCol_)->Fill((int)maxPixelCol);
00570           (meSizeX_)->Fill((int)sizeX);
00571           (meSizeY_)->Fill((int)sizeY);
00572           (meX_)->Fill((float)x);
00573           (meY_)->Fill((float)y);
00574           if(twoD)(mePixClusters_)->Fill((float)y,(float)x);
00575           else{
00576                   (mePixClusters_px_)->Fill((float)y);
00577                 (mePixClusters_py_)->Fill((float)x);
00578           }
00579         }
00580         //      (meEdgeHitX_)->Fill((int)edgeHitX);
00581         //      (meEdgeHitY_)->Fill((int)edgeHitY);
00582       }
00583       //**
00584       if(barrel && smileyon){
00585         (meSizeYvsEtaBarrel_)->Fill(clustgp.eta(),sizeY);
00586         //std::cout << "Cluster Global x y z theta eta " << clustgp.x() << " " << clustgp.y() << " " << clustgp.z() << " " << clustgp.theta() << " " << clustgp.eta() << std::endl;
00587       }      
00588       if(ladon && barrel){
00589         (meChargeLad_)->Fill((float)charge);
00590         (meSizeLad_)->Fill((int)size);
00591         if(!reducedSet)
00592         {
00593         (meMinRowLad_)->Fill((int)minPixelRow);
00594         (meMaxRowLad_)->Fill((int)maxPixelRow);
00595         (meMinColLad_)->Fill((int)minPixelCol);
00596         (meMaxColLad_)->Fill((int)maxPixelCol);
00597         (meXLad_)->Fill((float)x);
00598         (meYLad_)->Fill((float)y);
00599         (meSizeXLad_)->Fill((int)sizeX);
00600         (meSizeYLad_)->Fill((int)sizeY);
00601         if(twoD) (mePixClustersLad_)->Fill((float)y,(float)x);
00602         else{
00603           (mePixClustersLad_px_)->Fill((float)y);
00604           (mePixClustersLad_py_)->Fill((float)x);
00605         }
00606         }
00607       }
00608       if(layon && barrel){
00609         (meChargeLay_)->Fill((float)charge);
00610         (meSizeLay_)->Fill((int)size);
00611         if(!reducedSet)
00612         {
00613         (meMinRowLay_)->Fill((int)minPixelRow);
00614         (meMaxRowLay_)->Fill((int)maxPixelRow);
00615         (meMinColLay_)->Fill((int)minPixelCol);
00616         (meMaxColLay_)->Fill((int)maxPixelCol);
00617         (meXLay_)->Fill((float)x);
00618         (meYLay_)->Fill((float)y);
00619         (meSizeXLay_)->Fill((int)sizeX);
00620         (meSizeYLay_)->Fill((int)sizeY);
00621         if(twoD) (mePixClustersLay_)->Fill((float)y,(float)x);
00622         else{
00623           (mePixClustersLay_px_)->Fill((float)y);
00624           (mePixClustersLay_py_)->Fill((float)x);
00625         }
00626         }
00627       }
00628       if(phion && barrel){
00629         (meChargePhi_)->Fill((float)charge);
00630         (meSizePhi_)->Fill((int)size);
00631         if(!reducedSet)
00632         {
00633         (meMinRowPhi_)->Fill((int)minPixelRow);
00634         (meMaxRowPhi_)->Fill((int)maxPixelRow);
00635         (meMinColPhi_)->Fill((int)minPixelCol);
00636         (meMaxColPhi_)->Fill((int)maxPixelCol);
00637         (meXPhi_)->Fill((float)x);
00638         (meYPhi_)->Fill((float)y);
00639         (meSizeXPhi_)->Fill((int)sizeX);
00640         (meSizeYPhi_)->Fill((int)sizeY);
00641         if(twoD) (mePixClustersPhi_)->Fill((float)y,(float)x);
00642         else{
00643           (mePixClustersPhi_px_)->Fill((float)y);
00644           (mePixClustersPhi_py_)->Fill((float)x);
00645         }
00646         }
00647       }
00648       if(bladeon && endcap){
00649         (meChargeBlade_)->Fill((float)charge);
00650         (meSizeBlade_)->Fill((int)size);
00651         if(!reducedSet)
00652         {
00653         (meMinRowBlade_)->Fill((int)minPixelRow);
00654         (meMaxRowBlade_)->Fill((int)maxPixelRow);
00655         (meMinColBlade_)->Fill((int)minPixelCol);
00656         (meMaxColBlade_)->Fill((int)maxPixelCol);
00657         (meXBlade_)->Fill((float)x);
00658         (meYBlade_)->Fill((float)y);
00659         (meSizeXBlade_)->Fill((int)sizeX);
00660         (meSizeYBlade_)->Fill((int)sizeY);
00661         }
00662       }
00663       if(diskon && endcap){
00664         (meChargeDisk_)->Fill((float)charge);
00665         (meSizeDisk_)->Fill((int)size);
00666         if(!reducedSet)
00667         {
00668         (meMinRowDisk_)->Fill((int)minPixelRow);
00669         (meMaxRowDisk_)->Fill((int)maxPixelRow);
00670         (meMinColDisk_)->Fill((int)minPixelCol);
00671         (meMaxColDisk_)->Fill((int)maxPixelCol);
00672         (meXDisk_)->Fill((float)x);
00673         (meYDisk_)->Fill((float)y);
00674         (meSizeXDisk_)->Fill((int)sizeX);
00675         (meSizeYDisk_)->Fill((int)sizeY);
00676         }
00677       }
00678       
00679       if(ringon && endcap){
00680         (meChargeRing_)->Fill((float)charge);
00681         (meSizeRing_)->Fill((int)size);
00682         if(!reducedSet)
00683         {
00684         (meMinRowRing_)->Fill((int)minPixelRow);
00685         (meMaxRowRing_)->Fill((int)maxPixelRow);
00686         (meMinColRing_)->Fill((int)minPixelCol);
00687         (meMaxColRing_)->Fill((int)maxPixelCol);
00688         (meXRing_)->Fill((float)x);
00689         (meYRing_)->Fill((float)y);
00690         (meSizeXRing_)->Fill((int)sizeX);
00691         (meSizeYRing_)->Fill((int)sizeY);
00692         if(twoD) (mePixClustersRing_)->Fill((float)y,(float)x);
00693         else{
00694           (mePixClustersRing_px_)->Fill((float)y);
00695           (mePixClustersRing_py_)->Fill((float)x);
00696         }
00697         }
00698       }
00699     }
00700     //if(modon) (meNClusters_)->Fill((float)numberOfClusters);
00701     if(ladon && barrel) (meNClustersLad_)->Fill((float)numberOfClusters);
00702     if(layon && barrel) (meNClustersLay_)->Fill((float)numberOfClusters);
00703     if(phion && barrel) (meNClustersPhi_)->Fill((float)numberOfClusters);
00704     if(bladeon && endcap) (meNClustersBlade_)->Fill((float)numberOfClusters);
00705     if(diskon && endcap) (meNClustersDisk_)->Fill((float)numberOfClusters);
00706     if(ringon && endcap) (meNClustersRing_)->Fill((float)numberOfClusters);
00707 
00708     //std::cout<<"number of clusters="<<numberOfClusters<<std::endl;
00709       
00710 
00711   }
00712   
00713   
00714   //std::cout<<"number of detector units="<<numberOfDetUnits<<std::endl;
00715   return numberOfFpixClusters;
00716   
00717 }