CMS 3D CMS Logo

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

#include <SiStripPlotGain.h>

Inheritance diagram for SiStripPlotGain:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripPlotGain (const edm::ParameterSet &)
 
 ~SiStripPlotGain () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 DoAnalysis (const TrackerTopology &tTopo, const SiStripApvGain &)
 
void endJob () override
 
TH1F * getHisto (const long unsigned int &index)
 
void getHistos (DetId detid, const TrackerTopology &tTopo, std::vector< TH1F * > &histos)
 

Private Attributes

TFile * file
 
SiStripDetInfoFileReaderfr
 
edm::ESGetToken< SiStripApvGain, SiStripApvGainRcdgainToken_
 
edm::ESWatcher< SiStripApvGainRcdgainWatcher_
 
TrackerMaptkmap
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
std::vector< TH1F * > vTH1
 

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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

DQM/SiStripMonitorSummary/plugins/SiStripPlotGain.cc

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

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

Definition at line 50 of file SiStripPlotGain.h.

Constructor & Destructor Documentation

◆ SiStripPlotGain()

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

Definition at line 3 of file SiStripPlotGain.cc.

4  : gainToken_{esConsumes<edm::Transition::BeginRun>()}, tTopoToken_{esConsumes<edm::Transition::BeginRun>()} {
5  // now do what ever initialization is needed
6  file = new TFile("correlTest.root", "RECREATE");
7  tkmap = new TrackerMap();
8 }

◆ ~SiStripPlotGain()

SiStripPlotGain::~SiStripPlotGain ( )
override

Definition at line 10 of file SiStripPlotGain.cc.

10 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 57 of file SiStripPlotGain.h.

57 {};

◆ beginRun()

void SiStripPlotGain::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 14 of file SiStripPlotGain.cc.

14  {
15  if (gainWatcher_.check(es)) {
16  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << es.get<SiStripApvGainRcd>().cacheIdentifier()
17  << std::endl;
19  }
20 }

References edm::ESWatcher< T >::check(), DoAnalysis(), gainToken_, gainWatcher_, edm::EventSetup::get(), edm::EventSetup::getData(), and tTopoToken_.

◆ DoAnalysis()

void SiStripPlotGain::DoAnalysis ( const TrackerTopology tTopo,
const SiStripApvGain gain 
)
private

Definition at line 22 of file SiStripPlotGain.cc.

22  {
23  edm::LogInfo("") << "[Doanalysis]";
24 
25  std::vector<TH1F *> histos;
26 
27  SiStripApvGain::RegistryPointers p = gain.getRegistryPointers();
29  iter = p.detid_begin;
30  iterE = p.detid_end;
31 
32  float value;
33 
34  // Divide result by d
35  for (; iter != iterE; ++iter) {
36  getHistos(*iter, tTopo, histos);
37  SiStripApvGain::Range range = SiStripApvGain::Range(p.getFirstElement(iter), p.getLastElement(iter));
38 
39  edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second - range.first;
40  size_t apv = 0, apvE = (range.second - range.first);
41  for (; apv < apvE; apv += 2) {
42  value = gain.getApvGain(apv, range);
43  tkmap->fill(*iter, value);
44  for (size_t i = 0; i < histos.size(); ++i)
45  histos[i]->Fill(value);
46  }
47  }
48 }

References TrackerMap::fill(), HcalObjRepresent::Fill(), PedestalClient_cfi::gain, getHistos(), combine::histos, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, FastTimerService_cff::range, tkmap, and relativeConstraints::value.

Referenced by beginRun().

◆ endJob()

void SiStripPlotGain::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file SiStripPlotGain.cc.

89  {
90  for (size_t i = 0; i < vTH1.size(); i++)
91  if (vTH1[i] != nullptr)
92  vTH1[i]->Write();
93 
94  file->Write();
95  file->Close();
96 
97  tkmap->save(false, 0, 0, "testTkMap.png");
98 }

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

◆ getHisto()

TH1F * SiStripPlotGain::getHisto ( const long unsigned int &  index)
private

Definition at line 75 of file SiStripPlotGain.cc.

