]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONv3.cxx
Additional protection in the destructor
[u/mrichter/AliRoot.git] / MUON / AliMUONv3.cxx
CommitLineData
8d7b49a7 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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// AliMUONv3 Addapted for AliMUONv1
17// This was the last revision of AliMUONv1
18// $Log$
2468d1a9 19// Revision 1.1 2003/02/07 15:40:53 morsch
20// New class for testing new Stepmanager added. (G. Martinez)
21//
8d7b49a7 22// Revision 1.40 2003/01/28 13:21:06 morsch
23// Improved response simulation for station 1.
24// (M. Mac Cormick, I. Hrivnacova, D. Guez)
25//
26// Gines Martinez (Subatech) jan 2003
27
28/////////////////////////////////////////////////////////
29// Manager and hits classes for set:MUON version 2 //
30/////////////////////////////////////////////////////////
31
32#include <Riostream.h>
33#include <TClonesArray.h>
34#include <TLorentzVector.h>
35#include <TNode.h>
36#include <TRandom.h>
37#include <TTUBE.h>
38
39#include "AliMUONv3.h"
40#include "AliRun.h"
41#include "AliMagF.h"
42#include "AliCallf77.h"
43#include "AliConst.h"
44#include "AliMUONChamber.h"
45#include "AliMUONHit.h"
46#include "AliMUONPadHit.h"
47#include "AliMUONConstants.h"
48#include "AliMUONTriggerCircuit.h"
49#include "AliMUONFactory.h"
50
51ClassImp(AliMUONv3)
52
53//___________________________________________
54AliMUONv3::AliMUONv3() : AliMUONv1()
55{
56// Constructor
57 fChambers = 0;
58 fStations = 0;
59}
60
61//___________________________________________
62AliMUONv3::AliMUONv3(const char *name, const char *title)
63 : AliMUONv1(name,title)
64{
65// Constructor
66 // By default include all stations
67 fStations = new Int_t[5];
68 for (Int_t i=0; i<5; i++) fStations[i] = 1;
69
70 AliMUONFactory factory;
71 factory.Build(this, title);
72}
73//___________________________________________
74void AliMUONv3::StepManager()
75{
76
77 // Volume id
78 Int_t copy, id;
79 Int_t idvol;
80 Int_t iChamber=0;
81 // Particule id, pos and mom vectors,
82 // theta, phi angles with respect the normal of the chamber,
83 // spatial step, delta_energy and time of flight
84 Int_t ipart;
85 TLorentzVector pos, mom;
86 Float_t theta, phi, tof;
87 Float_t destep, step;
88
89 TClonesArray &lhits = *fHits;
90
91 // Only charged tracks
92 if( !(gMC->TrackCharge()) ) return;
93
94 // Only gas gap inside chamber
95 // Tag chambers and record hits when track enters
96 idvol=-1;
97 id=gMC->CurrentVolID(copy);
98 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
99 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
100 iChamber = i;
101 idvol = i-1;
102 }
103 }
104 if (idvol == -1) return;
105
106 // Get current particle id (ipart), track position (pos) and momentum (mom)
107 gMC->TrackPosition(pos);
108 gMC->TrackMomentum(mom);
109 ipart = gMC->TrackPid();
110 theta = mom.Theta()*kRaddeg; // theta of track
111 phi = mom.Phi() *kRaddeg; // phi of the track
112 tof = gMC->TrackTime(); // Time of flight
113 //
114 // momentum loss and steplength in last step
115 destep = gMC->Edep();
116 step = gMC->TrackStep();
2468d1a9 117 //new hit
118 if (destep>0.) new(lhits[fNhits++])
119 AliMUONHit(fIshunt, gAlice->CurrentTrack(), iChamber, ipart,
120 pos.X(), pos.Y(), pos.Z(), tof, mom.P(),
121 theta, phi, step, destep);
8d7b49a7 122}
123
124