Accessing Event Data - PowerPoint PPT Presentation

About This Presentation
Title:

Accessing Event Data

Description:

Tree - similar to file system. Identification by path '/Event/MCEvent/MCEcalHit' Objects or ... 0..1 Relationships can be implemented using a SmartRef class-type ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 25
Provided by: markus98
Category:

less

Transcript and Presenter's Notes

Title: Accessing Event Data


1
Accessing Event Data
2
Objectives
  • After completing this lesson, you should be able
    to
  • Understand how objects are delivered to user
    algorithms.
  • Retrieve objects from the event data store within
    an algorithm.
  • Use relationships between objects.
  • Specify event data input.

3
Event Data Reside In Data Store
  • Tree - similar to file system
  • Identification by path/Event/MCEvent/MCEcalHit
  • Objects or
  • Containers of objectsObjectVectorltTypegt

4
Containers ObjectVectorltTgt
  • Templated class
  • What you fill in are pointers to T
  • Iteration like STL vector

ObjectVectorltMCParticlegt p...ObjectVectorltMCPa
rticlegtiterator ifor( ip-gtbegin() i !
p-gtend() i ) log ltlt MSGINFO ltlt
(i)-gtparticleID().id()
5
Understanding Data Stores Loading
Try to accessan object data
6
Caveats
  • Consider Objects on the store asREAD-ONLY
  • Do not modify existing objects!
  • Do not destroy existing objects!
  • Never, never delete an object which is registered
    to the store
  • Its not yours!
  • It will only screw up others!

7
Data Access In Algorithms
  • Objects can be accessed using a
    SmartDataPtrltclass-typegt
  • Usage similar to a normal pointer
  • SmartDataPtrltEventgt evt(eventSvc(),/Event)
  • if ( !evt ) !error!

Do not forget to check validity
8
SmartDataPtr Ingredients
  • SmartDataPtrltEventgt evt( eventSvc(), /Event )
  • Template class type
  • Data store manager Pointer to service
  • Item identifier location of the object

9
SmartDataPtr Usage
  • SmartDataPtrltEventgt evt(eventSvc(),/Event)
  • if ( evt )
  • MsgStream log(msgSvc(), name())
  • log ltlt MSGINFO ltlt Run ltlt evt-gtrun()
  • ltlt endreq

This will trigger some action
this as well
  • If invalid the evt-gtrun() will cause access
    violation (core dump)

10
Relationships Between Objects
  • Objects have relationships between each other
  • Vertices are also connected to particles, but
    this we neglect here...

11
Implementing Relationships
  • 0..1 Relationships can be implemented using a
    SmartRefltclass-typegt
  • Usage similar to a normal pointer
  • 0..n Relationships are implemented using a
    SmartRefVectorltclass-typegtan array of
    SmartRefltclass-typegt
  • Allow for late data loading

12
Using These Relationships
class MCParticle ... SmartRefltMCVertexgt
m_originVertex ... MCVertex
originMCVertex() return m_originMCVertex

See Doxygen code documentation
load data and trigger conversion
13
Using SmartReflttypegt
MCParticle p new MCParticle() SmartRefltMCParti
clegt ref
Assignment from raw pointer
ref p
p ref
Assignment to raw pointer
Usage
HepLorentzVector mom4 p-gtfourMomentum() HepLo
rentzVector mom4_2 ref-gtfourMomentum()
14
Specify Event Data Input
EventSelector.Input FILEsicbmc.dat
Spec-1, ... ,Spec-n
  • Event data input is specified in the job options
  • Spec is an array of qualified
    stringsKEY1VALUE1 KEYnVALUEn

15
Specify SICB Event Input
Input Type KEY VALUE SICB data file FILE
/afs//myfile.dat SICB data from
JOBID JOBID 16835
  • Retrieve JobIDs from the bookkeeping web page.
  • Our main data source is SICB output.

16
Specify Other Event Input
KEY VALUE EXAMPLE DATAFIL
E ltfile-namegt /afs//myfile.dat TYPE
lttechnologygt ROOT COLLECTIO
N lttuple-namegt MyCollection SELECTION
ltSQL-preselectiongt NTRACKgt50 FUNCTION
ltnamegt MySelector

17
Hands On Print B0 Decays
  • Use particle property service
  • See User Guide chapter 12.5
  • Retrieve MCParticles from event store
  • /Event/MC/MCParticles
  • Filter out the B0 particles
  • Part. member particleID().id() is Geant 3
    particle code
  • For each B0 Loop over all decay vertices and
    print the decay particles
  • recursion ?

18
DecayTreeAlgorithm.cpp Add Headers
include "CLHEP/Units/PhysicalConstants.h" includ
e "GaudiKernel/IParticlePropertySvc.h" include
"GaudiKernel/ParticleProperty.h" include
"GaudiKernel/SmartDataPtr.h" include
"LHCbEvent/MCParticle.h" include
"LHCbEvent/MCVertex.h"
19
Using IParticlePropertySvc
...DecayTreeAlgorithm.h... IParticleProperySvc
m_ppSvc stdstring m_partName
long m_partID ...DecayTreeAlgorit
hminitialize()... m_ppSvc 0 StatusCode
sc service("ParticlePropertySvc", m_ppSvc )
if( !sc.isSuccess() ) // You have to handle
the error! ParticleProperty partProp
m_ppSvc-gtfind( m_partName ) if ( 0 partProp
) // You have to handle the error!
m_partID partProp-gtgeantID()
20
Hands On Retrieve MCParticles
include GaudiKernel/SmartDataPtr.h
SmartDataPtrltMCParticleVectorgt
parts(eventSvc(), /Event/MC/MCParticles) if (
parts ) loop over particles
21
Hands On Loop Over MCParticles
MCParticleVectorconst_iterator
i for(iparts-gtbegin()i ! parts-gtend() i )
if ( (i)-gtparticleID().id() m_partID )
printDecayTree( i )
New member function
22
Hands On Print Decays
  • For each selected particle
  • Loop over decay vertices
  • Print all daughters
  • If daughters have decay vertices
  • recurse
  • If you run out of time, just print someparticle
    property

23
Loop Over Decay Vertices
const SmartRefVectorltMCVertexgt decays
mother-gtdecayMCVertices() SmartRefVectorltMCVert
exgtconst_iterator iv for (iv
decays.begin() iv ! decays.end() iv )
const SmartRefVectorltMCParticlegt daughters

(iv)-gtdaughterMCParticles()
SmartRefVectorltMCParticlegtconst_iterator idau
for (idaudaughters.begin()
idau!daughters.end() idau )
printDecayTree( 0, " ", idau )
24
printDecayTree
void DecayTreeAlgorithmprintDecayTree(long
depth,
const stdstring prefix,
const MCParticle mother)
MsgStream log(msgSvc(), name()) const
SmartRefVectorltMCVertexgt decays
mother-gtdecayMCVertices() ParticleProperty p
m_ppSvc-gtfind( mother-gtparticleID().id() )
log ltlt MSGINFO ltlt depth ltlt prefix.substr(0,
prefix.length()-1) ltlt "---gt" ltlt
p-gtparticle() ltlt endreq if ( depth lt m_depth )
SmartRefVectorltMCVertexgtconst_iterator
iv for ( iv decays.begin() iv !
decays.end() iv ) const
SmartRefVectorltMCParticlegt daughters
(iv)-gtdaughterMCParticles()
SmartRefVectorltMCParticlegtconst_iterator idau
for ( idau daughters.begin() idau !
daughters.end() idau )
printDecayTree( depth1, prefix" ", idau )
Write a Comment
User Comments (0)
About PowerShow.com