more on kernel
DESCRIPTION
June 2005, Geant4 v7.0p01. More on kernel. Makoto Asai (SLAC) Geant4 Tutorial Course the 2nd Finnish Geant4 Workshop June 6-7 2005, Helsinki Institute of Physics. Contents. Detector sensitivity Track and step statuses Attaching user information to G4 classes Stacking mechanism - PowerPoint PPT PresentationTRANSCRIPT
More on kernelMore on kernel
Makoto Asai (SLAC)Makoto Asai (SLAC)
Geant4 Tutorial CourseGeant4 Tutorial Course
the 2nd Finnish Geant4 Workshop the 2nd Finnish Geant4 Workshop
June 6-7 2005, Helsinki Institute of June 6-7 2005, Helsinki Institute of Physics Physics
June 2005, Geant4 v7.0p01
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 22
ContentsContents Detector sensitivityDetector sensitivity Track and step statusesTrack and step statuses Attaching user information to G4 classesAttaching user information to G4 classes Stacking mechanismStacking mechanism Cuts per regionCuts per region Event biasingEvent biasing Fast simulation (Shower parameterization)Fast simulation (Shower parameterization)
Detector SensitivityDetector Sensitivity
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 44
Sensitive detector and HitSensitive detector and Hit
Each Logical Volume can have a pointer to a sensitive detector.Each Logical Volume can have a pointer to a sensitive detector.
Then this volume becomes Then this volume becomes sensitivesensitive..
Hit is a snapshot of the physical interaction of a track or an Hit is a snapshot of the physical interaction of a track or an
accumulation of interactions of tracks in the sensitive region of your accumulation of interactions of tracks in the sensitive region of your
detector.detector.
A sensitive detector creates hit(s) using the information given in A sensitive detector creates hit(s) using the information given in
G4Step object. The user has to provide his/her own implementation G4Step object. The user has to provide his/her own implementation
of the detector response.of the detector response.
UserSteppingAction class UserSteppingAction class should NOTshould NOT do this. do this.
Hit objects, which are still the user’s class objects, are collected in a Hit objects, which are still the user’s class objects, are collected in a
G4Event object at the end of an event.G4Event object at the end of an event.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 55
Detector sensitivityDetector sensitivity A sensitive detector eitherA sensitive detector either
constructs one or more hit objects or constructs one or more hit objects or
accumulates values to existing hits accumulates values to existing hits
using information given in a G4Step object.using information given in a G4Step object.
Note that you must get the volume information from the “PreStepPoint”.Note that you must get the volume information from the “PreStepPoint”.
Begin of step point
End of step pointStep
Boundary
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 66
Digitizer module and digitDigitizer module and digit Digit represents a detector output (e.g. ADC/TDC count, trigger signal, Digit represents a detector output (e.g. ADC/TDC count, trigger signal,
etc.).etc.).
Digit is created with one or more hits and/or other digits by a user's Digit is created with one or more hits and/or other digits by a user's
concrete implementation derived from G4VDigitizerModule.concrete implementation derived from G4VDigitizerModule.
In contradiction to the sensitive detector which is accessed at tracking In contradiction to the sensitive detector which is accessed at tracking
time automatically, the digitize() method of each G4VDigitizerModule time automatically, the digitize() method of each G4VDigitizerModule
must be must be explicitly invokedexplicitly invoked by the user’s code (e.g. at EventAction). by the user’s code (e.g. at EventAction).
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 77
Hit classHit class Hit is a user-defined class derived from Hit is a user-defined class derived from G4VHitG4VHit.. You can store various types information by implementing your own You can store various types information by implementing your own
concrete Hit class. For example:concrete Hit class. For example: Position and time of the step Position and time of the step Momentum and energy of the track Momentum and energy of the track Energy deposition of the step Energy deposition of the step Geometrical information Geometrical information or any combination of aboveor any combination of above
Hit objects of a concrete hit class must be stored in a dedicated collection Hit objects of a concrete hit class must be stored in a dedicated collection
which is instantiated from which is instantiated from G4THitsCollection template classG4THitsCollection template class.. The collection will be associated to a G4Event object via The collection will be associated to a G4Event object via G4HCofThisEventG4HCofThisEvent.. Hits collections are accessible Hits collections are accessible
through G4Event at the end of event.through G4Event at the end of event. to be used for analyzing an eventto be used for analyzing an event
through G4SDManager during processing an event.through G4SDManager during processing an event. to be used for event filtering.to be used for event filtering.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 88
Implementation of Hit Implementation of Hit classclass#include "G4VHit.hh"#include "G4VHit.hh"
class MyDriftChamberHit : public G4VHitclass MyDriftChamberHit : public G4VHit{{ public:public: MyDriftChamberHit(MyDriftChamberHit(some_arguments);); virtual ~MyDriftChamberHit();virtual ~MyDriftChamberHit(); virtual void Draw();virtual void Draw(); virtual void Print();virtual void Print(); private:private: // some data members// some data members public:public: // some set/get methods// some set/get methods};};
#include “G4THitsCollection.hh”#include “G4THitsCollection.hh”#typedef G4THitsCollection<MyDriftChamberHit>#typedef G4THitsCollection<MyDriftChamberHit> MyDriftChamberHitsCollection;MyDriftChamberHitsCollection;
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 99
Sensitive Detector classSensitive Detector class Sensitive detector is a user-defined class derived from Sensitive detector is a user-defined class derived from
G4VSensitiveDetector.G4VSensitiveDetector.
#include "G4VSensitiveDetector.hh"#include "G4VSensitiveDetector.hh"#include "MyDriftChamberHit.hh"#include "MyDriftChamberHit.hh"class G4Step;class G4Step;class G4HCofThisEvent;class G4HCofThisEvent;class MyDriftChamber : public G4VSensitiveDetectorclass MyDriftChamber : public G4VSensitiveDetector{{ public:public: MyDriftChamber(G4String name);MyDriftChamber(G4String name); virtual ~MyDriftChamber();virtual ~MyDriftChamber(); virtual void Initialize(G4HCofThisEvent*HCE);virtual void Initialize(G4HCofThisEvent*HCE); virtual G4bool ProcessHits(G4Step*aStep, virtual G4bool ProcessHits(G4Step*aStep, G4TouchableHistory*ROhist);G4TouchableHistory*ROhist); virtual void EndOfEvent(G4HCofThisEvent*HCE);virtual void EndOfEvent(G4HCofThisEvent*HCE); private:private: MyDriftChamberHitsCollection * hitsCollection;MyDriftChamberHitsCollection * hitsCollection; G4int collectionID;G4int collectionID;};};
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1010
Sensitive detectorSensitive detector A A trackertracker detector typically generates detector typically generates a hit for every single step of a hit for every single step of
every single (charged) trackevery single (charged) track.. A tracker hit typically contains A tracker hit typically contains
Position and timePosition and time Energy deposition of the stepEnergy deposition of the step Track IDTrack ID
A A calorimetercalorimeter detector typically generates a hit for every cell, and detector typically generates a hit for every cell, and accumulates energy deposition in that cell for all steps of all tracksaccumulates energy deposition in that cell for all steps of all tracks.. A calorimeter hit typically containsA calorimeter hit typically contains
Sum of deposited energySum of deposited energy Cell IDCell ID
You can instantiate more than one objects for one sensitive detector You can instantiate more than one objects for one sensitive detector class. Each object should have its unique detector name.class. Each object should have its unique detector name. For example, each of two sets of drift chambers can have their For example, each of two sets of drift chambers can have their
dedicated sensitive detector objects. But, the functionalities of dedicated sensitive detector objects. But, the functionalities of them are exactly the same to each other and thus they can share them are exactly the same to each other and thus they can share the same class. See the same class. See examples/extended/analysis/A01examples/extended/analysis/A01 as an as an example.example.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1111
Implementation of Sensitive Detector Implementation of Sensitive Detector - 1- 1MyDriftChamber::MyDriftChamber::MyDriftChamberMyDriftChamber(G4String (G4String detector_name))
:G4VSensitiveDetector(:G4VSensitiveDetector(detector_name),), collectionID(-1)collectionID(-1){{ collectionName.insert(“collectionName.insert(“collection_name");");}}
In the constructor, define the name of the hits collection which is
handled by this sensitive detector
In case your sensitive detector generates more than one kinds of hits
(e.g. anode and cathode hits separately), define all collection names.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1212
Implementation of Sensitive Detector Implementation of Sensitive Detector - 2- 2void MyDriftChamber::void MyDriftChamber::InitializeInitialize(G4HCofThisEvent*HCE)(G4HCofThisEvent*HCE)
{{ if(collectionID<0) collectionID = if(collectionID<0) collectionID = GetCollectionIDGetCollectionID((00);); hitsCollection = hitsCollection = new MyDriftChamberHitsCollectionnew MyDriftChamberHitsCollection (SensitiveDetectorName,collectionName[(SensitiveDetectorName,collectionName[00]);]); HCE->HCE->AddHitsCollectionAddHitsCollection(collectionID,hitsCollection); (collectionID,hitsCollection); }}
Initialize() method is invoked at the beginning of each event. Get the unique ID number for this collection.
GetCollectionID() is a heavy operation. It should not be used for every events.
GetCollectionID() is available after this sensitive detector object is registered to G4SDManager. Thus, this method cannot be used in the constructor of this detector class.
Instantiate hits collection(s) and attach it/them to G4HCofThisEvent object given in the argument.
In case of calorimeter-type detector, you may also want to instantiate hits for all calorimeter cells with zero energy depositions, and insert them to the collection.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1313
Implementation of Sensitive Detector Implementation of Sensitive Detector - 3- 3G4bool MyDriftChamber::G4bool MyDriftChamber::ProcessHitsProcessHits
(G4Step*aStep,G4TouchableHistory*ROhist)(G4Step*aStep,G4TouchableHistory*ROhist){{ MyDriftChamberHit* aHit = MyDriftChamberHit* aHit = new MyDriftChamberHitnew MyDriftChamberHit();(); ...... // some set methods // some set methods ...... hitsCollection->insert(aHit);hitsCollection->insert(aHit); return true; return true; }}
This ProcessHits() method is invoked for every steps in the volume(s) where this sensitive detector is assigned.
In this method, generate a hit corresponding to the current step (for tracking detector), or accumulate the energy deposition of the current step to the existing hit object where the current step belongs to (for calorimeter detector).
Don’t forget to collect geometry information (e.g. copy number) from “PreStepPoint”.
Currently, returning boolean value is not used.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1414
Implementation of Sensitive Detector Implementation of Sensitive Detector - 4- 4
void MyDriftChamber::void MyDriftChamber::EndOfEventEndOfEvent(G4HCofThisEvent*HCE) (G4HCofThisEvent*HCE)
{;}{;}
This method is invoked at the end of processing an event. It is invoked even if the event is aborted. It is invoked before UserEndOfEventAction.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1515
TouchableTouchable As mentioned already, G4Step has two G4StepPoint objects as As mentioned already, G4Step has two G4StepPoint objects as
its starting and ending points. All the geometrical information of its starting and ending points. All the geometrical information of the particular step should be taken from “the particular step should be taken from “PreStepPointPreStepPoint”.”. Geometrical information associated with G4Track is basically Geometrical information associated with G4Track is basically
same as “PostStepPoint”.same as “PostStepPoint”. Each G4StepPoint object has Each G4StepPoint object has
Position in world coordinate systemPosition in world coordinate system Global and local timeGlobal and local time MaterialMaterial G4TouchableHistoryG4TouchableHistory for geometrical information for geometrical information
G4TouchableHistoryG4TouchableHistory object is a vector of information for each object is a vector of information for each geometrical hierarchy.geometrical hierarchy. copy numbercopy number transformation / rotation to its mothertransformation / rotation to its mother
Since release 4.0, Since release 4.0, handleshandles (or (or smart-pointerssmart-pointers) to touchables are ) to touchables are intrinsically used. Touchables are reference counted.intrinsically used. Touchables are reference counted.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1616
Copy numberCopy number Suppose a calorimeter is made Suppose a calorimeter is made
of 4x5 cells.of 4x5 cells. and it is implemented by and it is implemented by
two levels of replicatwo levels of replica.. In reality, there is In reality, there is only oneonly one
physical volumephysical volume object object for each for each
level. Its position is level. Its position is
parameterized by its copy parameterized by its copy
number.number. To get the copy number of To get the copy number of
each level, suppose what each level, suppose what
happens if a step belongs to happens if a step belongs to
two cells.two cells.
CopyNo = 0
CopyNo = 1
CopyNo = 2
CopyNo = 3
0
0
0
0
1
1
1
1
2
2
2
2
3
3
3
3
4
4
4
4
Remember geometrical information in G4Track is identical to Remember geometrical information in G4Track is identical to "PostStepPoint"."PostStepPoint".
You You cannotcannot get the collect copy number for "PreStepPoint" if you get the collect copy number for "PreStepPoint" if you directly access to the physical volume.directly access to the physical volume.
Use touchableUse touchable to get the proper copy number, transform matrix, etc. to get the proper copy number, transform matrix, etc.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1717
TouchableTouchable G4TouchableHistory has information of geometrical hierarchy of the G4TouchableHistory has information of geometrical hierarchy of the
point. point.
G4StepG4Step* aStep;* aStep;
G4StepPointG4StepPoint* preStepPoint = aStep->* preStepPoint = aStep->GetPreStepPointGetPreStepPoint();();
G4TouchableHistoryG4TouchableHistory* theTouchable =* theTouchable =
(G4TouchableHistory*)(preStepPoint->GetTouchable());(G4TouchableHistory*)(preStepPoint->GetTouchable());
G4int G4int copyNocopyNo = theTouchable->GetVolume()->GetCopyNo(); = theTouchable->GetVolume()->GetCopyNo();
G4int G4int motherCopyNomotherCopyNo
= theTouchable->GetVolume(= theTouchable->GetVolume(11)->GetCopyNo();)->GetCopyNo();
G4int G4int grandMotherCopyNograndMotherCopyNo
= theTouchable->GetVolume(= theTouchable->GetVolume(22)->GetCopyNo();)->GetCopyNo();
G4ThreeVector G4ThreeVector worldPosworldPos = preStepPoint->GetPosition(); = preStepPoint->GetPosition();
G4ThreeVector G4ThreeVector localPoslocalPos = theTouchable->GetHistory() = theTouchable->GetHistory()
->->GetTopTransformGetTopTransform().().TransformPointTransformPoint(worldPos);(worldPos);
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1818
Readout geometry Readout geometry In some cases of most complicated geometries, it is not easy to define In some cases of most complicated geometries, it is not easy to define
volume boundaries corresponding to the readout segmentation.volume boundaries corresponding to the readout segmentation. Readout geometry is a Readout geometry is a virtualvirtual and and artificialartificial geometry which can be geometry which can be
defined defined in parallel to the realin parallel to the real detector geometry. detector geometry. Readout geometry is optional. May have more than one.Readout geometry is optional. May have more than one.
Each one should be associated to a sensitive detector. Each one should be associated to a sensitive detector. Note that a step is Note that a step is notnot limited by the boundary of readout geometry. limited by the boundary of readout geometry.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 1919
Defining a sensitive detectorDefining a sensitive detector Basic strategy Basic strategy
G4LogicalVolume* myLogCalor = ……;G4LogicalVolume* myLogCalor = ……;
G4VSensetiveDetector* pSensetivePart =G4VSensetiveDetector* pSensetivePart =
new MyCalorimeter(new MyCalorimeter(“/mydet/calorimeter1”“/mydet/calorimeter1”););
G4SDManager* SDMan = G4SDManager::GetSDMpointer();G4SDManager* SDMan = G4SDManager::GetSDMpointer();
SDMan->SDMan->AddNewDetectorAddNewDetector(pSensitivePart);(pSensitivePart);
myLogCalor->myLogCalor->SetSensitiveDetectorSetSensitiveDetector(pSensetivePart);(pSensetivePart);
Each detector Each detector objectobject must have a unique name. must have a unique name. Some logical volumes can share one detector object.Some logical volumes can share one detector object. More than one detector objects can be instantiated from one More than one detector objects can be instantiated from one
detector class with different detector name.detector class with different detector name. One logical volume cannot have more than one detector objects. One logical volume cannot have more than one detector objects.
But, one detector object can generate more than one kinds of hits.But, one detector object can generate more than one kinds of hits. e.g. a drift chamber class may generate anode and cathode e.g. a drift chamber class may generate anode and cathode
hits separately.hits separately.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2020
G4HCofThisEventG4HCofThisEvent A G4Event object has a A G4Event object has a G4HCofThisEventG4HCofThisEvent object at the end of object at the end of
(successful) event processing. G4HCofThisEvent object stores all hits (successful) event processing. G4HCofThisEvent object stores all hits
collections made within the event.collections made within the event.
Pointer(s) may be NULL if collection(s) are not created in the Pointer(s) may be NULL if collection(s) are not created in the
particular event.particular event.
Hits collections are stored by pointers of G4VHitsCollection base Hits collections are stored by pointers of G4VHitsCollection base
class. Thus, you have to class. Thus, you have to castcast them to types of individual concrete them to types of individual concrete
classes.classes.
The index number of a Hits collection is unique and stable for a run The index number of a Hits collection is unique and stable for a run
and can be obtained by and can be obtained by
G4SDManager::GetCollectionID(“G4SDManager::GetCollectionID(“detName/colNamedetName/colName”);”);
The index table is also stored in G4Run.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2121
Usage of G4HCofThisEventUsage of G4HCofThisEventstatic int CHCID = -1;static int CHCID = -1;
if(CHCID<0) G4SDManager::GetSDMpointer()if(CHCID<0) G4SDManager::GetSDMpointer()
->GetCollectionID("->GetCollectionID("myDet/calorimeter1/collection1myDet/calorimeter1/collection1");");
G4HCofThisEventG4HCofThisEvent* HCE = evt->GetHCofThisEvent();* HCE = evt->GetHCofThisEvent();
MyCalorimeterHitsCollection* CHC = 0;MyCalorimeterHitsCollection* CHC = 0;
if(HCE)if(HCE)
{CHC = {CHC = (MyCalorimeterHitsCollection*)(MyCalorimeterHitsCollection*)(HCE->(HCE->GetHC(CHCID)GetHC(CHCID));});}
if(CHC)if(CHC)
{ int n_hit = CHC->{ int n_hit = CHC->entriesentries();();
G4cout<<"Calorimeter has ”<<n_hit<<" hits."<<G4endl;G4cout<<"Calorimeter has ”<<n_hit<<" hits."<<G4endl;
for(int i1=0;i1<n_hit;i1++)for(int i1=0;i1<n_hit;i1++)
{ { MyCalorimeterHitMyCalorimeterHit* aHit = (*CHC)[i1];* aHit = (*CHC)[i1];
aHit->Print(); }aHit->Print(); }
}}
This scheme can be adapted also for Digitization.This scheme can be adapted also for Digitization.
cast
Track and Step StatusesTrack and Step Statuses
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2424
Track statusTrack status At the end of each step, according to the processes involved, the state At the end of each step, according to the processes involved, the state
of a track may be changed.of a track may be changed. The user can also change the status in UserSteppingAction.The user can also change the status in UserSteppingAction. Statuses shown in Statuses shown in yellowyellow are artificial, i.e. Geant4 kernel won’t set are artificial, i.e. Geant4 kernel won’t set
them, but the user can set.them, but the user can set.
fAlivefAlive Continue the tracking.Continue the tracking.
fStopButAlivefStopButAlive The track has come to zero kinetic energy, but still AtRest process The track has come to zero kinetic energy, but still AtRest process
to occur.to occur. fStopAndKillfStopAndKill
The track has lost its identity because it has decayed, interacted or The track has lost its identity because it has decayed, interacted or gone beyond the world boundary.gone beyond the world boundary.
Secondaries will be pushed to the stack.Secondaries will be pushed to the stack. fKillTrackAndSecondariesfKillTrackAndSecondaries
Kill the current track and also associated secondaries.Kill the current track and also associated secondaries. fSuspendfSuspend
Suspend processing of the current track and push it and its Suspend processing of the current track and push it and its secondaries to the stack.secondaries to the stack.
fPostponeToNextEventfPostponeToNextEvent Postpone processing of the current track to the next event. Postpone processing of the current track to the next event. Secondaries are still being processed within the current event.Secondaries are still being processed within the current event.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2525
Set the track statusSet the track status In UserSteppingAction, user can change the status of a track.In UserSteppingAction, user can change the status of a track.
void MySteppingAction::UserSteppingActionvoid MySteppingAction::UserSteppingAction (const G4Step * theStep)(const G4Step * theStep){{ G4Track* theTrack = theStep->G4Track* theTrack = theStep->GetTrackGetTrack();(); if(…) theTrack->if(…) theTrack->SetTrackStatusSetTrackStatus(fSuspend);(fSuspend);}}
If a track is killed, physics quantities of the track (energy, If a track is killed, physics quantities of the track (energy, charge, etc.) are not conserved but completely lost.charge, etc.) are not conserved but completely lost.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2626
Step statusStep status Step status is attached to G4StepPoint to indicate why that particular Step status is attached to G4StepPoint to indicate why that particular
step was determined.step was determined. Use “PostStepPoint” to get the status of this step.Use “PostStepPoint” to get the status of this step. ““PreStepPoint” has the status of the previous step.PreStepPoint” has the status of the previous step.
fWorldBoundaryfWorldBoundary Step reached the world boundaryStep reached the world boundary
fGeomBoundary fGeomBoundary Step is limited by a geometry boundaryStep is limited by a geometry boundary
fAtRestDoItProc, fAlongStepDoItProc, fPostStepDoItProcfAtRestDoItProc, fAlongStepDoItProc, fPostStepDoItProc Step is limited by a AtRest, AlongStep or PostStep processStep is limited by a AtRest, AlongStep or PostStep process
fUserDefinedLimit fUserDefinedLimit Step is limited by the user Step limit in the logical volumeStep is limited by the user Step limit in the logical volume
fExclusivelyForcedProc fExclusivelyForcedProc Step is limited by an exclusively forced PostStep process Step is limited by an exclusively forced PostStep process
fUndefined fUndefined Step not defined yetStep not defined yet
If you want to identify If you want to identify the first step in a volumethe first step in a volume, pick , pick fGeomBoudaryfGeomBoudary status in status in PreStepPointPreStepPoint. .
If you want to identify If you want to identify a step getting out of a volumea step getting out of a volume, pick , pick fGeomBoundaryfGeomBoundary status in status in PostStepPointPostStepPoint
Attaching user information to Attaching user information to some kernel classessome kernel classes
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2828
Attaching user informationAttaching user information Abstract classesAbstract classes
User can use his/her own class derived from the provided base User can use his/her own class derived from the provided base
classclass
G4Run, G4VHit, G4VDigit, G4VTrajectory, G4VTrajectoryPointG4Run, G4VHit, G4VDigit, G4VTrajectory, G4VTrajectoryPoint
Concrete classesConcrete classes
User can attach a user information class objectUser can attach a user information class object
G4Event - G4Event - G4VUserEventInformationG4VUserEventInformation
G4Track - G4Track - G4VUserTrackInformationG4VUserTrackInformation
G4PrimaryVertex - G4PrimaryVertex - G4VUserPrimaryVertexInformationG4VUserPrimaryVertexInformation
G4PrimaryParticle - G4PrimaryParticle - G4VUserPrimaryParticleInformationG4VUserPrimaryParticleInformation
G4Region -G4Region - G4VUserRegionInformation G4VUserRegionInformation
User information class object is deleted when associated User information class object is deleted when associated
Geant4 class object is deleted.Geant4 class object is deleted.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 2929
Trajectory and trajectory pointTrajectory and trajectory point Trajectory and trajectory point class objects persist until the Trajectory and trajectory point class objects persist until the
end of an event.end of an event. And most likely stored to disk as "simulation truth"And most likely stored to disk as "simulation truth"
G4VTrajectoryG4VTrajectory is the abstract base class to represent a is the abstract base class to represent a
trajectory, and trajectory, and G4VTrajectoryPointG4VTrajectoryPoint is the abstract base class to is the abstract base class to
represent a point which makes up the trajectory.represent a point which makes up the trajectory. In general, trajectory class is expected to have a vector of In general, trajectory class is expected to have a vector of
trajectory points.trajectory points. Geant4 provides Geant4 provides G4TrajectoyG4Trajectoy and and G4TrajectoryPointG4TrajectoryPoint concrete concrete
classes as defaults. These classes keep only the most common classes as defaults. These classes keep only the most common
quantities.quantities. If the user wants to keep some additional information and/or If the user wants to keep some additional information and/or
wants to change the drawing style of a trajectory, he/she is wants to change the drawing style of a trajectory, he/she is
encouraged to implement his/her own concrete classes.encouraged to implement his/her own concrete classes.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3030
Creation of trajectoriesCreation of trajectories Naïve creation of trajectories occasionally causes a memory
consumption concern, especially for high energy EM showers. In UserTrackingAction, you can switch on/off the creation of a
trajectory for the particular track.
void MyTrackingAction ::PreUserTrackingAction(const G4Track* aTrack){ if(...) { fpTrackingManager->SetStoreTrajectory(true); } else { fpTrackingManager->SetStoreTrajectory(false); }}
If you want to use user-defined trajectory, object should be If you want to use user-defined trajectory, object should be instantiated in this method and set to G4TrackingManager by instantiated in this method and set to G4TrackingManager by SetTrajectory()SetTrajectory() method. method.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3131
Bookkeeping issuesBookkeeping issues Connection from G4PrimaryParticle to G4TrackConnection from G4PrimaryParticle to G4Track
G4int G4PrimaryParticle::GetTrackID()G4int G4PrimaryParticle::GetTrackID()
Returns the track ID if this primary particle had been converted into Returns the track ID if this primary particle had been converted into
G4Track, otherwise -1.G4Track, otherwise -1.
Both for primaries and pre-assigned decay productsBoth for primaries and pre-assigned decay products
Connection from G4Track to G4PrimaryParticleConnection from G4Track to G4PrimaryParticle
G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle()G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle()
Returns the pointer of G4PrimaryParticle object if this track was defined Returns the pointer of G4PrimaryParticle object if this track was defined
as a primary or a pre-assigned decay product, otherwise null.as a primary or a pre-assigned decay product, otherwise null.
G4VUserPrimaryVertexInformationG4VUserPrimaryVertexInformation, , G4VUserPrimaryParticleInformationG4VUserPrimaryParticleInformation and and
G4VUserTrackInformationG4VUserTrackInformation can be utilized for storing additional information. can be utilized for storing additional information.
Information in UserTrackInformation should be then copied to user-Information in UserTrackInformation should be then copied to user-
defined trajectory class, so that such information is kept until the end of defined trajectory class, so that such information is kept until the end of
the event.the event.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3232
Examples/extended/Examples/extended/runAndEvent/RE01runAndEvent/RE01
An example for connecting An example for connecting
G4PrimaryParticle, G4Track, G4PrimaryParticle, G4Track,
hits and trajectories, by hits and trajectories, by
utilizing utilizing
G4VUserTrackInformationG4VUserTrackInformation and and
G4VUserRegionInformationG4VUserRegionInformation. .
SourceTrackID means the SourceTrackID means the
ID of a track which gets ID of a track which gets
into calorimeter. into calorimeter.
PrimaryTrackID is copied PrimaryTrackID is copied
to UserTrackInformation to UserTrackInformation
of daughter tracks. of daughter tracks.
SourceTrackID is updated for SourceTrackID is updated for
secondaries born in tracker, secondaries born in tracker,
while just copied in while just copied in
calorimeter.calorimeter.
PrimaryTrackID = 1
SourceTrackID = 4
PrimaryTrackID = 1
SourceTrackID = 1
RE01TrackInformation
PrimaryTrackID = 2
SourceTrackID = 2
PrimaryTrackID = 1
SourceTrackID = 1
PrimaryTrackID = 1
SourceTrackID = 3
PrimaryTrackID = 1
SourceTrackID = 1
PrimaryTrackID = 1
SourceTrackID = 1
PrimaryTrackID = 1
SourceTrackID = 4
PrimaryTrackID = 1
SourceTrackID = 4
PrimaryTrackID = 1
SourceTrackID = 4
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3333
Examples/extended/Examples/extended/runAndEvent/RE01runAndEvent/RE01
Trajectory of track6782
Tracker hits of track6782
Calorimeter hits of track6782
Energy deposition includes not only muon itself but also all
secondary EM showers started inside the calorimeter.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3434
RE01RegionInformationRE01RegionInformation This example RE01 has three regions, i.e. default world region, tracker This example RE01 has three regions, i.e. default world region, tracker
region and calorimeter region.region and calorimeter region. Each region has its unique object of RE01RegionInformation class.Each region has its unique object of RE01RegionInformation class.
class RE01RegionInformation : public G4VUserRegionInformationclass RE01RegionInformation : public G4VUserRegionInformation{{ … … public:public: G4bool IsWorld() const;G4bool IsWorld() const; G4bool IsTracker() const;G4bool IsTracker() const; G4bool IsCalorimeter() const;G4bool IsCalorimeter() const; … …};};
Through step->preStepPoint->physicalVolume->logicalVolume-Through step->preStepPoint->physicalVolume->logicalVolume->region-> regionInformation, you can easily identify in which region >region-> regionInformation, you can easily identify in which region the current step belongs.the current step belongs. Don’t use volume name to identify.Don’t use volume name to identify.
Cuts per regionCuts per region
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3636
Cuts per RegionCuts per Region Geant4 has had a unique production threshold (‘cut’) Geant4 has had a unique production threshold (‘cut’)
expressed in length (i.e. minimum range of secondary).expressed in length (i.e. minimum range of secondary). For all volumesFor all volumes Possibly different for each particle.Possibly different for each particle.
Yet appropriate length scales can vary greatly between Yet appropriate length scales can vary greatly between different areas of a large detectordifferent areas of a large detector E.g. a vertex detector (5 E.g. a vertex detector (5 m) and a muon detector (2.5 cm).m) and a muon detector (2.5 cm). Having a unique (low) cut can create a performance Having a unique (low) cut can create a performance
penalty.penalty. Requests from ATLAS, BABAR, CMS, LHCb, …, to allow several Requests from ATLAS, BABAR, CMS, LHCb, …, to allow several
cutscuts Globally or per particleGlobally or per particle
New functionality, New functionality, enabling the tuning of production thresholds at the level of enabling the tuning of production thresholds at the level of
a sub-detector, i.e. a sub-detector, i.e. regionregion.. Cuts are applied Cuts are applied only for gamma, electron and positron only for gamma, electron and positron and and
only for processes which have infrared divergenceonly for processes which have infrared divergence.. ‘‘Full release’ in Geant4 5.1 (end April, 2003)Full release’ in Geant4 5.1 (end April, 2003)
Comparable run-time performanceComparable run-time performance
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3737
RegionRegion Introducing the concept of region.Introducing the concept of region.
Set of geometry volumes, Set of geometry volumes,
typically of a sub-system;typically of a sub-system;
barrel + end-caps of the barrel + end-caps of the
calorimeter;calorimeter;
““Deep” areas of support Deep” areas of support
structures can be a region.structures can be a region.
Or any group of volumes;Or any group of volumes;
A set of cuts in range is associated A set of cuts in range is associated
to a region;to a region;
a different range cut for each a different range cut for each
particle among gamma, e-, e+ particle among gamma, e-, e+
is allowed in a region.is allowed in a region.
Region B
RegionB
DefaultRegion Region B
Region B
Region A
CC
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 3838
World Volume - Default Region
Region and cutRegion and cut Each region has its unique set of cuts.Each region has its unique set of cuts. World volume is recognized as the World volume is recognized as the
default region and the default cuts default region and the default cuts defined in Physics list are used for it.defined in Physics list are used for it. User is not allowed to define a User is not allowed to define a
region to the world volume or a cut region to the world volume or a cut to the default region.to the default region.
A A logical volumelogical volume becomes a becomes a root logical root logical volumevolume once it is assigned to a region. once it is assigned to a region. All daughter volumes belonging to All daughter volumes belonging to
the root logical volume share the the root logical volume share the same region (and cut), unless a same region (and cut), unless a daughter volume itself becomes to daughter volume itself becomes to another root.another root.
Important restriction :Important restriction : NoNo logical volume can be shared by logical volume can be shared by
more than one regions, regardless more than one regions, regardless of root volume or not.of root volume or not.
Root logical - Region A
Root logical - Region B
Stack managementStack management
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4040
Track stacks in Geant4Track stacks in Geant4 By default, Geant4 has three track stacks.By default, Geant4 has three track stacks.
""UrgentUrgent", "", "WaitingWaiting" and "" and "PostponeToNextEventPostponeToNextEvent"" Each stack is a simple "Each stack is a simple "last-in-first-outlast-in-first-out" stack. " stack. User can arbitrary increase the number of stacks.User can arbitrary increase the number of stacks.
ClassifyNewTrackClassifyNewTrack() method of UserStackingAction decides which stack () method of UserStackingAction decides which stack each newly storing track to be stacked (or to be killed).each newly storing track to be stacked (or to be killed). By default, all tracks go to Urgent stack.By default, all tracks go to Urgent stack.
A Track is popped up A Track is popped up only from Urgent stack.only from Urgent stack. Once Urgent stack becomes empty, all tracks in Waiting stack are Once Urgent stack becomes empty, all tracks in Waiting stack are
transferred to Urgent stack.transferred to Urgent stack. And And NewStageNewStage() method of UsetStackingAction is invoked.() method of UsetStackingAction is invoked.
Utilizing more than one stacks, user can control the priorities of Utilizing more than one stacks, user can control the priorities of processing tracks without paying the overhead of "scanning the processing tracks without paying the overhead of "scanning the highest priority track" which was the only available way in Geant3.highest priority track" which was the only available way in Geant3. Proper selection/abortion of tracks/events with well designed stack Proper selection/abortion of tracks/events with well designed stack
management provides significant efficiency increase of the entire management provides significant efficiency increase of the entire simulation.simulation.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4141
Stacking mechanismStacking mechanism
Event Manager
TrackingManager
StackingManager
User StackingAction
UrgentStack
WaitingStack
Postpone To Next Event
Stack
Push
PopPush
Push
Push
Pop
Classify
secondary and suspended
tracks
Process One Track
primary tracks
RIP
Deleted
Transfer
NewStageUrgentStack
WaitingStack
TemporaryStack
Reclassify
Pop
End OfEvent
Postpone To Next Event
Stack
Transfer
Prepare New Event
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4242
G4UserStackingActionG4UserStackingAction User has to implement three methods.User has to implement three methods. G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*)G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*)
Invoked every time a new track is pushed to G4StackManager.Invoked every time a new track is pushed to G4StackManager. ClassificationClassification
fUrgentfUrgent - pushed into Urgent stack - pushed into Urgent stack fWaitingfWaiting - pushed into Waiting stack - pushed into Waiting stack fPostponefPostpone - pushed into PostponeToNextEvent stack - pushed into PostponeToNextEvent stack fKillfKill - killed - killed
void NewStage()void NewStage() Invoked when Urgent stack becomes empty and all tracks in Invoked when Urgent stack becomes empty and all tracks in
Waiting stack are transferred to Urgent stack.Waiting stack are transferred to Urgent stack. All tracks which have been transferred from Waiting stack to All tracks which have been transferred from Waiting stack to
Urgent stack can be reclassified by invoking Urgent stack can be reclassified by invoking stackManager-stackManager->ReClassify()>ReClassify()
void PrepareNewEvent()void PrepareNewEvent() Invoked at the beginning of each event for resetting the Invoked at the beginning of each event for resetting the
classification scheme. classification scheme.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4343
ExN04StackingActionExN04StackingAction ExampleN04 has simplified collider ExampleN04 has simplified collider
detector geometry and event samples detector geometry and event samples of Higgs decays into four muons.of Higgs decays into four muons.
Stage 0Stage 0 Only primary muonsOnly primary muons are pushed are pushed
into into Urgent Urgent stack and all other stack and all other primaries and secondaries are primaries and secondaries are pushed into pushed into WaitingWaiting stack. stack.
All of four muons are trackedAll of four muons are tracked without being bothered by EM without being bothered by EM showers caused by delta-raysshowers caused by delta-rays..
Once Urgent stack becomes empty Once Urgent stack becomes empty (i.e. end of stage 0), number of (i.e. end of stage 0), number of hits in muon counters are hits in muon counters are examined.examined.
Proceed to next stage only if Proceed to next stage only if sufficient number of muons passed sufficient number of muons passed through muon counters. Otherwise through muon counters. Otherwise the event is aborted.the event is aborted.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4444
ExN04StackingActionExN04StackingAction Stage 1Stage 1
Only primary charged particlesOnly primary charged particles are are
pushed into pushed into UrgentUrgent stack and all stack and all
other primaries and secondaries are other primaries and secondaries are
pushed into pushed into WaitingWaiting stack. stack. All of primary charged particles are All of primary charged particles are
tracked tracked until they reach to the until they reach to the
surface of calorimetersurface of calorimeter. Tracks . Tracks
reached to the calorimeter surface reached to the calorimeter surface
are are suspended and pushed back to suspended and pushed back to
Waiting stackWaiting stack.. All charged primaries are tracked in All charged primaries are tracked in
the tracking region the tracking region without being without being
bothered by the showers in bothered by the showers in
calorimetercalorimeter.. At the end of stage 1, isolation of At the end of stage 1, isolation of
muon tracks is examined.muon tracks is examined.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4545
ExN04StackingActionExN04StackingAction Stage 2Stage 2
Only tracks in "region of interest" Only tracks in "region of interest"
are pushed into are pushed into UrgentUrgent stack and stack and
all other tracks are all other tracks are killedkilled..
Showers are calculated Showers are calculated only only
inside of "region of interest".inside of "region of interest".
Event biasingEvent biasing
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4747
Event biasing in Geant4Event biasing in Geant4 Event biasing (variance reduction) techniques are a vital Event biasing (variance reduction) techniques are a vital
requirement for many applicationsrequirement for many applications These feature could be utilized by many application fields such These feature could be utilized by many application fields such
as as ShieldingShielding Radiation environment assessmentRadiation environment assessment DosimetryDosimetry
Since Geant4 is a toolkit and also all source code is open, the Since Geant4 is a toolkit and also all source code is open, the
user can do whatever he/she wants.user can do whatever he/she wants. Capable users in experiments/institutions created their own Capable users in experiments/institutions created their own
implementations of event biasing.implementations of event biasing. Yet it is more convenient for user if Geant4 itself provides most Yet it is more convenient for user if Geant4 itself provides most
commonly used event biasing techniques.commonly used event biasing techniques.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4848
Event biasing techniquesEvent biasing techniques Production cuts / thresholdProduction cuts / threshold
This is a biasing technique – most popular for many This is a biasing technique – most popular for many applicationsapplications
Geometry based biasingGeometry based biasing Importance weighting for volume/regionImportance weighting for volume/region Duplication or sudden death of tracksDuplication or sudden death of tracks
Leading particle biasingLeading particle biasing Taking only the most energetic (or most important) secondaryTaking only the most energetic (or most important) secondary
Primary event biasingPrimary event biasing Biasing primary events and/or primary particles in terms of Biasing primary events and/or primary particles in terms of
type of event, momentum distribution, etc.type of event, momentum distribution, etc. Forced interactionForced interaction
Force a particular interaction, e.g. within a volumeForce a particular interaction, e.g. within a volume Enhanced process or channelEnhanced process or channel
Increasing cross section for a processIncreasing cross section for a process Physics based biasingPhysics based biasing
Biasing secondary production in terms of particle type, Biasing secondary production in terms of particle type, momentum distribution, cross-section, etc.momentum distribution, cross-section, etc.
Weight on Track / EventWeight on Track / Event
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 4949
Current features in Geant4Current features in Geant4 Partial MARS migration Partial MARS migration
n, p, pi, K (< 5 GeV)n, p, pi, K (< 5 GeV) Since Geant4 0.0Since Geant4 0.0
General particle source moduleGeneral particle source module Primary particle biasingPrimary particle biasing
Since Geant4 3.0Since Geant4 3.0 Radioactive decay moduleRadioactive decay module
Physics process biasing in terms of decay products and Physics process biasing in terms of decay products and momentum distributionmomentum distribution
Since Geant4 3.0Since Geant4 3.0 Geometry based biasingGeometry based biasing
Weight associating with real volume or artificial volumeWeight associating with real volume or artificial volume Since Geant4 4.2Since Geant4 4.2
Weight cutoff and weight windowWeight cutoff and weight window Since Geant4 5.2Since Geant4 5.2
Cross-section biasing and leading particle biasing for Cross-section biasing and leading particle biasing for hadronic processes hadronic processes
Since Geant4 7.0Since Geant4 7.0
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5050
Geometrical importance Geometrical importance biasingbiasing
Define importance for each Define importance for each geometrical regiongeometrical region
Splitting a track,Splitting a track, Eg creating two particles Eg creating two particles
with half the ‘weight’ if it with half the ‘weight’ if it moves into volume with moves into volume with double importance value.double importance value.
Russian-rouletteRussian-roulette in opposite in opposite direction.direction.
Scoring particle flux with Scoring particle flux with weightsweights At the surface of volumesAt the surface of volumes
I = 1.0 I = 2.0
W=1.0W=0.5W=0.5
P = 0.5
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5151
Using importance biasingUsing importance biasing Decide whether to bias in “mass” geometry, or in a dedicated Decide whether to bias in “mass” geometry, or in a dedicated
‘parallel’ geometry (“importance geometry”).‘parallel’ geometry (“importance geometry”). Assign an importance value to all volumes in this geometryAssign an importance value to all volumes in this geometry
The importance is a number (double)The importance is a number (double) Register the processes for importance biasing (and scoring, Register the processes for importance biasing (and scoring,
optionally) to each particle type (eg neutron, gamma, proton, optionally) to each particle type (eg neutron, gamma, proton, …)…) Examples show easy ways to do this. Examples show easy ways to do this.
CaveatsCaveats World of importance geometry must ‘overlap’ exactly with World of importance geometry must ‘overlap’ exactly with
mass worldmass world Biasing and scoring of charged particles in a field is not yet Biasing and scoring of charged particles in a field is not yet
supportedsupported More detailsMore details
Users can choose their importance sampling algorithm,Users can choose their importance sampling algorithm, Or accept the default one (‘equal weight’).Or accept the default one (‘equal weight’). For customization & further information see “Geant4 For customization & further information see “Geant4
User's Guide for Application Developers”, Section 3.7User's Guide for Application Developers”, Section 3.7
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5252
Biasing example B01Biasing example B01 Examples demonstrating the use of importance Examples demonstrating the use of importance
biasing and scoring can be found in biasing and scoring can be found in examples/extended/biasingexamples/extended/biasing
B01B01 Shows the importance sampling and scoring in the Shows the importance sampling and scoring in the
mass (tracking) geometrymass (tracking) geometry Option to show weight windowOption to show weight window
Geometry is 80 cm high concrete cylinder divided Geometry is 80 cm high concrete cylinder divided into 18 slabs into 18 slabs
Importance values assigned to 18 concrete slabs Importance values assigned to 18 concrete slabs in the detector construction - for simplicity.in the detector construction - for simplicity.
The G4Scorer is used for the scoringThe G4Scorer is used for the scoring Top level class uses the frame work provided for Top level class uses the frame work provided for
scoring.scoring.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5353
Example biasing B02Example biasing B02 Show how to use Show how to use
importance sampling in a parallel geometry and importance sampling in a parallel geometry and a customized scoring making use of the scoring framework.a customized scoring making use of the scoring framework.
A simple A simple mass geometrymass geometry consists of a 180 cm high concrete consists of a 180 cm high concrete cylinder cylinder
A A parallel geometryparallel geometry is created to hold importance values for is created to hold importance values for slabs of width 10cm and for scoring. slabs of width 10cm and for scoring. Note: The parallel world volume must overlap the mass Note: The parallel world volume must overlap the mass
world volume world volume The radii of the slabs is larger than the radius of the The radii of the slabs is larger than the radius of the
concrete cylinder in the mass geometry.concrete cylinder in the mass geometry. The importance value is assigned to each ‘G4GeometryCell’The importance value is assigned to each ‘G4GeometryCell’
To do this, pairs of G4GeometryCell and importance To do this, pairs of G4GeometryCell and importance values are stored in the importance store.values are stored in the importance store.
The The scoringscoring uses the G4CellSCorer and one customized scorer uses the G4CellSCorer and one customized scorer for the last slab. for the last slab.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5454
Example B03Example B03
Uses Geant4 importance sampling and scoring through Uses Geant4 importance sampling and scoring through pythonpython. . It creates a simple histogram. It creates a simple histogram. It demonstrates how to use a customized scorer and It demonstrates how to use a customized scorer and
importance sampling in combination with a scripting language, importance sampling in combination with a scripting language, python.python.
Geant4 code is executed from a python session. Geant4 code is executed from a python session. Note: the swig package is used to create python shadow Note: the swig package is used to create python shadow
classes and to generate the code necessary to use the classes and to generate the code necessary to use the Geant4 libraries from a python session.Geant4 libraries from a python session.
It can be built and run using the PI implementation of AIDA It can be built and run using the PI implementation of AIDA For this see http://cern.ch/PI.For this see http://cern.ch/PI.
At the end a histogram called "trackentering.hbook" is create.At the end a histogram called "trackentering.hbook" is create.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5555
The Weight Window TechniqueThe Weight Window Technique The weight window technique is a weight-based algorithm – generally The weight window technique is a weight-based algorithm – generally
used together with other techniques as an alternative to importance used together with other techniques as an alternative to importance sampling:sampling: It applies splitting and Russian roulette depending on space (cells) It applies splitting and Russian roulette depending on space (cells)
and energyand energy user defines weight windows in contrast to defining importance user defines weight windows in contrast to defining importance
values as in importance samplingvalues as in importance sampling It checks the value of the particle weightIt checks the value of the particle weight
Comparing it to a ‘window’ of weights defined for the current Comparing it to a ‘window’ of weights defined for the current energy-space cell.energy-space cell.
Doing splitting or roulette in case if it is outside, resulting in 0 or Doing splitting or roulette in case if it is outside, resulting in 0 or more particles ‘inside’ the window.more particles ‘inside’ the window.
apply in combination with other techniques such as cross-section apply in combination with other techniques such as cross-section biasing, leading particle and implicit capture, or combinations of these.biasing, leading particle and implicit capture, or combinations of these.
A weight window may A weight window may be specified for every be specified for every cell and for several cell and for several energy regions: energy regions: space-energy cellspace-energy cell . .
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5656
Leading particle biasingLeading particle biasing Simulating a full shower is an Simulating a full shower is an
expensive calculation.expensive calculation. Instead of generating a full Instead of generating a full
shower, trace only the most shower, trace only the most energetic secondary.energetic secondary. Other secondary particles Other secondary particles
are immediately killed are immediately killed before being stacked.before being stacked.
Convenient way to roughly Convenient way to roughly estimate, e.g. the thickness estimate, e.g. the thickness of a shield.of a shield.
Of course, physical Of course, physical quantities such as energy quantities such as energy are not conserved for each are not conserved for each event.event.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5757
ScoringScoring Scoring is provided by a framework and is done according to Scoring is provided by a framework and is done according to
particle type. particle type. It is possible to score particles of different types into the It is possible to score particles of different types into the
same scorer. The framework may also be easily used for same scorer. The framework may also be easily used for customized scoring.customized scoring.
Scoring may be applied to a mass or a parallel geometry. It is Scoring may be applied to a mass or a parallel geometry. It is done with an object generically called a scorer using a sampler. done with an object generically called a scorer using a sampler. The scorer receives the information about every step taken The scorer receives the information about every step taken
by a particle of chosen type. This information consists a by a particle of chosen type. This information consists a G4Step and a G4GeometryCellStep (created for scoring and G4Step and a G4GeometryCellStep (created for scoring and importance sampling).importance sampling).
G4GeometryCellStep provides information about the G4GeometryCellStep provides information about the previous and current "cell" of the particle track. previous and current "cell" of the particle track.
A "scorer" class derives from the interface G4VScorer. Users A "scorer" class derives from the interface G4VScorer. Users may create customized "scorers" or use the standard scoring. may create customized "scorers" or use the standard scoring.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 5858
Plans of event biasing in Geant4Plans of event biasing in Geant4 Cross-section biasing for physics processesCross-section biasing for physics processes General geometrical weight field General geometrical weight field
In continuous process for geometrical, angular, energy In continuous process for geometrical, angular, energy biasing and weight window. biasing and weight window.
First implementation of weight-window biasing option was First implementation of weight-window biasing option was introduced with Geant4 6.0.introduced with Geant4 6.0.
Another biasing options are under study.Another biasing options are under study. Other scoring options rather than surface flux counting which is Other scoring options rather than surface flux counting which is
currently supported are under study.currently supported are under study.
User’s contribution is welcome.User’s contribution is welcome.
Fast simulationFast simulation(shower parameterization)(shower parameterization)
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6060
Fast simulation - GeneralitiesFast simulation - Generalities
Fast Simulation, also called as shower parameterization, is a shortcut Fast Simulation, also called as shower parameterization, is a shortcut
to the "ordinary" tracking.to the "ordinary" tracking.
Fast Simulation allows you to take over the tracking and implement Fast Simulation allows you to take over the tracking and implement
your own "fast" physics and detector response.your own "fast" physics and detector response.
The classical use case of fast simulation is the shower The classical use case of fast simulation is the shower
parameterization where the typical several thousand steps per GeV parameterization where the typical several thousand steps per GeV
computed by the tracking are replaced by a few ten of energy computed by the tracking are replaced by a few ten of energy
deposits per GeV.deposits per GeV.
Parameterizations are generally experiment dependent. Geant4 Parameterizations are generally experiment dependent. Geant4
provides a convenient framework.provides a convenient framework.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6161
Parameterization featuresParameterization features Parameterizations take Parameterizations take
place in an place in an envelopeenvelope.. This is This is
typically a mother volume typically a mother volume
of a sub-system or of a of a sub-system or of a
major module of such a sub-major module of such a sub-
system.system.
Parameterizations are often Parameterizations are often
dependent to particle types dependent to particle types
and/or may be applied only and/or may be applied only
to some kinds of particles.to some kinds of particles.
They are often not applied They are often not applied
in complicated regions.in complicated regions.
e
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6262
Models and envelopeModels and envelope Concrete models are bound to the envelope Concrete models are bound to the envelope
through a G4FastSimulationManager object.through a G4FastSimulationManager object.
This allows several models to be bound to This allows several models to be bound to
one envelope.one envelope.
The envelope is simply a G4LogicalVolume The envelope is simply a G4LogicalVolume
which has G4FastSimulationManager.which has G4FastSimulationManager.
All its [grand[…]]daughters will be sensitive All its [grand[…]]daughters will be sensitive
to the parameterizations.to the parameterizations.
A model may returns back to the "ordinary" A model may returns back to the "ordinary"
tracking the new state of G4Track after tracking the new state of G4Track after
parameterization (alive/killed, new position, parameterization (alive/killed, new position,
new momentum, etc.) and eventually adds new momentum, etc.) and eventually adds
secondaries (e.g. punch-through) created secondaries (e.g. punch-through) created
by the parameterization.by the parameterization.
G4FastSimulationManager
ModelForElectrons
ModelForPions
« envelope »(G4LogicalVolume)
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6363
Fast SimulationFast Simulation The Fast Simulation components The Fast Simulation components
are indicated in white.are indicated in white.
When the G4Track comes in an When the G4Track comes in an envelope, envelope,
the G4FastSimulationManagerProcess the G4FastSimulationManagerProcess looks for a G4FastSimulationManager.looks for a G4FastSimulationManager. If one exists, at the beginning of each If one exists, at the beginning of each
step in the envelope, each model is step in the envelope, each model is asked for a trigger.asked for a trigger.
In case a trigger is issued, the model In case a trigger is issued, the model is applied at the point the G4track is.is applied at the point the G4track is.
Otherwise, the tracking proceeds with Otherwise, the tracking proceeds with a normal tracking.a normal tracking.
G4FastSimulationManager
ModelForElectrons
ModelForPions
« envelope »(G4LogicalVolume)
Multiple Scattering
G4Transportation
G4FastSimulationManagerProcess
Process xxx
G4Track
G4ProcessManager
Placements
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6464
G4FastSimulationManagerProcessG4FastSimulationManagerProcess The G4FastSimulationManagerProcess is a process providing the
interface between the tracking and the fast simulation.
It has to be set to the particles to be parameterized:
The process ordering must be the following:
[n-3] …
[n-2] Multiple Scattering
[n-1] G4FastSimulationManagerProcess
[ n ] G4Transportation
It can be set as a discrete process or it must be set as a
continuous & discrete process if using ghost volumes.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6565
Ghost VolumeGhost Volume Ghost volumes allow to define envelopes independent to the volumes of the Ghost volumes allow to define envelopes independent to the volumes of the
tracking geometry.tracking geometry.
For example, this allows to group together electromagnetic and hadronic For example, this allows to group together electromagnetic and hadronic
calorimeters for hadron parameterization or to define envelopes for calorimeters for hadron parameterization or to define envelopes for
imported geometries which do not have a hierarchical structure.imported geometries which do not have a hierarchical structure.
In addition, Ghost volumes can be sensitive to particle type, allowing to In addition, Ghost volumes can be sensitive to particle type, allowing to
define envelops individually to particle types.define envelops individually to particle types.
Ghost Volume of a given particle type is placed as a clone of the world Ghost Volume of a given particle type is placed as a clone of the world
volume for tracking.volume for tracking.
This is done automatically by G4GlobalFastSimulationManager.This is done automatically by G4GlobalFastSimulationManager.
The G4FastSimulationManagerProcess provides the additional navigation The G4FastSimulationManagerProcess provides the additional navigation
inside a ghost geometry. This special navigation is done transparently to the inside a ghost geometry. This special navigation is done transparently to the
user.user.
User support processes User support processes in Geant4in Geant4
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6767
User SupportUser Support Geant4 Collaboration offers extensive user supports. Geant4 Collaboration offers extensive user supports.
Users workshopsUsers workshops
Tutorial coursesTutorial courses
HyperNews and mailing listHyperNews and mailing list
Bug reporting system Bug reporting system
Requirements tracking systemRequirements tracking system
Daily “private” communicationsDaily “private” communications
Technical ForumTechnical Forum
http://cern.ch/geant4/http://cern.ch/geant4/
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6868
Geant4 users workshopGeant4 users workshop Users workshops were held or are going to be held hosted by Users workshops were held or are going to be held hosted by
several institutes for various user communities.several institutes for various user communities.
KEK - Dec.2000, Jul.2001, Mar.2002, Jul.2002, Mar.2003, KEK - Dec.2000, Jul.2001, Mar.2002, Jul.2002, Mar.2003,
Jul.2003, Jul.2004, Jan.2005Jul.2003, Jul.2004, Jan.2005
SLAC - Feb.2002SLAC - Feb.2002
Spain (supported by INFN) - Jul.2002Spain (supported by INFN) - Jul.2002
CERN - Nov.2002CERN - Nov.2002
NASA/ESA/Vanderbilt - Jan.2003, May.2004, Oct.2005NASA/ESA/Vanderbilt - Jan.2003, May.2004, Oct.2005
Helsinki - Oct.2003, Jun.2005Helsinki - Oct.2003, Jun.2005
Local workshops of one or two days were held or are Local workshops of one or two days were held or are
planned at several places.planned at several places.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 6969
Geant4 tutorials / lecturesGeant4 tutorials / lectures In addition to the users workshops, many tutorial courses and In addition to the users workshops, many tutorial courses and
lectures with some discussion time slots were held for various user lectures with some discussion time slots were held for various user communities.communities. CERN School of ComputingCERN School of Computing Italian National School for HEP/Nuclear PhysicistsItalian National School for HEP/Nuclear Physicists MC2000MC2000 MCNEG workshopMCNEG workshop IEEE NSS/MIC IEEE NSS/MIC KEK, SLAC, DESY, FNAL, INFN, Frascati, Karolinska, GranSasso, KEK, SLAC, DESY, FNAL, INFN, Frascati, Karolinska, GranSasso,
etc.etc. ATLAS, CMS, LHCbATLAS, CMS, LHCb Tutorials/lectures at universitiesTutorials/lectures at universities
Italy - Genoa, Bologna, Udine, Roma, TriesteItaly - Genoa, Bologna, Udine, Roma, Trieste U.K. - ImperialU.K. - Imperial U.S. - VanderbiltU.S. - Vanderbilt
Geant4 collaboration is happy to offer tutorial courses if requested.Geant4 collaboration is happy to offer tutorial courses if requested. SLAC Geant4 team is offering tutorial courses regularly.SLAC Geant4 team is offering tutorial courses regularly.
http://geant4.slac.stanford.edu/http://geant4.slac.stanford.edu/
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7070
HyperNewsHyperNews HyperNews system was set up in April 2001 HyperNews system was set up in April 2001
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7171
HyperNewsHyperNews 22 categories 22 categories Not only “user-Not only “user-
developer”, but also developer”, but also
“user-user” “user-user”
information exchanges information exchanges
are quite intensive.are quite intensive.
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7272
HyperNews is quite activeHyperNews is quite active
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7373
Some postings are novice…Some postings are novice…
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7474
Some are excellent users Some are excellent users contributioncontribution
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7575
Technical ForumTechnical Forum In the Technical Forum, the Geant4 Collaboration, its user community In the Technical Forum, the Geant4 Collaboration, its user community
and resource providers discuss:and resource providers discuss: major user and developer requirements, user and developer major user and developer requirements, user and developer
priorities, software implementation issues, prioritized plans, priorities, software implementation issues, prioritized plans, physics validation issues, user support issuesphysics validation issues, user support issues
The Technical Forum is open to all interested parties The Technical Forum is open to all interested parties To be held at least 4 times per year (in at least two locales)To be held at least 4 times per year (in at least two locales) First Technical Forum at TRIUMF in September 2003, followed by First Technical Forum at TRIUMF in September 2003, followed by
forum meetings at various places. forum meetings at various places. The purpose of the forum is to:The purpose of the forum is to:
Achieve, as much as possible, a mutual understanding of the Achieve, as much as possible, a mutual understanding of the needs and plans of users and developers. needs and plans of users and developers.
Provide the Geant4 Collaboration with the clearest possible Provide the Geant4 Collaboration with the clearest possible understanding of the needs of its users.understanding of the needs of its users.
Promote the exchange of information about physics validation Promote the exchange of information about physics validation performed by Geant4 Collaborators and Geant4 users.performed by Geant4 Collaborators and Geant4 users.
Promote the exchange of information about user support provided Promote the exchange of information about user support provided by Geant4 Collaborators and Geant4 user communities. by Geant4 Collaborators and Geant4 user communities.
SLAC Geant4 teamSLAC Geant4 team
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7777
SLAC Computing ServicesSLAC Computing Services (SCS)(SCS)
Scientific Computing and Scientific Computing and Computing ServicesComputing Services (SCCS)(SCCS)
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7878
Physics Experiment Support Physics Experiment Support GroupGroup
ObjectivesObjectives
Support software Support software
developments and developments and
maintenances for the maintenances for the
experiments SLAC is hosting experiments SLAC is hosting
Participate nation-wide and Participate nation-wide and
international collaborating international collaborating
research and development research and development
activities of HEP software activities of HEP software
On-line teamOn-line team
Database teamDatabase team
Off-line teamOff-line team
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 7979
Mark Dönszelmann Tony JohnsonJoseph PerlVictor SerboMax Turri
Vis & Analysis Tools for HEP http://www.freehep.org
• Experiment Independent• Abstract Interfaces• Component Architecture
•Experiment or collaboration choose the interfaces; end users choose the desktop tool
•Based on well-defined, flexible, language neutral interfaces
Abstract Interfaces
BaBar, GLAST,LCD, Geant4
IceCube, CLEO
Lizard
OpenScientist
WIRED
Event Display
HepRep
JAS
Data Analysis&
VisualizationAIDA
FRED
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 8080
Geant4Geant4
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 8181
http://geant4.slac.stanford.edu/
More on Kernel - M.Asai (SLAC)More on Kernel - M.Asai (SLAC) 8282