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, 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 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 6 of file SiStripCorrelateBadStripAndNoise.cc.

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

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

Definition at line 23 of file SiStripCorrelateBadStripAndNoise.cc.

23 {}

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 plotFactory::histos.

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

Definition at line 27 of file SiStripCorrelateBadStripAndNoise.cc.

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

27  {
29  return;
32 
33  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun] cacheID_quality " << cacheID_quality
34  << " cacheID_noise " << cacheID_noise << std::endl;
35 
38 
39  DoAnalysis(es);
40 }
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:71
void SiStripCorrelateBadStripAndNoise::correlateWithNoise ( const uint32_t &  detid,
const TrackerTopology tTopo,
const uint32_t &  firstStrip,
const uint32_t &  range 
)
private

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

99  {
100  std::vector<TH2F *> histos;
101 
102  SiStripNoises::Range noiseRange = noiseHandle_->getRange(detid);
103  edm::LogInfo("Domenico") << "detid " << detid << " first " << firstStrip << " range " << range;
104  float meanAPVNoise = getMeanNoise(noiseRange, firstStrip / 128, 128);
105 
106  // float meanNoiseHotStrips=getMeanNoise(noiseRange,firstStrip,range);
107  for (size_t theStrip = firstStrip; theStrip < firstStrip + range; theStrip++) {
108  float meanNoiseHotStrips = getMeanNoise(noiseRange, theStrip, 1);
109 
110  // Get the histogram for this detid
111  getHistos(detid, tTopo, histos);
112  float yvalue = range < 21 ? 1. * range : 21;
113 
114  for (size_t i = 0; i < histos.size(); ++i)
115  histos[i]->Fill(meanNoiseHotStrips / meanAPVNoise - 1., yvalue);
116 
117  if (meanNoiseHotStrips / meanAPVNoise - 1. < -0.3)
118  tkmap->fillc(detid, 0xFF0000);
119  else
120  tkmap->fillc(detid, 0x0000FF);
121  }
122 }
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 42 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by analyze(), and beginRun().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 176 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by analyze().

176  {
177  for (size_t i = 0; i < vTH2.size(); i++)
178  if (vTH2[i] != nullptr)
179  vTH2[i]->Write();
180 
181  file->Write();
182  file->Close();
183 
184  tkmap->save(true, 0, 0, "testTkMap.png");
185 }
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 162 of file SiStripCorrelateBadStripAndNoise.cc.

References dataset::name, and vTH2.

Referenced by analyze(), and getHistos().

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

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

136  {
137  histos.clear();
138 
139  int subdet = -999;
140  int component = -999;
141  SiStripDetId a(detid);
142  if (a.subdetId() == 3) {
143  subdet = 0;
144  component = tTopo->tibLayer(detid);
145  } else if (a.subdetId() == 4) {
146  subdet = 1;
147  component = tTopo->tidSide(detid) == 2 ? tTopo->tidWheel(detid) : tTopo->tidWheel(detid) + 3;
148  } else if (a.subdetId() == 5) {
149  subdet = 2;
150  component = tTopo->tobLayer(detid);
151  } else if (a.subdetId() == 6) {
152  subdet = 3;
153  component = tTopo->tecSide(detid) == 2 ? tTopo->tecWheel(detid) : tTopo->tecWheel(detid) + 9;
154  }
155 
156  int index = 100 + subdet * 100 + component;
157 
158  histos.push_back(getHisto(subdet));
159  histos.push_back(getHisto(index));
160 }
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 124 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by correlateWithNoise(), and getQualityCache().

126  {
127  float mean = 0;
128  for (size_t istrip = firstStrip; istrip < firstStrip + range; istrip++) {
129  mean += noiseHandle_->getNoise(istrip, noiseRange);
130  }
131  return mean / (1. * range);
132 }
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 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:71
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 72 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by getQualityCache(), and iterateOnDets().

74  {
75  float percentage = 0;
76  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
77  unsigned int firstStrip = qualityHandle_->decode(*(sqrange.first + it)).firstStrip;
78  unsigned int range = qualityHandle_->decode(*(sqrange.first + it)).range;
79 
80  correlateWithNoise(detid, tTopo, firstStrip, range);
81 
82  edm::LogInfo("range") << range;
83  percentage += range;
84  }
85  if (percentage != 0)
86  percentage /= 128. * fr->getNumberOfApvsAndStripLength(detid).first;
87  if (percentage > 1)
88  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage << std::endl;
89 
90  //------- Global Statistics on percentage of bad components along the IOVs
91  //------//
92  if (percentage != 0)
93  edm::LogInfo("") << "percentage " << detid << " " << percentage;
94 }
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 59 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by DoAnalysis(), and getQualityCache().

59  {
62 
63  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
64  const uint32_t detid = rp->detid;
65 
67  qualityHandle_->getDataVectorBegin() + rp->iend);
68  iterateOnBadStrips(detid, tTopo, sqrange);
69  }
70 }
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 89 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

unsigned long long SiStripCorrelateBadStripAndNoise::cacheID_quality
private

Definition at line 88 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

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

Definition at line 81 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 80 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 84 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().