4c039060 |
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 | **************************************************************************/ |
4c039060 |
15 | |
88cb7938 |
16 | /* $Id$ */ |
17 | |
a9e2aefa |
18 | |
19 | /////////////////////////////////////////////// |
fe4da5cc |
20 | // Manager and hits classes for set:MUON // |
21 | //////////////////////////////////////////////// |
22 | |
88cb7938 |
23 | #include "Riostream.h" |
24 | |
25 | #include <AliPDG.h> |
a897a37a |
26 | #include <TBRIK.h> |
88cb7938 |
27 | #include <TCanvas.h> |
28 | #include <TDirectory.h> |
29 | #include <TFile.h> |
94de3818 |
30 | #include <TGeometry.h> |
88cb7938 |
31 | #include <TMinuit.h> |
fe4da5cc |
32 | #include <TNode.h> |
88cb7938 |
33 | #include <TNtuple.h> |
fe4da5cc |
34 | #include <TObjArray.h> |
88cb7938 |
35 | #include <TObject.h> |
36 | #include <TObjectTable.h> |
37 | #include <TPad.h> |
a897a37a |
38 | #include <TParticle.h> |
39 | #include <TROOT.h> |
88cb7938 |
40 | #include <TRandom.h> |
41 | #include <TRotMatrix.h> |
42 | #include <TTUBE.h> |
a9e2aefa |
43 | #include <TTUBE.h> |
88cb7938 |
44 | #include <TTree.h> |
45 | #include <TVector.h> |
46 | #include <TVirtualMC.h> |
fe4da5cc |
47 | |
88cb7938 |
48 | #include "AliConst.h" |
49 | #include "AliHeader.h" |
50 | #include "AliHitMap.h" |
51 | #include "AliLoader.h" |
3fa6cfdd |
52 | #include "AliMUONLoader.h" |
fe4da5cc |
53 | #include "AliMUON.h" |
88cb7938 |
54 | #include "AliMUONChamberTrigger.h" |
55 | #include "AliMUONClusterFinderVS.h" |
56 | #include "AliMUONClusterInput.h" |
57 | #include "AliMUONConstants.h" |
58 | #include "AliMUONDigit.h" |
59 | #include "AliMUONGlobalTrigger.h" |
a9e2aefa |
60 | #include "AliMUONHit.h" |
88cb7938 |
61 | #include "AliMUONHitMapA1.h" |
62 | #include "AliMUONLocalTrigger.h" |
63 | #include "AliMUONMerger.h" |
a9e2aefa |
64 | #include "AliMUONPadHit.h" |
a9e2aefa |
65 | #include "AliMUONRawCluster.h" |
88cb7938 |
66 | #include "AliMUONTransientDigit.h" |
ecfa008b |
67 | #include "AliMUONTriggerCircuit.h" |
a9e2aefa |
68 | #include "AliMUONTriggerDecision.h" |
88cb7938 |
69 | #include "AliRun.h" |
85a5290f |
70 | #include "AliMUONDigitizerv1.h" |
88cb7938 |
71 | |
a9e2aefa |
72 | |
73 | // Defaults parameters for Z positions of chambers |
74 | // taken from values for "stations" in AliMUON::AliMUON |
75 | // const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.}; |
76 | // and from array "dstation" in AliMUONv1::CreateGeometry |
77 | // Float_t dstation[5]={20., 20., 20, 20., 20.}; |
78 | // for tracking chambers, |
79 | // according to (Z1 = zch - dstation) and (Z2 = zch + dstation) |
80 | // for the first and second chambers in the station, respectively, |
81 | // and from "DTPLANES" in AliMUONv1::CreateGeometry |
82 | // const Float_t DTPLANES = 15.; |
83 | // for trigger chambers, |
84 | // according to (Z1 = zch) and (Z2 = zch + DTPLANES) |
85 | // for the first and second chambers in the station, respectively |
fe4da5cc |
86 | |
fe4da5cc |
87 | ClassImp(AliMUON) |
ce3f5e87 |
88 | //__________________________________________________________________ |
fe4da5cc |
89 | AliMUON::AliMUON() |
90 | { |
de05461e |
91 | // Default Constructor |
92 | // |
1bd28025 |
93 | fNCh = 0; |
94 | fNTrackingCh = 0; |
1bd26093 |
95 | fIshunt = 0; |
1bd28025 |
96 | fChambers = 0; |
ce3f5e87 |
97 | fTriggerCircuits = 0; |
1bd26093 |
98 | fAccMin = 0.; |
99 | fAccMax = 0.; |
100 | fAccCut = kFALSE; |
1cae9436 |
101 | fMerger = 0; |
edf34242 |
102 | fFileName = 0; |
aecb8bcd |
103 | fMUONData = 0; |
d652f85c |
104 | fSplitLevel = 0; |
fe4da5cc |
105 | } |
ce3f5e87 |
106 | //__________________________________________________________________ |
fe4da5cc |
107 | AliMUON::AliMUON(const char *name, const char *title) |
ce3f5e87 |
108 | : AliDetector(name,title) |
fe4da5cc |
109 | { |
110 | //Begin_Html |
111 | /* |
a897a37a |
112 | <img src="gif/alimuon.gif"> |
fe4da5cc |
113 | */ |
114 | //End_Html |
ce3f5e87 |
115 | fMUONData = 0x0; |
d652f85c |
116 | fSplitLevel= 0; |
ce3f5e87 |
117 | fIshunt = 0; |
f665c1ea |
118 | |
ce3f5e87 |
119 | fNCh = AliMUONConstants::NCh(); |
120 | fNTrackingCh = AliMUONConstants::NTrackingCh(); |
a897a37a |
121 | |
ce3f5e87 |
122 | SetMarkerColor(kRed);// |
a9e2aefa |
123 | // |
ce3f5e87 |
124 | // Creating List of Chambers |
a9e2aefa |
125 | Int_t ch; |
f665c1ea |
126 | fChambers = new TObjArray(AliMUONConstants::NCh()); |
a9e2aefa |
127 | // Loop over stations |
f665c1ea |
128 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
a9e2aefa |
129 | // Loop over 2 chambers in the station |
ce3f5e87 |
130 | for (Int_t stCH = 0; stCH < 2; stCH++) { |
131 | // |
132 | // |
133 | // Default Parameters for Muon Tracking Stations |
134 | ch = 2 * st + stCH; |
135 | if (ch < AliMUONConstants::NTrackingCh()) { |
136 | fChambers->AddAt(new AliMUONChamber(ch),ch); |
137 | } else { |
138 | fChambers->AddAt(new AliMUONChamberTrigger(ch),ch); |
139 | } |
140 | AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch); |
141 | chamber->SetGid(0); |
142 | // Default values for Z of chambers |
143 | chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch)); |
144 | // |
145 | chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch)); |
146 | // Set chamber inner and outer radius to default |
147 | chamber->SetRInner(AliMUONConstants::Dmin(st)/2); |
148 | chamber->SetROuter(AliMUONConstants::Dmax(st)/2); |
149 | // |
150 | } // Chamber stCH (0, 1) in |
a9e2aefa |
151 | } // Station st (0...) |
ce3f5e87 |
152 | |
1391e633 |
153 | // Negatives values are ignored by geant3 CONS200 in the calculation of the tracking parameters |
154 | fMaxStepGas=0.1; |
155 | fMaxStepAlu=0.1; |
a9e2aefa |
156 | fMaxDestepGas=-1; |
157 | fMaxDestepAlu=-1; |
ce3f5e87 |
158 | |
159 | fMaxIterPad = 0; |
160 | fCurIterPad = 0; |
161 | |
162 | fAccMin = 0.; |
163 | fAccMax = 0.; |
164 | fAccCut = kFALSE; |
165 | |
166 | // cp new design of AliMUONTriggerDecision |
167 | fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit()); |
168 | for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) { |
169 | fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ); |
170 | } |
171 | fMerger = 0; |
fe4da5cc |
172 | } |
ce3f5e87 |
173 | //____________________________________________________________________ |
50e97f19 |
174 | AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON) |
a9e2aefa |
175 | { |
176 | // Dummy copy constructor |
177 | ; |
178 | |
179 | } |
ce3f5e87 |
180 | //____________________________________________________________________ |
fe4da5cc |
181 | AliMUON::~AliMUON() |
182 | { |
de05461e |
183 | // Destructor |
ce3f5e87 |
184 | if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName()); |
185 | fIshunt = 0; |
186 | if (fMerger) delete fMerger; |
a897a37a |
187 | } |
ce3f5e87 |
188 | //____________________________________________________________________ |
fe4da5cc |
189 | void AliMUON::BuildGeometry() |
190 | { |
de05461e |
191 | // Geometry for event display |
5fd73042 |
192 | for (Int_t i=0; i<7; i++) { |
193 | for (Int_t j=0; j<2; j++) { |
194 | Int_t id=2*i+j+1; |
195 | this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); |
a897a37a |
196 | } |
5fd73042 |
197 | } |
fe4da5cc |
198 | } |
ce3f5e87 |
199 | //___________________________________________________________________ |
fe4da5cc |
200 | Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t ) |
201 | { |
ce3f5e87 |
202 | return 9999; |
fe4da5cc |
203 | } |
ce3f5e87 |
204 | //__________________________________________________________________ |
205 | void AliMUON::SetTreeAddress() |
a897a37a |
206 | { |
ce3f5e87 |
207 | GetMUONData()->SetLoader(fLoader); |
208 | GetMUONData()->SetTreeAddress("H,D,RC"); |
d652f85c |
209 | fHits = GetMUONData()->Hits(); // Added by Ivana to use the methods FisrtHit, NextHit of AliDetector |
a9e2aefa |
210 | } |
211 | |
ce3f5e87 |
212 | //____________________________________________________________________ |
a9e2aefa |
213 | void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2) |
214 | { |
de05461e |
215 | // Set the pad size for chamber id and cathode isec |
a9e2aefa |
216 | Int_t i=2*(id-1); |
2682e810 |
217 | ((AliMUONChamber*) fChambers->At(i)) ->SetPadSize(isec,p1,p2); |
218 | ((AliMUONChamber*) fChambers->At(i+1))->SetPadSize(isec,p1,p2); |
a897a37a |
219 | } |
220 | |
fe4da5cc |
221 | //___________________________________________ |
a9e2aefa |
222 | void AliMUON::SetChambersZ(const Float_t *Z) |
223 | { |
224 | // Set Z values for all chambers (tracking and trigger) |
225 | // from the array pointed to by "Z" |
f665c1ea |
226 | for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) |
2682e810 |
227 | ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]); |
f665c1ea |
228 | return; |
a9e2aefa |
229 | } |
ce3f5e87 |
230 | //_________________________________________________________________ |
a9e2aefa |
231 | void AliMUON::SetChambersZToDefault() |
fe4da5cc |
232 | { |
a9e2aefa |
233 | // Set Z values for all chambers (tracking and trigger) |
234 | // to default values |
f665c1ea |
235 | SetChambersZ(AliMUONConstants::DefaultChamberZ()); |
a9e2aefa |
236 | return; |
fe4da5cc |
237 | } |
ce3f5e87 |
238 | //_________________________________________________________________ |
a897a37a |
239 | void AliMUON::SetChargeSlope(Int_t id, Float_t p1) |
fe4da5cc |
240 | { |
de05461e |
241 | // Set the inverse charge slope for chamber id |
ce3f5e87 |
242 | Int_t i=2*(id-1); //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1); |
243 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1); |
2682e810 |
244 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1); |
245 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1); |
fe4da5cc |
246 | } |
ce3f5e87 |
247 | //__________________________________________________________________ |
a897a37a |
248 | void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2) |
fe4da5cc |
249 | { |
de05461e |
250 | // Set sigma of charge spread for chamber id |
fe4da5cc |
251 | Int_t i=2*(id-1); |
2682e810 |
252 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2); |
253 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2); |
fe4da5cc |
254 | } |
ce3f5e87 |
255 | //___________________________________________________________________ |
a897a37a |
256 | void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1) |
fe4da5cc |
257 | { |
de05461e |
258 | // Set integration limits for charge spread |
fe4da5cc |
259 | Int_t i=2*(id-1); |
2682e810 |
260 | ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1); |
261 | ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1); |
fe4da5cc |
262 | } |
263 | |
ce3f5e87 |
264 | //__________________________________________________________________ |
d09fafb0 |
265 | void AliMUON::SetMaxAdc(Int_t id, Int_t p1) |
fe4da5cc |
266 | { |
de05461e |
267 | // Set maximum number for ADCcounts (saturation) |
fe4da5cc |
268 | Int_t i=2*(id-1); |
2682e810 |
269 | ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1); |
270 | ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1); |
fe4da5cc |
271 | } |
ce3f5e87 |
272 | //__________________________________________________________________ |
a897a37a |
273 | void AliMUON::SetMaxStepGas(Float_t p1) |
fe4da5cc |
274 | { |
de05461e |
275 | // Set stepsize in gas |
ce3f5e87 |
276 | fMaxStepGas=p1; |
fe4da5cc |
277 | } |
ce3f5e87 |
278 | //__________________________________________________________________ |
a897a37a |
279 | void AliMUON::SetMaxStepAlu(Float_t p1) |
fe4da5cc |
280 | { |
de05461e |
281 | // Set step size in Alu |
fe4da5cc |
282 | fMaxStepAlu=p1; |
283 | } |
ce3f5e87 |
284 | //__________________________________________________________________ |
a897a37a |
285 | void AliMUON::SetMaxDestepGas(Float_t p1) |
fe4da5cc |
286 | { |
de05461e |
287 | // Set maximum step size in Gas |
fe4da5cc |
288 | fMaxDestepGas=p1; |
289 | } |
ce3f5e87 |
290 | //__________________________________________________________________ |
a897a37a |
291 | void AliMUON::SetMaxDestepAlu(Float_t p1) |
fe4da5cc |
292 | { |
de05461e |
293 | // Set maximum step size in Alu |
ce3f5e87 |
294 | fMaxDestepAlu=p1; |
fe4da5cc |
295 | } |
ce3f5e87 |
296 | //___________________________________________________________________ |
5c1f55c5 |
297 | void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax) |
fe4da5cc |
298 | { |
de05461e |
299 | // Set acceptance cuts |
ce3f5e87 |
300 | fAccCut=acc; |
301 | fAccMin=angmin*TMath::Pi()/180; |
302 | fAccMax=angmax*TMath::Pi()/180; |
303 | Int_t ch; |
304 | if (acc) { |
305 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
306 | // Loop over 2 chambers in the station |
307 | for (Int_t stCH = 0; stCH < 2; stCH++) { |
308 | ch = 2 * st + stCH; |
309 | // Set chamber inner and outer radius according to acceptance cuts |
b13a15bc |
310 | Chamber(ch).SetRInner(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin))); |
311 | Chamber(ch).SetROuter(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax))); |
ce3f5e87 |
312 | } // chamber loop |
313 | } // station loop |
314 | } |
fe4da5cc |
315 | } |
ce3f5e87 |
316 | //____________________________________________________________________ |
a30a000f |
317 | void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation) |
fe4da5cc |
318 | { |
de05461e |
319 | // Set the segmentation for chamber id cathode isec |
2682e810 |
320 | ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation); |
fe4da5cc |
321 | |
322 | } |
ce3f5e87 |
323 | //____________________________________________________________________ |
a9e2aefa |
324 | void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response) |
fe4da5cc |
325 | { |
de05461e |
326 | // Set the response for chamber id |
2682e810 |
327 | ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response); |
fe4da5cc |
328 | } |
ce3f5e87 |
329 | //____________________________________________________________________ |
30aaba74 |
330 | void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst) |
a897a37a |
331 | { |
de05461e |
332 | // Set ClusterFinder for chamber id |
2682e810 |
333 | ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst); |
a897a37a |
334 | } |
ce3f5e87 |
335 | //____________________________________________________________________ |
fe4da5cc |
336 | void AliMUON::SetNsec(Int_t id, Int_t nsec) |
337 | { |
de05461e |
338 | // Set number of segmented cathods for chamber id |
2682e810 |
339 | ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec); |
fe4da5cc |
340 | } |
85a5290f |
341 | //____________________________________________________________________ |
c92eb8ad |
342 | AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f |
343 | { |
344 | return new AliMUONDigitizerv1(manager); |
345 | } |
ce3f5e87 |
346 | //_____________________________________________________________________ |
2ab0c725 |
347 | void AliMUON::SDigits2Digits() |
348 | { |
d963c261 |
349 | |
350 | // write TreeD here |
351 | |
352 | if (!fMerger) { |
353 | if (gAlice->GetDebug()>0) { |
354 | cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl; |
355 | cerr<<" no merging, just digitization of 1 event will be done"<<endl; |
356 | } |
357 | fMerger = new AliMUONMerger(); |
2ab0c725 |
358 | } |
d963c261 |
359 | fMerger->Init(); |
360 | fMerger->Digitise(); |
361 | char hname[30]; |
88cb7938 |
362 | // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent()); |
363 | fLoader->TreeD()->Write(hname,TObject::kOverwrite); |
364 | fLoader->TreeD()->Reset(); |
2ab0c725 |
365 | } |
a9e2aefa |
366 | |
ce3f5e87 |
367 | //_______________________________________________________________________ |
3fa6cfdd |
368 | AliLoader* AliMUON::MakeLoader(const char* topfoldername) |
369 | { |
370 | //builds standard getter (AliLoader type) |
371 | //if detector wants to use castomized getter, it must overload this method |
372 | |
373 | if (GetDebug()) |
374 | Info("MakeLoader", |
375 | "Creating standard getter for detector %s. Top folder is %s.", |
376 | GetName(),topfoldername); |
377 | |
128843d9 |
378 | fLoader = new AliLoader(GetName(),topfoldername); |
ce3f5e87 |
379 | fMUONData = new AliMUONData(fLoader,GetName(),GetName()); |
d652f85c |
380 | fMUONData->SetSplitLevel(fSplitLevel); |
3fa6cfdd |
381 | return fLoader; |
382 | } |
a897a37a |
383 | |
ce3f5e87 |
384 | //_______________________________________________________________________ |
a9e2aefa |
385 | void AliMUON::Trigger(Int_t nev){ |
386 | // call the Trigger Algorithm and fill TreeR |
387 | |
388 | Int_t singlePlus[3] = {0,0,0}; |
389 | Int_t singleMinus[3] = {0,0,0}; |
390 | Int_t singleUndef[3] = {0,0,0}; |
391 | Int_t pairUnlike[3] = {0,0,0}; |
392 | Int_t pairLike[3] = {0,0,0}; |
ce3f5e87 |
393 | |
a9e2aefa |
394 | ResetTrigger(); |
a9e2aefa |
395 | AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1); |
396 | decision->Trigger(); |
397 | decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef, |
398 | pairUnlike, pairLike); |
ce3f5e87 |
399 | |
400 | // add a local trigger in the list |
401 | GetMUONData()->AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); |
9ae15266 |
402 | Int_t i; |
a9e2aefa |
403 | |
f665c1ea |
404 | for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) { |
ce3f5e87 |
405 | if(decision->GetITrigger(icirc)==1) { |
406 | Int_t localtr[7]={0,0,0,0,0,0,0}; |
407 | Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0}; |
408 | decision->GetLutOutput(icirc, loLpt, loHpt, loApt); |
409 | localtr[0] = icirc; |
410 | localtr[1] = decision->GetStripX11(icirc); |
411 | localtr[2] = decision->GetDev(icirc); |
412 | localtr[3] = decision->GetStripY11(icirc); |
413 | for (i=0; i<2; i++) { // convert the Lut output in 1 digit |
414 | localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i)); |
415 | localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i)); |
416 | localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i)); |
a897a37a |
417 | } |
ce3f5e87 |
418 | GetMUONData()->AddLocalTrigger(localtr); // add a local trigger in the list |
419 | } |
a9e2aefa |
420 | } |
ce3f5e87 |
421 | |
a9e2aefa |
422 | delete decision; |
bf17dbfd |
423 | |
ba9436c6 |
424 | // fLoader->TreeR()->Fill(); |
1a1cdff8 |
425 | GetMUONData()->Fill("GLT"); //Filling Global and Local Trigger GLT |
ce3f5e87 |
426 | // char hname[30]; |
427 | // sprintf(hname,"TreeR%d",nev); |
428 | // fLoader->TreeR()->Write(hname,TObject::kOverwrite); |
bf17dbfd |
429 | // fLoader->TreeR()->Reset(); |
88cb7938 |
430 | fLoader->WriteRecPoints("OVERWRITE"); |
88cb7938 |
431 | |
a9e2aefa |
432 | printf("\n End of trigger for event %d", nev); |
a897a37a |
433 | } |
a897a37a |
434 | |
ce3f5e87 |
435 | //____________________________________________________________________ |
fe311ef1 |
436 | void AliMUON::Digits2Reco() |
437 | { |
438 | FindClusters(); |
e365e1ee |
439 | Int_t nev = gAlice->GetHeader()->GetEvent(); |
1a1cdff8 |
440 | GetMUONData()->Fill("RC"); //Filling Reconstructed Cluster |
88cb7938 |
441 | fLoader->WriteRecPoints("OVERWRITE"); |
ce3f5e87 |
442 | GetMUONData()->ResetRawClusters(); |
1a1cdff8 |
443 | Info("Digits2Reco","End of cluster finding for event %d", nev); |
fe311ef1 |
444 | } |
ce3f5e87 |
445 | //____________________________________________________________________ |
fe311ef1 |
446 | void AliMUON::FindClusters() |
a9e2aefa |
447 | { |
de05461e |
448 | // |
449 | // Perform cluster finding |
450 | // |
a9e2aefa |
451 | TClonesArray *dig1, *dig2; |
452 | Int_t ndig, k; |
453 | dig1 = new TClonesArray("AliMUONDigit",1000); |
454 | dig2 = new TClonesArray("AliMUONDigit",1000); |
455 | AliMUONDigit *digit; |
a9e2aefa |
456 | // Loop on chambers and on cathode planes |
a897a37a |
457 | // |
fe311ef1 |
458 | ResetRawClusters(); |
88cb7938 |
459 | TClonesArray * muonDigits; |
460 | |
1bd28025 |
461 | for (Int_t ich = 0; ich < 10; ich++) { |
2682e810 |
462 | //PH AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich]; |
463 | AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich); |
fe311ef1 |
464 | AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel(); |
465 | |
88cb7938 |
466 | ResetDigits(); |
1a1cdff8 |
467 | GetMUONData()->GetCathode(0); |
88cb7938 |
468 | //TClonesArray * |
1a1cdff8 |
469 | muonDigits = GetMUONData()->Digits(ich); |
a9e2aefa |
470 | ndig=muonDigits->GetEntriesFast(); |
88cb7938 |
471 | printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich); |
a9e2aefa |
472 | TClonesArray &lhits1 = *dig1; |
1bd28025 |
473 | Int_t n = 0; |
474 | for (k = 0; k < ndig; k++) { |
475 | digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); |
476 | if (rec->TestTrack(digit->Track(0))) |
a9e2aefa |
477 | new(lhits1[n++]) AliMUONDigit(*digit); |
478 | } |
1a1cdff8 |
479 | GetMUONData()->ResetDigits(); |
480 | GetMUONData()->GetCathode(1); |
481 | muonDigits = GetMUONData()->Digits(ich); |
a9e2aefa |
482 | ndig=muonDigits->GetEntriesFast(); |
483 | printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich); |
484 | TClonesArray &lhits2 = *dig2; |
485 | n=0; |
486 | |
487 | for (k=0; k<ndig; k++) { |
488 | digit= (AliMUONDigit*) muonDigits->UncheckedAt(k); |
1bd28025 |
489 | if (rec->TestTrack(digit->Track(0))) |
a9e2aefa |
490 | new(lhits2[n++]) AliMUONDigit(*digit); |
a897a37a |
491 | } |
a897a37a |
492 | |
9825400f |
493 | if (rec) { |
494 | AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); |
a9e2aefa |
495 | rec->FindRawClusters(); |
496 | } |
497 | dig1->Delete(); |
498 | dig2->Delete(); |
499 | } // for ich |
a9e2aefa |
500 | delete dig1; |
501 | delete dig2; |
a897a37a |
502 | } |
ce3f5e87 |
503 | //______________________________________________________________________ |
2ab0c725 |
504 | #ifdef never |
ce3f5e87 |
505 | void AliMUON::Streamer(TBuffer &R__b)_ |
fe4da5cc |
506 | { |
507 | // Stream an object of class AliMUON. |
a30a000f |
508 | AliMUONChamber *iChamber; |
a9e2aefa |
509 | AliMUONTriggerCircuit *iTriggerCircuit; |
a30a000f |
510 | AliSegmentation *segmentation; |
511 | AliMUONResponse *response; |
512 | TClonesArray *digitsaddress; |
513 | TClonesArray *rawcladdress; |
9ae15266 |
514 | Int_t i; |
9ae15266 |
515 | if (R__b.IsReading()) { |
516 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } |
517 | AliDetector::Streamer(R__b); |
518 | R__b >> fNPadHits; |
519 | R__b >> fPadHits; // diff |
520 | R__b >> fNLocalTrigger; |
521 | R__b >> fLocalTrigger; |
522 | R__b >> fNGlobalTrigger; |
523 | R__b >> fGlobalTrigger; |
524 | R__b >> fDchambers; |
525 | R__b >> fRawClusters; |
526 | R__b.ReadArray(fNdch); |
527 | R__b.ReadArray(fNrawch); |
528 | R__b >> fAccCut; |
529 | R__b >> fAccMin; |
530 | R__b >> fAccMax; |
531 | R__b >> fChambers; |
532 | R__b >> fTriggerCircuits; |
f665c1ea |
533 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 |
534 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
535 | iTriggerCircuit->Streamer(R__b); |
fe4da5cc |
536 | } |
9ae15266 |
537 | // Stream chamber related information |
f665c1ea |
538 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 |
539 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
540 | iChamber->Streamer(R__b); |
541 | if (iChamber->Nsec()==1) { |
542 | segmentation=iChamber->SegmentationModel(1); |
543 | if (segmentation) |
544 | segmentation->Streamer(R__b); |
545 | } else { |
546 | segmentation=iChamber->SegmentationModel(1); |
547 | if (segmentation) |
548 | segmentation->Streamer(R__b); |
549 | if (segmentation) |
550 | segmentation=iChamber->SegmentationModel(2); |
551 | segmentation->Streamer(R__b); |
552 | } |
553 | response=iChamber->ResponseModel(); |
554 | if (response) |
555 | response->Streamer(R__b); |
556 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
557 | digitsaddress->Streamer(R__b); |
f665c1ea |
558 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 |
559 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
560 | rawcladdress->Streamer(R__b); |
561 | } |
a9e2aefa |
562 | } |
9ae15266 |
563 | |
564 | } else { |
565 | R__b.WriteVersion(AliMUON::IsA()); |
566 | AliDetector::Streamer(R__b); |
567 | R__b << fNPadHits; |
568 | R__b << fPadHits; // diff |
569 | R__b << fNLocalTrigger; |
570 | R__b << fLocalTrigger; |
571 | R__b << fNGlobalTrigger; |
572 | R__b << fGlobalTrigger; |
573 | R__b << fDchambers; |
574 | R__b << fRawClusters; |
f665c1ea |
575 | R__b.WriteArray(fNdch, AliMUONConstants::NCh()); |
576 | R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh()); |
9ae15266 |
577 | |
578 | R__b << fAccCut; |
579 | R__b << fAccMin; |
580 | R__b << fAccMax; |
581 | |
582 | R__b << fChambers; |
583 | R__b << fTriggerCircuits; |
f665c1ea |
584 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 |
585 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
586 | iTriggerCircuit->Streamer(R__b); |
fe4da5cc |
587 | } |
f665c1ea |
588 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 |
589 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
590 | iChamber->Streamer(R__b); |
591 | if (iChamber->Nsec()==1) { |
592 | segmentation=iChamber->SegmentationModel(1); |
593 | if (segmentation) |
594 | segmentation->Streamer(R__b); |
595 | } else { |
596 | segmentation=iChamber->SegmentationModel(1); |
597 | if (segmentation) |
598 | segmentation->Streamer(R__b); |
599 | segmentation=iChamber->SegmentationModel(2); |
600 | if (segmentation) |
601 | segmentation->Streamer(R__b); |
602 | } |
603 | response=iChamber->ResponseModel(); |
604 | if (response) |
605 | response->Streamer(R__b); |
606 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
607 | digitsaddress->Streamer(R__b); |
f665c1ea |
608 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 |
609 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
610 | rawcladdress->Streamer(R__b); |
611 | } |
a9e2aefa |
612 | } |
fe4da5cc |
613 | } |
fe4da5cc |
614 | } |
2ab0c725 |
615 | #endif |
ce3f5e87 |
616 | //_______________________________________________________________________ |
a9e2aefa |
617 | AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters) |
fe4da5cc |
618 | { |
5a35ac13 |
619 | // to be removed |
fe4da5cc |
620 | // Initialise the pad iterator |
621 | // Return the address of the first padhit for hit |
a897a37a |
622 | TClonesArray *theClusters = clusters; |
fe4da5cc |
623 | Int_t nclust = theClusters->GetEntriesFast(); |
1bd28025 |
624 | if (nclust && hit->PHlast() > 0) { |
625 | AliMUON::fMaxIterPad=hit->PHlast(); |
626 | AliMUON::fCurIterPad=hit->PHfirst(); |
a9e2aefa |
627 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); |
fe4da5cc |
628 | } else { |
629 | return 0; |
630 | } |
631 | } |
ce3f5e87 |
632 | //_______________________________________________________________________ |
a9e2aefa |
633 | AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters) |
fe4da5cc |
634 | { |
5a35ac13 |
635 | // To be removed |
de05461e |
636 | // Get next pad (in iterator) |
637 | // |
a9e2aefa |
638 | AliMUON::fCurIterPad++; |
639 | if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) { |
640 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); |
fe4da5cc |
641 | } else { |
642 | return 0; |
643 | } |
644 | } |
ce3f5e87 |
645 | //_______________________________________________________________________ |
a897a37a |
646 | |
647 | AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster) |
648 | { |
de05461e |
649 | // |
650 | // Return rawcluster (icluster) for chamber ichamber and cathode icathod |
651 | // Obsolete ?? |
ce3f5e87 |
652 | TClonesArray *muonRawCluster = GetMUONData()->RawClusters(ichamber); |
a897a37a |
653 | ResetRawClusters(); |
88cb7938 |
654 | TTree *treeR = fLoader->TreeR(); |
a9e2aefa |
655 | Int_t nent=(Int_t)treeR->GetEntries(); |
656 | treeR->GetEvent(nent-2+icathod-1); |
657 | //treeR->GetEvent(icathod); |
658 | //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast(); |
a897a37a |
659 | |
a9e2aefa |
660 | AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster); |
a897a37a |
661 | //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw); |
662 | |
663 | return mRaw; |
664 | } |
ce3f5e87 |
665 | //________________________________________________________________________ |
1cae9436 |
666 | void AliMUON::SetMerger(AliMUONMerger* merger) |
667 | { |
668 | // Set pointer to merger |
669 | fMerger = merger; |
670 | } |
ce3f5e87 |
671 | //________________________________________________________________________ |
1cae9436 |
672 | AliMUONMerger* AliMUON::Merger() |
673 | { |
674 | // Return pointer to merger |
675 | return fMerger; |
676 | } |
ce3f5e87 |
677 | //________________________________________________________________________ |
50e97f19 |
678 | AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/) |
a897a37a |
679 | { |
a9e2aefa |
680 | // copy operator |
681 | // dummy version |
682 | return *this; |
a897a37a |
683 | } |
684 | |