]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/AliHLTITSclusterer.cxx
dynamic adjustment of the output buffer size estimator
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSclusterer.cxx
1 // $Id$
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Author: The ALICE Off-line Project.                                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 //-------------------------------------------------------------------------
19 //               Implementation of the HLT ITS clusterer class
20 //    The class derives from AliITSclustererV2.
21 //    There is one new method added which allows to read ITS raw data
22 //    and store the clusters in a tree without using runloaders.
23 //    In this case, the labels filling is skipped.
24 //          Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
25 //-------------------------------------------------------------------------
26
27 #include "AliHLTITSclusterer.h"
28 #include "AliITSgeomTGeo.h"
29 #include "AliRawReader.h"
30 #include "AliITSRawStreamSPD.h"
31 #include "AliITSRawStreamSDD.h"
32 #include "AliITSRawStreamSSD.h"
33 #include <TTree.h>
34 #include <TClonesArray.h>
35
36 ClassImp(AliHLTITSclusterer)
37
38 AliHLTITSclusterer::AliHLTITSclusterer(const Char_t *geom)
39   :
40   AliITSclustererV2(geom),
41   fNModule(AliITSgeomTGeo::GetNModules())  
42 {
43 }
44
45 void AliHLTITSclusterer::Digits2Clusters(AliRawReader* rawReader,TTree *cTree)
46 {
47
48   TClonesArray *array=new TClonesArray("AliITSclusterV2",1000);
49   cTree->Branch("Clusters",&array);
50   delete array;
51
52   TClonesArray** clusters = new TClonesArray*[fNModule]; 
53   for (Int_t iModule = 0; iModule < fNModule; iModule++) {
54     clusters[iModule] = NULL;
55   }
56
57   rawReader->Reset();
58   AliITSRawStreamSPD inputSPD(rawReader);
59   FindClustersSPD(&inputSPD, clusters);
60
61   rawReader->Reset();
62   AliITSRawStreamSDD inputSDD(rawReader);
63   FindClustersSDD(&inputSDD, clusters);
64
65   rawReader->Reset();
66   AliITSRawStreamSSD inputSSD(rawReader);
67   FindClustersSSD(&inputSSD, clusters);
68
69   // write all clusters to the tree
70   Int_t nClusters = 0;
71   for (Int_t iModule = 0; iModule < fNModule; iModule++) {
72     array = clusters[iModule];
73     if (!array) {
74       Error("Digits2Clusters", "data for module %d missing!", iModule);
75       array = new TClonesArray("AliITSclusterV2");
76     }
77     cTree->SetBranchAddress("Clusters", &array);
78     cTree->Fill();
79     nClusters += array->GetEntriesFast();
80     delete array;
81   }
82
83   delete[] clusters;
84
85   Info("Digits2Clusters", "total number of found clusters in ITS: %d\n", 
86        nClusters);
87 }