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:
DQMEDAnalyzer edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ESPedestalTask (const edm::ParameterSet &ps)
 
 ~ESPedestalTask () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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]
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

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:519
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:45
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< ESDigiCollection > digitoken_
const_iterator end() const
edm::EventID id() const
Definition: EventBase.h:60
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 &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

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_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
int senCount_[2][2][40][40]
std::string fullPath() const
Definition: FileInPath.cc:197
MonitorElement * meADC_[4288][32]
std::string prefixME_
void ESPedestalTask::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

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.