-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathcommonConfig.C
More file actions
53 lines (48 loc) · 1.55 KB
/
commonConfig.C
File metadata and controls
53 lines (48 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
// common piece of code to setup stack and register
// with VMC instances
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "DetectorsBase/Stack.h"
#include "SimulationDataFormat/StackParam.h"
#include "SimConfig/SimParams.h"
#include "TVirtualMC.h"
#include "Generators/DecayerPythia8.h"
#endif
template <typename T, typename R>
void stackSetup(T* vmc, R* run)
{
// create the O2 vmc stack instance
auto st = new o2::data::Stack();
st->setMinHits(1);
auto& stackparam = o2::sim::StackParam::Instance();
st->StoreSecondaries(stackparam.storeSecondaries);
st->pruneKinematics(stackparam.pruneKine);
st->setTrackSeedingMode(o2::conf::SimCutParams::Instance().trackSeed);
vmc->SetStack(st);
/*
// register the stack as an observer on FinishPrimary events (managed by Cave)
bool foundCave = false;
auto modules = run->GetListOfModules();
if( strcmp(vmc->GetName(), "TGeant4")==0 ) {
// there is no way to get the module by name, so we have
// to iterate through the complete list
for (auto m : *modules) {
if(strcmp("CAVE", ((FairModule*)m)->GetName()) == 0) {
// this thing is the cave
if(auto c=dynamic_cast<o2::passive::Cave*>(m)) {
foundCave = true;
c->addFinishPrimaryHook([st](){ st->notifyFinishPrimary();});
}
}
}
if (!foundCave) {
LOG(fatal) << "Cave volume not found; Could not attach observers";
}
}
*/
}
void decayerSetup(TVirtualMC* vmc)
{
auto decayer = new o2::eventgen::DecayerPythia8;
decayer->Init();
vmc->SetExternalDecayer(decayer);
}