CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripLorentzAngleDQM Class Reference

#include <SiStripLorentzAngleDQM.h>

Inheritance diagram for SiStripLorentzAngleDQM:
SiStripBaseCondObjDQM

List of all members.

Public Member Functions

void fillMEsForDet (ModMEs selModME_, uint32_t selDetId_)
void fillMEsForLayer (uint32_t selDetId_)
void fillModMEs (const std::vector< uint32_t > &selectedDetIds)
void fillSummaryMEs (const std::vector< uint32_t > &selectedDetIds)
void getActiveDetIds (const edm::EventSetup &eSetup)
unsigned long long getCache (const edm::EventSetup &eSetup)
void getConditionObject (const edm::EventSetup &eSetup)
 SiStripLorentzAngleDQM (const edm::EventSetup &eSetup, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet)
virtual ~SiStripLorentzAngleDQM ()

Private Attributes

edm::ESHandle
< SiStripLorentzAngle
lorentzangleHandle_

Detailed Description

Definition at line 13 of file SiStripLorentzAngleDQM.h.


Constructor & Destructor Documentation

SiStripLorentzAngleDQM::SiStripLorentzAngleDQM ( const edm::EventSetup eSetup,
edm::ParameterSet const &  hPSet,
edm::ParameterSet const &  fPSet 
)

Definition at line 6 of file SiStripLorentzAngleDQM.cc.

References SiStripBaseCondObjDQM::HistoMaps_On_, and SiStripBaseCondObjDQM::Tk_HM_.

                                                                            :SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){

  // Build the Histo_TkMap:
  if(HistoMaps_On_ ) Tk_HM_ = new TkHistoMap("SiStrip/Histo_Map","LA_TkMap",0.);

}
SiStripLorentzAngleDQM::~SiStripLorentzAngleDQM ( ) [virtual]

Definition at line 19 of file SiStripLorentzAngleDQM.cc.

{}

Member Function Documentation

void SiStripLorentzAngleDQM::fillMEsForDet ( ModMEs  selModME_,
uint32_t  selDetId_ 
) [inline, virtual]

Implements SiStripBaseCondObjDQM.

Definition at line 26 of file SiStripLorentzAngleDQM.h.

{};
void SiStripLorentzAngleDQM::fillMEsForLayer ( uint32_t  selDetId_) [virtual]

Implements SiStripBaseCondObjDQM.

Definition at line 122 of file SiStripLorentzAngleDQM.cc.

References SiStripBaseCondObjDQM::activeDetIds, gather_cfg::cout, SiStripHistoId::createHistoLayer(), MonitorElement::Fill(), TkHistoMap::fill(), SiStripBaseCondObjDQM::fillTkMap(), first, SiStripBaseCondObjDQM::fPSet_, SiStripBaseCondObjDQM::getLayerNameAndId(), edm::ParameterSet::getParameter(), SiStripBaseCondObjDQM::GetSameLayerDetId(), SiStripBaseCondObjDQM::getStringNameAndId(), SiStripBaseCondObjDQM::getSummaryMEs(), SiStripSubStructure::getTECDetectors(), SiStripSubStructure::getTIBDetectors(), SiStripSubStructure::getTIDDetectors(), SiStripSubStructure::getTOBDetectors(), SiStripBaseCondObjDQM::hidmanager, SiStripBaseCondObjDQM::HistoMaps_On_, SiStripBaseCondObjDQM::hPSet_, i, align::tib::layerNumber(), lorentzangleHandle_, align::tob::rodNumber(), edm::second(), align::tib::stringNumber(), SiStripBaseCondObjDQM::SummaryMEsMap_, SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr, SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr, SiStripBaseCondObjDQM::SummaryOnStringLevel_On_, and SiStripBaseCondObjDQM::Tk_HM_.

