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, const edm::EventSetup& es){
00034
00035
00036 edm::ESHandle<TrackerTopology> tTopoHandle;
00037 es.get<IdealGeometryRecord>().get(tTopoHandle);
00038 const TrackerTopology* const tTopo = tTopoHandle.product();
00039
00040 ModMEs CondObj_ME;
00041
00042 for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00043 detIter_!= selectedDetIds.end();detIter_++){
00044
00045 fillMEsForDet(CondObj_ME,*detIter_,tTopo);
00046
00047 }
00048 }
00049
00050
00051
00052
00053
00054
00055 void SiStripPedestalsDQM::fillMEsForDet(const ModMEs& _selModME_, uint32_t selDetId_, const TrackerTopology* tTopo){
00056 ModMEs selModME_ = _selModME_;
00057 getModMEs(selModME_,selDetId_,tTopo);
00058
00059 SiStripPedestals::Range pedRange = pedestalHandle_->getRange(selDetId_);
00060 int nStrip = reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
00061
00062 for( int istrip=0;istrip<nStrip;++istrip){
00063 if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
00064 selModME_.ProfileDistr->Fill(istrip+1,pedestalHandle_->getPed(istrip,pedRange));
00065 }
00066 }
00067
00068 }
00069
00070
00071
00072
00073
00074 void SiStripPedestalsDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds, const edm::EventSetup& es){
00075
00076
00077 edm::ESHandle<TrackerTopology> tTopoHandle;
00078 es.get<IdealGeometryRecord>().get(tTopoHandle);
00079 const TrackerTopology* const tTopo = tTopoHandle.product();
00080
00081 for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00082 detIter_!= selectedDetIds.end();detIter_++){
00083 fillMEsForLayer( *detIter_,tTopo);
00084 }
00085
00086 for (std::map<uint32_t, ModMEs>::iterator iter=SummaryMEsMap_.begin(); iter!=SummaryMEsMap_.end(); iter++){
00087
00088 ModMEs selME;
00089 selME = iter->second;
00090
00091 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")){
00092
00093 if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
00094
00095 TCanvas c1("c1");
00096 selME.SummaryOfProfileDistr->getTProfile()->Draw();
00097 std::string name (selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
00098 name+=".png";
00099 c1.Print(name.c_str());
00100 }
00101 }
00102 if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")){
00103
00104 TCanvas c1("c1");
00105 selME.SummaryDistr->getTH1()->Draw();
00106 std::string name (selME.SummaryDistr->getTH1()->GetTitle());
00107 name+=".png";
00108 c1.Print(name.c_str());
00109 }
00110
00111 }
00112
00113 }
00114
00115
00116
00117
00118
00119
00120 void SiStripPedestalsDQM::fillMEsForLayer( uint32_t selDetId_, const TrackerTopology* tTopo){
00121
00122
00123 int subdetectorId_ = ((selDetId_>>25)&0x7);
00124
00125 if( subdetectorId_<3 || subdetectorId_>6 ){
00126 edm::LogError("SiStripPedestalsDQM")
00127 << "[SiStripPedestalsDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
00128 << subdetectorId_ << " no folder set!"
00129 << std::endl;
00130 return;
00131 }
00132
00133
00134
00135
00136 std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_,tTopo).second);
00137 ModMEs selME_;
00138 if ( selMEsMapIter_ != SummaryMEsMap_.end())
00139 selME_ =selMEsMapIter_->second;
00140 getSummaryMEs(selME_,selDetId_,tTopo);
00141
00142 SiStripPedestals::Range pedRange = pedestalHandle_->getRange(selDetId_);
00143
00144 int nStrip = reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
00145
00146 SiStripHistoId hidmanager;
00147
00148 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
00149
00150
00151
00152 std::string hSummaryOfProfile_description;
00153 hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
00154
00155 std::string hSummaryOfProfile_name;
00156
00157
00158 hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description,
00159 "layer",
00160 getLayerNameAndId(selDetId_,tTopo).first,
00161 "") ;
00162
00163 for( int istrip=0;istrip<nStrip;++istrip){
00164
00165 if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
00166 selME_.SummaryOfProfileDistr->Fill(istrip+1,pedestalHandle_->getPed(istrip,pedRange));
00167 }
00168
00169
00170 if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
00171 fillTkMap(selDetId_, pedestalHandle_->getPed(istrip,pedRange));
00172 }
00173
00174 }
00175 }
00176
00177 if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
00178
00179
00180
00181 std::string hSummary_description;
00182 hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
00183
00184 std::string hSummary_name;
00185 hSummary_name = hidmanager.createHistoLayer(hSummary_description,
00186 "layer",
00187 getLayerNameAndId(selDetId_,tTopo).first,
00188 "") ;
00189 float meanPedestal=0;
00190
00191 for( int istrip=0;istrip<nStrip;++istrip){
00192
00193 meanPedestal = meanPedestal + pedestalHandle_->getPed(istrip,pedRange);
00194
00195 }
00196
00197 meanPedestal = meanPedestal/nStrip;
00198
00199
00200
00201
00202
00203 std::vector<uint32_t> sameLayerDetIds_;
00204
00205 sameLayerDetIds_.clear();
00206
00207 sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_,tTopo);
00208
00209
00210 unsigned int iBin=0;
00211 for(unsigned int i=0;i<sameLayerDetIds_.size();i++){
00212 if(sameLayerDetIds_[i]==selDetId_){iBin=i+1;}
00213 }
00214
00215 selME_.SummaryDistr->Fill(iBin,meanPedestal);
00216
00217
00218 if(HistoMaps_On_ ) Tk_HM_->fill(selDetId_, meanPedestal);
00219
00220
00221 }
00222
00223
00224
00225 }
00226
00227