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 6 of file SiStripPlotGain.cc.

References file, fr, Utilities::operator, and tkmap.

6  : cacheID(0xFFFFFFFF) {
7  // now do what ever initialization is needed
8  if (!edm::Service<SiStripDetInfoFileReader>().isAvailable()) {
9  edm::LogError("TkLayerMap") << "\n------------------------------------------"
10  "\nUnAvailable Service SiStripDetInfoFileReader: please insert in "
11  "the configuration file an instance like"
12  "\n\tprocess.SiStripDetInfoFileReader = "
13  "cms.Service(\"SiStripDetInfoFileReader\")"
14  "\n------------------------------------------";
15  }
16 
18  file = new TFile("correlTest.root", "RECREATE");
19  tkmap = new TrackerMap();
20 }
unsigned long long cacheID
SiStripDetInfoFileReader * fr
TrackerMap * tkmap
SiStripPlotGain::~SiStripPlotGain ( )
override

Definition at line 22 of file SiStripPlotGain.cc.

22 {}

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 plotFactory::histos.

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

Definition at line 26 of file SiStripPlotGain.cc.

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

26  {
27  if (getCache(es) == cacheID)
28  return;
29  cacheID = getCache(es);
30 
31  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << cacheID << std::endl;
32 
33  es.get<SiStripApvGainRcd>().get(Handle_);
34  DoAnalysis(es, *Handle_.product());
35 }
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:71
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 37 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(), plotFactory::histos, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), tkmap, and relativeConstraints::value.

Referenced by analyze(), and beginRun().

37  {
38  edm::LogInfo("") << "[Doanalysis]";
39 
40  // Retrieve tracker topology from geometry
42  es.get<TrackerTopologyRcd>().get(tTopoHandle);
43  const TrackerTopology *const tTopo = tTopoHandle.product();
44 
45  std::vector<TH1F *> histos;
46 
49  iter = p.detid_begin;
50  iterE = p.detid_end;
51 
52  float value;
53 
54  // Divide result by d
55  for (; iter != iterE; ++iter) {
56  getHistos(*iter, tTopo, histos);
58 
59  edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second - range.first;
60  size_t apv = 0, apvE = (range.second - range.first);
61  for (; apv < apvE; apv += 2) {
62  value = gain.getApvGain(apv, range);
63  tkmap->fill(*iter, value);
64  for (size_t i = 0; i < histos.size(); ++i)
65  histos[i]->Fill(value);
66  }
67  }
68 }
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
T get() const
Definition: EventSetup.h:71
RegistryPointers getRegistryPointers() const
T const * product() const
Definition: ESHandle.h:86
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:2786
void SiStripPlotGain::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 110 of file SiStripPlotGain.cc.

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

Referenced by analyze().

110  {
111  for (size_t i = 0; i < vTH1.size(); i++)
112  if (vTH1[i] != nullptr)
113  vTH1[i]->Write();
114 
115  file->Write();
116  file->Close();
117 
118  tkmap->save(false, 0, 0, "testTkMap.png");
119 }
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:699
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:71
TH1F * SiStripPlotGain::getHisto ( const long unsigned int &  index)
private

Definition at line 96 of file SiStripPlotGain.cc.

References dataset::name, and vTH1.

Referenced by analyze(), and getHistos().

96  {
97  if (vTH1.size() < index + 1)
98  vTH1.resize(index + 1, nullptr);
99 
100  if (vTH1[index] == nullptr) {
101  char name[128];
102  sprintf(name, "%lu", index);
103  edm::LogInfo("") << "[getHisto] creating index " << index << std::endl;
104  vTH1[index] = new TH1F(name, name, 150, 0., 5.);
105  }
106 
107  return vTH1[index];
108 }
std::vector< TH1F * > vTH1
void SiStripPlotGain::getHistos ( const uint32_t &  detid,
const TrackerTopology tTopo,
std::vector< TH1F * > &  histos 
)
private

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

70  {
71  histos.clear();
72 
73  int subdet = -999;
74  int component = -999;
75  SiStripDetId a(detid);
76  if (a.subdetId() == 3) {
77  subdet = 0;
78  component = tTopo->tibLayer(detid);
79  } else if (a.subdetId() == 4) {
80  subdet = 1;
81  component = tTopo->tidSide(detid) == 2 ? tTopo->tidWheel(detid) : tTopo->tidWheel(detid) + 3;
82  } else if (a.subdetId() == 5) {
83  subdet = 2;
84  component = tTopo->tobLayer(detid);
85  } else if (a.subdetId() == 6) {
86  subdet = 3;
87  component = tTopo->tecSide(detid) == 2 ? tTopo->tecWheel(detid) : tTopo->tecWheel(detid) + 9;
88  }
89 
90  int index = 100 + subdet * 100 + component;
91 
92  histos.push_back(getHisto(subdet + 1));
93  histos.push_back(getHisto(index));
94 }
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:17
TH1F * getHisto(const long unsigned int &index)
double a
Definition: hdecay.h:121
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.

Referenced by SiStripPlotGain().

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().