Ignore:
Timestamp:
11/04/03 11:32:57 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.cc

    r2236 r2463  
    3232// interface of how to acccess the geometry information.
    3333//
     34//
     35// Version 1:
     36// ----------
     37//  - first implementation
     38//
     39// Version 2:
     40// ----------
     41//  - added fPixRatio
     42//  - added fPixRatioSqrt
     43//
     44//
    3445///////////////////////////////////////////////////////////////////////
    3546#include "MGeomCam.h"
     
    5970//
    6071MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
    61     : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), fPixels(npix)
     72    : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), fPixels(npix), fPixRatio(npix), fPixRatioSqrt(npix)
    6273{
    6374    fName  = name  ? name  : "MGeomCam";
     
    8798// --------------------------------------------------------------------------
    8899//
     100// Calculate and fill the arrays storing the ratio of the area of a pixel
     101// i to the pixel 0 and its square root.
     102// The precalculation is done for speed reasons. Having an event the
     103// ratio would be calculated at least once for each pixel which is
     104// an enormous amount of numerical calculations, which are time
     105// consuming and which can be avoided doing the precalculation.
     106//
     107void MGeomCam::CalcPixRatio()
     108{
     109    const Double_t a0 = (*this)[0].GetA();
     110
     111    for (UInt_t i=0; i<fNumPixels; i++)
     112    {
     113        fPixRatio[i] = a0/(*this)[i].GetA();
     114        fPixRatioSqrt[i] = TMath::Sqrt(fPixRatio[i]);
     115    }
     116}
     117
     118// --------------------------------------------------------------------------
     119//
    89120//  Set the kIsOuterRing flag for all pixels which have a outermost pixel
    90121//  as Next Neighbor and don't have the kIsOutermostRing flag itself.
     
    103134{
    104135    fNumSectors = 0;
     136
     137    for (UInt_t i=0; i<fNumPixels; i++)
     138    {
     139        const UInt_t s = (*this)[i].GetSector();
     140
     141        if (s>fNumSectors)
     142            fNumSectors = s;
     143    }
     144
     145    fNumSectors++;
     146}
     147
     148// --------------------------------------------------------------------------
     149//
     150// Calculate the maximum radius of the camera. This is ment for GUI layout.
     151//
     152void MGeomCam::CalcMaxRadius()
     153{
     154    fMaxRadius = 0;
    105155
    106156    for (UInt_t i=0; i<fNumPixels; i++)
    107157    {
    108158        const MGeomPix &pix = (*this)[i];
    109         const UInt_t s = pix.GetSector();
    110 
    111         if (s>fNumSectors)
    112             fNumSectors = s;
    113     }
    114 
    115     fNumSectors++;
    116 }
    117 
    118 // --------------------------------------------------------------------------
    119 //
    120 // Calculate the maximum radius of the camera. This is ment for GUI layout.
    121 //
    122 void MGeomCam::CalcMaxRadius()
    123 {
    124     fMaxRadius = 0;
    125 
    126     for (UInt_t i=0; i<fNumPixels; i++)
    127     {
    128         const MGeomPix &pix = (*this)[i];
    129159
    130160        const Float_t x = pix.GetX();
     
    147177Float_t MGeomCam::GetPixRatio(UInt_t i) const
    148178{
    149     return i<fNumPixels ? (*this)[0].GetA()/(*this)[i].GetA() : 0;
     179    // Former: (*this)[0].GetA()/(*this)[i].GetA();
     180    // The const_cast is necessary to support older root version
     181    return i<fNumPixels ? const_cast<TArrayF&>(fPixRatio)[i] : 0;
     182}
     183
     184// --------------------------------------------------------------------------
     185//
     186//  returns the square root of the ratio of the area of the pixel with
     187//  index 0 to the pixel with the specified index i. 0 Is returned if
     188//  the index argument is out of range.
     189//
     190Float_t MGeomCam::GetPixRatioSqrt(UInt_t i) const
     191{
     192    // The const_cast is necessary to support older root version
     193    return i<fNumPixels ? const_cast<TArrayF&>(fPixRatioSqrt)[i] : 0;
    150194}
    151195
Note: See TracChangeset for help on using the changeset viewer.