]>
Commit | Line | Data |
---|---|---|
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 | /* |
16 | $Log$ | |
2ab0c725 | 17 | Revision 1.44 2001/01/25 17:39:09 morsch |
18 | Pass size of fNdch and fNrawch to CINT. | |
19 | ||
1bd26093 | 20 | Revision 1.43 2001/01/23 18:58:19 hristov |
21 | Initialisation of some pointers | |
22 | ||
3f5cf0b3 | 23 | Revision 1.42 2001/01/17 20:53:40 hristov |
24 | Destructors corrected to avoid memory leaks | |
25 | ||
c2c0190f | 26 | Revision 1.41 2000/12/21 22:12:40 morsch |
27 | Clean-up of coding rule violations, | |
28 | ||
de05461e | 29 | Revision 1.40 2000/11/29 20:32:26 gosset |
30 | Digitize: | |
31 | 1. correction for array index out of bounds | |
32 | 2. one printout commented | |
33 | ||
48030acd | 34 | Revision 1.39 2000/11/12 17:17:03 pcrochet |
35 | BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers) | |
36 | ||
5fd73042 | 37 | Revision 1.38 2000/11/06 09:20:43 morsch |
38 | AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the | |
39 | Draw() method. This avoids code and parameter replication. | |
40 | ||
aaf4addd | 41 | Revision 1.37 2000/10/26 09:53:37 pcrochet |
42 | put back trigger chambers in the display (there was a problem in buildgeometry) | |
43 | ||
43b96d92 | 44 | Revision 1.36 2000/10/25 19:51:18 morsch |
45 | Correct x-position of chambers. | |
46 | ||
6bc66d8f | 47 | Revision 1.35 2000/10/24 19:46:21 morsch |
48 | BuildGeometry updated for slats in station 3-4. | |
49 | ||
e4fa3d7e | 50 | Revision 1.34 2000/10/18 11:42:06 morsch |
51 | - AliMUONRawCluster contains z-position. | |
52 | - Some clean-up of useless print statements during initialisations. | |
53 | ||
3e1872ed | 54 | Revision 1.33 2000/10/09 14:01:57 morsch |
55 | Unused variables removed. | |
56 | ||
0234695f | 57 | Revision 1.32 2000/10/06 09:08:10 morsch |
58 | Built geometry includes slat geometry for event display. | |
59 | ||
7ab910ae | 60 | Revision 1.31 2000/10/02 21:28:08 fca |
61 | Removal of useless dependecies via forward declarations | |
62 | ||
94de3818 | 63 | Revision 1.30 2000/10/02 16:58:29 egangler |
64 | Cleaning of the code : | |
65 | -> coding conventions | |
66 | -> void Streamers | |
67 | -> some useless includes removed or replaced by "class" statement | |
68 | ||
ecfa008b | 69 | Revision 1.29 2000/07/28 13:49:38 morsch |
70 | SetAcceptance defines inner and outer chamber radii according to angular acceptance. | |
71 | Can be used for simple acceptance studies. | |
72 | ||
5c1f55c5 | 73 | Revision 1.28 2000/07/22 16:43:15 morsch |
74 | Same comment as before, but now done correctly I hope (sorry it's Saturday evening) | |
75 | ||
45085cb9 | 76 | Revision 1.27 2000/07/22 16:36:50 morsch |
77 | Change order of indices in creation (new) of xhit and yhit | |
78 | ||
6b18d06a | 79 | Revision 1.26 2000/07/03 11:54:57 morsch |
80 | AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER | |
81 | The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. | |
82 | ||
a30a000f | 83 | Revision 1.25 2000/06/29 12:34:09 morsch |
84 | AliMUONSegmentation class has been made independent of AliMUONChamber. This makes | |
85 | it usable with any other geometry class. The link to the object to which it belongs is | |
86 | established via an index. This assumes that there exists a global geometry manager | |
87 | from which the pointer to the parent object can be obtained (in our case gAlice). | |
88 | ||
d81db581 | 89 | Revision 1.24 2000/06/28 15:16:35 morsch |
90 | (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) | |
91 | to allow development of slat-muon chamber simulation and reconstruction code in the MUON | |
92 | framework. The changes should have no side effects (mostly dummy arguments). | |
93 | (2) Hit disintegration uses 3-dim hit coordinates to allow simulation | |
94 | of chambers with overlapping modules (MakePadHits, Disintegration). | |
95 | ||
802a864d | 96 | Revision 1.23 2000/06/28 12:19:17 morsch |
97 | More consequent seperation of global input data services (AliMUONClusterInput singleton) and the | |
98 | cluster and hit reconstruction algorithms in AliMUONClusterFinderVS. | |
99 | AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction. | |
100 | It requires two cathode planes. Small modifications in the code will make it usable for | |
101 | one cathode plane and, hence, more general (for test beam data). | |
102 | AliMUONClusterFinder is now obsolete. | |
103 | ||
30aaba74 | 104 | Revision 1.22 2000/06/28 08:06:10 morsch |
105 | Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the | |
106 | algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton. | |
107 | It also naturally takes care of the TMinuit instance. | |
108 | ||
9825400f | 109 | Revision 1.21 2000/06/27 08:54:41 morsch |
110 | Problems with on constant array sizes (in hitMap, nmuon, xhit, yhit) corrected. | |
111 | ||
d09fafb0 | 112 | Revision 1.20 2000/06/26 14:02:38 morsch |
113 | Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. | |
114 | ||
f665c1ea | 115 | Revision 1.19 2000/06/22 13:40:51 morsch |
116 | scope problem on HP, "i" declared once | |
117 | pow changed to TMath::Power (PH, AM) | |
118 | ||
9ae15266 | 119 | Revision 1.18 2000/06/15 07:58:48 morsch |
120 | Code from MUON-dev joined | |
121 | ||
a9e2aefa | 122 | Revision 1.14.4.17 2000/06/14 14:36:46 morsch |
123 | - add TriggerCircuit (PC) | |
124 | - add GlobalTrigger and LocalTrigger and specific methods (PC) | |
125 | ||
126 | Revision 1.14.4.16 2000/06/09 21:20:28 morsch | |
127 | Most coding rule violations corrected | |
128 | ||
129 | Revision 1.14.4.15 2000/05/02 09:54:32 morsch | |
130 | RULE RN17 violations corrected | |
131 | ||
132 | Revision 1.14.4.12 2000/04/26 12:25:02 morsch | |
133 | Code revised by P. Crochet: | |
134 | - Z position of TriggerChamber changed according to A.Tournaire Priv.Comm. | |
135 | - ToF included in the method MakePadHits | |
136 | - inner radius of flange between beam shielding and trigger corrected | |
137 | - Trigger global volume updated (according to the new geometry) | |
138 | ||
139 | Revision 1.14.4.11 2000/04/19 19:42:08 morsch | |
140 | Some changes of variable names curing viols and methods concerning | |
141 | correlated clusters removed. | |
142 | ||
143 | Revision 1.14.4.10 2000/03/22 16:44:07 gosset | |
144 | Memory leak suppressed in function Digitise: | |
145 | p_adr->Delete() instead of Clear (I.Chevrot and A.Baldisseri) | |
146 | ||
147 | Revision 1.14.4.9 2000/03/20 18:15:25 morsch | |
148 | Positions of trigger chambers corrected (P.C.) | |
dbe37a89 | 149 | |
a9e2aefa | 150 | Revision 1.14.4.8 2000/02/21 15:38:01 morsch |
151 | Call to AddHitList introduced to make this version compatible with head. | |
dffd31ef | 152 | |
a9e2aefa | 153 | Revision 1.14.4.7 2000/02/20 07:45:53 morsch |
154 | Bugs in Trigger part of BuildGeomemetry corrected (P.C) | |
1cedd08a | 155 | |
a9e2aefa | 156 | Revision 1.14.4.6 2000/02/17 14:28:54 morsch |
157 | Trigger included into initialization and digitization | |
6a935c13 | 158 | |
a9e2aefa | 159 | Revision 1.14.4.5 2000/02/15 10:02:58 morsch |
160 | Log messages of previous revisions added | |
5d84196c | 161 | |
a9e2aefa | 162 | Revision 1.14.4.2 2000/02/04 10:57:34 gosset |
163 | Z position of the chambers: | |
164 | it was the Z position of the stations; | |
165 | it is now really the Z position of the chambers. | |
166 | !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS" | |
167 | !!!! AND "AliMUONChamber::ZPosition" | |
168 | !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ" | |
169 | !!!! AND "AliMUONChamber::Z" | |
50f986db | 170 | |
a9e2aefa | 171 | Revision 1.14.4.3 2000/02/04 16:19:04 gosset |
172 | Correction for mis-spelling of NCH | |
0b34885d | 173 | |
a9e2aefa | 174 | Revision 1.14.4.4 2000/02/15 09:43:38 morsch |
175 | Log message added | |
2b86633d | 176 | |
4c039060 | 177 | */ |
178 | ||
a9e2aefa | 179 | |
180 | /////////////////////////////////////////////// | |
fe4da5cc | 181 | // Manager and hits classes for set:MUON // |
182 | //////////////////////////////////////////////// | |
183 | ||
184 | #include <TTUBE.h> | |
a897a37a | 185 | #include <TBRIK.h> |
186 | #include <TRotMatrix.h> | |
94de3818 | 187 | #include <TGeometry.h> |
fe4da5cc | 188 | #include <TNode.h> |
a897a37a | 189 | #include <TTree.h> |
fe4da5cc | 190 | #include <TRandom.h> |
191 | #include <TObject.h> | |
192 | #include <TVector.h> | |
193 | #include <TObjArray.h> | |
a897a37a | 194 | #include <TMinuit.h> |
195 | #include <TParticle.h> | |
196 | #include <TROOT.h> | |
197 | #include <TFile.h> | |
198 | #include <TNtuple.h> | |
199 | #include <TCanvas.h> | |
200 | #include <TPad.h> | |
201 | #include <TDirectory.h> | |
202 | #include <TObjectTable.h> | |
203 | #include <AliPDG.h> | |
a9e2aefa | 204 | #include <TTUBE.h> |
fe4da5cc | 205 | |
206 | #include "AliMUON.h" | |
a9e2aefa | 207 | #include "AliMUONHit.h" |
208 | #include "AliMUONPadHit.h" | |
209 | #include "AliMUONDigit.h" | |
210 | #include "AliMUONTransientDigit.h" | |
211 | #include "AliMUONRawCluster.h" | |
212 | #include "AliMUONLocalTrigger.h" | |
213 | #include "AliMUONGlobalTrigger.h" | |
ecfa008b | 214 | #include "AliMUONTriggerCircuit.h" |
a30a000f | 215 | #include "AliHitMap.h" |
a9e2aefa | 216 | #include "AliMUONHitMapA1.h" |
217 | #include "AliMUONChamberTrigger.h" | |
f665c1ea | 218 | #include "AliMUONConstants.h" |
30aaba74 | 219 | #include "AliMUONClusterFinderVS.h" |
a9e2aefa | 220 | #include "AliMUONTriggerDecision.h" |
fe4da5cc | 221 | #include "AliRun.h" |
222 | #include "AliMC.h" | |
9825400f | 223 | #include "AliMUONClusterInput.h" |
fe4da5cc | 224 | #include "iostream.h" |
225 | #include "AliCallf77.h" | |
a9e2aefa | 226 | #include "AliConst.h" |
227 | ||
228 | // Defaults parameters for Z positions of chambers | |
229 | // taken from values for "stations" in AliMUON::AliMUON | |
230 | // const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.}; | |
231 | // and from array "dstation" in AliMUONv1::CreateGeometry | |
232 | // Float_t dstation[5]={20., 20., 20, 20., 20.}; | |
233 | // for tracking chambers, | |
234 | // according to (Z1 = zch - dstation) and (Z2 = zch + dstation) | |
235 | // for the first and second chambers in the station, respectively, | |
236 | // and from "DTPLANES" in AliMUONv1::CreateGeometry | |
237 | // const Float_t DTPLANES = 15.; | |
238 | // for trigger chambers, | |
239 | // according to (Z1 = zch) and (Z2 = zch + DTPLANES) | |
240 | // for the first and second chambers in the station, respectively | |
fe4da5cc | 241 | |
fe4da5cc | 242 | ClassImp(AliMUON) |
fe4da5cc | 243 | //___________________________________________ |
244 | AliMUON::AliMUON() | |
245 | { | |
de05461e | 246 | // Default Constructor |
247 | // | |
1bd26093 | 248 | fNCh = AliMUONConstants::NCh(); |
249 | fNTrackingCh = AliMUONConstants::NTrackingCh(); | |
250 | fIshunt = 0; | |
251 | fHits = 0; | |
252 | fPadHits = 0; | |
253 | fNPadHits = 0; | |
254 | fDchambers = 0; | |
255 | fTriggerCircuits = 0; | |
256 | fNdch = 0; | |
257 | fRawClusters = 0; | |
258 | fNrawch = 0; | |
259 | fGlobalTrigger = 0; | |
260 | fNLocalTrigger = 0; | |
261 | fLocalTrigger = 0; | |
262 | fNLocalTrigger = 0; | |
263 | fAccMin = 0.; | |
264 | fAccMax = 0.; | |
265 | fAccCut = kFALSE; | |
266 | fChambers = 0; | |
267 | fHits2 = 0; | |
268 | fPadHits2 = 0; | |
269 | fFileName = 0; | |
270 | fTrH1 = 0; | |
fe4da5cc | 271 | } |
272 | ||
273 | //___________________________________________ | |
274 | AliMUON::AliMUON(const char *name, const char *title) | |
275 | : AliDetector(name,title) | |
276 | { | |
277 | //Begin_Html | |
278 | /* | |
a897a37a | 279 | <img src="gif/alimuon.gif"> |
fe4da5cc | 280 | */ |
281 | //End_Html | |
f665c1ea | 282 | |
a9e2aefa | 283 | fHits = new TClonesArray("AliMUONHit",1000); |
1cedd08a | 284 | gAlice->AddHitList(fHits); |
a9e2aefa | 285 | fPadHits = new TClonesArray("AliMUONPadHit",10000); |
286 | fNPadHits = 0; | |
fe4da5cc | 287 | fIshunt = 0; |
288 | ||
1bd26093 | 289 | fNCh = AliMUONConstants::NCh(); |
290 | fNTrackingCh = AliMUONConstants::NTrackingCh(); | |
291 | ||
f665c1ea | 292 | fNdch = new Int_t[AliMUONConstants::NCh()]; |
fe4da5cc | 293 | |
f665c1ea | 294 | fDchambers = new TObjArray(AliMUONConstants::NCh()); |
fe4da5cc | 295 | |
296 | Int_t i; | |
297 | ||
f665c1ea | 298 | for (i=0; i<AliMUONConstants::NCh() ;i++) { |
a9e2aefa | 299 | (*fDchambers)[i] = new TClonesArray("AliMUONDigit",10000); |
fe4da5cc | 300 | fNdch[i]=0; |
301 | } | |
302 | ||
f665c1ea | 303 | fNrawch = new Int_t[AliMUONConstants::NTrackingCh()]; |
a897a37a | 304 | |
f665c1ea | 305 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
a897a37a | 306 | |
f665c1ea | 307 | for (i=0; i<AliMUONConstants::NTrackingCh();i++) { |
a897a37a | 308 | (*fRawClusters)[i] = new TClonesArray("AliMUONRawCluster",10000); |
309 | fNrawch[i]=0; | |
310 | } | |
311 | ||
a9e2aefa | 312 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
313 | fNGlobalTrigger = 0; | |
314 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
315 | fNLocalTrigger = 0; | |
fe4da5cc | 316 | |
fe4da5cc | 317 | SetMarkerColor(kRed); |
a9e2aefa | 318 | // |
319 | // | |
320 | // | |
321 | // | |
f665c1ea | 322 | |
a9e2aefa | 323 | Int_t ch; |
324 | ||
f665c1ea | 325 | fChambers = new TObjArray(AliMUONConstants::NCh()); |
a9e2aefa | 326 | |
327 | // Loop over stations | |
f665c1ea | 328 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
a9e2aefa | 329 | // Loop over 2 chambers in the station |
330 | for (Int_t stCH = 0; stCH < 2; stCH++) { | |
331 | // | |
332 | // | |
333 | // Default Parameters for Muon Tracking Stations | |
334 | ||
335 | ||
336 | ch = 2 * st + stCH; | |
337 | // | |
f665c1ea | 338 | if (ch < AliMUONConstants::NTrackingCh()) { |
d81db581 | 339 | (*fChambers)[ch] = new AliMUONChamber(ch); |
a9e2aefa | 340 | } else { |
d81db581 | 341 | (*fChambers)[ch] = new AliMUONChamberTrigger(ch); |
a9e2aefa | 342 | } |
343 | ||
344 | AliMUONChamber* chamber = (AliMUONChamber*) (*fChambers)[ch]; | |
345 | ||
346 | chamber->SetGid(0); | |
347 | // Default values for Z of chambers | |
f665c1ea | 348 | chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch)); |
a9e2aefa | 349 | // |
f665c1ea | 350 | chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch)); |
5c1f55c5 | 351 | // Set chamber inner and outer radius to default |
f665c1ea | 352 | chamber->SetRInner(AliMUONConstants::Dmin(st)/2); |
353 | chamber->SetROuter(AliMUONConstants::Dmax(st)/2); | |
a9e2aefa | 354 | // |
355 | } // Chamber stCH (0, 1) in | |
356 | } // Station st (0...) | |
357 | fMaxStepGas=0.01; | |
358 | fMaxStepAlu=0.1; | |
359 | fMaxDestepGas=-1; | |
360 | fMaxDestepAlu=-1; | |
361 | // | |
362 | fMaxIterPad = 0; | |
363 | fCurIterPad = 0; | |
5c1f55c5 | 364 | // |
365 | fAccMin = 0.; | |
366 | fAccMax = 0.; | |
367 | fAccCut = kFALSE; | |
a9e2aefa | 368 | |
369 | // cp new design of AliMUONTriggerDecision | |
f665c1ea | 370 | fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit()); |
371 | for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) { | |
a9e2aefa | 372 | (*fTriggerCircuits)[circ] = new AliMUONTriggerCircuit(); |
373 | } | |
374 | // cp new design of AliMUONTriggerDecision | |
375 | ||
fe4da5cc | 376 | } |
377 | ||
378 | //___________________________________________ | |
a9e2aefa | 379 | AliMUON::AliMUON(const AliMUON& rMUON) |
380 | { | |
381 | // Dummy copy constructor | |
382 | ; | |
383 | ||
384 | } | |
385 | ||
fe4da5cc | 386 | AliMUON::~AliMUON() |
387 | { | |
de05461e | 388 | // Destructor |
a897a37a | 389 | printf("Calling AliMUON destructor !!!\n"); |
390 | ||
f665c1ea | 391 | Int_t i; |
392 | fIshunt = 0; | |
c2c0190f | 393 | |
394 | // Delete TObjArrays | |
395 | ||
396 | if (fChambers){ | |
397 | fChambers->Delete(); | |
398 | delete fChambers; | |
399 | } | |
400 | ||
401 | if (fTriggerCircuits){ | |
402 | fTriggerCircuits->Delete(); | |
403 | delete fTriggerCircuits; | |
404 | } | |
405 | ||
406 | if (fDchambers){ | |
407 | fDchambers->Delete(); | |
408 | delete fDchambers; | |
409 | } | |
410 | ||
411 | if (fRawClusters){ | |
412 | fRawClusters->Delete(); | |
413 | delete fRawClusters; | |
414 | } | |
415 | for (i=0;i<AliMUONConstants::NTrackingCh();i++) { | |
416 | fNrawch[i]=0; | |
417 | } | |
418 | ||
419 | // Delete TClonesArrays | |
420 | ||
421 | if (fPadHits){ | |
422 | fPadHits->Delete(); | |
423 | delete fPadHits; | |
424 | } | |
425 | ||
426 | if (fGlobalTrigger){ | |
427 | fGlobalTrigger->Delete(); | |
428 | delete fGlobalTrigger; | |
429 | } | |
f665c1ea | 430 | fNGlobalTrigger = 0; |
431 | ||
c2c0190f | 432 | if (fLocalTrigger){ |
433 | fLocalTrigger->Delete(); | |
434 | delete fLocalTrigger; | |
435 | } | |
f665c1ea | 436 | fNLocalTrigger = 0; |
a897a37a | 437 | |
c2c0190f | 438 | if (fHits2){ |
439 | fHits2->Delete(); | |
440 | delete fHits2; | |
f665c1ea | 441 | } |
c2c0190f | 442 | |
443 | if (fPadHits2){ | |
444 | fPadHits2->Delete(); | |
445 | delete fPadHits2; | |
f665c1ea | 446 | } |
c2c0190f | 447 | |
448 | if (fHits) { | |
449 | fHits->Delete(); | |
450 | delete fHits; | |
451 | } | |
452 | ||
453 | // Delete hits tree for background event | |
454 | ||
455 | if (fTrH1) { | |
456 | fTrH1->Delete(); | |
457 | delete fTrH1; | |
f665c1ea | 458 | } |
fe4da5cc | 459 | } |
460 | ||
461 | //___________________________________________ | |
462 | void AliMUON::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
463 | { | |
464 | TClonesArray &lhits = *fHits; | |
a9e2aefa | 465 | new(lhits[fNhits++]) AliMUONHit(fIshunt,track,vol,hits); |
fe4da5cc | 466 | } |
467 | //___________________________________________ | |
a9e2aefa | 468 | void AliMUON::AddPadHit(Int_t *clhits) |
fe4da5cc | 469 | { |
a9e2aefa | 470 | TClonesArray &lclusters = *fPadHits; |
471 | new(lclusters[fNPadHits++]) AliMUONPadHit(clhits); | |
fe4da5cc | 472 | } |
473 | //_____________________________________________________________________________ | |
474 | void AliMUON::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) | |
475 | { | |
476 | // | |
477 | // Add a MUON digit to the list | |
478 | // | |
479 | ||
480 | TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]); | |
a9e2aefa | 481 | new(ldigits[fNdch[id]++]) AliMUONDigit(tracks,charges,digits); |
fe4da5cc | 482 | } |
483 | ||
a897a37a | 484 | //_____________________________________________________________________________ |
485 | void AliMUON::AddRawCluster(Int_t id, const AliMUONRawCluster& c) | |
486 | { | |
487 | // | |
488 | // Add a MUON digit to the list | |
489 | // | |
490 | ||
491 | TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]); | |
492 | new(lrawcl[fNrawch[id]++]) AliMUONRawCluster(c); | |
493 | } | |
a897a37a | 494 | |
a9e2aefa | 495 | //___________________________________________ |
496 | void AliMUON::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus, | |
497 | Int_t *singleUndef, | |
498 | Int_t *pairUnlike, Int_t *pairLike) | |
499 | { | |
500 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) | |
501 | TClonesArray &globalTrigger = *fGlobalTrigger; | |
502 | new(globalTrigger[fNGlobalTrigger++]) | |
503 | AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, | |
504 | pairLike); | |
505 | } | |
506 | //___________________________________________ | |
507 | void AliMUON::AddLocalTrigger(Int_t *localtr) | |
508 | { | |
509 | // add a MUON Local Trigger to the list | |
510 | TClonesArray &localTrigger = *fLocalTrigger; | |
511 | new(localTrigger[fNLocalTrigger++]) AliMUONLocalTrigger(localtr); | |
a897a37a | 512 | } |
513 | ||
fe4da5cc | 514 | //___________________________________________ |
515 | void AliMUON::BuildGeometry() | |
516 | { | |
de05461e | 517 | // Geometry for event display |
5fd73042 | 518 | for (Int_t i=0; i<7; i++) { |
519 | for (Int_t j=0; j<2; j++) { | |
520 | Int_t id=2*i+j+1; | |
521 | this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); | |
a897a37a | 522 | } |
5fd73042 | 523 | } |
fe4da5cc | 524 | } |
525 | ||
526 | //___________________________________________ | |
527 | Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t ) | |
528 | { | |
529 | return 9999; | |
530 | } | |
531 | ||
532 | //___________________________________________ | |
2ab0c725 | 533 | void AliMUON::MakeBranch(Option_t* option, char *file) |
fe4da5cc | 534 | { |
2ab0c725 | 535 | // |
f665c1ea | 536 | // Create Tree branches for the MUON. |
2ab0c725 | 537 | // |
f665c1ea | 538 | const Int_t kBufferSize = 4000; |
539 | char branchname[30]; | |
540 | sprintf(branchname,"%sCluster",GetName()); | |
541 | ||
2ab0c725 | 542 | AliDetector::MakeBranch(option,file); |
f665c1ea | 543 | |
2ab0c725 | 544 | char *cD = strstr(option,"D"); |
545 | char *cR = strstr(option,"R"); | |
546 | char *cH = strstr(option,"H"); | |
547 | ||
548 | if (fPadHits && gAlice->TreeH() && cH) { | |
549 | gAlice->MakeBranchInTree(gAlice->TreeH(), | |
550 | branchname, &fPadHits, kBufferSize, file) ; | |
551 | printf("Making Branch %s for clusters\n",branchname); | |
f665c1ea | 552 | } |
553 | ||
2ab0c725 | 554 | if (cD) { |
555 | // | |
556 | // one branch for digits per chamber | |
557 | // | |
558 | Int_t i; | |
f665c1ea | 559 | |
2ab0c725 | 560 | for (i=0; i<AliMUONConstants::NCh() ;i++) { |
561 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
562 | if (fDchambers && gAlice->TreeD()) { | |
563 | gAlice->MakeBranchInTree(gAlice->TreeD(), | |
564 | branchname, &((*fDchambers)[i]), kBufferSize, file) ; | |
565 | printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); | |
566 | } | |
567 | } | |
f665c1ea | 568 | } |
569 | ||
2ab0c725 | 570 | if (cR) { |
571 | // | |
572 | // one branch for raw clusters per chamber | |
573 | // | |
574 | printf("Make Branch - TreeR address %p\n",gAlice->TreeR()); | |
575 | ||
576 | Int_t i; | |
577 | ||
578 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) { | |
579 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
580 | if (fRawClusters && gAlice->TreeR()) { | |
581 | gAlice->MakeBranchInTree(gAlice->TreeR(), | |
582 | branchname, &((*fRawClusters)[i]), kBufferSize, file) ; | |
583 | printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); | |
584 | } | |
585 | } | |
586 | // | |
587 | // one branch for global trigger | |
588 | // | |
589 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
590 | if (fGlobalTrigger && gAlice->TreeR()) { | |
591 | gAlice->MakeBranchInTree(gAlice->TreeR(), | |
592 | branchname, &fGlobalTrigger, kBufferSize, file) ; | |
593 | printf("Making Branch %s for Global Trigger\n",branchname); | |
594 | } | |
595 | // | |
596 | // one branch for local trigger | |
597 | // | |
598 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
599 | if (fLocalTrigger && gAlice->TreeR()) { | |
600 | gAlice->MakeBranchInTree(gAlice->TreeR(), | |
601 | branchname, &fLocalTrigger, kBufferSize, file) ; | |
602 | printf("Making Branch %s for Local Trigger\n",branchname); | |
603 | } | |
604 | } | |
fe4da5cc | 605 | } |
606 | ||
607 | //___________________________________________ | |
608 | void AliMUON::SetTreeAddress() | |
609 | { | |
610 | // Set branch address for the Hits and Digits Tree. | |
a897a37a | 611 | char branchname[30]; |
fe4da5cc | 612 | AliDetector::SetTreeAddress(); |
613 | ||
614 | TBranch *branch; | |
615 | TTree *treeH = gAlice->TreeH(); | |
616 | TTree *treeD = gAlice->TreeD(); | |
a897a37a | 617 | TTree *treeR = gAlice->TreeR(); |
fe4da5cc | 618 | |
619 | if (treeH) { | |
a9e2aefa | 620 | if (fPadHits) { |
fe4da5cc | 621 | branch = treeH->GetBranch("MUONCluster"); |
a9e2aefa | 622 | if (branch) branch->SetAddress(&fPadHits); |
fe4da5cc | 623 | } |
624 | } | |
625 | ||
626 | if (treeD) { | |
f665c1ea | 627 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
fe4da5cc | 628 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
629 | if (fDchambers) { | |
630 | branch = treeD->GetBranch(branchname); | |
631 | if (branch) branch->SetAddress(&((*fDchambers)[i])); | |
632 | } | |
633 | } | |
634 | } | |
a897a37a | 635 | |
636 | // printf("SetTreeAddress --- treeR address %p \n",treeR); | |
637 | ||
638 | if (treeR) { | |
f665c1ea | 639 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
a897a37a | 640 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); |
641 | if (fRawClusters) { | |
642 | branch = treeR->GetBranch(branchname); | |
643 | if (branch) branch->SetAddress(&((*fRawClusters)[i])); | |
644 | } | |
645 | } | |
a897a37a | 646 | |
a9e2aefa | 647 | if (fLocalTrigger) { |
648 | branch = treeR->GetBranch("MUONLocalTrigger"); | |
649 | if (branch) branch->SetAddress(&fLocalTrigger); | |
650 | } | |
651 | if (fGlobalTrigger) { | |
652 | branch = treeR->GetBranch("MUONGlobalTrigger"); | |
653 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
654 | } | |
655 | } | |
fe4da5cc | 656 | } |
657 | //___________________________________________ | |
658 | void AliMUON::ResetHits() | |
659 | { | |
660 | // Reset number of clusters and the cluster array for this detector | |
661 | AliDetector::ResetHits(); | |
a9e2aefa | 662 | fNPadHits = 0; |
663 | if (fPadHits) fPadHits->Clear(); | |
fe4da5cc | 664 | } |
665 | ||
666 | //____________________________________________ | |
667 | void AliMUON::ResetDigits() | |
668 | { | |
669 | // | |
670 | // Reset number of digits and the digits array for this detector | |
671 | // | |
f665c1ea | 672 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { |
a897a37a | 673 | if ((*fDchambers)[i]) ((TClonesArray*)(*fDchambers)[i])->Clear(); |
fe4da5cc | 674 | if (fNdch) fNdch[i]=0; |
675 | } | |
676 | } | |
a897a37a | 677 | //____________________________________________ |
678 | void AliMUON::ResetRawClusters() | |
679 | { | |
680 | // | |
681 | // Reset number of raw clusters and the raw clust array for this detector | |
682 | // | |
f665c1ea | 683 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { |
a897a37a | 684 | if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear(); |
685 | if (fNrawch) fNrawch[i]=0; | |
686 | } | |
687 | } | |
a9e2aefa | 688 | |
a897a37a | 689 | //____________________________________________ |
a9e2aefa | 690 | void AliMUON::ResetTrigger() |
a897a37a | 691 | { |
a9e2aefa | 692 | // Reset Local and Global Trigger |
693 | fNGlobalTrigger = 0; | |
694 | if (fGlobalTrigger) fGlobalTrigger->Clear(); | |
695 | fNLocalTrigger = 0; | |
696 | if (fLocalTrigger) fLocalTrigger->Clear(); | |
697 | } | |
698 | ||
699 | //____________________________________________ | |
700 | void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2) | |
701 | { | |
de05461e | 702 | // Set the pad size for chamber id and cathode isec |
a9e2aefa | 703 | Int_t i=2*(id-1); |
704 | ((AliMUONChamber*) (*fChambers)[i]) ->SetPadSize(isec,p1,p2); | |
705 | ((AliMUONChamber*) (*fChambers)[i+1])->SetPadSize(isec,p1,p2); | |
a897a37a | 706 | } |
707 | ||
fe4da5cc | 708 | //___________________________________________ |
a9e2aefa | 709 | void AliMUON::SetChambersZ(const Float_t *Z) |
710 | { | |
711 | // Set Z values for all chambers (tracking and trigger) | |
712 | // from the array pointed to by "Z" | |
f665c1ea | 713 | for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) |
714 | ((AliMUONChamber*) ((*fChambers)[ch]))->SetZ(Z[ch]); | |
715 | return; | |
a9e2aefa | 716 | } |
fe4da5cc | 717 | |
a9e2aefa | 718 | //___________________________________________ |
719 | void AliMUON::SetChambersZToDefault() | |
fe4da5cc | 720 | { |
a9e2aefa | 721 | // Set Z values for all chambers (tracking and trigger) |
722 | // to default values | |
f665c1ea | 723 | SetChambersZ(AliMUONConstants::DefaultChamberZ()); |
a9e2aefa | 724 | return; |
fe4da5cc | 725 | } |
726 | ||
727 | //___________________________________________ | |
a897a37a | 728 | void AliMUON::SetChargeSlope(Int_t id, Float_t p1) |
fe4da5cc | 729 | { |
de05461e | 730 | // Set the inverse charge slope for chamber id |
fe4da5cc | 731 | Int_t i=2*(id-1); |
a9e2aefa | 732 | ((AliMUONChamber*) (*fChambers)[i])->SetChargeSlope(p1); |
733 | ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSlope(p1); | |
fe4da5cc | 734 | } |
735 | ||
736 | //___________________________________________ | |
a897a37a | 737 | void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2) |
fe4da5cc | 738 | { |
de05461e | 739 | // Set sigma of charge spread for chamber id |
fe4da5cc | 740 | Int_t i=2*(id-1); |
a9e2aefa | 741 | ((AliMUONChamber*) (*fChambers)[i])->SetChargeSpread(p1,p2); |
742 | ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSpread(p1,p2); | |
fe4da5cc | 743 | } |
744 | ||
745 | //___________________________________________ | |
a897a37a | 746 | void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1) |
fe4da5cc | 747 | { |
de05461e | 748 | // Set integration limits for charge spread |
fe4da5cc | 749 | Int_t i=2*(id-1); |
a9e2aefa | 750 | ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1); |
751 | ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1); | |
fe4da5cc | 752 | } |
753 | ||
754 | //___________________________________________ | |
d09fafb0 | 755 | void AliMUON::SetMaxAdc(Int_t id, Int_t p1) |
fe4da5cc | 756 | { |
de05461e | 757 | // Set maximum number for ADCcounts (saturation) |
fe4da5cc | 758 | Int_t i=2*(id-1); |
a9e2aefa | 759 | ((AliMUONChamber*) (*fChambers)[i])->SetMaxAdc(p1); |
760 | ((AliMUONChamber*) (*fChambers)[i+1])->SetMaxAdc(p1); | |
fe4da5cc | 761 | } |
762 | ||
763 | //___________________________________________ | |
a897a37a | 764 | void AliMUON::SetMaxStepGas(Float_t p1) |
fe4da5cc | 765 | { |
de05461e | 766 | // Set stepsize in gas |
fe4da5cc | 767 | fMaxStepGas=p1; |
768 | } | |
769 | ||
770 | //___________________________________________ | |
a897a37a | 771 | void AliMUON::SetMaxStepAlu(Float_t p1) |
fe4da5cc | 772 | { |
de05461e | 773 | // Set step size in Alu |
fe4da5cc | 774 | fMaxStepAlu=p1; |
775 | } | |
776 | ||
777 | //___________________________________________ | |
a897a37a | 778 | void AliMUON::SetMaxDestepGas(Float_t p1) |
fe4da5cc | 779 | { |
de05461e | 780 | // Set maximum step size in Gas |
fe4da5cc | 781 | fMaxDestepGas=p1; |
782 | } | |
783 | ||
784 | //___________________________________________ | |
a897a37a | 785 | void AliMUON::SetMaxDestepAlu(Float_t p1) |
fe4da5cc | 786 | { |
de05461e | 787 | // Set maximum step size in Alu |
fe4da5cc | 788 | fMaxDestepAlu=p1; |
789 | } | |
790 | //___________________________________________ | |
5c1f55c5 | 791 | void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax) |
fe4da5cc | 792 | { |
de05461e | 793 | // Set acceptance cuts |
fe4da5cc | 794 | fAccCut=acc; |
5c1f55c5 | 795 | fAccMin=angmin*TMath::Pi()/180; |
796 | fAccMax=angmax*TMath::Pi()/180; | |
797 | Int_t ch; | |
798 | if (acc) { | |
799 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { | |
800 | // Loop over 2 chambers in the station | |
801 | for (Int_t stCH = 0; stCH < 2; stCH++) { | |
802 | ch = 2 * st + stCH; | |
803 | // Set chamber inner and outer radius according to acceptance cuts | |
804 | Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin)); | |
805 | Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax)); | |
806 | } // chamber loop | |
807 | } // station loop | |
808 | } | |
fe4da5cc | 809 | } |
810 | //___________________________________________ | |
a30a000f | 811 | void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation) |
fe4da5cc | 812 | { |
de05461e | 813 | // Set the segmentation for chamber id cathode isec |
a9e2aefa | 814 | ((AliMUONChamber*) (*fChambers)[id])->SetSegmentationModel(isec, segmentation); |
fe4da5cc | 815 | |
816 | } | |
817 | //___________________________________________ | |
a9e2aefa | 818 | void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response) |
fe4da5cc | 819 | { |
de05461e | 820 | // Set the response for chamber id |
a9e2aefa | 821 | ((AliMUONChamber*) (*fChambers)[id])->SetResponseModel(response); |
fe4da5cc | 822 | } |
823 | ||
30aaba74 | 824 | void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst) |
a897a37a | 825 | { |
de05461e | 826 | // Set ClusterFinder for chamber id |
a9e2aefa | 827 | ((AliMUONChamber*) (*fChambers)[id])->SetReconstructionModel(reconst); |
a897a37a | 828 | } |
829 | ||
fe4da5cc | 830 | void AliMUON::SetNsec(Int_t id, Int_t nsec) |
831 | { | |
de05461e | 832 | // Set number of segmented cathods for chamber id |
a9e2aefa | 833 | ((AliMUONChamber*) (*fChambers)[id])->SetNsec(nsec); |
fe4da5cc | 834 | } |
835 | ||
fe4da5cc | 836 | //___________________________________________ |
2ab0c725 | 837 | void AliMUON::SDigits2Digits() |
838 | { | |
839 | Int_t evNumber2=0, ibg=0, bgr=0; | |
840 | Int_t nbgr_ev= 0, nev=0; | |
fe4da5cc | 841 | |
2ab0c725 | 842 | Int_t nparticles = gAlice->GetNtrack(); |
843 | cout << "nev " <<nev<<endl; | |
844 | cout << "nparticles " <<nparticles<<endl; | |
845 | if (nparticles <= 0) return; | |
a897a37a | 846 | |
2ab0c725 | 847 | nbgr_ev = Int_t(nev*bgr/(evNumber2+1)); |
848 | ||
849 | if (ibg) { | |
850 | printf("nbgr_ev %d\n",nbgr_ev); | |
851 | Digitise(nev,nbgr_ev,"Add"," ","galice_bgr.root"); | |
852 | } | |
853 | else { | |
854 | Digitise(nev,nbgr_ev,"rien","",""); | |
855 | } | |
856 | } | |
a9e2aefa | 857 | |
2ab0c725 | 858 | //___________________________________________ |
802a864d | 859 | void AliMUON::MakePadHits(Float_t xhit,Float_t yhit, Float_t zhit, |
a9e2aefa | 860 | Float_t eloss, Float_t tof, Int_t idvol) |
fe4da5cc | 861 | { |
862 | // | |
a897a37a | 863 | // Calls the charge disintegration method of the current chamber and adds |
864 | // the simulated cluster to the root treee | |
fe4da5cc | 865 | // |
a897a37a | 866 | Int_t clhits[7]; |
867 | Float_t newclust[6][500]; | |
868 | Int_t nnew; | |
869 | ||
870 | ||
fe4da5cc | 871 | // |
a897a37a | 872 | // Integrated pulse height on chamber |
873 | ||
874 | ||
875 | clhits[0]=fNhits+1; | |
fe4da5cc | 876 | // |
a897a37a | 877 | // |
7ab910ae | 878 | // if (idvol == 6) printf("\n ->Disintegration %f %f %f", xhit, yhit, eloss ); |
879 | ||
880 | ||
a9e2aefa | 881 | ((AliMUONChamber*) (*fChambers)[idvol]) |
802a864d | 882 | ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust); |
a897a37a | 883 | Int_t ic=0; |
7ab910ae | 884 | // if (idvol == 6) printf("\n nnew %d \n", nnew); |
a897a37a | 885 | // |
886 | // Add new clusters | |
887 | for (Int_t i=0; i<nnew; i++) { | |
888 | if (Int_t(newclust[3][i]) > 0) { | |
889 | ic++; | |
890 | // Cathode plane | |
891 | clhits[1] = Int_t(newclust[5][i]); | |
892 | // Cluster Charge | |
893 | clhits[2] = Int_t(newclust[0][i]); | |
894 | // Pad: ix | |
895 | clhits[3] = Int_t(newclust[1][i]); | |
896 | // Pad: iy | |
897 | clhits[4] = Int_t(newclust[2][i]); | |
898 | // Pad: charge | |
899 | clhits[5] = Int_t(newclust[3][i]); | |
900 | // Pad: chamber sector | |
901 | clhits[6] = Int_t(newclust[4][i]); | |
902 | ||
a9e2aefa | 903 | AddPadHit(clhits); |
a897a37a | 904 | } |
905 | } | |
a897a37a | 906 | } |
907 | ||
a9e2aefa | 908 | //---------------------------------------------------------------------- |
909 | ||
910 | void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,Text_t *filename) | |
a897a37a | 911 | { |
912 | // keep galice.root for signal and name differently the file for | |
913 | // background when add! otherwise the track info for signal will be lost ! | |
914 | ||
a6f39961 | 915 | static Bool_t first=kTRUE; |
a9e2aefa | 916 | static TFile *file; |
917 | char *addBackground = strstr(option,"Add"); | |
a897a37a | 918 | |
f665c1ea | 919 | |
a30a000f | 920 | AliMUONChamber* iChamber; |
921 | AliSegmentation* segmentation; | |
a897a37a | 922 | |
923 | ||
924 | Int_t trk[50]; | |
925 | Int_t chtrk[50]; | |
926 | TObjArray *list=new TObjArray; | |
a9e2aefa | 927 | static TClonesArray *pAddress=0; |
928 | if(!pAddress) pAddress=new TClonesArray("TVector",1000); | |
a897a37a | 929 | Int_t digits[5]; |
930 | ||
a9e2aefa | 931 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); |
a30a000f | 932 | AliHitMap** hitMap= new AliHitMap* [AliMUONConstants::NCh()]; |
f665c1ea | 933 | for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {hitMap[i]=0;} |
a9e2aefa | 934 | if (addBackground ) { |
a897a37a | 935 | if(first) { |
936 | fFileName=filename; | |
937 | cout<<"filename"<<fFileName<<endl; | |
a9e2aefa | 938 | file=new TFile(fFileName); |
a897a37a | 939 | cout<<"I have opened "<<fFileName<<" file "<<endl; |
a9e2aefa | 940 | fHits2 = new TClonesArray("AliMUONHit",1000 ); |
941 | fPadHits2 = new TClonesArray("AliMUONPadHit",10000); | |
a897a37a | 942 | } |
a6f39961 | 943 | first=kFALSE; |
a9e2aefa | 944 | file->cd(); |
945 | //file->ls(); | |
a897a37a | 946 | // Get Hits Tree header from file |
947 | if(fHits2) fHits2->Clear(); | |
a9e2aefa | 948 | if(fPadHits2) fPadHits2->Clear(); |
949 | if(fTrH1) delete fTrH1; | |
950 | fTrH1=0; | |
a897a37a | 951 | |
952 | char treeName[20]; | |
a9e2aefa | 953 | sprintf(treeName,"TreeH%d",bgrEvent); |
954 | fTrH1 = (TTree*)gDirectory->Get(treeName); | |
955 | //printf("fTrH1 %p of treename %s for event %d \n",fTrH1,treeName,bgrEvent); | |
a897a37a | 956 | |
a9e2aefa | 957 | if (!fTrH1) { |
958 | printf("ERROR: cannot find Hits Tree for event:%d\n",bgrEvent); | |
a897a37a | 959 | } |
960 | // Set branch addresses | |
961 | TBranch *branch; | |
962 | char branchname[20]; | |
963 | sprintf(branchname,"%s",GetName()); | |
a9e2aefa | 964 | if (fTrH1 && fHits2) { |
965 | branch = fTrH1->GetBranch(branchname); | |
a897a37a | 966 | if (branch) branch->SetAddress(&fHits2); |
967 | } | |
a9e2aefa | 968 | if (fTrH1 && fPadHits2) { |
969 | branch = fTrH1->GetBranch("MUONCluster"); | |
970 | if (branch) branch->SetAddress(&fPadHits2); | |
a897a37a | 971 | } |
972 | // test | |
a9e2aefa | 973 | //Int_t ntracks1 =(Int_t)fTrH1->GetEntries(); |
a897a37a | 974 | //printf("background - ntracks1 - %d\n",ntracks1); |
975 | } | |
976 | // | |
977 | // loop over cathodes | |
978 | // | |
a30a000f | 979 | AliHitMap* hm; |
a897a37a | 980 | Int_t countadr=0; |
981 | for (int icat=0; icat<2; icat++) { | |
a897a37a | 982 | Int_t counter=0; |
d09fafb0 | 983 | Int_t * nmuon = new Int_t [AliMUONConstants::NCh()]; |
f665c1ea | 984 | for (Int_t i =0; i<AliMUONConstants::NCh(); i++) { |
a9e2aefa | 985 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
a897a37a | 986 | if (iChamber->Nsec()==1 && icat==1) { |
fe4da5cc | 987 | continue; |
a897a37a | 988 | } else { |
a9e2aefa | 989 | segmentation=iChamber->SegmentationModel(icat+1); |
fe4da5cc | 990 | } |
a9e2aefa | 991 | hitMap[i] = new AliMUONHitMapA1(segmentation, list); |
f665c1ea | 992 | nmuon[i]=0; |
a897a37a | 993 | } |
994 | //printf("Start loop over tracks \n"); | |
995 | // | |
996 | // Loop over tracks | |
997 | // | |
998 | ||
a9e2aefa | 999 | TTree *treeH = gAlice->TreeH(); |
1000 | Int_t ntracks =(Int_t) treeH->GetEntries(); | |
d09fafb0 | 1001 | Int_t jj; |
48030acd | 1002 | Int_t nmaxmuon = 5; |
6b18d06a | 1003 | |
1004 | Float_t ** xhit = new Float_t * [AliMUONConstants::NCh()]; | |
48030acd | 1005 | for (jj=0; jj<AliMUONConstants::NCh(); jj++) |
1006 | xhit[jj] = new Float_t[nmaxmuon]; | |
45085cb9 | 1007 | Float_t ** yhit = new Float_t * [AliMUONConstants::NCh()]; |
48030acd | 1008 | for (jj=0; jj<AliMUONConstants::NCh(); jj++) |
1009 | yhit[jj] = new Float_t[nmaxmuon]; | |
6b18d06a | 1010 | |
a897a37a | 1011 | for (Int_t track=0; track<ntracks; track++) { |
1012 | gAlice->ResetHits(); | |
a9e2aefa | 1013 | treeH->GetEvent(track); |
a897a37a | 1014 | // |
1015 | // Loop over hits | |
a9e2aefa | 1016 | for(AliMUONHit* mHit=(AliMUONHit*)pMUON->FirstHit(-1); |
a897a37a | 1017 | mHit; |
a9e2aefa | 1018 | mHit=(AliMUONHit*)pMUON->NextHit()) |
a897a37a | 1019 | { |
1020 | Int_t nch = mHit->fChamber-1; // chamber number | |
f665c1ea | 1021 | if (nch > AliMUONConstants::NCh()-1) continue; |
7ab910ae | 1022 | // if (nch > 9) continue; |
a9e2aefa | 1023 | iChamber = &(pMUON->Chamber(nch)); |
a897a37a | 1024 | // new 17.07.99 |
a9e2aefa | 1025 | if (addBackground) { |
1026 | ||
1027 | if (mHit->fParticle == kMuonPlus | |
1028 | || mHit->fParticle == kMuonMinus) { | |
48030acd | 1029 | // mark muon hits |
1030 | if (nmuon[nch] < nmaxmuon) { | |
94de3818 | 1031 | xhit[nch][nmuon[nch]]=mHit->X(); |
1032 | yhit[nch][nmuon[nch]]=mHit->Y(); | |
a9e2aefa | 1033 | nmuon[nch]++; |
48030acd | 1034 | } |
1035 | // ignore muon if too many compared to nmaxmuon | |
1036 | else printf("AliMUON::Digitize: nmuon %d ==> ignored\n",nmuon[nch]); | |
a9e2aefa | 1037 | } |
fe4da5cc | 1038 | } |
a9e2aefa | 1039 | |
a897a37a | 1040 | |
1041 | ||
1042 | ||
1043 | // | |
1044 | // Loop over pad hits | |
a9e2aefa | 1045 | for (AliMUONPadHit* mPad= |
1046 | (AliMUONPadHit*)pMUON->FirstPad(mHit,fPadHits); | |
a897a37a | 1047 | mPad; |
a9e2aefa | 1048 | mPad=(AliMUONPadHit*)pMUON->NextPad(fPadHits)) |
a897a37a | 1049 | { |
1050 | Int_t cathode = mPad->fCathode; // cathode number | |
1051 | Int_t ipx = mPad->fPadX; // pad number on X | |
1052 | Int_t ipy = mPad->fPadY; // pad number on Y | |
a9e2aefa | 1053 | Int_t iqpad = Int_t(mPad->fQpad);// charge per pad |
7ab910ae | 1054 | // printf("\n Pad: %d %d %d %d", ipx, ipy, cathode,nch); |
a897a37a | 1055 | // |
1056 | // | |
1057 | ||
1058 | if (cathode != (icat+1)) continue; | |
1059 | // fill the info array | |
7ab910ae | 1060 | // Float_t thex, they, thez; |
a9e2aefa | 1061 | segmentation=iChamber->SegmentationModel(cathode); |
7ab910ae | 1062 | // segmentation->GetPadC(ipx,ipy,thex,they,thez); |
a9e2aefa | 1063 | // Float_t rpad=TMath::Sqrt(thex*thex+they*they); |
1064 | // if (rpad < rmin || iqpad ==0 || rpad > rmax) continue; | |
a897a37a | 1065 | |
a9e2aefa | 1066 | new((*pAddress)[countadr++]) TVector(2); |
1067 | TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]); | |
a897a37a | 1068 | trinfo(0)=(Float_t)track; |
1069 | trinfo(1)=(Float_t)iqpad; | |
1070 | ||
1071 | digits[0]=ipx; | |
1072 | digits[1]=ipy; | |
1073 | digits[2]=iqpad; | |
1074 | digits[3]=iqpad; | |
a9e2aefa | 1075 | if (mHit->fParticle == kMuonPlus || |
1076 | mHit->fParticle == kMuonMinus) { | |
1077 | digits[4]=mPad->fHitNumber; | |
a897a37a | 1078 | } else digits[4]=-1; |
1079 | ||
a9e2aefa | 1080 | AliMUONTransientDigit* pdigit; |
a897a37a | 1081 | // build the list of fired pads and update the info |
a9e2aefa | 1082 | if (!hitMap[nch]->TestHit(ipx, ipy)) { |
a897a37a | 1083 | |
1084 | list->AddAtAndExpand( | |
a9e2aefa | 1085 | new AliMUONTransientDigit(nch,digits),counter); |
a897a37a | 1086 | |
a9e2aefa | 1087 | hitMap[nch]->SetHit(ipx, ipy, counter); |
a897a37a | 1088 | counter++; |
a9e2aefa | 1089 | pdigit=(AliMUONTransientDigit*)list->At(list->GetLast()); |
a897a37a | 1090 | // list of tracks |
1091 | TObjArray *trlist=(TObjArray*)pdigit->TrackList(); | |
1092 | trlist->Add(&trinfo); | |
1093 | } else { | |
a9e2aefa | 1094 | pdigit=(AliMUONTransientDigit*) hitMap[nch]->GetHit(ipx, ipy); |
a897a37a | 1095 | // update charge |
1096 | (*pdigit).fSignal+=iqpad; | |
1097 | (*pdigit).fPhysics+=iqpad; | |
1098 | // update list of tracks | |
1099 | TObjArray* trlist=(TObjArray*)pdigit->TrackList(); | |
a9e2aefa | 1100 | Int_t lastEntry=trlist->GetLast(); |
1101 | TVector *pTrack=(TVector*)trlist->At(lastEntry); | |
1102 | TVector &ptrk=*pTrack; | |
7ab910ae | 1103 | Int_t lastTrack = Int_t(ptrk(0)); |
1104 | Int_t lastCharge = Int_t(ptrk(1)); | |
a9e2aefa | 1105 | if (lastTrack==track) { |
1106 | lastCharge+=iqpad; | |
1107 | trlist->RemoveAt(lastEntry); | |
1108 | trinfo(0)=lastTrack; | |
1109 | trinfo(1)=lastCharge; | |
1110 | trlist->AddAt(&trinfo,lastEntry); | |
a897a37a | 1111 | } else { |
1112 | trlist->Add(&trinfo); | |
1113 | } | |
1114 | // check the track list | |
1115 | Int_t nptracks=trlist->GetEntriesFast(); | |
1116 | if (nptracks > 2) { | |
1117 | for (Int_t tr=0;tr<nptracks;tr++) { | |
a9e2aefa | 1118 | TVector *ppTrack=(TVector*)trlist->At(tr); |
1119 | TVector &pptrk=*ppTrack; | |
7ab910ae | 1120 | trk[tr] = Int_t(pptrk(0)); |
1121 | chtrk[tr] = Int_t(pptrk(1)); | |
a897a37a | 1122 | } |
1123 | } // end if nptracks | |
1124 | } // end if pdigit | |
1125 | } //end loop over clusters | |
1126 | } // hit loop | |
1127 | } // track loop | |
a897a37a | 1128 | |
1129 | // open the file with background | |
1130 | ||
a9e2aefa | 1131 | if (addBackground) { |
1132 | ntracks =(Int_t)fTrH1->GetEntries(); | |
a897a37a | 1133 | // |
1134 | // Loop over tracks | |
1135 | // | |
1136 | for (Int_t track=0; track<ntracks; track++) { | |
1137 | ||
1138 | if (fHits2) fHits2->Clear(); | |
a9e2aefa | 1139 | if (fPadHits2) fPadHits2->Clear(); |
a897a37a | 1140 | |
a9e2aefa | 1141 | fTrH1->GetEvent(track); |
a897a37a | 1142 | // |
1143 | // Loop over hits | |
a9e2aefa | 1144 | AliMUONHit* mHit; |
a897a37a | 1145 | for(int i=0;i<fHits2->GetEntriesFast();++i) |
a9e2aefa | 1146 | { |
1147 | mHit=(AliMUONHit*) (*fHits2)[i]; | |
a897a37a | 1148 | Int_t nch = mHit->fChamber-1; // chamber number |
1149 | if (nch >9) continue; | |
a9e2aefa | 1150 | iChamber = &(pMUON->Chamber(nch)); |
0234695f | 1151 | // Int_t rmin = (Int_t)iChamber->RInner(); |
1152 | // Int_t rmax = (Int_t)iChamber->ROuter(); | |
94de3818 | 1153 | Float_t xbgr=mHit->X(); |
1154 | Float_t ybgr=mHit->Y(); | |
a6f39961 | 1155 | Bool_t cond=kFALSE; |
a897a37a | 1156 | |
1157 | for (Int_t imuon =0; imuon < nmuon[nch]; imuon++) { | |
1158 | Float_t dist= (xbgr-xhit[nch][imuon])*(xbgr-xhit[nch][imuon]) | |
1159 | +(ybgr-yhit[nch][imuon])*(ybgr-yhit[nch][imuon]); | |
a6f39961 | 1160 | if (dist<100) cond=kTRUE; |
a897a37a | 1161 | } |
1162 | if (!cond) continue; | |
1163 | ||
1164 | // | |
1165 | // Loop over pad hits | |
a9e2aefa | 1166 | for (AliMUONPadHit* mPad= |
1167 | (AliMUONPadHit*)pMUON->FirstPad(mHit,fPadHits2); | |
a897a37a | 1168 | mPad; |
a9e2aefa | 1169 | mPad=(AliMUONPadHit*)pMUON->NextPad(fPadHits2)) |
a897a37a | 1170 | { |
a9e2aefa | 1171 | // mPad = (AliMUONPadHit*) (*fPadHits2)[j]; |
a897a37a | 1172 | Int_t cathode = mPad->fCathode; // cathode number |
1173 | Int_t ipx = mPad->fPadX; // pad number on X | |
1174 | Int_t ipy = mPad->fPadY; // pad number on Y | |
a9e2aefa | 1175 | Int_t iqpad = Int_t(mPad->fQpad);// charge per pad |
a897a37a | 1176 | |
1177 | if (cathode != (icat+1)) continue; | |
48030acd | 1178 | // printf("\n Pad: %d %d %d", ipx, ipy, cathode); |
7ab910ae | 1179 | |
1180 | // Float_t thex, they, thez; | |
1181 | // segmentation=iChamber->SegmentationModel(cathode); | |
1182 | // segmentation->GetPadC(ipx,ipy,thex,they,thez); | |
1183 | // Float_t rpad=TMath::Sqrt(thex*thex+they*they); | |
1184 | // if (rpad < rmin || iqpad ==0 || rpad > rmax) continue; | |
a9e2aefa | 1185 | new((*pAddress)[countadr++]) TVector(2); |
1186 | TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]); | |
1187 | trinfo(0)=-1; // tag background | |
1188 | trinfo(1)=-1; | |
1189 | ||
a897a37a | 1190 | digits[0]=ipx; |
1191 | digits[1]=ipy; | |
1192 | digits[2]=iqpad; | |
1193 | digits[3]=0; | |
1194 | digits[4]=-1; | |
a897a37a | 1195 | |
a9e2aefa | 1196 | AliMUONTransientDigit* pdigit; |
1197 | // build the list of fired pads and update the info | |
1198 | if (!hitMap[nch]->TestHit(ipx, ipy)) { | |
1199 | list->AddAtAndExpand(new AliMUONTransientDigit(nch,digits),counter); | |
1200 | ||
1201 | hitMap[nch]->SetHit(ipx, ipy, counter); | |
a897a37a | 1202 | counter++; |
1203 | ||
a9e2aefa | 1204 | pdigit=(AliMUONTransientDigit*)list->At(list->GetLast()); |
a897a37a | 1205 | // list of tracks |
a9e2aefa | 1206 | TObjArray *trlist=(TObjArray*)pdigit-> |
1207 | TrackList(); | |
1208 | trlist->Add(&trinfo); | |
a897a37a | 1209 | } else { |
a9e2aefa | 1210 | pdigit=(AliMUONTransientDigit*) hitMap[nch]->GetHit(ipx, ipy); |
a897a37a | 1211 | // update charge |
1212 | (*pdigit).fSignal+=iqpad; | |
a9e2aefa | 1213 | |
a897a37a | 1214 | // update list of tracks |
a9e2aefa | 1215 | TObjArray* trlist=(TObjArray*)pdigit-> |
1216 | TrackList(); | |
1217 | Int_t lastEntry=trlist->GetLast(); | |
1218 | TVector *pTrack=(TVector*)trlist-> | |
1219 | At(lastEntry); | |
1220 | TVector &ptrk=*pTrack; | |
1221 | Int_t lastTrack=Int_t(ptrk(0)); | |
1222 | if (lastTrack==-1) { | |
1223 | continue; | |
1224 | } else { | |
1225 | trlist->Add(&trinfo); | |
1226 | } | |
a897a37a | 1227 | // check the track list |
a9e2aefa | 1228 | Int_t nptracks=trlist->GetEntriesFast(); |
1229 | if (nptracks > 0) { | |
1230 | for (Int_t tr=0;tr<nptracks;tr++) { | |
1231 | TVector *ppTrack=(TVector*)trlist->At(tr); | |
1232 | TVector &pptrk=*ppTrack; | |
1233 | trk[tr]=Int_t(pptrk(0)); | |
1234 | chtrk[tr]=Int_t(pptrk(1)); | |
1235 | } | |
1236 | } // end if nptracks | |
a897a37a | 1237 | } // end if pdigit |
1238 | } //end loop over clusters | |
1239 | } // hit loop | |
1240 | } // track loop | |
1241 | //Int_t nentr2=list->GetEntriesFast(); | |
1242 | //printf(" \n counter2, nentr2 %d %d \n",counter,nentr2); | |
1243 | TTree *fAli=gAlice->TreeK(); | |
a9e2aefa | 1244 | TFile *file=NULL; |
a897a37a | 1245 | |
1246 | if (fAli) file =fAli->GetCurrentFile(); | |
1247 | file->cd(); | |
d09fafb0 | 1248 | } // if addBackground |
1249 | delete [] xhit; | |
1250 | delete [] yhit; | |
1251 | ||
a897a37a | 1252 | Int_t tracks[10]; |
1253 | Int_t charges[10]; | |
a897a37a | 1254 | Int_t nentries=list->GetEntriesFast(); |
a897a37a | 1255 | |
1256 | for (Int_t nent=0;nent<nentries;nent++) { | |
a9e2aefa | 1257 | AliMUONTransientDigit *address=(AliMUONTransientDigit*)list->At(nent); |
a897a37a | 1258 | if (address==0) continue; |
1259 | Int_t ich=address->fChamber; | |
1260 | Int_t q=address->fSignal; | |
a9e2aefa | 1261 | iChamber=(AliMUONChamber*) (*fChambers)[ich]; |
1262 | // | |
1263 | // Digit Response (noise, threshold, saturation, ...) | |
1264 | // if (address->fPhysics !=0 ) address->fPhysics+=(Int_t)Noise; | |
1265 | AliMUONResponse * response=iChamber->ResponseModel(); | |
1266 | q=response->DigitResponse(q); | |
1267 | ||
1268 | if (!q) continue; | |
1269 | ||
a897a37a | 1270 | digits[0]=address->fPadX; |
1271 | digits[1]=address->fPadY; | |
1272 | digits[2]=q; | |
1273 | digits[3]=address->fPhysics; | |
1274 | digits[4]=address->fHit; | |
a897a37a | 1275 | |
1276 | TObjArray* trlist=(TObjArray*)address->TrackList(); | |
1277 | Int_t nptracks=trlist->GetEntriesFast(); | |
1278 | //printf("nptracks, trlist %d %p\n",nptracks,trlist); | |
1279 | ||
a9e2aefa | 1280 | // this was changed to accomodate the real number of tracks |
1281 | if (nptracks > 10) { | |
1282 | cout<<"Attention - nptracks > 10 "<<nptracks<<endl; | |
1283 | nptracks=10; | |
1284 | } | |
1285 | if (nptracks > 2) { | |
1286 | printf("Attention - nptracks > 2 %d \n",nptracks); | |
1287 | printf("cat,ich,ix,iy,q %d %d %d %d %d \n",icat,ich,digits[0],digits[1],q); | |
1288 | } | |
1289 | for (Int_t tr=0;tr<nptracks;tr++) { | |
1290 | TVector *ppP=(TVector*)trlist->At(tr); | |
1291 | if(!ppP ) printf("ppP - %p\n",ppP); | |
1292 | TVector &pp =*ppP; | |
1293 | tracks[tr]=Int_t(pp(0)); | |
1294 | charges[tr]=Int_t(pp(1)); | |
a897a37a | 1295 | //printf("tracks, charges - %d %d\n",tracks[tr],charges[tr]); |
a9e2aefa | 1296 | } //end loop over list of tracks for one pad |
a897a37a | 1297 | // Sort list of tracks according to charge |
a9e2aefa | 1298 | if (nptracks > 1) { |
1299 | SortTracks(tracks,charges,nptracks); | |
1300 | } | |
1301 | if (nptracks < 10 ) { | |
1302 | for (Int_t i=nptracks; i<10; i++) { | |
1303 | tracks[i]=0; | |
1304 | charges[i]=0; | |
a897a37a | 1305 | } |
a9e2aefa | 1306 | } |
1307 | ||
a897a37a | 1308 | // fill digits |
a9e2aefa | 1309 | pMUON->AddDigits(ich,tracks,charges,digits); |
1310 | // delete trlist; | |
a897a37a | 1311 | } |
1312 | //cout<<"I'm out of the loops for digitisation"<<endl; | |
a9e2aefa | 1313 | // gAlice->GetEvent(nev); |
a897a37a | 1314 | gAlice->TreeD()->Fill(); |
a9e2aefa | 1315 | pMUON->ResetDigits(); |
a897a37a | 1316 | list->Delete(); |
d09fafb0 | 1317 | |
a9e2aefa | 1318 | |
f665c1ea | 1319 | for(Int_t ii=0;ii<AliMUONConstants::NCh();++ii) { |
a9e2aefa | 1320 | if (hitMap[ii]) { |
1321 | hm=hitMap[ii]; | |
a897a37a | 1322 | delete hm; |
a9e2aefa | 1323 | hitMap[ii]=0; |
fe4da5cc | 1324 | } |
a897a37a | 1325 | } |
d09fafb0 | 1326 | delete [] nmuon; |
a897a37a | 1327 | } //end loop over cathodes |
d09fafb0 | 1328 | delete [] hitMap; |
a9e2aefa | 1329 | char hname[30]; |
1330 | sprintf(hname,"TreeD%d",nev); | |
2ab0c725 | 1331 | gAlice->TreeD()->Write(hname,TObject::kOverwrite); |
a9e2aefa | 1332 | // reset tree |
1333 | gAlice->TreeD()->Reset(); | |
1334 | delete list; | |
1335 | ||
1336 | pAddress->Delete(); | |
1337 | // gObjectTable->Print(); | |
a897a37a | 1338 | } |
1339 | ||
1340 | void AliMUON::SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr) | |
1341 | { | |
1342 | // | |
1343 | // Sort the list of tracks contributing to a given digit | |
1344 | // Only the 3 most significant tracks are acctually sorted | |
1345 | // | |
1346 | ||
1347 | // | |
1348 | // Loop over signals, only 3 times | |
1349 | // | |
1350 | ||
1351 | Int_t qmax; | |
1352 | Int_t jmax; | |
1353 | Int_t idx[3] = {-2,-2,-2}; | |
1354 | Int_t jch[3] = {-2,-2,-2}; | |
1355 | Int_t jtr[3] = {-2,-2,-2}; | |
1356 | Int_t i,j,imax; | |
1357 | ||
1358 | if (ntr<3) imax=ntr; | |
1359 | else imax=3; | |
1360 | for(i=0;i<imax;i++){ | |
1361 | qmax=0; | |
1362 | jmax=0; | |
1363 | ||
1364 | for(j=0;j<ntr;j++){ | |
1365 | ||
1366 | if((i == 1 && j == idx[i-1]) | |
1367 | ||(i == 2 && (j == idx[i-1] || j == idx[i-2]))) continue; | |
1368 | ||
1369 | if(charges[j] > qmax) { | |
1370 | qmax = charges[j]; | |
1371 | jmax=j; | |
1372 | } | |
1373 | } | |
1374 | ||
1375 | if(qmax > 0) { | |
1376 | idx[i]=jmax; | |
1377 | jch[i]=charges[jmax]; | |
1378 | jtr[i]=tracks[jmax]; | |
1379 | } | |
1380 | ||
1381 | } | |
1382 | ||
1383 | for(i=0;i<3;i++){ | |
1384 | if (jtr[i] == -2) { | |
1385 | charges[i]=0; | |
1386 | tracks[i]=0; | |
1387 | } else { | |
1388 | charges[i]=jch[i]; | |
1389 | tracks[i]=jtr[i]; | |
1390 | } | |
1391 | } | |
1392 | ||
fe4da5cc | 1393 | } |
1394 | ||
a9e2aefa | 1395 | //___________________________________________ |
1396 | void AliMUON::Trigger(Int_t nev){ | |
1397 | // call the Trigger Algorithm and fill TreeR | |
1398 | ||
1399 | Int_t singlePlus[3] = {0,0,0}; | |
1400 | Int_t singleMinus[3] = {0,0,0}; | |
1401 | Int_t singleUndef[3] = {0,0,0}; | |
1402 | Int_t pairUnlike[3] = {0,0,0}; | |
1403 | Int_t pairLike[3] = {0,0,0}; | |
1404 | ||
1405 | ResetTrigger(); | |
a9e2aefa | 1406 | AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1); |
1407 | decision->Trigger(); | |
1408 | decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef, | |
1409 | pairUnlike, pairLike); | |
1410 | // add a local trigger in the list | |
1411 | AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); | |
9ae15266 | 1412 | Int_t i; |
a9e2aefa | 1413 | |
f665c1ea | 1414 | for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) { |
9ae15266 | 1415 | if(decision->GetITrigger(icirc)==1) { |
1416 | Int_t localtr[7]={0,0,0,0,0,0,0}; | |
1417 | Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0}; | |
1418 | decision->GetLutOutput(icirc, loLpt, loHpt, loApt); | |
1419 | localtr[0] = icirc; | |
1420 | localtr[1] = decision->GetStripX11(icirc); | |
1421 | localtr[2] = decision->GetDev(icirc); | |
1422 | localtr[3] = decision->GetStripY11(icirc); | |
1423 | for (i=0; i<2; i++) { // convert the Lut output in 1 digit | |
1424 | localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i)); | |
1425 | localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i)); | |
1426 | localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i)); | |
1427 | } | |
1428 | AddLocalTrigger(localtr); // add a local trigger in the list | |
a897a37a | 1429 | } |
a9e2aefa | 1430 | } |
1431 | delete decision; | |
a897a37a | 1432 | |
a9e2aefa | 1433 | gAlice->TreeR()->Fill(); |
1434 | ResetTrigger(); | |
a897a37a | 1435 | char hname[30]; |
1436 | sprintf(hname,"TreeR%d",nev); | |
2ab0c725 | 1437 | gAlice->TreeR()->Write(hname,TObject::kOverwrite); |
a897a37a | 1438 | gAlice->TreeR()->Reset(); |
a9e2aefa | 1439 | printf("\n End of trigger for event %d", nev); |
a897a37a | 1440 | } |
a897a37a | 1441 | |
a897a37a | 1442 | |
a9e2aefa | 1443 | //____________________________________________ |
1444 | void AliMUON::FindClusters(Int_t nev,Int_t lastEntry) | |
1445 | { | |
de05461e | 1446 | // |
1447 | // Perform cluster finding | |
1448 | // | |
a9e2aefa | 1449 | TClonesArray *dig1, *dig2; |
1450 | Int_t ndig, k; | |
1451 | dig1 = new TClonesArray("AliMUONDigit",1000); | |
1452 | dig2 = new TClonesArray("AliMUONDigit",1000); | |
1453 | AliMUONDigit *digit; | |
a897a37a | 1454 | // |
a9e2aefa | 1455 | // Loop on chambers and on cathode planes |
a897a37a | 1456 | // |
a897a37a | 1457 | |
a9e2aefa | 1458 | for (Int_t ich=0;ich<10;ich++) { |
1459 | AliMUONChamber* iChamber=(AliMUONChamber*) (*fChambers)[ich]; | |
30aaba74 | 1460 | AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel(); |
a9e2aefa | 1461 | gAlice->ResetDigits(); |
1462 | gAlice->TreeD()->GetEvent(lastEntry); | |
1463 | TClonesArray *muonDigits = this->DigitsAddress(ich); | |
1464 | ndig=muonDigits->GetEntriesFast(); | |
1465 | printf("\n 1 Found %d digits in %p %d", ndig, muonDigits,ich); | |
1466 | TClonesArray &lhits1 = *dig1; | |
1467 | Int_t n=0; | |
1468 | for (k=0; k<ndig; k++) { | |
1469 | digit=(AliMUONDigit*) muonDigits->UncheckedAt(k); | |
1470 | if (rec->TestTrack(digit->fTracks[0])) | |
1471 | new(lhits1[n++]) AliMUONDigit(*digit); | |
1472 | } | |
1473 | gAlice->ResetDigits(); | |
1474 | gAlice->TreeD()->GetEvent(lastEntry+1); | |
1475 | muonDigits = this->DigitsAddress(ich); | |
1476 | ndig=muonDigits->GetEntriesFast(); | |
1477 | printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich); | |
1478 | TClonesArray &lhits2 = *dig2; | |
1479 | n=0; | |
1480 | ||
1481 | for (k=0; k<ndig; k++) { | |
1482 | digit= (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
1483 | if (rec->TestTrack(digit->fTracks[0])) | |
1484 | new(lhits2[n++]) AliMUONDigit(*digit); | |
a897a37a | 1485 | } |
a897a37a | 1486 | |
9825400f | 1487 | if (rec) { |
1488 | AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); | |
a9e2aefa | 1489 | rec->FindRawClusters(); |
1490 | } | |
1491 | dig1->Delete(); | |
1492 | dig2->Delete(); | |
1493 | } // for ich | |
1494 | gAlice->TreeR()->Fill(); | |
1495 | ResetRawClusters(); | |
1496 | char hname[30]; | |
1497 | sprintf(hname,"TreeR%d",nev); | |
2ab0c725 | 1498 | gAlice->TreeR()->Write(hname,TObject::kOverwrite); |
a9e2aefa | 1499 | gAlice->TreeR()->Reset(); |
1500 | printf("\n End of cluster finding for event %d", nev); | |
1501 | ||
1502 | delete dig1; | |
1503 | delete dig2; | |
1504 | //gObjectTable->Print(); | |
a897a37a | 1505 | } |
a9e2aefa | 1506 | |
2ab0c725 | 1507 | #ifdef never |
fe4da5cc | 1508 | void AliMUON::Streamer(TBuffer &R__b) |
1509 | { | |
1510 | // Stream an object of class AliMUON. | |
a30a000f | 1511 | AliMUONChamber *iChamber; |
a9e2aefa | 1512 | AliMUONTriggerCircuit *iTriggerCircuit; |
a30a000f | 1513 | AliSegmentation *segmentation; |
1514 | AliMUONResponse *response; | |
1515 | TClonesArray *digitsaddress; | |
1516 | TClonesArray *rawcladdress; | |
9ae15266 | 1517 | Int_t i; |
9ae15266 | 1518 | if (R__b.IsReading()) { |
1519 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
1520 | AliDetector::Streamer(R__b); | |
1521 | R__b >> fNPadHits; | |
1522 | R__b >> fPadHits; // diff | |
1523 | R__b >> fNLocalTrigger; | |
1524 | R__b >> fLocalTrigger; | |
1525 | R__b >> fNGlobalTrigger; | |
1526 | R__b >> fGlobalTrigger; | |
1527 | R__b >> fDchambers; | |
1528 | R__b >> fRawClusters; | |
1529 | R__b.ReadArray(fNdch); | |
1530 | R__b.ReadArray(fNrawch); | |
1531 | R__b >> fAccCut; | |
1532 | R__b >> fAccMin; | |
1533 | R__b >> fAccMax; | |
1534 | R__b >> fChambers; | |
1535 | R__b >> fTriggerCircuits; | |
f665c1ea | 1536 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 | 1537 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
1538 | iTriggerCircuit->Streamer(R__b); | |
fe4da5cc | 1539 | } |
9ae15266 | 1540 | // Stream chamber related information |
f665c1ea | 1541 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 | 1542 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
1543 | iChamber->Streamer(R__b); | |
1544 | if (iChamber->Nsec()==1) { | |
1545 | segmentation=iChamber->SegmentationModel(1); | |
1546 | if (segmentation) | |
1547 | segmentation->Streamer(R__b); | |
1548 | } else { | |
1549 | segmentation=iChamber->SegmentationModel(1); | |
1550 | if (segmentation) | |
1551 | segmentation->Streamer(R__b); | |
1552 | if (segmentation) | |
1553 | segmentation=iChamber->SegmentationModel(2); | |
1554 | segmentation->Streamer(R__b); | |
1555 | } | |
1556 | response=iChamber->ResponseModel(); | |
1557 | if (response) | |
1558 | response->Streamer(R__b); | |
1559 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; | |
1560 | digitsaddress->Streamer(R__b); | |
f665c1ea | 1561 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 | 1562 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1563 | rawcladdress->Streamer(R__b); | |
1564 | } | |
a9e2aefa | 1565 | } |
9ae15266 | 1566 | |
1567 | } else { | |
1568 | R__b.WriteVersion(AliMUON::IsA()); | |
1569 | AliDetector::Streamer(R__b); | |
1570 | R__b << fNPadHits; | |
1571 | R__b << fPadHits; // diff | |
1572 | R__b << fNLocalTrigger; | |
1573 | R__b << fLocalTrigger; | |
1574 | R__b << fNGlobalTrigger; | |
1575 | R__b << fGlobalTrigger; | |
1576 | R__b << fDchambers; | |
1577 | R__b << fRawClusters; | |
f665c1ea | 1578 | R__b.WriteArray(fNdch, AliMUONConstants::NCh()); |
1579 | R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh()); | |
9ae15266 | 1580 | |
1581 | R__b << fAccCut; | |
1582 | R__b << fAccMin; | |
1583 | R__b << fAccMax; | |
1584 | ||
1585 | R__b << fChambers; | |
1586 | R__b << fTriggerCircuits; | |
f665c1ea | 1587 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 | 1588 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
1589 | iTriggerCircuit->Streamer(R__b); | |
fe4da5cc | 1590 | } |
f665c1ea | 1591 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 | 1592 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
1593 | iChamber->Streamer(R__b); | |
1594 | if (iChamber->Nsec()==1) { | |
1595 | segmentation=iChamber->SegmentationModel(1); | |
1596 | if (segmentation) | |
1597 | segmentation->Streamer(R__b); | |
1598 | } else { | |
1599 | segmentation=iChamber->SegmentationModel(1); | |
1600 | if (segmentation) | |
1601 | segmentation->Streamer(R__b); | |
1602 | segmentation=iChamber->SegmentationModel(2); | |
1603 | if (segmentation) | |
1604 | segmentation->Streamer(R__b); | |
1605 | } | |
1606 | response=iChamber->ResponseModel(); | |
1607 | if (response) | |
1608 | response->Streamer(R__b); | |
1609 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; | |
1610 | digitsaddress->Streamer(R__b); | |
f665c1ea | 1611 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 | 1612 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1613 | rawcladdress->Streamer(R__b); | |
1614 | } | |
a9e2aefa | 1615 | } |
fe4da5cc | 1616 | } |
fe4da5cc | 1617 | } |
2ab0c725 | 1618 | #endif |
1619 | ||
a9e2aefa | 1620 | AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters) |
fe4da5cc | 1621 | { |
1622 | // | |
1623 | // Initialise the pad iterator | |
1624 | // Return the address of the first padhit for hit | |
a897a37a | 1625 | TClonesArray *theClusters = clusters; |
fe4da5cc | 1626 | Int_t nclust = theClusters->GetEntriesFast(); |
1627 | if (nclust && hit->fPHlast > 0) { | |
a9e2aefa | 1628 | AliMUON::fMaxIterPad=hit->fPHlast; |
1629 | AliMUON::fCurIterPad=hit->fPHfirst; | |
1630 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); | |
fe4da5cc | 1631 | } else { |
1632 | return 0; | |
1633 | } | |
1634 | } | |
1635 | ||
a9e2aefa | 1636 | AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters) |
fe4da5cc | 1637 | { |
de05461e | 1638 | // Get next pad (in iterator) |
1639 | // | |
a9e2aefa | 1640 | AliMUON::fCurIterPad++; |
1641 | if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) { | |
1642 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); | |
fe4da5cc | 1643 | } else { |
1644 | return 0; | |
1645 | } | |
1646 | } | |
1647 | ||
a897a37a | 1648 | |
1649 | AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster) | |
1650 | { | |
de05461e | 1651 | // |
1652 | // Return rawcluster (icluster) for chamber ichamber and cathode icathod | |
1653 | // Obsolete ?? | |
a9e2aefa | 1654 | TClonesArray *muonRawCluster = RawClustAddress(ichamber); |
a897a37a | 1655 | ResetRawClusters(); |
a9e2aefa | 1656 | TTree *treeR = gAlice->TreeR(); |
1657 | Int_t nent=(Int_t)treeR->GetEntries(); | |
1658 | treeR->GetEvent(nent-2+icathod-1); | |
1659 | //treeR->GetEvent(icathod); | |
1660 | //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast(); | |
a897a37a | 1661 | |
a9e2aefa | 1662 | AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster); |
a897a37a | 1663 | //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw); |
1664 | ||
1665 | return mRaw; | |
1666 | } | |
1667 | ||
a9e2aefa | 1668 | AliMUON& AliMUON::operator = (const AliMUON& rhs) |
a897a37a | 1669 | { |
a9e2aefa | 1670 | // copy operator |
1671 | // dummy version | |
1672 | return *this; | |
a897a37a | 1673 | } |
1674 | ||
1675 | ||
1676 | ||
a897a37a | 1677 | |
1678 | ||
fe4da5cc | 1679 | |
fe4da5cc | 1680 | |
fe4da5cc | 1681 | |
fe4da5cc | 1682 | |
1683 | ||
1684 | ||
1685 | ||
1686 | ||
1687 | ||
1688 | ||
1689 | ||
1690 | ||
1691 | ||
1692 |