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 "AliTRDclusterizerV1HLT.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(AliTRDclusterizerV1HLT)
50 //_____________________________________________________________________________
51 AliTRDclusterizerV1HLT::AliTRDclusterizerV1HLT()
52 : AliTRDclusterizerV1(),
53 fTreeCreatedHere(kFALSE),
59 // AliTRDclusterizerV1HLT default constructor
63 //_____________________________________________________________________________
64 AliTRDclusterizerV1HLT::AliTRDclusterizerV1HLT(const Text_t *name, const Text_t *title)
65 : AliTRDclusterizerV1(name,title),
66 fTreeCreatedHere(kFALSE),
72 // AliTRDclusterizerV1HLT constructor
76 //_____________________________________________________________________________
77 AliTRDclusterizerV1HLT::AliTRDclusterizerV1HLT(const AliTRDclusterizerV1HLT &c)
78 : AliTRDclusterizerV1(c),
79 fTreeCreatedHere(kFALSE),
85 // AliTRDclusterizerV1HLT copy constructor
89 //_____________________________________________________________________________
90 AliTRDclusterizerV1HLT::~AliTRDclusterizerV1HLT()
93 // AliTRDclusterizerV1HLT destructor
95 if (fTreeCreatedHere == kTRUE)
98 delete fRawDataSource;
102 //_____________________________________________________________________________
103 AliTRDclusterizerV1HLT &AliTRDclusterizerV1HLT::operator=(const AliTRDclusterizerV1HLT &c)
106 // Assignment operator
109 this->fRawDataSource = 0;
110 if (this != &c) ((AliTRDclusterizerV1HLT &) c).Copy(*this);
115 //_____________________________________________________________________________
116 void AliTRDclusterizerV1HLT::Copy(TObject &c) const
122 AliFatal("Not implemented");
124 // ((AliTRDclusterizerV1HLT &) c).fDigitsManager = 0;
125 // ((AliTRDclusterizerV1HLT &) c).fTreeCreatedHere = kFALSE;
126 // AliTRDclusterizerV1::Copy(c);
130 //_____________________________________________________________________________
131 Bool_t AliTRDclusterizerV1HLT::ReadDigits(AliRawReaderMemory *rawReader)
134 // Reads the digits arrays from the ddl file
137 if (fRawDataSource == 0)
138 fRawDataSource = new AliTRDrawData;
140 //PH fRawDataSource->SetRawVersion(fRawDataVersion);
141 fDigitsManager = fRawDataSource->Raw2Digits((AliRawReader*)rawReader);
142 //AliInfo(Form("Digits manager at 0x%x", fDigitsManager));
143 AliDebug(1, Form("Digits manager at 0x%x", fDigitsManager));
151 //_____________________________________________________________________________
152 Bool_t AliTRDclusterizerV1HLT::InitClusterTree()
155 // This has to be called on HLT - creation of the cluster Tree used by the offline clusterizer (base class)
157 Bool_t kReturn = kFALSE;
158 if (fClusterTree == 0)
160 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
161 fTreeCreatedHere = kTRUE;
164 if (fClusterTree != 0)
170 //_____________________________________________________________________________
171 Bool_t AliTRDclusterizerV1HLT::InsertClusters(TObjArray *tobjarr, Int_t idet)
174 // Fill the tree with clusters - from a different component for example
182 //set the pointer used in WriteClusters
183 fRecPoints = tobjarr;
184 Bool_t kRet = kFALSE;
185 if (InitClusterTree())
186 kRet = WriteClusters(idet);
192 //_____________________________________________________________________________
193 Int_t AliTRDclusterizerV1HLT::GetNclusters()
196 // Returns the number of clusters AliTRDclusterizerV1HLT::fNclusters
197 // Count them first if fNclusters < 0
207 //_____________________________________________________________________________
208 Bool_t AliTRDclusterizerV1HLT::ResetTree()
211 // Recreate the cluster tree
214 // if (fClusterTree != 0)
215 // fClusterTree->Reset();
216 // well we'd better delete the whole tree and branches
219 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
222 fTreeCreatedHere = kTRUE;
224 //AliInfo("Tree Reset Successful");
225 AliDebug(1,Form("Tree Reset Successful"));
229 fTreeCreatedHere = kFALSE;
230 AliError("Reset Tree Error!\n");
233 return fTreeCreatedHere;
236 //_____________________________________________________________________________
237 Int_t AliTRDclusterizerV1HLT::CountClusters()
240 // Count the clusters - runs over the cluster tree
244 if (fClusterTree == 0)
246 AliError("No tree to count clusters!\n");
249 TList *lt = (TList*)fClusterTree->GetListOfBranches();
254 while ((tb = (TBranch*)it.Next()) != 0)
256 TObjArray *clusters = 0;
257 tb->SetAddress(&clusters);
258 for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
261 icount += clusters->GetEntries();
265 //AliInfo(Form("Recounted clusters %d", fNclusters));
266 AliDebug(2, Form("Recounted clusters %d", fNclusters));