<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks Peter,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I will take a look, EPICS interface is more difficult to handle, it's easy to deal with the</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
PS rate directly.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
             Sasha<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Peter Pauli <Peter.Pauli@glasgow.ac.uk><br>
<b>Sent:</b> Friday, January 22, 2021 8:16 AM<br>
<b>To:</b> Alexander Somov <somov@jlab.org><br>
<b>Cc:</b> Alexander Austregesilo <aaustreg@jlab.org>; Igal Jaegle <ijaegle@jlab.org>; primexd@jlab.org <primexd@jlab.org><br>
<b>Subject:</b> [EXTERNAL] Re: [Primexd] Random trigger skims</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">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="x_Apple-interchange-newline">
<div class="">
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="x_Apple-interchange-newline">
Hi,</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
The fraction of accidental hits in the CCAL is relatively small<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
so the impact of accidentals on the efficiency of Compton events<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
is not significant, at least for the event selection I used.<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
The difference in efficiency was well below 1% (on the level of sensitivity of<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
the MC sample I used) when the beam trip time was excluded  (for some<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
runs with the typical fraction of the beam off time )</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
At any rate, when Peter is done with his method, we can produce new hddm files<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
for random triggers. The easiest way would be to accept or reject random triggers</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
in between SYNC events, where we read out TS scalers (I don't know how exactly<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
Peter is implementing this).</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
Cheers,</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
             Sasha</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div id="x_appendonsend" class="" style="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; text-decoration:none">
</div>
<hr tabindex="-1" class="" style="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; text-decoration:none; display:inline-block; width:748.71875px">
<span class="" style="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; text-decoration:none; float:none; display:inline!important"></span>
<div id="x_divRplyFwdMsg" dir="ltr" class="" style="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; text-decoration:none">
<font face="Calibri, sans-serif" class="" style="font-size:11pt"><b class="">From:</b><span class="x_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="x_Apple-converted-space"> </span>Thursday, January 21, 2021 5:25 PM<br class="">
<b class="">To:</b><span class="x_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="x_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="x_Apple-converted-space"> </span>[Primexd] Random trigger skims</font>
<div class=""> </div>
</div>
<div class="x_BodyFragment" style="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; text-decoration:none">
<font size="2" class=""><span class="" style="font-size:11pt">
<div class="x_PlainText">Hi Igal,<br class="">
<br class="">
We have a plugin called randomtrigger_skim to filter out the random<span class="x_Apple-converted-space"> </span><br class="">
triggers from any evio input and convert them into the hddm format that<span class="x_Apple-converted-space"> </span><br class="">
can be mixed into the simulation by mcsmear. To be more realistic, we<span class="x_Apple-converted-space"> </span><br class="">
only accept random triggers that fall into a time period were the beam<span class="x_Apple-converted-space"> </span><br class="">
was actually on. The plugin takes this beam fiducial map into account,<span class="x_Apple-converted-space"> </span><br class="">
but it has to be generated beforehand. Peter Pauli (cc) was just working<span class="x_Apple-converted-space"> </span><br class="">
on an improved scheme for this extraction, maybe he can help you also<span class="x_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="x_Apple-converted-space"> </span><br class="">
evio files. Afterwards, we can concatenate the hddm skims from<span class="x_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="x_Apple-converted-space"> </span><br class="">
`RANDSKIM:USEBEAM 0` into your config file to simply write out all<span class="x_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>
</div>
</body>
</html>