Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TrackPhiCut.cxx
1/*
2 * TrackPhiCut.cxx
3 *
4 * Created on: 16-08-2014
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "TrackPhiCut.h"
10
11#include "Track.h"
12
13namespace Hal{
14
15TrackPhiCut::TrackPhiCut() : TrackCut(1), fRound(kFALSE) {
16 SetUnitName("#phi");
17 SetMinMax(-TMath::Pi(), TMath::Pi());
18}
19
20Bool_t TrackPhiCut::Pass(Track* track) {
21 Double_t phi = TMath::ATan2(track->GetPy(), track->GetPx());
22 SetValue(phi);
23 if (fRound) {
24 if (phi < GetMax() || phi > GetMin()) {
25 ForcedUpdate(kTRUE);
26 return kTRUE;
27 } else {
28 ForcedUpdate(kFALSE);
29 return kFALSE;
30 }
31 } else {
32 return Validate();
33 }
34}
35
36Bool_t TrackPhiCut::Init(Int_t /*task_id*/) {
37 fInit = kTRUE;
38 while (GetMax(0) > TMath::Pi()) {
39 SetMaximum(GetMax() - TMath::Pi() * 2.0);
40 }
41 while (GetMin(0) > TMath::Pi()) {
42 SetMinimum(GetMin() - TMath::Pi() * 2.0);
43 }
44 while (GetMax(0) < -TMath::Pi()) {
45 SetMaximum(GetMax() + TMath::Pi() * 2.0);
46 }
47 while (GetMin(0) < -TMath::Pi()) {
48 SetMinimum(GetMin() + TMath::Pi() * 2.0);
49 }
50 if (GetMax(0) < GetMin(0)) { fRound = kTRUE; }
51 return kTRUE;
52}
53
54TrackPhiCut::~TrackPhiCut() {}
55}
Double_t GetPx() const
Definition Track.h:99
Double_t GetPy() const
Definition Track.h:104