Skip to content

Commit

Permalink
[g4star] Expose partcile stack for the geant4 application.
Browse files Browse the repository at this point in the history
[g4star] Update stacker and agml extension classes to enable multi engine tracking and user defined hits in the geant4 application.  Few additional fixes and cleanups in the code.

[g4star] Import the StGeant4Maker into the repository.  Builds under root 6.24 (with some additional compilation flags).

[g4star] Defer mysql load until StBFChain can do it.

[g4star] Add geant4vmc, geant4mk and fastjet chain options.  Load libfastjet with stargen package b/c one or more filters depends on it.  (Should consider splitting filters into sep chain opt).

[g4star] Cleanup commented out includes.

[g4star] Reduce compile time warnings...

[g4star] ... more reduction of compiler warnings

... and even more reduction of compiler warnings...

[g4star] And modify cons to pickup the include paths to geant4 and geant4 vmc libraries
  • Loading branch information
klendathu2k committed Nov 1, 2023
1 parent 6638b49 commit 36978ba
Show file tree
Hide file tree
Showing 79 changed files with 25,523 additions and 26 deletions.
7 changes: 6 additions & 1 deletion StRoot/StBFChain/BigFullChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -1275,13 +1275,15 @@ Bfc_st BFC[] = { // standard chains
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
{"Generators ","-----------","-----------","------------------------------------------","","","",kFALSE},
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
{"stargen", "","", "gen_T,sim_T"/*+++*/, "", "libVMC.so,libStarGeneratorUtil.so,libStarGeneratorEvent.so,libStarGeneratorBase.so,libStarGeneratorFilt.so,libMathMore.so","STAR Generator BASE",false},
{"stargen", "","", "gen_T,sim_T"/*+++*/, "", "libVMC.so,libfastjet.so,libStarGeneratorUtil.so,libStarGeneratorEvent.so,libStarGeneratorBase.so,libStarGeneratorFilt.so,libMathMore.so","STAR Generator BASE",false},
{"pythia8.1.86","","","stargen", "", "Pythia8_1_86.so", "Load Pythia 8.1.86 generator", false },
{"pythia8.2.35","","","stargen", "", "Pythia8_2_35.so", "Load Pythia 8.1.86 generator", false },
{"hijing1.383" ,"","","stargen", "", "Hijing1_383.so", "Load Hijing 1.383 generator", false },
{"kinematics" ,"","","stargen", "", "Kinematics.so", "Load STAR Particle Gun", false },
{"genreader" ,"","","stargen", "", "StarGenEventReader.so", "Load STAR Gen Event Reader", false },

{"fastjet" ,"","","" , "", "libfastjet.so", "Load fast jet reconstruction algo", false},


{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
{"GEANT4 Libs ","-----------","-----------","------------------------------------------","","","",kFALSE},
Expand All @@ -1292,6 +1294,9 @@ Bfc_st BFC[] = { // standard chains
{"g4geant3", "", "", "", "", "libG3toG4.so", "Load g3 to g4 support", false },
{"geant4", "", "", "g4physics,g4interfaces","","","Load G4 libs", false},

{"geant4vmc", "","", "geant4", "", "libVMC.so,libgeant4vmc.so", "Load G4 VMC libs", false},
{"geant4mk", "","", "stargen,geant4vmc", "", "StGeant4Maker.so,StarMagField.so", "Load G4 VMC libs", false},


{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
{"I/O Makers ","-----------","-----------","------------------------------------------","","","",kFALSE},
Expand Down
Empty file.
38 changes: 38 additions & 0 deletions StRoot/StGeant4Maker/AgMLBTofVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef __AgMLBtofVolumeId_h__
#define __AgMLBtofVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLBtofVolumeId : public AgMLVolumeId {
public:

AgMLBtofVolumeId(){}
// Applies to btog.version = 8 with btog.choice =13 (run 13 onwards)

virtual int id( int* numbv ) const {

int rileft = numbv[0];
int sector = numbv[1];
int module = numbv[2];
int layer = numbv[3];

// Adjust for GMT modules
if ( rileft==1 ) {
if ( sector== 8 ) module += 4;
if ( sector==23 ) module += 4;
}
else if ( rileft==2 ) {
if ( sector == 33 ) module += 4;
if ( sector == 48 ) module += 4;
}

int _id = layer + 10 * (module + 100 * (sector+100*rileft) );

return _id;

};
};


#endif
70 changes: 70 additions & 0 deletions StRoot/StGeant4Maker/AgMLEEmcVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef __AgMLEEmcVolumeId_h__
#define __AgMLEEmcVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <TGeoNavigator.h>
#include <StMessMgr.h>
#include <TLorentzVector.h>
#include <TVirtualMC.h>
#include <TMath.h>

#include <TString.h>
#include <StMessMgr.h>

class AgMLEEmcVolumeId : public AgMLVolumeId {

const int onoff = 1;
const int fillmode = 3;
const int sectormap[2][6] = {
{ 4, 5, 6, 7, 8, 9},
{10,11,12, 1, 2, 3}
};


public:

AgMLEEmcVolumeId() : AgMLVolumeId() { /* nada */ };

virtual int id( int* numbv ) const {

// cd == ESCI
int rileft = onoff;
int shift = 0;

int wheel = numbv[0];
int section = numbv[1];
int idx = numbv[2];
int phi30d = sectormap[wheel-1][idx-1]; // sector number
int subsec = numbv[3]; // subsection (i.e. layer) within each section
int sublay = numbv[4]; // ???
int phi = numbv[5]; // phibin in sector
int eta = numbv[6];

int depth = subsec + 3 * ( section - 1 );

// int volumeid = 100000*rileft + 1000*(5*(phi30d-1)+phi) + 10*eta + depth;

int volumeid = 100000 * rileft
+ 1000 * ( 5 * ( phi30d-1 ) + phi )
+ 10 * eta
+ depth;

// LOG_INFO << Form("AgML EEmc VolumdId = wheel=%i section=%i idx=%i phi30d=%i subsection=%i %i %i %i %i",
// numbv[0],
// numbv[1],
// numbv[2],
// phi30d,
// numbv[3],
// numbv[4],
// numbv[5],
// numbv[6],
// volumeid ) << endm;


return volumeid;

};
};


#endif
66 changes: 66 additions & 0 deletions StRoot/StGeant4Maker/AgMLEmcVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#ifndef __AgMLEmcVolumeId_h__
#define __AgMLEmcVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <TGeoNavigator.h>
#include <StMessMgr.h>
#include <TLorentzVector.h>
#include <TVirtualMC.h>
#include <TMath.h>

#include <TString.h>
#include <StMessMgr.h>

class AgMLEmcVolumeId : public AgMLVolumeId {

const int numberOfEtaRings = 20;

public:

AgMLEmcVolumeId() : AgMLVolumeId() { /* nada */ };

virtual int id( int* numbv ) const {


int rileft = numbv[0]; // east barrel vs west barrel
int phi = numbv[1]; // module
int superl = numbv[2]; // before / after SMD layer

TLorentzVector _direction(0,0,0,0);
TVirtualMC::GetMC()->TrackPosition( _direction );

double xg[4], xl[4];
_direction.GetXYZT( xg );
double pseudoRapidity = TMath::Abs(_direction.Eta());

// Obtain local coordinates from global coordinates
TVirtualMC::GetMC()->Gmtod( xg, xl, 1 );

// Calculate the eta ring and submodule
int eta_tow = ( pseudoRapidity * double(numberOfEtaRings) ) + 1.0;
int phi_sub = ( xl[1]>= 0 )? 1 : 0; // (-13,0)=0, (0,13)=1

// LOG_INFO << Form("eta=%f xlocal=%f %f %f | phi_sub=%i eta_tow=%i", pseudoRapidity, xl[0], xl[1], xl[2],phi_sub,eta_tow) << endm;

int volumeid = -999;

if ( rileft==1 ) {
phi = 60 - phi + 1;
if ( phi_sub==0 ) {
phi_sub=2;
}
}
else {
phi = 60+phi;
phi_sub = phi_sub + 1;
}

volumeid=10000000*rileft+100000*eta_tow+100*phi+10*phi_sub+superl;

return volumeid;

};
};


#endif
40 changes: 40 additions & 0 deletions StRoot/StGeant4Maker/AgMLEpdVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef __AgMLEpdVolumeId_h__
#define __AgMLEpdVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLEpdVolumeId : public AgMLVolumeId {
public:

AgMLEpdVolumeId(){}

virtual int id( int* numbv ) const {

int epdm = numbv[0]; // 1=east, 2=west
int epss = numbv[1]; // 1 for PP1, 2 for PP2, PP-postion 1'o,2'o clock etc
int epdt = numbv[2]; // 1:T1 trap, 2:T1 Triangular, 3:T2 Thin, 4:T3 Thick

/*
" EPD volume_id "
" 100,000 : east or west "
" 1,000 : Position clock wise, 1 to 12 "
" 10 : Tile number 1 to 31, refer EPD Drupal page"
" 1 : 1 T1 trap or T2 thin; 0 T1 triangular or T2 thick
*/

int _id = 0;
_id += 100000 * epdm;
_id += 1000 * epss;
_id += 10 * ( epdt%2 + epdt/2 );
_id += 1 * ( epdt%2 );

return _id;

};
};


#endif
28 changes: 28 additions & 0 deletions StRoot/StGeant4Maker/AgMLFstVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef __AgMLFstVolumeId_h__
#define __AgMLFstVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLFstVolumeId : public AgMLVolumeId {
public:

AgMLFstVolumeId(){}

virtual int id( int* numbv ) const {

static const int mapping[] = { 2, 3, 1 };

int disk = numbv[0];
int wedge = numbv[1];
assert( numbv[2]>0 && numbv[2]<=3 );
int sensor = mapping[ numbv[2]-1 ];


return 1000*disk + 10*wedge + sensor;

};
};


#endif
23 changes: 23 additions & 0 deletions StRoot/StGeant4Maker/AgMLHcaVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef __AgMLHcaVolumeId_h__
#define __AgMLHcaVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLHcaVolumeId : public AgMLVolumeId {
public:

AgMLHcaVolumeId(){}

virtual int id( int* numbv ) const {

int mod = numbv[0]; // module
int tow = numbv[1]; // tower

return 1000*mod + tow;

};
};


