Belle II Software development
FBXWriterModule Class Reference

The FBX-writer module. More...

#include <FBXWriterModule.h>

Inheritance diagram for FBXWriterModule:
Module PathElement

Public Types

enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 FBXWriterModule ()
 Constructor of the module.
 
void initialize () override
 Initialize at the start of a job.
 
void event () override
 Called for each event: this runs the FBX writer only for the first event.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void beginRun ()
 Called when entering a new run.
 
virtual void endRun ()
 This method is called if the current run ends.
 
virtual void terminate ()
 This method is called at the end of the event processing.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python.
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side.
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module.
 
void setType (const std::string &type)
 Set the module type.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

void assignName (std::vector< std::string > *, unsigned int, const G4String &, int)
 Create unique and legal name for each solid, logical volume, physical volume.
 
void writeGeometryNode (G4VSolid *, const std::string &, unsigned long long)
 Write FBX definition for each solid's polyhedron.
 
void writeMaterialNode (int, const std::string &)
 Write FBX definition for each logical volume's color information.
 
void writeLVModelNode (G4LogicalVolume *, const std::string &, unsigned long long)
 Write FBX definition for each logical volume.
 
void writePVModelNode (G4VPhysicalVolume *, const std::string &, unsigned long long)
 Write FBX definition for each physical volume.
 
void countEntities (G4VPhysicalVolume *)
 Count the physical volumes, logical volumes, materials and solids (recursive)
 
void addModels (G4VPhysicalVolume *, int)
 Process one physical volume for FBX-node writing (recursive)
 
void addConnections (G4VPhysicalVolume *, int)
 Write FBX connections among all of the nodes in the tree (recursive)
 
void writePreamble (int, int, int)
 Write FBX at the start of the file.
 
void writePolyhedron (G4VSolid *, G4Polyhedron *, const std::string &, unsigned long long)
 Write FBX definition for the solid's polyhedron.
 
void writeSolidToLV (const std::string &, const std::string &, bool, unsigned long long, unsigned long long, unsigned long long)
 Write FBX connection for each logical volume's solid and color info.
 
void writeSolidToPV (const std::string &, const std::string &, bool, unsigned long long, unsigned long long, unsigned long long)
 Write FBX connection for each physical volume's solid and color info (bypass singleton logical volume)
 
void writeLVToPV (const std::string &, const std::string &, unsigned long long, unsigned long long)
 Write FBX connection for the (unique) logical volume of a physical volume.
 
void writePVToParentLV (const std::string &, const std::string &, unsigned long long, unsigned long long)
 Write FBX connection for each physical-volume daughter of a parent logical volume.
 
void writePVToParentPV (const std::string &, const std::string &, unsigned long long, unsigned long long)
 Write FBX connection for each physical-volume daughter of a parent physical volume (bypass singleton logical volume)
 
HepPolyhedron * getBooleanSolidPolyhedron (G4VSolid *)
 Create polyhedron for a boolean solid (recursive)
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

bool m_First {true}
 Once-only flag to write FBX only on the first event.
 
bool m_UsePrototypes {false}
 User-specified flag to select whether to write and re-use logical- and physical-volume prototypes once (true) or to write duplicates of each such volume (false).
 
std::string m_Filename {"belle2.fbx"}
 User-specified output filename.
 
std::ofstream m_File
 Output file.
 
std::vector< std::string > * m_PVName {nullptr}
 Modified (legal-character and unique) physical-volume name.
 
std::vector< std::string > * m_LVName {nullptr}
 Modified (legal-character and unique) logical-volume name.
 
std::vector< std::string > * m_SolidName {nullptr}
 Modified (legal-character and unique) solid name.
 
std::vector< unsigned long long > * m_PVID {nullptr}
 Unique identifiers for physical volumes (Model nodes with transformation information)
 
std::vector< unsigned long long > * m_LVID {nullptr}
 Unique identifiers for logical volumes (Model nodes with links to Geometry and Material)
 
std::vector< unsigned long long > * m_MatID {nullptr}
 Unique identifiers for logical volumes' color information (Material nodes)
 
std::vector< unsigned long long > * m_SolidID {nullptr}
 Unique identifiers for solids (Geometry nodes)
 
std::vector< bool > * m_Visible {nullptr}
 Flag to indicate that the logical volume is visible.
 
std::vector< unsigned int > * m_PVCount {nullptr}
 Count of number of instances of each physical volume.
 
std::vector< unsigned int > * m_LVCount {nullptr}
 Count of number of instances of each logical volume.
 
std::vector< unsigned int > * m_SolidCount {nullptr}
 Count of number of instances of each solid (typically 1)
 
std::vector< unsigned int > * m_PVReplicas {nullptr}
 Count of number of replicas of each replicated physical volume.
 
std::vector< unsigned int > * m_LVReplicas {nullptr}
 Count of number of replicas of each logical volume associated with a replicated physical volume.
 
std::vector< unsigned int > * m_SolidReplicas {nullptr}
 Count of number of replicas of each solid (extras for replicas with modified solids)
 
std::vector< bool > * m_LVUnique {nullptr}
 Flag to indicate that a logical volume is referenced at most once (eligible for bypass)
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

The FBX-writer module.

This module goes through all volumes of the Belle II detector geometry and write an Autodesk FBX file.

This module requires a valid geometry. Therefore, a geometry-building module should have been executed before this module is called.

Definition at line 37 of file FBXWriterModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

77 {
78 c_Input = 1,
79 c_Output = 2,
85 };
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition: Module.h:81
@ c_Input
This module is an input module (reads data).
Definition: Module.h:78
@ c_DontCollectStatistics
No statistics is collected for this module.
Definition: Module.h:84
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition: Module.h:82
@ c_Output
This module is an output module (writes data).
Definition: Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition: Module.h:83

Constructor & Destructor Documentation

◆ FBXWriterModule()

Constructor of the module.

Definition at line 34 of file FBXWriterModule.cc.

35{
36 //Set module properties and the description
37 setDescription("Write the detector geometry in a (semi-)hierarchical FBX format.");
38
39 //Parameter definition
40 addParam("usePrototypes", m_UsePrototypes, "Use LogVol and PhysVol prototypes", false);
41
42 //Parameter definition
43 addParam("outputFile", m_Filename, "Output filename", std::string("belle2.fbx"));
44}
bool m_UsePrototypes
User-specified flag to select whether to write and re-use logical- and physical-volume prototypes onc...
std::string m_Filename
User-specified output filename.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

Member Function Documentation

◆ addConnections()

void addConnections ( G4VPhysicalVolume *  physVol,
int  replica 
)
private

Write FBX connections among all of the nodes in the tree (recursive)

Definition at line 481 of file FBXWriterModule.cc.

