]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterReconstructor.cxx
Reversing previous commit (Gines)
[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
30178c30 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
38
52c9bc11 39
343146bf 40const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0;
52c9bc11 41
42ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
43
44//__________________________________________________________________________
45AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader)
30178c30 46 : TObject()
52c9bc11 47{
30178c30 48 // Standard Constructor
52c9bc11 49
50 fDebug = 0;
51 fNCh = 0;
52 fNTrackingCh = 0;
53 fChambers = 0;
54 fMUONData = 0;
55 fChambers = new TObjArray(AliMUONConstants::NCh());
56
343146bf 57 fPrintLevel = fgkDefaultPrintLevel;
52c9bc11 58
59 // initialize loader's
60 fLoader = loader;
61
62 // initialize container
63 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
64
65 // Loading AliRun master
66 AliRunLoader* runloader = fLoader->GetRunLoader();
67 if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice();
68 gAlice = runloader->GetAliRun();
69
70 // getting MUON
71 fMUON = (AliMUON*) gAlice->GetDetector("MUON");
30178c30 72}
52c9bc11 73
30178c30 74//__________________________________________________________________________
75AliMUONClusterReconstructor::AliMUONClusterReconstructor()
76 : TObject(),
77 fNCh(0),
78 fNTrackingCh(0),
79 fMUONData(0),
80 fMUON(0),
81 fChambers(0),
82 fPrintLevel(fgkDefaultPrintLevel),
83 fDebug(0),
84 fLoader(0)
85{
86 // Default Constructor
52c9bc11 87}
30178c30 88
52c9bc11 89//____________________________________________________________________
90void AliMUONClusterReconstructor::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
91{
92 // take infos chambers from AliMUON
93 AliMUONChamber* pCh = 0;
94 pCh = &(fMUON->Chamber(id));
95
96 fChambers->AddAt(pCh, id);
97
98 // Set ClusterFinder for chamber id
99 ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
100}
101//_______________________________________________________________________
30178c30 102AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
103 : TObject(rhs)
52c9bc11 104{
30178c30 105// Protected copy constructor
106
e516b01d 107 Fatal("AliMUONClusterReconstructor", "Not implemented.");
52c9bc11 108}
109
30178c30 110//_______________________________________________________________________
111AliMUONClusterReconstructor &
112AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
52c9bc11 113{
30178c30 114// Protected assignement operator
115
116 if (this == &rhs) return *this;
117
e516b01d 118 Fatal("operator=", "Not implemented.");
30178c30 119
120 return *this;
52c9bc11 121}
122
123//__________________________________________________________________________
124AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
125{
126 if (fChambers){
86b48c39 127 fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner
52c9bc11 128 delete fChambers;
129 }
130 if (fMUONData)
131 delete fMUONData;
132
133 return;
134}
135//____________________________________________________________________
136void AliMUONClusterReconstructor::Digits2Clusters()
137{
138//
139// Perform cluster finding
140//
141 TClonesArray *dig1, *dig2;
142 Int_t ndig, k;
143 dig1 = new TClonesArray("AliMUONDigit",1000);
144 dig2 = new TClonesArray("AliMUONDigit",1000);
145 AliMUONDigit *digit;
146// Loop on chambers and on cathode planes
147//
148// fMUONData->ResetRawClusters();
149 TClonesArray * muonDigits;
150
151 for (Int_t ich = 0; ich < 10; ich++) {
152 AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
153 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
154 //AliMUONClusterFinderAZ* rec = (AliMUONClusterFinderAZ*)iChamber->ReconstructionModel();
155
156 fMUONData->ResetDigits();
157 fMUONData->GetCathode(0);
158 //TClonesArray *
159 muonDigits = fMUONData->Digits(ich);
160 ndig=muonDigits->GetEntriesFast();
e516b01d 161 if(fDebug)
162 printf("1 Found %d digits in %p chamber %d\n", ndig, (void*)muonDigits,ich);
52c9bc11 163 TClonesArray &lhits1 = *dig1;
164 Int_t n = 0;
165 for (k = 0; k < ndig; k++) {
166 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
167 if (rec->TestTrack(digit->Track(0)))
168 new(lhits1[n++]) AliMUONDigit(*digit);
169 }
170 fMUONData->ResetDigits();
171 fMUONData->GetCathode(1);
172 muonDigits = fMUONData->Digits(ich);
173 ndig=muonDigits->GetEntriesFast();
e516b01d 174 if(fDebug)
175 printf("\n 2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich);
52c9bc11 176 TClonesArray &lhits2 = *dig2;
177 n=0;
178
179 for (k=0; k<ndig; k++) {
180 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
181 if (rec->TestTrack(digit->Track(0)))
182 new(lhits2[n++]) AliMUONDigit(*digit);
183 }
184
185 if (rec) {
186 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
187 rec->FindRawClusters();
188 }
189 // copy into the container
190 TClonesArray* tmp = rec->GetRawClusters();
191 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
192 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
193 fMUONData->AddRawCluster(ich, *pClus);
194 }
195 dig1->Delete();
196 dig2->Delete();
197 } // for ich
198 delete dig1;
199 delete dig2;
200}
cf464691 201
202//____________________________________________________________________
203void AliMUONClusterReconstructor::Digits2Clusters(AliRawReader* /*rawReader*/)
204{
205
206// Perform cluster finding form raw data
207
e516b01d 208 Fatal("Digits2Clusters","clusterization not implemented for raw data input");
cf464691 209}