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

Public Member Functions

 SiStripPlotGain (const edm::ParameterSet &)
 
 ~SiStripPlotGain ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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 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, 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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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

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

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

Definition at line 28 of file SiStripPlotGain.cc.

29 {}

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

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

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

Definition at line 49 of file SiStripPlotGain.cc.

References SiStripApvGain::RegistryPointers::detid_begin, SiStripApvGain::RegistryPointers::detid_end, TrackerMap::fill(), HcalObjRepresent::Fill(), SiStripApvGain::getApvGain(), SiStripApvGain::RegistryPointers::getFirstElement(), getHistos(), SiStripApvGain::RegistryPointers::getLastElement(), SiStripApvGain::getRegistryPointers(), mergeVDriftHistosByStation::histos, i, L1TEmulatorMonitor_cff::p, tkmap, and relativeConstraints::value.

Referenced by beginRun().

49  {
50 
51  edm::LogInfo("") << "[Doanalysis]";
52 
53  std::vector<TH1F *>histos;
54 
57  iter=p.detid_begin;
58  iterE=p.detid_end;
59 
60  float value;
61 
62  //Divide result by d
63  for(;iter!=iterE;++iter){
64  getHistos(*iter,histos);
66 
67  edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second-range.first;
68  size_t apv=0, apvE= (range.second-range.first);
69  for (;apv<apvE;apv+=2){
70  value=gain.getApvGain(apv,range);
71  tkmap->fill(*iter,value);
72  for(size_t i=0;i<histos.size();++i)
73  histos[i]->Fill(value);
74  }
75 
76  }
77 }
ContainerIterator getFirstElement(RegistryConstIterator &idet)
int i
Definition: DBlmapReader.cc:9
Registry::const_iterator RegistryConstIterator
RegistryConstIterator detid_end
RegistryConstIterator detid_begin
void getHistos(const uint32_t &detid, std::vector< TH1F * > &histos)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::pair< ContainerIterator, ContainerIterator > Range
ContainerIterator getLastElement(RegistryConstIterator &idet)
TrackerMap * tkmap
RegistryPointers getRegistryPointers() const
float getApvGain(const uint16_t &apv, const Range &range) const
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:2548
void SiStripPlotGain::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file SiStripPlotGain.cc.

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

125  {
126  for(size_t i=0;i<vTH1.size();i++)
127  if(vTH1[i]!=0)
128  vTH1[i]->Write();
129 
130  file->Write();
131  file->Close();
132 
133  tkmap->save(false,0,0,"testTkMap.png");
134 
135 }
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:632
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 110 of file SiStripPlotGain.cc.

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

Referenced by getHistos().

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

Definition at line 81 of file SiStripPlotGain.cc.

References a, getHisto(), getHLTprescales::index, TOBDetId::layer(), TIBDetId::layer(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), TIDDetId::wheel(), and TECDetId::wheel().

Referenced by DoAnalysis().

81  {
82 
83  histos.clear();
84 
85  int subdet=-999; int component=-999;
87  if ( a.subdetId() == 3 ){
88  subdet=0;
89  component=TIBDetId(detid).layer();
90  } else if ( a.subdetId() == 4 ) {
91  subdet=1;
92  component=TIDDetId(detid).side()==2?TIDDetId(detid).wheel():TIDDetId(detid).wheel()+3;
93  } else if ( a.subdetId() == 5 ) {
94  subdet=2;
95  component=TOBDetId(detid).layer();
96  } else if ( a.subdetId() == 6 ) {
97  subdet=3;
98  component=TECDetId(detid).side()==2?TECDetId(detid).wheel():TECDetId(detid).wheel()+9;
99  }
100 
101  int index=100+subdet*100+component;
102 
103 
104  histos.push_back(getHisto(subdet+1));
105  histos.push_back(getHisto(index));
106 
107 }
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
unsigned int side() const
positive or negative id
Definition: TIDDetId.h:45
TH1F * getHisto(const long unsigned int &index)
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
double a
Definition: hdecay.h:121
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50

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