482{
483 // Write the PhysVolModel-parentLogVolModel connections as we descend the recursive tree.
484 // If the parentLogVol is referenced at most once, use its referencing PhysVol instead.
485 G4PhysicalVolumeStore* pvStore = G4PhysicalVolumeStore::GetInstance();
486 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
487 G4SolidStore* solidStore = G4SolidStore::GetInstance();
488 G4LogicalVolume* logVol = physVol->GetLogicalVolume();
489 int pvIndex = std::find(pvStore->begin(), pvStore->end(), physVol) - pvStore->begin();
490 unsigned long long pvID = (*m_PVID)[pvIndex];
491 unsigned int pvCount = (*m_PVCount)[pvIndex];
492 std::string pvName = (*m_PVName)[pvIndex];
493 int lvIndex = std::find(lvStore->begin(), lvStore->end(), logVol) - lvStore->begin();
494 unsigned long long lvID = (*m_LVID)[lvIndex];
495 unsigned int lvCount = (*m_LVCount)[lvIndex];
496 std::string lvName = (*m_LVName)[lvIndex];
497 for (size_t daughter = 0; daughter < logVol->GetNoDaughters(); ++daughter) {
498 G4VPhysicalVolume* physVolDaughter = logVol->GetDaughter(daughter);
499 int pvIndexDaughter = std::find(pvStore->begin(), pvStore->end(), physVolDaughter) - pvStore->begin();
500 unsigned long long pvIDDaughter = (*m_PVID)[pvIndexDaughter];
501 unsigned int pvCountDaughter = (*m_PVCount)[pvIndexDaughter];
502 for (int j = 0; j < physVolDaughter->GetMultiplicity(); ++j) {
503 if (m_UsePrototypes) {
504 if ((replica == 0) && (j == 0) && (lvCount == 0) && (pvCountDaughter == 0)) {
505 if ((*m_LVUnique)[lvIndex]) {
506 writePVToParentPV((*m_PVName)[pvIndexDaughter], pvName, pvIDDaughter, pvID);
507 } else {
508 writePVToParentLV((*m_PVName)[pvIndexDaughter], lvName, pvIDDaughter, lvID);
509 }
510 }
511 } else {
512 //writePVToParentLV((*m_PVName)[pvIndexDaughter], lvName, pvIDDaughter+0x00010000*j+pvCountDaughter, lvID+0x00010000*replica+lvCount);
513 writePVToParentPV((*m_PVName)[pvIndexDaughter], pvName, pvIDDaughter + 0x00010000 * j + pvCountDaughter,
514 pvID + 0x00010000 * replica + pvCount);
515 }
516 addConnections(physVolDaughter, j);
517 }
518 }
519
520 // Write the Geometry-LogVolModel, Material-LogVolModel and PhysVolModel-LogVolModel
521 // connections as we ascend the recursive tree
522 G4VSolid* solid = logVol->GetSolid();
523 int solidIndex = std::find(solidStore->begin(), solidStore->end(), solid) - solidStore->begin();
524 unsigned long long solidID = (*m_SolidID)[solidIndex];
525 unsigned long long matID = (*m_MatID)[lvIndex];
526 std::string solidName = (*m_SolidName)[solidIndex];
527 if (physVol->IsReplicated()) {
528 pvName.append("_R");
529 pvName.append(std::to_string(replica));
530 EAxis axis;
531 G4int nReplicas;
532 G4double width;
533 G4double offset;
534 G4bool consuming;
535 physVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
536 physVol->SetCopyNo(replica);
537 G4VPVParameterisation* physParameterisation = physVol->GetParameterisation();
538 if (physParameterisation) { // parameterised volume
539 G4VSolid* solidReplica = physParameterisation->ComputeSolid(replica, physVol);
540 physParameterisation->ComputeTransformation(replica, physVol);
541 solidReplica->ComputeDimensions(physParameterisation, replica, physVol);
542 if (!(*solidReplica == *solid)) {
543 solidName.append("_R");
544 solidName.append(std::to_string(replica));
545 solidID += 0x00010000 * replica;
546 }
547 if (m_UsePrototypes && (*solidReplica == *solid)) {
548 if ((replica == 0) && (lvCount == 0)) {
549 if ((*m_LVUnique)[lvIndex]) { // bypass the singleton logical volume
550 writeSolidToPV(pvName, solidName, (*m_Visible)[lvIndex], matID, pvID, solidID);
551 } else {
552 writeSolidToLV(lvName, solidName, (*m_Visible)[lvIndex], matID, lvID, solidID);
553 }
554 }
555 } else {
556 lvName.append("_R");
557 lvName.append(std::to_string(replica));
558 if ((*m_LVUnique)[lvIndex]) { // bypass the singleton logical volume
559 writeSolidToPV(pvName, solidName, (*m_Visible)[lvIndex], matID, pvID + 0x00010000 * replica + pvCount, solidID);
560 } else {
561 writeSolidToLV(lvName, solidName, (*m_Visible)[lvIndex], matID, lvID + 0x00010000 * replica + lvCount, solidID);
562 }
563 }
564 if (!(*m_LVUnique)[lvIndex]) {
565 writeLVToPV(pvName, lvName, pvID + 0x00010000 * replica + pvCount, lvID + 0x00010000 * replica + lvCount);
566 }
567 } else { // plain replicated volume
568 if ((axis == kRho) && (solid->GetEntityType() == "G4Tubs")) {
569 solidName.append("_R");
570 solidName.append(std::to_string(replica));
571 solidID += 0x00010000 * replica;
572 }
573 if (m_UsePrototypes && !((axis == kRho) && (solid->GetEntityType() == "G4Tubs"))) {
574 if ((replica == 0) && (lvCount == 0)) {
575 if ((*m_LVUnique)[lvIndex]) { // bypass the singleton logical volume
576 writeSolidToPV(pvName, solidName, (*m_Visible)[lvIndex], matID, pvID, solidID);
577 } else {
578 writeSolidToLV(lvName, solidName, (*m_Visible)[lvIndex], matID, lvID, solidID);
579 }
580 }
581 } else {
582 lvName.append("_R");
583 lvName.append(std::to_string(replica));
584 if ((*m_LVUnique)[lvIndex]) { // bypass the singleton logical volume
585 writeSolidToPV(pvName, solidName, (*m_Visible)[lvIndex], matID, pvID + 0x00010000 * replica + pvCount, solidID);
586 } else {
587 writeSolidToLV(lvName, solidName, (*m_Visible)[lvIndex], matID, lvID + 0x00010000 * replica + lvCount, solidID);
588 }
589 }
590 if (!(*m_LVUnique)[lvIndex]) {
591 writeLVToPV(pvName, lvName, pvID + 0x00010000 * replica + pvCount, lvID + 0x00010000 * replica + lvCount);
592 }
593 }
594 } else {
595 if (m_UsePrototypes) {
596 if (lvCount == 0) {
597 if ((*m_LVUnique)[lvIndex]) { // bypass the singleton logical volume
598 writeSolidToPV(pvName, solidName, (*m_Visible)[lvIndex], matID, pvID, solidID);
599 } else {
600 writeSolidToLV(lvName, solidName, (*m_Visible)[lvIndex], matID, lvID, solidID);
601 }
602 }
603 if (pvCount == 0) {
604 if (!(*m_LVUnique)[lvIndex]) writeLVToPV(pvName, lvName, pvID, lvID);
605 }
606 } else {
607 //writeSolidToLV(lvName, solidName, (*m_Visible)[lvIndex], matID, lvID+lvCount, solidID);
608 //writeLVToPV(pvName, lvName, pvID+pvCount, lvID+lvCount);
609 writeSolidToPV(pvName, solidName, (*m_Visible)[lvIndex], matID, pvID + pvCount, solidID);
610 }
611 (*m_LVCount)[lvIndex]++;
612 (*m_PVCount)[pvIndex]++;
613 }
614}
void writePVToParentLV(const std::string &, const std::string &, unsigned long long, unsigned long long)
Write FBX connection for each physical-volume daughter of a parent logical volume.
void writeLVToPV(const std::string &, const std::string &, unsigned long long, unsigned long long)
Write FBX connection for the (unique) logical volume of a physical volume.
void addConnections(G4VPhysicalVolume *, int)
Write FBX connections among all of the nodes in the tree (recursive)
void writeSolidToPV(const std::string &, const std::string &, bool, unsigned long long, unsigned long long, unsigned long long)
Write FBX connection for each physical volume's solid and color info (bypass singleton logical volume...
std::vector< bool > * m_Visible
Flag to indicate that the logical volume is visible.
std::vector< bool > * m_LVUnique
Flag to indicate that a logical volume is referenced at most once (eligible for bypass)
std::vector< std::string > * m_PVName
Modified (legal-character and unique) physical-volume name.
void writePVToParentPV(const std::string &, const std::string &, unsigned long long, unsigned long long)
Write FBX connection for each physical-volume daughter of a parent physical volume (bypass singleton ...
void writeSolidToLV(const std::string &, const std::string &, bool, unsigned long long, unsigned long long, unsigned long long)
Write FBX connection for each logical volume's solid and color info.

◆ addModels()

void addModels ( G4VPhysicalVolume *  physVol,
int  replica 
)
private

Process one physical volume for FBX-node writing (recursive)

Definition at line 295 of file FBXWriterModule.cc.

296{
297 // Descend to the leaves of the tree
298 G4LogicalVolume* logVol = physVol->GetLogicalVolume();
299 for (size_t daughter = 0; daughter < logVol->GetNoDaughters(); ++daughter) {
300 G4VPhysicalVolume* physVolDaughter = logVol->GetDaughter(daughter);
301 for (int j = 0; j < physVolDaughter->GetMultiplicity(); ++j) {
302 addModels(physVolDaughter, j);
303 }
304 }
305
306 // Write the physical- and logical-volume models as we ascend the recursive tree
307 G4PhysicalVolumeStore* pvStore = G4PhysicalVolumeStore::GetInstance();
308 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
309 int pvIndex = std::find(pvStore->begin(), pvStore->end(), physVol) - pvStore->begin();
310 unsigned long long pvID = (*m_PVID)[pvIndex];
311 unsigned int pvCount = (*m_PVCount)[pvIndex];
312 std::string pvName = (*m_PVName)[pvIndex];
313 int lvIndex = std::find(lvStore->begin(), lvStore->end(), logVol) - lvStore->begin();
314 unsigned long long lvID = (*m_LVID)[lvIndex];
315 unsigned int lvCount = (*m_LVCount)[lvIndex];
316 std::string lvName = (*m_LVName)[lvIndex];
317 if ((*m_LVUnique)[lvIndex]) writeMaterialNode(lvIndex, (*m_PVName)[pvIndex]);
318 if (physVol->IsReplicated()) {
319 G4VSolid* solid = logVol->GetSolid();
320 G4SolidStore* solidStore = G4SolidStore::GetInstance();
321 int solidIndex = std::find(solidStore->begin(), solidStore->end(), solid) - solidStore->begin();
322 unsigned long long solidID = (*m_SolidID)[solidIndex];
323 EAxis axis;
324 G4int nReplicas;
325 G4double width;
326 G4double offset;
327 G4bool consuming;
328 physVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
329 physVol->SetCopyNo(replica);
330 G4VPVParameterisation* physParameterisation = physVol->GetParameterisation();
331 if (physParameterisation) { // parameterised volume
332 G4VSolid* solidReplica = physParameterisation->ComputeSolid(replica, physVol);
333 physParameterisation->ComputeTransformation(replica, physVol);
334 solidReplica->ComputeDimensions(physParameterisation, replica, physVol);
335 if (!(*solidReplica == *solid)) {
336 std::string solidName = (*m_SolidName)[solidIndex];
337 solidName.append("_R");
338 solidName.append(std::to_string(replica));
339 writeGeometryNode(solidReplica, solidName, solidID + 0x00010000 * replica);
340 }
341 if (m_UsePrototypes && (*solidReplica == *solid)) {
342 if ((replica == 0) && (lvCount == 0)) {
343 if (!(*m_LVUnique)[lvIndex]) writeLVModelNode((*lvStore)[lvIndex], lvName, lvID);
344 }
345 } else {
346 // DIVOT lvName.append("_R");
347 // DIVOT lvName.append(std::to_string(replica));
348 // DIVOT writeLVModelNode((*lvStore)[lvIndex], lvName, lvID+0x00010000*replica+lvCount);
349 }
350 pvName.append("_R");
351 pvName.append(std::to_string(replica));
352 writePVModelNode(physVol, pvName, pvID + 0x00010000 * replica + pvCount);
353 } else { // plain replicated volume
354 G4RotationMatrix* originalRotation = physVol->GetRotation();
355 G4ThreeVector translation; // No translation
356 G4RotationMatrix rotation; // No rotation
357 switch (axis) {
358 default:
359 case kXAxis:
360 translation.setX(width * (replica - 0.5 * (nReplicas - 1)));
361 physVol->SetTranslation(translation);
362 break;
363 case kYAxis:
364 translation.setY(width * (replica - 0.5 * (nReplicas - 1)));
365 physVol->SetTranslation(translation);
366 break;
367 case kZAxis:
368 translation.setZ(width * (replica - 0.5 * (nReplicas - 1)));
369 physVol->SetTranslation(translation);
370 break;
371 case kRho:
372 if (solid->GetEntityType() == "G4Tubs") {
373 double originalRMin = ((G4Tubs*)solid)->GetInnerRadius();
374 double originalRMax = ((G4Tubs*)solid)->GetOuterRadius();
375 ((G4Tubs*)solid)->SetInnerRadius(offset + width * replica);
376 ((G4Tubs*)solid)->SetOuterRadius(offset + width * (replica + 1));
377 std::string solidName = (*m_SolidName)[solidIndex];
378 solidName.append("_R");
379 solidName.append(std::to_string(replica));
380 writeGeometryNode(solid, solidName, (*m_SolidID)[solidIndex] + 0x00010000 * replica);
381 ((G4Tubs*)solid)->SetInnerRadius(originalRMin);
382 ((G4Tubs*)solid)->SetOuterRadius(originalRMax);
383 } else if (replica == 0) {
384 B2WARNING("Built-in volumes replicated along radius for " << solid->GetEntityType() <<
385 " (solid " << solid->GetName() << ") are not visualisable.");
386 }
387 break;
388 case kPhi:
389 physVol->SetRotation(&(rotation.rotateZ(-(offset + (replica + 0.5) * width))));
390 break;
391 }
392 if (m_UsePrototypes && !((axis == kRho) && (solid->GetEntityType() == "G4Tubs"))) {
393 if ((replica == 0) && (lvCount == 0)) {
394 if (!(*m_LVUnique)[lvIndex]) writeLVModelNode((*lvStore)[lvIndex], lvName, lvID);
395 }
396 } else {
397 // DIVOT lvName.append("_R");
398 // DIVOT lvName.append(std::to_string(replica));
399 // DIVOT writeLVModelNode((*lvStore)[lvIndex], lvName, lvID+0x00010000*replica+lvCount);
400 }
401 pvName.append("_R");
402 pvName.append(std::to_string(replica));
403 writePVModelNode(physVol, pvName, pvID + 0x00010000 * replica + pvCount);
404 if (axis == kPhi) physVol->SetRotation(originalRotation);
405 }
406 } else {
407 if (m_UsePrototypes) {
408 if (lvCount == 0) {
409 if (!(*m_LVUnique)[lvIndex]) writeLVModelNode((*lvStore)[lvIndex], lvName, lvID);
410 }
411 if (pvCount == 0) writePVModelNode(physVol, pvName, pvID);
412 } else {
413 // DIVOT writeLVModelNode((*lvStore)[lvIndex], lvName, lvID+lvCount);
414 writePVModelNode(physVol, pvName, pvID + pvCount);
415 }
416 (*m_LVCount)[lvIndex]++;
417 (*m_PVCount)[pvIndex]++;
418 }
419}
void addModels(G4VPhysicalVolume *, int)
Process one physical volume for FBX-node writing (recursive)
void writePVModelNode(G4VPhysicalVolume *, const std::string &, unsigned long long)
Write FBX definition for each physical volume.
void writeLVModelNode(G4LogicalVolume *, const std::string &, unsigned long long)
Write FBX definition for each logical volume.
std::vector< unsigned long long > * m_SolidID
Unique identifiers for solids (Geometry nodes)
void writeMaterialNode(int, const std::string &)
Write FBX definition for each logical volume's color information.
void writeGeometryNode(G4VSolid *, const std::string &, unsigned long long)
Write FBX definition for each solid's polyhedron.

◆ assignName()

void assignName ( std::vector< std::string > *  names,
unsigned int  index,
const G4String &  originalName,
int  select 
)
private

Create unique and legal name for each solid, logical volume, physical volume.

Definition at line 186 of file FBXWriterModule.cc.

187{
188 G4PhysicalVolumeStore* pvStore = G4PhysicalVolumeStore::GetInstance();
189 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
190 G4SolidStore* solidStore = G4SolidStore::GetInstance();
191
192 G4String name = originalName;
193 if (name.length() == 0) { name = "anonymous"; }
194 // Replace problematic characters with underscore
195 for (char c : " .,:;?'\"*+-=|^!/@#$\\%{}[]()<>") std::replace(name.begin(), name.end(), c, '_');
196 // Avoid duplicate names for entities that will be written to FBX file
197 for (int j = (int)index - 1; j >= 0; --j) {
198 if ((*names)[j].length() == 0) continue;
199 int match = 0;
200 switch (select) {
201 case 0:
202 match = (*pvStore)[j]->GetName().compare((*pvStore)[index]->GetName()); break;
203 case 1:
204 match = (*lvStore)[j]->GetName().compare((*lvStore)[index]->GetName()); break;
205 case 2:
206 match = (*solidStore)[j]->GetName().compare((*solidStore)[index]->GetName()); break;
207 }
208 if (match == 0) {
209 if (name.length() == (*names)[j].length()) {
210 (*names)[j].append("_1");
211 }
212 int n = std::stoi((*names)[j].substr(name.length() + 1), nullptr);
213 name.append("_");
214 name.append(std::to_string(n + 1));
215 break;
216 }
217 }
218 (*names)[index] = name;
219}

◆ beginRun()

virtual void beginRun ( void  )
inlinevirtualinherited

Called when entering a new run.

Called at the beginning of each run, the method gives you the chance to change run dependent constants like alignment parameters, etc.

This method can be implemented by subclasses.

Reimplemented in ARICHBackgroundModule, BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, EventsOfDoomBusterModule, CosmicsAlignmentValidationModule, EnergyBiasCorrectionModule, ChargedPidMVAModule, ChargedPidMVAMulticlassModule, CurlTaggerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, ParticleVertexFitterModule, PhotonEfficiencySystematicsModule, TagVertexModule, TreeFitterModule, arichBtestModule, ARICHDigitizerModule, ARICHDQMModule, ARICHRateCalModule, ARICHReconstructorModule, B2BIIMCParticlesMonitorModule, B2BIIConvertBeamParamsModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCRTestModule, cdcDQM7Module, CDCDQMModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, ElapsedTimeModule, DeSerializerPXDModule, GenRawSendModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageSerializerModule, IPDQMModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDMVAModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMConnectedRegionsModule, ECLDQMEXTENDEDModule, ECLDQMOutOfTimeDigitsModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLLOMModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, HistoModule, SubEventModule, SwitchDataStoreModule, EventInfoPrinterModule, EventLimiterModule, IoVDependentConditionModule, ProgressModule, RandomBarrierModule, GearboxModule, HistoManagerModule, StatisticsSummaryModule, SeqRootInputModule, SeqRootOutputModule, RxModule, TxModule, EvtGenDecayModule, EvtGenInputModule, OverrideGenerationFlagsModule, KKGenInputModule, CreateFieldMapModule, ExportGeometryModule, SoftwareTriggerModule, SoftwareTriggerHLTDQMModule, StatisticsTimingHLTDQMModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterAnaModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDigitTimeShifterModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, MVAExpertModule, MVAMultipleExpertsModule, MVAPrototypeModule, AWESOMEBasicModule, PXDBackgroundModule, PXDRawDQMChipsModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDClusterizerModule, Convert2RawDetModule, CDCDedxDQMModule, CDCDedxValidationModule, EventT0DQMModule, EventT0ValidationModule, DataWriterModule, ECLExpertModule, KLMExpertModule, KlongValidationModule, KLMMuonIDDNNExpertModule, FullSimModule, MaterialScanModule, SVDBackgroundModule, SVDClusterCalibrationsMonitorModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsCheckModule, SVDLocalCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDTimeCalibrationsMonitorModule, SVDDQMHitTimeModule, svdDumpModule, SVDPackerModule, SVDB4CommissioningPlotsModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDMaxStripTTreeModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPerformanceTTreeModule, SVDShaperDigitsFromTracksModule, SVDClusterizerModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVDMissingAPVsClusterCreatorModule, SVDRecoDigitCreatorModule, SVD3SamplesEmulatorModule, SVDDigitizerModule, SVDEventInfoSetterModule, SVDTriggerQualityGeneratorModule, SVDSpacePointCreatorModule, SVDTimeGroupingModule, SVDUnpackerModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelMaskerModule, TOPChannelT0MCModule, TOPDigitizerModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPDQMModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTimeRecalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, DQMHistoModuleBase, SVDEventT0EstimatorModule, ExtModule, FlipQualityModule, BeamSpotMonitorModule, KinkFinderModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, PXDROIFinderModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, TrackCreatorModule, TrackFinderMCTruthRecoTracksModule, EffPlotsModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, TrackQualityEstimatorMVAModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDSimpleClusterizerModule, QualityEstimatorVXDModule, VXDQETrainingDataCollectorModule, VXDQualityEstimatorMVAModule, SectorMapBootstrapModule, SegmentNetworkProducerModule, TrackFinderVXDBasicPathFinderModule, TrackFinderVXDCellOMatModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerNDFinderModule, CDCTriggerTSFModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, CDCTriggerUnpackerModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLEventTimingDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, VXDMisalignmentModule, DQMHistAnalysisARICHModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputRootFileModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTrackingHLTModule, DQMHistAnalysisTRGECLModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, DAQMonitorModule, DelayDQMModule, V0ObjectsDQMModule, ECLDQMInjectionModule, PyModule, PXDBgTupleProducerModule, PXDMCBgTupleProducerModule, PXDDAQDQMModule, PXDDQMClustersModule, PXDDQMCorrModule, PXDDQMEfficiencyModule, PXDDQMEfficiencySelftrackModule, PXDDQMExpressRecoModule, PXDGatedDHCDQMModule, PXDGatedModeDQMModule, PXDInjectionDQMModule, PXDRawDQMCorrModule, PXDRawDQMModule, PXDROIDQMModule, PXDTrackClusterDQMModule, PXDDigitizerModule, PXDPackerModule, PXDUnpackerModule, TTDDQMModule, DetectorOccupanciesDQMModule, SVDDQMClustersOnTrackModule, SVDDQMDoseModule, SVDDQMExpressRecoModule, SVDDQMInjectionModule, SVDUnpackerDQMModule, PXDclusterFilterModule, PXDdigiFilterModule, PXDROIFinderAnalysisModule, TrackingAbortDQMModule, VXDDQMExpressRecoModule, vxdDigitMaskingModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisTRGModule, DQMHistInjectionModule, and DQMHistOutputToEPICSModule.

Definition at line 147 of file Module.h.

147{};

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

180{
182 newModule->m_moduleParamList.setParameters(getParamList());
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
const ModuleParamList & getParamList() const
Return module param list.
Definition: Module.h:363
const std::string & getName() const
Returns the name of the module.
Definition: Module.h:187
const std::string & getType() const
Returns the type of the module (i.e.
Definition: Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition: Module.h:512
LogConfig m_logConfig
The log system configuration of the module.
Definition: Module.h:514
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition: Module.h:521
std::string m_package
Package this module is found in (may be empty).
Definition: Module.h:510
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:43

◆ countEntities()

void countEntities ( G4VPhysicalVolume *  physVol)
private

Count the physical volumes, logical volumes, materials and solids (recursive)

Definition at line 421 of file FBXWriterModule.cc.

422{
423 // Descend to the leaves of the tree
424 G4LogicalVolume* logVol = physVol->GetLogicalVolume();
425 for (size_t daughter = 0; daughter < logVol->GetNoDaughters(); ++daughter) {
426 G4VPhysicalVolume* physVolDaughter = logVol->GetDaughter(daughter);
427 for (int j = 0; j < physVolDaughter->GetMultiplicity(); ++j) {
428 countEntities(physVolDaughter);
429 }
430 }
431 // Count replicas and duplicates of each physical and logical volume as well as the unique
432 // versions of replicated solids as we ascend the recursive tree
433 G4PhysicalVolumeStore* pvStore = G4PhysicalVolumeStore::GetInstance();
434 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
435 G4SolidStore* solidStore = G4SolidStore::GetInstance();
436 G4VSolid* solid = logVol->GetSolid();
437 int pvIndex = std::find(pvStore->begin(), pvStore->end(), physVol) - pvStore->begin();
438 int lvIndex = std::find(lvStore->begin(), lvStore->end(), logVol) - lvStore->begin();
439 int solidIndex = std::find(solidStore->begin(), solidStore->end(), solid) - solidStore->begin();
440 if (physVol->IsReplicated()) {
441 EAxis axis;
442 G4int nReplicas;
443 G4double width;
444 G4double offset;
445 G4bool consuming;
446 physVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
447 G4VPVParameterisation* physParameterisation = physVol->GetParameterisation();
448 if (physParameterisation) { // parameterised volume
449 G4VSolid* solidReplica = physParameterisation->ComputeSolid(0, physVol);
450 physParameterisation->ComputeTransformation(0, physVol);
451 solidReplica->ComputeDimensions(physParameterisation, 0, physVol);
452 if (!(*solidReplica == *solid))(*m_SolidReplicas)[solidIndex]++;
453 if (m_UsePrototypes && (*solidReplica == *solid)) {
454 if ((*m_LVReplicas)[lvIndex] > 0)(*m_LVUnique)[lvIndex] = false;
455 (*m_LVReplicas)[lvIndex] = 1;
456 } else {
457 (*m_LVReplicas)[lvIndex]++;
458 }
459 (*m_PVReplicas)[pvIndex]++;
460 } else { // plain replicated volume
461 if ((axis == kRho) && (solid->GetEntityType() == "G4Tubs"))(*m_SolidReplicas)[solidIndex]++;
462 if (m_UsePrototypes && !((axis == kRho) && (solid->GetEntityType() == "G4Tubs"))) {
463 (*m_LVReplicas)[lvIndex] = 1;
464 } else {
465 (*m_LVReplicas)[lvIndex]++;
466 }
467 (*m_PVReplicas)[pvIndex]++;
468 }
469 } else {
470 if ((*m_LVCount)[lvIndex] > 0)(*m_LVUnique)[lvIndex] = false;
471 if (m_UsePrototypes) {
472 (*m_PVCount)[pvIndex] = 1;
473 (*m_LVCount)[lvIndex] = 1;
474 } else {
475 (*m_PVCount)[pvIndex]++;
476 (*m_LVCount)[lvIndex]++;
477 }
478 }
479}
std::vector< unsigned int > * m_LVReplicas
Count of number of replicas of each logical volume associated with a replicated physical volume.
void countEntities(G4VPhysicalVolume *)
Count the physical volumes, logical volumes, materials and solids (recursive)
std::vector< unsigned int > * m_LVCount
Count of number of instances of each logical volume.

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

426{ beginRun(); }
virtual void beginRun()
Called when entering a new run.
Definition: Module.h:147

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

439{ endRun(); }
virtual void endRun()
This method is called if the current run ends.
Definition: Module.h:166

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

432{ event(); }
virtual void event()
This method is the core of the module.
Definition: Module.h:157

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

420{ initialize(); }
virtual void initialize()
Initialize the Module.
Definition: Module.h:109

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

445{ terminate(); }
virtual void terminate()
This method is called at the end of the event processing.
Definition: Module.h:176

◆ endRun()

virtual void endRun ( void  )
inlinevirtualinherited

This method is called if the current run ends.

Use this method to store information, which should be aggregated over one run.

This method can be implemented by subclasses.

Reimplemented in BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, AlignDQMModule, CosmicsAlignmentValidationModule, CurlTaggerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, arichBtestModule, ARICHDQMModule, B2BIIMCParticlesMonitorModule, B2BIIConvertMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, TPCStudyModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCRTestModule, cdcDQM7Module, CDCDQMModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, ElapsedTimeModule, DeSerializerPXDModule, GenRawSendModule, Root2RawModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMEXTENDEDModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLLOMModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, HistoModule, SubEventModule, SwitchDataStoreModule, EventInfoPrinterModule, RandomBarrierModule, HistoManagerModule, StatisticsSummaryModule, SeqRootInputModule, SeqRootOutputModule, RxModule, TxModule, ZMQTxInputModule, ZMQTxWorkerModule, EvtGenDecayModule, OverrideGenerationFlagsModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, AWESOMEBasicModule, PXDBackgroundModule, PXDClustersFromTracksModule, PXDPerformanceModule, Convert2RawDetModule, PrintDataModule, PrintEventRateModule, Root2BinaryModule, CDCDedxDQMModule, CDCDedxValidationModule, EventT0ValidationModule, DataWriterModule, KlongValidationModule, KLMMuonIDDNNExpertModule, FullSimModule, SVDBackgroundModule, SVDClusterCalibrationsMonitorModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDTimeCalibrationsMonitorModule, svdDumpModule, SVDPackerModule, SVDB4CommissioningPlotsModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDShaperDigitsFromTracksModule, SVDClusterizerModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVDRecoDigitCreatorModule, SVD3SamplesEmulatorModule, SVDTriggerQualityGeneratorModule, SVDUnpackerModule, TOPBackgroundModule, TOPChannelT0MCModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPMCTrackMakerModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPWaveformQualityPlotterModule, TOPXTalkChargeShareSetterModule, ExtModule, GenfitVisModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, MCSlowPionPXDROICreatorModule, PXDROIFinderModule, SVDROIDQMModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, RT2SPTCConverterModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, TrackFinderMCTruthRecoTracksModule, EffPlotsModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDSimpleClusterizerModule, NoKickCutsEvalModule, SectorMapBootstrapModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerNDFinderModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, PyModule, SVDUnpackerDQMModule, TrackSetEvaluatorHopfieldNNDEVModule, vxdDigitMaskingModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisTRGModule, and DQMHistOutputToEPICSModule.

Definition at line 166 of file Module.h.

166{};

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition: Module.h:519
bool m_hasReturnValue
True, if the return value is set.
Definition: Module.h:518

◆ event()

void event ( void  )
overridevirtual

Called for each event: this runs the FBX writer only for the first event.

Reimplemented from Module.

Definition at line 51 of file FBXWriterModule.cc.

52{
53 if (!m_First) return;
54 m_First = false;
55 G4VPhysicalVolume* topVol = geometry::GeometryManager::getInstance().getTopVolume();
56 if (!topVol) {
57 B2ERROR("No geometry found: add the Geometry module to the path before the FBXWriter module.");
58 return;
59 }
60
61 G4PhysicalVolumeStore* pvStore = G4PhysicalVolumeStore::GetInstance();
62 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
63 G4SolidStore* solidStore = G4SolidStore::GetInstance();
64
65 // Assign legal and unique names to each used physical volume, logical volume and solid
66 m_PVName = new std::vector<std::string>(pvStore->size(), "");
67 m_LVName = new std::vector<std::string>(lvStore->size(), "");
68 m_SolidName = new std::vector<std::string>(solidStore->size(), "");
69 for (G4VPhysicalVolume* physVol : *pvStore) {
70 int pvIndex = std::find(pvStore->begin(), pvStore->end(), physVol) - pvStore->begin();
71 if ((*m_PVName)[pvIndex].length() == 0) {
72 assignName(m_PVName, pvIndex, physVol->GetName(), 0);
73 G4LogicalVolume* logVol = physVol->GetLogicalVolume();
74 int lvIndex = std::find(lvStore->begin(), lvStore->end(), logVol) - lvStore->begin();
75 if ((*m_LVName)[lvIndex].length() == 0) {
76 assignName(m_LVName, lvIndex, logVol->GetName(), 1);
77 G4VSolid* solid = logVol->GetSolid();
78 int solidIndex = std::find(solidStore->begin(), solidStore->end(), solid) - solidStore->begin();
79 if ((*m_SolidName)[solidIndex].length() == 0) {
80 assignName(m_SolidName, solidIndex, solid->GetName(), 2);
81 }
82 }
83 }
84 }
85
86 // Count the number of references to each physical volume and logical volume and solid
87 // so that these values can be placed in the FBX file's Definitions{} section.
88 m_PVCount = new std::vector<unsigned int>(pvStore->size(), 0);
89 m_LVCount = new std::vector<unsigned int>(lvStore->size(), 0);
90 m_SolidCount = new std::vector<unsigned int>(solidStore->size(), 0);
91 m_PVReplicas = new std::vector<unsigned int>(pvStore->size(), 0);
92 m_LVReplicas = new std::vector<unsigned int>(lvStore->size(), 0);
93 m_SolidReplicas = new std::vector<unsigned int>(solidStore->size(), 0);
94 m_LVUnique = new std::vector<bool>(lvStore->size(), true);
95 countEntities(topVol);
96 unsigned int geometryCount = 0;
97 unsigned int materialCount = 0;
98 unsigned int modelCount = 0;
99 for (unsigned int pvIndex = 0; pvIndex < pvStore->size(); ++pvIndex) {
100 if ((*m_PVName)[pvIndex].length() > 0) {
101 modelCount += (*m_PVCount)[pvIndex] + (*m_PVReplicas)[pvIndex];
102 }
103 }
104 for (unsigned int lvIndex = 0; lvIndex < lvStore->size(); ++lvIndex) {
105 if ((*m_LVName)[lvIndex].length() > 0) {
106 if (!(*m_LVUnique)[lvIndex]) {
107 modelCount += (*m_LVCount)[lvIndex] + (*m_LVReplicas)[lvIndex];
108 }
109 materialCount++;
110 }
111 }
112 for (unsigned int solidIndex = 0; solidIndex < solidStore->size(); ++solidIndex) {
113 if ((*m_SolidName)[solidIndex].length() > 0) {
114 geometryCount += (*m_SolidCount)[solidIndex] + (*m_SolidReplicas)[solidIndex] + 1;
115 }
116 }
117
118 m_File.open(m_Filename, std::ios_base::trunc);
119 writePreamble(modelCount, materialCount, geometryCount);
120
121 // Write all solids as Geometry nodes (replicas are written later).
122 // Write all logical volumes as Material nodes (color information).
123 // Write all physical and logical volumes as Model nodes (with replica-solids treated here).
124 m_PVID = new std::vector<unsigned long long>(pvStore->size(), 0x0000010000000000LL);
125 m_LVID = new std::vector<unsigned long long>(lvStore->size(), 0x000000C000000000LL);
126 m_SolidID = new std::vector<unsigned long long>(solidStore->size(), 0x0000008000000000LL);
127 m_MatID = new std::vector<unsigned long long>(lvStore->size(), 0x0000004000000000LL);
128 m_Visible = new std::vector<bool>(lvStore->size(), false);
129 m_File << "Objects: {" << std::endl;
130 for (unsigned int solidIndex = 0; solidIndex < solidStore->size(); ++solidIndex) {
131 (*m_SolidID)[solidIndex] += 0x0000000001000000LL * solidIndex;
132 if ((*m_SolidName)[solidIndex].length() > 0) {
133 for (unsigned int solidCount = 0; solidCount <= (*m_SolidCount)[solidIndex]; ++solidCount) { // note lower and upper limits!
134 writeGeometryNode((*solidStore)[solidIndex], (*m_SolidName)[solidIndex], (*m_SolidID)[solidIndex] + solidCount);
135 }
136 }
137 }
138 for (unsigned int lvIndex = 0; lvIndex < lvStore->size(); ++lvIndex) {
139 (*m_MatID)[lvIndex] += 0x0000000001000000LL * lvIndex;
140 (*m_LVID)[lvIndex] += 0x0000000001000000LL * lvIndex;
141 if ((*m_LVName)[lvIndex].length() > 0) {
142 if (!(*m_LVUnique)[lvIndex]) writeMaterialNode(lvIndex, (*m_LVName)[lvIndex]);
143 }
144 }
145 for (unsigned int pvIndex = 0; pvIndex < pvStore->size(); ++pvIndex) {
146 (*m_PVID)[pvIndex] += 0x0000000001000000LL * pvIndex;
147 }
148 m_PVCount->assign(pvStore->size(), 0);
149 m_LVCount->assign(lvStore->size(), 0);
150 m_SolidCount->assign(solidStore->size(), 0);
151 addModels(topVol, 0);
152 m_File << "}" << std::endl << std::endl;
153
154 // Recursively write the connections among the solid and logical/physical volume elements
155 m_PVCount->assign(pvStore->size(), 0);
156 m_LVCount->assign(lvStore->size(), 0);
157 m_SolidCount->assign(solidStore->size(), 0);
158 m_File << "Connections: {" << std::endl;
159 addConnections(topVol, 0);
160 int pvIndex = std::find(pvStore->begin(), pvStore->end(), topVol) - pvStore->begin();
161 m_File << "\t; Physical volume Model::" << (*m_PVName)[pvIndex] << " to Model::RootNode" << std::endl <<
162 "\tC: \"OO\"," << (*m_PVID)[pvIndex] << ",0" << std::endl << std::endl <<
163 "}" << std::endl << std::endl;
164
165 m_File << "Takes: {" << std::endl <<
166 "\tCurrent: \"\"" << std::endl <<
167 "}" << std::endl;
168
169 m_File.close();
170 B2INFO("FBX written to " << m_Filename);
171
172 delete m_PVName;
173 delete m_LVName;
174 delete m_SolidName;
175 delete m_PVID;
176 delete m_LVID;
177 delete m_MatID;
178 delete m_SolidID;
179 delete m_PVCount;
180 delete m_LVCount;
181 delete m_SolidCount;
182 delete m_Visible;
183
184}
std::vector< unsigned int > * m_PVCount
Count of number of instances of each physical volume.
std::vector< unsigned long long > * m_LVID
Unique identifiers for logical volumes (Model nodes with links to Geometry and Material)
std::vector< unsigned int > * m_PVReplicas
Count of number of replicas of each replicated physical volume.
std::ofstream m_File
Output file.
std::vector< unsigned long long > * m_PVID
Unique identifiers for physical volumes (Model nodes with transformation information)
bool m_First
Once-only flag to write FBX only on the first event.
void writePreamble(int, int, int)
Write FBX at the start of the file.
void assignName(std::vector< std::string > *, unsigned int, const G4String &, int)
Create unique and legal name for each solid, logical volume, physical volume.
std::vector< unsigned int > * m_SolidCount
Count of number of instances of each solid (typically 1)
std::vector< unsigned int > * m_SolidReplicas
Count of number of replicas of each solid (extras for replicas with modified solids)
std::vector< std::string > * m_SolidName
Modified (legal-character and unique) solid name.
std::vector< unsigned long long > * m_MatID
Unique identifiers for logical volumes' color information (Material nodes)
std::vector< std::string > * m_LVName
Modified (legal-character and unique) logical-volume name.
G4VPhysicalVolume * getTopVolume()
Return a pointer to the top volume.
static GeometryManager & getInstance()
Return a reference to the instance.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional pathes */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 When using parallel processing, call this module's terminate() function in all processes. This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.
372)")
373 .value("INPUT", Module::EModulePropFlags::c_Input)
374 .value("OUTPUT", Module::EModulePropFlags::c_Output)
375 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
376 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
377 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
378 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
379 ;
380
381 //Python class definition
382 class_<Module, PyModule> module("Module", R"(
383Base class for Modules.
384
385A module is the smallest building block of the framework.
386A typical event processing chain consists of a Path containing
387modules. By inheriting from this base class, various types of
388modules can be created. To use a module, please refer to
389:func:`Path.add_module()`. A list of modules is available by running
390``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
391given by e.g. ``basf2 -m RootInput``.
392
393The 'Module Development' section in the manual provides detailed information
394on how to create modules, setting parameters, or using return values/conditions:
395https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
396
397)");
398 module
399 .def("__str__", &Module::getPathString)
400 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
401 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
402 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
403 "Returns the type of the module (i.e. class name minus 'Module')")
404 .def("set_name", &Module::setName, args("name"), R"(
405Set custom name, e.g. to distinguish multiple modules of the same type.
406
407>>> path.add_module('EventInfoSetter')
408>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
409>>> ro.set_name('RootOutput_metadata_only')
410>>> print(path)
411[EventInfoSetter -> RootOutput_metadata_only]
412
413)")
414 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
415 "Returns the description of this module.")
416 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
417 "Returns the package this module belongs to.")
418 .def("available_params", &_getParamInfoListPython,
419 "Return list of all module parameters as `ModuleParamInfo` instances")
420 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
421 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
422
423>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
424>>> ...
425
426Parameters:
427 properties (int): bitmask of `ModulePropFlags` to check for.
428)DOCSTRING")
429 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
430 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
431 {
432 // python signature is too crowded, make ourselves
433 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
434 module
435 .def("if_value", &Module::if_value,
436 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
437 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
438
439Sets a conditional sub path which will be executed after this
440module if the return value set in the module passes the given ``expression``.
441
442Modules can define a return value (int or bool) using ``setReturnValue()``,
443which can be used in the steering file to split the Path based on this value, for example
444
445>>> module_with_condition.if_value("<1", another_path)
446
447In case the return value of the ``module_with_condition`` for a given event is
448less than 1, the execution will be diverted into ``another_path`` for this event.
449
450You could for example set a special return value if an error occurs, and divert
451the execution into a path containing :b2:mod:`RootOutput` if it is found;
452saving only the data producing/produced by the error.
453
454After a conditional path has executed, basf2 will by default stop processing
455the path for this event. This behaviour can be changed by setting the
456``after_condition_path`` argument.
457
458Parameters:
459 expression (str): Expression to determine if the conditional path should be executed.
460 This should be one of the comparison operators ``<``, ``>``, ``<=``,
461 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
462 condition_path (Path): path to execute in case the expression is fulfilled
463 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
464)DOCSTRING")
465 .def("if_false", &Module::if_false,
466 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
467 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
468
469Sets a conditional sub path which will be executed after this module if
470the return value of the module evaluates to False. This is equivalent to
471calling `if_value` with ``expression=\"<1\"``)DOC")
472 .def("if_true", &Module::if_true,
473 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
474 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
475
476Sets a conditional sub path which will be executed after this module if
477the return value of the module evaluates to True. It is equivalent to
478calling `if_value` with ``expression=\">=1\"``)DOC");
479 }
480 module
481 .def("has_condition", &Module::hasCondition,
482 "Return true if a conditional path has been set for this module "
483 "using `if_value`, `if_true` or `if_false`")
484 .def("get_all_condition_paths", &_getAllConditionPathsPython,
485 "Return a list of all conditional paths set for this module using "
486 "`if_value`, `if_true` or `if_false`")
487 .def("get_all_conditions", &_getAllConditionsPython,
488 "Return a list of all conditional path expressions set for this module using "
489 "`if_value`, `if_true` or `if_false`")
490 .add_property("logging", make_function(&Module::getLogConfig, return_value_policy<reference_existing_object>()),
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">"
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "=="
@ c_ST
Smaller than: "<"
Base class for Modules.
Definition: Module.h:72
LogConfig & getLogConfig()
Returns the log system configuration.
Definition: Module.h:225
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition: Module.cc:79
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition: Module.cc:90
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:220
void setLogConfig(const LogConfig &logConfig)
Set the log system configuration.
Definition: Module.h:230
const std::string & getDescription() const
Returns the description of the module.
Definition: Module.h:202
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition: Module.cc:85
bool hasCondition() const
Returns true if at least one condition was set for the module.
Definition: Module.h:311
const std::string & getPackage() const
Returns the package this module is in.
Definition: Module.h:197
void setName(const std::string &name)
Set the name of the module.
Definition: Module.h:214
bool hasProperties(unsigned int propertyFlags) const
Returns true if all specified property flags are available in this module.
Definition: Module.cc:160
std::string getPathString() const override
return the module name.
Definition: Module.cc:192

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getBooleanSolidPolyhedron()

HepPolyhedron * getBooleanSolidPolyhedron ( G4VSolid *  solid)
private

Create polyhedron for a boolean solid (recursive)

Definition at line 1006 of file FBXWriterModule.cc.

1007{
1008 G4VSolid* solidA = solid->GetConstituentSolid(0);
1009 G4VSolid* solidB = solid->GetConstituentSolid(1);
1010 HepPolyhedron* polyhedronA = nullptr;
1011 if ((solidA->GetEntityType() == "G4IntersectionSolid") ||
1012 (solidA->GetEntityType() == "G4UnionSolid") ||
1013 (solidA->GetEntityType() == "G4SubtractionSolid") ||
1014 (solidA->GetEntityType() == "G4BooleanSolid")) {
1015 polyhedronA = getBooleanSolidPolyhedron(solidA);
1016 } else {
1017 polyhedronA = new HepPolyhedron(*(solidA->GetPolyhedron()));
1018 }
1019 HepPolyhedron* polyhedronB = nullptr;
1020 G4VSolid* solidB2 = solidB;
1021 if (solidB->GetEntityType() == "G4DisplacedSolid") {
1022 solidB2 = ((G4DisplacedSolid*)solidB)->GetConstituentMovedSolid();
1023 }
1024 if ((solidB2->GetEntityType() == "G4IntersectionSolid") ||
1025 (solidB2->GetEntityType() == "G4UnionSolid") ||
1026 (solidB2->GetEntityType() == "G4SubtractionSolid") ||
1027 (solidB2->GetEntityType() == "G4BooleanSolid")) {
1028 polyhedronB = getBooleanSolidPolyhedron(solidB2);
1029 if (solidB != solidB2) { // was solidB a G4DisplacedSolid?
1030 polyhedronB->Transform(G4Transform3D(
1031 ((G4DisplacedSolid*)solidB)->GetObjectRotation(),
1032 ((G4DisplacedSolid*)solidB)->GetObjectTranslation()));
1033 }
1034 } else {
1035 polyhedronB = new HepPolyhedron(*(solidB->GetPolyhedron()));
1036 }
1037 auto* result = new HepPolyhedron();
1038 if (solid->GetEntityType() == "G4UnionSolid") {
1039 *result = polyhedronA->add(*polyhedronB);
1040 } else if (solid->GetEntityType() == "G4SubtractionSolid") {
1041 *result = polyhedronA->subtract(*polyhedronB);
1042 } else if (solid->GetEntityType() == "G4IntersectionSolid") {
1043 *result = polyhedronA->intersect(*polyhedronB);
1044 } else {
1045 B2WARNING("getBooleanSolidPolyhedron(): Unrecognized boolean solid " << solid->GetName() <<
1046 " of type " << solid->GetEntityType());
1047 }
1048 delete polyhedronA;
1049 delete polyhedronB;
1050 return result;
1051}
HepPolyhedron * getBooleanSolidPolyhedron(G4VSolid *)
Create polyhedron for a boolean solid (recursive)

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 314 of file Module.h.

315 {
316 if (m_conditions.empty()) {
317 return nullptr;
318 } else {
319 return &m_conditions.front();
320 }
321 }

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).


