Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6086edf
MQ/examples/simulation_split
karabowi Sep 11, 2018
cece980
examples/MQ/simulation_split
karabowi Sep 13, 2018
0480f0b
examples/MQ/pixelDetector
karabowi Oct 2, 2018
6c8679f
examples/MQ/simulation_split
karabowi Oct 2, 2018
48fc05c
examples/MQ/pixelDetector
karabowi Oct 2, 2018
d959113
examples/MQ
karabowi Oct 2, 2018
037698a
examples/MQ/simulation_split
karabowi Oct 4, 2018
afa965c
examples/
karabowi Oct 9, 2018
ffdbc9f
examples/MQ/simulation_split
karabowi Nov 1, 2018
dfc8735
examples/MQ/simulation_split
karabowi Nov 12, 2018
5f86cb7
examples/MQ/simulation_split
karabowi Nov 13, 2018
701baa7
examples/MQ/simulation_split
karabowi Nov 14, 2018
9f747ed
examles/MQ/simulation_split
karabowi Nov 14, 2018
0c1dcb3
test g3Config.C
karabowi Nov 20, 2018
3c84323
test runsim
karabowi Nov 20, 2018
0933914
another tests
karabowi Nov 20, 2018
e4d082e
hardcode detector geometry in transporter, remove reading library
karabowi Nov 21, 2018
640ba4e
check paths
karabowi Nov 21, 2018
089e9d7
source fairroot's config.sh
karabowi Nov 21, 2018
9b6885a
examples/MQ/simulation_split
karabowi Nov 30, 2018
9d47fa9
examples/MQ/simulation_split
karabowi Nov 30, 2018
3d6eaed
test location of config.sh
karabowi Nov 30, 2018
2bc45ca
see what's in config.sh and DDS_env.sh
karabowi Nov 30, 2018
5d294da
print DYLD_LIBRARY_PATH
karabowi Nov 30, 2018
fc6d9a5
examples/MQ/simulation_split/
karabowi Dec 7, 2018
d366bb5
examples/MQ/simulation_split
karabowi Dec 11, 2018
d3742fe
examples/MQ/simulation_split
karabowi Dec 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions base/sim/FairGenericStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class FairGenericStack : public TVirtualMCStack
virtual void Register() {}

virtual TClonesArray* GetListOfParticles() { return 0; }
virtual void SetParticleArray(TClonesArray* partArray) {}
virtual void SetParticleArray(TClonesArray* partArray, Int_t partFrom, Int_t partTo) {}

/** Clone this object (used in MT mode only) */
virtual FairGenericStack* CloneStack() const;
Expand Down
4 changes: 4 additions & 0 deletions base/steer/FairRunSim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,18 @@ void FairRunSim::SetMCConfig()
cuts =work_config+ fUserCuts;
}
//--------------------------------------Now load the Config and Cuts------------------------------------
LOG(info) << "Now load the Config and Cuts";
if (!LibMacro.IsNull()) {
LOG(info) << "LibMacro " << LibMacro.Data();
gROOT->LoadMacro(LibMacro.Data());
gROOT->ProcessLine(LibFunction.Data());
}

LOG(info) << "ConfigMacro " << ConfigMacro.Data();
gROOT->LoadMacro(ConfigMacro.Data());
gROOT->ProcessLine("Config()");

