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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 ESPedestalTask (const edm::ParameterSet &ps)
 
virtual ~ESPedestalTask ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob (void)
 

Private Attributes

int dac_
 
edm::EDGetTokenT
< ESDigiCollection
digitoken_
 
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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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(), i, j, relval_steps::k, and prof2calltree::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
int i
Definition: DBlmapReader.cc:9
std::string outputFile_
edm::FileInPath lookup_
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< ESDigiCollection > digitoken_
int senCount_[2][2][40][40]
std::string prefixME_
virtual ESPedestalTask::~ESPedestalTask ( )
inlinevirtual

Definition at line 19 of file ESPedestalTask.h.

19 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 84 of file ESPedestalTask.cc.

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

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:449
const ESDetId & id() const
Definition: ESDataFrame.h:21
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:44
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< ESDigiCollection > digitoken_
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(), mergeVDriftHistosByStation::file, i, and DQMStore::IBooker::setCurrentFolder().

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 }
int i
Definition: DBlmapReader.cc:9
edm::FileInPath lookup_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
int senCount_[2][2][40][40]
std::string fullPath() const
Definition: FileInPath.cc:165
MonitorElement * meADC_[4288][32]
std::string prefixME_
void ESPedestalTask::endJob ( void  )
private

Definition at line 78 of file ESPedestalTask.cc.

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.