]>
Commit | Line | Data |
---|---|---|
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 | 39 | ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context |
dd20215d | 40 | |
52c9bc11 | 41 | //__________________________________________________________________________ |
dd20215d | 42 | AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONData* data) |
43 | : TObject(), | |
44 | fMUONData(data), | |
45 | fRecModel(new AliMUONClusterFinderVS()), | |
46 | fDigitsCath0(new TClonesArray("AliMUONDigit",1000)), | |
47 | fDigitsCath1(new TClonesArray("AliMUONDigit",1000)) | |
52c9bc11 | 48 | { |
30178c30 | 49 | // Standard Constructor |
52c9bc11 | 50 | |
dd20215d | 51 | fDigitsCath0->SetOwner(kTRUE); |
52 | fDigitsCath1->SetOwner(kTRUE); | |
52c9bc11 | 53 | } |
30178c30 | 54 | |
52c9bc11 | 55 | //_______________________________________________________________________ |
30178c30 | 56 | AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs) |
57 | : TObject(rhs) | |
52c9bc11 | 58 | { |
30178c30 | 59 | // Protected copy constructor |
60 | ||
8c343c7c | 61 | AliFatal("Not implemented."); |
52c9bc11 | 62 | } |
63 | ||
30178c30 | 64 | //_______________________________________________________________________ |
65 | AliMUONClusterReconstructor & | |
66 | AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs) | |
52c9bc11 | 67 | { |
30178c30 | 68 | // Protected assignement operator |
69 | ||
70 | if (this == &rhs) return *this; | |
71 | ||
8c343c7c | 72 | AliFatal("Not implemented."); |
30178c30 | 73 | |
74 | return *this; | |
52c9bc11 | 75 | } |
76 | ||
77 | //__________________________________________________________________________ | |
78 | AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void) | |
79 | { | |
dd20215d | 80 | delete fRecModel; |
81 | delete fDigitsCath0; | |
82 | delete fDigitsCath1; | |
83 | } | |
7e4a628d | 84 | |
dd20215d | 85 | //______________________________________________________________________________ |
86 | void | |
87 | AliMUONClusterReconstructor::CheckSize(TClonesArray& a) | |
88 | { | |
89 | // | |
90 | // Check if one can adds a new element, or if a is already full. | |
91 | // If full, it is resized. | |
92 | // | |
93 | if ( a.GetLast()+1 >= a.GetSize() ) | |
94 | { | |
95 | AliInfo(Form("Increasing array size from %d to %d", | |
96 | a.GetSize(),a.GetSize()*2)); | |
97 | a.Expand(a.GetSize()*2); | |
98 | } | |
99 | } | |
52c9bc11 | 100 | |
dd20215d | 101 | //______________________________________________________________________________ |
102 | void | |
103 | AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId) | |
104 | { | |
105 | // | |
106 | // Clusterize one detection element, and let fMUONData know about | |
107 | // the results. | |
108 | // | |
109 | ||
110 | if ( fDigitsCath0->GetEntriesFast() || fDigitsCath1->GetEntriesFast() ) | |
111 | { | |
112 | Int_t iChamber = detElemId/100 - 1; | |
113 | AliMUONClusterInput::Instance()->SetDigits(iChamber, detElemId, | |
114 | fDigitsCath0,fDigitsCath1); | |
115 | AliDebug(3,Form("ClusterizeOneDE iChamber=%d DE=%d",iChamber,detElemId)); | |
116 | StdoutToAliDebug(3,cout << "DigitsCath0=" << endl; | |
117 | fDigitsCath0->Print(); | |
118 | cout << "DigitsCath1=" << endl; | |
119 | fDigitsCath1->Print();); | |
120 | fRecModel->FindRawClusters(); | |
121 | ||
122 | // copy results into the output container | |
123 | TClonesArray* tmp = fRecModel->GetRawClusters(); | |
124 | for (Int_t id = 0; id < tmp->GetEntriesFast(); ++id) | |
125 | { | |
126 | AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id); | |
127 | fMUONData->AddRawCluster(iChamber, *pClus); | |
128 | } | |
129 | ||
130 | // Reset the arrays | |
131 | fDigitsCath0->Clear("C"); | |
132 | fDigitsCath1->Clear("C"); | |
133 | } | |
52c9bc11 | 134 | } |
dd20215d | 135 | |
52c9bc11 | 136 | //____________________________________________________________________ |
cc87ebcd | 137 | void AliMUONClusterReconstructor::Digits2Clusters(Int_t chBeg) |
a713db22 | 138 | { |
dd20215d | 139 | // |
140 | // Clusterize all the tracking chamber digits. | |
141 | // | |
142 | // For each chamber, we loop *once* on that chamber digits, and store them | |
143 | // in 2 temporary arrays (one pair of arrays per detection element, | |
144 | // one array per cathode). Once a pair of arrays is full (i.e. all the digits | |
145 | // of that detection element have been stored), we clusterize this DE, and | |
146 | // move to the next one. | |
147 | // | |
a713db22 | 148 | |
dd20215d | 149 | if (!fRecModel) |
150 | { | |
151 | AliWarning("No reco model defined. Nothing to do..."); | |
152 | return; | |
153 | } | |
154 | ||
155 | Int_t iChamber(-1); | |
156 | Int_t currentDE(-1); | |
157 | ||
158 | // Loop on chambers | |
159 | for ( iChamber = chBeg; iChamber < AliMUONConstants::NTrackingCh(); ++iChamber ) | |
160 | { | |
161 | TClonesArray* muonDigits = fMUONData->Digits(iChamber); | |
162 | ||
163 | Int_t ndig = muonDigits->GetEntriesFast(); | |
164 | if (!ndig) continue; | |
165 | ||
166 | muonDigits->Sort(); // the sort *must* be per DE (at least), otherwise | |
167 | // the following logic with currentDE will fail. | |
168 | ||
169 | currentDE = -1; // initialize the DE counter (that is used to track | |
170 | // when we change of DE in the following loop over | |
171 | // all digits) to an invalid value. | |
172 | ||
173 | for ( Int_t k = 0; k < ndig; ++k ) | |
174 | { | |
175 | AliMUONDigit* digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
176 | if ( ! digit->Signal() > 0 ) continue; // skip void digits. | |
177 | ||
178 | if ( digit->DetElemId() != currentDE ) | |
179 | { | |
180 | AliDebug(3,Form("Switching DE from %d to %d",currentDE,digit->DetElemId())); | |
181 | // we get to a new DE, so clusterize the previous one before | |
182 | // moving on. | |
183 | ClusterizeOneDE(currentDE); | |
184 | currentDE = digit->DetElemId(); | |
a713db22 | 185 | } |
dd20215d | 186 | |
187 | // Add the digit to the array with the right cathode number. | |
188 | if (digit->Cathode() == 0) | |
189 | { | |
190 | CheckSize(*fDigitsCath0); | |
191 | new((*fDigitsCath0)[fDigitsCath0->GetLast()+1]) AliMUONDigit(*digit); | |
192 | } | |
193 | else | |
194 | { | |
195 | CheckSize(*fDigitsCath1); | |
196 | new((*fDigitsCath1)[fDigitsCath1->GetLast()+1]) AliMUONDigit(*digit); | |
197 | } | |
198 | } // end of loop on chamber digits | |
199 | ||
200 | // As the above logic is based on detecting a change in DE number, | |
201 | // the last DE of each chamber has not been clusterized, so we do | |
202 | // it here. | |
203 | ClusterizeOneDE(currentDE); | |
204 | } // end of loop over chambers | |
52c9bc11 | 205 | } |
cf464691 | 206 | |
dd20215d | 207 | //_______________________________________________________________________ |
208 | void | |
209 | AliMUONClusterReconstructor::SetRecoModel(AliMUONClusterFinderVS* rec) | |
210 | { | |
211 | delete fRecModel; | |
212 | fRecModel = rec; | |
213 | } | |
214 | ||
7e4a628d | 215 | //_______________________________________________________________________ |
216 | void AliMUONClusterReconstructor::Trigger2Trigger() | |
217 | { | |
218 | // copy trigger from TreeD to TreeR | |
cc87ebcd | 219 | |
220 | fMUONData->SetTreeAddress("GLT"); | |
7e4a628d | 221 | fMUONData->GetTriggerD(); |
222 | } |