CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripCorrelateBadStripAndNoise Class Reference

#include <SiStripCorrelateBadStripAndNoise.h>

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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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, const TrackerGeometry *tGeom, SiStripQuality::Range &sqrange)
 
void iterateOnDets (const TrackerTopology *tTopo, const TrackerGeometry *tGeom)
 

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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

DQM/SiStripMonitorSummary/plugins/SiStripCorrelateBadStripAndNoise.cc

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

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

Definition at line 48 of file SiStripCorrelateBadStripAndNoise.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file SiStripCorrelateBadStripAndNoise.cc.

References file, and tkmap.

10  : cacheID_quality(0xFFFFFFFF), cacheID_noise(0xFFFFFFFF) {
11  // now do what ever initialization is needed
12  file = new TFile("correlTest.root", "RECREATE");
13  tkmap = new TrackerMap();
14 }
SiStripCorrelateBadStripAndNoise::~SiStripCorrelateBadStripAndNoise ( )
override

Definition at line 16 of file SiStripCorrelateBadStripAndNoise.cc.

16 {}

Member Function Documentation

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

Definition at line 55 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 20 of file SiStripCorrelateBadStripAndNoise.cc.

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

20  {
22  return;
25 
26  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun] cacheID_quality " << cacheID_quality
27  << " cacheID_noise " << cacheID_noise << std::endl;
28 
31 
32  DoAnalysis(es);
33 }
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:73
void SiStripCorrelateBadStripAndNoise::correlateWithNoise ( const uint32_t &  detid,
const TrackerTopology tTopo,
const uint32_t &  firstStrip,
const uint32_t &  range 
)
private

Definition at line 91 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by getQualityCache(), and iterateOnBadStrips().

94  {
95  std::vector<TH2F *> histos;
96 
97  SiStripNoises::Range noiseRange = noiseHandle_->getRange(detid);
98  edm::LogInfo("Domenico") << "detid " << detid << " first " << firstStrip << " range " << range;
99  float meanAPVNoise = getMeanNoise(noiseRange, firstStrip / 128, 128);
100 
101  // float meanNoiseHotStrips=getMeanNoise(noiseRange,firstStrip,range);
102  for (size_t theStrip = firstStrip; theStrip < firstStrip + range; theStrip++) {
103  float meanNoiseHotStrips = getMeanNoise(noiseRange, theStrip, 1);
104 
105  // Get the histogram for this detid
106  getHistos(detid, tTopo, histos);
107  float yvalue = range < 21 ? 1. * range : 21;
108 
109  for (size_t i = 0; i < histos.size(); ++i)
110  histos[i]->Fill(meanNoiseHotStrips / meanAPVNoise - 1., yvalue);
111 
112  if (meanNoiseHotStrips / meanAPVNoise - 1. < -0.3)
113  tkmap->fillc(detid, 0xFF0000);
114  else
115  tkmap->fillc(detid, 0x0000FF);
116  }
117 }
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:135
float getMeanNoise(const SiStripNoises::Range &noiseRange, const uint32_t &first, const uint32_t &range)
histos
Definition: combine.py:4
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
void SiStripCorrelateBadStripAndNoise::DoAnalysis ( const edm::EventSetup es)
private

Definition at line 35 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by analyze(), and beginRun().

35  {
36  // Retrieve tracker topology from geometry
38  es.get<TrackerTopologyRcd>().get(tTopoHandle);
40  es.get<TrackerDigiGeometryRecord>().get(tGeomHandle);
41 
42  // Loop on quality bad stirps
43  // for each strip, look at the noise
44  // evalaute the mean apv noise and the ratio among strip noise and
45  // meanApvNoise put the value in the histo in terms of ratio Vs percentage of
46  // badStrips per APV
47 
48  // Fill an histo per subdet and layer (and plus && minus for TEC/TID)
49  edm::LogInfo("") << "[Doanalysis]";
50  iterateOnDets(tTopoHandle.product(), tGeomHandle.product());
51 }
void iterateOnDets(const TrackerTopology *tTopo, const TrackerGeometry *tGeom)
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
void SiStripCorrelateBadStripAndNoise::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by analyze().

171  {
172  for (size_t i = 0; i < vTH2.size(); i++)
173  if (vTH2[i] != nullptr)
174  vTH2[i]->Write();
175 
176  file->Write();
177  file->Close();
178 
179  tkmap->save(true, 0, 0, "testTkMap.png");
180 }
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:811
TH2F * SiStripCorrelateBadStripAndNoise::getHisto ( const long unsigned int &  index)
private

Definition at line 157 of file SiStripCorrelateBadStripAndNoise.cc.

References Skims_PA_cff::name, and vTH2.

