CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripCorrelateBadStripAndNoise Class Reference

#include <DQM/SiStripMonitorSummary/plugins/SiStripCorrelateBadStripAndNoise.cc>

Inheritance diagram for SiStripCorrelateBadStripAndNoise:
edm::EDAnalyzer

List of all members.

Public Member Functions

 SiStripCorrelateBadStripAndNoise (const edm::ParameterSet &)
 ~SiStripCorrelateBadStripAndNoise ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginRun (const edm::Run &run, const edm::EventSetup &es)
void correlateWithNoise (const uint32_t &detid, const uint32_t &firstStrip, const uint32_t &range)
void DoAnalysis (const edm::EventSetup &)
virtual void endJob ()
TH2F * getHisto (const long unsigned int &index)
void getHistos (const uint32_t &detid, std::vector< TH2F * > &histos)
float getMeanNoise (const SiStripNoises::Range &noiseRange, const uint32_t &first, const uint32_t &range)
unsigned long long getNoiseCache (const edm::EventSetup &eSetup)
unsigned long long getQualityCache (const edm::EventSetup &eSetup)
void iterateOnBadStrips (const uint32_t &detid, SiStripQuality::Range &sqrange)
void iterateOnDets ()

Private Attributes

unsigned long long cacheID_noise
unsigned long long cacheID_quality
TFile * file
SiStripDetInfoFileReaderfr
edm::ESHandle< SiStripNoisesnoiseHandle_
edm::ESHandle< SiStripQualityqualityHandle_
TrackerMaptkmap
std::vector< TH2F * > vTH2

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 50 of file SiStripCorrelateBadStripAndNoise.h.


Constructor & Destructor Documentation

SiStripCorrelateBadStripAndNoise::SiStripCorrelateBadStripAndNoise ( const edm::ParameterSet iConfig) [explicit]

Definition at line 10 of file SiStripCorrelateBadStripAndNoise.cc.

References file, fr, cmsCodeRules::cppFunctionSkipper::operator, and tkmap.

                                                                                                :
  cacheID_quality(0xFFFFFFFF),cacheID_noise(0xFFFFFFFF)
{
  //now do what ever initialization is needed
  if(!edm::Service<SiStripDetInfoFileReader>().isAvailable()){
    edm::LogError("TkLayerMap") << 
      "\n------------------------------------------"
      "\nUnAvailable Service SiStripDetInfoFileReader: please insert in the configuration file an instance like"
      "\n\tprocess.SiStripDetInfoFileReader = cms.Service(\"SiStripDetInfoFileReader\")"
      "\n------------------------------------------";
  }
 
  fr=edm::Service<SiStripDetInfoFileReader>().operator->();
  file = new TFile("correlTest.root","RECREATE");
  tkmap = new TrackerMap();
}
SiStripCorrelateBadStripAndNoise::~SiStripCorrelateBadStripAndNoise ( )

Definition at line 28 of file SiStripCorrelateBadStripAndNoise.cc.

{}

Member Function Documentation

virtual void SiStripCorrelateBadStripAndNoise::analyze ( const edm::Event ,
const edm::EventSetup  
) [inline, private, virtual]

Implements edm::EDAnalyzer.

Definition at line 58 of file SiStripCorrelateBadStripAndNoise.h.

{};
void SiStripCorrelateBadStripAndNoise::beginRun ( const edm::Run run,
const edm::EventSetup es 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file SiStripCorrelateBadStripAndNoise.cc.

References cacheID_noise, cacheID_quality, DoAnalysis(), edm::EventSetup::get(), getNoiseCache(), getQualityCache(), noiseHandle_, and qualityHandle_.

                                                                                    {

  if(getNoiseCache(es)==cacheID_noise && getQualityCache(es)==cacheID_quality)
    return;
  cacheID_noise=getNoiseCache(es);
  cacheID_quality=getQualityCache(es);
  
  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun] cacheID_quality " << cacheID_quality << " cacheID_noise " << cacheID_noise << std::endl; 
  
  es.get<SiStripQualityRcd>().get(qualityHandle_);
  es.get<SiStripNoisesRcd>().get(noiseHandle_);

  DoAnalysis(es);
}
void SiStripCorrelateBadStripAndNoise::correlateWithNoise ( const uint32_t &  detid,
const uint32_t &  firstStrip,
const uint32_t &  range 
) [private]

