Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
739e494
Add Parallel world in ITS aligner
mconcas Aug 10, 2023
70a4c6a
toggle parallel world (#82)
maciacco Apr 3, 2024
3241cf0
Don't close geomeitry here
mconcas Apr 5, 2024
92fc6f9
qwer
mconcas Apr 8, 2024
50a4e61
add ITS sensors to PW
maciacco May 27, 2024
3ba9e9c
remove debug print
maciacco May 27, 2024
2bf26f4
Please consider the following formatting changes
alibuild May 27, 2024
e11c643
Merge pull request #1 from alibuild/alibot-cleanup-13163
maciacco May 27, 2024
d6bf6b5
Update Detectors/gconfig/g4config.in
maciacco May 27, 2024
932e262
Merge branch 'AliceO2Group:dev' into its-parallel-world
maciacco Aug 12, 2024
1b3d7e0
disable geometry saving w/ pw + fill pw w/ full list of vols
maciacco Aug 12, 2024
ebe61e9
Merge branch 'AliceO2Group:dev' into its-parallel-world
maciacco Aug 20, 2024
3d38760
make pw filling detector specific (todo: configuration)
maciacco Sep 3, 2024
9494c0c
fix filling order + add configurables
maciacco Sep 4, 2024
bcaddf4
Please consider the following formatting changes
alibuild Sep 4, 2024
6c80f2a
Merge pull request #2 from alibuild/alibot-cleanup-13163
maciacco Sep 4, 2024
add5531
Merge branch 'AliceO2Group:dev' into its-parallel-world
maciacco Sep 4, 2024
6aa192d
remove unused params
maciacco Sep 4, 2024
1cb77ff
remove unused include + add new class to linkdef
maciacco Sep 4, 2024
e764530
remove print + format string only once
maciacco Sep 6, 2024
d2a9e9f
get param only once
maciacco Sep 6, 2024
ca0a024
remove useless comment
maciacco Sep 9, 2024
3f72471
Merge branch 'AliceO2Group:dev' into its-parallel-world
maciacco Oct 1, 2024
a9fcf2b
enable pw optimisation
maciacco Oct 1, 2024
ef32328
add empty implementation for generic pw method
maciacco Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class AlignParam
ClassDefNV(AlignParam, 1);
};

}
}
} // namespace detectors
} // namespace o2

