]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDsimple.cxx
Updated SDigitizer; Added AliTOFanalyzeSDigits.C macro
[u/mrichter/AliRoot.git] / TRD / AliTRDsimple.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 purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15  
16 /*
17 $Log$
18 Revision 1.1  2001/11/06 17:19:41  cblume
19 Add detailed geometry and simple simulator
20                                                           
21 */
22  
23 ///////////////////////////////////////////////////////////////////////////////
24 //                                                                           //
25 //  Simplified TRD slow simulator                                            //
26 //                                                                           //
27 ///////////////////////////////////////////////////////////////////////////////
28  
29 #include <stdlib.h>
30  
31 #include "AliTRDsimple.h"
32 #include "AliTRDsimpleGen.h" 
33 #include "AliTRDsimpleMC.h"
34
35 ClassImp(AliTRDsimple)
36  
37 //_____________________________________________________________________________
38 AliTRDsimple::AliTRDsimple():TObject()
39 {                       
40   //
41   // AliTRDsimple default constructor
42   //
43
44   fGenerator = NULL;
45                                                          
46 }                                                                               
47  
48 //_____________________________________________________________________________
49 AliTRDsimple::AliTRDsimple(const AliTRDsimple &s)
50 {
51   //
52   // AliTRDsimple copy constructor
53   //
54  
55   ((AliTRDsimple &) s).Copy(*this);
56  
57 }
58  
59 //_____________________________________________________________________________
60 AliTRDsimple::~AliTRDsimple()
61 {
62   //
63   // AliTRDsimple destructor
64   //
65  
66   if (fGenerator) {
67     delete fGenerator;
68   }
69
70 }                                                                               
71  
72 //_____________________________________________________________________________
73 AliTRDsimple &AliTRDsimple::operator=(const AliTRDsimple &s)
74 {
75   //
76   // Assignment operator
77   //
78  
79   if (this != &s) ((AliTRDsimple &) s).Copy(*this);
80   return *this;
81  
82 }
83  
84 //_____________________________________________________________________________
85 void AliTRDsimple::Init()
86 {
87   //
88   // Initialization
89   //
90
91   fGenerator = new AliTRDsimpleGen();
92
93   // Create the MC object
94   new AliTRDsimpleMC("simple","Simplified Monte Carlo");
95                                                          
96 }
97  
98 //_____________________________________________________________________________
99 void AliTRDsimple::Copy(TObject &s)
100 {
101   //
102   // Copy function
103   //                             
104                   
105   fGenerator->Copy(*((AliTRDsimple &) s).fGenerator);  
106                               
107 }
108                                                                                 
109 //_____________________________________________________________________________
110 void AliTRDsimple::ProcessEvent(Int_t ievent)
111 {
112   //
113   // Runs a single event
114   //
115
116   Int_t copy = 0;
117
118   // Generate a new particle
119   fGenerator->NewParticle(ievent);
120
121   // Track the event
122   do {
123     gMC->ProcessEvent();
124   } 
125   while (gMC->CurrentVolID(copy) != -1);
126
127 }
128