CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/DQM/SiPixelMonitorDigi/src/SiPixelDigiModule.cc

Go to the documentation of this file.
00001 #include "DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h"
00002 #include "DQMServices/Core/interface/DQMStore.h"
00003 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
00005 #include "FWCore/ServiceRegistry/interface/Service.h"
00006 // STL
00007 #include <vector>
00008 #include <memory>
00009 #include <string>
00010 #include <iostream>
00011 #include <stdlib.h>
00012 #include <sstream>
00013 #include <cstdio>
00014 
00015 // Data Formats
00016 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00017 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00018 #include "DataFormats/DetId/interface/DetId.h"
00019 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00020 
00021 //
00022 // Constructors
00023 //
00024 SiPixelDigiModule::SiPixelDigiModule() : id_(0),
00025                                          ncols_(416),
00026                                          nrows_(160) 
00027 {
00028 }
00030 SiPixelDigiModule::SiPixelDigiModule(const uint32_t& id) : 
00031   id_(id),
00032   ncols_(416),
00033   nrows_(160)
00034 { 
00035 }
00037 SiPixelDigiModule::SiPixelDigiModule(const uint32_t& id, const int& ncols, const int& nrows) : 
00038   id_(id),
00039   ncols_(ncols),
00040   nrows_(nrows)
00041 { 
00042 }
00043 //
00044 // Destructor
00045 //
00046 SiPixelDigiModule::~SiPixelDigiModule() {}
00047 //
00048 // Book histograms
00049 //
00050 void SiPixelDigiModule::book(const edm::ParameterSet& iConfig, int type, bool twoD, bool hiRes, bool reducedSet, bool additInfo) {
00051   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00052   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00053   bool isHalfModule = false;
00054   if(barrel){
00055     isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule(); 
00056   }
00057 
00058   std::string hid;
00059   // Get collection name and instantiate Histo Id builder
00060   edm::InputTag src = iConfig.getParameter<edm::InputTag>( "src" );
00061   
00062 
00063   // Get DQM interface
00064   DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
00065 
00066   int nbinx=ncols_/2, nbiny=nrows_/2;
00067   std::string twodtitle           = "Number of Digis (1bin=four pixels)"; 
00068   std::string pxtitle             = "Number of Digis (1bin=two columns)";
00069   std::string pytitle             = "Number of Digis (1bin=two rows)";
00070   std::string twodroctitle        = "ROC Occupancy (1bin=one ROC)";
00071   std::string twodzeroOccroctitle = "Zero Occupancy ROC Map (1bin=one ROC) for ";
00072   if(hiRes){
00073     nbinx = ncols_;
00074     nbiny = nrows_;
00075     twodtitle    = "Number of Digis (1bin=one pixel)";
00076     pxtitle = "Number of Digis (1bin=one column)";
00077     pytitle = "Number of Digis (1bin=one row)";
00078   }
00079   if(type==0){
00080     SiPixelHistogramId* theHistogramId = new SiPixelHistogramId( src.label() );
00081     // Number of digis
00082     hid = theHistogramId->setHistoId("ndigis",id_);
00083     meNDigis_ = theDMBE->book1D(hid,"Number of Digis",25,0.,25.);
00084     meNDigis_->setAxisTitle("Number of digis",1);
00085     // Charge in ADC counts
00086     hid = theHistogramId->setHistoId("adc",id_);
00087     meADC_ = theDMBE->book1D(hid,"Digi charge",128,0.,256.);
00088     meADC_->setAxisTitle("ADC counts",1);
00089         if(!reducedSet)
00090         {
00091     if(twoD){
00092       if(additInfo){
00093         // 2D hit map
00094         hid = theHistogramId->setHistoId("hitmap",id_);
00095         mePixDigis_ = theDMBE->book2D(hid,twodtitle,nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00096         mePixDigis_->setAxisTitle("Columns",1);
00097         mePixDigis_->setAxisTitle("Rows",2);
00098         //std::cout << "During booking: type is "<< type << ", ID is "<< id_ << ", pwd for booking is " << theDMBE->pwd() << ", Plot name: " << hid << std::endl;
00099       }
00100     }
00101     else{
00102       // projections of 2D hit map
00103       hid = theHistogramId->setHistoId("hitmap",id_);
00104       mePixDigis_px_ = theDMBE->book1D(hid+"_px",pxtitle,nbinx,0.,float(ncols_));
00105       mePixDigis_py_ = theDMBE->book1D(hid+"_py",pytitle,nbiny,0.,float(nrows_));
00106       mePixDigis_px_->setAxisTitle("Columns",1);
00107       mePixDigis_py_->setAxisTitle("Rows",1);
00108     }
00109         }
00110     delete theHistogramId;
00111 
00112   }
00113   
00114   if(type==1 && barrel){
00115     uint32_t DBladder = PixelBarrelName(DetId(id_)).ladderName();
00116     char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
00117     hid = src.label() + "_" + sladder;
00118     if(isHalfModule) hid += "H";
00119     else hid += "F";
00120     // Number of digis
00121     meNDigisLad_ = theDMBE->book1D("ndigis_"+hid,"Number of Digis",25,0.,25.);
00122     meNDigisLad_->setAxisTitle("Number of digis",1);
00123     // Charge in ADC counts
00124     meADCLad_ = theDMBE->book1D("adc_" + hid,"Digi charge",128,0.,256.);
00125     meADCLad_->setAxisTitle("ADC counts",1);
00126         if(!reducedSet)
00127         {
00128     if(twoD){
00129       // 2D hit map
00130       mePixDigisLad_ = theDMBE->book2D("hitmap_"+hid,twodtitle,nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00131       mePixDigisLad_->setAxisTitle("Columns",1);
00132       mePixDigisLad_->setAxisTitle("Rows",2);
00133       //std::cout << "During booking: type is "<< type << ", ID is "<< id_ << ", pwd for booking is " << theDMBE->pwd() << ", Plot name: " << hid << std::endl;
00134     }
00135     else{
00136       // projections of 2D hit map
00137       mePixDigisLad_px_ = theDMBE->book1D("hitmap_"+hid+"_px",pxtitle,nbinx,0.,float(ncols_));
00138       mePixDigisLad_py_ = theDMBE->book1D("hitmap_"+hid+"_py",pytitle,nbiny,0.,float(nrows_));
00139       mePixDigisLad_px_->setAxisTitle("Columns",1);
00140       mePixDigisLad_py_->setAxisTitle("Rows",1);        
00141     }
00142         }
00143   }
00144   if(type==2 && barrel){
00145     uint32_t DBlayer = PixelBarrelName(DetId(id_)).layerName();
00146     char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
00147     hid = src.label() + "_" + slayer;
00148     if(!additInfo){
00149       // Number of digis
00150       meNDigisLay_ = theDMBE->book1D("ndigis_"+hid,"Number of Digis",25,0.,25.);
00151       meNDigisLay_->setAxisTitle("Number of digis",1);
00152     // Charge in ADC counts
00153       meADCLay_ = theDMBE->book1D("adc_" + hid,"Digi charge",128,0.,256.);
00154       meADCLay_->setAxisTitle("ADC counts",1);
00155     }
00156     if(!reducedSet){
00157       if(twoD || additInfo){
00158         // 2D hit map
00159         if(isHalfModule){
00160           mePixDigisLay_ = theDMBE->book2D("hitmap_"+hid,twodtitle,nbinx,0.,float(ncols_),2*nbiny,0.,float(2*nrows_));
00161         }
00162         else{
00163           mePixDigisLay_ = theDMBE->book2D("hitmap_"+hid,twodtitle,nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00164 
00165         }
00166         mePixDigisLay_->setAxisTitle("Columns",1);
00167         mePixDigisLay_->setAxisTitle("Rows",2);
00168         
00169         //std::cout << "During booking: type is "<< type << ", ID is "<< id_ << ", pwd for booking is " << theDMBE->pwd() << ", Plot name: " << hid << std::endl;
00170         int yROCbins[3] = {18,30,42};
00171         mePixRocsLay_ = theDMBE->book2D("rocmap_"+hid,twodroctitle,32,0.,32.,yROCbins[DBlayer-1],1.5,1.5+float(yROCbins[DBlayer-1]/2));
00172         mePixRocsLay_->setAxisTitle("ROCs per Module",1);
00173         mePixRocsLay_->setAxisTitle("ROCs per 1/2 Ladder",2);
00174         meZeroOccRocsLay_ = theDMBE->book2D("zeroOccROC_map",twodzeroOccroctitle+hid,32,0.,32.,yROCbins[DBlayer-1],1.5,1.5+float(yROCbins[DBlayer-1]/2));
00175         meZeroOccRocsLay_->setAxisTitle("ROCs per Module",1);
00176         meZeroOccRocsLay_->setAxisTitle("ROCs per 1/2 Ladder",2);
00177       }
00178       if(!twoD && !additInfo){
00179         // projections of 2D hit map
00180         mePixDigisLay_px_ = theDMBE->book1D("hitmap_"+hid+"_px",pxtitle,nbinx,0.,float(ncols_));
00181         if(isHalfModule){
00182           mePixDigisLay_py_ = theDMBE->book1D("hitmap_"+hid+"_py",pytitle,2*nbiny,0.,float(2*nrows_));
00183         }
00184         else{
00185           mePixDigisLay_py_ = theDMBE->book1D("hitmap_"+hid+"_py",pytitle,nbiny,0.,float(nrows_));
00186         }
00187         mePixDigisLay_px_->setAxisTitle("Columns",1);
00188         mePixDigisLay_py_->setAxisTitle("Rows",1);
00189       }
00190     }
00191   }
00192   if(type==3 && barrel){
00193     uint32_t DBmodule = PixelBarrelName(DetId(id_)).moduleName();
00194     char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
00195     hid = src.label() + "_" + smodule;
00196     // Number of digis
00197     meNDigisPhi_ = theDMBE->book1D("ndigis_"+hid,"Number of Digis",25,0.,25.);
00198     meNDigisPhi_->setAxisTitle("Number of digis",1);
00199     // Charge in ADC counts
00200     meADCPhi_ = theDMBE->book1D("adc_" + hid,"Digi charge",128,0.,256.);
00201     meADCPhi_->setAxisTitle("ADC counts",1);
00202     if(!reducedSet)
00203       {
00204         if(twoD){
00205           
00206           // 2D hit map
00207           if(isHalfModule){
00208             mePixDigisPhi_ = theDMBE->book2D("hitmap_"+hid,twodtitle,nbinx,0.,float(ncols_),2*nbiny,0.,float(2*nrows_));
00209           }
00210           else {
00211             mePixDigisPhi_ = theDMBE->book2D("hitmap_"+hid,twodtitle,nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00212           }
00213           mePixDigisPhi_->setAxisTitle("Columns",1);
00214           mePixDigisPhi_->setAxisTitle("Rows",2);
00215           //std::cout << "During booking: type is "<< type << ", ID is "<< id_ << ", pwd for booking is " << theDMBE->pwd() << ", Plot name: " << hid << std::endl;
00216         }
00217         else{
00218           // projections of 2D hit map
00219           mePixDigisPhi_px_ = theDMBE->book1D("hitmap_"+hid+"_px",pxtitle,nbinx,0.,float(ncols_));
00220           if(isHalfModule){
00221             mePixDigisPhi_py_ = theDMBE->book1D("hitmap_"+hid+"_py",pytitle,2*nbiny,0.,float(2*nrows_));
00222           }
00223           else{
00224             mePixDigisPhi_py_ = theDMBE->book1D("hitmap_"+hid+"_py",pytitle,nbiny,0.,float(nrows_));
00225           }
00226           mePixDigisPhi_px_->setAxisTitle("Columns",1);
00227           mePixDigisPhi_py_->setAxisTitle("Rows",1);
00228         }
00229       }
00230   }
00231   if(type==4 && endcap){
00232     uint32_t blade= PixelEndcapName(DetId(id_)).bladeName();
00233     
00234     char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
00235     hid = src.label() + "_" + sblade;
00236     // Number of digis
00237     meNDigisBlade_ = theDMBE->book1D("ndigis_"+hid,"Number of Digis",25,0.,25.);
00238     meNDigisBlade_->setAxisTitle("Number of digis",1);
00239     // Charge in ADC counts
00240     meADCBlade_ = theDMBE->book1D("adc_" + hid,"Digi charge",128,0.,256.);
00241     meADCBlade_->setAxisTitle("ADC counts",1);
00242   }
00243   if(type==5 && endcap){
00244     uint32_t disk = PixelEndcapName(DetId(id_)).diskName();
00245     
00246     char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
00247     hid = src.label() + "_" + sdisk;
00248     if(!additInfo){
00249       // Number of digis
00250       meNDigisDisk_ = theDMBE->book1D("ndigis_"+hid,"Number of Digis",25,0.,25.);
00251       meNDigisDisk_->setAxisTitle("Number of digis",1);
00252       // Charge in ADC counts
00253       meADCDisk_ = theDMBE->book1D("adc_" + hid,"Digi charge",128,0.,256.);
00254       meADCDisk_->setAxisTitle("ADC counts",1);
00255     }
00256     if(additInfo){
00257       mePixDigisDisk_ = theDMBE->book2D("hitmap_"+hid,twodtitle,260,0.,260.,160,0.,160.);
00258       mePixDigisDisk_->setAxisTitle("Columns",1);
00259       mePixDigisDisk_->setAxisTitle("Rows",2);
00260       //ROC information in disks
00261       mePixRocsDisk_  = theDMBE->book2D("rocmap_"+hid,twodroctitle,26,0.,26.,24,1.,13.);
00262       mePixRocsDisk_ ->setAxisTitle("ROCs per Module (2 Panels)",1);
00263       mePixRocsDisk_ ->setAxisTitle("Blade Number",2);
00264       meZeroOccRocsDisk_  = theDMBE->book2D("zeroOccROC_map",twodzeroOccroctitle+hid,26,0.,26.,24,1.,13.);
00265       meZeroOccRocsDisk_ ->setAxisTitle("Zero-Occupancy ROCs per Module (2 Panels)",1);
00266       meZeroOccRocsDisk_ ->setAxisTitle("Blade Number",2);
00267     }
00268   }
00269   if(type==6 && endcap){
00270     uint32_t panel= PixelEndcapName(DetId(id_)).pannelName();
00271     uint32_t module= PixelEndcapName(DetId(id_)).plaquetteName();
00272     char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
00273     hid = src.label() + "_" + slab;
00274     // Number of digis
00275     meNDigisRing_ = theDMBE->book1D("ndigis_"+hid,"Number of Digis",25,0.,25.);
00276     meNDigisRing_->setAxisTitle("Number of digis",1);
00277     // Charge in ADC counts
00278     meADCRing_ = theDMBE->book1D("adc_" + hid,"Digi charge",128,0.,256.);
00279     meADCRing_->setAxisTitle("ADC counts",1);
00280         if(!reducedSet)
00281         {
00282     if(twoD){
00283       // 2D hit map
00284       mePixDigisRing_ = theDMBE->book2D("hitmap_"+hid,twodtitle,nbinx,0.,float(ncols_),nbiny,0.,float(nrows_));
00285       mePixDigisRing_->setAxisTitle("Columns",1);
00286       mePixDigisRing_->setAxisTitle("Rows",2);
00287       //std::cout << "During booking: type is "<< type << ", ID is "<< id_ << ", pwd for booking is " << theDMBE->pwd() << ", Plot name: " << hid << std::endl;
00288     }
00289     else{
00290       // projections of 2D hit map
00291       mePixDigisRing_px_ = theDMBE->book1D("hitmap_"+hid+"_px",pxtitle,nbinx,0.,float(ncols_));
00292       mePixDigisRing_py_ = theDMBE->book1D("hitmap_"+hid+"_py",pytitle,nbiny,0.,float(nrows_));
00293       mePixDigisRing_px_->setAxisTitle("Columns",1);
00294       mePixDigisRing_py_->setAxisTitle("Rows",1);
00295     }
00296         }
00297   }
00298 }
00299 
00300 
00301 //
00302 // Fill histograms
00303 //
00304 int SiPixelDigiModule::fill(const edm::DetSetVector<PixelDigi>& input, bool modon, 
00305                                                                  bool ladon, bool layon, bool phion, 
00306                                                                  bool bladeon, bool diskon, bool ringon, 
00307                                                                  bool twoD, bool reducedSet, bool twoDimModOn, bool twoDimOnlyLayDisk,
00308                                                                  int &nDigisA, int &nDigisB) {
00309   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00310   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00311   bool isHalfModule = false;
00312   uint32_t DBladder = 0;
00313   if(barrel){
00314     isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule(); 
00315     DBladder = PixelBarrelName(DetId(id_)).ladderName();
00316   }
00317 
00318   // Get DQM interface
00319   DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
00320   //std::cout<<"id_ = "<<id_<<" , dmbe="<<theDMBE->pwd()<<std::endl;
00321   //std::cout<<"********************"<<std::endl;
00322   edm::DetSetVector<PixelDigi>::const_iterator isearch = input.find(id_); // search  digis of detid
00323   
00324   unsigned int numberOfDigisMod = 0;
00325   int numberOfDigis[8]; for(int i=0; i!=8; i++) numberOfDigis[i]=0; 
00326   nDigisA=0; nDigisB=0;
00327   if( isearch != input.end() ) {  // Not an empty iterator
00328     
00329     // Look at digis now
00330     edm::DetSet<PixelDigi>::const_iterator  di;
00331     for(di = isearch->data.begin(); di != isearch->data.end(); di++) {
00332       int adc = di->adc();    // charge
00333       int col = di->column(); // column 
00334       int row = di->row();    // row
00335       numberOfDigisMod++;
00336       PixelBarrelName::Shell DBshell = PixelBarrelName(DetId(id_)).shell();
00337       int DBlayer  = PixelBarrelName(DetId(id_)).layerName();
00338       int DBmodule = PixelBarrelName(DetId(id_)).moduleName();
00339       if(barrel){
00340         if(isHalfModule){
00341           if(DBshell==PixelBarrelName::pI||DBshell==PixelBarrelName::pO){
00342             numberOfDigis[0]++; nDigisA++;
00343             if(DBlayer==1) numberOfDigis[2]++;
00344             if(DBlayer==2) numberOfDigis[3]++;
00345             if(DBlayer==3) numberOfDigis[4]++;
00346           }
00347           if(DBshell==PixelBarrelName::mI||DBshell==PixelBarrelName::mO){
00348             numberOfDigis[1]++; nDigisB++;
00349             if(DBlayer==1) numberOfDigis[5]++;
00350             if(DBlayer==2) numberOfDigis[6]++;
00351             if(DBlayer==3) numberOfDigis[7]++;
00352           }
00353         }else{
00354           if(row<80){
00355             numberOfDigis[0]++; nDigisA++;
00356             if(DBlayer==1) numberOfDigis[2]++;
00357             if(DBlayer==2) numberOfDigis[3]++;
00358             if(DBlayer==3) numberOfDigis[4]++;
00359           }else{ 
00360             numberOfDigis[1]++; nDigisB++;
00361             if(DBlayer==1) numberOfDigis[5]++;
00362             if(DBlayer==2) numberOfDigis[6]++;
00363             if(DBlayer==3) numberOfDigis[7]++;
00364           }
00365         }
00366       }
00367       if(modon){
00368         if(!reducedSet){
00369           if(twoD) {
00370             if(twoDimModOn) (mePixDigis_)->Fill((float)col,(float)row);
00371             //std::cout << "Col: " << col << ", Row: " << row << ", for DBlayer " << DBlayer << " and isladder " << DBladder << " and module " << PixelBarrelName(DetId(id_)).moduleName() << " and side is " << DBshell << std::endl;
00372             //std::cout<<"id_ = "<<id_<<" , dmbe="<<theDMBE->pwd()<<std::endl;                                                                                                                  
00373           }
00374           else {
00375             (mePixDigis_px_)->Fill((float)col);
00376             (mePixDigis_py_)->Fill((float)row);
00377           }
00378         }
00379         (meADC_)->Fill((float)adc);
00380       }
00381       if(ladon && barrel){
00382         (meADCLad_)->Fill((float)adc);
00383         if(!reducedSet){
00384           if(twoD) (mePixDigisLad_)->Fill((float)col,(float)row);
00385           else {
00386           (mePixDigisLad_px_)->Fill((float)col);
00387           (mePixDigisLad_py_)->Fill((float)row);
00388           }
00389         }
00390       }
00391       if((layon || twoDimOnlyLayDisk) && barrel){
00392         if(!twoDimOnlyLayDisk) (meADCLay_)->Fill((float)adc);
00393         if(!reducedSet){
00394           if((layon && twoD) || twoDimOnlyLayDisk){
00395             //ROC histos...
00396             float rocx = (float)col/52. + 8.0*float(DBmodule-1);
00397             float rocy = (float)row/160.+float(DBladder);
00398             //Shift 1st ladder (half modules) up by 1 bin
00399             if(DBladder==1) rocy = rocy + 0.5;
00400             mePixRocsLay_->Fill(rocx,rocy);
00401             //Copying full 1/2 module to empty 1/2 module...
00402             //if(isHalfModule) mePixRocsLay_->Fill(rocx,rocy+0.5);
00403             //end of ROC filling...
00404 
00405             if(isHalfModule && DBladder==1){
00406               (mePixDigisLay_)->Fill((float)col,(float)row+80);
00407             }
00408             else (mePixDigisLay_)->Fill((float)col,(float)row);
00409           }
00410           if((layon && !twoD) && !twoDimOnlyLayDisk){
00411             (mePixDigisLay_px_)->Fill((float)col);
00412             if(isHalfModule && DBladder==1) {
00413               (mePixDigisLay_py_)->Fill((float)row+80);
00414             }
00415             else (mePixDigisLay_py_)->Fill((float)row);
00416           }
00417         }
00418       }
00419       if(phion && barrel){
00420         (meADCPhi_)->Fill((float)adc);
00421         if(!reducedSet)
00422         {
00423         if(twoD){
00424           if(isHalfModule && DBladder==1){
00425             (mePixDigisPhi_)->Fill((float)col,(float)row+80);
00426           }
00427           else (mePixDigisPhi_)->Fill((float)col,(float)row);
00428         }
00429         else {
00430           (mePixDigisPhi_px_)->Fill((float)col);
00431           if(isHalfModule && DBladder==1) {
00432             (mePixDigisPhi_py_)->Fill((float)row+80);
00433           }
00434           else (mePixDigisPhi_py_)->Fill((float)row);
00435         }
00436         }
00437       }
00438       if(bladeon && endcap){
00439         (meADCBlade_)->Fill((float)adc);
00440       }
00441 
00442       if((diskon || twoDimOnlyLayDisk) && endcap){
00443         if(!twoDimOnlyLayDisk) (meADCDisk_)->Fill((float)adc);
00444         if(twoDimOnlyLayDisk){
00445           (mePixDigisDisk_)->Fill((float)col,(float)row);
00446           //ROC monitoring
00447           int DBpanel= PixelEndcapName(DetId(id_)).pannelName();
00448           int DBblade= PixelEndcapName(DetId(id_)).bladeName();
00449           float offx = 0.;
00450           //This crazy offset takes into account the roc and module fpix configuration
00451           for (int i = DBpanel; i < DBmodule; ++i) {offx = offx + float(5+DBpanel-i);}
00452           float rocx = (float)col/52. + offx + 14.0*float(DBpanel-1);
00453           float rocy = (float)row/160.+float(DBblade);
00454           mePixRocsDisk_->Fill(rocx,rocy);
00455           //Now handle the 1/2 module cases by cloning those bins and filling...
00456           //if (DBpanel==1 && (DBmodule==1||DBmodule==4)){
00457           //rocy = rocy + 0.5;
00458           //mePixRocsDisk_->Fill(rocx,rocy);}
00459           //end ROC monitoring
00460         }
00461       }
00462       if(ringon && endcap){
00463         (meADCRing_)->Fill((float)adc);
00464         if(!reducedSet)
00465         {
00466         if(twoD) (mePixDigisRing_)->Fill((float)col,(float)row);
00467         else {
00468           (mePixDigisRing_px_)->Fill((float)col);
00469           (mePixDigisRing_py_)->Fill((float)row);
00470         }
00471         }
00472       }
00473     }
00474     if(modon) (meNDigis_)->Fill((float)numberOfDigisMod);
00475     if(ladon && barrel) (meNDigisLad_)->Fill((float)numberOfDigisMod);
00476     if(layon && barrel && !twoDimOnlyLayDisk) (meNDigisLay_)->Fill((float)numberOfDigisMod);
00477     if(phion && barrel) (meNDigisPhi_)->Fill((float)numberOfDigisMod);
00478     if(bladeon && endcap) (meNDigisBlade_)->Fill((float)numberOfDigisMod);
00479     if(diskon && endcap && !twoDimOnlyLayDisk) (meNDigisDisk_)->Fill((float)numberOfDigisMod);
00480     if(ringon && endcap) (meNDigisRing_)->Fill((float)numberOfDigisMod);
00481     if(barrel){ 
00482       MonitorElement* me=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCOMB_Barrel");
00483       if(me) me->Fill((float)numberOfDigisMod);
00484       me=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_Barrel");
00485       if(me){ if(numberOfDigis[0]>0) me->Fill((float)numberOfDigis[0]); if(numberOfDigis[1]>0) me->Fill((float)numberOfDigis[1]); }
00486       me=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelL1");
00487       if(me){ if(numberOfDigis[2]>0) me->Fill((float)numberOfDigis[2]); }
00488       me=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelL2");
00489       if(me){ if(numberOfDigis[3]>0) me->Fill((float)numberOfDigis[3]); }
00490       me=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelL3");
00491       if(me){ if(numberOfDigis[4]>0) me->Fill((float)numberOfDigis[4]); }
00492     }else if(endcap){
00493       MonitorElement* me=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCOMB_Endcap");
00494       if(me) me->Fill((float)numberOfDigisMod);
00495     }
00496   }
00497   
00498   //std::cout<<"numberOfDigis for this module: "<<numberOfDigis<<std::endl;
00499   return numberOfDigisMod;
00500 }