CMS 3D CMS Logo

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.18 2008/09/02 13:52:17 merkelp 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::DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00068   bool endcap = DetId::DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00069   bool isHalfModule = false;
00070   if(barrel){
00071     isHalfModule = PixelBarrelName::PixelBarrelName(DetId::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   SiPixelHistogramId* theHistogramId = new SiPixelHistogramId( src.label() );
00080   // Get DQM interface
00081   DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
00082   if(type==0){
00083     // Number of clusters
00084     hid = theHistogramId->setHistoId("nclusters",id_);
00085     meNClusters_ = theDMBE->book1D(hid,"Number of Clusters",50,0.,50.);
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",500,0.,500.);
00090     meCharge_->setAxisTitle("Charge size (MeV)",1);
00091     // Total cluster size (in pixels)
00092     hid = theHistogramId->setHistoId("size",id_);
00093     meSize_ = theDMBE->book1D(hid,"Total cluster size",100,0.,100.);
00094     meSize_->setAxisTitle("Cluster size (in 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)",20,0.,20.);
00127     meSizeY_->setAxisTitle("Cluster y-size (columns)",1);
00128     }
00129     int nbinx = ncols_/2;
00130     int nbiny = nrows_/2;
00131     hid = theHistogramId->setHistoId("hitmap",id_);
00132     if(twoD){
00133       // 2D hit map
00134       mePixClusters_ = theDMBE->book2D(hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00135       mePixClusters_->setAxisTitle("Columns",1);
00136       mePixClusters_->setAxisTitle("Rows",2);
00137     }
00138     else{
00139       // projections of hitmap
00140       mePixClusters_px_ = theDMBE->book1D(hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00141       mePixClusters_py_ = theDMBE->book1D(hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00142       mePixClusters_px_->setAxisTitle("Columns",1);
00143       mePixClusters_py_->setAxisTitle("Rows",1);
00144     }
00145     delete theHistogramId;
00146   }
00147 
00148   if(type==1 && barrel){
00149     uint32_t DBladder = PixelBarrelName::PixelBarrelName(DetId::DetId(id_)).ladderName();
00150     char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
00151     hid = src.label() + "_" + sladder;
00152     if(isHalfModule) hid += "H";
00153     else hid += "F";
00154     // Number of clusters
00155     meNClustersLad_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",50,0.,50.);
00156     meNClustersLad_->setAxisTitle("Number of Clusters",1);
00157     // Total cluster charge in MeV
00158     meChargeLad_ = theDMBE->book1D("charge_" + hid,"Cluster charge",500,0.,500.);
00159     meChargeLad_->setAxisTitle("Charge size (MeV)",1);
00160     // Cluster barycenter X position
00161     meXLad_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00162     meXLad_->setAxisTitle("Barycenter x-position (row #)",1);
00163     // Cluster barycenter Y position
00164     meYLad_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00165     meYLad_->setAxisTitle("Barycenter y-position (column #)",1);
00166     // Total cluster size (in pixels)
00167     meSizeLad_ = theDMBE->book1D("size_" + hid,"Total cluster size",100,0.,100.);
00168     meSizeLad_->setAxisTitle("Cluster size (in pixels)",1);
00169     // Cluster width on the x-axis
00170     meSizeXLad_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00171     meSizeXLad_->setAxisTitle("Cluster x-size (rows)",1);
00172     // Cluster width on the y-axis
00173     meSizeYLad_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",20,0.,20.);
00174     meSizeYLad_->setAxisTitle("Cluster y-size (columns)",1);
00175     // Lowest cluster row
00176     meMinRowLad_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00177     meMinRowLad_->setAxisTitle("Lowest cluster row",1);
00178     // Highest cluster row
00179     meMaxRowLad_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00180     meMaxRowLad_->setAxisTitle("Highest cluster row",1);
00181     // Lowest cluster column
00182     meMinColLad_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00183     meMinColLad_->setAxisTitle("Lowest cluster column",1);
00184     // Highest cluster column
00185     meMaxColLad_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00186     meMaxColLad_->setAxisTitle("Highest cluster column",1);
00187     if(twoD){
00188       // 2D hit map
00189       mePixClustersLad_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00190       mePixClustersLad_->setAxisTitle("Columns",1);
00191       mePixClustersLad_->setAxisTitle("Rows",2);
00192     }
00193     else{
00194       // projections of hitmap
00195       mePixClustersLad_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00196       mePixClustersLad_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00197       mePixClustersLad_px_->setAxisTitle("Columns",1);
00198       mePixClustersLad_py_->setAxisTitle("Rows",1);
00199     }
00200   }
00201 
00202   if(type==2 && barrel){
00203     
00204     uint32_t DBlayer = PixelBarrelName::PixelBarrelName(DetId::DetId(id_)).layerName();
00205     char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
00206     hid = src.label() + "_" + slayer;
00207     // Number of clusters
00208     meNClustersLay_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",50,0.,50.);
00209     meNClustersLay_->setAxisTitle("Number of Clusters",1);
00210     // Total cluster charge in MeV
00211     meChargeLay_ = theDMBE->book1D("charge_" + hid,"Cluster charge",500,0.,500.);
00212     meChargeLay_->setAxisTitle("Charge size (MeV)",1);
00213     // Cluster barycenter X position
00214     meXLay_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00215     meXLay_->setAxisTitle("Barycenter x-position (row #)",1);
00216     // Cluster barycenter Y position
00217     meYLay_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00218     meYLay_->setAxisTitle("Barycenter y-position (column #)",1);
00219     // Total cluster size (in pixels)
00220     meSizeLay_ = theDMBE->book1D("size_" + hid,"Total cluster size",100,0.,100.);
00221     meSizeLay_->setAxisTitle("Cluster size (in pixels)",1);
00222     // Cluster width on the x-axis
00223     meSizeXLay_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00224     meSizeXLay_->setAxisTitle("Cluster x-size (rows)",1);
00225     // Cluster width on the y-axis
00226     meSizeYLay_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",20,0.,20.);
00227     meSizeYLay_->setAxisTitle("Cluster y-size (columns)",1);
00228     // Lowest cluster row
00229     meMinRowLay_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00230     meMinRowLay_->setAxisTitle("Lowest cluster row",1);
00231     // Highest cluster row
00232     meMaxRowLay_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00233     meMaxRowLay_->setAxisTitle("Highest cluster row",1);
00234     // Lowest cluster column
00235     meMinColLay_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00236     meMinColLay_->setAxisTitle("Lowest cluster column",1);
00237     // Highest cluster column
00238     meMaxColLay_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00239     meMaxColLay_->setAxisTitle("Highest cluster column",1);
00240     if(twoD){
00241       // 2D hit map
00242       if(isHalfModule){
00243         mePixClustersLay_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),2*nbiny,0.,float(2*nrows_));
00244       }
00245       else {
00246         mePixClustersLay_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00247       }
00248       mePixClustersLay_->setAxisTitle("Columns",1);
00249       mePixClustersLay_->setAxisTitle("Rows",2);
00250     }
00251     else{
00252       // projections of hitmap
00253       mePixClustersLay_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00254       if(isHalfModule){
00255         mePixClustersLay_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",2*nbiny,0.,float(2*nrows_));
00256       }
00257       else{
00258         mePixClustersLay_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00259       }
00260       mePixClustersLay_px_->setAxisTitle("Columns",1);
00261       mePixClustersLay_py_->setAxisTitle("Rows",1);
00262 
00263     }
00264   }
00265   if(type==3 && barrel){
00266     uint32_t DBmodule = PixelBarrelName::PixelBarrelName(DetId::DetId(id_)).moduleName();
00267     char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
00268     hid = src.label() + "_" + smodule;
00269     // Number of clusters
00270     meNClustersPhi_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",50,0.,50.);
00271     meNClustersPhi_->setAxisTitle("Number of Clusters",1);
00272     // Total cluster charge in MeV
00273     meChargePhi_ = theDMBE->book1D("charge_" + hid,"Cluster charge",500,0.,500.);
00274     meChargePhi_->setAxisTitle("Charge size (MeV)",1);
00275     // Cluster barycenter X position
00276     meXPhi_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00277     meXPhi_->setAxisTitle("Barycenter x-position (row #)",1);
00278     // Cluster barycenter Y position
00279     meYPhi_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00280     meYPhi_->setAxisTitle("Barycenter y-position (column #)",1);
00281     // Total cluster size (in pixels)
00282     meSizePhi_ = theDMBE->book1D("size_" + hid,"Total cluster size",100,0.,100.);
00283     meSizePhi_->setAxisTitle("Cluster size (in pixels)",1);
00284     // Cluster width on the x-axis
00285     meSizeXPhi_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00286     meSizeXPhi_->setAxisTitle("Cluster x-size (rows)",1);
00287     // Cluster width on the y-axis
00288     meSizeYPhi_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",20,0.,20.);
00289     meSizeYPhi_->setAxisTitle("Cluster y-size (columns)",1);
00290     // Lowest cluster row
00291     meMinRowPhi_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00292     meMinRowPhi_->setAxisTitle("Lowest cluster row",1);
00293     // Highest cluster row
00294     meMaxRowPhi_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00295     meMaxRowPhi_->setAxisTitle("Highest cluster row",1);
00296     // Lowest cluster column
00297     meMinColPhi_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00298     meMinColPhi_->setAxisTitle("Lowest cluster column",1);
00299     // Highest cluster column
00300     meMaxColPhi_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00301     meMaxColPhi_->setAxisTitle("Highest cluster column",1);
00302     if(twoD){
00303       // 2D hit map
00304       if(isHalfModule){
00305         mePixClustersPhi_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),2*nbiny,0.,float(2*nrows_));
00306       }
00307       else {
00308         mePixClustersPhi_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00309       }
00310       mePixClustersPhi_->setAxisTitle("Columns",1);
00311       mePixClustersPhi_->setAxisTitle("Rows",2);
00312     }
00313     else{
00314       // projections of hitmap
00315       mePixClustersPhi_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00316       if(isHalfModule){
00317         mePixClustersPhi_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",2*nbiny,0.,float(2*nrows_));
00318       }
00319       else{
00320         mePixClustersPhi_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00321       }
00322       mePixClustersPhi_px_->setAxisTitle("Columns",1);
00323       mePixClustersPhi_py_->setAxisTitle("Rows",1);
00324     }
00325   }
00326 
00327   if(type==4 && endcap){
00328     uint32_t blade= PixelEndcapName::PixelEndcapName(DetId::DetId(id_)).bladeName();
00329     
00330     char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
00331     hid = src.label() + "_" + sblade;
00332     // Number of clusters
00333     meNClustersBlade_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",50,0.,50.);
00334     meNClustersBlade_->setAxisTitle("Number of Clusters",1);
00335     // Total cluster charge in MeV
00336     meChargeBlade_ = theDMBE->book1D("charge_" + hid,"Cluster charge",500,0.,500.);
00337     meChargeBlade_->setAxisTitle("Charge size (MeV)",1);
00338     // Cluster barycenter X position
00339     meXBlade_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00340     meXBlade_->setAxisTitle("Barycenter x-position (row #)",1);
00341     // Cluster barycenter Y position
00342     meYBlade_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00343     meYBlade_->setAxisTitle("Barycenter y-position (column #)",1);
00344     // Total cluster size (in pixels)
00345     meSizeBlade_ = theDMBE->book1D("size_" + hid,"Total cluster size",100,0.,100.);
00346     meSizeBlade_->setAxisTitle("Cluster size (in pixels)",1);
00347     // Cluster width on the x-axis
00348     meSizeXBlade_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00349     meSizeXBlade_->setAxisTitle("Cluster x-size (rows)",1);
00350     // Cluster width on the y-axis
00351     meSizeYBlade_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",20,0.,20.);
00352     meSizeYBlade_->setAxisTitle("Cluster y-size (columns)",1);
00353     // Lowest cluster row
00354     meMinRowBlade_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00355     meMinRowBlade_->setAxisTitle("Lowest cluster row",1);
00356     // Highest cluster row
00357     meMaxRowBlade_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00358     meMaxRowBlade_->setAxisTitle("Highest cluster row",1);
00359     // Lowest cluster column
00360     meMinColBlade_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00361     meMinColBlade_->setAxisTitle("Lowest cluster column",1);
00362     // Highest cluster column
00363     meMaxColBlade_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00364     meMaxColBlade_->setAxisTitle("Highest cluster column",1);
00365 
00366   }
00367   if(type==5 && endcap){
00368     uint32_t disk = PixelEndcapName::PixelEndcapName(DetId::DetId(id_)).diskName();
00369     
00370     char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
00371     hid = src.label() + "_" + sdisk;
00372     // Number of clusters
00373     meNClustersDisk_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",50,0.,50.);
00374     meNClustersDisk_->setAxisTitle("Number of Clusters",1);
00375     // Total cluster charge in MeV
00376     meChargeDisk_ = theDMBE->book1D("charge_" + hid,"Cluster charge",500,0.,500.);
00377     meChargeDisk_->setAxisTitle("Charge size (MeV)",1);
00378     // Cluster barycenter X position
00379     meXDisk_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00380     meXDisk_->setAxisTitle("Barycenter x-position (row #)",1);
00381     // Cluster barycenter Y position
00382     meYDisk_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00383     meYDisk_->setAxisTitle("Barycenter y-position (column #)",1);
00384     // Total cluster size (in pixels)
00385     meSizeDisk_ = theDMBE->book1D("size_" + hid,"Total cluster size",100,0.,100.);
00386     meSizeDisk_->setAxisTitle("Cluster size (in pixels)",1);
00387     // Cluster width on the x-axis
00388     meSizeXDisk_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00389     meSizeXDisk_->setAxisTitle("Cluster x-size (rows)",1);
00390     // Cluster width on the y-axis
00391     meSizeYDisk_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",20,0.,20.);
00392     meSizeYDisk_->setAxisTitle("Cluster y-size (columns)",1);
00393     // Lowest cluster row
00394     meMinRowDisk_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00395     meMinRowDisk_->setAxisTitle("Lowest cluster row",1);
00396     // Highest cluster row
00397     meMaxRowDisk_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00398     meMaxRowDisk_->setAxisTitle("Highest cluster row",1);
00399     // Lowest cluster column
00400     meMinColDisk_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00401     meMinColDisk_->setAxisTitle("Lowest cluster column",1);
00402     // Highest cluster column
00403     meMaxColDisk_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00404     meMaxColDisk_->setAxisTitle("Highest cluster column",1);
00405 
00406   }
00407 
00408   if(type==6 && endcap){
00409     uint32_t panel= PixelEndcapName::PixelEndcapName(DetId::DetId(id_)).pannelName();
00410     uint32_t module= PixelEndcapName::PixelEndcapName(DetId::DetId(id_)).plaquetteName();
00411     char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
00412     hid = src.label() + "_" + slab;
00413     // Number of clusters
00414     meNClustersRing_ = theDMBE->book1D("nclusters_" + hid,"Number of Clusters",50,0.,50.);
00415     meNClustersRing_->setAxisTitle("Number of Clusters",1);
00416     // Total cluster charge in MeV
00417     meChargeRing_ = theDMBE->book1D("charge_" + hid,"Cluster charge",500,0.,500.);
00418     meChargeRing_->setAxisTitle("Charge size (MeV)",1);
00419     // Cluster barycenter X position
00420     meXRing_ = theDMBE->book1D("x_" + hid,"Cluster barycenter X (row #)",200,0.,200.);
00421     meXRing_->setAxisTitle("Barycenter x-position (row #)",1);
00422     // Cluster barycenter Y position
00423     meYRing_ = theDMBE->book1D("y_" + hid,"Cluster barycenter Y (column #)",500,0.,500.);
00424     meYRing_->setAxisTitle("Barycenter y-position (column #)",1);
00425     // Total cluster size (in pixels)
00426     meSizeRing_ = theDMBE->book1D("size_" + hid,"Total cluster size",100,0.,100.);
00427     meSizeRing_->setAxisTitle("Cluster size (in pixels)",1);
00428     // Cluster width on the x-axis
00429     meSizeXRing_ = theDMBE->book1D("sizeX_" + hid,"Cluster x-width (rows)",10,0.,10.);
00430     meSizeXRing_->setAxisTitle("Cluster x-size (rows)",1);
00431     // Cluster width on the y-axis
00432     meSizeYRing_ = theDMBE->book1D("sizeY_" + hid,"Cluster y-width (columns)",20,0.,20.);
00433     meSizeYRing_->setAxisTitle("Cluster y-size (columns)",1);
00434     // Lowest cluster row
00435     meMinRowRing_ = theDMBE->book1D("minrow_" + hid,"Lowest cluster row",200,0.,200.);
00436     meMinRowRing_->setAxisTitle("Lowest cluster row",1);
00437     // Highest cluster row
00438     meMaxRowRing_ = theDMBE->book1D("maxrow_" + hid,"Highest cluster row",200,0.,200.);
00439     meMaxRowRing_->setAxisTitle("Highest cluster row",1);
00440     // Lowest cluster column
00441     meMinColRing_ = theDMBE->book1D("mincol_" + hid,"Lowest cluster column",500,0.,500.);
00442     meMinColRing_->setAxisTitle("Lowest cluster column",1);
00443     // Highest cluster column
00444     meMaxColRing_ = theDMBE->book1D("maxcol_" + hid,"Highest cluster column",500,0.,500.);
00445     meMaxColRing_->setAxisTitle("Highest cluster column",1);
00446     if(twoD){
00447       // 2D hit map
00448       mePixClustersRing_ = theDMBE->book2D("hitmap_" + hid,"Number of Clusters (1bin=four pixels)",nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00449       mePixClustersRing_->setAxisTitle("Columns",1);
00450       mePixClustersRing_->setAxisTitle("Rows",2);
00451     }
00452     else{
00453       // projections of hitmap
00454       mePixClustersRing_px_ = theDMBE->book1D("hitmap_" + hid+"_px","Number of Clusters (1bin=two columns)",nbinx,0.,float(ncols_));
00455       mePixClustersRing_py_ = theDMBE->book1D("hitmap_" + hid+"_py","Number of Clusters (1bin=two rows)",nbiny,0.,float(nrows_));
00456       mePixClustersRing_px_->setAxisTitle("Columns",1);
00457       mePixClustersRing_py_->setAxisTitle("Rows",1);
00458     }
00459   }
00460   
00461 }
00462 //
00463 // Fill histograms
00464 //
00465 void SiPixelClusterModule::fill(const edmNew::DetSetVector<SiPixelCluster>& input,bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon, bool twoD, bool reducedSet) {
00466   
00467   bool barrel = DetId::DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00468   bool endcap = DetId::DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00469   
00470   edmNew::DetSetVector<SiPixelCluster>::const_iterator isearch = input.find(id_); // search  clusters of detid
00471   
00472   if( isearch != input.end() ) {  // Not an empty iterator
00473 
00474     unsigned int numberOfClusters = 0;
00475     
00476     // Look at clusters now
00477     edmNew::DetSet<SiPixelCluster>::const_iterator  di;
00478     //for(di = isearch->data.begin(); di != isearch->data.end(); di++) {
00479     for(di = isearch->begin(); di != isearch->end(); di++) {
00480       numberOfClusters++;
00481       float charge = 0.001*(di->charge()); // total charge of cluster
00482       float x = di->x();                   // barycenter x position
00483       float y = di->y();                   // barycenter y position
00484       int size = di->size();               // total size of cluster (in pixels)
00485       int sizeX = di->sizeX();             // size of cluster in x-direction
00486       int sizeY = di->sizeY();             // size of cluster in y-direction
00487       int minPixelRow = di->minPixelRow(); // min x index
00488       int maxPixelRow = di->maxPixelRow(); // max x index
00489       int minPixelCol = di->minPixelCol(); // min y index
00490       int maxPixelCol = di->maxPixelCol(); // max y index
00491       //      bool edgeHitX = di->edgeHitX();      // records if a cluster is at the x-edge of the detector
00492       //      bool edgeHitY = di->edgeHitY();      // records if a cluster is at the y-edge of the detector
00493       
00494       if(modon){
00495         (meCharge_)->Fill((float)charge);
00496         (meSize_)->Fill((int)size);
00497         if(!reducedSet){
00498           (meMinRow_)->Fill((int)minPixelRow);
00499           (meMaxRow_)->Fill((int)maxPixelRow);
00500           (meMinCol_)->Fill((int)minPixelCol);
00501           (meMaxCol_)->Fill((int)maxPixelCol);
00502           (meSizeX_)->Fill((int)sizeX);
00503           (meSizeY_)->Fill((int)sizeY);
00504           (meX_)->Fill((float)x);
00505           (meY_)->Fill((float)y);
00506         }
00507         if(twoD)(mePixClusters_)->Fill((float)y,(float)x);
00508         else{
00509           (mePixClusters_px_)->Fill((float)y);
00510           (mePixClusters_py_)->Fill((float)x);
00511         }
00512         //      (meEdgeHitX_)->Fill((int)edgeHitX);
00513         //      (meEdgeHitY_)->Fill((int)edgeHitY);
00514       }
00515       
00516       if(ladon && barrel){
00517         (meChargeLad_)->Fill((float)charge);
00518         (meXLad_)->Fill((float)x);
00519         (meYLad_)->Fill((float)y);
00520         (meSizeLad_)->Fill((int)size);
00521         (meSizeXLad_)->Fill((int)sizeX);
00522         (meSizeYLad_)->Fill((int)sizeY);
00523         (meMinRowLad_)->Fill((int)minPixelRow);
00524         (meMaxRowLad_)->Fill((int)maxPixelRow);
00525         (meMinColLad_)->Fill((int)minPixelCol);
00526         (meMaxColLad_)->Fill((int)maxPixelCol);
00527         if(twoD) (mePixClustersLad_)->Fill((float)y,(float)x);
00528         else{
00529           (mePixClustersLad_px_)->Fill((float)y);
00530           (mePixClustersLad_py_)->Fill((float)x);
00531         }
00532       }
00533       if(layon && barrel){
00534         (meChargeLay_)->Fill((float)charge);
00535         (meXLay_)->Fill((float)x);
00536         (meYLay_)->Fill((float)y);
00537         (meSizeLay_)->Fill((int)size);
00538         (meSizeXLay_)->Fill((int)sizeX);
00539         (meSizeYLay_)->Fill((int)sizeY);
00540         (meMinRowLay_)->Fill((int)minPixelRow);
00541         (meMaxRowLay_)->Fill((int)maxPixelRow);
00542         (meMinColLay_)->Fill((int)minPixelCol);
00543         (meMaxColLay_)->Fill((int)maxPixelCol);
00544         if(twoD) (mePixClustersLay_)->Fill((float)y,(float)x);
00545         else{
00546           (mePixClustersLay_px_)->Fill((float)y);
00547           (mePixClustersLay_py_)->Fill((float)x);
00548         }
00549       }
00550       if(phion && barrel){
00551         (meChargePhi_)->Fill((float)charge);
00552         (meXPhi_)->Fill((float)x);
00553         (meYPhi_)->Fill((float)y);
00554         (meSizePhi_)->Fill((int)size);
00555         (meSizeXPhi_)->Fill((int)sizeX);
00556         (meSizeYPhi_)->Fill((int)sizeY);
00557         (meMinRowPhi_)->Fill((int)minPixelRow);
00558         (meMaxRowPhi_)->Fill((int)maxPixelRow);
00559         (meMinColPhi_)->Fill((int)minPixelCol);
00560         (meMaxColPhi_)->Fill((int)maxPixelCol);
00561         if(twoD) (mePixClustersPhi_)->Fill((float)y,(float)x);
00562         else{
00563           (mePixClustersPhi_px_)->Fill((float)y);
00564           (mePixClustersPhi_py_)->Fill((float)x);
00565         }
00566       }
00567       if(bladeon && endcap){
00568         (meChargeBlade_)->Fill((float)charge);
00569         (meXBlade_)->Fill((float)x);
00570         (meYBlade_)->Fill((float)y);
00571         (meSizeBlade_)->Fill((int)size);
00572         (meSizeXBlade_)->Fill((int)sizeX);
00573         (meSizeYBlade_)->Fill((int)sizeY);
00574         (meMinRowBlade_)->Fill((int)minPixelRow);
00575         (meMaxRowBlade_)->Fill((int)maxPixelRow);
00576         (meMinColBlade_)->Fill((int)minPixelCol);
00577         (meMaxColBlade_)->Fill((int)maxPixelCol);
00578       }
00579       if(diskon && endcap){
00580         (meChargeDisk_)->Fill((float)charge);
00581         (meXDisk_)->Fill((float)x);
00582         (meYDisk_)->Fill((float)y);
00583         (meSizeDisk_)->Fill((int)size);
00584         (meSizeXDisk_)->Fill((int)sizeX);
00585         (meSizeYDisk_)->Fill((int)sizeY);
00586         (meMinRowDisk_)->Fill((int)minPixelRow);
00587         (meMaxRowDisk_)->Fill((int)maxPixelRow);
00588         (meMinColDisk_)->Fill((int)minPixelCol);
00589         (meMaxColDisk_)->Fill((int)maxPixelCol);
00590       }
00591       
00592       if(ringon && endcap){
00593         (meChargeRing_)->Fill((float)charge);
00594         (meXRing_)->Fill((float)x);
00595         (meYRing_)->Fill((float)y);
00596         (meSizeRing_)->Fill((int)size);
00597         (meSizeXRing_)->Fill((int)sizeX);
00598         (meSizeYRing_)->Fill((int)sizeY);
00599         (meMinRowRing_)->Fill((int)minPixelRow);
00600         (meMaxRowRing_)->Fill((int)maxPixelRow);
00601         (meMinColRing_)->Fill((int)minPixelCol);
00602         (meMaxColRing_)->Fill((int)maxPixelCol);
00603         if(twoD) (mePixClustersRing_)->Fill((float)y,(float)x);
00604         else{
00605           (mePixClustersRing_px_)->Fill((float)y);
00606           (mePixClustersRing_py_)->Fill((float)x);
00607         }
00608       }
00609     }
00610     if(modon) (meNClusters_)->Fill((float)numberOfClusters);
00611     if(ladon && barrel) (meNClustersLad_)->Fill((float)numberOfClusters);
00612     if(layon && barrel) (meNClustersLay_)->Fill((float)numberOfClusters);
00613     if(phion && barrel) (meNClustersPhi_)->Fill((float)numberOfClusters);
00614     if(bladeon && endcap) (meNClustersBlade_)->Fill((float)numberOfClusters);
00615     if(diskon && endcap) (meNClustersDisk_)->Fill((float)numberOfClusters);
00616     if(ringon && endcap) (meNClustersRing_)->Fill((float)numberOfClusters);
00617 
00618     //std::cout<<"number of clusters="<<numberOfClusters<<std::endl;
00619       
00620 
00621   }
00622   
00623   
00624   //std::cout<<"number of detector units="<<numberOfDetUnits<<std::endl;
00625   
00626 }

Generated on Tue Jun 9 17:33:22 2009 for CMSSW by  doxygen 1.5.4