]>
Commit | Line | Data |
---|---|---|
bdcfac30 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
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 | **************************************************************************/ | |
4b707925 | 15 | |
16 | // root | |
bdcfac30 | 17 | #include <TROOT.h> |
18 | #include <TSystem.h> | |
19 | #include <TInterpreter.h> | |
20 | #include <TChain.h> | |
21 | #include <TFile.h> | |
22 | #include <Riostream.h> | |
23 | ||
4b707925 | 24 | // analysis |
bdcfac30 | 25 | #include "AliAnalysisTaskGamma.h" |
26 | #include "AliAnalysisManager.h" | |
2021085e | 27 | #include "AliESDInputHandler.h" |
bdcfac30 | 28 | #include "AliMCEventHandler.h" |
4b707925 | 29 | #include "AliMCEvent.h" |
bdcfac30 | 30 | #include "AliAnaGamma.h" |
31 | #include "AliGammaReader.h" | |
32 | #include "AliESDEvent.h" | |
4b707925 | 33 | #include "AliAODEvent.h" |
34 | #include "AliAODHandler.h" | |
bdcfac30 | 35 | #include "AliStack.h" |
36 | #include "AliLog.h" | |
37 | ||
38 | ClassImp(AliAnalysisTaskGamma) | |
39 | ||
40 | //////////////////////////////////////////////////////////////////////// | |
41 | ||
17a1db27 | 42 | AliAnalysisTaskGamma::AliAnalysisTaskGamma(): |
43 | AliAnalysisTaskSE(), | |
bdcfac30 | 44 | fAna(0x0), |
3bb2c538 | 45 | fOutputContainer(0x0), |
46 | fConfigName(0) | |
bdcfac30 | 47 | { |
48 | // Default constructor | |
49 | } | |
50 | ||
51 | //_____________________________________________________ | |
52 | AliAnalysisTaskGamma::AliAnalysisTaskGamma(const char* name): | |
17a1db27 | 53 | AliAnalysisTaskSE(name), |
bdcfac30 | 54 | fAna(0x0), |
3bb2c538 | 55 | fOutputContainer(0x0), |
56 | fConfigName("ConfigGammaAnalysis") | |
bdcfac30 | 57 | { |
58 | // Default constructor | |
17a1db27 | 59 | |
4b707925 | 60 | DefineOutput(1, TList::Class()); |
bdcfac30 | 61 | |
62 | } | |
63 | ||
64 | //_____________________________________________________ | |
65 | AliAnalysisTaskGamma::~AliAnalysisTaskGamma() | |
66 | { | |
bdcfac30 | 67 | // Remove all pointers |
4b707925 | 68 | |
69 | if(fOutputContainer){ | |
70 | fOutputContainer->Clear() ; | |
71 | delete fOutputContainer ; | |
72 | } | |
bdcfac30 | 73 | |
bdcfac30 | 74 | } |
75 | ||
76 | //_____________________________________________________ | |
17a1db27 | 77 | void AliAnalysisTaskGamma::UserCreateOutputObjects() |
bdcfac30 | 78 | { |
79 | // Create the output container | |
bdcfac30 | 80 | |
4b707925 | 81 | //AODs |
17a1db27 | 82 | |
83 | fAna->ConnectAOD(AODEvent()); | |
bdcfac30 | 84 | |
4b707925 | 85 | //Histograms container |
86 | OpenFile(1); | |
87 | fOutputContainer = fAna->GetOutputContainer(); | |
88 | ||
bdcfac30 | 89 | } |
90 | ||
91 | //_____________________________________________________ | |
92 | void AliAnalysisTaskGamma::Init() | |
93 | { | |
94 | // Initialization | |
95 | AliDebug(1,"Begin"); | |
4b707925 | 96 | |
bdcfac30 | 97 | // Call configuration file |
3bb2c538 | 98 | |
99 | if(fConfigName == ""){ | |
100 | fConfigName="ConfigGammaAnalysis"; | |
101 | } | |
102 | ||
103 | AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data())); | |
104 | gROOT->LoadMacro(fConfigName+".C"); | |
bdcfac30 | 105 | fAna = (AliAnaGamma*) gInterpreter->ProcessLine("ConfigGammaAnalysis()"); |
106 | ||
107 | if(!fAna) | |
108 | AliFatal("Analysis pointer not initialized, abort analysis!"); | |
109 | ||
110 | // Initialise Gamma Analysis | |
111 | fAna->Init(); | |
112 | ||
bdcfac30 | 113 | AliDebug(1,"End"); |
114 | ||
115 | } | |
116 | ||
bdcfac30 | 117 | |
118 | //_____________________________________________________ | |
17a1db27 | 119 | void AliAnalysisTaskGamma::UserExec(Option_t */*option*/) |
bdcfac30 | 120 | { |
121 | // Execute analysis for current event | |
122 | // | |
123 | ||
124 | //Get the type of data, check if type is correct | |
125 | Int_t datatype = fAna->GetReader()->GetDataType(); | |
126 | if(datatype != AliGammaReader::kData && | |
127 | datatype != AliGammaReader::kMC && | |
128 | datatype != AliGammaReader::kMCData){ | |
129 | AliFatal("Wrong type of data"); | |
130 | return ; | |
131 | } | |
bdcfac30 | 132 | |
17a1db27 | 133 | fAna->SetData(InputEvent()); |
bdcfac30 | 134 | |
135 | //In case of montecarlo analysis, pass the stack also. | |
17a1db27 | 136 | if((datatype == AliGammaReader::kMC || datatype == AliGammaReader::kMCData ) && MCEvent()) |
137 | fAna -> SetKine(MCEvent()->Stack()); | |
bdcfac30 | 138 | |
139 | //Process event | |
17a1db27 | 140 | fAna->ProcessEvent(); |
bdcfac30 | 141 | |
4b707925 | 142 | PostData(1, fOutputContainer); |
bdcfac30 | 143 | |
144 | } | |
145 | ||
146 | //_____________________________________________________ | |
147 | void AliAnalysisTaskGamma::Terminate(Option_t */*option*/) | |
148 | { | |
149 | // Terminate analysis | |
150 | // | |
151 | AliDebug(1,"Do nothing in Terminate"); | |
17a1db27 | 152 | //fAna->Terminate(); |
bdcfac30 | 153 | } |
154 |