JeffersonLab / halld_sim

Simulation for the GlueX Experiment in Hall D
6 stars 10 forks source link

Random Trigger Skims not showing #332

Closed alfab3 closed 6 months ago

alfab3 commented 6 months ago

Using the plugin "random_triggerskim" to generate hddm files generates skim files with no information on FMWPC hits.

Testing the random trigger skims using mcsmear to merge the skims into simulated data has the following results:

This is the simulated data from MCwrapper with mcsmear turned on image

This is the simulated data from MCwrapper with mcsmear turned off, then the random triggers are merged into the simulated times image

Note the statistics are off but the structure of the histogram is the same. We believe the final product of simulated events with merged random triggers should resemble real data: image We see the fmwpc hits in the .hddm files from the plugin but for some reason they are not showing up in mcsmear here.

I also ran a plugin to look at a histogram of the random triggers

image

but this shows up empty.

Any help is appreciated!

aaust commented 6 months ago

Do you mind sharing the location of your random trigger hddm files?

alfab3 commented 6 months ago

Yes my mistake: /volatile/halld/home/alfab/cpp_rand_trig/converted_random/101142/

aaust commented 6 months ago

Thank you. When I run the halld_recon plugin FMPWC_online over these files, I do see hits in the detector: image

For that reason, we believe the problem is on the mcsmear side.

alfab3 commented 6 months ago

What object did you use to produce this histogram? Was it just DFMWPCHit?

sdobbs commented 6 months ago

that's correct, the merging code doesn't currently support the FMWPC or the CTOF

aaust commented 6 months ago

What object did you use to produce this histogram? Was it just DFMWPCHit?

Yes. You can see the source code here: https://github.com/JeffersonLab/halld_recon/blob/master/src/plugins/monitoring/FMWPC_online/JEventProcessor_FMWPC_online.cc

alfab3 commented 6 months ago

that's correct, the merging code doesn't currently support the FMWPC or the CTOF

is that something we can add? I am unfamiliar with the mcsmear code

sdobbs commented 6 months ago

OK, I am apparently wrong about this. @alfab3 - how are you running mcsmear?

alfab3 commented 6 months ago

The command I am using is: mcsmear /volatile/halld/home/alfab/bhmuons/bhmuons_no_mcsmear/101142/geant4_101142_000.hddm /volatile/halld/home/alfab/cpp_rand_trig/converted_random/101142/converted_random_101142_000.hddm:1

Where the first file is a simulated file of muons passed through geant4 in MCWrapper but stopped before the mcsmear step. The second file is a random trigger skim that was created with the randomtrigger_skim plugin.

sdobbs commented 6 months ago

OK, I think I see the problem. It's more obvious if you look at the converted_random_101142_000.hddm file, e.g., with hd_dump.

All of the hits are being added to one wire per layer, and naturally only one is being kept for further analysis.

So this looks to be a bug in the HDDMWriter - you probably need to create multiple entries per chamber, one per wire, or something like that.

alfab3 commented 6 months ago

I see I will look into fixing this

rjones30 commented 6 months ago

Albert, let me fix this, if you don't mind. I think someone added this capability to mcsmear who did not quite understand how it works. -Richard Jones

On Tue, Apr 30, 2024 at 2:40 PM Albert @.***> wrote:

I see I will look into fixing this

— Reply to this email directly, view it on GitHub https://github.com/JeffersonLab/halld_sim/issues/332#issuecomment-2086513606, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWDD2JM4YAXV3F3HE6DY77QRXAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBWGUYTGNRQGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

alfab3 commented 6 months ago

That would be great thank you very much

sdobbs commented 6 months ago

Thanks Richard - for what it's worth, the issue looks to be in the DEventWriterHDDM class in halld_recon.

rjones30 commented 6 months ago

Sean, yes that is what I am looking at. I already introduced the code for the CTOF, now debugging the MWPC code that was there already. -rtj

On Tue, Apr 30, 2024 at 2:49 PM Sean Dobbs @.***> wrote:

Thanks Richard - for what it's worth, the issue looks to be in the DEventWriterHDDM class in halld_recon.

