/* $Id$ */
+//
+// Realisation of the TVirtualMC interface for the FLUKA code
+// (See official web side http://www.fluka.org/).
+//
+// This implementation makes use of the TGeo geometry modeller.
+// User configuration is via automatic generation of FLUKA input cards.
+//
+// Authors:
+// A. Fasso
+// E. Futo
+// A. Gheata
+// A. Morsch
+//
+
#include <Riostream.h>
//#include "AliModule.h"
TFluka::TFluka()
:TVirtualMC(),
fVerbosityLevel(0),
- sInputFileName("")
+ fInputFileName("")
{
//
// Default constructor
TFluka::TFluka(const char *title, Int_t verbosity, Bool_t isRootGeometrySupported)
:TVirtualMC("TFluka",title, isRootGeometrySupported),
fVerbosityLevel(verbosity),
- sInputFileName(""),
+ fInputFileName(""),
fTrackIsEntering(0),
fTrackIsExiting(0),
fTrackIsNew(0)
// TFluka control methods
//______________________________________________________________________________
void TFluka::Init() {
-
+//
+// Geometry initialisation
+//
if (fVerbosityLevel >=3) cout << "==> TFluka::Init() called." << endl;
if (!gGeoManager) new TGeoManager("geom", "FLUKA geometry");
//______________________________________________________________________________
void TFluka::BuildPhysics() {
+//
+// Prepare FLUKA input files and call FLUKA physics initialisation
+//
+
if (fVerbosityLevel >=3)
cout << "==> TFluka::BuildPhysics() called." << endl;
- InitPhysics(); // prepare input file with the current physics settings
+// Prepare input file with the current physics settings
+ InitPhysics();
cout << "\t* InitPhysics() - Prepare input file was called" << endl;
if (fVerbosityLevel >=2)
GLOBAL.lfdrtr = true;
if (fVerbosityLevel >=2)
- cout << "\t* Opening file " << sInputFileName << endl;
- const char* fname = sInputFileName;
+ cout << "\t* Opening file " << fInputFileName << endl;
+ const char* fname = fInputFileName;
fluka_openinp(lunin, PASSCHARA(fname));
if (fVerbosityLevel >=2)
flukam(1);
if (fVerbosityLevel >=2)
- cout << "\t* Closing file " << sInputFileName << endl;
+ cout << "\t* Closing file " << fInputFileName << endl;
fluka_closeinp(lunin);
FinishGeometry();
//______________________________________________________________________________
void TFluka::ProcessEvent() {
+//
+// Process one event
+//
if (fVerbosityLevel >=3)
cout << "==> TFluka::ProcessEvent() called." << endl;
fApplication->GeneratePrimaries();
#else
void TFluka::ProcessRun(Int_t nevent) {
#endif
+//
+// Run steering
+//
+
if (fVerbosityLevel >=3)
cout << "==> TFluka::ProcessRun(" << nevent << ") called."
<< endl;
if (fVerbosityLevel >=3)
cout << "<== TFluka::ProcessRun(" << nevent << ") called."
<< endl;
+
+ #if ROOT_VERSION_CODE >= 262150
return kTRUE;
+ #endif
}
//_____________________________________________________________________________
void TFluka::SetProcess(const char* flagName, Int_t flagValue, Int_t imat)
{
+// Set process user flag for material imat
+//
strcpy(&fProcessFlag[fNbOfProc][0],flagName);
fProcessValue[fNbOfProc] = flagValue;
fProcessMaterial[fNbOfProc] = imat;
//______________________________________________________________________________
void TFluka::SetProcess(const char* flagName, Int_t flagValue)
{
+// Set process user flag
+//
+
Int_t i;
if (fNbOfProc < 100) {
for (i=0; i<fNbOfProc; i++) {
//______________________________________________________________________________
void TFluka::SetCut(const char* cutName, Double_t cutValue, Int_t imed)
{
+// Set user cut value for material imed
+//
strcpy(&fCutFlag[fNbOfCut][0],cutName);
fCutValue[fNbOfCut] = cutValue;
fCutMaterial[fNbOfCut] = imed;
//______________________________________________________________________________
void TFluka::SetCut(const char* cutName, Double_t cutValue)
{
+// Set user cut value
+//
Int_t i;
if (fNbOfCut < 100) {
for (i=0; i<fNbOfCut; i++) {
//______________________________________________________________________________
void TFluka::InitPhysics()
{
+//
+// Physics initialisation with preparation of FLUKA input cards
+//
printf("=>InitPhysics\n");
Int_t i, j, k;
Double_t fCut;
//______________________________________________________________________________
Bool_t TFluka::IsTrackExiting() const
{
+// True if track is exiting volume
+//
Int_t caller = GetCaller();
if (caller == 12) // bxdraw exiting
return 1;
//______________________________________________________________________________
Int_t TFluka::NSecondaries() const
+
+{
// Number of secondary particles generated in the current step
// FINUC.np = number of secondaries except light and heavy ions
// FHEAVY.npheav = number of secondaries for light and heavy secondary ions
-{
Int_t caller = GetCaller();
if (caller == 6) // valid only after usdraw
return FINUC.np + FHEAVY.npheav;
void TFluka::GetSecondary(Int_t isec, Int_t& particleId,
TLorentzVector& position, TLorentzVector& momentum)
{
+// Copy particles from secondary stack to vmc stack
+//
+
Int_t caller = GetCaller();
if (caller == 6) { // valid only after usdraw
if (isec >= 0 && isec < FINUC.np) {
//______________________________________________________________________________
TMCProcess TFluka::ProdProcess(Int_t) const
+
+{
// Name of the process that has produced the secondary particles
// in the current step
-{
const TMCProcess kIpNoProc = kPNoProcess;
const TMCProcess kIpPDecay = kPDecay;
const TMCProcess kIpPPair = kPPair;
-#ifndef TFLUKA
-#define TFLUKA
+#ifndef TFLUKA_H
+#define TFLUKA_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
// ------------------------------------------------
//
// - Core input file name
- TString GetCoreInputFileName() const {return sCoreInputFileName;}
- void SetCoreInputFileName(const char* n) {sCoreInputFileName = n;}
+ TString GetCoreInputFileName() const {return fCoreInputFileName;}
+ void SetCoreInputFileName(const char* n) {fCoreInputFileName = n;}
// - Input file name
- TString GetInputFileName() const {return sInputFileName;}
- void SetInputFileName(const char* n) {sInputFileName = n;}
+ TString GetInputFileName() const {return fInputFileName;}
+ void SetInputFileName(const char* n) {fInputFileName = n;}
// - SetProcess and SetCut
Int_t GetProcessNb() const {return fNbOfProc;}
Int_t GetMreg() const {return fCurrentFlukaRegion;}
void SetMreg(Int_t l);
- Int_t GetNewreg() const {return iNewreg;}
- void SetNewreg(Int_t l) {iNewreg = l;}
+ Int_t GetNewreg() const {return fNewReg;}
+ void SetNewreg(Int_t l) {fNewReg = l;}
Double_t GetRull() const {return fRull;}
void SetRull(Double_t r) {fRull = r;}
void SetTrackIsInside() {fTrackIsExiting = kFALSE; fTrackIsEntering = kFALSE;}
void SetTrackIsNew(Bool_t flag=kTRUE) {fTrackIsNew = flag;}
Int_t GetMaterialIndex(Int_t idmat) {return fMaterials[idmat];}
-
+
+
private:
TFluka(const TFluka &mc): TVirtualMC(mc) {;}
TFluka & operator=(const TFluka &) {return (*this);}
- protected:
Int_t fVerbosityLevel; //Verbosity level (0 lowest - 3 highest)
- TString sInputFileName; //Name of the real input file (e.g. alice.inp)
- TString sCoreInputFileName; //Name of the input file (e.g. corealice.inp)
+ TString fInputFileName; //Name of the real input file (e.g. alice.inp)
+ TString fCoreInputFileName; //Name of the input file (e.g. corealice.inp)
Int_t fCaller; //Parameter to indicate who is the caller of the Fluka Draw
Int_t fIcode; //Fluka Draw procedures formal parameter
- Int_t iNewreg; //Fluka Draw procedures formal parameter
+ Int_t fNewReg; //Fluka Draw procedures formal parameter
Double_t fRull; //Fluka Draw procedures formal parameter
Double_t fXsco; //Fluka Draw procedures formal parameter
Double_t fYsco; //Fluka Draw procedures formal parameter
Bool_t fFieldFlag; // Flag for magnetic field
Int_t fDummyBoundary; // Flag for crossing dummy boundaries
//variables for SetProcess and SetCut
- Int_t fNbOfProc;
- Int_t fProcessValue[10000];
- Int_t fProcessMaterial[10000];
- Char_t fProcessFlag[10000][5];
- Int_t fNbOfCut;
- Double_t fCutValue[10000];
- Char_t fCutFlag[10000][7];
- Int_t fCutMaterial[10000];
+ Int_t fNbOfProc; // Current number of processes
+ Int_t fProcessValue[10000]; // User values assigned to processes
+ Int_t fProcessMaterial[10000]; // Materials assigned to user settings
+ Char_t fProcessFlag[10000][5]; // User flags assigned to processes
+ Int_t fNbOfCut; // Current number of cuts
+ Double_t fCutValue[10000]; // User values assigned to cuts
+ Char_t fCutFlag[10000][7]; // User flags assigned to cuts
+ Int_t fCutMaterial[10000]; // Materials assigned to cuts
//Geometry through TGeo
Int_t* fMaterials; //!Array of indices
Int_t fCurrentFlukaRegion; //Index of fluka region at each step
TFlukaMCGeometry *fGeom; // TGeo-FLUKA interface
+
ClassDef(TFluka,1) //C++ interface to Fluka montecarlo
};