CMS 3D CMS Logo

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

#include <ESTimingTask.h>

Inheritance diagram for ESTimingTask:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 ESTimingTask (const edm::ParameterSet &ps)
 
 ~ESTimingTask () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< ESDigiCollectiondigilabel_
 
int eCount_
 
edm::ESHandle< ESGainesgain_
 
TF1 * fit_
 
MonitorElementh2DTiming_
 
TH1F * htESM_
 
TH1F * htESP_
 
MonitorElementhTiming_ [2][2]
 
Double_t n_
 
std::string prefixME_
 
int runNum_
 
Double_t wc_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 21 of file ESTimingTask.h.

Constructor & Destructor Documentation

◆ ESTimingTask()

ESTimingTask::ESTimingTask ( const edm::ParameterSet ps)

Definition at line 39 of file ESTimingTask.cc.

39  {
40  digilabel_ = consumes<ESDigiCollection>(ps.getParameter<InputTag>("DigiLabel"));
41  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
42 
43  eCount_ = 0;
44 
45  fit_ = new TF1("fitShape", fitf, -200, 200, 4);
46  fit_->SetParameters(50, 10, 0, 0);
47 
48  //Histogram init
49  for (int i = 0; i < 2; ++i)
50  for (int j = 0; j < 2; ++j)
51  hTiming_[i][j] = nullptr;
52 
53  htESP_ = new TH1F("htESP", "Timing ES+", 81, -20.5, 20.5);
54  htESM_ = new TH1F("htESM", "Timing ES-", 81, -20.5, 20.5);
55 }

References fitf(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, dqmiolumiharvest::j, and tools::TF1.

◆ ~ESTimingTask()

ESTimingTask::~ESTimingTask ( )
override

Definition at line 77 of file ESTimingTask.cc.

77  {
78  delete fit_;
79  delete htESP_;
80  delete htESM_;
81 }

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 83 of file ESTimingTask.cc.

83  {
84  set(iSetup);
85 
86  runNum_ = e.id().run();
87  eCount_++;
88 
89  htESP_->Reset();
90  htESM_->Reset();
91 
92  //Digis
93  int zside, plane, ix, iy, is;
94  double adc[3];
95  // double para[10];
96  //double tx[3] = {-5., 20., 45.};
98  if (e.getByToken(digilabel_, digis)) {
99  for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
100  ESDataFrame dataframe = (*digiItr);
101  ESDetId id = dataframe.id();
102 
103  zside = id.zside();
104  plane = id.plane();
105  ix = id.six();
106  iy = id.siy();
107  is = id.strip();
108 
109  //if (zside==1 && plane==1 && ix==15 && iy==6) continue;
110  if (zside == 1 && plane == 1 && ix == 7 && iy == 28)
111  continue;
112  if (zside == 1 && plane == 1 && ix == 24 && iy == 9 && is == 21)
113  continue;
114  if (zside == -1 && plane == 2 && ix == 35 && iy == 17 && is == 23)
115  continue;
116 
117  int i = (zside == 1) ? 0 : 1;
118  int j = plane - 1;
119 
120  for (int k = 0; k < dataframe.size(); ++k)
121  adc[k] = dataframe.sample(k).adc();
122 
123  double status = 0;
124  if (adc[1] < 200)
125  status = 1;
126  if (fabs(adc[0]) > 10)
127  status = 1;
128  if (adc[1] < 0 || adc[2] < 0)
129  status = 1;
130  if (adc[0] > adc[1] || adc[0] > adc[2])
131  status = 1;
132  if (adc[2] > adc[1])
133  status = 1;
134 
135  if (int(status) == 0) {
136  double A1 = adc[1];
137  double A2 = adc[2];
138  double DeltaT = 25.;
139  double aaa = (A2 > 0 && A1 > 0) ? log(A2 / A1) / n_ : 20.; // if A1=0, t0=20
140  double bbb = wc_ / n_ * DeltaT;
141  double ccc = exp(aaa + bbb);
142 
143  double t0 = (2. - ccc) / (1. - ccc) * DeltaT - 5;
144  hTiming_[i][j]->Fill(t0);
145  //cout<<"t0 : "<<t0<<endl;
146  /*
147  TGraph *gr = new TGraph(3, tx, adc);
148  fit_->SetParameters(50, 10, wc_, n_);
149  fit_->FixParameter(2, wc_);
150  fit_->FixParameter(3, n_);
151  fit_->Print();
152  gr->Fit("fitShape", "MQ");
153  fit_->GetParameters(para);
154  delete gr;
155  //hTiming_[i][j]->Fill(para[1]);
156  */
157  //cout<<"ADC : "<<zside<<" "<<plane<<" "<<ix<<" "<<iy<<" "<<is<<" "<<adc[0]<<" "<<adc[1]<<" "<<adc[2]<<" "<<para[1]<<" "<<wc_<<" "<<n_<<endl;
158 
159  if (zside == 1)
160  htESP_->Fill(t0);
161  else if (zside == -1)
162  htESM_->Fill(t0);
163  }
164  }
165  } else {
166  LogWarning("ESTimingTask") << "DigiCollection not available";
167  }
168 
169  if (htESP_->GetEntries() > 0 && htESM_->GetEntries() > 0)
170  h2DTiming_->Fill(htESM_->GetMean(), htESP_->GetMean());
171 }