Referenced by fillSummaryMEs().

                                                                 {  

  SiStripHistoId hidmanager;

      
  std::string hSummaryOfProfile_description;
  hSummaryOfProfile_description  = hPSet_.getParameter<std::string>("SummaryOfProfile_description");

  std::string hSummary_name; 

  int subDetId_ = ((selDetId_>>25)&0x7);
  
  if( subDetId_<3 || subDetId_>6 ){ 
    edm::LogError("SiStripLorentzAngleDQM")
      << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
      << subDetId_ << " no folder set!" 
      << std::endl;
    return;
  }

  uint32_t selSubDetId_ =  ((selDetId_>>25)&0x7);
  SiStripSubStructure substructure_;
  
  std::vector<uint32_t> sameLayerDetIds_;
  sameLayerDetIds_.clear();

  if (SummaryOnStringLevel_On_) {  //FILLING FOR STRING LEVEL

    hSummary_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getStringNameAndId(selDetId_).first, "") ;
    std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getStringNameAndId(selDetId_).second);
    
    ModMEs selME_;
    if ( selMEsMapIter_ != SummaryMEsMap_.end())
      selME_ =selMEsMapIter_->second;

    getSummaryMEs(selME_,selDetId_ );
  
    // -----                                       
    sameLayerDetIds_.clear();
   
    if(selSubDetId_==3){  //  TIB
      if(TIBDetId(selDetId_).isInternalString()){
        substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_, TIBDetId(selDetId_).layerNumber(),0,1,TIBDetId(selDetId_).stringNumber());
      }
      if(TIBDetId(selDetId_).isExternalString()){
        substructure_.getTIBDetectors(activeDetIds, sameLayerDetIds_, TIBDetId(selDetId_).layerNumber(),0,2,TIBDetId(selDetId_).stringNumber());
      } 
    }
    else if(selSubDetId_==4){  // TID
      substructure_.getTIDDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0);
    }
    else if(selSubDetId_==5){  // TOB
      substructure_.getTOBDetectors(activeDetIds, sameLayerDetIds_, TOBDetId(selDetId_).layerNumber(),0,TOBDetId(selDetId_).rodNumber());
    }
    else if(selSubDetId_==6){  // TEC
      substructure_.getTECDetectors(activeDetIds, sameLayerDetIds_, 0,0,0,0,0,0);
    }
 
    // -----

    for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
        selME_.SummaryOfProfileDistr->Fill(i+1,lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));

        // Fill the Histo_TkMap+TkMap with the LA:
        if(HistoMaps_On_ ) Tk_HM_->fill(sameLayerDetIds_[i], lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));

          std::cout<<sameLayerDetIds_[i]<<"\t"<<lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i])<<std::endl;

        if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
          fillTkMap(sameLayerDetIds_[i], lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
        }
        
    } 
    
    std::string hSummaryOfCumul_description;
    hSummaryOfCumul_description  = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
    
    std::string hSummaryOfCumul_name; 
    
    if( subDetId_<3 || subDetId_>6 ){ 
      edm::LogError("SiStripLorentzAngleDQM")
        << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
        << subDetId_ << " no folder set!" 
        << std::endl;
      return;
    }
    
    hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getStringNameAndId(selDetId_).first, "") ;
    
    for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
        selME_.SummaryOfCumulDistr->Fill(lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
    } 
  } //FILLING FOR STRING LEVEL
  
  
  else { //FILLING FOR LAYER LEVEL

    std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
    
    ModMEs selME_;
    if ( selMEsMapIter_ != SummaryMEsMap_.end())
      selME_ =selMEsMapIter_->second;
    
    getSummaryMEs(selME_,selDetId_ );
    
    if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){

      hSummary_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_).first, "") ;    
    
      // -----                                             
      sameLayerDetIds_.clear();

      sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_);     

      for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
          selME_.SummaryOfProfileDistr->Fill(i+1,lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));

          // Fill the Histo_TkMap with LA:
          if(HistoMaps_On_ ) Tk_HM_->fill(sameLayerDetIds_[i], lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));

        if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
          fillTkMap(sameLayerDetIds_[i], lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));

        }

      } 
    }//if Fill ...

    if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")){

      std::string hSummaryOfCumul_description;
      hSummaryOfCumul_description  = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
    
      std::string hSummaryOfCumul_name; 
    
      if( subDetId_<3 || subDetId_>6 ){ 
        edm::LogError("SiStripLorentzAngleDQM")
          << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
          << subDetId_ << " no folder set!" 
          << std::endl;
        return;
      }
    
      hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getLayerNameAndId(selDetId_).first, "") ;
    
      for(unsigned int i=0;i< sameLayerDetIds_.size(); i++){
          selME_.SummaryOfCumulDistr->Fill(lorentzangleHandle_->getLorentzAngle(sameLayerDetIds_[i]));
      }
    }//if Fill ... 
  } //FILLING FOR LAYER LEVEL
  
}  
void SiStripLorentzAngleDQM::fillModMEs ( const std::vector< uint32_t > &  selectedDetIds) [inline, virtual]

Reimplemented from SiStripBaseCondObjDQM.

Definition at line 25 of file SiStripLorentzAngleDQM.h.

{};
void SiStripLorentzAngleDQM::fillSummaryMEs ( const std::vector< uint32_t > &  selectedDetIds) [virtual]

Reimplemented from SiStripBaseCondObjDQM.

Definition at line 42 of file SiStripLorentzAngleDQM.cc.

