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
ESTimingTask Class Reference

#include <ESTimingTask.h>

Inheritance diagram for ESTimingTask:
edm::EDAnalyzer

Public Member Functions

 ESTimingTask (const edm::ParameterSet &ps)
 
virtual ~ESTimingTask ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void endJob (void)
 
void set (const edm::EventSetup &es)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 19 of file ESTimingTask.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file ESTimingTask.cc.

References fitf(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), interpolateCardsSimple::histo, i, j, and cppFunctionSkipper::operator.

43  {
44 
45  rechitlabel_ = ps.getParameter<InputTag>("RecHitLabel");
46  digilabel_ = ps.getParameter<InputTag>("DigiLabel");
47  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
48 
50  eCount_ = 0;
51 
52  fit_ = new TF1("fitShape", fitf, -200, 200, 4);
53  fit_->SetParameters(50, 10, 0, 0);
54 
55  //Histogram init
56  for (int i = 0; i < 2; ++i)
57  for (int j = 0; j < 2; ++j)
58  hTiming_[i][j] = 0;
59 
60  dqmStore_->setCurrentFolder(prefixME_ + "/ESTimingTask");
61 
62  //Booking Histograms
63  //Notice: Change ESRenderPlugin under DQM/RenderPlugins/src if you change this histogram name.
64  char histo[200];
65  for (int i=0 ; i<2; ++i)
66  for (int j=0 ; j<2; ++j) {
67  int iz = (i==0)? 1:-1;
68  sprintf(histo, "ES Timing Z %d P %d", iz, j+1);
69  hTiming_[i][j] = dqmStore_->book1D(histo, histo, 81, -20.5, 20.5);
70  hTiming_[i][j]->setAxisTitle("ES Timing (ns)", 1);
71  }
72 
73  sprintf(histo, "ES 2D Timing");
74  h2DTiming_ = dqmStore_->book2D(histo, histo, 81, -20.5, 20.5, 81, -20.5, 20.5);
75  h2DTiming_->setAxisTitle("ES- Timing (ns)", 1);
76  h2DTiming_->setAxisTitle("ES+ Timing (ns)", 2);
77 
78  htESP_ = new TH1F("htESP", "Timing ES+", 81, -20.5, 20.5);
79  htESM_ = new TH1F("htESM", "Timing ES-", 81, -20.5, 20.5);
80 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
TH1F * htESM_
Definition: ESTimingTask.h:46
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
double fitf(double *x, double *par)
Definition: ESTimingTask.cc:30
std::string prefixME_
Definition: ESTimingTask.h:36
TH1F * htESP_
Definition: ESTimingTask.h:45
int j
Definition: DBlmapReader.cc:9
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:40
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:39
DQMStore * dqmStore_
Definition: ESTimingTask.h:38
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
edm::InputTag digilabel_
Definition: ESTimingTask.h:35
edm::InputTag rechitlabel_
Definition: ESTimingTask.h:34
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
ESTimingTask::~ESTimingTask ( )
virtual

Definition at line 82 of file ESTimingTask.cc.

82  {
83  delete htESP_;
84  delete htESM_;
85 }
TH1F * htESM_
Definition: ESTimingTask.h:46
TH1F * htESP_
Definition: ESTimingTask.h:45

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 93 of file ESTimingTask.cc.

References ecalMGPA::adc(), ESSample::adc(), create_public_lumi_plots::exp, edm::Event::getByLabel(), i, ESDataFrame::id(), edm::EventBase::id(), j, gen::k, create_public_lumi_plots::log, edm::EventID::run(), ESDataFrame::sample(), runtimedef::set(), ESDataFrame::size(), ntuplemaker::status, and ESDetId::zside().

93  {
94 
95  set(iSetup);
96 
97  runNum_ = e.id().run();
98  eCount_++;
99 
100  htESP_->Reset();
101  htESM_->Reset();
102 
103  //Digis
104  int zside, plane, ix, iy, is;
105  double adc[3];
106  // double para[10];
107  //double tx[3] = {-5., 20., 45.};
109  if ( e.getByLabel(digilabel_, digis) ) {
110 
111  for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
112 
113  ESDataFrame dataframe = (*digiItr);
114  ESDetId id = dataframe.id();
115 
116  zside = id.zside();
117  plane = id.plane();
118  ix = id.six();
119  iy = id.siy();
120  is = id.strip();
121 
122  //if (zside==1 && plane==1 && ix==15 && iy==6) continue;
123  if (zside==1 && plane==1 && ix==7 && iy==28) continue;
124  if (zside==1 && plane==1 && ix==24 && iy==9 && is==21) continue;
125  if (zside==-1 && plane==2 && ix==35 && iy==17 && is==23) continue;
126 
127  int i = (zside==1)? 0:1;
128  int j = plane-1;
129 
130  for (int k=0; k<dataframe.size(); ++k)
131  adc[k] = dataframe.sample(k).adc();
132 
133  double status = 0;
134  if (adc[1] < 200) status = 1;
135  if (fabs(adc[0]) > 10) status = 1;
136  if (adc[1] < 0 || adc[2] < 0) status = 1;
137  if (adc[0] > adc[1] || adc[0] > adc[2]) status = 1;
138  if (adc[2] > adc[1]) status = 1;
139 
140  if (int(status) == 0) {
141 
142  double A1 = adc[1];
143  double A2 = adc[2];
144  double DeltaT = 25.;
145  double aaa = (A2 > 0 && A1 > 0) ? log(A2/A1)/n_ : 20.; // if A1=0, t0=20
146  double bbb = wc_/n_*DeltaT;
147  double ccc= exp(aaa+bbb);
148 
149  double t0 = (2.-ccc)/(1.-ccc) * DeltaT - 5;
150  hTiming_[i][j]->Fill(t0);
151  //cout<<"t0 : "<<t0<<endl;
152  /*
153  TGraph *gr = new TGraph(3, tx, adc);
154  fit_->SetParameters(50, 10, wc_, n_);
155  fit_->FixParameter(2, wc_);
156  fit_->FixParameter(3, n_);
157  fit_->Print();
158  gr->Fit("fitShape", "MQ");
159  fit_->GetParameters(para);
160  delete gr;
161  //hTiming_[i][j]->Fill(para[1]);
162  */
163  //cout<<"ADC : "<<zside<<" "<<plane<<" "<<ix<<" "<<iy<<" "<<is<<" "<<adc[0]<<" "<<adc[1]<<" "<<adc[2]<<" "<<para[1]<<" "<<wc_<<" "<<n_<<endl;
164 
165  if (zside == 1) htESP_->Fill(t0);
166  else if (zside == -1) htESM_->Fill(t0);
167  }
168 
169  }
170  } else {
171  LogWarning("ESTimingTask") << digilabel_ << " not available";
172  }
173 
174  if (htESP_->GetEntries() > 0 && htESM_->GetEntries() > 0)
175  h2DTiming_->Fill(htESM_->GetMean(), htESP_->GetMean());
176 
177 }
int adc(sample_type sample)
get the ADC sample (12 bits)
RunNumber_t run() const
Definition: EventID.h:42
int i
Definition: DBlmapReader.cc:9
TH1F * htESM_
Definition: ESTimingTask.h:46
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const ESDetId & id() const
Definition: ESDataFrame.h:21
void set(const edm::EventSetup &es)
int size() const
Definition: ESDataFrame.h:23
TH1F * htESP_
Definition: ESTimingTask.h:45
void Fill(long long x)
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
int j
Definition: DBlmapReader.cc:9
int zside() const
Definition: ESDetId.h:33
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
int k[5][pyjets_maxn]
MonitorElement * h2DTiming_
Definition: ESTimingTask.h:40
edm::EventID id() const
Definition: EventBase.h:56
Double_t wc_
Definition: ESTimingTask.h:49
MonitorElement * hTiming_[2][2]
Definition: ESTimingTask.h:39
Double_t n_
Definition: ESTimingTask.h:49
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
tuple status
Definition: ntuplemaker.py:245
edm::InputTag digilabel_
Definition: ESTimingTask.h:35
void ESTimingTask::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file ESTimingTask.cc.

