wiki:PageTopViewAtLpsc
close Warning: Can't synchronize with repository "(default)" (/SVN/atlas does not appear to be a Subversion repository.). Look in the Trac log for more information.

Version 14 (modified by /O=GRID-FR/C=FR/O=CNRS/OU=LPSC/CN=Julien Donini, 13 years ago) (diff)

--

TopView with release 12.0.7 (CSC)

This page is taken from the CERN twiki by Akira Shibata

  • The latest tag is TopView-00-12-14-03 ($version = 00-12-14-03 in the following)
  • This version is compatible with 12.0.7

This is the official version for CSC analysis. Unfortunately several tags needs to be checked out before proper functioning of the package.

Follow EventViewGroupArea and set yourself up to release 12.0.7 with groupArea. Define your requirement file as :

###### cmthome/requirement ######
set   CMTSITE  CERN
set   SITEROOT /afs/cern.ch

macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist
set CMTSTRUCTURINGSTYLE "with_version_directory"

# my own development area
#macro ATLAS_TEST_AREA ${HOME}/scratch0/AtlasOffline-11.5.0
macro ATLAS_TEST_AREA ${HOME}/scratch0/TopView

#macro ATLAS_TEST_AREA "" \
#    11.3.0 "${HOME}/AtlasOffline-11.3.0" \
#    11.4.0 "${HOME}/AtlasOffline-11.4.0" \
#    11.5.0 "${HOME}/AtlasOffline-11.5.0" \
#    dico   "${HOME}/dico"
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Tutorial"

# perform actual environment setup
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
apply_tag setup
apply_tag oneTest

###### EOF ######

and then setup:

   source setup.sh -tag=12.0.7,groupArea

Check out the following packages in your workarea (not necessary if packman package was used):

   cmt co -r TopView-00-12-14-03 PhysicsAnalysis/TopPhys/TopView
   cmt co -r HighPtView-00-00-32 PhysicsAnalysis/HighPtPhys/HighPtView
   cmt co -r HiggsAnalysisUtils-00-03-14 PhysicsAnalysis/HiggsPhys/HiggsAnalysisUtils
   cmt co -r EventViewConfiguration-00-00-52 PhysicsAnalysis/EventViewBuilder/EventViewConfiguration
   cmt co -r EventViewInserters-00-00-49-15 PhysicsAnalysis/EventViewBuilder/EventViewInserters

If the local setup does not have SUSYView checked out then also switch the following two lines in TopView/share/Analysis_topOptions.py

theApp.Dlls += ["SUSYView"]
theApp.Dlls += ["HiggsAnalysisUtils"]

to

theApp.Dlls += ["HiggsAnalysisUtils"]
theApp.Dlls += ["SUSYView"]

These lines can be found in the beginning of the job Options, more precisely here

# used for fitter
theApp.Dlls += ["TopTools"]
#theApp.Dlls += ["EventViewPerformance"]
theApp.Dlls += ["TopView"]
theApp.Dlls += ["SUSYView"]
theApp.Dlls += ["HiggsAnalysisUtils"]
include("EventViewConfiguration/EventViewFullInclude_jobOptions.py")

The Higgs package and !EVInserters are needed for isEM tuning (tune2). HighPtView and !EVConfig packages are needed to revert to the compatible versions (the ones in !groupArea breaks TopView).

If you are using PANDA, don't forget to checkout panda tools too

   cmt co PandaTools PhysicsAnalysis/DistributedAnalysis/PandaTools

and set up top view:

   cd PhysicsAnalysis/TopPhys/TopView/TopView-$version/cmt
   # (TopView-$version directory may not exist depending on your setup)
   cmt config
   source setup.sh
   cmt bro gmake

Finally, compile some additional packages (athena job will crash otherwise):

   cd ../../../../HiggsPhys/HiggsAnalysisUtils/HiggsAnalysisUtils-00-03-14/cmt/
   source setup.sh
   gmake

   cd ../../../../HighPtPhys/HighPtView/HighPtView-00-00-32/cmt
   source setup.sh
   gmake