#endif
2 changes: 2 additions & 0 deletions Detectors/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ o2_add_library(DetectorsBase
src/GeometryManager.cxx
src/MaterialManager.cxx
src/MaterialManagerParam.cxx
src/GeometryManagerParam.cxx
src/Propagator.cxx
src/MatLayerCyl.cxx
src/MatLayerCylSet.cxx
Expand Down Expand Up @@ -51,6 +52,7 @@ o2_target_root_dictionary(DetectorsBase
include/DetectorsBase/GeometryManager.h
include/DetectorsBase/MaterialManager.h
include/DetectorsBase/MaterialManagerParam.h
include/DetectorsBase/GeometryManagerParam.h
include/DetectorsBase/Propagator.h
include/DetectorsBase/Ray.h
include/DetectorsBase/MatCell.h
Expand Down
3 changes: 3 additions & 0 deletions Detectors/Base/include/DetectorsBase/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class Detector : public FairDetector
/// declare alignable volumes of detector
virtual void addAlignableVolumes() const;

/// fill parallel geometry with sensitive volumes of detector
virtual void fillParallelWorld() const;

/// Sets per wrapper volume parameters
virtual void defineWrapperVolume(Int_t id, Double_t rmin, Double_t rmax, Double_t zspan);

Expand Down
4 changes: 2 additions & 2 deletions Detectors/Base/include/DetectorsBase/GeometryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class GeometryManager : public TObject
double meanZ = 0.; // mean Z: sum(x_i*Z_i)/sum(x_i) [adimensional]
double meanZ2A = 0.; // Z/A mean: sum(x_i*Z_i/A_i)/sum(x_i) [adimensional]
double length = -1.; // length: sum(x_i) [cm]
int nCross = 0;
; // number of boundary crosses
int nCross = 0; // number of boundary crosses

MatBudgetExt() = default;
~MatBudgetExt() = default;
Expand Down Expand Up @@ -132,6 +131,7 @@ class GeometryManager : public TObject
/// detector geometry. The output global matrix is stored in 'm'.
/// Returns kFALSE in case TGeo has not been initialized or the volume path is not valid.
static Bool_t getOriginalMatrixFromPath(const char* path, TGeoHMatrix& m);

private:
/// sensitive volume identifier composed from (det_ID<<sDetOffset)|(sensid&sSensorMask)
static constexpr UInt_t sDetOffset = 15; /// detector identifier will start from this bit
Expand Down
31 changes: 31 additions & 0 deletions Detectors/Base/include/DetectorsBase/GeometryManagerParam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef DETECTORS_BASE_INCLUDE_GEOMETRYMANAGERPARAM_H_
#define DETECTORS_BASE_INCLUDE_GEOMETRYMANAGERPARAM_H_

#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"

namespace o2
{

struct GeometryManagerParam : public o2::conf::ConfigurableParamHelper<GeometryManagerParam> {
bool useParallelWorld = false;
bool usePwGeoBVH = false;
bool usePwCaching = false;

O2ParamDef(GeometryManagerParam, "GeometryManagerParam");
};

} // namespace o2

#endif /* DETECTORS_BASE_INCLUDE_GEOMETRYMANAGERPARAM_H_ */
4 changes: 4 additions & 0 deletions Detectors/Base/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ void Detector::addAlignableVolumes() const
LOG(warning) << "Alignable volumes are not yet defined for " << GetName();
}

void Detector::fillParallelWorld() const
{
}

int Detector::registerSensitiveVolumeAndGetVolID(TGeoVolume const* vol)
{
// register this volume with FairRoot
Expand Down
1 change: 1 addition & 0 deletions Detectors/Base/src/DetectorsBaseLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#pragma link C++ class o2::base::GeometryManager::MatBudgetExt + ;
#pragma link C++ class o2::base::MaterialManager + ;
#pragma link C++ class o2::MaterialManagerParam + ;
#pragma link C++ class o2::GeometryManagerParam + ;
#pragma link C++ class o2::base::SimFieldUtils + ;

#pragma link C++ class o2::base::Ray + ;
Expand Down
4 changes: 2 additions & 2 deletions Detectors/Base/src/GeometryManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/// \file GeometryManager.cxx
/// \brief Implementation of the GeometryManager class

#include <fairlogger/Logger.h> // for LOG
#include <TCollection.h> // for TIter
#include <fairlogger/Logger.h> // for LOG
#include <TCollection.h> // for TIter
#include <TFile.h>
#include <TGeoMatrix.h> // for TGeoHMatrix
#include <TGeoNode.h> // for TGeoNode
Expand Down
13 changes: 13 additions & 0 deletions Detectors/Base/src/GeometryManagerParam.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "DetectorsBase/GeometryManagerParam.h"
O2ParamImpl(o2::GeometryManagerParam);
4 changes: 3 additions & 1 deletion Detectors/ITSMFT/ITS/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ o2_add_library(ITSSimulation
SOURCES src/V11Geometry.cxx src/V1Layer.cxx src/V3Layer.cxx
src/Detector.cxx src/V3Services.cxx src/V3Cage.cxx
src/DescriptorInnerBarrelITS2.cxx src/ITSDataSimulator.cxx
src/ITSSimParam.cxx
PUBLIC_LINK_LIBRARIES O2::ITSBase O2::ITSMFTSimulation ROOT::Physics
$<$<BOOL:${ENABLE_UPGRADES}>:O2::ITS3Base> $<$<BOOL:${ENABLE_UPGRADES}>:O2::ITS3Simulation>)

Expand All @@ -24,7 +25,8 @@ o2_target_root_dictionary(ITSSimulation
include/ITSSimulation/V3Cage.h
include/ITSSimulation/V11Geometry.h
include/ITSSimulation/V3Services.h
include/ITSSimulation/DescriptorInnerBarrelITS2.h)
include/ITSSimulation/DescriptorInnerBarrelITS2.h
include/ITSSimulation/ITSSimParam.h)

o2_data_file(COPY data DESTINATION Detectors/ITS/simulation)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ class Detector : public o2::base::DetImpl<Detector>
/// Add alignable top volumes
void addAlignableVolumes() const override;

/// Add ITS chip volumes to parallel world geometry
void fillParallelWorld() const override;

/// Add alignable Layer volumes
/// \param lr layer number
/// \param parent path of the parent volume
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef DETECTORS_BASE_INCLUDE_ITSSIMPARAM_H_
#define DETECTORS_BASE_INCLUDE_ITSSIMPARAM_H_

#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"

namespace o2
{
namespace its
{

struct ITSSimParam : public o2::conf::ConfigurableParamHelper<ITSSimParam> {
bool addMetalToPW = true;
bool addSensorToPW = true;
bool addChipToPW = true;

O2ParamDef(ITSSimParam, "ITSSimParam");
};

} // namespace its
} // namespace o2

#endif /* DETECTORS_BASE_INCLUDE_ITSSIMPARAM_H_ */
49 changes: 49 additions & 0 deletions Detectors/ITSMFT/ITS/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ITSSimulation/V3Layer.h"
#include "ITSSimulation/V3Services.h"
#include "ITSSimulation/V3Cage.h"
#include "ITSSimulation/ITSSimParam.h"

#include "DetectorsBase/Stack.h"
#include "SimulationDataFormat/TrackReference.h"
Expand All @@ -41,6 +42,7 @@
#include "TVirtualMC.h" // for gMC, TVirtualMC
#include "TVirtualMCStack.h" // for TVirtualMCStack
#include "TFile.h" // for TVirtualMCStack
#include "TGeoParallelWorld.h"

#include <cstdio> // for NULL, snprintf
#include <cmath>
Expand Down Expand Up @@ -1308,6 +1310,53 @@ void Detector::defineSensitiveVolumes()
}
}

