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