diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt deleted file mode 100644 index c9ddae25d64c4d798a9267e994de1d78df12cd96..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Package: AnalysisExamples -################################################################################ - -# Declare the package name: -atlas_subdir( AnalysisExamples ) - -# External dependencies: -find_package( CLHEP ) -find_package( HepPDT ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) - -# Component(s) in the package: -atlas_add_component( AnalysisExamples - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent AthenaBaseComps AthenaKernel Navigation SGTools StoreGateLib SGtests NavFourMom xAODEventInfo xAODTracking GaudiKernel TruthHelper GeneratorObjects AthAnalysisToolsLib AnalysisUtilsLib ParticleEvent AnalysisTriggerEvent JetTagEvent JetTagInfo MuonIDEvent McParticleEvent McParticleKernel JetEvent muonEvent Particle ParticleTruth RecoToolInterfaces egammaEvent VxVertex TrkVKalVrtFitterLib TrigDecisionToolLib TrigInDetEvent TrigParticle TrigSteeringEvent CompositeParticleEvent ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/README b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/README deleted file mode 100644 index d917b4ebe4066b92291121182c17596521744cb7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/README +++ /dev/null @@ -1 +0,0 @@ -this package is an example of using the new CP Tools for analysis \ No newline at end of file diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/doc/packagedoc.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/doc/packagedoc.h deleted file mode 100644 index 364a28c8a8aed6b2a5b8eb38480b2e19a6d89111..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/doc/packagedoc.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - -@page AnalysisExamples_page Analysis Examples - - - In this package, we have few complete analysis codes to show the user how -to do analyses on ESD and AOD. - - - The user analysis code should be developed in the package PhysicsAnalysis/AnalysisCommon/UserAnalysis -The user should check out the package UserAnalysis and implement his/he analysis code there. In the -package UserAnalysis, we have a very simple analysis code: AnalysisSkeleton. But it does not scale. -The user may follow the structure of code development in this package AnalysisExamples, or not. In any -case however, the user should make his analysis code modular and scalable. - - - DoBJet: BJet Analysis code -The user is free to modify this as he/she sees fit This algorithm fills the container of user pre selected -B-jets in store gate and fills an ntuple or histograms. The user must override the following -methods, -otherwise the base class methods will be called - they do nothing: - - * virtual StatusCode doPreSelection(); - * virtual StatusCode initializeParticle(); - * virtual StatusCode finalizeParticle(); - - - Job options: DoBJet_jobOptions.py. The cuts for b jet selection are defined here, should be -modified for the particular analysis - - - DoElectron: Electron Analysis code -The user is free to modify this as he/she sees fit. This algorithm fills the container of user pre -selected electrons in store gate and fills an ntuple or histograms. The user must override the -following methods, otherwise the base class methods will be called - they do nothing: - - * virtual StatusCode doPreSelection(); - * virtual StatusCode initializeParticle(); - * virtual StatusCode finalizeParticle(); - - - Job options: DoElectron_jobOptions.py. The cuts for electron selection are defined here, should be -modified for the particular analysis - - - DoMuon: Muon analysis code -The use is free to modify this as he/she sees fit. This algorithm fills the container of user pre -selected muons in store gate and fills an ntuple or histograms. The user must override the -following methods, otherwise the base class methods will be called - they do nothing: - - * virtual StatusCode doPreSelection(); - * virtual StatusCode intializeParticle(); - * virtual StatusCode finalizeParticle(); - - - Job options: DoMuon_jobOptions.py. The cuts for muon seletion are defined here, should be modified -for the particular analysis - - - DoParticle: Particle Analysis base class, should never be instanciated! - - - DoParticleJet: ParticleJet analysis code -The user should modify this as he/she sees fit. This algorithm fills the container of user pre selected -jets in store gate and fills an ntuple or histograms. The user must override the following -methods, otherwise the base class methods will be called - they do nothing: - - * virtual StatusCode doPreSelection(); - * virtual StatusCode initializeParticle(); - * virtual StatusCode finalizeParticle(); - - - Job options: DoParticleJet_jobOptions.py. The cuts for q, g jet selectrion are defined here, should -be modified for the particular analysis - - - DoPhoton: Photon Analysis code -The user is free to modify this as he/she sees fit. This algorithm fills the container of user pre -selected photons in store gate and fills an ntuple or histograms. The user must override the -following methods, otherwise the base class methods will be called - they do nothing: - - * virtual StatusCode doPreSelection(); - * virtual StatusCode initializeParticle(); - * virtual StatusCode finalizeParticle(); - - - Job options: DoPhoton_jobOptions.py. The cuts for photon selection are defined here, should be -modified for the particular analysis - - - DoTauJet: TauJet analysis code -The user should modify this as he/she sees fit. This algorithm fills the container of user pre selected -tau-jets in store gate and fills an ntuple or histograms. The user must override the following -methods, -otherwise the base class methods will be called - they do nothing: - - * virtual StatusCode doPreSelection(); - * virtual StatusCode initializeParticle(); - * virtual StatusCode finalizeParticle(); - - - Job options: DoTauJet_jobOptions.py. The cuts for tau jet selection are defined here, should be -modified for the particular analysis - - - Zll analysis Example (l = electron, muon, tau) -An analysis algorithm to demonstrate Z to leptons analysis. It simply reads the containers of the pre -selected particles from StoreGate and does Z to lepton reconstruction. The pre selected particles -are recorded in the transient event store (StoreGate) by the DoParticle algorithms described above. It -therefore runs the DoParticle algorithms described above so that the pre selected (or selected) -particles are available the event store beforehand. - - - Job Options: ZeeZmmOnAODExample_jobOptions.py, should be modified for cuts, etc. One ROOT output -files are produced for histograms. - - - Job Options: VFitZmmOnAODExample_jobOptions.py, should be modified for cuts, etc. One ROOT output -files are produced for histograms and ntuple. - - - Job Options: ZeeOnESDExample_jobOptions.py, should be modified for cuts, etc. For analysis on ESD. -One ROOT output files are produced for histograms. - - - Job Options: ZtautauExample_jobOptions.py, should be modified for cuts, etc. For Z -> tautau -reconstruction on AOD. One ROOT output files are produced for histograms. - - - H to 4 lepton analysis Example (l = electron, muon) -An analysis algorithm to demonstrate Higgs to leptons analysis. It simply reads the containers of the -pre selected particles from StoreGate and does H to 4-lepton reconstruction. The pre selected particles -are recorded in the transient event store (StoreGate) by the DoParticle algorithms described above. It -therefore runs the DoParticle algorithms described above so that the pre selected (or selected) -particles are available the event store beforehand. - - - Job options: H4lExample_jobOptions.py, should be modified for cuts, etc. Two ROOT output -files are produced: one for ntuples and the other for histograms. - - - gg to ttbar to jjb lnu b analysis example -An analyis algorithm to demoonstrate the reconstruction of ttbar to jjb lnu b. It reads the container of -electrons, muons, jets and b-jets, and also the missing Et object from StoreGate. It uses the SpecialUtils -for the solution to the neutrino pz problem, and also its uses analysis combinations and permutations. As -described above, the DoParticle algorithms run first, recording the pre-selected particles in StoreGate. -This ttbar algorithm does not have an ntuple, only histograms. - - - Job options: ttbarExample_jobOptions.py, should be modified for cuts, etc. One ROOT output file is -produced for the histograms. - - - Job options: PIDinAOD_jobOptions.py, for single particle idnetification studies. It runs only the -DoParticle algorithms. Note that the DoParticle_jobOptions.py cannot run independently by themselves, -they must be included as fragments in other job options such as PIDinAOD_jobOptions.py. Two -ROOT output files are produced: one for histograms the other for ntuples. - - - Job options: AnalysisCommon_jobOptions.py, for common options to all algorithms such as common DLL. -Cannnot run independently, must be included as a fragment in other job options. - - - Job options: produceGenEvents_jobOptions.py, an example job options for event generation. The -generated events can be passed to atlfast for fast simulation or to full simulation. Consult the -Monte Carlo Generator Group for details. - - - Analysis flags: these are flags which control which DoParticle_jobOptions the user wants to run. For -examples, in the H to 4 leptons analysis algorithms, only the electron and the muon selection algorithm -are ON (all the other particle selection algorithms are switched OFF). All the flags are ON by default. -Look at the job options ZllExamples_jobOptions.py or H4lExample_jobOptions.py to see how to switch OFF -particular algorithms. - - - Examples of job transformations for large scale production of ESD and AOD: look in the -sub-directory "scripts". - - - For details on how to produce ESD, AOD, how to set your input ESD or AOD in the analysis job -options, see the following "Customizing ESD and AOD production" on this web page: -@htmlinclude https://uimon.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools - - - A python script to merge many AOD files into a single file: look in the directory mergeAOD. There -you will find 2 files: globalMerge.py which allows you merge many AOD files into one. The reason you -may want to do this is that, for large statistics, running your analysis code over many AOD POOL -files may be slow because of I/O operations. So you may be better off merging the AOD files, so your -analysis code runs on a fewer number of AOD files (same statistics) and a much less processing time. -The script globalMerge.py should be executed in python. It produces a shell script, merge.sh, and a -number of job options fragments for the files to merge. You can then execute merge.sh, interactively -or in batch. The script merge.sh run athena jobs which use the top job options Merge.py to do the -merging. The output file names of the merged AOD POOL data files are defined in merge.sh when it is -produced by globalMerge.py. - - - globalMergeCLArgs.py. Purpose: set variables at commandline - Usage: python globalMergeCLArgs.py <dir> <fileprefix> <datasetid> - Example: python globalMerge2.py rfio:/castor/... rome.004100.recov10.T1_McAtNLO_top 41 - - - globalMergeConfigFile.py. Purpose: set variables in config file mergeconfig.py - Usage: python globalMergeConfigFile.py - Example of Config file: - prefix="rome.004100.recov10.T1_McAtNLO_top" - dir="rfio:/castor/cern.ch/grid/atlas/datafiles/rome/recov10" - dsid=4100 - catalog="file:PoolFileCatalog.xml" - nfiles=20 - - - MiscellaneousExamples: an example algorithm to show how to access TrackParticle (Trk::Track) -information from the Electron, the Muon for example, how to do back navigation from the AOD to the ESD -(from ParticleJet to calorimeter cells for examples), how to do symLink, how to use the CompositeParticle -class and how to do combinations with a selection. - - - AthenaAwareNTuple: an example of how to create an ATHENA aware NTuple. What is meant by ATHENA -aware is that it can be used as input to other ATHENA, for example to make pre-selection. - - - JetTagAna: To simply access the b-tagging weight for each jet, have a look at the section -SECTION::WEIGHTS in the JetTagAna.cxx file. To access the Monte-Carlo label (b,c or light) of a jet, -have a look at the section SECTION::LABEL. To access detailed information about each tag, see -SECTION::DETAILS in the JetTagAna.cxx - - - TrackExample: an example algorithm to show how to access TrackParticle collections, useful for analyses -that requires access to TrackParticle data such as track summary, perigee parameters, vertices, etc. - - - FilterExample: an example algorithm to show how to filter various collections of AOD classes using the so-called Filter Tools of AnalysisUtils package. -It makes use of a collection of IParticleFilter classes for each of the collection one wants to filter. -The Algorithm first retrieves the containers from StoreGate and copy the elements in a new container only if it satisfies the criteria of the IParticleFilter. -Eventually it stores these filtered containers. -Notice the use of the -@verbatim AnalysisUtils::copy_if( inCont->begin(), inCont->end(), std::back_inserter(*outCont), filter );@endverbatim -method which does the copy and the filtering in one go. - - - ReadTruthParticles: an example algorithm which exercises the TruthParticle interface. It shows how to navigate back to the HepMC::GenParticles and retrieve the children (in a HepMC format) as well as how to retrieve the (TruthParticle) children of a TruthParticle. - The Algorithm first retrieves a container of TruthParticle, loop over its elements and for each of them asks for its HepMC::GenParticle creator (and use the GenParticle methods). - Then, for each TruthParticle, it loops over its children in a TruthParticle format. - - - An example of LCG Minuit Minimization: see LCGMinuitMinimization.cxx - - - For questions or comments: Ketevi A. Assamagan - ketevi@bnl.gov - - -*/ diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/Merge.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/Merge.py deleted file mode 100644 index f621802bfc40649c8c8a8c19671e6fa69acecfbd..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/Merge.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# This is the job options that does the merging - -############################################################### -# -# Job options file -# -#============================================================== -#-------------------------------------------------------------- -# Load POOL support -#-------------------------------------------------------------- -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) - -#-------------------------------------------------------------- -# Event related parameters -#-------------------------------------------------------------- -theApp.EvtMax = 1000 - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -# Load "user algorithm" -#top algorithms to be run, and the libraries that house them - -DetDescrVersion="ATLAS-CSC-01-02-00" -include ("RecExCommon/AllDet_detDescr.py") - -# Pool Converters for AOD -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -doTrigger=True -doWriteAOD = True -doTruth = True - -# -#-------------------------------------------------------------- -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -#-------------------------------------------------------------- -MessageSvc = Service( "MessageSvc" ) -MessageSvc.OutputLevel = 3 -EventSelector = Service( "EventSelector" ) -include(mergeFile) -#============================================================== -# -# End of job options file -# -############################################################### -#-------------------------------------------------------------- -#--- Secondary Write portion ----- Don't change it !!! -#-------------------------------------------------------------- -theApp.OutStream =["Stream1"] -theApp.OutStreamType ="AthenaOutputStream" -Stream1 = Algorithm( "Stream1" ) -Stream1.Output = OUTPUT -Stream1.EvtConversionSvc ="AthenaPoolCnvSvc" -PoolSvc = Service( "PoolSvc" ) - -# list of output objects -include( "ParticleBuilderOptions/AOD_OutputList_jobOptions.py") -Stream1.ItemList = AOD_ItemList - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMerge.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMerge.py deleted file mode 100644 index 7cfe5ba175d706c20d2040e2a460376d94271074..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMerge.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/local/pkg/Python-2.2.2/bin/python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# by Davide Costanzo with a few modification from Ketevi A. Assamagan - -# You have to execute this job in python: -#lxplus> python -#python>>> import globalMerge -#python>>> Ctrl D -#lxplus> - -# as output: -# merge.sh - the script to do the merging -# a number of .py which contains the lists of AOD files to merge into one - -import string -import os -import sys - -# sub-string to select the AOD to be merged from your PoolFileCatalog.xml -myAODfiles = "BsDsPi.AOD_Trig900GeV.slim.100evts" - -#number of AOD files to be merged into a single file -NFileToMerge = 20 - -# get the AODs to be merged: -AodList = [] -import xml.dom.minidom -root = xml.dom.minidom.parse("PoolFileCatalog.xml") -files = root.getElementsByTagName('File') -for file in files: - # get PFN - physical = file.getElementsByTagName('physical')[0] - pfnNode = physical.getElementsByTagName('pfn')[0] - # convert UTF8 to Raw - pfn = str(pfnNode.getAttribute('name')) - # check basename - if pfn.split('/')[-1].startswith(myAODfiles): - # append - AodList.append(pfn) - -NMergedFiles=0 -fileNumber=0 -AodList.sort() - -# Ketevi - find out the total number of AOD files to merge -size = 0 -for name in AodList : - size = size+1 - -# The script merge.sh is produced as output -# you can then submit that script to LSF batch or run interactively to merge the AOD files -script=open('merge.sh','w') - -i = 0 -for filename in AodList : - AodFile = string.strip(filename) - i = i+1 - if NMergedFiles == NFileToMerge: - NMergedFiles = 0 - fileNumber = fileNumber+1 - f.close() - if NMergedFiles == 0 : - fileToOpen=myAODfiles+'Merge_'+str(fileNumber)+'.py' - f=open(fileToOpen,'w') - outfile = myAODfiles+'_Merge'+str(fileNumber) - script.write("athena.py Merge.py -c 'mergeFile="+'"'+fileToOpen+'"'+'; OUTPUT="'+outfile+'.root"'+"'\n") - print "open file ", fileToOpen - f.write("EventSelector.InputCollections = [ \n") - f.write("'"+AodFile+"'") - if NMergedFiles < NFileToMerge-1 and i < size : - f.write(", \n") - else : - f.write(']') - - NMergedFiles = NMergedFiles+1 - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMergeCLArgs.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMergeCLArgs.py deleted file mode 100644 index f8d5fcdc6b81e6101b3e15e5e4efc99e8774d820..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMergeCLArgs.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/local/pkg/Python-2.2.2/bin/python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# Original by Davide Costanzo with a few modification from Ketevi A. Assamagan -# Modified by Jack Cranshaw for rome tags 26.04.05 - -# You have to execute this job in python: -#lxplus> python -#python>>> import globalMergeWithTags -#python>>> Ctrl D -#lxplus> - -# as output: -# mergeTags.sh - the script to do the merging -# a number of .py which contains the lists of AOD files to merge into one - -import string -import os -import sys - -# translate command line arguments -if len(sys.argv)<4: - print "**>> Need at least 3 arguments: dir, prefix, dsid" - sys.exit(1) -myAODfiles = sys.argv[1]+sys.argv[2] -pithyprefix = sys.argv[2] -dataset = sys.argv[3] - -#number of AOD files to be merged into a single file -NFileToMerge = 20 - -# get the AODs to be merged: -# -# if FClistPFN is not found then you should source the TestRelease setup -get = os.popen('FClistPFN | grep '+myAODfiles) -AodList = get.readlines() -NMergedFiles=0 -fileNumber=0 -AodList.sort() - -# Ketevi - find out the total number of AOD files to merge -size = 0 -for name in AodList : - size = size+1 - -print "Found ", size, "files to merge" - -if (size>0): - # The script mergeTags.sh is produced as output - # you can then submit that script to LSF batch or run interactively to merge the AOD files - script=open('mergeTags.sh','w') - - i = 0 - for filename in AodList : - AodFile = string.strip(filename) - i = i+1 - if NMergedFiles == NFileToMerge: - NMergedFiles = 0 - fileNumber = fileNumber+1 - f.close() - if NMergedFiles == 0 : - fileToOpen=pithyprefix+'Merge_'+str(fileNumber)+'.py' - f=open(fileToOpen,'w') - outfile = myAODfiles+"_Merge"+str(fileNumber)+".AOD" - script.write('athena.py MergeWithTags.py -c "DSID='+str(dataset)+'; dbseed='+str(dataset+fileNumber)+'; mergeFile='+"'"+fileToOpen+"'"+"; OUTPUT='"+outfile+"'"+'"'+"\n") - print "open file ", fileToOpen - f.write("EventSelector.InputCollections = [ \n") - f.write("'"+AodFile+"'") - if NMergedFiles < NFileToMerge-1 and i < size : - f.write(", \n") - else : - f.write(']') - - NMergedFiles = NMergedFiles+1 -else: - print " ** No files for search string \n",myAODfiles, "\nfound in catalog" - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMergeConfigFile.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMergeConfigFile.py deleted file mode 100644 index 49c5590ab1a5cc7aa54e9baf0538e9a1a7692444..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/globalMergeConfigFile.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/local/pkg/Python-2.2.2/bin/python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# Original by Davide Costanzo with a few modification from Ketevi A. Assamagan -# Modified by Jack Cranshaw for rome tags 26.04.05 - -# You have to execute this job in python: -#lxplus> python -#python>>> import globalMergeWithTags -#python>>> Ctrl D -#lxplus> - -# as output: -# mergeTags.sh - the script to do the merging -# a number of .py which contains the lists of AOD files to merge into one - -import string -import os -import sys - -import mergeconfig - -# get parameters -try: - myAODfiles = mergeconfig.dir+'/'+mergeconfig.prefix+'/'+mergeconfig.prefix - pithyprefix = mergeconfig.prefix - postfix = mergeconfig.postfix -except: - print "MUST define dir and prefix and postfix" - sys.exit(1) - -try: - dataset = mergeconfig.dsid -except: - dataset = 0 - -#number of AOD files to be merged into a single file -try: - NFileToMerge = mergeconfig.nfiles -except: - NFileToMerge = 20 - -# is it a different catalog -try: - source = mergeconfig.catalog -except: - source = "file:PoolFileCatalog.xml" - -try: - seed = mergeconfig.dbseed - print "seed in conf file" -except: - seed = dataset - print "NO SEED in conf file" - -print "**" -print "myAODfiles = ",myAODfiles -print "pithyprefix = ",pithyprefix -print "dataset = ",dataset -print " N = ",NFileToMerge -print "source = ",source - -# get the AODs to be merged: -# -# if FClistPFN is not found then you should source the TestRelease setup -get = os.popen('FClistPFN -u '+source+' | grep '+myAODfiles) -AodList = get.readlines() -NMergedFiles=0 -fileNumber=0 -AodList.sort() - -# Ketevi - find out the total number of AOD files to merge -size = 0 -for name in AodList : - size = size+1 - -print "Found ", size, "files to merge" - -if (size>0): - # The script mergeTags.sh is produced as output - # you can then submit that script to LSF batch or run interactively to merge the AOD files - script=open('mergeTags.sh','w') - - i = 0 - for filename in AodList : - AodFile = string.strip(filename) - i = i+1 - if NMergedFiles == NFileToMerge: - NMergedFiles = 0 - fileNumber = fileNumber+1 - seed = seed+1 - f.close() - if NMergedFiles == 0 : - fileToOpen=postfix+'._'+str(fileNumber)+'.py' - f=open(fileToOpen,'w') - outfile=mergeconfig.dir+'/'+mergeconfig.prefix+'/'+postfix+"._"+str(fileNumber)+".AOD" - script.write('athena.py MergeWithTags.py -c "DSID='+str(dataset)+'; dbseed='+str(seed)+'; mergeFile='+"'"+fileToOpen+"'"+"; OUTPUT='"+outfile+"'"+'"'+"\n") - print "open file ", fileToOpen - f.write("EventSelector.InputCollections = [ \n") - f.write("'"+AodFile+"'") - if NMergedFiles < NFileToMerge-1 and i < size : - f.write(", \n") - else : - f.write(']') - - NMergedFiles = NMergedFiles+1 -else: - print " ** No files for search string \n",myAODfiles, "\nfound in catalog" - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/mergeconfig.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/mergeconfig.py deleted file mode 100644 index 24718afcd0d51e66a1e7b3469c0fd7fab9d27343..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/mergingAOD/mergeconfig.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -dsname = "T1_McAtNLO_top" -dsid = 4100 -inputstage = "recov10" -outputstage = "merge" -process = "rome.00" -dir = "rfio:/castor/cern.ch/grid/atlas/datafiles/rome/recov10" -catalog = "file:PoolFileCatalog.xml" -nfiles = 20 -dbseed = 3124 -prefix = process + str(dsid) + '.' + inputstage + '.' + dsname -postfix = process + str(dsid) + '.' + outputstage + '.' + dsname diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/AnalysisFlags.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/AnalysisFlags.py deleted file mode 100644 index 7a3ee2aa954362a5a2dccdf3f40ab3a3410fd453..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/AnalysisFlags.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -class _AnalysisFlags: - - # Particle Analysis Flags Default is ON=True - _partAna = [ - 'DoPhoton', - 'DoElectron', - 'DoMuon', - 'DoTauJet', - 'DoParticleJet', - 'DoBJet', - 'DoNavigation', - 'DoInteractive' - ] - - def __init__ (self): - # Particle Analysis Attributes - for attr in self._partAna: - setattr(self, attr, True) - self.DoNavigation = False - self.DoInteractive = False - def Print (self): - format = "%17s : %s" - for attr in self._partAna: - if getattr(self, attr): - print(format % (attr, "ON")) - else: - print(format % (attr, "--")) - -AnalysisFlags = _AnalysisFlags() - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/Lib.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/Lib.py deleted file mode 100644 index b2428b4dbf006a1a0aab5b9cd90014ee57ddf060..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/Lib.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaPython import PyAthena -StatusCode = PyAthena.StatusCode - -class PyReadD3pdNtuple( PyAthena.Alg ): - - def __init__(self, name='PyReadD3pdNtuple', **kw): - kw['name'] = name - super(PyReadD3pdNtuple, self).__init__(**kw) - - self.treename = kw.get('TreeName', - '/temp/TTreeStream/egamma') - return - - def initialize(self): - - hsvc = PyAthena.py_svc('THistSvc', iface='ITHistSvc') - if not hsvc: - self.msg.error("Could not retrieve THistSvc !") - return StatusCode.Failure - - self.tree = hsvc.get(self.treename, klass='TTree') - if not self.tree: - self.msg.error('could not retrieve tree from THistSvc') - return StatusCode.Failure - return StatusCode.Success - - def execute(self): - info = self.msg.info - info('running execute...') - t = self.tree - info('run-nbr: %s', t.RunNumber) - info('evt-nbr: %s', t.EventNumber) - info('el-nbr: %s', t.el_n) - if t.el_n >0: - info('el.eta[0]: %s', t.el_eta[0]) - nmax = len(t.el_jetcone_dr[0]) - info('el_jetcone_dr[0].size: %s', nmax) - for i in range(nmax): - info(' jet-cone-dr[0][%i]: %s', i, t.el_jetcone_dr[0][i]) - - return StatusCode.Success - - def finalize(self): - return StatusCode.Success - - pass # PyReadD3pdNtuple - -class PyReadD3pdEvtStore( PyAthena.Alg ): - - def __init__(self, name='PyReadD3pdEvtStore', **kw): - kw['name'] = name - super(PyReadD3pdEvtStore, self).__init__(**kw) - - return - - def initialize(self): - - self.evtstore = PyAthena.py_svc('StoreGateSvc') - if not self.evtstore: - self.msg.error('could not retrieve EvtStore') - return StatusCode.Failure - return StatusCode.Success - - def execute(self): - info = self.msg.info - info('running execute...') - sg = self.evtstore - info('run-nbr: %s', sg["RunNumber"]) - info('evt-nbr: %s', sg["EventNumber"]) - info('el-nbr: %s', sg["el_n"]) - if sg["el_n"] >0: - el_eta = sg["el_eta"] - el_jetcone_dr = sg["el_jetcone_dr"] - info('el.eta[0]: %s', el_eta[0]) - nmax = len(el_jetcone_dr[0]) - info('el_jetcone_dr[0].size: %s', nmax) - for i in range(nmax): - info(' jet-cone-dr[0][%i]: %s', i, el_jetcone_dr[0][i]) - - return StatusCode.Success - - def finalize(self): - return StatusCode.Success - - pass # PyReadD3pdEvtStore - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/__init__.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/__init__.py deleted file mode 100644 index 74583d364ec2ca794156596c7254d9b234a940c6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/python/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/AnalysisCommon_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/AnalysisCommon_jobOptions.py deleted file mode 100644 index 2d3aa4cdddf8d3059420ce2980070c16342020ab..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/AnalysisCommon_jobOptions.py +++ /dev/null @@ -1,34 +0,0 @@ -# import the data types -import EventKernel.ParticleDataType - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -# load additional libraries for back navigation -from AnalysisExamples.AnalysisFlags import AnalysisFlags - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -import AthenaPoolCnvSvc.ReadAthenaPool - -if AnalysisFlags.DoNavigation: - include( "RecExCommon/AllDet_detDescr.py" ) - -# the Dlls -# Don't need them -# -#include ( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -#include ( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) -#include ( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" ) -#include ( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -# write out a summary of the time spent -#theAuditorSvc = AuditorSvc() -#theAuditorSvc.Auditors += [ "NameAuditor"] -#theAuditorSvc.Auditors += [ "ChronoAuditor", "MemStatAuditor"] - -# Athena-Aware NTuple making Tools - -include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/AnalysisMaster.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/AnalysisMaster.py deleted file mode 100644 index a32558447ff993eb06274253a2fbb9d093e13487..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/AnalysisMaster.py +++ /dev/null @@ -1,55 +0,0 @@ -############################################################ -# AnalysisMaster.py -# These are the master job options for running your analysis -# Include your own job options as shown below ensuring you -############################################################ - -# We use "jp" to pass the input file to the userAlgs jO file defined below -# if you want to run over multiple files locally, use glob as shown below - -from AthenaCommon.AthenaCommonFlags import jobproperties as jp -jp.AthenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d49/AOD.191045._001937.pool.root.1'] - -# to run over multiple input files -################## -#DATAPATH = '/afs/cern.ch/atlas/maxidisk/d49/' -#from glob import glob -#INPUT = glob(DATAPATH + 'AOD*.root*') -#print INPUT -#jp.AthenaCommonFlags.FilesInput = INPUT - -################## -# -from RecExConfig.RecFlags import rec - -jp.AthenaCommonFlags.EvtMax=-1 # number of event to process - -# include your algorithm job options here - -#rec.UserAlgs=[ "ZeeZmmOnAODExample_jobOptions_NEW.py" ] -#rec.UserAlgs=[ "ZtautauExample_jobOptions_NEW.py" ] -#rec.UserAlgs=[ "ttbarExample_jobOptions_NEW.py" ] -rec.UserAlgs=[ "VFitZmmOnAOD_jobOptions_NEW.py" ] - -# Output log setting; this is for the framework in general -# You may over-ride this in your job options for your algorithm -rec.OutputLevel = INFO - -# Control the writing of your own n-tuple in the alg's job options -# The following line only turns off the standard CBNT made by RecExCommon. -# and has no bearing on the ntuple that you make in your user job Options file. -# -rec.doCBNT = False - -# for analysis you don't need to write out anything -rec.doWriteESD.set_Value_and_Lock(False) -rec.doWriteAOD.set_Value_and_Lock(False) -rec.doWriteTAG.set_Value_and_Lock(False) - -# to turn off perfmon - avoids writing out big ntuples - -rec.doPerfMon=False - -# main jobOption - must always be included -include ("RecExCommon/RecExCommon_topOptions.py") - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/FilterBeforeAlgorithmExample_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/FilterBeforeAlgorithmExample_topOptions.py deleted file mode 100644 index 706dc245b7002286abab107da6d229d8e3463529..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/FilterBeforeAlgorithmExample_topOptions.py +++ /dev/null @@ -1,75 +0,0 @@ -# Author: Ketevi A. Assamagan -# CERN, February 13, 2005 - -#get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -# Detector Description if needed -DetDescrVersion="ATLAS-CSC-01-02-00" # default - uncomment to set the geometry -include ("RecExCommon/RecExCommon_flags.py") -#DetFlags.ID_setOff() -#DetFlags.Calo_setOff() -#DetFlags.Muon_setOff() -include( "RecExCommon/AllDet_detDescr.py" ) - -# The ESD or AOD input data -# note that here, you can use the ESD or the AOD as input -# since the collections of TrackParticles are both in the ESD and in the AOD -import AthenaPoolCnvSvc.ReadAthenaPool -ServiceMgr.EventSelector.InputCollections = [ "AOD.pool.root" ] - -include( "TrackIsolationTools/TrackIsolationTool_jobOptions.py" ) - -# use sequencer for filtering -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from AthenaCommon.AlgSequence import AthSequencer -Sequencer = AthSequencer( "MySequencer" ) -Sequencer.StopOverride = False -topSequence += Sequencer - -##### Define the filter algorithm -from AnalysisExamples.AnalysisExamplesConf import FilterExample -FilterExample = FilterExample( - Jets = "Cone7H1TopoParticleJets", - Electrons = "ElectronAODCollection", - Muons = "StacoMuonCollection", - Photons = "PhotonAODCollection", - TauJets = "TauRecContainer", - MissingET = "MET_Final", - OutputLevel = DEBUG - ) -print FilterExample -Sequencer += FilterExample -######## End Filter algorithm - -######## Now define the algorithms to run after the filter passed -from AnalysisExamples.AnalysisExamplesConf import TrackExample -TrackExample = TrackExample() -TrackExample.TrackIsolationTool = TrackIsolationTool -TrackExample.TrackParticleContainerName = "TrackParticleCandidate" -TrackExample.TrackIsolationCone = 0.4 -TrackExample.EventWeight = 1.0 -TrackExample.TrackMomentumCut = 0.0*GeV -TrackExample.OutputLevel = INFO -print TrackExample -Sequencer += TrackExample - -############# End of the algorithms to run - -# Output level and Number of Events to process -ServiceMgr.MessageSvc.OutputLevel = INFO -theApp.EvtMax = 500 - -######################################### -#Setup TTree registration Service -# save ROOT histograms and NTuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -#Root Ntuple output file and name -ServiceMgr.THistSvc.Output = ["AANT DATAFILE='TrackExample.hist.root' OPT='RECREATE'"] - -# For interactive analysis in athena -#import PyAnalysisCore.InitPyAnalysisCore - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT.py deleted file mode 100644 index 2cebfa03a2e597c2a54788242a3999a892f9bea5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT.py +++ /dev/null @@ -1,60 +0,0 @@ -# Python job to run b-tagging+JetTagAna in RTT framework -# Laurent Vacavant 2005/10/12 - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.AppMgr import theApp -from AthenaCommon.AppMgr import ServiceMgr -from AthenaCommon.GlobalFlags import globalflags - -DetDescrVersion = "ATLAS-GEO-02-01-00" -include( "RecExCommon/AllDet_detDescr.py") - -import AthenaPoolCnvSvc.ReadAthenaPool -ServiceMgr.EventSelector.InputCollections = [ "AOD.pool.root" ] -theApp.EvtMax = -1 - -include( "PartPropSvc/PartPropSvc.py" ) -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) -theApp.Dlls += ["CaloTools" ] -theApp.Dlls += ["TileRecAlgs"] -theApp.Dlls += ["LArClusterRec"] -theApp.Dlls += ["CaloRec"] -theApp.Dlls += ["TileRec"] -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py") -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -# non-existent file: include( "InDetEventCnvTools/InDetEventCnvTools_jobOptions.py" ) -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") - -# ------ BTagging configuration: -redoBtag = True -if not 'BTaggingFlags' in dir(): - from BTagging.BTaggingFlags import BTaggingFlags -if redoBtag: - BTaggingFlags.Runmodus = "analysis" - BTaggingFlags.PoolInputType = "AOD" - from ParticleBuilderOptions.AODFlags import AODFlags - AODFlags.TruthParticleJet = False - BTaggingFlags.OutputLevel = INFO - BTaggingFlags.Jets = ['Cone4H1Tower'] - BTaggingFlags.JetsWithInfoPlus = ['Cone4H1Tower'] - include( "BTagging/BTagging_jobOptions.py" ) - from JetTagTools.JetTagToolsConf import Analysis__JetFitterTag - JetFitterTagTool = Analysis__JetFitterTag(name = "JetFitterTag") - JetFitterTagTool.jetCollectionList = ['Cone4H1Tower'] - -# ------ JetTagAna part: -include("AnalysisExamples/JetTagAna_jobOptions.py") -if redoBtag: - MyJetTagAna.JetContainer = 'Cone4H1TowerJetsAOD' -else: - MyJetTagAna.JetContainer = 'Cone4H1TowerJets' -MyJetTagAna.PrimaryVertexContainer = BTaggingFlags.PrimaryVertexCollectionName -MyJetTagAna.TrackParticleContainer = BTaggingFlags.TrackParticleCollectionName -print MyJetTagAna - -# ------ MsgSvc: -ServiceMgr.MessageSvc.OutputLevel = ERROR -ServiceMgr.MessageSvc.defaultLimit = 9999999 # all messages -ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT_postProcessing.C b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT_postProcessing.C deleted file mode 100644 index 555fc541547f7f6214c148b3ac51a1a52b0b04bf..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT_postProcessing.C +++ /dev/null @@ -1,631 +0,0 @@ - -#include "TFile.h" -#include "TH1F.h" -#include "TCanvas.h" -#include "TLegend.h" - -// Always leave N_HISTO_TESTS as last entry -enum histo_tests {HAS_ENTRIES, IS_EMPTY, ARE_NOT_IDENTICAL, ARE_IDENTICAL, MEAN_NEAR_ZERO, KS_TEST, ARE_ALMOST_IDENTICAL, N_HISTO_TESTS}; - -int DrawHistograms(TCanvas *, TH1F* ref, TH1F* cur, char * refstr, char *curstr); -bool CheckHistogram(TH1F *hist, TH1F* hist2, char * tests, char *hname, char *extension, char *dir); -bool PerformHistogramTest(TH1F* h1, TH1F *h2, char *test, char *extension, char *test_description, char *result_str); -int SaveHistograms(TCanvas * cx, char *filename, char *extension, char * dir); -int PrintHtmlTableEntry(char *html, char *hist_name, bool, bool ,bool ); -int PrintHtmlTableEntry2(char *html, char *test, char *result, bool pass); -int PrintHtmlHead(char *, char *, char *, char *); -int PrintHtmlHead2(char *, char *); -int PrintHtmlFoot(char *); -int PrintHtmlFoot2(char *html, char *image_file); -void FormatFileName(char * h, char * h2); - - -// file: root_to_html.cc -// author: Sven Vahsen, sevahsen@lbl.gov -// version: 09/02/05 -// synposis: builds web pages (.html and .gif files) for Inner Detector Tracking -// inputs: two .root files with histograms, a testlist, and some strings -// outputs: main web page, sub-pages for each histogram, images (.GIFs) linked from these pages -// -// revisions: -// -// 09/02/05: o error message on web page when input .root files not find -// o new function argument for name of main html file -// (previously hardcoded as 'test.html') -// -// to-do list: -// -// o error message on web page in case of wrong format for testlist file --> also list testdate -// o implement more histograms comparisons --> KS test. What else? -// o allow appending string to all filenames ? - -#include <iostream> -#include <time.h> -#include "TFile.h" -#include "TH1F.h" -#include "TCanvas.h" -#include "TLegend.h" -#include "TStyle.h" -#include "TPaveStats.h" - -char *test_keyword[N_HISTO_TESTS]={"has_entries","is_empty","are_not_identical","are_identical", "mean_near_zero","ks_test","are_almost_identical"}; -char *test_description[N_HISTO_TESTS]={"Does the histogram have entries?","Is the histogram empty?","Do the histograms differ?","Are the histograms identical?", "Is the histogram mean consistent with zero?","KS Test","Are the histograms almost identical?"}; - -int root_to_html(char *ref_file, char *cur_file, char *ref_version, char *cur_version, char *particle_type, char *testlist, char *tmpdir, char *pagetmp) -{ - char aline[512], hname[512], tests[512]; - char refstr[512], curstr [512], hname2[512], page[512], dir[512]; - - sprintf(dir,"%s%s",tmpdir, (strlen(tmpdir)>0) ? "/" : ""); - sprintf(page,"%s%s",dir,pagetmp); - sprintf(refstr,"%s (reference)",ref_version); - sprintf(curstr,"%s (current)",cur_version); - - // Open Root Files, initialize canvas - //gROOT->SetStyle("Plain"); - gStyle->SetOptStat(111111); - TCanvas *c0 = (TCanvas *) gROOT->FindObject("c0"); - if (c0) c0->Delete(); - c0 = new TCanvas("c0"); - - // add check later: if (!OpenRootFiles()) return -1; - TFile reference(ref_file); - TFile current(cur_file); - - if (! reference.IsOpen()) cerr << "ERROR: Unable to open file \"" << ref_file << "\"!\n"; - if (! current.IsOpen()) cerr << "ERROR: Unable to open file \"" << cur_file << "\"!\n"; - - // Open file which lists the checks to be performed - FILE * infile = fopen(testlist,"r"); - if(!infile) - { - cerr << "Unable to open input file " << testlist << "\n"; - return -1; - } - - PrintHtmlHead(page,ref_version,cur_version,particle_type, current, reference); - - while (fgets(aline,256,infile)) - { - int nvars = sscanf(aline,"Histogram %s Test %[^\n]\n", hname, tests); - - if (nvars < 2) - { - cerr << "Formatting error in txt file: Line \"" << aline << "\" will be ignored.\n"; - continue; - } - - TH1F *ref_hist = 0; - TH1F *cur_hist = 0; - - if (reference.IsOpen()) ref_hist = (TH1F*)reference.Get(hname); - if (current.IsOpen()) cur_hist = (TH1F*)current.Get(hname); - - char* result = strstr(cur_hist->GetName(),"rej"); - if(result == NULL) { - - ref_hist->Scale(1./ref_hist->GetEntries()); - cur_hist->Scale(1./cur_hist->GetEntries()); - - } - - FormatFileName(hname,hname2); - - DrawHistograms(c0, ref_hist, NULL, refstr, curstr ); - SaveHistograms(c0, hname2, "ref", dir); - DrawHistograms(c0, NULL, cur_hist, refstr, curstr ); - SaveHistograms(c0, hname2, "cur", dir); - DrawHistograms(c0, ref_hist, cur_hist, refstr, curstr ); - SaveHistograms(c0, hname2, "cmp", dir); - - bool pass_ref = CheckHistogram(ref_hist, NULL, tests, hname2, "ref", dir); - bool pass_cur = CheckHistogram(cur_hist, NULL, tests, hname2, "cur", dir); - bool pass_cmp = CheckHistogram(ref_hist, cur_hist, tests, hname2, "cmp", dir); - - PrintHtmlTableEntry(page, hname2, pass_ref, pass_cur, pass_cmp); - } - - PrintHtmlFoot(page); - return 1; -} - - -// substitute '/' or '\' characters in filename with '_' -void FormatFileName(char * h, char * h2) -{ - int len = strlen(h)+1; - - for (int i=0; i<len && i<511; i++) - { - *h2=*h; - if (*h2=='/' || *h2=='\\') *h2='_'; - h++; h2++; - } -} - -// Check whether histogram exists -// Perform specified tests on histogram -// create html output file with gif of -// histogram and table of tests results -bool CheckHistogram(TH1F *hist, TH1F *hist2, char * tests, char *hname, char *extension, char *dir) -{ - char image_file[512], html_file[512], one_test[512], result_str[512], tmp[512], test_descr[512]; - sprintf(image_file,"%s_%s.gif", hname,extension); - sprintf(html_file, "%s%s_%s.html",dir, hname,extension); - - PrintHtmlHead2(html_file, hname); - - bool pass = true; - if (!strcmp(extension,"cmp") && (!hist || !hist2)) - { - // fail if comparison test, and one of the histogram doesn't exist - pass = false; - if (!hist) PrintHtmlTableEntry2 (html_file,"Reference histogram not found in root file!","",false); - if (!hist2) PrintHtmlTableEntry2 (html_file,"Current histogram not found in root file!","",false); - } - else if (!hist) - { - // always fail if histogram 1 doesn't exist - pass = false; - PrintHtmlTableEntry2(html_file,"Histogram not found in root file!","",false); - } - else - { - int nvars = 1; - char *ptr = tests; - int ntests=0; - - // get single words (test instructions) from string - while (nvars > 0 && nvars != EOF && (ptr < (tests+strlen(tests)))) - { - nvars = sscanf(ptr,"%s", one_test); - ptr += strlen(one_test) + 1; - if (nvars>0 && nvars !=EOF) - { - strcpy(tmp,one_test); tmp[3]=0; - //cout << "position=" << ptr-tests << ", tmp = \"" << tmp << "\" ,extension=\"" << extension << "\"\n"; - - if (!strcmp(extension,tmp)) - { - bool tmp_pass = PerformHistogramTest(hist, hist2, one_test, extension, test_descr, result_str); - PrintHtmlTableEntry2(html_file, test_descr, result_str ,tmp_pass); - if (!tmp_pass) pass = false; - ntests++; - } - } - } - if (!ntests) PrintHtmlTableEntry2(html_file, "No tests defined for this histogram", "-" , 1); - } - PrintHtmlFoot2(html_file, image_file); - return pass; -} - - -bool PerformHistogramTest(TH1F* h1, TH1F* h2, char *test, char *extension, char *test_descr, char *result) -{ - - bool match=false; - bool pass=false; - int entries=0; - double mean=0; - double sigma=0; - double signific=0; - int entries_2=0; - double mean_2=0; - double sigma_2=0; - char current[512]; - float cut = 0; - - // which histogram are we testing? - - sprintf(test_descr,test); - - cout << "PerformHistogramTest: tests=" << test << ", extension=" << extension << "\n"; - if (strlen(test)> 4) - { - cout << "Comparing " << test << endl; - - for (int i=0; i<N_HISTO_TESTS; i++) - { - - // Truncate length of test, name it current - int j; - for (j=0;(j<strlen(test))&&(j<strlen(test_keyword[i])+4); j++) { - current[j] = test[j]; - } - current[j] = '\0'; - - cout << " To " << test_keyword[i] << ": " << current << endl; - - // check if test name matches any of the keywords - if (!strcmp(current+4,test_keyword[i])) - { - match = true; - strcpy(test_descr,test_description[i]); - switch(i) - { - case HAS_ENTRIES: - entries = (int) h1->GetEntries(); - sprintf(result,"Entries=%d",entries); - if (entries > 0) pass=true; - break; - case IS_EMPTY: - entries = (int) h1->GetEntries(); - sprintf(result,"Entries=%d",entries); - if (entries != 0) pass=false; - break; - case MEAN_NEAR_ZERO: - sscanf(test+4,"mean_near_zero(%f)",&cut); - - if (cut == 0) cut = 4; - - entries = (int) h1->GetEntries(); - mean = h1->GetMean(1); - sigma = h1->GetMeanError(1); - if (sigma !=0) - { - signific = fabs(mean/sigma); - sprintf(result,"fabs(mean/sigma_of_mean)=%f (cut was %f)",signific,cut); - if (signific < cut ) pass =true; - else pass = false; - } - else - { - signific = 999999.0; - sprintf(result,"sigma_mean=0,can't calculate significance!"); - pass = false; - } - break; - case ARE_IDENTICAL: - case ARE_NOT_IDENTICAL: - entries = (int) h1->GetEntries(); - mean = h1->GetMean(1); - sigma = h1->GetMeanError(1); - entries_2 = (int) h2->GetEntries(); - mean_2 = h2->GetMean(1); - sigma_2 = h2->GetMeanError(1); - - if (entries != entries_2 || mean!=mean_2 || sigma !=sigma_2) - { - sprintf(result,"Histogram number of entries, mean, or sigma differ"); - pass = false; - } - else - { - sprintf(result,"Histogram number of entries, mean, and sigma are identical"); - pass = true; - } - if (i==ARE_NOT_IDENTICAL) pass = !pass; - break; - case KS_TEST: - sscanf(test+4,"ks_test(%f)",&cut); - - double ks = h1->KolmogorovTest(h2); - sprintf(result,"Output from KS test is %f (cut is %f)",ks,cut); - pass = (ks > cut); - break; - - case ARE_ALMOST_IDENTICAL: - sscanf(test+4,"are_almost_identical(%f)",&cut); - - - - double dA = 0; - double A = 0; - - for (int k=0; k <= h1->GetNbinsX()+1; k++) { - dA += fabs(h1->GetBinContent(k) - h2->GetBinContent(k)); - A += h1->GetBinContent(k); - } - - if (A > 0) { - dA = dA / A; - } - - sprintf(result,"Σ(|ΔA|)/ΣA is %f (cut is %f)",dA,cut); - - pass = (dA < cut); - break; - - default: - sprintf(test_descr,test+4); - sprintf(result,"Test name recognized, but no action defined in root_to_html.cc!"); - pass=false; - } - break; - } - } - } - if (!match) - { - sprintf(result,"Unknown test!"); - pass=false; - } - return pass; -} - - -int DrawHistograms(TCanvas *c0, TH1F* ref_hist, TH1F* cur_hist, char *refstr, char *curstr) -{ - if (!ref_hist && !cur_hist) - { - c0->Clear(); - return 0; - } - - double posStatX = 0.89; - double posLeg1X = 0.50; - double posLeg2X = 0.89; - gStyle->SetStatY(0.67); - gStyle->SetOptStat(111111); - // Modif LV: decide to put stat box on left or right side: - TH1F* h = 0; - if(cur_hist) h = cur_hist; - if(ref_hist) h = ref_hist; - if(h) { - double activL = h->Integral(0,h->GetNbinsX()/3); - double activR = h->Integral(h->GetNbinsX()*2/3,h->GetNbinsX()); - if(activL*1.2<activR) { - posStatX = 0.33; - } else { - posStatX = 0.89; - } - } - gStyle->SetStatX(posStatX); - - if (ref_hist) - { - ref_hist->Draw(); - } - if (cur_hist) - { - cur_hist->SetMarkerStyle(20); - if (ref_hist) // make sure stat boxes don't overlap - { - TPaveStats *st = (TPaveStats*)cur_hist->GetListOfFunctions()->FindObject("stats"); - //st->SetLabel(curstr); - st->SetY2NDC(0.40); - st->SetY1NDC(0.16); - } - cur_hist->Draw((ref_hist) ? "samesp" : "p"); - } - TLegend *legend=new TLegend(posLeg1X,0.75,posLeg2X,0.88); - legend->SetTextFont(72); - legend->SetTextSize(0.03); - if (ref_hist) legend->AddEntry(ref_hist,refstr,"l"); - if (cur_hist) legend->AddEntry(cur_hist,curstr,"p"); - legend->Draw(); - - c0->Modified(); - c0->Update(); - - return 1; -} - - -// print out one line of RTT results table for histogram details page, in html format -int PrintHtmlTableEntry2(char *html, char *test, char*result, bool pass) -{ - FILE * f = fopen(html,"a"); - if (!f) return 0; - - // cell 1 - fputs("<tr>\n",f); - fprintf(f,"<td align=\"center\">%s</td>\n",test); - fprintf(f,"<td align=\"center\">%s</td>\n",result); - fprintf(f,"<td align=\"center\"><span style=\"color: rgb(%s);\">%s</span></td>\n", - (pass ? "51, 204, 0":"255, 0, 0"), (pass ? "PASS" : "FAIL")); - fputs("</tr>\n",f); - fclose(f); - - return 1; -} - -// print out one line of RTT results table in html format -int PrintHtmlTableEntry(char *html, char *hist_name, bool pass_ref, bool pass_cur, bool pass_cmp) -{ - FILE * f = fopen(html,"a"); - if (!f) return 0; - - fputs("<tr>\n",f); - - // cell 1 - fprintf(f,"<td align=\"center\"><a href=\"%s_expl.txt\">%s</a></td>\n",hist_name,hist_name); - - // cell 2 - fprintf(f,"<td align=\"center\"><span style=\"color: rgb(%s);\">%s <a target=\"_blank\" href=\"%s_ref.html\">(view)</a></span></td>\n", - (pass_ref ? "51, 204, 0":"255, 0, 0"), (pass_ref ? "PASS" : "FAIL"), hist_name); - - // cell 3 - fprintf(f,"<td align=\"center\"><span style=\"color: rgb(%s);\">%s <a target=\"_blank\" href=\"%s_cur.html\">(view)</a></span></td>\n", - (pass_cur ? "51, 204, 0":"255, 0, 0"), (pass_cur ? "PASS" : "FAIL"), hist_name); - - // cell 4 - fprintf(f,"<td align=\"center\"><span style=\"color: rgb(%s);\">%s <a target=\"_blank\" href=\"%s_cmp.html\">(view)</a></span></td>\n", - (pass_cmp ? "51, 204, 0":"255, 0, 0"), (pass_cmp ? "PASS" : "FAIL"), hist_name); - - fputs("</tr>\n",f); - - if (!f) return 0; - fclose(f); - return 1; -} - - -// used to build html pages that show histograms -int PrintHtmlHead2(char *html, char *hname) -{ - FILE * f = fopen(html,"w"); - if (!f) return 0; - - fputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n",f); - fputs("<html>\n",f); - fputs("<head>\n",f); - fputs("<meta content=\"text/html; charset=ISO-8859-1\"\n",f); - fputs("http-equiv=\"content-type\">\n",f); - fputs("<title>ATLAS B-tagging RTT</title>\n",f); - fputs("</head>\n",f); - fputs("<body>\n",f); - fputs("<span style=\"font-weight: bold;\">B-tagging Histogram\n",f); - fprintf(f,"\"%s\"<br>\n",hname); - fputs("<br>\n",f); - fputs("</span>\n",f); - fputs("<table style=\"text-align: left; width: 70%;\" border=\"1\" cellpadding=\"2\"\n",f); - fputs("cellspacing=\"2\">\n",f); - fputs("<tbody>\n",f); - fputs("<tr>\n",f); - fputs("<tr>\n",f); - fputs("<td style=\"font-weight: bold;\" align=\"center\">Test performed</td>\n",f); - fputs("<td style=\"font-weight: bold;\" align=\"center\">Result</td>\n",f); - fputs("<td style=\"font-weight: bold;\" align=\"center\">Pass/Fail</td>\n",f); - fputs("</tr>\n",f); - fclose(f); - return 1; -} - -// used to build html pages that show histograms -int PrintHtmlFoot2(char *html, char *image_file) -{ - FILE * f = fopen(html,"a"); - if (!f) return 0; - - time_t rawtime; - struct tm * timeinfo; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - - fputs("</tr>\n",f); - fputs("</tbody>\n",f); - fputs("</table>\n",f); - fputs("<br>\n",f); - - fputs("<img style=\"border: 1px solid;\" alt=\"IMAGE\"\n",f); - fprintf(f,"src=\"%s\"><br>\n",image_file); - fputs("<br>\n",f); - fputs("<br>\n",f); - fputs("<address>This page was automatically generated using a modified version of root_to_html (S.Vahsen/LBNL) on ",f); - fputs(asctime(timeinfo),f); - fputs(".</address>\n",f); - fputs("</body>\n",f); - fputs("</html>\n",f); - fclose(f); - return 1; -} - - -int PrintHtmlHead(char *html, char *ref_version, char *cur_version, char *particle_type, TFile &cfile, TFile &rfile) -{ - FILE * f = fopen(html,"w"); - if (!f) return 0; - - fputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n",f); - fputs("<html>\n",f); - fputs("<head>\n",f); - fputs("<meta content=\"text/html; charset=ISO-8859-1\"\n",f); - fputs("http-equiv=\"content-type\">\n",f); - fputs("<title>ATLAS B-tagging RTT</title>\n",f); - fputs("</head>\n",f); - fputs("<body>\n",f); - fputs("<h1>ATLAS B-tagging RTT</h1>\n",f); - - fputs("<table style=\"text-align: left;\" border=\"1\"\n",f); - fputs("cellpadding=\"2\" cellspacing=\"2\">\n",f); - fputs("<tbody>\n",f); - fputs("<tr>\n",f); - - fputs("<td align=\"center\">Current Athena release:</td>\n",f); - fprintf(f,"<td align=\"center\">%s</td>\n",cur_version); - fputs("<td align=\"center\">Histogram file:</td>\n",f); - fprintf(f,"<td align=\"center\"><span style=\"color: rgb(%s);\">%s%s</span></td>\n", - (cfile.IsOpen() ? "51, 204, 0":"255, 0, 0"), cfile.GetName(), (cfile.IsOpen() ? "" : ": UNABLE TO OPEN FILE!")); - fputs("</tr>\n",f); - - fputs("<tr>\n",f); - fputs("<td align=\"center\">Reference Athena release:</td>\n",f); - fprintf(f,"<td align=\"center\">%s</td>\n",ref_version); - fputs("<td align=\"center\">Histogram file:</td>\n",f); - fprintf(f,"<td align=\"center\"><span style=\"color: rgb(%s);\">%s%s</span></td>\n", - (rfile.IsOpen() ? "51, 204, 0":"255, 0, 0"), rfile.GetName(), (rfile.IsOpen() ? "" : ": UNABLE TO OPEN FILE!")); - fputs("</tr>\n",f); - - //fputs("<tr>\n",f); - //fputs("<td align=\"center\">Particle Species:</td>\n",f); - //fprintf(f,"<td align=\"center\">%s</td>\n",particle_type); - //fprintf(f,"<td align=\"center\" colspan=2>All tracks from iPatRec<br>via CBNT::TrackParticle (for now)</td>\n"); - //fputs("</tr>\n",f); - - fputs("</tbody>\n",f); - fputs("</table>\n",f); - fputs("<p>Click on the link in the histogram column to see the a brief explanation of the histogram. <br>Click on \"view\" for each column to see what tests were run and a plot of the quantity.\n",f); - fputs(" <br>\n",f); - fputs("<h3>Test Results: <br>\n",f); - fputs("</h3>\n",f); - //fputs("<h3>Click on histogram names for brief explanations. <br>\n",f); - //fputs("</h3>\n",f); - //fputs("<h3>Click on Pass/Fail to view actual histogram and tests performed.</h3>\n",f); - fputs("<table style=\"text-align: left; width: 70%;\" border=\"1\" cellpadding=\"2\"\n",f); - fputs("cellspacing=\"2\">\n",f); - fputs("<tbody>\n",f); - fputs("<tr>\n",f); - fputs("<td align=\"center\"><span style=\"font-weight: bold;\">Histogram</span></td>\n",f); - fputs("<td align=\"center\"><span style=\"font-weight: bold;\">Reference\n",f); - fputs("Release<br>\n",f); - fputs("</span></td>\n",f); - fputs("<td align=\"center\"><span style=\"font-weight: bold;\">Current\n",f); - fputs("Release</span></td>\n",f); - fputs("<td align=\"center\"><span style=\"font-weight: bold;\">Comparison</span></td>\n",f); - fputs("</tr>\n",f); - fclose(f); - return 1; -} - -int PrintHtmlFoot(char *html) -{ - time_t rawtime; - struct tm * timeinfo; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - - FILE * f = fopen(html,"a"); - if (!f) return 0; - fputs("</tr>\n",f); - fputs("</tbody>\n",f); - fputs("</table>\n",f); - fputs("<br>\n",f); - fputs("<address>This page was automatically generated using a modified version of root_to_html (S.Vahsen/LBNL) on ",f); - fputs(asctime(timeinfo),f); - fputs(".</address>\n",f); - fputs("</body>\n",f); - fputs("</html>\n",f); - fclose(f); - return 1; -} - -int SaveHistograms(TCanvas * cx, char *hname, char *ext, char *dir) -{ - char epsname[512]; - char gifname[512]; - char comm1[512]; - char comm2[512]; - char comm3[512]; - - sprintf(epsname,"%s%s_%s.eps",dir, hname,ext); - sprintf(gifname,"%s%s_%s.gif",dir, hname,ext); - sprintf(comm1,"%s %s","pstopnm -ppm -xborder 0 -yborder 0 -portrait",epsname); - sprintf(comm2,"%s %s%s %s","ppmtogif",epsname,"001.ppm >",gifname); - sprintf(comm3,"%s%s%s","rm -f ",epsname,"001.ppm"); - - // cx->SaveAs(gifname); - - cx->SaveAs(epsname); - gSystem->Exec(comm1); - gSystem->Exec(comm2); - gSystem->Exec(comm3); - - return 1; -} - -void JetTagAna_RTT_postProcessing() { - cout << "Starting JetTagAna_RTT_postProcessing..." << endl; - root_to_html("JetTagAna_RTT_refsHist.root","tagana.root","12.0.6.5","current","","JetTagAna_RTT_testList.txt","","all_tests.html"); -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT_testList.txt b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT_testList.txt deleted file mode 100644 index 4f19dc54cd580e9c9b9d7434d92a31902ea57a71..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_RTT_testList.txt +++ /dev/null @@ -1,131 +0,0 @@ -Histogram global_counters Test cmp_are_almost_identical(0.03) -Histogram global_nprimvtx Test cmp_are_almost_identical(0.03) -Histogram global_xprimvtx Test cmp_are_almost_identical(0.03) -Histogram global_yprimvtx Test cmp_are_almost_identical(0.03) -Histogram global_zprimvtx Test cmp_are_almost_identical(0.03) -Histogram global_primvtxresx Test ref_mean_near_zero cur_mean_near_zero cmp_are_almost_identical(0.03) -Histogram global_primvtxresy Test ref_mean_near_zero cur_mean_near_zero cmp_are_almost_identical(0.03) -Histogram global_primvtxresz Test ref_mean_near_zero cur_mean_near_zero cmp_are_almost_identical(0.03) -Histogram global_nmcpart Test cmp_are_almost_identical(0.03) -Histogram global_ntrkpart Test cmp_are_almost_identical(0.03) -Histogram global_BLayerHits Test cmp_are_almost_identical(0.03) -Histogram global_BLayerSharedHits Test cmp_are_almost_identical(0.03) -Histogram global_PixelHits Test cmp_are_almost_identical(0.03) -Histogram global_PixelLayers Test cmp_are_almost_identical(0.03) -Histogram global_SiHits Test cmp_are_almost_identical(0.03) -Histogram global_TRTHits Test cmp_are_almost_identical(0.03) -Histogram global_nmuon Test cmp_are_almost_identical(0.03) -Histogram global_nelectron Test cmp_are_almost_identical(0.03) -Histogram global_njettag Test cmp_are_almost_identical(0.03) -Histogram truth_bquark_nb Test cmp_are_almost_identical(0.03) -Histogram truth_bquark_pt Test cmp_are_almost_identical(0.03) -Histogram truth_bquark_eta Test cmp_are_almost_identical(0.03) -Histogram truth_cquark_nb Test cmp_are_almost_identical(0.03) -Histogram truth_cquark_pt Test cmp_are_almost_identical(0.03) -Histogram truth_cquark_eta Test cmp_are_almost_identical(0.03) -Histogram truth_bhadr_nb Test cmp_are_almost_identical(0.03) -Histogram truth_bhadr_pt Test cmp_are_almost_identical(0.03) -Histogram truth_bhadr_eta Test cmp_are_almost_identical(0.03) -Histogram truth_chadr_nb Test cmp_are_almost_identical(0.03) -Histogram truth_chadr_pt Test cmp_are_almost_identical(0.03) -Histogram truth_chadr_eta Test cmp_are_almost_identical(0.03) -Histogram jet_ntotal Test cmp_are_almost_identical(0.03) -Histogram jet_label Test cmp_are_almost_identical(0.03) -Histogram jet_nlabelb Test cmp_are_almost_identical(0.03) -Histogram jet_nlabelc Test cmp_are_almost_identical(0.03) -Histogram jet_nlabelt Test cmp_are_almost_identical(0.03) -Histogram jet_ntag Test cmp_are_almost_identical(0.03) -Histogram jet_eta Test cmp_are_almost_identical(0.03) -Histogram jet_phi Test cmp_are_almost_identical(0.03) -Histogram jet_et Test cmp_are_almost_identical(0.03) -Histogram jet_ntracks Test cmp_are_almost_identical(0.03) -Histogram jet_nmuons Test cmp_are_almost_identical(0.03) -Histogram jet_muons_pt Test cmp_are_almost_identical(0.03) -Histogram jet_nelectrons Test cmp_are_almost_identical(0.03) -Histogram jet_electrons_pt Test cmp_are_almost_identical(0.03) -Histogram tag_jetprob_w Test cmp_are_almost_identical(0.03) -Histogram tag_i2d_w Test cmp_are_almost_identical(0.03) -Histogram tag_i2d_n Test cmp_are_almost_identical(0.03) -Histogram tag_i2d_b Test cmp_are_almost_identical(0.03) -Histogram tag_i2d_u Test cmp_are_almost_identical(0.03) -Histogram tag_i2d_sig Test cmp_are_almost_identical(0.03) -Histogram tag_i3d_w Test cmp_are_almost_identical(0.03) -Histogram tag_i3d_n Test cmp_are_almost_identical(0.03) -Histogram tag_i3d_b Test cmp_are_almost_identical(0.03) -Histogram tag_i3d_u Test cmp_are_almost_identical(0.03) -Histogram tag_i3d_sig Test cmp_are_almost_identical(0.03) -Histogram tag_sv1_w Test cmp_are_almost_identical(0.03) -Histogram tag_sv1_b Test cmp_are_almost_identical(0.03) -Histogram tag_sv1_u Test cmp_are_almost_identical(0.03) -Histogram tag_sv2_w Test cmp_are_almost_identical(0.03) -Histogram tag_sv2_b Test cmp_are_almost_identical(0.03) -Histogram tag_sv2_u Test cmp_are_almost_identical(0.03) -Histogram tag_sv_n Test cmp_are_almost_identical(0.03) -Histogram tag_sv_n2t Test cmp_are_almost_identical(0.03) -Histogram tag_sv_frc Test cmp_are_almost_identical(0.03) -Histogram tag_sv_m Test cmp_are_almost_identical(0.03) -Histogram tag_cmb_w Test cmp_are_almost_identical(0.03) -Histogram tag_lf2d_w Test cmp_are_almost_identical(0.03) -Histogram tag_svbu_w Test cmp_are_almost_identical(0.03) -Histogram tag_lhsig_w Test cmp_are_almost_identical(0.03) -Histogram tag_softm_w Test cmp_are_almost_identical(0.03) -Histogram tag_softe_w Test cmp_are_almost_identical(0.03) -Histogram tag_jetfitter_w Test cmp_are_almost_identical(0.03) -Histogram tag_jetfitcomb_w Test cmp_are_almost_identical(0.03) -Histogram tag_jetfitternn_w Test cmp_are_almost_identical(0.03) -Histogram tag_jetfitcombnn_w Test cmp_are_almost_identical(0.03) -Histogram perf_ip2d_b Test cmp_are_almost_identical(0.03) -Histogram perf_ip2d_u Test cmp_are_almost_identical(0.03) -Histogram perf_ip2d_upur Test cmp_are_almost_identical(0.03) -Histogram perf_ip3d_b Test cmp_are_almost_identical(0.03) -Histogram perf_ip3d_u Test cmp_are_almost_identical(0.03) -Histogram perf_ip3d_upur Test cmp_are_almost_identical(0.03) -Histogram perf_sv1_b Test cmp_are_almost_identical(0.03) -Histogram perf_sv1_u Test cmp_are_almost_identical(0.03) -Histogram perf_sv1_upur Test cmp_are_almost_identical(0.03) -Histogram perf_sv2_b Test cmp_are_almost_identical(0.03) -Histogram perf_sv2_u Test cmp_are_almost_identical(0.03) -Histogram perf_sv2_upur Test cmp_are_almost_identical(0.03) -Histogram perf_ip3dsv1_b Test cmp_are_almost_identical(0.03) -Histogram perf_ip3dsv1_u Test cmp_are_almost_identical(0.03) -Histogram perf_ip3dsv1_upur Test cmp_are_almost_identical(0.03) -Histogram perf_lifetime2d_b Test cmp_are_almost_identical(0.03) -Histogram perf_lifetime2d_u Test cmp_are_almost_identical(0.03) -Histogram perf_lifetime2d_upur Test cmp_are_almost_identical(0.03) -Histogram perf_secvtxtagbu_b Test cmp_are_almost_identical(0.03) -Histogram perf_secvtxtagbu_u Test cmp_are_almost_identical(0.03) -Histogram perf_secvtxtagbu_upur Test cmp_are_almost_identical(0.03) -Histogram perf_lhsig_b Test cmp_are_almost_identical(0.03) -Histogram perf_lhsig_u Test cmp_are_almost_identical(0.03) -Histogram perf_lhsig_upur Test cmp_are_almost_identical(0.03) -Histogram perf_softmuontag_b Test cmp_are_almost_identical(0.03) -Histogram perf_softmuontag_u Test cmp_are_almost_identical(0.03) -Histogram perf_softmuontag_upur Test cmp_are_almost_identical(0.03) -Histogram perf_softelectrontag_b Test cmp_are_almost_identical(0.03) -Histogram perf_softelectrontag_u Test cmp_are_almost_identical(0.03) -Histogram perf_softelectrontag_upur Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitter_b Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitter_u Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitter_upur Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitcomb_b Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitcomb_u Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitcomb_upur Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitternn_b Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitternn_u Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitternn_upur Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitcombnn_b Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitcombnn_u Test cmp_are_almost_identical(0.03) -Histogram perf_jetfitcombnn_upur Test cmp_are_almost_identical(0.03) -Histogram perf_jetprob_b Test cmp_are_almost_identical(0.03) -Histogram perf_jetprob_u Test cmp_are_almost_identical(0.03) -Histogram perf_jetprob_upur Test cmp_are_almost_identical(0.03) -Histogram perf_vxeff_den_b Test cmp_are_almost_identical(0.03) -Histogram perf_vxeff_num_b Test cmp_are_almost_identical(0.03) -Histogram perf_vxeff_den_u Test cmp_are_almost_identical(0.03) -Histogram perf_vxeff_num_u Test cmp_are_almost_identical(0.03) -Histogram perf_vxeff_den_upur Test cmp_are_almost_identical(0.03) -Histogram perf_vxeff_num_upur Test cmp_are_almost_identical(0.03) -Histogram perf_rej50 Test cmp_are_almost_identical(0.03) -Histogram perf_rej60 Test cmp_are_almost_identical(0.03) -Histogram perf_rejpur50 Test cmp_are_almost_identical(0.03) -Histogram perf_rejpur60 Test cmp_are_almost_identical(0.03) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_jobOptions.py deleted file mode 100644 index 82c37edff88b96a582989a82b7224bdeedb30269..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_jobOptions.py +++ /dev/null @@ -1,21 +0,0 @@ - -# Python job to configure JetTagAna -# Laurent Vacavant 2005/10/12 - -if not "AnalysisExamples" in theApp.Dlls: - theApp.Dlls += [ "AnalysisExamples" ] - -from AnalysisExamples.AnalysisExamplesConf import JetTagAna -MyJetTagAna = JetTagAna( - name="MyJetTagAna", - #SelectBFromRun = run_number # use only u-jets from this run - #SelectUFromRun = run_number # use only u-jets from this run - OutputLevel=INFO) - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += MyJetTagAna - -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = ["fileJetTagAna DATAFILE='tagana.root' OPT='RECREATE'"] diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_postProcessing.C b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_postProcessing.C deleted file mode 100644 index 8166ab03004a864a876e4d4f9bcc1e8395128a19..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_postProcessing.C +++ /dev/null @@ -1,144 +0,0 @@ -#include <iostream> -#include <iomanip> -#include <sstream> -#include <cmath> - -#include "TROOT.h" -#include "TFile.h" -#include "TGraph.h" -#include "TH1.h" -#include "TStyle.h" -#include "TCanvas.h" -#include "TPad.h" -#include "TLegend.h" - -void plotPerf(std::string fileIn) -{ - - TFile* file = new TFile(fileIn.c_str(),"read"); - - std::string tagger[10]; - tagger[0] = "IP2D"; - tagger[1] = "IP3D"; - tagger[2] = "SV1"; - tagger[3] = "SV2"; - tagger[4] = "IP3DSV1"; - tagger[5] = "Lifetime2D"; - tagger[6] = "SecVtxTagBU"; - tagger[7] = "lhSig"; - tagger[8] = "SoftMuonTag"; - tagger[9] = "SoftElectronTag"; - for(int i=0;i<10;i++) - { - std::cout << "Starting with tagger " << tagger[i] << std::endl; - - TString tit("perf_"); tit+=tagger[i]; tit.ToLower(); - - std::cout << "Histo " << tit << std::endl; - - // b-jets: - TH1F* bjet = (TH1F*)file->Get(tit+"_b"); - if(bjet==0) continue; - double nbjets = bjet->GetEntries(); - - // light jets: - TH1F* ujet = (TH1F*)file->Get(tit+"_u"); - if(ujet==0)continue; - double nujets = ujet->GetEntries(); - - // purified light jets: - TH1F* upurjet = (TH1F*)file->Get(tit+"_upur"); - if(upurjet==0)continue; - double nupurjets = upurjet->GetEntries(); - - std::cout << "Histograms " << bjet << " " << ujet << " " << upurjet << std::endl; - - int nbins = ujet->GetNbinsX(); - const int nmax = 200; - if(nbins>nmax)std::cout << "JetTagAna_postProcessing ERROR: nbins too large" << std::endl; - double beff[nmax] = {0}; - double ueff[nmax] = {0}; - double upureff[nmax] = {0}; - int ngdbins(nbins); - int ngdbinspur(nbins); - for(int k=0;k<nbins;k++) - { - if( ngdbins ==nbins && (bjet->Integral(k+1,nbins) == 0 || ujet ->Integral(k+1,nbins) == 0) ) ngdbins = k; - if( ngdbinspur==nbins && (bjet->Integral(k+1,nbins) == 0 || upurjet->Integral(k+1,nbins) == 0) ) ngdbinspur = k; - if(nbjets)beff[k] = bjet ->Integral(k+1,nbins)/nbjets; - if(nujets)ueff[k] = ujet ->Integral(k+1,nbins)/nujets; - if(nupurjets)upureff[k] = upurjet->Integral(k+1,nbins)/nupurjets; - } - - std::cout << "Done computing efficiencies..." << std::endl; - - if(ngdbins==0||ngdbinspur==0)continue; - - double urej [nmax] = {0}; - double upurrej[nmax] = {0}; - for(int k=0;k<nbins;k++) - { - if(ueff[k])urej[k] = 1./ueff[k]; - if(upureff[k])upurrej[k] = 1./upureff[k]; - } - - std::cout << "Done computing rejections..." << std::endl; - - TString cn = tit+"_canvas"; - TCanvas* c = new TCanvas(cn,cn,800,600); - c->Draw(); - c->cd(); - - TGraph* bVSupur(0); - if(ngdbinspur) - { - bVSupur = new TGraph(ngdbinspur,beff,upurrej); - std::cout << "TGraph " << bVSupur << std::endl; - bVSupur->SetName(tit+"_graph_pur"); - bVSupur->SetTitle(tagger[i].c_str()); - bVSupur->SetLineColor(2); - bVSupur->SetMarkerSize(1.3); - bVSupur->SetLineWidth(4); - bVSupur->SetMarkerColor(2); - bVSupur->SetMarkerStyle(21); - bVSupur->GetXaxis()->SetTitle("#epsilon_{B}"); - bVSupur->GetYaxis()->SetTitle("Rejection"); - bVSupur->Draw("ACP"); - } - - TGraph* bVSu(0); - if(ngdbins) - { - bVSu = new TGraph(ngdbins,beff,urej); - std::cout << "TGraph " << bVSu << std::endl; - bVSu->SetName(tit+"_graph"); - bVSu->SetTitle(tagger[i].c_str()); - bVSu->SetLineColor(4); - bVSu->SetMarkerSize(1.3); - bVSu->SetLineWidth(4); - bVSu->SetMarkerColor(4); - bVSu->SetMarkerStyle(20); - bVSu->GetXaxis()->SetTitle("#epsilon_{B}"); - bVSu->GetYaxis()->SetTitle("Rejection"); - if(ngdbinspur)bVSu->Draw("CPsame"); - else bVSu->Draw("ACP"); - } - - TLegend* leg1 = new TLegend(0.55,0.7,0.9,.87); - leg1->SetName(tit+"_leg"); - leg1->AddEntry(bVSu->GetName(),"All light jets","pl"); - leg1->AddEntry(bVSupur->GetName(),"Purified light jets","pl"); - leg1->SetFillColor(0); - leg1->Draw(); - - c->Print(tit+".eps"); - c->Print(tit+".gif"); - - std::cout << "Done with tagger " << tagger[i] << std::endl; - } - - file->Close(); - file->Delete(); - -} - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_postProcessingHLT.C b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_postProcessingHLT.C deleted file mode 100644 index b0902dd44622b32cc84570664dec371d2beb26d2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/JetTagAna_postProcessingHLT.C +++ /dev/null @@ -1,328 +0,0 @@ -#include <fstream> - - -void JetTagAna_postProcessingHLT(TString sample){ - - ofstream fout("out.txt"); - - gROOT->Reset(); - gStyle->SetOptStat(0); - gROOT->ForceStyle(); - - Int_t first=1; - Int_t last=1; - - TString path_bb = "./"; - TString path_uu = "./"; - TString path = "./"; - - TString fileName_bb; - TString fileName_uu; - TString fileName; - - TH1F* hbbL2 = 0; - TH1F* hbbEF = 0; - TH1F* huuL2 = 0; - TH1F* huuEF = 0; - TH1F* hbbOf1 = 0; - TH1F* huuOf1 = 0; - TH1F* hbbOf2 = 0; - TH1F* huuOf2 = 0; - - if (sample == "5850" || sample == "5851") { - - fileName_bb = "tagana.bb.0"; - fileName_uu = "tagana.uu.0"; - - } else if (sample == "5200") { - - fileName = "tagana.0"; - - } - - if (sample == "5850" || sample == "5851") { - - bool doFirst_u = true; - bool doFirst_b = true; - - for(Int_t i = first; i <= last; i++) { - - TString realFileName_bb; - TString realFileName_uu; - - TString insideFileName_bb = fileName_bb; - TString insideFileName_uu = fileName_uu; - - TString number = ""; number+=i; - - insideFileName_bb.Resize(insideFileName_bb.Length()-(number.Length()-1)); - insideFileName_uu.Resize(insideFileName_uu.Length()-(number.Length()-1)); - - realFileName_bb = insideFileName_bb+number+".root"; - realFileName_uu = insideFileName_uu+number+".root"; - - fout << path_bb << realFileName_bb << endl; - fout << path_uu << realFileName_uu << endl; - - ifstream fb(path_bb + realFileName_bb); - ifstream fu(path_uu + realFileName_uu); - - TFile* file; - - if(fb) { - - file = new TFile(path_bb + realFileName_bb); - - TH1F* h_bbL2 = (TH1F*)file->Get("perf_l2ip3d_b"); - TH1F* h_bbEF = (TH1F*)file->Get("perf_ef_afterl2_ip3d_b"); - TH1F* h_bbOf1 = (TH1F*)file->Get("perf_ofip3d_b"); - TH1F* h_bbOf2 = (TH1F*)file->Get("perf_ip3d_b"); - } - - if(fu) { - - file = new TFile(path_uu + realFileName_uu); - - TH1F* h_uuL2 = (TH1F*)file->Get("perf_l2ip3d_u"); - TH1F* h_uuEF = (TH1F*)file->Get("perf_ef_afterl2_ip3d_u"); - TH1F* h_uuOf1 = (TH1F*)file->Get("perf_ofip3d_u"); - TH1F* h_uuOf2 = (TH1F*)file->Get("perf_ip3d_u"); - } - - if (fu && doFirst_u){ - - huuL2 = new TH1F(*h_uuL2); - huuEF = new TH1F(*h_uuEF); - huuOf1 = new TH1F(*h_uuOf1); - huuOf2 = new TH1F(*h_uuOf2); - - doFirst_u = false; - } - - if (fb && doFirst_b){ - - hbbL2 = new TH1F(*h_bbL2); - hbbEF = new TH1F(*h_bbEF); - hbbOf1 = new TH1F(*h_bbOf1); - hbbOf2 = new TH1F(*h_bbOf2); - - doFirst_b = false; - } - - if(fu) { - huuL2->Add(h_uuL2); huuEF->Add(h_uuEF); - huuOf1->Add(h_uuOf1); huuOf2->Add(h_uuOf2); - } - - if(fb) { - hbbL2->Add(h_bbL2); hbbEF->Add(h_bbEF); - hbbOf1->Add(h_bbOf1); hbbOf2->Add(h_bbOf2); - } - } - } - - if (sample == "5200") { - - bool doFirst = true; - - for(Int_t i = first; i <= last; i++) { - - TString realFileName; - - TString insideFileName = fileName; - - TString number = ""; number+=i; - - insideFileName.Resize(insideFileName.Length()-(number.Length()-1)); - - realFileName = insideFileName+number+".root"; - - fout << path << realFileName << endl; - - ifstream f(path + realFileName); - - TFile* file; - - if(f) { - - file = new TFile(path + realFileName); - - TH1F* h_bbL2 = (TH1F*)file->Get("perf_l2_ip3d_b"); - TH1F* h_bbEF = (TH1F*)file->Get("perf_ef_afterl2_ip3d_b"); - //TH1F* h_bbEF = (TH1F*)file->Get("perf_ef_ip3d_b"); - TH1F* h_bbOf1 = (TH1F*)file->Get("perf_offline_afterhlt_ip3d_b"); - TH1F* h_bbOf2 = (TH1F*)file->Get("perf_ip3d_b"); - - TH1F* h_uuL2 = (TH1F*)file->Get("perf_l2_ip3d_u"); - TH1F* h_uuEF = (TH1F*)file->Get("perf_ef_afterl2_ip3d_u"); - //TH1F* h_uuEF = (TH1F*)file->Get("perf_ef_ip3d_u"); - TH1F* h_uuOf1 = (TH1F*)file->Get("perf_offline_afterhlt_ip3d_u"); - TH1F* h_uuOf2 = (TH1F*)file->Get("perf_ip3d_u"); - - TH1F* h_bbL2JetProb = (TH1F*)file->Get("perf_l2_jetprob_b"); - TH1F* h_bbEFJetProb = (TH1F*)file->Get("perf_ef_jetprob_b"); - - TH1F* h_uuL2JetProb = (TH1F*)file->Get("perf_l2_jetprob_u"); - TH1F* h_uuEFJetProb = (TH1F*)file->Get("perf_ef_jetprob_u"); - } - - if (f && doFirst){ - - hbbL2 = new TH1F(*h_bbL2); - hbbEF = new TH1F(*h_bbEF); - hbbOf1 = new TH1F(*h_bbOf1); - hbbOf2 = new TH1F(*h_bbOf2); - - huuL2 = new TH1F(*h_uuL2); - huuEF = new TH1F(*h_uuEF); - huuOf1 = new TH1F(*h_uuOf1); - huuOf2 = new TH1F(*h_uuOf2); - - hbbL2JetProb = new TH1F(*h_bbL2JetProb); - hbbEFJetProb = new TH1F(*h_bbEFJetProb); - - huuL2JetProb = new TH1F(*h_uuL2JetProb); - huuEFJetProb = new TH1F(*h_uuEFJetProb); - - doFirst = false; - - } - - if(f) { - - hbbL2->Add(h_bbL2); hbbEF->Add(h_bbEF); - hbbOf1->Add(h_bbOf1); hbbOf2->Add(h_bbOf2); - - huuL2->Add(h_uuL2); huuEF->Add(h_uuEF); - huuOf1->Add(h_uuOf1); huuOf2->Add(h_uuOf2); - - hbbL2JetProb->Add(h_bbL2JetProb); hbbEFJetProb->Add(h_bbEFJetProb); - huuL2JetProb->Add(h_uuL2JetProb); huuEFJetProb->Add(h_uuEFJetProb); - } - } - } - - TCanvas *c = new TCanvas("c","",10,10,500,500); - TGraphErrors *grx1 = new TGraphErrors(); - TGraphErrors *grx2 = new TGraphErrors(); - TGraphErrors *grx3 = new TGraphErrors(); - TGraphErrors *grx4 = new TGraphErrors(); - - fout << "L2 " << endl; - plot(fout,hbbL2,huuL2,grx1); - fout << "EF " << endl; - plot(fout,hbbEF,huuEF,grx2,1.,1.,"SAME"); - fout << "Offline corr." << endl; - plot(fout,hbbOf1,huuOf1,grx3,1.,1.,"SAME"); - fout << "Offline " << endl; - plot(fout,hbbOf2,huuOf2,grx4,1.,1.,"SAME"); - - grx1->Draw("AP"); - grx1->GetXaxis()->SetLimits(0.38,1.02); - grx1->SetMinimum(1); - grx1->SetMaximum(800); - grx1->SetMarkerStyle(22); - grx2->Draw("P"); - grx2->SetMarkerStyle(26); - grx3->Draw("P"); - grx3->SetMarkerStyle(20); - grx4->Draw("P"); - grx4->SetMarkerStyle(18); - - gPad->SetLogy(); - gPad->SetGrid(); - gPad->SetLeftMargin(0.15); - gPad->SetBottomMargin(0.15); - gPad->SetFillColor(0); - gPad->SetHighLightColor(0); - gPad->SetBorderMode(0); - - grx1->GetYaxis()->SetTitle("Light-jet rejection"); - grx1->GetXaxis()->SetTitle("b-jet efficiency"); - grx1->GetYaxis()->SetTitleOffset(1.3); - - TLegend *leg = new TLegend(0.5,0.65,0.88,0.85); - leg->SetTextSize(0.04); - leg->AddEntry(grx1,"L2","PL"); - leg->AddEntry(grx2,"EF after L2 ","PL"); - leg->AddEntry(grx3,"Offline after HLT","PL"); - leg->AddEntry(grx4,"Offline","PL"); - leg->Draw(); - - TCanvas *c2 = new TCanvas("c2","",10,10,500,500); - TGraphErrors *grx5 = new TGraphErrors(); - TGraphErrors *grx6 = new TGraphErrors(); - - fout << "L2 JetProb" << endl; - plot(fout,hbbL2JetProb,huuL2JetProb,grx5); - fout << "EF JetProb" << endl; - plot(fout,hbbEFJetProb,huuEFJetProb,grx6,1.,1.,"SAME"); - - grx5->Draw("AP"); - grx5->GetXaxis()->SetLimits(0.38,1.02); - grx5->SetMinimum(1); - grx5->SetMaximum(110); - grx5->SetMarkerStyle(22); - grx6->Draw("P"); - grx6->SetMarkerStyle(26); - - gPad->SetLogy(); - gPad->SetGrid(); - gPad->SetLeftMargin(0.15); - gPad->SetBottomMargin(0.15); - gPad->SetFillColor(0); - gPad->SetHighLightColor(0); - gPad->SetBorderMode(0); - - grx5->GetYaxis()->SetTitle("Light-jet rejection"); - grx5->GetXaxis()->SetTitle("b-jet efficiency"); - grx5->GetYaxis()->SetTitleOffset(1.3); - - TLegend *leg = new TLegend(0.5,0.65,0.88,0.85); - leg->SetTextSize(0.04); - leg->AddEntry(grx5,"L2 JetProb","PL"); - leg->AddEntry(grx6,"EF JetProb","PL"); - leg->Draw(); -} - -void plot(ofstream &fout, TH1F* hb, TH1F* hu,TGraphErrors *gr,double off_eps=1, double off_R=1, TString opt="AP"){ - - double totb = 0; - double totu = 0; - for (int i=0;i<hb->GetNbinsX();i++){ - totb += hb->GetBinContent(i+1); - totu += hu->GetBinContent(i+1); - } - - fout << "totb = " << totb << "; totu = " << totu << endl; - - double sumu=totu,sumb=totb; - double effu,effb,seffu,seffb; - int ind=0; - - for (int i=0;i<hb->GetNbinsX()-1;i++){ - if (i>=0){ - sumb -= hb->GetBinContent(i+1); - sumu -= hu->GetBinContent(i+1); - } - - //fout << "GetBinContent " << i+1 << " = " << hb->GetBinContent(i+1) << " " << totb << endl; - //fout << "GetBinCenter " << i << " = " << hu->GetBinCenter(i) << endl; - //fout << "sumb = " << sumb << "; sumu = " << sumu << endl; - - effb = sumb/totb*off_eps; - effu = sumu/totu*(1/off_R); - seffb = sqrt((effb)*(1-effb)/totb); - seffu = sqrt((effu)*(1-effu)/totu); - - fout << "cut " << hb->GetBinCenter(i+1)+hb->GetBinWidth(i+1) << " effb = " << effb << "; effu = " << effu << endl; - - if (effu!=0 && effb!=0){ - seffu = seffu/pow(effu,2); - gr->SetPoint(ind,effb,1./effu); - gr->SetPointError(ind,seffb,seffu); - ind++; - } - } -} - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/MiscellaneousExamples_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/MiscellaneousExamples_jobOptions.py deleted file mode 100644 index a75b15ca7dbe531e28552090ae218e64810d4dce..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/MiscellaneousExamples_jobOptions.py +++ /dev/null @@ -1,70 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, November 20, 2004 - -# Read in the AOD from POOL - AOD.pool.root -# this file is produced by running the AOD builders of the RDO raw data - -# import the analysis flags -from AnalysisExamples.AnalysisFlags import AnalysisFlags - -# back navigation and interactive session flags -AnalysisFlags.DoNavigation = False -AnalysisFlags.DoInteractive = True - -include( "AnalysisExamples/AnalysisCommon_jobOptions.py") - -AnalysisFlags.Print() - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr -# The AOD input file -import AthenaPoolCnvSvc.ReadAthenaPool -ServiceMgr.EventSelector.InputCollections = ["AOD.pool.root"] - -# The AOD input file for large statistics -#include ( "aodinput.py" ) - -########################################### -# setup TTree registration Service -# save ROOT histograms and NTuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = ["AANT DATAFILE='MiscellaneousExamples.root' OPT='RECREATE'"] -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() - -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'MisellaneousExamples.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# The user analysis algorithm to be executed -from AnalysisExamples.AnalysisExamplesConf import MiscellaneousExamples -topSequence += MiscellaneousExamples() - -MiscellaneousExamples = MiscellaneousExamples() -# The user analysis cuts - default values to changed by the user as needed - -# set the names of the particle containers to be retrieved from StoreGate -# must be the same name used to build the AOD container -# do not touch these if you do know what you are doing - -MiscellaneousExamples.JetContainerName = "Cone4H1TowerJets" -MiscellaneousExamples.ElectronContainerName = "ElectronAODCollection" -MiscellaneousExamples.MuonContainerName = "StacoMuonCollection" -MiscellaneousExamples.EventWeight = 1.0 -MiscellaneousExamples.JetPtCut = 20.0*GeV -MiscellaneousExamples.DeltaMjj = 25.0*GeV -MiscellaneousExamples.OutputLevel = INFO - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = ERROR - -# Number of Events to process -theApp.EvtMax = 200 - -# For interactive analysis in athena -if AnalysisFlags.DoInteractive: - include( "PyAnalysisCore/InitPyAnalysisCore.py" ) - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/PIDinAOD_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/PIDinAOD_jobOptions.py deleted file mode 100644 index 51b746b8aa5b533a946113ea468c49083f38f855..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/PIDinAOD_jobOptions.py +++ /dev/null @@ -1,53 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, July 16, 2004 - -# job options for particle identification analysis -# Read in the AOD from POOL -# this file is produced by running the AOD builders of the RDO raw data -# The user is supposed to modify the input data andset the flags as -# appropriate for his/her analysis - -#get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -# import the analysis flags -from AnalysisExamples.AnalysisFlags import AnalysisFlags - -# load common options and common DLL -include( "AnalysisExamples/AnalysisCommon_jobOptions.py" ) - -# Print the flags before running the analysis code -AnalysisFlags.Print() - -# particle pre selection job options -if AnalysisFlags.DoElectron: - include( "AnalysisExamples/DoElectron_jobOptions.py" ) -if AnalysisFlags.DoPhoton: - include( "AnalysisExamples/DoPhoton_jobOptions.py" ) -if AnalysisFlags.DoMuon: - include( "AnalysisExamples/DoMuon_jobOptions.py" ) -if AnalysisFlags.DoTauJet: - include( "AnalysisExamples/DoTauJet_jobOptions.py" ) -if AnalysisFlags.DoParticleJet: - include( "AnalysisExamples/DoParticleJet_jobOptions.py" ) -if AnalysisFlags.DoBJet: - include( "AnalysisExamples/DoBJet_jobOptions.py" ) - -# The AOD input file -import AthenaPoolCnvSvc.ReadAthenaPool -ServiceMgr.EventSelector.InputCollections = [ "AOD.pool.root" ] - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = DEBUG - -# Number of Events to process -theApp.EvtMax = 10000 - -######################################### -#Setup TTree registration Service -# save ROOT histograms and NTuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -# Root Ntuple output -ServiceMgr.THistSvc.Output = [ "FILE1 DATAFILE='PIDinAOD.ntuple.root' OPT='NEW'" ] -ServiceMgr.THistSvc.Output += [ "FILE2 DATAFILE='PIDinAOD.hist.root' OPT='NEW'" ] diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/PileUpTruthExample_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/PileUpTruthExample_topOptions.py deleted file mode 100644 index 768d5b07329802d29cb10d2fbb1ad63468317c3e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/PileUpTruthExample_topOptions.py +++ /dev/null @@ -1,25 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, february 2008 - -# get a handle on the service manager -from AthenaCommon.AppMgr import ServiceMgr as svcMgr - -# get a handle on the sequence of top-level algorithms -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool -svcMgr.EventSelector.InputCollections = [ "ESD.pool.root" ] - -from AnalysisExamples.AnalysisExamplesConf import PileUpTruthExample -topSequence += PileUpTruthExample( - "PileUpTruthExample", - McEventKey = "TruthEvent", - OutputLevel = INFO - ) - -from AthenaCommon.AppMgr import theApp -theApp.EvtMax = 100 - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/README.TXT b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/README.TXT deleted file mode 100644 index 0319ebb7014e568b5c7a9db377e503554311bed3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/README.TXT +++ /dev/null @@ -1,8 +0,0 @@ -Some of the examples have three jobOptions files, e.g., - -ttbarExample_jobOptions.py -ttbarExample_jobOptions_AutoConfig.py -ttbarExample_jobOptions_New.py - -Please look at https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhysicsAnalysisWorkBookAODAnalysisRel15#What_s_NEW_on_this_page for an explanation - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ReadTruthParticles_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ReadTruthParticles_jobOptions.py deleted file mode 100644 index f36389993cb7c7fc4221a8b1b2c86dfb04dfeca9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ReadTruthParticles_jobOptions.py +++ /dev/null @@ -1,18 +0,0 @@ -# Fragment to run the ReadTruthParticles Algorithm -# Author : S.Binet <binet.At_cern.ch> - -import AthenaCommon.Constants as Lvl -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from McParticleTools.McParticleToolsConf import TruthParticleCnvTool -from AnalysisExamples.AnalysisExamplesConf import ReadTruthParticles - -topSequence += ReadTruthParticles( - "ReadTruthParticles", - ## input location of the TruthParticles - TruthParticles = "SpclMC", - - ## message level for this algorithm - OutputLevel = Lvl.INFO - ) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ReadTruthParticles_topOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ReadTruthParticles_topOptions.py deleted file mode 100644 index 6ebf9614e2386669e9fe71228d3c00a950f598fc..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ReadTruthParticles_topOptions.py +++ /dev/null @@ -1,54 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, June 12, 2004 - -# get a handle on the service manager -from AthenaCommon.AppMgr import ServiceMgr as svcMgr - -# get a handle on the sequence of top-level algorithms -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# the POOL converters: loaded on demand from now on (release 13) -## include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -## include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -## include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -## include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -# Read in the AOD from POOL - AOD.pool.root -# this file is produced by running the AOD builders of the RDO raw data - -#-------- to convert "GEN_EVENT" to TruthParticles on the fly - Ketevi A. Assamagan -#from ParticleBuilderOptions.AODFlags import AODFlags -#AODFlags.McEventKey = "GEN_EVENT" -#from McParticleAlgs.JobOptCfg import createTruthParticlesBuilder -#topSequence += createTruthParticlesBuilder() -#from JetRec.JetGetters import * -#from JetRec.JetRecFlags import jetFlags -#jetFlags.inputFileType = 'GEN' -#make_StandardJetGetter('Cone',0.4,'Truth').jetAlgorithmHandle() - -#------------ - -include ( "AnalysisExamples/ReadTruthParticles_jobOptions.py" ) -ReadTruthParticles = topSequence.ReadTruthParticles -ReadTruthParticles.ConvertFromESD = True - -if ReadTruthParticles.ConvertFromESD: - #ESD case - svcMgr.EventSelector.InputCollections = [ "ESD.pool.root" ] - ReadTruthParticles.CnvTool.McEvents = "TruthEvent" - ReadTruthParticles.CnvTool.TruthParticlesOutput = "SpclMC_ESD" - ReadTruthParticles.TruthParticles = "SpclMC_ESD" -else: - # The AOD case - svcMgr.EventSelector.InputCollections = [ "AOD.pool.root" ] - -# Number of Events to process -from AthenaCommon.AppMgr import theApp -theApp.EvtMax = 500 - - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/TrackExample_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/TrackExample_jobOptions.py deleted file mode 100644 index 4a422d62fb4aad98db5bce74954463aaa807c7f4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/TrackExample_jobOptions.py +++ /dev/null @@ -1,52 +0,0 @@ -# Author: Ketevi A. Assamagan -# CERN, February 13, 2005 - -# Set up the reading of an xAOD file using RecExCommon: -FNAME = "/afs/cern.ch/atlas/project/PAT/data/xAOD/" \ - "valid2.147807.PowhegPythia8_AU2CT10_Zmumu.digit." \ - "AOD.e2657_s1933_s1964_r5493.pool.root" -import AthenaPoolCnvSvc.ReadAthenaPool -ServiceMgr.EventSelector.InputCollections = [ FNAME ] - -# Access the algorithm sequence: -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -# Create and configure the example algorithm: -from AnalysisExamples.AnalysisExamplesConf import TrackExample -trackExample = TrackExample() - -# The stream/file to write to -trackExample.RootStreamName = "/AANT" -trackExample.RootDirName = "TrackParticle" - -# Track isolation cone -trackExample.TrackIsolationCone = 16 - -# Event weight -trackExample.EventWeight = 1.0 - -# Track Momentum cut -trackExample.TrackMomentumCut = 1.0 * GeV - -# Message output level for this algorithm -trackExample.OutputLevel = DEBUG - -# Print the algorithm's properties: -print trackExample - -# Add the algorithm to the sequence: -topSequence += trackExample - -# Number of Events to process -theApp.EvtMax = 10 - -######################################### -#Setup TTree registration Service -# save ROOT histograms and NTuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -#Root Ntuple output file and name -ServiceMgr.THistSvc.Output += [ - "AANT DATAFILE='TrackExample.hist.root' OPT='RECREATE'" - ] diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/TrigAnalysisExample_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/TrigAnalysisExample_jobOptions.py deleted file mode 100644 index 78e7101d233ea5d8e262d97d71263884961d3ca4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/TrigAnalysisExample_jobOptions.py +++ /dev/null @@ -1,60 +0,0 @@ -# TriggerExample_jobOptions.py -# Based on UserAnalysis/AnalysisSkeleton_topOptions.py - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# Particle Properties -from PartPropSvc.PartPropSvcConf import PartPropSvc - -# the POOL converters -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -# The AOD input file -ServiceMgr.EventSelector.InputCollections = [ "AOD.pool.root" ] - -# Create the algorithm sequence: -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -# Add the analysis algorithm: -from AnalysisExamples.AnalysisExamplesConf import TrigAnalysisExample -topSequence += TrigAnalysisExample() -topSequence.TrigAnalysisExample.OutputLevel = INFO - -## -########################################## -## Set up trigger configuration service and metadata service -## it relies on, for analysis job without RecExCommon - -from AthenaCommon.GlobalFlags import GlobalFlags -GlobalFlags.DetGeo.set_atlas() - -# set up trigger configuration service -from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter -cfg = TriggerConfigGetter("ReadPool") - -## set up trigger decision tool -from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool -ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) -topSequence.TrigAnalysisExample.TrigDecisionTool = ToolSvc.TrigDecisionTool - -## END of trigger setup -## - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = WARNING - -# Number of Events to process -theApp.EvtMax = 10 - -from GaudiCommonSvc.GaudiCommonSvcConf import AuditorSvc -ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -AthenaPoolCnvSvc.UseDetailChronoStat = TRUE diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/WriteTruthParticles_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/WriteTruthParticles_jobOptions.py deleted file mode 100644 index 57fd84457728d15bcf6106c6eb5d8fae26fc4afb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/WriteTruthParticles_jobOptions.py +++ /dev/null @@ -1,105 +0,0 @@ -############################################################### -# -# Job options file -# -#============================================================== - -# You can use this jobO like that: -# athena -c 'MCEVENTKEY="GEN_EVENT"; POOL_OUTPUT="my.pool.root"' AnalysisExamples/WriteTruthParticles_jobOptions.py - -#-------------------------------------------------------------- -# General Application Configuration options -#-------------------------------------------------------------- -import AthenaCommon.AtlasUnixGeneratorJob - -## get a handle on the sequence of top-level algorithms -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -## get a handle on the service manager -from AthenaCommon.AppMgr import ServiceMgr as svcMgr - -## get a handle on the application manager -from AthenaCommon.AppMgr import theApp - -#-------------------------------------------------------------- -# Event related parameters -#-------------------------------------------------------------- -if not 'EVTMAX' in dir(): - EVTMAX = 5 - pass -theApp.EvtMax = EVTMAX - -from AthenaServices.AthenaServicesConf import AtRndmGenSvc -svcMgr += AtRndmGenSvc( - "AtRndmGenSvc", - Seeds = [ - "PYTHIA 4789899 989240512", "PYTHIA_INIT 820021 2347532", - "JIMMY 390020611 821000366", "JIMMY_INIT 820021 2347532", - "HERWIG 390020611 821000366", "HERWIG_INIT 820021 2347532", - ] - ) - -#################### -# Generate the event -#################### -from Pythia_i.Pythia_iConf import Pythia - -topSequence += Pythia( - "Pythia", - PythiaCommand = [ - # generate ttbar events - "pysubs msel 6", - - #selection of the subprocess gg -> ttbar - "pysubs msub 81 1", - "pysubs msub 82 1", - ] - ) - -############################### -# Dump the event from Generator -############################### -if not 'MCEVENTKEY' in dir(): - MCEVENTKEY = "GEN_EVENT" - pass -# uncomment this if you want to dump the McEventCollection on-screen -## from TruthExamples.TruthExamplesConf import DumpMC -## topSequence += DumpMC("GenMcEvent", -## McEventKey = MCEVENTKEY) - -############################### -# Convert a McEventCollection -# into a TruthParticleContainer -############################### -from McParticleTools.McParticleToolsConf import TruthParticleCnvTool -from AnalysisExamples.AnalysisExamplesConf import WriteTruthParticles -topSequence += WriteTruthParticles( - "WriteTruthParticles", - CnvTool = TruthParticleCnvTool( "CnvTool", - McEvents = MCEVENTKEY, - TruthParticlesOutput = "My"+MCEVENTKEY ) - ) - -#--------------------------------------------------------------- -# Pool Persistency -#--------------------------------------------------------------- -from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream - -if not 'POOL_OUTPUT' in dir(): - POOL_OUTPUT = "mc.aod.pool" - pass - -outStream = AthenaPoolOutputStream("OutStream") -outStream.ItemList = [ - "EventInfo#*", - "McEventCollection#*", - "TruthParticleContainer#*", - ] -outStream.OutputFile = POOL_OUTPUT - -#============================================================== -# -# End of job options file -# -############################################################### diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ZeeOnESDExample_jobOptions_AutoConfig.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ZeeOnESDExample_jobOptions_AutoConfig.py deleted file mode 100644 index 07a487fbf6c878f016b2c675af7b1ec6b5df271b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/ZeeOnESDExample_jobOptions_AutoConfig.py +++ /dev/null @@ -1,85 +0,0 @@ -# Author: Ketevi A. Assamagan -# CERN, February 2005 -# Modified by Vivek Jain, Mar. 2012 - -# This file uses AutoConfig to peek at the input file, and set Geometry tag, etc., correctly -# you don't need to set Geometry tags anymore. They are read from the file itself. - -# here give the full path of a file that you run over locally -# if you are running on the grid, it will ignore what you set here, and do the right thing -# if you want to run over multiple files locally, use glob as shown below - -from AthenaCommon.AthenaCommonFlags import jobproperties as jp -#jp.AthenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d49/AOD.191045._001937.pool.root.1'] -jp.AthenaCommonFlags.FilesInput = ['root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/rtt/prod/tct/rel_2/17.2.X/i686-slc5-gcc43-opt/offline/Tier0ChainTests/Run00183021_JetTauEtmiss0_Collisions/myESD_JetTauEtmiss_0.pool.root'] -#jp.AthenaCommonFlags.FilesInput = ['/usatlas/u/vj/vj_bnl_local/datafile/mc11_7TeV.105014.J5_pythia_jetjet.recon.ESD.e815_s1273_s1274_r3060_tid709350_00/ESD.709350._002530.pool.root.1'] - -#DATAPATH = '/afs/cern.ch/atlas/maxidisk/d49/' -#from glob import glob -#INPUT = glob(DATAPATH + 'AOD*.root*') -#print INPUT -#jp.AthenaCommonFlags.FilesInput = INPUT - -# -from RecExConfig.RecFlags import rec - -# import the data types -import EventKernel.ParticleDataType - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -include ("RecExCond/RecExCommon_flags.py") -include( "RecExCond/AllDet_detDescr.py" ) -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) - - -# The input file already specified near the top of this file -ServiceMgr.EventSelector.InputCollections = jp.AthenaCommonFlags.FilesInput() - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from AnalysisExamples.AnalysisExamplesConf import ZeeOnESD -topSequence += ZeeOnESD() - -# The user analysis cuts - default values to changed by the user as needed - -# set the names of the particle containers to be retrieved from StoreGate -# must be the same name used to build the AOD container -# do not touch these if you do know what you are doing - -# Electron Parameters -topSequence.ZeeOnESD.egammaContainer = "ElectronCollection" -topSequence.ZeeOnESD.TrackMatchContainer="egDetailContainer" -topSequence.ZeeOnESD.egammaEtCut = 20.0*GeV -topSequence.ZeeOnESD.egammaEtaCut = 2.5 - - -# message level for ZeeOnESD -topSequence.ZeeOnESD.OutputLevel = INFO - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = INFO -# print out all messages. may need to increase it -ServiceMgr.MessageSvc.defaultLimit = 9999999 - -# Number of Events to process -theApp.EvtMax = -1 - -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = ["AANT DATAFILE='ZeeOnESD.root' OPT='RECREATE'"] -from AnalysisTools.AthAnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -topSequence.AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -topSequence.AANTupleStream.OutputName = 'ZeeOnESD.root' -topSequence.AANTupleStream.WriteInputDataHeader = True -topSequence.AANTupleStream.OutputLevel = WARNING -# Root Ntuple output file and name -#theApp.HistogramPersistency = "ROOT" -#theApp.HistogramPersistencySvc.OutputFile = "VFitZmmOnAOD.root" - - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/produceGenEvents_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/produceGenEvents_jobOptions.py deleted file mode 100644 index c544b7f49e0f685087039184854fca33fea0f3df..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/produceGenEvents_jobOptions.py +++ /dev/null @@ -1,65 +0,0 @@ -import AthenaCommon.AtlasUnixGeneratorJob -from AthenaCommon.AppMgr import theApp - -include( "PartPropSvc/PartPropSvc.py" ) - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -#* load relevant libraries -ServiceMgr.AuditorSvc.Auditors = [ "ChronoAuditor" ] -from AthenaServices.AthenaServicesConf import AtRndmGenSvc -ServiceMgr += AtRndmGenSvc() - -ServiceMgr.AtRndmGenSvc.Seeds = ["PYTHIA 85909879 9707499", "PYTHIA_INIT 87928165 11160529"] - -#-------------------------------------------------------------- -# Persistency services -#-------------------------------------------------------------- -# you shouldn't need to change this -ServiceMgr.EventPersistencySvc.CnvServices = [ "McCnvSvc" ]; -#-------------------------------------------------------------- -# Event related parameters -#-------------------------------------------------------------- -# Number of events to be processed (default is 10) -theApp.EvtMax = 10 -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -# OUTPUT PRINTOUT LEVEL -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -# you can override this for individual modules if necessary -ServiceMgr.MessageSvc.OutputLevel = 3 -#-------------------------------------------------------------- -#GENERATORS SETUP (select by uncommenting/commenting) -#-------------------------------------------------------------- -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from Pythia_i.Pythia_iConf import Pythia -topSequence += Pythia() - -#------------------------------------------------------------- -# define your physics process here -# Declare the Pythia to be the Generator to be used -topSequence.Pythia.PythiaCommand += ["pysubs msel 6"] -#selection of the subprocess gg -> ttbar -topSequence.Pythia.PythiaCommand += ["pysubs msub 81 1"] -topSequence.Pythia.PythiaCommand += ["pysubs msub 82 1"] - -#------------------------------------------------------------- - -#------------------------------------------------------------- -# Pool Persistency -#------------------------------------------------------------- -from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream - -# EventInfo Converters -include( "EventAthenaPool/EventAthenaPool_joboptions.py") -PoolSvc = Service( "PoolSvc" ) -Stream1 = AthenaPoolOutputStream( "Stream1" ) -Stream1.ItemList+=["EventInfo#*"]; -Stream1.ItemList+=[ "McEventCollection#*" ] -Stream1.OutputFile = "McEvent.root" -#PoolSvc.Output = "McEvent.root" -#============================================================== diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/py_read_egamma_d3pd.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/py_read_egamma_d3pd.py deleted file mode 100644 index 907e7e064ad9e1d40df1b39dba23154c2a5346bf..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/py_read_egamma_d3pd.py +++ /dev/null @@ -1,26 +0,0 @@ -_d3pd_files = [ - 'root://castoratlas//castor/cern.ch/user/b/binet/utests/utests/filter-d3pd/ntuple.0.root', - #'ntuple.0.root', - ] -import AthenaRootComps.ReadAthenaRoot -svcMgr.EventSelector.InputCollections = _d3pd_files -svcMgr.EventSelector.TupleName = "egamma" - -#activeBranches = [ 'nMC' ] # only 1 branch -activeBranches = [ '*' ] # all branches -activeBranches = [] # no branch -svcMgr.EventSelector.ActiveBranches = activeBranches - -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() - -import AnalysisExamples.Lib as AEL -job += AEL.PyReadD3pdNtuple( - TreeName = '/temp/TTreeStream/egamma', - OutputLevel = Lvl.DEBUG - ) - -if not 'EVTMAX' in dir(): - EVTMAX=10 -theApp.EvtMax = EVTMAX - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/py_read_egamma_d3pd_evtstore.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/py_read_egamma_d3pd_evtstore.py deleted file mode 100644 index c58add868b2419ff982d95df5118df252ff05c35..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/py_read_egamma_d3pd_evtstore.py +++ /dev/null @@ -1,25 +0,0 @@ -_d3pd_files = [ - 'root://castoratlas//castor/cern.ch/user/b/binet/utests/utests/filter-d3pd/ntuple.0.root', - 'root://castoratlas//castor/cern.ch/user/b/binet/utests/utests/filter-d3pd/ntuple.1.root', - #'ntuple.0.root', - #'ntuple.1.root', - ] -import AthenaRootComps.ReadAthenaRoot -svcMgr.EventSelector.InputCollections = _d3pd_files -svcMgr.EventSelector.TupleName = "egamma" - -# disable all branches (will be activated on a need-to-use basis) -svcMgr.EventSelector.ActiveBranches = [] - -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() - -import AnalysisExamples.Lib as AEL -job += AEL.PyReadD3pdEvtStore( - OutputLevel = Lvl.DEBUG - ) - -if not 'EVTMAX' in dir(): - EVTMAX=10 -theApp.EvtMax = EVTMAX - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/read_egamma_d3pd.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/read_egamma_d3pd.py deleted file mode 100644 index cf8ecffa50b86ea14647c9acb7920a3624b4f9a6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/read_egamma_d3pd.py +++ /dev/null @@ -1,24 +0,0 @@ -_d3pd_files = [ - 'root://castoratlas//castor/cern.ch/user/b/binet/utests/utests/filter-d3pd/ntuple.0.root', - #'ntuple.0.root', - ] -import AthenaRootComps.ReadAthenaRoot -svcMgr.EventSelector.InputCollections = _d3pd_files -svcMgr.EventSelector.TupleName = "egamma" - -#activeBranches = [ 'nMC' ] # only 1 branch -activeBranches = [ '*' ] # all branches -activeBranches = [] # no branch -svcMgr.EventSelector.ActiveBranches = activeBranches - -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() -job += CfgMgr.AthEx__ReadD3pdNtuple( - TreeName = '/temp/TTreeStream/egamma', - OutputLevel = Lvl.DEBUG - ) - -if not 'EVTMAX' in dir(): - EVTMAX=10 -theApp.EvtMax = EVTMAX - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/read_egamma_d3pd_evtstore.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/read_egamma_d3pd_evtstore.py deleted file mode 100644 index 22d5c1181e2f8c926a40e3bd90855bfe4f46d7e2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/read_egamma_d3pd_evtstore.py +++ /dev/null @@ -1,30 +0,0 @@ -_d3pd_files = [ - 'root://castoratlas//castor/cern.ch/user/b/binet/utests/utests/filter-d3pd/ntuple.0.root', - 'root://castoratlas//castor/cern.ch/user/b/binet/utests/utests/filter-d3pd/ntuple.1.root', - #'ntuple.0.root', - #'ntuple.1.root', - ] -import AthenaRootComps.ReadAthenaRoot -svcMgr.EventSelector.InputCollections = _d3pd_files -svcMgr.EventSelector.TupleName = "egamma" - -# disable all branches (will be activated on a need-to-use basis) -svcMgr.EventSelector.ActiveBranches = [] - -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() - -job += CfgMgr.AthEx__ReadD3pdEvtStore( - 'alg1', - OutputLevel = Lvl.DEBUG - ) - -job += CfgMgr.AthEx__ReadD3pdEvtStore( - 'alg2', - OutputLevel = Lvl.DEBUG - ) - -if not 'EVTMAX' in dir(): - EVTMAX=10 -theApp.EvtMax = EVTMAX - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdEvtStore.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdEvtStore.cxx deleted file mode 100644 index fc1eaf0006d745d7ecdf0bfef80522d990fa3ea6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdEvtStore.cxx +++ /dev/null @@ -1,151 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// AthExReadD3pdEvtStore.cxx -// Implementation file for class AthEx::ReadD3pdEvtStore -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - -// AnalysisExamples includes -#include "AthExReadD3pdEvtStore.h" - -// STL includes - -// FrameWork includes -#include "Gaudi/Property.h" -#include "AthenaKernel/IDictLoaderSvc.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ITHistSvc.h" - -// SGTools -#include "SGTools/BuiltinsClids.h" // to put ints,... in evtstore -#include "SGTools/StlVectorClids.h" // to put std::vectors... in evtstore - - -namespace AthEx { - -/////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// - -// Constructors -//////////////// -ReadD3pdEvtStore::ReadD3pdEvtStore( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::AthAlgorithm( name, pSvcLocator ) -{ - // - // Property declaration - // - //declareProperty( "Property", m_nProperty ); - - m_runnbr = "RunNumber"; - m_evtnbr = "EventNumber"; - m_el_n = "el_n"; - m_el_eta = "el_eta"; - m_el_jetcone_dr = "el_jetcone_dr"; - -} - -// Destructor -/////////////// -ReadD3pdEvtStore::~ReadD3pdEvtStore() -{} - -// Athena Algorithm's Hooks -//////////////////////////// -StatusCode ReadD3pdEvtStore::initialize() -{ - ATH_MSG_INFO ("Initializing " << name() << "..."); - - return StatusCode::SUCCESS; -} - -StatusCode ReadD3pdEvtStore::finalize() -{ - ATH_MSG_INFO ("Finalizing " << name() << "..."); - - return StatusCode::SUCCESS; -} - -StatusCode ReadD3pdEvtStore::execute() -{ - ATH_MSG_DEBUG ("Executing " << name() << "..."); - - const uint32_t *runnbr = 0; - const uint32_t *evtnbr = 0; - const int32_t *el_n = 0; - const std::vector<float> *el_eta = 0; - const std::vector<std::vector<float> > *el_jetcone_dr = 0; - - if (!evtStore()->retrieve(runnbr, m_runnbr).isSuccess()) { - ATH_MSG_INFO("could not retrieve [RunNumber]"); - return StatusCode::SUCCESS; - } - - if (!evtStore()->retrieve(evtnbr, m_evtnbr).isSuccess()) { - ATH_MSG_INFO("could not retrieve [EventNumber]"); - return StatusCode::SUCCESS; - } - - if (!evtStore()->retrieve(el_n, m_el_n).isSuccess()) { - ATH_MSG_INFO("could not retrieve [el_n]"); - return StatusCode::SUCCESS; - } - - if (!evtStore()->retrieve(el_eta, m_el_eta).isSuccess()) { - ATH_MSG_INFO("could not retrieve [el_eta]"); - return StatusCode::SUCCESS; - } - - if (!evtStore()->retrieve(el_jetcone_dr, m_el_jetcone_dr).isSuccess()) { - ATH_MSG_INFO("could not retrieve [el_jetcone_dr]"); - return StatusCode::SUCCESS; - } - - msg(MSG::INFO) - << "run-nbr: " << *runnbr << endmsg - << "evt-nbr: " << *evtnbr << endmsg - << "el-nbr: " << *el_n << endmsg; - if (*el_n > 0) { - msg(MSG::INFO) << "el.eta[0]: " << el_eta->at(0) << endmsg - << "el_jetcone_dr[0].size: " - << el_jetcone_dr->at(0).size() - << endmsg; - for (std::size_t i = 0, imax = el_jetcone_dr->at(0).size(); - i != imax; - ++i) { - msg(MSG::INFO) << " jet-cone-dr[0][" << i << "]: " - << el_jetcone_dr->at(0)[i] - << endmsg; - } - } - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - - -} //> end namespace AthEx diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdEvtStore.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdEvtStore.h deleted file mode 100644 index ca4b64451bca0fcf382b29a490d3649824d3ce52..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdEvtStore.h +++ /dev/null @@ -1,85 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// ReadD3pdEvtStore.h -// Header file for class ReadD3pdEvtStore -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef ANALYSISEXAMPLES_ATHEXREADD3PDEVTSTORE_H -#define ANALYSISEXAMPLES_ATHEXREADD3PDEVTSTORE_H 1 - -// STL includes -#include <string> -#include <vector> -#include <stdint.h> - -// FrameWork includes -#include "AthenaBaseComps/AthAlgorithm.h" - -// fwd declares - -namespace AthEx { - -class ReadD3pdEvtStore - : public ::AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - // Copy constructor: - - /// Constructor with parameters: - ReadD3pdEvtStore( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~ReadD3pdEvtStore(); - - // Assignment operator: - //ReadD3pdEvtStore &operator=(const ReadD3pdEvtStore &alg); - - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - - /// Default constructor: - ReadD3pdEvtStore(); - - // containers - std::string m_runnbr; - std::string m_evtnbr; - std::string m_el_n; - std::string m_el_eta; - std::string m_el_jetcone_dr; - -}; - -// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - -} //> end namespace AthEx - -#endif //> !ANALYSISEXAMPLES_ATHEXREADD3PDEVTSTORE_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdNtuple.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdNtuple.cxx deleted file mode 100644 index 7f016b01dd78fe354714e369dacbee2cd152b461..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdNtuple.cxx +++ /dev/null @@ -1,199 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// AthExReadD3pdNtuple.cxx -// Implementation file for class AthEx::ReadD3pdNtuple -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - -// AnalysisExamples includes -#include "AthExReadD3pdNtuple.h" - -// STL includes - -// FrameWork includes -#include "Gaudi/Property.h" -#include "AthenaKernel/IDictLoaderSvc.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ITHistSvc.h" - -// ROOT includes -#include "TTree.h" - -namespace AthEx { - -/////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// - -// Constructors -//////////////// -ReadD3pdNtuple::ReadD3pdNtuple( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::AthAlgorithm( name, pSvcLocator ) -{ - // - // Property declaration - // - //declareProperty( "Property", m_nProperty ); - - declareProperty("TreeName", - m_treeName = "/temp/TTreeStream/egamma", - "Name of the TTree to access in THistSvc"); - m_runnbr = 0; - m_evtnbr = 0; - m_el_n = 0; - m_el_eta = 0; - m_el_jetcone_dr = 0; -} - -// Destructor -/////////////// -ReadD3pdNtuple::~ReadD3pdNtuple() -{} - -// Athena Algorithm's Hooks -//////////////////////////// -StatusCode ReadD3pdNtuple::initialize() -{ - ATH_MSG_INFO ("Initializing " << name() << "..."); - - ServiceHandle<ITHistSvc> hsvc("THistSvc/THistSvc", this->name()); - if (!hsvc.retrieve().isSuccess()) { - ATH_MSG_ERROR("could not retrieve THistSvc!"); - return StatusCode::FAILURE; - } - TTree *tree = 0; - if (!hsvc->getTree(m_treeName, tree).isSuccess() || - 0 == tree) { - ATH_MSG_ERROR("Could not register with our ttree!"); - return StatusCode::FAILURE; - } - - // connect our variables to the tree - if (!initBranches(tree).isSuccess()) { - ATH_MSG_ERROR("could not configure branches !"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; -} - -StatusCode ReadD3pdNtuple::finalize() -{ - ATH_MSG_INFO ("Finalizing " << name() << "..."); - - return StatusCode::SUCCESS; -} - -StatusCode ReadD3pdNtuple::execute() -{ - ATH_MSG_DEBUG ("Executing " << name() << "..."); - - msg(MSG::INFO) - << "run-nbr: " << m_runnbr << endmsg - << "evt-nbr: " << m_evtnbr << endmsg - << "el-nbr: " << m_el_n << endmsg; - if (m_el_n > 0) { - msg(MSG::INFO) << "el.eta[0]: " << m_el_eta->at(0) << endmsg - << "el_jetcone_dr[0].size: " - << m_el_jetcone_dr->at(0).size() - << endmsg; - for (std::size_t i = 0, imax = m_el_jetcone_dr->at(0).size(); - i != imax; - ++i) { - msg(MSG::INFO) << " jet-cone-dr[0][" << i << "]: " - << m_el_jetcone_dr->at(0)[i] - << endmsg; - } - } - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -StatusCode -ReadD3pdNtuple::initBranches(TTree *tree) -{ - { - TBranch *br = tree->GetBranch("RunNumber"); - if (0==br) { - ATH_MSG_ERROR("could not set branch address for [RunNumber]"); - return StatusCode::FAILURE; - } - br->SetStatus(1); - br->SetAddress(&m_runnbr); - } - { - TBranch *br = tree->GetBranch("EventNumber"); - if (0==br) { - ATH_MSG_ERROR("could not set branch address for [EventNumber]"); - return StatusCode::FAILURE; - } - br->SetStatus(1); - br->SetAddress(&m_evtnbr); - } - { - TBranch *br = tree->GetBranch("el_n"); - if (0==br) { - ATH_MSG_ERROR("could not set branch address for [el_n]"); - return StatusCode::FAILURE; - } - br->SetStatus(1); - br->SetAddress(&m_el_n); - } - ServiceHandle<IDictLoaderSvc> dictsvc("AthDictLoaderSvc", this->name()); - { - // load the reflex dict for this type: - if (dictsvc->load_type("std::vector<float>").Name() == "") { - ATH_MSG_ERROR("could not load reflex type for [std::vector<float>]!"); - return StatusCode::FAILURE; - } - TBranch *br = tree->GetBranch("el_eta"); - if (0==br) { - ATH_MSG_ERROR("could not set branch address for [el_eta]"); - return StatusCode::FAILURE; - } - br->SetStatus(1); - br->SetAddress(&m_el_eta); - } - { - // load the reflex dict for this type: - if (dictsvc->load_type("std::vector<std::vector<float> >").Name() == "") { - ATH_MSG_ERROR("could not load reflex type for [std::vector<std::vector<int> >]!"); - return StatusCode::FAILURE; - } - TBranch *br = tree->GetBranch("el_jetcone_dr"); - if (0==br) { - ATH_MSG_ERROR("could not set branch address for [el_jetcone_dr]"); - return StatusCode::FAILURE; - } - br->SetStatus(1); - br->SetAddress(&m_el_jetcone_dr); - } - - return StatusCode::SUCCESS; -} - -} //> end namespace AthEx diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdNtuple.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdNtuple.h deleted file mode 100644 index 5d2010ccc766bacf3f73ccb3aa31de2786ec6c20..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/AthExReadD3pdNtuple.h +++ /dev/null @@ -1,93 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// ReadD3pdNtuple.h -// Header file for class ReadD3pdNtuple -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef ANALYSISEXAMPLES_ATHEXREADD3PDNTUPLE_H -#define ANALYSISEXAMPLES_ATHEXREADD3PDNTUPLE_H 1 - -// STL includes -#include <string> -#include <vector> -#include <stdint.h> - -// FrameWork includes -#include "AthenaBaseComps/AthAlgorithm.h" - -// fwd declares -class TTree; - -namespace AthEx { - -class ReadD3pdNtuple - : public ::AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - // Copy constructor: - - /// Constructor with parameters: - ReadD3pdNtuple( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~ReadD3pdNtuple(); - - // Assignment operator: - //ReadD3pdNtuple &operator=(const ReadD3pdNtuple &alg); - - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - - /// Default constructor: - ReadD3pdNtuple(); - - /// initialize branches - StatusCode initBranches(TTree *tree); - - // name of the TTree to read from THistSvc - std::string m_treeName; - - // data to read from ttree - uint32_t m_runnbr; - uint32_t m_evtnbr; - - int32_t m_el_n; - std::vector<float> *m_el_eta; - std::vector<std::vector<float> > *m_el_jetcone_dr; - -}; - -// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - -} //> end namespace AthEx - -#endif //> !ANALYSISEXAMPLES_ATHEXREADD3PDNTUPLE_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx deleted file mode 100644 index ba11f5df82b214c14592a4fcb54e2f5996d9ff13..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.cxx +++ /dev/null @@ -1,2376 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// JetTagAna is an example algorithm which shows how to access the -// b-tagging information from JetTag objects. -// -// To simply access the b-tagging weight for each jet, have a look -// at the section SECTION::WEIGHTS -// -// To access the Monte-Carlo label (b,c or light) of a jet, have a -// look at the section SECTION::LABEL -// -// To access detailed information about each tag: SECTION::DETAILS -// -// Author: Laurent Vacavant <vacavant@in2p3.fr> - -#include "JetTagAna.h" - -#include "GaudiKernel/MsgStream.h" - -#include "StoreGate/DataHandle.h" - -#include "GaudiKernel/ITHistSvc.h" -#include "TH1F.h" -#include "TH2F.h" -#include "TTree.h" -#include "TMath.h" - -#include "McParticleEvent/TruthParticleContainer.h" -#include "JetEvent/Jet.h" -#include "JetEvent/JetCollection.h" -#include "JetEvent/JetTagInfoBase.h" -#include "JetTagEvent/TrackAssociation.h" -#include "Particle/TrackParticleContainer.h" - -#include "Navigation/NavigationToken.h" -#include "MuonIDEvent/MuonAssociation.h" -#include "egammaEvent/ElectronAssociation.h" - - -#include "egammaEvent/ElectronContainer.h" -#include "muonEvent/MuonContainer.h" - -/// the Electron -#include "egammaEvent/egamma.h" -#include "egammaEvent/Electron.h" -#include "egammaEvent/EMShower.h" -#include "egammaEvent/EMTrackMatch.h" - - -/// The Muon -#include "muonEvent/Muon.h" - -#include "JetTagInfo/ITagInfo.h" -#include "JetTagInfo/IPInfoBase.h" -#include "JetTagInfo/IPInfoPlus.h" -#include "JetTagInfo/IPTrackInfo.h" -#include "JetTagInfo/SVInfoBase.h" -#include "JetTagInfo/SVInfoPlus.h" -#include "JetTagInfo/TruthInfo.h" -#include "JetTagInfo/SoftMuonInfo.h" -#include "JetTagInfo/SMTrackInfo.h" -#include "JetTagInfo/SoftElectronInfo.h" -#include "JetTagInfo/SETrackInfo.h" -#include "JetTagInfo/SoftLeptonTruthInfo.h" -#include "JetTagInfo/SLTrueInfo.h" - -//* -#include "AnalysisTriggerEvent/LVL1_ROI.h" -#include "AnalysisTriggerEvent/Jet_ROI.h" -#include "TrigParticle/TrigL2BjetContainer.h" -#include "TrigParticle/TrigEFBjetContainer.h" - -#include "CLHEP/Vector/LorentzVector.h" -#include "VxVertex/VxContainer.h" -#include "VxVertex/RecVertex.h" - -#include "GeneratorObjects/McEventCollection.h" -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/GenParticle.h" - -#include "xAODEventInfo/EventInfo.h" -#include "AthenaKernel/Units.h" - -#include <map> -#include <algorithm> -#include <cmath> - -using Athena::Units::GeV; - -JetTagAna::JetTagAna(const std::string& name, - ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_irun(0), - m_ievt(0), - m_trackTES(nullptr), - m_mcpartTES(nullptr), - m_histos(nullptr), - m_h_global_counters(nullptr), - m_h_global_nprimvtx(nullptr), - m_h_global_xprimvtx(nullptr), - m_h_global_yprimvtx(nullptr), - m_h_global_zprimvtx(nullptr), - m_h_global_primvtxresx(nullptr), - m_h_global_primvtxresy(nullptr), - m_h_global_primvtxresz(nullptr), - m_h_global_nmcpart(nullptr), - m_h_global_ntrkpart(nullptr), - m_h_global_BLayerHits(nullptr), - m_h_global_BLayerSharedHits(nullptr), - m_h_global_PixelHits(nullptr), - m_h_global_PixelLayers(nullptr), - m_h_global_SiHits(nullptr), - m_h_global_TRTHits(nullptr), - m_h_global_nmuon(nullptr), - m_h_global_nelectron(nullptr), - m_h_global_njettag(nullptr), - m_h_truth_bquark_nb(nullptr), - m_h_truth_bquark_pt(nullptr), - m_h_truth_bquark_eta(nullptr), - m_h_truth_cquark_nb(nullptr), - m_h_truth_cquark_pt(nullptr), - m_h_truth_cquark_eta(nullptr), - m_h_truth_bhadr_nb(nullptr), - m_h_truth_bhadr_pt(nullptr), - m_h_truth_bhadr_eta(nullptr), - m_h_truth_chadr_nb(nullptr), - m_h_truth_chadr_pt(nullptr), - m_h_truth_chadr_eta(nullptr), - m_h_jet_ntotal(nullptr), - m_h_jet_label(nullptr), - m_h_jet_nlabelb(nullptr), - m_h_jet_nlabelc(nullptr), - m_h_jet_nlabelt(nullptr), - m_h_jet_ntag(nullptr), - m_h_jet_eta(nullptr), - m_h_jet_phi(nullptr), - m_h_jet_et(nullptr), - m_h_jet_ntracks(nullptr), - m_h_jet_tracks_pt(nullptr), - m_h_jet_tracks_BLayerHits(nullptr), - m_h_jet_tracks_PixelHits(nullptr), - m_h_jet_tracks_SCTHits(nullptr), - m_h_jet_nmuons(nullptr), - m_h_jet_muons_pt(nullptr), - m_h_jet_nelectrons(nullptr), - m_h_jet_electrons_pt(nullptr), - m_h_tag_jetprob_w(nullptr), - m_h_tag_i2d_w(nullptr), - m_h_tag_i2d_n(nullptr), - m_h_tag_i2d_b(nullptr), - m_h_tag_i2d_u(nullptr), - m_h_tag_i2d_sig(nullptr), - m_h_tag_i3d_w(nullptr), - m_h_tag_i3d_n(nullptr), - m_h_tag_i3d_b(nullptr), - m_h_tag_i3d_u(nullptr), - m_h_tag_i3d_sig(nullptr), - m_h_tag_sv1_w(nullptr), - m_h_tag_sv1_b(nullptr), - m_h_tag_sv1_u(nullptr), - m_h_tag_sv2_w(nullptr), - m_h_tag_sv2_b(nullptr), - m_h_tag_sv2_u(nullptr), - m_h_tag_sv_n(nullptr), - m_h_tag_sv_n2t(nullptr), - m_h_tag_sv_frc(nullptr), - m_h_tag_sv_m(nullptr), - m_h_tag_cmb_w(nullptr), - m_h_tag_lf2d_w(nullptr), - m_h_tag_svbu_w(nullptr), - m_h_tag_lhsig_w(nullptr), - m_h_tag_softm_w(nullptr), - m_h_tag_softe_w(nullptr), - m_h_tag_jetfitter_w(nullptr), - m_h_tag_jetfitcomb_w(nullptr), - m_h_tag_jetfitternn_w(nullptr), - m_h_tag_jetfitcombnn_w(nullptr), - m_h_tag_i2d_l2_w(nullptr), - m_h_tag_i3d_l2_w(nullptr), - m_h_tag_i2d_ef_w(nullptr), - m_h_tag_i3d_ef_w(nullptr), - m_h_tag_i2d_of_w(nullptr), - m_h_tag_i3d_of_w(nullptr), - m_h_tag_IPinfo_ntrk(), - m_h_tag_IPinfo_trkPt(), - m_h_tag_IPinfo_d0val(), - m_h_tag_IPinfo_z0val(), - m_h_tag_IPinfo_d0sig(), - m_h_tag_IPinfo_z0sig(), - m_h_tag_IPinfo_weight2D(), - m_h_tag_IPinfo_weight3D(), - m_h_tag_IPinfo_piJP(), - m_h_tag_IPinfo_fromV0(), - m_h_tag_IPinfo_grade(), - m_h_perf_b(), - m_h_perf_u(), - m_h_perf_upur(), - m_h_perf_vxeff_den_b(nullptr), - m_h_perf_vxeff_num_b(nullptr), - m_h_perf_vxeff_den_u(nullptr), - m_h_perf_vxeff_num_u(nullptr), - m_h_perf_vxeff_den_upur(nullptr), - m_h_perf_vxeff_num_upur(nullptr), - m_h_perf_rej10(nullptr), - m_h_perf_rej50(nullptr), - m_h_perf_rej60(nullptr), - m_h_perf_rejpur10(nullptr), - m_h_perf_rejpur50(nullptr), - m_h_perf_rejpur60(nullptr), - m_h_perfWt_10(nullptr), - m_h_perfWt_50(nullptr), - m_h_perfWt_60(nullptr), - m_h_perfWt_pur10(nullptr), - m_h_perfWt_pur50(nullptr), - m_h_perfWt_pur60(nullptr), - m_h_perf_b_ET(), - m_h_perf_b_eta(), - m_h_perf_b_phi(), - m_h_perf_u_ET(), - m_h_perf_u_eta(), - m_h_perf_u_phi(), - m_h_perf_upur_ET(), - m_h_perf_upur_eta(), - m_h_perf_upur_phi(), - m_h_eff_b_ET(), - m_h_eff_b_eta(), - m_h_eff_b_phi(), - m_h_rej_u_ET(), - m_h_rej_u_eta(), - m_h_rej_u_phi(), - m_h_rej_upur_ET(), - m_h_rej_upur_eta(), - m_h_rej_upur_phi(), - m_njet(0), - m_jet_phi(), - m_jet_eta(), - m_jet_et(), - m_jet_flav(), - m_jet_isol(), - m_jet_ne(), - m_jet_eTrueEle(), - m_jet_eAnyEle(), - m_jet_eptr(), - m_jet_ept(), - m_jet_ea0(), - m_jet_ew(), - m_jet_elh(), - m_jet_epb(), - m_jet_epu(), - m_jet_tag_pid(), - m_jet_tag_mothpid(), - m_jet_NtrackEle(), - m_jet_trackElept(), - m_jet_trackEle(), - m_jet_Ntrack(), - m_jet_sumptTrack(), - m_nelej(), - m_ntrackj(), - m_nmuonj(), - p_nt1(nullptr), - m_UseTupleSET(false) -{ - declareProperty("JetContainer", m_particleJetContainerName = "Cone4H1TowerJets"); - declareProperty("MCParticleContainer", m_truthParticleContainerName = "SpclMC"); - declareProperty("TrackParticleContainer", m_trackParticleContainerName = "TrackParticleCandidate"); - declareProperty("MuonContainer",m_muonContainerName = "StacoMuonCollection"); - declareProperty("ElectronContainer", m_electronContainerName = "ElectronAODCollection"); - declareProperty("PrimaryVertexContainer", m_primaryVertexContainerName = "VxPrimaryCandidate"); - declareProperty("MCEventContainer", m_mcEventContainerName = "GEN_AOD"); - declareProperty("SelectBFromRun", m_selectBFromRun = 0); - declareProperty("SelectUFromRun", m_selectUFromRun = 0); - declareProperty("PurificationDeltaR", m_purificationDeltaR = 0.8); - declareProperty("LeptonPurificationDeltaR", m_leptonPurificationDeltaR = 0.7); - declareProperty("UseTupleSET", m_UseTupleSET = false); - m_tagger[0] = "IP2D"; - m_tagger[1] = "IP3D"; - m_tagger[2] = "SV1"; - m_tagger[3] = "SV2"; - m_tagger[4] = "IP3DSV1"; - m_tagger[5] = "Lifetime2D"; - m_tagger[6] = "SecVtxTagBU"; - m_tagger[7] = "lhSig"; - m_tagger[8] = "SoftMuonTag"; - m_tagger[9] = "SoftElectronTag"; - m_tagger[10] = "JetFitter"; - m_tagger[11] = "JetFitComb"; - m_tagger[12] = "JetFitterNN"; - m_tagger[13] = "JetFitCombNN"; - m_tagger[14] = "JetProb"; - //* - m_tagger[15] = "Offline_afterHLT_IP2D"; - m_tagger[16] = "Offline_afterHLT_IP3D"; - m_tagger[17] = "L2_IP2D"; - m_tagger[18] = "L2_IP3D"; - m_tagger[19] = "L2_JetProb"; - m_tagger[20] = "EF_afterL2_IP2D"; - m_tagger[21] = "EF_afterL2_IP3D"; - m_tagger[22] = "EF_IP2D"; - m_tagger[23] = "EF_IP3D"; - m_tagger[24] = "EF_JetProb"; - m_tagger[25] = "EF_MVTX"; - m_tagger[26] = "EF_EVTX"; - m_tagger[27] = "EF_NVTX"; - - // for histograms as a function of jet ET - // - m_jetET[0] = "Et_0_100"; - m_jetET[1] = "Et_100_200"; - m_jetET[2] = "Et_200_300"; - m_jetET[3] = "Et_300_400"; - m_jetET[4] = "Et_400_500"; - m_jetET[5] = "Et_500"; - -} - -JetTagAna::~JetTagAna() {} - -StatusCode JetTagAna::initialize() { - ATH_CHECK( service("THistSvc", m_histos, true) ); - - this->bookHistograms(); - return StatusCode::SUCCESS; -} - -double phiCorr(double phi){ - double newphi = phi; - if (phi<-M_PI) newphi += 2*M_PI; - if (phi> M_PI) newphi -= 2*M_PI; - return newphi; -} - -StatusCode JetTagAna::finalize() { - int nj = (int)(m_h_jet_ntotal->GetMean()*m_h_jet_ntotal->Integral()); - int njb = (int)(m_h_jet_nlabelb->GetMean()*m_h_jet_nlabelb->Integral()); - int njc = (int)(m_h_jet_nlabelc->GetMean()*m_h_jet_nlabelc->Integral()); - int njt = (int)(m_h_jet_nlabelt->GetMean()*m_h_jet_nlabelt->Integral()); - ATH_MSG_INFO ( "##### APPROX. NB JETS LABELLED AS B: " << njb << " C: " << njc - << " TAU: " << njt << " TOTAL: " << nj ); - this->computeRejections(); - return StatusCode::SUCCESS; -} - - -StatusCode JetTagAna::execute() { - - ATH_MSG_DEBUG ( "JetTagAna::execute()" ); - StatusCode sc = StatusCode::SUCCESS; - m_h_global_counters->Fill(1.); - - /** Retrieve Event header: */ - const xAOD::EventInfo* eventInfo; - sc = evtStore()->retrieve(eventInfo); - m_irun = 0; - m_ievt = 0; - if (sc.isFailure()) { - ATH_MSG_ERROR ( "Could not retrieve event info" ); - } else { - m_irun = eventInfo->runNumber(); - m_ievt = eventInfo->eventNumber(); - } - ATH_MSG_DEBUG ( "--- Run " << m_irun << " Event " << m_ievt ); - - /** Primary vertex: */ - double pvx = 0.; - double pvy = 0.; - double pvz = 0.; - const VxContainer* vxContainer(0); - int npvx = 0; - sc = evtStore()->retrieve(vxContainer, m_primaryVertexContainerName); - if (sc.isFailure()) { - ATH_MSG_ERROR ( "Could not retrieve primary vertex info: " << m_primaryVertexContainerName ); - return StatusCode::SUCCESS; - } else { - ATH_MSG_VERBOSE ( "Found primary vertex info: " << m_primaryVertexContainerName ); - m_h_global_counters->Fill(2.); - if(vxContainer) { - npvx = vxContainer->size(); - VxContainer::const_iterator fz = vxContainer->begin(); - const Trk::RecVertex& primaryVertex = (*fz)->recVertex(); - pvx = primaryVertex.position().x(); - pvy = primaryVertex.position().y(); - pvz = primaryVertex.position().z(); - } - } - m_h_global_nprimvtx->Fill((float)npvx); - m_h_global_xprimvtx->Fill(pvx); - m_h_global_yprimvtx->Fill(pvy); - m_h_global_zprimvtx->Fill(pvz); - ATH_MSG_VERBOSE ( "--- Primary vertex: " << pvx << " " << pvy << " " << pvz ); - // Check for undefined PV (when no PV is reconstructed, a dummy one is stored): - if( pvx == 0 && pvy == 0 && pvz == 0 ) { - ATH_MSG_WARNING ( "Primary Vertex is (0,0,0): skipping event." ); - return StatusCode::SUCCESS; - } else { - m_h_global_counters->Fill(3.); - } - /** True primary vertex: */ - double xpvxt = 0.; - double ypvxt = 0.; - double zpvxt = 0.; - const McEventCollection* gen(0); - sc = evtStore()->retrieve(gen, m_mcEventContainerName); - if( sc.isFailure() ) { - ATH_MSG_WARNING ( "MC Event " << m_mcEventContainerName << " not found." ); - } else { - ATH_MSG_VERBOSE ( "MC Event " << m_mcEventContainerName << " found with " << gen->size() << " entries." ); - const HepMC::GenEvent* genEvent = *(gen->begin()); - if(genEvent) { - HepMC::GenEvent::vertex_const_iterator vitr = genEvent->vertices_begin(); - xpvxt = (*vitr)->position().x(); - ypvxt = (*vitr)->position().y(); - zpvxt = (*vitr)->position().z(); - m_h_global_primvtxresx->Fill(pvx-xpvxt); - m_h_global_primvtxresy->Fill(pvy-ypvxt); - m_h_global_primvtxresz->Fill(pvz-zpvxt); - } - } - - /** MC Truth container: */ - sc=evtStore()->retrieve( m_mcpartTES, m_truthParticleContainerName); - int nmcp = 0; - if( sc.isFailure() ) { - ATH_MSG_WARNING ( "TruthParticleContainer " << m_truthParticleContainerName - << " not found." ); - } else { - nmcp = (*m_mcpartTES).size(); - ATH_MSG_VERBOSE ( "TruthParticleContainer " << m_truthParticleContainerName - << " found with " << nmcp << " entries." ); - m_h_global_counters->Fill(5.); - } - m_h_global_nmcpart->Fill((float)nmcp); - - // fill some information about b and c particles: - if(m_mcpartTES) { - TruthParticleContainer::const_iterator mcItr = (*m_mcpartTES).begin(); - TruthParticleContainer::const_iterator mcEnd = (*m_mcpartTES).end(); - int nbbq = 0; - int nbcq = 0; - int nbbh = 0; - int nbch = 0; - for (; mcItr != mcEnd; ++mcItr) { - int mpdg = (*mcItr)->pdgId(); - double pt = (*mcItr)->pt(); - double eta = (*mcItr)->eta(); - if(5==abs(mpdg)) { - nbbq++; - m_h_truth_bquark_pt->Fill(pt); - m_h_truth_bquark_eta->Fill(eta); - } - if(4==abs(mpdg)) { - nbcq++; - m_h_truth_cquark_pt->Fill(pt); - m_h_truth_cquark_eta->Fill(eta); - } - if(this->isBHadron(mpdg)) { - nbbh++; - m_h_truth_bhadr_pt->Fill(pt); - m_h_truth_bhadr_eta->Fill(eta); - } - if(this->isDHadron(mpdg)) { - nbch++; - m_h_truth_chadr_pt->Fill(pt); - m_h_truth_chadr_eta->Fill(eta); - } - } - m_h_truth_bquark_nb->Fill((float)nbbq); - m_h_truth_cquark_nb->Fill((float)nbcq); - m_h_truth_bhadr_nb->Fill((float)nbbh); - m_h_truth_chadr_nb->Fill((float)nbch); - } - - /** TrackParticleTruth container: */ - const TrackParticleTruthCollection* tpTruthColl(0); - sc = evtStore()->retrieve(tpTruthColl,m_TPTruthContainer); - if (!sc.isFailure() ) { - ATH_MSG_VERBOSE ( "Number of TruthTrackParticles in event: " - << tpTruthColl->size() ); - } else { - ATH_MSG_DEBUG ( "Unable to retrieve TrackParticleTruthCollection" ); - } - - /** TrackParticle container: */ - int ntrkp = 0; - sc=evtStore()->retrieve( m_trackTES, m_trackParticleContainerName); - if( sc.isFailure() ) { - ATH_MSG_WARNING ( "TrackParticleContainer " << m_trackParticleContainerName - << " not found." ); - } else { - m_h_global_counters->Fill(6.); - ntrkp = (*m_trackTES).size(); - ATH_MSG_VERBOSE ( "TrackParticleContainer " << m_trackParticleContainerName - << " found with " << ntrkp << " entries." ); - - /// iterators over the container - Rec::TrackParticleContainer::const_iterator trackItr = m_trackTES->begin(); - Rec::TrackParticleContainer::const_iterator trackItrE = m_trackTES->end(); - for (; trackItr != trackItrE; ++trackItr) { - const Rec::TrackParticle * trackParticle = (*trackItr); - if(trackParticle) { - if(trackParticle->pt()<1000.) continue; - const Trk::TrackSummary* summary = trackParticle->trackSummary(); - if (summary) { - m_h_global_BLayerHits->Fill((float) summary->get(Trk::numberOfInnermostPixelLayerHits)); - m_h_global_BLayerSharedHits->Fill((float) summary->get(Trk::numberOfInnermostPixelLayerSharedHits)); - m_h_global_PixelHits->Fill((float) summary->get(Trk::numberOfPixelHits)); - m_h_global_PixelLayers->Fill((float) summary->get(Trk::numberOfContribPixelLayers)); - m_h_global_TRTHits->Fill((float) summary->get(Trk::numberOfTRTHits)); - int nSiHits = summary->get(Trk::numberOfPixelHits) + summary->get(Trk::numberOfSCTHits); - m_h_global_SiHits->Fill((float) nSiHits); - } - } - } - - } - m_h_global_ntrkpart->Fill((float)ntrkp); - - /** Muon Container: */ - const Analysis::MuonContainer* muonTDS=0; - int nmuon=0; - sc=evtStore()->retrieve( muonTDS, m_muonContainerName); - if( sc.isFailure() || !muonTDS ) { - ATH_MSG_WARNING ( "No AOD muon container of muons found in TDS"); - } - else { - nmuon = (*muonTDS).size(); - ATH_MSG_DEBUG ( "MuonContainer successfully retrieved, size = " << nmuon ); - } - m_h_global_nmuon->Fill((float) nmuon); - - /** Electron Container: */ - - const ElectronContainer* electronTDS=0; - int nelectron=0; - sc=evtStore()->retrieve( electronTDS, m_electronContainerName); - if( sc.isFailure() || !electronTDS ) { - ATH_MSG_WARNING ( "No AOD electron container of electrons found in TDS" ); - } - else { - nelectron = (*electronTDS).size(); - ATH_MSG_DEBUG ( "ElectronContainer successfully retrieved, size = " << nelectron ); - } - m_h_global_nelectron->Fill((float) nelectron); - - /** Jet container: */ - int njtag = 0; - const JetCollection* jetTES; - sc=evtStore()->retrieve( jetTES, m_particleJetContainerName); - if( sc.isFailure() ) { - ATH_MSG_ERROR ( "JetContainer " << m_particleJetContainerName - << " not found." ); - return StatusCode::SUCCESS; - } else { - njtag = (*jetTES).size(); - ATH_MSG_VERBOSE ( "JetContainer " << m_particleJetContainerName - << " found with " << njtag << " entries." ); - m_h_global_counters->Fill(7.); - } - m_h_global_njettag->Fill((float)njtag); - - // --- iterate over the Jet container - JetCollection::const_iterator jetItr = (*jetTES).begin(); - JetCollection::const_iterator jetEnd = (*jetTES).end(); - int ntotal = 0; - int nlabelb = 0; - int nlabelc = 0; - int nlabelt = 0; - int icount =0; - for (; jetItr != jetEnd; ++jetItr) { - CLHEP::HepLorentzVector p4((*jetItr)->px(), - (*jetItr)->py(), - (*jetItr)->pz(), - (*jetItr)->e()); - int ntag = (*jetItr)->jetTagInfoVector().size(); - m_h_jet_ntag->Fill((float)ntag); - ntotal++; - - // --- get the true label of the jet from MC Truth: SECTION::LABEL - std::string label("N/A"); - const Analysis::TruthInfo* mcinfo = (*jetItr)->tagInfo<Analysis::TruthInfo>("TruthInfo"); - if(mcinfo) { - label = mcinfo->jetTruthLabel(); - } else { - ATH_MSG_VERBOSE ( "could not find TruthInfo for matching jet" ); - } - int iflav(0); - if(label=="B") { - iflav = 5; - nlabelb++; - } - if(label=="C") { - iflav = 4; - nlabelc++; - } - if(label=="T") { - iflav = 15; - nlabelt++; - } - m_h_jet_label->Fill((float)iflav); - // for isolation/purification: - double dRminToB = mcinfo->deltaRMinTo("B"); - double dRminToC = mcinfo->deltaRMinTo("C"); - double dRminToT = mcinfo->deltaRMinTo("T"); - - // --- get jet basic kinematics: - ATH_MSG_VERBOSE ( "BJet # " << icount << " Eta= " << p4.pseudoRapidity() - << " Phi= " << p4.phi() << " pT= " << p4.perp() - << " #Tags= " << ntag << " MCLabel= " << label ); - icount++; - m_h_jet_eta->Fill(p4.pseudoRapidity()); - m_h_jet_phi->Fill(p4.phi()); - m_h_jet_et->Fill(p4.et()); - - // --- get some information about Track/Muon/Electron Constituents - - int ntrk_j=0, nmu_j=0, nel_j=0; - const Analysis::TrackAssociation* ta = (*jetItr)->getAssociation<Analysis::TrackAssociation>("Tracks"); - if(ta) ntrk_j = ta->size(); - const Analysis::MuonAssociation* ma = (*jetItr)->getAssociation<Analysis::MuonAssociation>("Muons"); - if(ma) nmu_j = ma->size(); - const Analysis::ElectronAssociation* ea = (*jetItr)->getAssociation<Analysis::ElectronAssociation>("Electrons"); - if(ea) nel_j = ea->size(); - m_h_jet_ntracks->Fill((float) ntrk_j); - m_h_jet_nmuons->Fill((float) nmu_j); - m_h_jet_nelectrons->Fill((float) nel_j); - - // loop over tracks in a jet - - if(ta) { - - std::vector<const Rec::TrackParticle*>* trackVector = ta->tracks(); - for(std::vector<const Rec::TrackParticle*>::iterator trkItr = trackVector->begin(); trkItr !=trackVector->end(); ++trkItr) { - - - const Rec::TrackParticle* aTemp = *trkItr; - - m_h_jet_tracks_pt->Fill(aTemp->pt()/GeV); - - const Trk::TrackSummary* summary = aTemp->trackSummary(); - if (summary) { - m_h_jet_tracks_BLayerHits->Fill((float) summary->get(Trk::numberOfInnermostPixelLayerHits)); - m_h_jet_tracks_PixelHits->Fill((float) summary->get(Trk::numberOfPixelHits)); - m_h_jet_tracks_SCTHits->Fill((float) summary->get(Trk::numberOfSCTHits)); - } - } - - } - - // loop over muons in a jet - if(ma) { - for(Navigable<Analysis::MuonContainer,double>::object_iter it=ma->begin(); it !=ma->end(); ++it) { - const Analysis::Muon *m = (*it); - m_h_jet_muons_pt->Fill(m->pt()/GeV); - } - } - // loop over electrons in jet - if(ea) { - for(Navigable<ElectronContainer,double>::object_iter it=ea->begin(); it !=ea->end(); ++it) { - const Analysis::Electron *e = (*it); - m_h_jet_electrons_pt->Fill(e->pt()/GeV); - } - } - - // --- get btagging weights: SECTION::WEIGHTS - double w_ip2d = (*jetItr)->getFlavourTagWeight("IP2D"); - double w_ip3d = (*jetItr)->getFlavourTagWeight("IP3D"); - double w_sv1 = (*jetItr)->getFlavourTagWeight("SV1"); - double w_sv2 = (*jetItr)->getFlavourTagWeight("SV2"); - double w_cmb = (*jetItr)->getFlavourTagWeight(); // combination of IP3D and SV1 - double w_lf2d = (*jetItr)->getFlavourTagWeight("LifetimeTag2D"); - double w_svbu = (*jetItr)->getFlavourTagWeight("SecVtxTagBU"); - double w_lhsig= (*jetItr)->getFlavourTagWeight("lhSig"); - double w_softm= (*jetItr)->getFlavourTagWeight("SoftMuonTag"); - double w_softe= (*jetItr)->getFlavourTagWeight("SoftElectronTag"); - double w_jetfit = (*jetItr)->getFlavourTagWeight("JetFitterTag"); - double w_jetfitcomb = (*jetItr)->getFlavourTagWeight("JetFitterCOMB"); - double w_jetfitnn = (*jetItr)->getFlavourTagWeight("JetFitterTagNN"); - double w_jetfitcombnn = (*jetItr)->getFlavourTagWeight("JetFitterCOMBNN"); - double w_jetprob = (*jetItr)->getFlavourTagWeight("JetProb"); - ATH_MSG_VERBOSE ( "-> weights: " - << " JetProb: " << w_jetprob - << " IP2D: " << w_ip2d - << " IP3D: " << w_ip3d - << " SV1 : " << w_sv1 - << " SV2 : " << w_sv2 - << " SV1+IP3D : " << w_cmb - << " | " - << " Lifetime2D : " << w_lf2d - << " SecVtxTagBU : " << w_svbu - << " lhSig : " << w_lhsig - << " | " - << " SoftMuonTag : " << w_softm - << " SoftElectronTag : " << w_softe - << " | " - << " JetFitterTag : "<< w_jetfit - << " JetFitterCOMB : "<< w_jetfitcomb - << " JetFitterTagNN : "<< w_jetfitnn - << " JetFitterCOMBNN : "<< w_jetfitcombnn - ); - m_h_tag_jetprob_w->Fill(w_jetprob); - m_h_tag_i2d_w->Fill(w_ip2d); - m_h_tag_i3d_w->Fill(w_ip3d); - m_h_tag_sv1_w->Fill(w_sv1); - m_h_tag_sv2_w->Fill(w_sv2); - m_h_tag_cmb_w->Fill(w_cmb); - m_h_tag_lf2d_w->Fill(w_lf2d); - m_h_tag_svbu_w->Fill(w_svbu); - m_h_tag_lhsig_w->Fill(w_lhsig); - m_h_tag_softm_w->Fill(w_softm); - m_h_tag_softe_w->Fill(w_softe); - m_h_tag_jetfitter_w->Fill(w_jetfit); - m_h_tag_jetfitcomb_w->Fill(w_jetfitcomb); - m_h_tag_jetfitternn_w->Fill(w_jetfitnn); - m_h_tag_jetfitcombnn_w->Fill(w_jetfitcombnn); - double w[MAX_numTaggers]; - w[0] = w_ip2d; - w[1] = w_ip3d; - w[2] = w_sv1; - w[3] = w_sv2; - w[4] = w_cmb; - w[5] = w_lf2d; - w[6] = w_svbu; - w[7] = w_lhsig; - w[8] = w_softm; - w[9] = w_softe; - w[10] = w_jetfit; - w[11] = w_jetfitcomb; - w[12] = w_jetfitnn; - w[13] = w_jetfitcombnn; - w[14] = -TMath::Log10(w_jetprob); - - bool svok = false; - // --- loop on tags & get detailed information for each tag: SECTION::DETAILS - std::vector<const JetTagInfoBase*> infoVector = (*jetItr)->jetTagInfoVector(); - for(uint iInfo = 0; iInfo < infoVector.size(); iInfo++) { - if(0==infoVector[iInfo]) continue; - bool is2D = (infoVector[iInfo]->infoType()=="IP2D"); - bool is3D = (infoVector[iInfo]->infoType()=="IP3D"); - bool isIPlus = (infoVector[iInfo]->infoType()=="IPInfoPlus"); - bool isS1 = (infoVector[iInfo]->infoType()=="SV1"); - bool isS2 = (infoVector[iInfo]->infoType()=="SV2"); - bool isSPlus = (infoVector[iInfo]->infoType()=="SVInfoPlus"); - bool isSoftElectron = (infoVector[iInfo]->infoType()=="SoftElectronTag"); - - // ...... detailed information for impact parameter-based informations ...... - if(is2D) { // impact parameter 2D - // basic additional information: - const Analysis::IPInfoBase* infob = dynamic_cast<const Analysis::IPInfoBase*>(infoVector[iInfo]); - if(infob) { - int ntrk = infob->nbTracks(); // number of tracks used for tagging in the jet - double pb = infob->tagLikelihood()[0]; // b likelihood - double pu = infob->tagLikelihood()[1]; // u likelihood - m_h_tag_i2d_n->Fill((float)ntrk); - m_h_tag_i2d_b->Fill(pb); - m_h_tag_i2d_u->Fill(pu); - ATH_MSG_VERBOSE ( "-> InfoBase for IP2D: #tracks= " << ntrk - << " Pb= " << pb << " Pu= " << pu ); - } - } - if(is3D) { // impact parameter 3D - // basic additional information: - const Analysis::IPInfoBase* infob = dynamic_cast<const Analysis::IPInfoBase*>(infoVector[iInfo]); - if(infob) { - int ntrk = infob->nbTracks(); // number of tracks used for tagging in the jet - double pb = infob->tagLikelihood()[0]; // b likelihood - double pu = infob->tagLikelihood()[1]; // u likelihood - m_h_tag_i3d_n->Fill((float)ntrk); - m_h_tag_i3d_b->Fill(pb); - m_h_tag_i3d_u->Fill(pu); - ATH_MSG_VERBOSE ( "-> InfoBase for IP3D: #tracks= " << ntrk - << " Pb= " << pb << " Pu= " << pu ); - } - } - if(isIPlus) { - // more detailed information (not always present in any AOD):: - const Analysis::IPInfoPlus* infop = dynamic_cast<const Analysis::IPInfoPlus*>(infoVector[iInfo]); - if(infop) { - int ntrk = infop->numTrackInfo(); - ATH_MSG_VERBOSE ( "-> InfoPlus for each track in IP2D/IP3D/JetProb: #tracks= " - << ntrk ); - int ibin; - ibin = (int) ((p4.et())/GeV)/100; - if(ibin>5) ibin=5; - m_h_tag_IPinfo_ntrk[ibin]->Fill((float) ntrk); - for(int itinf = 0; itinf < ntrk; itinf++) { - Analysis::IPTrackInfo trackInfo = infop->getTrackInfo(itinf); - // impact parameters w.r.t. primary vertex: this information is stored - // to avoid calling again the extrapolator which requires the full geometry initialization - double d0val = trackInfo.d0Value(); - double d0sig = trackInfo.d0Significance(); - double z0val = trackInfo.z0Value(); - double z0sig = trackInfo.z0Significance(); - m_h_tag_i2d_sig->Fill(d0sig); - m_h_tag_i3d_sig->Fill(z0sig); - // individual contribution of this track to the b-tagging weights: - double wi2D = trackInfo.trackWeight2D(); // IP2D - double wi3D = trackInfo.trackWeight3D(); // IP3D - double piJP = trackInfo.trackProbJP(); // JetProb - // track quality information: - Analysis::TrackGrade grd = trackInfo.trackGrade(); // Good, Shared, ... - bool vzero = trackInfo.isFromV0(); // track from V0, interaction in identified material, ... - // pointer to actual TrackParticle: - const Rec::TrackParticle* trk = trackInfo.track(); - // - // fill some histograms as a func of jet ET - // - m_h_tag_IPinfo_d0val[ibin]->Fill(d0val); - m_h_tag_IPinfo_z0val[ibin]->Fill(z0val); - m_h_tag_IPinfo_d0sig[ibin]->Fill(d0sig); - m_h_tag_IPinfo_z0sig[ibin]->Fill(z0sig); - m_h_tag_IPinfo_weight2D[ibin]->Fill(wi2D); - m_h_tag_IPinfo_weight3D[ibin]->Fill(wi3D); - m_h_tag_IPinfo_piJP[ibin]->Fill(piJP); - m_h_tag_IPinfo_fromV0[ibin]->Fill((float) vzero); - m_h_tag_IPinfo_grade[ibin]->Fill((float) grd); - - // dump: - ATH_MSG_VERBOSE ( " --> track " << itinf - << " d0= " << d0val << " Signif(d0)= " << d0sig - << " z0= " << z0val << " Signif(z0)= " << z0sig - << " weight2D= " << wi2D - << " weight3D= " << wi3D - << " probJetProb= " << piJP - << " grade= " << grd.gradeString() - << (vzero ? " fromV0 " : "") ); - if(trk) { - ATH_MSG_VERBOSE ( " track pT= " << trk->pt() - << " eta= " << trk->eta() - << " phi= " << trk->phi() ); - } - } - } - } - // ...... detailed information for secondary vertex-based informations ...... - if(isS1) { - // basic additional information: - const Analysis::SVInfoBase* info = dynamic_cast<const Analysis::SVInfoBase*>(infoVector[iInfo]); - if(info) { - double pb = info->tagLikelihood()[0]; - double pu = info->tagLikelihood()[1]; - m_h_tag_sv1_b->Fill(pb); - m_h_tag_sv1_u->Fill(pu); - ATH_MSG_VERBOSE ( "-> InfoBase for SV1: " - << " Pb= " << pb << " Pu= " << pu ); - } - } - if(isS2) { - // basic additional information: - const Analysis::SVInfoBase* info = dynamic_cast<const Analysis::SVInfoBase*>(infoVector[iInfo]); - if(info) { - double pb = info->tagLikelihood()[0]; - double pu = info->tagLikelihood()[1]; - m_h_tag_sv2_b->Fill(pb); - m_h_tag_sv2_u->Fill(pu); - ATH_MSG_VERBOSE ( "-> InfoBase for SV2: " - << " Pb= " << pb << " Pu= " << pu ); - } - } - if(isSPlus) { - // more detailed information (not always present in any AOD):: - const Analysis::SVInfoPlus* info = dynamic_cast<const Analysis::SVInfoPlus*>(infoVector[iInfo]); - if(info) { - int ntrk = info->getNGTrackInSvx(); // number of tracks in vertex - double mass = info->getMass(); // mass of secondary vertex - int n2t = info->getN2T(); // number of two-track vertices - svok = (mass>0. && n2t>0 ); - double efrc = info->getEnergyFraction(); // energy fraction svx/jet - m_h_tag_sv_n->Fill((float)ntrk); - m_h_tag_sv_n2t->Fill((float)n2t); - m_h_tag_sv_frc->Fill(efrc); - m_h_tag_sv_m->Fill(mass); - ATH_MSG_VERBOSE ( "-> InfoPlus for SV1/SV2: " - << " #tracks= " << ntrk - << " mass= " << mass - << " #n2t= " << n2t - << " efrac= " << efrc - << " tagOK= " << svok ); - } - } - // soft electron b-tagging - if (isSoftElectron) { - // basic additional information: - const Analysis::SoftElectronInfo* info = dynamic_cast<const Analysis::SoftElectronInfo*>(infoVector[iInfo]); - if(info) { - checkSoftElectron(infoVector,iInfo,ntotal,p4,iflav,ea, - ntrk_j,nmu_j,electronTDS,tpTruthColl); - - double pb = info->tagLikelihood()[0]; - double pu = info->tagLikelihood()[1]; - //m_h_tag_softe_b->Fill(pb); - //m_h_tag_softe_u->Fill(pu); - ATH_MSG_VERBOSE ( "-> InfoBase for SET: " - << " Pb= " << pb << " Pu= " << pu ); - } - } - } // loop on tags - - ///////////////////// - //* HLT b-tagging *// - ///////////////////// - - double deltaR = 9999, phiRoI = -9999, etaRoI = -9999, etRoI = -9999; - - double w_ip2d_l2 = -1, w_ip3d_l2 = -1; - double w_ip2d_ef = -1, w_ip3d_ef = -1; - double w_ip2d_of = -21, w_ip3d_of = -21; - - double w_jetProb_l2 = -1, w_jetProb_ef = -1; - double w_mVtx_ef = -1, w_eVtx_ef = -1, w_nVtx_ef = -1; - - bool isFoundL2 = true; - - //* Retrieve from StoreGate TrigL2BjetContainer *// - const DataHandle<TrigL2BjetContainer> trigL2Bjet; - const DataHandle<TrigL2BjetContainer> lastTrigL2Bjet; - - sc = evtStore()->retrieve(trigL2Bjet,lastTrigL2Bjet); - if (sc.isSuccess()) { - - //* Loop on TrigL2BjetContainer *// - for (int j=1; trigL2Bjet != lastTrigL2Bjet; ++trigL2Bjet, ++j) { - - ATH_MSG_VERBOSE ( "Looking at TrigL2BjetContainer " << j ); - - TrigL2BjetContainer::const_iterator pL2BjetItr = trigL2Bjet->begin(); - TrigL2BjetContainer::const_iterator lastL2BjetItr = trigL2Bjet->end(); - - //* Loop on TrigL2Bjet (expected one per collection) *// - for (int k=1; pL2BjetItr != lastL2BjetItr; ++pL2BjetItr, ++k ) { - - ATH_MSG_VERBOSE ( "Looking at TrigL2Bjet " << k << "/" << trigL2Bjet->size() ); - - ATH_MSG_VERBOSE - ( "TrigL2Bjet->xIP1D() = " << (*pL2BjetItr)->xIP1D() - << "; TrigL2Bjet->xIP2D() = " << (*pL2BjetItr)->xIP2D() - << "; TrigL2Bjet->xIP3D() = " << (*pL2BjetItr)->xIP3D() - << "; TrigL2Bjet->xCHI2() = " << (*pL2BjetItr)->xCHI2() - ); - - //* eta/phi matching w.r.t. offline b-jet *// - double dR = sqrt(pow((*jetItr)->eta() - (*pL2BjetItr)->eta(),2) + pow(phiCorr(phiCorr((*jetItr)->phi()) - phiCorr((*pL2BjetItr)->phi())),2)); - - if (dR < deltaR) { - deltaR = dR; - - w_ip2d_l2 = (double)(*pL2BjetItr)->xIP2D(); - w_ip3d_l2 = (double)(*pL2BjetItr)->xIP3D(); - - w_jetProb_l2 = (double)(*pL2BjetItr)->xCHI2(); - - phiRoI = (*pL2BjetItr)->phi(); - etaRoI = (*pL2BjetItr)->eta(); - } - } - } - - ATH_MSG_DEBUG ( "deltaR L2 = " << deltaR ); - - } else { - - isFoundL2 = false; - ATH_MSG_DEBUG ( "No TrigL2BjetContainer found" ); - - } - - if (deltaR > 0.1) { - isFoundL2 = false; - w_ip2d_l2 = -1; w_ip3d_l2 = -1; - ATH_MSG_DEBUG ( "TrigL2BjetContainer not matched with offline" ); - } - - if (isFoundL2) { - - //If no EF found the chain stopped at L2.. - w_ip2d_ef = 0, w_ip3d_ef = 0; - w_jetProb_ef = 0; - w_mVtx_ef = 0, w_eVtx_ef = 0, w_nVtx_ef = 0; - deltaR = 9999; - - //* Retrieve from StoreGate TrigEFBjetContainer *// - const DataHandle<TrigEFBjetContainer> trigEFBjet; - const DataHandle<TrigEFBjetContainer> lastTrigEFBjet; - - sc = evtStore()->retrieve(trigEFBjet,lastTrigEFBjet); - if (sc.isSuccess()) { - - //* Loop on TrigEFBjetContainer *// - for (int i=0; trigEFBjet != lastTrigEFBjet; ++trigEFBjet, ++i) { - - ATH_MSG_VERBOSE ( "Looking at TrigEFBjetContainer " << i ); - - TrigEFBjetContainer::const_iterator pEFBjetItr = trigEFBjet->begin(); - TrigEFBjetContainer::const_iterator lastEFBjetItr = trigEFBjet->end(); - - //* Loop on TrigEFBjet (expected one per collection) *// - for (int j=0; pEFBjetItr != lastEFBjetItr; ++pEFBjetItr, ++j ) { - - ATH_MSG_VERBOSE ( "Looking at TrigEFBjet " << j ); - - ATH_MSG_VERBOSE - ( "TrigEFBjet->xIP1D() = " << (*pEFBjetItr)->xIP1D() - << "; TrigEFBjet->xIP2D() = " << (*pEFBjetItr)->xIP2D() - << "; TrigEFBjet->xIP3D() = " << (*pEFBjetItr)->xIP3D() - << "; TrigEFBjet->xCHI2() = " << (*pEFBjetItr)->xCHI2() - << "; TrigEFBjet->xMVtx() = " << (*pEFBjetItr)->xMVtx() - << "; TrigEFBjet->xEVtx() = " << (*pEFBjetItr)->xEVtx() - << "; TrigEFBjet->xNVtx() = " << (*pEFBjetItr)->xNVtx() - ); - - //* eta/phi matching w.r.t. LVL2 b-jet *// - double dR = sqrt(pow(etaRoI - (*pEFBjetItr)->eta(),2) + pow(phiCorr(phiCorr(phiRoI) - phiCorr((*pEFBjetItr)->phi())),2)); - - if (dR < deltaR){ - deltaR = dR; - - w_ip2d_ef = (*pEFBjetItr)->xIP2D(); - w_ip3d_ef = (*pEFBjetItr)->xIP3D(); - - w_jetProb_ef = (double)(*pEFBjetItr)->xCHI2(); - - w_mVtx_ef = (double)(*pEFBjetItr)->xMVtx(); - w_eVtx_ef = (double)(*pEFBjetItr)->xEVtx(); - w_nVtx_ef = (double)(*pEFBjetItr)->xNVtx(); - } - } - } - - ATH_MSG_DEBUG ( "deltaR EF = " << deltaR << " " << w_ip3d_l2 ); - - if (deltaR > 0.001) { - w_ip2d_ef = -1; w_ip3d_ef = -1; - w_jetProb_ef = -1; - w_mVtx_ef = -1, w_eVtx_ef = -1, w_nVtx_ef = -1; - ATH_MSG_DEBUG ( "TrigEFBjetContainer found but not matched with offline (should never happen)" ); - } - } else { - ATH_MSG_INFO ( "TrigEFBjetContainer not found" ); - } - - deltaR = 9999; - - //* Retrieve from StoreGate LVL1 RoIs *// - const LVL1_ROI* lvl1RoI = 0; - sc = evtStore()->retrieve(lvl1RoI); - - if (sc.isFailure() || !lvl1RoI) { - ATH_MSG_WARNING ( "No L1RoI found in TDS" ); - return StatusCode::SUCCESS; - } else { - ATH_MSG_DEBUG ( "L1RoI successfully retrieved in TDS" ); - - LVL1_ROI::jets_type::const_iterator pL1Jet = (lvl1RoI->getJetROIs()).begin(); - LVL1_ROI::jets_type::const_iterator lastL1Jet = (lvl1RoI->getJetROIs()).end(); - - ATH_MSG_VERBOSE ( "get L1 Jet size : " << (lvl1RoI->getJetROIs()).size() ); - - for (int i=1; pL1Jet != lastL1Jet; ++pL1Jet, ++i) { - - ATH_MSG_VERBOSE ( "Looking at LVL1 RoI " << i << "/" << (lvl1RoI->getJetROIs()).size() ); - ATH_MSG_VERBOSE ( "L1 ET8x8 : " << (*pL1Jet).getET8x8() ); - - if ((*pL1Jet).getET8x8() <= 18000) continue; - - double dR = sqrt(pow((*pL1Jet).eta() - etaRoI,2) + pow(phiCorr(phiCorr((*pL1Jet).phi()) - phiCorr(phiRoI)),2)); - - if (dR < deltaR) { - deltaR = dR; - etRoI = (*pL1Jet).getET8x8(); - } - } - - ATH_MSG_DEBUG ( "deltaR L1 = " << deltaR ); - } - } - - bool jetRoImatched=false; - //* IP2D offline weight if b-jet has been selected online *// - if (w_ip2d_l2 != -1 || w_ip2d_ef != -1) { - if (w_ip2d_l2 >= 0.57 && w_ip2d_ef >= 0.33) - w_ip2d_of = (*jetItr)->getFlavourTagWeight("IP2D"); - else - w_ip2d_of = -10; - jetRoImatched=true; - } - - //* IP3D offline weight if b-jet has been selected online *// - if (w_ip3d_l2 != -1 || w_ip3d_ef != -1) { - if (w_ip3d_l2 >= 0.57 && w_ip3d_ef >= 0.33) - w_ip3d_of = (*jetItr)->getFlavourTagWeight("IP3D"); - else - w_ip3d_of = -10; - jetRoImatched=true; - } - - double w_ip2d_ef_afterl2=w_ip2d_ef; - double w_ip3d_ef_afterl2=w_ip3d_ef; - if (jetRoImatched){ - if (w_ip2d_l2 <= 0.57) - w_ip2d_ef_afterl2 = 0; - if (w_ip3d_l2 <= 0.57) - w_ip3d_ef_afterl2 = 0; - } - - if (jetRoImatched){ - w[15] = w_ip2d_of; - w[16] = w_ip3d_of; - w[17] = w_ip2d_l2; - w[18] = w_ip3d_l2; - w[19] = w_jetProb_l2; - w[20] = w_ip2d_ef_afterl2; - w[21] = w_ip3d_ef_afterl2; - w[22] = w_ip2d_ef; - w[23] = w_ip3d_ef; - w[24] = w_jetProb_ef; - w[25] = w_mVtx_ef; - w[26] = w_eVtx_ef; - w[27] = w_nVtx_ef; - } - - //////////////////////////// - //* end of HLT b-tagging *// - //////////////////////////// - - // --- fill histos for computing efficiency & rejections: - // use only jets within ID acceptance and with pT>15 GeV and away from high-pt leptons - bool leptonPur = isJetFarFromHPTLepton(*jetItr); - if(fabs(p4.pseudoRapidity())<2.5&&p4.et()>15000.&&leptonPur) { - - // b-jets: - if(5==iflav && ( m_selectBFromRun==0 || m_selectBFromRun==m_irun)) { - for(int i=0;i<MAX_numTaggers;i++) { - if ( i<MAX_numTaggers-MAX_numHLTTaggers || jetRoImatched ){ - m_h_perf_b[i]->Fill(w[i]); - } - } - m_h_perf_vxeff_den_b->Fill(0.5); - if(svok) m_h_perf_vxeff_num_b->Fill(0.5); - - // fill histograms for weights vs. ET, eta and phi - // will use them to calculate effs and rejs. as a function of these variables - // VJ Apr 13'2007 - for(int i=0;i<(MAX_numTaggers-MAX_numHLTTaggers)+2;i++) { - m_h_perf_b_ET[i]->Fill(p4.et()/GeV,w[i]); - m_h_perf_b_eta[i]->Fill(p4.pseudoRapidity(),w[i]); - m_h_perf_b_phi[i]->Fill(p4.phi(),w[i]); - } - //* - for(int i=(MAX_numTaggers-MAX_numHLTTaggers)+2;i<MAX_numTaggers;i++) { - if (jetRoImatched){ - m_h_perf_b_ET[i]->Fill(etRoI/GeV,w[i]); - m_h_perf_b_eta[i]->Fill(etaRoI,w[i]); - m_h_perf_b_phi[i]->Fill(phiRoI,w[i]); - } - } - } - - // light jets: - if(0==iflav && ( m_selectUFromRun==0 || m_selectUFromRun==m_irun)) { - for(int i=0;i<MAX_numTaggers;i++) { - if ( i<MAX_numTaggers-MAX_numHLTTaggers || jetRoImatched ){ - m_h_perf_u[i]->Fill(w[i]); - } - } - m_h_perf_vxeff_den_u->Fill(0.5); - if(svok) m_h_perf_vxeff_num_u->Fill(0.5); - - // fill histograms for weights vs. ET, eta and phi - // will use them to calculate effs and rejs. as a function of these variables - for(int i=0;i<(MAX_numTaggers-MAX_numHLTTaggers)+2;i++) { - m_h_perf_u_ET[i]->Fill(p4.et()/GeV,w[i]); - m_h_perf_u_eta[i]->Fill(p4.pseudoRapidity(),w[i]); - m_h_perf_u_phi[i]->Fill(p4.phi(),w[i]); - } - //* - for(int i=(MAX_numTaggers-MAX_numHLTTaggers)+2;i<MAX_numTaggers;i++) { - if (jetRoImatched){ - m_h_perf_u_ET[i]->Fill(etRoI/GeV,w[i]); - m_h_perf_u_eta[i]->Fill(etaRoI,w[i]); - m_h_perf_u_phi[i]->Fill(phiRoI,w[i]); - } - } - - // light jets away from lifetime particles (purification) - if( this->isLightJetIsolated(p4) || // recomputed on truth particles - ( // from pre-filled distances - dRminToB > m_purificationDeltaR && - dRminToC > m_purificationDeltaR && - dRminToT > m_purificationDeltaR - ) - ) { - for(int i=0;i<MAX_numTaggers;i++) { - if ( i<MAX_numTaggers-MAX_numHLTTaggers || jetRoImatched ){ - m_h_perf_upur[i]->Fill(w[i]); - } - } - m_h_perf_vxeff_den_upur->Fill(0.5); - if(svok) m_h_perf_vxeff_num_upur->Fill(0.5); - - // fill histograms for weights vs. ET, eta and phi - // will use them to calculate effs and rejs. as a function of these variables - for(int i=0;i<(MAX_numTaggers-MAX_numHLTTaggers)+2;i++) { - m_h_perf_upur_ET[i]->Fill(p4.et()/GeV,w[i]); - m_h_perf_upur_eta[i]->Fill(p4.pseudoRapidity(),w[i]); - m_h_perf_upur_phi[i]->Fill(p4.phi(),w[i]); - } - //* - for(int i=(MAX_numTaggers-MAX_numHLTTaggers)+2;i<MAX_numTaggers;i++) { - if (jetRoImatched){ - m_h_perf_upur_ET[i]->Fill(etRoI/GeV,w[i]); - m_h_perf_upur_eta[i]->Fill(etaRoI,w[i]); - m_h_perf_upur_phi[i]->Fill(phiRoI,w[i]); - } - } - } - } - } - } // end loop jets - - m_h_jet_ntotal->Fill((float)ntotal); - m_h_jet_nlabelb->Fill((float)nlabelb); - m_h_jet_nlabelc->Fill((float)nlabelc); - m_h_jet_nlabelt->Fill((float)nlabelt); - - // for ntuple - m_njet = ntotal; - // Fill ntuple // - if (m_UseTupleSET) p_nt1->Fill(); - - return StatusCode::SUCCESS; -} - -// ============================================================ -void -JetTagAna::checkSoftElectron(const std::vector<const JetTagInfoBase*> infoVector, uint iInfo, int ntotal, - CLHEP::HepLorentzVector p4, int iflav, - const Analysis::ElectronAssociation *ea, int ntrk_j, int nmu_j, - const ElectronContainer* electronTDS, - const TrackParticleTruthCollection* tpTruthColl) -{ - // - // check information for soft electron b-tagging - // in particular look for jets which indeed contain - // an electron with good quality track in order - // to estimate performance only on this subset - // add information in a tuple - // - - const Analysis::SoftElectronInfo* info = dynamic_cast<const Analysis::SoftElectronInfo*>(infoVector[iInfo]); - - if (!info) return; - if (!electronTDS) return; - - ATH_MSG_DEBUG ( name() << " SoftElectronTag info ! " - << iInfo << " " << infoVector[iInfo] - << " " << infoVector[iInfo]->infoType() << " " << ntotal ); - - // ntuple variables initialisation - m_jet_eptr[ntotal-1] = 0; - m_jet_ea0[ntotal-1] = 0; - m_jet_tag_pid[ntotal-1] = 0; - m_jet_tag_mothpid[ntotal-1] = 0; - - m_jet_eTrueEle[ntotal-1] = 0 ; - m_jet_eAnyEle[ntotal-1] = 0 ; - m_jet_ne[ntotal-1] = 0 ; - m_jet_epb[ntotal-1] = 0.; - m_jet_epu[ntotal-1] = 0.; - m_jet_elh[ntotal-1] = -40.; - m_jet_ew[ntotal-1] = -40.; - m_jet_Ntrack[ntotal-1] = 0 ; - m_jet_sumptTrack[ntotal-1] = 0 ; - m_jet_NtrackEle[ntotal-1] = 0 ; - - for (int i=0; i<10;i++) { //fix me! hardcoded number - m_jet_trackEle[ntotal-1][i] = 0; - m_jet_trackElept[ntotal-1][i] = 0; - } - - int jetele = 0; - int jetanyele = 0; - - for (int ii=0; ii< m_maxjet ;ii++) { - m_jet_eTrueEle[ii]= 0; - m_jet_eAnyEle[ii] = 0; - } - - m_jet_phi[ntotal-1] = (float)p4.phi(); - m_jet_eta[ntotal-1] = p4.pseudoRapidity(); - m_jet_et[ntotal-1] = p4.et(); - m_jet_flav[ntotal-1] = iflav; - if( this->isLightJetIsolated(p4)) m_jet_isol[ntotal-1]=1; - else m_jet_isol[ntotal-1]=0; - - if(ea) m_nelej[ntotal-1] = ea->size(); - else m_nelej[ntotal-1] = 0; - - m_ntrackj[ntotal-1] = ntrk_j; - m_nmuonj[ntotal-1] = nmu_j; - - unsigned int ntrkp = info->numTrackInfo(); - //mlog << MSG::INFO << "N good ele " << ntrkp << endmsg; - - m_jet_ne[ntotal-1] = ntrkp; - m_jet_ew[ntotal-1] = info->weight(); // softe standard weight - - // get total LH - if (info->tagLikelihood().size() >= 2) { - m_jet_epb[ntotal-1] = info->tagLikelihood()[0];//sig part of J-B LH - m_jet_epu[ntotal-1] = info->tagLikelihood()[1];//bkg part of J-B LH - m_jet_elh[ntotal-1]=getTotWeight(m_jet_epb[ntotal-1],m_jet_epu[ntotal-1]); - } - ATH_MSG_VERBOSE ( "Elec xcheck " << m_jet_ew[ntotal-1] - << " " << m_jet_elh[ntotal-1]); - - // Flag the jet as containing ELECTRON if DR <= 0.4 - // and e mother pid is between 400 and 600 or 4000 and 6000 - ATH_MSG_VERBOSE ( " in container you have electrons : " - << electronTDS->size() ); - // loop on electron container - ElectronContainer::const_iterator elecItr = electronTDS->begin(); - ElectronContainer::const_iterator elecItrE = electronTDS->end(); - for (; elecItr != elecItrE; ++elecItr) { - // only soft e - if ( !(*elecItr)->author(egammaParameters::AuthorSofte)) continue; - - CLHEP::HepLorentzVector p4ele = (*elecItr)->hlv(); - double drie = p4ele.deltaR(p4); - //double dptr = (p4ele.et()-p4.et())/p4.et(); - - // check the parent id - int parentID =0; - //int grandparentID=0; - int ID = 0; - - if( !(*elecItr)->trackParticle() ) continue; - - const Rec::TrackParticle *myTrackParticle = (*elecItr)->trackParticle(); - // take truth info for that particle - const HepMC::GenParticle* thePart1 = getTruth((myTrackParticle),tpTruthColl,m_trackTES); - if (thePart1!=0) { - //std::cout << "PDG of the track is " << thePart1->pdg_id()<<std::endl; - ID= thePart1->pdg_id(); - HepMC::GenVertex::particle_iterator firstParent, lastParent, thisParent; - - firstParent =thePart1->production_vertex()->particles_begin(HepMC::parents); - lastParent =thePart1->production_vertex()->particles_end(HepMC::parents); - for(thisParent = firstParent; thisParent != lastParent++; ++thisParent) { - parentID = (*thisParent)->pdg_id(); - } - } - - // REMOVE ME! - //std::cout<< " MW drie parentID "<<drie<<" "<<parentID<<std::endl; - if (std::abs(drie) <= 0.4 && std::abs(ID)==11 && - (isBHadron(parentID) || isDHadron(parentID))) jetele = 1; - //if (fabs(drie) <= 0.4 && fabs(ID)==11 && - //((fabs(parentID)>= 400 && fabs(parentID)<600) || - // (fabs(parentID)>= 4000 && fabs(parentID)<6000))) jetele = 1; - - if (std::abs(drie) <= 0.4 && std::abs(ID)==11) jetanyele = 1; - } - - // REMOVE ME! - //std::cout<< " is electron in jet "<<jetanyele<<" "<<jetele<<std::endl; - m_jet_eTrueEle[ntotal-1] = jetele; - m_jet_eAnyEle[ntotal-1] = jetanyele; - //---------------------------------------------- - // Flag the jet as containing ELECTRON TRACK - //----------------------------------------------- - int itrack = 0; - double ptsum = 0.; - //int jettrackele[10]; // this is never used in the code - //for (int i=0; i< 10;i++) jettrackele[i]= 0; - - int nele = 0; - double trackpt = 0.; - - // iterators over the trackparticle container - Rec::TrackParticleContainer::const_iterator trackItr = m_trackTES->begin(); - Rec::TrackParticleContainer::const_iterator trackItrE = m_trackTES->end(); - for (; trackItr != trackItrE; ++trackItr) { - // check track quality - if (!checkTrackqualforSET(trackItr,&trackpt).isSuccess()) continue; - //int goodtrack = 0; - CLHEP::HepLorentzVector p4trk = (*trackItr)->hlv(); - double drie = p4trk.deltaR(p4); - //double dptr = (p4trk.et()-p4.et())/p4.et(); - //std::cout << " HLV = " << p4trk << " " << drie << " " << dptr << std::endl; - - // check the parent id - int parentID = 0; - //int grandparentID = 0; - int ID = 0; - - const Rec::TrackParticle *myTrackParticle = (*trackItr); - //take truth info for that particle - const HepMC::GenParticle* thePart1 =getTruth(myTrackParticle,tpTruthColl,m_trackTES); - if (thePart1!=0) { - //std::cout << "PDG of the trackparticle is " << thePart1->pdg_id()<<std::endl; - ID= thePart1->pdg_id(); - HepMC::GenVertex::particle_iterator firstParent, lastParent, thisParent; - - firstParent =thePart1->production_vertex()->particles_begin(HepMC::parents); - lastParent =thePart1->production_vertex()->particles_end(HepMC::parents); - for(thisParent = firstParent; thisParent != lastParent++; ++thisParent) { - parentID = (*thisParent)->pdg_id(); - } - } - - //if GQ track inside jet - int codeEle = 0; - if (fabs(drie) <= 0.4) { - if (std::abs(ID)==11) { - codeEle = 1; - - if (isDHadron(parentID)) codeEle = 4; - //if ((fabs(parentID)>=400 && fabs(parentID)<500) || - // (fabs(parentID)>=4000 && fabs(parentID)<5000)) codeEle = 4; - - if (isBHadron(parentID)) codeEle = 5; - //if ((fabs(parentID)>=500 && fabs(parentID)<600) || - // (fabs(parentID)>=5000 && fabs(parentID)<6000)) codeEle = 5; - - if (std::abs(parentID)==22 || std::abs(parentID)==111) codeEle = 2; - - //jettrackele[nele] = codeEle; - m_jet_trackEle[ntotal-1][nele] = codeEle; - m_jet_trackElept[ntotal-1][nele] = fabs(trackpt); - - nele = nele + 1; - } - ptsum = ptsum + fabs(trackpt); - itrack++; - } - } - - - //if (m_UseTupleSET) { - m_jet_NtrackEle[ntotal-1] = nele; - m_jet_sumptTrack[ntotal-1] = ptsum; - m_jet_Ntrack[ntotal-1] = itrack; - //} - //std::cout << " number of found ele tracks in jet " - // << nele<<std::endl; - - int beid = 0; - int mothbeid = 0; - - for(unsigned int i=0;i<ntrkp;i++) { - const Analysis::SETrackInfo ipteinfo = info->getTrackInfo(i); - //mlog << MSG::INFO << "Elec " << i << endmsg; - //mlog << MSG::INFO << ipteinfo << endmsg; - - beid = 0; - mothbeid = 0; - - if (i == 0) { - m_jet_eptr[ntotal-1] = ipteinfo.pTrel(); - //std::cout << " pT = " << ipteinfo.pTrel() << std::endl; - m_jet_ea0[ntotal-1] = ipteinfo.d0Value(); - - // Does it correspond to a true electron ? - const egamma* bestSoftE = ipteinfo.electron(); - // const Analysis::Electron* bestSoftE = ipteinfo.electron(); - if (bestSoftE) { - //if (m_UseTupleSET) { - m_jet_ept[ntotal-1] = bestSoftE->pt(); - //} - //info about pid and moth pid of tagging particle - if( bestSoftE->trackParticle() ) { - const Rec::TrackParticle *myTrackParticle = bestSoftE->trackParticle(); - //take truth info for that particle - const HepMC::GenParticle* thePartBE =getTruth(myTrackParticle,tpTruthColl,m_trackTES); - if (thePartBE!=0) { - beid= thePartBE->pdg_id(); - //std::cout << "PDG of the best ele is " << beid<<std::endl; - - HepMC::GenVertex::particle_iterator firstParent, lastParent, thisParent; - - firstParent =thePartBE->production_vertex()->particles_begin(HepMC::parents); - lastParent =thePartBE->production_vertex()->particles_end(HepMC::parents); - for(thisParent = firstParent; thisParent != lastParent++; ++thisParent) { - mothbeid = (*thisParent)->pdg_id(); - //std::cout<< "best ele parent id " << mothbeid <<std::endl; - } - } - } - - //if (m_UseTupleSET) { - m_jet_tag_pid[ntotal-1] = beid ; - m_jet_tag_mothpid[ntotal-1] = mothbeid ; - //} - // Flag the jet as containing electron if DR <= 0.4 - // and e mother pid is between 400 and 600 or 4000 and 6000 - jetele = 0; - jetanyele = 0; - - } - } - } -} - -// ============================================================ -StatusCode JetTagAna::checkTrackqualforSET(Rec::TrackParticleContainer::const_iterator trackItr, double *trackpt) { - // - // check track quality for soft electrons - // Beware that requirements could be slightly different - // than for other taggers (in particular for TRT) - // - - // good quality track cuts - double cutA0 = 1; - int cutBL = 1; - int cutPi = 2; - int cutSi = 7; - int cutNTRHits = 1; - int cutNTRTHits = 20; - double cutPt = 2000.; - - int nBL = 0; - int nPix = 0; - int nSi = 0; - int nTR = 0; - int nTRT = 0; - - const Trk::TrackSummary* summary = (*trackItr)->trackSummary(); - if (summary) { - // number of b-layer hits - nBL = summary->get(Trk::numberOfInnermostPixelLayerHits); - // number of pixel hits - nPix = summary->get(Trk::numberOfPixelHits); - // number of Si hits - nSi = summary->get(Trk::numberOfPixelHits) + - summary->get(Trk::numberOfSCTHits); - // number of high threshold hits in TRT (with outliers) - nTR = summary->get(Trk::numberOfTRTHighThresholdHits)+ - summary->get(Trk::numberOfTRTHighThresholdOutliers); - // number of TRT hits (with outliers) - nTRT = summary->get(Trk::numberOfTRTHits)+ - summary->get(Trk::numberOfTRTOutliers); - } - - // access to the perigee parameters - const Trk::Perigee* perigee = (*trackItr)->measuredPerigee(); - - double A0Vert = 0.; - double PTInvVert = 0.; - - if (perigee) { - const auto & parameters = perigee->parameters(); - // transverse impact parameter - A0Vert = parameters[Trk::d0]; - // pT of the track - PTInvVert = parameters[Trk::qOverP]; - if ( PTInvVert != 0. ) { - *trackpt = 1./PTInvVert; - } else { *trackpt = 0.;} - } - - // basic cuts on good quality tracks - if ( A0Vert <= cutA0 && - nBL >= cutBL && - nPix >= cutPi && - nSi >= cutSi && - nTR >= cutNTRHits && - nTRT >= cutNTRTHits && - fabs(*trackpt) > cutPt ) - return StatusCode::SUCCESS; - - return StatusCode::FAILURE; -} - -// ==================================================================== -void JetTagAna::computeRejections() { - MsgStream mlog( msgSvc(), name() ); - double r10, e10, w10, r50, e50, w50, r60, e60, w60; - int nbj = (int)m_h_perf_b[0]->Integral(); - int nbu = (int)m_h_perf_u[0]->Integral(); - ATH_MSG_INFO ( "##### STANDARD REJECTIONS ##### #B-JETS: " << nbj << " #U-JETS: " << nbu ); - for(int i=0;i<MAX_numTaggers;i++) { - if(i>4&&i<8) continue; - this->getRej(m_h_perf_u[i], m_h_perf_b[i], r10, e10, w10, r50, e50, w50, r60, e60, w60); - ATH_MSG_INFO ( "- Tag " << m_tagger[i] << ": light-jet rejection" ); - if(i<8 || i>9) { - ATH_MSG_INFO ( " for a 50% b-tag efficiency (w>" << w50 << "): " << r50 << "+-" << e50 ); - ATH_MSG_INFO ( " for a 60% b-tag efficiency (w>" << w60 << "): " << r60 << "+-" << e60 ); - - // fill some plots here - VJ Apr. 2007 - // - m_h_perfWt_50->SetBinContent(i+1,w50); // histogram givs the weight (for each tagger) for the 50% eff point - if(r50<100000) { - m_h_perf_rej50->SetBinContent(i+1,r50); m_h_perf_rej50->SetBinError(i+1,e50); - } - m_h_perfWt_60->SetBinContent(i+1,w60); // histogram givs the weight (for each tagger) for the 50% eff point - if(r60<100000) { - m_h_perf_rej60->SetBinContent(i+1,r60); m_h_perf_rej60->SetBinError(i+1,e60); - } - // now get efficiencies as a function of et/eta/phi - // w50 was determined by averaging over all et/eta/phi. see how well it does in bins of et/eta/phi - - int nYbins = m_h_perf_b_ET[i]->GetNbinsY(); - int y50bin = m_h_perf_b[i]->FindBin(w50); - // int y60bin = m_h_perf_b[i]->FindBin(w60); - // - // first do for ET - for(int iet=1;iet<51;iet++) { - - //eff - double integ = m_h_perf_b_ET[i]->Integral(iet,iet,1,nYbins+1); - double integ50 = m_h_perf_b_ET[i]->Integral(iet,iet,y50bin,nYbins+1); - if(integ>0) { - double eff= integ50/integ; - m_h_eff_b_ET[i]->SetBinContent(iet,eff); - m_h_eff_b_ET[i]->SetBinError(iet,sqrt(eff*(1-eff)/integ)); - } - - // std. rejection - integ = m_h_perf_u_ET[i]->Integral(iet,iet,1,nYbins+1); - integ50 = m_h_perf_u_ET[i]->Integral(iet,iet,y50bin,nYbins+1); - if(integ50>0) { - m_h_rej_u_ET[i]->SetBinContent(iet,integ/integ50); - double invrej = integ50/integ; - double err_invrej = sqrt(invrej*(1-invrej)/integ); - double err_rej = err_invrej/invrej/invrej; - m_h_rej_u_ET[i]->SetBinError(iet,err_rej); - } - // purified rejection - integ = m_h_perf_upur_ET[i]->Integral(iet,iet,1,nYbins+1); - integ50 = m_h_perf_upur_ET[i]->Integral(iet,iet,y50bin,nYbins+1); - if(integ50>0) { - m_h_rej_upur_ET[i]->SetBinContent(iet,integ/integ50); - double invrej = integ50/integ; - double err_invrej = sqrt(invrej*(1-invrej)/integ); - double err_rej = err_invrej/invrej/invrej; - m_h_rej_upur_ET[i]->SetBinError(iet,err_rej); - } - - } // end of ET - - // now do for eta - for(int ieta=1;ieta<51;ieta++) { - - //eff - double integ = m_h_perf_b_eta[i]->Integral(ieta,ieta,1,nYbins+1); - double integ50 = m_h_perf_b_eta[i]->Integral(ieta,ieta,y50bin,nYbins+1); - if(integ>0) { - double eff= integ50/integ; - m_h_eff_b_eta[i]->SetBinContent(ieta,eff); - m_h_eff_b_eta[i]->SetBinError(ieta,sqrt(eff*(1-eff)/integ)); - } - - // std. rejection - integ = m_h_perf_u_eta[i]->Integral(ieta,ieta,1,nYbins+1); - integ50 = m_h_perf_u_eta[i]->Integral(ieta,ieta,y50bin,nYbins+1); - if(integ50>0) { - m_h_rej_u_eta[i]->SetBinContent(ieta,integ/integ50); - double invrej = integ50/integ; - double err_invrej = sqrt(invrej*(1-invrej)/integ); - double err_rej = err_invrej/invrej/invrej; - m_h_rej_u_eta[i]->SetBinError(ieta,err_rej); - } - // purified rejection - integ = m_h_perf_upur_eta[i]->Integral(ieta,ieta,1,nYbins+1); - integ50 = m_h_perf_upur_eta[i]->Integral(ieta,ieta,y50bin,nYbins+1); - if(integ50>0) { - m_h_rej_upur_eta[i]->SetBinContent(ieta,integ/integ50); - double invrej = integ50/integ; - double err_invrej = sqrt(invrej*(1-invrej)/integ); - double err_rej = err_invrej/invrej/invrej; - m_h_rej_upur_eta[i]->SetBinError(ieta,err_rej); - } - - } // end of eta - // now do for phi - for(int iphi=1;iphi<61;iphi++) { - - //eff - double integ = m_h_perf_b_phi[i]->Integral(iphi,iphi,1,nYbins+1); - double integ50 = m_h_perf_b_phi[i]->Integral(iphi,iphi,y50bin,nYbins+1); - if(integ>0) { - double eff= integ50/integ; - m_h_eff_b_phi[i]->SetBinContent(iphi,eff); - m_h_eff_b_phi[i]->SetBinError(iphi,sqrt(eff*(1-eff)/integ)); - } - - // std. rejection - integ = m_h_perf_u_phi[i]->Integral(iphi,iphi,1,nYbins+1); - integ50 = m_h_perf_u_phi[i]->Integral(iphi,iphi,y50bin,nYbins+1); - if(integ50>0) { - m_h_rej_u_phi[i]->SetBinContent(iphi,integ/integ50); - double invrej = integ50/integ; - double err_invrej = sqrt(invrej*(1-invrej)/integ); - double err_rej = err_invrej/invrej/invrej; - m_h_rej_u_phi[i]->SetBinError(iphi,err_rej); - } - // purified rejection - integ = m_h_perf_upur_phi[i]->Integral(iphi,iphi,1,nYbins+1); - integ50 = m_h_perf_upur_phi[i]->Integral(iphi,iphi,y50bin,nYbins+1); - if(integ50>0) { - m_h_rej_upur_phi[i]->SetBinContent(iphi,integ/integ50); - double invrej = integ50/integ; - double err_invrej = sqrt(invrej*(1-invrej)/integ); - double err_rej = err_invrej/invrej/invrej; - m_h_rej_upur_phi[i]->SetBinError(iphi,err_rej); - } - - } // end of phi - - } - else - { - ATH_MSG_INFO ( " for a 10% b-tag efficiency (w>" << w10 << "): " << r10 << "+-" << e10 ); - - m_h_perfWt_10->SetBinContent(i-7,w10);// start with bin 1 - if(r10<100000) { - m_h_perf_rej10->SetBinContent(i-7,r10); // start with bin 1 - m_h_perf_rej10->SetBinError(i-7,e10); // start with bin 1 - } - - } - // - } - int nbupur = (int)m_h_perf_upur[0]->Integral(); - ATH_MSG_INFO ( "##### REJECTIONS AFTER PURIFICATION ##### #B-JETS: " << nbj << " #U-JETS: " << nbupur ); - for(int i=0;i<MAX_numTaggers;i++) { - if(i>4&&i<8) continue; - this->getRej(m_h_perf_upur[i], m_h_perf_b[i], r10, e10, w10, r50, e50, w50, r60, e60, w60); - ATH_MSG_INFO ( "- Tag " << m_tagger[i] << ": light-jet rejection" ); - if(i<8 || i>9) { - ATH_MSG_INFO ( " for a 50% b-tag efficiency (w>" << w50 << "): " << r50 << "+-" << e50 ); - ATH_MSG_INFO ( " for a 60% b-tag efficiency (w>" << w60 << "): " << r60 << "+-" << e60 ); - // fill some plots - VJ Apr. 2007 - m_h_perfWt_pur50->SetBinContent(i+1,w50); - if(r50<100000) { - m_h_perf_rejpur50->SetBinContent(i+1,r50); m_h_perf_rejpur50->SetBinError(i+1,e50); - } - m_h_perfWt_pur60->SetBinContent(i+1,w60); - if(r60<100000) { - m_h_perf_rejpur60->SetBinContent(i+1,r60); m_h_perf_rejpur60->SetBinError(i+1,e60); - } - - - } - else - { - ATH_MSG_INFO ( " for a 10% b-tag efficiency (w>" << w10 << "): " << r10 << "+-" << e10 ); - m_h_perfWt_pur10->SetBinContent(i-7,w10);// start with bin 1 - if(r10<100000) { - m_h_perf_rejpur10->SetBinContent(i-7,r10); // start with bin 1 - m_h_perf_rejpur10->SetBinError(i-7,e10); // start with bin 1 - } - } - } -} - -void JetTagAna::getRej(TH1F* uw, TH1F* bw, - double& ru10, double& eru10, double& w10, - double& ru50, double& eru50, double& w50, - double& ru60, double& eru60, double& w60 - ) { - if(uw==0||bw==0) return; - const int n_max_bins = 1000; - int nb = uw->GetNbinsX()+1; - if(nb>n_max_bins) return; - int bi10 = 0; - int bi50 = 0; - int bi60 = 0; - double ru[n_max_bins],efb[n_max_bins],eru[n_max_bins]; //,eefb[n_max_bins]; - const double xbi = (double) bw->Integral(0,nb); // also includes overflows - const double xui = (double) uw->Integral(0,nb); - const double inv_xbi = xbi != 0 ? 1. / xbi : 1; - const double inv_xui = xui != 0 ? 1. / xui : 1; - for (int ib = 1;ib<nb;ib++) { - efb[ib-1] = ((double) bw->Integral(ib,nb)) * inv_xbi; - if(ib>1) { - if (efb[ib-1] <= 0.1 && efb[ib-2] >= 0.1) {bi10 = ib-1;} - if (efb[ib-1] <= 0.5 && efb[ib-2] >= 0.5) {bi50 = ib-1;} - if (efb[ib-1] <= 0.6 && efb[ib-2] >= 0.6) {bi60 = ib-1;} - } - //eefb[ib-1] = sqrt(efb[ib-1]*(1.-efb[ib-1])/xbi); // nothing done with that - if(uw->Integral(ib,nb)>0.) { - ru[ib-1] = xui/((double) uw->Integral(ib,nb)); - eru[ib-1] = ru[ib-1]*sqrt((ru[ib-1]-1.) * inv_xui); - } else { - ru[ib-1] = 0.; - eru[ib-1] = 0.; - } - } - - if (bi10 > 0) { - w10 = uw->GetBinCenter(bi10); - ru10 = (ru[bi10]*(efb[bi10-1]-0.1)+ru[bi10-1]*(0.1-efb[bi10]))/(efb[bi10-1]-efb[bi10]); - eru10 = (eru[bi10]*(efb[bi10-1]-0.1)+eru[bi10-1]*(0.1-efb[bi10]))/(efb[bi10-1]-efb[bi10]); - } - else { - w10 = 0; - ru10 = 0; - eru10 = 0; - } - - if (bi50 > 0) { - w50 = uw->GetBinCenter(bi50); - ru50 = (ru[bi50]*(efb[bi50-1]-0.5)+ru[bi50-1]*(0.5-efb[bi50]))/(efb[bi50-1]-efb[bi50]); - eru50 = (eru[bi50]*(efb[bi50-1]-0.5)+eru[bi50-1]*(0.5-efb[bi50]))/(efb[bi50-1]-efb[bi50]); - } - else { - w50 = 0; - ru50 = 0; - eru50 = 0; - } - - if (bi60 > 0) { - w60 = uw->GetBinCenter(bi60); - ru60 = (ru[bi60]*(efb[bi60-1]-0.6)+ru[bi60-1]*(0.6-efb[bi60]))/(efb[bi60-1]-efb[bi60]); - eru60 = (eru[bi60]*(efb[bi60-1]-0.6)+eru[bi60-1]*(0.6-efb[bi60]))/(efb[bi60-1]-efb[bi60]); - } - else { - w60 = 0; - ru60 = 0; - eru60 = 0; - } -} - -void JetTagAna::bookHistograms() { - if (m_h_global_counters) return; - m_h_global_counters = new TH1F("global_counters","Counters",100,0.,100.); - m_h_global_nprimvtx = new TH1F("global_nprimvtx","N primary vertex",10,0.,10.); - m_h_global_xprimvtx = new TH1F("global_xprimvtx","X primary vertex",100,-0.1,0.1); - m_h_global_yprimvtx = new TH1F("global_yprimvtx","Y primary vertex",100,-0.1,0.1); - m_h_global_zprimvtx = new TH1F("global_zprimvtx","Z primary vertex",100,-250.,250.); - m_h_global_primvtxresx = new TH1F("global_primvtxresx","reso X primary vertex",100,-0.1,0.1); - m_h_global_primvtxresy = new TH1F("global_primvtxresy","reso Y primary vertex",100,-0.1,0.1); - m_h_global_primvtxresz = new TH1F("global_primvtxresz","reso Z primary vertex",100,-0.5,0.5); - m_h_global_nmcpart = new TH1F("global_nmcpart","N MC particles",100,0.,1500.); - m_h_global_ntrkpart = new TH1F("global_ntrkpart","N TrackParticles",100,0.,200.); - m_h_global_BLayerHits = new TH1F("global_BLayerHits","No. of BLayer Hits on TrackP",5,0.,5.); - m_h_global_BLayerSharedHits = new TH1F("global_BLayerSharedHits","No. of BLayer shared hits on TrackP",5,0.,5.); - m_h_global_PixelHits = new TH1F("global_PixelHits","No. of Pixel Hits on TrackP",10,0.,10.); - m_h_global_PixelLayers = new TH1F("global_PixelLayers","No. of Pixel Layers on TrackP",10,0.,10.); - m_h_global_SiHits = new TH1F("global_SiHits","No. of Pixel+SCT Hits on TrackP",25,0.,25.); - m_h_global_TRTHits = new TH1F("global_TRTHits","No. of TRT Hits on TrackP",100,0.,100.); - m_h_global_nmuon = new TH1F("global_nmuon","N Muons",10,0.,10.); - m_h_global_nelectron = new TH1F("global_nelectron","N Electron",10,0.,10.); - m_h_global_njettag = new TH1F("global_njettag","N JetTag",30,0.,30.); - m_h_truth_bquark_nb = new TH1F("truth_bquark_nb","N quark b",10,0.,10.); - m_h_truth_bquark_pt = new TH1F("truth_bquark_pt","b quark pt",100,0.,100000.); - m_h_truth_bquark_eta= new TH1F("truth_bquark_eta","b quark eta",100,-5.,5.); - m_h_truth_cquark_nb = new TH1F("truth_cquark_nb","N quark c",10,0.,10.); - m_h_truth_cquark_pt = new TH1F("truth_cquark_pt","c quark pt",100,0.,100000.); - m_h_truth_cquark_eta= new TH1F("truth_cquark_eta","c quark eta",100,-5.,5.); - m_h_truth_bhadr_nb = new TH1F("truth_bhadr_nb","N hadr b",10,0.,10.); - m_h_truth_bhadr_pt = new TH1F("truth_bhadr_pt","b hadr pt",100,0.,100000.); - m_h_truth_bhadr_eta = new TH1F("truth_bhadr_eta","b hadr eta",100,-5.,5.); - m_h_truth_chadr_nb = new TH1F("truth_chadr_nb","N hadr c",10,0.,10.); - m_h_truth_chadr_pt = new TH1F("truth_chadr_pt","c hadr pt",100,0.,100000.); - m_h_truth_chadr_eta = new TH1F("truth_chadr_eta","c hadr eta",100,-5.,5.); - m_h_jet_ntotal = new TH1F("jet_ntotal","N jets",30,0.,30.); - m_h_jet_label = new TH1F("jet_label","MC jet label",20,0.,20.); - m_h_jet_nlabelb = new TH1F("jet_nlabelb","N jets label b",10,0.,10.); - m_h_jet_nlabelc = new TH1F("jet_nlabelc","N jets label c",10,0.,10.); - m_h_jet_nlabelt = new TH1F("jet_nlabelt","N jets label tau",10,0.,10.); - m_h_jet_ntag = new TH1F("jet_ntag","N tags",20,0.,20.); - m_h_jet_eta = new TH1F("jet_eta","Jet eta",100,-5.,5.); - m_h_jet_phi = new TH1F("jet_phi","Jet phi",100,-3.15,3.15); - m_h_jet_et = new TH1F("jet_et","Jet et",100,0.,500000.); - m_h_jet_ntracks = new TH1F("jet_ntracks","# tracks in a Jet",50,0,50.); - m_h_jet_tracks_pt = new TH1F("jet_tracks_pt","pT of tracks in a Jet",100,0,50.); - m_h_jet_nmuons = new TH1F("jet_nmuons","# muons in a Jet",10,0,10.); - m_h_jet_muons_pt = new TH1F("jet_muons_pt","pT of muons in a Jet",100,0,100.); - m_h_jet_nelectrons = new TH1F("jet_nelectrons","# electrons in a Jet",10,0,10.); - m_h_jet_electrons_pt= new TH1F("jet_electrons_pt","pT of electrons in a Jet",100,0,100.); - m_h_jet_tracks_BLayerHits = new TH1F("jet_tracks_BLayerHits","BLay hits",10,0.,10.); - m_h_jet_tracks_PixelHits = new TH1F("jet_tracks_PixelHits","Pixel hits",10,0.,10.); - m_h_jet_tracks_SCTHits = new TH1F("jet_tracks_SCTHits","SCT hits",20,0.,20.); - m_h_tag_jetprob_w = new TH1F("tag_jetprob_w","JetProb: weight",100,0.,1.); - m_h_tag_i2d_w = new TH1F("tag_i2d_w","IP2D: weight",120,-20.,40.); - m_h_tag_i2d_n = new TH1F("tag_i2d_n","IP2D: Ntrack",20,0.,20.); - m_h_tag_i2d_b = new TH1F("tag_i2d_b","IP2D: Pb",10,0.,1.); - m_h_tag_i2d_u = new TH1F("tag_i2d_u","IP2D: Pu",10,0.,1.); - m_h_tag_i2d_sig = new TH1F("tag_i2d_sig","IP2D: signed IP",100,-5.,5.); - m_h_tag_i3d_w = new TH1F("tag_i3d_w","IP3D: weight",120,-20.,40.); - m_h_tag_i3d_n = new TH1F("tag_i3d_n","IP3D: Ntrack",20,0.,20.); - m_h_tag_i3d_b = new TH1F("tag_i3d_b","IP3D: Pb",10,0.,1.); - m_h_tag_i3d_u = new TH1F("tag_i3d_u","IP3D: Pu",10,0.,1.); - m_h_tag_i3d_sig = new TH1F("tag_i3d_sig","IP3D: signed IP",100,-5.,5.); - m_h_tag_sv1_w = new TH1F("tag_sv1_w","SV1: weight",120,-20.,40.); - m_h_tag_sv1_b = new TH1F("tag_sv1_b","SV1: Pb",10,0.,1.); - m_h_tag_sv1_u = new TH1F("tag_sv1_u","SV1: Pu",10,0.,1.); - m_h_tag_sv_n = new TH1F("tag_sv_n","SV1: Ntrack",10,-1.,9.); - m_h_tag_sv_n2t = new TH1F("tag_sv_n2t","SV1: N2T",20,0.,20.); - m_h_tag_sv_frc = new TH1F("tag_sv_frc","SV1: Frc",100,0.,1.); - m_h_tag_sv_m = new TH1F("tag_sv_m","SV1: mass",100,0.,10.); - m_h_tag_sv2_w = new TH1F("tag_sv2_w","SV2: weight",120,-20.,40.); - m_h_tag_sv2_b = new TH1F("tag_sv2_b","SV2: Pb",10,0.,1.); - m_h_tag_sv2_u = new TH1F("tag_sv2_u","SV2: Pu",10,0.,1.); - m_h_tag_cmb_w = new TH1F("tag_cmb_w","Weight combined",120,-20.,40.); - m_h_tag_lf2d_w = new TH1F("tag_lf2d_w","Lifetime2D: weight",120,-20.,40.); - m_h_tag_svbu_w = new TH1F("tag_svbu_w","SecVtxTagBU: weight",120,-20.,40.); - m_h_tag_lhsig_w = new TH1F("tag_lhsig_w","lhSig: weight",120,-20.,40.); - m_h_tag_softm_w = new TH1F("tag_softm_w","SoftMuonTag: weight",120,-20.,40.); - m_h_tag_softe_w = new TH1F("tag_softe_w","SoftElectronTag: weight",120,-20.,40.); - m_h_tag_jetfitter_w = new TH1F("tag_jetfitter_w","JetFitterTag: weight",120,-20.,40.); - m_h_tag_jetfitcomb_w = new TH1F("tag_jetfitcomb_w","JetFitterCombTag: weight",120,-20.,40.); - m_h_tag_jetfitternn_w = new TH1F("tag_jetfitternn_w","JetFitterTagNN: weight",120,-20.,40.); - m_h_tag_jetfitcombnn_w = new TH1F("tag_jetfitcombnn_w","JetFitterCombTagNN: weight",120,-20.,40.); - - //* - m_h_tag_i2d_of_w = new TH1F("tag_i2d_of_w","IP2D offline weight if selected by trigger",120,-20.,40.); - m_h_tag_i3d_of_w = new TH1F("tag_i3d_of_w","IP3D offline weight if selected by trigger",120,-20.,40.); - m_h_tag_i2d_l2_w = new TH1F("tag_i2d_l2_w","IP2D LVL2 weight",50,0.,1.); - m_h_tag_i3d_l2_w = new TH1F("tag_i3d_l2_w","IP3D LVL2 weight",50,0.,1.); - m_h_tag_i2d_ef_w = new TH1F("tag_i2d_ef_w","IP2D EF weight",50,0.,1.); - m_h_tag_i3d_ef_w = new TH1F("tag_i3d_ef_w","IP3D EF weight",50,0.,1.); - - // plots as a function of jet ET - for(int i=0; i<6; ++i) { - TString htit(m_jetET[i]); - m_h_tag_IPinfo_ntrk[i] = new TH1F(htit+"_tag_IPinfo_ntrk",htit+" ntrk in jet",50,0.,50.); - m_h_tag_IPinfo_trkPt[i] = new TH1F(htit+"_tag_IPinfo_trkPt",htit+" trk Pt in jet",100,0.,25.); - m_h_tag_IPinfo_d0val[i] = new TH1F(htit+"_tag_IPinfo_d0val",htit+" IP info - d0val",120,-0.2,0.4); - m_h_tag_IPinfo_z0val[i] = new TH1F(htit+"_tag_IPinfo_z0val",htit+" IP info - z0val",120,-0.5,1.); - m_h_tag_IPinfo_d0sig[i] = new TH1F(htit+"_tag_IPinfo_d0sig",htit+" IP info - d0sig",100,-5.,5.); - m_h_tag_IPinfo_z0sig[i] = new TH1F(htit+"_tag_IPinfo_z0sig",htit+" IP info - z0sig",100,-5.,5.); - m_h_tag_IPinfo_weight2D[i] = new TH1F(htit+"_tag_IPinfo_weight2D",htit+" weight2D for each track",100,-2.,6.); - m_h_tag_IPinfo_weight3D[i] = new TH1F(htit+"_tag_IPinfo_weight3D",htit+" weight3D for each track",100,-2.,6.); - m_h_tag_IPinfo_piJP[i] = new TH1F(htit+"_tag_IPinfo_piJP",htit+" piJP for each track",100,-1.,1.); - m_h_tag_IPinfo_fromV0[i] = new TH1F(htit+"_tag_IPinfo_fromV0",htit+" fromV0: for each track",3,-1,2.); - m_h_tag_IPinfo_grade[i] = new TH1F(htit+"_tag_IPinfo_grade",htit+" grade: for each track",5,-1,4.); - } - - int hnb[MAX_numTaggers]; - float hmin[MAX_numTaggers], hmax[MAX_numTaggers]; - - for(int i=0;i<(MAX_numTaggers-MAX_numHLTTaggers)+2;i++) { - hnb[i] = 560; - hmin[i] = -20.; - hmax[i] = +50.; - if(m_tagger[i]=="JetProb") { - hnb[i] = 100; - hmin[i] = 0.; - hmax[i] = 10.; - } - } - for(int i=(MAX_numTaggers-MAX_numHLTTaggers)+2;i<MAX_numTaggers;i++) { - hnb[i] = 50; - hmin[i] = 0.; - hmax[i] = 1.; - } - for(int i=0;i<MAX_numTaggers;i++) { - TString tit("perf_"); tit+=m_tagger[i]; tit.ToLower(); - TString htit(m_tagger[i]); - m_h_perf_b[i] = new TH1F(tit+"_b",htit+": weight for selected b jets",hnb[i],hmin[i],hmax[i]); - m_h_perf_u[i] = new TH1F(tit+"_u",htit+": weight for selected u jets",hnb[i],hmin[i],hmax[i]); - m_h_perf_upur[i] = new TH1F(tit+"_upur",htit+": weight for selected purified u jets",hnb[i],hmin[i],hmax[i]); - // - // hists for eff/rej as a function of ET/eta/phi - // - m_h_perf_b_ET[i] = new TH2F(tit+"_b_ET",htit+":weight for selected b jets v jet ET",50,0.,1000.,hnb[i],hmin[i],hmax[i]); - m_h_perf_b_eta[i] = new TH2F(tit+"_b_eta",htit+":weight for selected b jets v jet eta",50,-5.,5,hnb[i],hmin[i],hmax[i]); - m_h_perf_b_phi[i] = new TH2F(tit+"_b_phi",htit+":weight for selected b jets v jet phi",60,-3.15,3.15,hnb[i],hmin[i],hmax[i]); - m_h_perf_u_ET[i] = new TH2F(tit+"_u_ET",htit+":weight for selected u jets v jet ET",50,0.,1000.,hnb[i],hmin[i],hmax[i]); - m_h_perf_u_eta[i] = new TH2F(tit+"_u_eta",htit+":weight for selected u jets v jet eta",50,-5.,5.,hnb[i],hmin[i],hmax[i]); - m_h_perf_u_phi[i] = new TH2F(tit+"_u_phi",htit+":weight for selected u jets v jet phi",60,-3.15,3.15,hnb[i],hmin[i],hmax[i]); - m_h_perf_upur_ET[i] = new TH2F(tit+"_upur_ET",htit+":weight for selected u purified jets v jet ET",50,0.,1000.,hnb[i],hmin[i],hmax[i]); - m_h_perf_upur_eta[i] = new TH2F(tit+"_upur_eta",htit+":weight for selected u purified jets v jet eta",50,-5.,5.,hnb[i],hmin[i],hmax[i]); - m_h_perf_upur_phi[i] = new TH2F(tit+"_upur_phi",htit+":weight for selected u purified jets v jet phi",60,-3.15,3.15,hnb[i],hmin[i],hmax[i]); - // - TString tit1("eff_"); tit1+=m_tagger[i]; tit1.ToLower(); - m_h_eff_b_ET[i] = new TH1F(tit1+"_b_ET",htit+":efficiency of 50% point for selected b jets v jet ET",50,0.,1000.); - m_h_eff_b_ET[i]->Sumw2(); - m_h_eff_b_eta[i] = new TH1F(tit1+"_b_eta",htit+":efficiency of 50% point for selected b jets v jet eta",50,-5.,5.); - m_h_eff_b_eta[i]->Sumw2(); - m_h_eff_b_phi[i] = new TH1F(tit1+"_b_phi",htit+":efficiency of 50% point for selected b jets v jet phi",60,-3.15,3.15); - m_h_eff_b_phi[i]->Sumw2(); - TString tit2("rej_"); tit2+=m_tagger[i]; tit2.ToLower(); - m_h_rej_u_ET[i] = new TH1F(tit2+"_u_ET",htit+":rejection of 50% point for selected u jets v jet ET",50,0.,1000.); - m_h_rej_u_ET[i]->Sumw2(); - m_h_rej_u_eta[i] = new TH1F(tit2+"_u_eta",htit+":rejection of 50% point for selected u jets v jet eta",50,-5.,5.); - m_h_rej_u_eta[i]->Sumw2(); - m_h_rej_u_phi[i] = new TH1F(tit2+"_u_phi",htit+":rejection of 50% point for selected u jets v jet phi",60,-3.15,3.15); - m_h_rej_u_phi[i]->Sumw2(); - // - m_h_rej_upur_ET[i] = new TH1F(tit2+"_upur_ET",htit+":rejection of 50% point for selected u purified jets v jet ET",50,0.,1000.); - m_h_rej_upur_ET[i]->Sumw2(); - m_h_rej_upur_eta[i] = new TH1F(tit2+"_upur_eta",htit+":rejection of 50% point for selected u purified jets v jet eta",50,-5.,5.); - m_h_rej_upur_eta[i]->Sumw2(); - m_h_rej_upur_phi[i] = new TH1F(tit2+"_upur_phi",htit+":rejection of 50% point for selected u purified jets v jet phi",60,-3.15,3.15); - m_h_rej_upur_phi[i]->Sumw2(); - - } - m_h_perf_vxeff_den_b = new TH1F("perf_vxeff_den_b","SV efficiency (den) b",1,0.,1.); - m_h_perf_vxeff_num_b = new TH1F("perf_vxeff_num_b","SV efficiency (num) b",1,0.,1.); - m_h_perf_vxeff_den_u = new TH1F("perf_vxeff_den_u","SV efficiency (den) u",1,0.,1.); - m_h_perf_vxeff_num_u = new TH1F("perf_vxeff_num_u","SV efficiency (num) u",1,0.,1.); - m_h_perf_vxeff_den_upur = new TH1F("perf_vxeff_den_upur","SV efficiency (den) u",1,0.,1.); - m_h_perf_vxeff_num_upur = new TH1F("perf_vxeff_num_upur","SV efficiency (num) u",1,0.,1.); - m_h_perf_rej10 = new TH1F("perf_rej10","Rejections for soft muon/electron (eff=0.1)",15,0.,15.); - m_h_perf_rej10->Sumw2(); - m_h_perf_rej50 = new TH1F("perf_rej50","Rejections (eff=0.5)",15,0.,15.); - m_h_perf_rej50->Sumw2(); - m_h_perf_rej60 = new TH1F("perf_rej60","Rejections (eff=0.6)",15,0.,15.); - m_h_perf_rej60->Sumw2(); - m_h_perf_rejpur10 = new TH1F("perf_rejpur10","Rejections for soft muon/electron (eff=0.1 purification)",15,0.,15.); - m_h_perf_rejpur10->Sumw2(); - m_h_perf_rejpur50 = new TH1F("perf_rejpur50","Rejections (eff=0.5, purification)",15,0.,15.); - m_h_perf_rejpur50->Sumw2(); - m_h_perf_rejpur60 = new TH1F("perf_rejpur60","Rejections (eff=0.6, purification)",15,0.,15.); - m_h_perf_rejpur60->Sumw2(); - m_h_perfWt_10 = new TH1F("perfWt_10","Weight for which (eff=0.1) soft muon/electron",15,0.,15.); - m_h_perfWt_50 = new TH1F("perfWt_50","Weight for which (eff=0.5)",15,0.,15.); - m_h_perfWt_60 = new TH1F("perfWt_60","Weight for which (eff=0.6)",15,0.,15.); - m_h_perfWt_pur10 = new TH1F("perfWt_pur10","Weight for which (eff=0.1, purification) soft muon/electron",15,0.,15.); - m_h_perfWt_pur50 = new TH1F("perfWt_pur50","Weight for which (eff=0.5, purification)",15,0.,15.); - m_h_perfWt_pur60 = new TH1F("perfWt_pur60","Weight for which (eff=0.6, purification)",15,0.,15.); - std::string histDir("/fileJetTagAna/"); - StatusCode sc; - sc = m_histos->regHist(histDir+"global_counters",m_h_global_counters); - sc = m_histos->regHist(histDir+"global_nprimvtx",m_h_global_nprimvtx); - sc = m_histos->regHist(histDir+"global_xprimvtx",m_h_global_xprimvtx); - sc = m_histos->regHist(histDir+"global_yprimvtx",m_h_global_yprimvtx); - sc = m_histos->regHist(histDir+"global_zprimvtx",m_h_global_zprimvtx); - sc = m_histos->regHist(histDir+"global_primvtxresx",m_h_global_primvtxresx); - sc = m_histos->regHist(histDir+"global_primvtxresy",m_h_global_primvtxresy); - sc = m_histos->regHist(histDir+"global_primvtxresz",m_h_global_primvtxresz); - sc = m_histos->regHist(histDir+"global_nmcpart", m_h_global_nmcpart); - sc = m_histos->regHist(histDir+"global_ntrkpart",m_h_global_ntrkpart); - sc = m_histos->regHist(histDir+"global_BLayerHits",m_h_global_BLayerHits); - sc = m_histos->regHist(histDir+"global_BLayerSharedHits",m_h_global_BLayerSharedHits); - sc = m_histos->regHist(histDir+"global_PixelHits",m_h_global_PixelHits); - sc = m_histos->regHist(histDir+"global_PixelLayers",m_h_global_PixelLayers); - sc = m_histos->regHist(histDir+"global_SiHits",m_h_global_SiHits); - sc = m_histos->regHist(histDir+"global_TRTHits",m_h_global_TRTHits); - sc = m_histos->regHist(histDir+"global_muon",m_h_global_nmuon); - sc = m_histos->regHist(histDir+"global_electron",m_h_global_nelectron); - sc = m_histos->regHist(histDir+"global_njettag", m_h_global_njettag); - sc = m_histos->regHist(histDir+"truth_bquark_nb",m_h_truth_bquark_nb); - sc = m_histos->regHist(histDir+"truth_bquark_pt",m_h_truth_bquark_pt); - sc = m_histos->regHist(histDir+"truth_bquark_eta",m_h_truth_bquark_eta); - sc = m_histos->regHist(histDir+"truth_cquark_nb",m_h_truth_cquark_nb); - sc = m_histos->regHist(histDir+"truth_cquark_pt",m_h_truth_cquark_pt); - sc = m_histos->regHist(histDir+"truth_cquark_eta",m_h_truth_cquark_eta); - sc = m_histos->regHist(histDir+"truth_bhadr_nb",m_h_truth_bhadr_nb); - sc = m_histos->regHist(histDir+"truth_bhadr_pt",m_h_truth_bhadr_pt); - sc = m_histos->regHist(histDir+"truth_bhadr_eta",m_h_truth_bhadr_eta); - sc = m_histos->regHist(histDir+"truth_chadr_nb",m_h_truth_chadr_nb); - sc = m_histos->regHist(histDir+"truth_chadr_pt",m_h_truth_chadr_pt); - sc = m_histos->regHist(histDir+"truth_chadr_eta",m_h_truth_chadr_eta); - sc = m_histos->regHist(histDir+"jet_ntotal", m_h_jet_ntotal); - sc = m_histos->regHist(histDir+"jet_label", m_h_jet_label); - sc = m_histos->regHist(histDir+"jet_nlabelb",m_h_jet_nlabelb); - sc = m_histos->regHist(histDir+"jet_nlabelc",m_h_jet_nlabelc); - sc = m_histos->regHist(histDir+"jet_nlabelt",m_h_jet_nlabelt); - sc = m_histos->regHist(histDir+"jet_ntag", m_h_jet_ntag); - sc = m_histos->regHist(histDir+"jet_eta", m_h_jet_eta); - sc = m_histos->regHist(histDir+"jet_ntracks", m_h_jet_ntracks); - sc = m_histos->regHist(histDir+"jet_tracks_pt", m_h_jet_tracks_pt); - sc = m_histos->regHist(histDir+"jet_nmuons", m_h_jet_nmuons); - sc = m_histos->regHist(histDir+"jet_muons_pt", m_h_jet_muons_pt); - sc = m_histos->regHist(histDir+"jet_nelectrons", m_h_jet_nelectrons); - sc = m_histos->regHist(histDir+"jet_electrons_pt", m_h_jet_electrons_pt); - sc = m_histos->regHist(histDir+"jet_phi", m_h_jet_phi); - sc = m_histos->regHist(histDir+"jet_et", m_h_jet_et); - sc = m_histos->regHist(histDir+"tag_jetprob_w",m_h_tag_jetprob_w); - sc = m_histos->regHist(histDir+"tag_i2d_w",m_h_tag_i2d_w); - sc = m_histos->regHist(histDir+"tag_i2d_n",m_h_tag_i2d_n); - sc = m_histos->regHist(histDir+"tag_i2d_b",m_h_tag_i2d_b); - sc = m_histos->regHist(histDir+"tag_i2d_u",m_h_tag_i2d_u); - sc = m_histos->regHist(histDir+"tag_i2d_sig",m_h_tag_i2d_sig); - sc = m_histos->regHist(histDir+"tag_i3d_w",m_h_tag_i3d_w); - sc = m_histos->regHist(histDir+"tag_i3d_n",m_h_tag_i3d_n); - sc = m_histos->regHist(histDir+"tag_i3d_b",m_h_tag_i3d_b); - sc = m_histos->regHist(histDir+"tag_i3d_u",m_h_tag_i3d_u); - sc = m_histos->regHist(histDir+"tag_i3d_sig",m_h_tag_i3d_sig); - sc = m_histos->regHist(histDir+"tag_sv1_w",m_h_tag_sv1_w); - sc = m_histos->regHist(histDir+"tag_sv1_b",m_h_tag_sv1_b); - sc = m_histos->regHist(histDir+"tag_sv1_u",m_h_tag_sv1_u); - sc = m_histos->regHist(histDir+"tag_sv_n",m_h_tag_sv_n); - sc = m_histos->regHist(histDir+"tag_sv_n2t",m_h_tag_sv_n2t); - sc = m_histos->regHist(histDir+"tag_sv_frc",m_h_tag_sv_frc); - sc = m_histos->regHist(histDir+"tag_sv_m",m_h_tag_sv_m); - sc = m_histos->regHist(histDir+"tag_sv2_w",m_h_tag_sv2_w); - sc = m_histos->regHist(histDir+"tag_sv2_b",m_h_tag_sv2_b); - sc = m_histos->regHist(histDir+"tag_sv2_u",m_h_tag_sv2_u); - sc = m_histos->regHist(histDir+"tag_cmb_w",m_h_tag_cmb_w); - sc = m_histos->regHist(histDir+"tag_lf2d_w",m_h_tag_lf2d_w); - sc = m_histos->regHist(histDir+"tag_svbu_w",m_h_tag_svbu_w); - sc = m_histos->regHist(histDir+"tag_lhsig_w",m_h_tag_lhsig_w); - sc = m_histos->regHist(histDir+"tag_softm_w",m_h_tag_softm_w); - sc = m_histos->regHist(histDir+"tag_jetfitter_w",m_h_tag_jetfitter_w); - sc = m_histos->regHist(histDir+"tag_jetfitcomb_w",m_h_tag_jetfitcomb_w); - sc = m_histos->regHist(histDir+"tag_jetfitternn_w",m_h_tag_jetfitternn_w); - sc = m_histos->regHist(histDir+"tag_jetfitcombnn_w",m_h_tag_jetfitcombnn_w); - //* - sc = m_histos->regHist(histDir+"tag_i2d_of_w",m_h_tag_i2d_of_w); - sc = m_histos->regHist(histDir+"tag_i3d_of_w",m_h_tag_i3d_of_w); - sc = m_histos->regHist(histDir+"tag_i2d_l2_w",m_h_tag_i2d_l2_w); - sc = m_histos->regHist(histDir+"tag_i3d_l2_w",m_h_tag_i3d_l2_w); - sc = m_histos->regHist(histDir+"tag_i2d_ef_w",m_h_tag_i2d_ef_w); - sc = m_histos->regHist(histDir+"tag_i3d_ef_w",m_h_tag_i3d_ef_w); - // - for(int i=0; i<6; ++i) { - TString htit(m_jetET[i]); - htit.ToLower(); - - std::string htit2 = htit.Data(); htit2+="_tag_IPinfo_ntrk"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_ntrk[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_trkPt"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_trkPt[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_d0val"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_d0val[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_z0val"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_z0val[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_d0sig"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_d0sig[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_z0sig"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_z0sig[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_weight2D"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_weight2D[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_weight3D"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_weight3D[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_piJP"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_piJP[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_fromV0"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_fromV0[i]); - - htit2 = htit.Data(); htit2+="_tag_IPinfo_grade"; - sc = m_histos->regHist(histDir+htit2,m_h_tag_IPinfo_grade[i]); - } - // - for(int i=0;i<MAX_numTaggers;i++) { - TString tit("perf_"); tit+=m_tagger[i]; tit.ToLower(); - std::string tit2 = tit.Data(); tit2+="_b"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_b[i]); - tit2 = tit.Data(); tit2+="_u"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_u[i]); - tit2 = tit.Data(); tit2+="_upur"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_upur[i]); - // - tit2=tit.Data(); tit2+="_b_ET"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_b_ET[i]); - tit2=tit.Data(); tit2+="_b_eta"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_b_eta[i]); - tit2=tit.Data(); tit2+="_b_phi"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_b_phi[i]); - tit2=tit.Data(); tit2+="_u_ET"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_u_ET[i]); - tit2=tit.Data(); tit2+="_u_eta"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_u_eta[i]); - tit2=tit.Data(); tit2+="_u_phi"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_u_phi[i]); - tit2=tit.Data(); tit2+="_upur_ET"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_upur_ET[i]); - tit2=tit.Data(); tit2+="_upur_eta"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_upur_eta[i]); - tit2=tit.Data(); tit2+="_upur_phi"; - sc = m_histos->regHist(histDir+tit2,m_h_perf_upur_phi[i]); - // - TString titA("eff_"); titA+=m_tagger[i]; titA.ToLower(); - tit2=titA.Data(); tit2+="_b_ET"; - sc = m_histos->regHist(histDir+tit2,m_h_eff_b_ET[i]); - tit2=titA.Data(); tit2+="_b_eta"; - sc = m_histos->regHist(histDir+tit2,m_h_eff_b_eta[i]); - tit2=titA.Data(); tit2+="_b_phi"; - sc = m_histos->regHist(histDir+tit2,m_h_eff_b_phi[i]); - // - TString titB("rej_"); titB+=m_tagger[i]; titB.ToLower(); - tit2=titB.Data(); tit2+="_u_ET"; - sc = m_histos->regHist(histDir+tit2,m_h_rej_u_ET[i]); - tit2=titB.Data(); tit2+="_u_eta"; - sc = m_histos->regHist(histDir+tit2,m_h_rej_u_eta[i]); - tit2=titB.Data(); tit2+="_u_phi"; - sc = m_histos->regHist(histDir+tit2,m_h_rej_u_phi[i]); - // - tit2=titB.Data(); tit2+="_upur_ET"; - sc = m_histos->regHist(histDir+tit2,m_h_rej_upur_ET[i]); - tit2=titB.Data(); tit2+="_upur_eta"; - sc = m_histos->regHist(histDir+tit2,m_h_rej_upur_eta[i]); - tit2=titB.Data(); tit2+="_upur_phi"; - sc = m_histos->regHist(histDir+tit2,m_h_rej_upur_phi[i]); - - } - sc = m_histos->regHist(histDir+"perf_vxeff_den_b",m_h_perf_vxeff_den_b); - sc = m_histos->regHist(histDir+"perf_vxeff_num_b",m_h_perf_vxeff_num_b); - sc = m_histos->regHist(histDir+"perf_vxeff_den_u",m_h_perf_vxeff_den_u); - sc = m_histos->regHist(histDir+"perf_vxeff_num_u",m_h_perf_vxeff_num_u); - sc = m_histos->regHist(histDir+"perf_vxeff_den_upur",m_h_perf_vxeff_den_upur); - sc = m_histos->regHist(histDir+"perf_vxeff_num_upur",m_h_perf_vxeff_num_upur); - sc = m_histos->regHist(histDir+"perf_rej10",m_h_perf_rej10); - sc = m_histos->regHist(histDir+"perf_rej50",m_h_perf_rej50); - sc = m_histos->regHist(histDir+"perf_rej60",m_h_perf_rej60); - sc = m_histos->regHist(histDir+"perf_rejpur10",m_h_perf_rejpur10); - sc = m_histos->regHist(histDir+"perf_rejpur50",m_h_perf_rejpur50); - sc = m_histos->regHist(histDir+"perf_rejpur60",m_h_perf_rejpur60); - sc = m_histos->regHist(histDir+"perfWt_10",m_h_perfWt_10); - sc = m_histos->regHist(histDir+"perfWt_50",m_h_perfWt_50); - sc = m_histos->regHist(histDir+"perfWt_60",m_h_perfWt_60); - sc = m_histos->regHist(histDir+"perfWt_pur10",m_h_perfWt_pur10); - sc = m_histos->regHist(histDir+"perfWt_pur50",m_h_perfWt_pur50); - sc = m_histos->regHist(histDir+"perfWt_pur60",m_h_perfWt_pur60); - // in case a tuple is written - if (m_UseTupleSET) { - p_nt1 = new TTree("JetTagAna","JetTagAna"); - std::string TreeDir("/fileJetTagAna/JetTagAna"); - sc = m_histos->regTree(TreeDir,p_nt1); - if (sc.isSuccess()) { - p_nt1->Branch("event", &m_ievt, "event/I"); - p_nt1->Branch("run", &m_irun, "run/I"); - p_nt1->Branch("njetse", &m_njet, "njetse/I"); - p_nt1->Branch("jetse_phi", &m_jet_phi, "jetse_phi[njetse]/F"); - p_nt1->Branch("jetse_eta", &m_jet_eta, "jetse_eta[njetse]/F"); - p_nt1->Branch("jetse_et", &m_jet_et, "jetse_et[njetse]/F"); - p_nt1->Branch("jetse_flav", &m_jet_flav, "jetse_flav[njetse]/I"); - p_nt1->Branch("jetse_isol", &m_jet_isol, "jetse_isol[njetse]/I"); - p_nt1->Branch("jetse_nelej", &m_nelej, "jetse_nelej[njetse]/I"); - p_nt1->Branch("jetse_ntrackj",&m_ntrackj, "jetse_ntrackj[njetse]/I"); - p_nt1->Branch("jetse_nmuonj", &m_nmuonj, "jetse_nmuonj[njetse]/I"); - // - p_nt1->Branch("jetse_ne", &m_jet_ne, "jetse_ne[njetse]/I"); - p_nt1->Branch("jetse_eptr", &m_jet_eptr, "jetse_eptr[njetse]/F"); - p_nt1->Branch("jetse_ea0", &m_jet_ea0, "jetse_ea0[njetse]/F"); - p_nt1->Branch("jetse_ept", &m_jet_ept, "jetse_ept[njetse]/F"); - - p_nt1->Branch("jetse_ew", &m_jet_ew, "jetse_ew[njetse]/F"); - p_nt1->Branch("jetse_elh", &m_jet_elh, "jetse_elh[njetse]/F"); - p_nt1->Branch("jetse_eTrueEle", &m_jet_eTrueEle, "jetse_eTrueEle[njetse]/I"); - p_nt1->Branch("jetse_eAnyEle", &m_jet_eAnyEle, "jetse_eAnyEle[njetse]/I"); - - p_nt1->Branch("jetse_epb", &m_jet_epb, "jetse_epb[njetse]/F"); - p_nt1->Branch("jetse_epu", &m_jet_epu, "jetse_epu[njetse]/F"); - - p_nt1->Branch("jetse_tag_pid", &m_jet_tag_pid, "jetse_tag_pid[njetse]/I"); - p_nt1->Branch("jetse_tag_mothpid", &m_jet_tag_mothpid, "jetse_tag_mothpid[njetse]/I"); - p_nt1->Branch("jetse_trackEle", &m_jet_trackEle, "jetse_trackEle[njetse][10]/I"); - p_nt1->Branch("jetse_NtrackEle", &m_jet_NtrackEle, "jetse_NtrackEle[njetse]/I"); - p_nt1->Branch("jetse_trackElept", &m_jet_trackElept, "jetse_trackElept[njetse][10]/F"); - p_nt1->Branch("jetse_Ntrack", &m_jet_Ntrack, "jetse_Ntrack[njetse]/I"); - p_nt1->Branch("jetse_sumptTrack", &m_jet_sumptTrack, "jetse_sumptTrack[njetse]/F"); - - } - } - - - if(sc.isFailure()) {}; -} - -bool JetTagAna::isBHadron(int pdg) { - int mpdg = abs(pdg); - return ( ( 500 < mpdg && mpdg < 599 ) || - ( 10500 < mpdg && mpdg < 10599 ) || - ( 5000 < mpdg && mpdg < 5999 ) || - ( 20500 < mpdg && mpdg < 20599 ) ); -} - -bool JetTagAna::isDHadron(int pdg) { - int mpdg = abs(pdg); - return ( ( 400 < mpdg && mpdg < 499 ) || - ( 10400 < mpdg && mpdg < 10499 ) || - ( 4000 < mpdg && mpdg < 4999 ) || - ( 20400 < mpdg && mpdg < 20499 ) ); -} - -bool JetTagAna::isLightJetIsolated(const CLHEP::HepLorentzVector& p) { - if(0==m_mcpartTES) return false; - TruthParticleContainer::const_iterator mcItr = (*m_mcpartTES).begin(); - TruthParticleContainer::const_iterator mcEnd = (*m_mcpartTES).end(); - bool isol = true; - for (; mcItr != mcEnd; ++mcItr) { - if( p.deltaR( (*mcItr)->hlv() ) < m_purificationDeltaR ) { - int mpdg = abs( (*mcItr)->pdgId() ); - if( this->isBHadron(mpdg) || - this->isDHadron(mpdg) || - 5==mpdg || - 4==mpdg || - 15==mpdg ) { - isol = false; - break; - } - } - } - return isol; -} - -bool JetTagAna::isJetFarFromHPTLepton(const Jet* jet) { - const Analysis::SoftLeptonTruthInfo* sltinfo = jet->tagInfo<Analysis::SoftLeptonTruthInfo>("SoftLeptonTruthInfo"); - if (sltinfo) { - int nslt = sltinfo->numSLTrueInfo(); - ATH_MSG_VERBOSE ( "SoftLeptonTruthInfo exists. Found " << nslt << " true leptons in jet" ); - for (int islt = 0; islt < nslt; islt++) { - const Analysis::SLTrueInfo slt = sltinfo->getSLTrueInfo(islt); - ATH_MSG_VERBOSE ( "SLT info " << slt.pdgId() - << " " << slt.momentum().perp() - << " " << slt.FromB() << " " << slt.FromD() << " " << slt.FromGH() - ); - if ( (abs(slt.pdgId()) == 13 || abs(slt.pdgId()) == 11 || abs(slt.pdgId()) == 15 ) && // Electron Or Muon from direct decay of W/Z/H - !(slt.FromB()) && - !(slt.FromD()) && - (abs(slt.pdgIdMother())<100) && // not from light hadron decay-in-flight - slt.FromGH() - ) - { - auto eigenv = AmgVector(3) { jet->hlv().x(), jet->hlv().y(), jet->hlv().z() }; - - if( slt.momentum().deltaR( eigenv ) < m_leptonPurificationDeltaR ) { - return false; - } - } - } - } - else { - ATH_MSG_DEBUG("Could not find SoftLeptonTruthInfo: no lepton purification can be done." ); - } - return true; -} - -// ========================================================= -double JetTagAna::getTotWeight(double epro,double ppro) -{ - double totalpro; - - if ( ppro > 0. ) - totalpro = epro/ppro; - else if (epro > 0. ) // epro > 0 ppro == 0 - totalpro = 1.0e20; - else // both == 0 - totalpro = 0.; - - // calculate log (safely) - if ( totalpro <= 1.0e-18 ) { - totalpro = -39.99; - } else { - totalpro = log(totalpro); - } - - return totalpro; -} - -// =============================================== -const HepMC::GenParticle* JetTagAna::getTruth(const Rec::TrackParticle* myTrackParticle, - const TrackParticleTruthCollection* mcpartTES, - const Rec::TrackParticleContainer* trackTES) -{ - //this method returns pointer to truth particle linked to given track - - const HepMC::GenParticle* GenPart =0; - - ElementLink<Rec::TrackParticleContainer> trackPrtlink; - trackPrtlink.setElement(const_cast<Rec::TrackParticle*>(myTrackParticle)); - trackPrtlink.setStorableObject(*trackTES); - //typedef std::map<ElementLink<Rec::TrackParticleContainer>,TrackParticleTruth> truthMap; - - std::map<Rec::TrackParticleTruthKey,TrackParticleTruth>::const_iterator tempTrackPrtTruthItr = mcpartTES->find(trackPrtlink); - - //truthMap::const_iterator tempTrackPrtTruthItr; - //tempTrackPrtTruthItr = mcpartTES->find(trackPrtlink); - if (tempTrackPrtTruthItr != mcpartTES->end()) - { - const HepMcParticleLink & temHepMcLink = - (*tempTrackPrtTruthItr).second.particleLink(); - long theBarcode=temHepMcLink.barcode(); - if (theBarcode!=0) GenPart = temHepMcLink.cptr(); - } - - - return GenPart; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h deleted file mode 100644 index d0b20006ddc788ddbd194099f2b02229053e59e7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/JetTagAna.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISEXAMPLES_JETTAGANA_H -#define ANALYSISEXAMPLES_JETTAGANA_H - -/** @class JetTagAna is an example algorithm which shows how to access the - b-tagging information from JetTag objects. - @author Laurent Vacavant <vacavant@in2p3.fr> - Created: 2005/10/11 - */ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "CLHEP/Vector/LorentzVector.h" -#include <string> -#include <map> -#include <vector> -#include <sys/types.h> -#include <TH1.h> -#include <TH2.h> -#include "GaudiKernel/ITHistSvc.h" - -#include "JetEvent/JetTagInfoBase.h" -#include "ParticleTruth/TrackParticleTruth.h" -#include "ParticleTruth/TrackParticleTruthCollection.h" -#include "AtlasHepMC/GenParticle.h" -#include "CLHEP/Vector/ThreeVector.h" -#include "HepPDT/ParticleDataTable.hh" -#include "egammaEvent/ElectronContainer.h" -#include "egammaEvent/Electron.h" -#include "egammaEvent/ElectronAssociation.h" - -//namespace Analysis { class JetTagInfoBase; } -namespace Rec { class TrackParticleContainer; } -namespace Analysis { class MuonContainer; } -class TruthParticleContainer; -class ITHistSvc; -class TH1F; -class Jet; - -static const int MAX_numTaggers = 28; -static const int MAX_numHLTTaggers = 13; - -class JetTagAna : public AthAlgorithm { - - public: - - JetTagAna(const std::string& name, ISvcLocator* pSvcLocator); - ~JetTagAna(); - - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); - - // helper methods: - void bookHistograms(); - void computeRejections(); - /** @brief check soft electron **/ - void checkSoftElectron(const std::vector<const JetTagInfoBase*> infoVector, uint iInfo, int ntotal, CLHEP::HepLorentzVector p4, int iflav, const Analysis::ElectronAssociation *ea, int ntrk_j, int nmu_j, const ElectronContainer* electronTDS, const TrackParticleTruthCollection* tpTruthColl); - /** @brief track quality for soft electrons **/ - StatusCode checkTrackqualforSET(Rec::TrackParticleContainer::const_iterator trackItr,double *pT); - void getRej(TH1F* u, TH1F* b, - double& r8 , double& e8 , double& w8, - double& r50, double& e50, double& w50, - double& r60, double& e60, double& w60 - ); - bool isBHadron(int pdg); - bool isDHadron(int pdg); - bool isLightJetIsolated(const CLHEP::HepLorentzVector& jet); - bool isJetFarFromHPTLepton(const Jet* jetItr); // to suppress influence of W/Z/H decay products - - private: - - std::string m_tagger[MAX_numTaggers]; // number of taggers. Many histograms (below) have same size - std::string m_jetET[6]; - - std::string m_particleJetContainerName; - std::string m_truthParticleContainerName; - std::string m_trackParticleContainerName; - std::string m_primaryVertexContainerName; - std::string m_mcEventContainerName; - /// name of the AOD electron container to retrieve from StoreGate - std::string m_electronContainerName; - - /// the AOD muon container to retrieve - std::string m_muonContainerName; - - int m_selectBFromRun; // use only b-jets from this run number - int m_selectUFromRun; // ditto for light jets - double m_purificationDeltaR; // light jets closer than this dR to b,c,tau are ignored - double m_leptonPurificationDeltaR; // jets closer than this dR to "high-pt" leptons are ignored - - int m_irun; - int m_ievt; - - const Rec::TrackParticleContainer* m_trackTES; - const TruthParticleContainer* m_mcpartTES; - std::vector<double> m_usedSignif; - - ITHistSvc* m_histos; /// histo service - TH1F* m_h_global_counters; - TH1F* m_h_global_nprimvtx; - TH1F* m_h_global_xprimvtx; - TH1F* m_h_global_yprimvtx; - TH1F* m_h_global_zprimvtx; - TH1F* m_h_global_primvtxresx; - TH1F* m_h_global_primvtxresy; - TH1F* m_h_global_primvtxresz; - TH1F* m_h_global_nmcpart; - TH1F* m_h_global_ntrkpart; - TH1F* m_h_global_BLayerHits; - TH1F* m_h_global_BLayerSharedHits; - TH1F* m_h_global_PixelHits; - TH1F* m_h_global_PixelLayers; - TH1F* m_h_global_SiHits; - TH1F* m_h_global_TRTHits; - TH1F* m_h_global_nmuon; - TH1F* m_h_global_nelectron; - TH1F* m_h_global_njettag; - TH1F* m_h_truth_bquark_nb; - TH1F* m_h_truth_bquark_pt; - TH1F* m_h_truth_bquark_eta; - TH1F* m_h_truth_cquark_nb; - TH1F* m_h_truth_cquark_pt; - TH1F* m_h_truth_cquark_eta; - TH1F* m_h_truth_bhadr_nb; - TH1F* m_h_truth_bhadr_pt; - TH1F* m_h_truth_bhadr_eta; - TH1F* m_h_truth_chadr_nb; - TH1F* m_h_truth_chadr_pt; - TH1F* m_h_truth_chadr_eta; - TH1F* m_h_jet_ntotal; - TH1F* m_h_jet_label; - TH1F* m_h_jet_nlabelb; - TH1F* m_h_jet_nlabelc; - TH1F* m_h_jet_nlabelt; - TH1F* m_h_jet_ntag; - TH1F* m_h_jet_eta; - TH1F* m_h_jet_phi; - TH1F* m_h_jet_et; - TH1F* m_h_jet_ntracks; - TH1F* m_h_jet_tracks_pt; - TH1F* m_h_jet_tracks_BLayerHits; - TH1F* m_h_jet_tracks_PixelHits; - TH1F* m_h_jet_tracks_SCTHits; - TH1F* m_h_jet_nmuons; - TH1F* m_h_jet_muons_pt; - TH1F* m_h_jet_nelectrons; - TH1F* m_h_jet_electrons_pt; - TH1F* m_h_tag_jetprob_w; - TH1F* m_h_tag_i2d_w; - TH1F* m_h_tag_i2d_n; - TH1F* m_h_tag_i2d_b; - TH1F* m_h_tag_i2d_u; - TH1F* m_h_tag_i2d_sig; - TH1F* m_h_tag_i3d_w; - TH1F* m_h_tag_i3d_n; - TH1F* m_h_tag_i3d_b; - TH1F* m_h_tag_i3d_u; - TH1F* m_h_tag_i3d_sig; - TH1F* m_h_tag_sv1_w; - TH1F* m_h_tag_sv1_b; - TH1F* m_h_tag_sv1_u; - TH1F* m_h_tag_sv2_w; - TH1F* m_h_tag_sv2_b; - TH1F* m_h_tag_sv2_u; - TH1F* m_h_tag_sv_n; - TH1F* m_h_tag_sv_n2t; - TH1F* m_h_tag_sv_frc; - TH1F* m_h_tag_sv_m; - TH1F* m_h_tag_cmb_w; - TH1F* m_h_tag_lf2d_w; - TH1F* m_h_tag_svbu_w; - TH1F* m_h_tag_lhsig_w; - TH1F* m_h_tag_softm_w; - TH1F* m_h_tag_softe_w; - TH1F* m_h_tag_jetfitter_w; - TH1F* m_h_tag_jetfitcomb_w; - TH1F* m_h_tag_jetfitternn_w; - TH1F* m_h_tag_jetfitcombnn_w; - //* - TH1F* m_h_tag_i2d_l2_w; - TH1F* m_h_tag_i3d_l2_w; - TH1F* m_h_tag_i2d_ef_w; - TH1F* m_h_tag_i3d_ef_w; - TH1F* m_h_tag_i2d_of_w; - TH1F* m_h_tag_i3d_of_w; - - TH1F* m_h_tag_IPinfo_ntrk[6]; - TH1F* m_h_tag_IPinfo_trkPt[6]; - TH1F* m_h_tag_IPinfo_d0val[6]; - TH1F* m_h_tag_IPinfo_z0val[6]; - TH1F* m_h_tag_IPinfo_d0sig[6]; - TH1F* m_h_tag_IPinfo_z0sig[6]; - TH1F* m_h_tag_IPinfo_weight2D[6]; - TH1F* m_h_tag_IPinfo_weight3D[6]; - TH1F* m_h_tag_IPinfo_piJP[6]; - TH1F* m_h_tag_IPinfo_fromV0[6]; - TH1F* m_h_tag_IPinfo_grade[6]; - - TH1F* m_h_perf_b[MAX_numTaggers]; - TH1F* m_h_perf_u[MAX_numTaggers]; - TH1F* m_h_perf_upur[MAX_numTaggers]; - TH1F* m_h_perf_vxeff_den_b; - TH1F* m_h_perf_vxeff_num_b; - TH1F* m_h_perf_vxeff_den_u; - TH1F* m_h_perf_vxeff_num_u; - TH1F* m_h_perf_vxeff_den_upur; - TH1F* m_h_perf_vxeff_num_upur; - TH1F* m_h_perf_rej10; - TH1F* m_h_perf_rej50; - TH1F* m_h_perf_rej60; - TH1F* m_h_perf_rejpur10; - TH1F* m_h_perf_rejpur50; - TH1F* m_h_perf_rejpur60; - - // histograms contain weights (for different taggers) for 50% and 60% eff. points - TH1F* m_h_perfWt_10; - TH1F* m_h_perfWt_50; - TH1F* m_h_perfWt_60; - TH1F* m_h_perfWt_pur10; - TH1F* m_h_perfWt_pur50; - TH1F* m_h_perfWt_pur60; - - // histograms used to calculate eff/rej as a function of ET/eta/phi - // for the various taggers. Same dimension as m_tagger[] - // - TH2F* m_h_perf_b_ET[MAX_numTaggers]; - TH2F* m_h_perf_b_eta[MAX_numTaggers]; - TH2F* m_h_perf_b_phi[MAX_numTaggers]; - - TH2F* m_h_perf_u_ET[MAX_numTaggers]; - TH2F* m_h_perf_u_eta[MAX_numTaggers]; - TH2F* m_h_perf_u_phi[MAX_numTaggers]; - - TH2F* m_h_perf_upur_ET[MAX_numTaggers]; - TH2F* m_h_perf_upur_eta[MAX_numTaggers]; - TH2F* m_h_perf_upur_phi[MAX_numTaggers]; - - TH1F* m_h_eff_b_ET[MAX_numTaggers]; - TH1F* m_h_eff_b_eta[MAX_numTaggers]; - TH1F* m_h_eff_b_phi[MAX_numTaggers]; - TH1F* m_h_rej_u_ET[MAX_numTaggers]; - TH1F* m_h_rej_u_eta[MAX_numTaggers]; - TH1F* m_h_rej_u_phi[MAX_numTaggers]; - TH1F* m_h_rej_upur_ET[MAX_numTaggers]; - TH1F* m_h_rej_upur_eta[MAX_numTaggers]; - TH1F* m_h_rej_upur_phi[MAX_numTaggers]; - - std::string m_TPTruthContainer; - // tag ntuple variables: - static const int m_maxjet = 80; - - //int m_eventNumber; - //int m_runNumber; - - // - int m_njet; - float m_jet_phi[m_maxjet]; - float m_jet_eta[m_maxjet]; - float m_jet_et[m_maxjet]; - int m_jet_flav[m_maxjet]; - int m_jet_isol[m_maxjet]; - - int m_jet_ne[m_maxjet]; - int m_jet_eTrueEle[m_maxjet],m_jet_eAnyEle[m_maxjet]; - float m_jet_eptr[m_maxjet], m_jet_ept[m_maxjet], m_jet_ea0[m_maxjet]; - float m_jet_ew[m_maxjet], m_jet_elh[m_maxjet],m_jet_epb[m_maxjet], m_jet_epu[m_maxjet]; - - int m_jet_tag_pid[m_maxjet]; - int m_jet_tag_mothpid[m_maxjet]; - int m_jet_NtrackEle[m_maxjet]; - float m_jet_trackElept[m_maxjet][10],m_jet_trackEle[m_maxjet][10]; - int m_jet_Ntrack[m_maxjet]; - float m_jet_sumptTrack[m_maxjet]; - int m_nelej[m_maxjet]; - int m_ntrackj[m_maxjet]; - int m_nmuonj[m_maxjet]; - // - TTree* p_nt1; - bool m_UseTupleSET; - - // - double getTotWeight(double,double); - const HepMC::GenParticle* getTruth(const Rec::TrackParticle* myTrackParticle,const TrackParticleTruthCollection* mcpartTES,const Rec::TrackParticleContainer* trackTES); - //const HepPDT::ParticleDataTable* m_particleTable; - -}; - -#endif // ANALYSISEXAMPLES_JETTAGANA_H - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.cxx deleted file mode 100644 index d227593bdfd3d2b2cbde1a3670890819c0060b83..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.cxx +++ /dev/null @@ -1,435 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// head file -#include "MiscellaneousExamples.h" - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" - -#include "StoreGate/StoreGateSvc.h" - -#include "Navigation/NavigationToken.h" - -/// the track object -#include "Particle/TrackParticleContainer.h" - -/// ESD objects -#include "CaloEvent/CaloClusterContainer.h" -#include "egammaEvent/egammaContainer.h" -#include "egammaEvent/ElectronContainer.h" -#include "muonEvent/MuonContainer.h" - -/// composite particles -#include "CompositeParticleEvent/CompositeParticle.h" - -/// analysis tools -#include "AnalysisUtils/AnalysisCombination.h" - -#include <algorithm> -#include <math.h> -#include <functional> - -/// declare some helper functions -bool selectJet(MiscellaneousExamples *self, const JetVect &jj); -bool selectParticle(MiscellaneousExamples *self, const ParticleVect &jj); - -/// some user defined constants -static const double mW = 80.4*CLHEP::GeV; -//static const double topMass = 175.0*CLHEP::GeV; - -using namespace Analysis; - -////////////////////////////////////////////////////////////////////////////////////// -/// Constructor - -MiscellaneousExamples::MiscellaneousExamples(const std::string& name, - ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_analysisTools( "AnalysisTools", this ), - m_thistSvc(nullptr), - m_dataType(), - m_WjjContainer(nullptr), - m_histNumberOfJets(nullptr), - m_histJetPt(nullptr), - m_histSymLinkPt(nullptr), - m_histSymLinkMjj(nullptr), - m_histJetEta(nullptr), - m_histMjj(nullptr), - m_histDataType(nullptr), - m_histSumEtCell(nullptr), - m_histElecTrackP(nullptr), - m_histElecClusterE(nullptr), - m_histCombinedMuonTrackP(nullptr), - m_histExtrapolatedMuonTrackP(nullptr), - m_histMuonSpectrometerTrackP(nullptr), - m_histInDetTrackP(nullptr), - m_histMuonEnergyLoss(nullptr) -{ - - /// switches to control the analysis through job options - declareProperty( "AnalysisTools", m_analysisTools ); - declareProperty("JetContainerName", m_jetContainerName = "JetCollection"); - declareProperty("ElectronContainerName", m_electronContainerName = "ElectronCollection"); - declareProperty("MuonContainerName", m_muonContainerName = "MuonCollection"); - declareProperty("EventWeight", m_eventWeight = 1.0); - - /// the cuts - default values - to be modified in job options - declareProperty("JetPtCut", m_jetPtCut = 20.0*CLHEP::GeV); - - /// selection for mjj - declareProperty("DeltaMjj", m_deltaMjj = 25.0*CLHEP::GeV); - -} - -///////////////////////////////////////////////////////////////////////////////////// -/// Destructor - check up memory allocation -/// delete any memory allocation on the heap - -MiscellaneousExamples::~MiscellaneousExamples() {} - -//////////////////////////////////////////////////////////////////////////////////// -/// Initialize -/// initialize StoreGate -/// get a handle on the analysis tools -/// book histograms - -StatusCode MiscellaneousExamples::initialize() { - - ATH_MSG_INFO ( "Initializing MiscellaneousExamples" ); - - ATH_CHECK( m_analysisTools.retrieve() ); - ATH_CHECK( service("THistSvc", m_thistSvc) ); - - /// reconstructed jet histograms - m_histNumberOfJets = new TH1F("NumberOfJets","N jets",20,0,20); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets/NumberOfJets", m_histNumberOfJets) ); - m_histJetPt = new TH1F("jet_pt","pt of jet",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets/jet_pt", m_histJetPt) ); - m_histJetEta = new TH1F("jet_eta","eta of jet",100,-5.0,5.0); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets", m_histJetEta) ); - m_histMjj = new TH1F("jj mass","mjj",80,0,160*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets/jj mass", m_histMjj) ); - m_histSumEtCell = new TH1F("jet_et","Sum Et Cells",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets/jet_et", m_histSumEtCell) ); - m_histSymLinkPt = new TH1F("jetSimLink_pt","pt of symLinkjet",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets/jetSimLink_pt", m_histSymLinkPt) ); - m_histSymLinkMjj = new TH1F("SimLink_Mjj","Mjj of symLinkjets",80,0,160.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/jets/SimLink_Mjj", m_histSymLinkMjj) ); - - m_histDataType = new TH1F("data type","dataType",5,0,5); - ATH_CHECK( m_thistSvc->regHist("/AANT/general/data type", m_histDataType) ); - m_histElecTrackP = new TH1F("elecTrackP","e Track Momentum",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/ectrons/elecTrackP", m_histElecTrackP) ); - m_histElecClusterE = new TH1F("elecClusterE","e Cluster Energy",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/electrons/elecClusterE", m_histElecClusterE) ); - - m_histCombinedMuonTrackP = new TH1F("CombinedTrackP","CombinedTrackP",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/muons/CombinedTrackP", m_histCombinedMuonTrackP) ); - m_histExtrapolatedMuonTrackP = new TH1F("ExtrapTrackP","ExtrapTrackP",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/muons/ExtrapTrackP", m_histExtrapolatedMuonTrackP) ); - m_histMuonSpectrometerTrackP = new TH1F("MuonSpectroTrackP","MuonSpectroTrackP",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/muons/MuonSpectroTrackP", m_histMuonSpectrometerTrackP) ); - m_histInDetTrackP = new TH1F("InDetTrackP","InDetTrackP",100,0,500.*CLHEP::GeV); - - ATH_CHECK( m_thistSvc->regHist("/AANT/muons/InDetTrackP", m_histInDetTrackP) ); - m_histMuonEnergyLoss = new TH1F("eLossCalo","eLossCalo",100,0,500.*CLHEP::GeV); - ATH_CHECK( m_thistSvc->regHist("/AANT/muons/eLossCalo", m_histMuonEnergyLoss) ); - /// create the container of W->jj - m_WjjContainer = new IParticleContainer(); - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////////////////////// -/// Finalize - delete any memory allocation from the heap - -StatusCode MiscellaneousExamples::finalize() { - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Execute - on event by event - -StatusCode MiscellaneousExamples::execute() { - - ATH_MSG_DEBUG ( "in execute()" ); - - ATH_CHECK( wjj() ); - ATH_CHECK( trackParticleAndNavigation() ); - ATH_CHECK( symLinkExample() ); - - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -/// wjj() for the reconstruction of W->jj -/// called by execute() on event by event basis - -StatusCode MiscellaneousExamples::wjj() { - - ATH_MSG_DEBUG ( "in wjj()" ); - - const JetCollection* jetTES=0; - StatusCode sc=evtStore()->retrieve( jetTES, m_jetContainerName); - if( sc.isFailure() || !jetTES ) { - ATH_MSG_WARNING ( "No AOD jet container found in TDS "<<m_jetContainerName); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG ( "JetCollection successfully retrieved " << m_jetContainerName); - - /// number of jets in the jets AOD container - m_histNumberOfJets->Fill( 1.0*jetTES->size(), m_eventWeight ); - - /// the data type - the AOD knows how it was created - /// this should be executed only once during the entire run - if (jetTES->size() > 0) { - m_dataType = (*jetTES)[0]->dataType(); - m_histDataType->Fill( 1.0*m_dataType, m_eventWeight ); - } - - /// iterators over the container - JetCollection::const_iterator jetItr = jetTES->begin(); - JetCollection::const_iterator jetItrE = jetTES->end(); - - for (; jetItr != jetItrE; ++jetItr) { - m_histJetPt->Fill( (*jetItr)->pt(), m_eventWeight); - m_histJetEta->Fill( (*jetItr)->eta(), m_eventWeight); - - /// constituent navigation - NavigationToken<CaloCell,double> cellToken; - (*jetItr)->fillToken(cellToken,double(1.)); - NavigationToken<CaloCell, double>::const_iterator c = cellToken.begin(); - NavigationToken<CaloCell,double>::const_iterator cend = cellToken.end(); - ATH_MSG_DEBUG ( "# cells found " << cellToken.size() ); - double etSum = 0; - for(; c != cend; ++c) { - const CaloCell* thisCell = *c; - double weight = cellToken.getParameter(thisCell); - double et = weight * thisCell->et(); - etSum += et; - } - m_histSumEtCell->Fill(etSum, m_eventWeight); - - } - - /// m-jj variant mass with a selection on the jet transverse momenta - AnalysisUtils::Combination<const JetCollection> combination(jetTES,2); - JetVect jetPair; - while (combination.goodOnes(this, jetPair, selectJet)) { - CLHEP::HepLorentzVector jet1_fourMomentum = jetPair[0]->hlv(); - CLHEP::HepLorentzVector jet2_fourMomentum = jetPair[1]->hlv(); - double mjj = (jet1_fourMomentum+jet2_fourMomentum).m(); - m_histMjj->Fill(mjj, m_eventWeight); - } - - ATH_MSG_DEBUG ( "wjj() succeeded" ); - - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -/// TrackParticle and Navigation -/// called by execute() on event by event basis - -StatusCode MiscellaneousExamples::trackParticleAndNavigation() { - - ATH_MSG_DEBUG ( "in trackParticleAndNavigation()" ); - - const ElectronContainer* elecTES=0; - StatusCode sc=evtStore()->retrieve( elecTES, m_electronContainerName); - if( sc.isFailure() || !elecTES ) { - ATH_MSG_WARNING ( "No AOD electron container found in TDS" ); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG ( "ElectronContainer successfully retrieved" ); - - /// iterators over the container - ElectronContainer::const_iterator elecItr = elecTES->begin(); - ElectronContainer::const_iterator elecItrE = elecTES->end(); - - for (; elecItr != elecItrE; ++elecItr) { - const Rec::TrackParticle *trackParticle = (*elecItr)->trackParticle(); - if (trackParticle != 0) { - double trackP = trackParticle->p(); - m_histElecTrackP->Fill(trackP, m_eventWeight); - } - - /// back navigation to ESD to access Electron's egamma object - const CaloCluster *cluster = (*elecItr)->cluster(); - if(cluster) { - double et = (cluster)->et(); - double eta = (cluster)->eta(); - double clusterE = et*cosh(eta); - m_histElecClusterE->Fill(clusterE, m_eventWeight); - } - } - - /// access to MuonTracks - const MuonContainer* muonTES=0; - sc=evtStore()->retrieve( muonTES, m_muonContainerName); - if( sc.isFailure() || !muonTES ) { - ATH_MSG_WARNING ( "No AOD muon container found in TDS" ); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG ( "MuonContainer successfully retrieved" ); - - /// iterators over the container - MuonContainer::const_iterator muonItr = muonTES->begin(); - MuonContainer::const_iterator muonItrE = muonTES->end(); - - for (; muonItr != muonItrE; ++muonItr) { - - /// the combined muon spectrometer/InnerDet track - if ( (*muonItr)->hasCombinedMuonTrackParticle() ) { - const Rec::TrackParticle * combinedTrack = (*muonItr)->combinedMuonTrackParticle(); - double trackP = combinedTrack->p(); - m_histCombinedMuonTrackP->Fill(trackP, m_eventWeight); - ATH_MSG_DEBUG ( "CombinedMuon TrackParticle accessed" ); - } - - /// the muon extrapolated track to the vertex - if ( (*muonItr)->hasMuonExtrapolatedTrackParticle() ) { - const Rec::TrackParticle * extrapTrack = (*muonItr)->muonExtrapolatedTrackParticle(); - double trackP = extrapTrack->p(); - m_histExtrapolatedMuonTrackP->Fill(trackP, m_eventWeight); - ATH_MSG_DEBUG ( "Extrapolated Muon TrackParticle accessed" ); - /** get the TrackParameters at the Muon Spectrometer */ - const auto& trackParametersAtSpectrometer = extrapTrack->trackParameters().front(); - //Trk::GlobalMomentum momentum = trackParametersAtSpectrometer->momentum(); - trackP = trackParametersAtSpectrometer->momentum().mag(); - m_histMuonSpectrometerTrackP->Fill(trackP, m_eventWeight); - } - - /// the InnerDet track - if ( (*muonItr)->hasInDetTrackParticle() ) { - const Rec::TrackParticle * inDetTrack = (*muonItr)->inDetTrackParticle(); - double trackP = inDetTrack->p(); - m_histInDetTrackP->Fill(trackP, m_eventWeight); - ATH_MSG_DEBUG ( "Inner Detector TrackParticle accessed" ); - } - - std::pair<double, double> eloss_error = (*muonItr)->energyLoss(); - double eLoss = eloss_error.first; - ///double error = eLoss_error.second; - m_histMuonEnergyLoss->Fill(eLoss, m_eventWeight); - ATH_MSG_DEBUG ( "Muon energy loss in Calo access" ); - } - - ATH_MSG_DEBUG ( "trackParticleAndNavigation() succeeded" ); - - return sc; -} - -template<typename InContainer, typename SymContainer> -StatusCode create_symlink(MsgStream& msg, - StoreGateSvc* sg, - const std::string& sgkey) -{ - const InContainer * in = 0; - if ( !sg->retrieve (in, sgkey).isSuccess() || - 0 == in ) { - msg << MSG::ERROR<< "Could not retrieve " << ClassName<InContainer>::name() - << " at [" << sgkey << "] !!" << endmsg; - return StatusCode::FAILURE; - } - - const SymContainer* sym = 0; - if ( sg->retrieve (sym, sgkey).isSuccess() ) { - // already symlinked... - return StatusCode::SUCCESS; - } - - if ( !sg->symLink (in, sym).isSuccess() ) { - msg << "Could not create symlink to " << ClassName<SymContainer>::name() - << endmsg; - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - - -////////////////////////////////////////////////////////////////////////////////// -/// symLink and CompositeParticle example -/// called by execute() on event by event basis - -StatusCode MiscellaneousExamples::symLinkExample() { - - ATH_MSG_DEBUG ( "in symLinkExample()" ); - - /// make sure the W ->jj container is empty - m_WjjContainer->clear(); - - // FIXME: remove when proper JetCollection impl. available. - if ( !create_symlink<JetCollection,IParticleContainer> - (msg(), &*evtStore(), m_jetContainerName).isSuccess() ) { - ATH_MSG_WARNING ( "Could not create symLink for JetCollection "); - return StatusCode::FAILURE; - } - - const IParticleContainer* iparticles = 0; - StatusCode sc=evtStore()->retrieve( iparticles, m_jetContainerName); - if( sc.isFailure() || !iparticles ) { - ATH_MSG_WARNING - ( "No AOD jet container found in TDS as symLink "<<m_jetContainerName ); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG ( "IParticleContainer successfully retrieved as symLink " << m_jetContainerName); - - /// ease handwriting: - //typedef ElementLink<IParticleContainer> IParticleLink_t; - - /// iterators over the container - IParticleContainer::const_iterator partItr = iparticles->begin(); - IParticleContainer::const_iterator partItrE = iparticles->end(); - - for (; partItr != partItrE; ++partItr) { - m_histSymLinkPt->Fill( (*partItr)->pt(), m_eventWeight); - } - - /// m-jj variant mass with a selection on the jet transverse momenta - AnalysisUtils::Combination<const IParticleContainer> combination(iparticles,2); - ParticleVect jetPair; - while (combination.goodOnes(this, jetPair, selectParticle)) { - - /// the composite particle - this snippet of code should be modified for 9.0.0 and above - /// due to a modification of the CompositeParticle class - CompositeParticle * Wjj = new CompositeParticle; - Wjj->add( INav4MomLink(&*jetPair[0], *iparticles), - INav4MomLink(&*jetPair[1], *iparticles) ); - - Wjj->set_charge(1); /// this is arbitrary :: I will assume W->lnu has charge=-1 - Wjj->set_pdgId(PDG::W_plus); /// this arbitrary :: I will assume W_minus -> lnu - Wjj->set_dataType(m_dataType); - double massW = Wjj->m(); - m_histSymLinkMjj->Fill(massW, m_eventWeight); - using std::abs; - if ( abs(massW-mW) < m_deltaMjj) m_WjjContainer->push_back(Wjj); - } - - ATH_MSG_DEBUG ( "symLinkExample() succeeded" ); - - return sc; -} - - -/// jet selection function in jet-jet combination -/// this function a friend of MiscellaneousExamples - -bool selectJet(MiscellaneousExamples *self, const JetVect &jj) { - bool test = (jj[0]->pt() > self->m_jetPtCut) && - (jj[1]->pt() > self->m_jetPtCut); - return (test); -} - -/// jet selection function in jet-jet combination -/// this function a friend of MiscellaneousExamples - -bool selectParticle(MiscellaneousExamples *self, const ParticleVect &jj) { - bool test = (jj[0]->pt() > self->m_jetPtCut) && - (jj[1]->pt() > self->m_jetPtCut); - return test; -} - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.h deleted file mode 100644 index e42b801be62ed28787d07b341705b446d06d0d8d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MISCELLANEOUS_EXAMPLES_H -#define MISCELLANEOUS_EXAMPLES_H -///////////////////////////////////////////////////////////////////////////////////////////////////// -/// Name : MiscellaneousExamples.h -/// Package : offline/PhysicsAnalysis/AnalysisCommon/AnalysisExamples -/// Author : Ketevi A. Assamagan -/// Created : November 2004 -/// -/// DESCRIPTION: -/// -/// This class contains a series of examples to show people how to: -/// - access TrackParticle, thus track information -/// - do constituent navigation -/// - do back navigation to access information from the ESD -/// - do symLink -/// - do combinatorial loops+selections -/// - to load the libraries for interactive analysis (MiscellaneousExamples_jobOptions.py) -/// -/// Ketevi A. Assamagan on November 19, 2004 -/// -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/ToolHandle.h" -#include "NavFourMom/IParticleContainer.h" -#include "ParticleEvent/ParticleBaseContainer.h" -#include "JetEvent/JetCollection.h" - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ObjectVector.h" -#include "GaudiKernel/ITHistSvc.h" -#include "CLHEP/Units/SystemOfUnits.h" - -#include "AnalysisTools/AnalysisTools.h" - -#include <string> -#include "TH1.h" -#include "TH2.h" - -typedef std::vector<const JetCollection::base_value_type*> JetVect; -typedef std::vector<const IParticleContainer::base_value_type*> ParticleVect; - -class MiscellaneousExamples : public AthAlgorithm { - - public: - - MiscellaneousExamples(const std::string& name, ISvcLocator* pSvcLocator); - ~MiscellaneousExamples(); - - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); - - private: - - /// reconstruction of W->jj as composite objects - StatusCode wjj(); - - /// TrackParticle and Navigation - StatusCode trackParticleAndNavigation(); - - /// symLink example and CompositeParticle - StatusCode symLinkExample(); - - /// the selection function is a friend of the AnalysisSketon class - friend bool selectJet(MiscellaneousExamples *self, const JetVect &jj); - friend bool selectParticle(MiscellaneousExamples *self, const ParticleVect &jj); - - /// get a handle to the tool helper - ToolHandle<AnalysisTools> m_analysisTools; - - /// a handle on the Hist/TTree registration service - ITHistSvc * m_thistSvc; - - /// the AOD jet container to retrieve - std::string m_jetContainerName; - - /// the AOD electron container to retrieve - std::string m_electronContainerName; - - /// the AOD muon container to retrieve - std::string m_muonContainerName; - - /// Event weight - double m_eventWeight; - - /// m_jj mass window cut - double m_deltaMjj; - - /// the data type, fast full siumation, test beam or real data - /// to be obtained from the AOD - ParticleDataType::DataType m_dataType; - - /// container of W->jj - IParticleContainer * m_WjjContainer; - - /// create the histograms - /// for jets - /// reconstructed quantities - TH1F* m_histNumberOfJets; - TH1F* m_histJetPt; - TH1F* m_histSymLinkPt; - TH1F* m_histSymLinkMjj; - TH1F* m_histJetEta; - TH1F* m_histMjj; - TH1F* m_histDataType; - TH1F* m_histSumEtCell; - TH1F* m_histElecTrackP; - TH1F* m_histElecClusterE; - - TH1F* m_histCombinedMuonTrackP; - TH1F* m_histExtrapolatedMuonTrackP; - TH1F* m_histMuonSpectrometerTrackP; - TH1F* m_histInDetTrackP; - TH1F* m_histMuonEnergyLoss; - - /// the cuts - to adjusted in the job options - /// jet Pt cut - double m_jetPtCut; - -}; - -#endif // MISCELLANEOUS_EXAMPPLES_H - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/PileUpTruthExample.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/PileUpTruthExample.cxx deleted file mode 100644 index ca42a2fb1bd1a9851aad879f69c48b79d297e7b4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/PileUpTruthExample.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// Author : Ketevi A. Assamagan -// Date : February 2008 - -#include "PileUpTruthExample.h" - -#include "GeneratorObjects/McEventCollection.h" - -#include "GaudiKernel/DataSvc.h" -#include "GaudiKernel/ISvcLocator.h" - -#include "TruthHelper/IsGenStable.h" -#include "TruthHelper/PileUpType.h" - -using namespace TruthHelper; - -PileUpTruthExample::PileUpTruthExample(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) -{ - declareProperty("McEventKey", m_key="TruthEvent"); -} - -PileUpTruthExample::~PileUpTruthExample() {} - -StatusCode PileUpTruthExample::initialize() -{ - return StatusCode::SUCCESS; -} - -StatusCode PileUpTruthExample::finalize() -{ - return StatusCode::SUCCESS; -} - -StatusCode PileUpTruthExample::execute() { - - const McEventCollection* mcCollptr = 0; - ATH_CHECK (evtStore()->retrieve(mcCollptr, m_key)); - - /** initialize a pileup type helper object */ - PileUpType pileupType( mcCollptr ); - - // signal - const HepMC::GenEvent * signal = pileupType.signal_mc_event(); - auto prodVtx = HepMC::signal_process_vertex(signal); - if ( prodVtx ) { - double xi = (prodVtx->position()).x(); - double yi = (prodVtx->position()).y(); - double zi = (prodVtx->position()).z(); - - ATH_MSG_INFO ("signal vertex is " << xi << " " << yi << " " << zi - << " process ID = " << HepMC::signal_process_id(signal) - << " McEvent index = " << signal->event_number()); - } - - // in-time minbias - McEventCollection::const_iterator ibeg = pileupType.in_time_minimum_bias_event_begin(); - McEventCollection::const_iterator iend = pileupType.in_time_minimum_bias_event_end(); - - for (; ibeg!=iend; ++ibeg ) { - auto prodVtx = HepMC::signal_process_vertex(*ibeg); - if ( prodVtx ) { - double xi = (prodVtx->position()).x(); - double yi = (prodVtx->position()).y(); - double zi = (prodVtx->position()).z(); - ATH_MSG_INFO ("pileup vertex is " << xi << " " << yi << " " << zi - << " process ID = " << HepMC::signal_process_id((*ibeg)) - << " McEvent index = " << (*ibeg)->event_number()); - } - } - - /** retrive the list of in-time generator stable particles - signal and in-time minimum bias - in-time meas particles in Bunch crossing = 0 */ - IsGenStable isStable; - std::vector<HepMC::ConstGenParticlePtr> particleList; - pileupType.in_time_particles( particleList, isStable ); - - /** now do something with the list */ - ATH_MSG_INFO ("Number of stable in-time pileup particles = " << particleList.size()); - - /** As another example, retrieve the in-time McEvents and print their contents - note that no selection is made in this case */ - McEventCollection::const_iterator ibegin = pileupType.in_time_event_begin(); - McEventCollection::const_iterator itend = pileupType.in_time_event_end(); - for (; ibegin != itend; ++ibegin ) { - (*ibegin)->print(); - } - return StatusCode::SUCCESS; -} - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/PileUpTruthExample.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/PileUpTruthExample.h deleted file mode 100644 index 1d4b6597e2ce5bea6bfec8afeeea0583f31809ab..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/PileUpTruthExample.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - - -//************************************************************************* -//* * -//* class PileUpTruthExample * -//* * -//* Uses PileUpType to returns iterators on the pileup type particles: -//* - the signal particles -//* - the in-time Minimum bias particles -//* - the signal+in-time Minimum bias particles -//* - the out-of-time Minimum bias particles -//* - the cavern background particles -//* - the Selector function MUST have the operator() implemented - for example: isGenStable -//* -// Author: Ketevi A. Assamagan <ketevi@bnl.gov> -// Date: February 2008 * -//************************************************************************* - -#include "AthenaBaseComps/AthAlgorithm.h" - -class PileUpTruthExample : public AthAlgorithm { -public: - PileUpTruthExample(const std::string& name, ISvcLocator* pSvcLocator); - ~PileUpTruthExample(); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - -private: - // McEventCollection key - std::string m_key; - -}; - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx deleted file mode 100644 index 75696dd6e152b6d90368311d95645a294da1013f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// ReadTruthparticles.cxx -// Implementation file for class ReadTruthparticles -// Author: S.Binet<binet@cern.ch> -// Purpose : Show how one can read the TruthParticleContainer -// and use the mother/daughter links -/////////////////////////////////////////////////////////////////// - -// STL includes -#include <algorithm> -#include <math.h> -#include <functional> - -// Framework includes -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" - -#include "StoreGate/DataHandle.h" - -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/GenParticle.h" - -#include "McParticleKernel/ITruthParticleCnvTool.h" - -#include "McParticleEvent/TruthParticle.h" -#include "McParticleEvent/TruthParticleContainer.h" - -#include "ReadTruthParticles.h" - - -////////////////////////////////////////////////////////////////////////////////////// -/// Constructor - -ReadTruthParticles::ReadTruthParticles(const std::string& name, - ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_cnvTool( ) -{ - /// switches to control the analysis through job options - - declareProperty("TruthParticles", m_truthParticlesName = "SpclMC"); - declareProperty("ConvertFromESD", m_fromESD = false ); - - declareProperty( "CnvTool", - m_cnvTool = CnvTool_t( "TruthParticleCnvTool/CnvTool", - this ), - "Handle to the tool converting a McEventCollection into a " - "TruthParticleContainer" ); -} - - - -///////////////////////////////////////////////////////////////////////////////////// -/// Destructor - check up memory allocation -/// delete any memory allocation on the heap - -ReadTruthParticles::~ReadTruthParticles() {} - -//////////////////////////////////////////////////////////////////////////////////// -/// Initialize -/// initialize StoreGate - -StatusCode ReadTruthParticles::initialize() -{ - - msg() << MSG::INFO - << "Initializing ReadTruthParticles" - << endmsg; - - // retrieve the storegate service - if ( !evtStore().retrieve().isSuccess() ) { - msg() << MSG::ERROR - << "Unable to retrieve pointer to StoreGateSvc" - << endmsg; - return StatusCode::FAILURE; - } - - // retrieve the truthparticle converter tool - if ( !m_cnvTool.retrieve().isSuccess() ) { - msg() << MSG::ERROR - << "Could not retrieve the truth particle converter tool !!" - << endmsg; - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////////////////////// -/// Finalize - delete any memory allocation from the heap - -StatusCode ReadTruthParticles::finalize() -{ - return StatusCode::SUCCESS; - -} - -////////////////////////////////////////////////////////////////////////////////// -/// Execute - on event by event - -StatusCode ReadTruthParticles::execute() -{ - ATH_MSG_DEBUG("execute()"); - - /** convert on the fly TruthEvent from the ESD to TruthParticleContainer - Ketevi */ - if ( m_fromESD ) { - if ( m_cnvTool->execute().isFailure() ) { - ATH_MSG_INFO("Could not convert the McEventCollection into " - << "a TruthParticleContainer !"); - return StatusCode::SUCCESS; - } - } - - /** Read the TruthParticleContainer. Either the one converted from ESD TruthEvent - as indicated above or the default one provided by the AOD where the conversion - is done from GEN_AOD. -Ketevi */ - const TruthParticleContainer * mcParts = 0; - if (!evtStore()->retrieve( mcParts, m_truthParticlesName ).isSuccess() || - 0 == mcParts ) { - ATH_MSG_INFO("Could not retrieve TruthParticleContainer at : " - << m_truthParticlesName); - return StatusCode::SUCCESS; - } - - unsigned int iPart = 0; - for ( TruthParticleContainer::const_iterator itr = mcParts->begin(); - itr != mcParts->end(); - ++itr, ++iPart ) { - ATH_MSG_INFO("Part " << iPart - << " PDG-ID: " << (*itr)->pdgId() - << " nChildren: " << (*itr)->nDecay() - << " status: " << (*itr)->genParticle()->status() - << " bc: " << HepMC::barcode((*itr)->genParticle())); - for ( unsigned int iChild = 0; iChild != (*itr)->nDecay(); ++iChild ){ - const TruthParticle * child = (*itr)->child( iChild ); - if ( 0 != child ) { - if (msgLvl(MSG::INFO)) { - msg(MSG::INFO) - << "\tchild: " << iChild - << "\tPDGID: " << child->pdgId() - << " status: " << child->genParticle()->status() - << " bc: " << HepMC::barcode(child->genParticle()) - << " bc Parents: " << child->nParents() << " [ "; - for ( unsigned int iMoth = 0; iMoth != child->nParents(); ++iMoth ) { - msg(MSG::INFO) << HepMC::barcode(child->genMother(iMoth)) << " "; - } - msg(MSG::INFO) << "]" << endmsg; - } - } else { - msg(MSG::WARNING) << "Wrong pointer to child !!" << endmsg; - } - }//> loop over children - }//> end loop over TruthParticles - - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.h deleted file mode 100644 index ea1ecff5738a6095db4d9e652ddd0d1b73fef5e0..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ReadTruthParticles.h +++ /dev/null @@ -1,99 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// ReadTruthParticles.h -// Header file for class ReadTruthParticles -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef ANALYSISEXAMPLES_READTRUTHPARTICLES_H -#define ANALYSISEXAMPLES_READTRUTHPARTICLES_H - -/** @class ReadTruthParticles is an example algorithm which exercises the - * TruthParticle interface. It shows how to navigate back to the - * HepMC::GenParticles and retrieve the children (in a HepMC format) as well - * as how to retrieve the (TruthParticle) children of a TruthParticle. - * The Algorithm first retrieves a container of TruthParticle, loop over its - * elements and for each of them asks for its HepMC::GenParticle creator (and - * use the GenParticle methods). - * Then, for each TruthParticle, it loops over its children in a TruthParticle - * format. - */ - -// STL includes -#include <string> - -// FrameWork includes -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -// Forward declaration -class StoreGateSvc; -class ITruthParticleCnvTool; - -class ReadTruthParticles : public AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - // Copy constructor: - - /// Constructor with parameters: - ReadTruthParticles( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~ReadTruthParticles(); - - // Assignment operator: - //ReadTruthParticles &operator=(const ReadTruthParticles &alg); - - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Protected data: - /////////////////////////////////////////////////////////////////// - protected: - - /// Default constructor: - ReadTruthParticles(); - - // Containers - - /// name of the AOD truth particle container to retrieve from Store Gate - std::string m_truthParticlesName; - - typedef ToolHandle<ITruthParticleCnvTool> CnvTool_t; - /** converter tool McEventCollection -> TruthParticle */ - CnvTool_t m_cnvTool; - - /** switch to build TruthParticles from ESD TruthEvent */ - bool m_fromESD; - -}; - -/// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - -#endif //> ANALYSISEXAMPLES_READTRUTHPARTICLES_H - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrackExample.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrackExample.cxx deleted file mode 100644 index 9ee711a23f246862d0cc53133274865017d12b88..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrackExample.cxx +++ /dev/null @@ -1,208 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: TrackExample.cxx 637956 2015-01-07 05:11:27Z ssnyder $ - -// ROOT include(s): -#include <TH1.h> - -// EDM include(s): -#include "xAODTracking/TrackParticleContainer.h" - -/// Local include(s): -#include "TrackExample.h" - -TrackExample::TrackExample( const std::string& name, - ISvcLocator* pSvcLocator) - : AthHistogramAlgorithm( name, pSvcLocator ), - m_analysisTools( "AnalysisTools", this ), - m_isolationTool( "xAOD::TrackIsolationTool/TrackIsolationTool", this ), - m_histNumberOfTrackParticles(0), - m_histQoverP(0), - m_histP(0), - m_histQ(0), - m_histEta(0), - m_histPhi(0), - m_histIsolationP(0), - m_histOriginType(0), - m_histVertexX(0), - m_histVertexY(0), - m_histVertexZ(0), - m_histd0wrtPrimVtx(0), - m_histz0wrtPrimVtx(0) -{ - - /// switches to control the analysis through job options - declareProperty( "AnalysisTools", m_analysisTools ); - declareProperty( "TrackIsolationTool", m_isolationTool ); - declareProperty( "TrackParticleContainerName", - m_trackParticleContainerName = "InDetTrackParticles" ); - declareProperty( "EventWeight", m_eventWeight = 1.0 ); - declareProperty( "TrackMomentumCut", m_trackPCut = 500.0 ); - declareProperty( "TrackIsolationCone", - m_isolationCone = xAOD::Iso::ptcone40 ); -} - -StatusCode TrackExample::initialize() { - - ATH_MSG_INFO( "Initialising - Package version: " << PACKAGE_VERSION ); - - // Retrieve the needed services: - ATH_CHECK( m_analysisTools.retrieve() ); - ATH_CHECK( m_isolationTool.retrieve() ); - - // - // Book the histograms: - // - m_histNumberOfTrackParticles = - bookGetPointer( TH1F( "nTrackParticles", "Number of TrackParticles", - 100, 0.0, 100.0 ), "TrackParticles" ); - m_histQoverP = - bookGetPointer( TH1F( "QoverP", "QoverP", 100, -1.0e-2, 1.0e-2 ), - "TrackParticles" ); - m_histP = - bookGetPointer( TH1F( "TrackP", "TrackP", 100, 0.0, 500000.0 ), - "TrackParticles" ); - m_histQ = - bookGetPointer( TH1F( "TrackQ", "TrackQ", 100, -2.0, 2.0 ), - "TrackParticles" ); - m_histEta = - bookGetPointer( TH1F( "TrackEta", "TrackEta", 100, -3.2, 3.2 ), - "TrackParticles" ); - m_histPhi = - bookGetPointer( TH1F( "TrackPhi", "TrackPhi", 100, -3.2, 3.2 ), - "TrackParticles" ); - - m_histVertexX = - bookGetPointer( TH1F( "VertexX", "VertexX", 100, -0.5, 0.5 ), - "TrackParticles" ); - m_histVertexY = - bookGetPointer( TH1F( "VertexY", "VertexY", 100, -0.5, 0.5 ), - "TrackParticles" ); - m_histVertexZ = - bookGetPointer( TH1F( "VertexZ","VertexZ", 100, -50.0, 50.0 ), - "TrackParticles" ); - - m_histd0wrtPrimVtx = - bookGetPointer( TH1F( "d0wrtPrimVtx", "d0wrtPrimVtx", 100, - -20.0, 20.0 ), "TrackParticles" ); - m_histz0wrtPrimVtx = - bookGetPointer( TH1F( "z0wrtPrimVtx", "z0wrtPrimVtx", 100, - -20.0, 20.0 ), "TrackParticles" ); - - m_histOriginType = - bookGetPointer( TH1F( "OriginType", "OriginType", 10, 0, 10 ), - "TrackParticles" ); - m_histIsolationP = - bookGetPointer( TH1F( "IsolationP", "IsolationP", 100, 0, 100000.0 ), - "TrackParticles" ); - - // Return gracefully: - return StatusCode::SUCCESS; -} - -StatusCode TrackExample::execute() { - - ATH_MSG_DEBUG( "Executing..." ); - - // Retrieve the track particles: - const xAOD::TrackParticleContainer* trackTES = 0; - if( evtStore()->retrieve( trackTES, - m_trackParticleContainerName ).isFailure() ) { - ATH_MSG_WARNING( "No TrackParticle container found in TDS" ); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG( "TrackParticleContainer successfully retrieved" ); - - /// number of TrackParticles in the container - m_histNumberOfTrackParticles->Fill( 1.0 * trackTES->size(), m_eventWeight ); - - /// iterators over the container - xAOD::TrackParticleContainer::const_iterator trackItr = trackTES->begin(); - xAOD::TrackParticleContainer::const_iterator trackItrE = trackTES->end(); - - // Loop over the container: - for( ; trackItr != trackItrE; ++trackItr ) { - - /// this TrackParticle - const xAOD::TrackParticle* trackParticle = ( *trackItr ); - - /// track momemtum and charge sign - m_histP->Fill( trackParticle->p4().P(), m_eventWeight ); - m_histEta->Fill( trackParticle->eta(), m_eventWeight ); - m_histPhi->Fill( trackParticle->phi(), m_eventWeight ); - m_histQ->Fill( trackParticle->charge(), m_eventWeight ); - m_histQoverP->Fill( trackParticle->qOverP(), m_eventWeight); - - /// track vertex position - m_histVertexX->Fill( trackParticle->vx(), m_eventWeight ); - m_histVertexY->Fill( trackParticle->vy(), m_eventWeight ); - m_histVertexZ->Fill( trackParticle->vz(), m_eventWeight ); - - m_histOriginType->Fill( 1.0 * trackParticle->particleHypothesis(), - m_eventWeight ); - - /// do track isolation - use the track isolation tools - const std::vector< xAOD::Iso::IsolationType > isoType = { - static_cast< xAOD::Iso::IsolationType >( m_isolationCone ) - }; - xAOD::TrackCorrection corrlist; - corrlist.trackbitset.set(static_cast<unsigned int>(xAOD::Iso::IsolationTrackCorrection::coreTrackPtr)); - xAOD::TrackIsolation isol; - if( ! m_isolationTool->trackIsolation( isol, *trackParticle, isoType, corrlist ) ) { - ATH_MSG_WARNING( "Unable to execute track isolation calculation" ); - isol.ptcones.push_back( 0.0 ); - } - - m_histIsolationP->Fill( isol.ptcones[ 0 ], m_eventWeight ); - ATH_MSG_DEBUG( "Track Isolation Momentum = " << isol.ptcones[ 0 ] - << " MeV" ); - - /// access to the perigee parameters - const Trk::Perigee& perigee = trackParticle->perigeeParameters(); - const auto& parameters = perigee.parameters(); - ATH_MSG_DEBUG( "Trk::Perigee parameters:" ); - ATH_MSG_DEBUG( " * d_0 : "<< parameters[ Trk::d0 ] ); - ATH_MSG_DEBUG( " * z_0 : "<< parameters[ Trk::z0 ] ); - ATH_MSG_DEBUG( " * phi : "<< parameters[ Trk::phi ] ); - ATH_MSG_DEBUG( " * Theta : "<< parameters[ Trk::theta ] ); - ATH_MSG_DEBUG( " * q/p : "<< parameters[ Trk::qOverP ] ); - - /// access to TrackSummary information - ATH_MSG_DEBUG( "Track summary information:" ); - uint8_t ival = 0; - if( trackParticle->summaryValue( ival, xAOD::numberOfInnermostPixelLayerHits ) ) { - ATH_MSG_DEBUG( " * Number of B layer hits : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfPixelHits ) ) { - ATH_MSG_DEBUG( " * Number of pixel hits : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfPixelHoles ) ) { - ATH_MSG_DEBUG( " * Number of pixel holes : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfSCTHits ) ) { - ATH_MSG_DEBUG( " * Number of SCT hits : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfSCTHoles ) ) { - ATH_MSG_DEBUG( " * Number of SCT holes : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfTRTHits ) ) { - ATH_MSG_DEBUG( " * Number of TRT hits : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, - xAOD::numberOfTRTHighThresholdHits ) ) { - ATH_MSG_DEBUG( " * Number of TRT high threshold hits : " - << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfTRTHoles ) ) { - ATH_MSG_DEBUG( " * Number of TRT holes : " << ( int ) ival ); - } - if( trackParticle->summaryValue( ival, xAOD::numberOfPrecisionLayers ) ) { - ATH_MSG_DEBUG( " * Number of MDT hits : " << ( int ) ival ); - } - } - - // Return gracefully: - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrackExample.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrackExample.h deleted file mode 100644 index 0f87a80518968ae45e917d70370bfd9de7021d41..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrackExample.h +++ /dev/null @@ -1,91 +0,0 @@ -// Dear emacs, this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: TrackExample.h 626373 2014-11-05 17:13:41Z neldik $ -#ifndef ANALYSISEXAMPLES_TRACKEXAMPLE_H -#define ANALYSISEXAMPLES_TRACKEXAMPLE_H - -// System include(s): -#include <string> - -// Gaudi/Athena include(s): -#include "AthenaBaseComps/AthHistogramAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -// Tool include(s): -#include "AnalysisTools/AnalysisTools.h" -#include "RecoToolInterfaces/ITrackIsolationTool.h" - -// Forward declaration(s): -class TH1; - -/** - * @short xAOD::TrackParticle handling example - * - * This class contains a series of examples to show people how to: - * - access a TrackParticle container from the ESD or the AOD - * - access track parameters from the TrackParticle - * - use the track isolation tools - * - * @author Ketevi A. Assamagan: February, 2005 - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 626373 $ - * $Date: 2014-11-05 18:13:41 +0100 (Wed, 05 Nov 2014) $ - */ -class TrackExample : public AthHistogramAlgorithm { - -public: - /// Regular Algorithm constructor - TrackExample( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Function initialising the algorithm - virtual StatusCode initialize(); - /// Function executing the algorithm - virtual StatusCode execute(); - -private: - /// get a handle to the tool helper - ToolHandle< AnalysisTools > m_analysisTools; - - /// the TrackParticle container to retrieve - std::string m_trackParticleContainerName; - - /// Event weight - double m_eventWeight; - - /// TrackIsolationTool - ToolHandle< xAOD::ITrackIsolationTool > m_isolationTool; - - /// @name Histograms of reconstructed quantities - /// @{ - TH1* m_histNumberOfTrackParticles; - TH1* m_histQoverP; - TH1* m_histP; - TH1* m_histQ; - TH1* m_histEta; - TH1* m_histPhi; - TH1* m_histIsolationP; - TH1* m_histOriginType; - - TH1* m_histVertexX; - TH1* m_histVertexY; - TH1* m_histVertexZ; - TH1* m_histd0wrtPrimVtx; - TH1* m_histz0wrtPrimVtx; - /// @} - - /// the cuts - to adjusted in the job options - - /// cut Pt cut - double m_trackPCut; - - /// track isolation cone - int m_isolationCone; - -}; // class TrackExample - -#endif // ANALYSISEXAMPLES_TRACKEXAMPLE_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrigAnalysisExample.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrigAnalysisExample.cxx deleted file mode 100644 index c008ae3804640767854415bf003fde1ee6c6c8f4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrigAnalysisExample.cxx +++ /dev/null @@ -1,216 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** This example is based on TrigDecisionTest by Till, Nicolas, Ricardo. - Example by Simon George. - Instructions: - 1) Set up 13.0.20 - 2) Check out PhysicsAnalysis/AnalysisCommon/UserAnalysis - https://twiki.cern.ch/twiki/bin/view/Atlas/UserAnalysis - and check you can make it and run an example so it is working - 2a) workaround for bugs: check out and build latest TrigDecision (compilation error in GetPassedFeatures and changes to configuration methods), TrigNavigation (reset problem), TrigDecisionMaker (compatability with TrigDecision), TrigSteering (to get TrigRoiDescriptor::roiWord set) - 3) Copy requirements, TrigAnalysisExample (.h and .cxx); make - 4) find an AOD file & register it: - e.g. RTT: http://atlas-project-rtt-results.web.cern.ch/atlas-project-rtt-results/rel_6/val/build/i686-slc4-gcc34-opt/offline/TrigAnalysisTest/AthenaTrigAnalysisTestIOTests/testAthenaRDOtoESDAOD/291/AOD.pool.root - or one made by hand - may be necessary, see below. - pool_insertFileToCatalog /afs/cern.ch/user/s/sgeorge/scratch1/analysis/run/AOD.pool.root - FCregisterLFN -p /afs/cern.ch/user/s/sgeorge/scratch1/analysis/run/AOD.pool.root -l myAOD.pool.root - Tip: run checkFile.py to check the contents of the AOD file. You need to know what you are looking for, especially if it is a bare class, std::vector or another container. - Need to create an AOD file with some fixes (pkgs above) w.r.t. 13.0.20: - athena -c "EvtMax=10;OutputLevel=WARNING;" TrigAnalysisTest/testAthenaRDOtoESDAOD.py - - 5) Modify AnalysisSkeleton_topOptions.py for input AOD file and: -# Trigger example algorithm -TrigAnalysisExample = Algorithm( "TrigAnalysisExample" ) -TrigAnalysisExample.OutputLevel = INFO -theApp.TopAlg += [ "TrigAnalysisExample" ] - -Reference for TrigDecisionTool: -http://atlas-computing.web.cern.ch/atlas-computing/links/nightlyDevDirectory/AtlasOffline/latest_doxygen/InstallArea/doc//TrigDecision/html/classTrigDec_1_1TrigDecisionTool.html - -Coding notes: -templated code => you will get lots of DEBUG messages about unpacking and navigating which you did not write, but appear to be from your algorithm. - -KNOWN PROBLEMS -1. LVL2 data not accessible through TrigDecision without HEAD of TrigNavigation. - -*/ - -// Gaudi/Athena include(s): -#include "AthenaKernel/errorcheck.h" - -// Trigger include(s): -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" -#include "JetEvent/JetCollection.h" -#include "AnalysisTriggerEvent/LVL1_ROI.h" -#include "AnalysisTriggerEvent/Jet_ROI.h" - -// Local include(s): -#include "TrigAnalysisExample.h" - -TrigAnalysisExample::TrigAnalysisExample( const std::string& name, - ISvcLocator* pSvcLocator ) - : AthAlgorithm( name, pSvcLocator ), - m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" ) { - - declareProperty( "TrigDecisionTool", m_trigDec ); - -} - -StatusCode TrigAnalysisExample::initialize(){ - - ATH_MSG_INFO( "in intialize()" ); - - // Retrieve the TDT: - CHECK( m_trigDec.retrieve() ); - - return StatusCode::SUCCESS; -} - - -StatusCode TrigAnalysisExample::execute() { - - ATH_MSG_INFO( "in execute()" ); - - // Example 1: Obtain overall trigger status for this event. - // Beware that there may be special low-threshold triggers that make this - // meaningless. Best to look for a specific signature. - ATH_MSG_INFO( "Pass state = " << m_trigDec->isPassed( "EF_.*" ) ); - ATH_MSG_INFO( "Pass state L1 = " << m_trigDec->isPassed( "L1_.*" ) ); - ATH_MSG_INFO( "Pass state L2 = " << m_trigDec->isPassed( "L2_.*" ) ); - ATH_MSG_INFO( "Pass state EF = " << m_trigDec->isPassed( "EF_.*" ) ); - - // Example 2: check if a specific chain passed. - std::string mychain( "EF_j40" ); - if( m_trigDec->getListOfTriggers( mychain ).empty() ){ - ATH_MSG_INFO( "Chain " << mychain << " is not defined" ); - } else { - ATH_MSG_INFO( "Chain " << mychain << " passed: " - << ( m_trigDec->isPassed( mychain ) ? "yes" : "no" ) ); - } - - /* Example 3: Advanced navigation/matching example. - - pick a chain (e.g. EF_j40) - - get TriggerElements for chain - - select active TriggerElements - - for each RoI (=TE) - - get JetCollections (EF) - - print properties of jets in collections - - get initial TrigRoiDescriptor for RoI (eta, phi, roiWord) - - loop over LVL1_ROI::std::vector<Jet_ROI> - - find Jet_ROI with matching roiWord and print properties - */ - - Trig::FeatureContainer fc = m_trigDec->features( mychain ); - - // get JetCollection. - std::vector< Trig::Feature< JetCollection > > jets = fc.get< JetCollection >(); - - if( jets.empty() ) { - ATH_MSG_INFO( "Chain " << mychain << " produced no JetCollection." ); - } else { - ATH_MSG_INFO( "Chain " << mychain << " produced " << jets.size() - << " JetCollection(s)." ); - } - - std::vector< Trig::Feature< JetCollection > >::const_iterator jet_itr = jets.begin(); - std::vector< Trig::Feature< JetCollection > >::const_iterator jet_end = jets.end(); - for( ; jet_itr != jet_end; ++jet_itr ) { - - if( jet_itr->te()->getActiveState() ) { - ATH_MSG_INFO( "For chain " << mychain << ", feature did activate the TE " - << jet_itr->label() ); - } - const JetCollection* jetcoll = *jet_itr; - if( ! jetcoll ) { - ATH_MSG_WARNING( "problem getting JetCollection" ); - continue; - } - - if( ! jetcoll->size() ) { - ATH_MSG_INFO( "JetCollection found but empty." ); - continue; - } - - ATH_MSG_INFO( "JetCollection found. Get jets." ); - JetCollection::const_iterator jet_obj_itr = jetcoll->begin(); - JetCollection::const_iterator jet_obj_end = jetcoll->end(); - for( ; jet_obj_itr != jet_obj_end; ++jet_obj_itr ) { - ATH_MSG_INFO( " jet: eta " << ( *jet_obj_itr )->eta() - << " phi " << ( *jet_obj_itr )->phi() - << " et " << ( *jet_obj_itr )->et() ); - } - } - - - // now get initial RoIDescriptor for the same TE as the jets - std::vector< Trig::Feature< TrigRoiDescriptor > > rois = - fc.get< TrigRoiDescriptor >( "initialRoI" ); - - if( ! rois.empty() ) { - - const TrigRoiDescriptor* roi = rois.front(); - ATH_MSG_INFO( "Initial TrigRoiDescriptor:" - << " eta " << roi->eta() - << " phi " << roi->phi() - << " roiWord " << roi->roiWord() - << " l1id " << roi->l1Id() - << " roiId " << roi->roiId() << " " << *roi ); - - // get LVL1 jet RoIs for comparison and to identify the one with the same roiWord. - // cache map of roiWord to LVL1_ROI in TrigDecisionTool? - const LVL1_ROI *lvl1ROI; - CHECK( evtStore()->retrieve( lvl1ROI ) ); - - LVL1_ROI::jets_type::const_iterator jet_itr = lvl1ROI->getJetROIs().begin(); - LVL1_ROI::jets_type::const_iterator jet_end = lvl1ROI->getJetROIs().end(); - for( ; jet_itr != jet_end; ++jet_itr ) { - - ATH_MSG_INFO( "Jet RoI Word: " << jet_itr->getROIWord() ); - if( roi->roiWord() == jet_itr->getROIWord() ) { - - ATH_MSG_INFO( "matching LVL1 jet: " - << " eta " << jet_itr->getEta() - << " phi " << jet_itr->getPhi() - << " pattern " << jet_itr->getThrPattern() - << " ET 4x4 " << jet_itr->getET4x4() - << " ET 6x6 " << jet_itr->getET6x6() - << " ET 8x8 " << jet_itr->getET8x8() ); - } - } - } - - - // for comparison and debug, get the JetCollections directly from SG - ATH_MSG_INFO( "get the JetCollections directly from SG for comparison" ); - const DataHandle <JetCollection> jetcoll, jetcollLast; - CHECK( evtStore()->retrieve( jetcoll, jetcollLast ) ); - - ATH_MSG_INFO( "found JetCollections" ); - for( ; jetcoll != jetcollLast; ++jetcoll ) { - - ATH_MSG_INFO( " Container " << jetcoll.key() ); - - JetCollection::const_iterator jet_itr = jetcoll->begin(); - JetCollection::const_iterator jet_end = jetcoll->end(); - for( ; jet_itr != jet_end; ++jet_itr ) { - - ATH_MSG_INFO( " jet: eta " << ( *jet_itr )->eta() << " phi " - << ( *jet_itr )->phi() << " et " - << ( *jet_itr )->et() ); - } - - } - - return StatusCode::SUCCESS; -} - - -StatusCode TrigAnalysisExample::finalize() { - - ATH_MSG_INFO( "in finalize()" ); - - return StatusCode::SUCCESS; -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrigAnalysisExample.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrigAnalysisExample.h deleted file mode 100644 index 74771641697331a7e3f530e902d26036315ab79d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/TrigAnalysisExample.h +++ /dev/null @@ -1,32 +0,0 @@ -// Dear emacs, this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: TrigAnalysisExample.h 604985 2014-07-04 15:20:52Z krasznaa $ -#ifndef TRIGANALYSISEXAMPLE_H -#define TRIGANALYSISEXAMPLE_H - -// Gaudi/Athena include(s): -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -// Trigger include(s): -#include "TrigDecisionTool/TrigDecisionTool.h" - -class TrigAnalysisExample : public AthAlgorithm { - -public: - TrigAnalysisExample( const std::string& name, ISvcLocator* pSvcLocator ); - - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - -private: - ToolHandle< Trig::TrigDecisionTool > m_trigDec; - -}; // class TrigAnalysisExample - -#endif // TRIGANALYSISEXAMPLE_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/WriteTruthParticles.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/WriteTruthParticles.cxx deleted file mode 100644 index ca654849c29eb8faeec1b6a0e886ff64d793af2b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/WriteTruthParticles.cxx +++ /dev/null @@ -1,111 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// WriteTruthParticles.cxx -// Implementation file for class WriteTruthParticles -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// - - -// STL includes - -// FrameWork includes -#include "GaudiKernel/MsgStream.h" -#include "Gaudi/Property.h" - -// McParticleKernel includes -#include "McParticleKernel/ITruthParticleCnvTool.h" - -// AnalysisExamples includes -#include "WriteTruthParticles.h" - -/////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// - -// Constructors -//////////////// -WriteTruthParticles::WriteTruthParticles( const std::string& name, - ISvcLocator* pSvcLocator ) : - AthAlgorithm( name, pSvcLocator ), - m_cnvTool( "TruthParticleCnvTool/CnvTool", this ) -{ - // - // Property declaration - // - //declareProperty( "Property", m_nProperty ); - - declareProperty( "CnvTool", - m_cnvTool, - "Handle to the tool which converts a McEventCollection into" - " a TruthParticleContainer" ); - -} - -// Destructor -/////////////// -WriteTruthParticles::~WriteTruthParticles() -{ - ATH_MSG_DEBUG ( "Calling destructor" ); -} - -// Athena Algorithm's Hooks -//////////////////////////// -StatusCode WriteTruthParticles::initialize() -{ - ATH_MSG_INFO ( "Initializing " << name() << "..." ); - - /// retrieve the converter tool - if ( !m_cnvTool.retrieve().isSuccess() ) { - ATH_MSG_ERROR ( "Could not retrieve the truth particle converter tool !!" ); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - -StatusCode WriteTruthParticles::finalize() -{ - ATH_MSG_INFO ( "Finalizing " << name() << "..." ); - return StatusCode::SUCCESS; -} - -StatusCode WriteTruthParticles::execute() -{ - ATH_MSG_DEBUG ( "Executing " << name() << "..." ); - - // create a TruthParticleContainer from a McEventCollection - if ( 0 == m_cnvTool || - !m_cnvTool->execute().isSuccess() ) { - ATH_MSG_WARNING - ( "Could not convert a McEventCollection into " - << "a TruthParticleContainer !" ); - return StatusCode::RECOVERABLE; - } - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/WriteTruthParticles.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/WriteTruthParticles.h deleted file mode 100644 index d672f4a24804213422c59e86ccc3536106f9acaf..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/WriteTruthParticles.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// WriteTruthParticles.h -// Header file for class WriteTruthParticles -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef ANALYSISEXAMPLES_WRITETRUTHPARTICLES_H -#define ANALYSISEXAMPLES_WRITETRUTHPARTICLES_H - -// STL includes -#include <string> - -// FrameWork includes -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -// Forward declaration -class ITruthParticleCnvTool; - -class WriteTruthParticles : public AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - // Copy constructor: - - /// Constructor with parameters: - WriteTruthParticles( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~WriteTruthParticles(); - - // Assignment operator: - //WriteTruthParticles &operator=(const WriteTruthParticles &alg); - - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Protected data: - /////////////////////////////////////////////////////////////////// - protected: - - /// Default constructor: - WriteTruthParticles(); - - typedef ToolHandle<ITruthParticleCnvTool> CnvTool_t; - /** Pointer to the AlgTool which will perform the conversion - * McEventCollection -> TruthParticleContainer - */ - CnvTool_t m_cnvTool; - -}; - -/// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Inline methods: -/////////////////////////////////////////////////////////////////// - -#endif //> ANALYSISEXAMPLES_WRITETRUTHPARTICLES_H diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ZeeOnESD.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ZeeOnESD.cxx deleted file mode 100644 index 1892499c1eaaa100f8258895b8333bb74f00aaa8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ZeeOnESD.cxx +++ /dev/null @@ -1,264 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" - -#include "StoreGate/DataHandle.h" - -#include "egammaEvent/Electron.h" -#include "egammaEvent/EMShower.h" -#include "egammaEvent/EMTrackMatch.h" - -#include "Particle/TrackParticle.h" - -#include "GaudiKernel/ITHistSvc.h" -#include "TTree.h" - -/// analysis tools -#include "AnalysisUtils/AnalysisCombination.h" - -/// the header file -#include "ZeeOnESD.h" - -#include <stdint.h> -#include <algorithm> -#include <math.h> -#include <functional> - -/// Declare a local helped function -bool selectEgamma(ZeeOnESD * self, const egammaPair &ll); - -using namespace Analysis; - -////////////////////////////////////////////////////////////////////////////////////// -/// Constructor - -ZeeOnESD::ZeeOnESD(const std::string& name, - ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_thistSvc(nullptr), - m_esd_egamma_pt(nullptr), - m_esd_egamma_eta(nullptr), - m_esd_egamma_overp(nullptr), - m_esd_egamma_isEM(nullptr), - m_esd_zee_mass_hist(nullptr), - m_histEgammaTrackP(nullptr), - m_histEgammaClusterE(nullptr) -{ - /// switches to control the analysis through job options :: these are the default - /// to changed in the job options - - /// The egamma ESD container name & selection cuts - declareProperty("egammaContainer", m_egammaContainerName = "egammaCollection"); - declareProperty("TrackMatchContainer", m_trkMatchContainerName="EMTrackMatchContainer"); - declareProperty("egammaEtCut", m_etEgammaCut = 20.0*CLHEP::GeV); - declareProperty("egammaEtaCut", m_etaEgammaCut = 2.5); - - } - - -///////////////////////////////////////////////////////////////////////////////////// -/// Destructor - check up memory allocation -/// delete any memory allocation on the heap - -ZeeOnESD::~ZeeOnESD() {} - -//////////////////////////////////////////////////////////////////////////////////// -/// Initialize -/// initialize StoreGate -/// get a handle on the analysis tools -/// book histograms - -StatusCode ZeeOnESD::initialize() { - - ATH_MSG_INFO("Initializing ZeeOnESD"); - - StatusCode sc = service("THistSvc", m_thistSvc); - if (sc.isFailure()) { - ATH_MSG_ERROR("Unable to retrieve pointer to THistSvc"); - return sc; - } - - /// the histograms - - /// Electron histogram booking - m_esd_egamma_pt = new TH1F("esd_egamma_pt","esd pt eg",50,0,250.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/egamma/esd_egamma_pt",m_esd_egamma_pt); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_pt registration failed"); - return sc; - } - - m_esd_egamma_eta = new TH1F("esd_egamma_eta","esd eta eg",70,-3.5,3.5); - sc = m_thistSvc->regHist("/AANT/egamma/esd_egamma_eta",m_esd_egamma_eta); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_eta registration failed"); - return sc; - } - - m_esd_egamma_overp = new TH1F("esd_egamma_eoverp","ead E/p eg",50,0,2.); - sc = m_thistSvc->regHist("/AANT/egamma/esd_egamma_eoverp",m_esd_egamma_overp); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_eoverp registration failed"); - return sc; - } - - m_esd_egamma_isEM = new TH1F("esd_egamma_isEM_bits","egamma isEM bit Pattern",20,-1.5,18.5); - sc = m_thistSvc->regHist("/AANT/egamma/esd_egamma_isEM_bits",m_esd_egamma_isEM); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_isEM registration failed"); - return sc; - } - - m_esd_zee_mass_hist = new TH1F("Mee_ESD","Mee_ESD",50,0,250.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/egamma/Mee_ESD",m_esd_zee_mass_hist); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_Mee registration failed"); - return sc; - } - - m_histEgammaTrackP = new TH1F("egammaTrackP","eg Track Momentum",100,0,500.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/egamma/esd_eta_eg",m_histEgammaTrackP); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_TrackP registration failed"); - return sc; - } - - m_histEgammaClusterE = new TH1F("egammaClusterE","eg Cluster Energy",100,0,500.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/egamma/egammaCkusterE",m_histEgammaClusterE); - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist m_esd_egamma_ClusterE registration failed"); - return sc; - } - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////////////////////// -/// Finalize - delete any memory allocation from the heap - -StatusCode ZeeOnESD::finalize() { - MsgStream mLog( msgSvc(), name() ); - - return StatusCode::SUCCESS; - -} - -////////////////////////////////////////////////////////////////////////////////// -/// Execute - called by the event loop on event by event - -StatusCode ZeeOnESD::execute() { - - MsgStream mLog( msgSvc(), name() ); - - mLog << MSG::DEBUG << "execute()" << endmsg; - - StatusCode sc = StatusCode::SUCCESS; - - /// do the Z->ee reconstruction on ESD - sc = zee_on_esd(); - if ( sc.isFailure() ) { - mLog << MSG::FATAL << "Z->ee reconstruction on ESD failed" << endmsg; - return StatusCode::FAILURE; - } - - return sc; - -} - -////////////////////////////////////////////////////////////////////////////////// -/// zee on esd: called by execute() - -StatusCode ZeeOnESD::zee_on_esd() { - - - ATH_MSG_DEBUG("zee_on_esd"); - - StatusCode sc = StatusCode::SUCCESS; - - /// read the ESD egamma container from Storegate - const ElectronContainer* egammaTES = 0; - sc=evtStore()->retrieve( egammaTES, m_egammaContainerName); - if( sc.isFailure() || !egammaTES ) { - ATH_MSG_FATAL("No ESD egamma container found in StoreGate"); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("egammaContainer successfully retrieved. Size = " << egammaTES->size()); - - /// iterators over the container - ElectronContainer::const_iterator egammaItr = egammaTES->begin(); - ElectronContainer::const_iterator egammaItrE = egammaTES->end(); - - /// loop over the ESD electron container - /// and fill the egamma pt, eta and E/P histograms - for (; egammaItr != egammaItrE; ++egammaItr) { - int bitPosition = 1; - - int isEM = (*egammaItr)->isem(); - if ( isEM == 0 ) m_esd_egamma_isEM->Fill( (isEM-1.0), 1.0); - if (isEM > 0) { - for (int i=0; i<16; ++i) { - if (isEM & bitPosition) m_esd_egamma_isEM->Fill(i, 1.0); - bitPosition *= 2; - } - } - const CaloCluster* cluster = (*egammaItr)->cluster(); - const EMTrackMatch* trkMatch = (*egammaItr)->detail<EMTrackMatch>(m_trkMatchContainerName); - ATH_MSG_DEBUG("egamma isEM/pt/trkMatch " << (*egammaItr)->isem()<<","<<cluster->pt()<<","<<trkMatch); - if((*egammaItr)->isem()%16 == 0) ATH_MSG_DEBUG("2: egamma isEM/pt/trkMatch " << (*egammaItr)->isem()<<","<<cluster->pt()<<","<<trkMatch); - - if( trkMatch && (*egammaItr)->isem()%16 == 0 && cluster){ - m_esd_egamma_pt->Fill( cluster->pt(), 1.); - m_esd_egamma_eta->Fill( cluster->eta(), 1.); - - // we need to calculate E/P ourselves - double eOp=0; - if((*egammaItr)->trackParticle() ) { - double p = ((*egammaItr)->trackParticle()->pt())*(cosh((*egammaItr)->trackParticle()->eta())); - double e = (*egammaItr)->cluster()->et()*(cosh((*egammaItr)->cluster()->eta())); - eOp = p>0. ? e/p:0.; - } - - m_esd_egamma_overp->Fill( eOp, 1.); - } - } - - /// ee invariant mass reconstruction - /// use the Analysis Utility to get combinations of 2 electrons from the AOD container - /// and the selection - /// retain the best combination - AnalysisUtils::Combination<const ElectronContainer> comb(egammaTES,2); - egammaPair egPair; - double mee = -1.0; - while (comb.goodOnes(this, egPair, selectEgamma)) { - mee = (egPair[0]->hlv()+egPair[1]->hlv()).m(); - m_esd_zee_mass_hist->Fill(mee); - } - - return StatusCode::SUCCESS; -} - - -/// this function is a friend of ZeeOnESD -/// electron selection - test for the charges - cut on pt - cut on eta -/// more sophisticated cuts such as shower shape cut should be considered -/// cut on the isEM -bool selectEgamma(ZeeOnESD * self, const egammaPair &ll) { - - bool test1 = false; - if (ll[0]->trackParticle() && ll[1]->trackParticle()) - test1 = ll[0]->trackParticle()->charge() == -(ll[1]->trackParticle()->charge()); - - bool test2 = false; - bool test3 = false; - if (ll[0]->cluster() && ll[1]->cluster()) { - test2 = (ll[0]->cluster()->et() > self->m_etEgammaCut) && - (ll[1]->cluster()->et() > self->m_etEgammaCut); - test3 = (fabs(ll[0]->cluster()->eta()) < self->m_etaEgammaCut ) && - (fabs(ll[1]->cluster()->eta()) < self->m_etaEgammaCut ); - } - bool test4 = ( (ll[0]->isem()%16)==0 && (ll[1]->isem()%16) == 0); - return (test1 && test2 && test3 && test4); -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ZeeOnESD.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ZeeOnESD.h deleted file mode 100644 index 6b8fe86da0f380b271abc727ff8d17dfb85e36f6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/ZeeOnESD.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ZEEONESD_H -#define ZEEONESD_H -///////////////////////////////////////////////////////////////////////////////////////////////////// -/// Name : ZeeOnESD.h -/// Package : offline/PhysicsAnalysis/AnalysisCommon/AnalysisExamples -/// Author : Ketevi A. Assamagan -/// Created : February 2005 -/// -/// DESCRIPTION: -/// -/// Example of Z->ee reconstruction on ESD -/// Ketevi A. Assamagan on February 20, 2005 -/// -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/Algorithm.h" -//#include "GaudiKernel/ObjectVector.h" -#include "CLHEP/Units/SystemOfUnits.h" -#include "GaudiKernel/ITHistSvc.h" -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "egammaEvent/ElectronContainer.h" - -#include <string> -#include "TH1.h" - -/// type definition -typedef std::vector<const ElectronContainer::base_value_type*> egammaPair; - -class ZeeOnESD : public AthAlgorithm { - - public: - - ZeeOnESD(const std::string& name, ISvcLocator* pSvcLocator); - ~ZeeOnESD(); - - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); - - private: - - /// the selection function for electrons - friend bool selectEgamma(ZeeOnESD *self, const egammaPair &ll); - - /// the z -> ee reconstruction method - StatusCode zee_on_esd(); - - private: - - /** a handle on the Hist/TTree registration service */ - ITHistSvc * m_thistSvc; - - /// name of the AOD electron container to retrieve from StoreGate - std::string m_egammaContainerName; - std::string m_trkMatchContainerName; - - /// use selection cuts - for electrons - /// to be modified thru job options - double m_etEgammaCut; - double m_etaEgammaCut; - - /// create the histograms - /// for electrons - /// reconstructed quantities - TH1F* m_esd_egamma_pt; - TH1F* m_esd_egamma_eta; - TH1F* m_esd_egamma_overp; - TH1F* m_esd_egamma_isEM; - TH1F* m_esd_zee_mass_hist; - TH1F* m_histEgammaTrackP; - TH1F* m_histEgammaClusterE; - -}; - -#endif // ZEEONESD_H - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx deleted file mode 100644 index cca89bfb1e563e23a795bef1030fc3f31fa51e43..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx +++ /dev/null @@ -1,23 +0,0 @@ -#include "../WriteTruthParticles.h" -#include "../ReadTruthParticles.h" -#include "../TrackExample.h" -#include "../ZeeOnESD.h" -#include "../JetTagAna.h" -#include "../MiscellaneousExamples.h" -#include "../PileUpTruthExample.h" -#include "../TrigAnalysisExample.h" -#include "../AthExReadD3pdEvtStore.h" -#include "../AthExReadD3pdNtuple.h" - - -DECLARE_COMPONENT( MiscellaneousExamples ) -DECLARE_COMPONENT( WriteTruthParticles ) -DECLARE_COMPONENT( ReadTruthParticles ) -DECLARE_COMPONENT( TrackExample ) -DECLARE_COMPONENT( ZeeOnESD ) -DECLARE_COMPONENT( JetTagAna ) -DECLARE_COMPONENT( PileUpTruthExample ) -DECLARE_COMPONENT( TrigAnalysisExample ) -DECLARE_COMPONENT( AthEx::ReadD3pdNtuple ) -DECLARE_COMPONENT( AthEx::ReadD3pdEvtStore ) - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/CMakeLists.txt deleted file mode 100644 index 586cc7f5d367f31eda0a6afc59639c710335670d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# Package: SpecialUtils -################################################################################ - -# Declare the package name: -atlas_subdir( SpecialUtils ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - PhysicsAnalysis/AnalysisCommon/ParticleEvent - Reconstruction/Jet/JetEvent - Reconstruction/MuonIdentification/muonEvent - Reconstruction/egamma/egammaEvent - Reconstruction/tauEvent ) - -# External dependencies: -find_package( CLHEP ) - -# Install files from the package: -atlas_install_headers( SpecialUtils ) - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/ElectronTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/ElectronTypeDefs.h deleted file mode 100755 index 9484c2b1236ee265980757bf8338d91b66c07fcc..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/ElectronTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ELECTRON_TYPE_DEFS_H -#define ELECTRON_TYPE_DEFS_H - -#include "egammaEvent/ElectronContainer.h" - -typedef std::vector<const ElectronContainer::base_value_type*> ElectronVect; - -typedef std::vector<ElectronContainer::base_value_type*> ListOfElectrons; - -#endif /// ELECTRON_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/JetTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/JetTypeDefs.h deleted file mode 100755 index e399b6e4e7c971a6b729a123cf81e284e375b4cc..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/JetTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PARTICLEJET_TYPE_DEFS_H -#define PARTICLEJET_TYPE_DEFS_H - -#include "JetEvent/JetCollection.h" - -typedef std::vector<const JetCollection::base_value_type*> JetVect; - -typedef std::vector<JetCollection::base_value_type*> ListOfJets; - -#endif /// PARTICLEJET_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/MuonTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/MuonTypeDefs.h deleted file mode 100755 index daf3a1a349fc0ef99c0ef94707e74b9aea16e2e6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/MuonTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUON_TYPE_DEFS_H -#define MUON_TYPE_DEFS_H - -#include "muonEvent/MuonContainer.h" - -typedef std::vector<const Analysis::MuonContainer::base_value_type*> MuonVect; - -typedef std::vector<Analysis::MuonContainer::base_value_type*> ListOfMuons; - -#endif /// MUON_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoTypeDefs.h deleted file mode 100755 index 113f4cd86a7347c5dc94b76b31f652ae9d70c136..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NEUTRINO_TYPE_DEFS_H -#define NEUTRINO_TYPE_DEFS_H - -#include "ParticleEvent/NeutrinoContainer.h" - -typedef std::vector<const NeutrinoContainer::base_value_type*> NeutrinoVect; - -typedef std::vector<NeutrinoContainer::base_value_type*> ListOfNeutrinos; - -#endif /// NEUTRINO_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoUtils.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoUtils.h deleted file mode 100755 index ced88ad6296f1f0aec37cbd2ac5230f9eaed9241..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoUtils.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - Utilities for Neutrino - - @author Tadashi Maeno - */ - -#ifndef SPECIALUTILS_NEUTRINOUTILS_H -#define SPECIALUTILS_NEUTRINOUTILS_H - -namespace NeutrinoUtils { - - /** - construct neutrino 4-momontum from lepton, missing pt and the W-mass. - The neutrino mass is zero. This method returns the container of neutrino candidates. - */ - template <class LEPTON, class COLL> - bool candidatesFromWMass(LEPTON* lepton, const double pxMiss, const double pyMiss, - COLL & neutrinoContainer, bool DealWithNegative = false); - - /** - tau tau -> a+b+ptmiss utility. This method returns two neutrinos - given two particles and ptmiss. Here the constraint is that a and b are - collinear with the taus (either leptons or a TauJet. Thus 'a' carries a - fraction x_a of one tau's momentum and that tau's neutrinos carry (1-x_a) - of that tau's momentum. - */ - template <class LEPTON1, class LEPTON2, class COLL> - void neutrinosFromColinearApproximation(LEPTON1* particleA, LEPTON2* particleB, - const double pxMiss, const double pyMiss, - COLL & neutrinoContainer, - double &x_a, double &x_b); -} - -#include "SpecialUtils/NeutrinoUtils.icc" - -#endif diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoUtils.icc b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoUtils.icc deleted file mode 100755 index 2194271d557012d3a5abe94939853ce5e471e1fb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/NeutrinoUtils.icc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "ParticleEvent/Neutrino.h" -#include "CLHEP/Units/SystemOfUnits.h" - -#include <cmath> - -template <class LEPTON, class COLL> inline -bool NeutrinoUtils::candidatesFromWMass(LEPTON* lepton, const double pxMiss, const double pyMiss, - COLL & neutrinoContainer, bool DealWithNegative) -{ - // W mass - const double WMass = 80.4*CLHEP::GeV; - - // clear output - neutrinoContainer.clear(); - - // solve the quadratic equation - - double ptMiss = sqrt (pxMiss*pxMiss + pyMiss*pyMiss); - - double alpha = pow(WMass,2)+pow((pxMiss+lepton->px()),2)+pow((pyMiss+lepton->py()),2) - -pow(lepton->e(),2); - - double beta = 0.5 * ( alpha-pow(ptMiss,2)+pow(lepton->pz(),2) ); - - double gamma = -( beta*beta - ( pow(lepton->e(),2)*pow(ptMiss,2) ) ) - / ( pow(lepton->e(),2)-pow(lepton->pz(),2) ); - - double lambda = 2*beta*lepton->pz() / (pow(lepton->e(),2)-pow(lepton->pz(),2)); - - double delta = pow(lambda,2)-4*gamma; - - // if no solution - if ( delta < 0 ){ - if ( DealWithNegative ){ - delta = 0; - } - else{ - return false; - } - } - - delta = sqrt(delta); - - // instantiate Neutrino - - double pz = (lambda-delta)/2.0; - double e = sqrt(pxMiss*pxMiss+pyMiss*pyMiss+pz*pz); - - Neutrino *nu1 = new Neutrino; - nu1->set4Mom(CLHEP::HepLorentzVector(pxMiss,pyMiss,pz,e)); - - neutrinoContainer.push_back(nu1); - if ( delta == 0 ) return true; - - pz = (lambda+delta)/2.0; - e = sqrt(pxMiss*pxMiss+pyMiss*pyMiss+pz*pz); - - Neutrino *nu2 = new Neutrino; - nu2->set4Mom(CLHEP::HepLorentzVector(pxMiss,pyMiss,pz,e)); - - neutrinoContainer.push_back(nu2); - - return true; -} - - -template <class LEPTON1, class LEPTON2, class COLL> inline -void NeutrinoUtils::neutrinosFromColinearApproximation(LEPTON1* particleA, LEPTON2* particleB, - const double pxMiss, const double pyMiss, - COLL & neutrinoContainer, - double &x_a, double &x_b) -{ - // numerator - double numerator = particleA->px()*particleB->py() - particleA->py()*particleB->px(); - - // fraction - x_a = numerator/(particleB->py()*(particleA->px()+pxMiss)-particleB->px()*(particleA->py()+pyMiss)); - x_b = numerator/(particleA->px()*(particleB->py()+pyMiss)-particleA->py()*(particleB->px()+pxMiss)); - - // instantiate Neutrino - double px = (1./x_a-1.)*particleA->px(); - double py = (1./x_a-1.)*particleA->py(); - double pz = (1./x_a-1.)*particleA->pz(); - double e = sqrt(px*px+py*py+pz*pz); - - Neutrino *nu1 = new Neutrino; - nu1->set4Mom(CLHEP::HepLorentzVector(px,py,pz,e)); - - px = (1./x_b-1.)*particleB->px(); - py = (1./x_b-1.)*particleB->py(); - pz = (1./x_b-1.)*particleB->pz(); - e = sqrt(px*px+py*py+pz*pz); - - Neutrino *nu2 = new Neutrino; - nu2->set4Mom(CLHEP::HepLorentzVector(px,py,pz,e)); - - neutrinoContainer.push_back(nu1); - neutrinoContainer.push_back(nu2); -} diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/ParticleBaseTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/ParticleBaseTypeDefs.h deleted file mode 100755 index d0794f48799eee4337bc37028a936efc5e27e8ee..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/ParticleBaseTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PARTICLEBASE_TYPE_DEFS_H -#define PARTICLEBASE_TYPE_DEFS_H - -#include "ParticleEvent/ParticleBaseContainer.h" - -typedef std::vector<const ParticleBaseContainer::base_value_type*> ParticleVect; - -typedef std::vector<ParticleBaseContainer::base_value_type*> ListOfParticles; - -#endif /// PARTICLEBASE_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/PhotonTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/PhotonTypeDefs.h deleted file mode 100755 index cb63eaef043023ff3e26aa11b7f73b3967af5181..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/PhotonTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PHOTON_TYPE_DEFS_H -#define PHOTON_TYPE_DEFS_H - -#include "egammaEvent/PhotonContainer.h" - -typedef std::vector<const PhotonContainer::base_value_type*> PhotonVect; - -typedef std::vector<PhotonContainer::base_value_type*> ListOfPhotons; - -#endif /// PHOTON_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/TauJetTypeDefs.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/TauJetTypeDefs.h deleted file mode 100755 index 4a8c9ae33f708f9abcab315fbca073a33fdc24ce..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/SpecialUtils/TauJetTypeDefs.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TAUJET_TYPE_DEFS_H -#define TAUJET_TYPE_DEFS_H - -#include "tauEvent/TauJetContainer.h" - -typedef std::vector<const Analysis::TauJetContainer::base_value_type*> TauJetVect; - -typedef std::vector<Analysis::TauJetContainer::base_value_type*> ListOfTauJets; - -#endif /// TAUJET_TYPE_DEFS_H - diff --git a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/doc/packagedoc.h b/PhysicsAnalysis/AnalysisCommon/SpecialUtils/doc/packagedoc.h deleted file mode 100644 index 5d76aced634b27142849df2f86d572563667932b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/SpecialUtils/doc/packagedoc.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** -@page SpecialUtils_page SpecialUtils - -@section SpecialUtils_introductionSpecialUtils Introduction -This package contains non-general tools, i.e., tools for Neutrino. General tools should be put in AnalysisTools/Utils. - -@section SpecialUtils_packagecontentSpecialUtils Package Contents -SpecialUtils contains the following classes: - -- NeutrinoUtils : tools for Neutrino. There 2 utilities here. One where the W mass constraint is used to find -the longitudinal component of the neutrino momentum, for example in W --> e nu, assuming that the transverse -missing energy is carried away by the neutrino. Up to 2 solutions can be obtained. The other is where one uses -the collinear approximation to solve for the neutrinos in the decay X --> a + b + Missing Energy, for example Z ---> tautau -> tauJet + tauJet + Missing Energy; The constraint is that a and b are collinear with the taus -(either leptons or a TauJet. Thus, 'a' carries a fraction x_a of one tau's momentum and that tau's neutrinos -carry (1-x_a) of that tau's momentum. Both of these 2 utilities return a container of Neutrino Objects. There is -a class for the neutrino, Netrino.h, in the package PhyscisAnalysis/AnalysisCommon/ParticleEvent. - - - -*/ diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/CMakeLists.txt deleted file mode 100644 index 46bccb789c96dbdee3422fcbf71399537525f791..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -################################################################################ -# Package: UserAnalysis -################################################################################ - -# Declare the package name: -atlas_subdir( UserAnalysis ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/StoreGate - GaudiKernel - PhysicsAnalysis/AnalysisCommon/AnalysisTools - PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils - Trigger/TrigAnalysis/TrigDecisionTool - Trigger/TrigEvent/TrigCaloEvent - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigMuonEvent - Trigger/TrigEvent/TrigParticle - PRIVATE - Control/AthenaKernel - Calorimeter/CaloEvent - Event/NavFourMom - Event/xAOD/xAODEventInfo - PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent - PhysicsAnalysis/JetTagging/JetTagInfo - PhysicsAnalysis/TruthParticleID/McParticleEvent - Reconstruction/Jet/JetEvent - Reconstruction/MissingETEvent - Reconstruction/MuonIdentification/muonEvent - Reconstruction/Particle - Reconstruction/egamma/egammaEvent - Reconstruction/tauEvent - Tracking/TrkEvent/VxVertex - Trigger/TrigEvent/TrigSteeringEvent ) - -# External dependencies: -find_package( CLHEP ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) - -# tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake - -# tag ROOTSTLDictLibs was not recognized in automatic conversion in cmt2cmake - -# Component(s) in the package: -atlas_add_component( UserAnalysis - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel AthAnalysisToolsLib UserAnalysisUtilsLib TrigDecisionToolLib TrigCaloEvent TrigInDetEvent TrigMuonEvent TrigParticle AthenaKernel CaloEvent NavFourMom xAODEventInfo AnalysisTriggerEvent JetTagInfo McParticleEvent JetEvent MissingETEvent muonEvent Particle egammaEvent tauEvent VxVertex TrigSteeringEvent ) - -# Install files from the package: -atlas_install_headers( UserAnalysis ) -atlas_install_joboptions( share/*.py ) - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/AnalysisSkeleton.h b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/AnalysisSkeleton.h deleted file mode 100755 index 01922689f44b7d0452d5533cbca56df56b91351a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/AnalysisSkeleton.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSIS_SKELETON_H -#define ANALYSIS_SKELETON_H -///////////////////////////////////////////////////////////////////////////////////////////////////// -/// Name : AnalysisSkeleton.h -/// Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysis -/// Author : Ketevi A. Assamagan -/// Created : July 2004 -/// -/// DESCRIPTION: -/// -/// This class is an analysis skeleton - The user can implement his analysis here -/// This class is also used for the demonstration of the distributed analysis -/// Ketevi A. Assamagan on June 9, 2004 -/// -/// Vivek Jain - March 11, 2010 -/// This file has been extensively modified since creation. It now shows you how to access -/// trigger information. Preparation of objects, e.g., electrons, muons, jets, etc., -/// has been pushed off into the UserAnalysisUtils package -/// -/// Vivek Jain - July 13, 2011 -/// Modified to use AthAlgorithm insead of CBNT_AthenaAwareBase. - -/// The code here also does overlap removal -/// -/// Please see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhysicsAnalysisWorkBookAODAnalysisRel17#Writing_your_own_analysis_code for details relating to release 17 -/// -/// -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/ToolHandle.h" -//#include "GaudiKernel/Algorithm.h" -#include "GaudiKernel/ObjectVector.h" -#include "CLHEP/Units/SystemOfUnits.h" -#include "GaudiKernel/ITHistSvc.h" -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "AnalysisTools/AnalysisTools.h" - -#include "UserAnalysisUtils/UserAnalysisSelectionTool.h" -#include "UserAnalysisUtils/UserAnalysisPreparationTool.h" -#include "UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h" -#include "UserAnalysisUtils/UserAnalysisOverlapRemovalTool.h" - -#include "TrigDecisionTool/TrigDecisionTool.h" - -//#include "TLorentzVector.h" -//#include "CLHEP/Vector/LorentzVector.h" - - -#include <string> - -#include "TH1.h" - -class JetCollection; - -//using namespace Trig; -namespace Trig { - class ChainGroup; -} - -// upgrade to inherit from AthAlgorithm - -class AnalysisSkeleton : public AthAlgorithm { - - public: - - AnalysisSkeleton(const std::string& name, ISvcLocator* pSvcLocator); - ~AnalysisSkeleton(); - - virtual StatusCode start() override; - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - virtual StatusCode execute() override; - virtual StatusCode initEvent(); - - private: - - - /** methods called by execute() */ - - // to add event info to new ntuple (used to go by default in CollectionTree) - StatusCode addEventInfo(); - // - StatusCode electronSkeleton(); - StatusCode triggerSkeleton(); - - /** an example of pre-selection, overlap-checking and overlap removal */ - StatusCode analysisPreparation(); - - /** look at b-jet tagging information */ - StatusCode bjetInfo(); - - /** get quark flavour of jets */ - int getQuarkJetFlavour(JetCollection::const_iterator jetItr); - - /** get missing ET information */ - StatusCode getMissingET(); - - /** make plots for SUSY studies */ - StatusCode SusyStudies(); - - /** get pT of top quarks */ - StatusCode getTopQpT(int &, double&, double&); - - private: - - /** get a handle to the tool helper */ - ToolHandle<AnalysisTools> m_analysisTools; - - /** get a handle on the user tool for pre-selection and overlap removal */ - ToolHandle<UserAnalysisSelectionTool> m_analysisSelectionTool; - ToolHandle<UserAnalysisPreparationTool> m_analysisPreparationTool; - ToolHandle<UserAnalysisOverlapCheckingTool> m_analysisOverlapCheckingTool; - ToolHandle<UserAnalysisOverlapRemovalTool> m_analysisOverlapRemovalTool; - - /** tool to access the trigger decision */ - ToolHandle<Trig::TrigDecisionTool> m_trigDec; - - /** a handle on the Hist/TTree registration service */ - ITHistSvc * m_thistSvc; - - /** the key of the Electron Container to retrieve from the AOD */ - std::string m_electronContainerName; - - /** name of the AOD truth particle container to retrieve from StoreGate */ - std::string m_truthParticleContainerName; - - /** key to get missing ET information */ - std::string m_missingETObjectName; - - - /// The missing ET object - const MissingET * m_pMissing; - double m_pxMiss; - double m_pyMiss; - double m_ptMiss; - - /** additional user cuts after pre-selections */ - - double m_deltaRMatchCut; - double m_maxDeltaR; - - /** electron specific cuts */ - double m_etElecCut; - double m_elecCone; - double m_etaElecCut; - - /** bjet specific cuts */ - double m_bjetWt_ip3dsv1Cut; - double m_bjet_etaCut; - double m_bjet_etCut; - - /** missing ET cuts */ - double m_missingETCut; - - /** Atlfast data? */ - bool m_isAtlFastData; - - /** truth input? */ - bool m_doTruth; - - /** min Jet ET cut for SUSY studies */ - double m_SusyJetMinEt; - - /** Histograms */ - TH1F* m_h_elecpt; - TH1F* m_h_eleceta; - TH1F* m_h_elec_deltaRMatch; - - TH1F* m_h_jet_eta_beforeOR; - TH1F* m_h_jet_et_beforeOR; - TH1F* m_h_jet_ip3dsv1Wt_beforeOR; - TH1F* m_h_jet_label_beforeOR; - TH1F* m_h_jet_ip3dsv1Wt_bjet_beforeOR; - TH1F* m_h_jet_ip3dsv1Wt_ujet_beforeOR; - - TH1F* m_h_jet_eta_afterOR; - TH1F* m_h_jet_et_afterOR; - TH1F* m_h_jet_ip3dsv1Wt_afterOR; - TH1F* m_h_jet_label_afterOR; - TH1F* m_h_jet_ip3dsv1Wt_bjet_afterOR; - TH1F* m_h_jet_ip3dsv1Wt_ujet_afterOR; - - TH1F* m_pxMis; - TH1F* m_pyMis; - TH1F* m_ptMis; - - TH1F* m_triggerAccepts; - - /** Athena-Aware Ntuple (AAN) variables - branches of the AAN TTree */ - - // stuff for new ntuple - // The standard AANT, CollectionTree, is bare bones - TTree* m_tree_AS; - - /** Simple variables by Ketevi */ - int m_aan_size; - std::vector<double> * m_aan_eta; - std::vector<double> * m_aan_pt; - std::vector<double> * m_aan_elecetres; - - /** Variables by VJ */ - double m_aan_ptMiss; - int m_aan_njets; - int m_aan_njets_etaLT25; - int m_aan_njets_SusyETCut; - double m_aan_effmass; - double m_aan_ht; - double m_aan_maxJetET; - int m_aan_nbjets; - - std::vector<double>* m_aan_JetEta; - std::vector<double>* m_aan_JetEt; - std::vector<double>* m_aan_JetBTagWt; - - /** Look at final electrons/muons */ - int m_aan_NFinalEl; - int m_aan_NFinalMu; - - std::vector<double>* m_aan_FinalElEta; - std::vector<double>* m_aan_FinalElPt; - std::vector<double>* m_aan_FinalElEtCone20; - //std::vector<double>* m_aan_FinalElPtrat; - - std::vector<double>* m_aan_FinalMuEta; - std::vector<double>* m_aan_FinalMuPt; - std::vector<double>* m_aan_FinalMuEtCone20; - std::vector<int>* m_aan_FinalMuBestMat; - std::vector<double>* m_aan_FinalMuMatChi2; - - double m_aan_FinalLepEtSum; - double m_aan_FinalElEtSum; - double m_aan_FinalMuEtSum; - - /** number top quarks */ - - int m_aan_NumTopQ; - double m_aan_pTtop1; - double m_aan_pTtop2; - - /** trigger branches */ - float m_aan_Trig_efJet_et ; - float m_aan_Trig_efJet_eta ; - float m_aan_Trig_efJet_phi ; - float m_aan_Trig_l2Jet_et ; - float m_aan_Trig_l2Jet_eta ; - float m_aan_Trig_l2Jet_phi ; - float m_aan_Trig_l1Jet_et88; - float m_aan_Trig_l1Jet_eta ; - float m_aan_Trig_l1Jet_phi ; - - bool m_doTrigger; - std::string m_investigateChain; - std::vector<std::string> m_triggerChains; - std::map<std::string,int> m_triggersPassed; - - unsigned int m_eventNr; - const Trig::ChainGroup* m_all; - const Trig::ChainGroup* m_allL1; - const Trig::ChainGroup* m_allL2; - const Trig::ChainGroup* m_allEF; - std::vector<std::string> m_chain_names; - - unsigned int m_runNumber; - unsigned int m_eventNumber; - unsigned int m_eventTime; - unsigned int m_lumiBlock; - unsigned int m_bCID; - double m_eventWeight; - //unsigned int m_statusElement; - /* - unsigned int m_lVL1ID; - unsigned int m_lvl1TriggerType; - std::vector<unsigned int>* m_lvl1TriggerInfo; - std::vector<unsigned int>* m_lvl2TriggerInfo; - std::vector<unsigned int>* m_evtFilterInfo; - std::vector<std::string>* m_streamTagName; - std::vector<std::string>* m_streamTagType; - */ - -}; - -#endif // ANALYSIS_SKELETON_H - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/doc/packagedoc.h b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/doc/packagedoc.h deleted file mode 100644 index 5e17d49fa869bfa4043558eac27e1d85fe963333..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/doc/packagedoc.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - -@page UserAnalysis_page The User Analysis Package - - - This class is an analysis skeleton - The user can implement his analysis here - - - This class is also used for the demonstration of the distributed analysis - - - Some electron histograms are used for the distributed case. The user may -remove the histograms and the electron stuff if not needed. - - - Note: the single algorithm structure as an analysis code does not scale. For detailed -analysis examples, look in CVS: PhysicsAnalysis/AnalysisCommon/AnalysisExamples/ - - - pathena: a glue script to submit user-defined jobs to distributed analysis systems - - - FakeAppMgr.py: a fake application manager to collect job configuration without DLL loading - - - ConfigExtractor.py: This jobO extracts job configuration - - - buildJob: a generic transformation to compile user-defined sources on a remote site - - - runAthena: a generic transformation to run athena on a remote site - - - getPFN: this is used to get a physical file name (PFN) for a logical file name (LFN) - - - Client.py,FileSpec.py,JobSpec.py: they are used by pathena. Users don't have to modify them - - - For questions or comments: Ketevi A. Assamagan - ketevi@bnl.gov - -*/ diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AANSelection_AODanalysis_topOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AANSelection_AODanalysis_topOptions.py deleted file mode 100755 index 1cc9380b2b7ee731127f7aff78fc7369971f8c3b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AANSelection_AODanalysis_topOptions.py +++ /dev/null @@ -1,81 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, June 12, 2004 - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# Particle Properties -from PartPropSvc.PartPropSvcConf import PartPropSvc - -# the POOL converters -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -# The AAN input file and AAN event selection -ServiceMgr.EventSelector.InputCollections = [ "AnalysisSkeleton.aan.root" ] -ServiceMgr.EventSelector.Query="NElectrons>0 && NElectrons<3 && abs(ElectronEta[0])<2.5 && abs(ElectronEta[1])<2.5 && ElectronPt[0]>10000 && ElectronPt[1]>10000" -ServiceMgr.EventSelector.CollectionType = "ExplicitROOT" - -# Athena-Aware NTuple making Tools -CBNTAthenaAware = True -include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -# list of the algorithms to be executed at run time - -############# The properties of the AnalysisSkeleton Algorithm -from UserAnalysis.UserAnalysisConf import AnalysisSkeleton -CBNT_AthenaAware += AnalysisSkeleton() -AnalysisSkeleton = AnalysisSkeleton() -AnalysisSkeleton.ElectronContainer = "ElectronAODCollection" -AnalysisSkeleton.MCParticleContainer = "SpclMC" -AnalysisSkeleton.DeltaRMatchCut = 0.2 -AnalysisSkeleton.MaxDeltaR = 0.9999 -AnalysisSkeleton.ElectronEtCut = 10.0*GeV -AnalysisSkeleton.ElectronEtaCut = 2.5 -AnalysisSkeleton.ElectronCone = 0.9 -AnalysisSkeleton.OutputLevel = INFO - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='AnalysisSkeleton.AANSel.aan.root' OPT='RECREATE'" ] -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'AnalysisSkeleton.AANSel.aan.root ' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = DEBUG - -# Number of Events to process -theApp.EvtMax = 500 - -###################### For interactive analysis -#include ("PyAnalysisCore/InitPyAnalysisCore.py") - -###################### Detail time measurement and auditors -# Use auditors -#itheApp.AuditAlgorithms=True - -ServiceMgr.theAuditorSvc = AuditorSvc() -ServiceMgr.theAuditorSvc.Auditors += [ "ChronoAuditor"] - -ServiceMgr.AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -#StoreGateSvc = Service( "StoreGateSvc" ) -#StoreGateSvc.Dump = True -#MessageSvc.OutputLevel = DEBUG - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AODtoAOD_viaTagSelection_topOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AODtoAOD_viaTagSelection_topOptions.py deleted file mode 100755 index b3543280f77f873f21333e21e8f9a55b30342391..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AODtoAOD_viaTagSelection_topOptions.py +++ /dev/null @@ -1,33 +0,0 @@ -#################################################### -#Author - Ketevi A. Assamagan - -#DetDescrVersion="ATLAS-XXX-..." - -doHist = False -doCBNT = False -doWriteTAG = False -doWriteESD = False -doESD = False -readAOD = True -doAOD = False -doWriteAOD = True -# read the TAG as input to the job -readTAG = True - -# Number of Events -EvtMax = 2000 - -# Use the TAG that you just produce to select the events -# define also the selection criteria -PoolTAGInput = ["TAG.pool.root"] -PoolInputQuery="NLooseMuon>0 || NLooseElectron>0" - -#Create a new RDO, ESD and AOD that contain only selected events -PoolAODOutput = "AOD.TagSel.root" - -# main reconstruction job jobOptions -include ("RecExCommon/RecExCommon_topOptions.py") -####################################################### - - - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AODtoTAG_topOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AODtoTAG_topOptions.py deleted file mode 100755 index 111534d7867de2ea4a97bff6c0edafdba61bcc28..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AODtoTAG_topOptions.py +++ /dev/null @@ -1,24 +0,0 @@ -#################### -#DetDescrVersion="ATLAS-XXX-..." - -PoolAODInput=["AOD.pool.root"] -PoolTAGOutput="TAG.pool.root" - -if not 'EvtMax' in dir(): - EvtMax=10 - - -doHist=False -doCBNT=False -readAOD=True -doWriteESD=False -doWriteAOD=False -doAOD=False -doESD=False -doWriteTAG=True - - -######################## main jobOption -include ("RecExCommon/RecExCommon_topOptions.py") -############################## - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisMaster.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisMaster.py deleted file mode 100755 index c6de904544eacdb6d53131925cc9c50d87323e00..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisMaster.py +++ /dev/null @@ -1,62 +0,0 @@ -############################################################ -# AnalysisMaster.py -# These are the master job options for running your analysis -# Include your own job options as shown below ensuring you -# This is essentially the same file as in AnalysisExamples -############################################################ - -# We use "jp" to pass the input file to the userAlgs jO file defined below -# if you want to run over multiple files locally, use glob as shown below - -from AthenaCommon.AthenaCommonFlags import jobproperties as jp -#jp.AthenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d49/AOD.191045._001937.pool.root.1'] -jp.AthenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d49/data11_7TeV.00178109.physics_Muons.merge.AOD.f351_m765._lb0846-lb0851._0001.1'] - - -# to run over multiple input files -################## -#DATAPATH = '/afs/cern.ch/atlas/maxidisk/d49/' -#from glob import glob -#INPUT = glob(DATAPATH + 'AOD*.root*') -#print INPUT -#jp.AthenaCommonFlags.FilesInput = INPUT - -################## -# -from RecExConfig.RecFlags import rec - -jp.AthenaCommonFlags.EvtMax=-1 # number of event to process - -# include your algorithm job options here - -rec.UserAlgs=[ "AnalysisSkeleton_topOptions_NEW.py" ] -#rec.UserAlgs=[ "ZeeZmmOnAODExample_jobOptions_NEW.py" ] -#rec.UserAlgs=[ "ZtautauExample_jobOptions_NEW.py" ] -#rec.UserAlgs=[ "ttbarExample_jobOptions_NEW.py" ] -#rec.UserAlgs=[ "VFitZmmOnAOD_jobOptions_NEW.py" ] - -# Output log setting; this is for the framework in general -# You may over-ride this in your job options for your algorithm -rec.OutputLevel = INFO - -# Control the writing of your own n-tuple in the alg's job options -# The following line only turns off the standard CBNT made by RecExCommon. -# and has no bearing on the ntuple that you make in your user job Options file. -# -rec.doCBNT = False - -# for analysis you don't need to write out anything -rec.doWriteESD.set_Value_and_Lock(False) -rec.doWriteAOD.set_Value_and_Lock(False) -rec.doWriteTAG.set_Value_and_Lock(False) - -# to turn off perfmon - avoids writing out big ntuples -rec.doPerfMon=False - -## need these two flags to turn on lumiblockmetadatatool and output metadatastore -rec.doDPD=True -rec.doFileMetaData=True - -# main jobOption - must always be included -include ("RecExCommon/RecExCommon_topOptions.py") - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions.py deleted file mode 100755 index 0a96b4462f08a7e562120ff47a8b4362fe3be5f1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions.py +++ /dev/null @@ -1,217 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, June 12, 2004 - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ToolSvc - -from AthenaCommon.AppMgr import ServiceMgr -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# Particle Properties -from PartPropSvc.PartPropSvcConf import PartPropSvc - -# the POOL converters -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -# this line is needed for reading AOD files made with pre-14.1.X releases -# If you leave it uncommented, you can still read post-14.1.X releases - -include ("JetRec/ParticleJetCompatibility.py") - - - -# The AOD input file -#ServiceMgr.EventSelector.InputCollections = [ "dcache:AOD.pool.root.1" ] -ServiceMgr.EventSelector.InputCollections = [ "AOD.pool.root" ] -#ServiceMgr.EventSelector.InputCollections = [ "/tmp/jgoncalo/AOD.065738._00001.pool.root.1"] - -# Get the selection, overlap checking and overlap removal tools -include ( "UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisPreparationTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisOverlapCheckingTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisOverlapRemovalTool_jobOptions.py" ) - -# Athena-Aware NTuple making Tools -CBNTAthenaAware = True -include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") - -# list of the algorithms to be executed at run time -from UserAnalysis.UserAnalysisConf import AnalysisSkeleton -topSequence.CBNT_AthenaAware += AnalysisSkeleton() -AnalysisSkeleton = AnalysisSkeleton() - -############# The properties of the AnalysisSkeleton Algorithm -AnalysisSkeleton.AnalysisSelectionTool = ToolSvc.UserAnalysisSelectionTool -AnalysisSkeleton.AnalysisPreparationTool = ToolSvc.UserAnalysisPreparationTool -AnalysisSkeleton.AnalysisOverlapCheckingTool = ToolSvc.UserAnalysisOverlapCheckingTool -AnalysisSkeleton.AnalysisOverlapRemovalTool = ToolSvc.UserAnalysisOverlapRemovalTool - -IsAtlfast = False - -AnalysisSkeleton.McParticleContainer = "SpclMC" -AnalysisSkeleton.ElectronContainer = "ElectronAODCollection" -AnalysisSkeleton.MissingETObject = "MET_RefFinal" -AnalysisSkeleton.DeltaRMatchCut = 0.2 -AnalysisSkeleton.MaxDeltaR = 0.9999 -AnalysisSkeleton.ElectronEtCut = 10.0*GeV -AnalysisSkeleton.ElectronEtaCut = 2.5 -AnalysisSkeleton.ElectronCone = 0.9 -AnalysisSkeleton.bjetWt_IP3DSV1Cut = 6 -AnalysisSkeleton.bjet_etaCut = 2.5 -AnalysisSkeleton.bjet_etCut = 15.0*GeV -AnalysisSkeleton.MissingETCut = 20.0*GeV -AnalysisSkeleton.OutputLevel = INFO -AnalysisSkeleton.IsAtlFastData = IsAtlfast -AnalysisSkeleton.SusyJetMinEt = 50*GeV - -# Change the selections if necesary -# Please read jO files in UserAnalysisUtils/ for other options -# -ToolSvc.UserAnalysisSelectionTool.IsAtlfastData = IsAtlfast -#AnalysisSkeleton.AnalysisSelectionTool.ElectronIsEMFlag="Loose" -ToolSvc.UserAnalysisSelectionTool.MuonPt=6.0*GeV -ToolSvc.UserAnalysisSelectionTool.JetPt=20.0*GeV -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindowCut=False -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindowCenter=1.445 -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindow=0.075 -ToolSvc.UserAnalysisSelectionTool.OutputLevel = INFO -ToolSvc.UserAnalysisSelectionTool.egDetailContainerName="egDetailAOD" - -# configure the overlap checking tool -ToolSvc.UserAnalysisOverlapCheckingTool.OverlapDeltaR=0.2 -ToolSvc.UserAnalysisOverlapCheckingTool.OverlapDeltaRWithJets=0.3 - -# Building the containers of selected obejcts -ToolSvc.UserAnalysisPreparationTool.IsAtlfastData = IsAtlfast -ToolSvc.UserAnalysisPreparationTool.OutputLevel = INFO - -#input cntainer keys to the pre-selection tool -ToolSvc.UserAnalysisPreparationTool.InputContainerKeys = [ - "ElectronAODCollection", - "StacoMuonCollection", - "TauRecContainer", - "AntiKt4TowerJets", - "PhotonAODCollection", - "CaloCalTopoCluster", - "TrackParticleCandidate" - ] -# Output container keys after the pre-selections -ToolSvc.UserAnalysisPreparationTool.OutputContainerKeys=[ - "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - -# Use the output containers fromi the selection tool as input to the overalp removal tool -# the order matters -# in this setting, first electrons will be chosen, -# then if any muon overlaps an electron, the latter is rejected, and so on - -ToolSvc.UserAnalysisOverlapRemovalTool.InputContainerKeys=[ - "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - -# The output container keys after the overlap-removal -# Note that a container of all leptons is provided on output -# as well as a container of all final state particles -ToolSvc.UserAnalysisOverlapRemovalTool.IsAtlfastData = IsAtlfast -ToolSvc.UserAnalysisOverlapRemovalTool.OuputObjectKey = "FinalStateObjectCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputLeptonKey = "FinalStateLeptonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputPhotonKey = "FinalStatePhotonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputElectronKey = "FinalStateElectronCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputMuonKey = "FinalStateMuonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputTauJetKey = "FinalStateTauJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputCalloClusterKey = "FinalStateCaloClusterCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputTrackParticleKey = "FinalStateTrackParticleCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputJetKey = "FinalStateJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputBJetKey = "FinalStateBJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputLightJetKey = "FinalStateLightJetCollection" - -########################################## -## -## Set up the trigger part -## -########################################## - -AnalysisSkeleton.DoTrigger = True -if AnalysisSkeleton.DoTrigger: - # needed for TriggerConfigGetter (will change with 15.3.0) - from RecExConfig.RecFlags import rec - rec.readRDO=False - rec.readAOD=True - rec.doWriteAOD=False - rec.doWriteESD=False - - # To read files with trigger config stored as in-file meta-data, - from TriggerJobOpts.TriggerFlags import TriggerFlags - TriggerFlags.configurationSourceList = ['ds'] - - # set up trigger config service - from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter - cfg = TriggerConfigGetter() - - ## chains and groups for which to print trigger statistics - photons = ["L1_2EM13", "L2_2g10_mu6", "EF_2g10"] - singletaus = ["EF_tau12_loose", "EF_tau16_loose", "EF_tau16i_loose", "EF_tau20_loose", "EF_tau20i_loose", - "EF_tau29_loose", "EF_tau29i_loose", "EF_tau38_loose", "EF_tau50_loose", "EF_tau84_loose"] - twotaus = ["EF_2tau20i_loose", "EF_2tau29i_loose", "EF_2tau29i_medium"] - combinedtaus = ["EF_tau12_loose_e10_loose", "L2_tau16i_loose_2j23", "EF_tau16i_loose_2j23", "EF_tau16i_loose_EFxe40"] - AnalysisSkeleton.StatTriggerChains = photons + singletaus + twotaus + combinedtaus; - - #AnalysisSkeleton.InvestigateChain = 'L2_tau16i_loose_2j23' - - -## Done with trigger setup - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'" ] -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = INFO -ServiceMgr.MessageSvc.defaultLimit = 9999999 - -# Number of Events to process -theApp.EvtMax = -1 -#theApp.EvtMax = 5 - -###################### For interactive analysis -#include ("PyAnalysisCore/InitPyAnalysisCore.py") - -from GaudiCommonSvc.GaudiCommonSvcConf import AuditorSvc -ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -#### test MC dump ### - -#from TruthExamples.TruthExamplesConf import DumpMC -#topSequence += DumpMC() -#DumpMC.McEventKey = "GEN_AOD" - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions_AutoConfig.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions_AutoConfig.py deleted file mode 100644 index 6658798ccf1e7877afac08d56e83fb4549cf91f4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions_AutoConfig.py +++ /dev/null @@ -1,237 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, June 12, 2004 - -# Author: Vivek Jain -# CERN, January 2010 - -# This file uses AutoConfig to peek at the input file, and set Geometry tag, etc., correctly -# -########################################################################### -# here give the full path of a file that you run over locally -# if you are running on the grid, it will ignore what you set here, and do the right thing -# if you want to run over multiple files locally, use glob as shown below - -from AthenaCommon.AthenaCommonFlags import jobproperties as jp -jp.AthenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d49/AOD.191045._001937.pool.root.1'] - -#DATAPATH = '/afs/cern.ch/atlas/maxidisk/d49/' -#from glob import glob -#INPUT = glob(DATAPATH + 'AOD*.root*') -#print INPUT -#jp.AthenaCommonFlags.FilesInput = INPUT -################################################################ - -# you don't need to set Geometry tags anymore. They are read from the file itself. -from RecExConfig.RecFlags import rec - -# get MetaReader - will use it to extract info for MC/DATA -from PyUtils.MetaReaderPeeker import metadata - -# import the data types -import EventKernel.ParticleDataType - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -include ("RecExCond/RecExCommon_flags.py") -include( "RecExCond/AllDet_detDescr.py" ) -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) - -# -from AthenaCommon.AppMgr import ToolSvc - -# this line is needed for reading AOD files made with pre-14.1.X releases -# If you leave it uncommented, you can still read post-14.1.X releases - -include ("JetRec/ParticleJetCompatibility.py") - -# The input file already specified near the top of this file -ServiceMgr.EventSelector.InputCollections = jp.AthenaCommonFlags.FilesInput() - -# Get the selection, overlap checking and overlap removal tools -include ( "UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisPreparationTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisOverlapCheckingTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisOverlapRemovalTool_jobOptions.py" ) - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from UserAnalysis.UserAnalysisConf import AnalysisSkeleton -topSequence += AnalysisSkeleton() - - -############# The properties of the AnalysisSkeleton Algorithm -topSequence.AnalysisSkeleton.AnalysisSelectionTool = ToolSvc.UserAnalysisSelectionTool -topSequence.AnalysisSkeleton.AnalysisPreparationTool = ToolSvc.UserAnalysisPreparationTool -topSequence.AnalysisSkeleton.AnalysisOverlapCheckingTool = ToolSvc.UserAnalysisOverlapCheckingTool -topSequence.AnalysisSkeleton.AnalysisOverlapRemovalTool = ToolSvc.UserAnalysisOverlapRemovalTool - -IsAtlfast = False - -topSequence.AnalysisSkeleton.McParticleContainer = "SpclMC" -topSequence.AnalysisSkeleton.ElectronContainer = "ElectronAODCollection" -topSequence.AnalysisSkeleton.MissingETObject = "MET_RefFinal" -topSequence.AnalysisSkeleton.DeltaRMatchCut = 0.2 -topSequence.AnalysisSkeleton.MaxDeltaR = 0.9999 -topSequence.AnalysisSkeleton.ElectronEtCut = 10.0*GeV -topSequence.AnalysisSkeleton.ElectronEtaCut = 2.5 -topSequence.AnalysisSkeleton.ElectronCone = 0.9 -topSequence.AnalysisSkeleton.bjetWt_IP3DSV1Cut = 6 -topSequence.AnalysisSkeleton.bjet_etaCut = 2.5 -topSequence.AnalysisSkeleton.bjet_etCut = 15.0*GeV -topSequence.AnalysisSkeleton.MissingETCut = 20.0*GeV -topSequence.AnalysisSkeleton.OutputLevel = INFO -topSequence.AnalysisSkeleton.IsAtlFastData = IsAtlfast -topSequence.AnalysisSkeleton.SusyJetMinEt = 50*GeV -topSequence.AnalysisSkeleton.DoTruth = False - -if 'IS_SIMULATION' in metadata['eventTypes']: - topSequence.AnalysisSkeleton.DoTruth = True - -print AnalysisSkeleton - -# Change the selections if necesary -# Please read jO files in UserAnalysisUtils/ for other options -# -ToolSvc.UserAnalysisSelectionTool.IsAtlfastData = IsAtlfast -#ToolSvc.UserAnalysisSelectionTool.ElectronIsEMFlag="Loose" -ToolSvc.UserAnalysisSelectionTool.MuonPt=6.0*GeV -ToolSvc.UserAnalysisSelectionTool.JetPt=20.0*GeV -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindowCut=False -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindowCenter=1.445 -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindow=0.075 - -# configure the overlap checking tool -ToolSvc.UserAnalysisOverlapCheckingTool.OverlapDeltaR=0.2 -ToolSvc.UserAnalysisOverlapCheckingTool.OverlapDeltaRWithJets=0.3 - -# Building the containers of selected obejcts -ToolSvc.UserAnalysisPreparationTool.IsAtlfastData = IsAtlfast - -#input cntainer keys to the pre-selection tool -ToolSvc.UserAnalysisPreparationTool.InputContainerKeys = [ - "ElectronAODCollection", - "StacoMuonCollection", - "TauRecContainer", - "AntiKt4TowerJets", - "PhotonAODCollection", - "CaloCalTopoCluster", - "TrackParticleCandidate" - ] -# Output container keys after the pre-selections -ToolSvc.UserAnalysisPreparationTool.OutputContainerKeys=[ - "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - -# Use the output containers fromi the selection tool as input to the overalp removal tool -# the order matters -# in this setting, first electrons will be chosen, -# then if any muon overlaps an electron, the latter is rejected, and so on - -ToolSvc.UserAnalysisOverlapRemovalTool.InputContainerKeys=[ - "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - -# The output container keys after the overlap-removal -# Note that a container of all leptons is provided on output -# as well as a container of all final state particles -ToolSvc.UserAnalysisOverlapRemovalTool.IsAtlfastData = IsAtlfast -ToolSvc.UserAnalysisOverlapRemovalTool.OuputObjectKey = "FinalStateObjectCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputLeptonKey = "FinalStateLeptonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputPhotonKey = "FinalStatePhotonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputElectronKey = "FinalStateElectronCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputMuonKey = "FinalStateMuonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputTauJetKey = "FinalStateTauJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputCalloClusterKey = "FinalStateCaloClusterCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputTrackParticleKey = "FinalStateTrackParticleCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputJetKey = "FinalStateJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputBJetKey = "FinalStateBJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputLightJetKey = "FinalStateLightJetCollection" - -########################################## -## -## Set up the trigger part -## -########################################## - -topSequence.AnalysisSkeleton.DoTrigger = True -if topSequence.AnalysisSkeleton.DoTrigger: - # needed for TriggerConfigGetter (will change with 15.3.0) - from RecExConfig.RecFlags import rec - rec.readRDO=False - rec.readAOD=True - rec.doWriteAOD=False - rec.doWriteESD=False - - # To read files with trigger config stored as in-file meta-data, - from TriggerJobOpts.TriggerFlags import TriggerFlags - TriggerFlags.configurationSourceList = ['ds'] - - # set up trigger config service - from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter - cfg = TriggerConfigGetter() - - ## chains and groups for which to print trigger statistics - photons = ["L1_2EM13", "L2_2g10_mu6", "EF_2g10"] - singletaus = ["EF_tau12_loose", "EF_tau16_loose", "EF_tau16i_loose", "EF_tau20_loose", "EF_tau20i_loose", - "EF_tau29_loose", "EF_tau29i_loose", "EF_tau38_loose", "EF_tau50_loose", "EF_tau84_loose"] - twotaus = ["EF_2tau20i_loose", "EF_2tau29i_loose", "EF_2tau29i_medium"] - combinedtaus = ["EF_tau12_loose_e10_loose", "L2_tau16i_loose_2j23", "EF_tau16i_loose_2j23", "EF_tau16i_loose_EFxe40"] - topSequence.AnalysisSkeleton.StatTriggerChains = photons + singletaus + twotaus + combinedtaus; - - #topSequence.AnalysisSkeleton.InvestigateChain = 'L2_tau16i_loose_2j23' - - -## Done with trigger setup - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'" ] -from AnalysisTools.AthAnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = INFO -# print out all messages. may need to increase it -ServiceMgr.MessageSvc.defaultLimit = 9999999 - -# Number of Events to process -theApp.EvtMax = -1 -#theApp.EvtMax = 5 - -###################### For interactive analysis -#include ("PyAnalysisCore/InitPyAnalysisCore.py") - -from GaudiCommonSvc.GaudiCommonSvcConf import AuditorSvc -ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -#### test MC dump ### - -#from TruthExamples.TruthExamplesConf import DumpMC -#topSequence += DumpMC() -#DumpMC.McEventKey = "GEN_AOD" - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions_NEW.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions_NEW.py deleted file mode 100644 index b7a323d715c3d2dd3508e3152f66704e7d73a693..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions_NEW.py +++ /dev/null @@ -1,228 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, June 12, 2004 -# Author: Vivek Jain -# Oct 30, 2009 -# ------------------------------------------------------------ - -# THIS SCRIPT MUST BE RUN FROM THE ====ANALYSISMASTER.PY===== - -# i.e., put the name of this file in AnalysisMaster.py, and do, -# athena AnalysisMaster.py -# ------------------------------------------------------------ - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ToolSvc - -from AthenaCommon.AppMgr import ServiceMgr -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# this line is needed for reading AOD files made with pre-14.1.X releases -# If you leave it uncommented, you can still read post-14.1.X releases - -include ("JetRec/ParticleJetCompatibility.py") - -# Get the selection, overlap checking and overlap removal tools -include ( "UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisPreparationTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisOverlapCheckingTool_jobOptions.py" ) -include ( "UserAnalysisUtils/UserAnalysisOverlapRemovalTool_jobOptions.py" ) - -# The input file already specified near the top of this file -ServiceMgr.EventSelector.InputCollections = jp.AthenaCommonFlags.FilesInput() - - -from AthenaCommon.AlgSequence import AlgSequence, AthSequencer -topSequence = AlgSequence() - - -#====================================================================================== -# L u m i B l o c k j o b o p t i o n s -#========================================= -# add LumiBlockMetaDataTool to ToolSvc and configure -from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool -ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" ) -LumiBlockMetaDataTool.OutputLevel = INFO - -# add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc -from AthenaServices.AthenaServicesConf import MetaDataSvc -svcMgr += MetaDataSvc( "MetaDataSvc" ) -svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ] - -# Configure the goodrunslist selector tool -from GoodRunsLists.GoodRunsListsConf import * -ToolSvc += GoodRunsListSelectorTool() -GoodRunsListSelectorTool.OutputLevel = INFO -GoodRunsListSelectorTool.GoodRunsListVec = [ 'data11_7TeV.periodAllYear_DetStatus-v18-pro08-05_CoolRunQuery-00-03-98_Muon.xml' ] # <<<<--- Edit this line! -GoodRunsListSelectorTool.PassThrough = False - -## This Athena job consists of algorithms that loop over events; -## here, the (default) top sequence is used: -#job = AlgSequence() -seq = AthSequencer("AthMasterSeq") -topSequence += seq - -from GoodRunsListsUser.GoodRunsListsUserConf import * -seq += GRLTriggerSelectorAlg('GRLTriggerAlg1') -## In the next line, pick up correct name from inside xml file! -seq.GRLTriggerAlg1.GoodRunsListArray = ['Muon'] - -#====================================================================================== - - -from UserAnalysis.UserAnalysisConf import AnalysisSkeleton -topSequence += AnalysisSkeleton() - - -############# The properties of the AnalysisSkeleton Algorithm -topSequence.AnalysisSkeleton.AnalysisSelectionTool = ToolSvc.UserAnalysisSelectionTool -topSequence.AnalysisSkeleton.AnalysisPreparationTool = ToolSvc.UserAnalysisPreparationTool -topSequence.AnalysisSkeleton.AnalysisOverlapCheckingTool = ToolSvc.UserAnalysisOverlapCheckingTool -topSequence.AnalysisSkeleton.AnalysisOverlapRemovalTool = ToolSvc.UserAnalysisOverlapRemovalTool - -IsAtlfast = False - -topSequence.AnalysisSkeleton.McParticleContainer = "SpclMC" -topSequence.AnalysisSkeleton.ElectronContainer = "ElectronAODCollection" -topSequence.AnalysisSkeleton.MissingETObject = "MET_RefFinal" -topSequence.AnalysisSkeleton.DeltaRMatchCut = 0.2 -topSequence.AnalysisSkeleton.MaxDeltaR = 0.9999 -topSequence.AnalysisSkeleton.ElectronEtCut = 10.0*GeV -topSequence.AnalysisSkeleton.ElectronEtaCut = 2.5 -topSequence.AnalysisSkeleton.ElectronCone = 0.9 -topSequence.AnalysisSkeleton.bjetWt_IP3DSV1Cut = 6 -topSequence.AnalysisSkeleton.bjet_etaCut = 2.5 -topSequence.AnalysisSkeleton.bjet_etCut = 15.0*GeV -topSequence.AnalysisSkeleton.MissingETCut = 20.0*GeV -topSequence.AnalysisSkeleton.OutputLevel = INFO -topSequence.AnalysisSkeleton.IsAtlFastData = IsAtlfast -topSequence.AnalysisSkeleton.SusyJetMinEt = 50*GeV -topSequence.AnalysisSkeleton.DoTruth = False - -print AnalysisSkeleton - -# Change the selections if necesary -# Please read jO files in UserAnalysisUtils/ for other options -# -ToolSvc.UserAnalysisSelectionTool.IsAtlfastData = IsAtlfast -#topSequence.AnalysisSkeleton.AnalysisSelectionTool.ElectronIsEMFlag="Loose" -ToolSvc.UserAnalysisSelectionTool.MuonPt=6.0*GeV -ToolSvc.UserAnalysisSelectionTool.JetPt=20.0*GeV -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindowCut=False -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindowCenter=1.445 -ToolSvc.UserAnalysisSelectionTool.ElectronEtaWindow=0.075 - -# configure the overlap checking tool -ToolSvc.UserAnalysisOverlapCheckingTool.OverlapDeltaR=0.2 -ToolSvc.UserAnalysisOverlapCheckingTool.OverlapDeltaRWithJets=0.3 - -# Building the containers of selected obejcts -ToolSvc.UserAnalysisPreparationTool.IsAtlfastData = IsAtlfast - -#input cntainer keys to the pre-selection tool -ToolSvc.UserAnalysisPreparationTool.InputContainerKeys = [ - "ElectronAODCollection", - "StacoMuonCollection", - "TauRecContainer", - "AntiKt4TowerJets", - "PhotonAODCollection", - "CaloCalTopoCluster", - "TrackParticleCandidate" - ] -# Output container keys after the pre-selections -ToolSvc.UserAnalysisPreparationTool.OutputContainerKeys=[ - "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - -# Use the output containers fromi the selection tool as input to the overalp removal tool -# the order matters -# in this setting, first electrons will be chosen, -# then if any muon overlaps an electron, the latter is rejected, and so on - -ToolSvc.UserAnalysisOverlapRemovalTool.InputContainerKeys=[ - "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - -# The output container keys after the overlap-removal -# Note that a container of all leptons is provided on output -# as well as a container of all final state particles -ToolSvc.UserAnalysisOverlapRemovalTool.IsAtlfastData = IsAtlfast -ToolSvc.UserAnalysisOverlapRemovalTool.OuputObjectKey = "FinalStateObjectCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputLeptonKey = "FinalStateLeptonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputPhotonKey = "FinalStatePhotonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputElectronKey = "FinalStateElectronCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputMuonKey = "FinalStateMuonCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputTauJetKey = "FinalStateTauJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputCalloClusterKey = "FinalStateCaloClusterCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputTrackParticleKey = "FinalStateTrackParticleCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputJetKey = "FinalStateJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputBJetKey = "FinalStateBJetCollection" -ToolSvc.UserAnalysisOverlapRemovalTool.OutputLightJetKey = "FinalStateLightJetCollection" - -########################################## -## -## Set up the trigger part -## -########################################## - -topSequence.AnalysisSkeleton.DoTrigger = True -if topSequence.AnalysisSkeleton.DoTrigger: - - # set up trigger config service - from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter - cfg = TriggerConfigGetter() - - ## chains and groups for which to print trigger statistics - photons = ["L1_2EM13", "L2_2g10_mu6", "EF_2g10"] - singletaus = ["EF_tau12_loose", "EF_tau16_loose", "EF_tau16i_loose", "EF_tau20_loose", "EF_tau20i_loose", - "EF_tau29_loose", "EF_tau29i_loose", "EF_tau38_loose", "EF_tau50_loose", "EF_tau84_loose"] - twotaus = ["EF_2tau20i_loose", "EF_2tau29i_loose", "EF_2tau29i_medium"] - combinedtaus = ["EF_tau12_loose_e10_loose", "L2_tau16i_loose_2j23", "EF_tau16i_loose_2j23", "EF_tau16i_loose_EFxe40"] - topSequence.AnalysisSkeleton.StatTriggerChains = photons + singletaus + twotaus + combinedtaus; - - #topSequence.AnalysisSkeleton.InvestigateChain = 'L2_tau16i_loose_2j23' - - -## Done with trigger setup - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'" ] -from AnalysisTools.AthAnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - - -###################### For interactive analysis -#include ("PyAnalysisCore/InitPyAnalysisCore.py") - -from GaudiCommonSvc.GaudiCommonSvcConf import AuditorSvc -ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -#### test MC dump ### - -#from TruthExamples.TruthExamplesConf import DumpMC -#topSequence += DumpMC() -#DumpMC.McEventKey = "GEN_AOD" diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/README.TXT b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/README.TXT deleted file mode 100644 index d71dd7a5e00d5a37ffbcaf577ad243f61a91f4f9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/README.TXT +++ /dev/null @@ -1,9 +0,0 @@ -AnalysisSkeleton have three jobOptions files, e.g., - -_topOptions.py -_topOptions_AutoConfig.py -_topOptions_New.py - -Please look at https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhysicsAnalysisWorkBookAODAnalysisRel15#What_s_NEW_on_this_page for an explanation - -Also see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhysicsAnalysisWorkBookFullAODAnalysisRel15 to learn how the file with _NEW suffix is used. diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/TagSelection_AODanalysis_topOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/TagSelection_AODanalysis_topOptions.py deleted file mode 100755 index 02eed4c9035bd2d9875bde51f86c6d917e713a3a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/TagSelection_AODanalysis_topOptions.py +++ /dev/null @@ -1,83 +0,0 @@ -# Author: Ketevi A. Assamagan -# BNL, June 12, 2004 - -#get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# Particle Properties -from PartPropSvc.PartPropSvcConf import PartPropSvc - -# the POOL converters -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -# The TAG input file and TAG event selection -ServiceMgr.EventSelector.InputCollections = [ "TAG.pool.root" ] -ServiceMgr.EventSelector.Query="NLooseMuon>0 || NLooseElectron>0" -ServiceMgr.EventSelector.CollectionType = "ExplicitROOT" - -# Athena-Aware NTuple making Tools -CBNTAthenaAware = True -include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -############# The properties of the AnalysisSkeleton Algorithm -from UserAnalysis.UserAnalysisConf import AnalysisSkeleton -topSequence.CBNT_AthenaAware += AnalysisSkeleton() -AnalysisSkeleton = AnalysisSkeleton() - -AnalysisSkeleton.ElectronContainer = "ElectronAODCollection" -AnalysisSkeleton.MCParticleContainer = "SpclMC" -AnalysisSkeleton.DeltaRMatchCut = 0.2 -AnalysisSkeleton.MaxDeltaR = 0.9999 -AnalysisSkeleton.ElectronEtCut = 10.0*GeV -AnalysisSkeleton.ElectronEtaCut = 2.5 -AnalysisSkeleton.ElectronCone = 0.9 -AnalysisSkeleton.OutputLevel = INFO - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.TagSel.aan.root' OPT='RECREATE'"] -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'AnalysisSkeleton.TagSel.aan.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = ERROR - -# Number of Events to process -theApp.EvtMax = 500 - -###################### For interactive analysis -#include ("PyAnalysisCore/InitPyAnalysisCore.py") - -###################### Detail time measurement and auditors -# Use auditors -#theApp.AuditAlgorithms=True -#theApp.Dlls += [ "GaudiAud" ] - -theAuditorSvc = AuditorSvc() -theAuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -#topSequence += AthenaPoolCnvSvc() -ServiceMgr.AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -#StoreGateSvc = Service( "StoreGateSvc" ) -#StoreGateSvc.Dump = True -#MessageSvc.OutputLevel = DEBUG - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/AnalysisSkeleton.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/AnalysisSkeleton.cxx deleted file mode 100755 index 14a731e8e8cb3a83c7a78b4498b148f809580ad1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/AnalysisSkeleton.cxx +++ /dev/null @@ -1,1414 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -////////////////////////////////////////////////////////////////////////////////// -/// Analysis skeleton -/// also for distributed analysis examples -/// Author: Ketevi A. Assamagan -/// BNL, July 22, 2004 -/// -/// DESCRIPTION: -/// -/// This class is an analysis skeleton - The user can implement her analysis here -/// Ketevi A. Assamagan on June 22, 2004 -/// -/// Vivek Jain - March 11, 2010 -/// This file has been extensively modified since creation. It now shows you how to access -/// trigger information. Preparation of objects, e.g., electrons, muons, jets, etc., -/// has been pushed off into the UserAnalysisUtils package -/// -/// The code here also does overlap removal -/// -/// Please see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhysicsAnalysisWorkBookAODAnalysisRel15#Writing_your_own_analysis_code for details relating to release 15 -/// -/////////////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////// - -// the first two come for free when using AthAlgorithm -//#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" - - -#include "xAODEventInfo/EventInfo.h" - -#include "egammaEvent/ElectronContainer.h" -#include "egammaEvent/EMShower.h" -#include "egammaEvent/egammaParamDefs.h" - -#include "McParticleEvent/TruthParticleContainer.h" - -#include "VxVertex/VxContainer.h" -#include "Particle/TrackParticleContainer.h" -#include "CaloEvent/CaloClusterContainer.h" - -#include "muonEvent/MuonContainer.h" -#include "egammaEvent/PhotonContainer.h" -#include "tauEvent/TauJetContainer.h" -#include "JetEvent/JetCollection.h" -#include "MissingETEvent/MissingET.h" - -#include "NavFourMom/IParticleContainer.h" -#include "NavFourMom/INavigable4MomentumCollection.h" - -#include "GaudiKernel/ITHistSvc.h" -#include "TTree.h" -#include "CLHEP/Vector/LorentzVector.h" - -#include "JetTagInfo/TruthInfo.h" - -#include "TrigDecisionTool/ChainGroup.h" - -#include "UserAnalysis/AnalysisSkeleton.h" - -#include "TrigParticle/TrigTau.h" -#include "tauEvent/TauJet.h" -#include "tauEvent/TauJetContainer.h" -#include "tauEvent/TauDetailsContainer.h" -#include "tauEvent/Tau1P3PDetails.h" -#include "tauEvent/TauRecDetails.h" -#include "AnalysisTriggerEvent/Jet_ROI.h" -#include "AnalysisTriggerEvent/EmTau_ROI.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" -#include "TrigParticle/TrigTau.h" -#include "TrigParticle/TrigTauContainer.h" -#include "TrigCaloEvent/TrigT2Jet.h" -#include "TrigCaloEvent/TrigTauCluster.h" -#include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "AthenaKernel/Units.h" - -#include <algorithm> -#include <math.h> -#include <functional> -#include <iostream> - -//static const double mZ = 91.19*CLHEP::GeV; -//static const int MAX_PARTICLES = 20; - -using namespace Analysis; -using namespace Rec; -using namespace Trig; -using Athena::Units::GeV; - -////////////////////////////////////////////////////////////////////////////////////// -/// Constructor - -AnalysisSkeleton::AnalysisSkeleton(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_analysisTools( "AnalysisTools" ), - m_analysisSelectionTool( "UserAnalysisSelectionTool" ), - m_analysisPreparationTool( "UserAnalysisPreparationTool" ), - m_analysisOverlapCheckingTool( "UserAnalysisOverlapCheckingTool" ), - m_analysisOverlapRemovalTool( "UserAnalysisOverlapRemovalTool" ), - m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" ), - m_aan_FinalLepEtSum(0), - m_aan_FinalElEtSum(0), - m_aan_FinalMuEtSum(0), - m_aan_NumTopQ(0), - m_aan_pTtop1(0), - m_aan_pTtop2(0), - m_aan_Trig_efJet_et(0), - m_aan_Trig_efJet_eta(0), - m_aan_Trig_efJet_phi(0), - m_aan_Trig_l2Jet_et(0), - m_aan_Trig_l2Jet_eta(0), - m_aan_Trig_l2Jet_phi(0), - m_aan_Trig_l1Jet_et88(0), - m_aan_Trig_l1Jet_eta(0), - m_aan_Trig_l1Jet_phi(0), - m_doTrigger(true), - m_investigateChain("EF_tau16i_loose_2j23"), - m_eventNr(0), - m_all(nullptr), - m_allL1(nullptr), - m_allL2(nullptr), - m_allEF(nullptr), - m_runNumber(0), - m_eventNumber(0), - m_eventTime(0), - m_lumiBlock(0), - m_bCID(0), - m_eventWeight(0) -{ - - /** switches to control the analysis through job options */ - - declareProperty( "AnalysisTools", m_analysisTools ); - declareProperty( "AnalysisSelectionTool", m_analysisSelectionTool); - declareProperty( "AnalysisPreparationTool", m_analysisPreparationTool); - declareProperty( "AnalysisOverlapCheckingTool", m_analysisOverlapCheckingTool); - declareProperty( "AnalysisOverlapRemovalTool", m_analysisOverlapRemovalTool); - declareProperty( "TrigDecisionTool", m_trigDec, "The tool to access TrigDecision"); - - declareProperty("ElectronContainer", m_electronContainerName="ElectronAODCollection"); - declareProperty("McParticleContainer", m_truthParticleContainerName = "SpclMC"); - declareProperty("MissingETObject",m_missingETObjectName="MET_RefFinal"); - - /** the cuts - default values - to be modified in job options */ - - declareProperty("DeltaRMatchCut", m_deltaRMatchCut = 0.2); - declareProperty("MaxDeltaR", m_maxDeltaR = 0.9999); - - /** additiona cuts for electrons */ - declareProperty("ElectronEtCut", m_etElecCut = 10.0*CLHEP::GeV); - declareProperty("ElectronEtaCut", m_etaElecCut = 2.5); - declareProperty("ElectronCone", m_elecCone = 0.9); - - /** additional cuts for bjet tagging */ - declareProperty("bjetWt_IP3DSV1Cut", m_bjetWt_ip3dsv1Cut = 6); - declareProperty("bjet_etaCut", m_bjet_etaCut = 2.5); - declareProperty("bjet_etCut", m_bjet_etCut = 15.0*CLHEP::GeV); - - /** missing ET options */ - declareProperty("MissingETCut",m_missingETCut=20.0*CLHEP::GeV); - - /** is this AtlFast */ - declareProperty("IsAtlFastData",m_isAtlFastData=false); - - // is this MC or not? - declareProperty("DoTruth",m_doTruth=false); - - /** count number of jets with ET > min value - for SUSY studies */ - declareProperty("SusyJetMinEt", m_SusyJetMinEt = 50*CLHEP::GeV); - - /** trigger properties */ - declareProperty("DoTrigger", m_doTrigger, "enable trigger example"); - declareProperty("StatTriggerChains", m_triggerChains, "list of triggers for which to print statistics"); - declareProperty("InvestigateChain", m_investigateChain, "chain to investigate"); - -} - -///////////////////////////////////////////////////////////////////////////////////// -/// Destructor - check up memory allocation -/// delete any memory allocation on the heap - -AnalysisSkeleton::~AnalysisSkeleton() {} - -//////////////////////////////////////////////////////////////////////////////////// -/// Initialize -/// initialize StoreGate -/// get a handle on the analysis tools -/// book histograms - -StatusCode AnalysisSkeleton::start() { - - ATH_MSG_ERROR("Initializing AnalysisSkeleton (before eventloop)"); - - // retrieve trigger decision tool - // needs to be done before the first run/event since a number of - // BeginRun/BeginEvents are registered by dependent services - StatusCode sc = StatusCode::SUCCESS; - - if ( m_doTrigger ) { - sc = m_trigDec.retrieve(); - if ( sc.isFailure() )ATH_MSG_DEBUG("Can't get handle on TrigDecisionTool"); - else ATH_MSG_DEBUG("Got handle on TrigDecisionTool"); - - } - - // Initialize the trigger passed counters - // this can not be done before initialize, since the properties need to be set from job-options first - std::vector<std::string>::const_iterator it; - for(it = m_triggerChains.begin();it != m_triggerChains.end(); it++) - m_triggersPassed[*it] = 0; - - return sc; -} - -StatusCode AnalysisSkeleton::initialize() { - - ATH_MSG_INFO("Initializing AnalysisSkeleton"); - - /// get a handle on the analysis tools - StatusCode sc = m_analysisTools.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis tools"); - return sc; - } - - /// get a handle on the preparartion analysis tools - sc = m_analysisSelectionTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis selection tool"); - return sc; - } - - sc = m_analysisPreparationTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis preparation tool"); - return sc; - } - - sc = m_analysisOverlapCheckingTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis overlap checking tool"); - return sc; - } - - sc = m_analysisOverlapRemovalTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis overlap removal tool"); - return sc; - } - - /** get a handle on the NTuple and histogramming service */ - sc = service("THistSvc", m_thistSvc); - if (sc.isFailure()) { - ATH_MSG_ERROR("Unable to retrieve pointer to THistSvc"); - return sc; - } - - // at this point declare new vectors to put in ntuple - /* - // don't really need this (as per Attila K.) May 23, 2012 - m_lvl1TriggerInfo = new std::vector<unsigned int>; - m_lvl2TriggerInfo = new std::vector<unsigned int>; - m_evtFilterInfo = new std::vector<unsigned int>; - m_streamTagName = new std::vector<std::string>; - m_streamTagType = new std::vector<std::string>; - */ - - m_aan_eta = new std::vector<double>; - m_aan_pt = new std::vector<double>; - m_aan_elecetres = new std::vector<double>; - - m_aan_JetEta = new std::vector<double>; - m_aan_JetEt = new std::vector<double>; - m_aan_JetBTagWt = new std::vector<double>; - - m_aan_FinalElEta = new std::vector<double>; - m_aan_FinalElPt = new std::vector<double>; - m_aan_FinalElEtCone20 = new std::vector<double>; - - m_aan_FinalMuEta = new std::vector<double>; - m_aan_FinalMuPt = new std::vector<double>; - m_aan_FinalMuEtCone20 = new std::vector<double>; - m_aan_FinalMuBestMat = new std::vector<int>; - m_aan_FinalMuMatChi2 = new std::vector<double>; - - - - /** now add branches and leaves to the AAN tree */ - // the TTree - m_tree_AS = new TTree("tree_AS","TTree of AnalysisSkleton"); - sc = m_thistSvc->regTree("/AANT/tree_AS", m_tree_AS); - - // first add Event info stuff - m_tree_AS->Branch("Run", &m_runNumber, "Run/I"); // run number - m_tree_AS->Branch("Event",&m_eventNumber, "Event/I"); // event number - m_tree_AS->Branch("Time", &m_eventTime, "Time/I"); // time stamp - m_tree_AS->Branch("LumiBlock", &m_lumiBlock,"LumiBlock/I"); // lum block num - m_tree_AS->Branch("BCID", &m_bCID,"BCID/I"); // bunch crossing ID - m_tree_AS->Branch("Weight", &m_eventWeight, "Weight/D"); // weight - /* - // don't really need this (as per Attila K.) May 23, 2012 - - m_tree_AS->Branch("LVL1ID", &m_lVL1ID,"LVL1ID/I"); // trigger LVL1 ID - m_tree_AS->Branch("StatusElement", &m_statusElement, "StatusElement/I"); - m_tree_AS->Branch("LVL1TriggerType", &m_lvl1TriggerType, "LVL1TriggerType/I"); - m_tree_AS->Branch("LVL1TriggerInfo",&m_lvl1TriggerInfo); - m_tree_AS->Branch("LVL2TriggerInfo",&m_lvl2TriggerInfo); - m_tree_AS->Branch("EventFilterInfo",&m_evtFilterInfo); - m_tree_AS->Branch("StreamTagName",&m_streamTagName); - m_tree_AS->Branch("StreamTagType",&m_streamTagType); - */ - - m_tree_AS->Branch("NElectrons", &m_aan_size, "NElectrons/i"); - m_tree_AS->Branch("ElectronEta", &m_aan_eta); - m_tree_AS->Branch("ElectronPt", &m_aan_pt); - m_tree_AS->Branch("ElecPtRatio", &m_aan_elecetres); - - m_tree_AS->Branch("NJets", &m_aan_njets, "NJets/i"); - m_tree_AS->Branch("NJets_etaLT25", &m_aan_njets_etaLT25, "NJets_etaLT25/i"); - m_tree_AS->Branch("NJets_SusyETCut",&m_aan_njets_SusyETCut, "NJets_SusyETCut/i"); - m_tree_AS->Branch("JetsEta" ,&m_aan_JetEta); - m_tree_AS->Branch("JetsEt" ,&m_aan_JetEt); - m_tree_AS->Branch("JetsBTagWt" ,&m_aan_JetBTagWt); - m_tree_AS->Branch("MissingET", &m_aan_ptMiss, "MissingET/d"); - m_tree_AS->Branch("EffMass", &m_aan_effmass, "EffMass/d"); - m_tree_AS->Branch("HT", &m_aan_ht,"HT/d"); - m_tree_AS->Branch("NBJets", &m_aan_nbjets, "NBJets/i"); - m_tree_AS->Branch("MaxJetET", &m_aan_maxJetET, "MaxJetET/d"); - - m_tree_AS->Branch("NFinalEl", &m_aan_NFinalEl, "NFinalEl/i"); - m_tree_AS->Branch("FinalElEta", &m_aan_FinalElEta); - m_tree_AS->Branch("FinalElPt", &m_aan_FinalElPt); - m_tree_AS->Branch("FinalElEtCone20",&m_aan_FinalElEtCone20); - - m_tree_AS->Branch("NFinalMu", &m_aan_NFinalMu, "NFinalMu/i"); - m_tree_AS->Branch("FinalMuEta", &m_aan_FinalMuEta); - m_tree_AS->Branch("FinalMuPt", &m_aan_FinalMuPt); - m_tree_AS->Branch("FinalMuEtCone20",&m_aan_FinalMuEtCone20); - m_tree_AS->Branch("FinalMuBestMat", &m_aan_FinalMuBestMat); - m_tree_AS->Branch("FinalMuMatChi2", &m_aan_FinalMuMatChi2); - - m_tree_AS->Branch("FinalLepEtSum", &m_aan_FinalLepEtSum, "FinalLepEtSum/d"); - m_tree_AS->Branch("FinalElEtSum", &m_aan_FinalElEtSum, "FinalElEtSum/d"); - m_tree_AS->Branch("FinalMuEtSum", &m_aan_FinalMuEtSum, "FinalMuEtSum/d"); - - m_tree_AS->Branch("NumberTopQ", &m_aan_NumTopQ, "NumberTopQ/i"); - m_tree_AS->Branch("pTtop1", &m_aan_pTtop1, "pTtop1/d"); - m_tree_AS->Branch("pTtop2", &m_aan_pTtop2, "pTtop2/d"); - - m_tree_AS->Branch("Trig_efJet_et", &m_aan_Trig_efJet_et , "Trig_efJet_et/f"); - m_tree_AS->Branch("Trig_efJet_eta", &m_aan_Trig_efJet_eta , "Trig_efJet_eta/f"); - m_tree_AS->Branch("Trig_efJet_phi", &m_aan_Trig_efJet_phi , "Trig_efJet_phi/f"); - m_tree_AS->Branch("Trig_l2Jet_et", &m_aan_Trig_l2Jet_et , "Trig_l2Jet_et/f"); - m_tree_AS->Branch("Trig_l2Jet_eta", &m_aan_Trig_l2Jet_eta , "Trig_l2Jet_eta/f"); - m_tree_AS->Branch("Trig_l2Jet_phi", &m_aan_Trig_l2Jet_phi , "Trig_l2Jet_phi/f"); - m_tree_AS->Branch("Trig_l1Jet_et88", &m_aan_Trig_l1Jet_et88, "Trig_l1Jet_et88/f"); - m_tree_AS->Branch("Trig_l1Jet_eta", &m_aan_Trig_l1Jet_eta , "Trig_l1Jet_eta/f"); - m_tree_AS->Branch("Trig_l1Jet_phi", &m_aan_Trig_l1Jet_phi , "Trig_l1Jet_phi/f"); - - /// ROOT histograms --------------------------------------- - - /// electrons - m_h_elecpt = new TH1F("elec_pt","pt el",50,0,250.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/Electron/elec_pt",m_h_elecpt); - - m_h_eleceta = new TH1F("elec_eta","eta el",70,-3.5,3.5); - sc = m_thistSvc->regHist("/AANT/Electron/elec_eta",m_h_eleceta); - - m_h_elec_deltaRMatch = new TH1F("elec_deltaRMatch","elec reco/MC deltaR",50,0.,1.); - sc = m_thistSvc->regHist("/AANT/Electron/elec_deltaRMatch",m_h_elec_deltaRMatch); - - /// jets - before OverlapRemoval - m_h_jet_eta_beforeOR = new TH1F("jet_eta_beforeOR","jet_eta before OR",50,-5.,5.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_eta_beforeOR",m_h_jet_eta_beforeOR); - - m_h_jet_et_beforeOR = new TH1F("jet_et_beforeOR","jet_et before OR",100,0.,500.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_et_beforeOR",m_h_jet_et_beforeOR); - - m_h_jet_ip3dsv1Wt_beforeOR = new TH1F("jet_ip3dsv1Wt_beforeOR","jet_ip3dsv1Wt before OR",120,-20.,40.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_ip3dsv1Wt_beforeOR",m_h_jet_ip3dsv1Wt_beforeOR); - - m_h_jet_label_beforeOR = new TH1F("jet_label_beforeOR","jet_label before OR",20,0.,20.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_label_beforeOR",m_h_jet_label_beforeOR); - - m_h_jet_ip3dsv1Wt_bjet_beforeOR = new TH1F("jet_ip3dsv1Wt_bjet_beforeOR","b jet_ip3dsv1Wt before OR",120,-20.,40.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_ip3dsv1Wt_bjet_beforeOR",m_h_jet_ip3dsv1Wt_bjet_beforeOR); - - m_h_jet_ip3dsv1Wt_ujet_beforeOR = new TH1F("jet_ip3dsv1Wt_ujet_beforeOR","u jet_ip3dsv1Wt before OR",120,-20.,40.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_ip3dsv1Wt_ujet_beforeOR",m_h_jet_ip3dsv1Wt_ujet_beforeOR); - - /// jets - after OverlapRemoval - m_h_jet_eta_afterOR = new TH1F("jet_eta_afterOR","jet_eta after OR",50,-5.,5.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_eta_afterOR",m_h_jet_eta_afterOR); - - m_h_jet_et_afterOR = new TH1F("jet_et_afterOR","jet_et after OR",100,0.,500.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_et_afterOR",m_h_jet_et_afterOR); - - m_h_jet_ip3dsv1Wt_afterOR = new TH1F("jet_ip3dsv1Wt_afterOR","jet_ip3dsv1Wt after OR",120,-20.,40.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_ip3dsv1Wt_afterOR",m_h_jet_ip3dsv1Wt_afterOR); - - m_h_jet_label_afterOR = new TH1F("jet_label_afterOR","jet_label after OR",20,0.,20.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_label_afterOR",m_h_jet_label_afterOR); - - m_h_jet_ip3dsv1Wt_bjet_afterOR = new TH1F("jet_ip3dsv1Wt_bjet_afterOR","b jet_ip3dsv1Wt after OR",120,-20.,40.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_ip3dsv1Wt_bjet_afterOR",m_h_jet_ip3dsv1Wt_bjet_afterOR); - - m_h_jet_ip3dsv1Wt_ujet_afterOR = new TH1F("jet_ip3dsv1Wt_ujet_afterOR","u jet_ip3dsv1Wt after OR",120,-20.,40.); - sc = m_thistSvc->regHist("/AANT/Jet/jet_ip3dsv1Wt_ujet_afterOR",m_h_jet_ip3dsv1Wt_ujet_afterOR); - - /// missing ET - - m_pxMis = new TH1F("MissingPx", "MissingPx",200,-500.0*CLHEP::GeV,500.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/MissingET/MissingPx", m_pxMis); - m_pyMis = new TH1F("MissingPy","MissingPy",200,-500.0*CLHEP::GeV,500.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/MissingET/MissingPy", m_pyMis); - m_ptMis = new TH1F("MissingPt","MissingPt",100,0.0,500.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/MissingET/MissingPt", m_ptMis); - - // trigger - - m_triggerAccepts = new TH1F("TriggerAccepts", "TriggerAccepts",3,0,3); - sc = m_thistSvc->regHist("/AANT/Trigger/TriggerAccepts", m_triggerAccepts); - - if (sc.isFailure()) { - ATH_MSG_ERROR("ROOT Hist registration failed"); - return sc; - } - /// end ROOT Histograms ------------------------------------------ - - // define chain groups using regular expressions and relying on the - // trigger chain name convention: all L1 items start their name from - // L1_ etc; in fact, the TrigDecisionTool already defines these - // groups by default, but let's do it again as an example - m_all = m_trigDec->getChainGroup(".*"); - m_allL1 = m_trigDec->getChainGroup("L1_.*"); - m_allL2 = m_trigDec->getChainGroup("L2_.*"); - m_allEF = m_trigDec->getChainGroup("EF_.*"); - - m_eventNr=0; - - /** Print out bjet cut values */ - ATH_MSG_DEBUG(":b jet cuts: Et/eta/IP3DSV1 wt. "<<m_bjet_etCut<< ","<<m_bjet_etaCut <<","<<m_bjetWt_ip3dsv1Cut); - - - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////////////////////// -/// Finalize - delete any memory allocation from the heap - -StatusCode AnalysisSkeleton::finalize() { - - // - if(m_doTrigger) { - // print trigger statistics - ATH_MSG_INFO("STAT Trigger Statistics on " << m_eventNr << " processed events"); - for( std::vector<std::string>::const_iterator it = m_triggerChains.begin();it != m_triggerChains.end(); it++) - ATH_MSG_INFO("STAT Passed events for chain " << *it << " " << m_triggersPassed[*it] << " ("<< 100.*m_triggersPassed[*it]/m_eventNr <<"%)"); - } - return StatusCode::SUCCESS; - -} - -/////////////////////////////////////////////////////////////////////////////////// -/// Clear - clear CBNT members -StatusCode AnalysisSkeleton::initEvent() { - /// For Athena-Aware NTuple - - m_aan_size = 0; - m_aan_eta->clear(); - m_aan_pt->clear(); - m_aan_elecetres->clear(); - - m_aan_njets=0; - m_aan_maxJetET = -1000.; - m_aan_JetEta->clear(); - m_aan_JetEt->clear(); - m_aan_JetBTagWt->clear(); - // - m_aan_njets_etaLT25=0; - m_aan_njets_SusyETCut = 0; - - m_aan_ptMiss = -1.; - m_aan_effmass = 0.; - m_aan_ht = 0; - m_aan_nbjets = 0; - - // - m_aan_NFinalEl = 0; - m_aan_FinalElPt->clear(); - m_aan_FinalElEta->clear(); - m_aan_FinalElEtCone20->clear(); - - - m_aan_NFinalMu = 0; - m_aan_FinalMuPt->clear(); - m_aan_FinalMuBestMat->clear(); - m_aan_FinalMuEta->clear(); - m_aan_FinalMuEtCone20->clear(); - m_aan_FinalMuMatChi2->clear(); - - // - m_aan_FinalLepEtSum = 0.; - m_aan_FinalElEtSum = 0.; - m_aan_FinalMuEtSum = 0.; - - // - m_aan_NumTopQ=0; - m_aan_pTtop1=-1; - m_aan_pTtop2=-1; - - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Execute - on event by event - -StatusCode AnalysisSkeleton::execute() { - // - m_eventNr++; - ATH_MSG_DEBUG(" in execute()"); - - StatusCode sc; - - // initialize first before processing each event - sc = initEvent(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("initEvent failed. Continue"); - } - - // initialize variables in ntuple - - - - /** it shows how to get the Electron and the TruthParticle - containers shows matching between reconstructed and MC electrons - - Can be commented out if you want to do so If you do so, some of - the electron histograms/ntuple variables will be unfilled */ - - // this method is discussed in the Computing workbook - uncomment - // VJ Oct. 29'08 - // protect with m_doTruth - VJ, Feb 16, 2010 - - if(m_doTruth) { - sc = electronSkeleton(); - if (sc.isFailure()) { - ATH_MSG_WARNING("The method electronSkeleton() failed"); - return StatusCode::SUCCESS; - } - } - /** an minimal example using the TrigDecisionTool */ - if ( m_doTrigger ) { - sc = triggerSkeleton(); - if (sc.isFailure()) { - ATH_MSG_WARNING("The method triggerSkeleton() failed"); - return StatusCode::SUCCESS; - } - ATH_MSG_INFO("Pass state L1_MBTS_1 = " << m_trigDec->isPassed("L1_MBTS_1")); - } - - /** an example of analysis preparation, including: - - pre-selections based on the reocmmendations of performance groups - - overlap checking - - overlap removal */ - - /** Do not comment the next method. This is where we do all the - selection/overlap removal Those results are then used in the - methods later on */ - - sc = analysisPreparation(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Analysis Preparation Failed "); - return StatusCode::SUCCESS; - } - - /** The following methods were added by Vivek Jain They just show - you how to access different variables and store them in - histograms and/or ntuples */ - - /** get basic event info. These variables are already in the output ntuple - here we show you how to access them yourself */ - - sc = addEventInfo(); - if (sc.isFailure() ) { - ATH_MSG_WARNING("Failure in getEventInfo() "); - return StatusCode::SUCCESS; - } - - /** look at bjet tagging information in the jets after overlap - removal */ - - sc = bjetInfo(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Failure in bjetInfo "); - return StatusCode::SUCCESS; - } - - /** get missing Et information */ - - sc = getMissingET(); - if( sc.isFailure() ) { - ATH_MSG_WARNING("Failed to retrieve Et object found in TDS"); - return StatusCode::SUCCESS; - } - - /** do SUSY studies */ - - sc = SusyStudies(); - if( sc.isFailure() ) { - ATH_MSG_WARNING("Failed to do SUSY studies"); - return StatusCode::SUCCESS; - } - - // - m_tree_AS->Fill(); - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Trigger method - called by execute() on event by event -/// to be removed if not needed - -StatusCode AnalysisSkeleton::triggerSkeleton() { - - ATH_MSG_INFO("Event Number " << m_eventNr); - - // print out list of chains in each level for the first event: - if (m_eventNr==1) { - ATH_MSG_INFO("L1 Items : " << m_allL1->getListOfTriggers()); - ATH_MSG_INFO("L2 Chains: " << m_allL2->getListOfTriggers()); - ATH_MSG_INFO("EF Chains: " << m_allEF->getListOfTriggers()); - } - - // simple example of isPassed(): - // isPassed([chain], [condition]) is called with the default argument condition = Physics - // a ChainGroup is defined implicitly by the regular expression given by "EF.*" in the call to isPassed() - ATH_MSG_INFO("Pass state L1 = " << m_trigDec->isPassed("L1_.*")) ; - ATH_MSG_INFO("Pass state L2 = " << m_trigDec->isPassed("L2_.*")) ; - ATH_MSG_INFO("Pass state EF = " << m_trigDec->isPassed("EF_.*")) ; - - ATH_MSG_INFO("Pass state L2_tau16i_loose_3j23 = " << m_trigDec->isPassed("L2_tau16i_loose_3j23")); - ATH_MSG_INFO("Pass state EF_mu10 = " << m_trigDec->isPassed("EF_mu10")); - ATH_MSG_INFO("Pass state EF_mu20 = " << m_trigDec->isPassed("EF_mu20")); - ATH_MSG_INFO("Pass state EF_e15_medium = " << m_trigDec->isPassed("EF_e15_medium")); - ATH_MSG_INFO("Pass state EF_e20_loose = " << m_trigDec->isPassed("EF_e20_loose")); - - // on the first event we are printing out prescale factors for all - // EF chains - // note that the prescales - - std::vector<std::string>::const_iterator it; - if (m_eventNr==1) { - const std::vector<std::string> allEF = m_allEF->getListOfTriggers(); - for(it = allEF.begin(); it != allEF.end(); it++) { - ATH_MSG_INFO("Prescale info: chain " << std::left << *it << " has prescale " << m_trigDec->getPrescale(*it)); - } - ATH_MSG_INFO("Stream info: " << m_trigDec->getListOfStreams()); - - for(it = m_triggerChains.begin();it != m_triggerChains.end(); it++) { - std::vector<std::string> chgrcnt = m_trigDec->getChainGroup(*it)->getListOfTriggers(); - for(std::vector<std::string>::iterator chgrit = chgrcnt.begin(); chgrit != chgrcnt.end(); chgrit++) { - ATH_MSG_INFO("Chain belonging to " << *it << ": " << *chgrit); - } - } - } - - - // Now we'd like to collect some trigger statistics for the chains specified in - for(it = m_triggerChains.begin();it != m_triggerChains.end(); it++) - if( m_trigDec->isPassed(*it) ) { - m_triggersPassed[*it]++; - m_triggerAccepts->Fill(it->c_str(),1); - } - - - std::string chain(m_investigateChain); - - ATH_MSG_INFO("FLAT Pass state " << chain << " = " << m_trigDec->isPassed(chain)); - - // first declare a FeatureContainer; fill it using the features(std::string chain_name) method - FeatureContainer f = m_trigDec->features(chain /*, broken in 15.2.0: TrigDefs::alsoDeactivateTEs*/ ); - - std::vector< Feature<JetCollection> > jetColls = f.get<JetCollection>(); - ATH_MSG_INFO("FLAT Number of JetCollections in " << chain << ": " << jetColls.size()); - if(jetColls.size()>0) { - - m_aan_Trig_efJet_et = 0; - m_aan_Trig_efJet_eta = 0; - m_aan_Trig_efJet_phi = 0; - m_aan_Trig_l2Jet_et = 0; - m_aan_Trig_l2Jet_eta = 0; - m_aan_Trig_l2Jet_phi = 0; - m_aan_Trig_l1Jet_et88 = 0; - m_aan_Trig_l1Jet_eta = 0; - m_aan_Trig_l1Jet_phi = 0; - - const Feature<JetCollection>& jcf = jetColls[0]; - ATH_MSG_INFO("FLAT TE Label: " << jcf.label()); - const JetCollection* jc = jcf.cptr(); - ATH_MSG_INFO("FLAT Number of Jets in JetCollection: " << jc->size()); - JetCollection::const_iterator jIt = jc->begin(); - for (; jIt != jc->end(); ++jIt ) { - Jet* jet = const_cast<Jet*> (*jIt); - // Jet* jet = *jIt; - ATH_MSG_INFO("FLAT Jet e : " << jet->e()) ; - ATH_MSG_INFO("FLAT eta : " << jet->eta()) ; - ATH_MSG_INFO("FLAT phi : " << jet->phi()) ; - ATH_MSG_INFO("FLAT pt : " << jet->pt()) ; - ATH_MSG_INFO("FLAT et : " << jet->et()) ; - m_aan_Trig_efJet_et = jet->et(); - m_aan_Trig_efJet_eta = jet->eta(); - m_aan_Trig_efJet_phi = jet->phi(); - } - - // let us find the corresponding jets in Lvl2 - Feature<TrigT2Jet> l2jetF = m_trigDec->ancestor<TrigT2Jet>(jcf); - ATH_MSG_INFO("FLAT Found " << (l2jetF.empty()?"no ":"") << "corresponding L2 Jet."); - if ( !l2jetF.empty() ) { - const TrigT2Jet* t2jet = l2jetF.cptr(); - ATH_MSG_INFO("FLAT e : " << t2jet->e()); - ATH_MSG_INFO("FLAT eta : " << t2jet->eta()); - ATH_MSG_INFO("FLAT phi : " << t2jet->phi()); - ATH_MSG_INFO("FLAT ehad : " << t2jet->ehad0()); - ATH_MSG_INFO("FLAT eem : " << t2jet->eem0()); - m_aan_Trig_l2Jet_et = t2jet->e()/cosh(t2jet->eta()); - m_aan_Trig_l2Jet_eta = t2jet->eta(); - m_aan_Trig_l2Jet_phi = t2jet->phi(); - } - - // we can also access the L1 Jet_ROI using the ancestor method of the TrigDecisionTool - Feature<Jet_ROI> jRoIF = m_trigDec->ancestor<Jet_ROI>(jcf); - ATH_MSG_INFO("FLAT Found " << (jRoIF.empty()?"no ":"") << "corresponding Jet_ROI"); - if ( !jRoIF.empty() ) { - const Jet_ROI* jroi = jRoIF.cptr(); - ATH_MSG_INFO("FLAT Passed thresholds" << jroi->getThresholdNames()); - ATH_MSG_INFO("FLAT ET4x4 : " << jroi->getET4x4()); - ATH_MSG_INFO("FLAT ET6x6 : " << jroi->getET6x6()); - ATH_MSG_INFO("FLAT ET8x8 : " << jroi->getET8x8()); - ATH_MSG_INFO("FLAT eta : " << jroi->eta()); - ATH_MSG_INFO("FLAT phi : " << jroi->phi()); - m_aan_Trig_l1Jet_et88 = jroi->getET8x8(); - m_aan_Trig_l1Jet_eta = jroi->eta(); - m_aan_Trig_l1Jet_phi = jroi->phi(); - } - } - - - // now we like to look at the Combinations of jets and tau that make up the chain decision - const std::vector<Trig::Combination>& tauJetCombinations = f.getCombinations(); - ATH_MSG_INFO("COMB Pass state " << chain << " = " << m_trigDec->isPassed(chain)); - ATH_MSG_INFO("COMB Number of TauJetCombinations in " << chain << ": " << tauJetCombinations.size()); - std::vector<Trig::Combination>::const_iterator cIt; - for ( cIt = tauJetCombinations.begin(); cIt != tauJetCombinations.end(); ++cIt ) { - - const Trig::Combination& comb = *cIt; - - std::vector< Feature<TauJetContainer> > tauC = comb.get<TauJetContainer>(); - std::vector< Feature<JetCollection> > jetC = comb.get<JetCollection>(); - - ATH_MSG_INFO("COMB Combination was " << (comb.active()?"":"not ") << "active."); - - if(tauC.size()>0 || jetC.size()>0) { - ATH_MSG_INFO("COMB Combination has " << tauC.size() << " TauJetContainer Fs and " - << jetC.size() << " JetCollection Fs"); - - const TauJetContainer* taus = tauC[0]; - const JetCollection* jets = jetC[0]; - - ATH_MSG_INFO("COMB In the TauJetContainer are " << taus->size() << " taus and in the JetCollection are " - << jets->size() << " jets."); - } else { - ATH_MSG_INFO("COMB TauJetContainer or JetCollection missing."); - } - - std::vector< Feature<TrigTau> > tauFV = comb.get<TrigTau>(); - std::vector< Feature<TrigT2Jet> > jetFV = comb.get<TrigT2Jet>(); - - ATH_MSG_INFO("COMB Combination has " << tauFV.size() << " TrigTau Fs and " << jetFV.size() << " TrigT2Jet Fs."); - - } - - - return StatusCode::SUCCESS; -} - - - - - - -////////////////////////////////////////////////////////////////////////////////// -/// Electron method - called by execute() on event by event -/// to be removed if not needed - -StatusCode AnalysisSkeleton::electronSkeleton() { - - ATH_MSG_DEBUG("in electronSkeleton()"); - - /** get the MC truth particle AOD container from StoreGate */ - const TruthParticleContainer* mcpartTES = 0; - StatusCode sc=evtStore()->retrieve( mcpartTES, m_truthParticleContainerName); - if( sc.isFailure() || !mcpartTES ) { - ATH_MSG_WARNING("No AOD MC truth particle container found in TDS"); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG("MC Truth Container Successfully Retrieved"); - - /** get the container of the original AOD electron - without any selection */ - /** get the AOD electron container for TES */ - const ElectronContainer* elecTES = 0; - sc=evtStore()->retrieve( elecTES, m_electronContainerName); - if( sc.isFailure() || !elecTES ) { - ATH_MSG_WARNING("No AOD electron container found in TDS"); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("ElectronContainer successfully retrieved - size is " << elecTES->size() << " electrons "); - - - /** iterators over the electron container - the pre-selected ones or the original ones */ - ElectronContainer::const_iterator elecItr = elecTES->begin(); - ElectronContainer::const_iterator elecItrE = elecTES->end(); - - for (; elecItr != elecItrE; ++elecItr) { - - /** apply further selections if necessary */ - /** check for the author of the electron */ - bool author = (*elecItr)->author(egammaParameters::AuthorElectron); - if ( !author || (*elecItr)->pt() < m_etElecCut ) continue; - - m_aan_size++; - - - /** fill histograms */ - m_h_elecpt->Fill( (*elecItr)->pt(), 1.); - m_h_eleceta->Fill( (*elecItr)->eta(), 1.); - - /** fill Athena-Aware NTuple */ - m_aan_eta->push_back((*elecItr)->eta()); - m_aan_pt->push_back((*elecItr)->pt()); - - /** find a match to this electron in the MC truth container - the index and deltaR are returned */ - int index = -1; - double deltaRMatch; - if( (*elecItr)->trackParticle() && (*elecItr)->pt()> m_etElecCut ) { - const TruthParticleContainer * truthContainer = mcpartTES; - bool findAMatch = m_analysisTools->matchR((*elecItr), truthContainer, - index, deltaRMatch, (*elecItr)->pdgId()); - if (findAMatch) { - deltaRMatch = (deltaRMatch > m_maxDeltaR) ? m_maxDeltaR : deltaRMatch; - - m_h_elec_deltaRMatch->Fill(deltaRMatch); - ATH_MSG_DEBUG("Electron: MC/Reco DeltaR " << deltaRMatch); - /** check for good match */ - if ( deltaRMatch < m_deltaRMatchCut) { - const TruthParticle* electronMCMatch = (*mcpartTES)[index]; - double res = (*elecItr)->pt() / electronMCMatch->pt(); - m_aan_elecetres->push_back(res); - } - } - } - } - - ATH_MSG_DEBUG("electronSkeleton() succeeded"); - - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Analysis Preparation method - called by execute() on event by event -/// A lot of the AOD container are read in -/// pre-selection is done using the UserAnalysisSelectionTool -/// An example of overlap checking is demonstrated -/// An example of overlap removal is demonstration -StatusCode AnalysisSkeleton::analysisPreparation() { - - ATH_MSG_DEBUG("in analysisPreparation()"); - - /** loop over Electrons from the AOD and see which pass the recommended electron selection - These selections are defined in m_analysisSelectionTool - to be changed if necessary */ - const ElectronContainer* elecTES = 0; - ATH_CHECK( evtStore()->retrieve( elecTES, m_electronContainerName) ); - ElectronContainer::const_iterator elecItr = elecTES->begin(); - ElectronContainer::const_iterator elecItrE = elecTES->end(); - for (; elecItr != elecItrE; ++elecItr) { - bool passedSelection = m_analysisSelectionTool->isSelected( *elecItr ); - if ( passedSelection ) ATH_MSG_DEBUG("Found a potential good Electron "); - } - - /** do analysis preparation using the AnalysisPreparationTool - selections based or recommended selections from performance groups - The tool outputs various containers of pre-selected objects */ - StatusCode sc = m_analysisPreparationTool->execute(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("AnalysisPreparation Failed - selection "); - return StatusCode::SUCCESS; - } - - /** get the pre-selected Electrons - given by the AnalysisPreparationTool */ - const ElectronContainer* preselectedElecTES = m_analysisPreparationTool->selectedElectrons(); - if ( !preselectedElecTES ) { - ATH_MSG_ERROR("Selected Electrons Not Found"); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("Pre-selected Electrons successfully retrieved - size is " << preselectedElecTES->size() << " electrons "); - - /** get the pre-selected Muons - given by the AnalysisPreparationTool */ - const MuonContainer* preselectedMuonTES = m_analysisPreparationTool->selectedMuons(); - if ( !preselectedMuonTES ) { - ATH_MSG_ERROR( "Selected Muons Not Found "); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG( "Pre-selected Muons successfully retrieved - size is " << preselectedMuonTES->size() << " muons "); - - /** Check if the leading Electron and the Leadign Muon overlap or not */ - double deltaR = -1.0; - if ( preselectedElecTES->size() > 0 && preselectedMuonTES->size() > 0) { - const Electron * leadingElectron = preselectedElecTES->at(0); - const Analysis::Muon * leadingMuon = preselectedMuonTES->at(0); - bool areOverlapping = m_analysisOverlapCheckingTool->overlap( leadingElectron, leadingMuon, deltaR ); - if ( areOverlapping ) ATH_MSG_INFO("Leading Electron and Leading Muon overlap - deltaR = "); - } - - /** now remove the overlaps using this tool - The input to the tool is the collection of pre-selected obeject obtained from the AnalysisPreparationTool - The output is various collections of final state non-overlapping particles - You can change the order of the overlap removal by change the input to the tool in job options */ - sc = m_analysisOverlapRemovalTool->execute(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING( "AnalysisPreparation Failed - overlap removal "); - return StatusCode::SUCCESS; - } - - /** get the final state Electrons - given by the AnalysisOverlapRemovalTool */ - const ElectronContainer* finalStateElecTES = m_analysisOverlapRemovalTool->finalStateElectrons(); - if ( !finalStateElecTES ) ATH_MSG_WARNING( "Final State Electrons Not Found "); - ATH_MSG_DEBUG( "Final State Electrons successfully retrieved - size is " << finalStateElecTES->size() << " electrons "); - - ATH_MSG_DEBUG( "AnalysisPreparation() succeeded"); - - return StatusCode::SUCCESS; - -} -////////////////////////////////////////////////////////////////////////////////// -/// Method to look at bjetInfo - called by execute() on event by event -/// Use jets after overlap removal and look at the b-tagging weights within -/// -////////////////////////////////////////////////////////////////////////////////// -StatusCode AnalysisSkeleton::bjetInfo() { - - ATH_MSG_DEBUG( "in bjetInfo()"); - - /** loop over jet container after overlap removal - As a check first get the container after selection cuts, but BEFORE Overlap Removal */ - - const JetCollection* selectedJetTES = m_analysisPreparationTool->selectedJets(); - if ( !selectedJetTES ) { - ATH_MSG_ERROR( "Selected Particle Jets Not Found "); - return StatusCode::FAILURE; - } - else ATH_MSG_DEBUG( "Selected Jets successfully retrieved - size is " << selectedJetTES->size() << " jets "); - // - const JetCollection* finalStateJetTES = m_analysisOverlapRemovalTool->finalStateJets(); - if ( !finalStateJetTES ) { - ATH_MSG_WARNING( "Final State Particle Jets Not Found "); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG( "Final State Jets successfully retrieved - size is " << finalStateJetTES->size() << " jets "); - - /** now look at some variables before and after overlap removal */ - - int iflav; - JetCollection::const_iterator jetItr_sel = selectedJetTES->begin(); - JetCollection::const_iterator jetItrE_sel = selectedJetTES->end(); - for (; jetItr_sel != jetItrE_sel; ++jetItr_sel) { - - CLHEP::HepLorentzVector p4((*jetItr_sel)->px(), - (*jetItr_sel)->py(), - (*jetItr_sel)->pz(), - (*jetItr_sel)->e()); - - m_h_jet_eta_beforeOR->Fill(p4.pseudoRapidity()); - m_h_jet_et_beforeOR->Fill(p4.et()/GeV); - - /** get b-tagging info */ - - double w_cmb = (*jetItr_sel)->getFlavourTagWeight(); // weight for IP3DSV1 - m_h_jet_ip3dsv1Wt_beforeOR->Fill(w_cmb); - - /** get quark flavour that originates this jet */ - // if we are looking at data, set it to -10 - if(m_doTruth) iflav = getQuarkJetFlavour(jetItr_sel); - else iflav=-10; - m_h_jet_label_beforeOR->Fill((float) iflav); - - if(p4.et() > m_bjet_etCut && fabs(p4.pseudoRapidity()) < m_bjet_etaCut) { - if(iflav==5) m_h_jet_ip3dsv1Wt_bjet_beforeOR->Fill(w_cmb); - if(iflav==0) m_h_jet_ip3dsv1Wt_ujet_beforeOR->Fill(w_cmb); - } - - } - /** after overlapRemoval */ - JetCollection::const_iterator jetItr_fin = finalStateJetTES->begin(); - JetCollection::const_iterator jetItrE_fin = finalStateJetTES->end(); - for (; jetItr_fin != jetItrE_fin; ++jetItr_fin) { - - CLHEP::HepLorentzVector p4((*jetItr_fin)->px(), - (*jetItr_fin)->py(), - (*jetItr_fin)->pz(), - (*jetItr_fin)->e()); - - m_h_jet_eta_afterOR->Fill(p4.pseudoRapidity()); - m_h_jet_et_afterOR->Fill(p4.et()/GeV); - - /** get b-tagging info */ - - - - if(p4.et() > m_bjet_etCut && fabs(p4.pseudoRapidity()) < m_bjet_etaCut) { - - double w_cmb = (*jetItr_fin)->getFlavourTagWeight(); // weight for IP3DSV1 - m_h_jet_ip3dsv1Wt_afterOR->Fill(w_cmb); - - /** get quark flavour that originates this jet */ - if(m_doTruth) iflav = getQuarkJetFlavour(jetItr_fin); - else iflav=-10; - m_h_jet_label_afterOR->Fill((float) iflav); - // - - if(w_cmb > m_bjetWt_ip3dsv1Cut) m_aan_nbjets++; // count # of bjets in event - - if(iflav==5) m_h_jet_ip3dsv1Wt_bjet_afterOR->Fill(w_cmb); - if(iflav==0) m_h_jet_ip3dsv1Wt_ujet_afterOR->Fill(w_cmb); - } - - } - - return StatusCode::SUCCESS; - -} -//////// - -int AnalysisSkeleton::getQuarkJetFlavour(JetCollection::const_iterator jetItr) { - - - /** flavour of quark that originated this jet */ - // --- get the true label of the jet from MC Truth - - std::string label("N/A"); - - const Analysis::TruthInfo* mcinfo = (*jetItr)->tagInfo<Analysis::TruthInfo>("TruthInfo"); - if(mcinfo) { - label = mcinfo->jetTruthLabel(); - } else { - ATH_MSG_VERBOSE("could not find TruthInfo for matching jet"); - } - int iflav(0); - if(label=="B") { - return iflav = 5; - } - if(label=="C") { - return iflav = 4; - } - if(label=="T") { - return iflav = 15; - } - - return iflav; -} -//////////////////////////////////////////////////////////////////////////////////////////////// -/// missing Et object - -StatusCode AnalysisSkeleton::getMissingET() { - - ATH_MSG_DEBUG( "in getMissingEt()"); - - StatusCode sc = StatusCode::SUCCESS; - - if (!m_isAtlFastData) { - /// retrieve the missing Et object from TDS - sc = evtStore()->retrieve(m_pMissing,m_missingETObjectName); - if (sc.isFailure()) { - ATH_MSG_ERROR("Could not retrieve MissingET Object"); - return StatusCode::SUCCESS; - } - else ATH_MSG_DEBUG(" retreived missing ET from AOD"); - - m_pxMiss = m_pMissing->etx(); - m_pyMiss = m_pMissing->ety(); - m_ptMiss = m_pMissing->et(); - } else { - /// retrieve the missing Et object from TDS - sc=evtStore()->retrieve(m_pMissing, "AtlfastMissingEt"); - if( sc.isFailure() || !m_pMissing ) { - ATH_MSG_WARNING("No Atlfast missing Et object found in TDS"); - return StatusCode::SUCCESS; - } - m_pxMiss = m_pMissing->etx(); - m_pyMiss = m_pMissing->ety(); - m_ptMiss = m_pMissing->et(); - } - - /// fill missing energy histograms - m_pxMis->Fill(m_pxMiss); - m_pyMis->Fill(m_pyMiss); - m_ptMis->Fill(m_ptMiss); - - m_aan_ptMiss = m_ptMiss; - - return sc; - -} -//////////////////////////////////////////////////////// -StatusCode AnalysisSkeleton::SusyStudies() { - - /** Make some introductory plots */ - - ATH_MSG_DEBUG( "in SusyStudies()"); - - /** loop over truth container and get pT of the earliest top quarks */ - - double pTtop1; - double pTtop2; - int numTops; - - StatusCode sc = StatusCode::SUCCESS; - if(m_doTruth) { - sc = getTopQpT(numTops, pTtop1, pTtop2); - if(!sc) ATH_MSG_DEBUG( "Something wrong with finding top quark pT"); - else{ - - ATH_MSG_DEBUG(" found the top quarks "); - m_aan_NumTopQ = 2; - m_aan_pTtop1 = pTtop1; - m_aan_pTtop2 = pTtop2; - } - } - else {m_aan_NumTopQ=0; m_aan_pTtop1 = -10; m_aan_pTtop2 = -10;} - - /** loop over jet container after overlap removal */ - - const JetCollection* finalStateJetTES = m_analysisOverlapRemovalTool->finalStateJets(); - if ( !finalStateJetTES ) { - ATH_MSG_WARNING( "SusyStudies: Final State Particle Jets Not Found "); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG( "SusyStudies: Final State Jets successfully retrieved - size is " << finalStateJetTES->size() << " jets "); - - double w_cmb=-100; - JetCollection::const_iterator jetItr_fin = finalStateJetTES->begin(); - JetCollection::const_iterator jetItrE_fin = finalStateJetTES->end(); - for (; jetItr_fin != jetItrE_fin; ++jetItr_fin) { - - CLHEP::HepLorentzVector p4((*jetItr_fin)->px(), - (*jetItr_fin)->py(), - (*jetItr_fin)->pz(), - (*jetItr_fin)->e()); - - /** variables for the ntuple */ - m_aan_njets++; - if(fabs(p4.pseudoRapidity()) < m_bjet_etaCut ) m_aan_njets_etaLT25++; - if(p4.et()> m_SusyJetMinEt ) m_aan_njets_SusyETCut++; - - m_aan_JetEta->push_back((*jetItr_fin)->eta()); - m_aan_JetEt->push_back(p4.et()); - - w_cmb = -100; - if(p4.et() > m_bjet_etCut && fabs(p4.pseudoRapidity()) < m_bjet_etaCut) { - w_cmb = (*jetItr_fin)->getFlavourTagWeight();} // weight for IP3DSV1 - m_aan_JetBTagWt->push_back(w_cmb); - - m_aan_ht += p4.et(); // scalar sum of jet ET - if(p4.et()>m_aan_maxJetET) m_aan_maxJetET = p4.et(); // Jet with max ET - - } // loop over jets - - /** Get final state leptons. We need these in the determination of effective mass - We should also store the leptons in the ntuple, so that we can re-do the calculation later */ - - /** First do electrons */ - - const ElectronContainer* finalStateElecTES = m_analysisOverlapRemovalTool->finalStateElectrons(); - if ( !finalStateElecTES ) { - - ATH_MSG_WARNING( "SusyStudies: Final State Electrons Not Found "); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG( "SusyStudies: Final State Electrons successfully retrieved - size is " << finalStateElecTES->size() << " electrons "); - - - /** iterators over the electron container - final state */ - ElectronContainer::const_iterator felecItr = finalStateElecTES->begin(); - ElectronContainer::const_iterator felecItrE = finalStateElecTES->end(); - - double sum_elET=0; - - for (; felecItr != felecItrE; ++felecItr) { - - /** apply further selections if necessary */ - /** check for the author of the electron */ - bool author = (*felecItr)->author(egammaParameters::AuthorElectron); - if ( !author || (*felecItr)->pt() < m_etElecCut ) continue; - - - const EMShower* eshow = (*felecItr)->detail<EMShower>("egDetailAOD"); - double etisol = -1; - if( eshow ) etisol = eshow->parameter(egammaParameters::etcone20); - - ATH_MSG_DEBUG( "SusyStudies:isEM/etisol "<< (*felecItr)->isem()<<","<<etisol); - - m_aan_NFinalEl++; - m_aan_FinalElPt->push_back((*felecItr)->pt()); - m_aan_FinalElEta->push_back((*felecItr)->eta()); - m_aan_FinalElEtCone20->push_back(etisol); - - /** isEM cut already picks out isolated electrons, so this is just a sanity check */ - if(etisol<10*GeV) sum_elET += (*felecItr)->pt(); - } - - - /** Now look at muons */ - - const MuonContainer* finalStateMuonTES = m_analysisOverlapRemovalTool->finalStateMuons(); - if ( !finalStateMuonTES ) { - - ATH_MSG_WARNING( "SusyStudies: Final State Muons Not Found "); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG( "SusyStudies: Final State Muons successfully retrieved - size is " << finalStateMuonTES->size() << " muons "); - - - /** iterators over the muon container - final state */ - MuonContainer::const_iterator fmuonItr = finalStateMuonTES->begin(); - MuonContainer::const_iterator fmuonItrE = finalStateMuonTES->end(); - - double sum_muET = 0; - - for (; fmuonItr != fmuonItrE; ++fmuonItr) { - - /** apply further selections if necessary */ - /** check for the author of the muon */ - - double etIsol = (*fmuonItr)->parameter( static_cast<MuonParameters::ParamDef>(1) ); // dR of 0.2 - - ATH_MSG_DEBUG( "SusyStudies:Muon etisol/best match "<< etIsol<<","<<(*fmuonItr)->bestMatch()); - - m_aan_NFinalMu++; - m_aan_FinalMuPt->push_back( (*fmuonItr)->pt()); - m_aan_FinalMuEta->push_back( (*fmuonItr)->eta()); - m_aan_FinalMuEtCone20->push_back( etIsol); - m_aan_FinalMuBestMat->push_back( (*fmuonItr)->bestMatch()); - m_aan_FinalMuMatChi2->push_back((*fmuonItr)->matchChi2()); - - /** require bestMatch, chi2 and isolation cuts */ - if((*fmuonItr)->bestMatch()==1 && (*fmuonItr)->matchChi2() <100. && etIsol < 10*GeV) sum_muET +=(*fmuonItr)->pt(); - - } - - ATH_MSG_DEBUG( "SusyStudies: here "); - - /** now calculate effmass */ - m_aan_FinalLepEtSum = sum_elET + sum_muET; // keep leptons separate for now. - m_aan_FinalElEtSum = sum_elET; - m_aan_FinalMuEtSum = sum_muET; - - m_aan_effmass = m_aan_ptMiss + m_aan_ht; // scalar sum of jet ET + missing ET - - ATH_MSG_DEBUG( "SusyStudies: here now "); - - return sc; - -} -StatusCode AnalysisSkeleton::getTopQpT(int& numTops, double& top1, double& top2) { - - ATH_MSG_DEBUG( "in getTopQpT()"); - - // - top1 = -1; top2 = -1; - // - double topPt[2]; - topPt[0]=-1; - topPt[1]=-1; - // - /** get the MC truth particle AOD container from StoreGate */ - - const TruthParticleContainer* mcpartTES = 0; - StatusCode sc=evtStore()->retrieve( mcpartTES, m_truthParticleContainerName); - if( sc.isFailure() || !mcpartTES ) { - ATH_MSG_WARNING("No AOD MC truth particle container found in TDS"); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG("MC Truth Container Successfully Retrieved"); - - /** loop over particles and get the top quarks produced at the hard scatter */ - - TruthParticleContainer::const_iterator mcpItr = mcpartTES->begin(); - TruthParticleContainer::const_iterator mcpItrE = mcpartTES->end(); - - numTops=0; - for (; mcpItr != mcpItrE; ++mcpItr) { - - const HepMC::GenParticle* part =(*mcpItr)->genParticle(); - int pdgid = part->pdg_id(); - - if(numTops==2) break; // quit if we have two already - - if(abs(pdgid)==6) { // it is a top - - HepMC::GenVertex* prod_vtx = part->production_vertex(); - int vtx_barcode = 1; - if(prod_vtx) vtx_barcode = HepMC::barcode(prod_vtx); - - if(vtx_barcode == -1) { - - topPt[numTops] = (part->momentum()).perp(); - numTops++; - - } - - - } - } - - top1 = topPt[0]; - top2 = topPt[1]; - return StatusCode::SUCCESS; -} -//////////////////////////////////////////////////////////// -// here we get event Information and store it in our new ntuple -// In the old days, when we inherited from CBNT_AthenaAwareBase, this information was put in the -// ntuple by default -//////////////////////////////////////////////////////// -StatusCode AnalysisSkeleton::addEventInfo() { - - - ATH_MSG_DEBUG( "in addEventInfo"); - - // this code has been taken from AnalysisExamples/VFitZmmOnAOD - // I have the actual EventNumber, but skipped the sequential count of event # - // - - //get EventInfo for run and event number - - const xAOD::EventInfo* eventInfo; - StatusCode sc = evtStore()->retrieve(eventInfo); - - if (sc.isFailure()) - { - ATH_MSG_WARNING("Could not retrieve event info"); - return sc; - } - - // - m_runNumber=eventInfo->runNumber(); - m_eventNumber=eventInfo->eventNumber(); - ATH_MSG_DEBUG( "event "<<m_eventNumber); - - m_eventTime=eventInfo->timeStamp() ; - m_lumiBlock=eventInfo->lumiBlock() ; - m_bCID=eventInfo->bcid(); - m_eventWeight=eventInfo->mcEventWeight(); - - /* - // see code in triggerSkeleton() - // - const TriggerInfo* myTriggerInfo=eventInfo->trigger_info(); - if (myTriggerInfo!=0) { - m_lVL1ID=myTriggerInfo->extendedLevel1ID(); - m_statusElement=myTriggerInfo->statusElement(); - m_lvl1TriggerType=myTriggerInfo->level1TriggerType(); - - std::vector<TriggerInfo::number_type>::const_iterator lvl1TrigIt=myTriggerInfo->level1TriggerInfo().begin(); - std::vector<TriggerInfo::number_type>::const_iterator lvl1TrigIt_e=myTriggerInfo->level1TriggerInfo().end(); - for (;lvl1TrigIt!=lvl1TrigIt_e;lvl1TrigIt++) - m_lvl1TriggerInfo->push_back(*lvl1TrigIt); - - - std::vector<TriggerInfo::number_type>::const_iterator lvl2TrigIt=myTriggerInfo->level2TriggerInfo().begin(); - std::vector<TriggerInfo::number_type>::const_iterator lvl2TrigIt_e=myTriggerInfo->level2TriggerInfo().end(); - for (;lvl2TrigIt!=lvl2TrigIt_e;lvl2TrigIt++) - m_lvl2TriggerInfo->push_back(*lvl2TrigIt); - - std::vector<TriggerInfo::number_type>::const_iterator evtFilterIt=myTriggerInfo->eventFilterInfo().begin(); - std::vector<TriggerInfo::number_type>::const_iterator evtFilterIt_e=myTriggerInfo->eventFilterInfo().end(); - for (;evtFilterIt!=evtFilterIt_e;evtFilterIt++) - m_evtFilterInfo->push_back(*evtFilterIt); - - - std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt=myTriggerInfo->streamTags().begin(); - std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt_e=myTriggerInfo->streamTags().end(); - for (;streamInfoIt!=streamInfoIt_e;streamInfoIt++) { - m_streamTagName->push_back(streamInfoIt->name()); - m_streamTagType->push_back(streamInfoIt->type()); - } - - }else - { - m_lVL1ID=0; - m_statusElement=0; - m_lvl1TriggerType=0; - } - */ - - return StatusCode::SUCCESS; - -} - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/components/UserAnalysis_entries.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/components/UserAnalysis_entries.cxx deleted file mode 100644 index cd03c0c28cbc9e4aafd74c51ee91982a07c7b962..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/components/UserAnalysis_entries.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include "UserAnalysis/AnalysisSkeleton.h" - - -DECLARE_COMPONENT( AnalysisSkeleton ) - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/CMakeLists.txt deleted file mode 100644 index 6b19dffd7c5e0443319c0d005bcd5f203c209923..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# $Id: CMakeLists.txt 773457 2016-09-15 13:17:29Z krasznaa $ -################################################################################ -# Package: UserAnalysisUtils -################################################################################ - -# Declare the package name: -atlas_subdir( UserAnalysisUtils ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Calorimeter/CaloEvent - Control/AthenaBaseComps - Control/AthContainers - Event/NavFourMom - GaudiKernel - PhysicsAnalysis/AnalysisCommon/AnalysisTools - Reconstruction/Jet/JetEvent - Reconstruction/MissingETEvent - Reconstruction/MuonIdentification/muonEvent - Reconstruction/Particle - Reconstruction/egamma/egammaEvent - Reconstruction/tauEvent - Tracking/TrkEvent/TrkSegment - Tracking/TrkEvent/VxVertex ) - -# External dependencies: -find_package( CLHEP ) - -# Component(s) in the package: -atlas_add_library( UserAnalysisUtilsLib - UserAnalysisUtils/*.h src/*.cxx - PUBLIC_HEADERS UserAnalysisUtils - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES CaloEvent AthenaBaseComps NavFourMom GaudiKernel JetEvent - MissingETEvent muonEvent Particle egammaEvent tauEvent TrkSegment VxVertex - AthAnalysisToolsLib - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ) - -atlas_add_component( UserAnalysisUtils - src/components/*.cxx - LINK_LIBRARIES UserAnalysisUtilsLib ) - -# Install files from the package: -atlas_install_joboptions( share/*.py ) diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h deleted file mode 100644 index 487477ea76407bd53b624e286b9a33a66eb6d3af..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef USERANALYSISUTILS_USERANALYSISOVERLAPCHECKINGTOOL_H -#define USERANALYSISUTILS_USERANALYSISOVERLAPCHECKINGTOOL_H - -/***************************************************************************** -Name : UserAnalysisOverlapCheckingTool.h -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User tools for checking overlaps at deltaR, TrackParticle/Cluster and Hit/Cell levels -*****************************************************************************/ - -//#include "GaudiKernel/AlgTool.h" -//#include "GaudiKernel/MsgStream.h" -//#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -#include "VxVertex/VxContainer.h" -#include "Particle/TrackParticleContainer.h" -#include "CaloEvent/CaloClusterContainer.h" -#include "TrkSegment/SegmentCollection.h" - -#include "muonEvent/MuonContainer.h" -#include "egammaEvent/ElectronContainer.h" -#include "egammaEvent/PhotonContainer.h" -#include "tauEvent/TauJetContainer.h" -#include "JetEvent/JetCollection.h" -#include "MissingETEvent/MissingET.h" - -#include "NavFourMom/IParticleContainer.h" -#include "NavFourMom/INavigable4MomentumCollection.h" - -#include "AnalysisTools/AnalysisTools.h" - -#include <string> -#include <map> -#include <vector> - -class MsgStream; - -/** Interface ID */ -static const InterfaceID IID_UserAnalysisOverlapCheckingTool("UserAnalysisOverlapCheckingTool", 1, 0); - -class UserAnalysisOverlapCheckingTool : public AthAlgTool { - -public: - - /** Standard Constructor */ - UserAnalysisOverlapCheckingTool(const std::string& type, const std::string& name, - const IInterface* parent); - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_UserAnalysisOverlapCheckingTool; }; - - /** Overriding initialize, finalize, and execute */ - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - /** overlaps */ - template<class Object1, class Object2> - bool overlap(const Object1* object1, const Object2* object2) const ; - - template<class Object1, class Object2> - bool overlap(const Object1* object1, const Object2* object2, double& deltaR) const ; - -private: - - - /** get a handle to the tool helper */ - ToolHandle<AnalysisTools> m_analysisTools; - - /** deltaR overlap */ - double m_deltaR; - double m_deltaRWithJets; - -}; - -/** check for oeverlap in deltaR and return as well the deltaR value */ -template<class Object1, class Object2> -inline bool UserAnalysisOverlapCheckingTool::overlap(const Object1* object1, - const Object2* object2) const { - double dr=-1.0; - bool areOverlapping = false; - areOverlapping = this->overlap( object1, object2, dr); - - return areOverlapping; -} - -template<class Object1, class Object2> -inline bool UserAnalysisOverlapCheckingTool::overlap(const Object1* object1, - const Object2* object2, - double& deltaR) const -{ - deltaR=1000.0; - bool areOverlapping = false; - if ( object1 && object2) { - deltaR = m_analysisTools->deltaR( object1, object2 ); - areOverlapping = deltaR < m_deltaR; - const Jet * jet1 = dynamic_cast<const Jet*> (object1); - const Jet * jet2 = dynamic_cast<const Jet*> (object2); - if ( jet1 || jet2 ) areOverlapping = deltaR < m_deltaRWithJets; - } - return areOverlapping; -} - -#endif // USERANALYSISUTILS_USERANALYSISOVERLAPCHECKINGTOOL_H - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisOverlapRemovalTool.h b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisOverlapRemovalTool.h deleted file mode 100644 index 2288cf2ecc670a858f915035604d695fb616bb7d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisOverlapRemovalTool.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef USERANALYSISUTILS_USERANALYSISOVERLAPREMOVALTOOL_H -#define USERANALYSISUTILS_USERANALYSISOVERLAPREMOVALTOOL_H - -/***************************************************************************** -Name : UserAnalysisOverlapRemovalTool.h -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User tools for analyis overlap removal on ESD/AOD/DPD in Athena - - do overlap removal given a set of containers - - Return lists of non-overlapping Particles, leptons, etc - - Call overlap checking tools down do cell and hit level -*****************************************************************************/ - -//#include "GaudiKernel/AlgTool.h" -//#include "GaudiKernel/MsgStream.h" -//#include "StoreGate/StoreGateSvc.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - -#include "UserAnalysisUtils/UserAnalysisSelectionTool.h" -#include "UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h" - -#include "VxVertex/VxContainer.h" -#include "Particle/TrackParticleContainer.h" -#include "CaloEvent/CaloClusterContainer.h" -#include "TrkSegment/SegmentCollection.h" - -#include "muonEvent/MuonContainer.h" -#include "egammaEvent/ElectronContainer.h" -#include "egammaEvent/PhotonContainer.h" -#include "tauEvent/TauJetContainer.h" -#include "JetEvent/JetCollection.h" -#include "MissingETEvent/MissingET.h" - -#include "NavFourMom/IParticleContainer.h" -#include "NavFourMom/INavigable4MomentumCollection.h" -#include "AthContainers/ConstDataVector.h" - -#include <string> -#include <map> -#include <vector> - -class MsgStream; - -/** Interface ID */ -static const InterfaceID IID_UserAnalysisOverlapRemovalTool("UserAnalysisOverlapRemovalTool", 1, 0); - -class UserAnalysisOverlapRemovalTool : public AthAlgTool { - -public: - - /** Standard Constructor */ - UserAnalysisOverlapRemovalTool(const std::string& type, const std::string& name, - const IInterface* parent); - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_UserAnalysisOverlapRemovalTool; }; - - /** Overriding initialize, finalize, and execute */ - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /** access to containers after preparation */ - const INavigable4MomentumCollection * finalStateObjects(); - const PhotonContainer * finalStatePhotons(); // including converted photons - const ElectronContainer * finalStateElectrons(); - const Analysis::MuonContainer * finalStateMuons(); - const INavigable4MomentumCollection * finalStateLeptons(); // Electrons or Muons - const Analysis::TauJetContainer * finalStateTauJets(); - const JetCollection * finalStateJets(); - const JetCollection * finalStateBJets(); - const JetCollection * finalStateLightJets(); - const Rec::TrackParticleContainer * finalStateTrackParticles(); - const CaloClusterContainer * finalStateCaloClusters(); - - /** summary of pre-selections and overlap removal - will be called at the end of the job - in the finalize of this tool - the first number is reconstrued and the second is the pre-selected */ - void summarize(); - const std::pair<unsigned int, unsigned int>& electronSummary() const; - const std::pair<unsigned int, unsigned int>& photonSummary() const; - const std::pair<unsigned int, unsigned int>& muonSummary() const; - const std::pair<unsigned int, unsigned int>& tauJetSummary() const; - const std::pair<unsigned int, unsigned int>& jetSummary() const; - const std::pair<unsigned int, unsigned int>& bJetSummary() const; - const std::pair<unsigned int, unsigned int>& lightJetSummary() const; - const std::pair<unsigned int, unsigned int>& trackParticleSummary() const; - const std::pair<unsigned int, unsigned int>& caloClusterSummary() const; - - /** check if execute() is already called for this tool in this job for this event */ - bool isExecuted(); - -private: - struct Vectors { - ConstDataVector<INavigable4MomentumCollection>* m_outputParticles; - ConstDataVector<INavigable4MomentumCollection>* m_outputLeptons; - ConstDataVector<ElectronContainer>* m_outputElectrons; - ConstDataVector<PhotonContainer>* m_outputPhotons; - ConstDataVector<Analysis::MuonContainer>* m_outputMuons; - ConstDataVector<Analysis::TauJetContainer>* m_outputTauJets; - ConstDataVector<JetCollection>* m_outputJets; - ConstDataVector<JetCollection>* m_outputBJets; - ConstDataVector<JetCollection>* m_outputLightJets; - ConstDataVector<Rec::TrackParticleContainer>* m_outputTrackParticles; - ConstDataVector<CaloClusterContainer>* m_outputCaloClusters; - }; - - /** container preparation */ - StatusCode prepareContainers(Vectors& v); - StatusCode electronPreparation( Vectors& v, std::string key ); - StatusCode photonPreparation( Vectors& v, std::string key ); - StatusCode muonPreparation( Vectors& v, std::string key ); - StatusCode tauJetPreparation( Vectors& v, std::string key ); - StatusCode jetPreparation( Vectors& v, std::string key ); - StatusCode trackParticlePreparation( Vectors& v, std::string key ); - StatusCode caloClusterPreparation( Vectors& v, std::string key ); - StatusCode lockContainers(); - - /** for debugging purposes - called if MSG_Level = DEBUG */ - void print(); - -private: - - INavigable4MomentumCollection * allParticles(); - INavigable4MomentumCollection * allLeptons(); - PhotonContainer * allPhotons(); // including converted photons - ElectronContainer * allElectrons(); - Analysis::MuonContainer * allMuons(); - Analysis::TauJetContainer * allTauJets(); - JetCollection * allJets(); - JetCollection * allBJets(); - JetCollection * allLightJets(); - Rec::TrackParticleContainer * allTrackParticles(); - CaloClusterContainer * allCaloClusters(); - -private: - - /** a handle on selection and on overlap checking */ - ToolHandle <UserAnalysisSelectionTool> m_userSelectionTool; - ToolHandle <UserAnalysisOverlapCheckingTool> m_userOverlapCheckingTool; - - /** should contain the StoreGate keys to be passed in job options */ - std::vector<std::string> m_inputContainerKeys; - - /** number of various particles <before selection, after selection> - used in the summarize() method print summary information */ - std::pair<unsigned int, unsigned int> m_numElectrons; - std::pair<unsigned int, unsigned int> m_numPhotons; - std::pair<unsigned int, unsigned int> m_numMuons; - std::pair<unsigned int, unsigned int> m_numTauJets; - std::pair<unsigned int, unsigned int> m_numJets; - std::pair<unsigned int, unsigned int> m_numBJets; - std::pair<unsigned int, unsigned int> m_numLightJets; - std::pair<unsigned int, unsigned int> m_numTrackParticles; - std::pair<unsigned int, unsigned int> m_numCaloClusters; - - /** output collection prefix and keys - the output collection key are built form the inputCollectionKeys with the prefix appended - the use can set the prefix in the job options */ - std::string m_outputObjectKey; - std::string m_outputLeptonKey; - std::string m_outputElectronKey; - std::string m_outputPhotonKey; - std::string m_outputMuonKey; - std::string m_outputTauJetKey; - std::string m_outputJetKey; - std::string m_outputBJetKey; - std::string m_outputLightJetKey; - std::string m_outputTrackParticleKey; - std::string m_outputCaloClusterKey; - - /** is ATLFAST data */ - bool m_isAtlfast; - - /** remove overlay in same container */ - bool m_removeOverlapInSameContainer; -}; - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::electronSummary() const -{ - return m_numElectrons; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::photonSummary() const -{ - return m_numPhotons; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::muonSummary() const -{ - return m_numMuons; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::tauJetSummary() const -{ - return m_numTauJets; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::jetSummary() const -{ - return m_numJets; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::bJetSummary() const -{ - return m_numBJets; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::lightJetSummary() const -{ - return m_numLightJets; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::trackParticleSummary() const -{ - return m_numTrackParticles; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisOverlapRemovalTool::caloClusterSummary() const -{ - return m_numCaloClusters; -} - -#endif // USERANALYSISUTILS_USERANALYSISOVERLAPREMOVALTOOL_H - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisPreparationTool.h b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisPreparationTool.h deleted file mode 100644 index e3102555ec7e4eba17ffd1b825180cef568cefb7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisPreparationTool.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef USERANALYSISUTILS_USERANALYSISPREPARATIONTOOL_H -#define USERANALYSISUTILS_USERANALYSISPREPARATIONTOOL_H - -/***************************************************************************** -Name : UserAnalysisPreparationTool.h -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User tools for analyis preparation on ESD/AOD/DPD in Athena - - selections - - write out contianer of selected particles to StoreGate -*****************************************************************************/ - -//#include "GaudiKernel/AlgTool.h" -//#include "GaudiKernel/MsgStream.h" -//#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "UserAnalysisUtils/UserAnalysisSelectionTool.h" - -#include "VxVertex/VxContainer.h" -#include "Particle/TrackParticleContainer.h" -#include "CaloEvent/CaloClusterContainer.h" -#include "TrkSegment/SegmentCollection.h" - -#include "muonEvent/MuonContainer.h" -#include "egammaEvent/ElectronContainer.h" -#include "egammaEvent/PhotonContainer.h" -#include "tauEvent/TauJetContainer.h" -#include "JetEvent/JetCollection.h" -#include "MissingETEvent/MissingET.h" - -#include "NavFourMom/IParticleContainer.h" -#include "NavFourMom/INavigable4MomentumCollection.h" - -#include <string> -#include <map> -#include <vector> - -class MsgStream; - -/** Interface ID */ -static const InterfaceID IID_UserAnalysisPreparationTool("UserAnalysisPreparationTool", 1, 0); - -class UserAnalysisPreparationTool : public AthAlgTool { - -public: - - /** Standard Constructor */ - UserAnalysisPreparationTool(const std::string& type, const std::string& name, - const IInterface* parent); - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_UserAnalysisPreparationTool; }; - - /** Overriding initialize, finalize, and execute */ - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /** access to containers after preparation */ - const ElectronContainer * selectedElectrons(); - const PhotonContainer * selectedPhotons(); - const Analysis::MuonContainer * selectedMuons(); - const Analysis::TauJetContainer * selectedTauJets(); - const JetCollection * selectedJets(); - const Rec::TrackParticleContainer * selectedTrackParticles(); - const CaloClusterContainer * selectedCaloClusters(); - - /** summary of pre-selections and overlap removal - will be called at the end of the job - in the finalize of this tool - the first number is reconstrued and the second is the pre-selected */ - void summarize(); - const std::pair<unsigned int, unsigned int>& electronSummary() const; - const std::pair<unsigned int, unsigned int>& photonSummary() const; - const std::pair<unsigned int, unsigned int>& muonSummary() const; - const std::pair<unsigned int, unsigned int>& tauJetSummary() const; - const std::pair<unsigned int, unsigned int>& jetSummary() const; - const std::pair<unsigned int, unsigned int>& trackParticleSummary() const; - const std::pair<unsigned int, unsigned int>& caloClusterSummary() const; - -private: - - /** container preparation */ - StatusCode electronPreparation( std::string key ); - StatusCode photonPreparation( std::string key ); - StatusCode muonPreparation( std::string key ); - StatusCode tauJetPreparation( std::string key ); - StatusCode jetPreparation( std::string key ); - StatusCode trackParticlePreparation( std::string key ); - StatusCode caloClusterPreparation( std::string key ); - - /** for debugging purposes - called if MSG_Level = DEBUG */ - void print(); - -private: - - /** a handle on selection */ - ToolHandle <UserAnalysisSelectionTool> m_userSelectionTool; - - /** should contain the StoreGate keys to be passed in job options */ - std::vector<std::string> m_inputContainerKeys; - - /** number of various particles <before selection, after selection> - used in the summarize() method print summary information */ - std::pair<unsigned int, unsigned int> m_numElectrons; - std::pair<unsigned int, unsigned int> m_numPhotons; - std::pair<unsigned int, unsigned int> m_numMuons; - std::pair<unsigned int, unsigned int> m_numTauJets; - std::pair<unsigned int, unsigned int> m_numJets; - std::pair<unsigned int, unsigned int> m_numTrackParticles; - std::pair<unsigned int, unsigned int> m_numCaloClusters; - - /** output collection prefix and keys - the output collection key are built form the inputCollectionKeys with the prefix appended - the use can set the prefix in the job options */ - std::vector<std::string> m_outputContainerKeys; - std::string m_outputElectronKey; - std::string m_outputPhotonKey; - std::string m_outputMuonKey; - std::string m_outputTauJetKey; - std::string m_outputJetKey; - std::string m_outputTrackParticleKey; - std::string m_outputCaloClusterKey; - - /** is ATLFAST data */ - bool m_isAtlfast; - - /** on first event */ - bool m_first; - -}; - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::electronSummary() const -{ - return m_numElectrons; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::photonSummary() const -{ - return m_numPhotons; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::muonSummary() const -{ - return m_numMuons; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::tauJetSummary() const -{ - return m_numTauJets; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::jetSummary() const -{ - return m_numJets; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::trackParticleSummary() const -{ - return m_numTrackParticles; -} - -inline const std::pair<unsigned int, unsigned int>& UserAnalysisPreparationTool::caloClusterSummary() const -{ - return m_numCaloClusters; -} - -#endif // USERANALYSISUTILS_USERANALYSISPREPARATIONTOOL_H - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisSelectionTool.h b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisSelectionTool.h deleted file mode 100644 index be68d1828d152078e80f2797f48177898de6d1c1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/UserAnalysisUtils/UserAnalysisSelectionTool.h +++ /dev/null @@ -1,128 +0,0 @@ -// Dear emacs, this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: UserAnalysisSelectionTool.h 773457 2016-09-15 13:17:29Z krasznaa $ -#ifndef USERANALYSISUTILS_USERANALYSISSELECTIONTOOL_H -#define USERANALYSISUTILS_USERANALYSISSELECTIONTOOL_H - -/***************************************************************************** -Name : UserAnalysisSelectionTool.h -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User tools for analyis preparation on ESD/AOD/DPD in Athena - selections - - Take a list of input containers - - Call the selections tools to see is containee passed selection - - if passed selection put containee in a new container -*****************************************************************************/ - -// System include(s): -#include <string> - -// Gaudi/Athena include(s): -#include "AthenaBaseComps/AthAlgTool.h" - -// Forward declaration(s): -namespace Analysis { - class Electron; - class Photon; - class Muon; - class TauJet; -} -namespace Rec { - class TrackParticle; -} -class Jet; -class CaloCluster; - -/** Interface ID */ -static const InterfaceID -IID_UserAnalysisSelectionTool( "UserAnalysisSelectionTool", 1, 0 ); - -class UserAnalysisSelectionTool : public AthAlgTool { - -public: - /** Standard Constructor */ - UserAnalysisSelectionTool( const std::string& type, const std::string& name, - const IInterface* parent ); - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { - return IID_UserAnalysisSelectionTool; - } - - /** Overriding initialize */ - virtual StatusCode initialize(); - - /// @name Pre-selections - /// @{ - - bool isSelected( const Analysis::Electron* electron ) const; - bool isSelected( const Analysis::Photon* photon ) const; - bool isSelected( const Analysis::Muon* muon ) const; - bool isSelected( const Analysis::TauJet* tauJet ) const; - bool isSelected( const Jet* jet ) const; - bool isSelected( const Rec::TrackParticle* trackParticle ) const; - bool isSelected( const CaloCluster* caloCluster ) const; - - bool isBJet( const Jet* jet ) const; - - /// @} - -private: - /** this is Atlfast data */ - bool m_isAtlfast; - - /** Electron selection */ - double m_electronPt; - double m_electronEta; - std::string m_egDetailContainerName; - std::string m_electronIsEMFlag; - int m_electronIsEM; - int m_electronIsolationConeIndex; - bool m_doElectronIsolation; - bool m_authorEgammaOnly; - bool m_electronEtaWindCut;/// apply (or not) eta cut in bad region window - double m_electronEtaWind; /// width of window - double m_electronEtaWindCent; /// center of window - double m_electronIsolationEt; - double m_normElectronIsolEt; // normalised electron isolation ET: EtCone/Pt - - /** Photon selection */ - double m_photonPt; - double m_photonEta; - double m_photonIsEM; - - /** Muon selection */ - double m_muonPt; - double m_muonEta; - bool m_doMuonIsolation; - int m_muonIsolationConeIndex; - double m_muonIsolationEt; - bool m_useMatchChi2; - double m_muonMatchChi2; - double m_normMuonIsolEt; // normalised muon isolation ET: EtCone/Pt - - /** TauJet selection */ - double m_tauJetPt; - double m_tauJetEta; - double m_tauJetLikelihood; - double m_tauEleBDTCut; - - /** Jet selection */ - double m_jetPt; - double m_jetEta; - double m_bJetLikelihood; - - /** caloCluster selection */ - double m_caloClusterE; - - /** TrackParticle selection */ - double m_trackParticlePt; - -}; // class UserAnalysisSelectionTool - -#endif // USERANALYSISUTILS_USERANALYSISSELECTIONTOOL_H diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisOverlapCheckingTool_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisOverlapCheckingTool_jobOptions.py deleted file mode 100644 index 9fb0c7f942d892c2617226773c4a3f097dec1410..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisOverlapCheckingTool_jobOptions.py +++ /dev/null @@ -1,13 +0,0 @@ -include.block( "UserAnalysisUtils/UserAnalysisOverlapCheckingTool_jobOptions.py" ) - -from UserAnalysisUtils.UserAnalysisUtilsConf import \ - UserAnalysisOverlapCheckingTool as ConfiguredUserAnalysisOverlapCheckingTool -UserAnalysisOverlapCheckingTool = ConfiguredUserAnalysisOverlapCheckingTool( - - OverlapDeltaR=0.2, - OverlapDeltaRWithJets=0.3 - - ) - -ToolSvc += UserAnalysisOverlapCheckingTool -print UserAnalysisOverlapCheckingTool diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisOverlapRemovalTool_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisOverlapRemovalTool_jobOptions.py deleted file mode 100644 index 46a66b6c6c114624ce81552e0982d7c01b42fbd4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisOverlapRemovalTool_jobOptions.py +++ /dev/null @@ -1,57 +0,0 @@ -include.block( "UserAnalysisUtils/UserAnalysisOverlapRemovalTool_jobOptions.py" ) - -# the user selection tools to use -# they are only used here to check if a jet is a b-jet or not -include ( "UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py" ) - -# the user Overlap Checking tools to use -include ( "UserAnalysisUtils/UserAnalysisOverlapCheckingTool_jobOptions.py" ) - -from UserAnalysisUtils.UserAnalysisUtilsConf import \ - UserAnalysisOverlapRemovalTool as ConfiguredUserAnalysisOverlapRemovalTool -UserAnalysisOverlapRemovalTool = ConfiguredUserAnalysisOverlapRemovalTool( - - # define the pre-selection tools - used here only to check if a jet is a b-jet - UserSelectionTool = UserAnalysisSelectionTool, - - # Whether to check overlap in same container or not. - # For example, muon overlapping with muon? - # Currently when set to False, it applies to all contianers. - RemoveOverlapInSameContainer = True, - - # define the overlap checking tools - UserOverlapCheckingTool = UserAnalysisOverlapCheckingTool, - - # thelist of the input container keys - the order is important: the overlap removing will be done in that order - - InputContainerKeys=[ "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ], - - - IsAtlfastData=False, # set this to true if running on Atlfast AOD - # Only deltaR overlap removal is done for Atlfast, no cluster/TrackParticle overlap - # and Cell/Hit overlap not done in the case of Atlfast - - # the list of the output container keys - - OuputObjectKey = "FinalStateObjectCollection", - OutputLeptonKey = "FinalStateLeptonCollection", - OutputPhotonKey = "FinalStatePhotonCollection", - OutputElectronKey = "FinalStateElectronCollection", - OutputMuonKey = "FinalStateMuonCollection", - OutputTauJetKey = "FinalStateTauJetCollection", - OutputCalloClusterKey = "FinalStateCaloClusterCollection", - OutputTrackParticleKey = "FinalStateTrackParticleCollection", - OutputJetKey = "FinalStateJetCollection", - OutputBJetKey = "FinalStateBJetCollection", - OutputLightJetKey = "FinalStateLightJetCollection" - - ) - -ToolSvc += UserAnalysisOverlapRemovalTool -print UserAnalysisOverlapRemovalTool diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisPreparationTool_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisPreparationTool_jobOptions.py deleted file mode 100644 index 6e6f523648411f0542946aa2d665ca24bf38f700..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisPreparationTool_jobOptions.py +++ /dev/null @@ -1,40 +0,0 @@ -include.block( "UserAnalysisUtils/UserAnalysisPreparationTool_jobOptions.py" ) - -# the user selection tools to use -include ( "UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py" ) - -from UserAnalysisUtils.UserAnalysisUtilsConf import \ - UserAnalysisPreparationTool as ConfiguredUserAnalysisPreparationTool -UserAnalysisPreparationTool = ConfiguredUserAnalysisPreparationTool( - - # define the pre-selection tools - UserSelectionTool = UserAnalysisSelectionTool, - - # thelist of the input container keys - the order does not matter - InputContainerKeys=[ "ElectronAODCollection", - "StacoMuonCollection", - "TauRecContainer", - "AntiKt4TowerJets", - "PhotonAODCollection", - "CaloCalTopoCluster", - "TrackParticleCandidate" - ], - - - IsAtlfastData=False, # set this to true if running on Atlfast AOD - some of the cuts are not used in this case - - # the list of the output container keys - these containers container the selected objects - # The order matter::Should follow the same order as the input container keys above - OutputContainerKeys=[ "SelectedElectronCollection", - "SelectedStacoMuonCollection", - "SelectedTauRecContainer", - "SelectedAntiKt4TowerJets", - "SelectedPhotonAODCollection", - "SelectedCaloCalTopoCluster", - "SelectedTrackParticleCandidate" - ] - - ) - -ToolSvc += UserAnalysisPreparationTool -print UserAnalysisPreparationTool diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisSelectionTool_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisSelectionTool_jobOptions.py deleted file mode 100644 index cddf3fd2c714f96e7f09fda526fd4593d38683cb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/share/UserAnalysisSelectionTool_jobOptions.py +++ /dev/null @@ -1,52 +0,0 @@ -include.block( "UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py" ) - -from UserAnalysisUtils.UserAnalysisUtilsConf import \ - UserAnalysisSelectionTool as ConfiguredUserSelectionTool -UserAnalysisSelectionTool = ConfiguredUserSelectionTool( - - - IsAtlfastData=False, # set this to true if running on Atlfast AOD - some of the cuts are not used in this case - - CaloClusterE=5.0*GeV, - - TrackParticlePt=1.0*GeV, - - ElectronPt=7.0*GeV, - ElectronEta=2.5, - ElectronIsEMFlag="Medium", #Loose/Medium/Tight - ElectronIsEM=0xffffff, #or set the IsEM value yourself - AuthorEgammaOnly=True, - ElectronEtaWindowCut=False, - ElectronEtaWindowCenter=1.445, - ElectronEtaWindow=0.075, - DoElectronIsolation=True, - ElectronIsolationConeIndex=3, #0-4 for dR=0.1, 0.2, 0.3, and 0.4 - ElectronIsolationEt=10.0*GeV, - NormalizedElectronIsolationEt=0.2, - - PhotonPt=10.0*GeV, - PhotonEta=3.2, - PhotonIsEM=0, - - MuonPt=6.0*GeV, - MuonEta=2.7, - DoMuonIsolation=True, - MuonIsolationConeIndex=3, # 0-4 for dR=0.1, 0.2, 0.3, and 0.4 - MuonIsolationEt=10*GeV, - NormalizedMuonIsolationEt=0.2, - UseMatchChi2=True, - MuonMatchChi2=100, - - TauJetPt=20*GeV, - TauJetEta=2.5, - TauJetLikelihood=-6.0, - TauEleBDTCut=0.5, # - - JetPt=20*GeV, - JetEta=5.0, - BJetLikelihood=6.0 - - ) - -ToolSvc += UserAnalysisSelectionTool -print UserAnalysisSelectionTool diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisOverlapCheckingTool.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisOverlapCheckingTool.cxx deleted file mode 100644 index 4d79e4ad6147293a72957820263bf7d42aefb3c4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisOverlapCheckingTool.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/***************************************************************************** -Name : UserAnalysisOverlapCheckingTool.cxx -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User Analysis Overlap Checking - see UserAnalysisOverlapCheckingTool.h for details -*****************************************************************************/ - -#include "GaudiKernel/GaudiException.h" -#include "Gaudi/Property.h" - -// Accessing data: -#include "CLHEP/Units/PhysicalConstants.h" - -// User Tools -#include "UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h" - -#include <sstream> -#include <iomanip> -#include <iostream> - -using namespace Analysis; -using namespace Rec; -using namespace std; - -//------------------------------------------------------------------------------ -UserAnalysisOverlapCheckingTool::UserAnalysisOverlapCheckingTool( const std::string& type, - const std::string& name, - const IInterface* parent ) - : AthAlgTool( type, name, parent ), - m_analysisTools( "AnalysisTools", this ) { - - declareInterface<UserAnalysisOverlapCheckingTool>( this ); - - declareProperty( "AnalysisTools", m_analysisTools ); - declareProperty("OverlapDeltaR", m_deltaR=0.2); - declareProperty("OverlapDeltaRWithJets", m_deltaRWithJets=0.3); - -} - -//------------------------------------------------------------------------------ -StatusCode UserAnalysisOverlapCheckingTool::initialize() { - - /// get a handle on the analysis tools - StatusCode sc = m_analysisTools.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis tools"); - return sc; - } - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------ -StatusCode UserAnalysisOverlapCheckingTool::finalize() { - - ATH_MSG_DEBUG("in finalize()"); - - - return StatusCode::SUCCESS; -} - - - - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisOverlapRemovalTool.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisOverlapRemovalTool.cxx deleted file mode 100644 index b79c89d14f46bf19b5a8ac3edb683a94e40ef733..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisOverlapRemovalTool.cxx +++ /dev/null @@ -1,987 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/***************************************************************************** -Name : UserAnalysisPreparationTool.cxx -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User Analysis Overlap Removal - see UserAnalysisOverlapRemovalTool.h for details -*****************************************************************************/ - -#include "GaudiKernel/GaudiException.h" -#include "Gaudi/Property.h" - -// Accessing data: -#include "CLHEP/Units/PhysicalConstants.h" - -// User Tools -#include "UserAnalysisUtils/UserAnalysisOverlapRemovalTool.h" - -#include "muonEvent/Muon.h" -#include "egammaEvent/Electron.h" -#include "egammaEvent/Photon.h" -#include "CaloEvent/CaloCluster.h" -#include "Particle/TrackParticle.h" -#include "tauEvent/TauJet.h" -#include "JetEvent/Jet.h" - -#include <sstream> -#include <iomanip> -#include <iostream> - -using namespace Analysis; -using namespace Rec; -using namespace std; - -//------------------------------------------------------------------------------ -UserAnalysisOverlapRemovalTool::UserAnalysisOverlapRemovalTool( const std::string& type, - const std::string& name, - const IInterface* parent ) - : AthAlgTool( type, name, parent ), - m_userSelectionTool ( "UserAnalysisSelectionTool"), - m_userOverlapCheckingTool ( "UserAnalysisOverlapCheckingTool") { - - declareInterface<UserAnalysisOverlapRemovalTool>( this ); - - declareProperty("UserSelectionTool", m_userSelectionTool); - declareProperty("UserOverlapCheckingTool", m_userOverlapCheckingTool); - declareProperty("InputContainerKeys", m_inputContainerKeys); - declareProperty("IsAtlfastData", m_isAtlfast=false); - - declareProperty("OuputObjectKey", m_outputObjectKey = "FinalStateObjects"); - declareProperty("OutputLeptonKey", m_outputLeptonKey = "FinalStateLeptons"); - declareProperty("OutputPhotonKey", m_outputPhotonKey = "FinalStatePhotons"); - declareProperty("OutputElectronKey", m_outputElectronKey = "FinalStateElectrons"); - declareProperty("OutputMuonKey", m_outputMuonKey = "FinalStateMuons"); - declareProperty("OutputTauJetKey", m_outputTauJetKey = "FinalStateTauJets"); - declareProperty("OutputCalloClusterKey", m_outputCaloClusterKey = "FinalStateCaloClusters"); - declareProperty("OutputTrackParticleKey", m_outputTrackParticleKey = "FinalStateTrackParticles"); - declareProperty("OutputJetKey", m_outputJetKey = "FinalStateJets"); - declareProperty("OutputBJetKey", m_outputBJetKey = "FinalStateBJets"); - declareProperty("OutputLightJetKey", m_outputLightJetKey = "FinalStateLightJets"); - declareProperty("RemoveOverlapInSameContainer", m_removeOverlapInSameContainer=true); - - /** initialize counters */ - m_numElectrons = std::make_pair(0,0); - m_numPhotons = std::make_pair(0,0); - m_numMuons = std::make_pair(0,0); - m_numTauJets = std::make_pair(0,0); - m_numJets = std::make_pair(0,0); - m_numBJets = std::make_pair(0,0); - m_numLightJets = std::make_pair(0,0); - m_numTrackParticles = std::make_pair(0,0); - m_numCaloClusters = std::make_pair(0,0); -} - -//------------------------------------------------------------------------------ -StatusCode UserAnalysisOverlapRemovalTool::initialize() { - - - /// get a handle on the selection tools - StatusCode sc = m_userSelectionTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis selection tool" ); - return sc; - } - - sc = m_userOverlapCheckingTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis overlap checking tool" ); - return sc; - } - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------ -StatusCode UserAnalysisOverlapRemovalTool::finalize() { - - ATH_MSG_DEBUG("in finalize()" ); - - this->summarize(); - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------- -StatusCode UserAnalysisOverlapRemovalTool::execute() { - ATH_MSG_DEBUG("in execute()" ); - - /** check if the execute is already called or not - in one job, execute should be called once for each event */ - if ( this->isExecuted() ) { - ATH_MSG_WARNING("overlapRemovalTool->execute() already called for the event in this job" ); - return StatusCode::SUCCESS; - } - - /** prepare the container for selection and overlap removal */ - Vectors v; - StatusCode sc = this->prepareContainers(v); - if ( sc.isFailure() ) return sc; - - /** now object preparation with overlap removal */ - for ( unsigned int i=0; i<m_inputContainerKeys.size(); ++i ) { - - string::size_type loc = m_inputContainerKeys[i].find( "Electron", 0); - if( loc != string::npos ) sc = this->electronPreparation( v, m_inputContainerKeys[i] ); - - loc = m_inputContainerKeys[i].find( "Photon", 0); - if( loc != string::npos ) sc = this->photonPreparation( v, m_inputContainerKeys[i] ); - - loc = m_inputContainerKeys[i].find( "Muon", 0); - if( loc != string::npos ) sc = this->muonPreparation( v, m_inputContainerKeys[i] ); - - std::string tau = "Tau"; - if ( m_isAtlfast ) tau = "TauJet"; - loc = m_inputContainerKeys[i].find( tau, 0); - if( loc != string::npos ) sc = this->tauJetPreparation( v, m_inputContainerKeys[i] ); - - std::string jet = "Jets"; - if ( m_isAtlfast ) jet = "Jet"; - loc = m_inputContainerKeys[i].find( jet, 0); - if( loc != string::npos ) sc = this->jetPreparation( v, m_inputContainerKeys[i] ); - - loc = m_inputContainerKeys[i].find( "Track", 0); - if( loc != string::npos ) sc = this->trackParticlePreparation( v, m_inputContainerKeys[i] ); - - loc = m_inputContainerKeys[i].find( "Cluster", 0); - if( loc != string::npos ) sc = this->caloClusterPreparation( v, m_inputContainerKeys[i] ); - - if ( sc.isFailure() ) return sc; - - } - - /** lock the containers so that they are no longer modified */ - sc = this->lockContainers(); - if ( sc.isFailure() ) return sc; - - this->print(); - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------- -const INavigable4MomentumCollection * UserAnalysisOverlapRemovalTool::finalStateObjects() { - ATH_MSG_DEBUG("in finalStateObjects()" ); - const INavigable4MomentumCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputObjectKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State objects not found" ); - return container; -} - -const PhotonContainer * UserAnalysisOverlapRemovalTool::finalStatePhotons() { - ATH_MSG_DEBUG("in finalStatePhotons()" ); - const PhotonContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputPhotonKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Photons not found" ); - return container; -} - -const ElectronContainer * UserAnalysisOverlapRemovalTool::finalStateElectrons() { - ATH_MSG_DEBUG("in finalStateElectrons()" ); - const ElectronContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputElectronKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Electrons not found" ); - return container; -} - -const MuonContainer * UserAnalysisOverlapRemovalTool::finalStateMuons() { - ATH_MSG_DEBUG("in finalStateMuons()" ); - const MuonContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputMuonKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Muons not found" ); - return container; -} - -const INavigable4MomentumCollection * UserAnalysisOverlapRemovalTool::finalStateLeptons() { - ATH_MSG_DEBUG("in finalStateLeptons()" ); - const INavigable4MomentumCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputLeptonKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Leptons not found" ); - return container; -} - -const TauJetContainer * UserAnalysisOverlapRemovalTool::finalStateTauJets() { - ATH_MSG_DEBUG("in finalStateTauJets()" ); - const TauJetContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputTauJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State TauJets not found" ); - return container; -} - -const JetCollection * UserAnalysisOverlapRemovalTool::finalStateJets() { - ATH_MSG_DEBUG("in finalStateJets()" ); - const JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Jets not found" ); - return container; -} - -const JetCollection * UserAnalysisOverlapRemovalTool::finalStateBJets() { - ATH_MSG_DEBUG("in finalStateBJets()" ); - const JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputBJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State BJets not found" ); - return container; -} - -const JetCollection * UserAnalysisOverlapRemovalTool::finalStateLightJets() { - ATH_MSG_DEBUG("in finalStateLightJets()" ); - const JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputLightJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Light Jets not found" ); - return container; -} - -const TrackParticleContainer * UserAnalysisOverlapRemovalTool::finalStateTrackParticles() { - ATH_MSG_DEBUG("in finalStateTrackParticles()" ); - const TrackParticleContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputTrackParticleKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State TrackParticles not found" ); - return container; -} - -const CaloClusterContainer * UserAnalysisOverlapRemovalTool::finalStateCaloClusters() { - ATH_MSG_DEBUG("in finalStateCaloClusters()" ); - const CaloClusterContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputCaloClusterKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State CaloClusters not found" ); - return container; -} - - /** container preparation */ -StatusCode UserAnalysisOverlapRemovalTool::electronPreparation( Vectors& v, std::string key ) { - ATH_MSG_DEBUG("in electronPreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - const ElectronContainer * aod_electrons = 0; - sc = evtStore()->retrieve( aod_electrons, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No Existing ESD/AOD/DPD electron container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("Initial ElectronContainer size is " << aod_electrons->size() ); - m_numElectrons.first += aod_electrons->size(); - - /// iterators over the container - ElectronContainer::const_iterator elecItr = aod_electrons->begin(); - ElectronContainer::const_iterator elecItrE = aod_electrons->end(); - - for (; elecItr != elecItrE; ++elecItr) { - - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *elecItr ); - v.m_outputLeptons->push_back( *elecItr ); - v.m_outputElectrons->push_back( *elecItr ); - - } - /** check for the overlap and save non overlapping ones */ - else { - ConstDataVector<INavigable4MomentumCollection>::const_iterator nav4MomItr = v.m_outputParticles->begin(); - ConstDataVector<INavigable4MomentumCollection>::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const Electron * electron = dynamic_cast<const Electron*>(*nav4MomItr); - if ( !electron || ( electron && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*elecItr, *nav4MomItr); - - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *elecItr ); - v.m_outputLeptons->push_back( *elecItr ); - v.m_outputElectrons->push_back( *elecItr ); - - } - } - } - - m_numElectrons.second += v.m_outputElectrons->size(); - - return sc; -} - -StatusCode UserAnalysisOverlapRemovalTool::photonPreparation( Vectors& v, std::string key ) { - ATH_MSG_DEBUG("in photonPreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - const PhotonContainer * aod_photons = 0; - sc = evtStore()->retrieve( aod_photons, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No Existing ESD/AOD/DPD photon container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("Initial PhotonContainer size is " << aod_photons->size() ); - m_numPhotons.first += aod_photons->size(); - - /// iterators over the container - PhotonContainer::const_iterator photItr = aod_photons->begin(); - PhotonContainer::const_iterator photItrE = aod_photons->end(); - - for (; photItr != photItrE; ++photItr) { - - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *photItr ); - v.m_outputPhotons->push_back( *photItr ); - } - /** check for the overlap and save non overlapping ones */ - else { - INavigable4MomentumCollection::const_iterator nav4MomItr = v.m_outputParticles->begin(); - INavigable4MomentumCollection::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const Photon * photon = dynamic_cast<const Photon*>(*nav4MomItr); - if ( !photon || ( photon && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*photItr, *nav4MomItr); - - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *photItr ); - v.m_outputPhotons->push_back( *photItr ); - } - } - } - - m_numPhotons.second += v.m_outputPhotons->size(); - - return sc; -} - -StatusCode UserAnalysisOverlapRemovalTool::muonPreparation( Vectors& v, std:: string key ) { - ATH_MSG_DEBUG("in muonPreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - const MuonContainer * aod_muons = 0; - sc = evtStore()->retrieve( aod_muons, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No Existing ESD/AOD/DPD muon container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("Initial MuonContainer size is " << aod_muons->size() ); - m_numMuons.first += aod_muons->size(); - - /// iterators over the container - MuonContainer::const_iterator muonItr = aod_muons->begin(); - MuonContainer::const_iterator muonItrE = aod_muons->end(); - - for (; muonItr != muonItrE; ++muonItr) { - - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *muonItr ); - v.m_outputMuons->push_back( *muonItr ); - - } - /** check for the overlap and save non overlapping ones */ - else { - INavigable4MomentumCollection::const_iterator nav4MomItr = v.m_outputParticles->begin(); - INavigable4MomentumCollection::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const Analysis::Muon * muon = dynamic_cast<const Analysis::Muon*>(*nav4MomItr); - if ( !muon || ( muon && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*muonItr, *nav4MomItr); - - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *muonItr ); - v.m_outputMuons->push_back( *muonItr ); - } - } - } - - m_numMuons.second += v.m_outputMuons->size(); - - return sc; -} - -StatusCode UserAnalysisOverlapRemovalTool::tauJetPreparation( Vectors& v, std::string key ) { - ATH_MSG_DEBUG("in tauJetPreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - TauJetContainer * tauJets = this->allTauJets(); - if ( !tauJets ) return sc; - - const TauJetContainer * aod_tauJets = 0; - sc = evtStore()->retrieve( aod_tauJets, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No Existing ESD/AOD/DPD tauJet container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("initial TauJetContainer size is " << aod_tauJets->size() ); - m_numTauJets.first += aod_tauJets->size(); - - /// iterators over the container - TauJetContainer::const_iterator tauJetItr = aod_tauJets->begin(); - TauJetContainer::const_iterator tauJetItrE = aod_tauJets->end(); - - for (; tauJetItr != tauJetItrE; ++tauJetItr) { - - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *tauJetItr ); - v.m_outputTauJets->push_back( *tauJetItr ); - } - /** check for the overlap and save non overlapping ones */ - else { - INavigable4MomentumCollection::const_iterator nav4MomItr = v.m_outputParticles->begin(); - INavigable4MomentumCollection::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const TauJet * taujet = dynamic_cast<const TauJet*>(*nav4MomItr); - if ( !taujet || ( taujet && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*tauJetItr, *nav4MomItr); - - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *tauJetItr ); - v.m_outputTauJets->push_back( *tauJetItr ); - } - } - } - - m_numTauJets.second += v.m_outputTauJets->size(); - - return sc; -} - -StatusCode UserAnalysisOverlapRemovalTool::jetPreparation( Vectors& v, std::string key ) { - ATH_MSG_DEBUG("in jetPreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - const JetCollection * aod_jets = 0; - sc = evtStore()->retrieve( aod_jets, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No Existing ESD/AOD/DPD jet container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("Initial JetCollection size is " << aod_jets->size() ); - m_numJets.first += aod_jets->size(); - m_numBJets.first += aod_jets->size(); - m_numLightJets.first += aod_jets->size(); - - /// iterators over the container - JetCollection::const_iterator jetItr = aod_jets->begin(); - JetCollection::const_iterator jetItrE = aod_jets->end(); - - for (; jetItr != jetItrE; ++jetItr) { - /** check if this jet passes pre-selection */ - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *jetItr ); - v.m_outputJets->push_back( *jetItr ); - if ( m_userSelectionTool->isBJet( *jetItr ) ) v.m_outputBJets->push_back( *jetItr); - else v.m_outputLightJets->push_back( *jetItr ); - - } - /** check for the overlap and save non overlapping ones */ - else { - INavigable4MomentumCollection::const_iterator nav4MomItr = v.m_outputParticles->begin(); - INavigable4MomentumCollection::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const Jet * jet = dynamic_cast<const Jet*>(*nav4MomItr); - if ( !jet || ( jet && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*jetItr, *nav4MomItr); - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *jetItr ); - v.m_outputJets->push_back( *jetItr ); - if ( m_userSelectionTool->isBJet( *jetItr ) ) v.m_outputBJets->push_back( *jetItr); - else v.m_outputLightJets->push_back( *jetItr ); - - } - } - } - - m_numJets.second += v.m_outputJets->size(); - m_numBJets.second += v.m_outputBJets->size(); - m_numLightJets.second += v.m_outputLightJets->size(); - - return sc; -} - -StatusCode UserAnalysisOverlapRemovalTool::trackParticlePreparation( Vectors& v, std::string key ) { - ATH_MSG_DEBUG("in trackParticlePreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - const TrackParticleContainer * aod_trackParticles = 0; - sc = evtStore()->retrieve( aod_trackParticles, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No ESD/AOD/DPD TrackParticle container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("Initial TrackParticleContainer size is " << aod_trackParticles->size() ); - m_numTrackParticles.first += aod_trackParticles->size(); - - /// iterators over the container - TrackParticleContainer::const_iterator trackParticleItr = aod_trackParticles->begin(); - TrackParticleContainer::const_iterator trackParticleItrE = aod_trackParticles->end(); - - for (; trackParticleItr != trackParticleItrE; ++trackParticleItr) { - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *trackParticleItr ); - v.m_outputTrackParticles->push_back( *trackParticleItr ); - - } - /** check for the overlap and save non overlapping ones */ - else { - INavigable4MomentumCollection::const_iterator nav4MomItr = v.m_outputParticles->begin(); - INavigable4MomentumCollection::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const TrackParticle * trackparticle = dynamic_cast<const TrackParticle*>(*nav4MomItr); - if ( !trackparticle || ( trackparticle && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*trackParticleItr, *nav4MomItr); - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *trackParticleItr ); - v.m_outputTrackParticles->push_back( *trackParticleItr ); - } - } - } - - m_numTrackParticles.second += v.m_outputTrackParticles->size(); - - return sc; -} - -StatusCode UserAnalysisOverlapRemovalTool::caloClusterPreparation( Vectors& v, std::string key ) { - ATH_MSG_DEBUG("in caloClusterPreparation() " ); - StatusCode sc = StatusCode::SUCCESS; - - const CaloClusterContainer * aod_caloClusters = 0; - sc = evtStore()->retrieve( aod_caloClusters, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No Existing ESD/AOD/DPD CaloCluster container found: key = " << key ); - return sc; - } - ATH_MSG_DEBUG("Initial CaloClusterContainer size is " << aod_caloClusters->size() ); - m_numCaloClusters.first += aod_caloClusters->size(); - - /// iterators over the container - CaloClusterContainer::const_iterator caloClusterItr = aod_caloClusters->begin(); - CaloClusterContainer::const_iterator caloClusterItrE = aod_caloClusters->end(); - - for (; caloClusterItr != caloClusterItrE; ++caloClusterItr) { - /** check if this caloCluster passes pre-selection */ - if ( !m_userSelectionTool->isSelected( *caloClusterItr ) ) continue; - - /** if this is the first particle, just put it in */ - if ( v.m_outputParticles->size() == 0 ) { - v.m_outputParticles->push_back( *caloClusterItr ); - v.m_outputCaloClusters->push_back( *caloClusterItr ); - - } - /** check for the overlap and save non overlapping ones */ - else { - INavigable4MomentumCollection::const_iterator nav4MomItr = v.m_outputParticles->begin(); - INavigable4MomentumCollection::const_iterator nav4MomItrE = v.m_outputParticles->end(); - bool overlap = false; - for (; nav4MomItr != nav4MomItrE; ++nav4MomItr) { - /** overlap checking */ - const CaloCluster * cluster = dynamic_cast<const CaloCluster*>(*nav4MomItr); - if ( !cluster || ( cluster && m_removeOverlapInSameContainer ) ) - overlap = m_userOverlapCheckingTool->overlap(*caloClusterItr, *nav4MomItr); - /** get out of the loop as soon as an overlap is found */ - if ( overlap ) break; - } - - /** if no overlap then save */ - if ( !overlap ) { - v.m_outputParticles->push_back( *caloClusterItr ); - v.m_outputCaloClusters->push_back( *caloClusterItr ); - - } - } - } - - m_numCaloClusters.second += v.m_outputCaloClusters->size(); - - return sc; -} - -INavigable4MomentumCollection * UserAnalysisOverlapRemovalTool::allParticles() { - ATH_MSG_DEBUG("in allObjects()" ); - INavigable4MomentumCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputObjectKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State objects not found" ); - return container; -} - -INavigable4MomentumCollection * UserAnalysisOverlapRemovalTool::allLeptons() { - ATH_MSG_DEBUG("in allLeptons()" ); - INavigable4MomentumCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputLeptonKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State leptons not found" ); - return container; - -} - -PhotonContainer * UserAnalysisOverlapRemovalTool::allPhotons() { - ATH_MSG_DEBUG("in allPhotons()" ); - PhotonContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputPhotonKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Photons not found" ); - return container; -} - -MuonContainer * UserAnalysisOverlapRemovalTool::allMuons() { - ATH_MSG_DEBUG("in allMuons()" ); - MuonContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputMuonKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Muons not found" ); - return container; -} - -ElectronContainer * UserAnalysisOverlapRemovalTool::allElectrons() { - ATH_MSG_DEBUG("in allElectrons()" ); - ElectronContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputElectronKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Electrons not found" ); - return container; -} - -TauJetContainer * UserAnalysisOverlapRemovalTool::allTauJets() { - ATH_MSG_DEBUG("in allTauJets()" ); - TauJetContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputTauJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State TauJets not found" ); - return container; -} - -JetCollection * UserAnalysisOverlapRemovalTool::allJets() { - ATH_MSG_DEBUG("in allJets()" ); - JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Jets not found" ); - return container; -} - -JetCollection * UserAnalysisOverlapRemovalTool::allBJets() { - ATH_MSG_DEBUG("in allBJets()" ); - JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputBJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State BJets not found" ); - return container; -} - -JetCollection * UserAnalysisOverlapRemovalTool::allLightJets() { - ATH_MSG_DEBUG("in allLightJets()" ); - JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputLightJetKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State Light Jets not found" ); - return container; -} - -TrackParticleContainer * UserAnalysisOverlapRemovalTool::allTrackParticles() { - ATH_MSG_DEBUG("in allTrackParticles()" ); - TrackParticleContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputTrackParticleKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State TrackParticles not found" ); - return container; -} - -CaloClusterContainer * UserAnalysisOverlapRemovalTool::allCaloClusters() { - ATH_MSG_DEBUG("in allCaloClusters()" ); - CaloClusterContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputCaloClusterKey); - if ( sc.isFailure() || container ==0 ) - ATH_MSG_ERROR("Final State CaloClusters not found" ); - return container; -} - -//------------------------------------------------------------------------------- -StatusCode UserAnalysisOverlapRemovalTool::prepareContainers(Vectors& v) { - ATH_MSG_DEBUG("in prepareContainers()" ); - - /** create an empty container of all particles and record it */ - ConstDataVector<CaloClusterContainer> * caloClusters = - new ConstDataVector<CaloClusterContainer>( SG::VIEW_ELEMENTS ); - StatusCode sc = evtStore()->record ( caloClusters, m_outputCaloClusterKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of CaloClusters in StoreGate: key= " << m_outputCaloClusterKey ); - return sc; - } - v.m_outputCaloClusters = caloClusters; - - /** create an empty container of TrackParticles and record it */ - ConstDataVector<TrackParticleContainer> * trackParticles = - new ConstDataVector<TrackParticleContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( trackParticles, m_outputTrackParticleKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of TrackParticles in StoreGate: key= " << m_outputTrackParticleKey ); - return sc; - } - v.m_outputTrackParticles = trackParticles; - - /** create an empty container of all particles and record it */ - ConstDataVector<INavigable4MomentumCollection> * particles = - new ConstDataVector<INavigable4MomentumCollection>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( particles, m_outputObjectKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of particles in StoreGate: key= " << m_outputObjectKey ); - return sc; - } - v.m_outputParticles = particles; - - /** create an empty container of all leptons and record it */ - ConstDataVector<INavigable4MomentumCollection> * leptons = - new ConstDataVector<INavigable4MomentumCollection>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( leptons, m_outputLeptonKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of leptons in StoreGate: key= " << m_outputLeptonKey ); - return sc; - } - v.m_outputLeptons = leptons; - - /** create an empty container of all electrons and record it */ - ConstDataVector<ElectronContainer> * electrons = - new ConstDataVector<ElectronContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( electrons, m_outputElectronKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of electrons in StoreGate: key= " << m_outputElectronKey ); - return sc; - } - v.m_outputElectrons = electrons; - - /** create an empty container of all photons and record it */ - ConstDataVector<PhotonContainer> * photons = - new ConstDataVector<PhotonContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( photons, m_outputPhotonKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of photons in StoreGate: key= " << m_outputPhotonKey ); - return sc; - } - v.m_outputPhotons = photons; - - /** create an empty container of all muons and record it */ - ConstDataVector<MuonContainer> * muons = - new ConstDataVector<MuonContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( muons, m_outputMuonKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of muons in StoreGate: key= " << m_outputMuonKey ); - return sc; - } - v.m_outputMuons = muons; - - /** create an empty container of all tauJets and record it */ - ConstDataVector<TauJetContainer> * tauJets = - new ConstDataVector<TauJetContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( tauJets, m_outputTauJetKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of tau jets in StoreGate: key= " << m_outputTauJetKey ); - return sc; - } - v.m_outputTauJets = tauJets; - - /** create an empty container of all jets and record it */ - ConstDataVector<JetCollection> * jets = - new ConstDataVector<JetCollection>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( jets, m_outputJetKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of jets in StoreGate: key= " << m_outputJetKey ); - return sc; - } - v.m_outputJets = jets; - - /** create an empty container of b-jets and record it */ - ConstDataVector<JetCollection> * bjets = - new ConstDataVector<JetCollection>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( bjets, m_outputBJetKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of b-jets in StoreGate: key= " << m_outputBJetKey ); - return sc; - } - v.m_outputBJets = bjets; - - /** create an empty container of light (non b-jet) jets and record it */ - ConstDataVector<JetCollection> * lightJets = - new ConstDataVector<JetCollection>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( lightJets, m_outputLightJetKey); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of lightJets in StoreGate: key= " << m_outputLightJetKey ); - return sc; - } - v.m_outputLightJets = lightJets; - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------- -StatusCode UserAnalysisOverlapRemovalTool::lockContainers() { - ATH_MSG_DEBUG("in lockContainers()" ); - - /** lock the contianer so it is not modified downstream by anyone else */ - StatusCode sc = evtStore()->setConst( this->allParticles() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of particles " ); - - sc = evtStore()->setConst( this->allLeptons() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of leptons " ); - - sc = evtStore()->setConst( this->allElectrons() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of electrons " ); - - sc = evtStore()->setConst( this->allPhotons() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of photons " ); - - sc = evtStore()->setConst( this->allMuons() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of muons " ); - - sc = evtStore()->setConst( this->allTauJets() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of tauJets " ); - - sc = evtStore()->setConst( this->allJets() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of jets " ); - - sc = evtStore()->setConst( this->allBJets() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of b-jets " ); - - sc = evtStore()->setConst( this->allLightJets() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of light Jets " ); - - sc = evtStore()->setConst( this->allTrackParticles() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of trackParticles " ); - - sc = evtStore()->setConst( this->allCaloClusters() ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of calo clusters " ); - - return sc; -} - -//----------------------------------------------------------------------------------------------- -void UserAnalysisOverlapRemovalTool::print() { - ATH_MSG_DEBUG("in print() " ); - - /** Get the container of pre-selected Electrons */ - const ElectronContainer * electrons = this->finalStateElectrons(); - ATH_MSG_DEBUG("Number of Pre-selected Electrons is " << electrons->size() ); - - /** Get the container of pre-selected Photons */ - const PhotonContainer * photons = this->finalStatePhotons(); - ATH_MSG_DEBUG("Number of Pre-selected Photons is " << photons->size() ); - - /** Get the container of pre-selected Muons */ - const MuonContainer * muons = this->finalStateMuons(); - ATH_MSG_DEBUG("Number of Pre-selected Muons is " << muons->size() ); - - /** Get the container of pre-selected TauJets */ - const TauJetContainer * tauJets = this->finalStateTauJets(); - ATH_MSG_DEBUG("Number of Pre-selected TauJets is " << tauJets->size() ); - - /** Get the container of pre-selected Jets */ - const JetCollection * jets = this->finalStateJets(); - ATH_MSG_DEBUG("Number of Pre-selected Jets is " << jets->size() ); - - /** Get the container of pre-selected B-tagged Jets */ - const JetCollection * bjets = this->finalStateBJets(); - ATH_MSG_DEBUG("Number of Pre-selected b-Jets is " << bjets->size() ); - - /** Get the container of pre-selected non b-jets */ - const JetCollection * lightJets = this->finalStateLightJets(); - ATH_MSG_DEBUG("Number of Pre-selected LightJets is " << lightJets->size() ); - - /** Get the container of pre-selected TrackParticles */ - const TrackParticleContainer * trackParticles = this->finalStateTrackParticles(); - ATH_MSG_DEBUG("Number of Pre-selected TrackParticles is " << trackParticles->size() ); - - /** Get the container of pre-selected CaloClusters */ - const CaloClusterContainer * caloClusters = this->finalStateCaloClusters(); - ATH_MSG_DEBUG("Number of Pre-selected CaloClusters is " << caloClusters->size() ); - - /** Get the container of pre-selected leptons (electrons, muons) */ - const INavigable4MomentumCollection * leptons = this->finalStateLeptons(); - ATH_MSG_DEBUG("Number of Pre-selected Leptons is " << leptons->size() ); - - /** Get the container of ALL pre-selected objects */ - const INavigable4MomentumCollection * allObjects = this->finalStateObjects(); - ATH_MSG_DEBUG("Number of Pre-selected final State Objects is " << allObjects->size() ); - -} - -//--------------------------------------------------------------------------------------------------------- -void UserAnalysisOverlapRemovalTool::summarize() { - ATH_MSG_INFO("in summarize() " ); - - ATH_MSG_INFO("Summary Pre-selected/Overlap Removed Events ###################" ); - ATH_MSG_INFO("---------------------------------------------------------------" ); - ATH_MSG_INFO("Pre-selected Electrons = " << std::setw(10) << m_numElectrons.first - << " Overlap-removed Electrons = " << std::setw(10) << m_numElectrons.second ); - ATH_MSG_INFO("Pre-selected Photons = " << std::setw(10) << m_numPhotons.first - << " Overlap-removed Photons = " << std::setw(10) << m_numPhotons.second ); - ATH_MSG_INFO("Pre-selected pMuons = " << std::setw(10) << m_numMuons.first - << " Overlap-removed Muons = " << std::setw(10) << m_numMuons.second ); - ATH_MSG_INFO("Pre-selected TauJets = " << std::setw(10) << m_numTauJets.first - << " Overlap-removed TauJets = " << std::setw(10) << m_numTauJets.second ); - ATH_MSG_INFO("Pre-selected Jets = " << std::setw(10) << m_numJets.first - << " Overlap-removed Jets = " << std::setw(10) << m_numJets.second ); - ATH_MSG_INFO("Pre-selected BJets = " << std::setw(10) << m_numBJets.first - << " Overlap-removed BJets = " << std::setw(10) << m_numBJets.second ); - ATH_MSG_INFO("Pre-selected LightJets = " << std::setw(10) << m_numLightJets.first - << " Overlpa-removed LightJets = " << std::setw(10) << m_numLightJets.second ); - ATH_MSG_INFO("Pre-selected TrackParticles = " << std::setw(10) << m_numTrackParticles.first - << " Overlap-removed TrackParticles = " << std::setw(10) << m_numTrackParticles.second ); - ATH_MSG_INFO("Pre-selected CaloClusters = " << std::setw(10) << m_numCaloClusters.first - << " Overlap-removed CaloClusters = " << std::setw(10) << m_numCaloClusters.second ); -} - -//----------------------------------------------------------------------------------------------------------- -bool UserAnalysisOverlapRemovalTool::isExecuted() { - ATH_MSG_DEBUG("in isExecuted() " ); - return evtStore()->contains<INavigable4MomentumCollection>( m_outputObjectKey ); -} diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisPreparationTool.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisPreparationTool.cxx deleted file mode 100644 index 61348d89f95be15d99dd283b86615aa91844b09c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisPreparationTool.cxx +++ /dev/null @@ -1,514 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/***************************************************************************** -Name : UserAnalysisPreparationTool.cxx -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User Analysis Preparation - see UserAnalysisPreparationTool.h for details -*****************************************************************************/ - -#include "GaudiKernel/GaudiException.h" -#include "Gaudi/Property.h" - -// Accessing data: -#include "CLHEP/Units/PhysicalConstants.h" - -// User Tools -#include "UserAnalysisUtils/UserAnalysisPreparationTool.h" -#include "AthContainers/ConstDataVector.h" - -#include <sstream> -#include <iomanip> -#include <iostream> - -using namespace Analysis; -using namespace Rec; -using namespace std; - -//------------------------------------------------------------------------------ -UserAnalysisPreparationTool::UserAnalysisPreparationTool( const std::string& type, - const std::string& name, - const IInterface* parent ) - : AthAlgTool( type, name, parent ), - m_userSelectionTool ( "UserAnalysisSelectionTool" ) { - - declareInterface<UserAnalysisPreparationTool>( this ); - - declareProperty("UserSelectionTool", m_userSelectionTool); - declareProperty("InputContainerKeys", m_inputContainerKeys); - declareProperty("OutputContainerKeys", m_outputContainerKeys); - declareProperty("IsAtlfastData", m_isAtlfast=false); - - /** initialize counters */ - m_numElectrons = std::make_pair(0,0); - m_numPhotons = std::make_pair(0,0); - m_numMuons = std::make_pair(0,0); - m_numTauJets = std::make_pair(0,0); - m_numJets = std::make_pair(0,0); - m_numTrackParticles = std::make_pair(0,0); - m_numCaloClusters = std::make_pair(0,0); - m_first = true; -} - -//------------------------------------------------------------------------------ -StatusCode UserAnalysisPreparationTool::initialize() { - - /// get a handle on the selection tools - StatusCode sc = m_userSelectionTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis selection tool"); - return sc; - } - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------ -StatusCode UserAnalysisPreparationTool::finalize() { - - ATH_MSG_DEBUG("in finalize()"); - - this->summarize(); - - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------- -StatusCode UserAnalysisPreparationTool::execute() { - ATH_MSG_DEBUG("in execute()"); - - /** check that the input and the output containers are defined */ - StatusCode sc = StatusCode::SUCCESS; - - if ( m_first ) { - if ( m_outputContainerKeys.size() != m_inputContainerKeys.size() ) { - ATH_MSG_FATAL("Input/Output container mis-match: please fix job options"); - return StatusCode::FAILURE; - } - if ( m_outputContainerKeys.size() == 0 ) { - ATH_MSG_ERROR("You should input at least one container : please fix jobOptions"); - return StatusCode::FAILURE; - } - } - - /** now object preparation with selection */ - for ( unsigned int i=0; i<m_inputContainerKeys.size(); ++i ) { - - string::size_type loc = m_inputContainerKeys[i].find( "Electron", 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputElectronKey = m_outputContainerKeys[i]; - sc = this->electronPreparation( m_inputContainerKeys[i] ); - } - - loc = m_inputContainerKeys[i].find( "Photon", 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputPhotonKey = m_outputContainerKeys[i]; - sc = this->photonPreparation( m_inputContainerKeys[i] ); - } - - loc = m_inputContainerKeys[i].find( "Muon", 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputMuonKey = m_outputContainerKeys[i]; - sc = this->muonPreparation( m_inputContainerKeys[i] ); - } - - std::string tau = "Tau"; - if ( m_isAtlfast ) tau = "TauJet"; - loc = m_inputContainerKeys[i].find( tau, 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputTauJetKey = m_outputContainerKeys[i]; - sc = this->tauJetPreparation( m_inputContainerKeys[i] ); - } - - std::string jet = "Jets"; - if ( m_isAtlfast ) jet = "Jet"; - loc = m_inputContainerKeys[i].find( jet, 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputJetKey = m_outputContainerKeys[i]; - sc = this->jetPreparation( m_inputContainerKeys[i] ); - } - - loc = m_inputContainerKeys[i].find( "Track", 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputTrackParticleKey = m_outputContainerKeys[i]; - sc = this->trackParticlePreparation( m_inputContainerKeys[i] ); - } - - loc = m_inputContainerKeys[i].find( "Cluster", 0); - if ( loc != string::npos ) { - if ( m_first ) m_outputCaloClusterKey = m_outputContainerKeys[i]; - sc = this->caloClusterPreparation( m_inputContainerKeys[i] ); - } - if ( sc.isFailure() ) return sc; - } - - this->print(); - m_first = false; - - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------------- -const PhotonContainer * UserAnalysisPreparationTool::selectedPhotons() { - ATH_MSG_DEBUG("in selectedPhotons()"); - const PhotonContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputPhotonKey); - if ( sc.isFailure() || container ==0 ) ATH_MSG_ERROR("Final State Photons not found"); - return container; -} - -const ElectronContainer * UserAnalysisPreparationTool::selectedElectrons() { - ATH_MSG_DEBUG("in selectedElectrons()"); - const ElectronContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputElectronKey); - if ( sc.isFailure() || container ==0 ) ATH_MSG_ERROR("Final State Electrons not found"); - return container; -} - -const MuonContainer * UserAnalysisPreparationTool::selectedMuons() { - ATH_MSG_DEBUG("in selectedMuons()"); - const MuonContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputMuonKey); - if ( sc.isFailure() || container ==0 ) ATH_MSG_DEBUG("Final State Muons not found"); - return container; -} - -const TauJetContainer * UserAnalysisPreparationTool::selectedTauJets() { - ATH_MSG_DEBUG("in selectedTauJets()"); - const TauJetContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputTauJetKey); - if ( sc.isFailure() || container ==0 ) ATH_MSG_ERROR("Final State TauJets not found"); - return container; -} - -const JetCollection * UserAnalysisPreparationTool::selectedJets() { - ATH_MSG_DEBUG("in selectedJets()"); - const JetCollection * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputJetKey); - if ( sc.isFailure() || container ==0 ) ATH_MSG_ERROR("Final State Jets not found"); - return container; -} - -const TrackParticleContainer * UserAnalysisPreparationTool::selectedTrackParticles() { - ATH_MSG_DEBUG("in selectedTrackParticles()"); - const TrackParticleContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputTrackParticleKey); - if ( sc.isFailure() || container ==0 ) ATH_MSG_ERROR("Final State TrackParticles not found"); - return container; -} - -const CaloClusterContainer * UserAnalysisPreparationTool::selectedCaloClusters() { - ATH_MSG_DEBUG("in selectedCaloClusters()"); - const CaloClusterContainer * container = 0; - StatusCode sc = evtStore()->retrieve(container, m_outputCaloClusterKey); - if ( sc.isFailure() || container ==0 )ATH_MSG_ERROR("Final State CaloClusters not found"); - return container; -} - - /** container preparation */ -StatusCode UserAnalysisPreparationTool::electronPreparation( std::string key ) { - ATH_MSG_DEBUG("in electronPreparation() "); - - /** create an empty container of all electrons and record it */ - auto electrons = std::make_unique<ConstDataVector<ElectronContainer> >( SG::VIEW_ELEMENTS ); - - const ElectronContainer * aod_electrons = 0; - ATH_CHECK( evtStore()->retrieve( aod_electrons, key ) ); - ATH_MSG_DEBUG("AOD ElectronContainer size is " << aod_electrons->size()); - m_numElectrons.first += aod_electrons->size(); - - /// iterators over the container - ElectronContainer::const_iterator elecItr = aod_electrons->begin(); - ElectronContainer::const_iterator elecItrE = aod_electrons->end(); - - for (; elecItr != elecItrE; ++elecItr) { - if ( m_userSelectionTool->isSelected( *elecItr ) ) electrons->push_back( *elecItr ); - } - m_numElectrons.second += electrons->size(); - - ATH_CHECK( evtStore()->record (std::move (electrons), m_outputElectronKey) ); - - return StatusCode::SUCCESS; -} - -StatusCode UserAnalysisPreparationTool::photonPreparation( std::string key ) { - ATH_MSG_DEBUG("in photonPreparation() "); - - /** create an empty container of all photons and record it */ - auto photons = std::make_unique<ConstDataVector<PhotonContainer> >( SG::VIEW_ELEMENTS ); - - const PhotonContainer * aod_photons = 0; - ATH_CHECK( evtStore()->retrieve( aod_photons, key ) ); - ATH_MSG_DEBUG("AOD PhotonContainer size is " << aod_photons->size()); - m_numPhotons.first += aod_photons->size(); - - /// iterators over the container - PhotonContainer::const_iterator photItr = aod_photons->begin(); - PhotonContainer::const_iterator photItrE = aod_photons->end(); - - /** check if this electron passes pre-selection */ - for (; photItr != photItrE; ++photItr) { - if ( m_userSelectionTool->isSelected( *photItr ) ) photons->push_back( *photItr ); - } - m_numPhotons.second += photons->size(); - - ATH_CHECK( evtStore()->record ( std::move(photons), m_outputPhotonKey ) ); - - return StatusCode::SUCCESS; -} - -StatusCode UserAnalysisPreparationTool::muonPreparation( std::string key ) { - ATH_MSG_DEBUG("in muonPreparation() "); - StatusCode sc = StatusCode::SUCCESS; - - /** create an empty container of all muons and record it */ - ConstDataVector<MuonContainer> * muons = - new ConstDataVector<MuonContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( muons, m_outputMuonKey ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of muons in StoreGate: key= " << m_outputMuonKey); - return sc; - } - - const MuonContainer * aod_muons = 0; - sc = evtStore()->retrieve( aod_muons, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No ESD/AOD/DPD muon container found: key = " << key); - return sc; - } - ATH_MSG_DEBUG("AOD MuonContainer size is " << aod_muons->size()); - m_numMuons.first += aod_muons->size(); - - /// iterators over the container - MuonContainer::const_iterator muonItr = aod_muons->begin(); - MuonContainer::const_iterator muonItrE = aod_muons->end(); - - /** check if this muon passes pre-selection */ - for (; muonItr != muonItrE; ++muonItr) { - // if ( m_userSelectionTool->isSelected( *muonItr ) ) muons->push_back( *muonItr ); - if ( m_userSelectionTool->isSelected( *muonItr ) ) { - muons->push_back( *muonItr ); - } - - } - m_numMuons.second += muons->size(); - - sc = evtStore()->setConst( muons ); - if ( sc.isFailure()) ATH_MSG_WARNING("Not able to lock the container of muons "); - - return sc; -} - -StatusCode UserAnalysisPreparationTool::tauJetPreparation( std::string key ) { - ATH_MSG_DEBUG("in tauJetPreparation() "); - StatusCode sc = StatusCode::SUCCESS; - - /** create an empty container of all tauJets and record it */ - ConstDataVector<TauJetContainer> * tauJets = - new ConstDataVector<TauJetContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( tauJets, m_outputTauJetKey ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of tau jets in StoreGate: key= " << m_outputTauJetKey); - return sc; - } - - const TauJetContainer * aod_tauJets = 0; - sc = evtStore()->retrieve( aod_tauJets, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No ESD/AOD/DPD tauJet container found: key = " << key); - return sc; - } - ATH_MSG_DEBUG("AOD TauJetContainer size is " << aod_tauJets->size()); - m_numTauJets.first += aod_tauJets->size(); - - /// iterators over the container - TauJetContainer::const_iterator tauJetItr = aod_tauJets->begin(); - TauJetContainer::const_iterator tauJetItrE = aod_tauJets->end(); - - /** check if this tauJet passes pre-selection */ - for (; tauJetItr != tauJetItrE; ++tauJetItr) { - // if ( m_userSelectionTool->isSelected( *tauJetItr ) ) tauJets->push_back( *tauJetItr ); - if ( m_userSelectionTool->isSelected( *tauJetItr ) ) { - tauJets->push_back( *tauJetItr ); - } - - } - m_numTauJets.second += tauJets->size(); - - sc = evtStore()->setConst( tauJets ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of tauJets "); - - return sc; -} - -StatusCode UserAnalysisPreparationTool::jetPreparation( std::string key ) { - ATH_MSG_DEBUG("in jetPreparation() "); - StatusCode sc = StatusCode::SUCCESS; - - /** create an empty container of all jets and record it */ - ConstDataVector<JetCollection> * jets = - new ConstDataVector<JetCollection>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( jets, m_outputJetKey ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of jets in StoreGate: key= " << m_outputJetKey); - return sc; - } - - const JetCollection * aod_jets = 0; - sc = evtStore()->retrieve( aod_jets, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No ESD/AOD/DPD jet container found: key = " << key); - return sc; - } - ATH_MSG_DEBUG("AOD JetCollection size is " << aod_jets->size()); - m_numJets.first += aod_jets->size(); - - /// iterators over the container - JetCollection::const_iterator jetItr = aod_jets->begin(); - JetCollection::const_iterator jetItrE = aod_jets->end(); - - /** check if this jet passes pre-selection */ - for (; jetItr != jetItrE; ++jetItr) { - // if ( m_userSelectionTool->isSelected( *jetItr ) ) jets->push_back( *jetItr ); - if ( m_userSelectionTool->isSelected( *jetItr ) ) { - jets->push_back( *jetItr ); - } - - } - m_numJets.second += jets->size(); - - sc = evtStore()->setConst( jets ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of jets "); - - return sc; -} - -StatusCode UserAnalysisPreparationTool::trackParticlePreparation( std::string key ) { - ATH_MSG_DEBUG("in trackParticlePreparation() "); - StatusCode sc = StatusCode::SUCCESS; - - /** create an empty container of TrackParticles and record it */ - ConstDataVector<TrackParticleContainer> * trackParticles = - new ConstDataVector<TrackParticleContainer>( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( trackParticles, m_outputTrackParticleKey ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Not able to create a collection of TrackParticles in StoreGate: key= " << m_outputTrackParticleKey); - return sc; - } - - const TrackParticleContainer * aod_trackParticles = 0; - sc = evtStore()->retrieve( aod_trackParticles, key ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("No ESD/AOD/DPD trackParticle container found: key = " << key); - return sc; - } - ATH_MSG_DEBUG("AOD TrackParticleContainer size is " << aod_trackParticles->size()); - m_numTrackParticles.first += aod_trackParticles->size(); - - /// iterators over the container - TrackParticleContainer::const_iterator trackParticleItr = aod_trackParticles->begin(); - TrackParticleContainer::const_iterator trackParticleItrE = aod_trackParticles->end(); - - /** check if this trackParticle passes pre-selection */ - for (; trackParticleItr != trackParticleItrE; ++trackParticleItr) { - // if ( m_userSelectionTool->isSelected( *trackParticleItr ) ) trackParticles->push_back( *trackParticleItr ); - if ( m_userSelectionTool->isSelected( *trackParticleItr ) ) { - trackParticles->push_back( *trackParticleItr ); - } - - } - m_numTrackParticles.second += trackParticles->size(); - - sc = evtStore()->setConst( trackParticles ); - if ( sc.isFailure() ) ATH_MSG_WARNING("Not able to lock the container of trackParticles "); - - return sc; -} - -StatusCode UserAnalysisPreparationTool::caloClusterPreparation( std::string key ) { - ATH_MSG_DEBUG("in caloClusterPreparation() "); - - /** create an empty container of all particles and record it */ - auto caloClusters = std::make_unique<ConstDataVector<CaloClusterContainer> >( SG::VIEW_ELEMENTS ); - - const CaloClusterContainer * aod_caloClusters = 0; - ATH_CHECK( evtStore()->retrieve( aod_caloClusters, key ) ); - ATH_MSG_DEBUG("AOD CaloClusterContainer size is " << aod_caloClusters->size()); - m_numCaloClusters.first += aod_caloClusters->size(); - - /// iterators over the container - CaloClusterContainer::const_iterator caloClusterItr = aod_caloClusters->begin(); - CaloClusterContainer::const_iterator caloClusterItrE = aod_caloClusters->end(); - - /** check if this caloCluster passes pre-selection */ - for (; caloClusterItr != caloClusterItrE; ++caloClusterItr) { - if ( m_userSelectionTool->isSelected( *caloClusterItr ) ) caloClusters->push_back( *caloClusterItr ); - } - m_numCaloClusters.second += caloClusters->size(); - - ATH_CHECK( evtStore()->record ( std::move (caloClusters), m_outputCaloClusterKey, false ) ); - - return StatusCode::SUCCESS; -} - -//----------------------------------------------------------------------------------------------- -void UserAnalysisPreparationTool::print() { - ATH_MSG_DEBUG("in print() "); - - /** Get the container of pre-selected Electrons */ - const ElectronContainer * electrons = this->selectedElectrons(); - if(electrons) ATH_MSG_DEBUG("Number of Pre-selected Electrons is " << electrons->size()); - - /** Get the container of pre-selected Photons */ - const PhotonContainer * photons = this->selectedPhotons(); - if(photons) ATH_MSG_DEBUG("Number of Pre-selected Photons is " << photons->size()); - - /** Get the container of pre-selected Muons */ - const MuonContainer * muons = this->selectedMuons(); - if(muons)ATH_MSG_DEBUG("Number of Pre-selected Muons is " << muons->size()); - - /** Get the container of pre-selected TauJets */ - const TauJetContainer * tauJets = this->selectedTauJets(); - if(tauJets) ATH_MSG_DEBUG("Number of Pre-selected TauJets is " << tauJets->size()); - - /** Get the container of pre-selected Jets */ - const JetCollection * jets = this->selectedJets(); - if(jets) ATH_MSG_DEBUG("Number of Pre-selected Jets is " << jets->size()); - - /** Get the container of pre-selected TrackParticles */ - const TrackParticleContainer * trackParticles = this->selectedTrackParticles(); - if(trackParticles) ATH_MSG_DEBUG("Number of Pre-selected TrackParticles is " << trackParticles->size()); - - /** Get the container of pre-selected CaloClusters */ - const CaloClusterContainer * caloClusters = this->selectedCaloClusters(); - if(caloClusters) ATH_MSG_DEBUG("Number of Pre-selected CaloClusters is " << caloClusters->size()); - -} - -//--------------------------------------------------------------------------------------------------------- -void UserAnalysisPreparationTool::summarize() { - ATH_MSG_INFO("in summarize() "); - - ATH_MSG_INFO("Summary of Reconstructed Events/pre-selected events ############"); - ATH_MSG_INFO("---------------------------------------------------------------"); - ATH_MSG_INFO("Reconstructed Electrons = " << std::setw(10) << m_numElectrons.first - << " Pre-selected Electrons = " << std::setw(10) << m_numElectrons.second); - ATH_MSG_INFO("Reconstructed Photons = " << std::setw(10) << m_numPhotons.first - << " Pre-selected Photons = " << std::setw(10) << m_numPhotons.second); - ATH_MSG_INFO("Reconstructed Muons = " << std::setw(10) << m_numMuons.first - << " Pre-selected Muons = " << std::setw(10) << m_numMuons.second); - ATH_MSG_INFO("Reconstructed TauJets = " << std::setw(10) << m_numTauJets.first - << " Pre-selected TauJets = " << std::setw(10) << m_numTauJets.second); - ATH_MSG_INFO("Reconstructed Jets = " << std::setw(10) << m_numJets.first - << " Pre-selected Jets = " << std::setw(10) << m_numJets.second); - ATH_MSG_INFO("Reconstructed TrackParticles = " << std::setw(10) << m_numTrackParticles.first - << " Pre-selected TrackParticles = " << std::setw(10) << m_numTrackParticles.second); - ATH_MSG_INFO("Reconstructed CaloClusters = " << std::setw(10) << m_numCaloClusters.first - << " Pre-selected CaloClusters = " << std::setw(10) << m_numCaloClusters.second); -} - - diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisSelectionTool.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisSelectionTool.cxx deleted file mode 100644 index 7e52ff70fc2cb6d3ee92bfe745fc270df65fa309..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/UserAnalysisSelectionTool.cxx +++ /dev/null @@ -1,278 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/***************************************************************************** -Name : UserAnalysisSelectionTool.cxx -Package : offline/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils -Author : Ketevi A. Assamagan -Created : November 2007 -Purpose : User Analysis Selections - see UserAnalysisSelectionTool.h for details -*****************************************************************************/ - -// EDM include(s): -#include "egammaEvent/Electron.h" -#include "egammaEvent/Photon.h" -#include "egammaEvent/EMShower.h" -#include "muonEvent/Muon.h" -#include "tauEvent/TauJet.h" -#include "JetEvent/Jet.h" -#include "MissingETEvent/MissingET.h" -#include "Particle/TrackParticleContainer.h" -#include "CaloEvent/CaloClusterContainer.h" - -// Local include(s): -#include "UserAnalysisUtils/UserAnalysisSelectionTool.h" - -/// Convenience GeV definition -static const double GeV = 1000.0; - -//------------------------------------------------------------------------------ -UserAnalysisSelectionTool::UserAnalysisSelectionTool( const std::string& type, - const std::string& name, - const IInterface* parent ) - : AthAlgTool( type, name, parent ) { - declareInterface<UserAnalysisSelectionTool>( this ); - - declareProperty("IsAtlfastData", m_isAtlfast=false); - - /** caloCluster selection */ - declareProperty("CaloClusterE", m_caloClusterE=1.0*GeV); - - /** TrackParticle Pt */ - declareProperty("TrackParticlePt", m_trackParticlePt=1.0*GeV); - - /** Electron selection */ - declareProperty("ElectronPt", m_electronPt=10*GeV); - declareProperty("ElectronEta", m_electronEta=2.5); - declareProperty("ElectronIsEMFlag", m_electronIsEMFlag="Loose"); - declareProperty("ElectronIsEM", m_electronIsEM=0); - declareProperty("AuthorEgammaOnly", m_authorEgammaOnly=false); - declareProperty("ElectronEtaWindowCut", m_electronEtaWindCut = false); - declareProperty("ElectronEtaWindow", m_electronEtaWind = 0.075); - declareProperty("ElectronEtaWindowCenter", m_electronEtaWindCent=1.445); - declareProperty("DoElectronIsolation", m_doElectronIsolation=true); - declareProperty("ElectronIsolationConeIndex", - m_electronIsolationConeIndex=1); - declareProperty("ElectronIsolationEt", m_electronIsolationEt=10*GeV); - declareProperty("NormalizedElectronIsolationEt",m_normElectronIsolEt=0.2); - - /** Photon selection */ - declareProperty("PhotonPt", m_photonPt=10*GeV); - declareProperty("PhotonEta", m_photonEta=3.2); - declareProperty("PhotonIsEM", m_photonIsEM=0); - - /** Muon selection */ - declareProperty("MuonPt", m_muonPt=3.0*GeV); - declareProperty("MuonEta", m_muonEta=2.7); - declareProperty("DoMuonIsolation", m_doMuonIsolation=true); - declareProperty("MuonIsolationConeIndex", m_muonIsolationConeIndex=1); - declareProperty("MuonIsolationEt", m_muonIsolationEt=10*GeV); - declareProperty("UseMatchChi2", m_useMatchChi2=false); - declareProperty("MuonMatchChi2", m_muonMatchChi2=100); - declareProperty("NormalizedMuonIsolationEt",m_normMuonIsolEt=0.2); - declareProperty("egDetailContainerName", - m_egDetailContainerName="egDetailAOD"); - - /** TauJet selection */ - declareProperty("TauJetPt", m_tauJetPt=20*GeV); - declareProperty("TauJetEta", m_tauJetEta=2.5); - declareProperty("TauJetLikelihood", m_tauJetLikelihood=-6.0); - declareProperty("TauEleBDTCut", m_tauEleBDTCut=0.5); // not yet set - No 23 1007 - - /** Jet selection */ - declareProperty("JetPt", m_jetPt=20*GeV); - declareProperty("JetEta", m_jetEta=5.0); - declareProperty("BJetLikelihood", m_bJetLikelihood=6.0); - -} - -StatusCode UserAnalysisSelectionTool::initialize() { - - ATH_MSG_DEBUG( "in initialize()" ); - ATH_MSG_DEBUG( " electron Flag/isEM val " << m_electronIsEMFlag << "," - << m_electronIsEM ); - - return StatusCode::SUCCESS; -} - -bool UserAnalysisSelectionTool:: -isSelected( const Analysis::Electron* electron ) const { - - if( ! electron ) { - return false; - } - - ATH_MSG_VERBOSE( "in electron isSelected()" ); - - bool select = ( ( electron->pt() > m_electronPt ) && - ( std::abs( electron->eta() ) < m_electronEta ) ); - - if( m_isAtlfast ) { - return select; - } - - if( m_electronIsEMFlag == "Loose" ) { - select = select && ( ! electron->isem( egammaPIDObs::ElectronLoose ) ); - } else if( m_electronIsEMFlag == "Medium" ) { - select = select && ( ! electron->isem( egammaPIDObs::ElectronMedium ) ); - } else if( m_electronIsEMFlag == "Tight" ) { - select = select && ( ! electron->isem( egammaPIDObs::ElectronTight ) ); - } else { - select = select && ( ( electron->isem() & m_electronIsEM ) ==0 ); - } - - ATH_MSG_VERBOSE( "in electron isSelected() -1 " ); - - if( m_authorEgammaOnly ) { - select = select && electron->author( egammaParameters::AuthorElectron ); - } - - ATH_MSG_VERBOSE( "in electron isSelected() - 2 " ); - if( m_electronEtaWindCut ) { - const double diff = std::abs( electron->eta() ) - m_electronEtaWindCent; - select = select && ( std::abs( diff ) > m_electronEtaWind ); - } - - ATH_MSG_VERBOSE( "in electron isSelected() " << m_egDetailContainerName ); - - if( m_doElectronIsolation ) { - const EMShower* egdetail = - electron->detail< EMShower >( m_egDetailContainerName ); - ATH_MSG_VERBOSE( "in electron isSelected() " << egdetail ); - double etIsol = 0.; - if( egdetail ) { - const auto helper1 = m_electronIsolationConeIndex; - const egammaParameters::ParamDef helper2 = - static_cast< egammaParameters::ParamDef >( helper1 ); - etIsol = egdetail->parameter( helper2 ); - } - select = select && ( etIsol < m_electronIsolationEt ); - if( electron->pt() ) { - select = select && ( ( etIsol / electron->pt() ) < - m_normElectronIsolEt ); - } - } - ATH_MSG_VERBOSE("in electron isSelected() - 4 "); - - return select; -} - -bool UserAnalysisSelectionTool:: -isSelected( const Analysis::Photon* photon ) const { - - if( ! photon ) { - return false; - } - - bool select = ( ( photon->pt() > m_photonPt ) && - ( std::abs( photon->eta() ) < m_photonEta ) ); - - if( m_isAtlfast ) { - return select; - } - - select = select && ( photon->isem() == m_photonIsEM ); - return select; -} - -bool UserAnalysisSelectionTool:: -isSelected( const Analysis::Muon* muon ) const { - - if( ! muon ) { - return false; - } - - bool select = ( ( muon->pt() > m_muonPt ) && - ( std::abs( muon->eta() ) < m_muonEta ) ); - - if( m_isAtlfast ) { - return select; - } - if( m_useMatchChi2 && muon->isCombinedMuon() ) { - select = select && ( muon->matchChi2() < m_muonMatchChi2 ); - } - if( m_doMuonIsolation ) { - const MuonParameters::ParamDef helper = - static_cast< MuonParameters::ParamDef >( m_muonIsolationConeIndex ); - const double etIsol = muon->parameter( helper ); - select = select && ( etIsol < m_muonIsolationEt ); - if ( muon->pt() ) { - select = select && ( ( etIsol / muon->pt() ) < m_normMuonIsolEt ); - } - } - - return select; -} - -bool UserAnalysisSelectionTool::isSelected( const Jet* jet ) const { - - if( ! jet ) { - return false; - } - - bool select = ( ( jet->pt() > m_jetPt ) && - ( std::abs( jet->eta() ) < m_jetEta ) ); - - return select; -} - -bool UserAnalysisSelectionTool:: -isSelected( const Rec::TrackParticle* trackParticle ) const { - - if( ! trackParticle ) { - return false; - } - - bool select = trackParticle->pt() > m_trackParticlePt; - - return select; -} - -bool UserAnalysisSelectionTool:: -isSelected( const CaloCluster* caloCluster ) const { - - if( ! caloCluster ) { - return false; - } - - bool select = caloCluster->e() > m_caloClusterE; - - return select; -} - -bool UserAnalysisSelectionTool:: -isSelected( const Analysis::TauJet* tauJet ) const { - - if( ! tauJet ) { - return false; - } - - const int numTrack = tauJet->numTrack(); - bool select = ( ( tauJet->pt() > m_tauJetPt ) && - ( std::abs( tauJet->eta() ) < m_tauJetEta ) && - ( ( std::abs( tauJet->charge() ) - 1.0 ) < 0.001 ) && - ( ( numTrack == 1 ) || ( numTrack == 3 ) ) ); - - const Analysis::TauPID* tauId = tauJet->tauID(); - if ( tauId ) { - const auto likelihood = - tauId->discriminant( TauJetParameters::Likelihood ); - const auto bdtelescore = - tauId->discriminant( TauJetParameters::BDTEleScore ); - select = select && ( ( likelihood > m_tauJetLikelihood ) && - ( bdtelescore > m_tauEleBDTCut ) ); - } - - return select; -} - -bool UserAnalysisSelectionTool::isBJet( const Jet* jet ) const { - - if( ! jet ) { - return false; - } - - bool select = this->isSelected( jet ); - return ( select && ( jet->getFlavourTagWeight() > m_bJetLikelihood ) ); -} diff --git a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/components/UserAnalysisUtils_entries.cxx b/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/components/UserAnalysisUtils_entries.cxx deleted file mode 100644 index 4bff409d3ad5392a28918a78ffc079b0e4a1c498..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/UserAnalysisUtils/src/components/UserAnalysisUtils_entries.cxx +++ /dev/null @@ -1,15 +0,0 @@ -//#include "UserAnalysisUtils/UserMuonTool.h" - -#include "UserAnalysisUtils/UserAnalysisPreparationTool.h" -#include "UserAnalysisUtils/UserAnalysisSelectionTool.h" -#include "UserAnalysisUtils/UserAnalysisOverlapCheckingTool.h" -#include "UserAnalysisUtils/UserAnalysisOverlapRemovalTool.h" - - -//DECLARE_COMPONENT( UserMuonTool ) - -DECLARE_COMPONENT( UserAnalysisPreparationTool ) -DECLARE_COMPONENT( UserAnalysisSelectionTool ) -DECLARE_COMPONENT( UserAnalysisOverlapCheckingTool ) -DECLARE_COMPONENT( UserAnalysisOverlapRemovalTool ) -