Reconstruction tutorial: Part 4 - PowerPoint PPT Presentation

About This Presentation
Title:

Reconstruction tutorial: Part 4

Description:

David Rousseau, Reconstruction Tutorial part 4, 30/31 January 2003. Where you should be now ... David Rousseau, Reconstruction Tutorial part 4, 30/31 January ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 14
Provided by: rou123
Category:

less

Transcript and Presenter's Notes

Title: Reconstruction tutorial: Part 4


1
Reconstruction tutorial Part 4
  • Writing a (very) simple Reconstruction/Analysis
    algorithm Z?ee-
  • Simplified from a real algorithm by Maarten
    Boonekamp (thanks!)
  • Access egamma objects, select some, compute
    invariant mass of pairs, and save a Zee object
  • Check the Z in the truth

2
Where you should be now
  • At that stage, you should have a running ZeeRec
    algorithm
  • which prints a few things (grep Zee AskAthena.log
    )
  • book variables in the ntuple but do not fill them
  • loop on egamma object and fill ZeeObject but no
    computation of the mass have been done

3
Compute kinematic quantities
  • In method ZeeObjectsetDaughters() called by
    the constructor, fill two HepLorentzVectors (
    http//wwwinfo.cern.ch/asd/lhc/clhep/doxygen/htm
    l/index.html ) with electron 4- momentum
  • m_egamma0eg1 m_egamma1eg2
  • HepLorentzVector hlv2
  • // get kinematics of the two electron and
    store in HepLorentzVector
  • for ( int i0 ilt2 i )
  • const LArCluster clus m_egammai-gtget_Cluste
    r()
  • const double eta (clus)-gteta()
  • const double phi (clus)-gtphi()
  • const double et (clus)-gtet()
  • const px et sin(phi)
  • const py et cos(phi)
  • const pz et sinh(eta)
  • const en et cosh(eta)
  • hlvi.set(px,py,pz,en)

4
kinematic quantities
  • Add 4-vectors
  • // sum kinematics in the internal 4-vector
  • m_hlvZhlv0hlv1
  • // already coded for you in ZeeObjectmass()
    etc
  • // mass() m_hlvZ.m()
  • // et() m_hlvZ.perp()
  • // phi() m_hlvZ.phi()
  • // eta() m_hlvZ.pseudoRapidity()
  • Run again and check the variables in the ntuple
    make sense (Z mass ?)

5
Note on const policy
  • We clearly want to avoid that, say, the person
    writing egamma identification modify (on purpose
    or by mistake) the content of, say, the track
    collection, which would affect downstream, say,
    primary vertex search
  • (in some very specific case, it can be that, on
    purpose, a collection is  finished  by another
    algorithm. Allowed only if it makes the code much
    simpler)
  • Collection in StoreGate are/will be locked?only
    accessible through const datahandle
  • The rest of the code need to be const-correct
  • Note that current compiler (gcc 2.95) is not very
    strict on that, but the next one (gcc 3.2, will
    become the default in the course of the year)
    will be!

6
Tips on const correct code
  • Const double a 1 // I promise not to modify a
  • Const MyObject a MyObject() // I promise
    never to modify a
  • Const MyObject a new MyObject() //I promise
    never to modify the MyObject on which a points
  • MyObject a new MyObject() const //I promise
    never to modify a
  • MyObjectMyDoer(const AnotherObject a, const
    AnotherObject b) //MyDoer promises not to
    modify a (which is passed by reference) nor the
    object pointed at by b
  • ?MyDoer accepts objects that are declared const
    or not
  • Note that the const-ness is part of the signature
    of the function so MyObjectMyDoer(const
    AnotherObject a, AnotherObject b) is another
    function

7
Tips (2)
  • MyObjectDoer() const //Doer promises not to
    modify the object it belongs to
  • ?only such const methods can be used from an
    object that was declared const
  • MyObjectDoerNonConst()
  • const MyObject theObject
  • theObject.DoerNonConst() //will not compile
    (error message no matching method best
    match..)
  • theObject.Doer() //will compile
  • So if you suddenly want to be const correct, all
    the code which depend on you may not compile any
    more if const-uncorrect
  • Hence the need to take this habit early

