1. Making TPC calibration task working on PROOF
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibBase.cxx
CommitLineData
3ab35fc5 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///////////////////////////////////////////////////////////////////////////////
18// //
19// Base class for the calibration components using
20// as input TPCseeds and ESDs
21// Event loop outside of the component
22//
23//
ae28e92e 24// Base functionality to be implemeneted by component
25/*
26 //In some cases only one of this function to be implemented
27 virtual void Process(AliESDEvent *event)
28 virtual void Process(AliTPCseed *track)
29 //
30 virtual Long64_t Merge(TCollection *li);
31 virtual void Analyze()
32 void Terminate();
33*/
34// Functionality provided by base class for Algorith debuging:
35// TTreeSRedirector * cstream = GetDebugStreamer() - get debug streamer which can be use for numerical debugging
36//
37
38
39
40// marian.ivanov@cern.ch
3ab35fc5 41//
42#include "AliTPCcalibBase.h"
f7f33dec 43#include "TSystem.h"
44#include "TFile.h"
ae28e92e 45#include "TTreeStream.h"
f7f33dec 46#include "AliLog.h"
47
3ab35fc5 48
49ClassImp(AliTPCcalibBase)
50
ae28e92e 51AliTPCcalibBase::AliTPCcalibBase():
52 TNamed(),
53 fDebugStreamer(0),
54 fStreamLevel(0),
55 fDebugLevel(0)
3ab35fc5 56{
57 //
58 // Constructor
59 //
60}
61
ae28e92e 62AliTPCcalibBase::AliTPCcalibBase(const AliTPCcalibBase&calib):
63 TNamed(calib),
64 fDebugStreamer(0),
65 fStreamLevel(calib.fStreamLevel),
66 fDebugLevel(calib.fDebugLevel)
67{
68 //
69 // copy constructor
70 //
71}
72
73AliTPCcalibBase &AliTPCcalibBase::operator=(const AliTPCcalibBase&calib){
74 //
75 //
76 //
77 ((TNamed *)this)->operator=(calib);
78 fDebugStreamer=0;
79 fStreamLevel=calib.fStreamLevel;
80 fDebugLevel=calib.fDebugLevel;
81}
82
83
3ab35fc5 84AliTPCcalibBase::~AliTPCcalibBase() {
85 //
86 // destructor
87 //
f7f33dec 88 if (fDebugLevel>0) printf("AliTPCcalibBase::~AliTPCcalibBase\n");
ae28e92e 89 if (fDebugStreamer) delete fDebugStreamer;
90 fDebugStreamer=0;
91}
92
93void AliTPCcalibBase::Terminate(){
94 //
95 //
96 //
f7f33dec 97 if (fDebugLevel>0) printf("AliTPCcalibBase::Terminate\n");
ae28e92e 98 if (fDebugStreamer) delete fDebugStreamer;
99 fDebugStreamer = 0;
100 return;
101}
102
103TTreeSRedirector *AliTPCcalibBase::GetDebugStreamer(){
104 //
105 // Get Debug streamer
106 // In case debug streamer not yet initialized and StreamLevel>0 create new one
107 //
108 if (fStreamLevel==0) return 0;
109 if (fDebugStreamer) return fDebugStreamer;
110 TString dsName;
111 dsName=GetName();
112 dsName+="Debug.root";
113 dsName.ReplaceAll(" ","");
114 fDebugStreamer = new TTreeSRedirector(dsName.Data());
115 return fDebugStreamer;
3ab35fc5 116}
f7f33dec 117
118
119void AliTPCcalibBase::RegisterDebugOutput(const char *path){
120 //
121 // store - copy debug output to the destination position
122 // currently ONLY for local copy
123 if (fDebugLevel>0) printf("AliTPCcalibBase::RegisterDebugOutput(%s)\n",path);
124 if (fStreamLevel==0) return;
125 TString dsName;
126 dsName=GetName();
127 dsName+="Debug.root";
128 dsName.ReplaceAll(" ","");
129 TString dsName2=path;
130 gSystem->MakeDirectory(dsName2.Data());
131 dsName2+=gSystem->HostName();
132 gSystem->MakeDirectory(dsName2.Data());
133 dsName2+="/";
134 dsName2+=dsName;
135 AliInfo(Form("copy %s\t%s\n",dsName.Data(),dsName2.Data()));
136 printf("copy %s\t%s\n",dsName.Data(),dsName2.Data());
137 TFile::Cp(dsName.Data(),dsName2.Data());
138}