75  {
76  if (vTH1.size() < index + 1)
77  vTH1.resize(index + 1, nullptr);
78 
79  if (vTH1[index] == nullptr) {
80  char name[128];
81  sprintf(name, "%lu", index);
82  edm::LogInfo("") << "[getHisto] creating index " << index << std::endl;
83  vTH1[index] = new TH1F(name, name, 150, 0., 5.);
84  }
85 
86  return vTH1[index];
87 }

References Skims_PA_cff::name, and vTH1.

Referenced by getHistos().

◆ getHistos()

void SiStripPlotGain::getHistos ( DetId  detid,
const TrackerTopology tTopo,
std::vector< TH1F * > &  histos 
)
private

Definition at line 50 of file SiStripPlotGain.cc.

50  {
51  histos.clear();
52 
53  int subdet = -999;
54  int component = -999;
55  if (detid.subdetId() == 3) {
56  subdet = 0;
57  component = tTopo.tibLayer(detid);
58  } else if (detid.subdetId() == 4) {
59  subdet = 1;
60  component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3;
61  } else if (detid.subdetId() == 5) {
62  subdet = 2;
63  component = tTopo.tobLayer(detid);
64  } else if (detid.subdetId() == 6) {
65  subdet = 3;
66  component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9;
67  }
68 
69  int index = 100 + subdet * 100 + component;
70 
71  histos.push_back(getHisto(subdet + 1));
72  histos.push_back(getHisto(index));
73 }

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

Referenced by DoAnalysis().

Member Data Documentation

◆ file

TFile* SiStripPlotGain::file
private

◆ fr

SiStripDetInfoFileReader* SiStripPlotGain::fr
private

Definition at line 66 of file SiStripPlotGain.h.

◆ gainToken_

edm::ESGetToken<SiStripApvGain, SiStripApvGainRcd> SiStripPlotGain::gainToken_
private

Definition at line 69 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ gainWatcher_

edm::ESWatcher<SiStripApvGainRcd> SiStripPlotGain::gainWatcher_
private

Definition at line 68 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ tkmap

TrackerMap* SiStripPlotGain::tkmap
private

Definition at line 75 of file SiStripPlotGain.h.

Referenced by DoAnalysis(), and endJob().

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripPlotGain::tTopoToken_
private

Definition at line 70 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ vTH1

std::vector<TH1F *> SiStripPlotGain::vTH1
private

Definition at line 73 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripPlotGain::gainToken_
edm::ESGetToken< SiStripApvGain, SiStripApvGainRcd > gainToken_
Definition: SiStripPlotGain.h:69
mps_fire.i
i
Definition: mps_fire.py:428
SiStripApvGain::RegistryPointers
Definition: SiStripApvGain.h:34
SiStripPlotGain::DoAnalysis
void DoAnalysis(const TrackerTopology &tTopo, const SiStripApvGain &)
Definition: SiStripPlotGain.cc:22
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TrackerMap::fill
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3288
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripPlotGain::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripPlotGain.h:70
SiStripApvGain::RegistryConstIterator
Registry::const_iterator RegistryConstIterator
Definition: SiStripApvGain.h:31
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
TrackerMap
Definition: TrackerMap.h:76
SiStripPlotGain::tkmap
TrackerMap * tkmap
Definition: SiStripPlotGain.h:75
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
TrackerTopology::tidSide
unsigned int tidSide(const DetId &id) const
Definition: TrackerTopology.h:190
SiStripPlotGain::getHisto
TH1F * getHisto(const long unsigned int &index)
Definition: SiStripPlotGain.cc:75
value
Definition: value.py:1
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripApvGainRcd
Definition: SiStripCondDataRecords.h:8
combine.histos
histos
Definition: combine.py:4
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiStripPlotGain::gainWatcher_
edm::ESWatcher< SiStripApvGainRcd > gainWatcher_
Definition: SiStripPlotGain.h:68
TrackerMap::save
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:810
SiStripPlotGain::file
TFile * file
Definition: SiStripPlotGain.h:72
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiStripPlotGain::getHistos
void getHistos(DetId detid, const TrackerTopology &tTopo, std::vector< TH1F * > &histos)
Definition: SiStripPlotGain.cc:50
SiStripPlotGain::vTH1
std::vector< TH1F * > vTH1
Definition: SiStripPlotGain.h:73
TrackerTopology::tecWheel
unsigned int tecWheel(const DetId &id) const
Definition: TrackerTopology.h:198
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184