Referenced by analyze(), and getHistos().

157  {
158  if (vTH2.size() < index + 1)
159  vTH2.resize(index + 1, nullptr);
160 
161  if (vTH2[index] == nullptr) {
162  char name[128];
163  sprintf(name, "%lu", index);
164  edm::LogInfo("") << "[getHisto] creating index " << index << std::endl;
165  vTH2[index] = new TH2F(name, name, 50, -2., 2., 21, 0.5, 21.5);
166  }
167 
168  return vTH2[index];
169 }
void SiStripCorrelateBadStripAndNoise::getHistos ( const uint32_t &  detid,
const TrackerTopology tTopo,
std::vector< TH2F * > &  histos 
)
private

Definition at line 129 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().

131  {
132  histos.clear();
133 
134  int subdet = -999;
135  int component = -999;
136  SiStripDetId a(detid);
137  if (a.subdetId() == 3) {
138  subdet = 0;
139  component = tTopo->tibLayer(detid);
140  } else if (a.subdetId() == 4) {
141  subdet = 1;
142  component = tTopo->tidSide(detid) == 2 ? tTopo->tidWheel(detid) : tTopo->tidWheel(detid) + 3;
143  } else if (a.subdetId() == 5) {
144  subdet = 2;
145  component = tTopo->tobLayer(detid);
146  } else if (a.subdetId() == 6) {
147  subdet = 3;
148  component = tTopo->tecSide(detid) == 2 ? tTopo->tecWheel(detid) : tTopo->tecWheel(detid) + 9;
149  }
150 
151  int index = 100 + subdet * 100 + component;
152 
153  histos.push_back(getHisto(subdet));
154  histos.push_back(getHisto(index));
155 }
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:18
histos
Definition: combine.py:4
double a
Definition: hdecay.h:119
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 119 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by correlateWithNoise(), and getQualityCache().

121  {
122  float mean = 0;
123  for (size_t istrip = firstStrip; istrip < firstStrip + range; istrip++) {
124  mean += noiseHandle_->getNoise(istrip, noiseRange);
125  }
126  return mean / (1. * range);
127 }
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:71
unsigned long long SiStripCorrelateBadStripAndNoise::getNoiseCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 62 of file SiStripCorrelateBadStripAndNoise.h.

References edm::EventSetup::get().

Referenced by beginRun().

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

Definition at line 66 of file SiStripCorrelateBadStripAndNoise.cc.

References correlateWithNoise(), SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, TrackerGeometry::idToDet(), qualityHandle_, SiStripBadStrip::data::range, and FastTimerService_cff::range.

Referenced by getQualityCache(), and iterateOnDets().

69  {
70  float percentage = 0;
71  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
72  unsigned int firstStrip = qualityHandle_->decode(*(sqrange.first + it)).firstStrip;
73  unsigned int range = qualityHandle_->decode(*(sqrange.first + it)).range;
74 
75  correlateWithNoise(detid, tTopo, firstStrip, range);
76 
77  edm::LogInfo("range") << range;
78  percentage += range;
79  }
80  if (percentage != 0)
81  percentage /= dynamic_cast<const StripGeomDetUnit *>(tGeom->idToDet(detid))->specificTopology().nstrips();
82  if (percentage > 1)
83  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage << std::endl;
84 
85  //------- Global Statistics on percentage of bad components along the IOVs
86  //------//
87  if (percentage != 0)
88  edm::LogInfo("") << "percentage " << detid << " " << percentage;
89 }
unsigned short range
edm::ESHandle< SiStripQuality > qualityHandle_
unsigned short firstStrip
const TrackerGeomDet * idToDet(DetId) const override
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,
const TrackerGeometry tGeom 
)
private

Definition at line 53 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by DoAnalysis(), and getQualityCache().

53  {
56 
57  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
58  const uint32_t detid = rp->detid;
59 
61  qualityHandle_->getDataVectorBegin() + rp->iend);
62  iterateOnBadStrips(detid, tTopo, tGeom, sqrange);
63  }
64 }
void iterateOnBadStrips(const uint32_t &detid, const TrackerTopology *tTopo, const TrackerGeometry *tGeom, 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 92 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

unsigned long long SiStripCorrelateBadStripAndNoise::cacheID_quality
private

Definition at line 91 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

TFile* SiStripCorrelateBadStripAndNoise::file
private
SiStripDetInfoFileReader* SiStripCorrelateBadStripAndNoise::fr
private

Definition at line 82 of file SiStripCorrelateBadStripAndNoise.h.

edm::ESHandle<SiStripNoises> SiStripCorrelateBadStripAndNoise::noiseHandle_
private

Definition at line 84 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 83 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 87 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().