CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc

Go to the documentation of this file.
00001 
00002 // -*- C++ -*-
00003 //
00004 // Package:    SiPixelMonitorDigi
00005 // Class:      SiPixelDigiSource
00006 // 
00014 //
00015 // Original Author:  Vincenzo Chiochia
00016 //         Created:  
00017 // $Id: SiPixelDigiSource.cc,v 1.58 2013/04/17 09:48:25 itopsisg Exp $
00018 //
00019 //
00020 #include "DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h"
00021 // Framework
00022 #include "FWCore/ServiceRegistry/interface/Service.h"
00023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00025 // DQM Framework
00026 #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h"
00027 #include "DQMServices/Core/interface/DQMStore.h"
00028 // Geometry
00029 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00030 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00031 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00032 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00033 // DataFormats
00034 #include "DataFormats/DetId/interface/DetId.h"
00035 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00036 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00037 #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h"
00038 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00039 #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h"
00040 //
00041 #include <string>
00042 #include <stdlib.h>
00043 #include <iostream>
00044 #include <fstream>
00045 
00046 using namespace std;
00047 using namespace edm;
00048 
00049 SiPixelDigiSource::SiPixelDigiSource(const edm::ParameterSet& iConfig) :
00050   conf_(iConfig),
00051   src_( conf_.getParameter<edm::InputTag>( "src" ) ),
00052   saveFile( conf_.getUntrackedParameter<bool>("saveFile",false) ),
00053   isPIB( conf_.getUntrackedParameter<bool>("isPIB",false) ),
00054   slowDown( conf_.getUntrackedParameter<bool>("slowDown",false) ),
00055   modOn( conf_.getUntrackedParameter<bool>("modOn",true) ),
00056   twoDimOn( conf_.getUntrackedParameter<bool>("twoDimOn",true) ),
00057   twoDimModOn( conf_.getUntrackedParameter<bool>("twoDimModOn",true) ),
00058   twoDimOnlyLayDisk( conf_.getUntrackedParameter<bool>("twoDimOnlyLayDisk",false) ),
00059   hiRes( conf_.getUntrackedParameter<bool>("hiRes",false) ),
00060   reducedSet( conf_.getUntrackedParameter<bool>("reducedSet",false) ),
00061   ladOn( conf_.getUntrackedParameter<bool>("ladOn",false) ), 
00062   layOn( conf_.getUntrackedParameter<bool>("layOn",false) ), 
00063   phiOn( conf_.getUntrackedParameter<bool>("phiOn",false) ), 
00064   ringOn( conf_.getUntrackedParameter<bool>("ringOn",false) ), 
00065   bladeOn( conf_.getUntrackedParameter<bool>("bladeOn",false) ), 
00066   diskOn( conf_.getUntrackedParameter<bool>("diskOn",false) ),
00067   bigEventSize( conf_.getUntrackedParameter<int>("bigEventSize",1000) ), 
00068   isUpgrade( conf_.getUntrackedParameter<bool>("isUpgrade",false) )
00069 {
00070    theDMBE = edm::Service<DQMStore>().operator->();
00071    LogInfo ("PixelDQM") << "SiPixelDigiSource::SiPixelDigiSource: Got DQM BackEnd interface"<<endl;
00072 }
00073 
00074 
00075 SiPixelDigiSource::~SiPixelDigiSource()
00076 {
00077    // do anything here that needs to be done at desctruction time
00078    // (e.g. close files, deallocate resources etc.)
00079   LogInfo ("PixelDQM") << "SiPixelDigiSource::~SiPixelDigiSource: Destructor"<<endl;
00080 }
00081 
00082 
00083 void SiPixelDigiSource::beginJob(){
00084   firstRun = true;  
00085   // find a FED# for the current detId:
00086   ifstream infile(edm::FileInPath("DQM/SiPixelMonitorClient/test/detId.dat").fullPath().c_str(),ios::in);
00087   int nModsInFile=0;
00088   assert(!infile.fail());
00089   int nTOTmodules;
00090   if (isUpgrade) { nTOTmodules=1856; } else { nTOTmodules=1440; }
00091   while(!infile.eof()&&nModsInFile<nTOTmodules) {
00092     infile >> I_name[nModsInFile] >> I_detId[nModsInFile] >> I_fedId[nModsInFile] >> I_linkId1[nModsInFile] >> I_linkId2[nModsInFile];
00093     //cout<<nModsInFile<<" , "<<I_name[nModsInFile]<<" , "<<I_detId[nModsInFile]<<" , "<<I_fedId[nModsInFile]<<" , "<<I_linkId[nModsInFile]<<endl; ;
00094     nModsInFile++;
00095   }
00096   infile.close();
00097 }
00098 
00099 void SiPixelDigiSource::beginRun(const edm::Run& r, const edm::EventSetup& iSetup){
00100   LogInfo ("PixelDQM") << " SiPixelDigiSource::beginJob - Initialisation ... " << std::endl;
00101   LogInfo ("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/" 
00102                        << layOn << "/" << phiOn << std::endl;
00103   LogInfo ("PixelDQM") << "Blade/Disk/Ring" << bladeOn << "/" << diskOn << "/" 
00104                        << ringOn << std::endl;
00105   
00106   LogInfo ("PixelDQM") << "2DIM IS " << twoDimOn << " and set to high resolution? " << hiRes << "\n";
00107 
00108   if(firstRun){
00109     eventNo = 0;
00110     lumSec = 0;
00111     nLumiSecs = 0;
00112     nBigEvents = 0;
00113     nBPIXDigis = 0; 
00114     nFPIXDigis = 0;
00115     for(int i=0; i!=40; i++) nDigisPerFed[i]=0;  
00116     for(int i=0; i!=4; i++) nDigisPerDisk[i]=0;  
00117     nDP1P1M1 = 0;
00118     nDP1P1M2 = 0;
00119     nDP1P1M3 = 0;
00120     nDP1P1M4 = 0;
00121     nDP1P2M1 = 0;
00122     nDP1P2M2 = 0;
00123     nDP1P2M3 = 0;
00124     nDP2P1M1 = 0;
00125     nDP2P1M2 = 0;
00126     nDP2P1M3 = 0;
00127     nDP2P1M4 = 0;
00128     nDP2P2M1 = 0;
00129     nDP2P2M2 = 0;
00130     nDP2P2M3 = 0;
00131     nDP3P1M1 = 0;
00132     nDP3P2M1 = 0;
00133     nDM1P1M1 = 0;
00134     nDM1P1M2 = 0;
00135     nDM1P1M3 = 0;
00136     nDM1P1M4 = 0;
00137     nDM1P2M1 = 0;
00138     nDM1P2M2 = 0;
00139     nDM1P2M3 = 0;
00140     nDM2P1M1 = 0;
00141     nDM2P1M2 = 0;
00142     nDM2P1M3 = 0;
00143     nDM2P1M4 = 0;
00144     nDM2P2M1 = 0;
00145     nDM2P2M2 = 0;
00146     nDM2P2M3 = 0;
00147     nDM3P1M1 = 0;
00148     nDM3P2M1 = 0;
00149     nL1M1 = 0;
00150     nL1M2 = 0;
00151     nL1M3 = 0;
00152     nL1M4 = 0;
00153     nL2M1 = 0;
00154     nL2M2 = 0;
00155     nL2M3 = 0;
00156     nL2M4 = 0;
00157     nL3M1 = 0;
00158     nL3M2 = 0;
00159     nL3M3 = 0;
00160     nL3M4 = 0;
00161     nL4M1 = 0;
00162     nL4M2 = 0;
00163     nL4M3 = 0;
00164     nL4M4 = 0;
00165     
00166     // Build map
00167     buildStructure(iSetup);
00168     // Book Monitoring Elements
00169     bookMEs();
00170     firstRun = false;
00171   }
00172 }
00173 
00174 
00175 void SiPixelDigiSource::endJob(void){
00176 
00177   if(saveFile) {
00178     LogInfo ("PixelDQM") << " SiPixelDigiSource::endJob - Saving Root File " << std::endl;
00179     std::string outputFile = conf_.getParameter<std::string>("outputFile");
00180     theDMBE->save( outputFile.c_str() );
00181   }
00182 
00183 }
00184 
00185 //------------------------------------------------------------------
00186 // Method called for every event
00187 //------------------------------------------------------------------
00188 void SiPixelDigiSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00189 {
00190   eventNo++;
00191   //cout<<"BIGFATEVENTNUMBER: "<<eventNo<<endl;
00192 
00193   // get input data
00194   edm::Handle< edm::DetSetVector<PixelDigi> >  input;
00195   iEvent.getByLabel( src_, input );
00196   if (!input.isValid()) return; 
00197   // Get DQM interface
00198   DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
00199   
00200   //float iOrbitSec = iEvent.orbitNumber()/11223.;
00201   int bx = iEvent.bunchCrossing();
00202   //long long tbx = (long long)iEvent.orbitNumber() * 3564 + bx;
00203   int lumiSection = (int)iEvent.luminosityBlock();
00204   int nEventDigis = 0; int nActiveModules = 0;
00205   //int nEventBPIXDigis = 0; int nEventFPIXDigis = 0;
00206   
00207   if(modOn){
00208     MonitorElement* meReset = theDMBE->get("Pixel/averageDigiOccupancy");
00209     //if(meReset && eventNo%1000==0){
00210     if(meReset && lumiSection%8==0){
00211       meReset->Reset();
00212       nBPIXDigis = 0; 
00213       nFPIXDigis = 0;
00214       for(int i=0; i!=40; i++) nDigisPerFed[i]=0;  
00215     }
00216     if (lumiSection%10==0){
00217       //Now do resets for ROCuppancy maps every 10 ls
00218       std::string baseDirs[2] = {"Pixel/Barrel", "Pixel/Endcap"};
00219       for (int i = 0; i < 2; ++i){
00220         theDMBE->cd(baseDirs[i]);
00221         vector<string> shellDirs = theDMBE->getSubdirs();
00222         for (vector<string>::const_iterator it = shellDirs.begin(); it != shellDirs.end(); it++) {
00223           theDMBE->cd(*it);
00224           vector<string> layDirs = theDMBE->getSubdirs();
00225           for (vector<string>::const_iterator itt = layDirs.begin(); itt != layDirs.end(); itt++) {
00226             theDMBE->cd(*itt);
00227             vector<string> contents = theDMBE->getMEs();
00228             for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++) {
00229               if ((*im).find("rocmap") == string::npos) continue;
00230               MonitorElement* me = theDMBE->get((*itt)+"/"+(*im));
00231               if(me) me->Reset();}}}}//end for contents//end for layDirs//end for shellDirs//end for bar/EC
00232     }
00233   }
00234   if(!modOn){
00235     MonitorElement* meReset = theDMBE->get("Pixel/averageDigiOccupancy");
00236     if(meReset && lumiSection%1==0){
00237       meReset->Reset();
00238       nBPIXDigis = 0; 
00239       nFPIXDigis = 0;
00240       for(int i=0; i!=40; i++) nDigisPerFed[i]=0;  
00241     }
00242   }
00243   
00244   std::map<uint32_t,SiPixelDigiModule*>::iterator struct_iter;
00245   for(int i=0; i!=192; i++) numberOfDigis[i]=0;
00246   for(int i=0; i!=1152; i++) nDigisPerChan[i]=0;  
00247   for(int i=0; i!=4; i++) nDigisPerDisk[i]=0;  
00248   for (struct_iter = thePixelStructure.begin() ; struct_iter != thePixelStructure.end() ; struct_iter++) {
00249     int numberOfDigisMod = (*struct_iter).second->fill(*input, modOn, 
00250                                 ladOn, layOn, phiOn, 
00251                                 bladeOn, diskOn, ringOn, 
00252                                 twoDimOn, reducedSet, twoDimModOn, twoDimOnlyLayDisk,
00253                                 nDigisA, nDigisB, isUpgrade);
00254     if(numberOfDigisMod>0){
00255       //if((*struct_iter).first == I_detId[39]) 
00256       //std::cout << "FED " << (*struct_iter).first << " NDigis all modules..." << numberOfDigisMod << std::endl;
00257       nEventDigis = nEventDigis + numberOfDigisMod;  
00258       nActiveModules++;  
00259       bool barrel = DetId((*struct_iter).first).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00260       bool endcap = DetId((*struct_iter).first).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00261       //if((*struct_iter).first >= 302055684 && (*struct_iter).first <= 302197792 ){ // Barrel
00262       int nBPiXmodules;
00263       //int nFPixmodules;
00264       int nTOTmodules;
00265       if (isUpgrade) {
00266         nBPiXmodules=1184;
00267         //nFPixmodules=672;
00268         nTOTmodules=1856;
00269       } else {
00270         nBPiXmodules=768;
00271         //nFPixmodules=672;
00272         nTOTmodules=1440;
00273       }
00274       if(barrel){ // Barrel
00275         //cout<<"AAbpix: "<<numberOfDigisMod<<" + "<<nBPIXDigis<<" = ";
00276         nBPIXDigis = nBPIXDigis + numberOfDigisMod;
00277         //cout<<nBPIXDigis<<endl;
00278         for(int i=0; i!=nBPiXmodules; ++i){
00279           //cout<<"\t\t\t bpix: "<<i<<" , "<<(*struct_iter).first<<" , "<<I_detId[i]<<endl;
00280           if((*struct_iter).first == I_detId[i]){
00281             //if(I_fedId[i]>=32&&I_fedId[i]<=39) std::cout<<"Attention: a BPIX module matched to an FPIX FED!"<<std::endl;
00282             nDigisPerFed[I_fedId[i]]=nDigisPerFed[I_fedId[i]]+numberOfDigisMod;
00283             //cout<<"BPIX: "<<i<<" , "<<I_fedId[i]<<" , "<<numberOfDigisMod<<" , "<<nDigisPerFed[I_fedId[i]]<<endl;
00284             int index1 = 0; int index2 = 0;
00285             if(I_linkId1[i]>0) index1 = I_fedId[i]*36+(I_linkId1[i]-1); 
00286             if(I_linkId2[i]>0) index2 = I_fedId[i]*36+(I_linkId2[i]-1);
00287             if(nDigisA>0 && I_linkId1[i]>0) nDigisPerChan[index1]=nDigisPerChan[index1]+nDigisA;
00288             if(nDigisB>0 && I_linkId2[i]>0) nDigisPerChan[index2]=nDigisPerChan[index2]+nDigisB;
00289             //if (index1==35 || index2==35) cout<<"BPIX 35: "<<I_detId[i]<<" : "<<I_fedId[i]<<"  "<<I_linkId1[i]<<" , "<<I_fedId[i]<<"  "<<I_linkId2[i]<<" , "<<nDigisA<<" , "<<nDigisB<<endl;
00290             i=(nBPiXmodules-1);
00291           }
00292         }
00293       //}else if((*struct_iter).first >= 343999748 && (*struct_iter).first <= 352477708 ){ // Endcap
00294       }else if(endcap && !isUpgrade){ // Endcap
00295         //cout<<"AAfpix: "<<nFPIXDigis<<" = ";
00296         nFPIXDigis = nFPIXDigis + numberOfDigisMod;
00297         //cout<<nFPIXDigis<<endl;
00298         PixelEndcapName::HalfCylinder side = PixelEndcapName(DetId((*struct_iter).first)).halfCylinder();
00299         int disk = PixelEndcapName(DetId((*struct_iter).first)).diskName();
00300         int blade = PixelEndcapName(DetId((*struct_iter).first)).bladeName();
00301         int panel = PixelEndcapName(DetId((*struct_iter).first)).pannelName();
00302         int module = PixelEndcapName(DetId((*struct_iter).first)).plaquetteName();
00303         
00304         int iter=0; int i=0;
00305         if(side==PixelEndcapName::mI){
00306           if(disk==1){
00307             i=0;
00308             if(panel==1){ if(module==1) nDM1P1M1+=numberOfDigisMod; 
00309                           else if(module==2) nDM1P1M2+=numberOfDigisMod; 
00310                           else if(module==3) nDM1P1M3+=numberOfDigisMod; 
00311                           else if(module==4) nDM1P1M4+=numberOfDigisMod;}
00312             else if(panel==2){ if(module==1) nDM1P2M1+=numberOfDigisMod; 
00313                                else if(module==2) nDM1P2M2+=numberOfDigisMod; 
00314                                else if(module==3) nDM1P2M3+=numberOfDigisMod; }
00315             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00316             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00317             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00318             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00319             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00320             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00321             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00322             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00323             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00324             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00325             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00326             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00327           }else if(disk==2){
00328             i=24;
00329             if(panel==1){ if(module==1) nDM2P1M1+=numberOfDigisMod; 
00330                           else if(module==2) nDM2P1M2+=numberOfDigisMod; 
00331                           else if(module==3) nDM2P1M3+=numberOfDigisMod; 
00332                           else if(module==4) nDM2P1M4+=numberOfDigisMod;}
00333             else if(panel==2){ if(module==1) nDM2P2M1+=numberOfDigisMod; 
00334                                else if(module==2) nDM2P2M2+=numberOfDigisMod; 
00335                                else if(module==3) nDM2P2M3+=numberOfDigisMod; }
00336             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00337             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00338             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00339             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00340             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00341             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00342             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00343             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00344             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00345             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00346             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00347             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00348           }
00349         }else if(side==PixelEndcapName::mO){
00350           if(disk==1){
00351             i=48;
00352             if(panel==1){ if(module==1) nDM1P1M1+=numberOfDigisMod; 
00353                           else if(module==2) nDM1P1M2+=numberOfDigisMod; 
00354                           else if(module==3) nDM1P1M3+=numberOfDigisMod; 
00355                           else if(module==4) nDM1P1M4+=numberOfDigisMod;}
00356             else if(panel==2){ if(module==1) nDM1P2M1+=numberOfDigisMod; 
00357                                else if(module==2) nDM1P2M2+=numberOfDigisMod; 
00358                                else if(module==3) nDM1P2M3+=numberOfDigisMod; }
00359             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00360             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00361             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00362             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00363             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00364             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00365             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00366             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00367             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00368             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00369             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00370             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00371           }else if(disk==2){
00372             i=72;
00373             if(panel==1){ if(module==1) nDM2P1M1+=numberOfDigisMod; 
00374                           else if(module==2) nDM2P1M2+=numberOfDigisMod; 
00375                           else if(module==3) nDM2P1M3+=numberOfDigisMod; 
00376                           else if(module==4) nDM2P1M4+=numberOfDigisMod;}
00377             else if(panel==2){ if(module==1) nDM2P2M1+=numberOfDigisMod; 
00378                                else if(module==2) nDM2P2M2+=numberOfDigisMod; 
00379                                else if(module==3) nDM2P2M3+=numberOfDigisMod; }
00380             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00381             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00382             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00383             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00384             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00385             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00386             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00387             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00388             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00389             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00390             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00391             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00392           }
00393         }else if(side==PixelEndcapName::pI){
00394           if(disk==1){
00395             i=96;
00396             if(panel==1){ if(module==1) nDP1P1M1+=numberOfDigisMod; 
00397                           else if(module==2) nDP1P1M2+=numberOfDigisMod; 
00398                           else if(module==3) nDP1P1M3+=numberOfDigisMod; 
00399                           else if(module==4) nDP1P1M4+=numberOfDigisMod;}
00400             else if(panel==2){ if(module==1) nDP1P2M1+=numberOfDigisMod; 
00401                                else if(module==2) nDP1P2M2+=numberOfDigisMod; 
00402                                else if(module==3) nDP1P2M3+=numberOfDigisMod; }
00403             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00404             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00405             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00406             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00407             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00408             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00409             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00410             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00411             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00412             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00413             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00414             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00415           }else if(disk==2){
00416             i=120;
00417             if(panel==1){ if(module==1) nDP2P1M1+=numberOfDigisMod; 
00418                           else if(module==2) nDP2P1M2+=numberOfDigisMod; 
00419                           else if(module==3) nDP2P1M3+=numberOfDigisMod; 
00420                           else if(module==4) nDP2P1M4+=numberOfDigisMod;}
00421             else if(panel==2){ if(module==1) nDP2P2M1+=numberOfDigisMod; 
00422                                else if(module==2) nDP2P2M2+=numberOfDigisMod; 
00423                                else if(module==3) nDP2P2M3+=numberOfDigisMod; }
00424             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00425             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00426             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00427             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00428             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00429             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00430             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00431             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00432             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00433             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00434             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00435             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00436           }
00437         }else if(side==PixelEndcapName::pO){
00438           if(disk==1){
00439             i=144;
00440             if(panel==1){ if(module==1) nDP1P1M1+=numberOfDigisMod; 
00441                           else if(module==2) nDP1P1M2+=numberOfDigisMod; 
00442                           else if(module==3) nDP1P1M3+=numberOfDigisMod; 
00443                           else if(module==4) nDP1P1M4+=numberOfDigisMod;}
00444             else if(panel==2){ if(module==1) nDP1P2M1+=numberOfDigisMod; 
00445                                else if(module==2) nDP1P2M2+=numberOfDigisMod; 
00446                                else if(module==3) nDP1P2M3+=numberOfDigisMod; }
00447             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00448             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00449             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00450             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00451             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00452             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00453             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00454             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00455             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00456             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00457             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00458             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00459           }else if(disk==2){
00460             i=168;
00461             if(panel==1){ if(module==1) nDP2P1M1+=numberOfDigisMod; 
00462                           else if(module==2) nDP2P1M2+=numberOfDigisMod; 
00463                           else if(module==3) nDP2P1M3+=numberOfDigisMod; 
00464                           else if(module==4) nDP2P1M4+=numberOfDigisMod;}
00465             else if(panel==2){ if(module==1) nDP2P2M1+=numberOfDigisMod; 
00466                                else if(module==2) nDP2P2M2+=numberOfDigisMod; 
00467                                else if(module==3) nDP2P2M3+=numberOfDigisMod; }
00468             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00469             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00470             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00471             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00472             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00473             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00474             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00475             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00476             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00477             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00478             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00479             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00480           }
00481         }
00482         numberOfDigis[iter]=numberOfDigis[iter]+numberOfDigisMod;
00483         //if(side==PixelEndcapName::pO||side==PixelEndcapName::pI){
00484         //  if(disk==2){ 
00485         //  std::cout<<"status: "<<iter<<","<<side<<","<<disk<<","<<blade<<","<<panel<<","<<numberOfDigisMod<<","<<numberOfDigis[iter]<<std::endl;       
00486         //}}
00487         for(int i=nBPiXmodules; i!=nTOTmodules; i++){ 
00488           //cout<<"\t\t\t fpix: "<<i<<" , "<<(*struct_iter).first<<" , "<<I_detId[i]<<endl;
00489           if((*struct_iter).first == I_detId[i]){
00490             //if(I_fedId[i]<32||I_fedId[i]>39) std::cout<<"Attention: an FPIX module matched to a BPIX FED!"<<std::endl;
00491             nDigisPerFed[I_fedId[i]]=nDigisPerFed[I_fedId[i]]+numberOfDigisMod;
00492             //cout<<"FPIX: "<<i<<" , "<<I_fedId[i]<<" , "<<nDigisPerFed[I_fedId[i]]<< ", "<<numberOfDigisMod << endl;
00493             i=nTOTmodules-1;
00494           }
00495         }
00496         //cout<<"NDigis Endcap: "<<nDM1P1M1/2.<<" "<<nDM1P2M1/6.<<" "<<nDM1P1M2/6.<<" "<<nDM1P2M2/8.<<" "<<nDM1P1M3/8.<<" "<<nDM1P2M3/10.<<" "<<nDM1P1M4/5.<<endl;
00497       } //endif Barrel/(Endcap && !isUpgrade)
00498       else if (endcap && isUpgrade) {
00499         //cout<<"AAfpix: "<<nFPIXDigis<<" = ";
00500         nFPIXDigis = nFPIXDigis + numberOfDigisMod;
00501         //cout<<nFPIXDigis<<endl;
00502         PixelEndcapNameUpgrade::HalfCylinder side = PixelEndcapNameUpgrade(DetId((*struct_iter).first)).halfCylinder();
00503         int disk = PixelEndcapNameUpgrade(DetId((*struct_iter).first)).diskName();
00504         int blade = PixelEndcapNameUpgrade(DetId((*struct_iter).first)).bladeName();
00505         int panel = PixelEndcapNameUpgrade(DetId((*struct_iter).first)).pannelName();
00506         int module = PixelEndcapNameUpgrade(DetId((*struct_iter).first)).plaquetteName();
00507         
00508         int iter=0; int i=0;
00509         if(side==PixelEndcapNameUpgrade::mI){
00510           if(disk==1){
00511             i=0;
00512             if(panel==1){ if(module==1) nDM1P1M1+=numberOfDigisMod; }
00513             else if(panel==2){ if(module==1) nDM1P2M1+=numberOfDigisMod; }
00514             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00515             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00516             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00517             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00518             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00519             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00520             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00521             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00522             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00523             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00524             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }            
00525           }else if(disk==2){
00526             i=22;
00527             if(panel==1){ if(module==1) nDM2P1M1+=numberOfDigisMod; }
00528             else if(panel==2){ if(module==1) nDM2P2M1+=numberOfDigisMod; }
00529             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00530             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00531             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00532             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00533             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00534             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00535             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00536             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00537             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00538             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00539             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00540           }else if(disk==3){
00541             i=44;
00542             if(panel==1){ if(module==1) nDM3P1M1+=numberOfDigisMod; }
00543             else if(panel==2){ if(module==1) nDM3P2M1+=numberOfDigisMod; }
00544             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00545             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00546             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00547             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00548             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00549             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00550             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00551             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00552             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00553             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00554             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00555           }
00556         }else if(side==PixelEndcapNameUpgrade::mO){
00557           if(disk==1){
00558             i=66;
00559             if(panel==1){ if(module==1) nDM1P1M1+=numberOfDigisMod; }
00560             else if(panel==2){ if(module==1) nDM1P2M1+=numberOfDigisMod; }
00561             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00562             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00563             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00564             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00565             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00566             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00567             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00568             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00569             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00570             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00571             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00572             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00573             if(blade==13){ if(panel==1) iter=i+24; else if(panel==2) iter=i+25; }
00574             if(blade==14){ if(panel==1) iter=i+26; else if(panel==2) iter=i+27; }
00575             if(blade==15){ if(panel==1) iter=i+28; else if(panel==2) iter=i+29; }
00576             if(blade==16){ if(panel==1) iter=i+30; else if(panel==2) iter=i+31; }
00577             if(blade==17){ if(panel==1) iter=i+32; else if(panel==2) iter=i+33; }
00578           }else if(disk==2){
00579            i=100;
00580            if(panel==1){ if(module==1) nDM2P1M1+=numberOfDigisMod; }
00581            else if(panel==2){ if(module==1) nDM2P2M1+=numberOfDigisMod; }
00582            if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00583            if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00584            if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00585            if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00586            if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00587            if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00588            if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00589            if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00590            if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00591            if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00592            if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00593            if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00594            if(blade==13){ if(panel==1) iter=i+24; else if(panel==2) iter=i+25; }
00595            if(blade==14){ if(panel==1) iter=i+26; else if(panel==2) iter=i+27; }
00596            if(blade==15){ if(panel==1) iter=i+28; else if(panel==2) iter=i+29; }
00597            if(blade==16){ if(panel==1) iter=i+30; else if(panel==2) iter=i+31; }
00598            if(blade==17){ if(panel==1) iter=i+32; else if(panel==2) iter=i+33; }
00599           }else if (disk==3){
00600             i=134;
00601             if(panel==1){ if(module==1) nDM3P1M1+=numberOfDigisMod; }
00602             else if(panel==2){ if(module==1) nDM3P2M1+=numberOfDigisMod; }
00603             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00604             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00605             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00606             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00607             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00608             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00609             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00610             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00611             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00612             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00613             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00614             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00615             if(blade==13){ if(panel==1) iter=i+24; else if(panel==2) iter=i+25; }
00616             if(blade==14){ if(panel==1) iter=i+26; else if(panel==2) iter=i+27; }
00617             if(blade==15){ if(panel==1) iter=i+28; else if(panel==2) iter=i+29; }
00618             if(blade==16){ if(panel==1) iter=i+30; else if(panel==2) iter=i+31; }
00619             if(blade==17){ if(panel==1) iter=i+32; else if(panel==2) iter=i+33; }
00620           }
00621         }else if(side==PixelEndcapNameUpgrade::pI){
00622           if(disk==1){
00623             i=168;
00624             if(panel==1){ if(module==1) nDP1P1M1+=numberOfDigisMod; }
00625             else if(panel==2){ if(module==1) nDP1P2M1+=numberOfDigisMod; }
00626             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00627             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00628             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00629             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00630             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00631             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00632             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00633             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00634             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00635             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00636             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00637           }else if(disk==2){
00638             i=190;
00639             if(panel==1){ if(module==1) nDP2P1M1+=numberOfDigisMod; }
00640             else if(panel==2){ if(module==1) nDP2P2M1+=numberOfDigisMod; }
00641             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00642             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00643             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00644             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00645             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00646             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00647             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00648             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00649             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00650             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00651             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00652           }else if(disk==3){
00653             i=212;
00654             if(panel==1){ if(module==1) nDP3P1M1+=numberOfDigisMod; }
00655             else if(panel==2){ if(module==1) nDP3P2M1+=numberOfDigisMod; }
00656             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00657             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00658             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00659             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00660             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00661             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00662             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00663             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00664             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00665             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00666             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00667           }
00668         }else if(side==PixelEndcapNameUpgrade::pO){
00669           if(disk==1){
00670             i=234;
00671             if(panel==1){ if(module==1) nDP1P1M1+=numberOfDigisMod; }
00672             else if(panel==2){ if(module==1) nDP1P2M1+=numberOfDigisMod; }
00673             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00674             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00675             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00676             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00677             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00678             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00679             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00680             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00681             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00682             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00683             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00684             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00685             if(blade==13){ if(panel==1) iter=i+24; else if(panel==2) iter=i+25; }
00686             if(blade==14){ if(panel==1) iter=i+26; else if(panel==2) iter=i+27; }
00687             if(blade==15){ if(panel==1) iter=i+28; else if(panel==2) iter=i+29; }
00688             if(blade==16){ if(panel==1) iter=i+30; else if(panel==2) iter=i+31; }
00689             if(blade==17){ if(panel==1) iter=i+32; else if(panel==2) iter=i+33; }
00690           }else if(disk==2){
00691             i=268;
00692             if(panel==1){ if(module==1) nDP2P1M1+=numberOfDigisMod; }
00693             else if(panel==2){ if(module==1) nDP2P2M1+=numberOfDigisMod; }
00694             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00695             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00696             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00697             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00698             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00699             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00700             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00701             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00702             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00703             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00704             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00705             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00706             if(blade==13){ if(panel==1) iter=i+24; else if(panel==2) iter=i+25; }
00707             if(blade==14){ if(panel==1) iter=i+26; else if(panel==2) iter=i+27; }
00708             if(blade==15){ if(panel==1) iter=i+28; else if(panel==2) iter=i+29; }
00709             if(blade==16){ if(panel==1) iter=i+30; else if(panel==2) iter=i+31; }
00710             if(blade==17){ if(panel==1) iter=i+32; else if(panel==2) iter=i+33; }
00711           }else if(disk==3){
00712             i=302;
00713             if(panel==1){ if(module==1) nDP3P1M1+=numberOfDigisMod; }
00714             else if(panel==2){ if(module==1) nDP3P2M1+=numberOfDigisMod; }
00715             if(blade==1){ if(panel==1) iter=i; else if(panel==2) iter=i+1; }
00716             if(blade==2){ if(panel==1) iter=i+2; else if(panel==2) iter=i+3; }
00717             if(blade==3){ if(panel==1) iter=i+4; else if(panel==2) iter=i+5; }
00718             if(blade==4){ if(panel==1) iter=i+6; else if(panel==2) iter=i+7; }
00719             if(blade==5){ if(panel==1) iter=i+8; else if(panel==2) iter=i+9; }
00720             if(blade==6){ if(panel==1) iter=i+10; else if(panel==2) iter=i+11; }
00721             if(blade==7){ if(panel==1) iter=i+12; else if(panel==2) iter=i+13; }
00722             if(blade==8){ if(panel==1) iter=i+14; else if(panel==2) iter=i+15; }
00723             if(blade==9){ if(panel==1) iter=i+16; else if(panel==2) iter=i+17; }
00724             if(blade==10){ if(panel==1) iter=i+18; else if(panel==2) iter=i+19; }
00725             if(blade==11){ if(panel==1) iter=i+20; else if(panel==2) iter=i+21; }
00726             if(blade==12){ if(panel==1) iter=i+22; else if(panel==2) iter=i+23; }
00727             if(blade==13){ if(panel==1) iter=i+24; else if(panel==2) iter=i+25; }
00728             if(blade==14){ if(panel==1) iter=i+26; else if(panel==2) iter=i+27; }
00729             if(blade==15){ if(panel==1) iter=i+28; else if(panel==2) iter=i+29; }
00730             if(blade==16){ if(panel==1) iter=i+30; else if(panel==2) iter=i+31; }
00731             if(blade==17){ if(panel==1) iter=i+32; else if(panel==2) iter=i+33; }
00732           }
00733         }
00734         numberOfDigis[iter]=numberOfDigis[iter]+numberOfDigisMod;
00735         //if(side==PixelEndcapNameUpgrade::pO||side==PixelEndcapNameUpgrade::pI){
00736         //  if(disk==2){ 
00737         //  std::cout<<"status: "<<iter<<","<<side<<","<<disk<<","<<blade<<","<<panel<<","<<numberOfDigisMod<<","<<numberOfDigis[iter]<<std::endl;       
00738         //}}
00739         for(int i=nBPiXmodules; i!=nTOTmodules; i++){
00740           //cout<<"\t\t\t fpix: "<<i<<" , "<<(*struct_iter).first<<" , "<<I_detId[i]<<endl;
00741           if((*struct_iter).first == I_detId[i]){
00742             //if(I_fedId[i]<32||I_fedId[i]>39) std::cout<<"Attention: an FPIX module matched to a BPIX FED!"<<std::endl;
00743             nDigisPerFed[I_fedId[i]]=nDigisPerFed[I_fedId[i]]+numberOfDigisMod;
00744             //cout<<"FPIX: "<<i<<" , "<<I_fedId[i]<<" , "<<nDigisPerFed[I_fedId[i]]<< ", "<<numberOfDigisMod << endl;
00745             i=nTOTmodules-1;
00746           }
00747         }
00748         //cout<<"NDigis Endcap: "<<nDM1P1M1/2.<<" "<<nDM1P2M1/6.<<" "<<nDM1P1M2/6.<<" "<<nDM1P2M2/8.<<" "<<nDM1P1M3/8.<<" "<<nDM1P2M3/10.<<" "<<nDM1P1M4/5.<<endl;
00749       }//endif(Endcap && isUpgrade)
00750       //cout<<"numberOfDigis: "<<numberOfDigisMod<<" , nBPIXDigis: "<<nBPIXDigis<<" , nFPIXDigis: "<<nFPIXDigis<<endl;
00751       // digi occupancy per individual FED channel:
00752     } // endif any digis in this module
00753   } // endfor loop over all modules
00754 
00755   //A really, really ugly way to do the occupancy-based 
00756   int NzeroROCs[2]        = {0,-672};
00757   int NloEffROCs[2]       = {0,-672};
00758   std::string baseDirs[2] = {"Pixel/Barrel", "Pixel/Endcap"};
00759   if (lumiSection%10> 2){
00760     for (int i = 0; i < 2; ++i){
00761       theDMBE->cd(baseDirs[i]);
00762       vector<string> shellDirs = theDMBE->getSubdirs();
00763       for (vector<string>::const_iterator it = shellDirs.begin(); it != shellDirs.end(); it++) {
00764         theDMBE->cd(*it);
00765         vector<string> layDirs = theDMBE->getSubdirs();
00766         for (vector<string>::const_iterator itt = layDirs.begin(); itt != layDirs.end(); itt++) {
00767           theDMBE->cd(*itt);
00768           vector<string> contents = theDMBE->getMEs(); 
00769           for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++) {
00770             if ((*im).find("rocmap") == string::npos) continue;
00771             MonitorElement* me  = theDMBE->get((*itt)+"/"+(*im));
00772             if(!me) continue;
00773             MonitorElement* me2;
00774             me2 = theDMBE->get((*itt)+"/zeroOccROC_map");
00775             float SF = 1.0; if (me->getEntries() > 0) SF = float(me->getNbinsX()*me->getNbinsY()/me->getEntries());
00776             for (int ii = 1; ii < me->getNbinsX()+1; ++ii){for (int jj = 1; jj < me->getNbinsY()+1; ++jj){
00777                 //Putting in conversion to layer maps.. again, ugly way to do it...
00778                 float localX = float(ii)-0.5;
00779                 float localY = float(jj)/2.0 + 1.25;
00780                 if (i ==1) localY = float(jj)/2.0 + 0.75;
00781                 if (me->getBinContent(ii,jj)    <   1) {++NzeroROCs[i]; if (me2) me2->Fill(localX, localY);}
00782                 if (me->getBinContent(ii,jj)*SF < 0.25) ++NloEffROCs[i];}}
00783           }
00784         }
00785       }
00786     }
00787     for (int i =0; i < 2; ++i) NloEffROCs[i] = NloEffROCs[i] - NzeroROCs[i];
00788     MonitorElement* menoOcc=theDMBE->get("Pixel/noOccROCsBarrel");
00789     MonitorElement* meloOcc=theDMBE->get("Pixel/loOccROCsBarrel");
00790     if(menoOcc) menoOcc->setBinContent(1+lumiSection/10, NzeroROCs[0]);
00791     if(meloOcc) meloOcc->setBinContent(1+lumiSection/10, NloEffROCs[0]);
00792     MonitorElement* menoOcc1=theDMBE->get("Pixel/noOccROCsEndcap");
00793     MonitorElement* meloOcc1=theDMBE->get("Pixel/loOccROCsEndcap");
00794     if(menoOcc1) menoOcc1->setBinContent(1+lumiSection/10, NzeroROCs[1]);
00795     if(meloOcc1) meloOcc1->setBinContent(1+lumiSection/10, NloEffROCs[1]);
00796     theDMBE->cd();
00797   }
00798 //  if(lumiSection>lumSec){ lumSec = lumiSection; nLumiSecs++; }
00799 //  if(nEventDigis>bigEventSize) nBigEvents++;
00800 //  if(nLumiSecs%5==0){
00801   
00802   MonitorElement* meE; MonitorElement* meE1; MonitorElement* meE2; MonitorElement* meE3; MonitorElement* meE4; 
00803   MonitorElement* meE5; MonitorElement* meE6;
00804   if (!isUpgrade) {
00805     meE=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_Endcap");
00806     if(meE){ for(int j=0; j!=192; j++) if(numberOfDigis[j]>0) meE->Fill((float)numberOfDigis[j]);}
00807     meE1=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDm1");
00808     if(meE1){ for(int j=0; j!=72; j++) if((j<24||j>47)&&numberOfDigis[j]>0) meE1->Fill((float)numberOfDigis[j]);}
00809     meE2=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDm2");
00810     if(meE2){ for(int j=24; j!=96; j++) if((j<48||j>71)&&numberOfDigis[j]>0) meE2->Fill((float)numberOfDigis[j]);}
00811     meE3=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDp1");
00812     if(meE3){ for(int j=96; j!=168; j++) if((j<120||j>143)&&numberOfDigis[j]>0) meE3->Fill((float)numberOfDigis[j]);}
00813     meE4=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDp2");
00814     if(meE4){ for(int j=120; j!=192; j++) if((j<144||j>167)&&numberOfDigis[j]>0) meE4->Fill((float)numberOfDigis[j]);}
00815   } else if (isUpgrade) {
00816     meE=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_Endcap");
00817     if(meE){ for(int j=0; j!=336; j++) if(numberOfDigis[j]>0) meE->Fill((float)numberOfDigis[j]);}
00818     meE1=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDm1");
00819     if(meE1){ for(int j=0; j!=100; j++) if((j<22||j>65)&&numberOfDigis[j]>0) meE1->Fill((float)numberOfDigis[j]);}
00820     meE2=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDm2");
00821     if(meE2){ for(int j=22; j!=134; j++) if((j<44||j>99)&&numberOfDigis[j]>0) meE2->Fill((float)numberOfDigis[j]);}
00822     meE3=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDm3");
00823     if(meE3){ for(int j=44; j!=168; j++) if((j<66||j>133)&&numberOfDigis[j]>0) meE3->Fill((float)numberOfDigis[j]);}
00824     meE4=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDp1");
00825     if(meE4){ for(int j=168; j!=268; j++) if((j<190||j>233)&&numberOfDigis[j]>0) meE4->Fill((float)numberOfDigis[j]);}
00826     meE5=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDp2");
00827     if(meE5){ for(int j=190; j!=302; j++) if((j<212||j>267)&&numberOfDigis[j]>0) meE5->Fill((float)numberOfDigis[j]);}
00828     meE6=theDMBE->get("Pixel/Endcap/ALLMODS_ndigisCHAN_EndcapDp3");
00829     if(meE6){ for(int j=212; j!=336; j++) if((j<234||j>301)&&numberOfDigis[j]>0) meE6->Fill((float)numberOfDigis[j]);}
00830   }
00831   
00832   MonitorElement* me1; MonitorElement* me2; MonitorElement* me3; MonitorElement* me4; MonitorElement* me5;
00833   MonitorElement* me6; MonitorElement* me7; MonitorElement* me8; MonitorElement* me9; MonitorElement* me10; MonitorElement* me11;
00834   MonitorElement* me12; MonitorElement* me13; MonitorElement* me14; MonitorElement* me15; MonitorElement* me16; MonitorElement* me17;
00835   MonitorElement* me18; MonitorElement* me19; MonitorElement* me20; MonitorElement* me21; MonitorElement* me22; MonitorElement* me23;
00836   MonitorElement* me24; MonitorElement* me25; MonitorElement* me26; MonitorElement* me27; MonitorElement* me28; MonitorElement* me29;
00837   MonitorElement* me30; MonitorElement* me31; MonitorElement* me32; MonitorElement* me33; MonitorElement* me34; MonitorElement* me35;
00838   MonitorElement* me36;
00839   me1=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh1");
00840   if(me1){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+0]>0) me1->Fill((float)nDigisPerChan[i*36+0]);}
00841   me2=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh2");
00842   if(me2){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+1]>0) me2->Fill((float)nDigisPerChan[i*36+1]);}
00843   me3=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh3");
00844   if(me3){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+2]>0) me3->Fill((float)nDigisPerChan[i*36+2]);}
00845   me4=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh4");
00846   if(me4){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+3]>0) me4->Fill((float)nDigisPerChan[i*36+3]);}
00847   me5=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh5");
00848   if(me5){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+4]>0) me5->Fill((float)nDigisPerChan[i*36+4]);}
00849   me6=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh6");
00850   if(me6){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+5]>0) me6->Fill((float)nDigisPerChan[i*36+5]);}
00851   me7=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh7");
00852   if(me7){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+6]>0) me7->Fill((float)nDigisPerChan[i*36+6]);}
00853   me8=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh8");
00854   if(me8){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+7]>0) me8->Fill((float)nDigisPerChan[i*36+7]);}
00855   me9=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh9");
00856   if(me9){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+8]>0) me9->Fill((float)nDigisPerChan[i*36+8]);}
00857   me10=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh10");
00858   if(me10){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+9]>0) me10->Fill((float)nDigisPerChan[i*36+9]);}
00859   me11=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh11");
00860   if(me11){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+10]>0) me11->Fill((float)nDigisPerChan[i*36+10]);}
00861   me12=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh12");
00862   if(me12){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+11]>0) me12->Fill((float)nDigisPerChan[i*36+11]);}
00863   me13=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh13");
00864   if(me13){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+12]>0) me13->Fill((float)nDigisPerChan[i*36+12]);}
00865   me14=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh14");
00866   if(me14){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+13]>0) me14->Fill((float)nDigisPerChan[i*36+13]);}
00867   me15=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh15");
00868   if(me15){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+14]>0) me15->Fill((float)nDigisPerChan[i*36+14]);}
00869   me16=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh16");
00870   if(me16){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+15]>0) me16->Fill((float)nDigisPerChan[i*36+15]);}
00871   me17=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh17");
00872   if(me17){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+16]>0) me17->Fill((float)nDigisPerChan[i*36+16]);}
00873   me18=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh18");
00874   if(me18){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+17]>0) me18->Fill((float)nDigisPerChan[i*36+17]);}
00875   me19=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh19");
00876   if(me19){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+18]>0) me19->Fill((float)nDigisPerChan[i*36+18]);}
00877   me20=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh20");
00878   if(me20){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+19]>0) me20->Fill((float)nDigisPerChan[i*36+19]);}
00879   me21=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh21");
00880   if(me21){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+20]>0) me21->Fill((float)nDigisPerChan[i*36+20]);}
00881   me22=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh22");
00882   if(me22){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+21]>0) me22->Fill((float)nDigisPerChan[i*36+21]);}
00883   me23=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh23");
00884   if(me23){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+22]>0) me23->Fill((float)nDigisPerChan[i*36+22]);}
00885   me24=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh24");
00886   if(me24){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+23]>0) me24->Fill((float)nDigisPerChan[i*36+23]);}
00887   me25=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh25");
00888   if(me25){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+24]>0) me25->Fill((float)nDigisPerChan[i*36+24]);}
00889   me26=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh26");
00890   if(me26){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+25]>0) me26->Fill((float)nDigisPerChan[i*36+25]);}
00891   me27=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh27");
00892   if(me27){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+26]>0) me27->Fill((float)nDigisPerChan[i*36+26]);}
00893   me28=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh28");
00894   if(me28){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+27]>0) me28->Fill((float)nDigisPerChan[i*36+27]);}
00895   me29=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh29");
00896   if(me29){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+28]>0) me29->Fill((float)nDigisPerChan[i*36+28]);}
00897   me30=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh30");
00898   if(me30){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+29]>0) me30->Fill((float)nDigisPerChan[i*36+29]);}
00899   me31=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh31");
00900   if(me31){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+30]>0) me31->Fill((float)nDigisPerChan[i*36+30]);}
00901   me32=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh32");
00902   if(me32){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+31]>0) me32->Fill((float)nDigisPerChan[i*36+31]);}
00903   me33=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh33");
00904   if(me33){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+32]>0) me33->Fill((float)nDigisPerChan[i*36+32]);}
00905   me34=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh34");
00906   if(me34){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+33]>0) me34->Fill((float)nDigisPerChan[i*36+33]);}
00907   me35=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh35");
00908   if(me35){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+34]>0) me35->Fill((float)nDigisPerChan[i*36+34]);}
00909   me36=theDMBE->get("Pixel/Barrel/ALLMODS_ndigisCHAN_BarrelCh36");
00910   if(me36){ for(int i=0; i!=32; i++) if(nDigisPerChan[i*36+35]>0) me36->Fill((float)nDigisPerChan[i*36+35]);}
00911   
00912   // Rate of events with >N digis:
00913   MonitorElement* meX1;
00914   if(nEventDigis>bigEventSize){
00915     meX1 = theDMBE->get("Pixel/bigEventRate");
00916     if(meX1) meX1->Fill(lumiSection,1./23.);    
00917   }
00918   //std::cout<<"nEventDigis: "<<nEventDigis<<" , nLumiSecs: "<<nLumiSecs<<" , nBigEvents: "<<nBigEvents<<std::endl;
00919   
00920   // Rate of pixel events and total number of pixel events per BX:
00921   MonitorElement* meX2; MonitorElement* meX3;
00922   if(nActiveModules>=4){
00923     meX2 = theDMBE->get("Pixel/pixEvtsPerBX");
00924     if(meX2) meX2->Fill(float(bx));
00925     meX3 = theDMBE->get("Pixel/pixEventRate");
00926     if(meX3) meX3->Fill(lumiSection, 1./23.);
00927   }
00928   
00929   // Actual digi occupancy in a FED compared to average digi occupancy per FED
00930   MonitorElement* meX4; MonitorElement* meX5;
00931   meX4 = theDMBE->get("Pixel/averageDigiOccupancy");
00932   meX5 = theDMBE->get("Pixel/avgfedDigiOccvsLumi");
00933   if(meX4){
00934     int maxfed=0;
00935     for(int i=0; i!=32; i++){
00936       if(nDigisPerFed[i]>maxfed) maxfed=nDigisPerFed[i];
00937     }
00938     for(int i=0; i!=40; i++){
00939       float averageOcc = 0.;
00940       if(i<32){
00941         float averageBPIXFed = float(nBPIXDigis-maxfed)/31.;
00942         if(averageBPIXFed>0.) averageOcc = nDigisPerFed[i]/averageBPIXFed;
00943         //cout<<"\t BPIX i: "<<i<<" , "<<nBPIXDigis<<" , "<<averageBPIXFed<<" , "<<nDigisPerFed[i]<<" , "<<averageOcc<<endl;
00944       }else{
00945         float averageFPIXFed = float(nFPIXDigis)/8.;
00946         if(averageFPIXFed>0.) averageOcc = nDigisPerFed[i]/averageFPIXFed;
00947         //cout<<"\t FPIX i: "<<i<<" , "<<nFPIXDigis<<" , "<<averageFPIXFed<<" , "<<nDigisPerFed[i]<<" , "<<averageOcc<<endl;
00948       }
00949       meX4->setBinContent(i+1,averageOcc);
00950       int lumiSections8 = int(lumiSection/8);
00951       if (modOn){
00952         if (meX5){
00953           meX5->setBinContent(1+lumiSections8, i+1, averageOcc);
00954         }//endif meX5
00955       }//endif modOn
00956     }
00957   }
00958   
00959   // slow down...
00960   if(slowDown) usleep(10000);
00961   
00962 }
00963 
00964 //------------------------------------------------------------------
00965 // Build data structure
00966 //------------------------------------------------------------------
00967 void SiPixelDigiSource::buildStructure(const edm::EventSetup& iSetup){
00968 
00969   LogInfo ("PixelDQM") <<" SiPixelDigiSource::buildStructure" ;
00970   edm::ESHandle<TrackerGeometry> pDD;
00971   iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
00972 
00973   LogVerbatim ("PixelDQM") << " *** Geometry node for TrackerGeom is  "<<&(*pDD)<<std::endl;
00974   LogVerbatim ("PixelDQM") << " *** I have " << pDD->dets().size() <<" detectors"<<std::endl;
00975   LogVerbatim ("PixelDQM") << " *** I have " << pDD->detTypes().size() <<" types"<<std::endl;
00976   
00977   for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
00978     
00979     if(dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
00980 
00981       DetId detId = (*it)->geographicalId();
00982       const GeomDetUnit      * geoUnit = pDD->idToDetUnit( detId );
00983       const PixelGeomDetUnit * pixDet  = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
00984       int nrows = (pixDet->specificTopology()).nrows();
00985       int ncols = (pixDet->specificTopology()).ncolumns();
00986 
00987       if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
00988         if(isPIB) continue;
00989         LogDebug ("PixelDQM") << " ---> Adding Barrel Module " <<  detId.rawId() << endl;
00990         uint32_t id = detId();
00991         SiPixelDigiModule* theModule = new SiPixelDigiModule(id, ncols, nrows);
00992         thePixelStructure.insert(pair<uint32_t,SiPixelDigiModule*> (id,theModule));
00993 
00994       } else if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) {
00995         LogDebug ("PixelDQM") << " ---> Adding Endcap Module " <<  detId.rawId() << endl;
00996         uint32_t id = detId();
00997         SiPixelDigiModule* theModule = new SiPixelDigiModule(id, ncols, nrows);
00998        
00999         PixelEndcapName::HalfCylinder side = PixelEndcapName(DetId(id)).halfCylinder();
01000         int disk   = PixelEndcapName(DetId(id)).diskName();
01001         int blade  = PixelEndcapName(DetId(id)).bladeName();
01002         int panel  = PixelEndcapName(DetId(id)).pannelName();
01003         int module = PixelEndcapName(DetId(id)).plaquetteName();
01004 
01005         char sside[80];  sprintf(sside,  "HalfCylinder_%i",side);
01006         char sdisk[80];  sprintf(sdisk,  "Disk_%i",disk);
01007         char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
01008         char spanel[80]; sprintf(spanel, "Panel_%i",panel);
01009         char smodule[80];sprintf(smodule,"Module_%i",module);
01010         std::string side_str = sside;
01011         std::string disk_str = sdisk;
01012         bool mask = side_str.find("HalfCylinder_1")!=string::npos||
01013                     side_str.find("HalfCylinder_2")!=string::npos||
01014                     side_str.find("HalfCylinder_4")!=string::npos||
01015                     disk_str.find("Disk_2")!=string::npos;
01016         // clutch to take all of FPIX, but no BPIX:
01017         mask = false;
01018         if(isPIB && mask) continue;
01019         
01020         thePixelStructure.insert(pair<uint32_t,SiPixelDigiModule*> (id,theModule));
01021       } else if( (detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) && (isUpgrade)) {
01022         LogDebug ("PixelDQM") << " ---> Adding Endcap Module " <<  detId.rawId() << endl;
01023         uint32_t id = detId();
01024         SiPixelDigiModule* theModule = new SiPixelDigiModule(id, ncols, nrows);
01025         
01026         PixelEndcapNameUpgrade::HalfCylinder side = PixelEndcapNameUpgrade(DetId(id)).halfCylinder();
01027         int disk   = PixelEndcapNameUpgrade(DetId(id)).diskName();
01028         int blade  = PixelEndcapNameUpgrade(DetId(id)).bladeName();
01029         int panel  = PixelEndcapNameUpgrade(DetId(id)).pannelName();
01030         int module = PixelEndcapNameUpgrade(DetId(id)).plaquetteName();
01031 
01032         char sside[80];  sprintf(sside,  "HalfCylinder_%i",side);
01033         char sdisk[80];  sprintf(sdisk,  "Disk_%i",disk);
01034         char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
01035         char spanel[80]; sprintf(spanel, "Panel_%i",panel);
01036         char smodule[80];sprintf(smodule,"Module_%i",module);
01037         std::string side_str = sside;
01038         std::string disk_str = sdisk;
01039         bool mask = side_str.find("HalfCylinder_1")!=string::npos||
01040                     side_str.find("HalfCylinder_2")!=string::npos||
01041                     side_str.find("HalfCylinder_4")!=string::npos||
01042                     disk_str.find("Disk_2")!=string::npos;
01043         // clutch to take all of FPIX, but no BPIX:
01044         mask = false;
01045         if(isPIB && mask) continue;
01046         
01047         thePixelStructure.insert(pair<uint32_t,SiPixelDigiModule*> (id,theModule));
01048       }//end_elseif(isUpgrade)
01049 
01050     }
01051   }
01052   LogInfo ("PixelDQM") << " *** Pixel Structure Size " << thePixelStructure.size() << endl;
01053 }
01054 //------------------------------------------------------------------
01055 // Book MEs
01056 //------------------------------------------------------------------
01057 void SiPixelDigiSource::bookMEs(){
01058   
01059   // Get DQM interface
01060   DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
01061   theDMBE->setCurrentFolder("Pixel");
01062   char title[80];   sprintf(title, "Rate of events with >%i digis;LumiSection;Rate [Hz]",bigEventSize);
01063   bigEventRate    = theDMBE->book1D("bigEventRate",title,5000,0.,5000.);
01064   char title1[80];  sprintf(title1, "Pixel events vs. BX;BX;# events");
01065   pixEvtsPerBX    = theDMBE->book1D("pixEvtsPerBX",title1,3565,0.,3565.);
01066   char title2[80];  sprintf(title2, "Rate of Pixel events;LumiSection;Rate [Hz]");
01067   pixEventRate    = theDMBE->book1D("pixEventRate",title2,5000,0.,5000.);
01068   char title3[80];  sprintf(title3, "Number of Zero-Occupancy Barrel ROCs;LumiSection;N_{ZERO-OCCUPANCY} Barrel ROCs");
01069   noOccROCsBarrel = theDMBE->book1D("noOccROCsBarrel",title3,500,0.,5000.);
01070   char title4[80];  sprintf(title4, "Number of Low-Efficiency Barrel ROCs;LumiSection;N_{LO EFF} Barrel ROCs");
01071   loOccROCsBarrel = theDMBE->book1D("loOccROCsBarrel",title4,500,0.,5000.);
01072   char title5[80];  sprintf(title5, "Number of Zero-Occupancy Endcap ROCs;LumiSection;N_{ZERO-OCCUPANCY} Endcap ROCs");
01073   noOccROCsEndcap = theDMBE->book1D("noOccROCsEndcap",title5,500,0.,5000.);
01074   char title6[80];  sprintf(title6, "Number of Low-Efficiency Endcap ROCs;LumiSection;N_{LO EFF} Endcap ROCs");
01075   loOccROCsEndcap = theDMBE->book1D("loOccROCsEndcap",title6,500,0.,5000.);
01076   char title7[80];  sprintf(title7, "Average digi occupancy per FED;FED;NDigis/<NDigis>");
01077   averageDigiOccupancy = theDMBE->book1D("averageDigiOccupancy",title7,40,-0.5,39.5);
01078   averageDigiOccupancy->setLumiFlag();
01079   if(modOn){
01080     char title4[80]; sprintf(title4, "FED Digi Occupancy (NDigis/<NDigis>) vs LumiSections;Lumi Section;FED");
01081     avgfedDigiOccvsLumi = theDMBE->book2D ("avgfedDigiOccvsLumi", title4, 400,0., 3200., 40, -0.5, 39.5);
01082   }  
01083   std::map<uint32_t,SiPixelDigiModule*>::iterator struct_iter;
01084  
01085   SiPixelFolderOrganizer theSiPixelFolder;
01086 
01087   for(struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++){
01089     if(modOn){
01090       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,0,isUpgrade)){
01091         (*struct_iter).second->book( conf_,0,twoDimOn,hiRes, reducedSet, twoDimModOn, isUpgrade);
01092       } else {
01093 
01094         if(!isPIB) throw cms::Exception("LogicError")
01095           << "[SiPixelDigiSource::bookMEs] Creation of DQM folder failed";
01096       }
01097     }
01098     if(ladOn){
01099       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,1,isUpgrade)){
01100         (*struct_iter).second->book( conf_,1,twoDimOn,hiRes, reducedSet, isUpgrade);
01101         } else {
01102         LogDebug ("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n";
01103       }
01104    
01105     }
01106     if(layOn || twoDimOnlyLayDisk){
01107       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,2,isUpgrade)){
01108         (*struct_iter).second->book( conf_,2,twoDimOn,hiRes, reducedSet, twoDimOnlyLayDisk, isUpgrade);
01109         } else {
01110         LogDebug ("PixelDQM") << "PROBLEM WITH LAYER-FOLDER\n";
01111       }
01112     }
01113 
01114     if(phiOn){
01115       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,3,isUpgrade)){
01116         (*struct_iter).second->book( conf_,3,twoDimOn,hiRes, reducedSet, isUpgrade);
01117         } else {
01118         LogDebug ("PixelDQM") << "PROBLEM WITH PHI-FOLDER\n";
01119       }
01120     }
01121     if(bladeOn){
01122       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,4,isUpgrade)){
01123         (*struct_iter).second->book( conf_,4,twoDimOn,hiRes, reducedSet, isUpgrade);
01124         } else {
01125         LogDebug ("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n";
01126       }
01127     }
01128     if(diskOn || twoDimOnlyLayDisk){
01129       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,5,isUpgrade)){
01130         (*struct_iter).second->book( conf_,5,twoDimOn,hiRes, reducedSet, twoDimOnlyLayDisk, isUpgrade);
01131       } else {
01132         LogDebug ("PixelDQM") << "PROBLEM WITH DISK-FOLDER\n";
01133       }
01134     }
01135     if(ringOn){
01136       if(theSiPixelFolder.setModuleFolder((*struct_iter).first,6,isUpgrade)){
01137         (*struct_iter).second->book( conf_,6,twoDimOn,hiRes, reducedSet, isUpgrade);
01138       } else {
01139         LogDebug ("PixelDQM") << "PROBLEM WITH RING-FOLDER\n";
01140       }
01141     }
01142   }
01143   std::string currDir = theDMBE->pwd();
01144   theDMBE->cd("Pixel/Barrel");
01145   meNDigisCOMBBarrel_ = theDMBE->book1D("ALLMODS_ndigisCOMB_Barrel","Number of Digis",200,0.,400.);
01146   meNDigisCOMBBarrel_->setAxisTitle("Number of digis per module per event",1);
01147   meNDigisCHANBarrel_ = theDMBE->book1D("ALLMODS_ndigisCHAN_Barrel","Number of Digis",100,0.,1000.);
01148   meNDigisCHANBarrel_->setAxisTitle("Number of digis per FED channel per event",1);
01149   meNDigisCHANBarrelL1_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelL1","Number of Digis L1",100,0.,1000.);
01150   meNDigisCHANBarrelL1_->setAxisTitle("Number of digis per FED channel per event",1);
01151   meNDigisCHANBarrelL2_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelL2","Number of Digis L2",100,0.,1000.);
01152   meNDigisCHANBarrelL2_->setAxisTitle("Number of digis per FED channel per event",1);
01153   meNDigisCHANBarrelL3_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelL3","Number of Digis L3",100,0.,1000.);
01154   meNDigisCHANBarrelL3_->setAxisTitle("Number of digis per FED channel per event",1);
01155   if (isUpgrade) {
01156     meNDigisCHANBarrelL4_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelL4","Number of Digis L4",100,0.,1000.);
01157     meNDigisCHANBarrelL4_->setAxisTitle("Number of digis per FED channel per event",1);
01158   }
01159   meNDigisCHANBarrelCh1_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh1","Number of Digis Ch1",100,0.,1000.);
01160   meNDigisCHANBarrelCh1_->setAxisTitle("Number of digis per FED channel per event",1);
01161   meNDigisCHANBarrelCh2_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh2","Number of Digis Ch2",100,0.,1000.);
01162   meNDigisCHANBarrelCh2_->setAxisTitle("Number of digis per FED channel per event",1);
01163   meNDigisCHANBarrelCh3_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh3","Number of Digis Ch3",100,0.,1000.);
01164   meNDigisCHANBarrelCh3_->setAxisTitle("Number of digis per FED channel per event",1);
01165   meNDigisCHANBarrelCh4_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh4","Number of Digis Ch4",100,0.,1000.);
01166   meNDigisCHANBarrelCh4_->setAxisTitle("Number of digis per FED channel per event",1);
01167   meNDigisCHANBarrelCh5_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh5","Number of Digis Ch5",100,0.,1000.);
01168   meNDigisCHANBarrelCh5_->setAxisTitle("Number of digis per FED channel per event",1);
01169   meNDigisCHANBarrelCh6_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh6","Number of Digis Ch6",100,0.,1000.);
01170   meNDigisCHANBarrelCh6_->setAxisTitle("Number of digis per FED channel per event",1);
01171   meNDigisCHANBarrelCh7_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh7","Number of Digis Ch7",100,0.,1000.);
01172   meNDigisCHANBarrelCh7_->setAxisTitle("Number of digis per FED channel per event",1);
01173   meNDigisCHANBarrelCh8_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh8","Number of Digis Ch8",100,0.,1000.);
01174   meNDigisCHANBarrelCh8_->setAxisTitle("Number of digis per FED channel per event",1);
01175   meNDigisCHANBarrelCh9_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh9","Number of Digis Ch9",100,0.,1000.);
01176   meNDigisCHANBarrelCh9_->setAxisTitle("Number of digis per FED channel per event",1);
01177   meNDigisCHANBarrelCh10_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh10","Number of Digis Ch10",100,0.,1000.);
01178   meNDigisCHANBarrelCh10_->setAxisTitle("Number of digis per FED channel per event",1);
01179   meNDigisCHANBarrelCh11_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh11","Number of Digis Ch11",100,0.,1000.);
01180   meNDigisCHANBarrelCh11_->setAxisTitle("Number of digis per FED channel per event",1);
01181   meNDigisCHANBarrelCh12_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh12","Number of Digis Ch12",100,0.,1000.);
01182   meNDigisCHANBarrelCh12_->setAxisTitle("Number of digis per FED channel per event",1);
01183   meNDigisCHANBarrelCh13_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh13","Number of Digis Ch13",100,0.,1000.);
01184   meNDigisCHANBarrelCh13_->setAxisTitle("Number of digis per FED channel per event",1);
01185   meNDigisCHANBarrelCh14_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh14","Number of Digis Ch14",100,0.,1000.);
01186   meNDigisCHANBarrelCh14_->setAxisTitle("Number of digis per FED channel per event",1);
01187   meNDigisCHANBarrelCh15_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh15","Number of Digis Ch15",100,0.,1000.);
01188   meNDigisCHANBarrelCh15_->setAxisTitle("Number of digis per FED channel per event",1);
01189   meNDigisCHANBarrelCh16_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh16","Number of Digis Ch16",100,0.,1000.);
01190   meNDigisCHANBarrelCh16_->setAxisTitle("Number of digis per FED channel per event",1);
01191   meNDigisCHANBarrelCh17_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh17","Number of Digis Ch17",100,0.,1000.);
01192   meNDigisCHANBarrelCh17_->setAxisTitle("Number of digis per FED channel per event",1);
01193   meNDigisCHANBarrelCh18_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh18","Number of Digis Ch18",100,0.,1000.);
01194   meNDigisCHANBarrelCh18_->setAxisTitle("Number of digis per FED channel per event",1);
01195   meNDigisCHANBarrelCh19_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh19","Number of Digis Ch19",100,0.,1000.);
01196   meNDigisCHANBarrelCh19_->setAxisTitle("Number of digis per FED channel per event",1);
01197   meNDigisCHANBarrelCh20_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh20","Number of Digis Ch20",100,0.,1000.);
01198   meNDigisCHANBarrelCh20_->setAxisTitle("Number of digis per FED channel per event",1);
01199   meNDigisCHANBarrelCh21_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh21","Number of Digis Ch21",100,0.,1000.);
01200   meNDigisCHANBarrelCh21_->setAxisTitle("Number of digis per FED channel per event",1);
01201   meNDigisCHANBarrelCh22_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh22","Number of Digis Ch22",100,0.,1000.);
01202   meNDigisCHANBarrelCh22_->setAxisTitle("Number of digis per FED channel per event",1);
01203   meNDigisCHANBarrelCh23_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh23","Number of Digis Ch23",100,0.,1000.);
01204   meNDigisCHANBarrelCh23_->setAxisTitle("Number of digis per FED channel per event",1);
01205   meNDigisCHANBarrelCh24_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh24","Number of Digis Ch24",100,0.,1000.);
01206   meNDigisCHANBarrelCh24_->setAxisTitle("Number of digis per FED channel per event",1);
01207   meNDigisCHANBarrelCh25_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh25","Number of Digis Ch25",100,0.,1000.);
01208   meNDigisCHANBarrelCh25_->setAxisTitle("Number of digis per FED channel per event",1);
01209   meNDigisCHANBarrelCh26_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh26","Number of Digis Ch26",100,0.,1000.);
01210   meNDigisCHANBarrelCh26_->setAxisTitle("Number of digis per FED channel per event",1);
01211   meNDigisCHANBarrelCh27_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh27","Number of Digis Ch27",100,0.,1000.);
01212   meNDigisCHANBarrelCh27_->setAxisTitle("Number of digis per FED channel per event",1);
01213   meNDigisCHANBarrelCh28_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh28","Number of Digis Ch28",100,0.,1000.);
01214   meNDigisCHANBarrelCh28_->setAxisTitle("Number of digis per FED channel per event",1);
01215   meNDigisCHANBarrelCh29_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh29","Number of Digis Ch29",100,0.,1000.);
01216   meNDigisCHANBarrelCh29_->setAxisTitle("Number of digis per FED channel per event",1);
01217   meNDigisCHANBarrelCh30_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh30","Number of Digis Ch30",100,0.,1000.);
01218   meNDigisCHANBarrelCh30_->setAxisTitle("Number of digis per FED channel per event",1);
01219   meNDigisCHANBarrelCh31_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh31","Number of Digis Ch31",100,0.,1000.);
01220   meNDigisCHANBarrelCh31_->setAxisTitle("Number of digis per FED channel per event",1);
01221   meNDigisCHANBarrelCh32_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh32","Number of Digis Ch32",100,0.,1000.);
01222   meNDigisCHANBarrelCh32_->setAxisTitle("Number of digis per FED channel per event",1);
01223   meNDigisCHANBarrelCh33_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh33","Number of Digis Ch33",100,0.,1000.);
01224   meNDigisCHANBarrelCh33_->setAxisTitle("Number of digis per FED channel per event",1);
01225   meNDigisCHANBarrelCh34_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh34","Number of Digis Ch34",100,0.,1000.);
01226   meNDigisCHANBarrelCh34_->setAxisTitle("Number of digis per FED channel per event",1);
01227   meNDigisCHANBarrelCh35_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh35","Number of Digis Ch35",100,0.,1000.);
01228   meNDigisCHANBarrelCh35_->setAxisTitle("Number of digis per FED channel per event",1);
01229   meNDigisCHANBarrelCh36_ = theDMBE->book1D("ALLMODS_ndigisCHAN_BarrelCh36","Number of Digis Ch36",100,0.,1000.);
01230   meNDigisCHANBarrelCh36_->setAxisTitle("Number of digis per FED channel per event",1);
01231   theDMBE->cd("Pixel/Endcap");
01232   meNDigisCOMBEndcap_ = theDMBE->book1D("ALLMODS_ndigisCOMB_Endcap","Number of Digis",200,0.,400.);
01233   meNDigisCOMBEndcap_->setAxisTitle("Number of digis per module per event",1);
01234   meNDigisCHANEndcap_ = theDMBE->book1D("ALLMODS_ndigisCHAN_Endcap","Number of Digis",100,0.,1000.);
01235   meNDigisCHANEndcap_->setAxisTitle("Number of digis per FED channel per event",1);
01236   meNDigisCHANEndcapDp1_ = theDMBE->book1D("ALLMODS_ndigisCHAN_EndcapDp1","Number of Digis Disk p1",100,0.,1000.);
01237   meNDigisCHANEndcapDp1_->setAxisTitle("Number of digis per FED channel per event",1);
01238   meNDigisCHANEndcapDp2_ = theDMBE->book1D("ALLMODS_ndigisCHAN_EndcapDp2","Number of Digis Disk p2",100,0.,1000.);
01239   meNDigisCHANEndcapDp2_->setAxisTitle("Number of digis per FED channel per event",1);
01240   if (isUpgrade) {
01241     meNDigisCHANEndcapDp3_ = theDMBE->book1D("ALLMODS_ndigisCHAN_EndcapDp3","Number of Digis Disk p3",100,0.,1000.);
01242     meNDigisCHANEndcapDp3_->setAxisTitle("Number of digis per FED channel per event",1);
01243   }
01244   meNDigisCHANEndcapDm1_ = theDMBE->book1D("ALLMODS_ndigisCHAN_EndcapDm1","Number of Digis Disk m1",100,0.,1000.);
01245   meNDigisCHANEndcapDm1_->setAxisTitle("Number of digis per FED channel per event",1);
01246   meNDigisCHANEndcapDm2_ = theDMBE->book1D("ALLMODS_ndigisCHAN_EndcapDm2","Number of Digis Disk m2",100,0.,1000.);
01247   meNDigisCHANEndcapDm2_->setAxisTitle("Number of digis per FED channel per event",1);
01248   if (isUpgrade) {
01249     meNDigisCHANEndcapDm3_ = theDMBE->book1D("ALLMODS_ndigisCHAN_EndcapDm3","Number of Digis Disk m3",100,0.,1000.);
01250     meNDigisCHANEndcapDm3_->setAxisTitle("Number of digis per FED channel per event",1);
01251   }
01252   theDMBE->cd(currDir);
01253 }
01254 
01255 //define this as a plug-in
01256 DEFINE_FWK_MODULE(SiPixelDigiSource);