Skip to content

Commit

Permalink
IT3: Enable Glo-tracking
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
  • Loading branch information
f3sch committed Apr 23, 2024
1 parent 4344c80 commit 9472197
Show file tree
Hide file tree
Showing 42 changed files with 729 additions and 363 deletions.
4 changes: 3 additions & 1 deletion Common/SimConfig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

#add_compile_options(-O0 -g -fPIC -fno-omit-frame-pointer)

o2_add_library(SimConfig
SOURCES src/SimConfig.cxx
src/SimParams.cxx
Expand All @@ -27,7 +29,7 @@ o2_target_root_dictionary(SimConfig
include/SimConfig/SimParams.h
include/SimConfig/SimUserDecay.h
include/SimConfig/InteractionDiamondParam.h
include/SimConfig/DigiParams.h
include/SimConfig/DigiParams.h
include/SimConfig/G4Params.h
include/SimConfig/GlobalProcessCutSimParam.h
include/SimConfig/MatMapParams.h)
Expand Down
81 changes: 41 additions & 40 deletions Common/SimConfig/include/SimConfig/SimConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,43 +48,44 @@ enum class TimeStampMode {

// configuration struct (which can be passed around)
struct SimConfigData {
std::vector<std::string> mActiveModules; // list of active modules
std::vector<std::string> mReadoutDetectors; // list of readout detectors
std::string mMCEngine; // chosen VMC engine
std::string mGenerator; // chosen VMC generator
std::string mTrigger; // chosen VMC generator trigger
unsigned int mNEvents; // number of events to be simulated
std::string mExtKinFileName; // file name of external kinematics file (needed for ext kinematics generator)
std::string mEmbedIntoFileName; // filename containing the reference events to be used for the embedding
unsigned int mStartEvent; // index of first event to be taken
float mBMax; // maximum for impact parameter sampling
bool mIsMT; // chosen MT mode (Geant4 only)
std::string mOutputPrefix; // prefix to be used for output files
std::string mLogSeverity; // severity for FairLogger
std::string mLogVerbosity; // loglevel for FairLogger
std::string mKeyValueTokens; // a string holding arbitrary sequence of key-value tokens
// Foo.parameter1=x,Bar.parameter2=y,Baz.paramter3=hello
// (can be used to **loosely** change any configuration parameter from command-line)
std::string mConfigFile; // path to a JSON or INI config file (file extension is required to determine type).
// values within the config file will override values set in code by the param classes
// but will themselves be overridden by any values given in mKeyValueTokens.
int mPrimaryChunkSize; // defining max granularity for input primaries of a sim job
int mInternalChunkSize; //
ULong_t mStartSeed; // base for random number seeds
int mSimWorkers = 1; // number of parallel sim workers (when it applies)
bool mFilterNoHitEvents = false; // whether to filter out events not leaving any response
std::string mCCDBUrl; // the URL where to find CCDB
uint64_t mTimestamp; // timestamp in ms to anchor transport simulation to
std::vector<std::string> mActiveModules; // list of active modules
std::vector<std::string> mReadoutDetectors; // list of readout detectors
std::string mMCEngine; // chosen VMC engine
std::string mGenerator; // chosen VMC generator
std::string mTrigger; // chosen VMC generator trigger
unsigned int mNEvents; // number of events to be simulated
std::string mExtKinFileName; // file name of external kinematics file (needed for ext kinematics generator)
std::string mEmbedIntoFileName; // filename containing the reference events to be used for the embedding
unsigned int mStartEvent; // index of first event to be taken
float mBMax; // maximum for impact parameter sampling
bool mIsMT; // chosen MT mode (Geant4 only)
std::string mOutputPrefix; // prefix to be used for output files
std::string mLogSeverity; // severity for FairLogger
std::string mLogVerbosity; // loglevel for FairLogger
std::string mKeyValueTokens; // a string holding arbitrary sequence of key-value tokens
// Foo.parameter1=x,Bar.parameter2=y,Baz.paramter3=hello
// (can be used to **loosely** change any configuration parameter from command-line)
std::string mConfigFile; // path to a JSON or INI config file (file extension is required to determine type).
// values within the config file will override values set in code by the param classes
// but will themselves be overridden by any values given in mKeyValueTokens.
int mPrimaryChunkSize; // defining max granularity for input primaries of a sim job
int mInternalChunkSize; //
ULong_t mStartSeed; // base for random number seeds
int mSimWorkers = 1; // number of parallel sim workers (when it applies)
bool mFilterNoHitEvents = false; // whether to filter out events not leaving any response
std::string mCCDBUrl; // the URL where to find CCDB
uint64_t mTimestamp; // timestamp in ms to anchor transport simulation to
TimeStampMode mTimestampMode = TimeStampMode::kNow; // telling of timestamp was given as option or defaulted to now
int mRunNumber = -1; // ALICE run number (if set != -1); the timestamp should be compatible
int mField; // L3 field setting in kGauss: +-2,+-5 and 0
SimFieldMode mFieldMode = SimFieldMode::kDefault; // uniform magnetic field
bool mAsService = false; // if simulation should be run as service/deamon (does not exit after run)
bool mNoGeant = false; // if Geant transport should be turned off (when one is only interested in the generated events)
bool mIsUpgrade = false; // true if the simulation is for Run 5
std::string mFromCollisionContext = ""; // string denoting a collision context file; If given, this file will be used to determine number of events
bool mForwardKine = false; // true if tracks and event headers are to be published on a FairMQ channel (for reading by other consumers)
bool mWriteToDisc = true; // whether we write simulation products (kine, hits) to disc
int mRunNumber = -1; // ALICE run number (if set != -1); the timestamp should be compatible
int mField; // L3 field setting in kGauss: +-2,+-5 and 0
SimFieldMode mFieldMode = SimFieldMode::kDefault; // uniform magnetic field
bool mAsService = false; // if simulation should be run as service/deamon (does not exit after run)
bool mNoGeant = false; // if Geant transport should be turned off (when one is only interested in the generated events)
bool mIsUpgrade = false; // true if the simulation is for Run 5
bool mWithIT3 = false; // true if simulation should use IT3
std::string mFromCollisionContext = ""; // string denoting a collision context file; If given, this file will be used to determine number of events
bool mForwardKine = false; // true if tracks and event headers are to be published on a FairMQ channel (for reading by other consumers)
bool mWriteToDisc = true; // whether we write simulation products (kine, hits) to disc
VertexMode mVertexMode = VertexMode::kDiamondParam; // by default we should use die InteractionDiamond parameter

ClassDefNV(SimConfigData, 4);
Expand Down Expand Up @@ -139,7 +140,7 @@ class SimConfig

// static helper functions to determine list of active / readout modules
// can also be used from outside
static void determineActiveModules(std::vector<std::string> const& input, std::vector<std::string> const& skipped, std::vector<std::string>& active, bool isUpgrade = false);
static void determineActiveModules(std::vector<std::string> const& input, std::vector<std::string> const& skipped, std::vector<std::string>& active, bool isUpgrade = false, bool withIT3 = false);
static void determineReadoutDetectors(std::vector<std::string> const& active, std::vector<std::string> const& enabledRO, std::vector<std::string> const& skippedRO, std::vector<std::string>& finalRO);

// helper to parse field option
Expand Down Expand Up @@ -206,9 +207,9 @@ struct SimReconfigData {
std::string configFile; // path to a JSON or INI config file (file extension is required to determine type).
// values within the config file will override values set in code by the param classes
// but will themselves be overridden by any values given in mKeyValueTokens.
unsigned int primaryChunkSize; // defining max granularity for input primaries of a sim job
ULong_t startSeed; // base for random number seeds
bool stop; // to shut down the service
unsigned int primaryChunkSize; // defining max granularity for input primaries of a sim job
ULong_t startSeed; // base for random number seeds
bool stop; // to shut down the service
std::string mFromCollisionContext = ""; // string denoting a collision context file; If given, this file will be used to determine number of events

ClassDefNV(SimReconfigData, 1);
Expand Down
20 changes: 15 additions & 5 deletions Common/SimConfig/src/SimConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ void SimConfig::initOptions(boost::program_options::options_description& options
"asservice", bpo::value<bool>()->default_value(false), "run in service/server mode")(
"noGeant", bpo::bool_switch(), "prohibits any Geant transport/physics (by using tight cuts)")(
"forwardKine", bpo::bool_switch(), "forward kinematics on a FairMQ channel")(
#ifdef ENABLE_UPGRADES
"withIT3", bpo::bool_switch()->default_value(false), "replace ITS with IT3")(
#endif
"noDiscOutput", bpo::bool_switch(), "switch off writing sim results to disc (useful in combination with forwardKine)");
options.add_options()("fromCollContext", bpo::value<std::string>()->default_value(""), "Use a pregenerated collision context to infer number of events to simulate, how to embedd them, the vertex position etc. Takes precedence of other options such as \"--nEvents\".");
}

void SimConfig::determineActiveModules(std::vector<std::string> const& inputargs, std::vector<std::string> const& skippedModules, std::vector<std::string>& activeModules, bool isUpgrade)
void SimConfig::determineActiveModules(std::vector<std::string> const& inputargs, std::vector<std::string> const& skippedModules, std::vector<std::string>& activeModules, bool isUpgrade, bool withIT3)
{
using o2::detectors::DetID;

Expand All @@ -86,8 +89,7 @@ void SimConfig::determineActiveModules(std::vector<std::string> const& inputargs
LOGP(fatal, "List of active modules contains {}, which is not a module from the upgrades.", activeModules[i]);
}
}
}
if (!isUpgrade) {
} else {
for (int i = 0; i < activeModules.size(); ++i) {
if (activeModules[i] == "A3IP" ||
activeModules[i] == "TRK" ||
Expand All @@ -98,6 +100,9 @@ void SimConfig::determineActiveModules(std::vector<std::string> const& inputargs
activeModules[i] == "MI3" ||
activeModules[i] == "ECL") {
LOGP(fatal, "List of active modules contains {}, which is not a run 3 module", activeModules[i]);
} else if (withIT3 && activeModules[i] == "ITS") {
activeModules[i] = "IT3";
LOGP(info, "Replacing ITS with IT3 as active module");
}
}
}
Expand Down Expand Up @@ -133,7 +138,10 @@ void SimConfig::determineActiveModules(std::vector<std::string> const& inputargs
activeModules.emplace_back("SHIL");
for (int d = DetID::First; d <= DetID::Last; ++d) {
#ifdef ENABLE_UPGRADES
if (d != DetID::IT3 && d != DetID::TRK && d != DetID::FT3 && d != DetID::FCT && d != DetID::TF3 && d != DetID::RCH && d != DetID::ECL && d != DetID::MI3) {
if (withIT3 && d == DetID::ITS) {
activeModules.emplace_back(DetID::getName(DetID::IT3));
LOGP(info, "Replacing ITS with IT3 as active module");
} else if (d != DetID::IT3 && d != DetID::TRK && d != DetID::FT3 && d != DetID::FCT && d != DetID::TF3 && d != DetID::RCH && d != DetID::ECL && d != DetID::MI3) {
activeModules.emplace_back(DetID::getName(d));
}
}
Expand Down Expand Up @@ -206,8 +214,10 @@ bool SimConfig::resetFromParsedMap(boost::program_options::variables_map const&
mConfigData.mMCEngine = vm["mcEngine"].as<std::string>();
mConfigData.mNoGeant = vm["noGeant"].as<bool>();

mConfigData.mWithIT3 = vm["withIT3"].as<bool>();

// get final set of active Modules
determineActiveModules(vm["modules"].as<std::vector<std::string>>(), vm["skipModules"].as<std::vector<std::string>>(), mConfigData.mActiveModules, mConfigData.mIsUpgrade);
determineActiveModules(vm["modules"].as<std::vector<std::string>>(), vm["skipModules"].as<std::vector<std::string>>(), mConfigData.mActiveModules, mConfigData.mIsUpgrade, mConfigData.mWithIT3);
if (mConfigData.mNoGeant) {
// CAVE is all that's needed (and that will be built either way), so clear all modules and set the O2TrivialMCEngine
mConfigData.mActiveModules.clear();
Expand Down
4 changes: 4 additions & 0 deletions DataFormats/Detectors/GlobalTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

add_compile_options(-O0 -g -fPIC -fno-omit-frame-pointer)

o2_add_library(
DataFormatsGlobalTracking
SOURCES src/RecoContainer.cxx
Expand All @@ -35,6 +37,8 @@ o2_add_library(
O2::DataFormatsPHOS
O2::DataFormatsEMCAL
O2::GPUDataTypeHeaders
PUBLIC_UPGRADE_LINK_LIBRARIES
O2::ITS3Reconstruction
PRIVATE_LINK_LIBRARIES
O2::Framework)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct DataRequest {
void requestFV0RecPoints(bool mc);
void requestFDDRecPoints(bool mc);
void requestZDCRecEvents(bool mc);
void requestITSClusters(bool mc);
void requestITSClusters(bool mc, bool withIT3 = false);
void requestMFTClusters(bool mc);
void requestTPCClusters(bool mc);
void requestTPCTriggers();
Expand Down Expand Up @@ -370,7 +370,7 @@ struct RecoContainer {
void addMFTMCHMatches(o2::framework::ProcessingContext& pc, bool mc);
void addMCHMIDMatches(o2::framework::ProcessingContext& pc, bool mc);

void addITSClusters(o2::framework::ProcessingContext& pc, bool mc);
void addITSClusters(o2::framework::ProcessingContext& pc, bool mc, bool withIT3 = false);
void addMFTClusters(o2::framework::ProcessingContext& pc, bool mc);
void addTPCClusters(o2::framework::ProcessingContext& pc, bool mc, bool shmap, bool occmap);
void addTPCTriggers(o2::framework::ProcessingContext& pc);
Expand Down
37 changes: 33 additions & 4 deletions DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include "Framework/DataRefUtils.h"
#include "Framework/CCDBParamSpec.h"

#ifdef ENABLE_UPGRADES
#include "ITS3Reconstruction/TopologyDictionary.h"
#endif

using namespace o2::globaltracking;
using namespace o2::framework;
namespace o2d = o2::dataformats;
Expand Down Expand Up @@ -222,17 +226,27 @@ void DataRequest::requestTOFMatches(o2::dataformats::GlobalTrackID::mask_t src,
}
}

void DataRequest::requestITSClusters(bool mc)
void DataRequest::requestITSClusters(bool mc, bool withIT3)
{
addInput({"clusITS", "ITS", "COMPCLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusITSPatt", "ITS", "PATTERNS", 0, Lifetime::Timeframe});
addInput({"clusITSROF", "ITS", "CLUSTERSROF", 0, Lifetime::Timeframe});
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
addInput({"alpparITS", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam")});
if (mc) {
addInput({"clusITSMC", "ITS", "CLUSTERSMCTR", 0, Lifetime::Timeframe});
}
#ifdef ENABLE_UPGRADES
if (withIT3) {
addInput({"cldictIT3", "IT3", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("IT3/Calib/ClusterDictionary")});
requestMap["clusIT3"] = mc;
} else {
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
requestMap["clusITS"] = mc;
}
#else
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
requestMap["clusITS"] = mc;
#endif
}

void DataRequest::requestMFTClusters(bool mc)
Expand Down Expand Up @@ -673,6 +687,13 @@ void RecoContainer::collectData(ProcessingContext& pc, const DataRequest& reques
addITSClusters(pc, req->second);
}

#ifdef ENABLE_UPGRADES
req = reqMap.find("clusIT3");
if (req != reqMap.end()) {
addITSClusters(pc, req->second, true);
}
#endif

req = reqMap.find("clusMFT");
if (req != reqMap.end()) {
addMFTClusters(pc, req->second);
Expand Down Expand Up @@ -1033,11 +1054,19 @@ void RecoContainer::addHMPMatches(ProcessingContext& pc, bool mc)
}

//__________________________________________________________
void RecoContainer::addITSClusters(ProcessingContext& pc, bool mc)
void RecoContainer::addITSClusters(ProcessingContext& pc, bool mc, bool withIT3)
{
if (pc.services().get<o2::framework::TimingInfo>().globalRunNumberChanged) { // this params need to be queried only once
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>*>("alpparITS"); // note: configurable param does not need finaliseCCDB
#ifdef ENABLE_UPGRADES
if (withIT3) {
pc.inputs().get<o2::its3::TopologyDictionary*>("cldictIT3"); // just to trigger the finaliseCCDB
} else {
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
}
#else
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
#endif
}
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusITSROF"), CLUSREFS);
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusITS"), CLUSTERS);
Expand Down
Loading

0 comments on commit 9472197

Please sign in to comment.