]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONv0.cxx
No longer needed as all deals with the old IO as well as old digit-cluster structure
[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
88cb7938 16/* $Id$ */
4c039060 17
fe4da5cc 18/////////////////////////////////////////////////////////
19// Manager and hits classes for set:MUON version 0 //
20/////////////////////////////////////////////////////////
21
116cbefd 22#include <Riostream.h>
88cb7938 23
116cbefd 24#include <TLorentzVector.h>
fe4da5cc 25#include <TNode.h>
26#include <TRandom.h>
116cbefd 27#include <TTUBE.h>
88cb7938 28#include <TVirtualMC.h>
fe4da5cc 29
fe4da5cc 30#include "AliCallf77.h"
31#include "AliConst.h"
88cb7938 32#include "AliMUONChamber.h"
f665c1ea 33#include "AliMUONConstants.h"
be3bb6c1 34#include "AliMUONFactory.h"
88cb7938 35#include "AliMUONHit.h"
36#include "AliMUONPadHit.h"
37#include "AliMUONv0.h"
38#include "AliMagF.h"
39#include "AliRun.h"
5d12ce38 40#include "AliMC.h"
88cb7938 41
fe4da5cc 42ClassImp(AliMUONv0)
43
44//___________________________________________
45AliMUONv0::AliMUONv0() : AliMUON()
46{
a9e2aefa 47// Constructor
fe4da5cc 48 fChambers = 0;
49}
50
51//___________________________________________
52AliMUONv0::AliMUONv0(const char *name, const char *title)
53 : AliMUON(name,title)
54{
a9e2aefa 55// Constructor
ba030c0e 56 AliMUONFactory factory;
57 factory.Build(this, title);
a897a37a 58}
59
a9e2aefa 60void AliMUONv0::CreateGeometry()
61{
62// Creates coarse geometry for hit density simulations
63 Int_t *idtmed = fIdtmed->GetArray()-1099;
fe4da5cc 64//
a9e2aefa 65 Float_t zpos, dAlu, tpar[3];
66 Int_t idAir=idtmed[1100];
67 Int_t idAlu=idtmed[1103];
68
69 AliMUONChamber *iChamber;
70 // Loop over all chambers (tracking and trigger)
f665c1ea 71 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) {
a9e2aefa 72 char alu[8];
73 char gas[8];
74
75 iChamber=(AliMUONChamber*) (*fChambers)[ch];
76 // Z of the chamber
77 zpos=iChamber->Z();
78 dAlu=iChamber->DAlu();
f665c1ea 79 if (ch < AliMUONConstants::NTrackingCh()) {
a9e2aefa 80 // tracking chambers
b74f1c6a 81 sprintf(alu,"SA0%1d",ch);
82 sprintf(gas,"SG0%1d",ch);
a9e2aefa 83 } else {
84 // trigger chambers
b74f1c6a 85 sprintf(alu,"SA%2d",ch);
86 sprintf(gas,"SG%2d",ch);
a9e2aefa 87 }
88//
a9e2aefa 89 tpar[0] = iChamber->RInner();
90 tpar[1] = iChamber->ROuter();
91 tpar[2] = (dAlu+0.2)/2.;
92 if (ch !=4 && ch !=5) {
93 gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
94 tpar[2] = 0.1;
95 gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
96 } else {
97 gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
98 tpar[2] = 0.1;
99 gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
100 }
101 gMC->Gspos(gas, 1, alu, 0., 0., 0., 0, "ONLY");
afa281f0 102 if (ch == 4 || ch ==5) {
82e22b99 103 if (gMC->VolId("DDIP")) {
104 gMC->Gspos(alu, 1, "DDIP", 0., 0., zpos, 0, "ONLY");
105 } else {
106 gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY");
107 }
afa281f0 108 } else {
109 gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY");
110 }
a897a37a 111 }
fe4da5cc 112}
113
fe4da5cc 114//___________________________________________
115void AliMUONv0::CreateMaterials()
116{
a9e2aefa 117// Creates materials for coarse geometry
82e22b99 118 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
119 AliMaterial( 9, "ALUMINIUM$", 26.98, 13. , 2.7, 8.9, 37.2);
fe4da5cc 120
a9e2aefa 121 Float_t epsil = .001; // Tracking precision,
122 Float_t stemax = -1.; // Maximum displacement for multiple scat
123 Float_t tmaxfd = -20.; // Maximum angle due to field deflection
124 Float_t deemax = -.3; // Maximum fractional energy loss, DLS
125 Float_t stmin = -.8;
126 Int_t isxfld = gAlice->Field()->Integ();
127 Float_t sxmgmx = gAlice->Field()->Max();
fe4da5cc 128
fe4da5cc 129 //
a9e2aefa 130 // Air
131 AliMedium(1, "AIR_CH_US ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
82e22b99 132 AliMedium(4, "ALU_CH_US ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu,
a897a37a 133 fMaxDestepAlu, epsil, stmin);
134
fe4da5cc 135}
136
fe4da5cc 137void AliMUONv0::Init()
138{
fe4da5cc 139 //
140 // Initialize Tracking Chambers
141 //
b9046b8f 142 char vName[8];
143 printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n");
144 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
145// Initialise chamber
146 ((AliMUONChamber*) (*fChambers)[i])->Init();
147// Set sensitive volume Id
148 if (i < AliMUONConstants::NTrackingCh()) {
149 // tracking chambers
b74f1c6a 150 sprintf(vName,"SG0%1d",i);
b9046b8f 151 } else {
152 // trigger chambers
b74f1c6a 153 sprintf(vName,"SG%2d",i);
b9046b8f 154 }
155 ((AliMUONChamber*) (*fChambers)[i])->SetGid(gMC->VolId(vName));
156 }
fe4da5cc 157}
158
fe4da5cc 159void AliMUONv0::StepManager()
160{
a9e2aefa 161//
162// Step manager for hit density simulations
fe4da5cc 163 Int_t copy, id;
164 static Int_t idvol;
165 static Int_t vol[2];
166 Int_t ipart;
a897a37a 167 TLorentzVector pos;
168 TLorentzVector mom;
169 Float_t theta,phi;
fe4da5cc 170
a897a37a 171 // modifs perso
a9e2aefa 172 static Float_t hits[15];
a897a37a 173
fe4da5cc 174 TClonesArray &lhits = *fHits;
fe4da5cc 175 //
176 // Only gas gap inside chamber
177 // Tag chambers and record hits when track enters
178 idvol=-1;
0a6d8768 179 id=gMC->CurrentVolID(copy);
fe4da5cc 180
f665c1ea 181 for (Int_t i=1; i<=AliMUONConstants::NCh(); i++) {
a9e2aefa 182 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){
fe4da5cc 183 vol[0]=i;
184 idvol=i-1;
185 }
186 }
187 if (idvol == -1) return;
188 //
189 // Get current particle id (ipart), track position (pos) and momentum (mom)
cfce8870 190 gMC->TrackPosition(pos);
191 gMC->TrackMomentum(mom);
fe4da5cc 192
cfce8870 193 ipart = gMC->TrackPid();
fe4da5cc 194 //
195 // record hits when track enters ...
9fde056a 196 if( !(gMC->TrackCharge()) ) return;
0a6d8768 197 if( gMC->IsTrackEntering()) {
82e22b99 198// printf("\n Particle entering %f %f %f", pos[0], pos[1], pos[2] );
199
a897a37a 200 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
201 Double_t rt = TMath::Sqrt(tc);
a897a37a 202 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
203 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
a9e2aefa 204 hits[0] = Float_t(ipart); // Geant3 particle type
205 hits[1] = pos[0]; // X-position for hit
206 hits[2] = pos[1]; // Y-position for hit
207 hits[3] = pos[2]; // Z-position for hit
208 hits[4] = theta; // theta angle of incidence
209 hits[5] = phi; // phi angle of incidence
210 hits[8] = -1; // first padhit
211 hits[9] = -1; // last pad hit
2eb55fab 212 hits[10] = mom[3]; // hit Energy
213 hits[11] = mom[0]; // Px
214 hits[12] = mom[1]; // Py
215 hits[13] = mom[2]; // Pz
216 hits[14] = gMC->TrackTime(); // time of flight
fe4da5cc 217 new(lhits[fNhits++])
5d12ce38 218 AliMUONHit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
a9e2aefa 219
fe4da5cc 220 }
82e22b99 221// if( gMC->IsTrackExiting()) gMC->StopTrack();
fe4da5cc 222}
a9e2aefa 223
224
225
226
227
228
229
230
231