-
Notifications
You must be signed in to change notification settings - Fork 13
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
DCH v2 digitizer, which smears the position and adds cluster information #27
Conversation
Hi Alvaro, excellent! Can you add a test and add a link between sim and digi hits? See e.g. https://github.com/key4hep/k4RecTracker/pull/28/files |
d69a88e
to
2a58e2c
Compare
I have added the association and the test. I have inspected the output file and the associations seems to make sense. Associations are now an additional output collection of the algorithm, but I am not sure if this is the proper way. You can use the following script to inspect the output file of the test, everything seems consistent import ROOT
from podio import root_io
import dd4hep as dd4hepModule
from ROOT import dd4hep
from ROOT import TVector3, TFile, TH1D
ofile = TFile("kk.root","update")
hDpw_calc = TH1D("hDpw_calc","",100,0,10)
hDpw_alg = TH1D("hDpw_alg" ,"",100,0,10)
hDpw_diff = TH1D("hDpw_diff","",100,0,10)
input_file_path = "dch_proton_10GeV_digi.root"
podio_reader = root_io.Reader(input_file_path)
for event in podio_reader.get("events"):
for dc_hit in event.get("DCH_DigiSimAssociationCollection"):
digihit = dc_hit.getDigi()
simhit = dc_hit.getSim()
digipos = TVector3( digihit.getPosition()[0],digihit.getPosition()[1],digihit.getPosition()[2] )
simpos = TVector3( simhit.getPosition()[0], simhit.getPosition()[1], simhit.getPosition()[2] )
hit_wire_vector = simpos - digipos
distance_calculated = hit_wire_vector.Mag()
distance_from_alg = digihit.getDistanceToWire()
# print( distance_from_alg - distance_calculated )
#print( f"{digihit.getEDep()} {simhit.getEDep()}")
hDpw_calc.Fill(distance_calculated)
hDpw_alg.Fill(distance_from_alg)
hDpw_diff.Fill(distance_calculated-distance_from_alg)
ofile.cd()
hDpw_calc.Write()
hDpw_alg.Write()
hDpw_diff.Write()
ofile.Close() |
@BrieucF the code is ready for review :) |
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.
Thanks Alvaro!
Let's add the interface as well: https://github.com/BrieucF/k4RecTracker/blob/fix_for_Dolores/DCHdigi/dataFormatExtension/driftChamberHit.yaml#L66 |
does this do the trick? how can I test that it works? |
I am surprised that it does not complain that the interfaces |
DCHdigi/src/DCHdigi.cpp
Outdated
std::pair<uint32_t,uint32_t> return_values = {0,0}; | ||
uint32_t & Ncl = return_values.first; | ||
uint32_t & ClSz = return_values.second; | ||
//_________________SET NECESSARY PARAMETERS FOR THE CLS ALGORITHM-----WALAA_________________// |
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.
All these parameters will be set at every call of the function, since many are hard coded, would'nt it be better to define them in the header once and for all?
I changed the data extension as you proposed originally (by duplicating code), so the interface can work as expected. |
5dd5d47
to
07a0dc5
Compare
I have added a suffix with the version please let me know if there is anything else I can do :) |
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.
Thanks a lot Alvaro! Can you add a plot of "distance to the wire of digitized hit - distance of the wire from the simhit" together with the code snippet that allows to derive the distance to the wire from the simHit position + cellID (using the facilities from DCH_info)? By the way, can this also be done in Python?
Hi, Thanks for reviewing it! I am not sure I understood your question:
For more advanced plots, I guess one would need a short script, which can be in python |
What is "zero" is the distance between the
No, the information you point is for the digitized hit. For the simHit, we need a routine (I thought you had one defined in the DCH_info) that gives the distance to the wire using the CellID and the simHit position.
The plot I am asking for is a validation: getDistanceToTheWire(simHit.position, cellID) - digitizedHit.getDistanceToWire. And we should see a gaussian with 100 um. Indirectly this code snippet will also provide an example on how to retrieve this info for simHit. Is it clearer? |
field was total number of electrons summed over all clusters during that step
…teClusters function
d16a63f
to
d02cf89
Compare
Thanks Alvaro! |
BEGINRELEASENOTES
ENDRELEASENOTES
Hi,
Please find attached the drift chamber (DCH) digitizer, based on Walaa's code for the cluster number and size calculations. In addition, I added the position smearing based on analytical calculations (I was stuck here, but thanks to Andre we found the problem).
The algorithm works as expected, but I can imagine there is room for improvement regarding naming, coding style in general, so please let me know if I can improve it somehow.
I have been working on a stand alone repository, in case you want to try out: https://github.com/atolosadelgado/DCH_detector
Alvaro.