CMS 3D CMS Logo

SiStripPedestalsDQM.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripMonitorSummary/interface/SiStripPedestalsDQM.h"
00002 #include "DQMServices/Core/interface/MonitorElement.h"
00003 
00004 // -----
00005 SiStripPedestalsDQM::SiStripPedestalsDQM(const edm::EventSetup & eSetup,
00006                                          edm::ParameterSet const& hPSet,
00007                                          edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){
00008 
00009 }
00010 // -----
00011 
00012 
00013 
00014 // -----
00015 SiStripPedestalsDQM::~SiStripPedestalsDQM(){}
00016 // -----
00017 
00018 
00019 // -----
00020 void SiStripPedestalsDQM::getActiveDetIds(const edm::EventSetup & eSetup){
00021   
00022   getConditionObject(eSetup);
00023   pedestalHandle_->getDetIds(activeDetIds);
00024   selectModules(activeDetIds);
00025 
00026 }
00027 // -----
00028 
00029 
00030 // -----
00031 void SiStripPedestalsDQM::fillModMEs(const std::vector<uint32_t> & selectedDetIds){
00032    
00033   ModMEs CondObj_ME;
00034   
00035   
00036   for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00037       detIter_!= selectedDetIds.end();detIter_++){
00038       
00039     fillMEsForDet(CondObj_ME,*detIter_);
00040       
00041   }
00042 }    
00043 // -----
00044 
00045 
00046 
00047 
00048 // -----
00049 void SiStripPedestalsDQM::fillMEsForDet(ModMEs selModME_, uint32_t selDetId_){
00050   
00051   getModMEs(selModME_,selDetId_);
00052   
00053   SiStripPedestals::Range pedRange = pedestalHandle_->getRange(selDetId_);
00054   int nStrip =  reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
00055   
00056   for( int istrip=0;istrip<nStrip;++istrip){
00057     try{      
00058       if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
00059         selModME_.ProfileDistr->Fill(istrip+1,pedestalHandle_->getPed(istrip,pedRange));
00060       }
00061     } 
00062     catch(cms::Exception& e){
00063       edm::LogError("SiStripPedestalsDQM")          
00064         << "[SiStripPedestalsDQM::fillMEsForDet] cms::Exception accessing pedestalHandle_->getPed(istrip,pedRange) for strip "  
00065         << istrip 
00066         << " and detid " 
00067         << selDetId_  
00068         << " :  " 
00069         << e.what() ;
00070     }
00071   }// istrip
00072   
00073 }    
00074 // -----
00075 
00076 
00077 
00078 // -----
00079 void SiStripPedestalsDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds){
00080    
00081   for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00082       detIter_!= selectedDetIds.end();detIter_++){
00083     fillMEsForLayer(SummaryMEsMap_, *detIter_);
00084   } 
00085 }           
00086   
00087 // -----
00088 
00089 
00090 
00091 // -----
00092 void SiStripPedestalsDQM::fillMEsForLayer( std::map<uint32_t, ModMEs> selMEsMap_, uint32_t selDetId_){
00093 
00094   // ----
00095   int subdetectorId_ = ((selDetId_>>25)&0x7);
00096     
00097   if( subdetectorId_<3 || subdetectorId_>6 ){ 
00098     edm::LogError("SiStripPedestalsDQM")
00099       << "[SiStripPedestalsDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
00100       << subdetectorId_ << " no folder set!" 
00101       << std::endl;
00102     return;
00103   }
00104   // ----
00105      
00106   std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = selMEsMap_.find(getLayerNameAndId(selDetId_).second);
00107   ModMEs selME_;
00108   selME_ =selMEsMapIter_->second;
00109   getSummaryMEs(selME_,selDetId_);
00110     
00111   SiStripPedestals::Range pedRange = pedestalHandle_->getRange(selDetId_);
00112   
00113   int nStrip =  reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
00114   
00115   SiStripHistoId hidmanager;
00116 
00117   if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
00118   
00119     // --> profile summary    
00120   
00121     std::string hSummaryOfProfile_description;
00122     hSummaryOfProfile_description  = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
00123   
00124     std::string hSummaryOfProfile_name; 
00125   
00126   
00127     hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, 
00128                                                          "layer", 
00129                                                          getLayerNameAndId(selDetId_).first, 
00130                                                          "") ;
00131   
00132   
00133     for( int istrip=0;istrip<nStrip;++istrip){
00134     
00135       try{ 
00136         if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
00137           selME_.SummaryOfProfileDistr->Fill(istrip+1,pedestalHandle_->getPed(istrip,pedRange));
00138         }
00139       } 
00140       catch(cms::Exception& e){
00141         edm::LogError("SiStripPedestalsDQM")          
00142           << "[SiStripPedestalsDQM::fillMEsForLayer] cms::Exception accessing pedestalHandle_->getPed(istrip,pedRange) for strip "  
00143           << istrip 
00144           << " and detid " 
00145           << selDetId_  
00146           << " :  " 
00147           << e.what() ;
00148       }
00149     }// istrip  
00150   }//if Fill ...
00151 
00152   if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
00153 
00154     // -->  summary  
00155   
00156     std::string hSummary_description;
00157     hSummary_description  = hPSet_.getParameter<std::string>("Summary_description");
00158   
00159     std::string hSummary_name; 
00160     hSummary_name = hidmanager.createHistoLayer(hSummary_description, 
00161                                                 "layer", 
00162                                                 getLayerNameAndId(selDetId_).first, 
00163                                                 "") ;
00164     float meanPedestal=0;
00165   
00166     for( int istrip=0;istrip<nStrip;++istrip){
00167     
00168       try{
00169         meanPedestal = meanPedestal + pedestalHandle_->getPed(istrip,pedRange);
00170       }
00171       catch(cms::Exception& e){
00172         edm::LogError("SiStripNoisesDQM")          
00173           << "[SiStripNoisesDQM::fillMEsForLayer] cms::Exception accessing pedestalHandle_->getPed(istrip,pedRange) for strip "  
00174           << istrip 
00175           << "and detid " 
00176           << selDetId_  
00177           << " :  " 
00178           << e.what() ;      
00179       }
00180     
00181     }//istrip
00182   
00183     meanPedestal = meanPedestal/nStrip;
00184   
00185   
00186     // -----
00187     // get detIds belonging to same layer to fill X-axis with detId-number
00188   
00189     std::vector<uint32_t> sameLayerDetIds_;
00190   
00191     sameLayerDetIds_.clear();
00192 
00193     sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_);
00194   
00195   
00196     unsigned int iBin=0;
00197     for(unsigned int i=0;i<sameLayerDetIds_.size();i++){
00198       if(sameLayerDetIds_[i]==selDetId_){iBin=i+1;}
00199     }   
00200   
00201     selME_.SummaryDistr->Fill(iBin,meanPedestal);
00202 
00203   }//if Fill ...
00204   
00205   
00206   
00207 }  
00208 // -----
00209 

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