<html>
  <head>
    
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hi Sean,<br>
    <br>
    &nbsp; First off, I'm CC-ing this to the Hall-D Offline Software mailing
    list since this may be of interest to a wider audience.<br>
    <br>
    &nbsp; I can answer the question regarding getting the DBCALHit objects
    that were used to make a given DBCALCluster object. You can get to
    them using the Associated Objects mechanism built into JANA. First,
    to see what types of associated objects a certain object has use
    hd_dump with the "-a" flag like this:<br>
    <br>
    <tt>&gt; hd_dump -f -s -a -DDBCALCluster hdgeant_smeared.hddm</tt><tt><br>
    </tt><tt>...</tt><tt><br>
    </tt><tt>================================================================</tt><tt><br>
    </tt><tt>Event: 1</tt><tt><br>
    </tt><tt>DBCALCluster:</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp; r:&nbsp;&nbsp; phi:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z: theta:&nbsp;&nbsp;&nbsp;&nbsp; t:&nbsp;&nbsp;&nbsp;&nbsp; E: N_cell:</tt><tt><br>
    </tt><tt>---------------------------------------------------</tt><tt><br>
    </tt><tt>&nbsp;65.43&nbsp;&nbsp; 2.52&nbsp; 290.15&nbsp;&nbsp; 0.28&nbsp;&nbsp; 7.77&nbsp;&nbsp; 0.54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7 </tt><tt><br>
    </tt><tt>&nbsp;74.52&nbsp;&nbsp; 0.35&nbsp;&nbsp; 51.66&nbsp;&nbsp; 1.75&nbsp;&nbsp; 2.49&nbsp;&nbsp; 0.31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 </tt><tt><br>
    </tt><tt>&nbsp;69.02&nbsp;&nbsp; 1.76&nbsp; 170.88&nbsp;&nbsp; 0.58&nbsp;&nbsp; 4.10&nbsp;&nbsp; 0.19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 </tt><tt><br>
    </tt><tt><br>
    </tt><tt>&nbsp; [== Associated objects for row 0 ==]</tt><tt><br>
    </tt><tt>&nbsp;&nbsp; DBCALPoint 0xb6c53a00</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c53b08</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c53c10</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c53d18</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c53ea8</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c53f70</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c54058</tt><tt><br>
    </tt><tt>&nbsp; [== Associated objects for row 1 ==]</tt><tt><br>
    </tt><tt>&nbsp;&nbsp; DBCALPoint 0xb6c4f1f0</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c4f288</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c4f380</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c4f488</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c4f590</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c4f698</tt><tt><br>
    </tt><tt>&nbsp; [== Associated objects for row 2 ==]</tt><tt><br>
    </tt><tt>&nbsp;&nbsp; DBCALPoint 0xb6c4f8a8</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c53490</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c535e0</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xb6c536e8</tt><br>
    <br>
    This shows that DBCALCluster objects have pointers to DBCALPoint
    objects attached as associated objects. You can then do the same
    exercise but for DBCALPoint objects to see that they have something
    called DBCALUnifiedHit attached. Finally, the DBCALUnifiedHit
    objects have the DBCALHit objects attached as associated objects.<br>
    <br>
    To get at these using code, use the Get() method of the data object
    itself. In this case, you might write something like this:<br>
    <br>
    <tt>vector&lt;const DBCALCluster*&gt; clusters;</tt><tt><br>
    </tt><tt>loop-&gt;Get(clusters);</tt><tt><br>
    </tt><tt>for(unsigned int i=0; i&lt;clusters.size(); i++){</tt><tt><br>
    </tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; vector&lt;const DBCALPoint*&gt;</tt><tt> points;</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; clusters[i]-&gt;Get(points);</tt><tt><br>
    </tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; for(unsigned int j=0; j&lt;points.size(); j++){</tt><tt><br>
    </tt><br>
    <tt><tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vector&lt;const DBCALUnifiedHit*&gt;</tt><tt>
        unifiedhits;</tt><tt><br>
      </tt><tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </tt></tt><tt><tt><tt>points</tt>[i]-&gt;Get(</tt></tt><tt><tt><tt><tt>unifiedhits</tt></tt>);</tt><tt><br>
      </tt><br>
    </tt><tt><tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(unsigned int k=0; k&lt;</tt></tt><tt><tt><tt><tt>unifiedhits</tt></tt>.size();
        k++){</tt><tt><br>
      </tt><tt><br>
        &nbsp;</tt></tt><tt><tt><tt><tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vector&lt;const
            DBCALHit*&gt;</tt><tt> hits;</tt><tt><br>
          </tt><tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </tt></tt></tt></tt><tt><tt><tt><tt><tt><tt>unifiedhits</tt></tt></tt></tt><tt><tt>[i]-&gt;Get(hits</tt></tt><tt><tt>);</tt><tt><br>
          </tt></tt>&nbsp;&nbsp; <br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Do something with the DBCALHit objects<br>
      </tt><tt>
      </tt><tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</tt><tt><br>
      </tt>&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>}</tt><tt><br>
    </tt><br>
    This case is a bit more complicated than most since you want to get
    at something that is a few generations back from the DBCALCluster
    objects. This should be pretty quick to run though and will give you
    exactly the hit objects that were ultimately used to make the
    cluster. Let me know if anything is unclear.<br>
    <br>
    Regards,<br>
    -Dave<br>
    <br>
    <div class="moz-cite-prefix">On 7/17/13 9:47 PM, Sean Dobbs wrote:<br>
    </div>
    <blockquote cite="mid:CAEAoKm7p+Pj=w96_u6nc5CGJvBuHJ0rtrxW9OoyDUB4qf9Wzow@mail.gmail.com" type="cite">
      <div dir="ltr">Hi Will,
        <div><br>
        </div>
        <div>I have some first order results you might find interesting,
          and have attached a few plots to illustrate them.</div>
        <div><br>
        </div>
        <div>The file kin_plots.pdf shows some p-theta plots to
          illustrate the kinematics of the reaction that I'm looking at:
          gamma p -&gt; J/psi + p, J/psi -&gt; e+ e-. &nbsp;The proton
          generally goes into the FCAL, while the &nbsp;e-/e+ generally go
          into the BCAL, and have a wide range of momenta. &nbsp;I made a few
          modifications to your code, to pick out the e-/e+ from these
          events, and it seemed to work fine.<br>
        </div>
        <div><br>
        </div>
        <div>The first two plots in bcal_plots.pdf give the
          distributions of ADC energies for all BCAL hits and the most
          energetic hit in a cluster, respectively. &nbsp;The good part is
          that only about 6% of hits have energies &gt; 4096 - the bad
          part is that about 60% clusters have a hit that's higher than
          that, and sometimes much higher!</div>
        <div><br>
        </div>
        <div>By the way, is there any easy way to backtrack from a
          DBCALCluster to a DBCALHit? &nbsp;I ended up matching the
          DBCALPoints and DBCALHits by hand.</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>The last plot shows the distribution of dz v. dphi for the
          e+/e- tracks, similar to what you had been showing for pion
          tracks, and it at least looks like the track/shower matching
          works well for electrons. &nbsp;So, it's looking like we might be
          better off looking at shower shape variables to identify
          electrons, rather than the scalar sum of shower energies. &nbsp;</div>
        <div><br>
        </div>
        <div>Cheers,</div>
        <div>Sean</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Thu, Jun 27, 2013 at 7:16 PM, Will
          Levine &lt;<a href="mailto:wlevine@gmail.com">wlevine@gmail.com</a>&gt;
          wrote:<br>
          <blockquote class="gmail_quote">The BCAL simulation does not
            currently account for the maximum<br>
            amplitude of the ADC. This is something we are aware of and
            I am a<br>
            little bit worried about. In theory, this seems like it
            should be a<br>
            simple thing to fix, but there could be complications (e.g.
            if the ADC<br>
            saturates, then probably we should set an overflow bit to
            indicate<br>
            this, but adding this overflow bit would require a change in
            the data<br>
            model which would be a bigger change),<br>
            <br>
            Something you could do to check how big a problem this will
            be for you<br>
            is look at the DBCALHit objects in your simulated data.
            These<br>
            represent ADC hits and contain what is supposed to be the
            ADC<br>
            amplitude. The ADCs are 12 bits, so we should be worried if
            a lot of<br>
            these values are over 4096.<br>
            <br>
            I've cc'ed David Lawrence in case he has any other thoughts<br>
            <div class="HOEnZb">
              <div class="h5"><br>
                On Thu, Jun 27, 2013 at 5:57 PM, Sean Dobbs &lt;<a href="mailto:s-dobbs@northwestern.edu">s-dobbs@northwestern.edu</a>&gt;
                wrote:<br>
                &gt; Hi Will,<br>
                &gt;<br>
                &gt; Thanks for the info! &nbsp;I do have something of a soft
                spot for calorimeters,<br>
                &gt; but the ones that I've worked with before have all
                been crystal<br>
                &gt; calorimeters, so I'm still learning about this
                BCAL.<br>
                &gt;<br>
                &gt; I don't mind using the latest version of the code,
                so I'll let you know how<br>
                &gt; things work as soon as I can get the trunk to
                compile (or find an earlier<br>
                &gt; one that will work).<br>
                &gt;<br>
                &gt; One additional question - does the new simulation
                include modelling of the<br>
                &gt; maximum amplitudes in the ADCs?<br>
                &gt;<br>
                &gt;<br>
                &gt; Cheers,<br>
                &gt; Sean<br>
                &gt;<br>
                &gt;<br>
                &gt; On Thu, Jun 27, 2013 at 2:13 PM, Will Levine &lt;<a href="mailto:wlevine@gmail.com">wlevine@gmail.com</a>&gt;
                wrote:<br>
                &gt;&gt;<br>
                &gt;&gt; Hi Sean,<br>
                &gt;&gt; Happy to hear that someone else is interested
                in the BCAL. I hope I can<br>
                &gt;&gt; help.<br>
                &gt;&gt;<br>
                &gt;&gt; The new(ish) BCAL reconstruction code is now
                enabled by default on the<br>
                &gt;&gt; trunk. However it didn't make it into the
                latest tagged release<br>
                &gt;&gt; (sim-recon-2013-04-22). If you are wedded to
                using an older version,<br>
                &gt;&gt; let me know and I can tell you how to enable
                the new BCAL code (it's<br>
                &gt;&gt; just a few command line switches), but
                otherwise I would recommend<br>
                &gt;&gt; upgrading to a newer version. One thing to note
                is that the BCAL<br>
                &gt;&gt; simulation changed as well, so if you have done
                any simulation you<br>
                &gt;&gt; will have to redo that.<br>
                &gt;&gt;<br>
                &gt;&gt; I've just checked in my code for doing
                track-shower matching studies,<br>
                &gt;&gt; it's available in<br>
                &gt;&gt;
                sim-recon/src/programs/Analysis/plugins/bcal_matching .
                It's designed<br>
                &gt;&gt; to analyze single-charged-pion events but
                should only need to be<br>
                &gt;&gt; changed minimally for single-electron events.
                Hopefully my code is<br>
                &gt;&gt; clear enough.<br>
                &gt;&gt;<br>
                &gt;&gt; Please let me know if you have any questions or
                complaints or feedback.<br>
                &gt;&gt;<br>
                &gt;&gt; Will<br>
                &gt;&gt;<br>
                &gt;&gt; On Thu, Jun 27, 2013 at 12:00 PM, Sean Dobbs
                &lt;<a href="mailto:s-dobbs@northwestern.edu">s-dobbs@northwestern.edu</a>&gt;<br>
                &gt;&gt; wrote:<br>
                &gt;&gt; &gt; Dear Will,<br>
                &gt;&gt; &gt;<br>
                &gt;&gt; &gt; I'm interested in trying out the new BCAL
                reconstruction software that<br>
                &gt;&gt; &gt; you've been working on, with our analysis
                of gamma p -&gt; J/psi + p, J/psi<br>
                &gt;&gt; &gt; -&gt;<br>
                &gt;&gt; &gt; e+ e-, to see how it works with showers
                high-energy electrons. &nbsp;If it's<br>
                &gt;&gt; &gt; in a<br>
                &gt;&gt; &gt; state that you wouldn't mind sharing, can
                you tell me how to properly<br>
                &gt;&gt; &gt; enable<br>
                &gt;&gt; &gt; it?<br>
                &gt;&gt; &gt;<br>
                &gt;&gt; &gt; Also, would you mind sharing the code that
                you used to make the<br>
                &gt;&gt; &gt; track-shower<br>
                &gt;&gt; &gt; matching plots that you showed in
                yesterday's offline software meeting?<br>
                &gt;&gt; &gt; It's really great to see someone taking a
                look at this issue, and I'd<br>
                &gt;&gt; &gt; like<br>
                &gt;&gt; &gt; to see if I see the same effects in our
                analysis.<br>
                &gt;&gt; &gt;<br>
                &gt;&gt; &gt;<br>
                &gt;&gt; &gt; Thanks,<br>
                &gt;&gt; &gt; Sean<br>
                &gt;&gt; &gt;<br>
                &gt;&gt; &gt;<br>
                &gt;&gt; &gt; --<br>
                &gt;&gt; &gt; Dr. Sean Dobbs<br>
                &gt;&gt; &gt; Department of Physics &amp; Astronomy<br>
                &gt;&gt; &gt; Northwestern University<br>
                &gt;&gt; &gt; phone: 847-467-2826<br>
                &gt;<br>
                &gt;<br>
                &gt;<br>
                &gt;<br>
                &gt; --<br>
                &gt; Dr. Sean Dobbs<br>
                &gt; Department of Physics &amp; Astronomy<br>
                &gt; Northwestern University<br>
                &gt; phone: 847-467-2826<br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        Dr. Sean Dobbs<br>
        Department of Physics &amp; Astronomy <br>
        Northwestern University<br>
        phone: 847-467-2826
      </div>
    </blockquote>
    <br>
  </body>
</html>