How to easily dump information from POOL files (AOD, D1PD, ...), from collections or simpler containers

Introduction

In this page we explain how to dump information from POOL files, like AOD, or D1PD, in the output D3PD.

The dumping is very easy: basically you only have to list the container and the information you want to dump. Then the dumping is automated. Below some examples.


Default containers/collections

Some common collections/containers are pre-defined in ATLASWatchMan and you can use them straightforward. Those are:

  • electron
  • muon
  • jet
  • met
  • truth
  • truth_jet
  • truth_met
  • info (McEventInfo)

You can see an example on how to use them in the example Steering File provided with the package; you can find it at ATLASWatchMan/run/ATLASWatchMan_AnalysisSteeringFile_benchmarkChannels.py. And more examples are provided below.

If you want other containers, it's very easy to add them, just see below.


How to add a container or a collection

Let's say you want to use the MissingEtSig::METSig container:

just open the steering file, pick up the collections dictionary and add a line like this: (you find the working example in the example steering file )

collections = {
                       'METSig_label' : { 'type': 'MissingETSig',
                                                    'name':'METSig',
                                                    'select':False},
}

And you are ready to use the MissingEtSig::METSig container as 'METSig_label'. 'METSig_label' is the label we want to use with this container. ='type' contains the class name of the conatiner, and 'name' contains the conatiner name. We set 'select': False because we do not want that that object will be part of 'candidates' (where we usually want to store objects like particles, jets, met, ...).

The same thing if we want to use the track container Rec::TrackParticleContainer::TrackParticleCandidate :

collections = {
                         'track': {'type': 'Rec::TrackParticleContainer',
                                     'name':'TrackParticleCandidate',
                                     'select': False},
}

In the same collections dictionary you can update the default built-in collections and, especially, you can declare that you want to select them: it means that those collections will be part of candidates list for each event. To select them just do:

collections = {'electron':{'select':True},
                       'muon':{'select':True},
                       'jet':{'select':True},
                       'truth_jet':{'select': True},
                       'truth': {'select': False},
                       'gen': {'select': False},
               }

Actually, you can mix up default and new containers settings in the same collections dictionary, like in the real-life example provided in the example steering file run/ATLASWatchMan_AnalysisSteeringFile_benchmarkChannels.py :

collections = {'electron':{'select':True},'muon':{'select':True},'jet':{'select':True},'truth_jet':{'select': True},
               'track': {'type':'Rec::TrackParticleContainer','name':'TrackParticleCandidate','select': False},
               'METSig':{'type':'MissingETSig','name':'METSig','select':False},
               'truth': {'select': False},'gen': {'select': False},
               }


How to dump info from the AOD

Once you set your collections you can use them in dumpContainers dict to dump information from a POOL file (AOD, DPD, ...). You only have to specify the container to use and the method, like in this example with the MissingEtSig::METSig container we defined above:

dumpContainers = { 'METSig': {'L': {'type':'  float',  'method':  '.sigL()',  },  },
                               }

where we declare that we want to use the METSig container (defined above in collections), and that we want a branch called 'L' (or, better, METSigL), that in this new branch we want to store a float, and that the method to get it it's .sigL() (see here to info on ESD&AOD content).

In the same way, we can easily specify many methods for each container, like in the following more complete working example, where we also want to dump the author() value from the ElectronAODCollection container, through the built-in pre-defined collection 'electron'.

And methods can be chained, to access nested methods, like in the example below, where we access the name() method of the first and second elements of the vector StreamTriggerName of the trigger_info() object of the McEventInfo class of the EventInfo container, through the built-in 'info' collection! :-P

dumpContainers = {'met':{},
                  'jet':{'energy_FCAL0':{'type':'float','method':'.getShape("energy_FCAL0",True)'},
                         'energy_FCAL1':{'type':'float','method':'.getShape("energy_FCAL1",True)'},
                         'energy_FCAL2':{'type':'float','method':'.getShape("energy_FCAL2",True)'}},
                  'electron':{'Author':{'type':'int','method':'.author()'}},
                  'truth':{'Pdgid':{'type':'int','method':'.pdgId()'}},
                  'METSig':{'L':{'type':'float','method':'.sigL()'}},
                  'evinfo':{'StreamTrigName0':{'type': 'str', 'method': '.trigger_info().streamTags()[0].name()'},
                               'StreamTrigName1':{'type': 'str', 'method': '.trigger_info().streamTags()[1].name()'},
                  }

Here we dump three FCAL objects from the jet container, the author() from 'electron' and the pdgId() from truth (all of them are pre-defined containers); the sigL() object from the newly added METSig container; and the same method from two element of a vector from the EventInfo container, as explained above.

You may notice the 'met': {} object above: this is necessary when we want to store in the output D3PD the standard output content for those pre-defined collections: 4mom, Charge and Channels for particles (jets, taus, electrons, ...) and Et, Eta and Phi for MET. From the example above, we will get in our output D3PD:

  • metEt
  • metPhi
  • metChannels
  • jet4mom
  • jetChannels
  • jetenergy_FCAL0
  • jetenergy_FCAL1
  • jetenergy_FCAL2
  • electron4mom
  • electronCharge
  • electronChannels
  • electronAuthor
  • truthPdgid

As you probably noticed, no muon information are inside the D3PD at this step, because we did not specify the muon container in the dumpContainers dict. ONLY containers/collections specified in the dumpContainers dict will be dumped out to the D3PD.

It's true, we selected muons in the collections dict, and it means that the muons pass through object selection, overlap removal and they will be part of candidates list (a dictionary, actually) and they can be used in formulas and in event selection cuts. But if we do not specify that we want to dump them, adding them to the dumpContainers, we will get no muons in the output.

It has designed like that in order to let the user free of defining the content of his/her own output !D3PD.

So, if we want the muons in the output, we can add this 'muon': {}, to the dumpContainers dict:

dumpContainers = {
                  'muon': {},
                  'met': {},
                  'jet':{'energy_FCAL0':{'type':'float','method':'.getShape("energy_FCAL0",True)'},
                         'energy_FCAL1':{'type':'float','method':'.getShape("energy_FCAL1",True)'},
                         'energy_FCAL2':{'type':'float','method':'.getShape("energy_FCAL2",True)'}},
                  'electron':{'Author':{'type':'int','method':'.author()'}},
                  'truth':{'Pdgid':{'type':'int','method':'.pdgId()'}},
                  'METSig':{'L':{'type':'float','method':'.sigL()'}},
                  }

...and in addition you will get the default particle content for muons as well, i.e.:

  • muon4mom
  • muonCharge
  • muonChannels

Of course in the same way as explained above you can define more objects to dump out from the muon container, as well.


Where to find information on collections and containers stored in the ESD, AOD files?

TIP You can find useful and updated information about ESD/AOD content here: AODClassSummary14

-- RiccardoMariaBianchi - 11 Mar 2009

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2009-03-23 - RiccardoMariaBianchi
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback