Message: Re: Crazy tracking error: >1 meter jumps Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Crazy tracking error: >1 meter jumps 

Keywords: tracking error
Forum: Event and Track Management
Re: Question Crazy tracking error: >1 meter jumps (Tom Roberts)
Re: None Re: Crazy tracking error: >1 meter jumps (Makoto Asai)
Date: 12 Dec, 2002
From: Tom Roberts <Tom Roberts>

[I responded via email, but it didn't appear here; this is a copy]

Makoto Asai wrote:
>> *** Discussion title: Event and Track Management
>> Email replies to PublicHyperNews@slac.stanford.edu must include:
>>   In-Reply-To: <"/eventtrackmanage/63/1"@geant4-hn.slac.stanford.edu>
>>   Subject: ...change this to be about your reply.
>> 
>> I'm almost sure your detector description has a bug.


That's what I thought, for my original much more complicated 
config. But this one is, I think, correct -- that's why I
simplified it.


>> For example, confirm D1 is placed in Cell1, D2 in Cell2,
>> and so on. I would suggest to use any visualization tool
>> to check how your detector looks like.


I did all that before posting my question. Looking at it, I
do indeed see 4 thin gray disks along z spaced roughly by 
their radius (1.0m vs 0.9m).

Below are the changed routines -- BEWARE OF LINE WRAPS!
If they occur inside a word, you'll get a compilation error
(it fits in 80 columns).

Tom Roberts	tjrob@fnal.gov


G4VPhysicalVolume* ExN01DetectorConstruction::Construct()
{
        // for simplicity, use no class variable here at all...
        // this configuration is completely different from that of exampleN01
        //      the beamline consists of 4 cells, each 1 m long
        //      each cell has a single detector at its center, 1 mm thick
        //      the beamline starts at z=0, along increasing z

        G4Material *vacuum = new G4Material("Vacuum", 1., 1.01*g/mole,
                universe_mean_density, kStateGas, 2.73*kelvin, 3.e-18*pascal);

        // a 5-meter long experimental hall (half length, beam starts at z=0)
        G4double expHall_x = 1.0*meter;
        G4double expHall_y = 1.0*meter;
        G4double expHall_z = 5.0*meter;
        G4Box* experimentalHall_box = new G4Box("expHall_box",expHall_x,
                                        expHall_y,expHall_z);
        experimentalHall_log = new G4LogicalVolume(experimentalHall_box,
                                        vacuum,"expHall_log",0,0,0);
        experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),"expHall",
                                        experimentalHall_log,0,false,0);

        // basic object sizes
        G4double cellLength = 1.0*meter;
        G4double radiusMax = 0.9*meter;
        G4double detLength = 1.0*mm;

        G4Tubs *cellTubs = new G4Tubs("CellTubs", 0.0, radiusMax,
                                        cellLength/2.0,0.0,360.0*deg);
        G4LogicalVolume *cellLog = new G4LogicalVolume(cellTubs,vacuum,
                                                        "CellLog", 0,0,0);
        G4Tubs *detTubs = new G4Tubs("DetTubs",0.0,radiusMax,0.5*detLength,
                                                        0.0,360.0*deg);
        G4LogicalVolume *detLog = new G4LogicalVolume(detTubs,vacuum,"DetLog",
                                                        0,0,0);
#ifdef G4VIS_USE
        experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
        cellLog->SetVisAttributes(G4VisAttributes::Invisible);
        G4Color color(0.7,0.7,0.7);
        detLog->SetVisAttributes(new G4VisAttributes(true, color));
