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" |
fe4da5cc |
52 | #include "AliMUON.h" |
88cb7938 |
53 | #include "AliMUONChamberTrigger.h" |
54 | #include "AliMUONClusterFinderVS.h" |
55 | #include "AliMUONClusterInput.h" |
56 | #include "AliMUONConstants.h" |
57 | #include "AliMUONDigit.h" |
58 | #include "AliMUONGlobalTrigger.h" |
a9e2aefa |
59 | #include "AliMUONHit.h" |
88cb7938 |
60 | #include "AliMUONHitMapA1.h" |
61 | #include "AliMUONLocalTrigger.h" |
62 | #include "AliMUONMerger.h" |
a9e2aefa |
63 | #include "AliMUONPadHit.h" |
a9e2aefa |
64 | #include "AliMUONRawCluster.h" |
88cb7938 |
65 | #include "AliMUONTransientDigit.h" |
ecfa008b |
66 | #include "AliMUONTriggerCircuit.h" |
a9e2aefa |
67 | #include "AliMUONTriggerDecision.h" |
88cb7938 |
68 | #include "AliRun.h" |
69 | |
a9e2aefa |
70 | |
71 | // Defaults parameters for Z positions of chambers |
72 | // taken from values for "stations" in AliMUON::AliMUON |
73 | // const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.}; |
74 | // and from array "dstation" in AliMUONv1::CreateGeometry |
75 | // Float_t dstation[5]={20., 20., 20, 20., 20.}; |
76 | // for tracking chambers, |
77 | // according to (Z1 = zch - dstation) and (Z2 = zch + dstation) |
78 | // for the first and second chambers in the station, respectively, |
79 | // and from "DTPLANES" in AliMUONv1::CreateGeometry |
80 | // const Float_t DTPLANES = 15.; |
81 | // for trigger chambers, |
82 | // according to (Z1 = zch) and (Z2 = zch + DTPLANES) |
83 | // for the first and second chambers in the station, respectively |
fe4da5cc |
84 | |
fe4da5cc |
85 | ClassImp(AliMUON) |
fe4da5cc |
86 | //___________________________________________ |
87 | AliMUON::AliMUON() |
88 | { |
de05461e |
89 | // Default Constructor |
90 | // |
1bd28025 |
91 | fNCh = 0; |
92 | fNTrackingCh = 0; |
1bd26093 |
93 | fIshunt = 0; |
1bd26093 |
94 | fPadHits = 0; |
95 | fNPadHits = 0; |
1bd28025 |
96 | fChambers = 0; |
1bd26093 |
97 | fDchambers = 0; |
1bd28025 |
98 | fTriggerCircuits = 0; |
1bd26093 |
99 | fNdch = 0; |
100 | fRawClusters = 0; |
101 | fNrawch = 0; |
102 | fGlobalTrigger = 0; |
103 | fNLocalTrigger = 0; |
104 | fLocalTrigger = 0; |
105 | fNLocalTrigger = 0; |
106 | fAccMin = 0.; |
107 | fAccMax = 0.; |
108 | fAccCut = kFALSE; |
1cae9436 |
109 | fMerger = 0; |
edf34242 |
110 | fFileName = 0; |
fe4da5cc |
111 | } |
112 | |
113 | //___________________________________________ |
114 | AliMUON::AliMUON(const char *name, const char *title) |
115 | : AliDetector(name,title) |
116 | { |
117 | //Begin_Html |
118 | /* |
a897a37a |
119 | <img src="gif/alimuon.gif"> |
fe4da5cc |
120 | */ |
121 | //End_Html |
f665c1ea |
122 | |
a9e2aefa |
123 | fHits = new TClonesArray("AliMUONHit",1000); |
1cedd08a |
124 | gAlice->AddHitList(fHits); |
a9e2aefa |
125 | fPadHits = new TClonesArray("AliMUONPadHit",10000); |
126 | fNPadHits = 0; |
fe4da5cc |
127 | fIshunt = 0; |
128 | |
1bd28025 |
129 | fNCh = AliMUONConstants::NCh(); |
1bd26093 |
130 | fNTrackingCh = AliMUONConstants::NTrackingCh(); |
1bd28025 |
131 | fNdch = new Int_t[fNCh]; |
fe4da5cc |
132 | |
f665c1ea |
133 | fDchambers = new TObjArray(AliMUONConstants::NCh()); |
fe4da5cc |
134 | |
135 | Int_t i; |
136 | |
f665c1ea |
137 | for (i=0; i<AliMUONConstants::NCh() ;i++) { |
cd4df77b |
138 | fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i); |
fe4da5cc |
139 | fNdch[i]=0; |
140 | } |
141 | |
1bd28025 |
142 | fNrawch = new Int_t[fNTrackingCh]; |
a897a37a |
143 | |
f665c1ea |
144 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
a897a37a |
145 | |
f665c1ea |
146 | for (i=0; i<AliMUONConstants::NTrackingCh();i++) { |
cd4df77b |
147 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); |
a897a37a |
148 | fNrawch[i]=0; |
149 | } |
150 | |
a9e2aefa |
151 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
152 | fNGlobalTrigger = 0; |
153 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
154 | fNLocalTrigger = 0; |
fe4da5cc |
155 | |
fe4da5cc |
156 | SetMarkerColor(kRed); |
a9e2aefa |
157 | // |
158 | // |
159 | // |
160 | // |
f665c1ea |
161 | |
a9e2aefa |
162 | Int_t ch; |
163 | |
f665c1ea |
164 | fChambers = new TObjArray(AliMUONConstants::NCh()); |
a9e2aefa |
165 | |
166 | // Loop over stations |
f665c1ea |
167 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
a9e2aefa |
168 | // Loop over 2 chambers in the station |
169 | for (Int_t stCH = 0; stCH < 2; stCH++) { |
170 | // |
171 | // |
172 | // Default Parameters for Muon Tracking Stations |
173 | |
174 | |
175 | ch = 2 * st + stCH; |
176 | // |
f665c1ea |
177 | if (ch < AliMUONConstants::NTrackingCh()) { |
cd4df77b |
178 | fChambers->AddAt(new AliMUONChamber(ch),ch); |
a9e2aefa |
179 | } else { |
cd4df77b |
180 | fChambers->AddAt(new AliMUONChamberTrigger(ch),ch); |
a9e2aefa |
181 | } |
182 | |
2682e810 |
183 | //PH AliMUONChamber* chamber = (AliMUONChamber*) (*fChambers)[ch]; |
184 | AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch); |
a9e2aefa |
185 | |
186 | chamber->SetGid(0); |
187 | // Default values for Z of chambers |
f665c1ea |
188 | chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch)); |
a9e2aefa |
189 | // |
f665c1ea |
190 | chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch)); |
5c1f55c5 |
191 | // Set chamber inner and outer radius to default |
f665c1ea |
192 | chamber->SetRInner(AliMUONConstants::Dmin(st)/2); |
193 | chamber->SetROuter(AliMUONConstants::Dmax(st)/2); |
a9e2aefa |
194 | // |
195 | } // Chamber stCH (0, 1) in |
196 | } // Station st (0...) |
cd4df77b |
197 | // fChambers->SetLast(AliMUONConstants::NCh()); |
a9e2aefa |
198 | fMaxStepGas=0.01; |
199 | fMaxStepAlu=0.1; |
200 | fMaxDestepGas=-1; |
201 | fMaxDestepAlu=-1; |
202 | // |
203 | fMaxIterPad = 0; |
204 | fCurIterPad = 0; |
5c1f55c5 |
205 | // |
206 | fAccMin = 0.; |
207 | fAccMax = 0.; |
208 | fAccCut = kFALSE; |
a9e2aefa |
209 | |
210 | // cp new design of AliMUONTriggerDecision |
f665c1ea |
211 | fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit()); |
212 | for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) { |
cd4df77b |
213 | fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ); |
a9e2aefa |
214 | |
1cae9436 |
215 | } |
216 | fMerger = 0; |
fe4da5cc |
217 | } |
218 | |
219 | //___________________________________________ |
50e97f19 |
220 | AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON) |
a9e2aefa |
221 | { |
222 | // Dummy copy constructor |
223 | ; |
224 | |
225 | } |
226 | |
fe4da5cc |
227 | AliMUON::~AliMUON() |
228 | { |
de05461e |
229 | // Destructor |
9e1a0ddb |
230 | if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName()); |
a897a37a |
231 | |
f665c1ea |
232 | fIshunt = 0; |
c2c0190f |
233 | |
234 | // Delete TObjArrays |
235 | |
236 | if (fChambers){ |
237 | fChambers->Delete(); |
238 | delete fChambers; |
239 | } |
240 | |
241 | if (fTriggerCircuits){ |
242 | fTriggerCircuits->Delete(); |
243 | delete fTriggerCircuits; |
244 | } |
245 | |
246 | if (fDchambers){ |
247 | fDchambers->Delete(); |
248 | delete fDchambers; |
249 | } |
250 | |
251 | if (fRawClusters){ |
252 | fRawClusters->Delete(); |
253 | delete fRawClusters; |
254 | } |
62468ef9 |
255 | |
256 | if (fNrawch) delete [] fNrawch; |
c2c0190f |
257 | |
258 | // Delete TClonesArrays |
259 | |
260 | if (fPadHits){ |
261 | fPadHits->Delete(); |
262 | delete fPadHits; |
263 | } |
264 | |
265 | if (fGlobalTrigger){ |
266 | fGlobalTrigger->Delete(); |
267 | delete fGlobalTrigger; |
268 | } |
f665c1ea |
269 | fNGlobalTrigger = 0; |
270 | |
c2c0190f |
271 | if (fLocalTrigger){ |
272 | fLocalTrigger->Delete(); |
273 | delete fLocalTrigger; |
274 | } |
f665c1ea |
275 | fNLocalTrigger = 0; |
a897a37a |
276 | |
c2c0190f |
277 | if (fHits) { |
278 | fHits->Delete(); |
279 | delete fHits; |
280 | } |
281 | |
1cae9436 |
282 | if (fMerger) delete fMerger; |
62468ef9 |
283 | if (fNdch) delete [] fNdch; |
284 | |
fe4da5cc |
285 | } |
286 | |
287 | //___________________________________________ |
288 | void AliMUON::AddHit(Int_t track, Int_t *vol, Float_t *hits) |
289 | { |
290 | TClonesArray &lhits = *fHits; |
a9e2aefa |
291 | new(lhits[fNhits++]) AliMUONHit(fIshunt,track,vol,hits); |
fe4da5cc |
292 | } |
293 | //___________________________________________ |
5a35ac13 |
294 | void AliMUON::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, |
295 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, |
296 | Float_t tof, Float_t momentum, Float_t theta, |
297 | Float_t phi, Float_t length, Float_t destep) |
298 | { |
299 | TClonesArray &lhits = *fHits; |
300 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, |
301 | idpart, X, Y, Z, |
302 | tof, momentum, theta, |
303 | phi, length, destep); |
304 | } |
305 | //___________________________________________ |
306 | void AliMUON::AddPadHit(Int_t *clhits) // To be removed |
fe4da5cc |
307 | { |
a9e2aefa |
308 | TClonesArray &lclusters = *fPadHits; |
309 | new(lclusters[fNPadHits++]) AliMUONPadHit(clhits); |
fe4da5cc |
310 | } |
311 | //_____________________________________________________________________________ |
312 | void AliMUON::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) |
313 | { |
314 | // |
315 | // Add a MUON digit to the list |
316 | // |
317 | |
1e7c351a |
318 | //PH TClonesArray &ldigits = * ((TClonesArray*)(*fDchambers)[id]); |
319 | TClonesArray &ldigits = * ( (TClonesArray*) fDchambers->At(id) ); |
a9e2aefa |
320 | new(ldigits[fNdch[id]++]) AliMUONDigit(tracks,charges,digits); |
fe4da5cc |
321 | } |
322 | |
a897a37a |
323 | //_____________________________________________________________________________ |
324 | void AliMUON::AddRawCluster(Int_t id, const AliMUONRawCluster& c) |
325 | { |
326 | // |
327 | // Add a MUON digit to the list |
328 | // |
329 | |
2682e810 |
330 | //PH TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]); |
331 | TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id)); |
a897a37a |
332 | new(lrawcl[fNrawch[id]++]) AliMUONRawCluster(c); |
333 | } |
a897a37a |
334 | |
a9e2aefa |
335 | //___________________________________________ |
336 | void AliMUON::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus, |
337 | Int_t *singleUndef, |
338 | Int_t *pairUnlike, Int_t *pairLike) |
339 | { |
340 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) |
341 | TClonesArray &globalTrigger = *fGlobalTrigger; |
342 | new(globalTrigger[fNGlobalTrigger++]) |
343 | AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, |
344 | pairLike); |
345 | } |
346 | //___________________________________________ |
347 | void AliMUON::AddLocalTrigger(Int_t *localtr) |
348 | { |
349 | // add a MUON Local Trigger to the list |
350 | TClonesArray &localTrigger = *fLocalTrigger; |
351 | new(localTrigger[fNLocalTrigger++]) AliMUONLocalTrigger(localtr); |
a897a37a |
352 | } |
353 | |
fe4da5cc |
354 | //___________________________________________ |
355 | void AliMUON::BuildGeometry() |
356 | { |
de05461e |
357 | // Geometry for event display |
5fd73042 |
358 | for (Int_t i=0; i<7; i++) { |
359 | for (Int_t j=0; j<2; j++) { |
360 | Int_t id=2*i+j+1; |
361 | this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); |
a897a37a |
362 | } |
5fd73042 |
363 | } |
fe4da5cc |
364 | } |
365 | |
366 | //___________________________________________ |
367 | Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t ) |
368 | { |
369 | return 9999; |
370 | } |
371 | |
372 | //___________________________________________ |
88cb7938 |
373 | void AliMUON::MakeBranch(Option_t* option) |
fe4da5cc |
374 | { |
2ab0c725 |
375 | // |
f665c1ea |
376 | // Create Tree branches for the MUON. |
2ab0c725 |
377 | // |
f665c1ea |
378 | const Int_t kBufferSize = 4000; |
379 | char branchname[30]; |
380 | sprintf(branchname,"%sCluster",GetName()); |
381 | |
f665c1ea |
382 | |
5cf7bbad |
383 | const char *cD = strstr(option,"D"); |
384 | const char *cR = strstr(option,"R"); |
385 | const char *cH = strstr(option,"H"); |
2ab0c725 |
386 | |
88cb7938 |
387 | if (TreeH() && cH) |
388 | { |
389 | if (fPadHits == 0x0) fPadHits = new TClonesArray("AliMUONPadHit",10000); |
390 | MakeBranchInTree(TreeH(), branchname, &fPadHits, kBufferSize, 0); |
391 | if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); |
392 | } |
393 | //it must be under fHits creation |
394 | AliDetector::MakeBranch(option); |
f665c1ea |
395 | |
88cb7938 |
396 | if (cD && fLoader->TreeD()) { |
2ab0c725 |
397 | // |
398 | // one branch for digits per chamber |
399 | // |
400 | Int_t i; |
88cb7938 |
401 | if (fDchambers == 0x0) |
402 | { |
403 | fDchambers = new TObjArray(AliMUONConstants::NCh()); |
404 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { |
405 | fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i); |
406 | } |
2ab0c725 |
407 | } |
88cb7938 |
408 | |
409 | for (i=0; i<AliMUONConstants::NCh() ;i++) |
410 | { |
411 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
412 | MakeBranchInTree(fLoader->TreeD(), branchname, &((*fDchambers)[i]), kBufferSize, 0); |
413 | printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); |
414 | } |
f665c1ea |
415 | } |
416 | |
88cb7938 |
417 | if (cR && fLoader->TreeR()) { |
2ab0c725 |
418 | // |
419 | // one branch for raw clusters per chamber |
420 | // |
88cb7938 |
421 | printf("Make Branch - TreeR address %p\n",fLoader->TreeR()); |
2ab0c725 |
422 | |
423 | Int_t i; |
88cb7938 |
424 | if (fRawClusters == 0x0) |
425 | { |
426 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
427 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { |
428 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); |
429 | } |
430 | } |
2ab0c725 |
431 | |
88cb7938 |
432 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) |
433 | { |
434 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); |
435 | MakeBranchInTree(fLoader->TreeR(), branchname, &((*fRawClusters)[i]), kBufferSize, 0); |
436 | printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); |
2ab0c725 |
437 | } |
438 | // |
439 | // one branch for global trigger |
440 | // |
441 | sprintf(branchname,"%sGlobalTrigger",GetName()); |
88cb7938 |
442 | |
443 | if (fGlobalTrigger == 0x0) { |
444 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
2ab0c725 |
445 | } |
88cb7938 |
446 | MakeBranchInTree(fLoader->TreeR(), branchname, &fGlobalTrigger, kBufferSize, 0); |
447 | printf("Making Branch %s for Global Trigger\n",branchname); |
2ab0c725 |
448 | // |
449 | // one branch for local trigger |
450 | // |
451 | sprintf(branchname,"%sLocalTrigger",GetName()); |
88cb7938 |
452 | |
453 | if (fLocalTrigger == 0x0) { |
454 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
2ab0c725 |
455 | } |
88cb7938 |
456 | |
457 | MakeBranchInTree(fLoader->TreeR(), branchname, &fLocalTrigger, kBufferSize, 0); |
458 | printf("Making Branch %s for Local Trigger\n",branchname); |
2ab0c725 |
459 | } |
fe4da5cc |
460 | } |
461 | |
462 | //___________________________________________ |
463 | void AliMUON::SetTreeAddress() |
464 | { |
465 | // Set branch address for the Hits and Digits Tree. |
a897a37a |
466 | char branchname[30]; |
fe4da5cc |
467 | |
468 | TBranch *branch; |
88cb7938 |
469 | TTree *treeH = fLoader->TreeH(); |
470 | TTree *treeD = fLoader->TreeD(); |
471 | TTree *treeR = fLoader->TreeR(); |
fe4da5cc |
472 | |
473 | if (treeH) { |
88cb7938 |
474 | if (fPadHits == 0x0) fPadHits = new TClonesArray("AliMUONPadHit",10000); |
a9e2aefa |
475 | if (fPadHits) { |
fe4da5cc |
476 | branch = treeH->GetBranch("MUONCluster"); |
a9e2aefa |
477 | if (branch) branch->SetAddress(&fPadHits); |
fe4da5cc |
478 | } |
88cb7938 |
479 | if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); |
fe4da5cc |
480 | } |
88cb7938 |
481 | //it must be under fHits creation |
482 | AliDetector::SetTreeAddress(); |
fe4da5cc |
483 | |
484 | if (treeD) { |
88cb7938 |
485 | if (fDchambers == 0x0) |
486 | { |
487 | fDchambers = new TObjArray(AliMUONConstants::NCh()); |
488 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { |
489 | fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i); |
490 | } |
491 | } |
f665c1ea |
492 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
fe4da5cc |
493 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
88cb7938 |
494 | |
495 | if (fDchambers) { |
fe4da5cc |
496 | branch = treeD->GetBranch(branchname); |
497 | if (branch) branch->SetAddress(&((*fDchambers)[i])); |
498 | } |
499 | } |
500 | } |
a897a37a |
501 | |
502 | // printf("SetTreeAddress --- treeR address %p \n",treeR); |
503 | |
504 | if (treeR) { |
88cb7938 |
505 | if (fRawClusters == 0x0) |
506 | { |
507 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
508 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { |
509 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); |
510 | } |
511 | } |
512 | |
f665c1ea |
513 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
a897a37a |
514 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); |
515 | if (fRawClusters) { |
516 | branch = treeR->GetBranch(branchname); |
517 | if (branch) branch->SetAddress(&((*fRawClusters)[i])); |
518 | } |
519 | } |
a897a37a |
520 | |
88cb7938 |
521 | if (fLocalTrigger == 0x0) { |
522 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
523 | } |
524 | |
a9e2aefa |
525 | if (fLocalTrigger) { |
526 | branch = treeR->GetBranch("MUONLocalTrigger"); |
527 | if (branch) branch->SetAddress(&fLocalTrigger); |
528 | } |
88cb7938 |
529 | |
530 | if (fGlobalTrigger == 0x0) { |
531 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
532 | } |
533 | |
a9e2aefa |
534 | if (fGlobalTrigger) { |
535 | branch = treeR->GetBranch("MUONGlobalTrigger"); |
536 | if (branch) branch->SetAddress(&fGlobalTrigger); |
537 | } |
538 | } |
fe4da5cc |
539 | } |
540 | //___________________________________________ |
541 | void AliMUON::ResetHits() |
542 | { |
543 | // Reset number of clusters and the cluster array for this detector |
544 | AliDetector::ResetHits(); |
a9e2aefa |
545 | fNPadHits = 0; |
546 | if (fPadHits) fPadHits->Clear(); |
fe4da5cc |
547 | } |
548 | |
549 | //____________________________________________ |
550 | void AliMUON::ResetDigits() |
551 | { |
552 | // |
553 | // Reset number of digits and the digits array for this detector |
554 | // |
03a51b7f |
555 | if (fDchambers == 0x0) return; |
f665c1ea |
556 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { |
2682e810 |
557 | //PH if ((*fDchambers)[i]) ((TClonesArray*)(*fDchambers)[i])->Clear(); |
558 | if ((*fDchambers)[i]) ((TClonesArray*)fDchambers->At(i))->Clear(); |
fe4da5cc |
559 | if (fNdch) fNdch[i]=0; |
560 | } |
561 | } |
a897a37a |
562 | //____________________________________________ |
563 | void AliMUON::ResetRawClusters() |
564 | { |
565 | // |
566 | // Reset number of raw clusters and the raw clust array for this detector |
567 | // |
f665c1ea |
568 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { |
2682e810 |
569 | //PH if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear(); |
570 | if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear(); |
a897a37a |
571 | if (fNrawch) fNrawch[i]=0; |
572 | } |
573 | } |
a9e2aefa |
574 | |
a897a37a |
575 | //____________________________________________ |
a9e2aefa |
576 | void AliMUON::ResetTrigger() |
a897a37a |
577 | { |
a9e2aefa |
578 | // Reset Local and Global Trigger |
579 | fNGlobalTrigger = 0; |
580 | if (fGlobalTrigger) fGlobalTrigger->Clear(); |
581 | fNLocalTrigger = 0; |
582 | if (fLocalTrigger) fLocalTrigger->Clear(); |
583 | } |
584 | |
585 | //____________________________________________ |
586 | void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2) |
587 | { |
de05461e |
588 | // Set the pad size for chamber id and cathode isec |
a9e2aefa |
589 | Int_t i=2*(id-1); |
2682e810 |
590 | //PH ((AliMUONChamber*) (*fChambers)[i]) ->SetPadSize(isec,p1,p2); |
591 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetPadSize(isec,p1,p2); |
592 | ((AliMUONChamber*) fChambers->At(i)) ->SetPadSize(isec,p1,p2); |
593 | ((AliMUONChamber*) fChambers->At(i+1))->SetPadSize(isec,p1,p2); |
a897a37a |
594 | } |
595 | |
fe4da5cc |
596 | //___________________________________________ |
a9e2aefa |
597 | void AliMUON::SetChambersZ(const Float_t *Z) |
598 | { |
599 | // Set Z values for all chambers (tracking and trigger) |
600 | // from the array pointed to by "Z" |
f665c1ea |
601 | for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) |
2682e810 |
602 | //PH ((AliMUONChamber*) ((*fChambers)[ch]))->SetZ(Z[ch]); |
603 | ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]); |
f665c1ea |
604 | return; |
a9e2aefa |
605 | } |
fe4da5cc |
606 | |
a9e2aefa |
607 | //___________________________________________ |
608 | void AliMUON::SetChambersZToDefault() |
fe4da5cc |
609 | { |
a9e2aefa |
610 | // Set Z values for all chambers (tracking and trigger) |
611 | // to default values |
f665c1ea |
612 | SetChambersZ(AliMUONConstants::DefaultChamberZ()); |
a9e2aefa |
613 | return; |
fe4da5cc |
614 | } |
615 | |
616 | //___________________________________________ |
a897a37a |
617 | void AliMUON::SetChargeSlope(Int_t id, Float_t p1) |
fe4da5cc |
618 | { |
de05461e |
619 | // Set the inverse charge slope for chamber id |
fe4da5cc |
620 | Int_t i=2*(id-1); |
2682e810 |
621 | //PH ((AliMUONChamber*) (*fChambers)[i])->SetChargeSlope(p1); |
622 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSlope(p1); |
623 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1); |
624 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1); |
fe4da5cc |
625 | } |
626 | |
627 | //___________________________________________ |
a897a37a |
628 | void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2) |
fe4da5cc |
629 | { |
de05461e |
630 | // Set sigma of charge spread for chamber id |
fe4da5cc |
631 | Int_t i=2*(id-1); |
2682e810 |
632 | //PH ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2); |
633 | //PH ((AliMUONChamber*) fChambers->Ati+1])->SetChargeSpread(p1,p2); |
634 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2); |
635 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2); |
fe4da5cc |
636 | } |
637 | |
638 | //___________________________________________ |
a897a37a |
639 | void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1) |
fe4da5cc |
640 | { |
de05461e |
641 | // Set integration limits for charge spread |
fe4da5cc |
642 | Int_t i=2*(id-1); |
2682e810 |
643 | //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1); |
644 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1); |
645 | ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1); |
646 | ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1); |
fe4da5cc |
647 | } |
648 | |
649 | //___________________________________________ |
d09fafb0 |
650 | void AliMUON::SetMaxAdc(Int_t id, Int_t p1) |
fe4da5cc |
651 | { |
de05461e |
652 | // Set maximum number for ADCcounts (saturation) |
fe4da5cc |
653 | Int_t i=2*(id-1); |
2682e810 |
654 | //PH ((AliMUONChamber*) (*fChambers)[i])->SetMaxAdc(p1); |
655 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetMaxAdc(p1); |
656 | ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1); |
657 | ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1); |
fe4da5cc |
658 | } |
659 | |
660 | //___________________________________________ |
a897a37a |
661 | void AliMUON::SetMaxStepGas(Float_t p1) |
fe4da5cc |
662 | { |
de05461e |
663 | // Set stepsize in gas |
fe4da5cc |
664 | fMaxStepGas=p1; |
665 | } |
666 | |
667 | //___________________________________________ |
a897a37a |
668 | void AliMUON::SetMaxStepAlu(Float_t p1) |
fe4da5cc |
669 | { |
de05461e |
670 | // Set step size in Alu |
fe4da5cc |
671 | fMaxStepAlu=p1; |
672 | } |
673 | |
674 | //___________________________________________ |
a897a37a |
675 | void AliMUON::SetMaxDestepGas(Float_t p1) |
fe4da5cc |
676 | { |
de05461e |
677 | // Set maximum step size in Gas |
fe4da5cc |
678 | fMaxDestepGas=p1; |
679 | } |
680 | |
681 | //___________________________________________ |
a897a37a |
682 | void AliMUON::SetMaxDestepAlu(Float_t p1) |
fe4da5cc |
683 | { |
de05461e |
684 | // Set maximum step size in Alu |
fe4da5cc |
685 | fMaxDestepAlu=p1; |
686 | } |
687 | //___________________________________________ |
5c1f55c5 |
688 | void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax) |
fe4da5cc |
689 | { |
de05461e |
690 | // Set acceptance cuts |
fe4da5cc |
691 | fAccCut=acc; |
5c1f55c5 |
692 | fAccMin=angmin*TMath::Pi()/180; |
693 | fAccMax=angmax*TMath::Pi()/180; |
694 | Int_t ch; |
695 | if (acc) { |
696 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
697 | // Loop over 2 chambers in the station |
698 | for (Int_t stCH = 0; stCH < 2; stCH++) { |
699 | ch = 2 * st + stCH; |
700 | // Set chamber inner and outer radius according to acceptance cuts |
701 | Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin)); |
702 | Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax)); |
703 | } // chamber loop |
704 | } // station loop |
705 | } |
fe4da5cc |
706 | } |
707 | //___________________________________________ |
a30a000f |
708 | void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation) |
fe4da5cc |
709 | { |
de05461e |
710 | // Set the segmentation for chamber id cathode isec |
2682e810 |
711 | //PH ((AliMUONChamber*) (*fChambers)[id])->SetSegmentationModel(isec, segmentation); |
712 | ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation); |
fe4da5cc |
713 | |
714 | } |
715 | //___________________________________________ |
a9e2aefa |
716 | void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response) |
fe4da5cc |
717 | { |
de05461e |
718 | // Set the response for chamber id |
2682e810 |
719 | //PH ((AliMUONChamber*) (*fChambers)[id])->SetResponseModel(response); |
720 | ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response); |
fe4da5cc |
721 | } |
722 | |
30aaba74 |
723 | void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst) |
a897a37a |
724 | { |
de05461e |
725 | // Set ClusterFinder for chamber id |
2682e810 |
726 | //PH ((AliMUONChamber*) (*fChambers)[id])->SetReconstructionModel(reconst); |
727 | ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst); |
a897a37a |
728 | } |
729 | |
fe4da5cc |
730 | void AliMUON::SetNsec(Int_t id, Int_t nsec) |
731 | { |
de05461e |
732 | // Set number of segmented cathods for chamber id |
2682e810 |
733 | //PH ((AliMUONChamber*) (*fChambers)[id])->SetNsec(nsec); |
734 | ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec); |
fe4da5cc |
735 | } |
736 | |
fe4da5cc |
737 | //___________________________________________ |
2ab0c725 |
738 | void AliMUON::SDigits2Digits() |
739 | { |
d963c261 |
740 | |
741 | // write TreeD here |
742 | |
743 | if (!fMerger) { |
744 | if (gAlice->GetDebug()>0) { |
745 | cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl; |
746 | cerr<<" no merging, just digitization of 1 event will be done"<<endl; |
747 | } |
748 | fMerger = new AliMUONMerger(); |
2ab0c725 |
749 | } |
d963c261 |
750 | fMerger->Init(); |
751 | fMerger->Digitise(); |
752 | char hname[30]; |
88cb7938 |
753 | // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent()); |
754 | fLoader->TreeD()->Write(hname,TObject::kOverwrite); |
755 | fLoader->TreeD()->Reset(); |
2ab0c725 |
756 | } |
a9e2aefa |
757 | |
2ab0c725 |
758 | //___________________________________________ |
5a35ac13 |
759 | // To be removed |
802a864d |
760 | void AliMUON::MakePadHits(Float_t xhit,Float_t yhit, Float_t zhit, |
a9e2aefa |
761 | Float_t eloss, Float_t tof, Int_t idvol) |
fe4da5cc |
762 | { |
763 | // |
a897a37a |
764 | // Calls the charge disintegration method of the current chamber and adds |
765 | // the simulated cluster to the root treee |
fe4da5cc |
766 | // |
a897a37a |
767 | Int_t clhits[7]; |
768 | Float_t newclust[6][500]; |
769 | Int_t nnew; |
770 | |
771 | |
fe4da5cc |
772 | // |
a897a37a |
773 | // Integrated pulse height on chamber |
774 | |
775 | |
776 | clhits[0]=fNhits+1; |
fe4da5cc |
777 | // |
a897a37a |
778 | // |
7ab910ae |
779 | // if (idvol == 6) printf("\n ->Disintegration %f %f %f", xhit, yhit, eloss ); |
780 | |
781 | |
2682e810 |
782 | //PH ((AliMUONChamber*) (*fChambers)[idvol]) |
783 | ((AliMUONChamber*) fChambers->At(idvol)) |
802a864d |
784 | ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust); |
a897a37a |
785 | Int_t ic=0; |
7ab910ae |
786 | // if (idvol == 6) printf("\n nnew %d \n", nnew); |
a897a37a |
787 | // |
788 | // Add new clusters |
789 | for (Int_t i=0; i<nnew; i++) { |
790 | if (Int_t(newclust[3][i]) > 0) { |
791 | ic++; |
792 | // Cathode plane |
793 | clhits[1] = Int_t(newclust[5][i]); |
794 | // Cluster Charge |
795 | clhits[2] = Int_t(newclust[0][i]); |
796 | // Pad: ix |
797 | clhits[3] = Int_t(newclust[1][i]); |
798 | // Pad: iy |
799 | clhits[4] = Int_t(newclust[2][i]); |
800 | // Pad: charge |
801 | clhits[5] = Int_t(newclust[3][i]); |
802 | // Pad: chamber sector |
803 | clhits[6] = Int_t(newclust[4][i]); |
804 | |
a9e2aefa |
805 | AddPadHit(clhits); |
a897a37a |
806 | } |
807 | } |
a897a37a |
808 | } |
809 | |
a9e2aefa |
810 | //___________________________________________ |
811 | void AliMUON::Trigger(Int_t nev){ |
812 | // call the Trigger Algorithm and fill TreeR |
813 | |
814 | Int_t singlePlus[3] = {0,0,0}; |
815 | Int_t singleMinus[3] = {0,0,0}; |
816 | Int_t singleUndef[3] = {0,0,0}; |
817 | Int_t pairUnlike[3] = {0,0,0}; |
818 | Int_t pairLike[3] = {0,0,0}; |
819 | |
820 | ResetTrigger(); |
a9e2aefa |
821 | AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1); |
822 | decision->Trigger(); |
823 | decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef, |
824 | pairUnlike, pairLike); |
88cb7938 |
825 | |
a9e2aefa |
826 | // add a local trigger in the list |
827 | AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); |
9ae15266 |
828 | Int_t i; |
a9e2aefa |
829 | |
f665c1ea |
830 | for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) { |
9ae15266 |
831 | if(decision->GetITrigger(icirc)==1) { |
832 | Int_t localtr[7]={0,0,0,0,0,0,0}; |
833 | Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0}; |
834 | decision->GetLutOutput(icirc, loLpt, loHpt, loApt); |
835 | localtr[0] = icirc; |
836 | localtr[1] = decision->GetStripX11(icirc); |
837 | localtr[2] = decision->GetDev(icirc); |
838 | localtr[3] = decision->GetStripY11(icirc); |
839 | for (i=0; i<2; i++) { // convert the Lut output in 1 digit |
840 | localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i)); |
841 | localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i)); |
842 | localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i)); |
843 | } |
844 | AddLocalTrigger(localtr); // add a local trigger in the list |
a897a37a |
845 | } |
a9e2aefa |
846 | } |
88cb7938 |
847 | |
a9e2aefa |
848 | delete decision; |
a897a37a |
849 | |
88cb7938 |
850 | fLoader->TreeR()->Fill(); |
851 | // char hname[30]; |
852 | // sprintf(hname,"TreeR%d",nev); |
853 | // fLoader->TreeR()->Write(hname,TObject::kOverwrite); |
854 | // fLoader->TreeR()->Reset(); |
855 | fLoader->WriteRecPoints("OVERWRITE"); |
a9e2aefa |
856 | ResetTrigger(); |
88cb7938 |
857 | |
a9e2aefa |
858 | printf("\n End of trigger for event %d", nev); |
a897a37a |
859 | } |
a897a37a |
860 | |
a897a37a |
861 | |
a9e2aefa |
862 | //____________________________________________ |
fe311ef1 |
863 | void AliMUON::Digits2Reco() |
864 | { |
865 | FindClusters(); |
e365e1ee |
866 | Int_t nev = gAlice->GetHeader()->GetEvent(); |
88cb7938 |
867 | fLoader->TreeR()->Fill(); |
868 | // char hname[30]; |
869 | // sprintf(hname,"TreeR%d", nev); |
870 | //fLoader->TreeR()->Write(hname); |
871 | //fLoader->TreeR()->Reset(); |
872 | fLoader->WriteRecPoints("OVERWRITE"); |
e365e1ee |
873 | ResetRawClusters(); |
874 | printf("\n End of cluster finding for event %d", nev); |
fe311ef1 |
875 | } |
876 | |
877 | void AliMUON::FindClusters() |
a9e2aefa |
878 | { |
de05461e |
879 | // |
880 | // Perform cluster finding |
881 | // |
a9e2aefa |
882 | TClonesArray *dig1, *dig2; |
883 | Int_t ndig, k; |
884 | dig1 = new TClonesArray("AliMUONDigit",1000); |
885 | dig2 = new TClonesArray("AliMUONDigit",1000); |
886 | AliMUONDigit *digit; |
a9e2aefa |
887 | // Loop on chambers and on cathode planes |
a897a37a |
888 | // |
fe311ef1 |
889 | ResetRawClusters(); |
88cb7938 |
890 | TClonesArray * muonDigits; |
891 | |
1bd28025 |
892 | for (Int_t ich = 0; ich < 10; ich++) { |
2682e810 |
893 | //PH AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich]; |
894 | AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich); |
fe311ef1 |
895 | AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel(); |
896 | |
88cb7938 |
897 | ResetDigits(); |
898 | fLoader->TreeD()->GetEvent(0); |
899 | //TClonesArray * |
900 | muonDigits = (TClonesArray *) Dchambers()->At(ich); |
a9e2aefa |
901 | ndig=muonDigits->GetEntriesFast(); |
88cb7938 |
902 | printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich); |
a9e2aefa |
903 | TClonesArray &lhits1 = *dig1; |
1bd28025 |
904 | Int_t n = 0; |
905 | for (k = 0; k < ndig; k++) { |
906 | digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); |
907 | if (rec->TestTrack(digit->Track(0))) |
a9e2aefa |
908 | new(lhits1[n++]) AliMUONDigit(*digit); |
909 | } |
88cb7938 |
910 | ResetDigits(); |
911 | fLoader->TreeD()->GetEvent(1); |
912 | //muonDigits = this->DigitsAddress(ich); |
913 | muonDigits = (TClonesArray *) Dchambers()->At(ich); |
a9e2aefa |
914 | ndig=muonDigits->GetEntriesFast(); |
915 | printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich); |
916 | TClonesArray &lhits2 = *dig2; |
917 | n=0; |
918 | |
919 | for (k=0; k<ndig; k++) { |
920 | digit= (AliMUONDigit*) muonDigits->UncheckedAt(k); |
1bd28025 |
921 | if (rec->TestTrack(digit->Track(0))) |
a9e2aefa |
922 | new(lhits2[n++]) AliMUONDigit(*digit); |
a897a37a |
923 | } |
a897a37a |
924 | |
9825400f |
925 | if (rec) { |
926 | AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); |
a9e2aefa |
927 | rec->FindRawClusters(); |
928 | } |
929 | dig1->Delete(); |
930 | dig2->Delete(); |
931 | } // for ich |
a9e2aefa |
932 | delete dig1; |
933 | delete dig2; |
a897a37a |
934 | } |
a9e2aefa |
935 | |
2ab0c725 |
936 | #ifdef never |
fe4da5cc |
937 | void AliMUON::Streamer(TBuffer &R__b) |
938 | { |
939 | // Stream an object of class AliMUON. |
a30a000f |
940 | AliMUONChamber *iChamber; |
a9e2aefa |
941 | AliMUONTriggerCircuit *iTriggerCircuit; |
a30a000f |
942 | AliSegmentation *segmentation; |
943 | AliMUONResponse *response; |
944 | TClonesArray *digitsaddress; |
945 | TClonesArray *rawcladdress; |
9ae15266 |
946 | Int_t i; |
9ae15266 |
947 | if (R__b.IsReading()) { |
948 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } |
949 | AliDetector::Streamer(R__b); |
950 | R__b >> fNPadHits; |
951 | R__b >> fPadHits; // diff |
952 | R__b >> fNLocalTrigger; |
953 | R__b >> fLocalTrigger; |
954 | R__b >> fNGlobalTrigger; |
955 | R__b >> fGlobalTrigger; |
956 | R__b >> fDchambers; |
957 | R__b >> fRawClusters; |
958 | R__b.ReadArray(fNdch); |
959 | R__b.ReadArray(fNrawch); |
960 | R__b >> fAccCut; |
961 | R__b >> fAccMin; |
962 | R__b >> fAccMax; |
963 | R__b >> fChambers; |
964 | R__b >> fTriggerCircuits; |
f665c1ea |
965 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 |
966 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
967 | iTriggerCircuit->Streamer(R__b); |
fe4da5cc |
968 | } |
9ae15266 |
969 | // Stream chamber related information |
f665c1ea |
970 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 |
971 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
972 | iChamber->Streamer(R__b); |
973 | if (iChamber->Nsec()==1) { |
974 | segmentation=iChamber->SegmentationModel(1); |
975 | if (segmentation) |
976 | segmentation->Streamer(R__b); |
977 | } else { |
978 | segmentation=iChamber->SegmentationModel(1); |
979 | if (segmentation) |
980 | segmentation->Streamer(R__b); |
981 | if (segmentation) |
982 | segmentation=iChamber->SegmentationModel(2); |
983 | segmentation->Streamer(R__b); |
984 | } |
985 | response=iChamber->ResponseModel(); |
986 | if (response) |
987 | response->Streamer(R__b); |
988 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
989 | digitsaddress->Streamer(R__b); |
f665c1ea |
990 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 |
991 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
992 | rawcladdress->Streamer(R__b); |
993 | } |
a9e2aefa |
994 | } |
9ae15266 |
995 | |
996 | } else { |
997 | R__b.WriteVersion(AliMUON::IsA()); |
998 | AliDetector::Streamer(R__b); |
999 | R__b << fNPadHits; |
1000 | R__b << fPadHits; // diff |
1001 | R__b << fNLocalTrigger; |
1002 | R__b << fLocalTrigger; |
1003 | R__b << fNGlobalTrigger; |
1004 | R__b << fGlobalTrigger; |
1005 | R__b << fDchambers; |
1006 | R__b << fRawClusters; |
f665c1ea |
1007 | R__b.WriteArray(fNdch, AliMUONConstants::NCh()); |
1008 | R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh()); |
9ae15266 |
1009 | |
1010 | R__b << fAccCut; |
1011 | R__b << fAccMin; |
1012 | R__b << fAccMax; |
1013 | |
1014 | R__b << fChambers; |
1015 | R__b << fTriggerCircuits; |
f665c1ea |
1016 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 |
1017 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
1018 | iTriggerCircuit->Streamer(R__b); |
fe4da5cc |
1019 | } |
f665c1ea |
1020 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 |
1021 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
1022 | iChamber->Streamer(R__b); |
1023 | if (iChamber->Nsec()==1) { |
1024 | segmentation=iChamber->SegmentationModel(1); |
1025 | if (segmentation) |
1026 | segmentation->Streamer(R__b); |
1027 | } else { |
1028 | segmentation=iChamber->SegmentationModel(1); |
1029 | if (segmentation) |
1030 | segmentation->Streamer(R__b); |
1031 | segmentation=iChamber->SegmentationModel(2); |
1032 | if (segmentation) |
1033 | segmentation->Streamer(R__b); |
1034 | } |
1035 | response=iChamber->ResponseModel(); |
1036 | if (response) |
1037 | response->Streamer(R__b); |
1038 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
1039 | digitsaddress->Streamer(R__b); |
f665c1ea |
1040 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 |
1041 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1042 | rawcladdress->Streamer(R__b); |
1043 | } |
a9e2aefa |
1044 | } |
fe4da5cc |
1045 | } |
fe4da5cc |
1046 | } |
2ab0c725 |
1047 | #endif |
1048 | |
a9e2aefa |
1049 | AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters) |
fe4da5cc |
1050 | { |
5a35ac13 |
1051 | // to be removed |
fe4da5cc |
1052 | // Initialise the pad iterator |
1053 | // Return the address of the first padhit for hit |
a897a37a |
1054 | TClonesArray *theClusters = clusters; |
fe4da5cc |
1055 | Int_t nclust = theClusters->GetEntriesFast(); |
1bd28025 |
1056 | if (nclust && hit->PHlast() > 0) { |
1057 | AliMUON::fMaxIterPad=hit->PHlast(); |
1058 | AliMUON::fCurIterPad=hit->PHfirst(); |
a9e2aefa |
1059 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); |
fe4da5cc |
1060 | } else { |
1061 | return 0; |
1062 | } |
1063 | } |
1064 | |
a9e2aefa |
1065 | AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters) |
fe4da5cc |
1066 | { |
5a35ac13 |
1067 | // To be removed |
de05461e |
1068 | // Get next pad (in iterator) |
1069 | // |
a9e2aefa |
1070 | AliMUON::fCurIterPad++; |
1071 | if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) { |
1072 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); |
fe4da5cc |
1073 | } else { |
1074 | return 0; |
1075 | } |
1076 | } |
1077 | |
a897a37a |
1078 | |
1079 | AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster) |
1080 | { |
de05461e |
1081 | // |
1082 | // Return rawcluster (icluster) for chamber ichamber and cathode icathod |
1083 | // Obsolete ?? |
a9e2aefa |
1084 | TClonesArray *muonRawCluster = RawClustAddress(ichamber); |
a897a37a |
1085 | ResetRawClusters(); |
88cb7938 |
1086 | TTree *treeR = fLoader->TreeR(); |
a9e2aefa |
1087 | Int_t nent=(Int_t)treeR->GetEntries(); |
1088 | treeR->GetEvent(nent-2+icathod-1); |
1089 | //treeR->GetEvent(icathod); |
1090 | //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast(); |
a897a37a |
1091 | |
a9e2aefa |
1092 | AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster); |
a897a37a |
1093 | //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw); |
1094 | |
1095 | return mRaw; |
1096 | } |
1cae9436 |
1097 | |
1098 | void AliMUON::SetMerger(AliMUONMerger* merger) |
1099 | { |
1100 | // Set pointer to merger |
1101 | fMerger = merger; |
1102 | } |
1103 | |
1104 | AliMUONMerger* AliMUON::Merger() |
1105 | { |
1106 | // Return pointer to merger |
1107 | return fMerger; |
1108 | } |
1109 | |
1110 | |
a897a37a |
1111 | |
50e97f19 |
1112 | AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/) |
a897a37a |
1113 | { |
a9e2aefa |
1114 | // copy operator |
1115 | // dummy version |
1116 | return *this; |
a897a37a |
1117 | } |
1118 | |
cd4df77b |
1119 | //////////////////////////////////////////////////////////////////////// |
1120 | void AliMUON::MakeBranchInTreeD(TTree *treeD, const char *file) |
1121 | { |
1122 | // |
1123 | // Create TreeD branches for the MUON. |
1124 | // |
a897a37a |
1125 | |
cd4df77b |
1126 | const Int_t kBufferSize = 4000; |
1127 | char branchname[30]; |
1128 | |
1e7c351a |
1129 | if (fDchambers == 0x0) { |
1130 | fDchambers = new TObjArray(AliMUONConstants::NCh()); |
1131 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { |
1132 | fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i); |
1133 | } |
1134 | } |
cd4df77b |
1135 | // |
1136 | // one branch for digits per chamber |
1137 | // |
1138 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { |
1139 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
1140 | if (fDchambers && treeD) { |
1141 | MakeBranchInTree(treeD, |
1142 | branchname, &((*fDchambers)[i]), kBufferSize, file); |
62468ef9 |
1143 | // printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); |
cd4df77b |
1144 | } |
1145 | } |
1146 | } |
a897a37a |
1147 | |
cd4df77b |
1148 | //___________________________________________ |
fe4da5cc |
1149 | |