Modified init of AliMuonForwardTrack
[u/mrichter/AliRoot.git] / MFT / AliMFTReconstructor.cxx
CommitLineData
820b4d9e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16//====================================================================================================================================================
17//
18// Event reconstruction class for the ALICE Muon Forward Tracker
19//
20// Contact author: antonio.uras@cern.ch
21//
22//====================================================================================================================================================
23
24#include "TObjArray.h"
25#include "TTree.h"
26#include "AliMFTSegmentation.h"
27#include "AliMFTClusterFinder.h"
28#include "AliReconstructor.h"
29#include "AliMFTReconstructor.h"
30
31ClassImp(AliMFTReconstructor)
32
33//====================================================================================================================================================
34
35AliMFTReconstructor::AliMFTReconstructor():
36 AliReconstructor(),
37 fDigits(0x0),
38 fNPlanes(0)
39{
40
41 // default constructor
42
43}
44
45//====================================================================================================================================================
46
47AliMFTReconstructor::~AliMFTReconstructor(){
48
49 // destructor
50
51 if (fDigits) {
52 fDigits->Delete();
53 delete fDigits;
54 fDigits=0;
55 }
56
57}
58
59//====================================================================================================================================================
60
61void AliMFTReconstructor::Init() {
62
63 AliMFTSegmentation *segmentation = new AliMFTSegmentation("AliMFTGeometry.root");
64 fNPlanes = segmentation->GetNPlanes();
65 delete segmentation;
66
67 fDigits = new TObjArray(fNPlanes);
68 fDigits->SetOwner(kTRUE);
d4643a10 69 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) fDigits->AddAt(new TClonesArray("AliMFTDigit"),iPlane);
820b4d9e 70
71 AliInfo(" ************* Using the MFT reconstructor! ****** ");
72
73 return;
74
75}
76
77//====================================================================================================================================================
78
79void AliMFTReconstructor::ResetDigits() {
80
81 // Reset number of digits and the digits array for the MFT detector.
82
83 if (!fDigits) return;
84 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
85 ResetDigits(iPlane);
86 }
87
88}
89
90//====================================================================================================================================================
91
92void AliMFTReconstructor::ResetDigits(Int_t plane) {
93
94 // Reset number of digits and the digits array for this branch.
95
96 if (fDigits->At(plane)) ((TClonesArray*)fDigits->At(plane))->Clear();
97
98}
99
100//====================================================================================================================================================
101
102void AliMFTReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const {
103
104 AliInfo("Starting Reconstruction for MFT");
105
106 // Clusterization
107
108 AliDebug(1, Form("nPlanes = %d",fNPlanes));
109
110 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
111 AliDebug(1, Form("Setting Address for Branch Plane_%02d", iPlane));
112 digitsTree->SetBranchAddress(Form("Plane_%02d",iPlane), &(*fDigits)[iPlane]);
113 }
114
115 digitsTree->GetEntry(0);
116
117 AliDebug(1, "Creating clusterFinder");
118 AliMFTClusterFinder *clusterFinder = new AliMFTClusterFinder();
119 clusterFinder->Init("AliMFTGeometry.root");
120 AliDebug(1, "clusterFinder->MakeClusterBranch(clustersTree)");
121 clusterFinder->MakeClusterBranch(clustersTree);
122 AliDebug(1, "clusterFinder->SetClusterTreeAddress(clustersTree)");
123 clusterFinder->SetClusterTreeAddress(clustersTree);
124 AliDebug(1, "clusterFinder->DigitsToClusters(fDigits)");
125 clusterFinder->DigitsToClusters(fDigits);
126 AliDebug(1, "clustersTree->Fill()");
127 clustersTree->Fill(); // fill tree for current event
128 AliDebug(1, "delete clusterFinder");
129 delete clusterFinder;
130
131 for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
132 AliDebug(1, Form("fDigits->At(%d)->Clear()",iPlane));
133 fDigits->At(iPlane)->Clear();
134 }
135
136}
137
138//====================================================================================================================================================