87  {
88 }
void ESTimingTask::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file ESTimingTask.cc.

90  {
91 }
void ESTimingTask::set ( const edm::EventSetup es)
private

Definition at line 179 of file ESTimingTask.cc.

References edm::EventSetup::get(), and ESGain::getESGain().

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

179  {
180 
181 
182  es.get<ESGainRcd>().get(esgain_);
183  const ESGain *gain = esgain_.product();
184 
185  int ESGain = (int) gain->getESGain();
186 
187  if (ESGain == 1) { // LG
188  wc_ = 0.0837264;
189  n_ = 2.016;
190  } else { // HG
191  wc_ = 0.07291;
192  n_ = 1.798;
193  }
194 
195  //cout<<"gain : "<<ESGain<<endl;
196  //cout<<wc_<<" "<<n_<<endl;
197 
198 }
edm::ESHandle< ESGain > esgain_
Definition: ESTimingTask.h:42
Definition: ESGain.h:5
float getESGain() const
Definition: ESGain.h:11
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
Double_t wc_
Definition: ESTimingTask.h:49
Double_t n_
Definition: ESTimingTask.h:49

Member Data Documentation

edm::InputTag ESTimingTask::digilabel_
private

Definition at line 35 of file ESTimingTask.h.

DQMStore* ESTimingTask::dqmStore_
private

Definition at line 38 of file ESTimingTask.h.

int ESTimingTask::eCount_
private

Definition at line 48 of file ESTimingTask.h.

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

Definition at line 42 of file ESTimingTask.h.

TF1* ESTimingTask::fit_
private

Definition at line 44 of file ESTimingTask.h.

MonitorElement* ESTimingTask::h2DTiming_
private

Definition at line 40 of file ESTimingTask.h.

TH1F* ESTimingTask::htESM_
private

Definition at line 46 of file ESTimingTask.h.

TH1F* ESTimingTask::htESP_
private

Definition at line 45 of file ESTimingTask.h.

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

Definition at line 39 of file ESTimingTask.h.

Double_t ESTimingTask::n_
private

Definition at line 49 of file ESTimingTask.h.

std::string ESTimingTask::prefixME_
private

Definition at line 36 of file ESTimingTask.h.

edm::InputTag ESTimingTask::rechitlabel_
private

Definition at line 34 of file ESTimingTask.h.

int ESTimingTask::runNum_
private

Definition at line 48 of file ESTimingTask.h.

Double_t ESTimingTask::wc_
private

Definition at line 49 of file ESTimingTask.h.