CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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)
 
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

TFile * file
 
const SiStripNoisesnoises_
 
edm::ESGetToken< SiStripNoises,
SiStripNoisesRcd
noiseToken_
 
edm::ESWatcher< SiStripNoisesRcdnoiseWatcher_
 
const SiStripQualityquality_
 
edm::ESGetToken
< SiStripQuality,
SiStripQualityRcd
qualityToken_
 
edm::ESWatcher< SiStripQualityRcdqualityWatcher_
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
tkGeomToken_
 
TrackerMaptkmap
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tTopoToken_
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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, noiseToken_, tkGeomToken_, tkmap, and tTopoToken_.

10  : qualityToken_{esConsumes<edm::Transition::BeginRun>()},
11  noiseToken_{esConsumes<edm::Transition::BeginRun>()},
12  tTopoToken_{esConsumes<edm::Transition::BeginRun>()},
13  tkGeomToken_{esConsumes<edm::Transition::BeginRun>()} {
14  // now do what ever initialization is needed
15  file = new TFile("correlTest.root", "RECREATE");
16  tkmap = new TrackerMap();
17 }
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
SiStripCorrelateBadStripAndNoise::~SiStripCorrelateBadStripAndNoise ( )
override

Definition at line 19 of file SiStripCorrelateBadStripAndNoise.cc.

19 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 55 of file SiStripCorrelateBadStripAndNoise.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 23 of file SiStripCorrelateBadStripAndNoise.cc.

References edm::ESWatcher< T >::check(), DoAnalysis(), edm::EventSetup::getData(), noises_, noiseToken_, noiseWatcher_, quality_, qualityToken_, and qualityWatcher_.

23  {
24  if (noiseWatcher_.check(es) || qualityWatcher_.check(es)) {
25  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun]" << std::endl;
26 
29 
30  DoAnalysis(es);
31  }
32 }
edm::ESWatcher< SiStripQualityRcd > qualityWatcher_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
Log< level::Info, false > LogInfo
edm::ESWatcher< SiStripNoisesRcd > noiseWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
void SiStripCorrelateBadStripAndNoise::correlateWithNoise ( const uint32_t &  detid,
const TrackerTopology tTopo,
const uint32_t &  firstStrip,
const uint32_t &  range 
)
private

Definition at line 83 of file SiStripCorrelateBadStripAndNoise.cc.

References HcalObjRepresent::Fill(), TrackerMap::fillc(), getHistos(), getMeanNoise(), SiStripNoises::getRange(), mergeVDriftHistosByStation::histos, mps_fire::i, noises_, sistrip::SpyUtilities::range(), and tkmap.

Referenced by iterateOnBadStrips().

86  {
87  std::vector<TH2F *> histos;
88 
89  SiStripNoises::Range noiseRange = noises_->getRange(detid);
90  edm::LogInfo("Domenico") << "detid " << detid << " first " << firstStrip << " range " << range;
91  float meanAPVNoise = getMeanNoise(noiseRange, firstStrip / 128, 128);
92 
93  // float meanNoiseHotStrips=getMeanNoise(noiseRange,firstStrip,range);
94  for (size_t theStrip = firstStrip; theStrip < firstStrip + range; theStrip++) {
95  float meanNoiseHotStrips = getMeanNoise(noiseRange, theStrip, 1);
96 
97  // Get the histogram for this detid
98  getHistos(detid, tTopo, histos);
99  float yvalue = range < 21 ? 1. * range : 21;
100 
101  for (size_t i = 0; i < histos.size(); ++i)
102  histos[i]->Fill(meanNoiseHotStrips / meanAPVNoise - 1., yvalue);
103 
104  if (meanNoiseHotStrips / meanAPVNoise - 1. < -0.3)
105  tkmap->fillc(detid, 0xFF0000);
106  else
107  tkmap->fillc(detid, 0x0000FF);
108  }
109 }
const uint16_t range(const Frame &aFrame)
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)
Log< level::Info, false > LogInfo
const Range getRange(const uint32_t detID) const
void getHistos(const uint32_t &detid, const TrackerTopology &tTopo, std::vector< TH2F * > &histos)
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
void SiStripCorrelateBadStripAndNoise::DoAnalysis ( const edm::EventSetup es)
private

Definition at line 34 of file SiStripCorrelateBadStripAndNoise.cc.

References edm::EventSetup::getData(), iterateOnDets(), tkGeomToken_, and tTopoToken_.

Referenced by beginRun().

34  {
35  // Loop on quality bad stirps
36  // for each strip, look at the noise
37  // evalaute the mean apv noise and the ratio among strip noise and
38  // meanApvNoise put the value in the histo in terms of ratio Vs percentage of
39  // badStrips per APV
40 
41  // Fill an histo per subdet and layer (and plus && minus for TEC/TID)
42  edm::LogInfo("") << "[Doanalysis]";
44 }
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
Log< level::Info, false > LogInfo
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
void iterateOnDets(const TrackerTopology &tTopo, const TrackerGeometry &tGeom)
void SiStripCorrelateBadStripAndNoise::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 163 of file SiStripCorrelateBadStripAndNoise.cc.

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

163  {
164  for (size_t i = 0; i < vTH2.size(); i++)
165  if (vTH2[i] != nullptr)
166  vTH2[i]->Write();
167 
168  file->Write();
169  file->Close();
170 
171  tkmap->save(true, 0, 0, "testTkMap.png");
172 }
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 149 of file SiStripCorrelateBadStripAndNoise.cc.

References mergeVDriftHistosByStation::name, and vTH2.

Referenced by getHistos().

