Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starsim bfc tests #570

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test_id: [10, 11, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 76, 77, 78, 90, 91, 92, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125]
test_id: [10, 11, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 76, 77, 78, 90, 91, 92, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128]
compiler: [gcc485, gcc11]
env:
STARENV: root5-${{ matrix.compiler }}
Expand Down
5 changes: 4 additions & 1 deletion StRoot/StBFChain/BigFullChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -1395,12 +1395,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,libStarGeneratorUtil.so,libStarGeneratorEvent.so,libStarGeneratorBase.so,libMathMore.so","STAR Generator BASE",false},
{"stargen.filt", "","", "stargen,fastjet" /*+++*/, "", "libStarGeneratorFilt.so","STAR Generator FILT (requires fastjet-3.3.4)",false},
{"fastjet", "","", "" /*+++*/, "", "libfastjet.so","Fastjet",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 },
{"genmuons" ,"","","", "StarPrimaryMaker", "", "Setup test for StarGenerator ala gstar", false },
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
{"I/O Makers ","-----------","-----------","------------------------------------------","","","",kFALSE},
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
Expand Down
21 changes: 20 additions & 1 deletion StRoot/StBFChain/StBFChain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Int_t StBFChain::Instantiate()
maker == "StMagFMaker" ||
maker == "StEEmcDbMaker" ||
maker == "St_geant_Maker" ||
maker == "StarPrimaryMaker" ||
maker == "StVMCMaker") {
mk = GetTopChain()->GetMakerInheritsFrom(maker);
if (mk) {
Expand Down Expand Up @@ -409,7 +410,7 @@ Int_t StBFChain::Instantiate()
Int_t NwGeant = 10; // default geant parameters
if (!GetOption("fzin") &&
!GetOption("ntin") &&
!GetOption("gstar") &&
!GetOption("gstar") && !GetOption("genmuons") &&
!GetOption("pythia")) NwGeant = 5;
if (GetOption("big")) NwGeant = 20;
if (GetOption("bigbig")) NwGeant = 40;
Expand All @@ -420,6 +421,7 @@ Int_t StBFChain::Instantiate()
if (GetOption("fzin") ||
GetOption("ntin") ||
GetOption("gstar") ||
GetOption("genmuons") ||
GetOption("pythia") ||
GetOption("hijing") ||
GetOption("PrepEmbed") ||
Expand All @@ -442,6 +444,21 @@ Int_t StBFChain::Instantiate()
SetGeantOptions(mk);
}

if (maker == "StarPrimaryMaker") {
if ( GetOption("genmuons") ) {
LOG_INFO << "Setup StarKinematics for 80 muons per event" << endm;
TString cmd = Form( "((StarPrimaryMaker*)%p)->AddGenerator( new StarKinematics );", mk );
ProcessLine( cmd );
auto* kine=GetMaker("StarKine"); assert(kine);
kine->SetAttr("kine:ntrack",80);
kine->SetAttr("kine:type","mu+,mu-");
kine->SetAttr("kine:ptmin",0.1);
kine->SetAttr("kine:ptmax",10.0);
kine->SetAttr("kine:etamin",-4.0);
kine->SetAttr("kine:etamax",+4.0);
}
}

// special maker options
// m_Mode xyz
// x = 1 phys_off
Expand Down Expand Up @@ -1707,6 +1724,7 @@ void StBFChain::SetOutputFile (const Char_t *outfile){
else if (GetOption("hijing")) fFileOut = "hijing.root";
else if (GetOption("VMC")) fFileOut = "VMC.root";
else if (GetOption("gstar")) fFileOut = "gtrack.root";
else if (GetOption("genmuons")) fFileOut = "stargen.root";
}
if ( fFileOut != "") {
fFileOut.ReplaceAll("*","");
Expand Down Expand Up @@ -1961,6 +1979,7 @@ void StBFChain::SetTreeOptions()
if (GetOption("fzin") ||
GetOption("ntin") ||
GetOption("gstar") ||
GetOption("genmuons") ||
GetOption("pythia") ||
GetOption("VMC") ||
GetOption("PrepEmbed")) {
Expand Down
14 changes: 14 additions & 0 deletions StRoot/StarGenerator/Kinematics/StarKinematics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ StarKinematics::StarKinematics( const Char_t *name ) : StarGenerator(name)
{
mEvent = new StarGenEvent("kine"); gEvent = mEvent;
mUser = new StarGenEvent("user"); gUser = mUser;
SetAttr( "kine:ntrack", int(0) );
}
// ----------------------------------------------------------------------------
Int_t StarKinematics::PreGenerate()
Expand All @@ -55,6 +56,19 @@ Int_t StarKinematics::PreGenerate()
// ----------------------------------------------------------------------------
Int_t StarKinematics::Generate()
{

int ntrack=IAttr("kine:ntrack");
if ( ntrack>0 )
{
TString type=SAttr("kine:type");
double ptmin=DAttr("kine:ptmin");
double ptmax=DAttr("kine:ptmax");
double etamin=DAttr("kine:etamin");
double etamax=DAttr("line:etamax");
Kine( ntrack, type, ptmin, ptmax, etamin, etamax );
LOG_INFO << "Adding ntrack=" << ntrack << " type="<< type.Data() << endm;
mUser->Print();
}

// Copy user event into mEvent
for ( Int_t i=0;i<mUser->GetNumberOfParticles(); i++ )
Expand Down
6 changes: 5 additions & 1 deletion tests/executest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def _json_object_hook(d):
for job in joblist:
if job.jobid != args.jobid: continue
if args.description: print("{descr}".format(**job._asdict()))
if args.command: print("root4star -b -q -l \'bfc.C({nevents}, \"{chopts}\", \"{inppath}/{inpfile}\")\'".format(**job._asdict()))
if args.command:
if job.inpfile:
print("root4star -b -q -l \'bfc.C({nevents}, \"{chopts}\", \"{inppath}/{inpfile}\")\'".format(**job._asdict()))
else:
print("root4star -b -q -l \'bfc.C({nevents}, \"{chopts}\")\'".format(**job._asdict()))
if args.attribute:
if args.attribute == 'fullpath':
print("{}/{}".format(job.inppath, job.inpfile))
Expand Down
18 changes: 18 additions & 0 deletions tests/joblist.json
Original file line number Diff line number Diff line change
Expand Up @@ -1123,5 +1123,23 @@
"inppath": "/star/rcf/test/daq/2023/072/23072022/",
"outpath": "",
"nevents": "200"
},
{
"jobid": "126",
"descr": "2023 simple simulation 80 muons",
"chopts": "sdt20230214 gstar",
"inpfile": "",
"inppath": "",
"outpath": "",
"nevents": "50"
},
{
"jobid": "127",
"descr": "2023 simple simulation 80 muons using StarGenerator",
"chopts": "sdt20230202 stargen kinematics genmuons geant",
"inpfile": "",
"inppath": "",
"outpath": "",
"nevents": "50"
}
]