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

Public Member Functions

 SiStripPlotGain (const edm::ParameterSet &)
 
 ~SiStripPlotGain () 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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
 
void endRun (const edm::Run &run, const edm::EventSetup &es) override
 
TH1F * getHisto (const long unsigned int &index)
 
void getHistos (DetId detid, const TrackerTopology &tTopo, std::vector< TH1F *> &histos)
 

Private Attributes

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

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 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/SiStripPlotGain.cc

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

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

Definition at line 47 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 }
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
edm::ESGetToken< SiStripApvGain, SiStripApvGainRcd > gainToken_
TrackerMap * tkmap

◆ ~SiStripPlotGain()

SiStripPlotGain::~SiStripPlotGain ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 54 of file SiStripPlotGain.h.

54 {}

◆ beginRun()

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

Definition at line 10 of file SiStripPlotGain.cc.

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

10  {
11  if (gainWatcher_.check(es)) {
12  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << es.get<SiStripApvGainRcd>().cacheIdentifier()
13  << std::endl;
15  }
16 }
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void DoAnalysis(const TrackerTopology &tTopo, const SiStripApvGain &)
T get() const
Definition: EventSetup.h:79
Log< level::Info, false > LogInfo
edm::ESGetToken< SiStripApvGain, SiStripApvGainRcd > gainToken_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< SiStripApvGainRcd > gainWatcher_

◆ DoAnalysis()

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

Definition at line 18 of file SiStripPlotGain.cc.

References TrackerMap::fill(), HcalObjRepresent::Fill(), Hcal_Conditions_forGlobalTag_cff::gain, getHistos(), mergeVDriftHistosByStation::histos, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, isotrackApplyRegressor::range, tkmap, and relativeConstraints::value.

Referenced by beginRun().

18  {
19  edm::LogInfo("") << "[Doanalysis]";
20 
21  std::vector<TH1F *> histos;
22 
23  SiStripApvGain::RegistryPointers p = gain.getRegistryPointers();
25  iter = p.detid_begin;
26  iterE = p.detid_end;
27 
28  float value;
29 
30  // Divide result by d
31  for (; iter != iterE; ++iter) {
32  getHistos(*iter, tTopo, histos);
33  SiStripApvGain::Range range = SiStripApvGain::Range(p.getFirstElement(iter), p.getLastElement(iter));
34 
35  edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second - range.first;
36  size_t apv = 0, apvE = (range.second - range.first);
37  for (; apv < apvE; apv += 2) {
38  value = gain.getApvGain(apv, range);
39  tkmap->fill(*iter, value);
40  for (size_t i = 0; i < histos.size(); ++i)
41  histos[i]->Fill(value);
42  }
43  }
44 }
Registry::const_iterator RegistryConstIterator
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::pair< ContainerIterator, ContainerIterator > Range
Definition: value.py:1
Log< level::Info, false > LogInfo
TrackerMap * tkmap
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3444
void getHistos(DetId detid, const TrackerTopology &tTopo, std::vector< TH1F *> &histos)

◆ endJob()

void SiStripPlotGain::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 85 of file SiStripPlotGain.cc.

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

85  {
86  for (size_t i = 0; i < vTH1.size(); i++)
87  if (vTH1[i] != nullptr)
88  vTH1[i]->Write();
89 
90  file->Write();
91  file->Close();
92 
93  tkmap->save(false, 0, 0, "testTkMap.png");
94 }
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:843
TrackerMap * tkmap
std::vector< TH1F * > vTH1

◆ endRun()

void SiStripPlotGain::endRun ( const edm::Run run,
const edm::EventSetup es 
)
inlineoverrideprivate

Definition at line 55 of file SiStripPlotGain.h.

55 {}

◆ getHisto()

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

Definition at line 71 of file SiStripPlotGain.cc.

References mergeVDriftHistosByStation::name, and vTH1.

Referenced by getHistos().

71  {
72  if (vTH1.size() < index + 1)
73  vTH1.resize(index + 1, nullptr);
74 
75  if (vTH1[index] == nullptr) {
76  char name[128];
77  sprintf(name, "%lu", index);
78  edm::LogInfo("") << "[getHisto] creating index " << index << std::endl;
79  vTH1[index] = new TH1F(name, name, 150, 0., 5.);
80  }
81 
82  return vTH1[index];
83 }
Log< level::Info, false > LogInfo
std::vector< TH1F * > vTH1

◆ getHistos()

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

Definition at line 46 of file SiStripPlotGain.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid, getHisto(), mergeVDriftHistosByStation::histos, TrackerTopology::tecSide(), TrackerTopology::tecWheel(), TrackerTopology::tibLayer(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), and TrackerTopology::tobLayer().

Referenced by DoAnalysis().

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

Member Data Documentation

◆ file

TFile* SiStripPlotGain::file
private

◆ gainToken_

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

Definition at line 64 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ gainWatcher_

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

Definition at line 63 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ tkmap

TrackerMap* SiStripPlotGain::tkmap
private

Definition at line 70 of file SiStripPlotGain.h.

Referenced by DoAnalysis(), and endJob().

◆ tTopoToken_

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

Definition at line 65 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ vTH1

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

Definition at line 68 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().