00001 #include "DQM/SiStripMonitorSummary/interface/SiStripBaseCondObjDQM.h"
00002
00003 #include "TCanvas.h"
00004
00005
00006
00007
00008
00009 SiStripBaseCondObjDQM::SiStripBaseCondObjDQM(const edm::EventSetup & eSetup,
00010 edm::ParameterSet const& hPSet,
00011 edm::ParameterSet const& fPSet ):
00012 eSetup_(eSetup),
00013 hPSet_(hPSet),
00014 fPSet_(fPSet),
00015 cacheID_memory(0),
00016 dqmStore_(edm::Service<DQMStore>().operator->()){
00017
00018 reader = new SiStripDetInfoFileReader(edm::FileInPath(std::string("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat") ).fullPath());
00019
00020 Mod_On_ = fPSet_.getParameter<bool>("Mod_On");
00021 HistoMaps_On_ = fPSet_.getParameter<bool>("HistoMaps_On");
00022 SummaryOnLayerLevel_On_ = fPSet_.getParameter<bool>("SummaryOnLayerLevel_On");
00023 SummaryOnStringLevel_On_ = fPSet_.getParameter<bool>("SummaryOnStringLevel_On");
00024
00025 GrandSummary_On_ = fPSet_.getParameter<bool>("GrandSummary_On");
00026
00027 CondObj_fillId_ = hPSet_.getParameter<std::string>("CondObj_fillId");
00028 CondObj_name_ = hPSet_.getParameter<std::string>("CondObj_name");
00029
00030
00031
00032 if(SummaryOnLayerLevel_On_ && SummaryOnStringLevel_On_){
00033 edm::LogWarning("SiStripBaseCondObjDQM")
00034 << "[SiStripBaseCondObjDQM::SiStripBaseCondObjDQMs] PLEASE CHECK : String and layer level options can not be activated together"
00035 << std::endl;
00036 }
00037
00038
00039 if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) bookTkMap(hPSet_.getParameter<std::string>("TkMapName"));
00040
00041
00042 minValue=hPSet_.getParameter<double>("minValue");
00043 maxValue=hPSet_.getParameter<double>("maxValue");
00044
00045 }
00046
00047
00048
00049
00050
00051 void SiStripBaseCondObjDQM::analysis(const edm::EventSetup & eSetup_){
00052
00053 cacheID_current= getCache(eSetup_);
00054
00055 if (cacheID_memory == cacheID_current) return;
00056
00057 getConditionObject(eSetup_);
00058
00059
00060 if(fPSet_.getParameter<bool>("ActiveDetIds_On") || hPSet_.getParameter<bool>("ActiveDetIds_On"))
00061 getActiveDetIds(eSetup_);
00062 else
00063 activeDetIds=reader->getAllDetIds();
00064
00065 selectModules(activeDetIds);
00066
00067 if(Mod_On_ ) { fillModMEs(activeDetIds, eSetup_); }
00068 if(SummaryOnLayerLevel_On_ || SummaryOnStringLevel_On_ ){ fillSummaryMEs(activeDetIds, eSetup_);}
00069
00070 std::string filename = hPSet_.getParameter<std::string>("TkMapName");
00071 if (filename!=""){
00072 char sRun[128];
00073 sprintf(sRun,"_Run_%d",eSetup_.iovSyncValue().eventID().run());
00074 filename.insert(filename.find("."),sRun);
00075
00076 saveTkMap(filename.c_str(), minValue, maxValue);
00077 }
00078 }
00079
00080
00081
00082
00083
00084 void SiStripBaseCondObjDQM::analysisOnDemand(const edm::EventSetup & eSetup_,
00085 std::string requestedSubDetector,
00086 uint32_t requestedSide,
00087 uint32_t requestedLayer){
00088
00089 getConditionObject(eSetup_);
00090 getActiveDetIds(eSetup_);
00091
00092 std::vector<uint32_t> requestedDetIds_;
00093 requestedDetIds_.clear();
00094
00095 SiStripSubStructure substructure_;
00096
00097 if(requestedSubDetector=="TIB"){
00098 substructure_.getTIBDetectors( activeDetIds, requestedDetIds_, requestedLayer,0,0,0);
00099 }
00100 else if(requestedSubDetector=="TID"){
00101 substructure_.getTIDDetectors( activeDetIds, requestedDetIds_, requestedSide,requestedLayer,0,0);
00102 }
00103 else if(requestedSubDetector=="TOB"){
00104 substructure_.getTOBDetectors( activeDetIds, requestedDetIds_, requestedLayer,0,0);
00105 }
00106 else if(requestedSubDetector=="TEC"){
00107 substructure_.getTECDetectors( activeDetIds, requestedDetIds_, requestedSide,requestedLayer,0,0,0,0);
00108 }
00109
00110 analysisOnDemand(eSetup_,requestedDetIds_);
00111
00112 }
00113
00114
00115
00116
00117 void SiStripBaseCondObjDQM::analysisOnDemand(const edm::EventSetup & eSetup_, uint32_t detIdOnDemand){
00118
00119 unsigned long long cacheID_current= getCache(eSetup_);
00120
00121 if (cacheID_memory == cacheID_current) return;
00122
00123 getConditionObject(eSetup_);
00124
00125 std::vector<uint32_t> vdetIdsOnDemand_;
00126 vdetIdsOnDemand_.push_back(detIdOnDemand);
00127
00128 fillModMEs(vdetIdsOnDemand_, eSetup_);
00129
00130 }
00131
00132
00133
00134 void SiStripBaseCondObjDQM::analysisOnDemand(const edm::EventSetup & eSetup_, const std::vector<uint32_t>& detIdsOnDemand){
00135
00136 unsigned long long cacheID_current= getCache(eSetup_);
00137
00138 if (cacheID_memory == cacheID_current) return;
00139
00140 getConditionObject(eSetup_);
00141
00142
00143 fillSummaryMEs(detIdsOnDemand, eSetup_);
00144
00145 }
00146
00147
00148
00149 std::vector<uint32_t> SiStripBaseCondObjDQM::getCabledModules() {
00150
00151 std::vector<uint32_t> cabledDetIds_;
00152 eSetup_.get<SiStripDetCablingRcd>().get(detCablingHandle_);
00153 detCablingHandle_->addActiveDetectorsRawIds(cabledDetIds_);
00154
00155 return cabledDetIds_;
00156
00157 }
00158
00159
00160
00161
00162
00163
00164
00165
00166 void SiStripBaseCondObjDQM::selectModules(std::vector<uint32_t> & detIds_){
00167
00168 ModulesToBeExcluded_ = fPSet_.getParameter< std::vector<unsigned int> >("ModulesToBeExcluded");
00169 ModulesToBeIncluded_ = fPSet_.getParameter< std::vector<unsigned int> >("ModulesToBeIncluded");
00170 SubDetectorsToBeExcluded_= fPSet_.getParameter< std::vector<std::string> >("SubDetectorsToBeExcluded");
00171
00172
00173
00174 std::sort(ModulesToBeExcluded_.begin(),ModulesToBeExcluded_.end());
00175 std::sort(ModulesToBeIncluded_.begin(),ModulesToBeIncluded_.end());
00176
00177 if(fPSet_.getParameter<bool>("restrictModules")
00178 && ModulesToBeExcluded_.size()==0
00179 && ModulesToBeIncluded_.size()==0 ){
00180 edm::LogWarning("SiStripBaseCondObjDQM")
00181 << "[SiStripBaseCondObjDQM::selectModules] PLEASE CHECK : no modules to be exclude/included in your cfg"
00182 << std::endl;
00183 }
00184
00185
00186
00187
00188
00189
00190 if( fPSet_.getParameter<bool>("restrictModules")){
00191
00192 if( ModulesToBeIncluded_.size()>0 ){
00193 std::vector<uint32_t> tmp;
00194 tmp.clear();
00195 set_intersection( detIds_.begin(), detIds_.end(),
00196 ModulesToBeIncluded_.begin(), ModulesToBeIncluded_.end(),
00197 inserter(tmp,tmp.begin()));
00198 swap(detIds_,tmp);
00199 }
00200
00201 }
00202
00203
00204
00205
00206
00207
00208 if( fPSet_.getParameter<bool>("restrictModules") ){
00209
00210 std::sort(detIds_.begin(),detIds_.end());
00211
00212 for( std::vector<uint32_t>::const_iterator modIter_ = ModulesToBeExcluded_.begin();
00213 modIter_ != ModulesToBeExcluded_.end(); modIter_++){
00214
00215 std::vector<uint32_t>::iterator detIter_=std::lower_bound(detIds_.begin(),detIds_.end(),*modIter_);
00216 detIds_.erase(detIter_);
00217 detIter_--;
00218
00219 }
00220
00221 }
00222
00223
00224
00225
00226
00227
00228
00229 if( *(SubDetectorsToBeExcluded_.begin()) !="none" ){
00230
00231 std::vector<uint32_t> tmp;
00232
00233 SiStripSubStructure substructure_;
00234
00235 for( std::vector<std::string>::const_iterator modIter_ = SubDetectorsToBeExcluded_.begin();
00236 modIter_ != SubDetectorsToBeExcluded_.end(); modIter_++){
00237 tmp.clear();
00238
00239 if (*modIter_=="TIB") { substructure_.getTIBDetectors(detIds_, tmp, 0,0,0,0);}
00240 else if (*modIter_=="TOB") { substructure_.getTOBDetectors(detIds_, tmp, 0,0,0);}
00241 else if (*modIter_=="TID") { substructure_.getTIDDetectors(detIds_, tmp, 0,0,0,0);}
00242 else if (*modIter_=="TEC") { substructure_.getTECDetectors(detIds_, tmp, 0,0,0,0,0,0);}
00243 else {
00244 edm::LogWarning("SiStripBaseCondObjDQM")
00245 << "[SiStripBaseCondObjDQM::selectModules] PLEASE CHECK : no correct (name) subdetector to be excluded in your cfg"
00246 << std::endl;
00247 }
00248
00249 std::vector<uint32_t>::iterator iterBegin_=std::lower_bound(detIds_.begin(),
00250 detIds_.end(),
00251 *min_element(tmp.begin(), tmp.end()));
00252
00253 std::vector<uint32_t>::iterator iterEnd_=std::lower_bound(detIds_.begin(),
00254 detIds_.end(),
00255 *max_element(tmp.begin(), tmp.end()));
00256
00257 for(std::vector<uint32_t>::iterator detIter_ = iterEnd_;
00258 detIter_!= iterBegin_-1;detIter_--){
00259 detIds_.erase(detIter_);
00260 }
00261
00262 }
00263 }
00264
00265
00266
00267
00268
00269 if(fPSet_.getParameter<std::string>("ModulesToBeFilled") == "onlyOneModulePerLayer"){
00270
00271 std::vector<uint32_t> tmp;
00272 std::vector<uint32_t> layerDetIds;
00273
00274 SiStripSubStructure substructure_;
00275
00276 for(unsigned int i=1; i<5 ; i++){
00277 tmp.clear();
00278 substructure_.getTIBDetectors(detIds_, tmp, i,0,0,0);
00279 if(tmp.size() !=0) { layerDetIds.push_back(*(tmp.begin()));}
00280 }
00281 for(unsigned int i=1; i<7 ; i++){
00282 tmp.clear();
00283 substructure_.getTOBDetectors(detIds_, tmp, i,0,0);
00284 if(tmp.size() !=0) { layerDetIds.push_back(*(tmp.begin()));}
00285 }
00286 for(unsigned int i=1; i<4 ; i++){
00287 tmp.clear();
00288 substructure_.getTIDDetectors(detIds_, tmp, 1,i,0,0);
00289 if(tmp.size() !=0) { layerDetIds.push_back(*(tmp.begin()));}
00290 substructure_.getTIDDetectors(detIds_, tmp, 2,i,0,0);
00291 if(tmp.size() !=0) { layerDetIds.push_back(*(tmp.begin()));}
00292 }
00293 for(unsigned int i=1; i<10 ; i++){
00294 tmp.clear();
00295 substructure_.getTECDetectors(detIds_, tmp, 1,i,0,0,0,0);
00296 if(tmp.size() !=0) { layerDetIds.push_back(*(tmp.begin()));}
00297 substructure_.getTECDetectors(detIds_, tmp, 2,i,0,0,0,0);
00298 if(tmp.size() !=0) { layerDetIds.push_back(*(tmp.begin()));}
00299 }
00300
00301 detIds_.clear();
00302 detIds_=layerDetIds;
00303
00304 }
00305
00306
00307
00308 }
00309
00310
00311
00312
00313
00314 void SiStripBaseCondObjDQM::getModMEs(ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00315
00316 std::map< uint32_t, ModMEs >::const_iterator ModMEsMap_iter = ModMEsMap_.find(detId_);
00317
00318 if (ModMEsMap_iter != ModMEsMap_.end()){
00319
00320 CondObj_ME=ModMEsMap_iter->second;
00321
00322 if( ( CondObj_fillId_ =="ProfileAndCumul" || CondObj_fillId_ =="onlyProfile") && CondObj_ME.ProfileDistr ) {
00323 CondObj_ME.ProfileDistr ->Reset();
00324 }
00325
00326 if( (CondObj_fillId_ =="ProfileAndCumul" || CondObj_fillId_ =="onlyCumul" ) && CondObj_ME.CumulDistr ){
00327 CondObj_ME.CumulDistr ->Reset();
00328 }
00329 else {
00330 edm::LogWarning("SiStripBaseCondObjDQM")
00331 << "[SiStripBaseCondObjDQM::getModMEs] PLEASE CHECK : CondObj_fillId option mispelled";
00332 }
00333 return;
00334
00335 }
00336
00337
00338 if ( (CondObj_fillId_ =="ProfileAndCumul" || CondObj_fillId_ =="onlyProfile")) {
00339 bookProfileMEs(CondObj_ME,detId_,tTopo);
00340 }
00341
00342
00343 if( (CondObj_fillId_ =="ProfileAndCumul" || CondObj_fillId_ =="onlyCumul" )
00344 &&(CondObj_name_ == "noise" || CondObj_name_ == "apvgain") ) bookCumulMEs(CondObj_ME,detId_,tTopo);
00345
00346
00347 ModMEsMap_.insert( std::make_pair(detId_,CondObj_ME) );
00348
00349 }
00350
00351
00352
00353
00354
00355 void SiStripBaseCondObjDQM::getSummaryMEs(ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00356
00357 std::map<uint32_t, ModMEs>::const_iterator SummaryMEsMap_iter;
00358
00359 if(CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_ ){
00360 SummaryMEsMap_iter = SummaryMEsMap_.find(getStringNameAndId(detId_,tTopo).second);
00361 }
00362 else {
00363 SummaryMEsMap_iter = SummaryMEsMap_.find(getLayerNameAndId(detId_,tTopo).second);
00364 }
00365
00366 if (SummaryMEsMap_iter != SummaryMEsMap_.end()){ return;}
00367
00368
00369
00370
00371 if( (CondObj_fillId_ =="ProfileAndCumul" || CondObj_fillId_ =="onlyProfile" ) &&
00372 (
00373 CondObj_name_ == "pedestal" ||
00374 CondObj_name_ == "noise" ||
00375 CondObj_name_ == "lowthreshold" ||
00376 CondObj_name_ == "highthreshold" ||
00377 CondObj_name_ == "apvgain" ||
00378 CondObj_name_ == "lorentzangle") ) {
00379 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel"))
00380 if (!CondObj_ME.SummaryOfProfileDistr) { bookSummaryProfileMEs(CondObj_ME,detId_,tTopo); }
00381 }
00382
00383
00384 if( (CondObj_fillId_ =="ProfileAndCumul" || CondObj_fillId_ =="onlyCumul" ) &&
00385 (
00386 CondObj_name_ == "lorentzangle" ||
00387 CondObj_name_ == "noise") ) {
00388 if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel"))
00389 if (!CondObj_ME.SummaryOfCumulDistr) { bookSummaryCumulMEs(CondObj_ME,detId_,tTopo); }
00390 }
00391
00392
00393 if( CondObj_name_ == "noise" ||
00394 CondObj_name_ == "lowthreshold" ||
00395 CondObj_name_ == "highthreshold" ||
00396 CondObj_name_ == "apvgain" ||
00397 CondObj_name_ == "pedestal" ||
00398 CondObj_name_ == "quality" ) {
00399 if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel"))
00400 if (!CondObj_ME.SummaryDistr) { bookSummaryMEs(CondObj_ME,detId_,tTopo); }
00401
00402 }
00403
00404 if(CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) {
00405
00406 SummaryMEsMap_.insert( std::make_pair(getStringNameAndId(detId_,tTopo).second,CondObj_ME) );
00407 }
00408 else {
00409 SummaryMEsMap_.insert( std::make_pair(getLayerNameAndId(detId_,tTopo).second,CondObj_ME) );
00410 }
00411
00412 }
00413
00414
00415
00416
00417 void SiStripBaseCondObjDQM::bookProfileMEs(SiStripBaseCondObjDQM::ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00418
00419 int hProfile_NchX = 0;
00420 double hProfile_LowX = 0;
00421 double hProfile_HighX = 0;
00422
00423 std::string hProfile_description;
00424 hProfile_description = hPSet_.getParameter<std::string>("Profile_description");
00425
00426 std::string hProfile_xTitle, hProfile_yTitle;
00427 hProfile_xTitle = hPSet_.getParameter<std::string>("Profile_xTitle");
00428 hProfile_yTitle = hPSet_.getParameter<std::string>("Profile_yTitle");
00429
00430 if( CondObj_name_!= "apvgain" ){
00431
00432 int nStrip = reader->getNumberOfApvsAndStripLength(detId_).first*128;
00433
00434 hProfile_NchX = nStrip;
00435 hProfile_LowX = 0.5;
00436 hProfile_HighX = nStrip+0.5;
00437 }
00438 else {
00439
00440 int nApv = reader->getNumberOfApvsAndStripLength(detId_).first;
00441
00442 hProfile_NchX = nApv;
00443 hProfile_LowX = 0.5;
00444 hProfile_HighX = nApv+0.5;
00445 }
00446
00447 folder_organizer.setDetectorFolder(detId_,tTopo);
00448
00449 std::string hProfile_Name;
00450 hProfile_Name = hidmanager.createHistoId(hProfile_description, "det", detId_);
00451
00452 std::string hProfile;
00453 hProfile = hProfile_Name ;
00454
00455 CondObj_ME.ProfileDistr = dqmStore_->book1D(hProfile_Name, hProfile, hProfile_NchX, hProfile_LowX, hProfile_HighX);
00456 CondObj_ME.ProfileDistr->setAxisTitle(hProfile_xTitle,1);
00457 CondObj_ME.ProfileDistr->setAxisTitle(hProfile_yTitle,2);
00458 dqmStore_->tag(CondObj_ME.ProfileDistr, detId_);
00459
00460 }
00461
00462
00463
00464
00465
00466 void SiStripBaseCondObjDQM::bookCumulMEs(SiStripBaseCondObjDQM::ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00467
00468 int hCumul_NchX = 0;
00469 double hCumul_LowX = 0;
00470 double hCumul_HighX = 0;
00471
00472 std::string hCumul_description;
00473 hCumul_description = hPSet_.getParameter<std::string>("Cumul_description");
00474
00475 std::string hCumul_xTitle, hCumul_yTitle;
00476 hCumul_xTitle = hPSet_.getParameter<std::string>("Cumul_xTitle");
00477 hCumul_yTitle = hPSet_.getParameter<std::string>("Cumul_yTitle");
00478
00479 hCumul_NchX = hPSet_.getParameter<int>("Cumul_NchX");
00480 hCumul_LowX = hPSet_.getParameter<double>("Cumul_LowX");
00481 hCumul_HighX = hPSet_.getParameter<double>("Cumul_HighX");
00482
00483 folder_organizer.setDetectorFolder(detId_,tTopo);
00484
00485 std::string hCumul_name;
00486 hCumul_name = hidmanager.createHistoId(hCumul_description , "det", detId_); ;
00487
00488 std::string hCumul_title;
00489 hCumul_title = hCumul_name ;
00490
00491 CondObj_ME.CumulDistr = dqmStore_->book1D(hCumul_name,
00492 hCumul_title,
00493 hCumul_NchX,
00494 hCumul_LowX,
00495 hCumul_HighX);
00496 CondObj_ME.CumulDistr->setAxisTitle(hCumul_xTitle,1);
00497 CondObj_ME.CumulDistr->setAxisTitle(hCumul_yTitle,2);
00498 dqmStore_->tag(CondObj_ME.CumulDistr, detId_);
00499
00500 }
00501
00502
00503
00504
00505
00506
00507 void SiStripBaseCondObjDQM::bookSummaryProfileMEs(SiStripBaseCondObjDQM::ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00508
00509 std::vector<uint32_t> sameLayerDetIds_;
00510
00511 int hSummaryOfProfile_NchX = 0;
00512 double hSummaryOfProfile_LowX = 0;
00513 double hSummaryOfProfile_HighX = 0;
00514
00515 std::string hSummaryOfProfile_description;
00516 hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
00517
00518 std::string hSummaryOfProfile_xTitle, hSummaryOfProfile_yTitle;
00519 hSummaryOfProfile_xTitle = hPSet_.getParameter<std::string>("SummaryOfProfile_xTitle");
00520 hSummaryOfProfile_yTitle = hPSet_.getParameter<std::string>("SummaryOfProfile_yTitle");
00521
00522 int hSummaryOfProfile_NchY;
00523 double hSummaryOfProfile_LowY, hSummaryOfProfile_HighY;
00524 hSummaryOfProfile_NchY = hPSet_.getParameter<int>("SummaryOfProfile_NchY");
00525 hSummaryOfProfile_LowY = hPSet_.getParameter<double>("SummaryOfProfile_LowY");
00526 hSummaryOfProfile_HighY = hPSet_.getParameter<double>("SummaryOfProfile_HighY");
00527
00528 int nStrip, nApv, layerId_;
00529
00530 if(CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) { layerId_= getStringNameAndId(detId_,tTopo).second;}
00531 else { layerId_= getLayerNameAndId(detId_,tTopo).second;}
00532
00533
00534 if( CondObj_name_ == "pedestal" || CondObj_name_ == "noise"|| CondObj_name_ == "lowthreshold" || CondObj_name_ == "highthreshold" ){
00535
00536 if( (layerId_ > 610 && layerId_ < 620) ||
00537 (layerId_ > 620 && layerId_ < 630) ||
00538 (layerId_ > 410 && layerId_ < 414) ||
00539 (layerId_ > 420 && layerId_ < 424) ){ nStrip =768;}
00540 else { nStrip = reader->getNumberOfApvsAndStripLength(detId_).first*128;}
00541
00542 hSummaryOfProfile_NchX = nStrip;
00543 hSummaryOfProfile_LowX = 0.5;
00544 hSummaryOfProfile_HighX = nStrip+0.5;
00545
00546 }
00547 else if( (CondObj_name_ == "lorentzangle" && SummaryOnLayerLevel_On_) || CondObj_name_ == "quality"){
00548
00549
00550
00551
00552 uint32_t subDetId_ = ((detId_>>25)&0x7);
00553 SiStripSubStructure substructure_;
00554
00555 sameLayerDetIds_.clear();
00556
00557 if(subDetId_==3){
00558 substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_,tTopo->tibLayer(detId_),0,0,tTopo->tibString(detId_));
00559 }
00560 else if(subDetId_==4){
00561 substructure_.getTIDDetectors(activeDetIds, sameLayerDetIds_,0,0,0,0);
00562 }
00563 else if(subDetId_==5){
00564 substructure_.getTOBDetectors(activeDetIds, sameLayerDetIds_, tTopo->tobLayer(detId_),0,0);
00565 }
00566 else if(subDetId_==6){
00567 substructure_.getTECDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0,0,0);
00568 }
00569
00570 hSummaryOfProfile_NchX = sameLayerDetIds_.size();
00571 hSummaryOfProfile_LowX = 0.5;
00572 hSummaryOfProfile_HighX = sameLayerDetIds_.size()+0.5;
00573
00574 }
00575 else if( CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_){
00576
00577
00578
00579
00580 uint32_t subDetId_ = ((detId_>>25)&0x7);
00581 SiStripSubStructure substructure_;
00582
00583 sameLayerDetIds_.clear();
00584
00585 if(subDetId_==3){
00586 if(tTopo->tibIsInternalString(detId_)){
00587 substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_, tTopo->tibLayer(detId_),0,1,tTopo->tibString(detId_)); }
00588 else if(tTopo->tibIsExternalString(detId_)){
00589 substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_, tTopo->tibLayer(detId_),0,2,tTopo->tibString(detId_)); }
00590 }
00591 else if(subDetId_==4){
00592 substructure_.getTIDDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0);
00593 }
00594 else if(subDetId_==5){
00595 substructure_.getTOBDetectors(activeDetIds, sameLayerDetIds_, tTopo->tobLayer(detId_),0,tTopo->tobRod(detId_));
00596 }
00597 else if(subDetId_==6){
00598 substructure_.getTECDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0,0,0);
00599 }
00600
00601
00602 hSummaryOfProfile_NchX = sameLayerDetIds_.size();
00603 hSummaryOfProfile_LowX = 0.5;
00604 hSummaryOfProfile_HighX = sameLayerDetIds_.size()+0.5;
00605
00606 }
00607 else if( CondObj_name_ == "apvgain"){
00608
00609 if( (layerId_ > 610 && layerId_ < 620) ||
00610 (layerId_ > 620 && layerId_ < 630) ||
00611 (layerId_ > 410 && layerId_ < 414) ||
00612 (layerId_ > 420 && layerId_ < 424) ){ nApv =6;}
00613 else { nApv = reader->getNumberOfApvsAndStripLength(detId_).first;}
00614
00615 hSummaryOfProfile_NchX = nApv;
00616 hSummaryOfProfile_LowX = 0.5;
00617 hSummaryOfProfile_HighX = nApv+0.5;
00618
00619 }
00620 else {
00621 edm::LogWarning("SiStripBaseCondObjDQM")
00622 << "[SiStripBaseCondObjDQM::bookSummaryProfileMEs] PLEASE CHECK : x-axis label in your cfg"
00623 << std::endl;
00624 }
00625
00626 uint32_t layer_=0;
00627
00628 layer_ = folder_organizer.GetSubDetAndLayer(detId_, tTopo).second;
00629
00630 folder_organizer.setLayerFolder(detId_,tTopo,layer_);
00631
00632 std::string hSummaryOfProfile_name;
00633
00634
00635 int subdetectorId_ = ((detId_>>25)&0x7);
00636
00637
00638 if( subdetectorId_<3 ||subdetectorId_>6 ){
00639 edm::LogError("SiStripBaseCondObjDQM")
00640 << "[SiStripBaseCondObjDQM::bookSummaryProfileMEs] WRONG INPUT : no such subdetector type : "
00641 << subdetectorId_ << " no folder set!"
00642 << std::endl;
00643 return;
00644 }
00645
00646
00647 if(CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) {
00648 hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer" , getStringNameAndId(detId_,tTopo).first,"") ;
00649 }
00650 else {
00651 hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer" , getLayerNameAndId(detId_,tTopo).first,"") ;
00652 }
00653
00654 std::string hSummaryOfProfile_title;
00655 hSummaryOfProfile_title = hSummaryOfProfile_name ;
00656
00657 CondObj_ME.SummaryOfProfileDistr = dqmStore_->bookProfile(hSummaryOfProfile_name,
00658 hSummaryOfProfile_title,
00659 hSummaryOfProfile_NchX,
00660 hSummaryOfProfile_LowX,
00661 hSummaryOfProfile_HighX,
00662 hSummaryOfProfile_NchY,
00663 0.,
00664 0.);
00665
00666
00667 CondObj_ME.SummaryOfProfileDistr->setAxisTitle(hSummaryOfProfile_xTitle,1);
00668 CondObj_ME.SummaryOfProfileDistr->setAxisTitle(hSummaryOfProfile_yTitle,2);
00669 CondObj_ME.SummaryOfProfileDistr->setAxisRange(hSummaryOfProfile_LowY, hSummaryOfProfile_HighY,2);
00670
00671
00672
00673
00674 if( CondObj_name_ == "quality" ){
00675
00676 unsigned int iBin=0;
00677
00678 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00679
00680 iBin++;
00681 char sameLayerDetIds_Name[1024];
00682 sprintf(sameLayerDetIds_Name,"%u",sameLayerDetIds_[i]);
00683 CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, sameLayerDetIds_Name);
00684
00685 }
00686 }
00687 if( CondObj_name_ == "lorentzangle"){
00688
00689
00690 reverse(sameLayerDetIds_.begin(), sameLayerDetIds_.begin()+sameLayerDetIds_.size()/2);
00691
00692 unsigned int iBin=0;
00693 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00694 iBin++;
00695 if (!SummaryOnStringLevel_On_){
00696
00697 CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, "");
00698 }
00699
00700 if (SummaryOnStringLevel_On_){
00701
00702 char sameLayerDetIds_Name[1024];
00703 if(subdetectorId_==3){
00704 if(tTopo->tibIsZPlusSide(sameLayerDetIds_[i])){
00705 sprintf(sameLayerDetIds_Name,"%i",tTopo->tibModule(sameLayerDetIds_[i]));}
00706 else if(tTopo->tibIsZMinusSide(sameLayerDetIds_[i])){
00707 sprintf(sameLayerDetIds_Name,"%i",-tTopo->tibModule(sameLayerDetIds_[i]));}
00708 CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, sameLayerDetIds_Name);
00709 }
00710 else if(subdetectorId_==5){
00711 if(tTopo->tobIsZPlusSide(sameLayerDetIds_[i])) { sprintf(sameLayerDetIds_Name,"%i",tTopo->tobModule(sameLayerDetIds_[i]));}
00712 else if(tTopo->tobIsZMinusSide(sameLayerDetIds_[i])) { sprintf(sameLayerDetIds_Name,"%i",-tTopo->tobModule(sameLayerDetIds_[i]));}
00713 CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, sameLayerDetIds_Name);
00714 }
00715 }
00716 }
00717
00718
00719
00720
00721
00722
00723 dqmStore_->tag(CondObj_ME.SummaryOfProfileDistr, layer_);
00724
00725 }
00726
00727 }
00728
00729
00730
00731
00732
00733 void SiStripBaseCondObjDQM::bookSummaryCumulMEs(SiStripBaseCondObjDQM::ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00734
00735 int hSummaryOfCumul_NchX = 0;
00736 double hSummaryOfCumul_LowX = 0;
00737 double hSummaryOfCumul_HighX = 0;
00738
00739 std::string hSummaryOfCumul_description;
00740 hSummaryOfCumul_description = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
00741
00742 std::string hSummaryOfCumul_xTitle, hSummaryOfCumul_yTitle;
00743 hSummaryOfCumul_xTitle = hPSet_.getParameter<std::string>("SummaryOfCumul_xTitle");
00744 hSummaryOfCumul_yTitle = hPSet_.getParameter<std::string>("SummaryOfCumul_yTitle");
00745
00746 hSummaryOfCumul_NchX = hPSet_.getParameter<int>("SummaryOfCumul_NchX");
00747 hSummaryOfCumul_LowX = hPSet_.getParameter<double>("SummaryOfCumul_LowX");
00748 hSummaryOfCumul_HighX = hPSet_.getParameter<double>("SummaryOfCumul_HighX");
00749
00750 uint32_t layer_=0;
00751
00752 layer_ = folder_organizer.GetSubDetAndLayer(detId_, tTopo).second;
00753
00754 folder_organizer.setLayerFolder(detId_,tTopo,layer_);
00755
00756 std::string hSummaryOfCumul_name;
00757
00758
00759 int subdetectorId_ = ((detId_>>25)&0x7);
00760
00761 if( subdetectorId_<3 || subdetectorId_>6 ){
00762 edm::LogError("SiStripBaseCondObjDQM")
00763 << "[SiStripBaseCondObjDQM::bookSummaryCumulMEs] WRONG INPUT : no such subdetector type : "
00764 << subdetectorId_ << " no folder set!"
00765 << std::endl;
00766 return;
00767 }
00768
00769
00770
00771 if(CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) {
00772 hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer" , getStringNameAndId(detId_,tTopo).first, "") ;
00773 }
00774 else {
00775 hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer" , getLayerNameAndId(detId_,tTopo).first, "") ;
00776 }
00777
00778
00779 std::string hSummaryOfCumul_title;
00780 hSummaryOfCumul_title = hSummaryOfCumul_name ;
00781
00782 CondObj_ME.SummaryOfCumulDistr = dqmStore_->book1D(hSummaryOfCumul_name,
00783 hSummaryOfCumul_title,
00784 hSummaryOfCumul_NchX,
00785 hSummaryOfCumul_LowX,
00786 hSummaryOfCumul_HighX);
00787
00788 CondObj_ME.SummaryOfCumulDistr->setAxisTitle(hSummaryOfCumul_xTitle,1);
00789 CondObj_ME.SummaryOfCumulDistr->setAxisTitle(hSummaryOfCumul_yTitle,2);
00790
00791 dqmStore_->tag(CondObj_ME.SummaryOfCumulDistr, layer_);
00792
00793 }
00794
00795
00796
00797
00798
00799 void SiStripBaseCondObjDQM::bookSummaryMEs(SiStripBaseCondObjDQM::ModMEs& CondObj_ME, const uint32_t& detId_, const TrackerTopology* tTopo){
00800
00801 std::vector<uint32_t> sameLayerDetIds_;
00802
00803 int hSummary_NchX = 0;
00804 double hSummary_LowX = 0;
00805 double hSummary_HighX = 0;
00806
00807 std::string hSummary_description;
00808 hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
00809
00810 std::string hSummary_xTitle, hSummary_yTitle;
00811 hSummary_xTitle = hPSet_.getParameter<std::string>("Summary_xTitle");
00812 hSummary_yTitle = hPSet_.getParameter<std::string>("Summary_yTitle");
00813
00814 int hSummary_NchY;
00815 double hSummary_LowY, hSummary_HighY;
00816 hSummary_NchY = hPSet_.getParameter<int>("Summary_NchY");
00817 hSummary_LowY = hPSet_.getParameter<double>("Summary_LowY");
00818 hSummary_HighY = hPSet_.getParameter<double>("Summary_HighY");
00819
00820
00821
00822
00823
00824
00825 sameLayerDetIds_.clear();
00826
00827 sameLayerDetIds_=GetSameLayerDetId(activeDetIds,detId_,tTopo);
00828
00829 hSummary_NchX = sameLayerDetIds_.size();
00830 hSummary_LowX = 0.5;
00831 hSummary_HighX = sameLayerDetIds_.size()+0.5;
00832
00833 uint32_t layer_=0;
00834
00835 layer_ = folder_organizer.GetSubDetAndLayer(detId_, tTopo).second;
00836
00837 folder_organizer.setLayerFolder(detId_,tTopo,layer_);
00838
00839 std::string hSummary_name;
00840
00841
00842 int subdetectorId_ = ((detId_>>25)&0x7);
00843
00844
00845 if( subdetectorId_<3 ||subdetectorId_>6 ){
00846 edm::LogError("SiStripBaseCondObjDQM")
00847 << "[SiStripBaseCondObjDQM::bookSummaryMEs] WRONG INPUT : no such subdetector type : "
00848 << subdetectorId_ << " no folder set!"
00849 << std::endl;
00850 return;
00851 }
00852
00853
00854 hSummary_name = hidmanager.createHistoLayer(hSummary_description,
00855 "layer" ,
00856 getLayerNameAndId(detId_,tTopo).first,
00857 "") ;
00858
00859 std::string hSummary_title;
00860 hSummary_title = hSummary_name ;
00861
00862 CondObj_ME.SummaryDistr = dqmStore_->bookProfile(hSummary_name,
00863 hSummary_title,
00864 hSummary_NchX,
00865 hSummary_LowX,
00866 hSummary_HighX,
00867 hSummary_NchY,
00868 0.,
00869 0.);
00870
00871
00872 CondObj_ME.SummaryDistr->setAxisTitle(hSummary_xTitle,1);
00873 CondObj_ME.SummaryDistr->setAxisTitle(hSummary_yTitle,2);
00874 CondObj_ME.SummaryDistr->setAxisRange(hSummary_LowY, hSummary_HighY,2);
00875
00876
00877
00878 unsigned int iBin=0;
00879
00880 for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
00881
00882 iBin++;
00883 char sameLayerDetIds_Name[1024];
00884 sprintf(sameLayerDetIds_Name,"%u",sameLayerDetIds_[i]);
00885 if(iBin%100==0)
00886 CondObj_ME.SummaryDistr->setBinLabel(iBin, sameLayerDetIds_Name);
00887
00888 }
00889
00890
00891 dqmStore_->tag(CondObj_ME.SummaryDistr, layer_);
00892
00893 }
00894
00895
00896
00897
00898 std::pair<std::string,uint32_t> SiStripBaseCondObjDQM::getLayerNameAndId(const uint32_t& detId_, const TrackerTopology* tTopo){
00899
00900 int subdetectorId_ = ((detId_>>25)&0x7);
00901 int layerId_=0;
00902
00903 std::stringstream layerName;
00904
00905 if( subdetectorId_ == 3 ){
00906
00907 for( unsigned int i = 1; i < 5; i++ ){
00908 if( tTopo->tibLayer( detId_ ) ==i ){
00909 layerName << "TIB__layer__" << i;
00910 layerId_ = 300 + i;
00911 }
00912 }
00913
00914 }
00915
00916 else if( subdetectorId_ == 4 ){
00917
00918 if( tTopo->tidSide( detId_ ) == 1 ) {
00919
00920 for( unsigned int i = 1; i < 4; i++ ){
00921 if(tTopo->tidWheel(detId_)==i){
00922 layerName << "TID__side__1__wheel__" << i;
00923 layerId_ = 410 + i;
00924 }
00925 }
00926
00927 }
00928
00929 else if( tTopo->tidSide( detId_ ) == 2 ) {
00930
00931 for( unsigned int i = 1; i < 4; i++ ) {
00932 if(tTopo->tidWheel(detId_)==i){
00933 layerName << "TID__side__2__wheel__" << i;
00934 layerId_ = 420 + i;
00935 }
00936 }
00937
00938 }
00939
00940 }
00941
00942
00943 else if( subdetectorId_ == 5 ){
00944
00945 for( unsigned int i = 1; i < 7; i++ ) {
00946 if( tTopo->tobLayer( detId_ ) == i ) {
00947 layerName << "TOB__layer__" << i;
00948 layerId_ = 500 + i;
00949 }
00950 }
00951
00952 }
00953
00954 else if( subdetectorId_ == 6 ){
00955
00956 if( tTopo->tecSide( detId_ ) == 1) {
00957
00958 for( unsigned int i = 1; i < 10; i++ ) {
00959 if( tTopo->tecWheel( detId_ ) == i ) {
00960 layerName << "TEC__side__1__wheel__" << i;
00961 layerId_ = 610 + i;
00962 }
00963 }
00964
00965 }
00966
00967 else if( tTopo->tecSide( detId_ ) == 2 ) {
00968
00969 for( unsigned int i = 1; i < 10; i++ ) {
00970 if( tTopo->tecWheel( detId_ ) == i ) {
00971 layerName << "TEC__side__2__wheel__" << i;
00972 layerId_ = 620 + i;
00973 }
00974 }
00975
00976 }
00977 }
00978
00979 return std::make_pair( layerName.str(), layerId_ );
00980
00981 }
00982
00983
00984
00985
00986
00987 std::pair<std::string,uint32_t> SiStripBaseCondObjDQM::getStringNameAndId(const uint32_t& detId_, const TrackerTopology* tTopo){
00988
00989 int subdetectorId_ = ((detId_>>25)&0x7);
00990 int layerStringId_=0;
00991
00992 std::stringstream layerStringName;
00993
00994 if( subdetectorId_==3 ){
00995 if(tTopo->tibLayer(detId_)==1 && tTopo->tibIsInternalString(detId_)){
00996 for( unsigned int i=1; i < 27 ;i++){
00997 if(tTopo->tibString(detId_)==i){
00998 layerStringName << "TIB_L1_Int_Str_" << i;
00999 layerStringId_ = 30110+i;
01000 }
01001 }
01002 }
01003 else if(tTopo->tibLayer(detId_)==1 && tTopo->tibIsExternalString(detId_)){
01004 for( unsigned int i=1; i < 31 ;i++){
01005 if(tTopo->tibString(detId_)==i){
01006 layerStringName << "TIB_L1_Ext_Str_" << i;
01007 layerStringId_ = 301200+i;
01008 }
01009 }
01010 }
01011 else if(tTopo->tibLayer(detId_)==2 && tTopo->tibIsInternalString(detId_)){
01012 for( unsigned int i=1; i < 35 ;i++){
01013 if(tTopo->tibString(detId_)==i){
01014 layerStringName << "TIB_L2_Int_Str_" << i;
01015 layerStringId_ = 302100+i;
01016 }
01017 }
01018 }
01019 else if(tTopo->tibLayer(detId_)==2 && tTopo->tibIsExternalString(detId_)){
01020 for( unsigned int i=1; i < 39 ;i++){
01021 if(tTopo->tibString(detId_)==i){
01022 layerStringName << "TIB_L2_Ext_Str_" << i;
01023 layerStringId_ = 302200+i;
01024 }
01025 }
01026 }
01027 else if(tTopo->tibLayer(detId_)==3 && tTopo->tibIsInternalString(detId_)){
01028 for( unsigned int i=1; i < 45 ;i++){
01029 if(tTopo->tibString(detId_)==i){
01030 layerStringName << "TIB_L3_Int_Str_" << i;
01031 layerStringId_ = 303100+i;
01032 }
01033 }
01034 }
01035 else if(tTopo->tibLayer(detId_)==3 && tTopo->tibIsExternalString(detId_)){
01036 for( unsigned int i=1; i < 47 ;i++){
01037 if(tTopo->tibString(detId_)==i){
01038 layerStringName << "TIB_L3_Ext_Str_" << i;
01039 layerStringId_ = 303200+i;
01040 }
01041 }
01042 }
01043 else if(tTopo->tibLayer(detId_)==4 && tTopo->tibIsInternalString(detId_)){
01044 for( unsigned int i=1; i < 53 ;i++){
01045 if(tTopo->tibString(detId_)==i){
01046 layerStringName << "TIB_L4_Int_Str_" << i;
01047 layerStringId_ = 304100+i;
01048 }
01049 }
01050 }
01051 else if(tTopo->tibLayer(detId_)==4 && tTopo->tibIsExternalString(detId_)){
01052 for( unsigned int i=1; i < 57 ;i++){
01053 if(tTopo->tibString(detId_)==i){
01054 layerStringName << "TIB_L4_Ext_Str_" << i;
01055 layerStringId_ = 304200+i;
01056 }
01057 }
01058 }
01059 }
01060
01061
01062 else if( subdetectorId_==5 ){
01063 if(tTopo->tobLayer(detId_)==1){
01064 for( unsigned int i=1; i < 43 ;i++){
01065 if(tTopo->tobRod(detId_)==i){
01066 layerStringName << "TOB_L1_Rod_" << i;
01067 layerStringId_ = 50100+i;
01068 }
01069 }
01070 }
01071 else if(tTopo->tobLayer(detId_)==2){
01072 for( unsigned int i=1; i < 49 ;i++){
01073 if(tTopo->tobRod(detId_)==i){
01074 layerStringName << "TOB_L2_Rod_" << i;
01075 layerStringId_ = 50200+i;
01076 }
01077 }
01078 }
01079 else if(tTopo->tobLayer(detId_)==3){
01080 for( unsigned int i=1; i < 55 ;i++){
01081 if(tTopo->tobRod(detId_)==i){
01082 layerStringName << "TOB_L3_Rod_" << i;
01083 layerStringId_ = 50300+i;
01084 }
01085 }
01086 }
01087 else if(tTopo->tobLayer(detId_)==4){
01088 for( unsigned int i=1; i < 61 ;i++){
01089 if(tTopo->tobRod(detId_)==i){
01090 layerStringName << "TOB_L4_Rod_" << i;
01091 layerStringId_ = 50400+i;
01092 }
01093 }
01094 }
01095 else if(tTopo->tobLayer(detId_)==5){
01096 for( unsigned int i=1; i < 67 ;i++){
01097 if(tTopo->tobRod(detId_)==i){
01098 layerStringName << "TOB_L5_Rod_" << i;
01099 layerStringId_ = 50500+i;
01100 }
01101 }
01102 }
01103 else if(tTopo->tobLayer(detId_)==6){
01104 for( unsigned int i=1; i < 75 ;i++){
01105 if(tTopo->tobRod(detId_)==i){
01106 layerStringName << "TOB_L6_Rod_" << i;
01107 layerStringId_ = 50600+i;
01108 }
01109 }
01110 }
01111 }
01112
01113 return std::make_pair( layerStringName.str(), layerStringId_ );
01114
01115 }
01116
01117
01118
01119
01120
01121 std::vector<uint32_t> SiStripBaseCondObjDQM::GetSameLayerDetId(const std::vector<uint32_t>& activeDetIds,uint32_t selDetId, const TrackerTopology* tTopo){
01122
01123 std::vector<uint32_t> sameLayerDetIds;
01124 sameLayerDetIds.clear();
01125
01126 SiStripSubStructure substructure_;
01127
01128 uint32_t subselDetId_ = ((selDetId>>25)&0x7);
01129
01130 if(subselDetId_==3){
01131 substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds, tTopo->tibLayer(selDetId),0,0,0);
01132 }
01133 else if(subselDetId_==4){
01134 substructure_.getTIDDetectors(activeDetIds, sameLayerDetIds, tTopo->tidSide(selDetId),tTopo->tidWheel(selDetId),0,0);
01135 }
01136 else if(subselDetId_==5){
01137 substructure_.getTOBDetectors(activeDetIds, sameLayerDetIds, tTopo->tobLayer(selDetId),0,0);
01138 }
01139 else if(subselDetId_==6){
01140 substructure_.getTECDetectors(activeDetIds, sameLayerDetIds, tTopo->tecSide(selDetId),tTopo->tecWheel(selDetId),0,0,0,0);
01141 }
01142
01143 return sameLayerDetIds;
01144
01145 }
01146
01147
01148
01149 void SiStripBaseCondObjDQM::bookTkMap(const std::string& TkMapname){
01150 tkMap= new TrackerMap(TkMapname.c_str());
01151 }
01152
01153
01154 void SiStripBaseCondObjDQM::fillTkMap(const uint32_t& detid, const float& value){
01155 tkMap->fill(detid,value);
01156 }
01157
01158
01159 void SiStripBaseCondObjDQM::saveTkMap(const std::string& TkMapname, double minValue, double maxValue){
01160 if(tkMapScaler.size()!=0){
01161
01162 float th=hPSet_.getParameter<double>("saturatedFraction");
01163
01164 size_t imin=0,imax=0;
01165 float entries=0 ;
01166 for(size_t i=0;i<tkMapScaler.size();++i)
01167 entries+=tkMapScaler[i];
01168
01169 float min=0 ;
01170 for(size_t i=0;(i<tkMapScaler.size()) && (min<th);++i){
01171 min+=tkMapScaler[i]/entries;
01172 imin=i;
01173 }
01174
01175 float max=0;
01176
01177
01178
01179
01180 for(size_t j=tkMapScaler.size();(j>0) && (max<th);--j){
01181 size_t i = j - 1;
01182 max+=tkMapScaler[i]/entries;
01183 imax=i;
01184 }
01185
01186
01187 if(maxValue<imax){
01188 edm::LogInfo("")<< "Resetting TkMap maxValue from " << maxValue << " to " << imax;
01189 maxValue=imax;
01190 }
01191
01192 if(minValue>imin){
01193 edm::LogInfo("")<< "Resetting TkMap minValue from " << minValue << " to " << imin;
01194 minValue=imin;
01195 }
01196 }
01197
01198 tkMap->save(false, minValue, maxValue, TkMapname.c_str(),4500,2400);
01199 tkMap->setPalette(1); tkMap->showPalette(true);
01200
01201 }
01202
01203
01204
01205 void SiStripBaseCondObjDQM::end(){
01206 edm::LogInfo("SiStripBaseCondObjDQM")
01207 << "SiStripBase::end"
01208 << std::endl;
01209 }
01210
01211
01212 void SiStripBaseCondObjDQM::fillModMEs(const std::vector<uint32_t> & selectedDetIds, const edm::EventSetup& es){
01213
01214
01215 edm::ESHandle<TrackerTopology> tTopoHandle;
01216 es.get<IdealGeometryRecord>().get(tTopoHandle);
01217 const TrackerTopology* const tTopo = tTopoHandle.product();
01218
01219 ModMEs CondObj_ME;
01220
01221 for(std::vector<uint32_t>::const_iterator detIter_=selectedDetIds.begin();
01222 detIter_!=selectedDetIds.end();++detIter_){
01223 fillMEsForDet(CondObj_ME,*detIter_,tTopo);
01224 }
01225 }
01226
01227
01228 void SiStripBaseCondObjDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds, const edm::EventSetup& es){
01229
01230
01231 edm::ESHandle<TrackerTopology> tTopoHandle;
01232 es.get<IdealGeometryRecord>().get(tTopoHandle);
01233 const TrackerTopology* const tTopo = tTopoHandle.product();
01234
01235 for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
01236 detIter_!= selectedDetIds.end();detIter_++){
01237 fillMEsForLayer( *detIter_,tTopo);
01238 }
01239
01240 for (std::map<uint32_t, ModMEs>::iterator iter=SummaryMEsMap_.begin(); iter!=SummaryMEsMap_.end(); iter++){
01241
01242 ModMEs selME;
01243 selME = iter->second;
01244
01245 if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")){
01246
01247 if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
01248
01249 TCanvas c1("c1");
01250 selME.SummaryOfProfileDistr->getTProfile()->Draw();
01251 std::string name (selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
01252 name+=".png";
01253 c1.Print(name.c_str());
01254 }
01255 }
01256 if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")){
01257
01258 TCanvas c1("c1");
01259 selME.SummaryDistr->getTH1()->Draw();
01260 std::string name (selME.SummaryDistr->getTH1()->GetTitle());
01261 name+=".png";
01262 c1.Print(name.c_str());
01263 }
01264 if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel") && fPSet_.getParameter<bool>("OutputCumulativeSummaryAtLayerLevelAsImage")){
01265
01266 if( CondObj_fillId_ =="onlyCumul" || CondObj_fillId_ =="ProfileAndCumul"){
01267
01268 TCanvas c1("c1");
01269 selME.SummaryOfCumulDistr->getTH1()->Draw();
01270 std::string name (selME.SummaryOfCumulDistr->getTH1()->GetTitle());
01271 name+=".png";
01272 c1.Print(name.c_str());
01273 }
01274 }
01275
01276 }
01277
01278 }