Linear Collider Forum



Home » Analysis and Reconstruction » Analysis Tools » how to get VtxBarrHits for a particle?
how to get VtxBarrHits for a particle? [message #1196] Sat, 13 October 2007 03:52 Go to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi, two things

1) it looks to me the Analysis101 example loops over the same event twice (histos have double entries for ex) - it's a known bug, isn't it?

2) How can I access VtxBarrHits (or any hits) for a particle from MCParticle? and vice versa if I know VtxBarrHits how can I determine from which particle are they in MCParticle? I would appreciate some examples how to do this.

Best, Andrei
Re: how to get VtxBarrHits for a particle? [message #1197 is a reply to message #1196] Sat, 13 October 2007 06:05 Go to previous messageGo to next message
kutschke
Messages: 16
Registered: June 2007
Location: Fermiliab
Hi Andrei,

This is just my 2 cents worth from a users point of view.

1) I had this problem too. Given the question, I presume that you
are running within JAS3 and have done the compile/load/go
cylce twice. When you do this, JAS3 does not delete/reset
the histograms between runs. There is a way to reset them
that I forget because I do not run within jas3. In the worst
case, exit and restart jas3.

2) The official example of accessing hits is:
http://confluence.slac.stanford.edu/display/ilc/Accessing+Si mTrackerHit+information
This gives you access to SimTrackerHits which are intersections
of a track with a sensitive volume.

At present there is no standard way to access information about hit
strips or clusters. Nick, Tim, Dima and Hans have all done work but it is all in their contrib areas. I have to run now but will send more information later.

Rob


Rob Kutschke Computing Division, MS#234
kutschke@fnal.gov Fermi National Accelerator Laboratory
Phone: (630) 840-5645 P.O. Box 500
Fax: (630) 840-2783 Batavia, IL 60510
http://home.fnal.gov/~kutschke/
Re: how to get VtxBarrHits for a particle? [message #1198 is a reply to message #1197] Sat, 13 October 2007 06:19 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi Rob,

1) you are right - thank you.

2) I think I need a bit more than this example shows. The example gives a list of all hits. I need a list of hits associated with a particular particle.

