Re: BRAT-2-0-15

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Fri Jul 27 2001 - 06:48:41 EDT

  • Next message: Christian Holm Christensen: "Re: BRAT-2-0-15"

    Hi Peter, 
    
    On Fri, 27 Jul 2001 12:22:02 +0200 (CEST)
    "Peter H. L. Christiansen" <pchristi@nbi.dk> wrote
    concerning ": BRAT-2-0-15":
    > Hi
    > 
    > I added a new class BrDetectorParamsChk 
                          ^^^^^^^^^^^^^^^^^^^
    		      |||||||||||||||||||
    
    Argh!!! Could you please rename that to BrChkParameters AT ONCE -
    thanks. 
    
    > The class should be straightforward to use for C1, just use backplane
    > projection, but for RICH someone will have to write a class to get from
    > the spherical mirror to the detector plane.
    > 
    > I imagine that the class could be used like this :
    > 
    > .....
    > BrVector3D projHit;
    > const Int_t tube = c1Mgr->GetClosestTube(projHit);
    > Float_t adcSum = c1Rdo->GetAdc(tube);
    > Int_t nTubes = 1;
    > for(Int_t i=-1;i<=1;i++) {
    >   for(Int_t j =-1; j<=1;j++) {
    >     if(i==0 && j==0)
    >       continue;
    >     const Int_t neighborTube = c1Mgr->GetTubeWithDirection(tube, i, j);
    >     if(neighborTube==-1)
    >       continue;
    >     adcSum += c1Rdo->GetAdc(neighborTube);
    >     nTubes++;
    >   }
    > }
    > const Float_t adcAvg = adcSum/nTubes;
    > if(adcAvg>cut)
    >    pion
    > ....
    
    Argh! Obfuscated code.  You mean: 
    
      BrVector3D  projHit;
      const Int_t tube     = c1Mgr->GetClosestTube(projHit);
      Float_t     adcSum   = c1Rdo->GetAdc(tube);
      Int_t       nTubes   = 1;
    
      // MSVC and KCC need this here.  Poor sods, they should implment the
      // ANSI/ISO behaviour for loop variables.  Alas, they don't - stupid
      // @#%!$ 
      Int_t i, j; 
    
      for(i = -1; i < = 1; i += 2) {
        for(j =-1; j <= 1; j += 2) {
          const Int_t neighborTube = 
            c1Mgr->GetTubeWithDirection(tube, i, j);
    
          if(neighborTube == -1)
            continue;
         
          adcSum += c1Rdo->GetAdc(neighborTube);
          nTubes++;
        }
      }
     
      Float_t adcAvg = 0;
    
      // Do not divide by zero!
      if (nTubes != 0) 
        adcAvg = adcSum/nTubes;
        
      // Check the threshold 
      if(adcAvg>cut)
        pion
    
    
    Yours, 
    
    Christian  -----------------------------------------------------------
    Holm Christensen                             Phone:  (+45) 35 35 96 91 
      Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
      DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
      Denmark                                    Email:       cholm@nbi.dk
    



    This archive was generated by hypermail 2b30 : Fri Jul 27 2001 - 06:48:56 EDT