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 "AliTRDclusterizerV2HLT.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(AliTRDclusterizerV2HLT)
50 //_____________________________________________________________________________
51 AliTRDclusterizerV2HLT::AliTRDclusterizerV2HLT()
52 : AliTRDclusterizerV2(),
53 fTreeCreatedHere(kFALSE),
58 // AliTRDclusterizerV2HLT default constructor
62 //_____________________________________________________________________________
63 AliTRDclusterizerV2HLT::AliTRDclusterizerV2HLT(const Text_t *name, const Text_t *title)
64 : AliTRDclusterizerV2(name,title),
65 fTreeCreatedHere(kFALSE),
70 // AliTRDclusterizerV2HLT constructor
74 //_____________________________________________________________________________
75 AliTRDclusterizerV2HLT::AliTRDclusterizerV2HLT(const AliTRDclusterizerV2HLT &c)
76 : AliTRDclusterizerV2(c),
77 fTreeCreatedHere(kFALSE),
82 // AliTRDclusterizerV2HLT copy constructor
86 //_____________________________________________________________________________
87 AliTRDclusterizerV2HLT::~AliTRDclusterizerV2HLT()
90 // AliTRDclusterizerV2HLT destructor
92 if (fTreeCreatedHere == kTRUE)
95 delete fRawDataSource;
99 //_____________________________________________________________________________
100 AliTRDclusterizerV2HLT &AliTRDclusterizerV2HLT::operator=(const AliTRDclusterizerV2HLT &c)
103 // Assignment operator
106 this->fRawDataSource = 0;
107 if (this != &c) ((AliTRDclusterizerV2HLT &) c).Copy(*this);
112 //_____________________________________________________________________________
113 void AliTRDclusterizerV2HLT::Copy(TObject &c) const
119 AliFatal("Not implemented");
121 // ((AliTRDclusterizerV2HLT &) c).fDigitsManager = 0;
122 // ((AliTRDclusterizerV2HLT &) c).fTreeCreatedHere = kFALSE;
123 // AliTRDclusterizerV2::Copy(c);
127 //_____________________________________________________________________________
128 Bool_t AliTRDclusterizerV2HLT::ReadDigits(AliRawReaderMemory *rawReader)
131 // Reads the digits arrays from the ddl file
134 if (fRawDataSource == 0)
135 fRawDataSource = new AliTRDrawData;
137 //PH fRawDataSource->SetRawVersion(fRawVersion);
138 fDigitsManager = fRawDataSource->Raw2Digits((AliRawReader*)rawReader);
139 //AliInfo(Form("Digits manager at 0x%x", fDigitsManager));
140 AliDebug(1, Form("Digits manager at 0x%x", fDigitsManager));
148 //_____________________________________________________________________________
149 Bool_t AliTRDclusterizerV2HLT::InitClusterTree()
152 // This has to be called on HLT - creation of the cluster Tree used by the offline clusterizer (base class)
154 Bool_t kReturn = kFALSE;
155 if (fClusterTree == 0)
157 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
158 fTreeCreatedHere = kTRUE;
161 if (fClusterTree != 0)
167 //_____________________________________________________________________________
168 Bool_t AliTRDclusterizerV2HLT::InsertClusters(TObjArray *tobjarr, Int_t idet)
171 // Fill the tree with clusters - from a different component for example
179 //set the pointer used in WriteClusters
180 fRecPoints = tobjarr;
181 Bool_t kRet = kFALSE;
182 if (InitClusterTree())
183 kRet = WriteClusters(idet);
189 //_____________________________________________________________________________
190 Int_t AliTRDclusterizerV2HLT::GetNclusters()
193 // Returns the number of clusters AliTRDclusterizerV2HLT::fNclusters
194 // Count them first if fNclusters < 0
204 //_____________________________________________________________________________
205 Bool_t AliTRDclusterizerV2HLT::ResetTree()
208 // Recreate the cluster tree
211 // if (fClusterTree != 0)
212 // fClusterTree->Reset();
213 // well we'd better delete the whole tree and branches
216 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
219 fTreeCreatedHere = kTRUE;
221 //AliInfo("Tree Reset Successful");
222 AliDebug(1,Form("Tree Reset Successful"));
226 fTreeCreatedHere = kFALSE;
227 AliError("Reset Tree Error!\n");
230 return fTreeCreatedHere;
233 //_____________________________________________________________________________
234 Int_t AliTRDclusterizerV2HLT::CountClusters()
237 // Count the clusters - runs over the cluster tree
241 if (fClusterTree == 0)
243 AliError("No tree to count clusters!\n");
246 TList *lt = (TList*)fClusterTree->GetListOfBranches();
251 while ((tb = (TBranch*)it.Next()) != 0)
253 TObjArray *clusters = 0;
254 tb->SetAddress(&clusters);
255 for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
258 icount += clusters->GetEntries();
262 //AliInfo(Form("Recounted clusters %d", fNclusters));
263 AliDebug(2, Form("Recounted clusters %d", fNclusters));