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