CMS 3D CMS Logo

SiStripBaseCondObjDQM.cc

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

Generated on Tue Jun 9 17:33:40 2009 for CMSSW by  doxygen 1.5.4