Make a test:

From PhysicsAnalysis/TopPhys/TopView/TopView-$version/run do:

   athena TopView/Analysis_topOptions.py 

You must provide alternative data if you are not on lxplus. If it runs, you are all set.

Exemple of working script (read EvGen file):

    ###################################################

     ####################################################
     # Common imports and includes (no need to edit)    #
     ####################################################


from EventViewConfiguration import *
from EventViewPerformance import *
from TopView import *
from HighPtView import *

# used for fitter
theApp.Dlls += ["TopTools"]
#theApp.Dlls += ["EventViewPerformance"]
theApp.Dlls += ["TopView"]
theApp.Dlls += ["HiggsAnalysisUtils"]
theApp.Dlls += ["SUSYView"]
include("EventViewConfiguration/EventViewFullInclude_jobOptions.py")
# for reading event pool file
include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" )


     ############################################
     # Job Properties setting (change as appr)  #
     ############################################
# specify input filea
if not "InFileNames" in dir():
  # single top sample
  import glob
 # EventSelector.InputCollections = \
 # glob.glob("/usatlas/u/akira/workarea/data/AOD/*")
 #["/afs/cern.ch/user/a/ashibata/scratch0/data/trig1_misal1_mc12.005200.T1_McAtNlo_Jimmy.recon.AOD.v12000601_tid005997._01149.pool.root.1"]a default ttbar AOD sitting in Akira's scratch area. Please not this is a release 12 AOD
  EventSelector.InputCollections = \
                                 ["/afs/cern.ch/user/l/lucotte/scratch0/TopView/PhysicsAnalysis/TopPhys/TopView/TopView-00-12-14-03/run/mc12.005175.AcerMC_Zbb_2l.evgen.EVNT.v12000401_tid004390._00190.pool.root.1"]    
else: # you can also set input file from external jobOp
  EventSelector.InputCollections = InFileNames

# number of events to process, -1 for "all"
if not "EvtMax" in dir(): EvtMax=10
theApp.EvtMax = EvtMax

     ##############################################
     # Pre-config settings (change as appropriate)#
     ##############################################

# you can set the following option from outside either by using -c option of athena
# or including another joboption BEFORE this jobOption. That's what the "if not..." does
# so the following is the default
if not "Analysis"           in dir():      Analysis=["Truth","Atlfast"]
if not "SaveTrees"          in dir():      SaveTrees=["FullReco", "FastSim", "FastSimAna", "Truth", "TruthAna", "TruthAll"]
if not "TtbarAnalysis"      in dir():      TtbarAnalysis=["LepJets"] #"LepJetsFit", "NoBTag"
if not "SingleTopAnalysis"  in dir():      SingleTopAnalysis=[] # "Leptonic", "LepJetsFit", "NoBTag"
if not "OutputLevel"        in dir():      OutputLevel=3
if not "KinematicsOnly"     in dir():      KinematicsOnly=False
if not "ParamBtag"          in dir():      ParamBtag=False
if not "SemilepTagging"     in dir():      SemilepTagging=False
if not "SecondaryVertex"    in dir():      SecondaryVertex=False
if not "NtupleName"         in dir():      NtupleName="TopViewAANtuple.root"
if not "doScreenDump"       in dir():      doScreenDump=True
if not "showUserData"       in dir():      showUserData=False
if not "doHisto"            in dir():      doHisto=True
if not "doAnalysis"         in dir():      doAnalysis=True
if not "doMatch"            in dir():      doMatch=True
if not "doJiveXML"          in dir():      doJiveXML=False
if not "doTrigger"          in dir():      doTrigger=False
if not "doPrintMC"          in dir():      doPrintMC=False
if not "doDumpMC"           in dir():      doDumpMC=False
if not "doSGDump"           in dir():      doSGDump=False
if not "readEvgen"          in dir():      readEvgen=True
if not "exportContainer"    in dir():      exportContainer=False
if not "removeOverlap"      in dir():      removeOverlap=True;      
if not "doObjSelection"     in dir():      doObjSelection=True
if not "fix1mmBug"          in dir():      fix1mmBug=False
if not "fixTauBug"          in dir():      fixTauBug=True
if not "doStream"           in dir():      doStream=True
if not "eventQuery"         in dir():      eventQuery=""


