CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripCorrelateBadStripAndNoise Class Reference

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

Inheritance diagram for SiStripCorrelateBadStripAndNoise:
edm::EDAnalyzer

Public Member Functions

 SiStripCorrelateBadStripAndNoise (const edm::ParameterSet &)
 
 ~SiStripCorrelateBadStripAndNoise ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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, cppFunctionSkipper::operator, and tkmap.

10  :
11  cacheID_quality(0xFFFFFFFF),cacheID_noise(0xFFFFFFFF)
12 {
13  //now do what ever initialization is needed
14  if(!edm::Service<SiStripDetInfoFileReader>().isAvailable()){
15  edm::LogError("TkLayerMap") <<
16  "\n------------------------------------------"
17  "\nUnAvailable Service SiStripDetInfoFileReader: please insert in the configuration file an instance like"
18  "\n\tprocess.SiStripDetInfoFileReader = cms.Service(\"SiStripDetInfoFileReader\")"
19  "\n------------------------------------------";
20  }
21 
23  file = new TFile("correlTest.root","RECREATE");
24  tkmap = new TrackerMap();
25 }
SiStripCorrelateBadStripAndNoise::~SiStripCorrelateBadStripAndNoise ( )

Definition at line 28 of file SiStripCorrelateBadStripAndNoise.cc.

29 {}

Member Function Documentation

virtual void SiStripCorrelateBadStripAndNoise::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 58 of file SiStripCorrelateBadStripAndNoise.h.

58 {};
void SiStripCorrelateBadStripAndNoise::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
privatevirtual

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_.

34  {
35 
37  return;
40 
41  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun] cacheID_quality " << cacheID_quality << " cacheID_noise " << cacheID_noise << std::endl;
42 
45 
46  DoAnalysis(es);
47 }
unsigned long long getQualityCache(const edm::EventSetup &eSetup)
unsigned long long getNoiseCache(const edm::EventSetup &eSetup)
edm::ESHandle< SiStripQuality > qualityHandle_
const T & get() const
Definition: EventSetup.h:55
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().

101  {
102 
103  std::vector<TH2F *>histos;
104 
105  SiStripNoises::Range noiseRange = noiseHandle_->getRange(detid);
106  edm::LogInfo("Domenico") << "detid " << detid << " first " << firstStrip << " range " << range;
107  float meanAPVNoise=getMeanNoise(noiseRange,firstStrip/128,128);
108 
109  //float meanNoiseHotStrips=getMeanNoise(noiseRange,firstStrip,range);
110  for (size_t theStrip=firstStrip;theStrip<firstStrip+range;theStrip++){
111  float meanNoiseHotStrips=getMeanNoise(noiseRange,theStrip,1);
112 
113  //Get the histogram for this detid
114  getHistos(detid,histos);
115  float yvalue=range<21?1.*range:21;
116 
117  for(size_t i=0;i<histos.size();++i)
118  histos[i]->Fill(meanNoiseHotStrips/meanAPVNoise-1.,yvalue);
119 
120  if(meanNoiseHotStrips/meanAPVNoise-1.<-0.3)
121  tkmap->fillc(detid,0xFF0000);
122  else
123  tkmap->fillc(detid,0x0000FF);
124  }
125 }
int i
Definition: DBlmapReader.cc:9
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void getHistos(const uint32_t &detid, std::vector< TH2F * > &histos)
void fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:48
float getMeanNoise(const SiStripNoises::Range &noiseRange, const uint32_t &first, const uint32_t &range)
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:41
void SiStripCorrelateBadStripAndNoise::DoAnalysis ( const edm::EventSetup es)
private

Definition at line 50 of file SiStripCorrelateBadStripAndNoise.cc.

References iterateOnDets().

Referenced by beginRun().

50  {
51  //Loop on quality bad stirps
52  //for each strip, look at the noise
53  // evalaute the mean apv noise and the ratio among strip noise and meanApvNoise
54  // put the value in the histo in terms of ratio Vs percentage of badStrips per APV
55 
56  //Fill an histo per subdet and layer (and plus && minus for TEC/TID)
57  edm::LogInfo("") << "[Doanalysis]";
58  iterateOnDets();
59 
60 }
void SiStripCorrelateBadStripAndNoise::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 182 of file SiStripCorrelateBadStripAndNoise.cc.

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

182  {
183  for(size_t i=0;i<vTH2.size();i++)
184  if(vTH2[i]!=0)
185  vTH2[i]->Write();
186 
187  file->Write();
188  file->Close();
189 
190  tkmap->save(true,0,0,"testTkMap.png");
191 
192 }
int i
Definition: DBlmapReader.cc:9
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:632
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().

167  {
168  if(vTH2.size()<index+1)
169  vTH2.resize(index+1,0);
170 
171  if(vTH2[index]==0){
172  char name[128];
173  sprintf(name,"%lu",index);
174  edm::LogInfo("")<<"[getHisto] creating index " << index << std::endl;
175  vTH2[index]=new TH2F(name,name,50,-2.,2.,21,0.5,21.5);
176  }
177 
178  return vTH2[index];
179 }
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, TOBDetId::layer(), TIBDetId::layer(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), TIDDetId::wheel(), and TECDetId::wheel().