Definition at line 101 of file SiStripCorrelateBadStripAndNoise.cc.

References HcalObjRepresent::Fill(), TrackerMap::fillc(), getHistos(), getMeanNoise(), mergeVDriftHistosByStation::histos, i, noiseHandle_, and tkmap.

Referenced by iterateOnBadStrips().

                                                                                                                                {

  std::vector<TH2F *>histos;

  SiStripNoises::Range noiseRange = noiseHandle_->getRange(detid);
  edm::LogInfo("Domenico") << "detid " << detid << " first " << firstStrip << " range " << range;
  float meanAPVNoise=getMeanNoise(noiseRange,firstStrip/128,128);

  //float meanNoiseHotStrips=getMeanNoise(noiseRange,firstStrip,range);
  for (size_t theStrip=firstStrip;theStrip<firstStrip+range;theStrip++){
    float meanNoiseHotStrips=getMeanNoise(noiseRange,theStrip,1);
  
    //Get the histogram for this detid
    getHistos(detid,histos);
    float yvalue=range<21?1.*range:21;
    
    for(size_t i=0;i<histos.size();++i)
      histos[i]->Fill(meanNoiseHotStrips/meanAPVNoise-1.,yvalue);
    
    if(meanNoiseHotStrips/meanAPVNoise-1.<-0.3)
      tkmap->fillc(detid,0xFF0000);
    else
      tkmap->fillc(detid,0x0000FF);
  }
}
void SiStripCorrelateBadStripAndNoise::DoAnalysis ( const edm::EventSetup es) [private]

Definition at line 50 of file SiStripCorrelateBadStripAndNoise.cc.

References iterateOnDets().

Referenced by beginRun().

                                                                   {
  //Loop on quality bad stirps
  //for each strip, look at the noise 
  // evalaute the mean apv noise and the ratio among strip noise and meanApvNoise
  // put the value in the histo in terms of ratio Vs percentage of badStrips per APV

  //Fill an histo per subdet and layer (and plus && minus for TEC/TID)
  edm::LogInfo("") << "[Doanalysis]";
  iterateOnDets();

}
void SiStripCorrelateBadStripAndNoise::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 182 of file SiStripCorrelateBadStripAndNoise.cc.

References file, i, TrackerMap::save(), tkmap, and vTH2.

                                         {
  for(size_t i=0;i<vTH2.size();i++)
    if(vTH2[i]!=0)
      vTH2[i]->Write();

  file->Write();
  file->Close();

  tkmap->save(true,0,0,"testTkMap.png");

}
TH2F * SiStripCorrelateBadStripAndNoise::getHisto ( const long unsigned int &  index) [private]

Definition at line 167 of file SiStripCorrelateBadStripAndNoise.cc.

References getHLTprescales::index, mergeVDriftHistosByStation::name, and vTH2.

Referenced by getHistos().

                                                                        {
  if(vTH2.size()<index+1)
    vTH2.resize(index+1,0);
  
  if(vTH2[index]==0){
    char name[128];
    sprintf(name,"%lu",index);
    edm::LogInfo("")<<"[getHisto] creating index " << index << std::endl;
    vTH2[index]=new TH2F(name,name,50,-2.,2.,21,0.5,21.5);
  }
  
  return vTH2[index];
}
void SiStripCorrelateBadStripAndNoise::getHistos ( const uint32_t &  detid,
std::vector< TH2F * > &  histos 
) [private]

Definition at line 138 of file SiStripCorrelateBadStripAndNoise.cc.

References a, getHisto(), getHLTprescales::index, TIBDetId::layer(), TOBDetId::layer(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), TIDDetId::wheel(), and TECDetId::wheel().

