Changeset 7174


Ignore:
Timestamp:
06/28/05 13:39:15 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7173 r7174  
    2525
    2626   * mfilter/MFMagicCuts.[h,cc]:
    27      - first full implemtation... updates to come.
     27     - first full implementation... updates to come.
    2828
    2929   * mhbase/MH.[h,cc]:
     
    3535     - implemented subtracting off-data from on-data
    3636     - set different palettes
     37
     38   * mhflux/MMcSpectrumWeight.[h,cc]:
     39     - implemented additional weight for zenith-angle- and size-bins
    3740
    3841
  • trunk/MagicSoft/Mars/mhflux/MMcSpectrumWeight.cc

    r7144 r7174  
    7373#include <TF1.h>
    7474#include <TH1.h>
     75#include <TSpline.h>
    7576
    7677#include "MLog.h"
     
    8081#include "MParameters.h"
    8182
     83#include "MHillas.h"
    8284#include "MPointingPos.h"
    8385
     
    109111    fAllowChange = kFALSE;
    110112
    111     fFunc      = NULL;
    112     fMcEvt     = NULL;
    113     fWeight    = NULL;
    114     fZdWeights = NULL;
    115     fPointing  = NULL;
     113    fFunc        = NULL;
     114    fMcEvt       = NULL;
     115    fHillas      = NULL;
     116    fWeight      = NULL;
     117    fWeightsZd   = NULL;
     118    fWeightsSize = NULL;
     119    fPointing    = NULL;
    116120}
    117121
     
    133137    if (fFunc)
    134138        delete fFunc;
     139//    if (fWeightsSize)
     140//        delete fWeightsSize;
    135141}
    136142
     
    156162        return kFALSE;
    157163
    158     if (!fZdWeights)
    159         return kTRUE;
    160 
    161     fPointing = (MPointingPos*)pList->FindObject("MPointingPos");
    162     if (!fPointing)
    163     {
    164         *fLog << err << "MPointingPos not found... abort." << endl;
    165         return kFALSE;
     164    if (fWeightsZd)
     165    {
     166        fPointing = (MPointingPos*)pList->FindObject("MPointingPos");
     167        if (!fPointing)
     168        {
     169            *fLog << err << "MPointingPos not found... abort." << endl;
     170            return kFALSE;
     171        }
     172    }
     173
     174    if (fWeightsSize)
     175    {
     176        fHillas = (MHillas*)pList->FindObject("MHillas");
     177        if (!fHillas)
     178        {
     179            *fLog << err << "MHillas not found... abort." << endl;
     180            return kFALSE;
     181        }
    166182    }
    167183
     
    256272    TF1 funcold("Dummy", GetFormulaSpecOldX());
    257273    return funcold.Integral(fEnergyMin, fEnergyMax);
     274}
     275
     276void MMcSpectrumWeight::SetWeightsSize(TH1D *h)
     277{
     278    fWeightsSize=h;
     279    /*
     280    if (h==0)
     281    {
     282        fWeightsSize=0;
     283        return;
     284    }
     285
     286    if (fWeightsSize)
     287        delete fWeightsSize;
     288
     289    const Double_t xmin = TMath::Log10(h->GetXaxis()->GetXmin());
     290    const Double_t xmax = TMath::Log10(h->GetXaxis()->GetXmax());
     291    const Double_t xnum = h->GetNbinsX()+1;
     292
     293    fWeightsSize = new TSpline3("WeightsSize", xmin, xmax,
     294                                h->GetArray()+1, xnum);*/
    258295}
    259296
     
    379416    Double_t w = 1;
    380417
    381     if (fZdWeights)
    382     {
    383         const Int_t i = fZdWeights->GetXaxis()->FindFixBin(fPointing->GetZd());
    384         w = fZdWeights->GetBinContent(i);
     418    if (fWeightsZd)
     419    {
     420        const Int_t i = fWeightsZd->GetXaxis()->FindFixBin(fPointing->GetZd());
     421        w = fWeightsZd->GetBinContent(i);
     422    }
     423    if (fWeightsSize)
     424    {
     425        const Int_t i = fWeightsSize->GetXaxis()->FindFixBin(fHillas->GetSize());
     426        w *= fWeightsSize->GetBinContent(i);
     427       // w *= fWeightsSize->Eval(TMath::Log10(fHillas->GetSize()));
    385428    }
    386429
  • trunk/MagicSoft/Mars/mhflux/MMcSpectrumWeight.h

    r7142 r7174  
    88class TF1;
    99class TH1;
     10class TH1D;
     11class TSpline3;
    1012class MParList;
    1113class MMcEvt;
     14class MHillas;
    1215class MParameterD;
    1316class MPointingPos;
     
    1720{
    1821private:
    19     const MMcEvt *fMcEvt;   // Pointer to the container with the MC energy
    20     MParameterD  *fWeight;  // Pointer to the output MWeight container
    21     MPointingPos *fPointing;
     22    const MMcEvt  *fMcEvt;   // Pointer to the container with the MC energy
     23    const MHillas *fHillas;
     24    MParameterD   *fWeight;  // Pointer to the output MWeight container
     25    MPointingPos  *fPointing;
    2226
    2327    TString fNameWeight;    // Name of the MWeight container
    2428    TString fNameMcEvt;     // Name of the MMcEvt container
    2529
    26     TF1 *fFunc;             // Function calculating the weights
    27     TH1 *fZdWeights;        // Set additional ZA weights
     30    TF1      *fFunc;        // Function calculating the weights
     31    TH1      *fWeightsZd;   // Set additional ZA weights
     32    TH1      *fWeightsSize; // Set additional ZA weights
     33//    TSpline3 *fWeightsSize;
    2834
    2935    Double_t fOldSlope;     // Slope of energy spectrum generated with Corsika
     
    6369    void SetEnergyRange(Double_t min=-2, Double_t max=-1) { fEnergyMin=min; fEnergyMax=max; }
    6470    void SetOldSlope(Double_t s=-2.6) { fOldSlope=s; }
    65     void SetZdWeights(TH1 *h=0) { fZdWeights = h; }
     71    void SetWeightsZd(TH1 *h=0) { fWeightsZd = h; }
     72    void SetWeightsSize(TH1D *h=0);
    6673    Bool_t Set(const MMcCorsikaRunHeader &h);
    6774
Note: See TracChangeset for help on using the changeset viewer.