Code from MUON-dev joined
[u/mrichter/AliRoot.git] / MUON / AliMUONv0.cxx
CommitLineData
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 **************************************************************************/
15
16/*
17$Log$
a9e2aefa 18Revision 1.8.4.9 2000/06/12 19:20:49 morsch
19Constructor sets default geometry, segmentation and response parameters.
20
21Revision 1.8.4.8 2000/06/09 21:55:28 morsch
22Most coding rule violations corrected.
23
24Revision 1.8.4.7 2000/05/02 13:15:18 morsch
25Coding rule violations RS3, RN13 corected
26
27Revision 1.8.4.6 2000/05/02 10:24:26 morsch
28Public access to fdGas and fdAlu of AliMUONChamber replaced by getters.
29
30Revision 1.8.4.5 2000/04/26 19:58:47 morsch
31Obsolete reference to trig_ removed.
32
33Revision 1.8.4.4 2000/04/19 19:42:47 morsch
34change NCH to kNCH
35
36Revision 1.8.4.3 2000/02/17 08:17:43 morsch
37Gammas and neutrons are also scored in the stepmanager
4c039060 38*/
39
fe4da5cc 40/////////////////////////////////////////////////////////
41// Manager and hits classes for set:MUON version 0 //
42/////////////////////////////////////////////////////////
43
44#include <TTUBE.h>
45#include <TNode.h>
46#include <TRandom.h>
a897a37a 47#include <TLorentzVector.h>
a9e2aefa 48#include <iostream.h>
fe4da5cc 49
50#include "AliMUONv0.h"
a9e2aefa 51#include "AliMUONChamber.h"
fe4da5cc 52#include "AliRun.h"
53#include "AliMC.h"
a9e2aefa 54#include "AliMUONHit.h"
55#include "AliMUONPadHit.h"
fe4da5cc 56#include "AliCallf77.h"
57#include "AliConst.h"
a9e2aefa 58#include "AliMUONResponseV0.h"
59#include "AliMUONResponseTrigger.h"
60#include "AliMUONSegmentationV0.h"
61#include "AliMUONSegmentationV01.h"
62#include "AliMUONSegmentationV02.h"
63#include "AliMUONSegmentationV04.h"
64#include "AliMUONSegmentationV05.h"
65#include "AliMUONSegmentationTrigger.h"
66#include "AliMUONSegmentationTriggerX.h"
67#include "AliMUONSegmentationTriggerY.h"
fe4da5cc 68
69ClassImp(AliMUONv0)
70
71//___________________________________________
72AliMUONv0::AliMUONv0() : AliMUON()
73{
a9e2aefa 74// Constructor
fe4da5cc 75 fChambers = 0;
76}
77
78//___________________________________________
79AliMUONv0::AliMUONv0(const char *name, const char *title)
80 : AliMUON(name,title)
81{
a9e2aefa 82// Constructor
83 fChambers = 0;
fe4da5cc 84
a9e2aefa 85 SetIshunt(0);
86 SetMaxStepGas(0.1);
87 SetMaxStepAlu(0.1);
88//
89// Version 0
90//
91// First define the number of planes that are segmented (1 or 2) by a call
92// to SetNsec.
93// Then chose for each chamber (chamber plane) the segmentation
94// and response model.
95// They should be equal for the two chambers of each station. In a future
96// version this will be enforced.
97//
98//
99 Int_t chamber;
100 Int_t station;
101// Default response
102 AliMUONResponseV0* response0 = new AliMUONResponseV0;
103 response0->SetSqrtKx3(0.7131);
104 response0->SetKx2(1.0107);
105 response0->SetKx4(0.4036);
106 response0->SetSqrtKy3(0.7642);
107 response0->SetKy2(0.9706);
108 response0->SetKy4(0.3831);
109 response0->SetPitch(0.25);
110 response0->SetSigmaIntegration(10.);
111 response0->SetChargeSlope(50);
112 response0->SetChargeSpread(0.18, 0.18);
113 response0->SetMaxAdc(4096);
114 response0->SetZeroSuppression(6);
115//--------------------------------------------------------
116// Configuration for Chamber TC1/2 (Station 1) ----------
117//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118 Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
119 Int_t nseg1[4]={4, 4, 2, 1};
120//
121 chamber=1;
122//^^^^^^^^^
123 SetNsec(chamber-1,2);
124//
125 AliMUONSegmentationV01 *seg11=new AliMUONSegmentationV01;
fe4da5cc 126
a9e2aefa 127 seg11->SetSegRadii(rseg1);
128 seg11->SetPadSize(3, 0.5);
129 seg11->SetDAnod(3.0/3./4);
130 seg11->SetPadDivision(nseg1);
131
132 SetSegmentationModel(chamber-1, 1, seg11);
fe4da5cc 133//
a9e2aefa 134 AliMUONSegmentationV02 *seg12=new AliMUONSegmentationV02;
135 seg12->SetSegRadii(rseg1);
136 seg12->SetPadSize(0.75, 2.0);
137 seg12->SetDAnod(3.0/3./4);
138 seg12->SetPadDivision(nseg1);
139
140 SetSegmentationModel(chamber-1, 2, seg12);
141
142 SetResponseModel(chamber-1, response0);
143
144 chamber=2;
145//^^^^^^^^^
146//
147 SetNsec(chamber-1,2);
148//
149 AliMUONSegmentationV01 *seg21=new AliMUONSegmentationV01;
150 seg21->SetSegRadii(rseg1);
151 seg21->SetPadSize(3, 0.5);
152 seg21->SetDAnod(3.0/3./4);
153 seg21->SetPadDivision(nseg1);
154 SetSegmentationModel(chamber-1, 1, seg21);
155//
156 AliMUONSegmentationV02 *seg22=new AliMUONSegmentationV02;
157 seg22->SetSegRadii(rseg1);
158 seg22->SetPadSize(0.75, 2.);
159 seg22->SetDAnod(3.0/3./4);
160 seg22->SetPadDivision(nseg1);
161 SetSegmentationModel(chamber-1, 2, seg22);
162
163 SetResponseModel(chamber-1, response0);
164//
165//--------------------------------------------------------
166// Configuration for Chamber TC3/4 -----------------------
167//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168 Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
169 Int_t nseg2[4]={4, 4, 2, 1};
170//
171 chamber=3;
172//^^^^^^^^^
173 SetNsec(chamber-1,2);
174//
175 AliMUONSegmentationV01 *seg31=new AliMUONSegmentationV01;
176 seg31->SetSegRadii(rseg2);
177 seg31->SetPadSize(6, 0.5);
178 seg31->SetDAnod(3.0/3./4);
179 seg31->SetPadDivision(nseg2);
180 SetSegmentationModel(chamber-1, 1, seg31);
181//
182 AliMUONSegmentationV02 *seg32=new AliMUONSegmentationV02;
183 seg32->SetSegRadii(rseg2);
184 seg32->SetPadSize(0.75, 4.);
185 seg32->SetPadDivision(nseg2);
186 seg32->SetDAnod(3.0/3./4);
187
188 SetSegmentationModel(chamber-1, 2, seg32);
189
190 SetResponseModel(chamber-1, response0);
191
192 chamber=4;
193//^^^^^^^^^
194//
195 SetNsec(chamber-1,2);
196//
197 AliMUONSegmentationV01 *seg41=new AliMUONSegmentationV01;
198 seg41->SetSegRadii(rseg2);
199 seg41->SetPadSize(6, 0.5);
200 seg41->SetDAnod(3.0/3./4);
201 seg41->SetPadDivision(nseg2);
202 SetSegmentationModel(chamber-1, 1, seg41);
203//
204 AliMUONSegmentationV02 *seg42=new AliMUONSegmentationV02;
205 seg42->SetSegRadii(rseg2);
206 seg42->SetPadSize(0.75, 4.);
207 seg42->SetPadDivision(nseg2);
208 seg42->SetDAnod(3.0/3./4);
209
210 SetSegmentationModel(chamber-1, 2, seg42);
211
212 SetResponseModel(chamber-1, response0);
213
214
215//--------------------------------------------------------
216// Configuration for Chamber TC5/6 -----------------------
217//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
218 chamber=5;
219//^^^^^^^^^
220 SetNsec(chamber-1,2);
221//
222 AliMUONSegmentationV01 *seg51=new AliMUONSegmentationV01;
223 seg51->SetSegRadii(rseg2);
224 seg51->SetPadSize(6, 0.5);
225 seg51->SetDAnod(3.0/3./4);
226 seg51->SetPadDivision(nseg2);
227 SetSegmentationModel(chamber-1, 1, seg51);
228//
229 AliMUONSegmentationV02 *seg52=new AliMUONSegmentationV02;
230 seg52->SetSegRadii(rseg2);
231 seg52->SetPadSize(0.75, 4.);
232 seg52->SetPadDivision(nseg2);
233 seg52->SetDAnod(3.0/3./4);
234
235 SetSegmentationModel(chamber-1, 2, seg52);
236 SetResponseModel(chamber-1, response0);
237
238 chamber=6;
239//^^^^^^^^^
240//
241 SetNsec(chamber-1,2);
242//
243 AliMUONSegmentationV01 *seg61=new AliMUONSegmentationV01;
244 seg61->SetSegRadii(rseg2);
245 seg61->SetPadSize(6, 0.5);
246 seg61->SetDAnod(3.0/3./4);
247 seg61->SetPadDivision(nseg2);
248 SetSegmentationModel(chamber-1, 1, seg61);
249//
250 AliMUONSegmentationV02 *seg62=new AliMUONSegmentationV02;
251 seg62->SetSegRadii(rseg2);
252 seg62->SetPadSize(0.75, 4.);
253 seg62->SetPadDivision(nseg2);
254 seg62->SetDAnod(3.0/3./4);
255
256 SetSegmentationModel(chamber-1, 2, seg62);
257
258 SetResponseModel(chamber-1, response0);
cfce8870 259
a897a37a 260
a897a37a 261//
a9e2aefa 262// Station 3
263 station=3;
264 SetPadSize(station, 1, 0.975, 0.55);
a897a37a 265
a9e2aefa 266//--------------------------------------------------------
267// Configuration for Chamber TC7/8 (Station 4) ----------
268//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a897a37a 269
a9e2aefa 270 Int_t nseg4[4]={4, 4, 2, 1};
a897a37a 271
a9e2aefa 272 chamber=7;
273//^^^^^^^^^
274 SetNsec(chamber-1,2);
a897a37a 275//
a9e2aefa 276 AliMUONSegmentationV04 *seg71=new AliMUONSegmentationV04;
277 seg71->SetPadSize(10.,0.5);
278 seg71->SetDAnod(0.25);
279 seg71->SetPadDivision(nseg4);
280 SetSegmentationModel(chamber-1, 1, seg71);
281 AliMUONSegmentationV05 *seg72=new AliMUONSegmentationV05;
282 seg72->SetPadSize(1,10);
283 seg72->SetDAnod(0.25);
284 seg72->SetPadDivision(nseg4);
285 SetSegmentationModel(chamber-1, 2, seg72);
286
287 SetResponseModel(chamber-1, response0);
288
289 chamber=8;
290//^^^^^^^^^
291 SetNsec(chamber-1,2);
292 AliMUONSegmentationV04 *seg81=new AliMUONSegmentationV04;
293 seg81->SetPadSize(10., 0.5);
294 seg81->SetPadDivision(nseg4);
295 seg81->SetDAnod(0.25);
296 SetSegmentationModel(chamber-1, 1, seg81);
297
298 AliMUONSegmentationV05 *seg82=new AliMUONSegmentationV05;
299 seg82->SetPadSize(1, 10);
300 seg82->SetPadDivision(nseg4);
301 seg82->SetDAnod(0.25);
302 SetSegmentationModel(chamber-1, 2, seg82);
303
304 SetResponseModel(chamber-1, response0);
305//--------------------------------------------------------
306// Configuration for Chamber TC9/10 (Station 5) ---------
307//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
308 chamber=9;
309//^^^^^^^^^
310 SetNsec(chamber-1,2);
311//
312 AliMUONSegmentationV04 *seg91=new AliMUONSegmentationV04;
313 seg91->SetPadSize(10.,0.5);
314 seg91->SetDAnod(0.25);
315 seg91->SetPadDivision(nseg4);
316 SetSegmentationModel(chamber-1, 1, seg91);
317
318 AliMUONSegmentationV05 *seg92=new AliMUONSegmentationV05;
319 seg92->SetPadSize(1,10);
320 seg92->SetDAnod(0.25);
321 seg92->SetPadDivision(nseg4);
322
323 SetSegmentationModel(chamber-1, 2, seg92);
324
325 SetResponseModel(chamber-1, response0);
326
327 chamber=10;
328//^^^^^^^^^
329 SetNsec(chamber-1,2);
330 AliMUONSegmentationV04 *seg101=new AliMUONSegmentationV04;
331 seg101->SetPadSize(10., 0.5);
332 seg101->SetPadDivision(nseg4);
333 seg101->SetDAnod(0.25);
334 SetSegmentationModel(chamber-1, 1, seg101);
335
336 AliMUONSegmentationV05 *seg102=new AliMUONSegmentationV05;
337 seg102->SetPadSize(1,10);
338 seg102->SetPadDivision(nseg4);
339 seg102->SetDAnod(0.25);
340 SetSegmentationModel(chamber-1, 2, seg102);
341
342 SetResponseModel(chamber-1, response0);
a897a37a 343
a9e2aefa 344//--------------------------------------------------------
345// Configuration for Trigger staions ---------------------
346//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
347 AliMUONResponseTrigger* responseTrigger0 = new AliMUONResponseTrigger;
348
349 chamber=11;
350 SetNsec(chamber-1,2);
351 AliMUONSegmentationTriggerX *seg111=new AliMUONSegmentationTriggerX;
352 SetSegmentationModel(chamber-1, 1, seg111);
353 AliMUONSegmentationTriggerY *seg112=new AliMUONSegmentationTriggerY;
354 SetSegmentationModel(chamber-1, 2, seg112);
355
356 SetResponseModel(chamber-1, responseTrigger0);
357
358 chamber=12;
359 SetNsec(chamber-1,2);
360 AliMUONSegmentationTriggerX *seg121=new AliMUONSegmentationTriggerX;
361 SetSegmentationModel(chamber-1, 1, seg121);
362 AliMUONSegmentationTriggerY *seg122=new AliMUONSegmentationTriggerY;
363 SetSegmentationModel(chamber-1, 2, seg122);
364
365 SetResponseModel(chamber-1, responseTrigger0);
366
367 chamber=13;
368 SetNsec(chamber-1,2);
369 AliMUONSegmentationTriggerX *seg131=new AliMUONSegmentationTriggerX;
370 SetSegmentationModel(chamber-1, 1, seg131);
371 AliMUONSegmentationTriggerY *seg132=new AliMUONSegmentationTriggerY;
372 SetSegmentationModel(chamber-1, 2, seg132);
373 SetResponseModel(chamber-1, responseTrigger0);
374
375 chamber=14;
376 SetNsec(chamber-1,2);
377 AliMUONSegmentationTriggerX *seg141=new AliMUONSegmentationTriggerX;
378 SetSegmentationModel(chamber-1, 1, seg141);
379 AliMUONSegmentationTriggerY *seg142=new AliMUONSegmentationTriggerY;
380 SetSegmentationModel(chamber-1, 2, seg142);
381
382 SetResponseModel(chamber-1, responseTrigger0);
a897a37a 383}
384
a9e2aefa 385void AliMUONv0::CreateGeometry()
386{
387// Creates coarse geometry for hit density simulations
388 Int_t *idtmed = fIdtmed->GetArray()-1099;
fe4da5cc 389//
a9e2aefa 390 Float_t zpos, dAlu, tpar[3];
391 Int_t idAir=idtmed[1100];
392 Int_t idAlu=idtmed[1103];
393
394 AliMUONChamber *iChamber;
395 // Loop over all chambers (tracking and trigger)
396 for (Int_t ch = 0; ch < kNCH; ch++) {
397 char alu[8];
398 char gas[8];
399
400 iChamber=(AliMUONChamber*) (*fChambers)[ch];
401 // Z of the chamber
402 zpos=iChamber->Z();
403 dAlu=iChamber->DAlu();
404 if (ch < kNTrackingCh) {
405 // tracking chambers
406 sprintf(alu,"CA0%1d",ch);
407 sprintf(gas,"CG0%1d",ch);
408 } else {
409 // trigger chambers
410 sprintf(alu,"CA%2d",ch);
411 sprintf(gas,"CG%2d",ch);
412 }
413//
414 printf("\n %d, %s, %s \n ", ch, alu, gas);
415
416 tpar[0] = iChamber->RInner();
417 tpar[1] = iChamber->ROuter();
418 tpar[2] = (dAlu+0.2)/2.;
419 if (ch !=4 && ch !=5) {
420 gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
421 tpar[2] = 0.1;
422 gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
423 } else {
424 gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
425 tpar[2] = 0.1;
426 gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
427 }
428 gMC->Gspos(gas, 1, alu, 0., 0., 0., 0, "ONLY");
429 gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY");
430 iChamber->SetGid(gMC->VolId(gas));
a897a37a 431 }
fe4da5cc 432}
433
fe4da5cc 434//___________________________________________
435void AliMUONv0::CreateMaterials()
436{
a9e2aefa 437// Creates materials for coarse geometry
fe4da5cc 438 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
a9e2aefa 439 AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
fe4da5cc 440
a9e2aefa 441 Float_t epsil = .001; // Tracking precision,
442 Float_t stemax = -1.; // Maximum displacement for multiple scat
443 Float_t tmaxfd = -20.; // Maximum angle due to field deflection
444 Float_t deemax = -.3; // Maximum fractional energy loss, DLS
445 Float_t stmin = -.8;
446 Int_t isxfld = gAlice->Field()->Integ();
447 Float_t sxmgmx = gAlice->Field()->Max();
fe4da5cc 448
fe4da5cc 449 //
a9e2aefa 450 // Air
451 AliMedium(1, "AIR_CH_US ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452 AliMedium(4, "ALU_CH_US ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu,
a897a37a 453 fMaxDestepAlu, epsil, stmin);
454
fe4da5cc 455}
456
fe4da5cc 457void AliMUONv0::Init()
458{
fe4da5cc 459 //
460 // Initialize Tracking Chambers
461 //
a9e2aefa 462 printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n");
463 for (Int_t i=0; i<kNCH; i++) {
464 ( (AliMUONChamber*) (*fChambers)[i])->Init();
fe4da5cc 465 }
fe4da5cc 466}
467
fe4da5cc 468void AliMUONv0::StepManager()
469{
a9e2aefa 470//
471// Step manager for hit density simulations
fe4da5cc 472 Int_t copy, id;
473 static Int_t idvol;
474 static Int_t vol[2];
475 Int_t ipart;
a897a37a 476 TLorentzVector pos;
477 TLorentzVector mom;
478 Float_t theta,phi;
fe4da5cc 479
a897a37a 480 // modifs perso
a9e2aefa 481 static Float_t hits[15];
a897a37a 482
fe4da5cc 483 TClonesArray &lhits = *fHits;
fe4da5cc 484 //
485 // Only gas gap inside chamber
486 // Tag chambers and record hits when track enters
487 idvol=-1;
0a6d8768 488 id=gMC->CurrentVolID(copy);
fe4da5cc 489
a9e2aefa 490 for (Int_t i=1; i<=kNCH; i++) {
491 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){
fe4da5cc 492 vol[0]=i;
493 idvol=i-1;
494 }
495 }
496 if (idvol == -1) return;
497 //
498 // Get current particle id (ipart), track position (pos) and momentum (mom)
cfce8870 499 gMC->TrackPosition(pos);
500 gMC->TrackMomentum(mom);
fe4da5cc 501
cfce8870 502 ipart = gMC->TrackPid();
fe4da5cc 503 //
504 // record hits when track enters ...
a9e2aefa 505// if( !(gMC->TrackCharge()) ) return;
0a6d8768 506 if( gMC->IsTrackEntering()) {
a897a37a 507 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
508 Double_t rt = TMath::Sqrt(tc);
a897a37a 509 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
510 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
a9e2aefa 511 hits[0] = Float_t(ipart); // Geant3 particle type
512 hits[1] = pos[0]; // X-position for hit
513 hits[2] = pos[1]; // Y-position for hit
514 hits[3] = pos[2]; // Z-position for hit
515 hits[4] = theta; // theta angle of incidence
516 hits[5] = phi; // phi angle of incidence
517 hits[8] = -1; // first padhit
518 hits[9] = -1; // last pad hit
519
520 // modifs personel
521 hits[10] = mom[3]; // hit Energy
522 hits[11] = mom[0]; // Px
523 hits[12] = mom[1]; // Py
524 hits[13] = mom[2]; // Pz
525 hits[14] = gMC->TrackTime();
fe4da5cc 526
a9e2aefa 527 // fin modifs perso
fe4da5cc 528 new(lhits[fNhits++])
a9e2aefa 529 AliMUONHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
530
fe4da5cc 531 }
532}
a9e2aefa 533
534
535
536
537
538
539
540
541