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