Changeset 9340 for trunk


Ignore:
Timestamp:
02/15/09 15:41:15 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mimage
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mimage/MHHillas.cc

    r9271 r9340  
    6161//
    6262MHHillas::MHHillas(const char *name, const char *title)
    63     : fGeomCam(0), fMm2Deg(1), fUseMmScale(kTRUE)
     63    : fGeomCam(0)
    6464{
    6565    //
     
    8181    fDelta->SetDirectory(NULL);
    8282
    83     fLength->SetXTitle("Length [mm]");
    84     fWidth->SetXTitle("Width [mm]");
    85     fDistC->SetXTitle("Distance [mm]");
     83    fLength->SetXTitle("Length [\\circ]");
     84    fWidth->SetXTitle("Width [\\circ]");
     85    fDistC->SetXTitle("Distance [\\circ]");
    8686    fDelta->SetXTitle("Delta [\\circ]");
    8787
     
    146146    fGeomCam = (MGeomCam*)plist->FindObject("MGeomCam");
    147147    if (!fGeomCam)
    148         *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
    149     else
    150     {
    151         fMm2Deg = fGeomCam->GetConvMm2Deg();
    152         SetMmScale(kFALSE);
    153     }
     148    {
     149        *fLog << err << "MGeomCam not found... abort." << endl;
     150        return kFALSE;
     151    }
     152
    154153
    155154    ApplyBinning(*plist, "Width",  fWidth);
     
    162161    if (!bins)
    163162    {
    164         float r = fGeomCam ? fGeomCam->GetMaxRadius() : 600;
    165         if (!fUseMmScale)
    166             r *= fMm2Deg;
     163        const Float_t r = fGeomCam->GetMaxRadius()*fGeomCam->GetConvMm2Deg();
    167164
    168165        MBinning b;
     
    179176// --------------------------------------------------------------------------
    180177//
    181 // Use this function to setup your own conversion factor between degrees
    182 // and millimeters. The conversion factor should be the one calculated in
    183 // MGeomCam. Use this function with Caution: You could create wrong values
    184 // by setting up your own scale factor.
    185 //
    186 void MHHillas::SetMm2Deg(Float_t mmdeg)
    187 {
    188     if (mmdeg<0)
    189     {
    190         *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
    191         return;
    192     }
    193 
    194     if (fMm2Deg>=0)
    195         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    196 
    197     fMm2Deg = mmdeg;
    198 }
    199 
    200 // --------------------------------------------------------------------------
    201 //
    202 // With this function you can convert the histogram ('on the fly') between
    203 // degrees and millimeters.
    204 //
    205 void MHHillas::SetMmScale(Bool_t mmscale)
    206 {
    207     if (fUseMmScale == mmscale)
    208         return;
    209 
    210     if (fMm2Deg<0)
    211     {
    212         *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;
    213         return;
    214     }
    215 
    216     const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    217     MH::ScaleAxis(fLength, scale);
    218     MH::ScaleAxis(fWidth,  scale);
    219     MH::ScaleAxis(fDistC,  scale);
    220     MH::ScaleAxis(fCenter, scale, scale);
    221 
    222     if (mmscale)
    223     {
    224         fLength->SetXTitle("Length [mm]");
    225         fWidth->SetXTitle("Width [mm]");
    226         fDistC->SetXTitle("Distance [mm]");
    227         fCenter->SetXTitle("x [mm]");
    228         fCenter->SetYTitle("y [mm]");
    229     }
    230     else
    231     {
    232         fLength->SetXTitle("Length [\\circ]");
    233         fWidth->SetXTitle("Width [\\circ]");
    234         fDistC->SetXTitle("Distance [\\circ]");
    235         fCenter->SetXTitle("x [\\circ]");
    236         fCenter->SetYTitle("y [\\circ]");
    237     }
    238 
    239     fUseMmScale = mmscale;
    240 }
    241 
    242 // --------------------------------------------------------------------------
    243 //
    244178// Fill the histograms with data from a MHillas-Container.
    245179// Be careful: Only call this with an object of type MHillas
     
    255189    const MHillas &h = *(MHillas*)par;
    256190
    257     const Double_t d = sqrt(h.GetMeanX()*h.GetMeanX() + h.GetMeanY()*h.GetMeanY());
    258     const Double_t scale = fUseMmScale ? 1 : fMm2Deg;
     191    const Double_t scale = fGeomCam->GetConvMm2Deg();
    259192
    260193    fLength->Fill(scale*h.GetLength(), w);
    261194    fWidth ->Fill(scale*h.GetWidth(), w);
    262     fDistC ->Fill(scale*d, w);
     195    fDistC ->Fill(scale*h.GetDist0(), w);
    263196    fCenter->Fill(scale*h.GetMeanX(), scale*h.GetMeanY(), w);
    264197    fDelta ->Fill(kRad2Deg*h.GetDelta(), w);
  • trunk/MagicSoft/Mars/mimage/MHHillas.h

    r9153 r9340  
    1414{
    1515private:
     16    MGeomCam *fGeomCam; //! Camera geometry for plots (for the moment this is a feature for a loop only!)
    1617
    1718    TH1F *fLength;  //-> Length
     
    2425    TH2F *fCenter;  //-> Center
    2526
    26     MGeomCam *fGeomCam; //! Camera geometry for plots (for the moment this is a feature for a loop only!)
    27 
    28     Float_t fMm2Deg;
    29     Bool_t  fUseMmScale;
    30 
    3127    void Paint(Option_t *opt="");
    3228
     
    3430    MHHillas(const char *name=NULL, const char *title=NULL);
    3531    ~MHHillas();
    36 
    37     void SetMmScale(Bool_t mmscale=kTRUE);
    38     virtual void SetMm2Deg(Float_t mmdeg);
    3932
    4033    Bool_t SetupFill(const MParList *pList);
  • trunk/MagicSoft/Mars/mimage/MHHillasExt.cc

    r9153 r9340  
    6565//
    6666MHHillasExt::MHHillasExt(const char *name, const char *title)
    67     : fHillas(0), fHillasExt(0), fMm2Deg(1),
    68     fUseMmScale(kTRUE), fHilName("MHillasExt")
     67    : fGeom(0), fHillas(0), fHillasExt(0), fHilName("MHillasExt")
    6968{
    7069    //
     
    9493    fHSlopeL.SetTitle("Longitudinal time-slope vs. Dist");
    9594
    96     fHAsym.SetXTitle("Asym [mm]");
    97     fHM3Long.SetXTitle("3^{rd} M_{l} [mm]");
    98     fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]");
    99     fHSlopeL.SetXTitle("D [mm]");
     95    fHAsym.SetXTitle("Asym [\\circ]");
     96    fHM3Long.SetXTitle("3^{rd} M_{l} [\\circ]");
     97    fHM3Trans.SetXTitle("3^{rd} M_{t} [\\circ]");
     98    fHSlopeL.SetXTitle("D [\\circ]");
    10099
    101100    fHAsym.SetYTitle("Counts");
    102101    fHM3Long.SetYTitle("Counts");
    103102    fHM3Trans.SetYTitle("Counts");
    104     fHSlopeL.SetYTitle("S_{l} [ns/mm]");
     103    fHSlopeL.SetYTitle("S_{l} [ns/\\circ]");
    105104
    106105    fHAsym.SetFillStyle(4000);
     
    156155    }
    157156
    158     const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    159     if (!geom)
    160         *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
    161     else
    162     {
    163         fMm2Deg = geom->GetConvMm2Deg();
    164         SetMmScale(kFALSE);
     157    fGeom = (MGeomCam*)plist->FindObject("MGeomCam");
     158    if (!fGeom)
     159    {
     160        *fLog << err << "MGeomCam not found... abort." << endl;
     161        return kFALSE;
    165162    }
    166163
     
    182179    const MHillasSrc *src = (MHillasSrc*)par;
    183180
    184     const Double_t scale = TMath::Sign(fUseMmScale?1:fMm2Deg, (src ? src->GetCosDeltaAlpha() : 1));
     181    const Double_t scale = TMath::Sign(fGeom->GetConvMm2Deg(), (src ? src->GetCosDeltaAlpha() : 1));
    185182    const Double_t dist  = src ? src->GetDist() : fHillas->GetDist0();
    186183
     
    191188
    192189    return kTRUE;
    193 }
    194 
    195 // --------------------------------------------------------------------------
    196 //
    197 // With this function you can convert the histogram ('on the fly') between
    198 // degrees and millimeters.
    199 //
    200 void MHHillasExt::SetMmScale(Bool_t mmscale)
    201 {
    202     if (fUseMmScale == mmscale)
    203         return;
    204 
    205     if (fMm2Deg<0)
    206     {
    207         *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;
    208         return;
    209     }
    210 
    211     const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    212     MH::ScaleAxis(&fHAsym,    scale);
    213     MH::ScaleAxis(&fHM3Long,  scale);
    214     MH::ScaleAxis(&fHM3Trans, scale);
    215     MH::ScaleAxis(&fHSlopeL,  scale, 1./scale);
    216 
    217     if (mmscale)
    218     {
    219         fHAsym.SetXTitle("Asym [mm]");
    220         fHM3Long.SetXTitle("3^{rd} M_{l} [mm]");
    221         fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]");
    222         fHSlopeL.SetXTitle("D [mm]");
    223         fHSlopeL.SetYTitle("S_{l} [ns/mm]");
    224     }
    225     else
    226     {
    227         fHAsym.SetXTitle("Asym [\\circ]");
    228         fHM3Long.SetXTitle("3^{rd} M_{l} [\\circ]");
    229         fHM3Trans.SetXTitle("3^{rd} M_{t} [\\circ]");
    230         fHSlopeL.SetXTitle("D [\\circ]");
    231         fHSlopeL.SetYTitle("S_{l} [ns/\\circ]");
    232     }
    233 
    234     fUseMmScale = mmscale;
    235 }
    236 
    237 // --------------------------------------------------------------------------
    238 //
    239 // Use this function to setup your own conversion factor between degrees
    240 // and millimeters. The conversion factor should be the one calculated in
    241 // MGeomCam. Use this function with Caution: You could create wrong values
    242 // by setting up your own scale factor.
    243 //
    244 void MHHillasExt::SetMm2Deg(Float_t mmdeg)
    245 {
    246     if (mmdeg<0)
    247     {
    248         *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
    249         return;
    250     }
    251 
    252     if (fMm2Deg>=0)
    253         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    254 
    255     fMm2Deg = mmdeg;
    256190}
    257191
  • trunk/MagicSoft/Mars/mimage/MHHillasExt.h

    r9153 r9340  
    99#endif
    1010
     11class MGeomCam;
    1112class MHillas;
    1213class MHillasExt;
     
    1516{
    1617private:
     18    MGeomCam   *fGeom;      //! conversion mm to deg
    1719    MHillas    *fHillas;    //! Pointer to the MHillas container
    1820    MHillasExt *fHillasExt; //! Pointer to the MHillasExt container
     
    2325    TH2F fHSlopeL;  //
    2426
    25     Float_t fMm2Deg;
    26     Bool_t  fUseMmScale;
    27 
    2827    TString fHilName;
    2928
     
    3231
    3332    void SetHillasName(const char *name) { fHilName = name; }
    34 
    35     void SetMmScale(Bool_t mmscale=kTRUE);
    36     virtual void SetMm2Deg(Float_t mmdeg);
    3733
    3834    Bool_t SetupFill(const MParList *pList);
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc

    r9153 r9340  
    5656//
    5757MHHillasSrc::MHHillasSrc(const char *name, const char *title)
    58     : fUseMmScale(kTRUE)
     58    : fGeom(0)
    5959{
    6060    //
     
    8282
    8383    fAlpha->SetXTitle("\\alpha [\\circ]");
    84     fDist->SetXTitle("Dist [mm]");
     84    fDist->SetXTitle("Dist [\\circ]");
    8585    fCosDA->SetXTitle("cos(\\delta,\\alpha)");
    8686    fDCA->SetXTitle("DCA [\\circ]");
     
    123123Bool_t MHHillasSrc::SetupFill(const MParList *plist)
    124124{
    125     const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    126     if (!geom)
    127         *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
    128     else
     125    fGeom = (MGeomCam*)plist->FindObject("MGeomCam");
     126    if (!fGeom)
    129127    {
    130         fMm2Deg = geom->GetConvMm2Deg();
    131         SetMmScale(kFALSE);
     128        *fLog << err << "MGeomCam not found... abort." << endl;
     129        return kFALSE;
    132130    }
    133131
     
    155153    const MHillasSrc &h = *(MHillasSrc*)par;
    156154
     155    const Double_t scale = fGeom->GetConvMm2Deg();
     156
    157157    fAlpha->Fill(h.GetAlpha(), w);
    158     fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist(), w);
     158    fDist ->Fill(h.GetDist()*scale, w);
    159159    fCosDA->Fill(h.GetCosDeltaAlpha(), w);
    160     fDCA  ->Fill(fUseMmScale ? h.GetDCA() : fMm2Deg*h.GetDCA(), w);
     160    fDCA  ->Fill(h.GetDCA()*scale, w);
    161161    fDCADelta->Fill(h.GetDCADelta(), w);
    162162
    163163    return kTRUE;
    164 }
    165 
    166 // --------------------------------------------------------------------------
    167 //
    168 // Use this function to setup your own conversion factor between degrees
    169 // and millimeters. The conversion factor should be the one calculated in
    170 // MGeomCam. Use this function with Caution: You could create wrong values
    171 // by setting up your own scale factor.
    172 //
    173 void MHHillasSrc::SetMm2Deg(Float_t mmdeg)
    174 {
    175     if (mmdeg<=0)
    176     {
    177         *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;
    178         return;
    179     }
    180 
    181     if (fMm2Deg>0)
    182         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    183 
    184     fMm2Deg = mmdeg;
    185 }
    186 
    187 // --------------------------------------------------------------------------
    188 //
    189 // With this function you can convert the histogram ('on the fly') between
    190 // degrees and millimeters.
    191 //
    192 void MHHillasSrc::SetMmScale(Bool_t mmscale)
    193 {
    194     if (fUseMmScale == mmscale)
    195         return;
    196 
    197     if (fMm2Deg<0)
    198     {
    199         *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;
    200         return;
    201     }
    202 
    203     const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    204     MH::ScaleAxis(fDist, scale);
    205     MH::ScaleAxis(fDCA,  scale);
    206 
    207     fDist->SetXTitle(mmscale ? "Dist [mm]" : "Dist [\\circ]");
    208     fDCA ->SetXTitle(mmscale ? "DCA [mm]"  : "DCA [\\circ]");
    209 
    210     fUseMmScale = mmscale;
    211164}
    212165
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.h

    r9153 r9340  
    77
    88class TH1F;
     9class MGeomCam;
    910class MHillas;
    1011
     
    1213{
    1314private:
     15    MGeomCam *fGeom;  //! conversion mm to deg
     16
    1417    TH1F *fAlpha;     //->
    1518    TH1F *fDist;      //->
     
    1922    TH1F *fDCADelta;  //->
    2023
    21     Float_t fMm2Deg;
    22     Bool_t  fUseMmScale;
    23 
    2424public:
    2525    MHHillasSrc(const char *name=NULL, const char *title=NULL);
    2626    ~MHHillasSrc();
    27 
    28     void SetMmScale(Bool_t mmscale=kTRUE);
    29     void SetMm2Deg(Float_t mmdeg);
    3027
    3128    Bool_t SetupFill(const MParList *pList);
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc

    r9153 r9340  
    6262//
    6363MHNewImagePar::MHNewImagePar(const char *name, const char *title)
    64     : fMm2Deg(1), fUseMmScale(kTRUE)
     64    : fGeom(0)
    6565{
    6666    fName  = name  ? name  : "MHNewImagePar";
     
    104104    fHistUsedArea.SetName("UsedArea");
    105105    fHistUsedArea.SetTitle("Area of used pixels");
    106     fHistUsedArea.SetXTitle("Area [m^2]");
     106    fHistUsedArea.SetXTitle("Area [\\circ^{2}]");
    107107    fHistUsedArea.SetYTitle("Counts");
    108108    fHistUsedArea.SetDirectory(NULL);
     
    113113    fHistCoreArea.SetName("CoreArea");
    114114    fHistCoreArea.SetTitle("Area of core pixels");
    115     fHistCoreArea.SetXTitle("Area [m^2]");
     115    fHistCoreArea.SetXTitle("Area [\\circ^{2}]");
    116116    fHistCoreArea.SetYTitle("Counts");
    117117    fHistCoreArea.SetDirectory(NULL);
     
    165165    bins.Apply(fHistCorePix);
    166166
    167     //bins.SetEdges(75, 0, 0.249);
    168     //bins.Apply(fHistUsedArea);
    169     //bins.Apply(fHistCoreArea);
     167    MBinning b;
     168    b.SetEdges(50, 0, 1.5);
     169    b.Apply(fHistUsedArea);
     170    b.Apply(fHistCoreArea);
    170171}
    171172
     
    177178Bool_t MHNewImagePar::SetupFill(const MParList *plist)
    178179{
    179     MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    180     if (!geom)
    181         *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
    182     else
     180    fGeom = (MGeomCam*)plist->FindObject("MGeomCam");
     181    if (!fGeom)
    183182    {
    184         fMm2Deg = geom->GetConvMm2Deg();
    185         SetMmScale(kFALSE);
     183        *fLog << err << "MGeomCam not found... abort." << endl;
     184        return kFALSE;
    186185    }
    187186
    188187    const MBinning *bins = (MBinning*)plist->FindObject("BinningArea");
    189     if (!bins)
    190     {
    191         float r = geom ? 1.5 : 0.133;
    192 
    193         MBinning b;
    194         b.SetEdges(50, 0, r);
    195         b.Apply(fHistUsedArea);
    196         b.Apply(fHistCoreArea);
    197     }
    198     else
     188    if (bins)
    199189    {
    200190        bins->Apply(fHistUsedArea);
     
    232222    }
    233223
    234     const Double_t scale = fUseMmScale ? 1e-6 : fMm2Deg*fMm2Deg;
     224    const Double_t scale = fGeom->GetConvMm2Deg()*fGeom->GetConvMm2Deg();
    235225
    236226    const MNewImagePar &h = *(MNewImagePar*)par;
     
    251241
    252242    return kTRUE;
    253 }
    254 
    255 // --------------------------------------------------------------------------
    256 //
    257 // With this function you can convert the histogram ('on the fly') between
    258 // degrees and millimeters.
    259 //
    260 void MHNewImagePar::SetMmScale(Bool_t mmscale)
    261 {
    262     if (fUseMmScale == mmscale)
    263         return;
    264 
    265     if (fMm2Deg<0)
    266     {
    267         *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;
    268         return;
    269     }
    270 
    271     const Double_t scale = mmscale ? 1./(fMm2Deg*fMm2Deg) : (fMm2Deg*fMm2Deg);
    272     MH::ScaleAxis(&fHistUsedArea,  scale);
    273     MH::ScaleAxis(&fHistCoreArea,  scale);
    274 
    275     if (mmscale)
    276     {
    277         fHistUsedArea.SetXTitle("A [m^{2}]");
    278         fHistCoreArea.SetXTitle("A [m^{2}]");
    279     }
    280     else
    281     {
    282         fHistUsedArea.SetXTitle("A [deg^{2}]");
    283         fHistCoreArea.SetXTitle("A [deg^{2}]");
    284     }
    285 
    286     fUseMmScale = mmscale;
    287 }
    288 
    289 // --------------------------------------------------------------------------
    290 //
    291 // Use this function to setup your own conversion factor between degrees
    292 // and millimeters. The conversion factor should be the one calculated in
    293 // MGeomCam. Use this function with Caution: You could create wrong values
    294 // by setting up your own scale factor.
    295 //
    296 void MHNewImagePar::SetMm2Deg(Float_t mmdeg)
    297 {
    298     if (mmdeg<0)
    299     {
    300         *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
    301         return;
    302     }
    303 
    304     if (fMm2Deg>=0)
    305         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    306 
    307     fMm2Deg = mmdeg;
    308243}
    309244
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.h

    r9153 r9340  
    99#endif
    1010
     11class MGeomCam;
    1112class MHillas;
    1213
     
    1415{
    1516private:
     17    MGeomCam *fGeom;     //! Conversion from mm to deg
     18
    1619    TH1F fHistLeakage1;  //
    1720    TH1F fHistLeakage2;  //
     
    2730    TH1F fHistConcCOG;   // [ratio] concentration of the three pixels next to COG
    2831    TH1F fHistConcCore;  // [ratio] concentration of signals inside or touching the ellipse
    29 
    30     Float_t fMm2Deg;
    31     Bool_t  fUseMmScale;
    3232
    3333public:
     
    5858    TH1F &GetHistConcCore()  { return fHistConcCore; }
    5959
    60     void SetMmScale(Bool_t mmscale=kTRUE);
    61     virtual void SetMm2Deg(Float_t mmdeg);
    62 
    6360    void Draw(Option_t *opt="");
    6461    void Paint(Option_t *opt="");
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar2.cc

    r9153 r9340  
    5555//
    5656MHNewImagePar2::MHNewImagePar2(const char *name, const char *title)
    57     : fMm2Deg(1), fUseMmScale(kTRUE)
     57    : fGeom(0)
    5858{
    5959    fName  = name  ? name  : "MHNewImagePar2";
     
    6262    fHistBorder1.SetName("Border1");
    6363    fHistBorder1.SetTitle("Border Line of border pixels (pixel border)");
    64     fHistBorder1.SetXTitle("Border");
     64    fHistBorder1.SetXTitle("Border [\\circ]]");
    6565    fHistBorder1.SetYTitle("Counts");
    6666    fHistBorder1.SetDirectory(NULL);
     
    7070    fHistBorder2.SetName("Border2");
    7171    fHistBorder2.SetTitle("Border Line of border pixels (pixel center)");
    72     fHistBorder2.SetXTitle("Border");
     72    fHistBorder2.SetXTitle("Border [\\circ]]");
    7373    fHistBorder2.SetYTitle("Counts");
    7474    fHistBorder2.SetDirectory(NULL);
     
    8585Bool_t MHNewImagePar2::SetupFill(const MParList *plist)
    8686{
    87     MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    88     if (!geom)
    89         *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
    90     else
     87    fGeom = (MGeomCam*)plist->FindObject("MGeomCam");
     88    if (!fGeom)
    9189    {
    92         fMm2Deg = geom->GetConvMm2Deg();
    93         SetMmScale(kFALSE);
     90        *fLog << err << "MGeomCam not found... abort." << endl;
     91        return kFALSE;
    9492    }
    9593
     
    9795    if (!bins)
    9896    {
    99         const float r = geom ? 10 : 2967;
    100 
    10197        MBinning b;
    102         b.SetEdges(87, 0, r);
     98        b.SetEdges(87, 0, 10);
    10399        b.Apply(fHistBorder1);
    104100        b.Apply(fHistBorder2);
     
    127123    }
    128124
    129     const Double_t scale = fUseMmScale ? 1 : fMm2Deg;
     125    const Double_t scale = fGeom->GetConvMm2Deg();
    130126
    131127    fHistBorder1.Fill(h->GetBorderLinePixel() *scale, w);
     
    133129
    134130    return kTRUE;
    135 }
    136 
    137 // --------------------------------------------------------------------------
    138 //
    139 // With this function you can convert the histogram ('on the fly') between
    140 // degrees and millimeters.
    141 //
    142 void MHNewImagePar2::SetMmScale(Bool_t mmscale)
    143 {
    144     if (fUseMmScale == mmscale)
    145         return;
    146 
    147     if (fMm2Deg<0)
    148     {
    149         *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;
    150         return;
    151     }
    152 
    153     const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    154     MH::ScaleAxis(&fHistBorder1,  scale);
    155     MH::ScaleAxis(&fHistBorder2,  scale);
    156 
    157     if (mmscale)
    158     {
    159         fHistBorder1.SetXTitle("L [mm]");
    160         fHistBorder2.SetXTitle("L [mm]");
    161     }
    162     else
    163     {
    164         fHistBorder1.SetXTitle("L [\\circ]");
    165         fHistBorder2.SetXTitle("L [\\circ]");
    166     }
    167 
    168     fUseMmScale = mmscale;
    169 }
    170 
    171 // --------------------------------------------------------------------------
    172 //
    173 // Use this function to setup your own conversion factor between degrees
    174 // and millimeters. The conversion factor should be the one calculated in
    175 // MGeomCam. Use this function with Caution: You could create wrong values
    176 // by setting up your own scale factor.
    177 //
    178 void MHNewImagePar2::SetMm2Deg(Float_t mmdeg)
    179 {
    180     if (mmdeg<0)
    181     {
    182         *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
    183         return;
    184     }
    185 
    186     if (fMm2Deg>=0)
    187         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    188 
    189     fMm2Deg = mmdeg;
    190131}
    191132
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar2.h

    r9153 r9340  
    99#endif
    1010
     11class MGeomCam;
    1112class MHillas;
    1213
     
    1415{
    1516private:
     17    MGeomCam *fGeom;    //! conversion mm to deg
     18
    1619    TH1F fHistBorder1;  //
    1720    TH1F fHistBorder2;  //
     
    2629    Int_t  Fill(const MParContainer *par, const Stat_t w=1);
    2730
    28     void SetMmScale(Bool_t mmscale=kTRUE);
    29     virtual void SetMm2Deg(Float_t mmdeg);
    30 
    3131    void Draw(Option_t *opt="");
    3232
Note: See TracChangeset for help on using the changeset viewer.