Best, Andrei
Re: how to get VtxBarrHits for a particle? [message #1199 is a reply to message #1196] Sat, 13 October 2007 09:45 Go to previous messageGo to next message
kutschke
Messages: 16
Registered: June 2007
Location: Fermiliab

Hi Andrei,

There are several options that I am aware of. As usual, several options is a bad sign...

Lots of people have "tracking cheaters" that do something like you ask. I have used one of these and it did not work properly. I don't know the status of the other codes.

There is a new development. Dima has his virtual segmentation package and Hans has a "cheater" that runs on top of it. These were described at the meeting last Tuesday and I think I recall that you were listening.

Tim Nelson also recently released some code but I have not yet
had a chance to look at it.

Below is what I am doing with Dima's and Han's stuff. Be aware that all of Dima's, Hans' and my code is in the middle of rapid development and may change three times before breakfast. Once it settles down, we will release a stable example.

First. I usually run in "batch" mode, not within jas3. ( Here batch just means that I run from the command line. ) So example is set up to run that way. For details of "batch" mode, see:
http://confluence.slac.stanford.edu/display/ilc/Running+JAS+ Programs+in+Batch+Mode

My code is in:
sandbox/RobKutschke/HitTests/v1

These are derived from examples provided by Hans and Dima.
You are getting a snapshot in the middle of my learning what information is available.

You will need to edit the main program, Hitloop.java,
to specify an input file. This code has been checked on
sid00 and sid01 - I don't know how it will behave on other
detectors.

My code works on a version of org.lcsim that was checked out
on October 6. Yesterday Dima committed some changes. He sent email saying that I need to make the following changes to use the most recent release:

> you only need to replace DigitizationDriver by
> SimToDigiDriver in your code.

I have not yet tried this.

Good luck. Let me know how well this works.

Rob



Rob Kutschke Computing Division, MS#234
kutschke@fnal.gov Fermi National Accelerator Laboratory
Phone: (630) 840-5645 P.O. Box 500
Fax: (630) 840-2783 Batavia, IL 60510
http://home.fnal.gov/~kutschke/
Re: how to get VtxBarrHits for a particle? [message #1200 is a reply to message #1199] Sat, 13 October 2007 12:37 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi Rob, - thanks! Looks like a lot of useful information but I don't know what is the sandbox - can you please tell me how to get to it from JAS3 or some other way.

Best, Andrei

Re: how to get VtxBarrHits for a particle? [message #1201 is a reply to message #1200] Sat, 13 October 2007 13:20 Go to previous messageGo to next message
kutschke
Messages: 16
Registered: June 2007
Location: Fermiliab

Hi Andrei,

The sandbox is a section of the cvs repository in which people
can put test/example/in-progress code. It is not built as part of the regular release.

To get it you need to check it out of cvs. The cvs instructions are at:

http://confluence.slac.stanford.edu/display/ilc/Building+org .lcsim+software

You will also need to build an up to date release to get Hans' and Dima's code. The jar files on the web are many months old.
The page I pointed you to, above, has instructions on building a release.

Before building a release you may need to know stuff from
all 4 bullets under "Installation Instructions" on:
http://confluence.slac.stanford.edu/display/ilc/lcsim+Tutori als

( the url above is the 4th bullet on this page ).

Sorry that this is not any easier but you are getting an accurate picture of the state of the software.

Rob


Rob Kutschke Computing Division, MS#234
kutschke@fnal.gov Fermi National Accelerator Laboratory
Phone: (630) 840-5645 P.O. Box 500
Fax: (630) 840-2783 Batavia, IL 60510
http://home.fnal.gov/~kutschke/
Re: how to get VtxBarrHits for a particle? [message #1202 is a reply to message #1196] Sat, 13 October 2007 13:22 Go to previous messageGo to next message
jfstrube
Messages: 64
Registered: September 2004
Location: Tohoku University
Hi Andrei,

the sandbox is a place for developers to put their code without having to worry about affecting other users. The code in this area is not compiled, and there is no way for you to pick it up from JAS3.
However you can download the whole codebase like this
http://confluence.slac.stanford.edu/display/ilc/Building+org .lcsim+software
Re: how to get VtxBarrHits for a particle? [message #1203 is a reply to message #1201] Sat, 13 October 2007 17:08 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi Rob, it was not too bad though I still need to figure out what maven does.. Anyway I got to your code and I think this is what I wanted

public class TrackerHitCheaterAccessDriver extends Driver {

I'll try it tomorrow.

thanks, Andrei

Re: how to get VtxBarrHits for a particle? [message #1204 is a reply to message #1202] Sat, 13 October 2007 17:16 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi Jan, after I downloaded the whole codebase what would be the best way for me to proceed if I want to use Rob's code or smth else from there? Will I be able to compile and run in JAS?

Best, Andrei
Re: how to get VtxBarrHits for a particle? [message #1205 is a reply to message #1204] Sat, 13 October 2007 19:57 Go to previous messageGo to next message
jfstrube
Messages: 64
Registered: September 2004
Location: Tohoku University
Hi Andrei,

yes, you can open Rob's files in JAS3. Just treat them like any files that you would create. Open the files in JAS3 and compile and load them from there.

Cheers,
Jan
Re: how to get VtxBarrHits for a particle? [message #1206 is a reply to message #1205] Sun, 14 October 2007 01:45 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi Jan,

here is my current problem:

I'm trying to execute

maven jas:install (I presume this is what builds lcsim and sets it up to be used in JAS - is it right?)

after this command maven downloaded a number of .jar's but GeomConverter-1.1.jar timed out. Now it can't build because of it. I found the GeomConverter-1.1.jar somewhere else (actually maven suggested doing it from www.lcsim.org but I could not find an obvious link there to download it so Google saved me). Now I don't know what to do with it to let maven know that I have it - it still tries to download it.. What should I do?

I presume my course of action now is to
1) build lcsim that includes Rob's and Hans'es code
2) compile and load pieces which I need together with my code that uses them
3) run

Best, Andrei
Re: how to get VtxBarrHits for a particle? [message #1207 is a reply to message #1206] Sun, 14 October 2007 09:36 Go to previous messageGo to next message
kutschke
Messages: 16
Registered: June 2007
Location: Fermiliab
Hi Andrei,

When I run maven, I always turn off the tests

cvs co GeomConverter
cvs co lcsim
cd GeomConverter
maven -Dmaven.test.skip=true
cd ../lcsim
maven -Dmaven.test.skip=true
maven -Dmaven.test.skip=true jas:install

I hate turnning off the tests but I usually do. I can only
run the tests on my desktop, which has 3GB of memory. If you try
to run the tests on a machine with 1GB of memory it can take
hours.

It is possible that I do not need to issue two separate maven
commands for lcsim and just do it once, with the jas:install.
I tried it once and it did not work, although the problem could
be a mistake elsewhere.

Rob


Rob Kutschke Computing Division, MS#234
kutschke@fnal.gov Fermi National Accelerator Laboratory
Phone: (630) 840-5645 P.O. Box 500
Fax: (630) 840-2783 Batavia, IL 60510
http://home.fnal.gov/~kutschke/
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 next 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.
Re: how to get VtxBarrHits for a particle? [message #1209 is a reply to message #1208] Mon, 15 October 2007 00:13 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
Dima, thanks - it looks like this is exactly what I need.

I was able to build the GeomConverter and lcsim in the end - it seems the maven server was glitching over the weekend, now all downloads and then builds just fine.

Best, andrei
Re: how to get VtxBarrHits for a particle? [message #1210 is a reply to message #1209] Mon, 15 October 2007 01:39 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
Dima, I tryed it and it works ok! Did I actually need to build lcsim for this or are those methods available in the default lcsim?

thanks, Andrei
Re: how to get VtxBarrHits for a particle? [message #1211 is a reply to message #1210] Mon, 15 October 2007 09:38 Go to previous messageGo to next message
Dmitry Onoprienko
Messages: 26
Registered: May 2004
Location: Kansas State University
Andrei, I do not remember when the last "official" release was made, so I am not sure whether it was before or after the mcTrackFinder package was moved from contrib to the main area. In any case, I would not recommend trying to use the lcsim.jar that can be downloaded through Jas3 plugin manager. Those releases are made very infrequently, and the framework is still under fairly rapid development, so if you try to use someone's recent code with old lcsim.jar, you are likely to run into problems.

I would check out both GeomConverter and lcsim modules from CVS, build them, and install into Jas3. I think you have already seen the tutorial on how to do this. If you do your own code development in NetBeans, you can also put your files into the org.lcsim source tree and build them together - with tests turned off, the build takes just a few seconds.
Re: how to get VtxBarrHits for a particle? [message #1219 is a reply to message #1211] Tue, 16 October 2007 04:53 Go to previous messageGo to next message
nomerot
Messages: 13
Registered: December 2005
Location: University of Oxford
hi Dima, I think I am making progress - thanks for your help!

I have another question : what "layer" in SimTrackerHit.getLayer()) actually means? I found that hits with layer=0 for example are not always constrained to the first VD layer but are all over the place. What is the best way to understand to which subsystem/layer this hit belongs?

Here is wjat I do so far:

public class Analysis104 extends Driver {

private AIDA aida = AIDA.defaultInstance();
protected void process(EventHeader event)
{
List<MCParticle> particles = event.get(MCParticle.class,event.MC_PARTICLES);
aida.cloud1D("nTracks").fill(particles.size());
System.out.println("# of tracks = "+particles.size());

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

// looping over particles
for (MCParticle particle : particles)
{
// for pi+ only
if (particle.getPDGID() == 211) {
System.out.println("next pion");
// filling some histos
aida.cloud1D("energy").fill(particle.getEnergy());
aida.cloud1D("cosTheta").fill(VecOp.cosTheta(particle.getMomentum()));
aida.cloud1D("phi").fill(VecOp.phi(particle.getMomentum()));
// creating list of hits for each particle
List<SimTrackerHit> hitList = map.get(particle);
// looping over hits for this particle
for (SimTrackerHit trackerHit : hitList)
{
int cell = trackerHit.getCellID();
int layer = trackerHit.getLayer();
double[] pos = trackerHit.getPoint();
System.out.println("cell = "+cell+" layer = "+layer+" x = "+pos[0]+" y = "+pos[1]);
aida.cloud2D(" layer "+layer+" x vs y").fill(pos[0], pos[1]);
}
}
}
}
}

thanks, Andrei
Re: how to get VtxBarrHits for a particle? [message #1222 is a reply to message #1219] Tue, 16 October 2007 06:28 Go to previous message
Dmitry Onoprienko
Messages: 26
Registered: May 2004
Location: Kansas State University
Hi Andrei,

Layers are numbered separately for each tracking subdetector, so
simTrackerHit.getLayer() == 0
will be true for innermost layers of VXD barrel, VXD endcap, outer tracker barrel, outer tracker endcap, and forward tracker.

Given a SimTrackerHit, you can check whether it is in VXD barrel by evaluating
simTrackerHit.getSubdetector().getName().equals("VertexBarrel")

Or, if would like to avoid string comparison at every step, you can look up Subdetector object for the vertex barrel by name once, and then compare it to the object returned by simTrackerHit.getSubdetector(). In practice, that will not make much difference since Java compiler caches short Strings, and will be doing object identity comparison anyway.

Alternatively, you can fill the map only with hits from "VtxBarrHits" list that can be fetched from the event by
List<SimTrackerHit> hitList = event.get(SimTrackerHit.class, "VtxBarrHits");

Previous Topic:question on The Students' Getting Started Guide
Next Topic:Neural Nets and lcsim.org
Goto Forum:
  

[ PDF ]

Current Time: Sat Sep 14 23:17:51 Pacific Daylight Time 2019
.:: Contact :: Home ::.

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