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
Close by gun generator #26065
Close by gun generator #26065
Conversation
A new particle gun has been added that supports the creation of particle guns located in 3D space. In particular the new module will take as input the Z location and the R radius over which the particles will be produced (one particle at one different vertex), equally spaced by DeltaR, again a parameter of the new module. DeltaR is, in fact, the arc-distance between two consecutive vertices over the circle of radius R. A corresponding PassThrough Event Vertex Generator has been added: it basically copy-paste the HepMC Event created by the upstream Particle Gun module, without touching the vertices created before.
The code-checks are being triggered in jenkins. |
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26065/8622
Code check has found code style and quality issues which could be resolved by applying a patch in https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26065/8622/git-diff.patch You can run |
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26065/8624
|
A new Pull Request was created by @rovere (Marco Rovere) for master. It involves the following packages: IOMC/EventVertexGenerators @efeyazgan, @perrozzi, @civanch, @mdhildreth, @cmsbuild, @alberto-sanchez, @qliphy can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
Pull request #26065 was updated. @efeyazgan, @perrozzi, @civanch, @mdhildreth, @cmsbuild, @alberto-sanchez, @qliphy can you please check and sign again. |
please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1 |
double x=fR*cos(phi); | ||
double y=fR*sin(phi); | ||
constexpr double c= 2.99792458e+1; // cm/ns | ||
double timeOffset = sqrt(x*x + y*y + fZ*fZ)/c*ns*c_light; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rovere , I would expect here CMS units (cm, GeV, ns)? In that case of CLHEP (mm, MeV, ns) should not be used.
Having in one expression both your constant "c" and CLHEP "c_light" seems to be a problem.
To resolve this I would put a comment line about fX, fX, fZ unit, and select one or another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used CMS units for the configuration parameters, namely cm, GeV and ns. Then I compute the timing in ns using CMS units and the "correct" c value and convert it back to whatever CLHEP/hepmc is expecting. Finally, I put back also x,y,fZ back to units that are digested by HepMC.
I have to admit that this mix of units is, to put it mildly, quite ugly and confusing, I agree, but it's not coming from this code but rather imposed from externals.
By the way, I think you will find the same kind of "units massaging" also in other Generators.
+1 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2) |
} | ||
|
||
HepMC::FourVector PassThroughEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine*) const { | ||
return HepMC::FourVector(0.,0.,0.); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you assume the implicit time=0 of the class, one could even set it explicitly to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I could change it into
return HepMC::FourVector(0.,0.,0.,0.);
return HepMC::FourVector(0.,0.,0.); | ||
} | ||
|
||
void PassThroughEvtVtxGenerator::produce( Event& evt, const EventSetup& ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of not using the base class as elsewhere? To avoid the dummy LorentzBoost with a copy-only method I understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, not sure if that will gain anything, but that's what I did.
fDelta = pgun_params.getParameter<double>("Delta"); | ||
fPartIDs = pgun_params.getParameter< vector<int> >("PartID"); | ||
fPointing = pgun_params.getParameter<bool>("Pointing"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have an example configuration fragment usable for tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have, since I already privately used it extensively. Would like me to put the snippet somewhere in this package? If so, where exactly?
This is an example:
process.generator = cms.EDProducer("CloseByParticleGunProducer",
PGunParameters = cms.PSet(PartID = cms.vint32(22, 22),
En = cms.double(50.),
R = cms.double(60),
Z = cms.double(320),
Delta = cms.double(2.5),
Pointing = cms.bool(True),
MaxEta = cms.double(2.9),
MaxPhi = cms.double(3.14159265359/6.),
MinEta = cms.double(1.5),
MinPhi = cms.double(-3.14159265359/6.),
),
Verbosity = cms.untracked.int32(10),
psethack = cms.string('two close by particles'),
AddAntiParticle = cms.bool(False),
firstRun = cms.untracked.uint32(1)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally store these default fragments in Configuration/Generator/python , where they may be used for instance by RelVals .
+1 a possible addition of a configuration example may be managed later |
This PR introduces a new ParticleGunGenerator that is capable of creating several vertices located at the specified (R,Z), with Z fixed and evenly spacing along R all the requested particles.
Particles can be produced parallel to the beamline or pointing towards (0,0,0).
The vertices are assigned the time required to travel from (0,0,0) to the desired location.
An accompanying PassThrough Event Vertex Generator has been added in order to copy-paste everything w/o any additional smearing on any vertex.
This generator has been extremely useful to perform clustering studies for the HGCAL detector (See, e.g. these slides