1 |
/* |
2 |
* TrkBetaPrVsTofBetaHistoAction.cpp |
3 |
* |
4 |
* Created on: 2009-06-05 |
5 |
* Author: S. Ricciarini |
6 |
*/ |
7 |
|
8 |
/*! @file TrkBetaPrVsTofBetaHistoAction.cpp The TrkBetaPrVsTofBetaHistoAction class implementation file. */ |
9 |
|
10 |
#include "TrkBetaPrVsTofBetaHistoAction.h" |
11 |
|
12 |
TrkBetaPrVsTofBetaHistoAction::TrkBetaPrVsTofBetaHistoAction(const char *actionName, TString outFileName, TString mode) : |
13 |
CollectionAction(actionName), _outFileName(outFileName), _histo(), _mode(mode) { |
14 |
|
15 |
_histo.SetName(GetName()); |
16 |
_histo.SetTitle("TRK Beta (p) Vs. TOF Beta"); |
17 |
_histo.GetXaxis()->SetTitle("TOF Beta"); |
18 |
_histo.GetYaxis()->SetTitle("TRK Beta (p)"); |
19 |
_histo.SetBins(500, 0., 1.2, 500, 0., 1.2); |
20 |
} |
21 |
|
22 |
void TrkBetaPrVsTofBetaHistoAction::OnGood(PamLevel2 *event){ |
23 |
|
24 |
TrkTrack *trkTrack = event->GetTrack(0)->GetTrkTrack(); |
25 |
|
26 |
Int_t seqno = trkTrack->GetSeqNo(); |
27 |
Int_t ntrack_tof = 0; |
28 |
for (Int_t i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
29 |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == seqno) |
30 |
ntrack_tof = i; |
31 |
} |
32 |
Float_t betaModTof = fabs(event->GetToFLevel2()->CalcBeta(ntrack_tof, 10., 10., 20.)); // beta[12] for TRK track 0 |
33 |
|
34 |
Int_t _charge=1; |
35 |
Float_t _mass_p=0.93827203; // GeV (pdg.web.cern.ch) |
36 |
|
37 |
Float_t betaModTrk_p = (trkTrack->GetRigidity() * abs(_charge)) / pow(pow(trkTrack->GetRigidity() * _charge, 2) + pow(_mass_p, 2), 0.5); |
38 |
|
39 |
_histo.Fill(betaModTof,betaModTrk_p); |
40 |
|
41 |
} |
42 |
|
43 |
void TrkBetaPrVsTofBetaHistoAction::Finalize(){ |
44 |
|
45 |
TFile outFile(_outFileName, _mode); |
46 |
outFile.cd(); |
47 |
_histo.Write(); |
48 |
outFile.Close(); |
49 |
|
50 |
} |