]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterReconstructor.cxx
Move to new 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"
8c343c7c 37#include "AliLog.h"
cf464691 38
52c9bc11 39ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
40
41//__________________________________________________________________________
1197ff51 42 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader, AliMUONData* data)
5ac16716 43 : TObject()
52c9bc11 44{
30178c30 45 // Standard Constructor
52c9bc11 46
47 // initialize loader's
48 fLoader = loader;
49
50 // initialize container
3bc8b580 51 fMUONData = data;
1197ff51 52
7e4a628d 53 // reconstruction model
54 fRecModel = new AliMUONClusterFinderVS();
55 //fRecModel = new AliMUONClusterFinderAZ();
52c9bc11 56
30178c30 57}
52c9bc11 58
30178c30 59//__________________________________________________________________________
60AliMUONClusterReconstructor::AliMUONClusterReconstructor()
61 : TObject(),
30178c30 62 fMUONData(0),
5ac16716 63 fRecModel(0),
30178c30 64 fLoader(0)
65{
66 // Default Constructor
52c9bc11 67}
30178c30 68
52c9bc11 69//_______________________________________________________________________
30178c30 70AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
71 : TObject(rhs)
52c9bc11 72{
30178c30 73// Protected copy constructor
74
8c343c7c 75 AliFatal("Not implemented.");
52c9bc11 76}
77
30178c30 78//_______________________________________________________________________
79AliMUONClusterReconstructor &
80AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
52c9bc11 81{
30178c30 82// Protected assignement operator
83
84 if (this == &rhs) return *this;
85
8c343c7c 86 AliFatal("Not implemented.");
30178c30 87
88 return *this;
52c9bc11 89}
90
91//__________________________________________________________________________
92AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
93{
7e4a628d 94
5ac16716 95 if (fRecModel)
96 delete fRecModel;
52c9bc11 97
98 return;
99}
100//____________________________________________________________________
cc87ebcd 101void AliMUONClusterReconstructor::Digits2Clusters(Int_t chBeg)
a713db22 102{
103
104 TClonesArray *dig1, *dig2, *digAll;
f29ba3e1 105 Int_t ndig, k, idDE, idDEprev;
a713db22 106 dig1 = new TClonesArray("AliMUONDigit",1000);
107 dig2 = new TClonesArray("AliMUONDigit",1000);
108 digAll = new TClonesArray("AliMUONDigit",2000);
109
110 AliMUONDigit* digit;
111
f7db2071 112 TArrayI id(200); // contains the different IdDE
113
a713db22 114
115// Loop on chambers and on cathode planes
116 TClonesArray* muonDigits;
117 Int_t n2;
118 Int_t n1;
cc87ebcd 119
120 for (Int_t ich = chBeg; ich < AliMUONConstants::NTrackingCh(); ich++) {
f7db2071 121
122 id.Reset();
a713db22 123 n1 = 0;
124 n2 = 0;
cc87ebcd 125
3bc8b580 126 //cathode 0 & 1
a713db22 127 muonDigits = fMUONData->Digits(ich);
128 ndig = muonDigits->GetEntriesFast();
129 TClonesArray &lDigit = *digAll;
130
f29ba3e1 131 idDEprev = 0;
935b9895 132 muonDigits->Sort();
a713db22 133 for (k = 0; k < ndig; k++) {
134
135 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
136 new(lDigit[n1++]) AliMUONDigit(*digit);
137 idDE = digit->DetElemId();
f29ba3e1 138 if (idDE != idDEprev) {
a713db22 139 id.AddAt(idDE,n2++);
f7db2071 140 }
f29ba3e1 141 idDEprev = idDE;
a713db22 142 }
143
f7db2071 144 Int_t idSize = n2;
a713db22 145
f7db2071 146 // loop over id DE
147 for (idDE = 0; idDE < idSize; idDE++) {
a713db22 148 TClonesArray &lhits1 = *dig1;
52c9bc11 149 TClonesArray &lhits2 = *dig2;
677975f0 150 dig1->Clear();
151 dig2->Clear();
a713db22 152 n1 = n2 = 0;
153
154 for (k = 0; k < digAll->GetEntriesFast(); k++) {
155 digit = (AliMUONDigit*) digAll->UncheckedAt(k);
f7db2071 156 // printf("digit idDE %d\n", digit->DetElemId());
157 if (id[idDE] == digit->DetElemId()) {
677975f0 158 if (digit->Cathode() == 0)
a713db22 159 new(lhits1[n1++]) AliMUONDigit(*digit);
160 else
161 new(lhits2[n2++]) AliMUONDigit(*digit);
f7db2071 162 }
52c9bc11 163 }
164
a713db22 165 // cluster finder
166 if (fRecModel) {
167 AliMUONClusterInput::Instance()->SetDigits(ich, id[idDE], dig1, dig2);
168 fRecModel->FindRawClusters();
52c9bc11 169 }
170 // copy into the container
7e4a628d 171 TClonesArray* tmp = fRecModel->GetRawClusters();
52c9bc11 172 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
173 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
174 fMUONData->AddRawCluster(ich, *pClus);
175 }
176 dig1->Delete();
177 dig2->Delete();
f7db2071 178 } // idDE
179 digAll->Delete();
52c9bc11 180 } // for ich
181 delete dig1;
182 delete dig2;
a713db22 183 delete digAll;
52c9bc11 184}
cf464691 185
7e4a628d 186//_______________________________________________________________________
187void AliMUONClusterReconstructor::Trigger2Trigger()
188{
189// copy trigger from TreeD to TreeR
cc87ebcd 190
191 fMUONData->SetTreeAddress("GLT");
7e4a628d 192 fMUONData->GetTriggerD();
193}