if doStream:
  if "Truth" in Analysis: Analysis.pop(Analysis.index("Truth"))
  if "Atlfast" in Analysis: Analysis.pop(Analysis.index("Atlfast"))

if doPrintMC or doDumpMC or doSGDump:  Analysis=[]

if readEvgen: 
  include("TopView/EvgenToAtlfast_jobOptions.py")
  Analysis=["Truth","Atlfast"]

if "LepJetsFit" in TtbarAnalysis: 
  import shutil
  from AthenaCommon.Utils.unixtools import FindFile
  shutil.copy(FindFile("defaults.txt",os.environ[ 'DATAPATH' ].split(os.pathsep),os.R_OK ), ".")

if fix1mmBug:
  #do 1mm correction 
  doAODFix1mm=True 
  include( "ElectronPhotonAlgs/ElectronPhotonCorrector_jobOptions.py") 
  include( "JetMissingEtAlgs/ParticleJet1mmCorrection_jobOptions.py") 
  include( "JetMissingEtAlgs/MissingET1mmCorrection_jobOptions.py") 

  if not "FullRecoInserter" in dir():
    FullRecoInserter = TopViewInserters("Inserter", mode="FullReco" , overlapRemoval=removeOverlap, selection=doObjSelection)

  FullRecoInserter.METInserter.override(
    {  "MissingETKeys" : ["MET_Final", 
                         "MET_RefFinal",
                         "ObjMET_Final", 
                         "MET_Base",
                         "MET_Calib",
                         "MET_Muon",
                         "MET_MuonBoy",
                         "MET_Final",
                         "MET_Cryo",
                         "MET_CryoCone",
                         "MET_Topo",
                         "MET_CellOut",
                         "MET_RefEle", 
                         "MET_RefJet",
                        ],
       "DefaultMETKey":"MET_RefFinal_1mmCorrection",
      })

if fixTauBug:
  doTauRecEtCorrection=True
  include("TauAlgs/TauRecEtCorrection_jobOptions.py")

# current limitation due to duplicate preparator issue
if "Trigger" in Analysis:
  doTrigger=True
if not "Truth" in Analysis:
  doMatch=False

def newMOLooper(name, output, input="", outputLevel=3):
  looper = EVMultipleOutputToolLooper(name)
  looper.EventViewCollectionOutputName=output
  if input: looper.EventViewCollectionInputName=input
  looper.OutputLevel=outputLevel
  return looper

# not working now...
from ROOT import *
def saveLog(logString, name):
  macroName=name+"Append.C"
  f = open(macroName, "w")
  f.write('{ \
    TDirectory *dir = gDirectory; \
    dir->mkdir("Selection"); \
    dir->cd("Selection"); \
    TText str; \
    str.SetName("'+name+'"); \
    str.SetText(0.0,0.9,"'+logString+'"); \
    str.Write(); \
  }')
  f.close()
  return macroName
  
    #str.SetText(0.0,0.9,"test"); \
     ###########################################
     # JobOptions (cook up your job)           #
     ###########################################

# instanciate the top alg sequence for athena, only one is required
theJob = AlgSequence()

if "Trigger" in Analysis:
  # include full trigger tree
  theApp.Dlls += ["EventViewTrigger"]
  triggerLooper = EVMultipleOutputToolLooper( "triggerLooper" )
  triggerLooper.EventViewCollectionOutputName = "TriggerView"
  theJob += triggerLooper

  triggerLooper += TriggerInserters( "trigInserters", slices = [ "Muon", "Electron", "Photon", "Tau", "Jet"  ] )
  triggerLooper += TriggerCalculators( "trigCalculators", slices = [ "Muon", "Electron", "Jet", "Tau", "Photon" ] )

  if "Trigger" in SaveTrees:
    triggerLooper += AANtupleFromUserData( "TriggerAADumper", filename = NtupleName,
                      sequencer = theJob, EventTree = True,
                      CandTree = False, Prefix = "Trigger",
                      MakeFriends=False )

