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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 7 of file SiStripPlotGain.cc.

References file, and tkmap.

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

Definition at line 13 of file SiStripPlotGain.cc.

13 {}

Member Function Documentation

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

Definition at line 55 of file SiStripPlotGain.h.

References DoAnalysis(), endJob(), getHisto(), getHistos(), and combine::histos.

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

Definition at line 17 of file SiStripPlotGain.cc.

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

17  {
18  if (getCache(es) == cacheID)
19  return;
20  cacheID = getCache(es);
21 
22  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << cacheID << std::endl;
23 
24  es.get<SiStripApvGainRcd>().get(Handle_);
25  DoAnalysis(es, *Handle_.product());
26 }
unsigned long long getCache(const edm::EventSetup &eSetup)
void DoAnalysis(const edm::EventSetup &es, const SiStripApvGain &)
unsigned long long cacheID
T get() const
Definition: EventSetup.h:73
edm::ESHandle< SiStripApvGain > Handle_
T const * product() const
Definition: ESHandle.h:86
void SiStripPlotGain::DoAnalysis ( const edm::EventSetup es,
const SiStripApvGain gain 
)
private

Definition at line 28 of file SiStripPlotGain.cc.

References SiStripApvGain::RegistryPointers::detid_begin, SiStripApvGain::RegistryPointers::detid_end, TrackerMap::fill(), HcalObjRepresent::Fill(), edm::EventSetup::get(), SiStripApvGain::getApvGain(), SiStripApvGain::RegistryPointers::getFirstElement(), getHistos(), SiStripApvGain::RegistryPointers::getLastElement(), SiStripApvGain::getRegistryPointers(), combine::histos, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), FastTimerService_cff::range, tkmap, and relativeConstraints::value.

Referenced by analyze(), and beginRun().

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 
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);
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 }
ContainerIterator getFirstElement(RegistryConstIterator &idet)
Registry::const_iterator RegistryConstIterator
void getHistos(const uint32_t &detid, const TrackerTopology *tTopo, std::vector< TH1F * > &histos)
static float getApvGain(uint16_t apv, const Range &range)
RegistryConstIterator detid_end
RegistryConstIterator detid_begin
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::pair< ContainerIterator, ContainerIterator > Range
ContainerIterator getLastElement(RegistryConstIterator &idet)
TrackerMap * tkmap
histos
Definition: combine.py:4
T get() const
Definition: EventSetup.h:73
RegistryPointers getRegistryPointers() const
T const * product() const
Definition: ESHandle.h:86
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3289
void SiStripPlotGain::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file SiStripPlotGain.cc.

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

Referenced by analyze().

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 }
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
TrackerMap * tkmap
std::vector< TH1F * > vTH1
unsigned long long SiStripPlotGain::getCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 62 of file SiStripPlotGain.h.

References edm::EventSetup::get().

Referenced by beginRun().

62  {
63  return eSetup.get<SiStripApvGainRcd>().cacheIdentifier();
64  }
T get() const
Definition: EventSetup.h:73
TH1F * SiStripPlotGain::getHisto ( const long unsigned int &  index)
private

Definition at line 87 of file SiStripPlotGain.cc.

References Skims_PA_cff::name, and vTH1.

Referenced by analyze(), and getHistos().

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 }
std::vector< TH1F * > vTH1
void SiStripPlotGain::getHistos ( const uint32_t &  detid,
const TrackerTopology tTopo,
std::vector< TH1F * > &  histos 
)
private

Definition at line 61 of file SiStripPlotGain.cc.

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

Referenced by analyze(), and DoAnalysis().

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 }
unsigned int tibLayer(const DetId &id) const
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
TH1F * getHisto(const long unsigned int &index)
histos
Definition: combine.py:4
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

Member Data Documentation

unsigned long long SiStripPlotGain::cacheID
private

Definition at line 77 of file SiStripPlotGain.h.

Referenced by beginRun().

TFile* SiStripPlotGain::file
private

Definition at line 72 of file SiStripPlotGain.h.

Referenced by endJob(), ztee.GZipLog::finish(), and SiStripPlotGain().

SiStripDetInfoFileReader* SiStripPlotGain::fr
private

Definition at line 68 of file SiStripPlotGain.h.

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

Definition at line 70 of file SiStripPlotGain.h.

Referenced by beginRun().

TrackerMap* SiStripPlotGain::tkmap
private

Definition at line 75 of file SiStripPlotGain.h.

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

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

Definition at line 73 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().