R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BCave.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 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
16#include "FairGeoInterface.h"
17#include "FairGeoLoader.h"
18#include "FairGeoNode.h"
19#include "FairGeoRootBuilder.h"
20#include "FairGeoVolume.h"
21#include "FairRun.h"
22#include "FairRuntimeDb.h"
23
24#include "TObjArray.h"
25#include <TList.h>
26#include <stddef.h>
27
28#include "R3BGeoCave.h"
29#include "R3BGeoPassivePar.h"
30
32 : FairModule()
33{
34}
35
36R3BCave::R3BCave(const char* name, const char* Title)
37 : FairModule(name, Title)
38{
39 world[0] = 0;
40 world[1] = 0;
41 world[2] = 0;
42}
43
44R3BCave::R3BCave(const R3BCave& right)
45 : FairModule(right)
46{
47 world[0] = right.world[0];
48 world[1] = right.world[1];
49 world[2] = right.world[2];
50}
51
53
55{
56 FairGeoLoader* loader = FairGeoLoader::Instance();
57 FairGeoInterface* GeoInterface = loader->getGeoInterface();
58 R3BGeoCave* MGeo = new R3BGeoCave();
59 MGeo->setGeomFile(GetGeometryFileName());
60 GeoInterface->addGeoModule(MGeo);
61 Bool_t rc = GeoInterface->readSet(MGeo);
62 if (rc)
63 {
64 MGeo->create(loader->getGeoBuilder());
65 }
66
67 TList* volList = MGeo->getListOfVolumes();
68 // store geo parameter
69
70 FairRun* fRun = FairRun::Instance();
71 FairRuntimeDb* rtdb = FairRun::Instance()->GetRuntimeDb();
72
73 R3BGeoPassivePar* par = dynamic_cast<R3BGeoPassivePar*>(rtdb->getContainer("R3BGeoPassivePar"));
74 TObjArray* fSensNodes = par->GetGeoSensitiveNodes();
75 TObjArray* fPassNodes = par->GetGeoPassiveNodes();
76
77 TListIter iter(volList);
78 FairGeoNode* node = NULL;
79 FairGeoVolume* aVol = NULL;
80
81 while ((node = dynamic_cast<FairGeoNode*>(iter.Next())))
82 {
83 aVol = dynamic_cast<FairGeoVolume*>(node);
84 if (node->isSensitive())
85 {
86 fSensNodes->AddLast(aVol);
87 }
88 else
89 {
90 fPassNodes->AddLast(aVol);
91 }
92 }
93 par->setChanged();
94 par->setInputVersion(fRun->GetRunId(), 1);
95}
96
97FairModule* R3BCave::CloneModule() const { return new R3BCave(*this); }
98
ClassImp(R3BCave)
virtual void ConstructGeometry()
Definition R3BCave.cxx:54
virtual ~R3BCave()
Definition R3BCave.cxx:52
R3BCave()
Definition R3BCave.cxx:31
virtual FairModule * CloneModule() const
Definition R3BCave.cxx:97
TObjArray * GetGeoSensitiveNodes()
TObjArray * GetGeoPassiveNodes()