CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripNoisesDQM Class Reference

#include <SiStripNoisesDQM.h>

Inheritance diagram for SiStripNoisesDQM:
SiStripBaseCondObjDQM

List of all members.

Public Member Functions

void fillMEsForDet (ModMEs selModME_, uint32_t selDetId_)
void fillMEsForLayer (uint32_t selDetId_)
void getActiveDetIds (const edm::EventSetup &eSetup)
unsigned long long getCache (const edm::EventSetup &eSetup)
void getConditionObject (const edm::EventSetup &eSetup)
 SiStripNoisesDQM (const edm::EventSetup &eSetup, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet)
virtual ~SiStripNoisesDQM ()

Private Attributes

edm::ESHandle< SiStripApvGaingainHandle_
bool gainRenormalisation_
edm::ESHandle< SiStripNoisesnoiseHandle_

Detailed Description

Definition at line 14 of file SiStripNoisesDQM.h.


Constructor & Destructor Documentation

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

Definition at line 9 of file SiStripNoisesDQM.cc.

References gainHandle_, gainRenormalisation_, edm::EventSetup::get(), edm::ParameterSet::getParameter(), SiStripBaseCondObjDQM::HistoMaps_On_, SiStripBaseCondObjDQM::hPSet_, and SiStripBaseCondObjDQM::Tk_HM_.

                                                                :SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){  
  gainRenormalisation_ = hPSet_.getParameter<bool>("GainRenormalisation");
  if( gainRenormalisation_){ eSetup.get<SiStripApvGainRcd>().get(gainHandle_);}


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

}
SiStripNoisesDQM::~SiStripNoisesDQM ( ) [virtual]

Definition at line 23 of file SiStripNoisesDQM.cc.

{}

Member Function Documentation

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

Implements SiStripBaseCondObjDQM.

Definition at line 36 of file SiStripNoisesDQM.cc.

References SiStripBaseCondObjDQM::CondObj_fillId_, SiStripBaseCondObjDQM::ModMEs::CumulDistr, MonitorElement::Fill(), gainHandle_, gainRenormalisation_, SiStripBaseCondObjDQM::getModMEs(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), noiseHandle_, SiStripBaseCondObjDQM::ModMEs::ProfileDistr, and SiStripBaseCondObjDQM::reader.

                                                                        {

  std::vector<uint32_t> DetIds;
  noiseHandle_->getDetIds(DetIds);

  SiStripNoises::Range noiseRange = noiseHandle_->getRange(selDetId_);
  
  int nStrip =  reader->getNumberOfApvsAndStripLength(selDetId_).first*128;

  getModMEs(selModME_,selDetId_);
  
  float gainFactor;
  float stripnoise;

  SiStripApvGain::Range gainRange;
  if( gainRenormalisation_ ){
    gainRange = gainHandle_->getRange(selDetId_);
  }

  for( int istrip=0;istrip<nStrip;++istrip){
    if( gainRenormalisation_ )
      gainFactor= gainHandle_ ->getStripGain(istrip,gainRange);
    else
      gainFactor=1;

      stripnoise=noiseHandle_->getNoise(istrip,noiseRange)/gainFactor;
    if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
      selModME_.ProfileDistr->Fill(istrip+1,stripnoise);
    }
    if( CondObj_fillId_ =="onlyCumul" || CondObj_fillId_ =="ProfileAndCumul"){
      selModME_.CumulDistr->Fill(stripnoise);
    } 
  } //istrip

}
void SiStripNoisesDQM::fillMEsForLayer ( uint32_t  selDetId_) [virtual]

Implements SiStripBaseCondObjDQM.

Definition at line 78 of file SiStripNoisesDQM.cc.

