CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/DQM/SiStripMonitorSummary/src/SiStripThresholdDQM.cc

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