CMS 3D CMS Logo

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 edm::EDConsumerBase

Public Member Functions

 SiStripCorrelateBadStripAndNoise (const edm::ParameterSet &)
 
 ~SiStripCorrelateBadStripAndNoise () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
void correlateWithNoise (const uint32_t &detid, const TrackerTopology *tTopo, const uint32_t &firstStrip, const uint32_t &range)
 
void DoAnalysis (const edm::EventSetup &)
 
void endJob () override
 
TH2F * getHisto (const long unsigned int &index)
 
void getHistos (const uint32_t &detid, const TrackerTopology *tTopo, 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, const TrackerTopology *tTopo, SiStripQuality::Range &sqrange)
 
void iterateOnDets (const TrackerTopology *tTopo)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 49 of file SiStripCorrelateBadStripAndNoise.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file SiStripCorrelateBadStripAndNoise.cc.

References file, fr, Utilities::operator, and tkmap.

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

Definition at line 26 of file SiStripCorrelateBadStripAndNoise.cc.

27 {}

Member Function Documentation

void SiStripCorrelateBadStripAndNoise::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverrideprivate

Definition at line 57 of file SiStripCorrelateBadStripAndNoise.h.

References DoAnalysis(), endJob(), getHisto(), getHistos(), and plotFactory::histos.

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

Definition at line 32 of file SiStripCorrelateBadStripAndNoise.cc.

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

32  {
33 
35  return;
38 
39  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun] cacheID_quality " << cacheID_quality << " cacheID_noise " << cacheID_noise << std::endl;
40 
43 
44  DoAnalysis(es);
45 }
unsigned long long getQualityCache(const edm::EventSetup &eSetup)
unsigned long long getNoiseCache(const edm::EventSetup &eSetup)
edm::ESHandle< SiStripQuality > qualityHandle_
T get() const
Definition: EventSetup.h:63
void SiStripCorrelateBadStripAndNoise::correlateWithNoise ( const uint32_t &  detid,
const TrackerTopology tTopo,
const uint32_t &  firstStrip,
const uint32_t &  range 
)
private

Definition at line 105 of file SiStripCorrelateBadStripAndNoise.cc.

References HcalObjRepresent::Fill(), TrackerMap::fillc(), getHistos(), getMeanNoise(), SiStripNoises::getRange(), plotFactory::histos, mps_fire::i, noiseHandle_, and tkmap.

Referenced by getQualityCache(), and iterateOnBadStrips().

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

Definition at line 48 of file SiStripCorrelateBadStripAndNoise.cc.

References edm::EventSetup::get(), iterateOnDets(), and edm::ESHandle< T >::product().

Referenced by analyze(), and beginRun().

48  {
49 
50  //Retrieve tracker topology from geometry
52  es.get<TrackerTopologyRcd>().get(tTopoHandle);
53  const TrackerTopology* const tTopo = tTopoHandle.product();
54 
55  //Loop on quality bad stirps
56  //for each strip, look at the noise
57  // evalaute the mean apv noise and the ratio among strip noise and meanApvNoise
58  // put the value in the histo in terms of ratio Vs percentage of badStrips per APV
59 
60  //Fill an histo per subdet and layer (and plus && minus for TEC/TID)
61  edm::LogInfo("") << "[Doanalysis]";
62  iterateOnDets(tTopo);
63 
64 }
void iterateOnDets(const TrackerTopology *tTopo)
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86
void SiStripCorrelateBadStripAndNoise::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 186 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by analyze().

186  {
187  for(size_t i=0;i<vTH2.size();i++)
188  if(vTH2[i]!=nullptr)
189  vTH2[i]->Write();
190 
191  file->Write();
192  file->Close();
193 
194  tkmap->save(true,0,0,"testTkMap.png");
195 
196 }
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:699
TH2F * SiStripCorrelateBadStripAndNoise::getHisto ( const long unsigned int &  index)
private

Definition at line 171 of file SiStripCorrelateBadStripAndNoise.cc.

References dataset::name, and vTH2.

Referenced by analyze(), and getHistos().

171  {
172  if(vTH2.size()<index+1)
173  vTH2.resize(index+1,nullptr);
174 
175  if(vTH2[index]==nullptr){
176  char name[128];
177  sprintf(name,"%lu",index);
178  edm::LogInfo("")<<"[getHisto] creating index " << index << std::endl;
179  vTH2[index]=new TH2F(name,name,50,-2.,2.,21,0.5,21.5);
180  }
181 
182  return vTH2[index];
183 }
void SiStripCorrelateBadStripAndNoise::getHistos ( const uint32_t &  detid,
const TrackerTopology tTopo,
std::vector< TH2F * > &  histos 
)
private

