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