#include <ESTimingTask.h>
Public Member Functions | |
ESTimingTask (const edm::ParameterSet &ps) | |
virtual | ~ESTimingTask () |
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_ |
DQMStore * | dqmStore_ |
int | eCount_ |
edm::ESHandle< ESGain > | esgain_ |
TF1 * | fit_ |
MonitorElement * | h2DTiming_ |
TH1F * | htESM_ |
TH1F * | htESP_ |
MonitorElement * | hTiming_ [2][2] |
Double_t | n_ |
std::string | prefixME_ |
edm::InputTag | rechitlabel_ |
int | runNum_ |
Double_t | wc_ |
Definition at line 19 of file ESTimingTask.h.
ESTimingTask::ESTimingTask | ( | const edm::ParameterSet & | ps | ) |
Definition at line 43 of file ESTimingTask.cc.
References fitf(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::histo, i, j, and cmsCodeRules::cppFunctionSkipper::operator.
{ rechitlabel_ = ps.getParameter<InputTag>("RecHitLabel"); digilabel_ = ps.getParameter<InputTag>("DigiLabel"); prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower"); dqmStore_ = Service<DQMStore>().operator->(); eCount_ = 0; fit_ = new TF1("fitShape", fitf, -200, 200, 4); fit_->SetParameters(50, 10, 0, 0); //Histogram init for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) hTiming_[i][j] = 0; dqmStore_->setCurrentFolder(prefixME_ + "/ESTimingTask"); //Booking Histograms //Notice: Change ESRenderPlugin under DQM/RenderPlugins/src if you change this histogram name. char histo[200]; for (int i=0 ; i<2; ++i) for (int j=0 ; j<2; ++j) { int iz = (i==0)? 1:-1; sprintf(histo, "ES Timing Z %d P %d", iz, j+1); hTiming_[i][j] = dqmStore_->book1D(histo, histo, 81, -20.5, 20.5); hTiming_[i][j]->setAxisTitle("ES Timing (ns)", 1); } sprintf(histo, "ES 2D Timing"); h2DTiming_ = dqmStore_->book2D(histo, histo, 81, -20.5, 20.5, 81, -20.5, 20.5); h2DTiming_->setAxisTitle("ES- Timing (ns)", 1); h2DTiming_->setAxisTitle("ES+ Timing (ns)", 2); htESP_ = new TH1F("htESP", "Timing ES+", 81, -20.5, 20.5); htESM_ = new TH1F("htESM", "Timing ES-", 81, -20.5, 20.5); }
ESTimingTask::~ESTimingTask | ( | ) | [virtual] |
Definition at line 82 of file ESTimingTask.cc.
void ESTimingTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 93 of file ESTimingTask.cc.
References ecalMGPA::adc(), ESSample::adc(), funct::exp(), edm::Event::getByLabel(), i, edm::EventBase::id(), ESDataFrame::id(), j, gen::k, funct::log(), edm::EventID::run(), ESDataFrame::sample(), ESDataFrame::size(), ntuplemaker::status, and ESDetId::zside().
{ set(iSetup); runNum_ = e.id().run(); eCount_++; htESP_->Reset(); htESM_->Reset(); //Digis int zside, plane, ix, iy, is; double adc[3]; // double para[10]; //double tx[3] = {-5., 20., 45.}; Handle<ESDigiCollection> digis; if ( e.getByLabel(digilabel_, digis) ) { for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) { ESDataFrame dataframe = (*digiItr); ESDetId id = dataframe.id(); zside = id.zside(); plane = id.plane(); ix = id.six(); iy = id.siy(); is = id.strip(); //if (zside==1 && plane==1 && ix==15 && iy==6) continue; if (zside==1 && plane==1 && ix==7 && iy==28) continue; if (zside==1 && plane==1 && ix==24 && iy==9 && is==21) continue; if (zside==-1 && plane==2 && ix==35 && iy==17 && is==23) continue; int i = (zside==1)? 0:1; int j = plane-1; for (int k=0; k<dataframe.size(); ++k) adc[k] = dataframe.sample(k).adc(); double status = 0; if (adc[1] < 200) status = 1; if (fabs(adc[0]) > 10) status = 1; if (adc[1] < 0 || adc[2] < 0) status = 1; if (adc[0] > adc[1] || adc[0] > adc[2]) status = 1; if (adc[2] > adc[1]) status = 1; if (int(status) == 0) { double A1 = adc[1]; double A2 = adc[2]; double DeltaT = 25.; double aaa = (A2 > 0 && A1 > 0) ? log(A2/A1)/n_ : 20.; // if A1=0, t0=20 double bbb = wc_/n_*DeltaT; double ccc= exp(aaa+bbb); double t0 = (2.-ccc)/(1.-ccc) * DeltaT - 5; hTiming_[i][j]->Fill(t0); //cout<<"t0 : "<<t0<<endl; /* TGraph *gr = new TGraph(3, tx, adc); fit_->SetParameters(50, 10, wc_, n_); fit_->FixParameter(2, wc_); fit_->FixParameter(3, n_); fit_->Print(); gr->Fit("fitShape", "MQ"); fit_->GetParameters(para); delete gr; //hTiming_[i][j]->Fill(para[1]); */ //cout<<"ADC : "<<zside<<" "<<plane<<" "<<ix<<" "<<iy<<" "<<is<<" "<<adc[0]<<" "<<adc[1]<<" "<<adc[2]<<" "<<para[1]<<" "<<wc_<<" "<<n_<<endl; if (zside == 1) htESP_->Fill(t0); else if (zside == -1) htESM_->Fill(t0); } } } else { LogWarning("ESTimingTask") << digilabel_ << " not available"; } if (htESP_->GetEntries() > 0 && htESM_->GetEntries() > 0) h2DTiming_->Fill(htESM_->GetMean(), htESP_->GetMean()); }
void ESTimingTask::beginJob | ( | void | ) | [private, virtual] |
void ESTimingTask::endJob | ( | void | ) | [private, virtual] |
void ESTimingTask::set | ( | const edm::EventSetup & | es | ) | [private] |
Definition at line 179 of file ESTimingTask.cc.
References edm::EventSetup::get(), and ESGain::getESGain().
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.