GRUTinizer
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
include
TUnpackedEvent.h
Go to the documentation of this file.
1
#ifndef _TUNPACKEDEVENT_H_
2
#define _TUNPACKEDEVENT_H_
3
4
#ifndef __CINT__
5
#include <type_traits>
6
#endif
7
8
#include "TClass.h"
9
10
#include "
TDetector.h
"
11
#include "
TGRUTTypes.h
"
12
#include "
TRawEvent.h
"
13
14
class
TUnpackedEvent
{
15
public
:
16
TUnpackedEvent
();
17
~TUnpackedEvent
();
18
19
template
<
typename
T>
20
T*
GetDetector
(
bool
make_if_not_found =
false
);
21
22
std::vector<TDetector*>&
GetDetectors
() {
return
detectors
; }
23
void
AddDetector
(
TDetector
* det) {
detectors
.push_back(det); }
24
void
AddRawData
(
const
TRawEvent
& event,
kDetectorSystems
detector);
25
26
void
Build
();
27
28
private
:
29
std::vector<TDetector*>
detectors
;
30
};
31
32
#ifndef __CINT__
33
template
<
typename
T>
34
T*
TUnpackedEvent::GetDetector
(
bool
make_if_not_found) {
35
static_assert(
std::is_base_of<TDetector, T>::value
,
36
"T must be a subclass of TDetector"
);
37
for
(
auto
det :
detectors
) {
38
T* output =
dynamic_cast<
T*
>
(det);
39
if
(output){
40
return
output;
41
}
42
}
43
44
if
(make_if_not_found) {
45
T* output =
new
T;
46
detectors.push_back(output);
47
return
output;
48
}
else
{
49
return
NULL;
50
}
51
}
52
#endif
53
54
#endif
/* _TUNPACKEDEVENT_H_ */
Generated on Wed Nov 4 2015 17:27:54 for GRUTinizer by
1.8.1.2