/* * CaloDedxVsBetaHistoAction.cpp * * Created on: 03/ago/2009 * Author: Nicola Mori */ /*! @file CaloDedxVsBetaHistoAction.cpp The CaloDedxVsBetaHistoAction class implementation file. */ #include "CaloDedxVsBetaHistoAction.h" CaloDedxVsBetaHistoAction::CaloDedxVsBetaHistoAction(const char *actionName, TString outFileName, unsigned int plane, unsigned int view, TString mode, float minDedx, float maxDedx, unsigned int nBinsDedx, float minBeta, float maxBeta, unsigned int nBinsBeta) : CollectionAction(actionName), _outFileName(outFileName), _plane(plane), _view(view), _histo(), _mode(mode) { _histo.SetName(GetName()); TString title = "CALO dE/dx (plane "; title += _plane; title += ", "; if (_view == 0) title += "X"; if (_view == 1) title += "Y"; title += " view) Vs Beta"; _histo.SetTitle(title); _histo.GetXaxis()->SetTitle("Beta"); _histo.GetYaxis()->SetTitle("dE/dx (MIP)"); _histo.SetBins(nBinsBeta, minBeta, maxBeta, nBinsDedx, minDedx, maxDedx); } void CaloDedxVsBetaHistoAction::OnGood(PamLevel2 *event) { _histo.Fill(event->GetTrack(0)->GetToFTrack()->beta[12], event->GetCaloLevel1()->qtotpl(_view, _plane)); //cout << event->GetTrack(0)->GetToFTrack()->beta[12] << " "<< event->GetCaloLevel1()->qtotpl(_view, _plane) << endl; } void CaloDedxVsBetaHistoAction::Finalize() { TFile outFile(_outFileName, _mode); outFile.cd(); _histo.Write(); outFile.Close(); }