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
 
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
 
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 edm::EventSetup &es, const SiStripApvGain &)
 
void endJob () override
 
unsigned long long getCache (const edm::EventSetup &eSetup)
 
TH1F * getHisto (const long unsigned int &index)
 
void getHistos (const uint32_t &detid, const TrackerTopology *tTopo, std::vector< TH1F * > &histos)
 

Private Attributes

unsigned long long cacheID
 
TFile * file
 
SiStripDetInfoFileReaderfr
 
edm::ESHandle< SiStripApvGainHandle_
 
TrackerMaptkmap
 
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 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>
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)
 
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 48 of file SiStripPlotGain.h.

Constructor & Destructor Documentation

◆ SiStripPlotGain()

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

Definition at line 7 of file SiStripPlotGain.cc.

7  : cacheID(0xFFFFFFFF) {
8  // now do what ever initialization is needed
9  file = new TFile("correlTest.root", "RECREATE");
10  tkmap = new TrackerMap();
11 }

References file, and tkmap.

◆ ~SiStripPlotGain()

SiStripPlotGain::~SiStripPlotGain ( )
override

Definition at line 13 of file SiStripPlotGain.cc.

13 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 55 of file SiStripPlotGain.h.

55 {};

◆ beginRun()

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

Reimplemented from edm::EDAnalyzer.

Definition at line 17 of file SiStripPlotGain.cc.

17  {
18  if (getCache(es) == cacheID)
19  return;
20  cacheID = getCache(es);
21 
22  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << cacheID << std::endl;
23 
25  DoAnalysis(es, *Handle_.product());
26 }

References cacheID, DoAnalysis(), edm::EventSetup::get(), get, getCache(), Handle_, and edm::ESHandle< T >::product().

◆ DoAnalysis()

void SiStripPlotGain::DoAnalysis ( const edm::EventSetup es,
const SiStripApvGain gain 
)
private

Definition at line 28 of file SiStripPlotGain.cc.

28  {
29  edm::LogInfo("") << "[Doanalysis]";
30 
31  // Retrieve tracker topology from geometry
33  es.get<TrackerTopologyRcd>().get(tTopoHandle);
34  const TrackerTopology *const tTopo = tTopoHandle.product();
35 
36  std::vector<TH1F *> histos;
37 
38  SiStripApvGain::RegistryPointers p = gain.getRegistryPointers();
40  iter = p.detid_begin;
41  iterE = p.detid_end;
42 
43  float value;
44 
45  // Divide result by d
46  for (; iter != iterE; ++iter) {
47  getHistos(*iter, tTopo, histos);
48  SiStripApvGain::Range range = SiStripApvGain::Range(p.getFirstElement(iter), p.getLastElement(iter));
49 
50  edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second - range.first;
51  size_t apv = 0, apvE = (range.second - range.first);
52  for (; apv < apvE; apv += 2) {
53  value = gain.getApvGain(apv, range);
54  tkmap->fill(*iter, value);
55  for (size_t i = 0; i < histos.size(); ++i)
56  histos[i]->Fill(value);
57  }
58  }
59 }

References TrackerMap::fill(), HcalObjRepresent::Fill(), PedestalClient_cfi::gain, edm::EventSetup::get(), get, getHistos(), combine::histos, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), FastTimerService_cff::range, tkmap, and relativeConstraints::value.

Referenced by beginRun().

◆ endJob()

void SiStripPlotGain::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file SiStripPlotGain.cc.

101  {
102  for (size_t i = 0; i < vTH1.size(); i++)
103  if (vTH1[i] != nullptr)
104  vTH1[i]->Write();
105 
106  file->Write();
107  file->Close();
108 
109  tkmap->save(false, 0, 0, "testTkMap.png");
110 }

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

◆ getCache()

unsigned long long SiStripPlotGain::getCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 62 of file SiStripPlotGain.h.

62  {
63  return eSetup.get<SiStripApvGainRcd>().cacheIdentifier();
64  }

References edm::EventSetup::get().

