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 **************************************************************************/
19 Revision 1.1.4.5 2000/10/15 23:40:01 cblume
22 Revision 1.1.4.4 2000/10/06 16:49:46 cblume
25 Revision 1.1.4.3 2000/10/04 16:34:58 cblume
26 Replace include files by forward declarations
28 Revision 1.1.4.2 2000/09/22 14:49:49 cblume
29 Adapted to tracking code
31 Revision 1.5 2000/10/02 21:28:19 fca
32 Removal of useless dependecies via forward declarations
34 Revision 1.4 2000/06/09 11:10:07 cblume
35 Compiler warnings and coding conventions, next round
37 Revision 1.3 2000/06/08 18:32:58 cblume
38 Make code compliant to coding conventions
40 Revision 1.2 2000/05/08 16:17:27 cblume
43 Revision 1.1.4.1 2000/05/08 15:08:03 cblume
44 Remove the class AliTRDcluster
46 Revision 1.4 2000/06/09 11:10:07 cblume
47 Compiler warnings and coding conventions, next round
49 Revision 1.3 2000/06/08 18:32:58 cblume
50 Make code compliant to coding conventions
52 Revision 1.2 2000/05/08 16:17:27 cblume
55 Revision 1.1.4.1 2000/05/08 15:08:03 cblume
56 Remove the class AliTRDcluster
58 Revision 1.1 2000/02/28 18:57:58 cblume
63 ///////////////////////////////////////////////////////////////////////////////
65 // TRD cluster finder base class //
67 ///////////////////////////////////////////////////////////////////////////////
75 #include "AliTRDclusterizer.h"
76 #include "AliTRDrecPoint.h"
77 #include "AliTRDgeometry.h"
79 ClassImp(AliTRDclusterizer)
81 //_____________________________________________________________________________
82 AliTRDclusterizer::AliTRDclusterizer():TNamed()
85 // AliTRDclusterizer default constructor
93 //_____________________________________________________________________________
94 AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title)
98 // AliTRDclusterizer default constructor
108 //_____________________________________________________________________________
109 AliTRDclusterizer::AliTRDclusterizer(const AliTRDclusterizer &c)
112 // AliTRDclusterizer copy constructor
115 ((AliTRDclusterizer &) c).Copy(*this);
119 //_____________________________________________________________________________
120 AliTRDclusterizer::~AliTRDclusterizer()
123 // AliTRDclusterizer destructor
133 //_____________________________________________________________________________
134 AliTRDclusterizer &AliTRDclusterizer::operator=(const AliTRDclusterizer &c)
137 // Assignment operator
140 if (this != &c) ((AliTRDclusterizer &) c).Copy(*this);
145 //_____________________________________________________________________________
146 void AliTRDclusterizer::Copy(TObject &c)
152 ((AliTRDclusterizer &) c).fInputFile = NULL;
153 ((AliTRDclusterizer &) c).fEvent = 0;
157 //_____________________________________________________________________________
158 void AliTRDclusterizer::Init()
161 // Initializes the cluster finder
166 //_____________________________________________________________________________
167 Bool_t AliTRDclusterizer::Open(const Char_t *name, Int_t nEvent)
170 // Opens a ROOT-file with TRD-hits and reads in the digits-tree
173 // Connect the AliRoot file containing Geometry, Kine, and Hits
174 fInputFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name);
176 printf("AliTRDclusterizer::Open -- ");
177 printf("Open the ALIROOT-file %s.\n",name);
178 fInputFile = new TFile(name,"UPDATE");
181 printf("AliTRDclusterizer::Open -- ");
182 printf("%s is already open.\n",name);
185 // Get AliRun object from file or create it if not on file
187 gAlice = (AliRun*) fInputFile->Get("gAlice");
189 printf("AliTRDclusterizer::Open -- ");
190 printf("AliRun object found on file.\n");
193 printf("AliTRDclusterizer::Open -- ");
194 printf("Could not find AliRun object.\n");
201 // Import the Trees for the event nEvent in the file
202 Int_t nparticles = gAlice->GetEvent(fEvent);
203 if (nparticles <= 0) {
204 printf("AliTRDclusterizer::Open -- ");
205 printf("No entries in the trees for event %d.\n",fEvent);
213 //_____________________________________________________________________________
214 Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
217 // Fills TRDrecPoints branch in TRDrecPoints## tree with rec. points
218 // found in detector = det. For det=-1 writes the tree.
219 // For det=-2 recreates the tree.
222 sprintf(treeName,"TRDrecPoints%d", fEvent);
225 fInputFile->Delete(treeName);
226 TTree *tree = new TTree(treeName,"Tree with TRD rec. points");
231 TTree *tree=(TTree*)fInputFile->Get(treeName);
232 TBranch *branch=tree->GetBranch("TRDrecPoints");
235 TObjArray *ioArray = 0;
236 branch = tree->Branch("TRDrecPoints","TObjArray",&ioArray,32000,0);
239 if ((det >= 0) && (det < AliTRDgeometry::Ndet())) {
241 AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD");
242 Int_t nRecPoints = TRD->RecPoints()->GetEntriesFast();
243 TObjArray *fDetRecPoints = new TObjArray(400);
245 for (Int_t i=0; i<nRecPoints; i++) {
246 AliTRDrecPoint *p=(AliTRDrecPoint*)TRD->RecPoints()->UncheckedAt(i);
247 if(det == p->GetDetector()) fDetRecPoints->AddLast(p);
248 else printf("attempt to write a RecPoint with unexpected detector index");
251 branch->SetAddress(&fDetRecPoints);
258 printf("\rAliTRDclusterizer::WriteClusters -- ");
259 printf("Writing the cluster tree %-18s for event %d.\n"
260 ,tree->GetName(),fEvent);
266 printf("\rAliTRDclusterizer::WriteClusters -- ");
267 printf("Unexpected detector index %d.\n", det);