8
Tips (3)
  • Code with const is more readable because you
    immediately spot const variables (obviously)
  • especially when reading header files
  • Many mistakes can be detected at compile/link
    time through const correctness
  • A trivial example
  • Const a theObject.doer()
  • If (a1) // will not compile, where is the
    bug ?

9
Compute Z mass from tracks only
  • Add variable m_massFromTracks in ZeeObject and
    output in the ntuple
  • Elements of code (not complete !)
  • Add variable in ntuple (cut and paste from
    z_mass)
  • In ZeeRec/CBNT_Zee.h add m_z_massFromTracks
  • In src/CBNT_Zee.cxx declare the ntuple variable
    and fill it from ZeeObj
  • Navigation from egamma object to the track
  • EMTrackMatch trackMatch m_egammai-gtget_EMTra
    ckMatch()
  • SimpleTrack track trackMatch-gtgetTrack()
  • Do not forget to test pointers are non-null
  • you will need include files SimpleTrack/SimpleTrac
    k.h and egammaEvent/EMTrackMatch.h
  • Computation of kinematics
  • Pxcos(track-gtPhiVert())/track-gtPTInvVert()
  • Pysin(
  • Pztrack-gtCotThVert()/ track-gtPTInvVert()
  • ?4-momentum then mass
  • Please try now

10
HepMC
  • HepMC is the truth event record. It has vertex
    and particles connected in a tree.
  • (see http//cern.ch/hepmc )
  • It stores the output from the generator, physical
    particles as well as some history/hard scatter
    (GenStat3)
  • Exercise find the Zs and its daughters in the
    truth and printout some quantities in the log
    file

11
NoteGeant particle in HepMC
  • Output from Geant3 is also stored in HepMC
  • allow smooth navigation between generator world
    and geant world
  • Avoid duplication of particles
  • Allow same interface
  • However difficult to store geant specific
    information so this will need to be eventually
    improved
  • The original kine Geant3 number need to be
    recovered because it is still used to label
    detector digits
  • It is stored in barcode() or status() depending
    of the cases (see Generators/GenzModule/doc/GenzMo
    dule.pdf )

12
Look for the Z
  • //in Zeerecexecute get pointer of MC
    collection
  • const McEventCollection mcCollptr
  • if ( m_storeGate-gtretrieve(mcCollptr).isFailure(
    ) )
  • mlog ltlt MSGERROR ltlt "Could not retrieve
    McEventCollection"ltlt endreq
  • return StatusCodeFAILURE
  • //loop on event in event collection
  • McEventCollectionconst_iterator itr
  • for (itr mcCollptr-gtbegin()
    itr!mcCollptr-gtend() itr)
  • const HepMCGenEvent myEvent(itr)-gtpGenE
    vt()
  • HepMCGenEventparticle_const_iterator
    Part
  • //loop on particles in event
  • for (Part myEvent-gtparticles_begin()
    Part!myEvent-gtparticles_end() Part )
  • // good particle
  • if ((Part)-gtpdg_id()23)
  • //dump in log file (note that a HepMC
    particle is-a HepLorentzvector
  • mlog ltlt MSGINFO ltlt "Z found with mass " ltlt
    (Part)-gtmomentum().m()
  • ltlt " barcode " ltlt (Part)-gtbarcode() ltlt "
    status " ltlt (Part)-gtstatus()

13
Find daughters
  • // find decay vertex
  • const HepMCGenVertex
    endVert(Part)-gtend_vertex()
  • //loop on daughters
  • for (HepMCGenVertexparticles_out_const_iter
    ator
  • itrDauendVert-gtparticles_out_const_begin(
    )
  • itrDau!endVert-gtparticles_out_const_end()
    itrDau )
  • mlog ltlt MSGINFO ltlt " daughter found with
    type " ltlt (itrDau)-gtpdg_id()
  • ltlt " barcode " ltlt (itrDau)-gtbarcode()ltlt
    " status " ltlt (itrDau)-gtstatus()
  • ltlt " Pt " ltlt (itrDau)-gtmomentum().perp()
    ltlt endreq
  • Please try now
Write a Comment
User Comments (0)
About PowerShow.com