if doTrigger : 
  theApp.Dlls += ["EventViewTrigger"]
  TriggerPrepLooper= EVMultipleOutputToolLooper("TriggerPrepLooper")
  TriggerPrepLooper.EventViewCollectionOutputName="DummyTriggerView"
  if not "TriggerLevels" in dir(): TriggerLevels=[ "L1", "L2", "EF",
                                      "Muon", "E/Gamma", "Electron", "Photon", "Tau",
                                      "Jet", "MissingEt" ]
  theJob += TriggerPrepLooper
  
  if not "Trigger" in Analysis:
    TriggerPrepLooper += L1TriggerPreparators("L1TrigPrep",TriggerLevels)
    TriggerPrepLooper += L2TriggerPreparators("L2TrigPrep",TriggerLevels)
    TriggerPrepLooper += EFTriggerPreparators("EFTrigPrep",TriggerLevels)
  else:
    TriggerPrepLooper += anEVTool( "ManT::EVL1EMTauObjPreparator/L1EMTauObjPreparator")
    TriggerPrepLooper += anEVTool( "ManT::EVL1JetObjPreparator/L1JetObjPreparator")

    TriggerPrepLooper.L1EMTauObjPreparator.setProperty( {
      "OutputKey"      : "Temp_L1EMTauObjectContainer",
      "SGKeyContains"   : [ "L1EMTauObjectContainer" ]
      } )
              
    TriggerPrepLooper.L1JetObjPreparator.setProperty( {
      "OutputKey"      : "Temp_L1JetObjectContainer",
      "SGKeyContains"   : [ "L1JetObjectContainer" ]
      } )

     ###########################################
     # Reco Insertion (with comments!)         #
     ###########################################

if "FullReco" in Analysis:
  # Instanciate one tool looper for reconstructed EV
  FullRecoLooper = newMOLooper("FullRecoLooper", "FullRecoView", outputLevel=OutputLevel)
  theJob += FullRecoLooper
  # Insert objects and label them
  if "FullRecoInserter" in dir(): FullRecoLooper += FullRecoInserter
  else: 
    FullRecoLooper += TopViewInserters("Inserter", mode="FullReco", overlapRemoval=removeOverlap, selection=doObjSelection )
  FullRecoLooper += TopViewLabel("AnalysisLabel")

  if exportContainer : 
    FullRecoLooper += ContainerExport("Exporter", FullRecoLooper.Inserter)
    Analysis.pop(Analysis.index("FullReco")) # don't do the rest

  # apply correction to jets from leptons, not on by default.
  # merge muon with jet if it's close
  # FullRecoLooper += MergeMuonAndJetTag("MuonJetMerge")  
  # subtract electron from jet when close
  # FullRecoLooper += SubtractElecFromJet("ElecJetSub")

if "FullReco" in Analysis:
  # dump object info into user data
  FullRecoLooper += RecoUserDataDump("UDCalc", Labels=[], onlyKin=KinematicsOnly , semilepB=SemilepTagging)
  if ParamBtag: FullRecoLooper += ParamBTagger("Paramtagger", process=ParamBtag)
  if doTrigger: 
    FullRecoLooper += HighPtRecoCalculator("HiPTUDCalc" , DetailLevel=["Jet_Info_C4_.LooperToolProperties['Prefix']:'PJet_'"], truthMatch=False,
               JetContainers=[["C4_","Cone4TruthParticleJets","Cone4"]],      
               triggerMatch=True,triggerLevels=[ "L1", "L2", "EF","Muon", "E/Gamma", "Electron", "Photon", "Tau","Jet", "MissingEt" ],
               saveHLTMET=True)

  # calculate top variables (HT, MTot, Transverse Mass)
  FullRecoLooper += EventVarCalculator("EventVar")
  # Find forward jets 
  FullRecoLooper += ForwardJetFinder("FWJet")  

  # added by Joerg Walbersloh for SecondaryVertexTool <walbers@physik.uni-dortmund.de>
  if SecondaryVertex: FullRecoLooper += EVSecVtxUserData("SecVertexCalculator", outputLevel=OutputLevel)
  # end addition by Joerg Walbersloh

  # performance analysis on object distance
  #FullRecoLooper += NearestAssociators("distance")  

     ###########################################
     # Atlfast Insertion                       #
     ###########################################

