1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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.
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.
32 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
33 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
34 AliXRDPROOFtoolkit tool;
36 // -- Make chain of files
37 TChain * chain = tool.MakeChain("KrClusters.txt","Kr","",1000,0);
39 // -- Create the analysis manager
40 AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
42 // -- Calibration component
43 AliTPCCalibKr *calibObj = new AliTPCCalibKr;
46 AliTPCCalibKrTask *task = new AliTPCCalibKrTask;
47 task->SetInputChain(chain);
48 task->SetTPCCalibKr(calibObj);
52 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
53 mgr->ConnectInput(task, 0, cInput);
56 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"outHistFile.root");
57 mgr->ConnectOutput(task, 0, cOutput);
62 mgr->StartAnalysis("local", chain);
74 #include <TDirectory.h>
77 #include "AliRawReader.h"
78 #include "AliRawReaderRoot.h"
79 #include "AliRawReaderDate.h"
80 #include "AliTPCRawStream.h"
81 #include "AliTPCCalROC.h"
82 #include "AliTPCCalPad.h"
83 #include "AliTPCROC.h"
84 #include "AliMathBase.h"
85 #include "TTreeStream.h"
86 #include "AliTPCRawStreamFast.h"
92 #include "AliTPCCalibKr.h"
93 #include "AliTPCCalibKrTask.h"
95 Int_t AliTPCCalibKrTask::evtNumber = 0;
97 ClassImp(AliTPCCalibKrTask)
99 AliTPCCalibKrTask::AliTPCCalibKrTask(const char *name) :
100 AliAnalysisTask(name,""),
107 // default constructor
110 DefineInput(0, TChain::Class());
111 DefineOutput(0, TList::Class());
114 //_____________________________________________________________________
115 AliTPCCalibKrTask::~AliTPCCalibKrTask()
120 if(fClustKr) delete fClustKr; fClustKr = 0;
123 //_____________________________________________________________________
124 void AliTPCCalibKrTask::ConnectInputData(Option_t *)
126 // Connect input data
129 fTree = dynamic_cast<TTree*> (GetInputData(0));
132 Printf("ERROR: Could not read chain from input");
135 fTree->SetBranchStatus("*",1);
138 // set branch address
139 if(!fTree->GetBranch("Cl.")) {
140 Printf("ERROR: Could not get Cl. branch from input");
142 fTree->GetBranch("Cl.")->SetAddress(&fClustKr);
146 //_____________________________________________________________________
147 void AliTPCCalibKrTask::CreateOutputObjects()
149 // create object to the output
153 if(fTPCCalibKr) fOutput->Add(fTPCCalibKr);
154 //fTPCCalibKr = new AliTPCCalibKr;
155 //if(fTPCCalibKr) fOutput->Add(fTPCCalibKr);
157 Printf("WARNING: AliTPCCalibKr is not added to the output");
160 //_____________________________________________________________________
161 Bool_t AliTPCCalibKrTask::ReadEntry(Int_t evt)
164 Long64_t centry = fTree->LoadTree(evt);
165 if(centry < 0) return kFALSE;
167 if(!fTree->GetBranch("Cl."))
169 Printf("ERROR: Could not get Cl. branch from input");
172 fTree->GetBranch("Cl.")->SetAddress(&fClustKr);
175 fTree->GetEntry(evt);
180 //_____________________________________________________________________
181 void AliTPCCalibKrTask::Exec(Option_t *)
184 // Called for each event
187 if(fClustKr) delete fClustKr; fClustKr=0;
188 Bool_t status = ReadEntry(evtNumber);
191 // Process output objects
192 if(fClustKr) fTPCCalibKr->Process(fClustKr);
195 if( !( evtNumber % 10000) ) {
196 cout << evtNumber << endl; }
201 PostData(0, fOutput);
204 //_____________________________________________________________________
205 void AliTPCCalibKrTask::Terminate(Option_t *)
207 // Called once at the end of the event loop
208 cout << "Terminate " << endl;
210 fOutput = dynamic_cast<TList*> (GetOutputData(0));
212 Printf("ERROR: fOutput not available");
216 fTPCCalibKr = dynamic_cast<AliTPCCalibKr*> (fOutput->FindObject("AliTPCCalibKr"));
218 Printf("WARNING: AliTPCCalibKr not available");
222 for(int i=0; i<72; ++i) {
223 if( fTPCCalibKr->IsCSide(i) == kTRUE )
224 printf("C side chamber: %d, 3D histo entries: %10.f \n",i,fTPCCalibKr->GetHistoKr(i)->GetEntries());
226 if( fTPCCalibKr->IsCSide(i) == kFALSE )
227 printf("A side chamber: %d, 3D histo entries: %10.f \n",i,fTPCCalibKr->GetHistoKr(i)->GetEntries());