Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TrackEtaCut.cxx
1/*
2 * TrackEtaCut.cxx
3 *
4 * Created on: 28-10-2013
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "TrackEtaCut.h"
11
12#include "Track.h"
13
14namespace Hal {
15 TrackEtaCut::TrackEtaCut() : TrackCut(1) { SetUnitName("#eta"); }
16
17 TrackEtaCut::~TrackEtaCut() {}
18
19 Bool_t TrackEtaCut::Pass(Track* track) {
20 Double_t px = track->GetPx();
21 Double_t py = track->GetPy();
22 Double_t pz = track->GetPz();
23 Double_t p = TMath::Sqrt(px * px + py * py + pz * pz);
24 if (p == pz) {
25 SetValue(kMaxInt);
26 return Validate();
27 }
28 Double_t eta = 0.5 * TMath::Log((p + pz) / (p - pz));
29 SetValue(eta);
30 return Validate();
31 }
32
33 //- Eta abs ------------------
34
35 TrackEtaAbsCut::TrackEtaAbsCut() : TrackCut(1) { SetUnitName("|#eta|"); }
36
37 Bool_t TrackEtaAbsCut::Pass(Track* track) {
38 Double_t px = track->GetPx();
39 Double_t py = track->GetPy();
40 Double_t pz = track->GetPz();
41 Double_t p = TMath::Sqrt(px * px + py * py + pz * pz);
42 if (p == pz) {
43 SetValue(kMaxInt);
44 return ValidateAbs();
45 }
46 if (p == -pz) {
47 SetValue(kMaxInt);
48 return ValidateAbs();
49 }
50 Double_t eta = 0.5 * TMath::Log((p + pz) / (p - pz));
51 SetValue(TMath::Abs(eta), 0);
52 return Validate();
53 }
54
55 TrackEtaAbsCut::~TrackEtaAbsCut() {}
56
57 Bool_t TrackEtaAbsCut::Init(Int_t task_id) {
58 if (TrackCut::Init(task_id) == kFALSE) return kFALSE;
59 return kTRUE;
60 }
61} // namespace Hal
virtual Bool_t Init(Int_t=0)
Definition Cut.h:346
Bool_t ValidateAbs()
Definition Cut.cxx:67
void SetValue(Double_t val, Int_t i=0)
Definition Cut.h:235
Bool_t Validate()
Definition Cut.cxx:43
void SetUnitName(TString name, Int_t i=0)
Definition Cut.h:241
virtual Bool_t Pass(Track *track)
virtual Bool_t Init(Int_t task_id)
Double_t GetPz() const
Definition Track.h:109
Double_t GetPx() const
Definition Track.h:99
Double_t GetPy() const
Definition Track.h:104