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