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

Contents of /PamCut/CollectionActions/TrkBetaPrVsTofBetaHistoAction/TrkBetaPrVsTofBetaHistoAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Aug 5 13:32:32 2009 UTC (15 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: Root_V8, MergedToHEAD_1, nuclei_reproc, MergedFromV8_1, BeforeMergingFromV8_1, V9, HEAD
Branch point for: V8
Added to repository

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 }

  ViewVC Help
Powered by ViewVC 1.1.23