Referenced by correlateWithNoise().

138  {
139 
140  histos.clear();
141 
142  int subdet=-999; int component=-999;
144  if ( a.subdetId() == 3 ){
145  subdet=0;
146  component=TIBDetId(detid).layer();
147  } else if ( a.subdetId() == 4 ) {
148  subdet=1;
149  component=TIDDetId(detid).side()==2?TIDDetId(detid).wheel():TIDDetId(detid).wheel()+3;
150  } else if ( a.subdetId() == 5 ) {
151  subdet=2;
152  component=TOBDetId(detid).layer();
153  } else if ( a.subdetId() == 6 ) {
154  subdet=3;
155  component=TECDetId(detid).side()==2?TECDetId(detid).wheel():TECDetId(detid).wheel()+9;
156  }
157 
158  int index=100+subdet*100+component;
159 
160 
161  histos.push_back(getHisto(subdet));
162  histos.push_back(getHisto(index));
163 
164 }
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
TH2F * getHisto(const long unsigned int &index)
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
unsigned int side() const
positive or negative id
Definition: TIDDetId.h:45
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
double a
Definition: hdecay.h:121
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
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().

128  {
129 
130  float mean=0;
131  for (size_t istrip=firstStrip;istrip<firstStrip+range;istrip++){
132  mean+=noiseHandle_->getNoise(istrip,noiseRange);
133  }
134  return mean/(1.*range);
135 }
unsigned long long SiStripCorrelateBadStripAndNoise::getNoiseCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 65 of file SiStripCorrelateBadStripAndNoise.h.

References edm::EventSetup::get().

Referenced by beginRun().

65 { return eSetup.get<SiStripNoisesRcd>().cacheIdentifier();}
const T & get() const
Definition: EventSetup.h:55
unsigned long long SiStripCorrelateBadStripAndNoise::getQualityCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 66 of file SiStripCorrelateBadStripAndNoise.h.

References edm::EventSetup::get().

Referenced by beginRun().

66 { return eSetup.get<SiStripQualityRcd>().cacheIdentifier();}
const T & get() const
Definition: EventSetup.h:55
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().

78  {
79 
80  float percentage=0;
81  for(int it=0;it<sqrange.second-sqrange.first;it++){
82  unsigned int firstStrip=qualityHandle_->decode( *(sqrange.first+it) ).firstStrip;
83  unsigned int range=qualityHandle_->decode( *(sqrange.first+it) ).range;
84 
85  correlateWithNoise(detid,firstStrip,range);
86 
87  edm::LogInfo("range")<< range;
88  percentage+=range;
89  }
90  if(percentage!=0)
91  percentage/=128.*fr->getNumberOfApvsAndStripLength(detid).first;
92  if(percentage>1)
93  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage<< std::endl;
94 
95  //------- Global Statistics on percentage of bad components along the IOVs ------//
96  if(percentage!=0)
97  edm::LogInfo("")<< "percentage " << detid << " " << percentage;
98 }
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void correlateWithNoise(const uint32_t &detid, const uint32_t &firstStrip, const uint32_t &range)
edm::ESHandle< SiStripQuality > qualityHandle_
void SiStripCorrelateBadStripAndNoise::iterateOnDets ( )
private

Definition at line 63 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by DoAnalysis().

63  {
64 
65  SiStripQuality::RegistryIterator rbegin = qualityHandle_->getRegistryVectorBegin();
66  SiStripQuality::RegistryIterator rend = qualityHandle_->getRegistryVectorEnd();
67 
68 
69  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
70  const uint32_t detid=rp->detid;
71 
72  SiStripQuality::Range sqrange = SiStripQuality::Range( qualityHandle_->getDataVectorBegin()+rp->ibegin , qualityHandle_->getDataVectorBegin()+rp->iend );
73  iterateOnBadStrips(detid,sqrange);
74  }
75 }
Registry::const_iterator RegistryIterator
edm::ESHandle< SiStripQuality > qualityHandle_
void iterateOnBadStrips(const uint32_t &detid, SiStripQuality::Range &sqrange)
std::pair< ContainerIterator, ContainerIterator > Range

Member Data Documentation

unsigned long long SiStripCorrelateBadStripAndNoise::cacheID_noise
private

Definition at line 88 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

unsigned long long SiStripCorrelateBadStripAndNoise::cacheID_quality
private

Definition at line 87 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

TFile* SiStripCorrelateBadStripAndNoise::file
private

Definition at line 81 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and SiStripCorrelateBadStripAndNoise().

SiStripDetInfoFileReader* SiStripCorrelateBadStripAndNoise::fr
private
edm::ESHandle<SiStripNoises> SiStripCorrelateBadStripAndNoise::noiseHandle_
private

Definition at line 79 of file SiStripCorrelateBadStripAndNoise.h.

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

edm::ESHandle<SiStripQuality> SiStripCorrelateBadStripAndNoise::qualityHandle_
private

Definition at line 78 of file SiStripCorrelateBadStripAndNoise.h.

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

TrackerMap* SiStripCorrelateBadStripAndNoise::tkmap
private
std::vector<TH2F*> SiStripCorrelateBadStripAndNoise::vTH2
private

Definition at line 82 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().