test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripPlotGain Class Reference

#include <DQM/SiStripMonitorSummary/plugins/SiStripPlotGain.cc>

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

Public Member Functions

 SiStripPlotGain (const edm::ParameterSet &)
 
 ~SiStripPlotGain ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &es)
 
void DoAnalysis (const edm::EventSetup &es, const SiStripApvGain &)
 
virtual void endJob ()
 
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
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 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

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

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

Definition at line 49 of file SiStripPlotGain.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file SiStripPlotGain.cc.

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

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

Definition at line 26 of file SiStripPlotGain.cc.

27 {}

Member Function Documentation

virtual void SiStripPlotGain::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 57 of file SiStripPlotGain.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 32 of file SiStripPlotGain.cc.

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

32  {
33 
34  if(getCache(es)==cacheID )
35  return;
36  cacheID=getCache(es);
37 
38  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << cacheID << std::endl;
39 
40  es.get<SiStripApvGainRcd>().get(Handle_);
41  DoAnalysis(es, *Handle_.product());
42 
43 
44 }
unsigned long long getCache(const edm::EventSetup &eSetup)
void DoAnalysis(const edm::EventSetup &es, const SiStripApvGain &)
unsigned long long cacheID
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
edm::ESHandle< SiStripApvGain > Handle_
void SiStripPlotGain::DoAnalysis ( const edm::EventSetup es,
const SiStripApvGain gain 
)
private

Definition at line 47 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(), mergeVDriftHistosByStation::histos, i, getDQMSummary::iter, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< class >::product(), tkmap, and relativeConstraints::value.

Referenced by beginRun().

47  {
48 
49  edm::LogInfo("") << "[Doanalysis]";
50 
51  //Retrieve tracker topology from geometry
53  es.get<IdealGeometryRecord>().get(tTopoHandle);
54  const TrackerTopology* const tTopo = tTopoHandle.product();
55 
56  std::vector<TH1F *>histos;
57 
60  iter=p.detid_begin;
61  iterE=p.detid_end;
62 
63  float value;
64 
65  //Divide result by d
66  for(;iter!=iterE;++iter){
67  getHistos(*iter,tTopo,histos);
69 
70  edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second-range.first;
71  size_t apv=0, apvE= (range.second-range.first);
72  for (;apv<apvE;apv+=2){
73  value=gain.getApvGain(apv,range);
74  tkmap->fill(*iter,value);
75  for(size_t i=0;i<histos.size();++i)
76  histos[i]->Fill(value);
77  }
78 
79  }
80 }
ContainerIterator getFirstElement(RegistryConstIterator &idet)
int i
Definition: DBlmapReader.cc:9
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)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
TrackerMap * tkmap
RegistryPointers getRegistryPointers() const
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:2776
void SiStripPlotGain::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 128 of file SiStripPlotGain.cc.

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

128  {
129  for(size_t i=0;i<vTH1.size();i++)
130  if(vTH1[i]!=0)
131  vTH1[i]->Write();
132 
133  file->Write();
134  file->Close();
135 
136  tkmap->save(false,0,0,"testTkMap.png");
137 
138 }
int i
Definition: DBlmapReader.cc:9
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:698
std::vector< TH1F * > vTH1
TrackerMap * tkmap
unsigned long long SiStripPlotGain::getCache ( const edm::EventSetup eSetup)
inlineprivate

Definition at line 64 of file SiStripPlotGain.h.

References edm::EventSetup::get().

Referenced by beginRun().

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

Definition at line 113 of file SiStripPlotGain.cc.

References cmsHarvester::index, mergeVDriftHistosByStation::name, and vTH1.

Referenced by getHistos().

113  {
114  if(vTH1.size()<index+1)
115  vTH1.resize(index+1,0);
116 
117  if(vTH1[index]==0){
118  char name[128];
119  sprintf(name,"%lu",index);
120  edm::LogInfo("")<<"[getHisto] creating index " << index << std::endl;
121  vTH1[index]=new TH1F(name,name,150,0.,5.);
122  }
123 
124  return vTH1[index];
125 }
std::vector< TH1F * > vTH1
void SiStripPlotGain::getHistos ( const uint32_t &  detid,
const TrackerTopology tTopo,
std::vector< TH1F * > &  histos 
)
private

Definition at line 84 of file SiStripPlotGain.cc.

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

Referenced by DoAnalysis().

84  {
85 
86  histos.clear();
87 
88  int subdet=-999; int component=-999;
90  if ( a.subdetId() == 3 ){
91  subdet=0;
92  component=tTopo->tibLayer(detid);
93  } else if ( a.subdetId() == 4 ) {
94  subdet=1;
95  component=tTopo->tidSide(detid)==2?tTopo->tidWheel(detid):tTopo->tidWheel(detid)+3;
96  } else if ( a.subdetId() == 5 ) {
97  subdet=2;
98  component=tTopo->tobLayer(detid);
99  } else if ( a.subdetId() == 6 ) {
100  subdet=3;
101  component=tTopo->tecSide(detid)==2?tTopo->tecWheel(detid):tTopo->tecWheel(detid)+9;
102  }
103 
104  int index=100+subdet*100+component;
105 
106 
107  histos.push_back(getHisto(subdet+1));
108  histos.push_back(getHisto(index));
109 
110 }
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 81 of file SiStripPlotGain.h.

Referenced by beginRun().

TFile* SiStripPlotGain::file
private

Definition at line 75 of file SiStripPlotGain.h.

Referenced by endJob(), and SiStripPlotGain().

SiStripDetInfoFileReader* SiStripPlotGain::fr
private

Definition at line 70 of file SiStripPlotGain.h.

Referenced by SiStripPlotGain().

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

Definition at line 72 of file SiStripPlotGain.h.

Referenced by beginRun().

TrackerMap* SiStripPlotGain::tkmap
private

Definition at line 78 of file SiStripPlotGain.h.

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

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

Definition at line 76 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().