void Detector::fillParallelWorld() const
{
TGeoParallelWorld* pw = gGeoManager->GetParallelWorld();
if (pw == nullptr) {
LOG(error) << "Parallel world was not created";
return;
}
auto& param = ITSSimParam::Instance();

for (int iL{0}; iL < mNumberLayers; ++iL) {
auto const layer = mGeometry[iL];
int nhbarrels = layer->getNumberOfHalfBarrelsPerParent();
int nstaves = layer->getNumberOfStavesPerParent();
int nhstaves = layer->getNumberOfHalfStavesPerParent();
int nmodules = layer->getNumberOfModulesPerParent();
int nchips = layer->getNumberOfChipsPerParent();

for (int iHB{0}; iHB < nhbarrels; ++iHB) {
for (int iS{0}; iS < nstaves; ++iS) {
for (int iHS{nhstaves > 0 ? 0 : -1}; iHS < nhstaves; ++iHS) {
for (int iM{nmodules > 0 ? 0 : -1}; iM < nmodules; ++iM) {
for (int iC{0}; iC < nchips; ++iC) {
TString sname = GeometryTGeo::composeSymNameChip(iL, iHB, iS, iHS, iM, iC);
TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(sname);
auto path = pne->GetTitle();

if (param.addMetalToPW) {
TString metalPath = Form("%s/MetalStack_1", path);
gGeoManager->MakePhysicalNode(metalPath);
pw->AddNode(metalPath);
}
if (param.addSensorToPW) {
TString sensorPath = Form("%s/ITSUSensor%d_1", path, iL);
gGeoManager->MakePhysicalNode(sensorPath);
pw->AddNode(sensorPath);
}
if (param.addChipToPW) {
pw->AddNode(path);
}
}
}
}
}
}
}
}

Hit* Detector::addHit(int trackID, int detID, const TVector3& startPos, const TVector3& endPos,
const TVector3& startMom, double startE, double endTime, double eLoss, unsigned char startStatus,
unsigned char endStatus)
Expand Down
13 changes: 13 additions & 0 deletions Detectors/ITSMFT/ITS/simulation/src/ITSSimParam.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "ITSSimulation/ITSSimParam.h"
O2ParamImpl(o2::its::ITSSimParam);
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
#pragma link C++ class o2::its::Detector + ;
#pragma link C++ class o2::its::DescriptorInnerBarrelITS2 + ;
#pragma link C++ class o2::base::DetImpl < o2::its::Detector> + ;
#pragma link C++ class o2::its::ITSSimParam + ;

#endif
23 changes: 23 additions & 0 deletions Steer/src/O2MCApplication.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include <cstdlib>

#include <Steer/O2MCApplication.h>
#include <fairmq/Channel.h>
#include <fairmq/Message.h>
Expand All @@ -33,6 +35,8 @@
#include <filesystem>
#include <CommonUtils/FileSystemUtils.h>
#include "SimConfig/GlobalProcessCutSimParam.h"
#include "DetectorsBase/GeometryManagerParam.h"
#include <TGeoParallelWorld.h>

namespace o2
{
Expand Down Expand Up @@ -186,6 +190,25 @@ bool O2MCApplicationBase::MisalignGeometry()
auto alignedgeomfile = o2::base::NameConf::getAlignedGeomFileName(confref.getOutPrefix());
gGeoManager->Export(alignedgeomfile.c_str());

auto& param = o2::GeometryManagerParam::Instance();

// fill parallel world geometry if activated
if (param.useParallelWorld) {
TGeoParallelWorld* pw = gGeoManager->CreateParallelWorld("priority_sensors");
if (param.usePwGeoBVH) {
pw->SetAccelerationMode(TGeoParallelWorld::AccelerationMode::kBVH);
}
if (param.usePwCaching) {
TGeoNavigator::SetPWSafetyCaching(true);
}
for (auto det : listDetectors) {
if (dynamic_cast<o2::base::Detector*>(det)) {
((o2::base::Detector*)det)->fillParallelWorld();
}
}
gGeoManager->SetUseParallelWorldNav(true);
}

// return original return value of misalignment procedure
return true;
}
Expand Down