if "Atlfast" in Analysis:
  FastSimLooper = newMOLooper("FastSimLooper", "FastSimView", outputLevel=OutputLevel)
  theJob += FastSimLooper
  
  if "FastSimInserter" in dir(): FastSimLooper += FastSimInserter
  else:  FastSimLooper += TopViewInserters("Inserter", mode="FastSim" , overlapRemoval=removeOverlap, selection=doObjSelection)
  FastSimLooper += TopViewLabel("AnalysisLabel")

  if exportContainer : 
    FastSimLooper += ContainerExport("Exporter", FastSimLooper.Inserter)
    Analysis.pop(Analysis.index("Atlfast")) # don't do the rest

if "Atlfast" in Analysis:
  FastSimLooper += RecoUserDataDump("UDCalc", Labels=[], onlyKin=True, semilepB=False, AtlfastB=True)
  if ParamBtag: FastSimLooper += ParamBTagger("FastParamtagger", process=ParamBtag)
  FastSimLooper += EventVarCalculator("EventVar", sphericity=True)
  FastSimLooper.EventVar.SumAllObj.ObjectName="FastSimAllObjects"
  FastSimLooper += ForwardJetFinder("FWJet" )  

     ###########################################
     # Truth Insertion                         #
     ###########################################

if "Truth" in Analysis:
  TruthLooper = newMOLooper("TruthLooper", "TruthView", outputLevel=OutputLevel)
  theJob += TruthLooper

  if "TruthInserter" in dir(): TruthLooper += TruthInserter
  else: TruthLooper += TopViewTruthInserters("Inserter", allTruth=False)
  #TruthLooper.Inserter.EventInfo.AlternativeWeight=True

  if exportContainer : 
    TruthLooper += ContainerExport("Exporter", TruthLooper.Inserter, truth=True)
    Analysis=[] # don't do the rest
    StoreGateSvc = Service( "StoreGateSvc" )
    StoreGateSvc.Dump = True  #true will dump data store contents

if "Truth" in Analysis:
  TruthLooper += anEVTool("EVUDFinalStateLooper/looper")
  TruthLooper.looper.Labels=["Truth"]
  TruthLooper.looper.Prefix="Tru_"
  TruthLooper.looper += anEVTool("MotherInfo/TopMother")
  TruthLooper.looper += anEVTool("EVUDTruthParticleTree/truthtree")
  TruthLooper.looper.truthtree.OutputLevel=ERROR
  TruthLooper.looper.TopMother.MotherLabel="Top"
  #TruthLooper.looper += anEVTool("TruthPdgLabeller")

  if doMatch:
    if "FullReco" in Analysis: TruthLooper += TruthToRecoAssociators("PerformanceFullReco", "FullRecoView", singleEVLooper=False)
    elif "Atlfast" in Analysis: TruthLooper += TruthToRecoAssociators("PerformanceFastSim", "FastSimView", singleEVLooper=False)
  if "Truth" in SaveTrees:
    TruthLooper += AANtupleFromUserData("AADumper", filename=NtupleName, sequencer=theJob, \
                                            EventTree=True, CandTree=False, Prefix="Truth", MakeFriends=False)
  #TruthLooper.AADumper.setMacro(saveLog(str(TruthLooper.Inserter), "TruthSelection"))

