]>
Commit | Line | Data |
---|---|---|
2bb2434e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Authors: Svein Lindal, Daniel Lohner * | |
5 | * Version 1.0 * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //////////////////////////////////////////////// | |
17 | //--------------------------------------------- | |
18 | // QA Task for V0 Reader V1 | |
19 | //--------------------------------------------- | |
20 | //////////////////////////////////////////////// | |
21 | ||
22 | #include "AliAnalysisTaskConversionQA.h" | |
23 | #include "TChain.h" | |
24 | #include "AliAnalysisManager.h" | |
25 | #include "TParticle.h" | |
26 | #include "TVectorF.h" | |
27 | #include "AliPIDResponse.h" | |
28 | #include "TFile.h" | |
29 | ||
30 | class iostream; | |
31 | ||
32 | using namespace std; | |
33 | ||
34 | ClassImp(AliAnalysisTaskConversionQA) | |
35 | ||
36 | //________________________________________________________________________ | |
37 | AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA(const char *name) : AliAnalysisTaskSE(name), | |
38 | fConversionGammas(NULL), | |
39 | fConversionCuts(NULL), | |
40 | fStreamQA(NULL), | |
41 | fIsHeavyIon(kFALSE), | |
42 | fOutputList(NULL) | |
43 | { | |
44 | // Default constructor | |
45 | ||
46 | DefineInput(0, TChain::Class()); | |
47 | DefineOutput(1, TList::Class()); | |
48 | } | |
49 | ||
50 | //________________________________________________________________________ | |
51 | AliAnalysisTaskConversionQA::~AliAnalysisTaskConversionQA() | |
52 | { | |
53 | // default deconstructor | |
54 | if(fStreamQA){ | |
55 | delete fStreamQA; | |
56 | fStreamQA = 0x0; | |
57 | } | |
58 | } | |
59 | //________________________________________________________________________ | |
60 | void AliAnalysisTaskConversionQA::UserCreateOutputObjects() | |
61 | { | |
62 | // Create User Output Objects | |
63 | ||
64 | if(fOutputList != NULL){ | |
65 | delete fOutputList; | |
66 | fOutputList = NULL; | |
67 | } | |
68 | if(fOutputList == NULL){ | |
69 | fOutputList = new TList(); | |
70 | fOutputList->SetOwner(kTRUE); | |
71 | } | |
72 | ||
73 | // V0 Reader Cuts | |
74 | TString cutnumber = fConversionCuts->GetCutNumber(); | |
75 | ||
76 | fStreamQA = new TTreeSRedirector(Form("GammaConvV1_QA_%s.root",cutnumber.Data())); | |
77 | PostData(1, fOutputList); | |
78 | ||
79 | } | |
80 | ||
81 | //________________________________________________________________________ | |
82 | void AliAnalysisTaskConversionQA::UserExec(Option_t *){ | |
83 | ||
84 | fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"); | |
85 | ||
86 | Int_t eventQuality = ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetEventQuality(); | |
87 | if(eventQuality != 0){// Event Not Accepted | |
88 | return; | |
89 | } | |
90 | AliESDEvent* event = (AliESDEvent*) InputEvent(); | |
91 | if(fIsHeavyIon && !fConversionCuts->IsCentralitySelected(event)) return; | |
92 | ||
93 | fConversionGammas=fV0Reader->GetReconstructedGammas(); | |
94 | ||
95 | ProcessQA(); | |
96 | PostData(1, fOutputList); | |
97 | } | |
98 | ||
99 | ||
100 | ///________________________________________________________________________ | |
101 | void AliAnalysisTaskConversionQA::ProcessQA(){ | |
102 | ||
103 | // Fill Histograms for QA and MC | |
104 | AliESDEvent* event = (AliESDEvent*) InputEvent(); | |
105 | AliPIDResponse* pidResonse = ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse(); | |
106 | for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){ | |
107 | AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex)); | |
108 | if(!fConversionCuts->PhotonIsSelected(gamma,event)) continue; | |
109 | Float_t gammaPt = gamma->GetPhotonPt(); | |
110 | Float_t gammaPhi = gamma->GetPhotonPhi(); | |
111 | Float_t gammaTheta = gamma->Theta(); | |
112 | Float_t gammaChi2NDF = gamma->GetChi2perNDF(); | |
113 | Float_t gammaQt = gamma->GetArmenterosQt(); | |
114 | Float_t gammaAlpha = gamma->GetArmenterosAlpha(); | |
115 | Float_t gammaPsiPair = gamma->GetPsiPair(); | |
116 | TVectorF daughterProp(14); | |
117 | AliVTrack * negTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelNegative()); | |
118 | AliVTrack * posTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelPositive()); | |
119 | if(!negTrack||!posTrack)return; | |
120 | ||
121 | daughterProp(0) = posTrack->Pt(); | |
122 | daughterProp(7) = negTrack->Pt(); | |
123 | daughterProp(1) = posTrack->Theta(); | |
124 | daughterProp(8) = negTrack->Theta(); | |
125 | daughterProp(2) = posTrack->GetTPCsignal(); | |
126 | daughterProp(9) = negTrack->GetTPCsignal(); | |
127 | daughterProp(3) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron); | |
ca91a3e1 | 128 | daughterProp(10) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kElectron); |
2bb2434e | 129 | if((posTrack->GetStatus() & AliESDtrack::kTOFpid) && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){ |
130 | daughterProp(4) = posTrack->GetTOFsignal(); | |
131 | daughterProp(5) = pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron); | |
132 | } else { | |
133 | daughterProp(4) = 20000; | |
134 | daughterProp(5) = -20; | |
135 | } | |
136 | if((negTrack->GetStatus() & AliESDtrack::kTOFpid) && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){ | |
137 | daughterProp(11) = negTrack->GetTOFsignal(); | |
138 | daughterProp(12) = pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron); | |
139 | } else { | |
140 | daughterProp(11) = 20000; | |
141 | daughterProp(12) = -20; | |
142 | } | |
143 | daughterProp(6) = (Float_t)posTrack->GetNcls(1)/(Float_t)posTrack->GetTPCNclsF(); | |
144 | daughterProp(13) = (Float_t)negTrack->GetNcls(1)/(Float_t)negTrack->GetTPCNclsF(); | |
145 | ||
146 | if (fStreamQA){ | |
147 | (*fStreamQA)<<"PhotonQA" | |
148 | << "pt=" << gammaPt | |
149 | << "phi=" << gammaPhi | |
150 | << "theta=" << gammaTheta | |
151 | << "chi2ndf=" << gammaChi2NDF | |
152 | << "qt="<< gammaQt | |
153 | << "alpha=" << gammaAlpha | |
154 | << "psipair=" << gammaPsiPair | |
155 | << "daugtherProp.=" << &daughterProp | |
156 | << "\n"; | |
157 | } | |
158 | } | |
159 | } | |
160 | ||
161 | ||
162 | //________________________________________________________________________ | |
163 | void AliAnalysisTaskConversionQA::Terminate(Option_t *) | |
164 | { | |
165 | if (fStreamQA){ | |
166 | fStreamQA->GetFile()->Write(); | |
167 | } | |
168 | } |