R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BCave.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2009 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2009-2026 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14#include "R3BCave.h"
15#include "R3BGeoCave.h"
16#include "R3BGeoPassivePar.h"
17
18#include <FairGeoInterface.h>
19#include <FairGeoLoader.h>
20#include <FairGeoNode.h>
21#include <FairGeoRootBuilder.h>
22#include <FairGeoVolume.h>
23#include <FairRun.h>
24#include <FairRuntimeDb.h>
25
26#include <TList.h>
27#include <TObjArray.h>
28#include <algorithm>
29#include <stddef.h>
30
32 : FairModule()
33{
34}
35
36R3BCave::R3BCave(const char* name, const char* Title)
37 : FairModule(name, Title)
38{
39}
40
42 : FairModule(right)
43{
44 std::copy(std::begin(right.world), std::end(right.world), world);
45}
46
48{
49 auto* loader = FairGeoLoader::Instance();
50 auto* GeoInterface = loader->getGeoInterface();
51 auto* MGeo = new R3BGeoCave();
52 MGeo->setGeomFile(GetGeometryFileName());
53 GeoInterface->addGeoModule(MGeo);
54 auto rc = GeoInterface->readSet(MGeo);
55 if (rc)
56 {
57 MGeo->create(loader->getGeoBuilder());
58 }
59
60 auto* volList = MGeo->getListOfVolumes();
61 // store geo parameter
62
63 auto* fRun = FairRun::Instance();
64 auto* rtdb = FairRun::Instance()->GetRuntimeDb();
65
66 auto* par = dynamic_cast<R3BGeoPassivePar*>(rtdb->getContainer("R3BGeoPassivePar"));
67 auto* fSensNodes = par->GetGeoSensitiveNodes();
68 auto* fPassNodes = par->GetGeoPassiveNodes();
69
70 TListIter iter(volList);
71 FairGeoNode* node = nullptr;
72 FairGeoVolume* aVol = nullptr;
73
74 while ((node = dynamic_cast<FairGeoNode*>(iter.Next())))
75 {
76 aVol = dynamic_cast<FairGeoVolume*>(node);
77 if (node->isSensitive())
78 {
79 fSensNodes->AddLast(aVol);
80 }
81 else
82 {
83 fPassNodes->AddLast(aVol);
84 }
85 }
86 par->setChanged();
87 par->setInputVersion(fRun->GetRunId(), 1);
88}
89
90FairModule* R3BCave::CloneModule() const { return new R3BCave(*this); }
91
ClassImp(R3B::Neuland::Cal2HitPar)
virtual void ConstructGeometry()
Definition R3BCave.cxx:47
R3BCave()
Definition R3BCave.cxx:31
virtual FairModule * CloneModule() const
Definition R3BCave.cxx:90
double world[3]
Definition R3BCave.h:34
TObjArray * GetGeoSensitiveNodes()