CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQMOffline/Hcal/src/HcalRecHitsDQMClient.cc

Go to the documentation of this file.
00001 #include "DQMOffline/Hcal/interface/HcalRecHitsDQMClient.h"
00002 #include "FWCore/Framework/interface/MakerMacros.h"
00003 
00004 #include "FWCore/Framework/interface/Run.h"
00005 #include "FWCore/Framework/interface/Event.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "FWCore/ServiceRegistry/interface/Service.h"
00008 
00009 #include "DQMServices/Core/interface/DQMStore.h"
00010 #include "DQMServices/Core/interface/MonitorElement.h"
00011 
00012 HcalRecHitsDQMClient::HcalRecHitsDQMClient(const edm::ParameterSet& iConfig):conf_(iConfig)
00013 {
00014 
00015   outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
00016 
00017   dbe_ = edm::Service<DQMStore>().operator->();
00018   if (!dbe_) {
00019     edm::LogError("HcalRecHitsDQMClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
00020   }
00021   if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
00022     if(dbe_) dbe_->setVerbose(0);
00023   }
00024  
00025   debug_ = false;
00026   verbose_ = false;
00027 
00028   dirName_=iConfig.getParameter<std::string>("DQMDirName");
00029   if(dbe_) dbe_->setCurrentFolder(dirName_);
00030  
00031 }
00032 
00033 
00034 HcalRecHitsDQMClient::~HcalRecHitsDQMClient()
00035 { 
00036   
00037 }
00038 
00039 void HcalRecHitsDQMClient::beginJob()
00040 {
00041  
00042 
00043 }
00044 
00045 void HcalRecHitsDQMClient::endJob() 
00046 {
00047    if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00048 }
00049 
00050 void HcalRecHitsDQMClient::beginRun(const edm::Run& run, const edm::EventSetup& c)
00051 {
00052  
00053 }
00054 
00055 
00056 void HcalRecHitsDQMClient::endRun(const edm::Run& run, const edm::EventSetup& c)
00057 {
00058   runClient_();
00059 }
00060 
00061 //dummy analysis function
00062 void HcalRecHitsDQMClient::analyze(const edm::Event& iEvent,const edm::EventSetup& iSetup)
00063 {
00064   
00065 }
00066 
00067 void HcalRecHitsDQMClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c)
00068 { 
00069 //  runClient_();
00070 }
00071 
00072 void HcalRecHitsDQMClient::runClient_()
00073 {
00074   if(!dbe_) return; //we dont have the DQMStore so we cant do anything
00075   dbe_->setCurrentFolder(dirName_);
00076 
00077   if (verbose_) std::cout << "\nrunClient" << std::endl; 
00078 
00079   std::vector<MonitorElement*> hcalMEs;
00080 
00081   // Since out folders are fixed to three, we can just go over these three folders
00082   // i.e., CaloTowersV/CaloTowersTask, HcalRecHitsV/HcalRecHitTask, NoiseRatesV/NoiseRatesTask.
00083   std::vector<std::string> fullPathHLTFolders = dbe_->getSubdirs();
00084   for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
00085 
00086     if (verbose_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
00087     dbe_->setCurrentFolder(fullPathHLTFolders[i]);
00088 
00089     std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs();
00090     for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
00091 
00092       if (verbose_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
00093 
00094       if( strcmp(fullSubPathHLTFolders[j].c_str(), "HcalRecHitsV/HcalRecHitTask") ==0  ){
00095          hcalMEs = dbe_->getContents(fullSubPathHLTFolders[j]);
00096          if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
00097          if( !HcalRecHitsEndjob(hcalMEs) ) std::cout<<"\nError in HcalRecHitsEndjob!"<<std::endl<<std::endl;
00098       }
00099 
00100     }    
00101 
00102   }
00103 
00104 }
00105 
00106 
00107 // called after entering the HcalRecHitsV/HcalRecHitTask directory
00108 // hcalMEs are within that directory
00109 int HcalRecHitsDQMClient::HcalRecHitsEndjob(const std::vector<MonitorElement*> &hcalMEs){
00110 
00111    int useAllHistos = 0, subdet =5;
00112 
00113 // for ZS ...
00114 //   MonitorElement* emap_min_ME =0;
00115    MonitorElement* ZS_HO=0, *ZS_seqHO=0;
00116    MonitorElement* ZS_HB1=0, *ZS_seqHB1=0, *ZS_HB2=0, *ZS_seqHB2=0; 
00117    MonitorElement* ZS_HF1=0, *ZS_seqHF1=0, *ZS_HF2=0, *ZS_seqHF2=0; 
00118    MonitorElement* ZS_HE1=0, *ZS_seqHE1=0, *ZS_HE2=0, *ZS_seqHE2=0, *ZS_HE3=0, *ZS_seqHE3=0;
00119    MonitorElement* map_depth1 =0, *map_depth2 =0, *map_depth3 =0, *map_depth4 =0;
00120 // others 
00121    MonitorElement* Nhf=0;
00122    MonitorElement* emap_depth1 =0, *emap_depth2 =0, *emap_depth3 =0, *emap_depth4 =0; 
00123    MonitorElement* occupancy_seqHB1 =0, *occupancy_seqHB2 =0; 
00124    MonitorElement* occupancy_seqHE1 =0, *occupancy_seqHE2 =0, *occupancy_seqHE3 =0;
00125    MonitorElement* occupancy_seqHF1 =0, *occupancy_seqHF2 =0; 
00126    MonitorElement* occupancy_seqHO =0;
00127    MonitorElement* emean_seqHB1 =0, *emean_seqHB2 =0; 
00128    MonitorElement* emean_seqHE1 =0, *emean_seqHE2 =0, *emean_seqHE3 =0;
00129    MonitorElement* emean_seqHF1 =0, *emean_seqHF2 =0; 
00130    MonitorElement* emean_seqHO =0;
00131 
00132    MonitorElement* RMS_seq_HB1 =0, *RMS_seq_HB2 =0; 
00133    MonitorElement* RMS_seq_HE1 =0, *RMS_seq_HE2 =0, *RMS_seq_HE3 =0;
00134    MonitorElement* RMS_seq_HF1 =0, *RMS_seq_HF2 =0; 
00135    MonitorElement* RMS_seq_HO =0;
00136 
00137    MonitorElement *occupancy_map_HO =0;
00138    MonitorElement* occupancy_map_HB1 =0, *occupancy_map_HB2 =0;
00139    MonitorElement* occupancy_map_HF1 =0, *occupancy_map_HF2 =0;
00140    MonitorElement* occupancy_map_HE1 =0, *occupancy_map_HE2 =0, *occupancy_map_HE3 =0;
00141 
00142    MonitorElement* emean_vs_ieta_HB1 =0, *emean_vs_ieta_HB2 =0; 
00143    MonitorElement* emean_vs_ieta_HE1 =0, *emean_vs_ieta_HE2 =0/*, *emean_vs_ieta_HE3 =0*/;
00144    //MonitorElement* emean_vs_ieta_HF1 =0, *emean_vs_ieta_HF2 =0; 
00145    //MonitorElement* emean_vs_ieta_HO =0;
00146    MonitorElement* RMS_vs_ieta_HB1 =0, *RMS_vs_ieta_HB2 =0; 
00147    MonitorElement* RMS_vs_ieta_HE1 =0, *RMS_vs_ieta_HE2 =0, *RMS_vs_ieta_HE3 =0;
00148    MonitorElement* RMS_vs_ieta_HF1 =0, *RMS_vs_ieta_HF2 =0; 
00149    MonitorElement* RMS_vs_ieta_HO =0;
00150    MonitorElement* occupancy_vs_ieta_HB1 =0, *occupancy_vs_ieta_HB2 =0; 
00151    MonitorElement* occupancy_vs_ieta_HE1 =0, *occupancy_vs_ieta_HE2 =0, *occupancy_vs_ieta_HE3 =0;
00152    MonitorElement* occupancy_vs_ieta_HF1 =0, *occupancy_vs_ieta_HF2 =0; 
00153    MonitorElement* occupancy_vs_ieta_HO =0;
00154 
00155    MonitorElement* RecHit_StatusWord_HB =0, *RecHit_StatusWord_HE=0, *RecHit_StatusWord_HO =0, *RecHit_StatusWord_HF =0, *RecHit_StatusWord_HF67 =0;
00156    MonitorElement* RecHit_Aux_StatusWord_HB =0, *RecHit_Aux_StatusWord_HE=0, *RecHit_Aux_StatusWord_HO =0, *RecHit_Aux_StatusWord_HF =0;
00157 
00158    for(unsigned int ih=0; ih<hcalMEs.size(); ih++){
00159       if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_map_depth1") ==0  ){
00160          useAllHistos =1; subdet =6;
00161       }
00162       if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HB1") ==0  ){
00163          useAllHistos =1;
00164       }
00165 //      if( strcmp(hcalMEs[ih]->getName().c_str(), "emap_min_ME") ==0  ){ emap_min_ME = hcalMEs[ih]; }
00166       if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HO") ==0  ){ ZS_HO = hcalMEs[ih]; }
00167       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HO") ==0  ){ ZS_seqHO = hcalMEs[ih]; }
00168       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HB1") ==0  ){ ZS_HB1 = hcalMEs[ih]; }
00169       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HB1") ==0  ){ ZS_seqHB1 = hcalMEs[ih]; }
00170       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HB2") ==0  ){ ZS_HB2 = hcalMEs[ih]; }
00171       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HB2") ==0  ){ ZS_seqHB2 = hcalMEs[ih]; }
00172       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HF1") ==0  ){ ZS_HF1 = hcalMEs[ih]; }
00173       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HF1") ==0  ){ ZS_seqHF1 = hcalMEs[ih]; }
00174       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HF2") ==0  ){ ZS_HF2 = hcalMEs[ih]; }
00175       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HF2") ==0  ){ ZS_seqHF2 = hcalMEs[ih]; }
00176       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HE1") ==0  ){ ZS_HE1 = hcalMEs[ih]; }
00177       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HE1") ==0  ){ ZS_seqHE1 = hcalMEs[ih]; }
00178       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HE2") ==0  ){ ZS_HE2 = hcalMEs[ih]; }
00179       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HE2") ==0  ){ ZS_seqHE2 = hcalMEs[ih]; }
00180       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_simple1D_HE3") ==0  ){ ZS_HE3 = hcalMEs[ih]; }
00181       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_sequential1D_HE3") ==0  ){ ZS_seqHE3 = hcalMEs[ih]; }
00182       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_map_depth1") ==0  ){ map_depth1= hcalMEs[ih]; }
00183       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_map_depth2") ==0  ){ map_depth2= hcalMEs[ih]; }
00184       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_map_depth3") ==0  ){ map_depth3= hcalMEs[ih]; }
00185       else if( strcmp(hcalMEs[ih]->getName().c_str(), "ZSmin_map_depth4") ==0  ){ map_depth4= hcalMEs[ih]; }
00186 
00187       else if( strcmp(hcalMEs[ih]->getName().c_str(), "N_HF") ==0  ){ Nhf= hcalMEs[ih]; }
00188       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emap_depth1") ==0  ){ emap_depth1= hcalMEs[ih]; }
00189       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emap_depth2") ==0  ){ emap_depth2= hcalMEs[ih]; }
00190       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emap_depth3") ==0  ){ emap_depth3= hcalMEs[ih]; }
00191       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emap_depth4") ==0  ){ emap_depth4= hcalMEs[ih]; }
00192 
00193       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HB1") ==0  ){ occupancy_seqHB1= hcalMEs[ih]; }
00194       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HB2") ==0  ){ occupancy_seqHB2= hcalMEs[ih]; }
00195       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HE1") ==0  ){ occupancy_seqHE1= hcalMEs[ih]; }
00196       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HE2") ==0  ){ occupancy_seqHE2= hcalMEs[ih]; }
00197       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HE3") ==0  ){ occupancy_seqHE3= hcalMEs[ih]; }
00198       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HF1") ==0  ){ occupancy_seqHF1= hcalMEs[ih]; }
00199       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HF2") ==0  ){ occupancy_seqHF2= hcalMEs[ih]; }
00200       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occ_sequential1D_HO") ==0  ){ occupancy_seqHO= hcalMEs[ih]; }
00201       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HB1") ==0  ){ emean_seqHB1= hcalMEs[ih]; }
00202       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HB2") ==0  ){ emean_seqHB2= hcalMEs[ih]; }
00203       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HE1") ==0  ){ emean_seqHE1= hcalMEs[ih]; }
00204       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HE2") ==0  ){ emean_seqHE2= hcalMEs[ih]; }
00205       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HE3") ==0  ){ emean_seqHE3= hcalMEs[ih]; }
00206       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HF1") ==0  ){ emean_seqHF1= hcalMEs[ih]; }
00207       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HF2") ==0  ){ emean_seqHF2= hcalMEs[ih]; }
00208       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_seq_HO") ==0  ){ emean_seqHO= hcalMEs[ih]; }
00209       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HB1") ==0  ){ RMS_seq_HB1= hcalMEs[ih]; }
00210       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HB2") ==0  ){ RMS_seq_HB2= hcalMEs[ih]; }
00211       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HE1") ==0  ){ RMS_seq_HE1= hcalMEs[ih]; }
00212       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HE2") ==0  ){ RMS_seq_HE2= hcalMEs[ih]; }
00213       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HE3") ==0  ){ RMS_seq_HE3= hcalMEs[ih]; }
00214       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HF1") ==0  ){ RMS_seq_HF1= hcalMEs[ih]; }
00215       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HF2") ==0  ){ RMS_seq_HF2= hcalMEs[ih]; }
00216       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_seq_HO") ==0  ){ RMS_seq_HO= hcalMEs[ih]; }
00217       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HB1") ==0  ){ occupancy_map_HB1= hcalMEs[ih]; }
00218       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HB2") ==0  ){ occupancy_map_HB2= hcalMEs[ih]; }
00219       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HE1") ==0  ){ occupancy_map_HE1= hcalMEs[ih]; }
00220       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HE2") ==0  ){ occupancy_map_HE2= hcalMEs[ih]; }
00221       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HE3") ==0  ){ occupancy_map_HE3= hcalMEs[ih]; }
00222       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HF1") ==0  ){ occupancy_map_HF1= hcalMEs[ih]; }
00223       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HF2") ==0  ){ occupancy_map_HF2= hcalMEs[ih]; }
00224       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_map_HO") ==0  ){ occupancy_map_HO= hcalMEs[ih]; }
00225       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HB1") ==0  ){ emean_vs_ieta_HB1= hcalMEs[ih]; }
00226       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HB2") ==0  ){ emean_vs_ieta_HB2= hcalMEs[ih]; }
00227       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HE1") ==0  ){ emean_vs_ieta_HE1= hcalMEs[ih]; }
00228       else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HE2") ==0  ){ emean_vs_ieta_HE2= hcalMEs[ih]; }
00229       //else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HE3") ==0  ){ emean_vs_ieta_HE3= hcalMEs[ih]; }
00230       //else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HF1") ==0  ){ emean_vs_ieta_HF1= hcalMEs[ih]; }
00231       //else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HF2") ==0  ){ emean_vs_ieta_HF2= hcalMEs[ih]; }
00232       //else if( strcmp(hcalMEs[ih]->getName().c_str(), "emean_vs_ieta_HO") ==0  ){ emean_vs_ieta_HO= hcalMEs[ih]; }
00233       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HB1") ==0  ){ RMS_vs_ieta_HB1= hcalMEs[ih]; }
00234       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HB2") ==0  ){ RMS_vs_ieta_HB2= hcalMEs[ih]; }
00235       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HE1") ==0  ){ RMS_vs_ieta_HE1= hcalMEs[ih]; }
00236       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HE2") ==0  ){ RMS_vs_ieta_HE2= hcalMEs[ih]; }
00237       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HE3") ==0  ){ RMS_vs_ieta_HE3= hcalMEs[ih]; }
00238       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HF1") ==0  ){ RMS_vs_ieta_HF1= hcalMEs[ih]; }
00239       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HF2") ==0  ){ RMS_vs_ieta_HF2= hcalMEs[ih]; }
00240       else if( strcmp(hcalMEs[ih]->getName().c_str(), "RMS_vs_ieta_HO") ==0  ){ RMS_vs_ieta_HO= hcalMEs[ih]; }
00241       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HB1") ==0  ){ occupancy_vs_ieta_HB1= hcalMEs[ih]; }
00242       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HB2") ==0  ){ occupancy_vs_ieta_HB2= hcalMEs[ih]; }
00243       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HE1") ==0  ){ occupancy_vs_ieta_HE1= hcalMEs[ih]; }
00244       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HE2") ==0  ){ occupancy_vs_ieta_HE2= hcalMEs[ih]; }
00245       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HE3") ==0  ){ occupancy_vs_ieta_HE3= hcalMEs[ih]; }
00246       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HF1") ==0  ){ occupancy_vs_ieta_HF1= hcalMEs[ih]; }
00247       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HF2") ==0  ){ occupancy_vs_ieta_HF2= hcalMEs[ih]; }
00248       else if( strcmp(hcalMEs[ih]->getName().c_str(), "occupancy_vs_ieta_HO") ==0  ){ occupancy_vs_ieta_HO= hcalMEs[ih]; }
00249       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_StatusWord_HB") ==0  ){ RecHit_StatusWord_HB= hcalMEs[ih]; }
00250       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_StatusWord_HE") ==0  ){ RecHit_StatusWord_HE= hcalMEs[ih]; }
00251       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_StatusWord_HO") ==0  ){ RecHit_StatusWord_HO= hcalMEs[ih]; }
00252       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_StatusWord_HF") ==0  ){ RecHit_StatusWord_HF= hcalMEs[ih]; }
00253       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_StatusWord_HF67") ==0  ){ RecHit_StatusWord_HF67= hcalMEs[ih]; }
00254       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_Aux_StatusWord_HB") ==0  ){ RecHit_Aux_StatusWord_HB= hcalMEs[ih]; }
00255       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_Aux_StatusWord_HE") ==0  ){ RecHit_Aux_StatusWord_HE= hcalMEs[ih]; }
00256       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_Aux_StatusWord_HO") ==0  ){ RecHit_Aux_StatusWord_HO= hcalMEs[ih]; }
00257       else if( strcmp(hcalMEs[ih]->getName().c_str(), "HcalRecHitTask_RecHit_Aux_StatusWord_HF") ==0  ){ RecHit_Aux_StatusWord_HF= hcalMEs[ih]; }
00258    } 
00259    if( useAllHistos !=0 && useAllHistos !=1 ) return 0;
00260 
00261    //None of the ZS stuff necessary for drawn histograms
00262    if (subdet==6 && useAllHistos) {
00263 // FIXME: a dummy emap_min! No solutions yet found.
00264 // Since useAllHistos is set to disable it in our ususal validation, it's left here to be fixed later...
00265       double emap_min[82][72][4][4];
00266 /* NOT a valid solution 
00267       for(unsigned int i1=0; i1 <82; i1++){
00268          for(unsigned int i2=0; i2<72; i2++){
00269             for(unsigned int i3=0; i3<4; i3++){
00270                for(unsigned int i4=0; i4<4; i4++){
00271                   int idx = i1 + i2*82 + i3*(82*72) + i4*(82*72*4);
00272                   emap_min[i1][i2][i3][i4] = emap_min_ME->GetBinContent(idx+1);     
00273                }
00274             }
00275          }
00276        }
00277 */
00278        for (unsigned int i1 = 0;  i1 < 82; i1++) {
00279           for (unsigned int i2 = 0;  i2 < 72; i2++) {
00280 
00281              int index = (i1-41) * 72 + i2;
00282         
00283              double e = emap_min[i1][i2][0][0];
00284              if( e < 10000.) {
00285                 ZS_HB1->Fill(e);
00286                 ZS_seqHB1->Fill(double(index),e);
00287              }
00288              e = emap_min[i1][i2][1][0];
00289              if( e < 10000.) {
00290                 ZS_HB2->Fill(e);
00291                 ZS_seqHB2->Fill(double(index),e);
00292              }
00293         
00294              e = emap_min[i1][i2][0][1];
00295              if( e < 10000.) {
00296                 ZS_HE1->Fill(e);
00297                 ZS_seqHE1->Fill(double(index),e);
00298              }
00299              e = emap_min[i1][i2][1][1];
00300              if( e < 10000.) {
00301                 ZS_HE2->Fill(e);
00302                 ZS_seqHE2->Fill(double(index),e);
00303              }
00304              e = emap_min[i1][i2][2][1];
00305              if( e < 10000.) {
00306                 ZS_HE3->Fill(e);
00307                 ZS_seqHE3->Fill(double(index),e);
00308              }
00309         
00310              e = emap_min[i1][i2][3][2];
00311              if( e < 10000.) {
00312                 ZS_HO->Fill(e);
00313                 ZS_seqHO->Fill(double(index),e);
00314              }
00315         
00316              e = emap_min[i1][i2][0][3];
00317              if( e < 10000.) {
00318                 ZS_HF1->Fill(e);
00319                 ZS_seqHF1->Fill(double(index),e);
00320              }
00321         
00322              e = emap_min[i1][i2][1][3];
00323              if( e < 10000.) {
00324                 ZS_HF2->Fill(e);
00325                 ZS_seqHF2->Fill(double(index),e);
00326              }
00327         
00328              for (unsigned int i3 = 0;  i3 < 4;  i3++) {  // depth
00329                 double emin = 100000.;
00330                 for (unsigned int i4 = 0;  i4 < 4;  i4++) {  // subdet
00331                    /*
00332                      std::cout << "* ieta, iphi, depth, sub = " 
00333                          << i1 << ", " << i2 << ", " << i3 << ", " << i4
00334                          << "  emap_min = " << emap_min [i1][i2][i3][i4]
00335                          << std::endl;
00336                    */
00337                    if ( emin > emap_min [i1][i2][i3][i4]) 
00338                    emin = emap_min [i1][i2][i3][i4];
00339                 }
00340 
00341                 int ieta = i1-41;
00342                 if( i3 == 0 && emin < 10000.) {
00343                    map_depth1->Fill(double(ieta),double(i2),emin);
00344                    /*
00345                      std::cout << "* Fill map_depth1 " << double(ieta) << " "  
00346                         << double(i2) << "  with " << emin <<  std::endl;
00347                    */
00348                 }
00349                 if( i3 == 1 && emin < 10000.)
00350                    map_depth2->Fill(double(ieta),double(i2),emin);
00351                 if( i3 == 2 && emin < 10000.) 
00352                    map_depth3->Fill(double(ieta),double(i2),emin);
00353                 if( i3 == 3 && emin < 10000.) 
00354                    map_depth4->Fill(double(ieta),double(i2),emin);
00355             }
00356          }
00357       } 
00358    }
00359   // mean energies and occupancies evaluation
00360    else {
00361 
00362       double nevtot = Nhf->getEntries();
00363       if(verbose_) std::cout<<"nevtot : "<<nevtot<<std::endl;
00364 
00365       int nx = occupancy_map_HB1->getNbinsX();
00366       int ny = occupancy_map_HB1->getNbinsY();
00367 
00368       float cnorm;
00369       float fev = float (nevtot);
00370       //    std::cout << "*** nevtot " <<  nevtot << std::endl; 
00371 
00372       float sumphi_hb1, sumphi_hb2, sumphi_he1, sumphi_he2, sumphi_he3,
00373             sumphi_ho, sumphi_hf1, sumphi_hf2;
00374       /*
00375       if(nx != 82 || ny != 72) 
00376             std::cout << "*** problem with binning " << std::endl;
00377       */
00378       float phi_factor;  
00379 
00380       // First - special <E> maps
00381       int nx1 = emap_depth1->getNbinsX();    
00382       int ny1 = emap_depth1->getNbinsY();
00383       for (int i = 1; i <= nx1; i++) {      
00384         for (int j = 1; j <= ny1; j++) {      
00385             cnorm = emap_depth1->getBinContent(i,j) / fev;
00386             emap_depth1->setBinContent(i,j,cnorm);
00387             cnorm = emap_depth2->getBinContent(i,j) / fev;
00388             emap_depth2->setBinContent(i,j,cnorm);
00389             cnorm = emap_depth3->getBinContent(i,j) / fev;
00390             emap_depth3->setBinContent(i,j,cnorm);
00391             cnorm = emap_depth4->getBinContent(i,j) / fev;
00392             emap_depth4->setBinContent(i,j,cnorm);
00393         }
00394       }
00395 
00396       // Second: all others regular maps
00397       for (int i = 1; i <= nx; i++) {
00398          sumphi_hb1 = 0.;
00399          sumphi_hb2 = 0.;
00400          sumphi_he1 = 0.;
00401          sumphi_he2 = 0.;
00402          sumphi_he3 = 0.;
00403          sumphi_ho  = 0.; 
00404          sumphi_hf1 = 0.;
00405          sumphi_hf2 = 0.;
00406       
00407          for (int j = 1; j <= ny; j++) {
00408         
00409             int index = (i-42) * ny + j-1;
00410 
00411             //Occupancies (needed for occ vs ieta histos)
00412             cnorm = occupancy_map_HB1->getBinContent(i,j) / fev;   
00413             occupancy_map_HB1->setBinContent(i,j,cnorm);
00414         
00415             cnorm = occupancy_map_HB2->getBinContent(i,j) / fev;   
00416             occupancy_map_HB2->setBinContent(i,j,cnorm);
00417         
00418             cnorm = occupancy_map_HE1->getBinContent(i,j) / fev;   
00419             occupancy_map_HE1->setBinContent(i,j,cnorm);
00420         
00421             cnorm = occupancy_map_HE2->getBinContent(i,j) / fev;   
00422             occupancy_map_HE2->setBinContent(i,j,cnorm);
00423         
00424             cnorm = occupancy_map_HE3->getBinContent(i,j) / fev;   
00425             occupancy_map_HE3->setBinContent(i,j,cnorm);
00426         
00427             cnorm = occupancy_map_HO->getBinContent(i,j) / fev;   
00428             occupancy_map_HO->setBinContent(i,j,cnorm);
00429         
00430             cnorm = occupancy_map_HF1->getBinContent(i,j) / fev;   
00431             occupancy_map_HF1->setBinContent(i,j,cnorm);
00432         
00433             cnorm = occupancy_map_HF2->getBinContent(i,j) / fev;   
00434             occupancy_map_HF2->setBinContent(i,j,cnorm);
00435 
00436             sumphi_hb1 += occupancy_map_HB1->getBinContent(i,j);
00437             sumphi_hb2 += occupancy_map_HB2->getBinContent(i,j);
00438             sumphi_he1 += occupancy_map_HE1->getBinContent(i,j);
00439             sumphi_he2 += occupancy_map_HE2->getBinContent(i,j);
00440             sumphi_he3 += occupancy_map_HE3->getBinContent(i,j);
00441             sumphi_ho  += occupancy_map_HO->getBinContent(i,j);
00442             sumphi_hf1 += occupancy_map_HF1->getBinContent(i,j);
00443             sumphi_hf2 += occupancy_map_HF2->getBinContent(i,j);
00444         
00445             // Occupancies - not in main drawn set of histos
00446             if(useAllHistos){
00447               occupancy_seqHB1->Fill(double(index),cnorm);
00448               occupancy_seqHB2->Fill(double(index),cnorm);
00449               occupancy_seqHE1->Fill(double(index),cnorm);
00450               occupancy_seqHE2->Fill(double(index),cnorm);
00451               occupancy_seqHE3->Fill(double(index),cnorm);
00452               occupancy_seqHO->Fill(double(index),cnorm);
00453               occupancy_seqHF1->Fill(double(index),cnorm);
00454               occupancy_seqHF2->Fill(double(index),cnorm); 
00455             }
00456          }
00457 
00458          int ieta = i - 42;        // -41 -1, 0 40 
00459          if(ieta >=0 ) ieta +=1;   // -41 -1, 1 41  - to make it detector-like
00460 
00461          if(ieta >= -20 && ieta <= 20 )
00462             {phi_factor = 72.;}
00463          else {
00464             if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
00465          else 
00466            phi_factor = 36.;
00467          }  
00468          if(ieta >= 0) ieta -= 1; // -41 -1, 0 40  - to bring back to histo num
00469                
00470          /*
00471          std::cout << "*** ieta = " << ieta << "  sumphi_hb1, sumphi_hb2, sumphi_he1, sumphi_he2, simphi_he3, sumphi_ho, simphi_hf1, sumphi_hf2" << std::endl 
00472                 << sumphi_hb1 << " " << sumphi_hb2 << " " << sumphi_he1 << " "
00473                 << sumphi_he2 << " " << simphi_he3 << " " << sumphi_ho  << " " 
00474                 << simphi_hf1 << " " << sumphi_hf2 << std::endl << std::endl;
00475          */
00476          //Occupancy vs. ieta histos are drawn, RMS is not
00477          cnorm = sumphi_hb1 / phi_factor;
00478          occupancy_vs_ieta_HB1->Fill(float(ieta), cnorm);
00479          cnorm = sumphi_hb2 / phi_factor;
00480          occupancy_vs_ieta_HB2->Fill(float(ieta), cnorm);
00481          cnorm = sumphi_he1 / phi_factor;
00482          occupancy_vs_ieta_HE1->Fill(float(ieta), cnorm);
00483          cnorm = sumphi_he2 / phi_factor;
00484          occupancy_vs_ieta_HE2->Fill(float(ieta), cnorm);
00485          cnorm = sumphi_he3 / phi_factor;
00486          occupancy_vs_ieta_HE3->Fill(float(ieta), cnorm);
00487          cnorm = sumphi_ho / phi_factor;
00488          occupancy_vs_ieta_HO->Fill(float(ieta), cnorm);
00489          cnorm = sumphi_hf1 / phi_factor;
00490          occupancy_vs_ieta_HF1->Fill(float(ieta), cnorm);
00491          cnorm = sumphi_hf2 / phi_factor;
00492          occupancy_vs_ieta_HF2->Fill(float(ieta), cnorm);
00493       
00494          if (useAllHistos){
00495           // RMS vs ieta (Emean's one)
00496             cnorm = emean_vs_ieta_HB1->getBinError(i);
00497             RMS_vs_ieta_HB1->Fill(ieta,cnorm);
00498             cnorm = emean_vs_ieta_HB2->getBinError(i);
00499             RMS_vs_ieta_HB2->Fill(ieta,cnorm);
00500             cnorm = emean_vs_ieta_HE1->getBinError(i);
00501             RMS_vs_ieta_HE1->Fill(ieta,cnorm);
00502             cnorm = emean_vs_ieta_HE2->getBinError(i);
00503             RMS_vs_ieta_HE2->Fill(ieta,cnorm);
00504             cnorm = emean_vs_ieta_HE1->getBinError(i);
00505             RMS_vs_ieta_HE3->Fill(ieta,cnorm);
00506             cnorm = emean_vs_ieta_HB1->getBinError(i);
00507             RMS_vs_ieta_HO->Fill(ieta,cnorm);
00508             cnorm = emean_vs_ieta_HB1->getBinError(i);
00509             RMS_vs_ieta_HF1->Fill(ieta,cnorm);
00510             cnorm = emean_vs_ieta_HB1->getBinError(i);
00511             RMS_vs_ieta_HF2->Fill(ieta,cnorm);
00512          }
00513       }  // end of i-loop
00514 
00515     
00516       // RMS seq (not drawn)
00517       if(useAllHistos){
00518          nx = emean_seqHB1->getNbinsX();    
00519          for(int ibin = 1; ibin <= nx; ibin++ ){
00520             cnorm = emean_seqHB1->getBinError(ibin);
00521             RMS_seq_HB1->setBinContent(ibin, cnorm);
00522             cnorm = emean_seqHB2->getBinError(ibin);
00523             RMS_seq_HB2->setBinContent(ibin, cnorm);
00524             cnorm = emean_seqHO->getBinError(ibin);
00525             RMS_seq_HO->setBinContent(ibin, cnorm);
00526          }
00527          nx = emean_seqHE1->getNbinsX();    
00528          for(int ibin = 1; ibin <= nx; ibin++ ){
00529             cnorm = emean_seqHE1->getBinError(ibin);
00530             RMS_seq_HE1->setBinContent(ibin, cnorm);
00531             cnorm = emean_seqHE2->getBinError(ibin);
00532             RMS_seq_HE2->setBinContent(ibin, cnorm);
00533             cnorm = emean_seqHE3->getBinError(ibin);
00534             RMS_seq_HE3->setBinContent(ibin, cnorm);
00535          }
00536          nx = emean_seqHF1->getNbinsX();    
00537          for(int ibin = 1; ibin <= nx; ibin++ ){
00538             cnorm = emean_seqHF1->getBinError(ibin);
00539             RMS_seq_HF1->setBinContent(ibin, cnorm);
00540             cnorm = emean_seqHF2->getBinError(ibin);
00541             RMS_seq_HF2->setBinContent(ibin, cnorm);
00542          }
00543       }
00544       //Status Word (drawn)
00545       nx = RecHit_StatusWord_HB->getNbinsX();    
00546       for (int ibin = 1;  ibin <= nx; ibin++) {
00547          cnorm = RecHit_StatusWord_HB->getBinContent(ibin) / (fev * 2592.);
00548          RecHit_StatusWord_HB->setBinContent(ibin,cnorm);
00549       
00550          cnorm = RecHit_StatusWord_HE->getBinContent(ibin) / (fev * 2592.);
00551          RecHit_StatusWord_HE->setBinContent(ibin,cnorm);
00552       
00553          cnorm = RecHit_StatusWord_HO->getBinContent(ibin) / (fev * 2160.);
00554          RecHit_StatusWord_HO->setBinContent(ibin,cnorm);
00555       
00556          cnorm = RecHit_StatusWord_HF->getBinContent(ibin) / (fev * 1728.);
00557          RecHit_StatusWord_HF->setBinContent(ibin,cnorm);
00558 
00559          cnorm = RecHit_Aux_StatusWord_HB->getBinContent(ibin) / (fev * 2592.);
00560          RecHit_Aux_StatusWord_HB->setBinContent(ibin,cnorm);
00561       
00562          cnorm = RecHit_Aux_StatusWord_HE->getBinContent(ibin) / (fev * 2592.);
00563          RecHit_Aux_StatusWord_HE->setBinContent(ibin,cnorm);
00564       
00565          cnorm = RecHit_Aux_StatusWord_HO->getBinContent(ibin) / (fev * 2160.);
00566          RecHit_Aux_StatusWord_HO->setBinContent(ibin,cnorm);
00567       
00568          cnorm = RecHit_Aux_StatusWord_HF->getBinContent(ibin) / (fev * 1728.);
00569          RecHit_Aux_StatusWord_HF->setBinContent(ibin,cnorm);
00570       }
00571       //HF 2-bit status word (not drawn)
00572       if(useAllHistos){
00573          nx = RecHit_StatusWord_HF67->getNbinsX();    
00574          for (int ibin = 1;  ibin <= nx; ibin++) {
00575             cnorm = RecHit_StatusWord_HF67->getBinContent(ibin) / (fev * 1728.);
00576             RecHit_StatusWord_HF67->setBinContent(ibin,cnorm);
00577          }
00578       }
00579    }
00580 
00581    return 1;
00582 }
00583 
00584 DEFINE_FWK_MODULE(HcalRecHitsDQMClient);