Changeset 9863 for trunk


Ignore:
Timestamp:
08/16/10 09:04:57 (14 years ago)
Author:
tbretz
Message:
Moved MGeomCamDwarf::CalcXY to MGeomPix::CalcXY. Removed some obsolete includes.
Location:
trunk/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/Changelog

    r9862 r9863  
    2626   * mgeom/MGeomCamFACT.[h,cc]:
    2727     - added
     28
     29   * mgeom/MGeomCamDwarf.[h,cc], mgeom/MGeomPix.[h,cc]:
     30     - moved CalcXY to MGeomPix
     31     - removed obsolete includes
     32
     33   * mgeom/MGeomCamFact.cc:
     34     - removed obsolete includes
    2835
    2936
  • trunk/Mars/mgeom/MGeomCamDwarf.cc

    r9462 r9863  
    4343#include "MGeomCamDwarf.h"
    4444
    45 #include <iostream>
    46 
    4745#include <TMath.h>
    48 #include <TArrayI.h>
    4946
    5047#include "MGeomPix.h"
     
    116113//
    117114// Calculate in the direction 0-5 (kind of sector) in the ring-th ring
    118 // the x and y coordinate of the i-th pixel. The unitx are unity,
    119 // distance to (0,0) is retruned.
    120 //
    121 Double_t MGeomCamDwarf::CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y)
    122 {
    123     const Double_t kSqrt32 = MGeomPix::gsSin60;
    124 
    125     switch (dir)
    126     {
    127     case kDirCenter: // Center
    128         x = 0;
    129         y = 0;
    130         break;
    131 
    132     case kDirNE: // Direction North East
    133         x = ring-i*0.5;
    134         y = i*kSqrt32;
    135         break;
    136 
    137     case kDirN: // Direction North
    138         x = ring*0.5-i;
    139         y = ring*kSqrt32;
    140         break;
    141 
    142     case kDirNW: // Direction North West
    143         x = -(ring+i)*0.5;
    144         y = (ring-i)*kSqrt32;
    145         break;
    146 
    147     case kDirSW: // Direction South West
    148          x = 0.5*i-ring;
    149          y = -i*kSqrt32;
    150          break;
    151 
    152     case kDirS: // Direction South
    153          x = i-ring*0.5;
    154          y = -ring*kSqrt32;
    155          break;
    156 
    157     case kDirSE: // Direction South East
    158         x = (ring+i)*0.5;
    159         y = (-ring+i)*kSqrt32;
    160         break;
    161     }
    162     return TMath::Hypot(x, y);
    163 }
    164 
    165 // --------------------------------------------------------------------------
    166 //
    167 // Calculate in the direction 0-5 (kind of sector) in the ring-th ring
    168115// the x and y coordinate of the i-th pixel. The units are unity,
    169116// distance to (0,0) is retruned.
     
    193140Int_t MGeomCamDwarf::CalcNumPix(Double_t rad)
    194141{
     142    const Double_t r2 = rad*rad;
     143
    195144    //
    196145    //  add the first pixel to the list
     
    206155        // starting number to the ending number
    207156        //
    208         for (Int_t dir=kDirNE; dir<=kDirSE; dir++)
     157        for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++)
    209158        {
    210159            for (int i=0; i<ring; i++)
    211160            {
    212161                Double_t x, y;
    213                 if (CalcXY(dir, ring, i, x, y)<rad)
     162                if (MGeomPix::CalcXY(dir, ring, i, x, y)<r2)
    214163                    n++;
    215164            }
     
    244193    for (int ring=1; ring<=rings; ring++)
    245194    {
    246         for (Int_t dir=kDirNE; dir<=kDirSE; dir++)
     195        for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++)
    247196        {
    248197            for (int i=0; i<ring; i++)
    249198            {
    250199                Double_t x, y;
    251                 CalcXY(dir, ring, i, x, y);
     200                MGeomPix::CalcXY(dir, ring, i, x, y);
    252201                SetAt(cnt++, MGeomPix(x*diameter, y*diameter, diameter));
    253202            }
     
    264213    //    units for diameter are mm
    265214
     215    const Double_t r2 = rad*rad;
     216
    266217    //
    267218    //  add the first pixel to the list
     
    276227        Int_t n = 0;
    277228
    278         for (Int_t dir=kDirNE; dir<=kDirSE; dir++)
     229        for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++)
    279230        {
    280231            for (int i=0; i<ring; i++)
    281232            {
    282233                Double_t x, y;
    283                 if (CalcXY(dir, ring, i, x, y)<rad)
     234                if (MGeomPix::CalcXY(dir, ring, i, x, y)<r2)
    284235                    SetAt(cnt+n++, MGeomPix(x*diameter, y*diameter, diameter));
    285236            }
  • trunk/Mars/mgeom/MGeomCamDwarf.h

    r9385 r9863  
    99{
    1010private:
    11     enum { kDirCenter, kDirNE, kDirN, kDirNW, kDirSW, kDirS, kDirSE };
     11    static Int_t CalcNumPix(Double_t rad);
     12    static Int_t CalcNumPix(Int_t rings);
    1213
    13     static Double_t CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y);
    14 
    15     static Int_t    CalcNumPix(Double_t rad);
    16     static Int_t    CalcNumPix(Int_t rings);
    17 
    18     void  CreateCam(Double_t diameter, Double_t rad);
    19     void  CreateCam(Double_t diameter, Int_t rings);
     14    void CreateCam(Double_t diameter, Double_t rad);
     15    void CreateCam(Double_t diameter, Int_t rings);
    2016
    2117public:
  • trunk/Mars/mgeom/MGeomCamFact.cc

    r9464 r9863  
    3939#include "MGeomCamFact.h"
    4040
    41 #include <iostream>
    4241
    4342#include <TMath.h>
    44 #include <TArrayI.h>
    4543
    4644#include "MGeomCamDwarf.h"
  • trunk/Mars/mgeom/MGeomPix.cc

    r9385 r9863  
    209209}
    210210
     211// --------------------------------------------------------------------------
     212//
     213// Calculate in the direction 0-5 (kind of sector) in the ring-th ring
     214// the x and y coordinate of the i-th pixel. The unitx are unity,
     215// distance to (0,0) is retruned.
     216//
     217Double_t MGeomPix::CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y)
     218{
     219    switch (dir)
     220    {
     221    case kDirCenter: // Center
     222        x = 0;
     223        y = 0;
     224        break;
     225
     226    case kDirNE: // Direction North East
     227        x = ring-i*0.5;
     228        y = i*gsSin60;
     229        break;
     230
     231    case kDirN: // Direction North
     232        x = ring*0.5-i;
     233        y = ring*gsSin60;
     234        break;
     235
     236    case kDirNW: // Direction North West
     237        x = -(ring+i)*0.5;
     238        y = (ring-i)*gsSin60;
     239        break;
     240
     241    case kDirSW: // Direction South West
     242         x = 0.5*i-ring;
     243         y = -i*gsSin60;
     244         break;
     245
     246    case kDirS: // Direction South
     247         x = i-ring*0.5;
     248         y = -ring*gsSin60;
     249         break;
     250
     251    case kDirSE: // Direction South East
     252        x = (ring+i)*0.5;
     253        y = (-ring+i)*gsSin60;
     254        break;
     255    }
     256    return x*x + y*y;
     257}
     258
    211259// ==============================================================================
    212260/*
Note: See TracChangeset for help on using the changeset viewer.