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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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_
 
edm::ESGetToken< ESGain, ESGainRcdesgainToken_
 
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 >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 20 of file ESTimingTask.h.

Constructor & Destructor Documentation

◆ ESTimingTask()

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

Definition at line 39 of file ESTimingTask.cc.

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

39  {
40  digilabel_ = consumes<ESDigiCollection>(ps.getParameter<InputTag>("DigiLabel"));
41  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
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 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TH1F * htESM_
Definition: ESTimingTask.h:42
std::string prefixME_
Definition: ESTimingTask.h:32
TH1F * htESP_
Definition: ESTimingTask.h:41
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< ESGain, ESGainRcd > esgainToken_
Definition: ESTimingTask.h:37
edm::EDGetTokenT< ESDigiCollection > digilabel_
Definition: ESTimingTask.h:31
double fitf(double *x, double *par)
Definition: ESTimingTask.cc:26
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:34

◆ ~ESTimingTask()

ESTimingTask::~ESTimingTask ( )
override

Definition at line 77 of file ESTimingTask.cc.

77  {
78  delete fit_;
79  delete htESP_;
80  delete htESM_;
81 }
TH1F * htESM_
Definition: ESTimingTask.h:42
TH1F * htESP_
Definition: ESTimingTask.h:41

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.

References ESSample::adc(), gpuClustering::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().

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 }
const ESDetId & id() const
Definition: ESDataFrame.h:19
TH1F * htESM_
Definition: ESTimingTask.h:42
int size() const
Definition: ESDataFrame.h:21
int zside(DetId const &)
TH1F * htESP_
Definition: ESTimingTask.h:41
void Fill(long long x)
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
edm::EDGetTokenT< ESDigiCollection > digilabel_
Definition: ESTimingTask.h:31
const_iterator end() const
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:35
const_iterator begin() const
The iterator returned can not safely be used across threads.
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Double_t wc_
Definition: ESTimingTask.h:45
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:34
Double_t n_
Definition: ESTimingTask.h:45
Log< level::Warning, false > LogWarning
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 57 of file ESTimingTask.cc.

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().

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 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::string prefixME_
Definition: ESTimingTask.h:32
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:35
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:34
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ set()

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

Definition at line 173 of file ESTimingTask.cc.

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

173  {
174  const ESGain* gain = &es.getData(esgainToken_);
175 
176  int ESGain = (int)gain->getESGain();
177 
178  if (ESGain == 1) { // LG
179  wc_ = 0.0837264;
180  n_ = 2.016;
181  } else { // HG
182  wc_ = 0.07291;
183  n_ = 1.798;
184  }
185 
186  //cout<<"gain : "<<ESGain<<endl;
187  //cout<<wc_<<" "<<n_<<endl;
188 }
Definition: ESGain.h:7
edm::ESGetToken< ESGain, ESGainRcd > esgainToken_
Definition: ESTimingTask.h:37
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Double_t wc_
Definition: ESTimingTask.h:45
Double_t n_
Definition: ESTimingTask.h:45

Member Data Documentation

◆ digilabel_

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

Definition at line 31 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.

◆ esgainToken_

edm::ESGetToken<ESGain, ESGainRcd> ESTimingTask::esgainToken_
private

Definition at line 37 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 35 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 34 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 32 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.