Message: Determining magnetic field for hit position Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Determining magnetic field for hit position 

Forum: Fields: Magnetic and Otherwise
Date: 17 Mar, 2016
From: <dtl>

Dear all,

In my simulations, I am trying to determine the magnetic field for a hit in a sensitive detector. This is what I try:

double Point[4]={step->GetPostStepPoint()->GetPosition().x(),
                 step->GetPostStepPoint()->GetPosition().y(),
                 step->GetPostStepPoint()->GetPosition().z(),
                 step->GetPostStepPoint()->GetProperTime()};
double fieldArr[6];
if(step &&
   step->GetPostStepPoint() &&
   step->GetPostStepPoint()->GetPhysicalVolume() &&
   step->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume() &&
   step->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetFieldManager() &&
   step->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetFieldManager()->GetDetectorField())
{
  step->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetFieldManager()->GetDetectorField()->GetFieldValue(Point, &fieldArr[0]);
  std::cout << "track=" << step->GetTrack()->GetTrackID()
            << " t=" << Point[3]
            << " x=" << Point[0]
            << " y=" << Point[1]
            << " z=" << Point[2]
            << " Bx=" << fieldArr[0]
            << " By=" << fieldArr[1]
            << " Bz=" << fieldArr[2]
            << " Ex=" << fieldArr[3]
            << " Ey=" << fieldArr[4]
            << " Ez=" << fieldArr[5]
            << std::endl;
}

However, this does not produce any output as the protection if-test fails.

It is not quite clear to me why this approach should not work. Is here perhaps another way to obtain the magnetic field at the hit position?

Thanks & kind regards, Dag

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: Determining magnetic field for hit position   (Gumplinger Peter - 17 Mar, 2016)
(_ None: Re: Determining magnetic field for hit position   (dtl - 18 Mar, 2016)
 Add Message Add Message
to: "Determining magnetic field for hit position"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]