Changeset 9234 for trunk/MagicSoft


Ignore:
Timestamp:
01/21/09 14:26:15 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r9229 r9234  
    2929
    3030#pragma link C++ class MSpline3+;
     31#pragma link C++ class MQuaternion+;
    3132
    3233#pragma link C++ class MString+;
  • trunk/MagicSoft/Mars/mbase/MArrayI.cc

    r5088 r9234  
    3636#include "MArrayI.h"
    3737
     38#include "MMath.h"
     39
    3840ClassImp(MArrayI);
    3941
     42void MArrayI::ReSort(Bool_t down)
     43{
     44    MMath::ReSort(fN, fArray, down);
     45}
  • trunk/MagicSoft/Mars/mbase/MArrayI.h

    r9211 r9234  
    7373        // Add char c at position i. Check for out of bounds.
    7474        fArray[i] = c;
     75    }
     76
     77    void Add(Int_t c)
     78    {
     79        Set(fN+1);
     80        fArray[fN-1] = c;
     81    }
     82
     83    Int_t Find(Int_t c) const
     84    {
     85        for (Int_t *ptr=fArray; ptr<fArray+fN; ptr++)
     86            if (*ptr==c)
     87                return ptr-fArray;
     88
     89        return -1;
     90    }
     91
     92    void AddUniq(Int_t c)
     93    {
     94        if (Find(c)<0)
     95            Add(c);
    7596    }
    7697
     
    157178    }
    158179
     180    void ReSort(Bool_t down=kFALSE);
     181
    159182    ClassDef(MArrayI, 1)  //Array of Int_t
    160183};
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r9226 r9234  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.44 2009-01-17 14:52:37 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.45 2009-01-21 14:22:39 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    347347        *ptr = cpy[*idx++];
    348348
    349     delete cpy;
    350     delete pos;
     349    delete [] cpy;
     350    delete [] pos;
    351351}
    352352
  • trunk/MagicSoft/Mars/mbase/Makefile

    r9229 r9234  
    2424           MMath.cc \
    2525           MSpline3.cc \
     26           MQuaternion.cc \
    2627           MEnv.cc \
    2728           MLog.cc \
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.h

    r8921 r9234  
    1313#ifndef ROOT_TArrayS
    1414#include <TArrayS.h>
     15#endif
     16#ifndef MARS_MQuaternion
     17#include "MQuaternion.h"
    1518#endif
    1619
     
    109112    Int_t GetNeighbor(UInt_t idx, Int_t dir) const;
    110113
     114    virtual Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const { return kFALSE; }
     115    virtual Bool_t HitDetector(const MQuaternion &p) const { return kFALSE; }
     116
    111117    void Print(Option_t *opt=NULL) const;
    112118
  • trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.cc

    r8910 r9234  
    112112// --------------------------------------------------------------------------
    113113//
     114// Check if the photon which is flying along the trajectory u has passed
     115// (or will pass) the frame of the camera (and consequently get
     116// absorbed). The position p and direction u must be in the
     117// telescope coordinate frame, which is z parallel to the focal plane,
     118// x to the right and y upwards, looking from the mirror towards the camera.
     119//
     120// The units are cm.
     121//
     122Bool_t MGeomCamDwarf::HitFrame(MQuaternion p, const MQuaternion &u) const
     123{
     124    // z is defined from the mirror (0) to the camera (z>0).
     125    // Thus we just propagate to the focal plane (z=fDist)
     126    //p -= 1700./u.Z()*u;
     127    p.PropagateZ(u, GetCameraDist()*100); // m->cm
     128
     129    // Add 10% to the max radius and convert from mm to cm
     130    return p.R()<GetMaxRadius()*0.11;//TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
     131}
     132
     133// --------------------------------------------------------------------------
     134//
     135// Check if the position given in the focal plane (so z can be ignored)
     136// is a position which might hit the detector. It is meant to be a rough
     137// and fast estimate not a precise calculation. All positions dicarded
     138// must not hit the detector. All positions accepted might still miss
     139// the detector.
     140//
     141// The units are cm.
     142//
     143Bool_t MGeomCamDwarf::HitDetector(const MQuaternion &v) const
     144{
     145    // Add 10% to the max radius and convert from mm to cm
     146    return v.R()<GetMaxRadius()*0.11;//60.2;
     147}
     148
     149// --------------------------------------------------------------------------
     150//
    114151// Calculate in the direction 0-5 (kind of sector) in the ring-th ring
    115152// the x and y coordinate of the i-th pixel. The unitx are unity,
  • trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.h

    r9219 r9234  
    2828    TObject *Clone(const char *newname) const;
    2929
    30     ClassDef(MGeomCamDwarf, 1)          // Geometry class for the Dwarf camera
     30    Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const;
     31    Bool_t HitDetector(const MQuaternion &p) const;
     32
     33    ClassDef(MGeomCamDwarf, 1) // Geometry class for the Dwarf camera
    3134};
    3235
    3336#endif
    34 
  • trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.cc

    r3392 r9234  
    4949    CreateNN();
    5050    InitGeometry();
     51}
     52
     53// --------------------------------------------------------------------------
     54//
     55// Check if the photon which is flying along the trajectory u has passed
     56// (or will pass) the frame of the camera (and consequently get
     57// absorbed). The position p and direction u must be in the
     58// telescope coordinate frame, which is z parallel to the focal plane,
     59// x to the right and y upwards, looking from the mirror towards the camera.
     60//
     61Bool_t MGeomCamMagic::HitFrame(MQuaternion p, const MQuaternion &u) const
     62{
     63    // z is defined from the mirror (0) to the camera (z>0).
     64    // Thus we just propagate to the focal plane (z=fDist)
     65    //p -= 1700./u.Z()*u;
     66    p.PropagateZ(u, GetCameraDist()*100);
     67
     68    return TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
     69}
     70
     71// --------------------------------------------------------------------------
     72//
     73// Check if the position given in the focal plane (so z can be ignored)
     74// is a position which might hit the detector. It is meant to be a rough
     75// and fast estimate not a precise calculation. All positions dicarded
     76// must not hit the detector. All positions accepted might still miss
     77// the detector.
     78//
     79Bool_t MGeomCamMagic::HitDetector(const MQuaternion &v) const
     80{
     81    return v.R()<60.2;
    5182}
    5283
  • trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.h

    r1458 r9234  
    1515    MGeomCamMagic(const char *name=NULL);
    1616
     17    Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const;
     18    Bool_t HitDetector(const MQuaternion &p) const;
     19
    1720    ClassDef(MGeomCamMagic, 1)          // Geometry class for the Magic camera
    1821};
  • trunk/MagicSoft/Mars/msim/MHPhotonEvent.cc

    r9232 r9234  
    4444//
    4545// Type 3:
    46 //   The maximum in x and y is determined from MCamera->GetMaxR();
     46//   The maximum in x and y is determined from MGeomCam->GetMaxR();
    4747//
    4848// Type 4:
    4949//   As type 3 but divided by 10.
    5050//
    51 // Type 5:
    52 //   The maximum in x and y is determined from MGeomCam->GetMaxR();
    53 //
    54 // Type 6:
    55 //   As type 5 but divided by 10.
    56 //
    5751// The binning is optimized using MH::FindGoodLimits. The number of bins
    58 // in 100 in the default case and 50 for type 3-6.
     52// in 100 in the default case and 50 for type 3-4.
    5953//
    6054// Fill expects a MPhotonEvent (the second argumnet in MFillH).
     
    7872#include "MCorsikaRunHeader.h"
    7973
    80 #include "../msimreflector/MSimReflector.h" // MCamera, MReflector
     74#include "MReflector.h"
    8175
    8276ClassImp(MHPhotonEvent);
     
    198192    case 4:
    199193        {
    200             MCamera *c = (MCamera*)pList->FindObject("MCamera");
    201             if (!c)
    202             {
    203                 *fLog << err << "MCamera not found... aborting." << endl;
    204                 return kFALSE;
    205             }
    206             xmax = fType==3 ? c->GetMaxR() : c->GetMaxR()/10;
    207             num  = 50;
    208 
    209             break;
    210         }
    211     case 5:
    212     case 6:
    213         {
    214194            MGeomCam *c = (MGeomCam*)pList->FindObject("MGeomCam");
    215195            if (!c)
     
    218198                return kFALSE;
    219199            }
    220             xmax = fType==5 ? c->GetMaxRadius() : c->GetMaxRadius()/10;
     200            xmax = fType==3 ? c->GetMaxRadius()/10 : c->GetMaxRadius()/100;
    221201            num  = 50;
    222202
Note: See TracChangeset for help on using the changeset viewer.