<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Hi All,</div><div><br></div><div> I just want to point out that there already exists a program to combine signal and background events as Justin describes, outside of GEANT. This was designed to be used with a library of backgrounds events as Richard suggested. The problem with this method is that it can lead to multiple detector hits on the same channel that overlap in time in a way the electronics would never produce. I believe this was the reason Richard said we need to merge them at the accumulation level (correct me if I’m wrong).</div><div><br></div><div> One could modify hddm_merge_events to combine hits close in time, but it wouldn’t be the same and would take a little work. Since it sounds like the hit due to EM is not all that bad (factor of 2, not a factor of 10) I would be inclined to agree with Richard that we should bite this bullet and just include the EM background in the original simulation. That’s just my 2 cents though.</div><div><br></div><div><br></div><div>Regards,</div><div>-David</div><div><br></div><div><br></div><div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"><br></div><div style="margin: 0px; font-size: 10px; font-family: Monaco;">Usage:</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> hddm_merge_events [-Mmaxevents] [-oOutputfile] [-l|s -Nnum] file1.hddm [-l|s -Nnum] file2.hddm ...</div><div style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"><br></div><div style="margin: 0px; font-size: 10px; font-family: Monaco;">options:</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> -oOutputfile Set output filename (def. merged.hddm)</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> -Mmaxevents Do not write out more than maxevents events</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> -Nnum Merge together num events from each of the following input files</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> -l Continually loop over events from the following inputs</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> -s Stop when all events from the following inputs have been read</div><div style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"><br></div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> This will take events from 1 or more HDDM files and merge them</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> into events written to an output HDDM file. This works by simply</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> copying the s_PhysicsEvent objects into a single event that gets</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> written to the output file.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> Multiple input files can be specified and for each, the number of</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> events to merge. This allows one to do things such as merge 3 events</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> from a file of background events with a single event from a file of</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> signal events to get a sample of events with 3 times the backaground</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> rate overlayed on the signal.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> By specifying the -l flag, certain input sources can be looped over</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> to recycle thier events. This is useful if one has a sample of</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> background events that is smaller than the sample of signal events.</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> See the examples below.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> NOTE: Events are not merged such that double hits are</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> merged. Hits are only copied so it is possible for</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> the output event to have two hits on the same wire</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> at the same time.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> Example 1:</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> hddm_merge_events -N2 file.hddm</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> This will combine every 2 events from file.hddm into a single in the</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> output. Since no output file name is specified, the file "merged.hddm"</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> will be used.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> Example 2:</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> hddm_merge_events signal.hddm -N10 em_bkgnd.hddm -N1 hadronic_bkgnd.hddm</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> This will combine 1 event from signal.hddm, 10 events from em_bkgnd.hddm,</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> and 1 event from hadronic_bkgnd.hdm into a single output event.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> Example 3:</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> hddm_merge_events -N3 file1.hddm file2.hddm file3.hddm -N1 file4.hddm</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> This will combine 3 events from each of file1.hddm, file2.hddm, and</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> file3.hddm with 1 event from file4.hddm.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> Example 4:</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> hddm_merge_events signal.hddm -l -N10 background.hddm</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> This will combine 1 signal event with 10 background events to create</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> and output event. The events in the background file will be looped</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> over continuosly as needed until all of the signal events have been</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;"> processed.</div><p style="margin: 0px; font-size: 10px; font-family: Monaco; min-height: 14px;"> <br class="webkit-block-placeholder"></p></div><div><br></div><div><br></div><br><div><div>On Feb 10, 2014, at 7:08 AM, Justin Stevens <<a href="mailto:jrsteven@mit.edu">jrsteven@mit.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Richard, All,<br><br>On Feb 10, 2014, at 6:01 AM, Richard Jones wrote:<br><br><blockquote type="cite">I cannot think of any study that is going to fail because we generated a factor 2-3 fewer events, but there are plenty of things that can go wrong if we fail to simulate realistic backgrounds in the detector. I see no advantage to generating even a part of the DC sample with less than 10^7 g/s background rates and the full 1us gate.<br></blockquote><br>I completely agree that we have to face the background issue head-on, but it seems to me that a sub-sample without background could still be useful for a comparison. We have some understanding of the event selection techniques that have been developed so far without background, and being able to connect with those using the updated tracking, etc. in the software since DC 1 would be useful in my opinion. Also being able to compare an analysis done on MC with and without background may provide some insight into what features of the background are the most problematic and how to reduce those effects in the analysis.<br><br><blockquote type="cite">With more time and effort, we could probably come up with a way to generate a library of background events and overlay random entries from the library onto the bggen events at the desired rate. This is not trivial to do because the superposition must be carried out at the hits accumulation level inside Geant before hits aggregation, but given the computing cost it is likely the way to go. <br></blockquote><br>In the other experiment I'm involved with (STAR) this superposition is done with background events from data (once it's available), so the superposition is done by combining raw hits for the physics event from Geant and raw hits for the background event from data. Is there something about the GlueX simulation which requires that "the superposition must be carried out at the hits accumulation level inside Geant before hits aggregation"? I was (maybe naively) assuming the mechanism that would be developed for this in GlueX would occur outside of Geant for superimposing with data as well. I'm not suggesting we wait for this for DC 2, just trying to understand the issue.<br><br>Thanks,<br>Justin<br>_______________________________________________<br>Halld-offline mailing list<br><a href="mailto:Halld-offline@jlab.org">Halld-offline@jlab.org</a><br>https://mailman.jlab.org/mailman/listinfo/halld-offline<br></blockquote></div><br></body></html>