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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 // TRD cluster finder //
20 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliRunLoader.h"
28 #include "AliLoader.h"
29 #include "AliRawReader.h"
32 #include "AliTRDclusterizerHLT.h"
33 #include "AliTRDgeometry.h"
34 #include "AliTRDdataArrayF.h"
35 #include "AliTRDdataArrayI.h"
36 #include "AliTRDdigitsManager.h"
37 #include "AliTRDpadPlane.h"
38 #include "AliTRDrawData.h"
39 #include "AliTRDcalibDB.h"
40 #include "AliTRDSimParam.h"
41 #include "AliTRDRecParam.h"
42 #include "AliTRDCommonParam.h"
43 #include "AliTRDcluster.h"
45 #include "Cal/AliTRDCalROC.h"
46 #include "Cal/AliTRDCalDet.h"
48 ClassImp(AliTRDclusterizerHLT)
50 //_____________________________________________________________________________
51 AliTRDclusterizerHLT::AliTRDclusterizerHLT()
52 : AliTRDclusterizer(),
53 fTreeCreatedHere(kFALSE),
58 // AliTRDclusterizerHLT default constructor
62 //_____________________________________________________________________________
63 AliTRDclusterizerHLT::AliTRDclusterizerHLT(const Text_t *name, const Text_t *title)
64 : AliTRDclusterizer(name,title),
65 fTreeCreatedHere(kFALSE),
70 // AliTRDclusterizerHLT constructor
74 //_____________________________________________________________________________
75 AliTRDclusterizerHLT::AliTRDclusterizerHLT(const AliTRDclusterizerHLT &c)
76 : AliTRDclusterizer(c),
77 fTreeCreatedHere(kFALSE),
82 // AliTRDclusterizerHLT copy constructor
86 //_____________________________________________________________________________
87 AliTRDclusterizerHLT::~AliTRDclusterizerHLT()
90 // AliTRDclusterizerHLT destructor
92 if (fTreeCreatedHere == kTRUE)
95 delete fRawDataSource;
99 //_____________________________________________________________________________
100 AliTRDclusterizerHLT &AliTRDclusterizerHLT::operator=(const AliTRDclusterizerHLT &c)
103 // Assignment operator
106 this->fRawDataSource = 0;
107 if (this != &c) ((AliTRDclusterizerHLT &) c).Copy(*this);
112 //_____________________________________________________________________________
113 void AliTRDclusterizerHLT::Copy(TObject &c) const
119 AliFatal("Not implemented");
121 //use the parameter c - no warning...
122 ((AliTRDclusterizerHLT &) c).fDigitsManager = 0;
123 // ((AliTRDclusterizerHLT &) c).fDigitsManager = 0;
124 // ((AliTRDclusterizerHLT &) c).fTreeCreatedHere = kFALSE;
125 // AliTRDclusterizer::Copy(c);
129 //_____________________________________________________________________________
130 Bool_t AliTRDclusterizerHLT::ReadDigits(AliRawReaderMemory *rawReader)
133 // Reads the digits arrays from the ddl file
136 if (fRawDataSource == 0)
137 fRawDataSource = new AliTRDrawData;
139 //PH fRawDataSource->SetRawVersion(fRawVersion);
140 fDigitsManager = fRawDataSource->Raw2Digits((AliRawReader*)rawReader);
141 //AliInfo(Form("Digits manager at 0x%x", fDigitsManager));
142 AliDebug(1, Form("Digits manager at 0x%x", fDigitsManager));
150 //_____________________________________________________________________________
151 Bool_t AliTRDclusterizerHLT::InitClusterTree()
154 // This has to be called on HLT - creation of the cluster Tree used by the offline clusterizer (base class)
156 Bool_t kReturn = kFALSE;
157 if (fClusterTree == 0)
159 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
160 fTreeCreatedHere = kTRUE;
163 if (fClusterTree != 0)
169 //_____________________________________________________________________________
170 Bool_t AliTRDclusterizerHLT::InsertClusters(TObjArray *tobjarr, Int_t idet)
173 // Fill the tree with clusters - from a different component for example
181 //set the pointer used in WriteClusters
182 fRecPoints = tobjarr;
183 Bool_t kRet = kFALSE;
184 if (InitClusterTree())
185 kRet = WriteClusters(idet);
191 //_____________________________________________________________________________
192 Int_t AliTRDclusterizerHLT::GetNclusters()
195 // Returns the number of clusters AliTRDclusterizerHLT::fNclusters
196 // Count them first if fNclusters < 0
206 //_____________________________________________________________________________
207 Bool_t AliTRDclusterizerHLT::ResetTree()
210 // Recreate the cluster tree
213 // if (fClusterTree != 0)
214 // fClusterTree->Reset();
215 // well we'd better delete the whole tree and branches
218 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
221 fTreeCreatedHere = kTRUE;
223 //AliInfo("Tree Reset Successful");
224 AliDebug(1,Form("Tree Reset Successful"));
228 fTreeCreatedHere = kFALSE;
229 AliError("Reset Tree Error!\n");
232 return fTreeCreatedHere;
235 //_____________________________________________________________________________
236 Int_t AliTRDclusterizerHLT::CountClusters()
239 // Count the clusters - runs over the cluster tree
243 if (fClusterTree == 0)
245 AliError("No tree to count clusters!\n");
248 TList *lt = (TList*)fClusterTree->GetListOfBranches();
253 while ((tb = (TBranch*)it.Next()) != 0)
255 TObjArray *clusters = 0;
256 tb->SetAddress(&clusters);
257 for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
260 icount += clusters->GetEntries();
264 //AliInfo(Form("Recounted clusters %d", fNclusters));
265 AliDebug(2, Form("Recounted clusters %d", fNclusters));