/[PAMELA software]/PamCut/CollectionActions/TrkDedxVsRigHistoAction/TrkDedxVsRigHistoAction.cpp
ViewVC logotype

Contents of /PamCut/CollectionActions/TrkDedxVsRigHistoAction/TrkDedxVsRigHistoAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Sep 25 15:39:36 2009 UTC (15 years, 5 months ago) by pam-fi
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
FILE REMOVED
Removed from repository (switch to the new Histo1DAction and Histo2DAction framework)

1 /*
2 * TrkDedxVsRigHistoAction.cpp
3 *
4 * Created on: 9-giu-2009
5 * Author: Nicola Mori
6 */
7
8 /*! @file TrkDedxVsRigHistoAction.cpp The TrkDedxVsRigHistoAction class implementation file. */
9
10 #include "TrkDedxVsRigHistoAction.h"
11
12 TrkDedxVsRigHistoAction::TrkDedxVsRigHistoAction(const char *actionName, TString outFileName, TString mode,
13 bool logBinningR, float minDedx, float maxDedx, unsigned int nBinsDedx, float minR, float maxR,
14 unsigned int nBinsR) :
15 CollectionAction(actionName), _outFileName(outFileName), _histo(), _mode(mode) {
16
17 _histo.SetName(GetName());
18 _histo.SetTitle("TRK dE/dx Vs Rigidity");
19 _histo.GetXaxis()->SetTitle("R (GV)");
20 _histo.GetYaxis()->SetTitle("dE/dx (MIP)");
21
22 if (!logBinningR || minR <= 0.)
23 _histo.SetBins(nBinsR, minR, maxR, nBinsDedx, minDedx, maxDedx);
24 else {
25 double rigBins[nBinsR + 1];
26 double maxExp = log10(maxR/minR);
27 for (unsigned int i = 0; i < nBinsR + 1; i++) {
28 rigBins[i] = minR * pow(10., (double)i / ((double)nBinsR) * maxExp);
29 }
30 double dedxBins[nBinsDedx + 1];
31 double dedxStep = (maxDedx - minDedx) / (double) nBinsDedx;
32 for (unsigned int i = 0; i < nBinsDedx + 1; i++) {
33 dedxBins[i] = minDedx + i * dedxStep;
34 }
35 _histo.SetBins(nBinsR, rigBins, nBinsDedx, dedxBins);
36 }
37 }
38
39 void TrkDedxVsRigHistoAction::OnGood(PamLevel2 *event) {
40
41 _histo.Fill(1 / event->GetTrack(0)->GetTrkTrack()->GetDeflection(), event->GetTrack(0)->GetTrkTrack()->GetDEDX());
42 }
43
44 void TrkDedxVsRigHistoAction::Finalize() {
45
46 TFile outFile(_outFileName, _mode);
47 outFile.cd();
48 _histo.Write();
49 outFile.Close();
50 }

  ViewVC Help
Powered by ViewVC 1.1.23