totEt cuts into their own proper class
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisHadEtReconstructed.cxx
1 //_________________________________________________________________________
2 //  Utility Class for transverse energy studies, charged hadrons
3 //  Base class for ESD analysis
4 //  - reconstruction output
5 // implementation file
6 //
7 //Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
8 //University of Tennessee at Knoxville
9 //_________________________________________________________________________
10 #include "AliAnalysisHadEtReconstructed.h"
11 #include "AliAnalysisEtCuts.h"
12 #include "AliESDtrack.h"
13 #include "AliESDCaloCluster.h"
14 #include "AliVEvent.h"
15 #include "AliESDEvent.h"
16 #include "AliVParticle.h"
17 #include <iostream>
18
19 AliAnalysisHadEtReconstructed::AliAnalysisHadEtReconstructed() :
20         AliAnalysisHadEt()
21 {
22
23 }
24
25 AliAnalysisHadEtReconstructed::~AliAnalysisHadEtReconstructed() 
26 {
27 }
28
29 Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
30 { // analyse ESD event
31     ResetEventValues();
32     AliESDEvent *event = dynamic_cast<AliESDEvent*>(ev);
33
34     for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++)
35     {
36         AliVParticle *track = event->GetTrack(iTrack);
37         if (!track)
38         {
39             Printf("ERROR: Could not get track %d", iTrack);
40             continue;
41         }
42
43         fMultiplicity++;
44
45         const Double_t *pidWeights = track->PID();
46         if (pidWeights)
47         {
48             Int_t maxpid = -1;
49             Float_t maxpidweight = 0;
50             for (Int_t p =0; p < AliPID::kSPECIES; p++)
51             {
52                 if (pidWeights[p] > maxpidweight)
53                 {
54                     maxpidweight = pidWeights[p];
55                     maxpid = p;
56                 }
57             }
58             if (maxpid == AliPID::kProton)
59             {
60                 //     massPart = -0.938*track->Charge();
61             }
62
63         }
64
65     }
66
67     fTotNeutralEtAcc = fTotNeutralEt;
68     fTotEt = fTotChargedEt + fTotNeutralEt;
69     fTotEtAcc = fTotChargedEtAcc + fTotNeutralEtAcc;
70
71     std::cout << fTotChargedEtAcc << std::endl;
72     // Fill the histograms...
73     FillHistograms();
74
75     return 1;
76 }
77
78 bool AliAnalysisHadEtReconstructed::CheckGoodVertex(AliVParticle* track)
79 { // check vertex
80
81     Float_t bxy = 999.;
82     Float_t bz = 999.;
83     dynamic_cast<AliESDtrack*>(track)->GetImpactParametersTPC(bxy,bz);
84
85     bool status = (TMath::Abs(track->Xv()) < fCuts->GetReconstructedVertexXCut()) && 
86       (TMath::Abs(track->Yv()) < fCuts->GetReconstructedVertexYCut()) && 
87       (TMath::Abs(track->Zv()) < fCuts->GetReconstructedVertexZCut()) && 
88       (TMath::Abs(bxy) < fCuts->GetReconstructedIPxyCut()) && 
89       (TMath::Abs(bz) < fCuts->GetReconstructedIPzCut()); 
90
91     return status;
92 }
93
94 void AliAnalysisHadEtReconstructed::Init()
95 { // Init
96     AliAnalysisHadEt::Init();
97 }
98
99