#endif
25 changes: 25 additions & 0 deletions StRoot/StGeant4Maker/AgMLMtdVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef __AgMLMtdVolumeId_h__
#define __AgMLMtdVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLMtdVolumeId : public AgMLVolumeId {
public:

AgMLMtdVolumeId(){}
// Applies to btog.version = 8 with btog.choice =13 (run 13 onwards)

virtual int id( int* numbv ) const {

int sector = numbv[0];
int module = numbv[1];
int layer = numbv[2];

return 1000 * sector + 100 * module + layer;

};
};


#endif
23 changes: 23 additions & 0 deletions StRoot/StGeant4Maker/AgMLPreVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef __AgMLPreVolumeId_h__
#define __AgMLPreVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLPreVolumeId : public AgMLVolumeId {
public:

AgMLPreVolumeId(){}

virtual int id( int* numbv ) const {

int layer = numbv[0]; // layer
int slat = numbv[1]; // slat

return 1000*layer + slat;

};
};


#endif
29 changes: 29 additions & 0 deletions StRoot/StGeant4Maker/AgMLStgVolumeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef __AgMLStgVolumeId_h__
#define __AgMLStgVolumeId_h__

#include <StarVMC/StarAgmlLib/AgMLExtension.h>
#include <StMessMgr.h>

class AgMLStgVolumeId : public AgMLVolumeId {

static const int version = 2;

public:

AgMLStgVolumeId(){}

virtual int id( int* numbv ) const {

int station = (numbv[0]-1) / 4 + 1;
int chamber = (numbv[0]-1) % 4 + 1;

if ( version == 2 )
return 10*station + chamber;
else
return numbv[0];

};
};


#endif
Loading

0 comments on commit 36978ba

Please sign in to comment.