LOG(info) << "CutsMacro " << cuts;
gROOT->LoadMacro(cuts);
gROOT->ProcessLine("SetCuts()");
}
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ If(GEANT3_FOUND)
add_subdirectory(MQ/serialization)
add_subdirectory(MQ/pixelDetector)
add_subdirectory(MQ/pixelAlternative)
add_subdirectory(MQ/simulation_split)
add_subdirectory(advanced/Tutorial3)
EndIf()
add_subdirectory(simulation/rutherford)
Expand Down
1 change: 1 addition & 0 deletions examples/MQ/pixelDetector/run/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GENERATE_TEST_SCRIPT(${CMAKE_BINARY_DIR}/bin/examples/MQ/pixelDetector/startFair

Add_Test(pixel_simulation
${CMAKE_CURRENT_BINARY_DIR}/startFairMQPixelSimulation.sh --work-dir ${CMAKE_BINARY_DIR} -n 1000 -g TGeant3 -c static -s 6 --force-kill true -m 20 -v veryhigh -l false)
Set_Tests_Properties(pixel_simulation PROPERTIES DEPENDS pixel_static)
Set_Tests_Properties(pixel_simulation PROPERTIES TIMEOUT ${MaxTestTime})
Set_Tests_Properties(pixel_simulation PROPERTIES PASS_REGULAR_EXPRESSION "Shell script finished successfully")

Expand Down
140 changes: 69 additions & 71 deletions examples/MQ/pixelDetector/run/runMQSim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,82 +27,80 @@ namespace bpo = boost::program_options;

void addCustomOptions(bpo::options_description& options)
{
options.add_options()
("random-seed", bpo::value<int64_t> ()->default_value(0) , "Random seed number")
("transport-name", bpo::value<std::string>()->default_value("TGeant3") , "Transport name")
("nof-events", bpo::value<int64_t> ()->required() , "Number of events to simulate")
("fairroot-config-dir", bpo::value<std::string>()->default_value("") , "FairRoot config dir")
("param-channel-name", bpo::value<std::string>()->default_value("updateChannel"), "Parameter update channel name")
options.add_options()
("random-seed", bpo::value<int64_t> ()->default_value(0) , "Random seed number")
("transport-name", bpo::value<std::string>()->default_value("TGeant3") , "Transport name")
("nof-events", bpo::value<int64_t> ()->required() , "Number of events to simulate")
("fairroot-config-dir", bpo::value<std::string>()->default_value("") , "FairRoot config dir")
("param-channel-name", bpo::value<std::string>()->default_value("updateChannel"), "Parameter update channel name")
("run-digi-tasks", bpo::value<bool> ()->default_value(false) , "Run digi tasks")
;
}

FairMQDevicePtr getDevice(const FairMQProgOptions& config)
{
gRandom->SetSeed(config.GetValue<int64_t> ("random-seed"));

TString dir = getenv("VMCWORKDIR");
TString tutdir = dir + "/MQ/pixelDetector";

TString tut_geomdir = dir + "/common/geometry";
gSystem->Setenv("GEOMPATH",tut_geomdir.Data());

TString tut_configdir = config.GetValue<std::string>("fairroot-config-dir");
if ( tut_configdir.Length() < 1 )
tut_configdir = dir + "/common/gconfig";
gSystem->Setenv("CONFIG_DIR",tut_configdir.Data());

FairMQSimDevice* run = new FairMQSimDevice();

// TString outputfilename = Form("outputfile_%d.root",(int)(getpid()));
// FairRootFileSink* sink = new FairRootFileSink(outputfilename);
FairOnlineSink* sink = new FairOnlineSink();
sink->SetMQSimDevice(run);
run->SetSink(sink);

run->SetParamUpdateChannelName(config.GetValue<std::string>("param-channel-name"));

run->SetNofEvents (config.GetValue<int64_t> ("nof-events"));
run->SetTransportName (config.GetValue<std::string>("transport-name"));
run->SetMaterials ("media.geo");

TObjArray* detArray = new TObjArray();
FairModule* cave= new FairCave("CAVE");
cave->SetGeometryFileName("cave_vacuum.geo");
detArray->Add(cave);
Pixel* det = new Pixel("PixelDetector", kTRUE);
det->SetGeometryFileName("pixel.geo");
detArray->Add(det);
run->SetDetectorArray (detArray);

TString partName[] = {"pions","eplus","proton"};
Int_t partPdgC[] = { 211, 11, 2212};
Int_t chosenPart = 0;

FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
FairBoxGenerator* boxGen = new FairBoxGenerator(partPdgC[chosenPart], 5);
boxGen->SetPRange(1,2);
boxGen->SetThetaRange(0,40);
boxGen->SetPhiRange(0,360);
primGen->AddGenerator(boxGen);
run->SetGenerator (primGen);

run->SetStoreTraj (false);

// ---------------------------------------------------
if ( 1==0 )
{
// try to run digi task in the simulation device
TString digParFile = tutdir + "/param/pixel_digi.par";
FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
parIo1->open(digParFile.Data(),"in");
run->SetFirstParameter(parIo1);

TObjArray* taskArray = new TObjArray();
PixelDigitize* digiTask = new PixelDigitize();
taskArray->Add(digiTask);
run->SetTaskArray(taskArray);
gRandom->SetSeed(config.GetValue<int64_t> ("random-seed"));

TString dir = getenv("VMCWORKDIR");
TString tutdir = dir + "/MQ/pixelDetector";

TString tut_geomdir = dir + "/common/geometry";
gSystem->Setenv("GEOMPATH",tut_geomdir.Data());

TString tut_configdir = config.GetValue<std::string>("fairroot-config-dir");
if ( tut_configdir.Length() < 1 )
tut_configdir = dir + "/common/gconfig";
gSystem->Setenv("CONFIG_DIR",tut_configdir.Data());

FairMQSimDevice* run = new FairMQSimDevice();

// TString outputfilename = Form("outputfile_%d.root",(int)(getpid()));
// FairRootFileSink* sink = new FairRootFileSink(outputfilename);
FairOnlineSink* sink = new FairOnlineSink();
sink->SetMQRunDevice(run);
run->SetSink(sink);

run->SetParamUpdateChannelName(config.GetValue<std::string>("param-channel-name"));

run->SetNofEvents (config.GetValue<int64_t> ("nof-events"));
run->SetTransportName (config.GetValue<std::string>("transport-name"));
run->SetMaterials ("media.geo");

TObjArray* detArray = new TObjArray();
FairModule* cave= new FairCave("CAVE");
cave->SetGeometryFileName("cave_vacuum.geo");
detArray->Add(cave);
Pixel* det = new Pixel("PixelDetector", kTRUE);
det->SetGeometryFileName("pixel.geo");
detArray->Add(det);
run->SetDetectorArray (detArray);

TString partName[] = {"pions","eplus","proton"};
Int_t partPdgC[] = { 211, 11, 2212};
Int_t chosenPart = 0;

FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
FairBoxGenerator* boxGen = new FairBoxGenerator(partPdgC[chosenPart], 100);
boxGen->SetPRange(1,2);
boxGen->SetThetaRange(0,180);
boxGen->SetPhiRange(0,360);
primGen->AddGenerator(boxGen);
run->SetGenerator (primGen);

run->SetStoreTraj (false);

if ( (config.GetValue<bool>("run-digi-tasks")) == true ) {
// Attach tasks if needed
TString digParFile = tutdir + "/param/pixel_digi.par";
FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
parIo1->open(digParFile.Data(),"in");
run->SetFirstParameter(parIo1);

TObjArray* taskArray = new TObjArray();
PixelDigitize* digiTask = new PixelDigitize();
taskArray->Add(digiTask);
run->SetTaskArray(taskArray);
}
// ---------------------------------------------------

return run;
return run;
}
2 changes: 0 additions & 2 deletions examples/MQ/pixelDetector/run/runPixelFileSink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ void addCustomOptions(bpo::options_description& options)
{
options.add_options()
("file-name", bpo::value<std::string> () , "Path to the output file")
("class-name", bpo::value<std::vector<std::string>>() , "class name")
("branch-name", bpo::value<std::vector<std::string>>() , "branch name")
("in-channel", bpo::value<std::string> ()->default_value("data-in") , "input channel name")
("ack-channel", bpo::value<std::string> () , "ack channel name");
}
Expand Down
8 changes: 1 addition & 7 deletions examples/MQ/pixelDetector/run/scripts/startFairMQPixel.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ if [ "$FAIRTASKNAME" == "--task-name PixelFindHits" ] ; then

# output file for sink
OUTPUTFILE="$WORKDIR/examples/MQ/pixelDetector/macros/MQ.pixel_TGeant3.hits.root"
OUTPUTCLASS="--class-name TClonesArray(PixelHit)"
OUTPUTBRANCH="--branch-name PixelHits"
elif [ "$FAIRTASKNAME" == "--task-name PixelFindTracks" ] ; then
# input file and branch for the sampler device
FAIRTASKNAME+=" --keep-data PixelHits"
Expand All @@ -86,17 +84,13 @@ elif [ "$FAIRTASKNAME" == "--task-name PixelFindTracks" ] ; then

# output file for sink
OUTPUTFILE="$WORKDIR/examples/MQ/pixelDetector/macros/MQ.pixel_TGeant3.hits_tracks.root"
OUTPUTCLASS="--class-name TClonesArray(PixelHit) --class-name TClonesArray(PixelTrack)"
OUTPUTBRANCH="--branch-name PixelHits --branch-name PixelTracks"
elif [ "$FAIRTASKNAME" == "--task-name PixelFitTracks" ] ; then
# input file and branch for the sampler device
INPUTFILE="$WORKDIR/examples/MQ/pixelDetector/macros/MQ.pixel_TGeant3.hits_tracks.root"
INPUTBRANCH="PixelHits --branch-name PixelTracks"

# output file for sink
OUTPUTFILE="$WORKDIR/examples/MQ/pixelDetector/macros/MQ.pixel_TGeant3.fitTracks.root"
OUTPUTCLASS="--class-name TClonesArray(PixelTrack)"
OUTPUTBRANCH="--branch-name PixelFitTracks"
else
echo "TASK $FAIRTASKNAME UNKNOWN!!!"
exit
Expand Down Expand Up @@ -145,7 +139,7 @@ FILESINK+=" --id pixDet-sink1 --channel-config name=data-in,type=pull,method=bin
if [ "$COMMAND" == "static" ]; then
FILESINK+=" --ack-channel ack --channel-config name=ack,type=push,method=connect,rateLogging=0,address=tcp://localhost:5108"
fi
FILESINK+=" --file-name $OUTPUTFILE --class-name FairEventHeader --branch-name EventHeader. $OUTPUTCLASS $OUTPUTBRANCH $CONTROL"
FILESINK+=" --file-name $OUTPUTFILE $CONTROL"

########################## run all
if [ "$COMMAND" == "print" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ xterm +aw -geometry 80x25+500+700 -hold -e @PIXEL_BIN_LOCATION@/$MERGER &
########################## start FILESINK
FILESINK="pixel-sink $TRANSPORT"
FILESINK+=" --id sink 1 --channel-config name=data-in,type=pull,method=bind,rateLogging=1,address=tcp://*:5230"
FILESINK+=" --file-name $OUTPUTFILE --class-name FairEventHeader --branch-name EventHeader. --class-name $OUTPUTCLASS --branch-name $OUTPUTBRANCH"
FILESINK+=" --file-name $OUTPUTFILE"
xterm +aw -geometry 80x25+1000+700 -hold -e @PIXEL_BIN_LOCATION@/$FILESINK &


Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ FILESINK+=" $SEVERITY "
FILESINK+=" $VERBOSITY "
FILESINK+=" $COLOR "
FILESINK+=" --id pixSim-sink1 --channel-config name=data#all#,type=pull,method=bind,rateLogging=1,address=tcp://*:5206"
FILESINK+=" --class-name FairMCEventHeader --branch-name MCEventHeader."
FILESINK+=" --class-name TClonesArray(PixelPoint) --branch-name PixelPoint"
FILESINK+=" --class-name TClonesArray(FairMCTrack) --branch-name MCTrack"
FILESINK+=" --file-name $OUTPUTFILE $CONTROL"

########################## run all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ INPUTBRANCH="PixelDigis"

# output file for sink
OUTPUTFILE="@PIXEL_FILE_LOCATION@/examples/MQ/pixelDetector/macros/MQ.pixel_TGeant3.3Levels.fitTracks.root"
OUTPUTCLASS="--class-name TClonesArray(PixelTrack)"
OUTPUTBRANCH="--branch-name PixelFitTracks"
###########################


Expand Down Expand Up @@ -109,7 +107,7 @@ xterm -geometry 80x22+1000+700 -hold -e @PIXEL_BIN_LOCATION@/$PROCESSOR3_2 &
########################## start FILESINK
FILESINK="pixel-sink $TRANSPORT"
FILESINK+=" --id sink1 --channel-config name=data-in,type=pull,method=bind,rateLogging=1,address=tcp://*:5330"
FILESINK+=" --file-name $OUTPUTFILE --class-name FairEventHeader --branch-name EventHeader. $OUTPUTCLASS $OUTPUTBRANCH"
FILESINK+=" --file-name $OUTPUTFILE"
xterm +aw -geometry 80x22+0+700 -hold -e @PIXEL_BIN_LOCATION@/$FILESINK &


2 changes: 2 additions & 0 deletions examples/MQ/pixelDetector/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ devices/PixelFindHitsTask.cxx
devices/FairMQPixelMerger.cxx
devices/FairMQPixelFileSink.cxx
devices/FairMQPixelFileSinkBin.cxx
devices/FairMQRunDevice.cxx
devices/FairMQSimDevice.cxx
FairOnlineSink.cxx
)
Expand All @@ -57,6 +58,7 @@ devices/FairMQPixelTaskProcessor.h
devices/FairMQPixelTaskProcessor.tpl
devices/FairMQPixelTaskProcessorBin.h
devices/FairMQPixelTaskProcessorBin.tpl
devices/FairMQRunDevice.h
devices/FairMQSimDevice.h
FairOnlineSink.h
)
Expand Down
8 changes: 4 additions & 4 deletions examples/MQ/pixelDetector/src/FairOnlineSink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "FairMQMessage.h"
#include "FairMQProgOptions.h"

#include "FairMQSimDevice.h"
#include "FairMQRunDevice.h"
#include "FairRootManager.h"

#include "FairEventHeader.h"
Expand All @@ -41,7 +41,7 @@ using namespace std;

FairOnlineSink::FairOnlineSink()
: FairSink()
, fMQSimDevice(NULL)
, fMQRunDevice(NULL)
{
}

Expand All @@ -66,8 +66,8 @@ void FairOnlineSink::Fill()
/// Fill the Root tree.
LOG(DEBUG) << "called FairOnlineSink::Fill()!!!!";

if ( fMQSimDevice )
fMQSimDevice->SendBranches();
if ( fMQRunDevice )
fMQRunDevice->SendBranches();
}

