]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | #include <TROOT.h> | |
3 | #include <TSystem.h> | |
4 | #include <TInterpreter.h> | |
5 | #include <TChain.h> | |
6 | #include <TFile.h> | |
7 | #include <TList.h> | |
8 | #include <iostream> | |
9 | #include "TH1F.h" | |
10 | #include "TH2F.h" | |
11 | #include "AliFMDAnalysisTaskBFCorrelation.h" | |
12 | #include "AliAnalysisManager.h" | |
13 | #include "AliESDFMD.h" | |
14 | #include "AliESDEvent.h" | |
15 | #include "AliAODEvent.h" | |
16 | #include "AliAODHandler.h" | |
17 | #include "AliMCEventHandler.h" | |
18 | #include "AliStack.h" | |
19 | #include "AliLog.h" | |
20 | #include "AliESDVertex.h" | |
21 | #include "TMath.h" | |
22 | #include "AliFMDAnaParameters.h" | |
23 | //#include "AliFMDGeometry.h" | |
24 | #include "AliGenEventHeader.h" | |
25 | #include "AliGenPythiaEventHeader.h" | |
26 | #include "AliHeader.h" | |
27 | //#include "TDatabasePDG.h" | |
28 | //#include "TParticlePDG.h" | |
29 | #include "AliESDInputHandler.h" | |
30 | ClassImp(AliFMDAnalysisTaskBFCorrelation) | |
31 | ||
32 | ||
33 | AliFMDAnalysisTaskBFCorrelation::AliFMDAnalysisTaskBFCorrelation() | |
34 | : fDebug(0), | |
35 | fOutputList(0), | |
36 | fInputList(0), | |
37 | fVertexString(0x0), | |
38 | fStandalone(kTRUE) | |
39 | { | |
40 | // Default constructor | |
41 | DefineInput (0, TList::Class()); | |
42 | DefineOutput(0, TList::Class()); | |
43 | } | |
44 | //_____________________________________________________________________ | |
45 | AliFMDAnalysisTaskBFCorrelation::AliFMDAnalysisTaskBFCorrelation(const char* name, Bool_t SE): | |
46 | AliAnalysisTask(name,name), | |
47 | fDebug(0), | |
48 | fOutputList(0), | |
49 | fInputList(0), | |
50 | fVertexString(0x0), | |
51 | fStandalone(kTRUE) | |
52 | { | |
53 | fStandalone = SE; | |
54 | if(fStandalone) { | |
55 | DefineInput (0, TList::Class()); | |
56 | DefineInput(1, TObjString::Class()); | |
57 | DefineOutput(0, TList::Class()); | |
58 | ||
59 | } | |
60 | } | |
61 | //_____________________________________________________________________ | |
62 | void AliFMDAnalysisTaskBFCorrelation::CreateOutputObjects() | |
63 | { | |
64 | //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
65 | ||
66 | if(!fOutputList) { | |
67 | fOutputList = new TList(); | |
68 | fOutputList->SetName("BackgroundCorrected"); | |
69 | } | |
70 | ||
71 | TH1F* test = new TH1F("test","test",10,0,10); | |
72 | fOutputList->Add(test); | |
73 | } | |
74 | //_____________________________________________________________________ | |
75 | void AliFMDAnalysisTaskBFCorrelation::ConnectInputData(Option_t */*option*/) | |
76 | { | |
77 | if(fStandalone) { | |
78 | fInputList = (TList*)GetInputData(0); | |
79 | fVertexString = (TObjString*)GetInputData(1); | |
80 | } | |
81 | } | |
82 | //_____________________________________________________________________ | |
83 | void AliFMDAnalysisTaskBFCorrelation::Exec(Option_t */*option*/) | |
84 | { | |
85 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
86 | ||
87 | fVertexString = (TObjString*)fInputList->At(0); | |
88 | ||
89 | Int_t vtxbin = fVertexString->GetString().Atoi(); | |
90 | //for(UShort_t det=1;det<=3;det++) { | |
91 | // Int_t nRings = (det==1 ? 1 : 2); | |
92 | // for (UShort_t ir = 0; ir < nRings; ir++) { | |
93 | // Char_t ringChar = (ir == 0 ? 'I' : 'O'); | |
94 | //TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); | |
95 | // TH2F* hMultTotalTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); | |
96 | ||
97 | ||
98 | TH1F* test = (TH1F*)fOutputList->FindObject("test"); | |
99 | test->Fill(vtxbin); | |
100 | if(pars->GetProcessPrimary()) | |
101 | ProcessPrimary(); | |
102 | ||
103 | if(fStandalone) { | |
104 | PostData(0, fOutputList); | |
105 | } | |
106 | ||
107 | } | |
108 | //_____________________________________________________________________ | |
109 | void AliFMDAnalysisTaskBFCorrelation::Terminate(Option_t */*option*/) { | |
110 | ||
111 | ||
112 | } | |
113 | //_____________________________________________________________________ | |
114 | void AliFMDAnalysisTaskBFCorrelation::ProcessPrimary() { | |
115 | /* | |
116 | AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
117 | AliMCEvent* mcEvent = eventHandler->MCEvent(); | |
118 | if(!mcEvent) | |
119 | return; | |
120 | ||
121 | ||
122 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
123 | ||
124 | AliMCParticle* particle = 0; | |
125 | AliStack* stack = mcEvent->Stack(); | |
126 | ||
127 | TH1F* hPrimary = (TH1F*)fOutputList->FindObject("hMultvsEta"); | |
128 | AliHeader* header = mcEvent->Header(); | |
129 | AliGenEventHeader* genHeader = header->GenEventHeader(); | |
130 | ||
131 | TArrayF vertex; | |
132 | genHeader->PrimaryVertex(vertex); | |
133 | if(TMath::Abs(vertex.At(2)) > pars->GetVtxCutZ()) | |
134 | return; | |
135 | Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins(); | |
136 | Double_t vertexBinDouble = (vertex.At(2) + pars->GetVtxCutZ()) / delta; | |
137 | Int_t vertexBin = (Int_t)vertexBinDouble; | |
138 | ||
139 | Bool_t firstTrack = kTRUE; | |
140 | ||
141 | // we loop over the primaries only unless we need the hits (diagnostics running slowly) | |
142 | Int_t nTracks = stack->GetNprimary(); | |
143 | if(pars->GetProcessHits()) | |
144 | nTracks = stack->GetNtrack(); | |
145 | ||
146 | for(Int_t i = 0 ;i<nTracks;i++) { | |
147 | particle = (AliMCParticle*) mcEvent->GetTrack(i); | |
148 | if(!particle) | |
149 | continue; | |
150 | ||
151 | if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) { | |
152 | hPrimary->Fill(particle->Eta()); | |
153 | ||
154 | ||
155 | TH1F* hPrimVtxBin = (TH1F*)fOutputList->FindObject(Form("primmult_vtxbin%d",vertexBin)); | |
156 | hPrimVtxBin->Fill(particle->Eta()); | |
157 | if(firstTrack) { | |
158 | fNMCevents.Fill(vertexBin); | |
159 | firstTrack = kFALSE; | |
160 | } | |
161 | } | |
162 | } | |
163 | */ | |
164 | } | |
165 | //_____________________________________________________________________ | |
166 | // | |
167 | // | |
168 | // EOF |