![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
45 TString
fileName =
"/eos/atlas/atlascerngroupdisk/perf-jets/ReferenceFiles/DAOD_JETM2.Wprime.pool.root";
50 bool runSystematics=
true;
53 Info(
APP_NAME,
"==============================================" );
57 Info(
APP_NAME,
" $> %s -n X | X = number of events you want to run on",
APP_NAME );
58 Info(
APP_NAME,
" $> %s -e X | X = specific number of the event to run on - for debugging",
APP_NAME );
63 Info(
APP_NAME,
"==============================================" );
67 Info(
APP_NAME,
"No arguments - using default file" );
79 if(
options.find(
"-f")!=std::string::npos){
80 for(
int ipos=0; ipos<
argc ; ipos++ ) {
81 if(std::string(
argv[ipos]).compare(
"-f")==0){
82 if( ipos+1 ==
argc || std::string(
argv[ipos+1])[0]==
'-' ) {
83 Error(
APP_NAME,
"Please add the file name after -f argument" );
93 if(
options.find(
"-event")!=std::string::npos){
94 for(
int ipos=0; ipos<
argc ; ipos++ ) {
96 if( ipos+1 ==
argc || std::string(
argv[ipos+1])[0]==
'-' ) {
97 Error(
APP_NAME,
"Please add the event# after -event argument" );
101 Info(
APP_NAME,
"Argument (-event) : Running only on event # %i", ievent );
107 if(
options.find(
"-m")!=std::string::npos){
108 for(
int ipos=0; ipos<
argc ; ipos++ ) {
110 if( ipos+1 ==
argc || std::string(
argv[ipos+1])[0]==
'-' ) {
111 Error(
APP_NAME,
"Please add 0 or 1 after -m (IsMC) argument" );
121 if(
options.find(
"-n")!=std::string::npos){
122 for(
int ipos=0; ipos<
argc ; ipos++ ) {
124 if( ipos+1 ==
argc || std::string(
argv[ipos+1])[0]==
'-' ) {
135 if(
options.find(
"-noSys")!=std::string::npos){
136 runSystematics=
false;
137 Info(
APP_NAME,
"Argument (-noSys) : Setting runSystematics");
140 if(
options.find(
"-v")!=std::string::npos){
142 Info(
APP_NAME,
"Argument (-v) : Setting verbose");
150 StatusCode::enableFailure();
156 TChain *
chain =
new TChain (
"CollectionTree",
"CollectionTree");
167 Long64_t
entries =
event.getEntries();
170 std::unique_ptr<TFile>
outputFile(TFile::Open(
"output_SmoothedWZTagger.root",
"recreate"));
171 int pass,truthLabel,ntrk;
173 TTree*
Tree =
new TTree(
"tree",
"test_tree" );
174 Tree->Branch(
"pass", &pass,
"pass/I" );
175 Tree->Branch(
"sf", &
sf,
"sf/F" );
176 Tree->Branch(
"pt", &
pt,
"pt/F" );
177 Tree->Branch(
"m", &
m,
"m/F" );
178 Tree->Branch(
"eta", &
eta,
"eta/F" );
179 Tree->Branch(
"ntrk", &ntrk,
"ntrk/I" );
180 Tree->Branch(
"eff", &
eff,
"eff/F" );
181 Tree->Branch(
"effSF", &effSF,
"effSF/F" );
182 Tree->Branch(
"sigeffSF", &sigeffSF,
"sigeffSF/F" );
183 Tree->Branch(
"truthLabel", &truthLabel,
"truthLabel/I" );
185 std::unique_ptr<JetUncertaintiesTool> jetUncToolSF(
new JetUncertaintiesTool((
"JetUncProvider_SF")));
186 std::vector<CP::SystematicSet> jetUnc_sysSets;
189 ANA_CHECK( jetUncToolSF->setProperty(
"JetDefinition",
"AntiKt10LCTopoTrimmedPtFrac5SmallR20") );
190 ANA_CHECK( jetUncToolSF->setProperty(
"ConfigFile",
"rel21/Fall2020/R10_SF_LCTopo_WTag_SigEff50.config") );
191 ANA_CHECK( jetUncToolSF->setProperty(
"MCType",
"MC16") );
194 std::vector<std::string> pulls = {
"__1down",
"__1up"};
196 const std::set<std::string> sysNames = jetUnc_sysSet.
getBaseNames();
197 for (
const std::string &
sysName: sysNames) {
198 for (
const std::string &
pull : pulls) {
214 std::cout<<
"Initializing WZ Tagger"<<std::endl;
219 ANA_CHECK( m_Tagger.
setProperty(
"ConfigFile",
"SmoothedContainedWTagger_AntiKt10UFOCSSKSoftDrop_FixedSignalEfficiency50_20220221.dat") );
230 event.getEntry(
entry );
234 if(
event.
retrieve( evtInfo,
"EventInfo" ) != StatusCode::SUCCESS){
237 if(ievent!=-1 &&
static_cast <int> (evtInfo->
eventNumber())!=ievent) {
243 if(
event.
retrieve( myJets,
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets" ) != StatusCode::SUCCESS)
248 std::unique_ptr<xAOD::JetContainer> shallowJets(jets_shallowCopy.first);
249 std::unique_ptr<xAOD::ShallowAuxContainer> shallowAux(jets_shallowCopy.second);
254 std::cout <<
"Testing W Tagger " << std::endl;
255 std::cout <<
"jet pt = " << jetSC->pt() << std::endl;
256 std::cout <<
"jet ntrk = " << jetSC->auxdata<
int>(
"ParentJetNTrkPt500") << std::endl;
257 std::cout <<
"RunningTag : " << jetSC->auxdata<
bool>(
"SmoothWContained50_Tagged") << std::endl;
258 std::cout <<
"result d2pass = " << jetSC->auxdata<
bool>(
"SmoothWContained50_PassD2") << std::endl;
259 std::cout <<
"result ntrkpass = " << jetSC->auxdata<
bool>(
"SmoothWContained50_PassNtrk") << std::endl;
260 std::cout <<
"result masspass = " << jetSC->auxdata<
bool>(
"SmoothWContained50_PassMass") << std::endl;
262 truthLabel = jetSC->auxdata<
int>(
"R10TruthLabel_R21Precision_2022v1");
264 pass = jetSC->auxdata<
bool>(
"SmoothWContained50_Tagged");
268 ntrk = jetSC->auxdata<
int>(
"ParentJetNTrkPt500");
269 sf = jetSC->auxdata<
float>(
"SmoothWContained50_SF");
270 eff = jetSC->auxdata<
float>(
"SmoothWContained50_efficiency");
271 effSF = jetSC->auxdata<
float>(
"SmoothWContained50_effSF");
272 sigeffSF = jetSC->auxdata<
float>(
"SmoothWContained50_sigeffSF");
273 std::cout <<
"pass " << pass
274 <<
" truthLabel " << truthLabel
276 <<
" pt " <<
pt*0.001
280 <<
" effSF " << effSF
281 <<
" sigeffSF " << sigeffSF
288 if (
pt/1.
e3 > 150 && std::abs(jetSC->eta()) < 2.0 ) {
289 bool validForUncTool = (
pt/1.e3 >= 150 &&
pt/1.e3 < 2500 &&
m > 40000. &&
m < 700000.);
290 validForUncTool &= (
m/
pt >= 0 &&
m/
pt <= 1 );
291 validForUncTool &= ( std::abs(
eta) < 2 );
292 std::cout <<
"Pass: " << pass << std::endl;
293 std::cout <<
"Nominal SF=" <<
sf <<
" truthLabel=" << truthLabel <<
" (1: t->qqb) "
294 << effSF <<
" " <<
eff <<
" " << pass << std::endl;
295 if( validForUncTool ){
300 std::cout << sysSet.name() <<
" " << jetSC->auxdata<
float>(
"SmoothWContained50_SF") << std::endl;
308 Info(
APP_NAME,
"===>>> done processing event #%i, run #%i %i events processed so far <<<===",
static_cast< int >( evtInfo->
eventNumber() ),
static_cast< int >( evtInfo->
runNumber() ),
static_cast< int >(
entry + 1 ) );
324 std::cout<<std::endl<<std::endl;
325 std::cout<<
"Smart Slimming Checker :"<<std::endl;
327 std::cout<<std::endl<<std::endl;
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
int main(int argc, char *argv[])
uint64_t eventNumber() const
The current event's event number.
ReadStats & stats()
Access the object belonging to the current thread.
Scalar eta() const
pseudorapidity method
@ kAthenaAccess
Access containers/objects like Athena does.
Class to wrap a set of SystematicVariations.
uint32_t runNumber() const
The current event's run number.
POOL::TEvent event(POOL::TEvent::kClassAccess)
std::set< std::string > getBaseNames() const
description: get the set of base systematic names from this set
static IOStats & instance()
Singleton object accessor.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
virtual StatusCode tag(const xAOD::Jet &jet) const override
Decorate single jet with tagging info.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Class describing the basic event information.
A relatively simple transient store for objects created in analysis.
StatusCode retrieve(const T *&obj)
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Error
The different types of error that can be flagged in the L1TopoRDO.
Tool for accessing xAOD files outside of Athena.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.