]>
Commit | Line | Data |
---|---|---|
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" |
47328338 | 47 | #include "TTimeStamp.h" |
f7f33dec | 48 | |
3ab35fc5 | 49 | |
50 | ClassImp(AliTPCcalibBase) | |
51 | ||
ae28e92e | 52 | AliTPCcalibBase::AliTPCcalibBase(): |
53 | TNamed(), | |
54 | fDebugStreamer(0), | |
55 | fStreamLevel(0), | |
56 | fDebugLevel(0) | |
3ab35fc5 | 57 | { |
58 | // | |
59 | // Constructor | |
60 | // | |
61 | } | |
62 | ||
ae28e92e | 63 | AliTPCcalibBase::AliTPCcalibBase(const AliTPCcalibBase&calib): |
64 | TNamed(calib), | |
65 | fDebugStreamer(0), | |
66 | fStreamLevel(calib.fStreamLevel), | |
67 | fDebugLevel(calib.fDebugLevel) | |
68 | { | |
69 | // | |
70 | // copy constructor | |
71 | // | |
72 | } | |
73 | ||
74 | AliTPCcalibBase &AliTPCcalibBase::operator=(const AliTPCcalibBase&calib){ | |
75 | // | |
76 | // | |
77 | // | |
78 | ((TNamed *)this)->operator=(calib); | |
79 | fDebugStreamer=0; | |
80 | fStreamLevel=calib.fStreamLevel; | |
81 | fDebugLevel=calib.fDebugLevel; | |
82 | } | |
83 | ||
84 | ||
3ab35fc5 | 85 | AliTPCcalibBase::~AliTPCcalibBase() { |
86 | // | |
87 | // destructor | |
88 | // | |
f7f33dec | 89 | if (fDebugLevel>0) printf("AliTPCcalibBase::~AliTPCcalibBase\n"); |
ae28e92e | 90 | if (fDebugStreamer) delete fDebugStreamer; |
91 | fDebugStreamer=0; | |
92 | } | |
93 | ||
94 | void AliTPCcalibBase::Terminate(){ | |
95 | // | |
96 | // | |
97 | // | |
f7f33dec | 98 | if (fDebugLevel>0) printf("AliTPCcalibBase::Terminate\n"); |
ae28e92e | 99 | if (fDebugStreamer) delete fDebugStreamer; |
100 | fDebugStreamer = 0; | |
101 | return; | |
102 | } | |
103 | ||
104 | TTreeSRedirector *AliTPCcalibBase::GetDebugStreamer(){ | |
105 | // | |
106 | // Get Debug streamer | |
107 | // In case debug streamer not yet initialized and StreamLevel>0 create new one | |
108 | // | |
109 | if (fStreamLevel==0) return 0; | |
110 | if (fDebugStreamer) return fDebugStreamer; | |
111 | TString dsName; | |
112 | dsName=GetName(); | |
113 | dsName+="Debug.root"; | |
114 | dsName.ReplaceAll(" ",""); | |
115 | fDebugStreamer = new TTreeSRedirector(dsName.Data()); | |
116 | return fDebugStreamer; | |
3ab35fc5 | 117 | } |
f7f33dec | 118 | |
119 | ||
120 | void AliTPCcalibBase::RegisterDebugOutput(const char *path){ | |
121 | // | |
122 | // store - copy debug output to the destination position | |
123 | // currently ONLY for local copy | |
124 | if (fDebugLevel>0) printf("AliTPCcalibBase::RegisterDebugOutput(%s)\n",path); | |
125 | if (fStreamLevel==0) return; | |
126 | TString dsName; | |
127 | dsName=GetName(); | |
128 | dsName+="Debug.root"; | |
129 | dsName.ReplaceAll(" ",""); | |
130 | TString dsName2=path; | |
131 | gSystem->MakeDirectory(dsName2.Data()); | |
132 | dsName2+=gSystem->HostName(); | |
133 | gSystem->MakeDirectory(dsName2.Data()); | |
134 | dsName2+="/"; | |
47328338 | 135 | TTimeStamp s; |
136 | dsName2+=Int_t(s.GetNanoSec()); | |
137 | dsName2+="/"; | |
138 | gSystem->MakeDirectory(dsName2.Data()); | |
f7f33dec | 139 | dsName2+=dsName; |
140 | AliInfo(Form("copy %s\t%s\n",dsName.Data(),dsName2.Data())); | |
141 | printf("copy %s\t%s\n",dsName.Data(),dsName2.Data()); | |
142 | TFile::Cp(dsName.Data(),dsName2.Data()); | |
143 | } |