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::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiStripCorrelateBadStripAndNoise (const edm::ParameterSet &)
 
 ~SiStripCorrelateBadStripAndNoise () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
void endRun (const edm::Run &run, const edm::EventSetup &es) 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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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< Bconsumes (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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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 46 of file SiStripCorrelateBadStripAndNoise.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file SiStripCorrelateBadStripAndNoise.cc.

References file, noiseToken_, tkGeomToken_, tkmap, and tTopoToken_.

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

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 53 of file SiStripCorrelateBadStripAndNoise.h.

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

Definition at line 18 of file SiStripCorrelateBadStripAndNoise.cc.

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

18  {
19  if (noiseWatcher_.check(es) || qualityWatcher_.check(es)) {
20  edm::LogInfo("") << "[SiStripCorrelateBadStripAndNoise::beginRun]" << std::endl;
21 
24 
25  DoAnalysis(es);
26  }
27 }
edm::ESWatcher< SiStripQualityRcd > qualityWatcher_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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 78 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().

81  {
82  std::vector<TH2F *> histos;
83 
84  SiStripNoises::Range noiseRange = noises_->getRange(detid);
85  edm::LogInfo("Domenico") << "detid " << detid << " first " << firstStrip << " range " << range;
86  float meanAPVNoise = getMeanNoise(noiseRange, firstStrip / 128, 128);
87 
88  // float meanNoiseHotStrips=getMeanNoise(noiseRange,firstStrip,range);
89  for (size_t theStrip = firstStrip; theStrip < firstStrip + range; theStrip++) {
90  float meanNoiseHotStrips = getMeanNoise(noiseRange, theStrip, 1);
91 
92  // Get the histogram for this detid
93  getHistos(detid, tTopo, histos);
94  float yvalue = range < 21 ? 1. * range : 21;
95 
96  for (size_t i = 0; i < histos.size(); ++i)
97  histos[i]->Fill(meanNoiseHotStrips / meanAPVNoise - 1., yvalue);
98 
99  if (meanNoiseHotStrips / meanAPVNoise - 1. < -0.3)
100  tkmap->fillc(detid, 0xFF0000);
101  else
102  tkmap->fillc(detid, 0x0000FF);
103  }
104 }
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 29 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by beginRun().

29  {
30  // Loop on quality bad stirps
31  // for each strip, look at the noise
32  // evalaute the mean apv noise and the ratio among strip noise and
33  // meanApvNoise put the value in the histo in terms of ratio Vs percentage of
34  // badStrips per APV
35 
36  // Fill an histo per subdet and layer (and plus && minus for TEC/TID)
37  edm::LogInfo("") << "[Doanalysis]";
39 }
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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::one::EDAnalyzerBase.

Definition at line 158 of file SiStripCorrelateBadStripAndNoise.cc.

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

158  {
159  for (size_t i = 0; i < vTH2.size(); i++)
160  if (vTH2[i] != nullptr)
161  vTH2[i]->Write();
162 
163  file->Write();
164  file->Close();
165 
166  tkmap->save(true, 0, 0, "testTkMap.png");
167 }
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
void SiStripCorrelateBadStripAndNoise::endRun ( const edm::Run run,
const edm::EventSetup es 
)
inlineoverrideprivate

Definition at line 54 of file SiStripCorrelateBadStripAndNoise.h.

54 {};
TH2F * SiStripCorrelateBadStripAndNoise::getHisto ( const long unsigned int &  index)
private

Definition at line 144 of file SiStripCorrelateBadStripAndNoise.cc.

References mergeVDriftHistosByStation::name, and vTH2.

Referenced by getHistos().

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

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

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

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

Referenced by correlateWithNoise().

108  {
109  float mean = 0;
110  for (size_t istrip = firstStrip; istrip < firstStrip + range; istrip++) {
111  mean += noises_->getNoise(istrip, noiseRange);
112  }
113  return mean / (1. * range);
114 }
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 53 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by iterateOnDets().

56  {
57  float percentage = 0;
58  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
59  unsigned int firstStrip = quality_->decode(*(sqrange.first + it)).firstStrip;
60  unsigned int range = quality_->decode(*(sqrange.first + it)).range;
61 
62  correlateWithNoise(detid, tTopo, firstStrip, range);
63 
64  edm::LogInfo("range") << range;
65  percentage += range;
66  }
67  if (percentage != 0)
68  percentage /= dynamic_cast<const StripGeomDetUnit *>(tGeom.idToDet(detid))->specificTopology().nstrips();
69  if (percentage > 1)
70  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage << std::endl;
71 
72  //------- Global Statistics on percentage of bad components along the IOVs
73  //------//
74  if (percentage != 0)
75  edm::LogInfo("") << "percentage " << detid << " " << percentage;
76 }
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 41 of file SiStripCorrelateBadStripAndNoise.cc.

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

Referenced by DoAnalysis().

41  {
42  const auto rbegin = quality_->getRegistryVectorBegin();
43  const auto rend = quality_->getRegistryVectorEnd();
44  for (auto rp = rbegin; rp != rend; ++rp) {
45  const uint32_t detid = rp->detid;
46 
47  auto sqrange =
49  iterateOnBadStrips(detid, tTopo, tGeom, sqrange);
50  }
51 }
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 81 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 75 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

const SiStripQuality* SiStripCorrelateBadStripAndNoise::quality_
private

Definition at line 80 of file SiStripCorrelateBadStripAndNoise.h.

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

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

Definition at line 76 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by beginRun().

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

Definition at line 74 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 84 of file SiStripCorrelateBadStripAndNoise.h.

Referenced by endJob(), and getHisto().