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

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
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 () noexcept(false) 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 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::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::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 21 of file ESTimingTask.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file ESTimingTask.cc.

References 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");
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 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TH1F * htESM_
Definition: ESTimingTask.h:42
std::string prefixME_
Definition: ESTimingTask.h:33
TH1F * htESP_
Definition: ESTimingTask.h:41
edm::EDGetTokenT< ESDigiCollection > digilabel_
Definition: ESTimingTask.h:32
double fitf(double *x, double *par)
Definition: ESTimingTask.cc:26
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:35
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

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

Definition at line 83 of file ESTimingTask.cc.

References ecalMGPA::adc(), ESSample::adc(), edm::DataFrameContainer::begin(), edm::DataFrameContainer::end(), JetChargeProducer_cfi::exp, edm::Event::getByToken(), mps_fire::i, ESDataFrame::id(), edm::EventBase::id(), dqmiolumiharvest::j, dqmdumpme::k, dqm-mbProfile::log, edm::EventID::run(), ESDataFrame::sample(), ESDataFrame::size(), mps_update::status, FrontierCondition_GT_autoExpress_cfi::t0, ESDetId::zside(), 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 }
RunNumber_t run() const
Definition: EventID.h:38
TH1F * htESM_
Definition: ESTimingTask.h:42
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const ESDetId & id() const
Definition: ESDataFrame.h:19
const_iterator begin() const
int zside(DetId const &)
int size() const
Definition: ESDataFrame.h:21
TH1F * htESP_
Definition: ESTimingTask.h:41
void Fill(long long x)
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
int zside() const
Definition: ESDetId.h:39
edm::EDGetTokenT< ESDigiCollection > digilabel_
Definition: ESTimingTask.h:32
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:36
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const_iterator end() const
edm::EventID id() const
Definition: EventBase.h:59
Double_t wc_
Definition: ESTimingTask.h:45
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:35
Double_t n_
Definition: ESTimingTask.h:45
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
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::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::book2D(), timingPdfMaker::histo, mps_fire::i, dqmiolumiharvest::j, dqm::impl::MonitorElement::setAxisTitle(), and dqm::dqmstoreimpl::DQMStore::IBooker::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 }
std::string prefixME_
Definition: ESTimingTask.h:33
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:36
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:35
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESTimingTask::set ( const edm::EventSetup es)
private

Definition at line 173 of file ESTimingTask.cc.

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

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 }
edm::ESHandle< ESGain > esgain_
Definition: ESTimingTask.h:38
Definition: ESGain.h:7
float getESGain() const
Definition: ESGain.h:13
Double_t wc_
Definition: ESTimingTask.h:45
Double_t n_
Definition: ESTimingTask.h:45
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

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

Definition at line 32 of file ESTimingTask.h.

int ESTimingTask::eCount_
private

Definition at line 44 of file ESTimingTask.h.

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

Definition at line 38 of file ESTimingTask.h.

TF1* ESTimingTask::fit_
private

Definition at line 40 of file ESTimingTask.h.

MonitorElement* ESTimingTask::h2DTiming_
private

Definition at line 36 of file ESTimingTask.h.

TH1F* ESTimingTask::htESM_
private

Definition at line 42 of file ESTimingTask.h.

TH1F* ESTimingTask::htESP_
private

Definition at line 41 of file ESTimingTask.h.

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

Definition at line 35 of file ESTimingTask.h.

Double_t ESTimingTask::n_
private

Definition at line 45 of file ESTimingTask.h.

std::string ESTimingTask::prefixME_
private

Definition at line 33 of file ESTimingTask.h.

int ESTimingTask::runNum_
private

Definition at line 44 of file ESTimingTask.h.

Double_t ESTimingTask::wc_
private

Definition at line 45 of file ESTimingTask.h.