]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterReconstructor.cxx
Removing category plane from mapping;
[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//__________________________________________________________________________
46AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader)
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
58 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
59
7e4a628d 60 // reconstruction model
61 fRecModel = new AliMUONClusterFinderVS();
62 //fRecModel = new AliMUONClusterFinderAZ();
52c9bc11 63
30178c30 64}
52c9bc11 65
30178c30 66//__________________________________________________________________________
67AliMUONClusterReconstructor::AliMUONClusterReconstructor()
68 : TObject(),
30178c30 69 fMUONData(0),
30178c30 70 fPrintLevel(fgkDefaultPrintLevel),
71 fDebug(0),
72 fLoader(0)
73{
74 // Default Constructor
52c9bc11 75}
30178c30 76
52c9bc11 77//_______________________________________________________________________
30178c30 78AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
79 : TObject(rhs)
52c9bc11 80{
30178c30 81// Protected copy constructor
82
8c343c7c 83 AliFatal("Not implemented.");
52c9bc11 84}
85
30178c30 86//_______________________________________________________________________
87AliMUONClusterReconstructor &
88AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
52c9bc11 89{
30178c30 90// Protected assignement operator
91
92 if (this == &rhs) return *this;
93
8c343c7c 94 AliFatal("Not implemented.");
30178c30 95
96 return *this;
52c9bc11 97}
98
99//__________________________________________________________________________
100AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
101{
7e4a628d 102
52c9bc11 103 if (fMUONData)
104 delete fMUONData;
105
106 return;
107}
108//____________________________________________________________________
109void AliMUONClusterReconstructor::Digits2Clusters()
a713db22 110{
111
112 TClonesArray *dig1, *dig2, *digAll;
113 Int_t ndig, k, idDE, idDE_prev;
114 dig1 = new TClonesArray("AliMUONDigit",1000);
115 dig2 = new TClonesArray("AliMUONDigit",1000);
116 digAll = new TClonesArray("AliMUONDigit",2000);
117
118 AliMUONDigit* digit;
119
f7db2071 120 TArrayI id(200); // contains the different IdDE
121
a713db22 122
123// Loop on chambers and on cathode planes
124 TClonesArray* muonDigits;
125 Int_t n2;
126 Int_t n1;
127 Int_t flag = 0;
128
129 for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) {
f7db2071 130
131 id.Reset();
a713db22 132 n1 = 0;
133 n2 = 0;
134 //cathode 0
135 fMUONData->ResetDigits();
136 fMUONData->GetCathode(0);
137 muonDigits = fMUONData->Digits(ich);
138 ndig = muonDigits->GetEntriesFast();
139 TClonesArray &lDigit = *digAll;
140
141 idDE_prev = 0;
142
143 for (k = 0; k < ndig; k++) {
144
145 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
146 new(lDigit[n1++]) AliMUONDigit(*digit);
147 idDE = digit->DetElemId();
f7db2071 148 if (idDE != idDE_prev) {
a713db22 149 id.AddAt(idDE,n2++);
f7db2071 150 }
a713db22 151 idDE_prev = idDE;
152 }
153
154 //cathode 1
155 fMUONData->ResetDigits();
156 fMUONData->GetCathode(1);
157 muonDigits = fMUONData->Digits(ich);
158 ndig = muonDigits->GetEntriesFast();
159
f7db2071 160 Int_t idSize = n2;
161
a713db22 162 for (k = 0; k < ndig; k++) {
163
164 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
165 new(lDigit[n1++]) AliMUONDigit(*digit);
166 idDE = digit->DetElemId();
167 flag = 0;
168
f7db2071 169 // looking for new idDE in cathode 1 (method to be checked CF)
170 for (Int_t n = 0; n < idSize; n++) {
171 if (idDE == id[n]) {
a713db22 172 flag = 1;
173 break;
174 }
52c9bc11 175 }
f7db2071 176 if (flag) continue;
177 id.AddAt(idDE,n2++);
a713db22 178 }
179
f7db2071 180 idSize = n2;
a713db22 181
f7db2071 182 // loop over id DE
183 for (idDE = 0; idDE < idSize; idDE++) {
a713db22 184 TClonesArray &lhits1 = *dig1;
52c9bc11 185 TClonesArray &lhits2 = *dig2;
677975f0 186 dig1->Clear();
187 dig2->Clear();
a713db22 188 n1 = n2 = 0;
189
190 for (k = 0; k < digAll->GetEntriesFast(); k++) {
191 digit = (AliMUONDigit*) digAll->UncheckedAt(k);
f7db2071 192 // printf("digit idDE %d\n", digit->DetElemId());
193 if (id[idDE] == digit->DetElemId()) {
677975f0 194 if (digit->Cathode() == 0)
a713db22 195 new(lhits1[n1++]) AliMUONDigit(*digit);
196 else
197 new(lhits2[n2++]) AliMUONDigit(*digit);
f7db2071 198 }
52c9bc11 199 }
200
a2b41b89 201 // if (id[idDE] < 500 && id[idDE] > 299) continue; // temporary patch til St2 geometry is not yet ok (CF)
677975f0 202
a713db22 203 // cluster finder
204 if (fRecModel) {
205 AliMUONClusterInput::Instance()->SetDigits(ich, id[idDE], dig1, dig2);
206 fRecModel->FindRawClusters();
52c9bc11 207 }
208 // copy into the container
7e4a628d 209 TClonesArray* tmp = fRecModel->GetRawClusters();
52c9bc11 210 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
211 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
212 fMUONData->AddRawCluster(ich, *pClus);
213 }
214 dig1->Delete();
215 dig2->Delete();
f7db2071 216 } // idDE
217 digAll->Delete();
52c9bc11 218 } // for ich
219 delete dig1;
220 delete dig2;
a713db22 221 delete digAll;
52c9bc11 222}
cf464691 223
224//____________________________________________________________________
225void AliMUONClusterReconstructor::Digits2Clusters(AliRawReader* /*rawReader*/)
226{
227
228// Perform cluster finding form raw data
229
8c343c7c 230 AliFatal("clusterization not implemented for raw data input");
cf464691 231}
7e4a628d 232//_______________________________________________________________________
233void AliMUONClusterReconstructor::Trigger2Trigger()
234{
235// copy trigger from TreeD to TreeR
236
237 fMUONData->SetTreeAddress("GLT");
238 fMUONData->GetTriggerD();
239}
240//_______________________________________________________________________
241void AliMUONClusterReconstructor::Trigger2Trigger(AliRawReader* /*rawReader*/)
242{
243// call the Trigger Algorithm from raw data and fill TreeR
244
245 AliFatal("Trigger not implemented for raw data input");
246
247}