Dear HPS Software Group,

We will have our regular HPS Software meeting this Thursday, 9am Pacific, noon East Coast, 6pm Europe.
I realize a number of people will be at the Readiness Review, but I would like to continue the discussion on the ECAL crystal numbering, which is still not clear. 

Agenda:

  1. Crystal Numbers in HPS Java                 -- Gabriel
  2. Questions?                                               -- All

Please let me know if you would like to present something.

Connection details at: https://confluence.slac.stanford.edu/display/hpsg/WebEx+Connection+Details+-+Software

Best,
Maurik

Hi,

I have modified org.hps.recon for it to use the database conditions but there is something not nice in it. If we fix it, I could probably fix a similar problem in org.hps.evio. In org.hps.recon.ecal.EcalTriggerFilterDriver.java, there are the following lines:

1    /**
2     * This method takes input hits and makes new hits with different ix
3     * @param CalorimeterHit hit
4     * @return new HPSCalorimeterHit
5     */
6    private CalorimeterHit filterHit(CalorimeterHit hit) {
7        int ix = hit.getIdentifierFieldValue("ix");
8        int iy = hit.getIdentifierFieldValue("iy");
9        long daqID = EcalConditions.physicalToDaqID(hit.getCellID());
10       int crate = EcalConditions.getCrate(daqID);
11       short slot = EcalConditions.getSlot(daqID);
12       short channel = EcalConditions.getChannel(daqID);
13
14       int delay = iy>0?topDelay:bottomDelay;
15       // no triggers from crate 1, slot 3
16       if (crate == 1 && slot == 3) {
17           return null;
18       }
19
20       // flip quadrant
21       if (ix > 0 && iy > 0) {
22           ix = 24 - ix;
23       }
24       long newID = EcalConditions.makePhysicalID(ix, iy);
25       //make new hit; set position to null so it gets recalculated
26       return new HPSCalorimeterHit(hit.getRawEnergy(), hit.getTime()+delay*4, newID, hit.getType());
27    }


To update this code (line 24 uses txt conditions) to the database conditions, I had to create a function in ECalUtils that is respecting the crystal numbering of hps-java:
  /** FIXME hard coded id encoding: need to use the id stuff
    * Return the identity of a channel based on x and y coordinates of the crystal/channel, cellID is needed to create the IIdentifier
    * The cellID should be 24 bits of the form
    * [6 signed bits iy][8 signed bits ix][2 unsigned bits layer][6 unsigned bits system]
    * where system is always 13 and layer is always 0.
    * @param cellID (long), ix position (int), iy position (int)
    * @return ID of the channel/crystal (long)
    */
   public static long makeID(int ix, int iy){

      String binX;
      if(0<ix){
       binX = Integer.toBinaryString(ix);
          while(binX.length()<8){
           binX="0".concat(binX);
          }
      }
      else{
       binX = Integer.toBinaryString(256+ix);
          while(binX.length()<8){
           binX="0".concat(binX);
          }
      }

      String binY;
      if(0<iy){
       binY = Integer.toBinaryString(iy);
          while(binY.length()<6){
           binY="0".concat(binY);
          }
      }
      else{
       binY = Integer.toBinaryString(64+iy);
          while(binY.length()<6){
           binY="0".concat(binY);
          }
      }

      String binC = Integer.toBinaryString(13);
      while(binC.length()<8){
       binC="0".concat(binC);
      }

      String strBinNumber = binY.concat(binX).concat(binC);

      long newID = Integer.parseInt ( strBinNumber , 2);

      return newID;
   }

It is not my ability to write a proper code to access the right number that is somewhere in the new database conditions. So, Jeremy, could you please find a way to access this number, either from ECalUtils which would allow me to reuse it in other parts of the code, either directly from ECalTriggerFilterDriver? I'm ready to test it, but I can not make it.


Regards,
-- 
Gabriel CHARLES
Institut de Physique Nucléaire d'Orsay


Use REPLY-ALL to reply to list

To unsubscribe from the HPS-SOFTWARE list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=HPS-SOFTWARE&A=1