Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TrackYCut.cxx
1/*
2 * TrackYCut.cpp
3 *
4 * Created on: 03-11-2014
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "TrackYCut.h"
11
12#include "Cut.h"
13#include "Package.h"
14#include "Parameter.h"
15#include "Track.h"
16
17#include <RtypesCore.h>
18#include <TDatabasePDG.h>
19#include <TMath.h>
20
21namespace Hal {
22
23 TrackYCut::TrackYCut() : TrackCut(1) { SetUnitName("y"); }
24
25 Bool_t TrackYCut::Pass(Track* track) {
26 Double_t pz = track->GetPz();
27 Double_t e = track->GetE();
28 Double_t y = 0.5 * TMath::Log((e + pz) / (e - pz));
29 SetValue(y);
30 return Validate();
31 }
32
33 TrackYCut::~TrackYCut() {
34 // TODO Auto-generated destructor stub
35 }
36
37 Bool_t TrackYAssumedCut::Pass(Track* track) {
38 Double_t p = track->GetMomentum().P();
39 Double_t E = TMath::Sqrt(p * p + fMass);
40 Double_t y = 0.5 * TMath::Log((E + p) / (E - p));
41 SetValue(y);
42 return Validate();
43 }
44
45 void TrackYAssumedCut::SetPid(Int_t pid) {
46 TDatabasePDG* pdg = TDatabasePDG::Instance();
47 TParticlePDG* part = pdg->GetParticle(pid);
48 if (part) {
49 fMass = part->Mass();
50 fMass = fMass * fMass;
51 fPdg = pid;
52 } else {
53 fMass = -1;
54 }
55 }
56
57 Bool_t TrackYAssumedCut::Init(Int_t taskId) {
58 if (fMass < 0) return kFALSE;
59 return TrackCut::Init(taskId);
60 }
61
62 Package* TrackYAssumedCut::Report() const {
63 Package* pack = TrackCut::Report();
64 pack->AddObject(new Hal::ParameterInt("PID", fPdg));
65 return pack;
66 }
67
68} // namespace Hal
void AddObject(TObject *object)
Definition Package.cxx:209
Double_t GetPz() const
Definition Track.h:109
const TLorentzVector & GetMomentum() const
Definition Track.h:118
Double_t GetE() const
Definition Track.h:114