]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterReconstructor.cxx
Fix bug on getter methods (Indranil)
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterReconstructor.cxx
CommitLineData
52c9bc11 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/* $Id$ */
17
18////////////////////////////////////
19//
cf464691 20// MUON cluster reconstructor for MUON
52c9bc11 21//
cf464691 22// Should implement a virtual class ClusterFinder to chose between VS and AZ method
52c9bc11 23////////////////////////////////////
24
52c9bc11 25#include "AliMUONClusterReconstructor.h"
cf464691 26#include "AliRun.h" // for gAlice
27#include "AliRunLoader.h"
28#include "AliLoader.h"
29
a713db22 30#include "AliMUON.h"
52c9bc11 31#include "AliMUONDigit.h"
32#include "AliMUONConstants.h"
33#include "AliMUONData.h"
34#include "AliMUONClusterFinderVS.h"
52c9bc11 35#include "AliMUONClusterInput.h"
36#include "AliMUONRawCluster.h"
cf464691 37#include "AliRawReader.h" // for raw data
8c343c7c 38#include "AliLog.h"
cf464691 39
52c9bc11 40
343146bf 41const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0;
52c9bc11 42
43ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
44
45//__________________________________________________________________________
1197ff51 46 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader, AliMUONData* data)
7e4a628d 47 : TObject(),
48 fMUONData(0),
49 fPrintLevel(fgkDefaultPrintLevel),
50 fDebug(0)
52c9bc11 51{
30178c30 52 // Standard Constructor
52c9bc11 53
54 // initialize loader's
55 fLoader = loader;
56
57 // initialize container
1197ff51 58 if (data == 0x0)
59 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
60 else
61 fMUONData = data;
62
7e4a628d 63 // reconstruction model
64 fRecModel = new AliMUONClusterFinderVS();
65 //fRecModel = new AliMUONClusterFinderAZ();
52c9bc11 66
30178c30 67}
52c9bc11 68
30178c30 69//__________________________________________________________________________
70AliMUONClusterReconstructor::AliMUONClusterReconstructor()
71 : TObject(),
30178c30 72 fMUONData(0),
30178c30 73 fPrintLevel(fgkDefaultPrintLevel),
74 fDebug(0),
75 fLoader(0)
76{
77 // Default Constructor
52c9bc11 78}
30178c30 79
52c9bc11 80//_______________________________________________________________________
30178c30 81AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
82 : TObject(rhs)
52c9bc11 83{
30178c30 84// Protected copy constructor
85
8c343c7c 86 AliFatal("Not implemented.");
52c9bc11 87}
88
30178c30 89//_______________________________________________________________________
90AliMUONClusterReconstructor &
91AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
52c9bc11 92{
30178c30 93// Protected assignement operator
94
95 if (this == &rhs) return *this;
96
8c343c7c 97 AliFatal("Not implemented.");
30178c30 98
99 return *this;
52c9bc11 100}
101
102//__________________________________________________________________________
103AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
104{
7e4a628d 105
52c9bc11 106 if (fMUONData)
107 delete fMUONData;
108
109 return;
110}
111//____________________________________________________________________
112void AliMUONClusterReconstructor::Digits2Clusters()
a713db22 113{
114
115 TClonesArray *dig1, *dig2, *digAll;
116 Int_t ndig, k, idDE, idDE_prev;
117 dig1 = new TClonesArray("AliMUONDigit",1000);
118 dig2 = new TClonesArray("AliMUONDigit",1000);
119 digAll = new TClonesArray("AliMUONDigit",2000);
120
121 AliMUONDigit* digit;
122
f7db2071 123 TArrayI id(200); // contains the different IdDE
124
a713db22 125
126// Loop on chambers and on cathode planes
127 TClonesArray* muonDigits;
128 Int_t n2;
129 Int_t n1;
935b9895 130
a713db22 131 for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) {
f7db2071 132
133 id.Reset();
a713db22 134 n1 = 0;
135 n2 = 0;
935b9895 136 //cathode 0 & 1
a713db22 137 fMUONData->ResetDigits();
935b9895 138 fMUONData->GetDigits();
a713db22 139 muonDigits = fMUONData->Digits(ich);
140 ndig = muonDigits->GetEntriesFast();
141 TClonesArray &lDigit = *digAll;
142
143 idDE_prev = 0;
935b9895 144 muonDigits->Sort();
a713db22 145 for (k = 0; k < ndig; k++) {
146
147 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
148 new(lDigit[n1++]) AliMUONDigit(*digit);
149 idDE = digit->DetElemId();
f7db2071 150 if (idDE != idDE_prev) {
a713db22 151 id.AddAt(idDE,n2++);
f7db2071 152 }
a713db22 153 idDE_prev = idDE;
154 }
155
a713db22 156
f7db2071 157 Int_t idSize = n2;
a713db22 158
f7db2071 159 // loop over id DE
160 for (idDE = 0; idDE < idSize; idDE++) {
a713db22 161 TClonesArray &lhits1 = *dig1;
52c9bc11 162 TClonesArray &lhits2 = *dig2;
677975f0 163 dig1->Clear();
164 dig2->Clear();
a713db22 165 n1 = n2 = 0;
166
167 for (k = 0; k < digAll->GetEntriesFast(); k++) {
168 digit = (AliMUONDigit*) digAll->UncheckedAt(k);
f7db2071 169 // printf("digit idDE %d\n", digit->DetElemId());
170 if (id[idDE] == digit->DetElemId()) {
677975f0 171 if (digit->Cathode() == 0)
a713db22 172 new(lhits1[n1++]) AliMUONDigit(*digit);
173 else
174 new(lhits2[n2++]) AliMUONDigit(*digit);
f7db2071 175 }
52c9bc11 176 }
177
a2b41b89 178 // if (id[idDE] < 500 && id[idDE] > 299) continue; // temporary patch til St2 geometry is not yet ok (CF)
677975f0 179
a713db22 180 // cluster finder
181 if (fRecModel) {
182 AliMUONClusterInput::Instance()->SetDigits(ich, id[idDE], dig1, dig2);
183 fRecModel->FindRawClusters();
52c9bc11 184 }
185 // copy into the container
7e4a628d 186 TClonesArray* tmp = fRecModel->GetRawClusters();
52c9bc11 187 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
188 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
189 fMUONData->AddRawCluster(ich, *pClus);
190 }
191 dig1->Delete();
192 dig2->Delete();
f7db2071 193 } // idDE
194 digAll->Delete();
52c9bc11 195 } // for ich
196 delete dig1;
197 delete dig2;
a713db22 198 delete digAll;
52c9bc11 199}
cf464691 200
7e4a628d 201//_______________________________________________________________________
202void AliMUONClusterReconstructor::Trigger2Trigger()
203{
204// copy trigger from TreeD to TreeR
205
206 fMUONData->SetTreeAddress("GLT");
207 fMUONData->GetTriggerD();
208}