CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ESPedestalTask Class Reference

#include <ESPedestalTask.h>

Inheritance diagram for ESPedestalTask:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 ESPedestalTask (const edm::ParameterSet &ps)
 
 ~ESPedestalTask () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob (void) override
 

Private Attributes

int dac_
 
edm::EDGetTokenT< ESDigiCollectiondigitoken_
 
int firstDAC_
 
int gain_
 
int ievt_
 
int isPed_
 
edm::FileInPath lookup_
 
MonitorElementmeADC_ [4288][32]
 
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]
 

Detailed Description

Definition at line 14 of file ESPedestalTask.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file ESPedestalTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, gen::k, and checklumidiff::l.

26  {
27 
28  digitoken_ = consumes<ESDigiCollection>(ps.getParameter<InputTag>("DigiLabel"));
29  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable");
30  outputFile_ = ps.getUntrackedParameter<string>("OutputFile","");
31  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
32 
33  for (int i=0; i<2; ++i)
34  for (int j=0; j<2; ++j)
35  for (int k=0; k<40; ++k)
36  for (int l=0; l<40; ++l)
37  senCount_[i][j][k][l] = -1;
38 
39  ievt_ = 0;
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string outputFile_
edm::FileInPath lookup_
int k[5][pyjets_maxn]
edm::EDGetTokenT< ESDigiCollection > digitoken_
int senCount_[2][2][40][40]
std::string prefixME_
ESPedestalTask::~ESPedestalTask ( )
inlineoverride

Definition at line 19 of file ESPedestalTask.h.

References analyze(), bookHistograms(), and endJob().

19 {}

Member Function Documentation

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

Definition at line 84 of file ESPedestalTask.cc.

References ESSample::adc(), edm::DataFrameContainer::begin(), DEFINE_FWK_MODULE, edm::DataFrameContainer::end(), edm::Event::getByToken(), ESDataFrame::id(), edm::EventBase::id(), edm::HandleBase::isValid(), edm::EventID::run(), ESDataFrame::sample(), digitizers_cfi::strip, ESDetId::zside(), and ecaldqm::zside().

Referenced by ~ESPedestalTask().

84  {
85 
86  ievt_++;
87  runNum_ = e.id().run();
88 
90  e.getByToken(digitoken_, digis);
91 
92  runtype_ = 1; // Let runtype_ = 1
93 
94  // Digis
95  int zside, plane, ix, iy, strip, iz;
96  if (digis.isValid()) {
97  for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
98 
99  ESDataFrame dataframe = (*digiItr);
100  ESDetId id = dataframe.id();
101 
102  zside = id.zside();
103  plane = id.plane();
104  ix = id.six();
105  iy = id.siy();
106  strip = id.strip();
107  iz = (zside==1) ? 0:1;
108 
109  if (meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]) {
110  if(runtype_ == 1){
111  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(0).adc());
112  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
113  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(2).adc());
114  } else if(runtype_ == 3) {
115  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
116  }
117  }
118 
119  }
120  }
121 
122 }
RunNumber_t run() const
Definition: EventID.h:39
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const ESDetId & id() const
Definition: ESDataFrame.h:21
const_iterator begin() const
int zside(DetId const &)
void Fill(long long x)
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
int zside() const
Definition: ESDetId.h:39
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< ESDigiCollection > digitoken_
const_iterator end() const
edm::EventID id() const
Definition: EventBase.h:59
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::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 42 of file ESPedestalTask.cc.

References DQMStore::IBooker::book1D(), FrontierConditions_GlobalTag_cff::file, mps_fire::i, and DQMStore::IBooker::setCurrentFolder().

Referenced by ~ESPedestalTask().

43 {
44  int iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
45  int senZ_[4288], senP_[4288], senX_[4288], senY_[4288];
46 
47  // read in look-up table
48  ifstream file(lookup_.fullPath().c_str());
49  if(!file.is_open())
50  throw cms::Exception("FileNotFound") << lookup_.fullPath();
51 
52  file >> nLines_;
53 
54  for (int i=0; i<nLines_; ++i) {
55  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
56 
57  senZ_[i] = iz;
58  senP_[i] = ip;
59  senX_[i] = ix;
60  senY_[i] = iy;
61 
62  iz = (senZ_[i]==1) ? 0:1;
63  senCount_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = i;
64  }
65 
66  char hname[300];
67 
68  iBooker.setCurrentFolder(prefixME_ + "/ESPedestalTask");
69 
70  for (int i=0; i<nLines_; ++i) {
71  for (int is=0; is<32; ++is) {
72  sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
73  meADC_[i][is] = iBooker.book1D(hname, hname, 1000, 899.5, 1899.5);
74  }
75  }
76 }
edm::FileInPath lookup_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
int senCount_[2][2][40][40]
std::string fullPath() const
Definition: FileInPath.cc:163
MonitorElement * meADC_[4288][32]
std::string prefixME_
void ESPedestalTask::endJob ( void  )
overrideprivate

Definition at line 78 of file ESPedestalTask.cc.

Referenced by ~ESPedestalTask().

78  {
79 
80  LogInfo("ESPedestalTask") << "analyzed " << ievt_ << " events";
81 
82 }

Member Data Documentation

int ESPedestalTask::dac_
private

Definition at line 35 of file ESPedestalTask.h.

edm::EDGetTokenT<ESDigiCollection> ESPedestalTask::digitoken_
private

Definition at line 27 of file ESPedestalTask.h.

int ESPedestalTask::firstDAC_
private

Definition at line 36 of file ESPedestalTask.h.

int ESPedestalTask::gain_
private

Definition at line 35 of file ESPedestalTask.h.

int ESPedestalTask::ievt_
private

Definition at line 34 of file ESPedestalTask.h.

int ESPedestalTask::isPed_
private

Definition at line 36 of file ESPedestalTask.h.

edm::FileInPath ESPedestalTask::lookup_
private

Definition at line 28 of file ESPedestalTask.h.

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

Definition at line 32 of file ESPedestalTask.h.

int ESPedestalTask::nDAC_
private

Definition at line 36 of file ESPedestalTask.h.

int ESPedestalTask::nLines_
private

Definition at line 34 of file ESPedestalTask.h.

std::string ESPedestalTask::outputFile_
private

Definition at line 29 of file ESPedestalTask.h.

int ESPedestalTask::precision_
private

Definition at line 35 of file ESPedestalTask.h.

std::string ESPedestalTask::prefixME_
private

Definition at line 30 of file ESPedestalTask.h.

int ESPedestalTask::runNum_
private

Definition at line 34 of file ESPedestalTask.h.

int ESPedestalTask::runtype_
private

Definition at line 35 of file ESPedestalTask.h.

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

Definition at line 34 of file ESPedestalTask.h.

int ESPedestalTask::seqtype_
private

Definition at line 35 of file ESPedestalTask.h.

int ESPedestalTask::vDAC_[5]
private

Definition at line 36 of file ESPedestalTask.h.