References alignmentValidation::c1, fillMEsForLayer(), SiStripBaseCondObjDQM::fPSet_, SiStripBaseCondObjDQM::getLayerNameAndId(), edm::ParameterSet::getParameter(), SiStripBaseCondObjDQM::getStringNameAndId(), MonitorElement::getTH1(), MonitorElement::getTProfile(), SiStripBaseCondObjDQM::hPSet_, i, mergeVDriftHistosByStation::name, SiStripBaseCondObjDQM::SummaryMEsMap_, SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr, SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr, SiStripBaseCondObjDQM::SummaryOnLayerLevel_On_, and SiStripBaseCondObjDQM::SummaryOnStringLevel_On_.

                                                                                     {
   
  // -----
  // LA on layer-level : fill at once all detIds belonging to same layer when encountering first detID in the layer 

  bool fillNext = true; 
  for(unsigned int i=0;i<selectedDetIds.size();i++){                                        
    int subDetId_ = ((selectedDetIds[i]>>25)&0x7);
    if( subDetId_<3 ||subDetId_>6 ){ 
      edm::LogError("SiStripLorentzAngle")
        << "[SiStripLorentzAngle::fillSummaryMEs] WRONG INPUT : no such subdetector type : "
        << subDetId_ << " and detId " << selectedDetIds[i] << " therefore no filling!" 
        << std::endl;
    }    
    else if (SummaryOnLayerLevel_On_) {    
      if( fillNext) { fillMEsForLayer(/*SummaryMEsMap_,*/ selectedDetIds[i]);} 
      if( getLayerNameAndId(selectedDetIds[i+1])==getLayerNameAndId(selectedDetIds[i])){ fillNext=false;}
      else { fillNext=true;}
    } 
    else if (SummaryOnStringLevel_On_) {
      if( fillNext) { fillMEsForLayer(/*SummaryMEsMap_,*/ selectedDetIds[i]);} 
      if( getStringNameAndId(selectedDetIds[i+1])==getStringNameAndId(selectedDetIds[i])){ fillNext=false;}
      else { fillNext=true;}
    } 
  }

  for (std::map<uint32_t, ModMEs>::iterator iter=SummaryMEsMap_.begin(); iter!=SummaryMEsMap_.end(); iter++){

    ModMEs selME;
    selME = iter->second;

    if(SummaryOnStringLevel_On_){

      if (fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")){

        TCanvas c1("c1");
        selME.SummaryOfProfileDistr->getTProfile()->Draw();
        std::string name (selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
        name+=".png";
        c1.Print(name.c_str());
      }

      if (fPSet_.getParameter<bool>("OutputCumulativeSummaryAtLayerLevelAsImage")){

        TCanvas c2("c2");
        selME.SummaryOfCumulDistr->getTH1()->Draw();
        std::string name2 (selME.SummaryOfCumulDistr->getTH1()->GetTitle());
        name2+=".png";
        c2.Print(name2.c_str());
      }

    }
    else{
      if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel") && fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")){

        TCanvas c1("c1");
        selME.SummaryOfProfileDistr->getTProfile()->Draw();
        std::string name (selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
        name+=".png";
        c1.Print(name.c_str());
      }

      if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel") && fPSet_.getParameter<bool>("OutputCumulativeSummaryAtLayerLevelAsImage")){

        TCanvas c1("c1");
        selME.SummaryOfCumulDistr->getTH1()->Draw();
        std::string name (selME.SummaryOfCumulDistr->getTH1()->GetTitle());
        name+=".png";
        c1.Print(name.c_str());
      }
    }

  }

}
void SiStripLorentzAngleDQM::getActiveDetIds ( const edm::EventSetup eSetup) [virtual]

Implements SiStripBaseCondObjDQM.

Definition at line 24 of file SiStripLorentzAngleDQM.cc.

References SiStripBaseCondObjDQM::activeDetIds, getConditionObject(), and lorentzangleHandle_.

                                                                        {
  
  getConditionObject(eSetup);

  std::map<uint32_t,float>::const_iterator LAMapIter_;
  std::map<uint32_t,float> LAMap_ = lorentzangleHandle_->getLorentzAngles();

  for( LAMapIter_ = LAMap_.begin();
       LAMapIter_!= LAMap_.end(); LAMapIter_++){

    activeDetIds.push_back((*LAMapIter_).first);
  }

}
unsigned long long SiStripLorentzAngleDQM::getCache ( const edm::EventSetup eSetup) [inline, virtual]

Implements SiStripBaseCondObjDQM.

Definition at line 31 of file SiStripLorentzAngleDQM.h.

References edm::EventSetup::get().

{ return eSetup.get<SiStripLorentzAngleRcd>().cacheIdentifier();}
void SiStripLorentzAngleDQM::getConditionObject ( const edm::EventSetup eSetup) [inline, virtual]

Member Data Documentation

Definition at line 39 of file SiStripLorentzAngleDQM.h.

Referenced by fillMEsForLayer(), getActiveDetIds(), and getConditionObject().