<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
      <!--
      html{color:#555555;}body{line-height:1.5;font-family:'Trebuchet MS','Helvetica Neue',Arial,Helvetica,sans-serif;font-size:87.5%;}h1{font-size:1.6em;}h2.field-label{display:inline-block;font-size:1em;padding-right:5px;min-width:10em;margin:0.3em;}.problem_report{line-height:1.5;max-width:60em;}fieldset.problem_report.resolved
legend{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAy0lEQVQ4jWP8//8/AyWAiZACd3f3/xYWFrht+f//P1a84t3e/0obff4rbfT5D1GGXR0LuoEr3+/7X3W4n2gvwA0gVSOKAcqbfPGGpImJCU45JgYGBoa7fpsZ22wLSbadgYGBgRE9GrF55Vf2BYbHjx8zYjWB0ljAcAGGExkZ/0MtwuoCggmJEBh4AzBS4pMnT/7fuXOH4dKlSwwnT56EiwcGBv43MDBgMDExYdDX12eQkZGBhAlyiC5YsOA/AwMDUXjLli3/iYoFQgAA+pSxZrXofD0AAAAASUVORK5CYII=);background-repeat:no-repeat;padding-left:18px;}fieldset.problem_report.needs_attention
legend{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA9ElEQVR42sWTvUoDQRSFv9wMKWxSBVmzdhZJIwTWv9pyLWxTpbE1kBeJPoLxBazzBgGFKNqlHXAhsITUw1y7sMpmjER0YJrDPWcO556BPzhjYPJjlhfT82LUpxcK6Lo5U0JMgcu56tXy7BQajeBDpkAcAEdz1W6uyrLdYieK2DMmKCArcqczpH/ddc0msy+OkyQJC4h3N0ynx+Q5ALtUNs5q5U+8e+R+VPFi4kjk3NZqd++qUK+TZVnYwSfAOyvejeLXt/2qVG/dYoG1dqseBNco27bs/wXKWhIDB8AhcFLAH4Bn4Al4AUqT7RVC++6mv/JVPwDi3VGzomYvyAAAAABJRU5ErkJggg==);background-repeat:no-repeat;padding-left:18px;}.problem_report div.field-items{display:inline-block;}div.date-vitals p{font-size:87.5%;}a{text-decoration:none;}.Readme a:link,.Readme a:visited,.Readme
a:active{color:red;}
      -->
    </style>
      </head>
  <body id="mimemail-body" class="elog-logentry-notify">
    <div id="center">
      <div id="main">
        <style>
<!--/*--><![CDATA[/* ><!--*/

div.field-vitals{
    margin: 0.5em 0;
}
div.field-vitals .field-type-taxonomy-term-reference {
    margin: 0.1em 0;
}

article.comment {
  padding-left: 10px;
}
article.comment.odd {
    background-color: #EEEEEE;
}
article.comment.even {
    background-color: #DDDDDD;
}

div.node-content.logentry table{
  width: auto;
  border-collapse: collapse;
  border-spacing: 0;
  border-width: 1px;
}

div.node-content.logentry th{
 border: inherit;
}

div.node-content.logentry blockquote{
  background-color: #FFFFFF;
}

div.node-content.logentry caption{
  font-size: 1em;
  font-weight: normal;
}

table.field-vitals{
   margin-top: 1em;
   margin-bottom: 1em;
   font-size: 87.5%;
}

table.field-vitals th{
   vertical-align: middle;
   text-align: left;
   width: 15%;
   padding: 0.1em;
}

table.field-vitals td{
   vertical-align: middle;
   text-align: left;
   width: auto;
   padding: 0.1em;
}
table.field-vitals td li {
  margin-left: 0;
  list-style-type: none;
  list-style-image: none;
}

table.downtime {
  width: 30em;
  margin-bottom: 1em;
  border: 1px black dotted;
}
table.downtime th {
  text-align: center;
}
table.downtime td {
  text-align: center;
}
tr.caption th {
  border-bottom: none;
}
table.downtime tfoot{
  background-color:#EEEEEE;
}

div.field-name-body{
    margin: 1em 0;
    font-size: 110%;
}
div.date-vitals p{
    margin: .1em 0;
}
article div.ctools-collapsible-container{
    margin-left: -5px;
    clear: both;
}
#comment-form{
  margin-left: 5px;
  border: graytext outset medium;
  -moz-border-radius: 15px;
  border-radius: 15px;
  padding: 1em;
}

div.comments-form-box {
  margin-top: 2em;
  margin-bottom: 5em;
}
h3.comment-title {
    /* display: none; */
}
p.author-datetime{
    font-weight: bold;
}


