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
ESPedestalTask Class Reference

#include <ESPedestalTask.h>

Inheritance diagram for ESPedestalTask:
edm::EDAnalyzer

Public Member Functions

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

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob (void)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
void cleanup (void)
 
void endJob (void)
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
void reset (void)
 
void setup (void)
 

Private Attributes

int dac_
 
edm::InputTag digilabel_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
int firstDAC_
 
int gain_
 
int ievt_
 
bool init_
 
int isPed_
 
edm::FileInPath lookup_
 
MonitorElementmeADC_ [4288][32]
 
bool mergeRuns_
 
int nDAC_
 
int nLines_
 
std::string outputFile_
 
int precision_
 
std::string prefixME_
 
int runNum_
 
int runtype_
 
int senCount_ [2][2][40][40]
 
int seqtype_
 
int vDAC_ [5]
 

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

Definition at line 11 of file ESPedestalTask.h.

Constructor & Destructor Documentation

ESPedestalTask::ESPedestalTask ( const edm::ParameterSet ps)

Definition at line 27 of file ESPedestalTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, prof2calltree::l, and cmsCodeRules.cppFunctionSkipper::operator.

27  {
28 
29  init_ = false;
30 
32 
33  digilabel_ = ps.getParameter<InputTag>("DigiLabel");
34  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable");
35  outputFile_ = ps.getUntrackedParameter<string>("OutputFile","");
36  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
37 
38  for (int i=0; i<2; ++i)
39  for (int j=0; j<2; ++j)
40  for (int k=0; k<40; ++k)
41  for (int l=0; l<40; ++l)
42  senCount_[i][j][k][l] = -1;
43 
44 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::string outputFile_
edm::FileInPath lookup_
int j
Definition: DBlmapReader.cc:9
edm::InputTag digilabel_
DQMStore * dqmStore_
int k[5][pyjets_maxn]
int senCount_[2][2][40][40]
std::string prefixME_
ESPedestalTask::~ESPedestalTask ( )
virtual

Definition at line 46 of file ESPedestalTask.cc.

46  {
47 }

Member Function Documentation

void ESPedestalTask::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 126 of file ESPedestalTask.cc.

References ESSample::adc(), edm::Event::getByLabel(), ESDataFrame::id(), edm::EventBase::id(), edm::HandleBase::isValid(), edm::EventID::run(), ESDataFrame::sample(), strip(), and ESDetId::zside().

126  {
127 
128  if ( ! init_ ) this->setup();
129 
130  ievt_++;
131  runNum_ = e.id().run();
132 
134  e.getByLabel(digilabel_, digis);
135 
136  runtype_ = 1; // Let runtype_ = 1
137 
138  // Digis
139  int zside, plane, ix, iy, strip, iz;
140  if (digis.isValid()) {
141  for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
142 
143  ESDataFrame dataframe = (*digiItr);
144  ESDetId id = dataframe.id();
145 
146  zside = id.zside();
147  plane = id.plane();
148  ix = id.six();
149  iy = id.siy();
150  strip = id.strip();
151  iz = (zside==1) ? 0:1;
152 
153  if (meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]) {
154  if(runtype_ == 1){
155  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(0).adc());
156  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
157  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(2).adc());
158  } else if(runtype_ == 3) {
159  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
160  }
161  }
162 
163  }
164  }
165 
166 }
RunNumber_t run() const
Definition: EventID.h:42
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
const ESDetId & id() const
Definition: ESDataFrame.h:18
std::vector< T >::const_iterator const_iterator
void Fill(long long x)
const ESSample & sample(int i) const
Definition: ESDataFrame.h:23
edm::InputTag digilabel_
int zside() const
Definition: ESDetId.h:33
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
void setup(void)
edm::EventID id() const
Definition: EventBase.h:56
int senCount_[2][2][40][40]
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
MonitorElement * meADC_[4288][32]
void ESPedestalTask::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file ESPedestalTask.cc.

49  {
50  ievt_ = 0;
51 }
void ESPedestalTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file ESPedestalTask.cc.

References reset().

53  {
54 
55  if ( ! mergeRuns_ ) this->reset();
56 
57 }
void reset(void)
void ESPedestalTask::cleanup ( void  )
private

Definition at line 111 of file ESPedestalTask.cc.

111  {
112 
113  if ( ! init_ ) return;
114 
115  init_ = false;
116 }
void ESPedestalTask::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file ESPedestalTask.cc.