— Reply to this email directly, view it on GitHub https://github.com/JeffersonLab/halld_sim/issues/332#issuecomment-2086563100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWH2SKPLHKWFORX5CODY77RUHAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBWGU3DGMJQGA . You are receiving this because you commented.Message ID: @.***>

rjones30 commented 6 months ago

I submitted a PR to halld_recon for the MWPC hits writer bug in DEventWriterHDDM, and to halld_sim for addition of ctof hits merging in mcsmear. Albert, this should fix both of your issues, please test and confirm. -Richard Jones

On Mon, Apr 29, 2024 at 4:54 PM Albert @.***> wrote:

Using the plugin "random_triggerskim" to generate hddm files generates skim files with no information on FMWPC hits.

Testing the random trigger skims using mcsmear to merge the skims into simulated data has the following results:

This is the simulated data from MCwrapper with mcsmear turned on image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/de8c8b6f-9f39-486c-94b7-488e4afa84e4

This is the simulated data from MCwrapper with mcsmear turned off, then the random triggers are merged into the simulated times image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/008783c9-2557-4ee0-87a4-74d11b3b9b52

Note the statistics are off but the structure of the histogram is the same. We believe the final product of simulated events with merged random triggers should resemble real data: image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/100d3f8b-ab41-444a-b0bf-abe3e2889b5a We see the fmwpc hits in the .hddm files from the plugin but for some reason they are not showing up in mcsmear here.

I also ran a plugin to look at a histogram of the random triggers

image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/e996d260-5d99-405b-881d-1d62578d3af3

but this shows up empty.

Any help is appreciated!

— Reply to this email directly, view it on GitHub https://github.com/JeffersonLab/halld_sim/issues/332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWFBINMRGGG3F4Y2SRTY72XQZAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DSOJVGY3DINA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

alfab3 commented 6 months ago

Okay thank you, I will get right on that

alfab3 commented 6 months ago

I submitted a PR to halld_recon for the MWPC hits writer bug in DEventWriterHDDM, and to halld_sim for addition of ctof hits merging in mcsmear. Albert, this should fix both of your issues, please test and confirm. -Richard Jones On Mon, Apr 29, 2024 at 4:54 PM Albert @.> wrote: Using the plugin "random_triggerskim" to generate hddm files generates skim files with no information on FMWPC hits. Testing the random trigger skims using mcsmear to merge the skims into simulated data has the following results: This is the simulated data from MCwrapper with mcsmear turned on image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/de8c8b6f-9f39-486c-94b7-488e4afa84e4 This is the simulated data from MCwrapper with mcsmear turned off, then the random triggers are merged into the simulated times image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/008783c9-2557-4ee0-87a4-74d11b3b9b52 Note the statistics are off but the structure of the histogram is the same. We believe the final product of simulated events with merged random triggers should resemble real data: image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/100d3f8b-ab41-444a-b0bf-abe3e2889b5a We see the fmwpc hits in the .hddm files from the plugin but for some reason they are not showing up in mcsmear here. I also ran a plugin to look at a histogram of the random triggers image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/e996d260-5d99-405b-881d-1d62578d3af3 but this shows up empty. Any help is appreciated! — Reply to this email directly, view it on GitHub <#332>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWFBINMRGGG3F4Y2SRTY72XQZAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DSOJVGY3DINA . You are receiving this because you are subscribed to this thread.Message ID: @.>

I attempted to compile the halld_sim branch but errors caused it to crash: (ERROR MESSAGE) Linking [.Linux_CentOS7.7-x86_64-gcc4.8.5/programs/Simulation/HDGeant/utilities/bcal2nt] /usr/bin/ld: cannot find -lECAL collect2: error: ld returned 1 exit status scons: *** [.Linux_CentOS7.7-x86_64-gcc4.8.5/programs/Simulation/HDGeant/utilities/bcal2nt] Error 1 scons: building terminated because of errors.

rjones30 commented 6 months ago

Albert, it appears that your halld_recon may not be up to date with the latest master. Can you check that you are on the master of halld_recon, and if so that you have done a git pull followed by a scons install?

