ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
TruthParticleID
McParticleEvent
src
PileUpClassification.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
McParticleEvent/PileUpClassification.h
"
6
7
8
void
PileUpClassification::findEventIterators
(
PileuType_t
putype,
McEventCollection::const_iterator
&fEvt,
McEventCollection::const_iterator
&lEvt ){
9
10
McEventCollection::const_iterator
maxIterator = lEvt;
11
//McEventCollection::const_iterator minIterator = fEvt;
12
13
int
intervallN =-1;
// -1 means no interval search.
14
15
16
switch
(putype){
17
case
SIGNAL
:
18
lEvt = fEvt; ++lEvt;
19
break
;
20
case
ALL
:
21
break
;
22
case
INTIME
:
23
{
24
// Special case : there's no SEPARATOR between SIGNAL and INTIME :
25
++fEvt; lEvt = fEvt; ++lEvt;
26
for
(; lEvt < maxIterator; ++lEvt){
27
if
(
HepMC::signal_process_id
(*lEvt) == 0 )
break
;
28
}
29
break
;
30
}
31
case
OUTOFTIME
:
32
intervallN = 1;
33
break
;
34
case
RESTOFMB
:
35
intervallN = 2;
36
break
;
37
case
CAVERN
:
38
intervallN = 3;
39
break
;
40
case
ALLMINBIAS
:
41
++fEvt;
42
break
;
43
default
:
44
break
;
45
};
46
47
48
// if needed, search the correct interval
49
while
(intervallN>0){
50
for
(; fEvt < maxIterator; ++fEvt){
51
if
(
HepMC::signal_process_id
(*fEvt) == 0 ) { ++fEvt;
break
; }
52
}
53
lEvt = fEvt;
54
for
(; lEvt < maxIterator; ++lEvt){
55
if
(
HepMC::signal_process_id
(*lEvt) == 0 )
break
;
56
}
57
intervallN--;
58
}
59
60
// don't overstep your bounds!
61
if
(lEvt>maxIterator) lEvt=maxIterator;
62
if
(fEvt>maxIterator) fEvt=maxIterator;
63
64
}
65
66
void
PileUpClassification::findEventIterators
(
PileuType_t
putype,
const
McEventCollection
* evts,
size_t
&firstIndex,
size_t
&lastIndex ){
67
68
McEventCollection::const_iterator
fEvt = evts->
begin
();
69
McEventCollection::const_iterator
lEvt = evts->
end
();
70
findEventIterators
(putype, fEvt, lEvt);
71
firstIndex = fEvt - evts->
begin
();
72
lastIndex = lEvt - evts->
begin
();
73
}
74
75
PileUpClassification::PileuType_t
PileUpClassification::pileUpType
(
const
McEventCollection
* evts,
size_t
evtIndex){
76
if
(evtIndex == 0 )
return
SIGNAL
;
77
78
McEventCollection::const_iterator
fEvt = evts->
begin
();
79
McEventCollection::const_iterator
lEvt = evts->
end
();
80
McEventCollection::const_iterator
itEvt = fEvt;
81
++itEvt;
82
PileuType_t
type
=
INTIME
;
83
while
( itEvt != lEvt){
84
if
(
size_t
(itEvt - fEvt) == evtIndex ){
return
type
;}
85
++itEvt;
86
if
(
HepMC::signal_process_id
(*itEvt) == 0 ) {
// a SEPARATOR
87
++itEvt;
type
= (
PileuType_t
) (
type
+1);
88
}
89
}
90
return
UNKONW
;
91
}
92
93
void
PileUpClassification::fillPileUpType
(
const
McEventCollection
* evts, std::vector<size_t> &evtToPUType){
94
evtToPUType.resize(evts->
size
());
95
McEventCollection::const_iterator
fEvt = evts->
begin
();
96
McEventCollection::const_iterator
lEvt = evts->
end
();
97
// 1st GenEvent is always SIGNAL
98
evtToPUType[0] =
SIGNAL
; ++fEvt;
99
// increment automatically following GenEvents
100
PileuType_t
type
=
INTIME
;
101
int
c=1;
102
for
(; fEvt != lEvt; ++fEvt){
103
if
(
HepMC::signal_process_id
(*fEvt) == 0 )
type
= (
PileuType_t
)(
type
+1);
104
evtToPUType[c] =
type
;
105
c++;
106
}
107
108
}
PileUpClassification.h
DataVector< HepMC::GenEvent >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Definition
McEventCollection.h:31
PileUpClassification::PileuType_t
PileuType_t
define some Pile-up classification Important : this classification is copied in McParticleAlgs/python...
Definition
PileUpClassification.h:29
PileUpClassification::CAVERN
@ CAVERN
Definition
PileUpClassification.h:31
PileUpClassification::UNKONW
@ UNKONW
Definition
PileUpClassification.h:31
PileUpClassification::ALL
@ ALL
Definition
PileUpClassification.h:30
PileUpClassification::SIGNAL
@ SIGNAL
Definition
PileUpClassification.h:29
PileUpClassification::ALLMINBIAS
@ ALLMINBIAS
Definition
PileUpClassification.h:31
PileUpClassification::OUTOFTIME
@ OUTOFTIME
Definition
PileUpClassification.h:31
PileUpClassification::INTIME
@ INTIME
Definition
PileUpClassification.h:31
PileUpClassification::RESTOFMB
@ RESTOFMB
Definition
PileUpClassification.h:31
PileUpClassification::findEventIterators
static void findEventIterators(PileuType_t putype, McEventCollection::const_iterator &fEvt, McEventCollection::const_iterator &lEvt)
Find interval [fEvt,lEvt] containing all GenEvents of type putype from the McEventCollection.
Definition
PileUpClassification.cxx:8
PileUpClassification::pileUpType
static PileuType_t pileUpType(const McEventCollection *evts, size_t evtIndex)
Return the type of pile-up event of the GenEvent number evtIndex in the McEventCollection.
Definition
PileUpClassification.cxx:75
PileUpClassification::fillPileUpType
static void fillPileUpType(const McEventCollection *evts, std::vector< size_t > &evtToPUType)
Fill evtToPUType so that entry i is the pile-up type of GenEvent number i inside the McEventCollectio...
Definition
PileUpClassification.cxx:93
HepMC::signal_process_id
int signal_process_id(const GenEvent &evt)
Definition
GenEvent.h:572
type
Generated on
for ATLAS Offline Software by
1.17.0