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 "AliTRDfeeParam.h"
38 #include "AliTRDpadPlane.h"
39 #include "AliTRDrawData.h"
40 #include "AliTRDcalibDB.h"
41 #include "AliTRDSimParam.h"
42 #include "AliTRDcluster.h"
44 #include "Cal/AliTRDCalROC.h"
45 #include "Cal/AliTRDCalDet.h"
47 ClassImp(AliTRDclusterizerHLT)
49 //_____________________________________________________________________________
50 AliTRDclusterizerHLT::AliTRDclusterizerHLT()
52 , 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)
71 // AliTRDclusterizerHLT constructor
75 //_____________________________________________________________________________
76 AliTRDclusterizerHLT::AliTRDclusterizerHLT(const AliTRDclusterizerHLT &c)
77 : AliTRDclusterizer(c)
78 , fTreeCreatedHere(kFALSE)
84 // AliTRDclusterizerHLT copy constructor
88 //_____________________________________________________________________________
89 AliTRDclusterizerHLT::~AliTRDclusterizerHLT()
92 // AliTRDclusterizerHLT destructor
94 if (fTreeCreatedHere == kTRUE)
97 delete fRawDataSource;
101 //_____________________________________________________________________________
102 AliTRDclusterizerHLT &AliTRDclusterizerHLT::operator=(const AliTRDclusterizerHLT &c)
105 // Assignment operator
108 this->fRawDataSource = 0;
109 if (this != &c) ((AliTRDclusterizerHLT &) c).Copy(*this);
114 //_____________________________________________________________________________
115 void AliTRDclusterizerHLT::Copy(TObject &c) const
121 AliFatal("Not implemented");
123 //use the parameter c - no warning...
124 ((AliTRDclusterizerHLT &) c).fDigitsManager = 0;
125 // ((AliTRDclusterizerHLT &) c).fDigitsManager = 0;
126 // ((AliTRDclusterizerHLT &) c).fTreeCreatedHere = kFALSE;
127 // AliTRDclusterizer::Copy(c);
131 void AliTRDclusterizerHLT::SetRawVersion(Int_t iver)
134 // set the expected raw data version
137 AliTRDclusterizer::SetRawVersion(iver);
141 fFeeParams = AliTRDfeeParam::Instance();
144 fFeeParams->SetRAWversion(iver);
146 //_____________________________________________________________________________
147 Bool_t AliTRDclusterizerHLT::ReadDigits(AliRawReaderMemory *rawReader)
150 // Reads the digits arrays from the ddl file
153 if (fRawDataSource == 0)
154 fRawDataSource = new AliTRDrawData;
156 //PH fRawDataSource->SetRawVersion(fRawVersion);
158 fDigitsManager = fRawDataSource->Raw2Digits((AliRawReader*)rawReader);
159 //AliInfo(Form("Digits manager at 0x%x", fDigitsManager));
160 AliDebug(1, Form("Digits manager at 0x%x", fDigitsManager));
168 //_____________________________________________________________________________
169 Bool_t AliTRDclusterizerHLT::InitClusterTree()
172 // This has to be called on HLT - creation of the cluster Tree used by the offline clusterizer (base class)
174 Bool_t kReturn = kFALSE;
175 if (fClusterTree == 0)
177 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
178 fTreeCreatedHere = kTRUE;
181 if (fClusterTree != 0)
187 //_____________________________________________________________________________
188 Bool_t AliTRDclusterizerHLT::InsertClusters(TObjArray *tobjarr, Int_t idet)
191 // Fill the tree with clusters - from a different component for example
199 //set the pointer used in WriteClusters
200 fRecPoints = tobjarr;
201 Bool_t kRet = kFALSE;
202 if (InitClusterTree())
203 kRet = WriteClusters(idet);
209 //_____________________________________________________________________________
210 Int_t AliTRDclusterizerHLT::GetNclusters()
213 // Returns the number of clusters AliTRDclusterizerHLT::fNclusters
214 // Count them first if fNclusters < 0
224 //_____________________________________________________________________________
225 Bool_t AliTRDclusterizerHLT::ResetTree()
228 // Recreate the cluster tree
231 // if (fClusterTree != 0)
232 // fClusterTree->Reset();
233 // well we'd better delete the whole tree and branches
236 fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
239 fTreeCreatedHere = kTRUE;
241 //AliInfo("Tree Reset Successful");
242 AliDebug(1,Form("Tree Reset Successful"));
246 fTreeCreatedHere = kFALSE;
247 AliError("Reset Tree Error!\n");
250 return fTreeCreatedHere;
253 //_____________________________________________________________________________
254 Int_t AliTRDclusterizerHLT::CountClusters()
257 // Count the clusters - runs over the cluster tree
261 if (fClusterTree == 0)
263 AliError("No tree to count clusters!\n");
266 TList *lt = (TList*)fClusterTree->GetListOfBranches();
271 while ((tb = (TBranch*)it.Next()) != 0)
273 TObjArray *clusters = 0;
274 tb->SetAddress(&clusters);
275 for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
278 icount += clusters->GetEntries();
282 //AliInfo(Form("Recounted clusters %d", fNclusters));
283 AliDebug(2, Form("Recounted clusters %d", fNclusters));