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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // TRD cluster finder base class //
24 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliTRDclusterizer.h"
31 ClassImp(AliTRDclusterizer)
33 //_____________________________________________________________________________
34 AliTRDclusterizer::AliTRDclusterizer():TNamed()
37 // AliTRDclusterizer default constructor
45 //_____________________________________________________________________________
46 AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title)
50 // AliTRDclusterizer default constructor
60 //_____________________________________________________________________________
61 AliTRDclusterizer::~AliTRDclusterizer()
71 //_____________________________________________________________________________
72 void AliTRDclusterizer::Init()
75 // Initializes the cluster finder
80 //_____________________________________________________________________________
81 Bool_t AliTRDclusterizer::Open(const Char_t *name, Int_t nEvent)
84 // Opens a ROOT-file with TRD-hits and reads in the digits-tree
87 // Connect the AliRoot file containing Geometry, Kine, and Hits
88 fInputFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name);
90 printf("AliTRDclusterizer::Open -- ");
91 printf("Open the ALIROOT-file %s.\n",name);
92 fInputFile = new TFile(name,"UPDATE");
95 printf("AliTRDclusterizer::Open -- ");
96 printf("%s is already open.\n",name);
99 // Get AliRun object from file or create it if not on file
101 gAlice = (AliRun*) fInputFile->Get("gAlice");
103 printf("AliTRDclusterizer::Open -- ");
104 printf("AliRun object found on file.\n");
107 printf("AliTRDclusterizer::Open -- ");
108 printf("Could not find AliRun object.\n");
115 // Import the Trees for the event nEvent in the file
116 Int_t nparticles = gAlice->GetEvent(fEvent);
117 if (nparticles <= 0) {
118 printf("AliTRDclusterizer::Open -- ");
119 printf("No entries in the trees for event %d.\n",fEvent);
127 //_____________________________________________________________________________
128 Bool_t AliTRDclusterizer::WriteCluster()
131 // Writes out the TRD-cluster
134 // Write the new tree into the input file (use overwrite option)
136 sprintf(treeName,"TreeR%d",fEvent);
137 printf("AliTRDclusterizer::WriteCluster -- ");
138 printf("Write the cluster tree %s for event %d.\n"
140 gAlice->TreeR()->Write(treeName,2);
146 ClassImp(AliTRDcluster)
148 //_____________________________________________________________________________
149 AliTRDcluster::AliTRDcluster(Int_t *tracks, Int_t *cluster, Float_t energy, Float_t* position)
153 // Create a TRD cluster
156 fDetector = cluster[0];
158 fTimeSlice = cluster[1];
165 fTracks[0] = tracks[0];
166 fTracks[1] = tracks[1];
167 fTracks[2] = tracks[2];