/*--><!]]>*/
</style><article id="node-533992" class="node node-logentry  article ia-n clearfix" role="article"><header class="node-header"><h1 class="node-title">
          <a href="https://logbooks.jlab.org/entry/3461150" rel="bookmark">Beam trip map for reconstruction</a>
        </h1>
          </header><div class="date-vitals">
        <p class="author-datetime">
      Lognumber <a href="https://logbooks.jlab.org/entry/3461150" class="lognumber" data-lognumber="3461150">3461150</a>.        Submitted by <a href="https://logbooks.jlab.org/user/davidl">davidl</a> on <time datetime="2017-02-21T23:30:51-0500" pubdate="pubdate">Tue, 02/21/2017 - 23:30</time>.        </p>
            <p class="last-update">
      Last updated on <time datetime="2017-02-22T08:21:42-0500" pubdate="pubdate">Wed, 02/22/2017 - 08:21</time></p> 
            
    
    
      
         
   
    
      
    <table class="field-vitals"><tr><th>Logbooks: </th><td><a href="https://logbooks.jlab.org/book/hdlog">HDLOG</a></td></tr></table></div>
  
    
  
    
  <div class="logentry node-content">
    <p>I have added a new data class, DBeamCurrent to sim-recon to allow one to cut out beam trips and only include times of stable beam operation during a run. The trip map will be stored in CCDB. At the moment only a few runs are entered into an sqlite form of CCDB. Here are some details:</p>
<p>The trip map is made by:<br />
- A python script connects directly to RCDB to access the start and end times of a run<br />
- It then runs the mySampler program to extract from the EPICS archive a list of interpolated values from beam current monitor  IBCAD00CRCUR6 at every second during the run<br />
- These values are searched to make a list of boundaries where the current changed by at least 3nA, index by time in seconds since the start of the run<br />
- An ascii representation of this map is written as a single string to the CCDB</p>
<p>On the sim-recon side:<br />
- A new DBeamCurrent factory was added to the DAQ library that reads and interprets this map<br />
- Boundaries corresponding to a current that dropped to below 10nA are considered "trips"<br />
- Boundaries corresponding to a current that rose above 10nA indicate the end of the trip<br />
- The time of the event relative to the start is taken from the 250MHz clock timestamp attached to every event<br />
- The "is_fiducial" member of the DBeamCurrent class will indicate if the beam is "ON" (i.e. >10nA) AND that the time of the current event is at least 3 seconds after the last trip AND at least 3 seconds before the next trip<br />
- The time since the last trip and time until the next trip are also given in the DBeamCurrent object<br /></p><div class="image-wrapper"><img class="image-style-plentybig" src="cid:2a672b237621292db3f537ef84d02630@logbooks.jlab.org" width="391" height="101" alt="" /></div>
<p>To use this, one might put something like the following at the top of their plugin's evnt() method:</p>
<p>  vector<const DBeamCurrent*> bcs;<br />
  loop->Get(bcs);<br />
  if( (!bcs.empty()) && (!bcs[0]->is_fiducial) ) return NOERROR;</p>
<p>In addition, a method is included in the DBeamCurrent_factory class for integrating the fiducial time, taking into account beam trips and the 3 second buffer for each of them. This method is called "IntegratedFiducialTime(tmin,tmax). The arguments allow one to specify a specific time range (say if analyzing only one file). If they are omitted then the fiducial time for the entire run is given.</p>
<p>A utility program called hdbeam_current has also been added to make it easy to browse trip information from CCDB via the command line. An example of the output is shown below for run 30686. Following that is the EPICS archive plot of the time period of the run where one can see where the 9 identified trips occurred.<br /></p><div class="image-wrapper"><img class="image-style-plentybig" src="cid:aa1125c43be41afcac5fa7b0ef812c08@logbooks.jlab.org" width="563" height="303" alt="" /></div><div class="image-wrapper"><img class="image-style-plentybig" src="cid:250d89ff6a4b191ff206738270af0a02@logbooks.jlab.org" width="937" height="483" alt="" /></div>
<p>For comparison, a high intensity run 30402:<br /></p><div class="image-wrapper"><img class="image-style-plentybig" src="cid:51b4191072fbd12468e2f2c1b2acb525@logbooks.jlab.org" width="317" height="195" alt="" /></div><div class="image-wrapper"><img class="image-style-plentybig" src="cid:6345454f43f0b261b870a1e6bdfbba84@logbooks.jlab.org" width="937" height="483" alt="" /></div>
  </div>
  

  <div class="attachment-box">
        </div>

       
</article>      </div>
    </div>
  </body>
</html>