ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
EventTPCnv
src
EventInfoCnv_p1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "EventInfo/EventInfo.h"
6
#include "
EventInfo/EventType.h
"
7
#include "
EventInfo/EventID.h
"
8
#include "
EventInfo/TriggerInfo.h
"
9
10
#include "
EventTPCnv/EventInfoCnv_p1.h
"
11
#include "
EventTPCnv/EventIDCnv_p1.h
"
12
#include "
EventTPCnv/EventTypeCnv_p1.h
"
13
#include "
EventTPCnv/TriggerInfoCnv_p1.h
"
14
#include <math.h>
15
16
static
const
EventIDCnv_p1
idConv
;
17
static
const
EventTypeCnv_p1
typeConv
;
18
static
const
TriggerInfoCnv_p1
trigInfoCnv
;
19
20
21
void
EventInfoCnv_p1::transToPers
(
const
EventInfo
* trans,
EventInfo_p1
* pers, MsgStream &log)
const
{
22
idConv
.transToPers(trans->
event_ID
(), &pers->
m_event_ID
, log);
23
typeConv
.transToPers(trans->
event_type
(), &pers->
m_event_type
, log);
24
if
( trans->
trigger_info
() ) {
25
pers->
m_trigger_info
=
trigInfoCnv
.createPersistentConst(trans->
trigger_info
(), log);
26
}
27
}
28
29
void
EventInfoCnv_p1::persToTrans
(
const
EventInfo_p1
* pers,
EventInfo
* trans, MsgStream &log)
const
{
30
trans->
setEventID
(
idConv
.createTransientConst(&pers->
m_event_ID
, log));
31
EventType
* event_type =
typeConv
.createTransientConst(&pers->
m_event_type
, log);
32
if
( pers->
m_trigger_info
) {
33
trans->
setTriggerInfo
(
trigInfoCnv
.createTransientConst(pers->
m_trigger_info
, log));
34
35
// Fill MC event weight in transient EventType from persistent
36
// TriggerInfo. This is only needed for MC events: if the
37
// weight is zero, and TriggerInfo exists - was stored at end
38
// of eventFilterInfo
39
40
static
const
double
MIN_WEIGHT = -1.0e+6;
41
static
const
double
MAX_WEIGHT = +1.0e+6;
42
static
const
double
BIN_WIDTH( (MAX_WEIGHT - MIN_WEIGHT) /
43
std::numeric_limits<unsigned int>::max() );
44
if
(event_type->
mc_event_weight
() == 0 &&
45
trans->
trigger_info
()->
eventFilterInfo
().size()) {
46
double
weight = (MIN_WEIGHT + BIN_WIDTH * (double(trans->
trigger_info
()->
eventFilterInfo
().back()) + 0.5));
47
if
(fabs(weight - 0.999775) < 0.0001) weight = 1.0;
48
else
if
(fabs(weight + 0.999775) < 0.0001 ) weight = -1.0;
49
event_type->
set_mc_event_weight
(weight);
50
//trans->m_event_type->m_mc_event_weight = trans->m_trigger_info->eventFilterInfo().back();
51
}
52
}
53
trans->
setEventType
(event_type);
54
}
55
56
// work around the default constructor of EventInfo allocating memory
57
EventInfo
*
EventInfoCnv_p1::createTransientConst
(
const
EventInfo_p1
* persObj, MsgStream &log)
const
{
58
std::unique_ptr<EventInfo> trans(
new
EventInfo
(0,0,0) );
59
persToTrans
(persObj, trans.get(), log);
60
return
(trans.release());
61
}
EventIDCnv_p1.h
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
trigInfoCnv
static const TriggerInfoCnv_p1 trigInfoCnv
Definition
EventInfoCnv_p1.cxx:18
typeConv
static const EventTypeCnv_p1 typeConv
Definition
EventInfoCnv_p1.cxx:17
idConv
static const EventIDCnv_p1 idConv
Definition
EventInfoCnv_p1.cxx:16
EventInfoCnv_p1.h
EventTypeCnv_p1.h
EventType.h
This class provides general information about an event.
TriggerInfoCnv_p1.h
TriggerInfo.h
This class contains trigger related information.
EventIDCnv_p1
Definition
EventIDCnv_p1.h:14
EventInfoCnv_p1::transToPers
virtual void transToPers(const EventInfo *transObj, EventInfo_p1 *persObj, MsgStream &log) const override
Definition
EventInfoCnv_p1.cxx:21
EventInfoCnv_p1::persToTrans
virtual void persToTrans(const EventInfo_p1 *persObj, EventInfo *transObj, MsgStream &log) const override
Definition
EventInfoCnv_p1.cxx:29
EventInfoCnv_p1::createTransientConst
virtual EventInfo * createTransientConst(const EventInfo_p1 *persObj, MsgStream &log) const override
Definition
EventInfoCnv_p1.cxx:57
EventInfo_p1
Definition
EventInfo_p1.h:18
EventInfo_p1::m_event_type
EventType_p1 m_event_type
Definition
EventInfo_p1.h:30
EventInfo_p1::m_event_ID
EventID_p1 m_event_ID
Definition
EventInfo_p1.h:29
EventInfo_p1::m_trigger_info
TriggerInfo_p1 * m_trigger_info
Definition
EventInfo_p1.h:31
EventInfo::setEventID
void setEventID(owner< EventID * > pid)
Definition
EventInfo.cxx:84
EventInfo::setEventType
void setEventType(owner< EventType * >)
Definition
EventInfo.cxx:92
EventInfo::setTriggerInfo
void setTriggerInfo(owner< TriggerInfo * > pTrig)
Add TriggerInfo to existing object.
Definition
EventInfo.cxx:100
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition
EventInfo/EventInfo/EventInfo.h:224
EventInfo::trigger_info
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
Definition
EventInfo/EventInfo/EventInfo.h:244
EventInfo::event_type
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
Definition
EventInfo/EventInfo/EventInfo.h:234
EventTypeCnv_p1
Definition
EventTypeCnv_p1.h:13
EventType
This class represents the "type of event" where the type is given by one or more "characteristics".
Definition
EventType.h:92
EventType::mc_event_weight
float mc_event_weight(unsigned int iweight=0) const
Access to MC weight.
Definition
EventType.cxx:175
EventType::set_mc_event_weight
void set_mc_event_weight(float weight, unsigned int iweight=0, unsigned int nWeightsMax=0)
Add in MC weight. For more than 1 weight, add with iweight > 0.
Definition
EventType.cxx:207
TriggerInfoCnv_p1
Definition
TriggerInfoCnv_p1.h:13
TriggerInfo::eventFilterInfo
const std::vector< number_type > & eventFilterInfo() const
get event filter trigger info
Definition
TriggerInfo.cxx:153
EventInfo
Definition
EventInfo.py:1
Generated on
for ATLAS Offline Software by
1.17.0