]>
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$ | |
cd4df77b | 17 | Revision 1.52 2001/06/14 13:49:22 hristov |
18 | Write a TreeD in SDigits2Digits method (needed to be compatible with alirun script) | |
19 | ||
d963c261 | 20 | Revision 1.51 2001/05/31 10:19:52 morsch |
21 | Fix for new AliRun::RunReco(). | |
22 | ||
e365e1ee | 23 | Revision 1.50 2001/05/16 14:57:17 alibrary |
24 | New files for folders and Stack | |
25 | ||
9e1a0ddb | 26 | Revision 1.49 2001/03/12 17:45:48 hristov |
27 | Changes needed on Sun with CC 5.0 | |
28 | ||
5cf7bbad | 29 | Revision 1.48 2001/03/06 00:01:36 morsch |
30 | Add Digits2Reco() and FindClusters() | |
31 | Adapt call of cluster finder to new STEER. | |
32 | ||
fe311ef1 | 33 | Revision 1.47 2001/03/05 08:38:36 morsch |
34 | Digitization related methods moved to AliMUONMerger. | |
35 | ||
1cae9436 | 36 | Revision 1.46 2001/01/26 21:34:59 morsch |
37 | Use access functions for AliMUONHit, AliMUONDigit and AliMUONPadHit data members. | |
38 | ||
1bd28025 | 39 | Revision 1.45 2001/01/26 20:00:49 hristov |
40 | Major upgrade of AliRoot code | |
41 | ||
2ab0c725 | 42 | Revision 1.44 2001/01/25 17:39:09 morsch |
43 | Pass size of fNdch and fNrawch to CINT. | |
44 | ||
1bd26093 | 45 | Revision 1.43 2001/01/23 18:58:19 hristov |
46 | Initialisation of some pointers | |
47 | ||
3f5cf0b3 | 48 | Revision 1.42 2001/01/17 20:53:40 hristov |
49 | Destructors corrected to avoid memory leaks | |
50 | ||
c2c0190f | 51 | Revision 1.41 2000/12/21 22:12:40 morsch |
52 | Clean-up of coding rule violations, | |
53 | ||
de05461e | 54 | Revision 1.40 2000/11/29 20:32:26 gosset |
55 | Digitize: | |
56 | 1. correction for array index out of bounds | |
57 | 2. one printout commented | |
58 | ||
48030acd | 59 | Revision 1.39 2000/11/12 17:17:03 pcrochet |
60 | BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers) | |
61 | ||
5fd73042 | 62 | Revision 1.38 2000/11/06 09:20:43 morsch |
63 | AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the | |
64 | Draw() method. This avoids code and parameter replication. | |
65 | ||
aaf4addd | 66 | Revision 1.37 2000/10/26 09:53:37 pcrochet |
67 | put back trigger chambers in the display (there was a problem in buildgeometry) | |
68 | ||
43b96d92 | 69 | Revision 1.36 2000/10/25 19:51:18 morsch |
70 | Correct x-position of chambers. | |
71 | ||
6bc66d8f | 72 | Revision 1.35 2000/10/24 19:46:21 morsch |
73 | BuildGeometry updated for slats in station 3-4. | |
74 | ||
e4fa3d7e | 75 | Revision 1.34 2000/10/18 11:42:06 morsch |
76 | - AliMUONRawCluster contains z-position. | |
77 | - Some clean-up of useless print statements during initialisations. | |
78 | ||
3e1872ed | 79 | Revision 1.33 2000/10/09 14:01:57 morsch |
80 | Unused variables removed. | |
81 | ||
0234695f | 82 | Revision 1.32 2000/10/06 09:08:10 morsch |
83 | Built geometry includes slat geometry for event display. | |
84 | ||
7ab910ae | 85 | Revision 1.31 2000/10/02 21:28:08 fca |
86 | Removal of useless dependecies via forward declarations | |
87 | ||
94de3818 | 88 | Revision 1.30 2000/10/02 16:58:29 egangler |
89 | Cleaning of the code : | |
90 | -> coding conventions | |
91 | -> void Streamers | |
92 | -> some useless includes removed or replaced by "class" statement | |
93 | ||
ecfa008b | 94 | Revision 1.29 2000/07/28 13:49:38 morsch |
95 | SetAcceptance defines inner and outer chamber radii according to angular acceptance. | |
96 | Can be used for simple acceptance studies. | |
97 | ||
5c1f55c5 | 98 | Revision 1.28 2000/07/22 16:43:15 morsch |
99 | Same comment as before, but now done correctly I hope (sorry it's Saturday evening) | |
100 | ||
45085cb9 | 101 | Revision 1.27 2000/07/22 16:36:50 morsch |
102 | Change order of indices in creation (new) of xhit and yhit | |
103 | ||
6b18d06a | 104 | Revision 1.26 2000/07/03 11:54:57 morsch |
105 | AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER | |
106 | The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. | |
107 | ||
a30a000f | 108 | Revision 1.25 2000/06/29 12:34:09 morsch |
109 | AliMUONSegmentation class has been made independent of AliMUONChamber. This makes | |
110 | it usable with any other geometry class. The link to the object to which it belongs is | |
111 | established via an index. This assumes that there exists a global geometry manager | |
112 | from which the pointer to the parent object can be obtained (in our case gAlice). | |
113 | ||
d81db581 | 114 | Revision 1.24 2000/06/28 15:16:35 morsch |
115 | (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) | |
116 | to allow development of slat-muon chamber simulation and reconstruction code in the MUON | |
117 | framework. The changes should have no side effects (mostly dummy arguments). | |
118 | (2) Hit disintegration uses 3-dim hit coordinates to allow simulation | |
119 | of chambers with overlapping modules (MakePadHits, Disintegration). | |
120 | ||
802a864d | 121 | Revision 1.23 2000/06/28 12:19:17 morsch |
122 | More consequent seperation of global input data services (AliMUONClusterInput singleton) and the | |
fe311ef1 | 123 | cluster and hit reconstruction algorithms in AliMUONClusterFindRawinderVS. |
802a864d | 124 | AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction. |
125 | It requires two cathode planes. Small modifications in the code will make it usable for | |
126 | one cathode plane and, hence, more general (for test beam data). | |
127 | AliMUONClusterFinder is now obsolete. | |
128 | ||
30aaba74 | 129 | Revision 1.22 2000/06/28 08:06:10 morsch |
130 | Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the | |
131 | algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton. | |
132 | It also naturally takes care of the TMinuit instance. | |
133 | ||
9825400f | 134 | Revision 1.21 2000/06/27 08:54:41 morsch |
135 | Problems with on constant array sizes (in hitMap, nmuon, xhit, yhit) corrected. | |
136 | ||
d09fafb0 | 137 | Revision 1.20 2000/06/26 14:02:38 morsch |
138 | Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. | |
139 | ||
f665c1ea | 140 | Revision 1.19 2000/06/22 13:40:51 morsch |
141 | scope problem on HP, "i" declared once | |
142 | pow changed to TMath::Power (PH, AM) | |
143 | ||
9ae15266 | 144 | Revision 1.18 2000/06/15 07:58:48 morsch |
145 | Code from MUON-dev joined | |
146 | ||
a9e2aefa | 147 | Revision 1.14.4.17 2000/06/14 14:36:46 morsch |
148 | - add TriggerCircuit (PC) | |
149 | - add GlobalTrigger and LocalTrigger and specific methods (PC) | |
150 | ||
151 | Revision 1.14.4.16 2000/06/09 21:20:28 morsch | |
152 | Most coding rule violations corrected | |
153 | ||
154 | Revision 1.14.4.15 2000/05/02 09:54:32 morsch | |
155 | RULE RN17 violations corrected | |
156 | ||
157 | Revision 1.14.4.12 2000/04/26 12:25:02 morsch | |
158 | Code revised by P. Crochet: | |
159 | - Z position of TriggerChamber changed according to A.Tournaire Priv.Comm. | |
160 | - ToF included in the method MakePadHits | |
161 | - inner radius of flange between beam shielding and trigger corrected | |
162 | - Trigger global volume updated (according to the new geometry) | |
163 | ||
164 | Revision 1.14.4.11 2000/04/19 19:42:08 morsch | |
165 | Some changes of variable names curing viols and methods concerning | |
166 | correlated clusters removed. | |
167 | ||
168 | Revision 1.14.4.10 2000/03/22 16:44:07 gosset | |
169 | Memory leak suppressed in function Digitise: | |
170 | p_adr->Delete() instead of Clear (I.Chevrot and A.Baldisseri) | |
171 | ||
172 | Revision 1.14.4.9 2000/03/20 18:15:25 morsch | |
173 | Positions of trigger chambers corrected (P.C.) | |
dbe37a89 | 174 | |
a9e2aefa | 175 | Revision 1.14.4.8 2000/02/21 15:38:01 morsch |
176 | Call to AddHitList introduced to make this version compatible with head. | |
dffd31ef | 177 | |
a9e2aefa | 178 | Revision 1.14.4.7 2000/02/20 07:45:53 morsch |
179 | Bugs in Trigger part of BuildGeomemetry corrected (P.C) | |
1cedd08a | 180 | |
a9e2aefa | 181 | Revision 1.14.4.6 2000/02/17 14:28:54 morsch |
182 | Trigger included into initialization and digitization | |
6a935c13 | 183 | |
a9e2aefa | 184 | Revision 1.14.4.5 2000/02/15 10:02:58 morsch |
185 | Log messages of previous revisions added | |
5d84196c | 186 | |
a9e2aefa | 187 | Revision 1.14.4.2 2000/02/04 10:57:34 gosset |
188 | Z position of the chambers: | |
189 | it was the Z position of the stations; | |
190 | it is now really the Z position of the chambers. | |
191 | !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS" | |
192 | !!!! AND "AliMUONChamber::ZPosition" | |
193 | !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ" | |
194 | !!!! AND "AliMUONChamber::Z" | |
50f986db | 195 | |
a9e2aefa | 196 | Revision 1.14.4.3 2000/02/04 16:19:04 gosset |
197 | Correction for mis-spelling of NCH | |
0b34885d | 198 | |
a9e2aefa | 199 | Revision 1.14.4.4 2000/02/15 09:43:38 morsch |
200 | Log message added | |
2b86633d | 201 | |
4c039060 | 202 | */ |
203 | ||
a9e2aefa | 204 | |
205 | /////////////////////////////////////////////// | |
fe4da5cc | 206 | // Manager and hits classes for set:MUON // |
207 | //////////////////////////////////////////////// | |
208 | ||
209 | #include <TTUBE.h> | |
a897a37a | 210 | #include <TBRIK.h> |
211 | #include <TRotMatrix.h> | |
94de3818 | 212 | #include <TGeometry.h> |
fe4da5cc | 213 | #include <TNode.h> |
a897a37a | 214 | #include <TTree.h> |
fe4da5cc | 215 | #include <TRandom.h> |
216 | #include <TObject.h> | |
217 | #include <TVector.h> | |
218 | #include <TObjArray.h> | |
a897a37a | 219 | #include <TMinuit.h> |
220 | #include <TParticle.h> | |
221 | #include <TROOT.h> | |
222 | #include <TFile.h> | |
223 | #include <TNtuple.h> | |
224 | #include <TCanvas.h> | |
225 | #include <TPad.h> | |
226 | #include <TDirectory.h> | |
227 | #include <TObjectTable.h> | |
228 | #include <AliPDG.h> | |
a9e2aefa | 229 | #include <TTUBE.h> |
fe4da5cc | 230 | |
231 | #include "AliMUON.h" | |
a9e2aefa | 232 | #include "AliMUONHit.h" |
233 | #include "AliMUONPadHit.h" | |
234 | #include "AliMUONDigit.h" | |
235 | #include "AliMUONTransientDigit.h" | |
236 | #include "AliMUONRawCluster.h" | |
237 | #include "AliMUONLocalTrigger.h" | |
238 | #include "AliMUONGlobalTrigger.h" | |
ecfa008b | 239 | #include "AliMUONTriggerCircuit.h" |
a30a000f | 240 | #include "AliHitMap.h" |
a9e2aefa | 241 | #include "AliMUONHitMapA1.h" |
242 | #include "AliMUONChamberTrigger.h" | |
f665c1ea | 243 | #include "AliMUONConstants.h" |
30aaba74 | 244 | #include "AliMUONClusterFinderVS.h" |
a9e2aefa | 245 | #include "AliMUONTriggerDecision.h" |
fe4da5cc | 246 | #include "AliRun.h" |
e365e1ee | 247 | #include "AliHeader.h" |
fe4da5cc | 248 | #include "AliMC.h" |
9825400f | 249 | #include "AliMUONClusterInput.h" |
1cae9436 | 250 | #include "AliMUONMerger.h" |
fe4da5cc | 251 | #include "iostream.h" |
252 | #include "AliCallf77.h" | |
a9e2aefa | 253 | #include "AliConst.h" |
254 | ||
255 | // Defaults parameters for Z positions of chambers | |
256 | // taken from values for "stations" in AliMUON::AliMUON | |
257 | // const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.}; | |
258 | // and from array "dstation" in AliMUONv1::CreateGeometry | |
259 | // Float_t dstation[5]={20., 20., 20, 20., 20.}; | |
260 | // for tracking chambers, | |
261 | // according to (Z1 = zch - dstation) and (Z2 = zch + dstation) | |
262 | // for the first and second chambers in the station, respectively, | |
263 | // and from "DTPLANES" in AliMUONv1::CreateGeometry | |
264 | // const Float_t DTPLANES = 15.; | |
265 | // for trigger chambers, | |
266 | // according to (Z1 = zch) and (Z2 = zch + DTPLANES) | |
267 | // for the first and second chambers in the station, respectively | |
fe4da5cc | 268 | |
fe4da5cc | 269 | ClassImp(AliMUON) |
fe4da5cc | 270 | //___________________________________________ |
271 | AliMUON::AliMUON() | |
272 | { | |
de05461e | 273 | // Default Constructor |
274 | // | |
1bd28025 | 275 | fNCh = 0; |
276 | fNTrackingCh = 0; | |
1bd26093 | 277 | fIshunt = 0; |
278 | fHits = 0; | |
279 | fPadHits = 0; | |
280 | fNPadHits = 0; | |
1bd28025 | 281 | fChambers = 0; |
1bd26093 | 282 | fDchambers = 0; |
1bd28025 | 283 | fTriggerCircuits = 0; |
1bd26093 | 284 | fNdch = 0; |
285 | fRawClusters = 0; | |
286 | fNrawch = 0; | |
287 | fGlobalTrigger = 0; | |
288 | fNLocalTrigger = 0; | |
289 | fLocalTrigger = 0; | |
290 | fNLocalTrigger = 0; | |
291 | fAccMin = 0.; | |
292 | fAccMax = 0.; | |
293 | fAccCut = kFALSE; | |
1cae9436 | 294 | fMerger = 0; |
fe4da5cc | 295 | } |
296 | ||
297 | //___________________________________________ | |
298 | AliMUON::AliMUON(const char *name, const char *title) | |
299 | : AliDetector(name,title) | |
300 | { | |
301 | //Begin_Html | |
302 | /* | |
a897a37a | 303 | <img src="gif/alimuon.gif"> |
fe4da5cc | 304 | */ |
305 | //End_Html | |
f665c1ea | 306 | |
a9e2aefa | 307 | fHits = new TClonesArray("AliMUONHit",1000); |
1cedd08a | 308 | gAlice->AddHitList(fHits); |
a9e2aefa | 309 | fPadHits = new TClonesArray("AliMUONPadHit",10000); |
310 | fNPadHits = 0; | |
fe4da5cc | 311 | fIshunt = 0; |
312 | ||
1bd28025 | 313 | fNCh = AliMUONConstants::NCh(); |
1bd26093 | 314 | fNTrackingCh = AliMUONConstants::NTrackingCh(); |
1bd28025 | 315 | fNdch = new Int_t[fNCh]; |
fe4da5cc | 316 | |
f665c1ea | 317 | fDchambers = new TObjArray(AliMUONConstants::NCh()); |
fe4da5cc | 318 | |
319 | Int_t i; | |
320 | ||
f665c1ea | 321 | for (i=0; i<AliMUONConstants::NCh() ;i++) { |
cd4df77b | 322 | fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i); |
fe4da5cc | 323 | fNdch[i]=0; |
324 | } | |
325 | ||
1bd28025 | 326 | fNrawch = new Int_t[fNTrackingCh]; |
a897a37a | 327 | |
f665c1ea | 328 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
a897a37a | 329 | |
f665c1ea | 330 | for (i=0; i<AliMUONConstants::NTrackingCh();i++) { |
cd4df77b | 331 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); |
a897a37a | 332 | fNrawch[i]=0; |
333 | } | |
334 | ||
a9e2aefa | 335 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
336 | fNGlobalTrigger = 0; | |
337 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
338 | fNLocalTrigger = 0; | |
fe4da5cc | 339 | |
fe4da5cc | 340 | SetMarkerColor(kRed); |
a9e2aefa | 341 | // |
342 | // | |
343 | // | |
344 | // | |
f665c1ea | 345 | |
a9e2aefa | 346 | Int_t ch; |
347 | ||
f665c1ea | 348 | fChambers = new TObjArray(AliMUONConstants::NCh()); |
a9e2aefa | 349 | |
350 | // Loop over stations | |
f665c1ea | 351 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
a9e2aefa | 352 | // Loop over 2 chambers in the station |
353 | for (Int_t stCH = 0; stCH < 2; stCH++) { | |
354 | // | |
355 | // | |
356 | // Default Parameters for Muon Tracking Stations | |
357 | ||
358 | ||
359 | ch = 2 * st + stCH; | |
360 | // | |
f665c1ea | 361 | if (ch < AliMUONConstants::NTrackingCh()) { |
cd4df77b | 362 | fChambers->AddAt(new AliMUONChamber(ch),ch); |
a9e2aefa | 363 | } else { |
cd4df77b | 364 | fChambers->AddAt(new AliMUONChamberTrigger(ch),ch); |
a9e2aefa | 365 | } |
366 | ||
367 | AliMUONChamber* chamber = (AliMUONChamber*) (*fChambers)[ch]; | |
368 | ||
369 | chamber->SetGid(0); | |
370 | // Default values for Z of chambers | |
f665c1ea | 371 | chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch)); |
a9e2aefa | 372 | // |
f665c1ea | 373 | chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch)); |
5c1f55c5 | 374 | // Set chamber inner and outer radius to default |
f665c1ea | 375 | chamber->SetRInner(AliMUONConstants::Dmin(st)/2); |
376 | chamber->SetROuter(AliMUONConstants::Dmax(st)/2); | |
a9e2aefa | 377 | // |
378 | } // Chamber stCH (0, 1) in | |
379 | } // Station st (0...) | |
cd4df77b | 380 | // fChambers->SetLast(AliMUONConstants::NCh()); |
a9e2aefa | 381 | fMaxStepGas=0.01; |
382 | fMaxStepAlu=0.1; | |
383 | fMaxDestepGas=-1; | |
384 | fMaxDestepAlu=-1; | |
385 | // | |
386 | fMaxIterPad = 0; | |
387 | fCurIterPad = 0; | |
5c1f55c5 | 388 | // |
389 | fAccMin = 0.; | |
390 | fAccMax = 0.; | |
391 | fAccCut = kFALSE; | |
a9e2aefa | 392 | |
393 | // cp new design of AliMUONTriggerDecision | |
f665c1ea | 394 | fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit()); |
395 | for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) { | |
cd4df77b | 396 | fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ); |
a9e2aefa | 397 | |
1cae9436 | 398 | } |
399 | fMerger = 0; | |
fe4da5cc | 400 | } |
401 | ||
402 | //___________________________________________ | |
a9e2aefa | 403 | AliMUON::AliMUON(const AliMUON& rMUON) |
404 | { | |
405 | // Dummy copy constructor | |
406 | ; | |
407 | ||
408 | } | |
409 | ||
fe4da5cc | 410 | AliMUON::~AliMUON() |
411 | { | |
de05461e | 412 | // Destructor |
9e1a0ddb | 413 | if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName()); |
a897a37a | 414 | |
f665c1ea | 415 | Int_t i; |
416 | fIshunt = 0; | |
c2c0190f | 417 | |
418 | // Delete TObjArrays | |
419 | ||
420 | if (fChambers){ | |
421 | fChambers->Delete(); | |
422 | delete fChambers; | |
423 | } | |
424 | ||
425 | if (fTriggerCircuits){ | |
426 | fTriggerCircuits->Delete(); | |
427 | delete fTriggerCircuits; | |
428 | } | |
429 | ||
430 | if (fDchambers){ | |
431 | fDchambers->Delete(); | |
432 | delete fDchambers; | |
433 | } | |
434 | ||
435 | if (fRawClusters){ | |
436 | fRawClusters->Delete(); | |
437 | delete fRawClusters; | |
438 | } | |
439 | for (i=0;i<AliMUONConstants::NTrackingCh();i++) { | |
440 | fNrawch[i]=0; | |
441 | } | |
442 | ||
443 | // Delete TClonesArrays | |
444 | ||
445 | if (fPadHits){ | |
446 | fPadHits->Delete(); | |
447 | delete fPadHits; | |
448 | } | |
449 | ||
450 | if (fGlobalTrigger){ | |
451 | fGlobalTrigger->Delete(); | |
452 | delete fGlobalTrigger; | |
453 | } | |
f665c1ea | 454 | fNGlobalTrigger = 0; |
455 | ||
c2c0190f | 456 | if (fLocalTrigger){ |
457 | fLocalTrigger->Delete(); | |
458 | delete fLocalTrigger; | |
459 | } | |
f665c1ea | 460 | fNLocalTrigger = 0; |
a897a37a | 461 | |
c2c0190f | 462 | if (fHits2){ |
463 | fHits2->Delete(); | |
464 | delete fHits2; | |
f665c1ea | 465 | } |
c2c0190f | 466 | |
467 | if (fPadHits2){ | |
468 | fPadHits2->Delete(); | |
469 | delete fPadHits2; | |
f665c1ea | 470 | } |
c2c0190f | 471 | |
472 | if (fHits) { | |
473 | fHits->Delete(); | |
474 | delete fHits; | |
475 | } | |
476 | ||
477 | // Delete hits tree for background event | |
478 | ||
479 | if (fTrH1) { | |
480 | fTrH1->Delete(); | |
481 | delete fTrH1; | |
f665c1ea | 482 | } |
1cae9436 | 483 | |
484 | if (fMerger) delete fMerger; | |
fe4da5cc | 485 | } |
486 | ||
487 | //___________________________________________ | |
488 | void AliMUON::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
489 | { | |
490 | TClonesArray &lhits = *fHits; | |
a9e2aefa | 491 | new(lhits[fNhits++]) AliMUONHit(fIshunt,track,vol,hits); |
fe4da5cc | 492 | } |
493 | //___________________________________________ | |
a9e2aefa | 494 | void AliMUON::AddPadHit(Int_t *clhits) |
fe4da5cc | 495 | { |
a9e2aefa | 496 | TClonesArray &lclusters = *fPadHits; |
497 | new(lclusters[fNPadHits++]) AliMUONPadHit(clhits); | |
fe4da5cc | 498 | } |
499 | //_____________________________________________________________________________ | |
500 | void AliMUON::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) | |
501 | { | |
502 | // | |
503 | // Add a MUON digit to the list | |
504 | // | |
505 | ||
506 | TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]); | |
a9e2aefa | 507 | new(ldigits[fNdch[id]++]) AliMUONDigit(tracks,charges,digits); |
fe4da5cc | 508 | } |
509 | ||
a897a37a | 510 | //_____________________________________________________________________________ |
511 | void AliMUON::AddRawCluster(Int_t id, const AliMUONRawCluster& c) | |
512 | { | |
513 | // | |
514 | // Add a MUON digit to the list | |
515 | // | |
516 | ||
517 | TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]); | |
518 | new(lrawcl[fNrawch[id]++]) AliMUONRawCluster(c); | |
519 | } | |
a897a37a | 520 | |
a9e2aefa | 521 | //___________________________________________ |
522 | void AliMUON::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus, | |
523 | Int_t *singleUndef, | |
524 | Int_t *pairUnlike, Int_t *pairLike) | |
525 | { | |
526 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) | |
527 | TClonesArray &globalTrigger = *fGlobalTrigger; | |
528 | new(globalTrigger[fNGlobalTrigger++]) | |
529 | AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, | |
530 | pairLike); | |
531 | } | |
532 | //___________________________________________ | |
533 | void AliMUON::AddLocalTrigger(Int_t *localtr) | |
534 | { | |
535 | // add a MUON Local Trigger to the list | |
536 | TClonesArray &localTrigger = *fLocalTrigger; | |
537 | new(localTrigger[fNLocalTrigger++]) AliMUONLocalTrigger(localtr); | |
a897a37a | 538 | } |
539 | ||
fe4da5cc | 540 | //___________________________________________ |
541 | void AliMUON::BuildGeometry() | |
542 | { | |
de05461e | 543 | // Geometry for event display |
5fd73042 | 544 | for (Int_t i=0; i<7; i++) { |
545 | for (Int_t j=0; j<2; j++) { | |
546 | Int_t id=2*i+j+1; | |
547 | this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); | |
a897a37a | 548 | } |
5fd73042 | 549 | } |
fe4da5cc | 550 | } |
551 | ||
552 | //___________________________________________ | |
553 | Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t ) | |
554 | { | |
555 | return 9999; | |
556 | } | |
557 | ||
558 | //___________________________________________ | |
9e1a0ddb | 559 | void AliMUON::MakeBranch(Option_t* option, const char *file) |
fe4da5cc | 560 | { |
2ab0c725 | 561 | // |
f665c1ea | 562 | // Create Tree branches for the MUON. |
2ab0c725 | 563 | // |
f665c1ea | 564 | const Int_t kBufferSize = 4000; |
565 | char branchname[30]; | |
566 | sprintf(branchname,"%sCluster",GetName()); | |
567 | ||
2ab0c725 | 568 | AliDetector::MakeBranch(option,file); |
f665c1ea | 569 | |
5cf7bbad | 570 | const char *cD = strstr(option,"D"); |
571 | const char *cR = strstr(option,"R"); | |
572 | const char *cH = strstr(option,"H"); | |
2ab0c725 | 573 | |
574 | if (fPadHits && gAlice->TreeH() && cH) { | |
9e1a0ddb | 575 | MakeBranchInTree(gAlice->TreeH(), |
576 | branchname, &fPadHits, kBufferSize, file); | |
f665c1ea | 577 | } |
578 | ||
2ab0c725 | 579 | if (cD) { |
580 | // | |
581 | // one branch for digits per chamber | |
582 | // | |
583 | Int_t i; | |
f665c1ea | 584 | |
2ab0c725 | 585 | for (i=0; i<AliMUONConstants::NCh() ;i++) { |
586 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
587 | if (fDchambers && gAlice->TreeD()) { | |
9e1a0ddb | 588 | MakeBranchInTree(gAlice->TreeD(), |
589 | branchname, &((*fDchambers)[i]), kBufferSize, file); | |
2ab0c725 | 590 | printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); |
591 | } | |
592 | } | |
f665c1ea | 593 | } |
594 | ||
2ab0c725 | 595 | if (cR) { |
596 | // | |
597 | // one branch for raw clusters per chamber | |
598 | // | |
599 | printf("Make Branch - TreeR address %p\n",gAlice->TreeR()); | |
600 | ||
601 | Int_t i; | |
602 | ||
603 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) { | |
604 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
605 | if (fRawClusters && gAlice->TreeR()) { | |
9e1a0ddb | 606 | MakeBranchInTree(gAlice->TreeR(), |
607 | branchname, &((*fRawClusters)[i]), kBufferSize, file); | |
2ab0c725 | 608 | printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); |
609 | } | |
610 | } | |
611 | // | |
612 | // one branch for global trigger | |
613 | // | |
614 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
615 | if (fGlobalTrigger && gAlice->TreeR()) { | |
9e1a0ddb | 616 | MakeBranchInTree(gAlice->TreeR(), |
617 | branchname, &fGlobalTrigger, kBufferSize, file); | |
2ab0c725 | 618 | printf("Making Branch %s for Global Trigger\n",branchname); |
619 | } | |
620 | // | |
621 | // one branch for local trigger | |
622 | // | |
623 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
624 | if (fLocalTrigger && gAlice->TreeR()) { | |
9e1a0ddb | 625 | MakeBranchInTree(gAlice->TreeR(), |
626 | branchname, &fLocalTrigger, kBufferSize, file); | |
2ab0c725 | 627 | printf("Making Branch %s for Local Trigger\n",branchname); |
628 | } | |
629 | } | |
fe4da5cc | 630 | } |
631 | ||
632 | //___________________________________________ | |
633 | void AliMUON::SetTreeAddress() | |
634 | { | |
635 | // Set branch address for the Hits and Digits Tree. | |
a897a37a | 636 | char branchname[30]; |
fe4da5cc | 637 | AliDetector::SetTreeAddress(); |
638 | ||
639 | TBranch *branch; | |
640 | TTree *treeH = gAlice->TreeH(); | |
641 | TTree *treeD = gAlice->TreeD(); | |
a897a37a | 642 | TTree *treeR = gAlice->TreeR(); |
fe4da5cc | 643 | |
644 | if (treeH) { | |
a9e2aefa | 645 | if (fPadHits) { |
fe4da5cc | 646 | branch = treeH->GetBranch("MUONCluster"); |
a9e2aefa | 647 | if (branch) branch->SetAddress(&fPadHits); |
fe4da5cc | 648 | } |
649 | } | |
650 | ||
651 | if (treeD) { | |
f665c1ea | 652 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
fe4da5cc | 653 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
654 | if (fDchambers) { | |
655 | branch = treeD->GetBranch(branchname); | |
656 | if (branch) branch->SetAddress(&((*fDchambers)[i])); | |
657 | } | |
658 | } | |
659 | } | |
a897a37a | 660 | |
661 | // printf("SetTreeAddress --- treeR address %p \n",treeR); | |
662 | ||
663 | if (treeR) { | |
f665c1ea | 664 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
a897a37a | 665 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); |
666 | if (fRawClusters) { | |
667 | branch = treeR->GetBranch(branchname); | |
668 | if (branch) branch->SetAddress(&((*fRawClusters)[i])); | |
669 | } | |
670 | } | |
a897a37a | 671 | |
a9e2aefa | 672 | if (fLocalTrigger) { |
673 | branch = treeR->GetBranch("MUONLocalTrigger"); | |
674 | if (branch) branch->SetAddress(&fLocalTrigger); | |
675 | } | |
676 | if (fGlobalTrigger) { | |
677 | branch = treeR->GetBranch("MUONGlobalTrigger"); | |
678 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
679 | } | |
680 | } | |
fe4da5cc | 681 | } |
682 | //___________________________________________ | |
683 | void AliMUON::ResetHits() | |
684 | { | |
685 | // Reset number of clusters and the cluster array for this detector | |
686 | AliDetector::ResetHits(); | |
a9e2aefa | 687 | fNPadHits = 0; |
688 | if (fPadHits) fPadHits->Clear(); | |
fe4da5cc | 689 | } |
690 | ||
691 | //____________________________________________ | |
692 | void AliMUON::ResetDigits() | |
693 | { | |
694 | // | |
695 | // Reset number of digits and the digits array for this detector | |
696 | // | |
f665c1ea | 697 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { |
a897a37a | 698 | if ((*fDchambers)[i]) ((TClonesArray*)(*fDchambers)[i])->Clear(); |
fe4da5cc | 699 | if (fNdch) fNdch[i]=0; |
700 | } | |
701 | } | |
a897a37a | 702 | //____________________________________________ |
703 | void AliMUON::ResetRawClusters() | |
704 | { | |
705 | // | |
706 | // Reset number of raw clusters and the raw clust array for this detector | |
707 | // | |
f665c1ea | 708 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { |
a897a37a | 709 | if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear(); |
710 | if (fNrawch) fNrawch[i]=0; | |
711 | } | |
712 | } | |
a9e2aefa | 713 | |
a897a37a | 714 | //____________________________________________ |
a9e2aefa | 715 | void AliMUON::ResetTrigger() |
a897a37a | 716 | { |
a9e2aefa | 717 | // Reset Local and Global Trigger |
718 | fNGlobalTrigger = 0; | |
719 | if (fGlobalTrigger) fGlobalTrigger->Clear(); | |
720 | fNLocalTrigger = 0; | |
721 | if (fLocalTrigger) fLocalTrigger->Clear(); | |
722 | } | |
723 | ||
724 | //____________________________________________ | |
725 | void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2) | |
726 | { | |
de05461e | 727 | // Set the pad size for chamber id and cathode isec |
a9e2aefa | 728 | Int_t i=2*(id-1); |
729 | ((AliMUONChamber*) (*fChambers)[i]) ->SetPadSize(isec,p1,p2); | |
730 | ((AliMUONChamber*) (*fChambers)[i+1])->SetPadSize(isec,p1,p2); | |
a897a37a | 731 | } |
732 | ||
fe4da5cc | 733 | //___________________________________________ |
a9e2aefa | 734 | void AliMUON::SetChambersZ(const Float_t *Z) |
735 | { | |
736 | // Set Z values for all chambers (tracking and trigger) | |
737 | // from the array pointed to by "Z" | |
f665c1ea | 738 | for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) |
739 | ((AliMUONChamber*) ((*fChambers)[ch]))->SetZ(Z[ch]); | |
740 | return; | |
a9e2aefa | 741 | } |
fe4da5cc | 742 | |
a9e2aefa | 743 | //___________________________________________ |
744 | void AliMUON::SetChambersZToDefault() | |
fe4da5cc | 745 | { |
a9e2aefa | 746 | // Set Z values for all chambers (tracking and trigger) |
747 | // to default values | |
f665c1ea | 748 | SetChambersZ(AliMUONConstants::DefaultChamberZ()); |
a9e2aefa | 749 | return; |
fe4da5cc | 750 | } |
751 | ||
752 | //___________________________________________ | |
a897a37a | 753 | void AliMUON::SetChargeSlope(Int_t id, Float_t p1) |
fe4da5cc | 754 | { |
de05461e | 755 | // Set the inverse charge slope for chamber id |
fe4da5cc | 756 | Int_t i=2*(id-1); |
a9e2aefa | 757 | ((AliMUONChamber*) (*fChambers)[i])->SetChargeSlope(p1); |
758 | ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSlope(p1); | |
fe4da5cc | 759 | } |
760 | ||
761 | //___________________________________________ | |
a897a37a | 762 | void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2) |
fe4da5cc | 763 | { |
de05461e | 764 | // Set sigma of charge spread for chamber id |
fe4da5cc | 765 | Int_t i=2*(id-1); |
a9e2aefa | 766 | ((AliMUONChamber*) (*fChambers)[i])->SetChargeSpread(p1,p2); |
767 | ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSpread(p1,p2); | |
fe4da5cc | 768 | } |
769 | ||
770 | //___________________________________________ | |
a897a37a | 771 | void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1) |
fe4da5cc | 772 | { |
de05461e | 773 | // Set integration limits for charge spread |
fe4da5cc | 774 | Int_t i=2*(id-1); |
a9e2aefa | 775 | ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1); |
776 | ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1); | |
fe4da5cc | 777 | } |
778 | ||
779 | //___________________________________________ | |
d09fafb0 | 780 | void AliMUON::SetMaxAdc(Int_t id, Int_t p1) |
fe4da5cc | 781 | { |
de05461e | 782 | // Set maximum number for ADCcounts (saturation) |
fe4da5cc | 783 | Int_t i=2*(id-1); |
a9e2aefa | 784 | ((AliMUONChamber*) (*fChambers)[i])->SetMaxAdc(p1); |
785 | ((AliMUONChamber*) (*fChambers)[i+1])->SetMaxAdc(p1); | |
fe4da5cc | 786 | } |
787 | ||
788 | //___________________________________________ | |
a897a37a | 789 | void AliMUON::SetMaxStepGas(Float_t p1) |
fe4da5cc | 790 | { |
de05461e | 791 | // Set stepsize in gas |
fe4da5cc | 792 | fMaxStepGas=p1; |
793 | } | |
794 | ||
795 | //___________________________________________ | |
a897a37a | 796 | void AliMUON::SetMaxStepAlu(Float_t p1) |
fe4da5cc | 797 | { |
de05461e | 798 | // Set step size in Alu |
fe4da5cc | 799 | fMaxStepAlu=p1; |
800 | } | |
801 | ||
802 | //___________________________________________ | |
a897a37a | 803 | void AliMUON::SetMaxDestepGas(Float_t p1) |
fe4da5cc | 804 | { |
de05461e | 805 | // Set maximum step size in Gas |
fe4da5cc | 806 | fMaxDestepGas=p1; |
807 | } | |
808 | ||
809 | //___________________________________________ | |
a897a37a | 810 | void AliMUON::SetMaxDestepAlu(Float_t p1) |
fe4da5cc | 811 | { |
de05461e | 812 | // Set maximum step size in Alu |
fe4da5cc | 813 | fMaxDestepAlu=p1; |
814 | } | |
815 | //___________________________________________ | |
5c1f55c5 | 816 | void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax) |
fe4da5cc | 817 | { |
de05461e | 818 | // Set acceptance cuts |
fe4da5cc | 819 | fAccCut=acc; |
5c1f55c5 | 820 | fAccMin=angmin*TMath::Pi()/180; |
821 | fAccMax=angmax*TMath::Pi()/180; | |
822 | Int_t ch; | |
823 | if (acc) { | |
824 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { | |
825 | // Loop over 2 chambers in the station | |
826 | for (Int_t stCH = 0; stCH < 2; stCH++) { | |
827 | ch = 2 * st + stCH; | |
828 | // Set chamber inner and outer radius according to acceptance cuts | |
829 | Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin)); | |
830 | Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax)); | |
831 | } // chamber loop | |
832 | } // station loop | |
833 | } | |
fe4da5cc | 834 | } |
835 | //___________________________________________ | |
a30a000f | 836 | void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation) |
fe4da5cc | 837 | { |
de05461e | 838 | // Set the segmentation for chamber id cathode isec |
a9e2aefa | 839 | ((AliMUONChamber*) (*fChambers)[id])->SetSegmentationModel(isec, segmentation); |
fe4da5cc | 840 | |
841 | } | |
842 | //___________________________________________ | |
a9e2aefa | 843 | void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response) |
fe4da5cc | 844 | { |
de05461e | 845 | // Set the response for chamber id |
a9e2aefa | 846 | ((AliMUONChamber*) (*fChambers)[id])->SetResponseModel(response); |
fe4da5cc | 847 | } |
848 | ||
30aaba74 | 849 | void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst) |
a897a37a | 850 | { |
de05461e | 851 | // Set ClusterFinder for chamber id |
a9e2aefa | 852 | ((AliMUONChamber*) (*fChambers)[id])->SetReconstructionModel(reconst); |
a897a37a | 853 | } |
854 | ||
fe4da5cc | 855 | void AliMUON::SetNsec(Int_t id, Int_t nsec) |
856 | { | |
de05461e | 857 | // Set number of segmented cathods for chamber id |
a9e2aefa | 858 | ((AliMUONChamber*) (*fChambers)[id])->SetNsec(nsec); |
fe4da5cc | 859 | } |
860 | ||
fe4da5cc | 861 | //___________________________________________ |
2ab0c725 | 862 | void AliMUON::SDigits2Digits() |
863 | { | |
d963c261 | 864 | |
865 | // write TreeD here | |
866 | ||
867 | if (!fMerger) { | |
868 | if (gAlice->GetDebug()>0) { | |
869 | cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl; | |
870 | cerr<<" no merging, just digitization of 1 event will be done"<<endl; | |
871 | } | |
872 | fMerger = new AliMUONMerger(); | |
2ab0c725 | 873 | } |
d963c261 | 874 | fMerger->Init(); |
875 | fMerger->Digitise(); | |
876 | char hname[30]; | |
877 | sprintf(hname,"TreeD%d",gAlice->GetHeader()->GetEvent()); | |
878 | gAlice->TreeD()->Write(hname,TObject::kOverwrite); | |
879 | gAlice->TreeD()->Reset(); | |
2ab0c725 | 880 | } |
a9e2aefa | 881 | |
2ab0c725 | 882 | //___________________________________________ |
802a864d | 883 | void AliMUON::MakePadHits(Float_t xhit,Float_t yhit, Float_t zhit, |
a9e2aefa | 884 | Float_t eloss, Float_t tof, Int_t idvol) |
fe4da5cc | 885 | { |
886 | // | |
a897a37a | 887 | // Calls the charge disintegration method of the current chamber and adds |
888 | // the simulated cluster to the root treee | |
fe4da5cc | 889 | // |
a897a37a | 890 | Int_t clhits[7]; |
891 | Float_t newclust[6][500]; | |
892 | Int_t nnew; | |
893 | ||
894 | ||
fe4da5cc | 895 | // |
a897a37a | 896 | // Integrated pulse height on chamber |
897 | ||
898 | ||
899 | clhits[0]=fNhits+1; | |
fe4da5cc | 900 | // |
a897a37a | 901 | // |
7ab910ae | 902 | // if (idvol == 6) printf("\n ->Disintegration %f %f %f", xhit, yhit, eloss ); |
903 | ||
904 | ||
a9e2aefa | 905 | ((AliMUONChamber*) (*fChambers)[idvol]) |
802a864d | 906 | ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust); |
a897a37a | 907 | Int_t ic=0; |
7ab910ae | 908 | // if (idvol == 6) printf("\n nnew %d \n", nnew); |
a897a37a | 909 | // |
910 | // Add new clusters | |
911 | for (Int_t i=0; i<nnew; i++) { | |
912 | if (Int_t(newclust[3][i]) > 0) { | |
913 | ic++; | |
914 | // Cathode plane | |
915 | clhits[1] = Int_t(newclust[5][i]); | |
916 | // Cluster Charge | |
917 | clhits[2] = Int_t(newclust[0][i]); | |
918 | // Pad: ix | |
919 | clhits[3] = Int_t(newclust[1][i]); | |
920 | // Pad: iy | |
921 | clhits[4] = Int_t(newclust[2][i]); | |
922 | // Pad: charge | |
923 | clhits[5] = Int_t(newclust[3][i]); | |
924 | // Pad: chamber sector | |
925 | clhits[6] = Int_t(newclust[4][i]); | |
926 | ||
a9e2aefa | 927 | AddPadHit(clhits); |
a897a37a | 928 | } |
929 | } | |
a897a37a | 930 | } |
931 | ||
a9e2aefa | 932 | //___________________________________________ |
933 | void AliMUON::Trigger(Int_t nev){ | |
934 | // call the Trigger Algorithm and fill TreeR | |
935 | ||
936 | Int_t singlePlus[3] = {0,0,0}; | |
937 | Int_t singleMinus[3] = {0,0,0}; | |
938 | Int_t singleUndef[3] = {0,0,0}; | |
939 | Int_t pairUnlike[3] = {0,0,0}; | |
940 | Int_t pairLike[3] = {0,0,0}; | |
941 | ||
942 | ResetTrigger(); | |
a9e2aefa | 943 | AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1); |
944 | decision->Trigger(); | |
945 | decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef, | |
946 | pairUnlike, pairLike); | |
947 | // add a local trigger in the list | |
948 | AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); | |
9ae15266 | 949 | Int_t i; |
a9e2aefa | 950 | |
f665c1ea | 951 | for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) { |
9ae15266 | 952 | if(decision->GetITrigger(icirc)==1) { |
953 | Int_t localtr[7]={0,0,0,0,0,0,0}; | |
954 | Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0}; | |
955 | decision->GetLutOutput(icirc, loLpt, loHpt, loApt); | |
956 | localtr[0] = icirc; | |
957 | localtr[1] = decision->GetStripX11(icirc); | |
958 | localtr[2] = decision->GetDev(icirc); | |
959 | localtr[3] = decision->GetStripY11(icirc); | |
960 | for (i=0; i<2; i++) { // convert the Lut output in 1 digit | |
961 | localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i)); | |
962 | localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i)); | |
963 | localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i)); | |
964 | } | |
965 | AddLocalTrigger(localtr); // add a local trigger in the list | |
a897a37a | 966 | } |
a9e2aefa | 967 | } |
968 | delete decision; | |
a897a37a | 969 | |
a9e2aefa | 970 | gAlice->TreeR()->Fill(); |
971 | ResetTrigger(); | |
a897a37a | 972 | char hname[30]; |
973 | sprintf(hname,"TreeR%d",nev); | |
2ab0c725 | 974 | gAlice->TreeR()->Write(hname,TObject::kOverwrite); |
a897a37a | 975 | gAlice->TreeR()->Reset(); |
a9e2aefa | 976 | printf("\n End of trigger for event %d", nev); |
a897a37a | 977 | } |
a897a37a | 978 | |
a897a37a | 979 | |
a9e2aefa | 980 | //____________________________________________ |
fe311ef1 | 981 | void AliMUON::Digits2Reco() |
982 | { | |
983 | FindClusters(); | |
e365e1ee | 984 | Int_t nev = gAlice->GetHeader()->GetEvent(); |
985 | gAlice->TreeR()->Fill(); | |
986 | char hname[30]; | |
987 | sprintf(hname,"TreeR%d", nev); | |
988 | gAlice->TreeR()->Write(hname); | |
989 | gAlice->TreeR()->Reset(); | |
990 | ResetRawClusters(); | |
991 | printf("\n End of cluster finding for event %d", nev); | |
fe311ef1 | 992 | } |
993 | ||
994 | void AliMUON::FindClusters() | |
a9e2aefa | 995 | { |
de05461e | 996 | // |
997 | // Perform cluster finding | |
998 | // | |
a9e2aefa | 999 | TClonesArray *dig1, *dig2; |
1000 | Int_t ndig, k; | |
1001 | dig1 = new TClonesArray("AliMUONDigit",1000); | |
1002 | dig2 = new TClonesArray("AliMUONDigit",1000); | |
1003 | AliMUONDigit *digit; | |
a897a37a | 1004 | // |
a9e2aefa | 1005 | // Loop on chambers and on cathode planes |
a897a37a | 1006 | // |
fe311ef1 | 1007 | ResetRawClusters(); |
1bd28025 | 1008 | for (Int_t ich = 0; ich < 10; ich++) { |
1009 | AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich]; | |
fe311ef1 | 1010 | AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel(); |
1011 | ||
a9e2aefa | 1012 | gAlice->ResetDigits(); |
fe311ef1 | 1013 | gAlice->TreeD()->GetEvent(0); |
1bd28025 | 1014 | TClonesArray *muonDigits = this->DigitsAddress(ich); |
a9e2aefa | 1015 | ndig=muonDigits->GetEntriesFast(); |
1016 | printf("\n 1 Found %d digits in %p %d", ndig, muonDigits,ich); | |
1017 | TClonesArray &lhits1 = *dig1; | |
1bd28025 | 1018 | Int_t n = 0; |
1019 | for (k = 0; k < ndig; k++) { | |
1020 | digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
1021 | if (rec->TestTrack(digit->Track(0))) | |
a9e2aefa | 1022 | new(lhits1[n++]) AliMUONDigit(*digit); |
1023 | } | |
1024 | gAlice->ResetDigits(); | |
fe311ef1 | 1025 | gAlice->TreeD()->GetEvent(1); |
a9e2aefa | 1026 | muonDigits = this->DigitsAddress(ich); |
1027 | ndig=muonDigits->GetEntriesFast(); | |
1028 | printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich); | |
1029 | TClonesArray &lhits2 = *dig2; | |
1030 | n=0; | |
1031 | ||
1032 | for (k=0; k<ndig; k++) { | |
1033 | digit= (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
1bd28025 | 1034 | if (rec->TestTrack(digit->Track(0))) |
a9e2aefa | 1035 | new(lhits2[n++]) AliMUONDigit(*digit); |
a897a37a | 1036 | } |
a897a37a | 1037 | |
9825400f | 1038 | if (rec) { |
1039 | AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); | |
a9e2aefa | 1040 | rec->FindRawClusters(); |
1041 | } | |
1042 | dig1->Delete(); | |
1043 | dig2->Delete(); | |
1044 | } // for ich | |
a9e2aefa | 1045 | delete dig1; |
1046 | delete dig2; | |
a897a37a | 1047 | } |
a9e2aefa | 1048 | |
2ab0c725 | 1049 | #ifdef never |
fe4da5cc | 1050 | void AliMUON::Streamer(TBuffer &R__b) |
1051 | { | |
1052 | // Stream an object of class AliMUON. | |
a30a000f | 1053 | AliMUONChamber *iChamber; |
a9e2aefa | 1054 | AliMUONTriggerCircuit *iTriggerCircuit; |
a30a000f | 1055 | AliSegmentation *segmentation; |
1056 | AliMUONResponse *response; | |
1057 | TClonesArray *digitsaddress; | |
1058 | TClonesArray *rawcladdress; | |
9ae15266 | 1059 | Int_t i; |
9ae15266 | 1060 | if (R__b.IsReading()) { |
1061 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
1062 | AliDetector::Streamer(R__b); | |
1063 | R__b >> fNPadHits; | |
1064 | R__b >> fPadHits; // diff | |
1065 | R__b >> fNLocalTrigger; | |
1066 | R__b >> fLocalTrigger; | |
1067 | R__b >> fNGlobalTrigger; | |
1068 | R__b >> fGlobalTrigger; | |
1069 | R__b >> fDchambers; | |
1070 | R__b >> fRawClusters; | |
1071 | R__b.ReadArray(fNdch); | |
1072 | R__b.ReadArray(fNrawch); | |
1073 | R__b >> fAccCut; | |
1074 | R__b >> fAccMin; | |
1075 | R__b >> fAccMax; | |
1076 | R__b >> fChambers; | |
1077 | R__b >> fTriggerCircuits; | |
f665c1ea | 1078 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 | 1079 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
1080 | iTriggerCircuit->Streamer(R__b); | |
fe4da5cc | 1081 | } |
9ae15266 | 1082 | // Stream chamber related information |
f665c1ea | 1083 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 | 1084 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
1085 | iChamber->Streamer(R__b); | |
1086 | if (iChamber->Nsec()==1) { | |
1087 | segmentation=iChamber->SegmentationModel(1); | |
1088 | if (segmentation) | |
1089 | segmentation->Streamer(R__b); | |
1090 | } else { | |
1091 | segmentation=iChamber->SegmentationModel(1); | |
1092 | if (segmentation) | |
1093 | segmentation->Streamer(R__b); | |
1094 | if (segmentation) | |
1095 | segmentation=iChamber->SegmentationModel(2); | |
1096 | segmentation->Streamer(R__b); | |
1097 | } | |
1098 | response=iChamber->ResponseModel(); | |
1099 | if (response) | |
1100 | response->Streamer(R__b); | |
1101 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; | |
1102 | digitsaddress->Streamer(R__b); | |
f665c1ea | 1103 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 | 1104 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1105 | rawcladdress->Streamer(R__b); | |
1106 | } | |
a9e2aefa | 1107 | } |
9ae15266 | 1108 | |
1109 | } else { | |
1110 | R__b.WriteVersion(AliMUON::IsA()); | |
1111 | AliDetector::Streamer(R__b); | |
1112 | R__b << fNPadHits; | |
1113 | R__b << fPadHits; // diff | |
1114 | R__b << fNLocalTrigger; | |
1115 | R__b << fLocalTrigger; | |
1116 | R__b << fNGlobalTrigger; | |
1117 | R__b << fGlobalTrigger; | |
1118 | R__b << fDchambers; | |
1119 | R__b << fRawClusters; | |
f665c1ea | 1120 | R__b.WriteArray(fNdch, AliMUONConstants::NCh()); |
1121 | R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh()); | |
9ae15266 | 1122 | |
1123 | R__b << fAccCut; | |
1124 | R__b << fAccMin; | |
1125 | R__b << fAccMax; | |
1126 | ||
1127 | R__b << fChambers; | |
1128 | R__b << fTriggerCircuits; | |
f665c1ea | 1129 | for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
9ae15266 | 1130 | iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i]; |
1131 | iTriggerCircuit->Streamer(R__b); | |
fe4da5cc | 1132 | } |
f665c1ea | 1133 | for (i =0; i<AliMUONConstants::NCh(); i++) { |
9ae15266 | 1134 | iChamber=(AliMUONChamber*) (*fChambers)[i]; |
1135 | iChamber->Streamer(R__b); | |
1136 | if (iChamber->Nsec()==1) { | |
1137 | segmentation=iChamber->SegmentationModel(1); | |
1138 | if (segmentation) | |
1139 | segmentation->Streamer(R__b); | |
1140 | } else { | |
1141 | segmentation=iChamber->SegmentationModel(1); | |
1142 | if (segmentation) | |
1143 | segmentation->Streamer(R__b); | |
1144 | segmentation=iChamber->SegmentationModel(2); | |
1145 | if (segmentation) | |
1146 | segmentation->Streamer(R__b); | |
1147 | } | |
1148 | response=iChamber->ResponseModel(); | |
1149 | if (response) | |
1150 | response->Streamer(R__b); | |
1151 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; | |
1152 | digitsaddress->Streamer(R__b); | |
f665c1ea | 1153 | if (i < AliMUONConstants::NTrackingCh()) { |
9ae15266 | 1154 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1155 | rawcladdress->Streamer(R__b); | |
1156 | } | |
a9e2aefa | 1157 | } |
fe4da5cc | 1158 | } |
fe4da5cc | 1159 | } |
2ab0c725 | 1160 | #endif |
1161 | ||
a9e2aefa | 1162 | AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters) |
fe4da5cc | 1163 | { |
1164 | // | |
1165 | // Initialise the pad iterator | |
1166 | // Return the address of the first padhit for hit | |
a897a37a | 1167 | TClonesArray *theClusters = clusters; |
fe4da5cc | 1168 | Int_t nclust = theClusters->GetEntriesFast(); |
1bd28025 | 1169 | if (nclust && hit->PHlast() > 0) { |
1170 | AliMUON::fMaxIterPad=hit->PHlast(); | |
1171 | AliMUON::fCurIterPad=hit->PHfirst(); | |
a9e2aefa | 1172 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); |
fe4da5cc | 1173 | } else { |
1174 | return 0; | |
1175 | } | |
1176 | } | |
1177 | ||
a9e2aefa | 1178 | AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters) |
fe4da5cc | 1179 | { |
de05461e | 1180 | // Get next pad (in iterator) |
1181 | // | |
a9e2aefa | 1182 | AliMUON::fCurIterPad++; |
1183 | if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) { | |
1184 | return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1); | |
fe4da5cc | 1185 | } else { |
1186 | return 0; | |
1187 | } | |
1188 | } | |
1189 | ||
a897a37a | 1190 | |
1191 | AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster) | |
1192 | { | |
de05461e | 1193 | // |
1194 | // Return rawcluster (icluster) for chamber ichamber and cathode icathod | |
1195 | // Obsolete ?? | |
a9e2aefa | 1196 | TClonesArray *muonRawCluster = RawClustAddress(ichamber); |
a897a37a | 1197 | ResetRawClusters(); |
a9e2aefa | 1198 | TTree *treeR = gAlice->TreeR(); |
1199 | Int_t nent=(Int_t)treeR->GetEntries(); | |
1200 | treeR->GetEvent(nent-2+icathod-1); | |
1201 | //treeR->GetEvent(icathod); | |
1202 | //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast(); | |
a897a37a | 1203 | |
a9e2aefa | 1204 | AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster); |
a897a37a | 1205 | //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw); |
1206 | ||
1207 | return mRaw; | |
1208 | } | |
1cae9436 | 1209 | |
1210 | void AliMUON::SetMerger(AliMUONMerger* merger) | |
1211 | { | |
1212 | // Set pointer to merger | |
1213 | fMerger = merger; | |
1214 | } | |
1215 | ||
1216 | AliMUONMerger* AliMUON::Merger() | |
1217 | { | |
1218 | // Return pointer to merger | |
1219 | return fMerger; | |
1220 | } | |
1221 | ||
1222 | ||
a897a37a | 1223 | |
a9e2aefa | 1224 | AliMUON& AliMUON::operator = (const AliMUON& rhs) |
a897a37a | 1225 | { |
a9e2aefa | 1226 | // copy operator |
1227 | // dummy version | |
1228 | return *this; | |
a897a37a | 1229 | } |
1230 | ||
cd4df77b | 1231 | //////////////////////////////////////////////////////////////////////// |
1232 | void AliMUON::MakeBranchInTreeD(TTree *treeD, const char *file) | |
1233 | { | |
1234 | // | |
1235 | // Create TreeD branches for the MUON. | |
1236 | // | |
a897a37a | 1237 | |
cd4df77b | 1238 | const Int_t kBufferSize = 4000; |
1239 | char branchname[30]; | |
1240 | ||
1241 | // | |
1242 | // one branch for digits per chamber | |
1243 | // | |
1244 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { | |
1245 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
1246 | if (fDchambers && treeD) { | |
1247 | MakeBranchInTree(treeD, | |
1248 | branchname, &((*fDchambers)[i]), kBufferSize, file); | |
1249 | printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); | |
1250 | } | |
1251 | } | |
1252 | } | |
a897a37a | 1253 | |
cd4df77b | 1254 | //___________________________________________ |
fe4da5cc | 1255 |