Definition at line 113 of file Module.cc.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:35

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

202{return m_description;}
std::string m_description
The description of the module.
Definition: Module.h:511

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool  outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

135 {
136 return std::vector<std::string>();
137 }

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

506{ return std::list<ModulePtr>(); }

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 187 of file Module.h.

187{return m_name;}
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition: Module.h:508

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition: Module.h:516

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition: Module.h:509

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 311 of file Module.h.

311{ return not m_conditions.empty(); };

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ if_false()

void if_false ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ if_true()

void if_true ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ if_value()

void if_value ( const std::string &  expression,
const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://xwiki.desy.de/xwiki/rest/p/a94f2 or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initialize()

void initialize ( void  )
overridevirtual

Initialize at the start of a job.

Reimplemented from Module.

Definition at line 46 of file FBXWriterModule.cc.

47{
48 m_First = true;
49}

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition: LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition: LogConfig.h:98

◆ setDescription()

void setDescription ( const std::string &  description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition: LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition: LogConfig.cc:25

◆ setName()

void setName ( const std::string &  name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

void setParamPython ( const std::string &  name,
const boost::python::object &  pyObj 
)
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
Class for logging debug, info and error messages.
Definition: LogSystem.h:46
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition: LogSystem.h:191
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict &  dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition: Module.cc:234

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ setType()

void setType ( const std::string &  type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ terminate()

virtual void terminate ( void  )
inlinevirtualinherited

This method is called at the end of the event processing.

This method is called only once after the event processing finished. Use this method for cleaning up, closing files, etc.

This method can be implemented by subclasses.

Reimplemented in ARICHBackgroundModule, BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, CosmicsAlignmentValidationModule, CurlTaggerModule, EventKinematicsModule, FlavorTaggerInfoFillerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, ParticleKinematicFitterModule, ParticleLoaderModule, ParticleMassHypothesesUpdaterModule, ParticleMassUpdaterModule, ParticleMCDecayStringModule, ParticleMomentumUpdaterModule, ParticleStatsModule, ParticleWeightingLookUpCreatorModule, RemoveParticlesNotInListsModule, SkimFilterModule, TreeFitterModule, VariablesToEventBasedTreeModule, VariablesToHistogramModule, VariablesToNtupleModule, arichBtestModule, ARICHNtupleModule, arichToNtupleModule, B2BIIMCParticlesMonitorModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCrossTalkAdderModule, CDCCRTestModule, CDCDigitizerModule, cdcDQM7Module, CDCDQMModule, ScanCDCGeoModule, CDCInitialT0DeterminationModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, ElapsedTimeModule, DeSerializerModule, DeSerializerPXDModule, GenRawSendModule, Root2RawModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, DisplayModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLClusterPSDModule, ECLCompressBGOverlayModule, ECLCovarianceMatrixModule, ECLCRFinderModule, EclCovMatrixNtupleModule, ECLDataAnalysisModule, ECLDigiStudyModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMEXTENDEDModule, ECLFillCellIdMappingModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLOMModule, ECLMatchingPerformanceExpertModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLTrackClusterMatchingModule, ECLTrackClusterMatchingParametrizationExpertModule, ECLTrackClusterMatchingPerformanceModule, ECLTRGInformationModule, ECLTrimShowersAndDigitsModule, ECLUnpackerModule, eclWaveformCalibCollectorModule, ECLWaveformFitModule, HistoModule, MergeDataStoreModule, SubEventModule, SwitchDataStoreModule, ProgressBarModule, RandomBarrierModule, HistoManagerModule, ProfileModule, RootInputModule, RootOutputModule, SeqRootInputModule, SeqRootOutputModule, AsyncWrapper, RxModule, TxModule, ZMQRxOutputModule, ZMQRxWorkerModule, ZMQTxInputModule, ZMQTxWorkerModule, AafhInputModule, BabayagaNLOInputModule, BBBremInputModule, BHWideInputModule, CRYInputModule, EvtGenDecayModule, FragmentationModule, HepMCInputModule, HepMCOutputModule, GeneratedVertexDisplacerModule, GeneratorPreselectionModule, HepevtOutputModule, OverrideGenerationFlagsModule, RemoveMCParticlesModule, KKGenInputModule, KoralWInputModule, PhokharaInputModule, TeeggInputModule, TrepsInputModule, GeometryModule, SoftwareTriggerModule, SoftwareTriggerResultPrinterModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, MasterClassModule, MVAExpertModule, MVAMultipleExpertsModule, AWESOMEBasicModule, PXDBackgroundModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDSpacePointCreatorModule, CheckErrorEventModule, Convert2RawDetModule, Root2BinaryModule, CDCDedxCorrectionModule, CDCDedxDQMModule, CDCDedxPIDModule, CDCDedxScanModule, CDCDedxSkimModule, CDCDedxSkimCDSTModule, CDCDedxValidationModule, HitLevelInfoWriterModule, DataWriterModule, ECLExpertModule, KLMExpertModule, KlongValidationModule, KLMMuonIDDNNExpertModule, PIDNtupleModule, VXDDedxPIDModule, FullSimModule, FullSimTimingModule, SVDBackgroundModule, SVDChannelMappingModule, SVDHotStripFinderModule, SVDChargeSharingAnalysisModule, SVDClusterQualityEstimatorCalibrationModule, SVDClusterQualityEstimatorModule, SVDCrossTalkFinderModule, svdDumpModule, SVDPackerModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDEventT0PerformanceTTreeModule, SVDMaxStripTTreeModule, SVDPerformanceTTreeModule, SVDShaperDigitsFromTracksModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVD3SamplesEmulatorModule, SVDDigitizerModule, SVDTriggerQualityGeneratorModule, SVDSpacePointCreatorModule, SVDSpacePointQICalibrationModule, TOPAlignerModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelT0CalibratorModule, TOPChannelT0MCModule, TOPCommonT0CalibratorModule, TOPCosmicT0FinderModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPLLScannerModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPPDFCheckerModule, TOPRawDigitConverterModule, TOPRingPlotterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, ExtModule, GenfitVisModule, BeamSpotMonitorModule, KinkFinderModule, Chi2MCTrackMatcherModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, ROIReadTestModule, SVDROIFinderAnalysisDataModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, CurlingTrackCandSplitterModule, GFTC2SPTCConverterModule, PhaseSpaceAnalysisModule, RT2SPTCConverterModule, SpacePoint2TrueHitConnectorModule, SpacePointCreatorTestModule, SPTC2GFTCConverterModule, SPTCRefereeModule, TCConvertersTestModule, StandardTrackingPerformanceModule, TrackFilterModule, CollectorTestModule, StudyMaterialEffectsModule, EffPlotsModule, FillTrackFitNtupleModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, V0FinderModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDQETrainingDataCollectorModule, FastBDTClassifierAnalyzerModule, FastBDTClassifierTrainingModule, MLSegmentNetworkProducerModule, NoKickCutsEvalModule, SegmentNetworkAnalyzerModule, SPTC2RTConverterModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerHoughETFModule, CDCTrigger2DFinderModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDataModule, CDCTriggerNeuroIDHistModule, CDCTriggerTSFFirmwareModule, CDCTriggerTSFModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, CDCTriggerUnpackerModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, GRLNeuroModule, GRLNeuroTrainerModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, VXDMisalignmentModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, PyModule, PXDBgTupleProducerModule, PXDMCBgTupleProducerModule, PXDDQMEfficiencyNtupleModule, PXDDQMEfficiencyNtupleSelftrackModule, PXDDQMTrackRawNtupleModule, PXDPackerErrModule, PXDPackerModule, PXDReadRawBonnDAQModule, PXDReadRawBonnDAQMatchedModule, PXDReadRawONSENModule, PXDUnpackerModule, PXDUnpackerOldModule, PXDUnpackerOTModule, SVDDQMClustersOnTrackModule, SVDDQMExpressRecoModule, PXDROIFinderAnalysisModule, ROISenderModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisTRGModule, DQMHistOutputToEPICSModule, and ROIDQMModule.

Definition at line 176 of file Module.h.

176{};

◆ writeGeometryNode()

void writeGeometryNode ( G4VSolid *  solid,
const std::string &  solidName,
unsigned long long  solidID 
)
private

Write FBX definition for each solid's polyhedron.

Definition at line 221 of file FBXWriterModule.cc.

222{
223 if ((solid->GetEntityType() == "G4IntersectionSolid") ||
224 (solid->GetEntityType() == "G4UnionSolid") ||
225 (solid->GetEntityType() == "G4SubtractionSolid") ||
226 (solid->GetEntityType() == "G4BooleanSolid")) {
227 HepPolyhedron* polyhedron = getBooleanSolidPolyhedron(solid);
228 auto* g4polyhedron = new G4Polyhedron(*polyhedron);
229 writePolyhedron(solid, g4polyhedron, solidName, solidID);
230 delete polyhedron;
231 delete g4polyhedron;
232 } else {
233 writePolyhedron(solid, solid->GetPolyhedron(), solidName, solidID);
234 }
235}
void writePolyhedron(G4VSolid *, G4Polyhedron *, const std::string &, unsigned long long)
Write FBX definition for the solid's polyhedron.

◆ writeLVModelNode()

void writeLVModelNode ( G4LogicalVolume *  logVol,
const std::string &  lvName,
unsigned long long  lvID 
)
private

Write FBX definition for each logical volume.

Definition at line 283 of file FBXWriterModule.cc.

284{
285 m_File << "\t; LogVol " << logVol->GetName() << " with solid " << logVol->GetSolid()->GetName() << std::endl <<
286 "\tModel: " << lvID << ", \"Model::lv_" << lvName << R"(", "Null" {)" << std::endl <<
287 "\t\tVersion: 232" << std::endl <<
288 "\t\tProperties70: {" << std::endl <<
289 "\t\t}" << std::endl <<
290 "\t\tShading: T" << std::endl <<
291 "\t\tCulling: \"CullingOff\"" << std::endl <<
292 "\t}" << std::endl;
293}

◆ writeLVToPV()

void writeLVToPV ( const std::string &  pvName,
const std::string &  lvName,
unsigned long long  pvID,
unsigned long long  lvID 
)
private

Write FBX connection for the (unique) logical volume of a physical volume.

Definition at line 983 of file FBXWriterModule.cc.

985{
986 m_File << "\t; LogVol Model::lv_" << lvName << ", PhysVol Model::" << pvName << std::endl <<
987 "\tC: \"OO\"," << lvID << "," << pvID << std::endl << std::endl;
988}

◆ writeMaterialNode()

void writeMaterialNode ( int  lvIndex,
const std::string &  matName 
)
private

Write FBX definition for each logical volume's color information.

Definition at line 237 of file FBXWriterModule.cc.

238{
239 G4LogicalVolumeStore* lvStore = G4LogicalVolumeStore::GetInstance();
240 G4LogicalVolume* logVol = (*lvStore)[lvIndex];
241 unsigned long long matID = (*m_MatID)[lvIndex];
242 G4Color color(0.0, 1.0, 0.0, 0.5); // default is semi-transparent green
243 if ((matName.compare(0, 23, "eclBarrelCrystalLogical") == 0) ||
244 (matName.compare(0, 20, "eclFwdCrystalLogical") == 0) ||
245 (matName.compare(0, 20, "eclBwdCrystalLogical") == 0) ||
246 (matName.compare(0, 24, "eclBarrelCrystalPhysical") == 0) ||
247 (matName.compare(0, 21, "eclFwdCrystalPhysical") == 0) ||
248 (matName.compare(0, 21, "eclBwdCrystalPhysical") == 0)) {
249 color = G4Color(1.0, 0.25, 0.0, 0.7); // orange since ECL crystals have no G4VisAttribute :(
250 }
251 bool visible = true;
252 G4String materialName = logVol->GetMaterial()->GetName();
253 // Hide containers that have vacuum, air or gas
254 if (materialName == "Vacuum") visible = false;
255 if (materialName == "G4_AIR") visible = false;
256 if (materialName == "CDCGas") visible = false;
257 if (materialName == "ColdAir") visible = false;
258 if (materialName == "STR-DryAir") visible = false;
259 if (materialName == "TOPAir") visible = false;
260 if (materialName == "TOPVacuum") visible = false;
261 const G4VisAttributes* visAttr = logVol->GetVisAttributes();
262 if (visAttr) {
263 color = const_cast<G4Color&>(logVol->GetVisAttributes()->GetColor());
264 if (!(visAttr->IsVisible())) visible = false;
265 } else {
266 visible = false;
267 }
268 if (logVol->GetSensitiveDetector() != nullptr) visible = "";
269 (*m_Visible)[lvIndex] = visible;
270 m_File << "\t; Color for LogVol " << logVol->GetName() << std::endl <<
271 "\tMaterial: " << matID << ", \"Material::" << matName << R"(", "" {)" << std::endl <<
272 "\t\tVersion: 102" << std::endl <<
273 "\t\tProperties70: {" << std::endl <<
274 "\t\t\tP: \"ShadingModel\", \"KString\", \"\", \"\", \"phong\"" << std::endl <<
275 "\t\t\tP: \"DiffuseColor\", \"RGBColor\", \"Color\", \"A\"," <<
276 color.GetRed() << "," << color.GetGreen() << "," << color.GetBlue() << std::endl <<
277 "\t\t\tP: \"TransparentColor\", \"RGBColor\", \"Color\", \"A\",1,1,1" << std::endl <<
278 "\t\t\tP: \"TransparencyFactor\", \"double\", \"Number\", \"\"," << (visible ? 1.0 - color.GetAlpha() : 1) << std::endl <<
279 "\t\t}" << std::endl <<
280 "\t}" << std::endl;
281}

◆ writePolyhedron()

void writePolyhedron ( G4VSolid *  solid,
G4Polyhedron *  polyhedron,
const std::string &  name,
unsigned long long  solidID 
)
private

Write FBX definition for the solid's polyhedron.

Definition at line 845 of file FBXWriterModule.cc.

847{
848 if (polyhedron) {
849 polyhedron->SetNumberOfRotationSteps(120);
850 m_File << "\t; Solid " << solid->GetName() << " of type " << solid->GetEntityType() << std::endl <<
851 "\tGeometry: " << solidID << ", \"Geometry::" << name << R"(", "Mesh" {)" << std::endl <<
852 "\t\tVertices: *" << polyhedron->GetNoVertices() * 3 << " {" << std::endl << "\t\t\ta: ";
853 std::streampos startOfLine = m_File.tellp();
854 for (int j = 1; j <= polyhedron->GetNoVertices(); ++j) {
855 m_File << (j == 1 ? "" : ",") <<
856 polyhedron->GetVertex(j).x() << "," <<
857 polyhedron->GetVertex(j).y() << "," <<
858 polyhedron->GetVertex(j).z();
859 if (m_File.tellp() - startOfLine > 100) {
860 startOfLine = m_File.tellp();
861 m_File << std::endl << "\t\t\t\t";
862 }
863 }
864 m_File << std::endl << "\t\t}" << std::endl;
865
866 std::vector<int> vertices;
867 for (int k = 1; k <= polyhedron->GetNoFacets(); ++k) {
868 G4bool notLastEdge = true;
869 G4int ndx = -1, edgeFlag = 1;
870 do {
871 notLastEdge = polyhedron->GetNextVertexIndex(ndx, edgeFlag);
872 if (notLastEdge) {
873 vertices.push_back(ndx - 1);
874 } else {
875 vertices.push_back(-ndx);
876 }
877 } while (notLastEdge);
878 }
879 m_File << "\t\tPolygonVertexIndex: *" << vertices.size() << " {" << std::endl << "\t\t\ta: ";
880 startOfLine = m_File.tellp();
881 for (unsigned int j = 0; j < vertices.size(); ++j) {
882 m_File << (j == 0 ? "" : ",") << vertices[j];
883 if (m_File.tellp() - startOfLine > 100) {
884 startOfLine = m_File.tellp();
885 m_File << std::endl << "\t\t\t\t";
886 }
887 }
888 m_File << std::endl << "\t\t}" << std::endl;
889
890 m_File << "\t\tGeometryVersion: 124" << std::endl <<
891 "\t\tLayerElementNormal: 0 {" << std::endl <<
892 "\t\t\tVersion: 101" << std::endl <<
893 // "\t\t\tName: \"\"" << std::endl <<
894 "\t\t\tMappingInformationType: \"ByPolygonVertex\"" << std::endl <<
895 "\t\t\tReferenceInformationType: \"Direct\"" << std::endl <<
896 "\t\t\tNormals: *" << vertices.size() * 3 << " {" << std::endl << "\t\t\t\ta: ";
897 startOfLine = m_File.tellp();
898 unsigned int j = 0;
899 for (int k = 1; k <= polyhedron->GetNoFacets(); ++k) {
900 G4Normal3D normal = polyhedron->GetUnitNormal(k);
901 do {
902 m_File << (j == 0 ? "" : ",") << normal.x() << "," << normal.y() << "," << normal.z();
903 if (m_File.tellp() - startOfLine > 100) {
904 startOfLine = m_File.tellp();
905 m_File << std::endl << "\t\t\t\t";
906 }
907 } while (vertices[j++] >= 0);
908 }
909 m_File << std::endl << "\t\t\t}" << std::endl << "\t\t}" << std::endl <<
910 "\t\tLayerElementMaterial: 0 {" << std::endl <<
911 "\t\t\tVersion: 101" << std::endl <<
912 // "\t\t\tName: \"\"" << std::endl <<
913 "\t\t\tMappingInformationType: \"AllSame\"" << std::endl <<
914 "\t\t\tReferenceInformationType: \"IndexToDirect\"" << std::endl <<
915 "\t\t\tMaterials: *1 {" << std::endl <<
916 "\t\t\t\ta: 0" << std::endl <<
917 "\t\t\t}" << std::endl <<
918 "\t\t}" << std::endl <<
919 "\t\tLayer: 0 {" << std::endl <<
920 "\t\t\tVersion: 100" << std::endl <<
921 "\t\t\tLayerElement: {" << std::endl <<
922 "\t\t\t\tType: \"LayerElementNormal\"" << std::endl <<
923 "\t\t\t\tTypedIndex: 0" << std::endl <<
924 "\t\t\t}" << std::endl <<
925 "\t\t\tLayerElement: {" << std::endl <<
926 "\t\t\t\tType: \"LayerElementMaterial\"" << std::endl <<
927 "\t\t\t\tTypedIndex: 0" << std::endl <<
928 "\t\t\t}" << std::endl <<
929 "\t\t}" << std::endl <<
930 "\t}" << std::endl;
931 } else {
932 B2INFO("Polyhedron representation of solid " << name << " cannot be created");
933 }
934}

◆ writePreamble()

void writePreamble ( int  modelCount,
int  materialCount,
int  geometryCount 
)
private

Write FBX at the start of the file.

Definition at line 616 of file FBXWriterModule.cc.

617{
618 std::time_t t = std::time(nullptr);
619 struct tm* now = std::localtime(&t);
620 m_File << "; FBX 7.3.0 project file" << std::endl <<
621 "; Copyright (C) 1997-2010 Autodesk Inc. and/or its licensors." << std::endl <<
622 "; All rights reserved." << std::endl << std::endl <<
623 "FBXHeaderExtension: {" << std::endl <<
624 "\tFBXHeaderVersion: 1003" << std::endl <<
625 "\tFBXVersion: 7300" << std::endl <<
626 "\tCreationTime: \"" << std::put_time(now, "%F %T") << ":000\"" << std::endl <<
627 //"\tCreationTimeStamp: {" << std::endl <<
628 //"\t\tVersion: 1000" << std::endl <<
629 //"\t\tYear: " << now->tm_year + 1900 << std::endl <<
630 //"\t\tMonth: " << now->tm_mon + 1 << std::endl <<
631 //"\t\tDay: " << now->tm_mday << std::endl <<
632 //"\t\tHour: " << now->tm_hour << std::endl <<
633 //"\t\tMinute: " << now->tm_min << std::endl <<
634 //"\t\tSecond: " << now->tm_sec << std::endl <<
635 //"\t\tMillisecond: 0" << std::endl <<
636 //"\t}" << std::endl <<
637 "\tCreator: \"FBX SDK/FBX Plugins version 2013.3\"" << std::endl <<
638 "\tSceneInfo: \"SceneInfo::GlobalInfo\", \"UserData\" {" << std::endl <<
639 "\t\tType: \"UserData\"" << std::endl <<
640 "\t\tVersion: 100" << std::endl <<
641 "\t\tMetaData: {" << std::endl <<
642 "\t\t\tVersion: 100" << std::endl <<
643 "\t\t\tTitle: \"Belle II Detector\"" << std::endl <<
644 "\t\t\tSubject: \"Detector Geometry Model\"" << std::endl <<
645 "\t\t\tAuthor: \"Belle II Collaboration\"" << std::endl <<
646 "\t\t\tKeywords: \"\"" << std::endl <<
647 "\t\t\tRevision: \"\"" << std::endl <<
648 "\t\t\tComment: \"\"" << std::endl <<
649 "\t\t}" << std::endl <<
650 "\t}" << std::endl <<
651 "}" << std::endl << std::endl;
652
653 m_File << "GlobalSettings: {" << std::endl <<
654 "\tVersion: 1000" << std::endl <<
655 "\tProperties70: {" << std::endl <<
656 "\t\tP: \"UpAxis\", \"int\", \"Integer\", \"\",1" << std::endl <<
657 "\t\tP: \"UpAxisSign\", \"int\", \"Integer\", \"\",1" << std::endl <<
658 "\t\tP: \"FrontAxis\", \"int\", \"Integer\", \"\",2" << std::endl <<
659 "\t\tP: \"FrontAxisSign\", \"int\", \"Integer\", \"\",1" << std::endl <<
660 "\t\tP: \"CoordAxis\", \"int\", \"Integer\", \"\",0" << std::endl <<
661 "\t\tP: \"CoordAxisSign\", \"int\", \"Integer\", \"\",1" << std::endl <<
662 "\t\tP: \"OriginalUpAxis\", \"int\", \"Integer\", \"\",1" << std::endl <<
663 "\t\tP: \"OriginalUpAxisSign\", \"int\", \"Integer\", \"\",1" << std::endl <<
664 "\t\tP: \"UnitScaleFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
665 "\t\tP: \"OriginalUnitScaleFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
666 "\t\tP: \"AmbientColor\", \"ColorRGB\", \"Color\", \"\",1,1,1" << std::endl <<
667 "\t\tP: \"DefaultCamera\", \"KString\", \"\", \"\", \"Producer Perspective\"" << std::endl <<
668 "\t\tP: \"TimeMode\", \"enum\", \"\", \"\",0" << std::endl <<
669 "\t\tP: \"TimeSpanStart\", \"KTime\", \"Time\", \"\",0" << std::endl <<
670 "\t\tP: \"TimeSpanStop\", \"KTime\", \"Time\", \"\",10" << std::endl <<
671 "\t\tP: \"CustomFrameRate\", \"double\", \"Number\", \"\",-1" << std::endl <<
672 "\t}" << std::endl <<
673 "}" << std::endl << std::endl;
674
675 m_File << "Documents: {" << std::endl <<
676 "\tCount: 1" << std::endl <<
677 "\tDocument: 4000000000, \"\", \"Scene\" {" << std::endl <<
678 "\t\tProperties70: {" << std::endl <<
679 "\t\t\tP: \"SourceObject\", \"object\", \"\", \"\"" << std::endl <<
680 "\t\t\tP: \"ActiveAnimStackName\", \"KString\", \"\", \"\", \"\"" << std::endl <<
681 "\t\t}" << std::endl <<
682 "\t\tRootNode: 0" << std::endl <<
683 "\t}" << std::endl <<
684 "}" << std::endl << std::endl;
685
686 m_File << "References: {" << std::endl <<
687 "}" << std::endl << std::endl;
688
689 m_File << "Definitions: {" << std::endl <<
690 "\tVersion: 100" << std::endl <<
691 "\tCount: 4" << std::endl <<
692 "\tObjectType: \"GlobalSettings\" {" << std::endl <<
693 "\t\tCount: 1" << std::endl <<
694 "\t}" << std::endl;
695 m_File << "\tObjectType: \"Model\" {" << std::endl <<
696 "\t\tCount: " << modelCount << std::endl <<
697 "\t\tPropertyTemplate: \"FbxNode\" {" << std::endl <<
698 "\t\t\tProperties70: {" << std::endl <<
699 "\t\t\t\tP: \"QuaternionInterpolate\", \"enum\", \"\", \"\",0" << std::endl <<
700 "\t\t\t\tP: \"RotationOffset\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
701 "\t\t\t\tP: \"RotationPivot\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
702 "\t\t\t\tP: \"ScalingOffset\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
703 "\t\t\t\tP: \"ScalingPivot\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
704 "\t\t\t\tP: \"TranslationActive\", \"bool\", \"\", \"\",0" << std::endl <<
705 "\t\t\t\tP: \"TranslationMin\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
706 "\t\t\t\tP: \"TranslationMax\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
707 "\t\t\t\tP: \"TranslationMinX\", \"bool\", \"\", \"\",0" << std::endl <<
708 "\t\t\t\tP: \"TranslationMinY\", \"bool\", \"\", \"\",0" << std::endl <<
709 "\t\t\t\tP: \"TranslationMinZ\", \"bool\", \"\", \"\",0" << std::endl <<
710 "\t\t\t\tP: \"TranslationMaxX\", \"bool\", \"\", \"\",0" << std::endl <<
711 "\t\t\t\tP: \"TranslationMaxY\", \"bool\", \"\", \"\",0" << std::endl <<
712 "\t\t\t\tP: \"TranslationMaxZ\", \"bool\", \"\", \"\",0" << std::endl <<
713 "\t\t\t\tP: \"RotationOrder\", \"enum\", \"\", \"\",0" << std::endl <<
714 "\t\t\t\tP: \"RotationSpaceForLimitOnly\", \"bool\", \"\", \"\",0" << std::endl <<
715 "\t\t\t\tP: \"RotationStiffnessX\", \"double\", \"Number\", \"\",0" << std::endl <<
716 "\t\t\t\tP: \"RotationStiffnessY\", \"double\", \"Number\", \"\",0" << std::endl <<
717 "\t\t\t\tP: \"RotationStiffnessZ\", \"double\", \"Number\", \"\",0" << std::endl <<
718 "\t\t\t\tP: \"AxisLen\", \"double\", \"Number\", \"\",10" << std::endl <<
719 "\t\t\t\tP: \"PreRotation\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
720 "\t\t\t\tP: \"PostRotation\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
721 "\t\t\t\tP: \"RotationActive\", \"bool\", \"\", \"\",0" << std::endl <<
722 "\t\t\t\tP: \"RotationMin\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
723 "\t\t\t\tP: \"RotationMax\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
724 "\t\t\t\tP: \"RotationMinX\", \"bool\", \"\", \"\",0" << std::endl <<
725 "\t\t\t\tP: \"RotationMinY\", \"bool\", \"\", \"\",0" << std::endl <<
726 "\t\t\t\tP: \"RotationMinZ\", \"bool\", \"\", \"\",0" << std::endl <<
727 "\t\t\t\tP: \"RotationMaxX\", \"bool\", \"\", \"\",0" << std::endl <<
728 "\t\t\t\tP: \"RotationMaxY\", \"bool\", \"\", \"\",0" << std::endl <<
729 "\t\t\t\tP: \"RotationMaxZ\", \"bool\", \"\", \"\",0" << std::endl <<
730 "\t\t\t\tP: \"InheritType\", \"enum\", \"\", \"\",0" << std::endl <<
731 "\t\t\t\tP: \"ScalingActive\", \"bool\", \"\", \"\",0" << std::endl <<
732 "\t\t\t\tP: \"ScalingMin\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
733 "\t\t\t\tP: \"ScalingMax\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
734 "\t\t\t\tP: \"ScalingMinX\", \"bool\", \"\", \"\",0" << std::endl <<
735 "\t\t\t\tP: \"ScalingMinY\", \"bool\", \"\", \"\",0" << std::endl <<
736 "\t\t\t\tP: \"ScalingMinZ\", \"bool\", \"\", \"\",0" << std::endl <<
737 "\t\t\t\tP: \"ScalingMaxX\", \"bool\", \"\", \"\",0" << std::endl <<
738 "\t\t\t\tP: \"ScalingMaxY\", \"bool\", \"\", \"\",0" << std::endl <<
739 "\t\t\t\tP: \"ScalingMaxZ\", \"bool\", \"\", \"\",0" << std::endl <<
740 "\t\t\t\tP: \"GeometricTranslation\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
741 "\t\t\t\tP: \"GeometricRotation\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
742 "\t\t\t\tP: \"GeometricScaling\", \"Vector3D\", \"Vector\", \"\",1,1,1" << std::endl <<
743 "\t\t\t\tP: \"MinDampRangeX\", \"double\", \"Number\", \"\",0" << std::endl <<
744 "\t\t\t\tP: \"MinDampRangeY\", \"double\", \"Number\", \"\",0" << std::endl <<
745 "\t\t\t\tP: \"MinDampRangeZ\", \"double\", \"Number\", \"\",0" << std::endl <<
746 "\t\t\t\tP: \"MaxDampRangeX\", \"double\", \"Number\", \"\",0" << std::endl <<
747 "\t\t\t\tP: \"MaxDampRangeY\", \"double\", \"Number\", \"\",0" << std::endl <<
748 "\t\t\t\tP: \"MaxDampRangeZ\", \"double\", \"Number\", \"\",0" << std::endl <<
749 "\t\t\t\tP: \"MinDampStrengthX\", \"double\", \"Number\", \"\",0" << std::endl <<
750 "\t\t\t\tP: \"MinDampStrengthY\", \"double\", \"Number\", \"\",0" << std::endl <<
751 "\t\t\t\tP: \"MinDampStrengthZ\", \"double\", \"Number\", \"\",0" << std::endl <<
752 "\t\t\t\tP: \"MaxDampStrengthX\", \"double\", \"Number\", \"\",0" << std::endl <<
753 "\t\t\t\tP: \"MaxDampStrengthY\", \"double\", \"Number\", \"\",0" << std::endl <<
754 "\t\t\t\tP: \"MaxDampStrengthZ\", \"double\", \"Number\", \"\",0" << std::endl <<
755 "\t\t\t\tP: \"PreferedAngleX\", \"double\", \"Number\", \"\",0" << std::endl <<
756 "\t\t\t\tP: \"PreferedAngleY\", \"double\", \"Number\", \"\",0" << std::endl <<
757 "\t\t\t\tP: \"PreferedAngleZ\", \"double\", \"Number\", \"\",0" << std::endl <<
758 "\t\t\t\tP: \"LookAtProperty\", \"object\", \"\", \"\"" << std::endl <<
759 "\t\t\t\tP: \"UpVectorProperty\", \"object\", \"\", \"\"" << std::endl <<
760 "\t\t\t\tP: \"Show\", \"bool\", \"\", \"\",1" << std::endl <<
761 "\t\t\t\tP: \"NegativePercentShapeSupport\", \"bool\", \"\", \"\",1" << std::endl <<
762 "\t\t\t\tP: \"DefaultAttributeIndex\", \"int\", \"Integer\", \"\",0" << std::endl <<
763 "\t\t\t\tP: \"Freeze\", \"bool\", \"\", \"\",0" << std::endl <<
764 "\t\t\t\tP: \"LODBox\", \"bool\", \"\", \"\",0" << std::endl <<
765 "\t\t\t\tP: \"Lcl Translation\", \"Lcl Translation\", \"\", \"A\",0,0,0" << std::endl <<
766 "\t\t\t\tP: \"Lcl Rotation\", \"Lcl Rotation\", \"\", \"A\",0,0,0" << std::endl <<
767 "\t\t\t\tP: \"Lcl Scaling\", \"Lcl Scaling\", \"\", \"A\",1,1,1" << std::endl <<
768 "\t\t\t\tP: \"Visibility\", \"Visibility\", \"\", \"A\",1" << std::endl <<
769 "\t\t\t\tP: \"Visibility Inheritance\", \"Visibility Inheritance\", \"\", \"\",1" << std::endl <<
770 "\t\t\t}" << std::endl <<
771 "\t\t}" << std::endl <<
772 "\t}" << std::endl;
773 m_File << "\tObjectType: \"Material\" {" << std::endl <<
774 "\t\tCount: " << materialCount << std::endl <<
775 "\t\tPropertyTemplate: \"FbxSurfacePhong\" {" << std::endl <<
776 "\t\t\tProperties70: {" << std::endl <<
777 "\t\t\t\tP: \"ShadingModel\", \"KString\", \"\", \"\", \"Phong\"" << std::endl <<
778 "\t\t\t\tP: \"MultiLayer\", \"bool\", \"\", \"\",0" << std::endl <<
779 "\t\t\t\tP: \"EmissiveColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
780 "\t\t\t\tP: \"EmissiveFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
781 "\t\t\t\tP: \"AmbientColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
782 "\t\t\t\tP: \"AmbientFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
783 "\t\t\t\tP: \"DiffuseColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
784 "\t\t\t\tP: \"DiffuseFactor\", \"double\", \"Number\", \"A\",1" << std::endl <<
785 "\t\t\t\tP: \"Bump\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
786 "\t\t\t\tP: \"NormalMap\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
787 "\t\t\t\tP: \"BumpFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
788 "\t\t\t\tP: \"TransparentColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
789 "\t\t\t\tP: \"TransparencyFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
790 "\t\t\t\tP: \"DisplacementColor\", \"ColorRGB\", \"Color\", \"\",0,0,0" << std::endl <<
791 "\t\t\t\tP: \"DisplacementFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
792 "\t\t\t\tP: \"VectorDisplacementColor\", \"ColorRGB\", \"Color\", \"\",0,0,0" << std::endl <<
793 "\t\t\t\tP: \"VectorDisplacementFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
794 "\t\t\t\tP: \"SpecularColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
795 "\t\t\t\tP: \"SpecularFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
796 "\t\t\t\tP: \"ShininessExponent\", \"double\", \"Number\", \"A\",20" << std::endl <<
797 "\t\t\t\tP: \"ReflectionColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
798 "\t\t\t\tP: \"ReflectionFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
799 "\t\t\t}" << std::endl <<
800 "\t\t}" << std::endl <<
801 "\t}" << std::endl;
802 /*
803 m_File << "\tObjectType: \"Material\" {" << std::endl <<
804 "\t\tCount: " << materialCount << std::endl <<
805 "\t\tPropertyTemplate: \"FbxSurfaceLambert\" {" << std::endl <<
806 "\t\t\tProperties70: {" << std::endl <<
807 "\t\t\t\tP: \"ShadingModel\", \"KString\", \"\", \"\", \"Lambet\"" << std::endl <<
808 "\t\t\t\tP: \"MultiLayer\", \"bool\", \"\", \"\",0" << std::endl <<
809 "\t\t\t\tP: \"EmissiveColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
810 "\t\t\t\tP: \"EmissiveFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
811 "\t\t\t\tP: \"AmbientColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
812 "\t\t\t\tP: \"AmbientFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
813 "\t\t\t\tP: \"DiffuseColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
814 "\t\t\t\tP: \"DiffuseFactor\", \"double\", \"Number\", \"A\",1" << std::endl <<
815 "\t\t\t\tP: \"Bump\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
816 "\t\t\t\tP: \"NormalMap\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
817 "\t\t\t\tP: \"BumpFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
818 "\t\t\t\tP: \"TransparentColor\", \"ColorRGB\", \"Color\", \"A\",0,0,0" << std::endl <<
819 "\t\t\t\tP: \"TransparencyFactor\", \"double\", \"Number\", \"A\",0" << std::endl <<
820 "\t\t\t\tP: \"DisplacementColor\", \"ColorRGB\", \"Color\", \"\",0,0,0" << std::endl <<
821 "\t\t\t\tP: \"DisplacementFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
822 "\t\t\t\tP: \"VectorDisplacementColor\", \"ColorRGB\", \"Color\", \"\",0,0,0" << std::endl <<
823 "\t\t\t\tP: \"VectorDisplacementFactor\", \"double\", \"Number\", \"\",1" << std::endl <<
824 "\t\t\t}" << std::endl <<
825 "\t\t}" << std::endl <<
826 "\t}" << std::endl;
827 */
828 m_File << "\tObjectType: \"Geometry\" {" << std::endl <<
829 "\t\tCount: " << geometryCount << std::endl <<
830 "\t\tPropertyTemplate: \"FbxMesh\" {" << std::endl <<
831 "\t\t\tProperties70: {" << std::endl <<
832 "\t\t\t\tP: \"Color\", \"ColorRGB\", \"Color\", \"\",1,1,1" << std::endl <<
833 "\t\t\t\tP: \"BBoxMin\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
834 "\t\t\t\tP: \"BBoxMax\", \"Vector3D\", \"Vector\", \"\",0,0,0" << std::endl <<
835 "\t\t\t\tP: \"Primary Visibility\", \"bool\", \"\", \"\",1" << std::endl <<
836 "\t\t\t\tP: \"Casts Shadows\", \"bool\", \"\", \"\",0" << std::endl <<
837 "\t\t\t\tP: \"Receive Shadows\", \"bool\", \"\", \"\",0" << std::endl <<
838 "\t\t\t}" << std::endl <<
839 "\t\t}" << std::endl <<
840 "\t}" << std::endl <<
841 "}" << std::endl << std::endl;
842
843}

◆ writePVModelNode()

void writePVModelNode ( G4VPhysicalVolume *  physVol,
const std::string &  pvName,
unsigned long long  pvID 
)
private

Write FBX definition for each physical volume.

Definition at line 936 of file FBXWriterModule.cc.

937{
938 G4RotationMatrix* rot = physVol->GetObjectRotation();
939 G4ThreeVector move = physVol->GetObjectTranslation();
940 // FBX uses the Tait-Bryan version of the Euler angles (X then Y then Z rotation)
941 double yaw = std::atan2(rot->yx(), rot->xx()) * 180.0 / M_PI;
942 if (fabs(yaw) < 1.0E-12) yaw = 0.0;
943 double pitch = -std::asin(rot->zx()) * 180.0 / M_PI;
944 if (fabs(pitch) < 1.0E-12) pitch = 0.0;
945 double roll = std::atan2(rot->zy(), rot->zz()) * 180.0 / M_PI;
946 if (fabs(roll) < 1.0E-12) roll = 0.0;
947 m_File << "\t; PhysVol " << physVol->GetName();
948 if (physVol->IsReplicated()) {
949 m_File << " (replicated: copy " << physVol->GetCopyNo() << ")";
950 }
951 m_File << ", placing LogVol " << physVol->GetLogicalVolume()->GetName() << std::endl <<
952 "\tModel: " << pvID << ", \"Model::" << pvName << R"(", "Null" {)" << std::endl <<
953 "\t\tVersion: 232" << std::endl <<
954 "\t\tProperties70: {" << std::endl <<
955 "\t\t\tP: \"Lcl Translation\", \"Lcl Translation\", \"\", \"A\"," <<
956 move.x() << "," << move.y() << "," << move.z() << std::endl <<
957 "\t\t\tP: \"Lcl Rotation\", \"Lcl Rotation\", \"\", \"A\"," <<
958 roll << "," << pitch << "," << yaw << std::endl <<
959 "\t\t}" << std::endl <<
960 "\t\tShading: T" << std::endl <<
961 "\t\tCulling: \"CullingOff\"" << std::endl <<
962 "\t}" << std::endl;
963}

◆ writePVToParentLV()

void writePVToParentLV ( const std::string &  pvNameDaughter,
const std::string &  lvName,
unsigned long long  pvIDDaughter,
unsigned long long  lvID 
)
private

Write FBX connection for each physical-volume daughter of a parent logical volume.

Definition at line 990 of file FBXWriterModule.cc.

992{
993 m_File << "\t; PhysVol Model::" << pvNameDaughter << ", parent LogVol Model::lv_" << lvName << std::endl <<
994 "\tC: \"OO\"," << pvIDDaughter << "," << lvID << std::endl << std::endl;
995}

◆ writePVToParentPV()

void writePVToParentPV ( const std::string &  pvNameDaughter,
const std::string &  pvName,
unsigned long long  pvIDDaughter,
unsigned long long  pvID 
)
private

Write FBX connection for each physical-volume daughter of a parent physical volume (bypass singleton logical volume)

Definition at line 997 of file FBXWriterModule.cc.

999{
1000 m_File << "\t; PhysVol Model::" << pvNameDaughter << ", parent PhysVol Model::" << pvName << std::endl <<
1001 "\tC: \"OO\"," << pvIDDaughter << "," << pvID << std::endl << std::endl;
1002}

◆ writeSolidToLV()

void writeSolidToLV ( const std::string &  lvName,
const std::string &  solidName,
bool  visible,
unsigned long long  matID,
unsigned long long  lvID,
unsigned long long  solidID 
)
private

Write FBX connection for each logical volume's solid and color info.

Definition at line 965 of file FBXWriterModule.cc.

967{
968 m_File << "\t; Solid Geometry::" << solidName << ", LogVol Model::lv_" << lvName << std::endl <<
969 "\t" << (visible ? "" : "; ") << "C: \"OO\"," << solidID << "," << lvID << std::endl << std::endl <<
970 "\t; Color Material::" << lvName << ", LogVol Model::lv_" << lvName << std::endl <<
971 "\t" << (visible ? "" : "; ") << "C: \"OO\"," << matID << "," << lvID << std::endl << std::endl;
972}

◆ writeSolidToPV()

void writeSolidToPV ( const std::string &  pvName,
const std::string &  solidName,
bool  visible,
unsigned long long  matID,
unsigned long long  pvID,
unsigned long long  solidID 
)
private

Write FBX connection for each physical volume's solid and color info (bypass singleton logical volume)

Definition at line 974 of file FBXWriterModule.cc.

976{
977 m_File << "\t; Solid Geometry::" << solidName << ", PhysVol Model::" << pvName << std::endl <<
978 "\t" << (visible ? "" : "; ") << "C: \"OO\"," << solidID << "," << pvID << std::endl << std::endl <<
979 "\t; Color Material::" << pvName << ", PhysVol Model::" << pvName << std::endl <<
980 "\t" << (visible ? "" : "; ") << "C: \"OO\"," << matID << "," << pvID << std::endl << std::endl;
981}

Member Data Documentation

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_File

std::ofstream m_File
private

Output file.

Definition at line 111 of file FBXWriterModule.h.

◆ m_Filename

std::string m_Filename {"belle2.fbx"}
private

User-specified output filename.

Definition at line 108 of file FBXWriterModule.h.

◆ m_First

bool m_First {true}
private

Once-only flag to write FBX only on the first event.

Definition at line 101 of file FBXWriterModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_LVCount

std::vector<unsigned int>* m_LVCount {nullptr}
private

Count of number of instances of each logical volume.

Definition at line 141 of file FBXWriterModule.h.

◆ m_LVID

std::vector<unsigned long long>* m_LVID {nullptr}
private

Unique identifiers for logical volumes (Model nodes with links to Geometry and Material)

Definition at line 126 of file FBXWriterModule.h.

◆ m_LVName

std::vector<std::string>* m_LVName {nullptr}
private

Modified (legal-character and unique) logical-volume name.

Definition at line 117 of file FBXWriterModule.h.

◆ m_LVReplicas

std::vector<unsigned int>* m_LVReplicas {nullptr}
private

Count of number of replicas of each logical volume associated with a replicated physical volume.

Definition at line 150 of file FBXWriterModule.h.

◆ m_LVUnique

std::vector<bool>* m_LVUnique {nullptr}
private

Flag to indicate that a logical volume is referenced at most once (eligible for bypass)

Definition at line 156 of file FBXWriterModule.h.

◆ m_MatID

std::vector<unsigned long long>* m_MatID {nullptr}
private

Unique identifiers for logical volumes' color information (Material nodes)

Definition at line 129 of file FBXWriterModule.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 508 of file Module.h.

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 510 of file Module.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 512 of file Module.h.

◆ m_PVCount

std::vector<unsigned int>* m_PVCount {nullptr}
private

Count of number of instances of each physical volume.

Definition at line 138 of file FBXWriterModule.h.

◆ m_PVID

std::vector<unsigned long long>* m_PVID {nullptr}
private

Unique identifiers for physical volumes (Model nodes with transformation information)

Definition at line 123 of file FBXWriterModule.h.

◆ m_PVName

std::vector<std::string>* m_PVName {nullptr}
private

Modified (legal-character and unique) physical-volume name.

Definition at line 114 of file FBXWriterModule.h.

◆ m_PVReplicas

std::vector<unsigned int>* m_PVReplicas {nullptr}
private

Count of number of replicas of each replicated physical volume.

Definition at line 147 of file FBXWriterModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_SolidCount

std::vector<unsigned int>* m_SolidCount {nullptr}
private

Count of number of instances of each solid (typically 1)

Definition at line 144 of file FBXWriterModule.h.

◆ m_SolidID

std::vector<unsigned long long>* m_SolidID {nullptr}
private

Unique identifiers for solids (Geometry nodes)

Definition at line 132 of file FBXWriterModule.h.

◆ m_SolidName

std::vector<std::string>* m_SolidName {nullptr}
private

Modified (legal-character and unique) solid name.

Definition at line 120 of file FBXWriterModule.h.

◆ m_SolidReplicas

std::vector<unsigned int>* m_SolidReplicas {nullptr}
private

Count of number of replicas of each solid (extras for replicas with modified solids)

Definition at line 153 of file FBXWriterModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ m_UsePrototypes

bool m_UsePrototypes {false}
private

User-specified flag to select whether to write and re-use logical- and physical-volume prototypes once (true) or to write duplicates of each such volume (false).

Definition at line 105 of file FBXWriterModule.h.

◆ m_Visible

std::vector<bool>* m_Visible {nullptr}
private

Flag to indicate that the logical volume is visible.

Definition at line 135 of file FBXWriterModule.h.


The documentation for this class was generated from the following files: