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 edm::EDConsumerBase

Public Member Functions

 ESPedestalTask (const edm::ParameterSet &ps)
 
virtual ~ESPedestalTask ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDGetTokenT
< ESDigiCollection
digitoken_
 
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
 
- 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

Definition at line 13 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(), i, j, gen::k, ConfigFiles::l, and cppFunctionSkipper::operator.

26  {
27 
28  init_ = false;
29 
31 
32  digitoken_ = consumes<ESDigiCollection>(ps.getParameter<InputTag>("DigiLabel"));
33  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable");
34  outputFile_ = ps.getUntrackedParameter<string>("OutputFile","");
35  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
36 
37  for (int i=0; i<2; ++i)
38  for (int j=0; j<2; ++j)
39  for (int k=0; k<40; ++k)
40  for (int l=0; l<40; ++l)
41  senCount_[i][j][k][l] = -1;
42 
43 }
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
DQMStore * dqmStore_
int k[5][pyjets_maxn]
edm::EDGetTokenT< ESDigiCollection > digitoken_
int senCount_[2][2][40][40]
std::string prefixME_
ESPedestalTask::~ESPedestalTask ( )
virtual

Definition at line 45 of file ESPedestalTask.cc.

45  {
46 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 125 of file ESPedestalTask.cc.

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

125  {
126 
127  if ( ! init_ ) this->setup();
128 
129  ievt_++;
130  runNum_ = e.id().run();
131 
133  e.getByToken(digitoken_, digis);
134 
135  runtype_ = 1; // Let runtype_ = 1
136 
137  // Digis
138  int zside, plane, ix, iy, strip, iz;
139  if (digis.isValid()) {
140  for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
141 
142  ESDataFrame dataframe = (*digiItr);
143  ESDetId id = dataframe.id();
144 
145  zside = id.zside();
146  plane = id.plane();
147  ix = id.six();
148  iy = id.siy();
149  strip = id.strip();
150  iz = (zside==1) ? 0:1;
151 
152  if (meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]) {
153  if(runtype_ == 1){
154  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(0).adc());
155  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
156  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(2).adc());
157  } else if(runtype_ == 3) {
158  meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
159  }
160  }
161 
162  }
163  }
164 
165 }
RunNumber_t run() const
Definition: EventID.h:42
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
const ESDetId & id() const
Definition: ESDataFrame.h:21
void Fill(long long x)
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
int zside() const
Definition: ESDetId.h:44
bool isValid() const
Definition: HandleBase.h:76
void setup(void)
edm::EDGetTokenT< ESDigiCollection > digitoken_
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 48 of file ESPedestalTask.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file ESPedestalTask.cc.

References reset().

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

Definition at line 110 of file ESPedestalTask.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file ESPedestalTask.cc.

References edm::cleanup().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file ESPedestalTask.cc.

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

Definition at line 61 of file ESPedestalTask.cc.

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

Definition at line 65 of file ESPedestalTask.cc.

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

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

Member Data Documentation

int ESPedestalTask::dac_
private

Definition at line 44 of file ESPedestalTask.h.

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

Definition at line 31 of file ESPedestalTask.h.

DQMStore* ESPedestalTask::dqmStore_
private

Definition at line 39 of file ESPedestalTask.h.

bool ESPedestalTask::enableCleanup_
private

Definition at line 36 of file ESPedestalTask.h.

int ESPedestalTask::firstDAC_
private

Definition at line 45 of file ESPedestalTask.h.

int ESPedestalTask::gain_
private

Definition at line 44 of file ESPedestalTask.h.

int ESPedestalTask::ievt_
private

Definition at line 43 of file ESPedestalTask.h.

bool ESPedestalTask::init_
private

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::isPed_
private

Definition at line 45 of file ESPedestalTask.h.

edm::FileInPath ESPedestalTask::lookup_
private

Definition at line 32 of file ESPedestalTask.h.

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

Definition at line 40 of file ESPedestalTask.h.

bool ESPedestalTask::mergeRuns_
private

Definition at line 37 of file ESPedestalTask.h.

int ESPedestalTask::nDAC_
private

Definition at line 45 of file ESPedestalTask.h.

int ESPedestalTask::nLines_
private

Definition at line 43 of file ESPedestalTask.h.

std::string ESPedestalTask::outputFile_
private

Definition at line 33 of file ESPedestalTask.h.

int ESPedestalTask::precision_
private

Definition at line 44 of file ESPedestalTask.h.

std::string ESPedestalTask::prefixME_
private

Definition at line 34 of file ESPedestalTask.h.

int ESPedestalTask::runNum_
private

Definition at line 43 of file ESPedestalTask.h.

int ESPedestalTask::runtype_
private

Definition at line 44 of file ESPedestalTask.h.

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

Definition at line 43 of file ESPedestalTask.h.

int ESPedestalTask::seqtype_
private

Definition at line 44 of file ESPedestalTask.h.

int ESPedestalTask::vDAC_[5]
private

Definition at line 45 of file ESPedestalTask.h.