<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi all,
<div class=""><br class="">
</div>
<div class="">So here is the method I use.</div>
<div class=""><br class="">
</div>
<div class="">In order to see if the beam was on or not the counts in the PS are used. They correlate very nicely with the beam delivery. David L. added a few histograms to the PS_flux plugin which are basically filled when there are counts in the PS. All I
 do is convert the histogram into a string that can be put into the ccdb which contains the entries in the hist for each time increment (bin-by-bin). Then in the DBeamCurrent_factory this database is loaded and used to determine if the beam is on by checking
 if the count is over a certain threshold. It seems a bit complicated which is owed to the fact that previously the beam_on condition was derived from EPICS. I wanted to keep the changes to the code as minimalistic as possible and have it backwards compatible.</div>
<div class=""><br class="">
</div>
<div class="">If you want to have a look at the macros I wrote to get the data tables from the histogram have a look at</div>
<div class="">/w/work/halld/home/ppauli/randomTrigger/</div>
<div class=""><br class="">
</div>
<div class="">It contains the files as well as some of the tables for the 2020 batches that have already been produced.</div>
<div class=""><br class="">
</div>
<div class="">If you need more info on this method please get in touch.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Peter</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 21 Jan 2021, at 22:56, Alexander Somov <<a href="mailto:somov@jlab.org" class="">somov@jlab.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="Apple-interchange-newline">
Hi,</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
The fraction of accidental hits in the CCAL is relatively small<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
so the impact of accidentals on the efficiency of Compton events<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
is not significant, at least for the event selection I used.<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
The difference in efficiency was well below 1% (on the level of sensitivity of<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
the MC sample I used) when the beam trip time was excluded  (for some<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
runs with the typical fraction of the beam off time )</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
At any rate, when Peter is done with his method, we can produce new hddm files<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
for random triggers. The easiest way would be to accept or reject random triggers</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
in between SYNC events, where we read out TS scalers (I don't know how exactly<span class="Apple-converted-space"> </span><br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Peter is implementing this).</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Cheers,</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
             Sasha</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div id="appendonsend" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
</div>
<hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 748.71875px;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span>
<div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Primexd <<a href="mailto:primexd-bounces@jlab.org" class="">primexd-bounces@jlab.org</a>> on behalf of Alexander Austregesilo
 <<a href="mailto:aaustreg@jlab.org" class="">aaustreg@jlab.org</a>><br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Thursday, January 21, 2021 5:25 PM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>Igal Jaegle <<a href="mailto:ijaegle@jlab.org" class="">ijaegle@jlab.org</a>><br class="">
<b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:primexd@jlab.org" class="">primexd@jlab.org</a> <<a href="mailto:primexd@jlab.org" class="">primexd@jlab.org</a>>; Peter Pauli (PGR) <<a href="mailto:p.pauli.1@research.gla.ac.uk" class="">p.pauli.1@research.gla.ac.uk</a>><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>[Primexd] Random trigger skims</font>
<div class=""> </div>
</div>
<div class="BodyFragment" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2" class=""><span style="font-size: 11pt;" class="">
<div class="PlainText">Hi Igal,<br class="">
<br class="">
We have a plugin called randomtrigger_skim to filter out the random<span class="Apple-converted-space"> </span><br class="">
triggers from any evio input and convert them into the hddm format that<span class="Apple-converted-space"> </span><br class="">
can be mixed into the simulation by mcsmear. To be more realistic, we<span class="Apple-converted-space"> </span><br class="">
only accept random triggers that fall into a time period were the beam<span class="Apple-converted-space"> </span><br class="">
was actually on. The plugin takes this beam fiducial map into account,<span class="Apple-converted-space"> </span><br class="">
but it has to be generated beforehand. Peter Pauli (cc) was just working<span class="Apple-converted-space"> </span><br class="">
on an improved scheme for this extraction, maybe he can help you also<span class="Apple-converted-space"> </span><br class="">
for the PrimEx data.<br class="">
<br class="">
Once the fiducial map is ready, you just have to run the plugin over all<span class="Apple-converted-space"> </span><br class="">
evio files. Afterwards, we can concatenate the hddm skims from<span class="Apple-converted-space"> </span><br class="">
individual evio files so that we have one file per run.<br class="">
<br class="">
Before you have the fiducial map, you can also include the option<span class="Apple-converted-space"> </span><br class="">
`RANDSKIM:USEBEAM 0` into your config file to simply write out all<span class="Apple-converted-space"> </span><br class="">
random triggers. This serves already as a good approximation.<br class="">
<br class="">
Let me know if you have any questions,<br class="">
<br class="">
Alex<br class="">
<br class="">
_______________________________________________<br class="">
Primexd mailing list<br class="">
<a href="mailto:Primexd@jlab.org" class="">Primexd@jlab.org</a><br class="">
<a href="https://mailman.jlab.org/mailman/listinfo/primexd" class="">https://mailman.jlab.org/mailman/listinfo/primexd</a></div>
</span></font></div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>