00001 #include "DQM/SiStripMonitorSummary/interface/SiStripLorentzAngleDQM.h"
00002 #include "DQMServices/Core/interface/MonitorElement.h"
00003
00004
00005 SiStripLorentzAngleDQM::SiStripLorentzAngleDQM(const edm::EventSetup & eSetup,
00006 edm::ParameterSet const& hPSet,
00007 edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){
00008 }
00009
00010
00011
00012
00013
00014 SiStripLorentzAngleDQM::~SiStripLorentzAngleDQM(){}
00015
00016
00017
00018
00019 void SiStripLorentzAngleDQM::getActiveDetIds(const edm::EventSetup & eSetup){
00020
00021 getConditionObject(eSetup);
00022 std::map<uint32_t,float>::const_iterator LAMapIter_;
00023 std::map<uint32_t,float> LAMap_ = lorentzangleHandle_->getLorentzAngles();
00024
00025 std::vector<uint32_t> cabledModules_ = getCabledModules();
00026
00027 for(std::vector<uint32_t>::const_iterator cablingIter_ = cabledModules_.begin();
00028 cablingIter_!= cabledModules_.end(); cablingIter_++){
00029
00030 unsigned int cablingId;
00031 cablingId=*cablingIter_;
00032 LAMapIter_=LAMap_.find(cablingId);
00033
00034 if (LAMapIter_!=LAMap_.end() && (*LAMapIter_).first==cablingId) {
00035 activeDetIds.push_back(*cablingIter_);
00036 }
00037 }
00038
00039 selectModules(activeDetIds);
00040
00041 }
00042
00043
00044
00045
00046 void SiStripLorentzAngleDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds){
00047
00048
00049
00050
00051
00052 bool fillNext = true;
00053 for(unsigned int i=0;i<selectedDetIds.size();i++){
00054 int subDetId_ = ((selectedDetIds[i]>>25)&0x7);
00055 if( subDetId_<3 ||subDetId_>6 ){
00056 edm::LogError("SiStripLorentzAngle")
00057 << "[SiStripLorentzAngle::fillSummaryMEs] WRONG INPUT : no such subdetector type : "
00058 << subDetId_ << " and detId " << selectedDetIds[i] << " therefore no filling!"
00059 << std::endl;
00060 }
00061 else if (SummaryOnLayerLevel_On_) {
00062 if( fillNext) { fillMEsForLayer(SummaryMEsMap_, selectedDetIds[i]);}
00063 if( getLayerNameAndId(selectedDetIds[i+1])==getLayerNameAndId(selectedDetIds[i])){ fillNext=false;}
00064 else { fillNext=true;}
00065 }
00066 else if (SummaryOnStringLevel_On_) {
00067 if( fillNext) { fillMEsForLayer(SummaryMEsMap_, selectedDetIds[i]);}
00068 if( getStringNameAndId(selectedDetIds[i+1])==getStringNameAndId(selectedDetIds[i])){ fillNext=false;}
00069 else { fillNext=true;}
00070 }
00071 }
00072 }
00073
00074
00075
00076
00077
00078 void SiStripLorentzAngleDQM::fillMEsForLayer( std::map<uint32_t, ModMEs> selMEsMap_, uint32_t selDetId_){
00079
00080 SiStripHistoId hidmanager;
00081
00082
00083 std::string hSummaryOfProfile_description;
00084 hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
00085
00086 std::string hSummary_name;
00087
00088 int subDetId_ = ((selDetId_>>25)&0x7);
00089
00090 if( subDetId_<3 || subDetId_>6 ){
00091 edm::LogError("SiStripLorentzAngleDQM")
00092 << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
00093 << subDetId_ << " no folder set!"
00094 << std::endl;
00095 return;
00096 }
00097
00098 uint32_t selSubDetId_ = ((selDetId_>>25)&0x7);
00099 SiStripSubStructure substructure_;
00100
00101 std::vector<uint32_t> sameLayerDetIds_;
00102 sameLayerDetIds_.clear();
00103
00104
00105 if (SummaryOnStringLevel_On_) {
00106
00107 hSummary_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getStringNameAndId(selDetId_).first, "") ;
00108 std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = selMEsMap_.find(getStringNameAndId(selDetId_).second);
00109
00110 ModMEs selME_;
00111 selME_ =selMEsMapIter_->second;
00112
00113 getSummaryMEs(selME_,selDetId_ );
00114
00115
00116 sameLayerDetIds_.clear();
00117
00118 if(selSubDetId_==3){
00119 if(TIBDetId(selDetId_).isInternalString()){
00120 substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_, TIBDetId(selDetId_).layerNumber(),0,1,TIBDetId(selDetId_).stringNumber());
00121 }
00122 if(TIBDetId(selDetId_).isExternalString()){
00123 substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_, TIBDetId(selDetId_).layerNumber(),0,2,TIBDetId(selDetId_).stringNumber());
00124 }
00125 }
00126 else if(selSubDetId_==4){
00127 substructure_.getTIDDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0);
00128 }
00129 else if(selSubDetId_==5){
00130 substructure_.getTOBDetectors(activeDetIds, sameLayerDetIds_, TOBDetId(selDetId_).layerNumber(),0,TOBDetId(selDetId_).rodNumber());
00131 }
00132 else if(selSubDetId_==6){
00133 substructure_.getTECDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0,0,0);
00134 }
00135
00136
00137
00138 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00139 try{
00140 selME_.SummaryOfProfileDistr->Fill(i+1,lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
00141 }
00142 catch(cms::Exception& e){
00143 edm::LogError("SiStripLorentzAngleDQM")
00144 << "[SiStripLorentzAngleDQM::fillMEsForLayer] cms::Exception accessing lorentzangleHandle_->getLorentzAngle() for detId "
00145 << selDetId_
00146 << " : "
00147 << e.what() ;
00148 }
00149 }
00150
00151 std::string hSummaryOfCumul_description;
00152 hSummaryOfCumul_description = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
00153
00154 std::string hSummaryOfCumul_name;
00155
00156 if( subDetId_<3 || subDetId_>6 ){
00157 edm::LogError("SiStripLorentzAngleDQM")
00158 << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
00159 << subDetId_ << " no folder set!"
00160 << std::endl;
00161 return;
00162 }
00163
00164 hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getStringNameAndId(selDetId_).first, "") ;
00165
00166 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00167 try{
00168 selME_.SummaryOfCumulDistr->Fill(lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
00169 }
00170 catch(cms::Exception& e){
00171 edm::LogError("SiStripLorentzAngleDQM")
00172 << "[SiStripLorentzAngleDQM::fillMEsForLayer] cms::Exception accessing lorentzangleHandle_->getLorentzAngle() for detId "
00173 << selDetId_
00174 << " : "
00175 << e.what() ;
00176 }
00177 }
00178 }
00179
00180
00181 else {
00182
00183 std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = selMEsMap_.find(getLayerNameAndId(selDetId_).second);
00184
00185 ModMEs selME_;
00186 selME_ =selMEsMapIter_->second;
00187
00188 getSummaryMEs(selME_,selDetId_ );
00189
00190 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
00191
00192 hSummary_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_).first, "") ;
00193
00194
00195 sameLayerDetIds_.clear();
00196
00197 sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_);
00198
00199 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00200 try{
00201 selME_.SummaryOfProfileDistr->Fill(i+1,lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
00202 }
00203 catch(cms::Exception& e){
00204 edm::LogError("SiStripLorentzAngleDQM")
00205 << "[SiStripLorentzAngleDQM::fillMEsForLayer] cms::Exception accessing lorentzangleHandle_->getLorentzAngle() for detId "
00206 << selDetId_
00207 << " : "
00208 << e.what() ;
00209 }
00210 }
00211 }
00212
00213 if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")){
00214
00215 std::string hSummaryOfCumul_description;
00216 hSummaryOfCumul_description = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
00217
00218 std::string hSummaryOfCumul_name;
00219
00220 if( subDetId_<3 || subDetId_>6 ){
00221 edm::LogError("SiStripLorentzAngleDQM")
00222 << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
00223 << subDetId_ << " no folder set!"
00224 << std::endl;
00225 return;
00226 }
00227
00228 hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getLayerNameAndId(selDetId_).first, "") ;
00229
00230 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00231 try{
00232 selME_.SummaryOfCumulDistr->Fill(lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
00233 }
00234 catch(cms::Exception& e){
00235 edm::LogError("SiStripLorentzAngleDQM")
00236 << "[SiStripLorentzAngleDQM::fillMEsForLayer] cms::Exception accessing lorentzangleHandle_->getLorentzAngle() for detId "
00237 << selDetId_
00238 << " : "
00239 << e.what() ;
00240 }
00241 }
00242 }
00243 }
00244
00245 }
00246
00247