# this will insert all truth
if "TruthAll" in Analysis:
  TruthLooperAll = newMOLooper("TruthLooperAll", "TruthViewAll", outputLevel=OutputLevel)
  theJob += TruthLooperAll
  TruthLooperAll += TopViewTruthInserters("Inserter", allTruth=True)

  TruthLooperAll += anEVTool("EVUDFinalStateLooper/looper")
  TruthLooperAll.looper.Labels=["Truth"]
  TruthLooperAll.looper.Prefix="Tru_"
  TruthLooperAll.looper += anEVTool("EVUDKinCalc")
  TruthLooperAll.looper += anEVTool("EVUDTruthParticleAll")
  TruthLooperAll.looper += anEVTool("EVUDTruthParticleTree")

  if "TruthAll" in SaveTrees:
    TruthLooperAll += AANtupleFromUserData("AADumper", filename=NtupleName, sequencer=theJob, \
                                            EventTree=True, CandTree=False, Prefix="TruthAll", MakeFriends=False)

     ###########################################
     # post truth processing (match)           #
     ###########################################

# save object part only
if "FullReco" in Analysis:
  FullRecoLooperPost = newMOLooper("FullRecoLooperPost", "FullRecoViewPost", "FullRecoView", outputLevel=OutputLevel)
  theJob += FullRecoLooperPost

  if "Truth" in Analysis and doMatch: # FullRec to Truth match
    FullRecoLooperPost += MatchRecoToTruth("TruthMatch",  "TruthView", onlyKin=KinematicsOnly)
  if "FullReco" in SaveTrees:
    FullRecoLooperPost += AANtupleFromUserData("AADumper", filename=NtupleName, sequencer=theJob, \
                                                EventTree=True, CandTree=False, Prefix="FullReco", MakeFriends=False)
  #FullRecoLooperPost.AADumper.setMacro(saveLog(str(FullRecoLooper.Inserter), "FullRecoSelection"))

if "Atlfast" in Analysis:
  FastSimLooperPost = newMOLooper("FastSimLooperPost", "FastSimViewPost", "FastSimView", outputLevel=OutputLevel)
  theJob += FastSimLooperPost

  if "Truth" in Analysis and doMatch: 
    FastSimLooperPost += MatchRecoToTruth("TruthMatch",  "TruthView", onlyKin=KinematicsOnly)
  if "FastSim" in SaveTrees:
    FastSimLooperPost += AANtupleFromUserData("AADumper", filename=NtupleName, sequencer=theJob, \
                                              EventTree=True, CandTree=False, Prefix="FastSim", MakeFriends=False)
  #FastSimLooperPost.AADumper.setMacro(saveLog(str(FastSimLooper.Inserter), "FastSimSelection"))

     ###########################################
     # a ttbar analysis                        #
     ###########################################

