DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
DDCore
src
DetectorSelector.cpp
Go to the documentation of this file.
1
//==========================================================================
2
// AIDA Detector description implementation
3
//--------------------------------------------------------------------------
4
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5
// All rights reserved.
6
//
7
// For the licensing terms see $DD4hepINSTALL/LICENSE.
8
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9
//
10
// Author : M.Frank
11
//
12
//==========================================================================
13
14
// Framework include files
15
#include <
DD4hep/DetectorSelector.h
>
16
#include <
DD4hep/Detector.h
>
17
18
using namespace
dd4hep
;
19
21
const
DetectorSelector::Result
&
DetectorSelector::detectors
(
const
std::string& type)
22
{
23
return
description
.
detectors
(type);
24
}
25
27
DetectorSelector::Result
28
DetectorSelector::detectors
(
const
std::string& type1,
29
const
std::string& type2,
30
const
std::string& type3,
31
const
std::string& type4,
32
const
std::string& type5) {
33
const
std::string* types[] = { &type1, &type2, &type3, &type4, &type5 };
34
Result
result;
35
for
( std::size_t i=0; i<
sizeof
(types)/
sizeof
(types[0]); ++i ) {
36
try
{
37
if
( !types[i]->empty() ) {
38
const
std::vector<DetElement>&
v
=
description
.
detectors
(*(types[i]));
39
result.insert(std::end(result), std::begin(
v
), std::end(
v
));
40
}
41
}
42
catch
(...) {}
43
}
44
return
result;
45
}
46
50
DetectorSelector::Result
51
DetectorSelector::detectors
(
unsigned
int
includeFlag,
unsigned
int
excludeFlag )
const
{
52
Result
result;
53
const
Detector::HandleMap
&
entries
=
description
.
detectors
();
54
result.reserve(
entries
.size() ) ;
55
description
.
detectors
(
""
);
// Just to ensure the geometry is closed....
56
for
(
const
auto
& i :
entries
) {
57
DetElement
det
(i.second);
58
if
(
det
.parent().isValid() ) {
// Exclude 'world'
59
//fixme: what to do with compounds - add their daughters ?
60
// ...
61
if
( (
det
.typeFlag() & includeFlag ) == includeFlag &&
62
(
det
.typeFlag() & excludeFlag ) == 0 )
63
result.emplace_back(
det
) ;
64
}
65
}
66
return
result;
67
}
v
View * v
Definition:
MultiView.cpp:28
Detector.h
dd4hep::Detector::detectors
virtual const HandleMap & detectors() const =0
Accessor to the map of sub-detectors.
entries
Entries entries
Definition:
AlignmentsCalculator.cpp:81
dd4hep::DetElement
Handle class describing a detector element.
Definition:
DetElement.h:188
DetectorSelector.h
dd4hep::DetectorSelector::description
Detector & description
Reference to main detector description object.
Definition:
DetectorSelector.h:47
dd4hep::DetectorSelector::detectors
const Result & detectors(const std::string &type)
Access a set of subdetectors according to the sensitive type.
Definition:
DetectorSelector.cpp:21
dd4hep::Detector::HandleMap
std::map< std::string, Handle< NamedObject > > HandleMap
Type definition of a map of named handles.
Definition:
Detector.h:93
dd4hep::DetectorSelector::Result
std::vector< DetElement > Result
Result set definition.
Definition:
DetectorSelector.h:44
dd4hep
Namespace for the AIDA detector description toolkit.
Definition:
AlignmentsCalib.h:28
det
DetElement::Object * det
Definition:
AlignmentsCalculator.cpp:66
Generated on Thu Nov 7 2024 13:31:55 for DD4hep by
1.8.18