References edm::cleanup().

118  {
119 
120  LogInfo("ESPedestalTask") << "analyzed " << ievt_ << " events";
121 
122  if ( enableCleanup_ ) this->cleanup();
123 
124 }
void cleanup(void)
void ESPedestalTask::endRun ( const edm::Run r,
const edm::EventSetup c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file ESPedestalTask.cc.

59  {
60 }
void ESPedestalTask::reset ( void  )
private

Definition at line 62 of file ESPedestalTask.cc.

62  {
63 
64 }
void ESPedestalTask::setup ( void  )
private

Definition at line 66 of file ESPedestalTask.cc.

References gather_cfg::cout, dbtoweb::file, and i.

66  {
67 
68  init_ = true;
69 
70  int iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
71  int senZ_[4288], senP_[4288], senX_[4288], senY_[4288];
72 
73  // read in look-up table
74  ifstream file;
75  file.open(lookup_.fullPath().c_str());
76  if( file.is_open() ) {
77 
78  file >> nLines_;
79 
80  for (int i=0; i<nLines_; ++i) {
81  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
82 
83  senZ_[i] = iz;
84  senP_[i] = ip;
85  senX_[i] = ix;
86  senY_[i] = iy;
87 
88  iz = (senZ_[i]==1) ? 0:1;
89  senCount_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = i;
90  }
91  }
92  else {
93  cout<<"ESPedestalTask : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
94  }
95 
96  char hname[300];
97 
98  if (dqmStore_) {
99  dqmStore_->setCurrentFolder(prefixME_ + "/ESPedestalTask");
100 
101  for (int i=0; i<nLines_; ++i) {
102  for (int is=0; is<32; ++is) {
103  sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
104  meADC_[i][is] = dqmStore_->book1D(hname, hname, 1000, 899.5, 1899.5);
105  }
106  }
107  }
108 
109 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
list file
Definition: dbtoweb.py:253
edm::FileInPath lookup_
DQMStore * dqmStore_
int senCount_[2][2][40][40]
tuple cout
Definition: gather_cfg.py:41
std::string fullPath() const
Definition: FileInPath.cc:170
MonitorElement * meADC_[4288][32]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
std::string prefixME_

Member Data Documentation

int ESPedestalTask::dac_
private

Definition at line 42 of file ESPedestalTask.h.

edm::InputTag ESPedestalTask::digilabel_
private

Definition at line 29 of file ESPedestalTask.h.

DQMStore* ESPedestalTask::dqmStore_
private

Definition at line 37 of file ESPedestalTask.h.

bool ESPedestalTask::enableCleanup_
private

Definition at line 34 of file ESPedestalTask.h.

int ESPedestalTask::firstDAC_
private

Definition at line 43 of file ESPedestalTask.h.

int ESPedestalTask::gain_
private

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::ievt_
private

Definition at line 41 of file ESPedestalTask.h.

bool ESPedestalTask::init_
private

Definition at line 40 of file ESPedestalTask.h.

int ESPedestalTask::isPed_
private

Definition at line 43 of file ESPedestalTask.h.

edm::FileInPath ESPedestalTask::lookup_
private

Definition at line 30 of file ESPedestalTask.h.

MonitorElement* ESPedestalTask::meADC_[4288][32]
private

Definition at line 38 of file ESPedestalTask.h.

bool ESPedestalTask::mergeRuns_
private

Definition at line 35 of file ESPedestalTask.h.

int ESPedestalTask::nDAC_
private

Definition at line 43 of file ESPedestalTask.h.

int ESPedestalTask::nLines_
private

Definition at line 41 of file ESPedestalTask.h.

std::string ESPedestalTask::outputFile_
private

Definition at line 31 of file ESPedestalTask.h.

int ESPedestalTask::precision_
private

Definition at line 42 of file ESPedestalTask.h.

std::string ESPedestalTask::prefixME_
private

Definition at line 32 of file ESPedestalTask.h.

int ESPedestalTask::runNum_
private

Definition at line 41 of file ESPedestalTask.h.

int ESPedestalTask::runtype_
private

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::senCount_[2][2][40][40]
private

Definition at line 41 of file ESPedestalTask.h.

int ESPedestalTask::seqtype_
private

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::vDAC_[5]
private

Definition at line 43 of file ESPedestalTask.h.