-Richard Jones

On Tue, Apr 30, 2024 at 7:24 PM Albert @.***> wrote:

I submitted a PR to halld_recon for the MWPC hits writer bug in DEventWriterHDDM, and to halld_sim for addition of ctof hits merging in mcsmear. Albert, this should fix both of your issues, please test and confirm. -Richard Jones … <#m5986656732937098733> On Mon, Apr 29, 2024 at 4:54 PM Albert @.> wrote: Using the plugin "random_triggerskim" to generate hddm files generates skim files with no information on FMWPC hits. Testing the random trigger skims using mcsmear to merge the skims into simulated data has the following results: This is the simulated data from MCwrapper with mcsmear turned on image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/de8c8b6f-9f39-486c-94b7-488e4afa84e4 https://github.com/JeffersonLab/halld_sim/assets/61334734/de8c8b6f-9f39-486c-94b7-488e4afa84e4 This is the simulated data from MCwrapper with mcsmear turned off, then the random triggers are merged into the simulated times image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/008783c9-2557-4ee0-87a4-74d11b3b9b52 https://github.com/JeffersonLab/halld_sim/assets/61334734/008783c9-2557-4ee0-87a4-74d11b3b9b52 Note the statistics are off but the structure of the histogram is the same. We believe the final product of simulated events with merged random triggers should resemble real data: image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/100d3f8b-ab41-444a-b0bf-abe3e2889b5a https://github.com/JeffersonLab/halld_sim/assets/61334734/100d3f8b-ab41-444a-b0bf-abe3e2889b5a We see the fmwpc hits in the .hddm files from the plugin but for some reason they are not showing up in mcsmear here. I also ran a plugin to look at a histogram of the random triggers image.png (view on web) https://github.com/JeffersonLab/halld_sim/assets/61334734/e996d260-5d99-405b-881d-1d62578d3af3 https://github.com/JeffersonLab/halld_sim/assets/61334734/e996d260-5d99-405b-881d-1d62578d3af3 but this shows up empty. Any help is appreciated! — Reply to this email directly, view it on GitHub <#332 https://github.com/JeffersonLab/halld_sim/issues/332>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWFBINMRGGG3F4Y2SRTY72XQZAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DSOJVGY3DINA https://github.com/notifications/unsubscribe-auth/AB3YKWFBINMRGGG3F4Y2SRTY72XQZAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DSOJVGY3DINA . You are receiving this because you are subscribed to this thread.Message ID: @.>

I attempted to compile the halld_sim branch but errors caused it to crash: (ERROR MESSAGE) Linking [.Linux_CentOS7.7-x86_64-gcc4.8.5/programs/Simulation/HDGeant/utilities/bcal2nt] /usr/bin/ld: cannot find -lECAL collect2: error: ld returned 1 exit status scons: *** [.Linux_CentOS7.7-x86_64-gcc4.8.5/programs/Simulation/HDGeant/utilities/bcal2nt] Error 1 scons: building terminated because of errors.

— Reply to this email directly, view it on GitHub https://github.com/JeffersonLab/halld_sim/issues/332#issuecomment-2087708317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWGM4JA6UGGGGW3S74TZAAR2JAVCNFSM6AAAAABG7BCX7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBXG4YDQMZRG4 . You are receiving this because you commented.Message ID: @.***>

alfab3 commented 6 months ago

That fixed it thanks!

alfab3 commented 6 months ago

First test looks good: Screenshot 2024-05-01 at 1 18 05 PM Screenshot 2024-05-01 at 1 18 40 PM

The red histogram represents the simulation with the random triggers, I am assuming the lack of tail like in the data (as shown in my initial post above) is due to just statistics.

sdobbs commented 6 months ago

Thanks, @alfab3 - looks like the code is working now, but probably more studies are needed to understand the distribution. For example, maybe the extra hits are due to some correlated noise which is not captured in the random triggers. Or perhaps there is more extensive showering in data than in the simulation.

We can probably close this issue, though, and open another one if needed.