149  {
150  if (vTH2.size() < index + 1)
151  vTH2.resize(index + 1, nullptr);
152 
153  if (vTH2[index] == nullptr) {
154  char name[128];
155  sprintf(name, "%lu", index);
156  edm::LogInfo("") << "[getHisto] creating index " << index << std::endl;
157  vTH2[index] = new TH2F(name, name, 50, -2., 2., 21, 0.5, 21.5);
158  }
159 
160  return vTH2[index];
161 }
Log< level::Info, false > LogInfo
void SiStripCorrelateBadStripAndNoise::getHistos ( const uint32_t &  detid,
const TrackerTopology tTopo,
std::vector< TH2F * > &  histos 
)
private

Definition at line 121 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by correlateWithNoise().

123  {
124  histos.clear();
125 
126  int subdet = -999;
127  int component = -999;
128  SiStripDetId a(detid);
129  if (a.subdetId() == 3) {
130  subdet = 0;
131  component = tTopo.tibLayer(detid);
132  } else if (a.subdetId() == 4) {
133  subdet = 1;
134  component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3;
135  } else if (a.subdetId() == 5) {
136  subdet = 2;
137  component = tTopo.tobLayer(detid);
138  } else if (a.subdetId() == 6) {
139  subdet = 3;
140  component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9;
141  }
142 
143  int index = 100 + subdet * 100 + component;
144 
145  histos.push_back(getHisto(subdet));
146  histos.push_back(getHisto(index));
147 }
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
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 111 of file SiStripCorrelateBadStripAndNoise.cc.

References SiStripNoises::getNoise(), SiStripPI::mean, noises_, and sistrip::SpyUtilities::range().

Referenced by correlateWithNoise().

113  {
114  float mean = 0;
115  for (size_t istrip = firstStrip; istrip < firstStrip + range; istrip++) {
116  mean += noises_->getNoise(istrip, noiseRange);
117  }
118  return mean / (1. * range);
119 }
const uint16_t range(const Frame &aFrame)
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:73
void SiStripCorrelateBadStripAndNoise::iterateOnBadStrips ( const uint32_t &  detid,
const TrackerTopology tTopo,
const TrackerGeometry tGeom,
SiStripQuality::Range sqrange 
)
private

Definition at line 58 of file SiStripCorrelateBadStripAndNoise.cc.

References correlateWithNoise(), SiStripBadStrip::decode(), SiStripBadStrip::data::firstStrip, TrackerGeometry::idToDet(), quality_, SiStripBadStrip::data::range, and sistrip::SpyUtilities::range().

Referenced by iterateOnDets().

61  {
62  float percentage = 0;
63  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
64  unsigned int firstStrip = quality_->decode(*(sqrange.first + it)).firstStrip;
65  unsigned int range = quality_->decode(*(sqrange.first + it)).range;
66 
67  correlateWithNoise(detid, tTopo, firstStrip, range);
68 
69  edm::LogInfo("range") << range;
70  percentage += range;
71  }
72  if (percentage != 0)
73  percentage /= dynamic_cast<const StripGeomDetUnit *>(tGeom.idToDet(detid))->specificTopology().nstrips();
74  if (percentage > 1)
75  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage << std::endl;
76 
77  //------- Global Statistics on percentage of bad components along the IOVs
78  //------//
79  if (percentage != 0)
80  edm::LogInfo("") << "percentage " << detid << " " << percentage;
81 }
unsigned short range
Log< level::Error, false > LogError
const uint16_t range(const Frame &aFrame)
void correlateWithNoise(const uint32_t &detid, const TrackerTopology &tTopo, const uint32_t &firstStrip, const uint32_t &range)
const TrackerGeomDet * idToDet(DetId) const override
Log< level::Info, false > LogInfo
unsigned short firstStrip
data decode(const unsigned int &value) const
void SiStripCorrelateBadStripAndNoise::iterateOnDets ( const TrackerTopology tTopo,
const TrackerGeometry tGeom 
)
private

Definition at line 46 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by DoAnalysis().

46  {
47  const auto rbegin = quality_->getRegistryVectorBegin();
48  const auto rend = quality_->getRegistryVectorEnd();
49  for (auto rp = rbegin; rp != rend; ++rp) {
50  const uint32_t detid = rp->detid;
51 
52  auto sqrange =
54  iterateOnBadStrips(detid, tTopo, tGeom, sqrange);
55  }
56 }
void iterateOnBadStrips(const uint32_t &detid, const TrackerTopology &tTopo, const TrackerGeometry &tGeom, SiStripQuality::Range &sqrange)
RegistryIterator getRegistryVectorEnd() const
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range

Member Data Documentation

TFile* SiStripCorrelateBadStripAndNoise::file
private
const SiStripNoises* SiStripCorrelateBadStripAndNoise::noises_
private

Definition at line 82 of file SiStripCorrelateBadStripAndNoise.h.

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

edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> SiStripCorrelateBadStripAndNoise::noiseToken_
private
edm::ESWatcher<SiStripNoisesRcd> SiStripCorrelateBadStripAndNoise::noiseWatcher_
private

Definition at line 76 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

const SiStripQuality* SiStripCorrelateBadStripAndNoise::quality_
private

Definition at line 81 of file SiStripCorrelateBadStripAndNoise.h.

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

edm::ESGetToken<SiStripQuality, SiStripQualityRcd> SiStripCorrelateBadStripAndNoise::qualityToken_
private

Definition at line 77 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

edm::ESWatcher<SiStripQualityRcd> SiStripCorrelateBadStripAndNoise::qualityWatcher_
private

Definition at line 75 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripCorrelateBadStripAndNoise::tkGeomToken_
private
TrackerMap* SiStripCorrelateBadStripAndNoise::tkmap
private
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripCorrelateBadStripAndNoise::tTopoToken_
private
std::vector<TH2F *> SiStripCorrelateBadStripAndNoise::vTH2
private

Definition at line 85 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().