beam replaced by beamcm
[u/mrichter/AliRoot.git] / TFluka / usdraw.cxx
CommitLineData
fa3d1cc7 1#include <Riostream.h>
7dac99f1 2#include "TVirtualMCApplication.h"
a7bb59a2 3#include "TFluka.h"
5d80a015 4#include <TLorentzVector.h>
a1f42b9c 5#include "Fdimpar.h" //(DIMPAR) fluka include
6#include "Ftrackr.h" //(TRACKR) fluka common
fa3d1cc7 7#ifndef WIN32
8# define usdraw usdraw_
9#else
10# define usdraw USDRAW
11#endif
12extern "C" {
13void usdraw(Int_t& icode, Int_t& mreg,
14 Double_t& xsco, Double_t& ysco, Double_t& zsco)
15{
fbf08100 16 TFluka *fluka = (TFluka*)gMC;
bcf1cd9c 17 Int_t verbosityLevel = fluka->GetVerbosityLevel();
57dc5a4a 18 Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
fbf08100 19 fluka->SetCaller(6);
20 fluka->SetIcode(icode);
57dc5a4a 21
22 if (fluka->IsTrackDisappeared()) {
23 TRACKR.ispusr[mkbmx2 - 2] = 1;
5d80a015 24// Save properties at point where particle disappears in case this is only an interruption
25 TLorentzVector p;
26 gMC->TrackMomentum(p);
27
28 TRACKR.spausr[0] = xsco; // x
29 TRACKR.spausr[1] = ysco; // y
30 TRACKR.spausr[2] = zsco; // z
31 TRACKR.spausr[3] = gMC->TrackTime(); // t
32 TRACKR.spausr[4] = p[0]; // px
33 TRACKR.spausr[5] = p[1]; // py
34 TRACKR.spausr[6] = p[2]; // pz
35 TRACKR.spausr[7] = p[3]; // e
36 TRACKR.spausr[8] = gMC->TrackLength(); // Length
57dc5a4a 37 }
38
fbf08100 39 fluka->SetMreg(mreg);
40 fluka->SetXsco(xsco);
41 fluka->SetYsco(ysco);
42 fluka->SetZsco(zsco);
57dc5a4a 43
5d80a015 44 if (debug) printf("USDRAW: Number of track segments:%6d %6d %6d %10.3e\n", TRACKR.ntrack, TRACKR.mtrack, icode, TRACKR.atrack);
cad96957 45
a1f42b9c 46 (TVirtualMCApplication::Instance())->Stepping();
fbf08100 47 fluka->SetTrackIsNew(kFALSE);
48
fa3d1cc7 49} // end of usdraw
50} // end of extern "C"
51