]>
Commit | Line | Data |
---|---|---|
97ce6a20 | 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 | **************************************************************************/ | |
15 | ||
16 | //---------------------------------------------------------------------------- | |
17 | // The AliTPCCalibKrTask class description (TPC Kr calibration). | |
18 | // The AliTPCCalibKrTask loops over tree of TPC Kr clusters and fills AliTPCCalibKr | |
19 | // calibration component. | |
20 | // | |
21 | // As the input it requires the tree with reconstructed Kr clusters (AliTPCclusterKr objects). | |
22 | // The AliTPCCalibKr output calibration component contains an array of TH3F histograms which can be stored | |
23 | // in the ouptut file. | |
24 | // | |
f3b61a78 | 25 | // Author: Jacek Otwinowski (J.Otwinowski@gsi.de) |
97ce6a20 | 26 | |
27 | /* | |
28 | ||
29 | // Usage example: | |
30 | // | |
31 | ||
32 | // -- Load toolkit | |
33 | gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros"); | |
34 | gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+"); | |
35 | AliXRDPROOFtoolkit tool; | |
36 | ||
37 | // -- Make chain of files | |
38 | TChain * chain = tool.MakeChain("KrClusters.txt","Kr","",1000,0); | |
39 | ||
40 | // -- Create the analysis manager | |
41 | AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis"); | |
42 | ||
43 | // -- Calibration component | |
44 | AliTPCCalibKr *calibObj = new AliTPCCalibKr; | |
9aaef63e | 45 | calibObj->SetIrocHistogram(200,100,6000); |
46 | calibObj->SetOrocHistogram(200,100,5500); | |
47 | calibObj->Init(); | |
97ce6a20 | 48 | |
49 | // -- Add task | |
50 | AliTPCCalibKrTask *task = new AliTPCCalibKrTask; | |
51 | task->SetInputChain(chain); | |
52 | task->SetTPCCalibKr(calibObj); | |
53 | mgr->AddTask(task); | |
54 | ||
55 | // -- Attach input | |
56 | cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer); | |
57 | mgr->ConnectInput(task, 0, cInput); | |
58 | ||
59 | // -- Attach output | |
60 | cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"outHistFile.root"); | |
61 | mgr->ConnectOutput(task, 0, cOutput); | |
62 | ||
63 | // -- Run analysis | |
64 | mgr->InitAnalysis(); | |
65 | mgr->PrintStatus(); | |
66 | mgr->StartAnalysis("local", chain); | |
67 | ||
68 | */ | |
69 | ||
70 | //Root includes | |
71 | #include <TH1F.h> | |
72 | #include <TH2F.h> | |
73 | #include <TH3F.h> | |
74 | #include <TString.h> | |
75 | #include <TMath.h> | |
76 | #include <TF1.h> | |
77 | #include <TRandom.h> | |
78 | #include <TDirectory.h> | |
79 | #include <TFile.h> | |
80 | //AliRoot includes | |
81 | #include "AliRawReader.h" | |
82 | #include "AliRawReaderRoot.h" | |
83 | #include "AliRawReaderDate.h" | |
84 | #include "AliTPCRawStream.h" | |
85 | #include "AliTPCCalROC.h" | |
86 | #include "AliTPCCalPad.h" | |
87 | #include "AliTPCROC.h" | |
88 | #include "AliMathBase.h" | |
89 | #include "TTreeStream.h" | |
90 | #include "AliTPCRawStreamFast.h" | |
91 | ||
92 | //date | |
93 | #include "event.h" | |
94 | ||
95 | //header file | |
96 | #include "AliTPCCalibKr.h" | |
97 | #include "AliTPCCalibKrTask.h" | |
98 | ||
ff0df25d | 99 | Int_t AliTPCCalibKrTask::fEvtNumber = 0; |
97ce6a20 | 100 | |
101 | ClassImp(AliTPCCalibKrTask) | |
102 | ||
103 | AliTPCCalibKrTask::AliTPCCalibKrTask(const char *name) : | |
104 | AliAnalysisTask(name,""), | |
105 | fClustKr(0), | |
106 | fTPCCalibKr(0), | |
107 | fTree(0), | |
108 | fOutput(0) | |
109 | { | |
110 | // | |
111 | // default constructor | |
112 | // | |
113 | ||
114 | DefineInput(0, TChain::Class()); | |
115 | DefineOutput(0, TList::Class()); | |
116 | } | |
117 | ||
118 | //_____________________________________________________________________ | |
119 | AliTPCCalibKrTask::~AliTPCCalibKrTask() | |
120 | { | |
121 | // | |
122 | // destructor | |
123 | // | |
f3b61a78 | 124 | if(fOutput) fOutput->Delete(); |
125 | delete fOutput; fOutput = 0; | |
97ce6a20 | 126 | } |
127 | ||
128 | //_____________________________________________________________________ | |
129 | void AliTPCCalibKrTask::ConnectInputData(Option_t *) | |
130 | { | |
131 | // Connect input data | |
132 | // Called once | |
133 | ||
134 | fTree = dynamic_cast<TTree*> (GetInputData(0)); | |
135 | ||
136 | if(!fTree) { | |
137 | Printf("ERROR: Could not read chain from input"); | |
138 | } | |
139 | else { | |
140 | fTree->SetBranchStatus("*",1); | |
f3b61a78 | 141 | fTree->SetBranchStatus("Cl.fCluster",0); |
97ce6a20 | 142 | } |
143 | ||
144 | // set branch address | |
145 | if(!fTree->GetBranch("Cl.")) { | |
146 | Printf("ERROR: Could not get Cl. branch from input"); | |
147 | } else { | |
148 | fTree->GetBranch("Cl.")->SetAddress(&fClustKr); | |
149 | } | |
150 | } | |
151 | ||
152 | //_____________________________________________________________________ | |
153 | void AliTPCCalibKrTask::CreateOutputObjects() | |
154 | { | |
155 | // create object to the output | |
156 | fOutput = new TList; | |
f3b61a78 | 157 | fOutput->SetOwner(); // is owner of the fTPCCalibKr objects |
97ce6a20 | 158 | |
159 | if(fTPCCalibKr) fOutput->Add(fTPCCalibKr); | |
160 | //fTPCCalibKr = new AliTPCCalibKr; | |
161 | //if(fTPCCalibKr) fOutput->Add(fTPCCalibKr); | |
162 | else | |
163 | Printf("WARNING: AliTPCCalibKr is not added to the output"); | |
164 | } | |
165 | ||
166 | //_____________________________________________________________________ | |
167 | Bool_t AliTPCCalibKrTask::ReadEntry(Int_t evt) | |
168 | { | |
169 | // read entry | |
170 | Long64_t centry = fTree->LoadTree(evt); | |
171 | if(centry < 0) return kFALSE; | |
172 | ||
173 | if(!fTree->GetBranch("Cl.")) | |
174 | { | |
175 | Printf("ERROR: Could not get Cl. branch from input"); | |
176 | return kFALSE; | |
177 | } else { | |
178 | fTree->GetBranch("Cl.")->SetAddress(&fClustKr); | |
179 | } | |
180 | ||
181 | fTree->GetEntry(evt); | |
182 | ||
183 | return kTRUE; | |
184 | } | |
185 | ||
186 | //_____________________________________________________________________ | |
187 | void AliTPCCalibKrTask::Exec(Option_t *) | |
188 | { | |
189 | // Main loop | |
190 | // Called for each event | |
191 | ||
192 | // read entry | |
193 | if(fClustKr) delete fClustKr; fClustKr=0; | |
ff0df25d | 194 | Bool_t status = ReadEntry(fEvtNumber); |
97ce6a20 | 195 | if(status==kTRUE) |
196 | { | |
197 | // Process output objects | |
198 | if(fClustKr) fTPCCalibKr->Process(fClustKr); | |
199 | } | |
200 | ||
ff0df25d | 201 | if( !( fEvtNumber % 100000) ) { |
202 | cout << fEvtNumber << endl; } | |
97ce6a20 | 203 | |
ff0df25d | 204 | fEvtNumber++; |
97ce6a20 | 205 | |
206 | // Post output data. | |
207 | PostData(0, fOutput); | |
208 | } | |
209 | ||
210 | //_____________________________________________________________________ | |
211 | void AliTPCCalibKrTask::Terminate(Option_t *) | |
212 | { | |
213 | // Called once at the end of the event loop | |
214 | cout << "Terminate " << endl; | |
215 | ||
216 | fOutput = dynamic_cast<TList*> (GetOutputData(0)); | |
217 | if (!fOutput) { | |
218 | Printf("ERROR: fOutput not available"); | |
219 | return; | |
220 | } | |
221 | ||
222 | fTPCCalibKr = dynamic_cast<AliTPCCalibKr*> (fOutput->FindObject("AliTPCCalibKr")); | |
223 | if (!fTPCCalibKr) { | |
224 | Printf("WARNING: AliTPCCalibKr not available"); | |
225 | return; | |
226 | } | |
227 | ||
228 | for(int i=0; i<72; ++i) { | |
229 | if( fTPCCalibKr->IsCSide(i) == kTRUE ) | |
230 | printf("C side chamber: %d, 3D histo entries: %10.f \n",i,fTPCCalibKr->GetHistoKr(i)->GetEntries()); | |
231 | ||
232 | if( fTPCCalibKr->IsCSide(i) == kFALSE ) | |
233 | printf("A side chamber: %d, 3D histo entries: %10.f \n",i,fTPCCalibKr->GetHistoKr(i)->GetEntries()); | |
234 | } | |
235 | } |