References SiStripBaseCondObjDQM::activeDetIds, SiStripBaseCondObjDQM::CondObj_fillId_, SiStripHistoId::createHistoLayer(), MonitorElement::Fill(), TkHistoMap::fill(), SiStripBaseCondObjDQM::fillTkMap(), first, SiStripBaseCondObjDQM::fPSet_, gainHandle_, gainRenormalisation_, SiStripBaseCondObjDQM::getLayerNameAndId(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), edm::ParameterSet::getParameter(), SiStripBaseCondObjDQM::GetSameLayerDetId(), SiStripBaseCondObjDQM::getStringNameAndId(), SiStripBaseCondObjDQM::getSummaryMEs(), SiStripBaseCondObjDQM::hidmanager, SiStripBaseCondObjDQM::HistoMaps_On_, SiStripBaseCondObjDQM::hPSet_, noiseHandle_, SiStripBaseCondObjDQM::reader, edm::second(), SiStripBaseCondObjDQM::ModMEs::SummaryDistr, SiStripBaseCondObjDQM::SummaryMEsMap_, SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr, SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr, SiStripBaseCondObjDQM::Tk_HM_, and SiStripBaseCondObjDQM::tkMapScaler.

                                                           {

  // ----
  int subdetectorId_ = ((selDetId_>>25)&0x7);
  
  if( subdetectorId_<3 ||subdetectorId_>6 ){ 
    edm::LogError("SiStripNoisesDQM")
      << "[SiStripNoisesDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
      << subdetectorId_ << " no folder set!" 
      << std::endl;
    return;
  }
  // ----
  
  std::map<uint32_t, ModMEs>::iterator selMEsMapIter_  = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
  ModMEs selME_;
  if ( selMEsMapIter_ != SummaryMEsMap_.end())
    selME_ =selMEsMapIter_->second;
  getSummaryMEs(selME_,selDetId_);
  
  SiStripNoises::Range noiseRange = noiseHandle_->getRange(selDetId_);
  int nStrip =  reader->getNumberOfApvsAndStripLength(selDetId_).first*128;

  float stripnoise=-1.;
  float meanNoise=0;
  int Nbadstrips=0;

  SiStripApvGain::Range gainRange;
  if(gainRenormalisation_ ){
    gainRange = gainHandle_->getRange(selDetId_);
  }
  float gainFactor=1;
  
  SiStripHistoId hidmanager;

  if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
    // --> profile summary    
    std::string hSummaryOfProfile_description;
    hSummaryOfProfile_description  = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
    
    std::string hSummaryOfProfile_name; 
    hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, 
                                                         "layer", 
                                                         getLayerNameAndId(selDetId_).first, 
                                                         "") ;
  }
  if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")){
    std::string hSummaryOfCumul_description;
    hSummaryOfCumul_description  = hPSet_.getParameter<std::string>("Cumul_description");
    
    std::string hSummaryOfCumul_name; 
    hSummaryOfCumul_name = hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getStringNameAndId(selDetId_).first, "") ;    
  }   
  if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
    // --> cumul summary    
    std::string hSummary_description;
    hSummary_description  = hPSet_.getParameter<std::string>("Summary_description");
    
    std::string hSummary_name; 
    hSummary_name = hidmanager.createHistoLayer(hSummary_description, 
                                                "layer", 
                                                getLayerNameAndId(selDetId_).first, 
                                                "") ;
  }


  for( int istrip=0;istrip<nStrip;++istrip){

    if(gainRenormalisation_ ){
      gainFactor= gainHandle_ ->getStripGain(istrip,gainRange);
    } else{
      gainFactor=1.;
    }
    
    stripnoise=noiseHandle_->getNoise(istrip,noiseRange)/gainFactor;
    meanNoise+=stripnoise;
    if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
      if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){      
        selME_.SummaryOfProfileDistr->Fill(istrip+1,stripnoise);
      }
    }

    if(hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")){
      if( CondObj_fillId_ =="onlyCumul" || CondObj_fillId_ =="ProfileAndCumul"){
        selME_.SummaryOfCumulDistr->Fill(stripnoise);
      }
    }

    // Fill the TkMap
    if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
      fillTkMap(selDetId_, stripnoise);   
    }
  
  } //istrip


  if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
    
    meanNoise = meanNoise/(nStrip-Nbadstrips);
    // get detIds belonging to same layer to fill X-axis with detId-number
    
    std::vector<uint32_t> sameLayerDetIds_;
    sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_);
    
    std::vector<uint32_t>::const_iterator ibound=lower_bound(sameLayerDetIds_.begin(),sameLayerDetIds_.end(),selDetId_);
    if(ibound!=sameLayerDetIds_.end() && *ibound==selDetId_)
      selME_.SummaryDistr->Fill(ibound-sameLayerDetIds_.begin()+1,meanNoise);
    

    // Fill the Histo_TkMap with the mean Noise:
    if(HistoMaps_On_ ){Tk_HM_->fill(selDetId_, meanNoise); }


    //Check the axis range for tkmap, and in case redefine;
    int intNoise = int(meanNoise);
    if(intNoise+1 > (int)tkMapScaler.size()){
      tkMapScaler.resize(intNoise+1,0);
    }
    tkMapScaler[intNoise]++;
      
  } 

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

Implements SiStripBaseCondObjDQM.

Definition at line 29 of file SiStripNoisesDQM.h.

References edm::EventSetup::get().

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

Member Data Documentation

Definition at line 39 of file SiStripNoisesDQM.h.

Referenced by fillMEsForDet(), fillMEsForLayer(), and SiStripNoisesDQM().

Definition at line 37 of file SiStripNoisesDQM.h.

Referenced by fillMEsForDet(), fillMEsForLayer(), and SiStripNoisesDQM().