Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TrackMtCut.cxx
1/*
2 * TrackMtCut.cxx
3 *
4 * Created on: 20-05-2015
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "TrackMtCut.h"
11
12
13#include <TMath.h>
14#include <TString.h>
15
16#include "Cut.h"
17#include "Package.h"
18#include "Parameter.h"
19#include "Track.h"
20
21namespace Hal {
22
23 TrackMtCut::TrackMtCut() : TrackCut(1), fMassFixed(kFALSE), fMass2(0), fPdg(NULL) { SetUnitName("m_{T} [GeV/c^{2}]"); }
24
25 Package* TrackMtCut::Report() const {
26 Package* pack = TrackCut::Report();
27 TString mass_flag;
28 TString mass_val;
29 if (fMassFixed) {
30 mass_flag = "fixed mass";
31 mass_val = Form("%4.3f", TMath::Sqrt(fMass2));
32 } else {
33 mass_flag = "free mass";
34 mass_val = " NULL";
35 }
36 pack->AddObject(new ParameterString("Mass status", mass_flag));
37 pack->AddObject(new ParameterString("Mass val", mass_val));
38 return pack;
39 }
40
41 TrackMtCut::TrackMtCut(const TrackMtCut& cut) : TrackCut(cut) {
42 this->fMass2 = cut.fMass2;
43 this->fMassFixed = cut.fMassFixed;
44 this->fPdg = cut.fPdg;
45 }
46
47 TrackMtCut::~TrackMtCut() {
48 // TODO Auto-generated destructor stub
49 }
50
51 Bool_t TrackMtCut::Pass(Track* track) {
52 Double_t px = track->GetPx();
53 Double_t py = track->GetPy();
54 Double_t pt2 = px * px + py * py;
55 if (fMassFixed) {
56 Double_t mt = TMath::Sqrt(pt2 + fMass2);
57 SetValue(mt);
58 return Validate();
59 } else {
60 Double_t m = track->GetMass();
61 Double_t mt = TMath::Sqrt(m * m + pt2);
62 SetValue(mt);
63 return Validate();
64 }
65 }
66
67 void TrackMtCut::FixMass(Double_t mass) {
68 fMassFixed = kTRUE;
69 fMass2 = mass * mass;
70 }
71
72 Bool_t TrackMtCut::Init(const Int_t task_id) {
73 Bool_t stat = TrackCut::Init(task_id);
74 fPdg = TDatabasePDG::Instance();
75 return stat;
76 }
77}
virtual Bool_t Init(Int_t=0)
Definition Cut.h:346
void SetValue(Double_t val, Int_t i=0)
Definition Cut.h:235
Bool_t Validate()
Definition Cut.cxx:43
void AddObject(TObject *object)
Definition Package.cxx:209
void FixMass(Double_t mass)
virtual Bool_t Init(const Int_t task_id=0)
virtual Bool_t Pass(Track *track)
Double_t GetPx() const
Definition Track.h:99
Double_t GetMass() const
Definition Track.h:179
Double_t GetPy() const
Definition Track.h:104