Bool_t FairOnlineSink::InitSink()
Expand Down
6 changes: 3 additions & 3 deletions examples/MQ/pixelDetector/src/FairOnlineSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "FairSink.h"

class FairEventHeader;
class FairMQSimDevice;
class FairMQRunDevice;

class FairOnlineSink : public FairSink
{
Expand Down Expand Up @@ -52,10 +52,10 @@ class FairOnlineSink : public FairSink
virtual void WriteObject(TObject* /* f */, const char*, Int_t /* option = 0 */) {}
virtual void WriteGeometry() {}

virtual void SetMQSimDevice(FairMQSimDevice* mrs) { fMQSimDevice = mrs;}
virtual void SetMQRunDevice(FairMQRunDevice* mrs) { fMQRunDevice = mrs;}

private:
FairMQSimDevice* fMQSimDevice;
FairMQRunDevice* fMQRunDevice;

FairOnlineSink(const FairOnlineSink&);
FairOnlineSink& operator=(const FairOnlineSink&);
Expand Down
14 changes: 14 additions & 0 deletions examples/MQ/pixelDetector/src/Pixel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "FairGeoVolume.h" // for FairGeoVolume
#include "FairRootManager.h" // for FairRootManager
#include "FairRun.h" // for FairRun
#include "FairRunSim.h" // for FairRunSim
#include "FairRuntimeDb.h" // for FairRuntimeDb
#include "FairStack.h" // for FairStack
#include "FairVolume.h" // for FairVolume
Expand Down Expand Up @@ -260,4 +261,17 @@ PixelPoint* Pixel::AddHit(Int_t trackID, Int_t detID,
time, length, eLoss);
}

extern "C" void ExternCreateDetector() {
using std::cout;
using std::endl;

cout << "-- ExternCreateDetector() START --" << endl;
FairRunSim* run = FairRunSim::Instance();

Pixel* det = new Pixel("PixelDetector", kTRUE);
det->SetGeometryFileName("pixel.geo");
run->AddModule(det);
cout << "-- ExternCreateDetector(" << det->GetName() << ") DONE --" << endl;
}

ClassImp(Pixel)
Loading