References ecalMGPA::adc(), ESSample::adc(), edm::DataFrameContainer::begin(), MillePedeFileConverter_cfg::e, edm::DataFrameContainer::end(), JetChargeProducer_cfi::exp, mps_fire::i, ESDataFrame::id(), dqmiolumiharvest::j, dqmdumpme::k, dqm-mbProfile::log, ESDataFrame::sample(), ESDataFrame::size(), mps_update::status, FrontierCondition_GT_autoExpress_cfi::t0, and ecaldqm::zside().

◆ bookHistograms()

void ESTimingTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 57 of file ESTimingTask.cc.

57  {
58  iBooker.setCurrentFolder(prefixME_ + "/ESTimingTask");
59 
60  //Booking Histograms
61  //Notice: Change ESRenderPlugin under DQM/RenderPlugins/src if you change this histogram name.
62  char histo[200];
63  for (int i = 0; i < 2; ++i)
64  for (int j = 0; j < 2; ++j) {
65  int iz = (i == 0) ? 1 : -1;
66  sprintf(histo, "ES Timing Z %d P %d", iz, j + 1);
67  hTiming_[i][j] = iBooker.book1D(histo, histo, 81, -20.5, 20.5);
68  hTiming_[i][j]->setAxisTitle("ES Timing (ns)", 1);
69  }
70 
71  sprintf(histo, "ES 2D Timing");
72  h2DTiming_ = iBooker.book2D(histo, histo, 81, -20.5, 20.5, 81, -20.5, 20.5);
73  h2DTiming_->setAxisTitle("ES- Timing (ns)", 1);
74  h2DTiming_->setAxisTitle("ES+ Timing (ns)", 2);
75 }

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), timingPdfMaker::histo, mps_fire::i, dqmiolumiharvest::j, dqm::impl::MonitorElement::setAxisTitle(), and dqm::implementation::NavigatorBase::setCurrentFolder().

◆ set()

void ESTimingTask::set ( const edm::EventSetup es)
private

Definition at line 173 of file ESTimingTask.cc.

173  {
174  es.get<ESGainRcd>().get(esgain_);
175  const ESGain* gain = esgain_.product();
176 
177  int ESGain = (int)gain->getESGain();
178 
179  if (ESGain == 1) { // LG
180  wc_ = 0.0837264;
181  n_ = 2.016;
182  } else { // HG
183  wc_ = 0.07291;
184  n_ = 1.798;
185  }
186 
187  //cout<<"gain : "<<ESGain<<endl;
188  //cout<<wc_<<" "<<n_<<endl;
189 }

References PedestalClient_cfi::gain, edm::EventSetup::get(), get, and createfilelist::int.