Referenced by correlateWithNoise().

                                                                                         {
  
  histos.clear();
  
  int subdet=-999; int component=-999;
  SiStripDetId a(detid);
  if ( a.subdetId() == 3 ){
    subdet=0;
    component=TIBDetId(detid).layer();
  } else if ( a.subdetId() == 4 ) {
    subdet=1;
    component=TIDDetId(detid).side()==2?TIDDetId(detid).wheel():TIDDetId(detid).wheel()+3;
  } else if ( a.subdetId() == 5 ) {
    subdet=2;
    component=TOBDetId(detid).layer();
  } else if ( a.subdetId() == 6 ) {
    subdet=3;
    component=TECDetId(detid).side()==2?TECDetId(detid).wheel():TECDetId(detid).wheel()+9;
  } 
  
  int index=100+subdet*100+component;


  histos.push_back(getHisto(subdet));
  histos.push_back(getHisto(index));
  
}
float SiStripCorrelateBadStripAndNoise::getMeanNoise ( const SiStripNoises::Range noiseRange,
const uint32_t &  first,
const uint32_t &  range 
) [private]

Definition at line 128 of file SiStripCorrelateBadStripAndNoise.cc.

References timingPdfMaker::mean, and noiseHandle_.

Referenced by correlateWithNoise().

                                                                                                                                    {
  
  float mean=0;
  for (size_t istrip=firstStrip;istrip<firstStrip+range;istrip++){
    mean+=noiseHandle_->getNoise(istrip,noiseRange);
  }
  return mean/(1.*range);
}
unsigned long long SiStripCorrelateBadStripAndNoise::getNoiseCache ( const edm::EventSetup eSetup) [inline, private]

Definition at line 65 of file SiStripCorrelateBadStripAndNoise.h.

References edm::EventSetup::get().

Referenced by beginRun().

{ return eSetup.get<SiStripNoisesRcd>().cacheIdentifier();}
unsigned long long SiStripCorrelateBadStripAndNoise::getQualityCache ( const edm::EventSetup eSetup) [inline, private]

Definition at line 66 of file SiStripCorrelateBadStripAndNoise.h.

References edm::EventSetup::get().

Referenced by beginRun().

{ return eSetup.get<SiStripQualityRcd>().cacheIdentifier();}
void SiStripCorrelateBadStripAndNoise::iterateOnBadStrips ( const uint32_t &  detid,
SiStripQuality::Range sqrange 
) [private]

Definition at line 78 of file SiStripCorrelateBadStripAndNoise.cc.

References correlateWithNoise(), fr, SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), and qualityHandle_.

Referenced by iterateOnDets().

                                                                                                        {

  float percentage=0;
  for(int it=0;it<sqrange.second-sqrange.first;it++){
    unsigned int firstStrip=qualityHandle_->decode( *(sqrange.first+it) ).firstStrip;
    unsigned int range=qualityHandle_->decode( *(sqrange.first+it) ).range;
    
    correlateWithNoise(detid,firstStrip,range);

    edm::LogInfo("range")<< range;
    percentage+=range;
  }
  if(percentage!=0)
    percentage/=128.*fr->getNumberOfApvsAndStripLength(detid).first;
  if(percentage>1)
    edm::LogError("SiStripQualityStatistics") <<  "PROBLEM detid " << detid << " value " << percentage<< std::endl;
  
  //------- Global Statistics on percentage of bad components along the IOVs ------//
  if(percentage!=0)
    edm::LogInfo("")<< "percentage " << detid << " " << percentage;
}
void SiStripCorrelateBadStripAndNoise::iterateOnDets ( ) [private]

Definition at line 63 of file SiStripCorrelateBadStripAndNoise.cc.

References cond::rpcobgas::detid, iterateOnBadStrips(), and qualityHandle_.

Referenced by DoAnalysis().

                                               {

  SiStripQuality::RegistryIterator rbegin = qualityHandle_->getRegistryVectorBegin();
  SiStripQuality::RegistryIterator rend   = qualityHandle_->getRegistryVectorEnd();

 
  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
    const uint32_t detid=rp->detid;
    
    SiStripQuality::Range sqrange = SiStripQuality::Range( qualityHandle_->getDataVectorBegin()+rp->ibegin , qualityHandle_->getDataVectorBegin()+rp->iend );
    iterateOnBadStrips(detid,sqrange);
  }  
}

Member Data Documentation

Definition at line 88 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

Definition at line 87 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

Definition at line 81 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and SiStripCorrelateBadStripAndNoise().

Definition at line 79 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun(), correlateWithNoise(), and getMeanNoise().

Definition at line 78 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun(), iterateOnBadStrips(), and iterateOnDets().

std::vector<TH2F*> SiStripCorrelateBadStripAndNoise::vTH2 [private]

Definition at line 82 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().