Linear Collider Forum



Home » Analysis and Reconstruction » Analysis Tools » how to get VtxBarrHits for a particle?
Re: how to get VtxBarrHits for a particle? [message #1208 is a reply to message #1196] Sun, 14 October 2007 17:42 Go to previous messageGo to previous message
Dmitry Onoprienko
Messages: 26
Registered: May 2004
Location: Kansas State University
Hi Andrei,

if you only need to find SimTrackerHits produced by a particular MCParticle, there is no need to run digitization or other time consuming drivers.

An event in org.lcsim does not contain mapping of MCParticles to SimTrackerHits, so you have to build it, either by hand or by using one of the cheaters. Here is an example of a driver that prints out a number of hits produced by each particle in the event record:

import java.util.*;
import org.lcsim.event.*;
import org.lcsim.recon.mcTrackFinder.MCTrackFinder;
import org.lcsim.util.Driver;

public class SimHitTest extends Driver {
  
  public void process(EventHeader event) {

    // Building the map :
    
    HashMap<MCParticle,List<SimTrackerHit>> map = MCTrackFinder.getMCParticleToSimTrackerHitMap(event);

    // Using it :
    
    List<MCParticle> mcList = event.getMCParticles();
    for (MCParticle mc : mcList) {
      List<SimTrackerHit> hitList = map.get(mc);
      System.out.println(hitList.size() +" SimTrackerHits are produced by "+ mc.getType().getName());
    }

  }
}

If you look at the source code for MCTrackFinder.getMCParticleToSimTrackerHitMap(event) method, it simply loops over all SimTrackerHits and puts them in a map based on particle returned by their getMCParticle() method. You can do it yourself rather than by using MCTrackFinder if, for example, you are only interested in vertex barrel hits and do not want to go through all SimTrackerHit collections, or if you do not want to include neutral MCParticles in the map.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:question on The Students' Getting Started Guide
Next Topic:Neural Nets and lcsim.org
Goto Forum:
  


Current Time: Thu Sep 20 21:25:21 Pacific Daylight Time 2018
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software