#include <GeoSwimApplication.h>
Inheritance diagram for GeoSwimApplication:

Public Member Functions | |
| virtual Gctrak_t * | Gctrak () const |
| GeoSwimApplication (const char *name, const char *title) | |
| virtual | ~GeoSwimApplication () |
| virtual void | GeneratePrimaries () |
| virtual void | BeginEvent () |
| virtual void | BeginPrimary () |
| virtual void | PreTrack () |
| virtual void | Stepping () |
| virtual void | PostTrack () |
| virtual void | FinishPrimary () |
| virtual void | FinishEvent () |
| GeoSwimStack * | GetStack () const |
| void | SetZCondition (GeoSwimZCondition &c) |
| void | SetDirection (Int_t idir) |
| void | SetHallSize (TVector3 min, TVector3 max) |
| bool | GetSatisfied () |
| Double_t | GetS () |
| Double_t | GetRange () |
Private Member Functions | |
| bool | IsExiting () |
Private Attributes | |
| GeoSwimStack * | fGeoSwimStack |
| VldRange | fVldRange |
| Double_t | fZCondition |
| TLorentzVector | fInitMomentum |
| TLorentzVector | fInitPosition |
| Int_t | fDir |
| bool | fSatisfied |
| Bool_t | fExitLiner |
| Int_t | fStep |
| Double_t | fS |
| Double_t | fRange |
| Float_t | fPreVect [7] |
| TVector3 | fHallMin |
| TVector3 | fHallMax |
| Gctrak_t * | fGctrak |
| Gcflag_t * | fGcflag |
| GCTRAK common structure. | |
|
||||||||||||
|
Definition at line 55 of file GeoSwimApplication.cxx. References gcomad, MSG, PASSCHARD, and PASSCHARL. 00056 : MCAppUser(name,title),fGeoSwimStack(0), 00057 fExitLiner(false) 00058 { 00059 // Normal constructor 00060 00061 MSG("GeoSwim",Msg::kDebug) << "GeoSwimApplication normal ctor @ " 00062 << this << endl; 00063 fGeoSwimStack = new GeoSwimStack(); 00064 00065 MSG("GeoSwim",Msg::kDebug) << "Get address of common GCTRAK" << endl; 00066 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK")); 00067 MSG("GeoSwim",Msg::kDebug) << "Get address of common GCFLAG" << endl; 00068 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG")); 00069 00070 }
|
|
|
Definition at line 73 of file GeoSwimApplication.cxx. References fGeoSwimStack, and MSG. 00073 {
00074 // delete all the owned sub-objects
00075
00076 MSG("GeoSwim",Msg::kDebug) << "GeoSwimApplication dtor @ "
00077 << this << endl;
00078
00079 if ( fGeoSwimStack ) delete fGeoSwimStack; fGeoSwimStack = 0;
00080
00081 }
|
|
|
Implements MCAppUser. Definition at line 84 of file GeoSwimApplication.cxx. References MCApplication::Instance(), and MSG. 00084 {
00085
00086
00087 bool toswim = true;
00088 const_cast<MCApplication&>(MCApplication::Instance()).SwitchMedia(toswim);
00089
00090 MSG("GeoSwim",Msg::kDebug) << "GeoSwimApplication::BeginEvent "
00091 << endl;
00092
00093 }
|
|
|
Implements MCAppUser. Definition at line 96 of file GeoSwimApplication.cxx. 00096 {
00097 gGeoManager->SetTminTmax(999999,-999999); // sec
00098
00099 }
|
|
|
Implements MCAppUser. Definition at line 255 of file GeoSwimApplication.cxx. References fGeoSwimStack, and MSG. 00255 {
00256
00257 MSG("GeoSim",Msg::kDebug) << "GeoSwimApplication::FinishEvent " << endl;
00258
00259 fGeoSwimStack -> Reset();
00260
00261 }
|
|
|
Implements MCAppUser. Definition at line 248 of file GeoSwimApplication.cxx. References MSG. 00248 {
00249
00250 MSG("GeoSim",Msg::kDebug) << "GeoSwimApplication::FinishPrimary " << endl;
00251
00252 }
|
|
|
Definition at line 87 of file GeoSwimApplication.h. 00087 {return fGctrak;}
|
|
|
Implements MCAppUser. Definition at line 93 of file GeoSwimApplication.h. 00093 {}
|
|
|
Definition at line 302 of file GeoSwimApplication.cxx. Referenced by GeoSwimmer::Swim(). 00303 {
00304 return fRange;
00305 }
|
|
|
Definition at line 295 of file GeoSwimApplication.cxx. Referenced by GeoSwimmer::Swim(). 00296 {
00297 return fS;
00298 }
|
|
|
Definition at line 288 of file GeoSwimApplication.cxx. Referenced by GeoSwimmer::Swim(). 00289 {
00290 return fSatisfied;
00291 }
|
|
|
Implements MCAppUser. Definition at line 102 of file GeoSwimApplication.h. 00102 { return fGeoSwimStack; }
|
|
|
Definition at line 223 of file GeoSwimApplication.cxx. References fExitLiner. Referenced by Stepping(). 00223 {
00224 if ( gMC -> IsTrackExiting() ) {
00225 if ( std::string(gMC -> CurrentVolName() ) == "LINR" ) {
00226 fExitLiner = true;
00227 }
00228 }
00229 else if ( gMC -> IsTrackEntering() && fExitLiner ) {
00230 if ( std::string(gMC -> CurrentVolName() ) == "MARS" ) {
00231 return true;
00232 }
00233 }
00234
00235 return false;
00236
00237 }
|
|
|
Implements MCAppUser. Definition at line 240 of file GeoSwimApplication.cxx. References fExitLiner, and MSG. 00240 {
00241 fExitLiner = false; // reset exit flag
00242
00243 MSG("GeoSwim",Msg::kDebug) << "GeoSwimApplication::PostTrack" << endl;
00244
00245 }
|
|
|
Implements MCAppUser. Definition at line 102 of file GeoSwimApplication.cxx. References fGcflag, fInitMomentum, fInitPosition, fRange, fS, fStep, and Gcflag_t::nrndm. 00102 {
00103 //
00104 // User actions at beginning of each track
00105 // Called by TGeant3gu::gutrak() before calling g3track.
00106 gMC->TrackPosition(fInitPosition);
00107 gMC->TrackMomentum(fInitMomentum);
00108 fGcflag->nrndm[0] = 0;
00109 fGcflag->nrndm[1] = 0;
00110 fStep = 0;
00111 fS = 0.;
00112 fRange = 0.;
00113 }
|
|
|
Definition at line 273 of file GeoSwimApplication.cxx. References fDir. Referenced by GeoSwimmer::Swim(). 00274 {
00275 fDir = idir;
00276 }
|
|
||||||||||||
|
Definition at line 280 of file GeoSwimApplication.cxx. References fHallMax, and fHallMin. Referenced by GeoSwimmer::Initialize().
|
|
|
Definition at line 265 of file GeoSwimApplication.cxx. References fSatisfied, fZCondition, and GeoSwimZCondition::GetZFinal(). Referenced by GeoSwimmer::Swim(). 00266 {
00267 fSatisfied = false;
00268 fZCondition = c.GetZFinal()/Munits::cm;
00269 }
|
|
|
Implements MCAppUser. Definition at line 116 of file GeoSwimApplication.cxx. References Gctrak_t::destep, fDir, fGctrak, fHallMax, fHallMin, fInitMomentum, fInitPosition, fPreVect, fRange, fS, fSatisfied, fStep, fZCondition, g3ekbin, Gctrak_t::gekin, Gctrak_t::getot, IsExiting(), MSG, and Gctrak_t::vect. 00116 {
00117 //
00118 // User actions at each step
00119 // Called by TGeant3gu::gustep
00120
00121 TLorentzVector pos;
00122 gMC->TrackPosition(pos);
00123 TLorentzVector mom;
00124 gMC->TrackMomentum(mom);
00125 Float_t a=0.,z=0.,dens=0.,radl=0.,absl=0.;
00126 Float_t small = 1e-04;
00127 Int_t curmat;
00128 curmat = gMC->CurrentMaterial(a,z,dens,radl,absl);
00129
00130 // Increasing energy in case of backward swimming: E' = E - dE + 2*dE.
00131 if(fDir==-1){
00132 fGctrak->gekin = fGctrak->gekin + 2.*fGctrak->destep;
00133 fGctrak->getot = fGctrak->gekin + gMC->TrackMass();
00134 fGctrak->vect[6] = sqrt((fGctrak->getot+gMC->TrackMass())*fGctrak->gekin);
00135 g3ekbin();
00136 }
00137
00138 fS += gMC->TrackStep();
00139 fRange += dens*gMC->TrackStep();
00140
00141 if((fInitPosition.Z() < fZCondition && pos.Z() >= fZCondition)
00142 || (fInitPosition.Z() > fZCondition && pos.Z() <= fZCondition)) {
00143
00144 MSG("GeoSwim",Msg::kDebug) << "Condition satisfied" << endl;
00145 fSatisfied = true;
00146
00147 // Correction of position, energy and direction.
00148 float frac = (TMath::Abs(pos.Z()-fPreVect[2]) > small) ?
00149 (fZCondition-fPreVect[2])/(pos.Z()-fPreVect[2]):
00150 0.;
00151 // Position
00152 fGctrak->vect[0] = fPreVect[0]+(fGctrak->vect[0]-fPreVect[0])*frac;
00153 fGctrak->vect[1] = fPreVect[1]+(fGctrak->vect[1]-fPreVect[1])*frac;
00154 fGctrak->vect[2] = fPreVect[2]+(fGctrak->vect[2]-fPreVect[2])*frac;
00155 // Direction
00156 TVector3 direction(fGctrak->vect[3]*frac + fPreVect[3]*(1.-frac),
00157 fGctrak->vect[4]*frac + fPreVect[4]*(1.-frac),
00158 fGctrak->vect[5]*frac + fPreVect[5]*(1.-frac));
00159 direction = direction.Unit();
00160 fGctrak->vect[3] = direction.x();
00161 fGctrak->vect[4] = direction.y();
00162 fGctrak->vect[5] = direction.z();
00163 // Momentum and energy
00164 fGctrak->vect[6] = (fGctrak->vect[6]*frac + fPreVect[6]*(1.-frac));
00165 fGctrak->getot = pow(fGctrak->vect[6],2) + pow(gMC->TrackMass(),2);
00166
00167 // Strop Run and return "satisfied"
00168 gMC->StopTrack();
00169 return;
00170 }
00171
00172 if ( IsExiting() ) {
00173 MSG("GeoSwim",Msg::kDebug)
00174 << "Track is entering MARS from LINR, call StopTrack" << endl;
00175 fSatisfied = false;
00176 gMC -> StopTrack();
00177 return;
00178 }
00179
00180 if(fInitMomentum.Z()*mom.Z()<0.){
00181 MSG("GeoSwim",Msg::kDebug)
00182 << "Negative Momentum\n";
00183 fSatisfied = false;
00184 gMC->StopTrack();
00185 return;
00186 }
00187
00188 fStep++;
00189 if(fStep>10000){
00190 MSG("GeoSwim",Msg::kWarning)
00191 << "GeoSwimApplication::Stepping more than 10000 steps"
00192 << fInitPosition.X() << " " << fInitPosition.Y() << " "
00193 << fInitPosition.Z() << " " << fInitMomentum.X() << " "
00194 << fInitMomentum.Y() << " " << fInitMomentum.Z() << " "
00195 << pos.X() << " " << pos.Y() << " " << pos.Z() << " "
00196 << fZCondition << endl;
00197 fSatisfied = false;
00198 gMC->StopTrack();
00199 return;
00200 }
00201
00202 if (pos.X() > fHallMax.X()/Munits::cm ||
00203 pos.X() < fHallMin.X()/Munits::cm ||
00204 pos.Y() > fHallMax.Y()/Munits::cm ||
00205 pos.Y() < fHallMin.Y()/Munits::cm ||
00206 pos.Z() > fHallMax.Z()/Munits::cm ||
00207 pos.Z() < fHallMin.Z()/Munits::cm) {
00208 MSG("GeoSwim",Msg::kDebug)
00209 << "GeoSwimmer::Swim Out of hall"
00210 << pos.X() << " " << pos.Y() << " " << pos.Z() << "\n";
00211 fSatisfied = false;
00212 gMC -> StopTrack();
00213 return;
00214 }
00215
00216 // Store /GCTRAK/VECT(7) as the status of previous step
00217 for(int i=0;i<7;i++){
00218 fPreVect[i]=fGctrak->vect[i];
00219 }
00220 }
|
|
|
Definition at line 122 of file GeoSwimApplication.h. Referenced by SetDirection(), and Stepping(). |
|
|
Definition at line 124 of file GeoSwimApplication.h. Referenced by IsExiting(), and PostTrack(). |
|
|
GCTRAK common structure.
Definition at line 134 of file GeoSwimApplication.h. Referenced by PreTrack(). |
|
|
Definition at line 133 of file GeoSwimApplication.h. Referenced by Stepping(). |
|
|
Definition at line 117 of file GeoSwimApplication.h. Referenced by FinishEvent(), and ~GeoSwimApplication(). |
|
|
Definition at line 131 of file GeoSwimApplication.h. Referenced by SetHallSize(), and Stepping(). |
|
|
Definition at line 130 of file GeoSwimApplication.h. Referenced by SetHallSize(), and Stepping(). |
|
|
Definition at line 120 of file GeoSwimApplication.h. Referenced by PreTrack(), and Stepping(). |
|
|
Definition at line 121 of file GeoSwimApplication.h. Referenced by PreTrack(), and Stepping(). |
|
|
Definition at line 128 of file GeoSwimApplication.h. Referenced by Stepping(). |
|
|
Definition at line 127 of file GeoSwimApplication.h. Referenced by PreTrack(), and Stepping(). |
|
|
Definition at line 126 of file GeoSwimApplication.h. Referenced by PreTrack(), and Stepping(). |
|
|
Definition at line 123 of file GeoSwimApplication.h. Referenced by SetZCondition(), and Stepping(). |
|
|
Definition at line 125 of file GeoSwimApplication.h. Referenced by PreTrack(), and Stepping(). |
|
|
Definition at line 118 of file GeoSwimApplication.h. |
|
|
Definition at line 119 of file GeoSwimApplication.h. Referenced by SetZCondition(), and Stepping(). |
1.3.9.1