]>
Commit | Line | Data |
---|---|---|
f7336fa3 | 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 | $Log$ | |
8230f242 | 18 | Revision 1.2 2000/05/08 16:17:27 cblume |
19 | Merge TRD-develop | |
20 | ||
6f1e466d | 21 | Revision 1.1.4.1 2000/05/08 15:08:03 cblume |
22 | Remove the class AliTRDcluster | |
23 | ||
24 | Revision 1.1 2000/02/28 18:57:58 cblume | |
25 | Add new TRD classes | |
26 | ||
f7336fa3 | 27 | */ |
28 | ||
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | // // | |
31 | // TRD cluster finder base class // | |
32 | // // | |
33 | /////////////////////////////////////////////////////////////////////////////// | |
34 | ||
35 | #include "AliRun.h" | |
36 | ||
37 | #include "AliTRD.h" | |
38 | #include "AliTRDclusterizer.h" | |
39 | ||
40 | ClassImp(AliTRDclusterizer) | |
41 | ||
42 | //_____________________________________________________________________________ | |
43 | AliTRDclusterizer::AliTRDclusterizer():TNamed() | |
44 | { | |
45 | // | |
46 | // AliTRDclusterizer default constructor | |
47 | // | |
48 | ||
49 | fInputFile = NULL; | |
50 | fEvent = 0; | |
51 | ||
52 | } | |
53 | ||
54 | //_____________________________________________________________________________ | |
55 | AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title) | |
56 | :TNamed(name, title) | |
57 | { | |
58 | // | |
59 | // AliTRDclusterizer default constructor | |
60 | // | |
61 | ||
62 | fInputFile = NULL; | |
63 | fEvent = 0; | |
64 | ||
65 | Init(); | |
66 | ||
67 | } | |
68 | ||
8230f242 | 69 | //_____________________________________________________________________________ |
70 | AliTRDclusterizer::AliTRDclusterizer(AliTRDclusterizer &c) | |
71 | { | |
72 | // | |
73 | // AliTRDclusterizer copy constructor | |
74 | // | |
75 | ||
76 | c.Copy(*this); | |
77 | ||
78 | } | |
79 | ||
f7336fa3 | 80 | //_____________________________________________________________________________ |
81 | AliTRDclusterizer::~AliTRDclusterizer() | |
82 | { | |
8230f242 | 83 | // |
84 | // AliTRDclusterizer destructor | |
85 | // | |
f7336fa3 | 86 | |
87 | if (fInputFile) { | |
88 | fInputFile->Close(); | |
89 | delete fInputFile; | |
90 | } | |
91 | ||
92 | } | |
93 | ||
8230f242 | 94 | //_____________________________________________________________________________ |
95 | void AliTRDclusterizer::Copy(AliTRDclusterizer &c) | |
96 | { | |
97 | // | |
98 | // Copy function | |
99 | // | |
100 | ||
101 | c.fInputFile = NULL; | |
102 | c.fEvent = 0; | |
103 | ||
104 | } | |
105 | ||
f7336fa3 | 106 | //_____________________________________________________________________________ |
107 | void AliTRDclusterizer::Init() | |
108 | { | |
109 | // | |
110 | // Initializes the cluster finder | |
111 | // | |
112 | ||
113 | } | |
114 | ||
115 | //_____________________________________________________________________________ | |
116 | Bool_t AliTRDclusterizer::Open(const Char_t *name, Int_t nEvent) | |
117 | { | |
118 | // | |
119 | // Opens a ROOT-file with TRD-hits and reads in the digits-tree | |
120 | // | |
121 | ||
122 | // Connect the AliRoot file containing Geometry, Kine, and Hits | |
123 | fInputFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name); | |
124 | if (!fInputFile) { | |
125 | printf("AliTRDclusterizer::Open -- "); | |
126 | printf("Open the ALIROOT-file %s.\n",name); | |
127 | fInputFile = new TFile(name,"UPDATE"); | |
128 | } | |
129 | else { | |
130 | printf("AliTRDclusterizer::Open -- "); | |
131 | printf("%s is already open.\n",name); | |
132 | } | |
133 | ||
134 | // Get AliRun object from file or create it if not on file | |
135 | //if (!gAlice) { | |
136 | gAlice = (AliRun*) fInputFile->Get("gAlice"); | |
137 | if (gAlice) { | |
138 | printf("AliTRDclusterizer::Open -- "); | |
139 | printf("AliRun object found on file.\n"); | |
140 | } | |
141 | else { | |
142 | printf("AliTRDclusterizer::Open -- "); | |
143 | printf("Could not find AliRun object.\n"); | |
144 | return kFALSE; | |
145 | } | |
146 | //} | |
147 | ||
148 | fEvent = nEvent; | |
149 | ||
150 | // Import the Trees for the event nEvent in the file | |
151 | Int_t nparticles = gAlice->GetEvent(fEvent); | |
152 | if (nparticles <= 0) { | |
153 | printf("AliTRDclusterizer::Open -- "); | |
154 | printf("No entries in the trees for event %d.\n",fEvent); | |
155 | return kFALSE; | |
156 | } | |
157 | ||
158 | return kTRUE; | |
159 | ||
160 | } | |
161 | ||
162 | //_____________________________________________________________________________ | |
163 | Bool_t AliTRDclusterizer::WriteCluster() | |
164 | { | |
165 | // | |
166 | // Writes out the TRD-cluster | |
167 | // | |
168 | ||
169 | // Write the new tree into the input file (use overwrite option) | |
170 | Char_t treeName[7]; | |
171 | sprintf(treeName,"TreeR%d",fEvent); | |
172 | printf("AliTRDclusterizer::WriteCluster -- "); | |
173 | printf("Write the cluster tree %s for event %d.\n" | |
174 | ,treeName,fEvent); | |
175 | gAlice->TreeR()->Write(treeName,2); | |
176 | ||
177 | return kTRUE; | |
178 | ||
179 | } |