#endif

        // This is a loop over the 4 cells, written out so the names can
        // be constant strings.
        G4double zCellCenter = cellLength/2.0;
        {
                // place the cell into experimentalHall_phys
                G4ThreeVector cellLocation(0.0, 0.0, zCellCenter);
                G4VPhysicalVolume *cell = new G4PVPlacement(0,cellLocation,
                        "Cell1",cellLog,experimentalHall_phys,false,0);

                // place the detector into the cell
                G4ThreeVector detLocation(0.0,0.0,0.0);
                G4VPhysicalVolume *d1 =  new G4PVPlacement(0, detLocation,
                        "D1",detLog,cell,false,0);
        }

        zCellCenter += cellLength;
        {
                // place the cell into experimentalHall_phys
                G4ThreeVector cellLocation(0.0, 0.0, zCellCenter);
                G4VPhysicalVolume *cell = new G4PVPlacement(0,cellLocation,
                        "Cell2",cellLog,experimentalHall_phys,false,0);

                // place the detector into the cell
                G4ThreeVector detLocation(0.0,0.0,0.0);
                G4VPhysicalVolume *d2 =  new G4PVPlacement(0, detLocation,
                        "D2",detLog,cell,false,0);
        }

        zCellCenter += cellLength;
        {
                // place the cell into experimentalHall_phys
                G4ThreeVector cellLocation(0.0, 0.0, zCellCenter);
                G4VPhysicalVolume *cell = new G4PVPlacement(0,cellLocation,
                        "Cell3",cellLog,experimentalHall_phys,false,0);

                // place the detector into the cell
                G4ThreeVector detLocation(0.0,0.0,0.0);
                G4VPhysicalVolume *d3 =  new G4PVPlacement(0, detLocation,
                        "D3",detLog,cell,false,0);
        }

        zCellCenter += cellLength;
        {
                // place the cell into experimentalHall_phys
                G4ThreeVector cellLocation(0.0, 0.0, zCellCenter);
                G4VPhysicalVolume *cell = new G4PVPlacement(0,cellLocation,
                        "Cell4",cellLog,experimentalHall_phys,false,0);

                // place the detector into the cell
                G4ThreeVector detLocation(0.0,0.0,0.0);
                G4VPhysicalVolume *d4 =  new G4PVPlacement(0, detLocation,
                        "D4",detLog,cell,false,0);
        }

        return experimentalHall_phys;
}

ExN01PrimaryGeneratorAction::ExN01PrimaryGeneratorAction()
{
  G4int n_particle = 1;
  particleGun = new G4ParticleGun(n_particle);

  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
  G4String particleName;
  particleGun->SetParticleDefinition(particleTable->
        			FindParticle(particleName="geantino"));
  particleGun->SetParticleEnergy(100.0*MeV);
  particleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, 0.0));
}

void ExN01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
  G4ThreeVector v(0.0,0.0,1.0);
  particleGun->SetParticleMomentumDirection(v);
  particleGun->GeneratePrimaryVertex(anEvent);
}

int main()
{
  // Construct the default run manager
  G4RunManager* runManager = new G4RunManager;

  // set mandatory initialization classes
  runManager->SetUserInitialization(new ExN01DetectorConstruction);
  runManager->SetUserInitialization(new ExN01PhysicsList);

  // set mandatory user action class
  runManager->SetUserAction(new ExN01PrimaryGeneratorAction);

  // Initialize G4 kernel
  runManager->Initialize();

  // get the pointer to the UI manager and set verbosities
  G4UImanager* UI = G4UImanager::GetUIpointer();
  UI->ApplyCommand("/run/verbose 1");
  UI->ApplyCommand("/event/verbose 1");
  UI->ApplyCommand("/tracking/verbose 1");

  // start a run
  int numberOfEvent = 1;
  runManager->BeamOn(numberOfEvent);

  // job termination
  delete runManager;
  return 0;
}

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

1 None: Re: Crazy tracking error: >1 meter jumps   (Makoto Asai - 12 Dec, 2002)
(_ Ok: Re: Crazy tracking error: >1 meter jumps   (Tom Roberts - 12 Dec, 2002)
 Add Message Add Message
to: "Re: Crazy tracking error: >1 meter jumps"

 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 ]