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