Member Data Documentation

◆ digilabel_

edm::EDGetTokenT<ESDigiCollection> ESTimingTask::digilabel_
private

Definition at line 32 of file ESTimingTask.h.

◆ eCount_

int ESTimingTask::eCount_
private

Definition at line 44 of file ESTimingTask.h.

◆ esgain_

edm::ESHandle<ESGain> ESTimingTask::esgain_
private

Definition at line 38 of file ESTimingTask.h.

◆ fit_

TF1* ESTimingTask::fit_
private

Definition at line 40 of file ESTimingTask.h.

◆ h2DTiming_

MonitorElement* ESTimingTask::h2DTiming_
private

Definition at line 36 of file ESTimingTask.h.

◆ htESM_

TH1F* ESTimingTask::htESM_
private

Definition at line 42 of file ESTimingTask.h.

◆ htESP_

TH1F* ESTimingTask::htESP_
private

Definition at line 41 of file ESTimingTask.h.

◆ hTiming_

MonitorElement* ESTimingTask::hTiming_[2][2]
private

Definition at line 35 of file ESTimingTask.h.

◆ n_

Double_t ESTimingTask::n_
private

Definition at line 45 of file ESTimingTask.h.

◆ prefixME_

std::string ESTimingTask::prefixME_
private

Definition at line 33 of file ESTimingTask.h.

◆ runNum_

int ESTimingTask::runNum_
private

Definition at line 44 of file ESTimingTask.h.

◆ wc_

Double_t ESTimingTask::wc_
private

Definition at line 45 of file ESTimingTask.h.

ESTimingTask::hTiming_
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:35
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ESTimingTask::htESP_
TH1F * htESP_
Definition: ESTimingTask.h:41
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
ESGain
Definition: ESGain.h:7
mps_fire.i
i
Definition: mps_fire.py:355
ESGainRcd
Definition: ESGainRcd.h:5
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
ESSample::adc
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
mps_update.status
status
Definition: mps_update.py:69
ESTimingTask::n_
Double_t n_
Definition: ESTimingTask.h:45
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
ESDataFrame::size
int size() const
Definition: ESDataFrame.h:21
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
ESTimingTask::fit_
TF1 * fit_
Definition: ESTimingTask.h:40
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ESDetId
Definition: ESDetId.h:15
tools.TF1
TF1
Definition: tools.py:23
edm::Handle
Definition: AssociativeIterator.h:50
ESTimingTask::htESM_
TH1F * htESM_
Definition: ESTimingTask.h:42
ESDataFrame
Definition: ESDataFrame.h:10
ESDataFrame::sample
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
ESTimingTask::h2DTiming_
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:36
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
ESTimingTask::eCount_
int eCount_
Definition: ESTimingTask.h:44
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ESTimingTask::digilabel_
edm::EDGetTokenT< ESDigiCollection > digilabel_
Definition: ESTimingTask.h:32
ESTimingTask::prefixME_
std::string prefixME_
Definition: ESTimingTask.h:33
ESTimingTask::wc_
Double_t wc_
Definition: ESTimingTask.h:45
edm::LogWarning
Definition: MessageLogger.h:141
createfilelist.int
int
Definition: createfilelist.py:10
edm::DataFrameContainer::begin
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: DataFrameContainer.h:149
fitf
double fitf(double *x, double *par)
Definition: ESTimingTask.cc:26
get
#define get
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ESTimingTask::esgain_
edm::ESHandle< ESGain > esgain_
Definition: ESTimingTask.h:38
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
ESTimingTask::runNum_
int runNum_
Definition: ESTimingTask.h:44
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
ESTimingTask::set
void set(const edm::EventSetup &es)
Definition: ESTimingTask.cc:173
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::DataFrameContainer::end
const_iterator end() const
Definition: DataFrameContainer.h:152
edm::InputTag
Definition: InputTag.h:15
ESDataFrame::id
const ESDetId & id() const
Definition: ESDataFrame.h:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37