Definition at line 142 of file SiStripCorrelateBadStripAndNoise.cc.

References a, getHisto(), DetId::subdetId(), TrackerTopology::tecSide(), TrackerTopology::tecWheel(), TrackerTopology::tibLayer(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), and TrackerTopology::tobLayer().

Referenced by analyze(), and correlateWithNoise().

142  {
143 
144  histos.clear();
145 
146  int subdet=-999; int component=-999;
147  SiStripDetId a(detid);
148  if ( a.subdetId() == 3 ){
149  subdet=0;
150  component=tTopo->tibLayer(detid);
151  } else if ( a.subdetId() == 4 ) {
152  subdet=1;
153  component=tTopo->tidSide(detid)==2?tTopo->tidWheel(detid):tTopo->tidWheel(detid)+3;
154  } else if ( a.subdetId() == 5 ) {
155  subdet=2;
156  component=tTopo->tobLayer(detid);
157  } else if ( a.subdetId() == 6 ) {
158  subdet=3;
159  component=tTopo->tecSide(detid)==2?tTopo->tecWheel(detid):tTopo->tecWheel(detid)+9;
160  }
161 
162  int index=100+subdet*100+component;
163 
164 
165  histos.push_back(getHisto(subdet));
166  histos.push_back(getHisto(index));
167 
168 }
unsigned int tibLayer(const DetId &id) const
TH2F * getHisto(const long unsigned int &index)
unsigned int tidWheel(const DetId &id) const
unsigned int tidSide(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
double a
Definition: hdecay.h:121
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
float SiStripCorrelateBadStripAndNoise::getMeanNoise ( const SiStripNoises::Range noiseRange,
const uint32_t &  first,
const uint32_t &  range 
)
private

Definition at line 132 of file SiStripCorrelateBadStripAndNoise.cc.

References SiStripNoises::getNoise(), SiStripPI::mean, and noiseHandle_.

Referenced by correlateWithNoise(), and getQualityCache().

132  {
133 
134  float mean=0;
135  for (size_t istrip=firstStrip;istrip<firstStrip+range;istrip++){
136  mean+=noiseHandle_->getNoise(istrip,noiseRange);
137  }
138  return mean/(1.*range);
139 }
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:74
unsigned long long SiStripCorrelateBadStripAndNoise::getNoiseCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 64 of file SiStripCorrelateBadStripAndNoise.h.

References edm::EventSetup::get().

Referenced by beginRun().

64 { return eSetup.get<SiStripNoisesRcd>().cacheIdentifier();}
T get() const
Definition: EventSetup.h:63
unsigned long long SiStripCorrelateBadStripAndNoise::getQualityCache ( const edm::EventSetup eSetup)
inlineprivate
void SiStripCorrelateBadStripAndNoise::iterateOnBadStrips ( const uint32_t &  detid,
const TrackerTopology tTopo,
SiStripQuality::Range sqrange 
)
private

Definition at line 82 of file SiStripCorrelateBadStripAndNoise.cc.

References correlateWithNoise(), SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, fr, SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), qualityHandle_, and SiStripBadStrip::data::range.

Referenced by getQualityCache(), and iterateOnDets().

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

Definition at line 67 of file SiStripCorrelateBadStripAndNoise.cc.

References SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), iterateOnBadStrips(), and qualityHandle_.

Referenced by DoAnalysis(), and getQualityCache().

67  {
68 
71 
72 
73  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
74  const uint32_t detid=rp->detid;
75 
77  iterateOnBadStrips(detid,tTopo,sqrange);
78  }
79 }
void iterateOnBadStrips(const uint32_t &detid, const TrackerTopology *tTopo, SiStripQuality::Range &sqrange)
Registry::const_iterator RegistryIterator
RegistryIterator getRegistryVectorEnd() const
edm::ESHandle< SiStripQuality > qualityHandle_
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range

Member Data Documentation

unsigned long long SiStripCorrelateBadStripAndNoise::cacheID_noise
private

Definition at line 87 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

unsigned long long SiStripCorrelateBadStripAndNoise::cacheID_quality
private

Definition at line 86 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

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

Definition at line 78 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 77 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 81 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().