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