How to initiate tracks in TGeometry with a TParticle

Hi,
I have created a toy tracker with TGeometry to study the errors on d0 and z0 measurements. I initially tested it with straight tracks initialized by geom->InitTrack(0,0,0,nx,ny,nz) where the initial directions are given by a random number generator. I have just implemented a uniform B-field and now want to have tracks seeded by a TParticle with a given charge and momentum so that my tracks will now become curved (helictical) tracks. I am not certain how to connect my track initialization to a single instance of a TParticle. Can you please help me understand this step?

Thanks,
Sheena

Hi Scheena,

I’m not sure I understand what you are trying to do. You can certainly store position/momentum information in a TParticle object, seed from it and update it as you propagate along the helix. I don’t see why you want to initialise from a single instance of it. You can of course do it if you just want to seed, but then where would you store the updated position after propagation? Can you be more explicit in what you want to achieve?

Regards,

Hi Andrei,

What I want to do is use the TNavigator to navigate through my tracker geometry that now has a 2T uniform B field using the charge, position, and momentum information stored in my TParticle object. I then want to add points to my TGeoVirtualTrack object corresponding to the hits in the pixel layers and also update the position and momentum of the TParticle. Is this possible?

cheers,
Sheena

Hi Sheena,

Yes, this is possible. Of course you need to handle the fact that you can only do helix propagation within the TGeoNavigator::fSafety and to handle correctly the volume boundary crossing. You can add a new TGeoTrack to match your tracks, then add points on them as you produce hits. Nothing prevents you to backup the momentum and position in the associated TParticle. It’s not clear for me what is not clear for you…

Cheers,

Hi Andrei,

What isn’t clear to me is how to do what I described. I don’t understand the TGeometry objects well enough to see how I can make the navigator take steps based on the charge, position, and momentum of the TParticle through my set B field. That is my main problem.

cheers,
Sheena

OK, now I understand, you want to make a transport engine in field using TGeo. That is not a trivial problem, but I can give you some hints:

  1. you need a propagator in field. If you limit yourself to constant magnetic field you could try TGeoHelix, which allows you to initialize from a point/direction (which you can take from TParticle) and can move the particle with a fixed step size, giving you the new point/direction. Maybe have a look to this class
  2. you need a valid geometry constructed, I guess you already have something
  3. you need a stepper, which will have to decide which steps to make to move the particle in the current geometry volume without exceeding the current material limits, which you can query only on a straight line from TGeoNavigator. The stepper will have to eventually approach every boundary very closely, then cross them with a small step in a controlled way, since you may want to generate hit positions at the entrance of some sensor.

Doing 1 and 2 will be simple, the most delicate task is 3. The algorithm is more or less the following, but there is a lot of tuning and optimisation you can do.

track_loop {
initialize TParticle object;
create new TGeoTrack object
initialize TGeoHelix from TParticle
initialize TGeoNavigator from TParticle {
TGeoNode node = nav->InitTrack(point, directoion);
}
stepping_loop {
backup current material or volume which you may need for scoring hits
volume = node->GetVolume();
if (volume = mySensor) score_hits_and_update_TGeoTrack
compute a proposed step if the propagation should be limited by some physics effect {
pstep = TMath::Min(1.e20, myPhysManager->ProposeStep());
}
query distance to next boundary and safety (closest distance to any object) from navigator {
nav->FindNextBoundary(pstep); // within proposed step
snext = nav->GetStep();
safety = nav->GetSafety();
}
check if the proposed step is smaller than the distance to boundary
if (!nav->IsOnBoundary()) && safety>tolerance) {
propagate using the TGeoHelix and update the TParticle
propagate_helix(pstep) {
helix->Step(pstep);
memcpy(current_point, helix->GetCurrentPoint(), 3
sizeof(double))
memcpy(current_direction, helix->GetCurrentDirection(), 3*sizeof(double))
// do the physics process if any
}
continue; // stepping loop in same material
}
if the distance to closest object is macroscopic, do a helix step with safety value
if (safety > tolerance) {
propagate_helix(safety)
continue;
}
// Make a snext + tolerance step along the helix
propagate_helix(snext+tolerance)
if (nav->IsSameLocation(newx, newy, newz, true)) continue;
// Here you should have crossed the boundary and the navigator reflects it
node = nav->GetCurrentNode();
// resume the stepping loop if you need to go further
}
}

Hope this helps,
Cheers,

How about:
grep -r -i magnetic ${ROOTSYS}/test/
and:
grep -r -i magnetic ${ROOTSYS}/tutorials/

Hi,
I doubt that any of those have any interactive connection to some geometry. The helix propagator can help indeed, for a constant field along Z.
Regards,

Hi Andreas, thank you this is very helpful. You are correct that I already have my geometry built and that I do want to record hits when my particle moves through a sensor material. I used TGeoNavigator to find the next boundary and step when I was using straight tracks with no magnetic field, but now using helical tracks makes using this navigator as the stepper more difficult. I will try this using your suggestions and might have more questions along the way. Thanks again.

Sheena