Referenced by beginRun().

◆ getHisto()

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

Definition at line 87 of file SiStripPlotGain.cc.

87  {
88  if (vTH1.size() < index + 1)
89  vTH1.resize(index + 1, nullptr);
90 
91  if (vTH1[index] == nullptr) {
92  char name[128];
93  sprintf(name, "%lu", index);
94  edm::LogInfo("") << "[getHisto] creating index " << index << std::endl;
95  vTH1[index] = new TH1F(name, name, 150, 0., 5.);
96  }
97 
98  return vTH1[index];
99 }

References Skims_PA_cff::name, and vTH1.

Referenced by getHistos().

◆ getHistos()

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

Definition at line 61 of file SiStripPlotGain.cc.

61  {
62  histos.clear();
63 
64  int subdet = -999;
65  int component = -999;
66  SiStripDetId a(detid);
67  if (a.subdetId() == 3) {
68  subdet = 0;
69  component = tTopo->tibLayer(detid);
70  } else if (a.subdetId() == 4) {
71  subdet = 1;
72  component = tTopo->tidSide(detid) == 2 ? tTopo->tidWheel(detid) : tTopo->tidWheel(detid) + 3;
73  } else if (a.subdetId() == 5) {
74  subdet = 2;
75  component = tTopo->tobLayer(detid);
76  } else if (a.subdetId() == 6) {
77  subdet = 3;
78  component = tTopo->tecSide(detid) == 2 ? tTopo->tecWheel(detid) : tTopo->tecWheel(detid) + 9;
79  }
80 
81  int index = 100 + subdet * 100 + component;
82 
83  histos.push_back(getHisto(subdet + 1));
84  histos.push_back(getHisto(index));
85 }

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

Referenced by DoAnalysis().

Member Data Documentation

◆ cacheID

unsigned long long SiStripPlotGain::cacheID
private

Definition at line 77 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ file

TFile* SiStripPlotGain::file
private

◆ fr

SiStripDetInfoFileReader* SiStripPlotGain::fr
private

Definition at line 68 of file SiStripPlotGain.h.

◆ Handle_

edm::ESHandle<SiStripApvGain> SiStripPlotGain::Handle_
private

Definition at line 70 of file SiStripPlotGain.h.

Referenced by beginRun().

◆ tkmap

TrackerMap* SiStripPlotGain::tkmap
private

Definition at line 75 of file SiStripPlotGain.h.

Referenced by DoAnalysis(), endJob(), and SiStripPlotGain().

◆ vTH1

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

Definition at line 73 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:355
SiStripApvGain::RegistryPointers
Definition: SiStripApvGain.h:34
SiStripPlotGain::getHistos
void getHistos(const uint32_t &detid, const TrackerTopology *tTopo, std::vector< TH1F * > &histos)
Definition: SiStripPlotGain.cc:61
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::LogInfo
Definition: MessageLogger.h:254
TrackerMap::fill
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3288
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:73
edm::ESHandle< TrackerTopology >
TrackerMap
Definition: TrackerMap.h:76
SiStripPlotGain::tkmap
TrackerMap * tkmap
Definition: SiStripPlotGain.h:75
SiStripPlotGain::Handle_
edm::ESHandle< SiStripApvGain > Handle_
Definition: SiStripPlotGain.h:70
a
double a
Definition: hdecay.h:119
SiStripPlotGain::getCache
unsigned long long getCache(const edm::EventSetup &eSetup)
Definition: SiStripPlotGain.h:62
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:87
value
Definition: value.py:1
SiStripPlotGain::DoAnalysis
void DoAnalysis(const edm::EventSetup &es, const SiStripApvGain &)
Definition: SiStripPlotGain.cc:28
get
#define get
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
SiStripApvGainRcd
Definition: SiStripCondDataRecords.h:8
combine.histos
histos
Definition: combine.py:4
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
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
SiStripPlotGain::cacheID
unsigned long long cacheID
Definition: SiStripPlotGain.h:77
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
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