CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualModule.cc

Go to the documentation of this file.
00001 // Package:    SiPixelMonitorTrack
00002 // Class:      SiPixelTrackResidualModule
00003 // 
00004 // class SiPixelTrackResidualModule SiPixelTrackResidualModule.cc 
00005 //       DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualModule.cc
00006 //
00007 // Description: SiPixel hit-to-track residual data quality monitoring modules
00008 // Implementation: prototype -> improved -> never final - end of the 1st step 
00009 //
00010 // Original Author: Shan-Huei Chuang
00011 //         Created: Fri Mar 23 18:41:42 CET 2007
00012 // $Id: SiPixelTrackResidualModule.cc,v 1.9 2010/07/20 14:29:51 wmtan Exp $
00013 
00014 
00015 #include <string>
00016 #include <iostream>
00017 
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021 #include "FWCore/Utilities/interface/InputTag.h"
00022 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
00023 #include "DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h"
00024 
00025 // Data Formats
00026 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00027 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00028 #include "DataFormats/DetId/interface/DetId.h"
00029 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00030 
00031 
00032 using namespace std; 
00033 
00034 
00035 SiPixelTrackResidualModule::SiPixelTrackResidualModule() : id_(0) {
00036   bBookTracks = true;
00037 }
00038 
00039 
00040 SiPixelTrackResidualModule::SiPixelTrackResidualModule(uint32_t id) : id_(id) { 
00041   bBookTracks = true;
00042 }
00043 
00044 
00045 SiPixelTrackResidualModule::~SiPixelTrackResidualModule() { 
00046  
00047 }
00048 
00049 
00050 void SiPixelTrackResidualModule::book(const edm::ParameterSet& iConfig, bool reducedSet, int type) {
00051   DQMStore* dbe = edm::Service<DQMStore>().operator->();
00052 
00053   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00054   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00055   bool isHalfModule = false;
00056   if(barrel){
00057     isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule(); 
00058   }
00059 
00060   edm::InputTag src = iConfig.getParameter<edm::InputTag>("src");
00061   std::string hisID;
00062 
00063   if(type==0){
00064     SiPixelHistogramId* theHistogramId = new SiPixelHistogramId(src.label());
00065     hisID = theHistogramId->setHistoId("residualX",id_);
00066     meResidualX_ = dbe->book1D(hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00067     meResidualX_->setAxisTitle("hit-to-track residual in x (cm)",1);
00068     hisID = theHistogramId->setHistoId("residualY",id_);
00069     meResidualY_ = dbe->book1D(hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00070     meResidualY_->setAxisTitle("hit-to-track residual in y (cm)",1);
00071     // Number of clusters
00072     hisID = theHistogramId->setHistoId("nclusters_OnTrack",id_);
00073     meNClusters_onTrack_ = dbe->book1D(hisID,"Number of Clusters (on Track)",10,0.,10.);
00074     meNClusters_onTrack_->setAxisTitle("Number of Clusters on Track",1);
00075     // Total cluster charge in ke
00076     hisID = theHistogramId->setHistoId("charge_OnTrack",id_);
00077     meCharge_onTrack_ = dbe->book1D(hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00078     meCharge_onTrack_->setAxisTitle("Charge [kilo electrons]",1);
00079     // Total cluster size (in pixels)
00080     hisID = theHistogramId->setHistoId("size_OnTrack",id_);
00081     meSize_onTrack_ = dbe->book1D(hisID,"Total cluster size (on Track)",30,0.,30.);
00082     meSize_onTrack_->setAxisTitle("Cluster size [number of pixels]",1);
00083     // Number of clusters
00084     hisID = theHistogramId->setHistoId("nclusters_OffTrack",id_);
00085     meNClusters_offTrack_ = dbe->book1D(hisID,"Number of Clusters (off Track)",35,0.,35.);
00086     meNClusters_offTrack_->setAxisTitle("Number of Clusters off Track",1);
00087     // Total cluster charge in ke
00088     hisID = theHistogramId->setHistoId("charge_OffTrack",id_);
00089     meCharge_offTrack_ = dbe->book1D(hisID,"Cluster charge (off Track)",100,0.,200.);
00090     meCharge_offTrack_->setAxisTitle("Charge [kilo electrons]",1);
00091     // Total cluster size (in pixels)
00092     hisID = theHistogramId->setHistoId("size_OffTrack",id_);
00093     meSize_offTrack_ = dbe->book1D(hisID,"Total cluster size (off Track)",30,0.,30.);
00094     meSize_offTrack_->setAxisTitle("Cluster size [number of pixels]",1);
00095     if(!reducedSet){
00096       // Cluster width on the x-axis
00097       hisID = theHistogramId->setHistoId("sizeX_OnTrack",id_);
00098       meSizeX_onTrack_ = dbe->book1D(hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00099       meSizeX_onTrack_->setAxisTitle("Cluster x-size [rows]",1);
00100       // Cluster width on the y-axis
00101       hisID = theHistogramId->setHistoId("sizeY_OnTrack",id_);
00102       meSizeY_onTrack_ = dbe->book1D(hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00103       meSizeY_onTrack_->setAxisTitle("Cluster y-size [columns]",1);
00104       // Cluster width on the x-axis
00105       hisID = theHistogramId->setHistoId("sizeX_OffTrack",id_);
00106       meSizeX_offTrack_ = dbe->book1D(hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00107       meSizeX_offTrack_->setAxisTitle("Cluster x-size [rows]",1);
00108       // Cluster width on the y-axis
00109       hisID = theHistogramId->setHistoId("sizeY_OffTrack",id_);
00110       meSizeY_offTrack_ = dbe->book1D(hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00111       meSizeY_offTrack_->setAxisTitle("Cluster y-size [columns]",1);
00112     }
00113     delete theHistogramId;
00114   }
00115 
00116   if(type==1 && barrel){
00117     uint32_t DBladder = PixelBarrelName(DetId(id_)).ladderName();
00118     char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
00119     hisID = src.label() + "_" + sladder;
00120     if(isHalfModule) hisID += "H";
00121     else hisID += "F";
00122     meResidualXLad_ = dbe->book1D("residualX_"+hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00123     meResidualXLad_->setAxisTitle("hit-to-track residual in x (cm)",1);
00124     meResidualYLad_ = dbe->book1D("residualY_"+hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00125     meResidualYLad_->setAxisTitle("hit-to-track residual in y (cm)",1);
00126     // Number of clusters
00127     meNClusters_onTrackLad_ = dbe->book1D("nclusters_OnTrack_" + hisID,"Number of Clusters (on Track)",10,0.,10.);
00128     meNClusters_onTrackLad_->setAxisTitle("Number of Clusters on Track",1);
00129     // Total cluster charge in MeV
00130     meCharge_onTrackLad_ = dbe->book1D("charge_OnTrack_" + hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00131     meCharge_onTrackLad_->setAxisTitle("Charge [kilo electrons]",1);
00132     // Total cluster size (in pixels)
00133     meSize_onTrackLad_ = dbe->book1D("size_OnTrack_" + hisID,"Total cluster size (on Track)",30,0.,30.);
00134     meSize_onTrackLad_->setAxisTitle("Cluster size [number of pixels]",1);
00135     // Number of clusters
00136     meNClusters_offTrackLad_ = dbe->book1D("nclusters_OffTrack_" + hisID,"Number of Clusters (off Track)",35,0.,35.);
00137     meNClusters_offTrackLad_->setAxisTitle("Number of Clusters off Track",1);
00138     // Total cluster charge in MeV
00139     meCharge_offTrackLad_ = dbe->book1D("charge_OffTrack_" + hisID,"Cluster charge (off Track)",100,0.,200.);
00140     meCharge_offTrackLad_->setAxisTitle("Charge [kilo electrons]",1);
00141     // Total cluster size (in pixels)
00142     meSize_offTrackLad_ = dbe->book1D("size_OffTrack_" + hisID,"Total cluster size (off Track)",30,0.,30.);
00143     meSize_offTrackLad_->setAxisTitle("Cluster size [number of pixels]",1);
00144     if(!reducedSet){
00145       // Cluster width on the x-axis
00146       meSizeX_offTrackLad_ = dbe->book1D("sizeX_OffTrack_" + hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00147       meSizeX_offTrackLad_->setAxisTitle("Cluster x-size [rows]",1);
00148       // Cluster width on the y-axis
00149       meSizeY_offTrackLad_ = dbe->book1D("sizeY_OffTrack_" + hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00150       meSizeY_offTrackLad_->setAxisTitle("Cluster y-size [columns]",1);
00151       // Cluster width on the x-axis
00152       meSizeX_onTrackLad_ = dbe->book1D("sizeX_OnTrack_" + hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00153       meSizeX_onTrackLad_->setAxisTitle("Cluster x-size [rows]",1);
00154       // Cluster width on the y-axis
00155       meSizeY_onTrackLad_ = dbe->book1D("sizeY_OnTrack_" + hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00156       meSizeY_onTrackLad_->setAxisTitle("Cluster y-size [columns]",1);
00157     }
00158   }
00159 
00160   if(type==2 && barrel){
00161     uint32_t DBlayer = PixelBarrelName(DetId(id_)).layerName();
00162     char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
00163     hisID = src.label() + "_" + slayer;
00164     meResidualXLay_ = dbe->book1D("residualX_"+hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00165     meResidualXLay_->setAxisTitle("hit-to-track residual in x (cm)",1);
00166     meResidualYLay_ = dbe->book1D("residualY_"+hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00167     meResidualYLay_->setAxisTitle("hit-to-track residual in y (cm)",1);
00168     // Number of clusters
00169     meNClusters_onTrackLay_ = dbe->book1D("nclusters_OnTrack_" + hisID,"Number of Clusters (on Track)",10,0.,10.);
00170     meNClusters_onTrackLay_->setAxisTitle("Number of Clusters on Track",1);
00171     // Total cluster charge in MeV
00172     meCharge_onTrackLay_ = dbe->book1D("charge_OnTrack_" + hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00173     meCharge_onTrackLay_->setAxisTitle("Charge [kilo electrons]",1);
00174     // Total cluster size (in pixels)
00175     meSize_onTrackLay_ = dbe->book1D("size_OnTrack_" + hisID,"Total cluster size (on Track)",30,0.,30.);
00176     meSize_onTrackLay_->setAxisTitle("Cluster size [number of pixels]",1);    
00177     // Number of clusters
00178     meNClusters_offTrackLay_ = dbe->book1D("nclusters_OffTrack_" + hisID,"Number of Clusters (off Track)",35,0.,35.);
00179     meNClusters_offTrackLay_->setAxisTitle("Number of Clusters off Track",1);
00180     // Total cluster charge in MeV
00181     meCharge_offTrackLay_ = dbe->book1D("charge_OffTrack_" + hisID,"Cluster charge (off Track)",100,0.,200.);
00182     meCharge_offTrackLay_->setAxisTitle("Charge [kilo electrons]",1);
00183     // Total cluster size (in pixels)
00184     meSize_offTrackLay_ = dbe->book1D("size_OffTrack_" + hisID,"Total cluster size (off Track)",30,0.,30.);
00185     meSize_offTrackLay_->setAxisTitle("Cluster size [number of pixels]",1);
00186     if(!reducedSet){
00187       // Cluster width on the x-axis
00188       meSizeX_onTrackLay_ = dbe->book1D("sizeX_OnTrack_" + hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00189       meSizeX_onTrackLay_->setAxisTitle("Cluster x-size [rows]",1);
00190       // Cluster width on the y-axis
00191       meSizeY_onTrackLay_ = dbe->book1D("sizeY_OnTrack_" + hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00192       meSizeY_onTrackLay_->setAxisTitle("Cluster y-size [columns]",1);
00193       // Cluster width on the x-axis
00194       meSizeX_offTrackLay_ = dbe->book1D("sizeX_OffTrack_" + hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00195       meSizeX_offTrackLay_->setAxisTitle("Cluster x-size [rows]",1);
00196       // Cluster width on the y-axis
00197       meSizeY_offTrackLay_ = dbe->book1D("sizeY_OffTrack_" + hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00198       meSizeY_offTrackLay_->setAxisTitle("Cluster y-size [columns]",1);
00199     }
00200   }
00201 
00202   if(type==3 && barrel){
00203     uint32_t DBmodule = PixelBarrelName(DetId(id_)).moduleName();
00204     char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
00205     hisID = src.label() + "_" + smodule;
00206     meResidualXPhi_ = dbe->book1D("residualX_"+hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00207     meResidualXPhi_->setAxisTitle("hit-to-track residual in x (cm)",1);
00208     meResidualYPhi_ = dbe->book1D("residualY_"+hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00209     meResidualYPhi_->setAxisTitle("hit-to-track residual in y (cm)",1);
00210     // Number of clusters
00211     meNClusters_onTrackPhi_ = dbe->book1D("nclusters_OnTrack_" + hisID,"Number of Clusters (on Track)",10,0.,10.);
00212     meNClusters_onTrackPhi_->setAxisTitle("Number of Clusters on Track",1);
00213     // Total cluster charge in MeV
00214     meCharge_onTrackPhi_ = dbe->book1D("charge_OnTrack_" + hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00215     meCharge_onTrackPhi_->setAxisTitle("Charge [kilo electrons]",1);
00216     // Total cluster size (in pixels)
00217     meSize_onTrackPhi_ = dbe->book1D("size_OnTrack_" + hisID,"Total cluster size (on Track)",30,0.,30.);
00218     meSize_onTrackPhi_->setAxisTitle("Cluster size [number of pixels]",1);    
00219     // Number of clusters
00220     meNClusters_offTrackPhi_ = dbe->book1D("nclusters_OffTrack_" + hisID,"Number of Clusters (off Track)",35,0.,35.);
00221     meNClusters_offTrackPhi_->setAxisTitle("Number of Clusters off Track",1);
00222     // Total cluster charge in MeV
00223     meCharge_offTrackPhi_ = dbe->book1D("charge_OffTrack_" + hisID,"Cluster charge (off Track)",100,0.,200.);
00224     meCharge_offTrackPhi_->setAxisTitle("Charge [kilo electrons]",1);
00225     // Total cluster size (in pixels)
00226     meSize_offTrackPhi_ = dbe->book1D("size_OffTrack_" + hisID,"Total cluster size (off Track)",30,0.,30.);
00227     meSize_offTrackPhi_->setAxisTitle("Cluster size [number of pixels]",1);
00228     if(!reducedSet){
00229       // Cluster width on the x-axis
00230       meSizeX_onTrackPhi_ = dbe->book1D("sizeX_OnTrack_" + hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00231       meSizeX_onTrackPhi_->setAxisTitle("Cluster x-size [rows]",1);
00232       // Cluster width on the y-axis
00233       meSizeY_onTrackPhi_ = dbe->book1D("sizeY_OnTrack_" + hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00234       meSizeY_onTrackPhi_->setAxisTitle("Cluster y-size [columns]",1);
00235       // Cluster width on the x-axis
00236       meSizeX_offTrackPhi_ = dbe->book1D("sizeX_OffTrack_" + hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00237       meSizeX_offTrackPhi_->setAxisTitle("Cluster x-size [rows]",1);
00238       // Cluster width on the y-axis
00239       meSizeY_offTrackPhi_ = dbe->book1D("sizeY_OffTrack_" + hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00240       meSizeY_offTrackPhi_->setAxisTitle("Cluster y-size [columns]",1);
00241     }
00242   }
00243 
00244   if(type==4 && endcap){
00245     uint32_t blade= PixelEndcapName(DetId(id_)).bladeName();
00246     char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
00247     hisID = src.label() + "_" + sblade;
00248     meResidualXBlade_ = dbe->book1D("residualX_"+hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00249     meResidualXBlade_->setAxisTitle("hit-to-track residual in x (cm)",1);
00250     meResidualYBlade_ = dbe->book1D("residualY_"+hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00251     meResidualYBlade_->setAxisTitle("hit-to-track residual in y (cm)",1);
00252     // Number of clusters
00253     meNClusters_onTrackBlade_ = dbe->book1D("nclusters_OnTrack_" + hisID,"Number of Clusters (on Track)",10,0.,10.);
00254     meNClusters_onTrackBlade_->setAxisTitle("Number of Clusters on Track",1);
00255     // Total cluster charge in MeV
00256     meCharge_onTrackBlade_ = dbe->book1D("charge_OnTrack_" + hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00257     meCharge_onTrackBlade_->setAxisTitle("Charge [kilo electrons]",1);
00258     // Total cluster size (in pixels)
00259     meSize_onTrackBlade_ = dbe->book1D("size_OnTrack_" + hisID,"Total cluster size (on Track)",30,0.,30.);
00260     meSize_onTrackBlade_->setAxisTitle("Cluster size [number of pixels]",1);    
00261     // Number of clusters
00262     meNClusters_offTrackBlade_ = dbe->book1D("nclusters_OffTrack_" + hisID,"Number of Clusters (off Track)",35,0.,35.);
00263     meNClusters_offTrackBlade_->setAxisTitle("Number of Clusters off Track",1);
00264     // Total cluster charge in MeV
00265     meCharge_offTrackBlade_ = dbe->book1D("charge_OffTrack_" + hisID,"Cluster charge (off Track)",100,0.,200.);
00266     meCharge_offTrackBlade_->setAxisTitle("Charge [kilo electrons]",1);
00267     // Total cluster size (in pixels)
00268     meSize_offTrackBlade_ = dbe->book1D("size_OffTrack_" + hisID,"Total cluster size (off Track)",30,0.,30.);
00269     meSize_offTrackBlade_->setAxisTitle("Cluster size [number of pixels]",1);
00270     if(!reducedSet){
00271       // Cluster width on the x-axis
00272       meSizeX_onTrackBlade_ = dbe->book1D("sizeX_OnTrack_" + hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00273       meSizeX_onTrackBlade_->setAxisTitle("Cluster x-size [rows]",1);
00274       // Cluster width on the y-axis
00275       meSizeY_onTrackBlade_ = dbe->book1D("sizeY_OnTrack_" + hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00276       meSizeY_onTrackBlade_->setAxisTitle("Cluster y-size [columns]",1);
00277       // Cluster width on the x-axis
00278       meSizeX_offTrackBlade_ = dbe->book1D("sizeX_OffTrack_" + hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00279       meSizeX_offTrackBlade_->setAxisTitle("Cluster x-size [rows]",1);
00280       // Cluster width on the y-axis
00281       meSizeY_offTrackBlade_ = dbe->book1D("sizeY_OffTrack_" + hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00282       meSizeY_offTrackBlade_->setAxisTitle("Cluster y-size [columns]",1);
00283     }
00284   }
00285 
00286   if(type==5 && endcap){
00287     uint32_t disk = PixelEndcapName(DetId(id_)).diskName();
00288     char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
00289     hisID = src.label() + "_" + sdisk;
00290     meResidualXDisk_ = dbe->book1D("residualX_"+hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00291     meResidualXDisk_->setAxisTitle("hit-to-track residual in x (cm)",1);
00292     meResidualYDisk_ = dbe->book1D("residualY_"+hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00293     meResidualYDisk_->setAxisTitle("hit-to-track residual in y (cm)",1);
00294     // Number of clusters
00295     meNClusters_onTrackDisk_ = dbe->book1D("nclusters_OnTrack_" + hisID,"Number of Clusters (on Track)",10,0.,10.);
00296     meNClusters_onTrackDisk_->setAxisTitle("Number of Clusters on Track",1);
00297     // Total cluster charge in MeV
00298     meCharge_onTrackDisk_ = dbe->book1D("charge_OnTrack_" + hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00299     meCharge_onTrackDisk_->setAxisTitle("Charge [kilo electrons]",1);
00300     // Total cluster size (in pixels)
00301     meSize_onTrackDisk_ = dbe->book1D("size_OnTrack_" + hisID,"Total cluster size (on Track)",30,0.,30.);
00302     meSize_onTrackDisk_->setAxisTitle("Cluster size [number of pixels]",1);    
00303     // Number of clusters
00304     meNClusters_offTrackDisk_ = dbe->book1D("nclusters_OffTrack_" + hisID,"Number of Clusters (off Track)",35,0.,35.);
00305     meNClusters_offTrackDisk_->setAxisTitle("Number of Clusters off Track",1);
00306     // Total cluster charge in MeV
00307     meCharge_offTrackDisk_ = dbe->book1D("charge_OffTrack_" + hisID,"Cluster charge (off Track)",100,0.,200.);
00308     meCharge_offTrackDisk_->setAxisTitle("Charge [kilo electrons]",1);
00309     // Total cluster size (in pixels)
00310     meSize_offTrackDisk_ = dbe->book1D("size_OffTrack_" + hisID,"Total cluster size (off Track)",30,0.,30.);
00311     meSize_offTrackDisk_->setAxisTitle("Cluster size [number of pixels]",1);
00312     if(!reducedSet){
00313       // Cluster width on the x-axis
00314       meSizeX_onTrackDisk_ = dbe->book1D("sizeX_OnTrack_" + hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00315       meSizeX_onTrackDisk_->setAxisTitle("Cluster x-size [rows]",1);
00316       // Cluster width on the y-axis
00317       meSizeY_onTrackDisk_ = dbe->book1D("sizeY_OnTrack_" + hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00318       meSizeY_onTrackDisk_->setAxisTitle("Cluster y-size [columns]",1);
00319       // Cluster width on the x-axis
00320       meSizeX_offTrackDisk_ = dbe->book1D("sizeX_OffTrack_" + hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00321       meSizeX_offTrackDisk_->setAxisTitle("Cluster x-size [rows]",1);
00322       // Cluster width on the y-axis
00323       meSizeY_offTrackDisk_ = dbe->book1D("sizeY_OffTrack_" + hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00324       meSizeY_offTrackDisk_->setAxisTitle("Cluster y-size [columns]",1);
00325     }
00326   }
00327 
00328   if(type==6 && endcap){
00329     uint32_t panel= PixelEndcapName(DetId(id_)).pannelName();
00330     uint32_t module= PixelEndcapName(DetId(id_)).plaquetteName();
00331     char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
00332     hisID = src.label() + "_" + slab;
00333     meResidualXRing_ = dbe->book1D("residualX_"+hisID,"Hit-to-Track Residual in X",100,-5.,5.);
00334     meResidualXRing_->setAxisTitle("hit-to-track residual in x (cm)",1);
00335     meResidualYRing_ = dbe->book1D("residualY_"+hisID,"Hit-to-Track Residual in Y",100,-5.,5.);
00336     meResidualYRing_->setAxisTitle("hit-to-track residual in y (cm)",1);
00337     // Number of clusters
00338     meNClusters_onTrackRing_ = dbe->book1D("nclusters_OnTrack_" + hisID,"Number of Clusters (on Track)",10,0.,10.);
00339     meNClusters_onTrackRing_->setAxisTitle("Number of Clusters on Track",1);
00340     // Total cluster charge in MeV
00341     meCharge_onTrackRing_ = dbe->book1D("charge_OnTrack_" + hisID,"Normalized Cluster charge (on Track)",100,0.,200.);
00342     meCharge_onTrackRing_->setAxisTitle("Charge [kilo electrons]",1);
00343     // Total cluster size (in pixels)
00344     meSize_onTrackRing_ = dbe->book1D("size_OnTrack_" + hisID,"Total cluster size (on Track)",30,0.,30.);
00345     meSize_onTrackRing_->setAxisTitle("Cluster size [number of pixels]",1);    
00346     // Number of clusters
00347     meNClusters_offTrackRing_ = dbe->book1D("nclusters_OffTrack_" + hisID,"Number of Clusters (off Track)",35,0.,35.);
00348     meNClusters_offTrackRing_->setAxisTitle("Number of Clusters off Track",1);
00349     // Total cluster charge in MeV
00350     meCharge_offTrackRing_ = dbe->book1D("charge_OffTrack_" + hisID,"Cluster charge (off Track)",100,0.,200.);
00351     meCharge_offTrackRing_->setAxisTitle("Charge [kilo electrons]",1);
00352     // Total cluster size (in pixels)
00353     meSize_offTrackRing_ = dbe->book1D("size_OffTrack_" + hisID,"Total cluster size (off Track)",30,0.,30.);
00354     meSize_offTrackRing_->setAxisTitle("Cluster size [number of pixels]",1);
00355     if(!reducedSet){
00356       // Cluster width on the x-axis
00357       meSizeX_onTrackRing_ = dbe->book1D("sizeX_OnTrack_" + hisID,"Cluster x-width (rows) (on Track)",10,0.,10.);
00358       meSizeX_onTrackRing_->setAxisTitle("Cluster x-size [rows]",1);
00359       // Cluster width on the y-axis
00360       meSizeY_onTrackRing_ = dbe->book1D("sizeY_OnTrack_" + hisID,"Cluster y-width (columns) (on Track)",15,0.,15.);
00361       meSizeY_onTrackRing_->setAxisTitle("Cluster y-size [columns]",1);
00362       // Cluster width on the x-axis
00363       meSizeX_offTrackRing_ = dbe->book1D("sizeX_OffTrack_" + hisID,"Cluster x-width (rows) (off Track)",10,0.,10.);
00364       meSizeX_offTrackRing_->setAxisTitle("Cluster x-size [rows]",1);
00365       // Cluster width on the y-axis
00366       meSizeY_offTrackRing_ = dbe->book1D("sizeY_OffTrack_" + hisID,"Cluster y-width (columns) (off Track)",15,0.,15.);
00367       meSizeY_offTrackRing_->setAxisTitle("Cluster y-size [columns]",1);
00368     }
00369   }
00370 }
00371 
00372 
00373 void SiPixelTrackResidualModule::fill(const Measurement2DVector& residual, bool reducedSet, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
00374 
00375   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00376   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00377 
00378   if(modon){
00379     (meResidualX_)->Fill(residual.x()); 
00380     (meResidualY_)->Fill(residual.y()); 
00381   }
00382 
00383   if(ladon && barrel){
00384     (meResidualXLad_)->Fill(residual.x()); 
00385     (meResidualYLad_)->Fill(residual.y()); 
00386   }
00387 
00388   if(layon && barrel){
00389     (meResidualXLay_)->Fill(residual.x()); 
00390     (meResidualYLay_)->Fill(residual.y()); 
00391   }
00392   if(phion && barrel){
00393     (meResidualXPhi_)->Fill(residual.x()); 
00394     (meResidualYPhi_)->Fill(residual.y()); 
00395   }
00396 
00397   if(bladeon && endcap){
00398     (meResidualXBlade_)->Fill(residual.x()); 
00399     (meResidualYBlade_)->Fill(residual.y()); 
00400   }
00401 
00402   if(diskon && endcap){
00403     (meResidualXDisk_)->Fill(residual.x()); 
00404     (meResidualYDisk_)->Fill(residual.y()); 
00405   }
00406 
00407   if(ringon && endcap){
00408     (meResidualXRing_)->Fill(residual.x()); 
00409     (meResidualYRing_)->Fill(residual.y()); 
00410   }
00411 }
00412 
00413 
00414 void SiPixelTrackResidualModule::fill(const SiPixelCluster &clust, bool onTrack, double corrCharge, bool reducedSet, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon){
00415 
00416   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00417   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00418 
00419   float charge = 0.001*(clust.charge()); // total charge of cluster
00420   if(onTrack) charge = corrCharge;              // corrected cluster charge
00421   int size = clust.size();               // total size of cluster (in pixels)
00422   int sizeX = clust.sizeX();             // size of cluster in x-clustrection
00423   int sizeY = clust.sizeY();             // size of cluster in y-direction
00424   
00425   if(onTrack){
00426     if(modon){
00427       (meCharge_onTrack_)->Fill((float)charge);
00428       (meSize_onTrack_)->Fill((int)size);
00429       if(!reducedSet){
00430         (meSizeX_onTrack_)->Fill((int)sizeX);
00431         (meSizeY_onTrack_)->Fill((int)sizeY);
00432       }
00433     }
00434     if(barrel && ladon){
00435       (meCharge_onTrackLad_)->Fill((float)charge);
00436       (meSize_onTrackLad_)->Fill((int)size);
00437       if(!reducedSet){
00438         (meSizeX_onTrackLad_)->Fill((int)sizeX);
00439         (meSizeY_onTrackLad_)->Fill((int)sizeY);
00440       }
00441     }
00442     if(barrel && layon){
00443       (meCharge_onTrackLay_)->Fill((float)charge);
00444       (meSize_onTrackLay_)->Fill((int)size);
00445       if(!reducedSet){
00446         (meSizeX_onTrackLay_)->Fill((int)sizeX);
00447         (meSizeY_onTrackLay_)->Fill((int)sizeY);
00448       }
00449     }   
00450     if(barrel && phion){
00451       (meCharge_onTrackPhi_)->Fill((float)charge);
00452       (meSize_onTrackPhi_)->Fill((int)size);
00453       if(!reducedSet){
00454         (meSizeX_onTrackPhi_)->Fill((int)sizeX);
00455         (meSizeY_onTrackPhi_)->Fill((int)sizeY);
00456       }
00457     }
00458     if(endcap && bladeon){
00459       (meCharge_onTrackBlade_)->Fill((float)charge);
00460       (meSize_onTrackBlade_)->Fill((int)size);
00461       if(!reducedSet){
00462         (meSizeX_onTrackBlade_)->Fill((int)sizeX);
00463         (meSizeY_onTrackBlade_)->Fill((int)sizeY);
00464       }
00465     }
00466     if(endcap && diskon){
00467       (meCharge_onTrackDisk_)->Fill((float)charge);
00468       (meSize_onTrackDisk_)->Fill((int)size);
00469       if(!reducedSet){
00470         (meSizeX_onTrackDisk_)->Fill((int)sizeX);
00471         (meSizeY_onTrackDisk_)->Fill((int)sizeY);
00472       }
00473     }
00474     if(endcap && ringon){
00475       (meCharge_onTrackRing_)->Fill((float)charge);
00476       (meSize_onTrackRing_)->Fill((int)size);
00477       if(!reducedSet){
00478         (meSizeX_onTrackRing_)->Fill((int)sizeX);
00479         (meSizeY_onTrackRing_)->Fill((int)sizeY);
00480       }
00481     }
00482   }
00483 
00484   if(!onTrack){
00485     if(modon){
00486       (meCharge_offTrack_)->Fill((float)charge);
00487       (meSize_offTrack_)->Fill((int)size);
00488       if(!reducedSet){
00489         (meSizeX_offTrack_)->Fill((int)sizeX);
00490         (meSizeY_offTrack_)->Fill((int)sizeY);
00491       }
00492     }
00493     if(barrel && ladon){
00494       (meCharge_offTrackLad_)->Fill((float)charge);
00495       (meSize_offTrackLad_)->Fill((int)size);
00496       if(!reducedSet){
00497         (meSizeX_offTrackLad_)->Fill((int)sizeX);
00498         (meSizeY_offTrackLad_)->Fill((int)sizeY);
00499       }
00500     }
00501     if(barrel && layon){
00502       (meCharge_offTrackLay_)->Fill((float)charge);
00503       (meSize_offTrackLay_)->Fill((int)size);
00504       if(!reducedSet){
00505         (meSizeX_offTrackLay_)->Fill((int)sizeX);
00506         (meSizeY_offTrackLay_)->Fill((int)sizeY);
00507       }
00508     }   
00509     if(barrel && phion){
00510       (meCharge_offTrackPhi_)->Fill((float)charge);
00511       (meSize_offTrackPhi_)->Fill((int)size);
00512       if(!reducedSet){
00513         (meSizeX_offTrackPhi_)->Fill((int)sizeX);
00514         (meSizeY_offTrackPhi_)->Fill((int)sizeY);
00515       }
00516     }
00517     if(endcap && bladeon){
00518       (meCharge_offTrackBlade_)->Fill((float)charge);
00519       (meSize_offTrackBlade_)->Fill((int)size);
00520       if(!reducedSet){
00521         (meSizeX_offTrackBlade_)->Fill((int)sizeX);
00522         (meSizeY_offTrackBlade_)->Fill((int)sizeY);
00523       }
00524     }
00525     if(endcap && diskon){
00526       (meCharge_offTrackDisk_)->Fill((float)charge);
00527       (meSize_offTrackDisk_)->Fill((int)size);
00528       if(!reducedSet){
00529         (meSizeX_offTrackDisk_)->Fill((int)sizeX);
00530         (meSizeY_offTrackDisk_)->Fill((int)sizeY);
00531       }
00532     }
00533     if(endcap && ringon){
00534       (meCharge_offTrackRing_)->Fill((float)charge);
00535       (meSize_offTrackRing_)->Fill((int)size);
00536       if(!reducedSet){
00537         (meSizeX_offTrackRing_)->Fill((int)sizeX);
00538         (meSizeY_offTrackRing_)->Fill((int)sizeY);
00539       }
00540     }
00541   }
00542 
00543 
00544   
00545 }
00546 
00547 void SiPixelTrackResidualModule::nfill(int onTrack, int offTrack, bool reducedSet, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon){
00548 
00549   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00550   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00551   bool fillOn = false; if(onTrack>0) fillOn = true; 
00552   bool fillOff = false; if(offTrack>0) fillOff = true; 
00553 
00554   if(modon){
00555     if(fillOn) meNClusters_onTrack_->Fill(onTrack); 
00556     if(fillOff) meNClusters_offTrack_->Fill(offTrack); 
00557   }
00558   if(ladon && barrel){
00559     if(fillOn) meNClusters_onTrackLad_->Fill(onTrack); 
00560     if(fillOff) meNClusters_offTrackLad_->Fill(offTrack); 
00561   }
00562   
00563   if(layon && barrel){
00564     if(fillOn) meNClusters_onTrackLay_->Fill(onTrack); 
00565     if(fillOff) meNClusters_offTrackLay_->Fill(offTrack); 
00566   }
00567   if(phion && barrel){
00568     if(fillOn) meNClusters_onTrackPhi_->Fill(onTrack); 
00569     if(fillOff) meNClusters_offTrackPhi_->Fill(offTrack); 
00570   }
00571   if(bladeon && endcap){
00572     if(fillOn) meNClusters_onTrackBlade_->Fill(onTrack); 
00573     if(fillOff) meNClusters_offTrackBlade_->Fill(offTrack); 
00574   }
00575   if(diskon && endcap){
00576     if(fillOn) meNClusters_onTrackDisk_->Fill(onTrack); 
00577     if(fillOff) meNClusters_offTrackDisk_->Fill(offTrack); 
00578   }
00579   if(ringon && endcap){
00580     if(fillOn) meNClusters_onTrackRing_->Fill(onTrack); 
00581     if(fillOff) meNClusters_offTrackRing_->Fill(offTrack); 
00582   }
00583 }