-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
step_length_max not propagated to Geant4 #327
Comments
From the Geant4 manual
It seems that DD4hep does not do the second step. |
Here is what I believe is the relevant code used in Mokka: void PhysicsListUserLimits::Enable(void)
{
// cf. Geant 4 HyperNews, Forum "Physics List", Message 129
// http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/phys-list/129.html
G4UserSpecialCuts *specialCuts = new G4UserSpecialCuts;
G4StepLimiter *stepLimiter = new G4StepLimiter;
TPCStepLimiterLowPt *tpcStepLimiterLowPt = new TPCStepLimiterLowPt;
G4ParticleTable *particleTable = G4ParticleTable::GetParticleTable();
G4ParticleTable::G4PTblDicIterator *particleIterator = particleTable->GetIterator();
// make sure you have called "G4RunManager::Initialize()" before
particleIterator->reset();
while ((*particleIterator)()) {
// iterate through all known particles
G4ParticleDefinition *particleDefinition = particleIterator->value();
G4ProcessManager *processManager = particleDefinition->GetProcessManager();
if (processManager && !particleDefinition->IsShortLived() && particleDefinition->GetPDGCharge() != 0) {
// the process manager should exist, but we don't need to limit short-lived particles or neutrals
processManager->AddDiscreteProcess(stepLimiter);
processManager->AddDiscreteProcess(specialCuts);
// these transportation-related processes are always applicable
// if TPCStepLimiterLowPt set in steering file
if( Control::TPCLowPtStepLimit ) {
processManager->AddDiscreteProcess(tpcStepLimiterLowPt);
}
}
}
}
|
Also, in this scheme, the limits apply to all particles entering in the volume where the limits are defined. This is how we currently define the limits in one of our ILD detector : <limits>
<limitset name="cal_limits">
<limit name="step_length_max" particles="*" value="cal_steplimit_val" unit="cal_steplimit_unit" />
</limitset>
<limitset name="TPC_limits">
<limit name="step_length_max" particles="*" value="tpc_steplimit_val" unit="tpc_steplimit_unit" />
</limitset>
<limitset name="Tracker_limits">
<limit name="step_length_max" particles="*" value="tracker_steplimit_val" unit="tracker_steplimit_unit" />
</limitset>
</limits> I don't understand how the limits could apply to a specific set of particles in a given volume but not to other particles. <limits>
<limitset name="cal_limits">
<limit name="step_length_max" particles="gamma" value="cal_steplimit_val" unit="cal_steplimit_unit" />
</limitset>
<limitset name="TPC_limits">
<limit name="step_length_max" particles="e-" value="tpc_steplimit_val" unit="tpc_steplimit_unit" />
</limitset>
</limits> the step limiter process will be assigned to the electron particle but by design Geant4 will apply the step limits to the electron also where the cal_limits are applied because the process is globally assigned to the particle. Am I clear ? ... |
From what I can see, the |
Frank, |
Markus, the way this works is that one has to add the StepLimiter to all charged long lived particles. The actual limits are then taken from the volume or the region (so probably nothing to be done there in DD4hep). auto physicsList = new FTFP_BERT;
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
runManager->SetUserInitialization(physicsList); The An extra complication is the |
Yes. I found that as well. Now build the physics list:
Would it be possible, that @shaojunlu tries this out? |
Ok, this works if we add it to DDSim - is this already the fix or should this also be added to DDG4 as default behavior ? |
Hi, Thank you, |
@nalipour : You will have to instruct Gaussino to do this for you. auto physicsList = new FTFP_BERT; |
It works if we add it to DDSim in this way. |
@shaojunlu I do not know ... Otherwise the behavior should be implemented in ddsim. |
There is still the issue mentioned by @rete from above. |
I have committed a dd4hep version in
Could someone please test this?
It would be good if we could have an explicit test checking such a behavior. |
@shaojunlu I am currently installing a HEAD release with this version of DD4hep at:
Once this is done, could you please run a short test with your tools that check the step size for a setting that specifies different additional limits to say electrons and muons ? @MarkusFrankATcernch could you provide example xml snippets that set limits for e+- and mu+- only ? |
@gaede: For me such a limitset definition works (or does not give errors): <limits>
<limitset name="minitel_limits">
<limit name="step_length_max" particles="e[+-]" value="1.0" unit="mm" />
<limit name="step_length_max" particles="mu[+-]" value="3.0" unit="mm" />
<limit name="step_length_max" particles="*" value="5.0" unit="mm" />
</limitset>
</limits> |
@gaede Your three step_length_max have been used in our ILD_l5_v02 simulation. |
Hi @shaojunlu ,
Cheers, Markus |
As for your question for Regions, we need the same behavior as Geant
|
Dear @MarkusFrankATcernch Recently, ILCsoft LCIO has added "SimCalorimeterHit::getLengthCont() (step length)". After the simulation as README.md documented in ILDConfig/StandardConfig/production. SimCalorimeterHit collections from the calorimeter detectors will include the "step length" information. const LCCollection* col = evt->getCollection( _simCaloHitCollectionName ) ;
if( col ){
streamlog_out(DEBUG4) << " We examine collection " << _simCaloHitCollectionNames<< " with " << col->getNumberOfElements() << " hits " << std::endl;
for( int j = 0, jN = col->getNumberOfElements() ; j<jN ; ++j ) {
SimCalorimeterHit* simHit = (SimCalorimeterHit*) col->getElementAt( j ) ;
for( int k = 0, kN = simHit->getNMCContributions() ; k<kN ; ++k ) {
int NMCC_PDG = simHit->getPDGCont(k) ;
float NMCC_stepLength = simHit->getLengthCont(k) ;
// NMCC_PDG is this contribution PDG code.
// NMCC_stepLength is this contribution step length.
}
}
}
// evt is the LCEvent which is defined in LCIO
// _simCaloHitCollectionName is one calorimeter collection name to be checked within this event. |
Hi, Thank you for fixing the issue. Is it possible to make a tag so that we can use it in FCCSW? Thanks, |
The
step_length_max
that is set in<limits>
is not propagated to G4.Individually corroborated by @shaojunlu and @nalipour that no step limit is observed when looking at step length.
The text was updated successfully, but these errors were encountered: