Go to the documentation of this file.00001 #include "DQM/SiStripMonitorSummary/interface/SiStripApvGainsDQM.h"
00002
00003
00004 #include "DQMServices/Core/interface/MonitorElement.h"
00005 #include "TCanvas.h"
00006
00007
00008 SiStripApvGainsDQM::SiStripApvGainsDQM(const edm::EventSetup & eSetup,
00009 edm::ParameterSet const& hPSet,
00010 edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup,hPSet, fPSet){
00011
00012
00013 if(HistoMaps_On_ ) Tk_HM_ = new TkHistoMap("SiStrip/Histo_Map","MeanApvGain_TkMap",0.);
00014
00015 }
00016
00017
00018
00019 SiStripApvGainsDQM::~SiStripApvGainsDQM(){}
00020
00021
00022
00023
00024 void SiStripApvGainsDQM::getActiveDetIds(const edm::EventSetup & eSetup){
00025
00026 getConditionObject(eSetup);
00027 gainHandle_->getDetIds(activeDetIds);
00028
00029 }
00030
00031
00032
00033
00034
00035
00036 void SiStripApvGainsDQM::fillModMEs(const std::vector<uint32_t> & selectedDetIds){
00037
00038 ModMEs CondObj_ME;
00039
00040 for(std::vector<uint32_t>::const_iterator detIter_ =selectedDetIds.begin();
00041 detIter_!=selectedDetIds.end();++detIter_){
00042 fillMEsForDet(CondObj_ME,*detIter_);
00043 }
00044 }
00045
00046
00047
00048 void SiStripApvGainsDQM::fillMEsForDet(ModMEs selModME_, uint32_t selDetId_){
00049
00050 std::vector<uint32_t> DetIds;
00051 gainHandle_->getDetIds(DetIds);
00052
00053 SiStripApvGain::Range gainRange = gainHandle_->getRange(selDetId_);
00054
00055 int nApv = reader->getNumberOfApvsAndStripLength(selDetId_).first;
00056
00057 getModMEs(selModME_,selDetId_);
00058
00059 for( int iapv=0;iapv<nApv;++iapv){
00060 if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
00061 selModME_.ProfileDistr->Fill(iapv+1,gainHandle_->getApvGain(iapv,gainRange));
00062 }
00063 if( CondObj_fillId_ =="onlyCumul" || CondObj_fillId_ =="ProfileAndCumul"){
00064 selModME_.CumulDistr ->Fill(gainHandle_->getApvGain(iapv,gainRange));
00065 }
00066
00067
00068 if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
00069 fillTkMap(selDetId_, gainHandle_->getApvGain(iapv,gainRange));
00070 }
00071
00072 }
00073 }
00074
00075
00076 void SiStripApvGainsDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds){
00077
00078 for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
00079 detIter_!= selectedDetIds.end();detIter_++){
00080 fillMEsForLayer( *detIter_);
00081 }
00082
00083 for (std::map<uint32_t, ModMEs>::iterator iter=SummaryMEsMap_.begin(); iter!=SummaryMEsMap_.end(); iter++){
00084
00085 ModMEs selME;
00086 selME = iter->second;
00087
00088 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")){
00089
00090 TCanvas c1("c1");
00091 selME.SummaryOfProfileDistr->getTProfile()->Draw();
00092 std::string name (selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
00093 name+=".png";
00094 c1.Print(name.c_str());
00095 }
00096 if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")){
00097
00098 TCanvas c1("c1");
00099 selME.SummaryDistr->getTH1()->Draw();
00100 std::string name (selME.SummaryDistr->getTH1()->GetTitle());
00101 name+=".png";
00102 c1.Print(name.c_str());
00103 }
00104 }
00105
00106 }
00107
00108
00109 void SiStripApvGainsDQM::fillMEsForLayer( uint32_t selDetId_){
00110
00111 int subdetectorId_ = ((selDetId_>>25)&0x7);
00112
00113 if( subdetectorId_<3 ||subdetectorId_>6 ){
00114 edm::LogError("SiStripApvGainsDQM")
00115 << "[SiStripApvGainsDQM::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_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
00123 ModMEs selME_;
00124 if ( selMEsMapIter_ != SummaryMEsMap_.end())
00125 selME_ =selMEsMapIter_->second;
00126 getSummaryMEs(selME_,selDetId_);
00127
00128 SiStripApvGain::Range gainRange = gainHandle_->getRange(selDetId_);
00129 int nApv = reader->getNumberOfApvsAndStripLength(selDetId_).first;
00130
00131 float meanApvGain=0;
00132
00133 SiStripHistoId hidmanager;
00134
00135 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
00136
00137
00138 std::string hSummaryOfProfile_description;
00139 hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
00140
00141 std::string hSummaryOfProfile_name;
00142 hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description,
00143 "layer",
00144 getLayerNameAndId(selDetId_).first, "") ;
00145
00146 for( int iapv=0;iapv<nApv;++iapv){
00147
00148 meanApvGain = meanApvGain +gainHandle_ ->getApvGain(iapv,gainRange);
00149 selME_.SummaryOfProfileDistr->Fill(iapv+1,gainHandle_->getApvGain(iapv,gainRange));
00150
00151
00152 if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
00153 fillTkMap(selDetId_, gainHandle_->getApvGain(iapv,gainRange));
00154 }
00155
00156 }
00157
00158 meanApvGain = meanApvGain/nApv;
00159
00160
00161 if(HistoMaps_On_ ) Tk_HM_->setBinContent(selDetId_, meanApvGain);
00162
00163 }
00164
00165
00166 if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
00167
00168
00169 std::string hSummary_description;
00170 hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
00171
00172 std::string hSummary_name;
00173 hSummary_name = hidmanager.createHistoLayer(hSummary_description,
00174 "layer",
00175 getLayerNameAndId(selDetId_).first,
00176 "") ;
00177
00178
00179
00180
00181 std::vector<uint32_t> sameLayerDetIds_;
00182
00183 sameLayerDetIds_.clear();
00184
00185 sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_);
00186
00187 unsigned int iBin=0;
00188 for(unsigned int i=0;i<sameLayerDetIds_.size();i++){
00189 if(sameLayerDetIds_[i]==selDetId_){iBin=i+1;}
00190 }
00191
00192 for( int iapv=0;iapv<nApv;++iapv){
00193 meanApvGain = meanApvGain +gainHandle_ ->getApvGain(iapv,gainRange);
00194 selME_.SummaryDistr->Fill(iBin,gainHandle_->getApvGain(iapv,gainRange));
00195 }
00196 meanApvGain = meanApvGain/nApv;
00197
00198
00199
00200
00201 }
00202 }
00203
00204
00205
00206
00207
00208
00209