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