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.
25 // Author: Jacek Otwinowski (J.Otwinowski@gsi.de)
33 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
34 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
35 AliXRDPROOFtoolkit tool;
37 // -- Make chain of files
38 TChain * chain = tool.MakeChain("KrClusters.txt","Kr","",1000,0);
40 // -- Create the analysis manager
41 AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
43 // -- Calibration component
44 AliTPCCalibKr *calibObj = new AliTPCCalibKr;
45 calibObj->SetIrocHistogram(200,100,6000);
46 calibObj->SetOrocHistogram(200,100,5500);
50 AliTPCCalibKrTask *task = new AliTPCCalibKrTask;
51 task->SetInputChain(chain);
52 task->SetTPCCalibKr(calibObj);
56 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
57 mgr->ConnectInput(task, 0, cInput);
60 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"outHistFile.root");
61 mgr->ConnectOutput(task, 0, cOutput);
66 mgr->StartAnalysis("local", chain);
82 #include <TDirectory.h>
85 #include "AliRawReader.h"
86 #include "AliRawReaderRoot.h"
87 #include "AliRawReaderDate.h"
88 #include "AliTPCRawStream.h"
89 #include "AliTPCCalROC.h"
90 #include "AliTPCCalPad.h"
91 #include "AliTPCROC.h"
92 #include "AliMathBase.h"
93 #include "TTreeStream.h"
99 #include "AliTPCCalibKr.h"
100 #include "AliTPCCalibKrTask.h"
102 Int_t AliTPCCalibKrTask::fEvtNumber = 0;
104 ClassImp(AliTPCCalibKrTask)
106 AliTPCCalibKrTask::AliTPCCalibKrTask(const char *name) :
107 AliAnalysisTask(name,""),
114 // default constructor
117 DefineInput(0, TChain::Class());
118 DefineOutput(0, TList::Class());
121 //_____________________________________________________________________
122 AliTPCCalibKrTask::~AliTPCCalibKrTask()
127 if(fOutput) fOutput->Delete();
128 delete fOutput; fOutput = 0;
131 //_____________________________________________________________________
132 void AliTPCCalibKrTask::ConnectInputData(Option_t *)
134 // Connect input data
137 fTree = dynamic_cast<TTree*> (GetInputData(0));
140 Printf("ERROR: Could not read chain from input");
144 fTree->SetBranchStatus("*",1);
145 fTree->SetBranchStatus("Cl.fCluster",0);
148 // set branch address
149 if(!fTree->GetBranch("Cl.")) {
150 Printf("ERROR: Could not get Cl. branch from input");
152 fTree->GetBranch("Cl.")->SetAddress(&fClustKr);
156 //_____________________________________________________________________
157 void AliTPCCalibKrTask::CreateOutputObjects()
159 // create object to the output
161 fOutput->SetOwner(); // is owner of the fTPCCalibKr objects
163 if(fTPCCalibKr) fOutput->Add(fTPCCalibKr);
164 //fTPCCalibKr = new AliTPCCalibKr;
165 //if(fTPCCalibKr) fOutput->Add(fTPCCalibKr);
167 Printf("WARNING: AliTPCCalibKr is not added to the output");
170 //_____________________________________________________________________
171 Bool_t AliTPCCalibKrTask::ReadEntry(Int_t evt)
174 Long64_t centry = fTree->LoadTree(evt);
175 if(centry < 0) return kFALSE;
177 if(!fTree->GetBranch("Cl."))
179 Printf("ERROR: Could not get Cl. branch from input");
182 fTree->GetBranch("Cl.")->SetAddress(&fClustKr);
185 fTree->GetEntry(evt);
190 //_____________________________________________________________________
191 void AliTPCCalibKrTask::Exec(Option_t *)
194 // Called for each event
197 if(fClustKr) delete fClustKr; fClustKr=0;
198 Bool_t status = ReadEntry(fEvtNumber);
201 // Process output objects
202 if(fClustKr) fTPCCalibKr->Process(fClustKr);
205 if( !( fEvtNumber % 100000) ) {
206 cout << fEvtNumber << endl; }
211 PostData(0, fOutput);
214 //_____________________________________________________________________
215 void AliTPCCalibKrTask::Terminate(Option_t *)
217 // Called once at the end of the event loop
218 cout << "Terminate " << endl;
220 fOutput = dynamic_cast<TList*> (GetOutputData(0));
222 Printf("ERROR: fOutput not available");
226 fTPCCalibKr = dynamic_cast<AliTPCCalibKr*> (fOutput->FindObject("AliTPCCalibKr"));
228 Printf("WARNING: AliTPCCalibKr not available");
232 for(int i=0; i<72; ++i) {
233 if( fTPCCalibKr->IsCSide(i) == kTRUE )
234 printf("C side chamber: %d, 3D histo entries: %10.f \n",i,fTPCCalibKr->GetHistoKr(i)->GetEntries());
236 if( fTPCCalibKr->IsCSide(i) == kFALSE )
237 printf("A side chamber: %d, 3D histo entries: %10.f \n",i,fTPCCalibKr->GetHistoKr(i)->GetEntries());