if doAnalysis:
  if "FullReco" in Analysis:
    FullRecoLooperAna = newMOLooper("FullRecoLooperAna", "FullRecoViewAna", "FullRecoView", outputLevel=OutputLevel)
    theJob += FullRecoLooperAna

    FullRecoLooperAna += anEVTool("EVMakeChild/MakeChildEV") # for ntuple organization purpose
    #if doScreenDump: FullRecoLooperAna+=EVScreenDump("RecoScreenDumpertmp", printUD=showUserData, printUDVals=showUserData)

    if "LepJets" in TtbarAnalysis:
      if "BTag" in TtbarAnalysis:
        FullRecoLooperAna += TTBarReconstruction("ttbar", sort=True)
      else:
        FullRecoLooperAna += TTBarReconstructionNoB("ttbar", keepCombination=False)
    elif "LepJetsFit" in TtbarAnalysis:
      theApp.Dlls += ["TopTools"]
      if "BTag" in TtbarAnalysis:
        FullRecoLooperAna += TTBarReconstructionFit("ttbar")
      else:
        FullRecoLooperAna += TTBarReconstructionFit("ttbar")
    
    if "Leptonic" in SingleTopAnalysis:
      FullRecoLooperAna += WgluonSingleTopReconstruction("singleT", sort=True)
      # example of using booster
      #FullRecoLooperAna += TopRestFrameBooster("topbooster", "TopWithLeptonicW")
      #FullRecoLooperAna.topbooster.OutputLevel=2

    FullRecoLooperAna += anEVTool("EVEventInfoUserData/EventInfo"),
    FullRecoLooperAna += TopViewSelection("Selection", ttbarCut=True)


  if "Atlfast" in Analysis:
    FastSimLooperAna = newMOLooper("FastSimLooperAna", "FastSimViewAna", "FastSimView", outputLevel=OutputLevel)
    theJob += FastSimLooperAna

    FastSimLooperAna += anEVTool("EVMakeChild/MakeChildEV") # for ntuple organization purpose

    if "LepJets" in TtbarAnalysis:
      if "BTag" in TtbarAnalysis:
        FastSimLooperAna += TTBarReconstruction("ttbar", sort=True)
      else:
        FastSimLooperAna += TTBarReconstructionNoB("ttbar")
    elif "LepJetsFit" in TtbarAnalysis:
      theApp.Dlls += ["TopTools"]
      if "BTag" in TtbarAnalysis:
        FastSimLooperAna += TTBarReconstructionFit("ttbar")
      else:
        FastSimLooperAna += TTBarReconstructionFit("ttbar")
    
    if "Leptonic" in SingleTopAnalysis:
      FastSimLooperAna += WgluonSingleTopReconstruction("singleT", sort=True)

    FastSimLooperAna += anEVTool("EVEventInfoUserData/EventInfo"),
    FastSimLooperAna += TopViewSelection("Selection", ttbarCut=True)

     ###########################################
     # truth match (from truth)                #
     ###########################################

  if "Truth" in Analysis:
    TruthLooperPost = newMOLooper("TruthLooperPost", "TruthViewPost", "TruthView", outputLevel=OutputLevel)
    theJob += TruthLooperPost
    TruthLooperPost += anEVTool("EVMakeChild/MakeChildEV") # for ntuple organization purpose

    TruthLooperPost+=EventVarCalculator("EventVar", sphericity=False)
    TruthLooperPost.EventVar.ObjectsForHT.RejectLabels=["Top","W","Neutrino"]
    TruthLooperPost.EventVar.EtCalc.MissEtName="MissingEtTruth"
    TruthLooperPost.EventVar.EtCalc.VariableName="HT"
    TruthLooperPost.EventVar.SumAllObj.ObjectName="TruAllObjects"

    if "FullReco" in Analysis and doMatch: 
      TruthLooperPost += MatchTruthToReco("TruthMatch",  "FullRecoViewAna" , onlyKin=KinematicsOnly)
    elif "Atlfast" in Analysis and doMatch: # if run on fast AOD
      TruthLooperPost += MatchTruthToReco("TruthMatch",  "FastSimViewAna" , onlyKin=KinematicsOnly)

    TruthLooperPost += anEVTool("EventTypeCalcTtbar/EventType")

    # calculates polarization of top, only for single top
    # TruthLooperPost += anEVTool("TopMotherInserter/motherIns") 

    if doScreenDump: TruthLooperPost+=EVScreenDump("TruthScreenDumper", printUD=showUserData, printUDVals=showUserData)
    if "TruthAna" in SaveTrees:
      TruthLooperPost += AANtupleFromUserData("AADumper", filename=NtupleName, sequencer=theJob, \
                                              EventTree=True, CandTree=False, Prefix="TruthAna", SaveParent=False, MakeFriends=False)
    if doHisto: TruthLooperPost += TruthHistograms("truthHisto",  match=True)

     ###########################################
     # Reco to Truth match                     #
     ###########################################

  if "FullReco" in Analysis:
    FullRecoLooperAnaPost = newMOLooper("FullRecoLooperAnaPost", "FullRecoViewAnaPost", "FullRecoViewAna", outputLevel=OutputLevel)
    theJob += FullRecoLooperAnaPost

    if SingleTopAnalysis or TtbarAnalysis:
      FullRecoLooperAnaPost += WTopCalculator("RecCalculator","TruthView", match=doMatch, onlyKin=KinematicsOnly)

    if doScreenDump: FullRecoLooperAnaPost +=EVScreenDump("RecoScreenDumper", printUD=showUserData, printUDVals=showUserData)

    if "FullRecoAna" in SaveTrees:
      FullRecoLooperAnaPost += AANtupleFromUserData("RecoAADumper", filename=NtupleName, sequencer=theJob, \
                                            EventTree=True, CandTree=False, Prefix="FullRecoAna", SaveParent=False, MakeFriends=False)

    # validation histogram
    if doHisto: FullRecoLooperAnaPost += RecoHistograms("recoHisto",  match=True, stream=doStream)

  if "Atlfast" in Analysis:
    FastSimLooperAnaPost = newMOLooper("FastSimLooperAnaPost", "FastSimViewAnaPost", "FastSimViewAna", outputLevel=OutputLevel)
    theJob += FastSimLooperAnaPost

    if SingleTopAnalysis or TtbarAnalysis:
      FastSimLooperAnaPost += WTopCalculator("WTopCalc","TruthView", match=doMatch, onlyKin=KinematicsOnly)
    if doScreenDump: FastSimLooperAnaPost+=EVScreenDump("FastScreenDumper", printUD=showUserData, printUDVals=showUserData)
    if "FastSimAna" in SaveTrees:
      FastSimLooperAnaPost += AANtupleFromUserData("FastAADumper", filename=NtupleName, sequencer=theJob, \
                                            EventTree=True, CandTree=False, Prefix="FastSimAna", SaveParent=False, MakeFriends=False)
    # not making histogram from fast sim
    if doHisto and not "FullReco" in Analysis : FastSimLooperAnaPost += RecoHistograms("fastHisto", match=True, stream=doStream)

     ###########################################
     # Jive XML                                #
     ###########################################

  if "FullReco" in Analysis:
    if doJiveXML:
      FullRecoLooperJive = EVMultipleOutputToolLooper("FullRecoLooperJive")
      FullRecoLooperJive.EventViewCollectionOutputName="FullRecoViewJive"
      FullRecoLooperJive.EventViewCollectionInputName="FullRecoViewAnaPost"
      theJob += FullRecoLooperJive
      # example of using JiveXML with a cut
      FullRecoLooperJive += EVJiveXML("jive")  
      FullRecoLooperJive.jive.XMLDumper.EventData2XML.EventViewkey="FullRecoViewAnaPost"
      FullRecoLooperJive.jive.XMLDumper.EventData2XML.CompositeParticlekey=""
      FullRecoLooperJive.jive.XMLDumper.CutName="tt_CommissioningCut"

     ###########################################
     # Event Query                             #
     ###########################################

if eventQuery:
  EventSelector.CollectionType="ExplicitROOT"
  EventSelector.Query= eventQuery

     ###########################################
     # Small Tools                             #
     ###########################################

# misc job Options when running these, don't rune the above

# dump truth info
if doDumpMC: include("TopView/DumpMC_jobOptions.py") 
if doPrintMC: include("TopView/PrintMC_jobOptions.py") 

# dump the contents of the StoreGate
# you shoud use "athena -i" to use this one
if doSGDump: 
  theApp.EvtMax = 1
  StoreGateSvc = Service( "StoreGateSvc" )
  StoreGateSvc.Dump = True  #true will dump data store contents

     ###########################################
     # Final setup (no need to edit)           #
     ###########################################

# useful for debugging, larger left margin (comment out as necessary)
MessageSvc.Format = "% F%70W%S%7W%R%T %0W%M"
MessageSvc.defaultLimit = 9999999

#FullRecoLooperAna.ttbar.HitFit.fitter.UseMinuit=True
print theJob

  • NOTE: TopView? is a runtime package, you can run your jobs from TopView?/run directory. You don't need to go to UserAnalysis.