ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
SUSYPhys
SUSYTools
util
SUSYTruthTester.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// System include(s):
6
#include <memory>
7
#include <cstdlib>
8
#include <string>
9
#include <iostream>
10
11
// ROOT include(s):
12
#include <TFile.h>
13
#include <TError.h>
14
#include <TString.h>
15
#include <TStopwatch.h>
16
#include <TSystem.h>
17
#include "TObjArray.h"
18
#include "TObjString.h"
19
20
#include "
xAODRootAccess/Init.h
"
21
#include "
xAODRootAccess/TStore.h
"
22
#ifdef ROOTCORE
23
#include "
xAODRootAccess/TEvent.h
"
24
#else
25
#include "
POOLRootAccess/TEvent.h
"
26
#endif
// ROOTCORE
27
#include "
PATInterfaces/CorrectionCode.h
"
28
29
// EDM include(s):
30
#include "
xAODEventInfo/EventInfo.h
"
31
#include "
xAODTruth/TruthParticleAuxContainer.h
"
32
#include "
xAODTruth/TruthParticleContainer.h
"
33
#include "
xAODTruth/TruthEventContainer.h
"
34
#include "
xAODTruth/TruthEvent.h
"
35
#include "
xAODCore/ShallowCopy.h
"
36
#include "
xAODBase/IParticleHelpers.h
"
37
#include "
xAODTruth/xAODTruthHelpers.h
"
38
39
// Local include(s):
40
#include "
SUSYTools/SUSYObjDef_xAOD.h
"
41
42
int
main
(
int
argc,
char
* argv[] ) {
43
44
using namespace
asg::msgUserCode;
45
ANA_CHECK_SET_TYPE
(
int
);
46
47
CP::CorrectionCode::enableFailure
();
48
49
// The application's name:
50
const
char
*
APP_NAME
= argv[ 0 ];
51
52
// Check if we received a file name:
53
if
( argc < 2 ) {
54
Error(
APP_NAME
,
"No file name received!"
);
55
Error(
APP_NAME
,
" Usage: %s [xAOD file name] [maxEvents] [Debug] [ConfigFile=<cfile.conf>] "
,
APP_NAME
);
56
return
1;
57
}
58
60
int
debug
= 1;
61
Long64_t
entries
=-1;
62
std::string config_file =
"SUSYTools/SUSYTools_Default.conf"
;
63
64
for
(
int
i = 1 ; i < argc ; i++) {
65
const
char
* key = strtok(argv[i],
"="
) ;
66
const
char
* val = strtok(0,
" "
) ;
67
68
Info(
APP_NAME
,
"processing key %s with value %s"
, key, val );
69
70
if
(strcmp(key,
"Debug"
) == 0)
debug
= atoi(val);
71
if
(strcmp(key,
"ConfigFile"
) == 0) config_file = std::string(val);
72
if
(strcmp(key,
"maxEvents"
) == 0)
entries
= atoi(val);
73
}
74
76
static
SG::Accessor<int>
acc_susyid(
"SUSY_procID"
);
77
78
// Initialise the application:
79
//ANA_CHECK( xAOD::Init( APP_NAME ) ); //NOT WORKING? //MT,WB
80
81
// Open the input file:
82
TString fileName;
83
fileName = argv[1];
84
Info(
APP_NAME
,
"Opening file: %s"
, fileName.Data() );
85
std::unique_ptr< TFile > ifile( TFile::Open( fileName,
"READ"
) );
86
ANA_CHECK
( ifile.get() );
87
88
// Create a TEvent object:
89
90
91
#ifdef ROOTCORE
92
xAOD::TEvent
event(
xAOD::TEvent::kAthenaAccess
);
93
#else
94
POOL::TEvent
event(
POOL::TEvent::kAthenaAccess
);
95
#endif
96
97
//xAOD::TEvent event( xAOD::TEvent::kBranchAccess );
98
//xAOD::TEvent event( xAOD::TEvent::kClassAccess );
99
ANA_CHECK
( event.readFrom( ifile.get() ) );
100
Info(
APP_NAME
,
"Number of events in the file: %i"
,
101
static_cast<
int
>
( event.getEntries() ) );
102
103
TString xStream=
""
;
//identify SUSY DxAOD flavour (inside entry loop now /MT)
104
105
xAOD::TStore
store;
106
107
// If we haven't set the number of events, then run over the whole tree
108
if
(
entries
<0){
109
entries
=
event
.getEntries();
110
}
111
112
// Create the tool(s) to test:
113
ST::SUSYObjDef_xAOD
objTool(
"SUSYObjDef_xAOD"
);
114
115
int
period =
debug
? 1 : 100;
116
117
// Loop over the events:
118
for
( Long64_t entry = 0; entry <
entries
; ++entry ) {
119
120
// Tell the object which entry to look at:
121
event
.getEntry( entry );
122
123
// Print some event information for fun:
124
const
xAOD::EventInfo
* ei = 0;
125
ANA_CHECK
( event.retrieve( ei,
"EventInfo"
) );
126
127
if
(entry % period == 0) {
128
Info(
APP_NAME
,
129
"===>>> start processing event #%i, "
130
"run #%i %i events processed so far <<<==="
,
131
static_cast<
int
>
( ei->
eventNumber
() ),
132
static_cast<
int
>
( ei->
runNumber
() ),
133
static_cast<
int
>
( entry ) );
134
}
135
136
// Check SUSY Proc. ID for signal MC (only for first event for now!)
137
int
pdgid1 = 0;
138
int
pdgid2 = 0;
139
140
if
( objTool.
FindSusyHP
(pdgid1, pdgid2) != StatusCode::SUCCESS ){
141
Error(
APP_NAME
,
"--- SOMETHING IS WRONG WITH THE SUSY PROC FINDING... ---"
);
142
return
1;
143
}
144
145
if
( pdgid1!=0 && pdgid2!=0){
//(just to avoid warnings)
146
Info(
APP_NAME
,
"--- SIGNAL ID1 : %d"
, pdgid1);
147
Info(
APP_NAME
,
" SIGNAL ID2 : %d"
, pdgid2);
148
149
if
( acc_susyid.
isAvailable
(*ei) ){
150
Info(
APP_NAME
,
" SIGNAL PROC ID (DECO) : %d"
, acc_susyid(*ei) );
151
}
152
}
153
}
154
155
// CALLGRIND_TOGGLE_COLLECT;
156
// CALLGRIND_DUMP_STATS;
157
// ProfilerStop();
158
159
// Return gracefully:
160
return
0;
161
}
APP_NAME
#define APP_NAME
Definition
BoostedXbbTag.cxx:25
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
ANA_CHECK_SET_TYPE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:314
TEvent.h
CorrectionCode.h
TruthParticleContainer.h
IParticleHelpers.h
Init.h
debug
const bool debug
Definition
MakeUncertaintyPlots.cxx:53
TEvent.h
SUSYObjDef_xAOD.h
ShallowCopy.h
TStore.h
TruthEventContainer.h
TruthEvent.h
TruthParticleAuxContainer.h
CP::CorrectionCode::enableFailure
static void enableFailure() noexcept
Definition
CorrectionCode.h:64
POOL::TEvent
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:40
POOL::TEvent::kAthenaAccess
@ kAthenaAccess
Definition
PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:47
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition
Control/AthContainers/AthContainers/Accessor.h:68
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
ST::SUSYObjDef_xAOD
Definition
SUSYObjDef_xAOD.h:142
ST::SUSYObjDef_xAOD::FindSusyHP
StatusCode FindSusyHP(int &pdgid1, int &pdgid2) const
Definition
Truth.cxx:76
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:59
xAOD::TEvent::kAthenaAccess
@ kAthenaAccess
Access containers/objects like Athena does.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:74
xAOD::TStore
A relatively simple transient store for objects created in analysis.
Definition
TStore.h:45
main
int main()
Definition
hello.cxx:18
entries
double entries
Definition
listroot.cxx:49
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAODTruthHelpers.h
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0