Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TwoTrackPtOrderCut.cxx
1/*
2 * TwoTrackPtOrderCut.cxx
3 *
4 * Created on: 30 sie 2016
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "TwoTrackPtOrderCut.h"
10
11#include "Track.h"
12#include "TwoTrack.h"
13namespace Hal {
14 TwoTrackPtOrderCut::TwoTrackPtOrderCut() : TwoTrackCut(1) { SetUnitName("Sloer [bool]"); }
15
16 Bool_t TwoTrackPtOrderCut::Pass(TwoTrack* pair) {
17 Double_t px1 = pair->GetTrack1()->GetPx();
18 Double_t px2 = pair->GetTrack2()->GetPx();
19 Double_t py1 = pair->GetTrack1()->GetPy();
20 Double_t py2 = pair->GetTrack2()->GetPy();
21 switch (pair->GetPairType()) {
22 case TwoTrack::kRotated:
23 px2 = -px2;
24 py2 = -py2;
25 break;
26 case TwoTrack::kHemishpere:
27 px2 = -px2;
28 py2 = -py2;
29 break;
30 default: break;
31 }
32 Double_t pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
33 Double_t pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
34
35 Double_t phi1 = TMath::ATan2(py1, px1);
36 Double_t phi2 = TMath::ATan2(py2, px2);
37 Double_t dphi = TMath::Abs(phi1 - phi2);
38 if (dphi > TMath::Pi()) dphi -= TMath::Pi();
39 if (dphi > TMath::Pi() * 0.5) {
40 SetValue(-1);
41 ForcedUpdate(kFALSE);
42 }
43 SetValue(TMath::Abs(pt1 - pt2));
44 return Validate();
45 }
46
47 TwoTrackPtOrderCut::~TwoTrackPtOrderCut() {}
48} // namespace Hal
Double_t GetPx() const
Definition Track.h:99
Double_t GetPy() const
Definition Track.h:104
PairType GetPairType() const
Definition TwoTrack.h:70
Track * GetTrack1() const
Definition TwoTrack.h:75
Track * GetTrack2() const
Definition TwoTrack.h:80