Changeset 2300 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/19/03 10:49:06 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2299 r2300  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3
     4
     5 2003/08/19: Wolfgang Wittek
     6
     7    * manalysis/MCT1Supercuts.[h,cc]
     8      - new class
     9      - container for the supercut parameters
     10
     11    * manalysis/MCT1SupercutsCalc.[h,cc]
     12      - get supercut parameters from container 'MCT1Supercuts'
     13
     14    * manalysis/MCT1FindSupercuts.[h,cc]
     15      - new class
     16      - optimizes the parameters for the supercuts
     17
     18    * manalysis/MMinuitInterface.[h,cc]
     19      - new class
     20      - interface for Minuit
     21
     22    * manalysis/Makefile
     23                AnalysisLinkDef.h
     24      - include MCT1FindSupercuts
     25                MMinuitInterface
     26
     27    * mhist/MH3.cc
     28      - reset fHist in SetupFill();
     29        this is necessary if the same MH3 object is used in more than one
     30        eventloop
     31
     32    * mhist/MHMatrix.cc
     33      - give name to the event loop
     34
     35    * mhist/MHFindSignificance.[h,cc]
     36      - new class
     37      - calculates the significance of the gamma signal in the alpha plot     
     38
     39    * mhist/MHCT1Supercuts.[h,cc]
     40      - new class
     41      - plots various quantities during the optimization of the supercuts
     42
     43    * mhist/Makefile
     44            HistLinkDef.h
     45      - MHFindSignificance included
     46      - MHCT1Supercuts included
     47
     48
    249 2003/08/01: Thomas Bretz
    350
     
    162209   * mgeom/Makefile, GeomLinkDef.h
    163210     - add new class
     211
     212
    164213
    165214
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r2272 r2300  
    5151#pragma link C++ class MMcTriggerLvl2Calc+;
    5252
     53#pragma link C++ class MCT1Supercuts+;
    5354#pragma link C++ class MCT1SupercutsCalc+;
     55#pragma link C++ class MCT1FindSupercuts+;
     56#pragma link C++ class MMinuitInterface+;
    5457#pragma link C++ class MFiltercutsCalc+;
    5558
    5659#endif
    5760
     61
     62
     63
     64
     65
     66
     67
     68
     69
  • trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc

    r2282 r2300  
    3333#include <fstream>
    3434
     35#include "TFile.h"
     36#include "TArrayD.h"
     37
    3538#include "MParList.h"
    3639#include "MHillasExt.h"
     
    4144#include "MHadronness.h"
    4245#include "MHMatrix.h"
     46#include "MCT1Supercuts.h"
    4347
    4448#include "MLog.h"
     
    4953using namespace std;
    5054
    51 void MCT1SupercutsCalc::InitParams()
    52 {
    53     fLengthUp.Set(8);
    54     fLengthLo.Set(8);
    55     fWidthUp.Set(8);
    56     fWidthLo.Set(8);
    57     fDistUp.Set(8);
    58     fDistLo.Set(8);
    59     fAsymUp.Set(8);
    60     fAsymLo.Set(8);
    61     fAlphaUp.Set(8);
    62 
    63     //---------------------------------
    64     // cut parameters
    65     fLengthUp[0] = 0.315585;
    66     fLengthUp[1] = 0.001455;
    67     fLengthUp[2] = 0.203198;
    68     fLengthUp[3] = 0.005532;
    69     fLengthUp[4] =-0.001670;
    70     fLengthUp[5] =-0.020362;
    71     fLengthUp[6] = 0.007388;
    72     fLengthUp[7] =-0.013463;
    73 
    74     fWidthUp[0] = 0.145412;
    75     fWidthUp[1] =-0.001771;
    76     fWidthUp[2] = 0.054462;
    77     fWidthUp[3] = 0.022280;
    78     fWidthUp[4] =-0.009893;
    79     fWidthUp[5] = 0.056353;
    80     fWidthUp[6] = 0.020711;
    81     fWidthUp[7] =-0.016703;
    82 
    83     fDistUp[0] = 1.787943;
    84     fDistUp[1] = 0.;
    85     fDistUp[2] = 2.942310;
    86     fDistUp[3] = 0.199815;
    87     fDistUp[4] = 0.;
    88     fDistUp[5] = 0.249909;
    89     fDistUp[6] = 0.189697;
    90     fDistUp[7] = 0.;
    91 
    92     fLengthLo[0] = 0.151530;
    93     fLengthLo[1] = 0.028323;
    94     fLengthLo[2] = 0.510707;
    95     fLengthLo[3] = 0.053089;
    96     fLengthLo[4] = 0.013708;
    97     fLengthLo[5] = 2.357993;
    98     fLengthLo[6] = 0.000080;
    99     fLengthLo[7] =-0.007157;
    100 
    101     fWidthLo[0] = 0.089187;
    102     fWidthLo[1] =-0.006430;
    103     fWidthLo[2] = 0.074442;
    104     fWidthLo[3] = 0.003738;
    105     fWidthLo[4] =-0.004256;
    106     fWidthLo[5] =-0.014101;
    107     fWidthLo[6] = 0.006126;
    108     fWidthLo[7] =-0.002849;
    109 
    110     fDistLo[0] = 0.589406;
    111     fDistLo[1] = 0.;
    112     fDistLo[2] =-0.083964;
    113     fDistLo[3] =-0.007975;
    114     fDistLo[4] = 0.;
    115     fDistLo[5] = 0.045374;
    116     fDistLo[6] =-0.001750;
    117     fDistLo[7] = 0.;
    118 
    119     fAsymUp[0] = 0.061267;
    120     fAsymUp[1] = 0.014462;
    121     fAsymUp[2] = 0.014327;
    122     fAsymUp[3] = 0.014540;
    123     fAsymUp[4] = 0.013391;
    124     fAsymUp[5] = 0.012319;
    125     fAsymUp[6] = 0.010444;
    126     fAsymUp[7] = 0.008328;
    127 
    128     fAsymLo[0] =-0.012055;
    129     fAsymLo[1] = 0.009157;
    130     fAsymLo[2] = 0.005441;
    131     fAsymLo[3] = 0.000399;
    132     fAsymLo[4] = 0.001433;
    133     fAsymLo[5] =-0.002050;
    134     fAsymLo[6] =-0.000104;
    135     fAsymLo[7] =-0.001188;
    136 
    137     fAlphaUp[0] = 13.123440;
    138     fAlphaUp[1] = 0.;
    139     fAlphaUp[2] = 0.;
    140     fAlphaUp[3] = 0.;
    141     fAlphaUp[4] = 0.;
    142     fAlphaUp[5] = 0.;
    143     fAlphaUp[6] = 0.;
    144     fAlphaUp[7] = 0.;
    145     //---------------------------------
    146 }
    147 
    148 // --------------------------------------------------------------------------
    149 //
    150 // Set the parameter values from vector 'par'
    151 //
    152 // Attention : it is assumed that there are (9*ncutpar) values
    153 //
    154 void MCT1SupercutsCalc::SetParams(Double_t *par)
    155 {
    156     UInt_t ncutpar = fLengthUp.GetSize();
    157     UInt_t k0 = 0;
    158 
    159     TArrayD lup(ncutpar,     par + k0);
    160     fLengthUp = lup;
    161     k0 += ncutpar;
    162 
    163     TArrayD wup(ncutpar,     par + k0);
    164     fWidthUp = wup;
    165     k0 += ncutpar;
    166 
    167     TArrayD dup(ncutpar,     par + k0);
    168     fDistUp = dup;
    169     k0 += ncutpar;
    170 
    171     TArrayD llo(ncutpar,     par + k0);
    172     fLengthLo = llo;
    173     k0 += ncutpar;
    174 
    175     TArrayD wlo(ncutpar,     par + k0);
    176     fWidthLo = wlo;
    177     k0 += ncutpar;
    178 
    179     TArrayD dlo(ncutpar,     par + k0);
    180     fDistLo = dlo;
    181     k0 += ncutpar;
    182 
    183     TArrayD aup(ncutpar,     par + k0);
    184     fAsymUp = aup;
    185     k0 += ncutpar;
    186 
    187     TArrayD alo(ncutpar,     par + k0);
    188     fAsymLo = alo;
    189     k0 += ncutpar;
    190 
    191     TArrayD alphaup(ncutpar, par + k0);
    192     fAlphaUp = alphaup;
    193 }
    194 
    195 // --------------------------------------------------------------------------
    196 //
    197 // Get the parameter values
    198 //
    199 // Attention : it is assumed that there are (9*ncutpar) values
    200 //
    201 void MCT1SupercutsCalc::GetParams(Double_t *par)
    202 {
    203     UInt_t ncutpar = fLengthUp.GetSize();
    204     UInt_t k0 = 0;
    205 
    206     for (UInt_t j=0; j<ncutpar; j++)
    207     {
    208       UInt_t k = k0 + j;
    209       par[k] = fLengthUp[j];
    210     }
    211     k0 += ncutpar;
    212 
    213     for (UInt_t j=0; j<ncutpar; j++)
    214     {
    215       UInt_t k = k0 + j;
    216       par[k] = fWidthUp[j];
    217     }
    218     k0 += ncutpar;
    219 
    220     for (UInt_t j=0; j<ncutpar; j++)
    221     {
    222       UInt_t k = k0 + j;
    223       par[k] = fDistUp[j];
    224     }
    225     k0 += ncutpar;
    226 
    227     for (UInt_t j=0; j<ncutpar; j++)
    228     {
    229       UInt_t k = k0 + j;
    230       par[k] = fLengthLo[j];
    231     }
    232     k0 += ncutpar;
    233 
    234     for (UInt_t j=0; j<ncutpar; j++)
    235     {
    236       UInt_t k = k0 + j;
    237       par[k] = fWidthLo[j];
    238     }
    239     k0 += ncutpar;
    240 
    241     for (UInt_t j=0; j<ncutpar; j++)
    242     {
    243       UInt_t k = k0 + j;
    244       par[k] = fDistLo[j];
    245     }
    246     k0 += ncutpar;
    247 
    248     for (UInt_t j=0; j<ncutpar; j++)
    249     {
    250       UInt_t k = k0 + j;
    251       par[k] = fAsymUp[j];
    252     }
    253     k0 += ncutpar;
    254 
    255     for (UInt_t j=0; j<ncutpar; j++)
    256     {
    257       UInt_t k = k0 + j;
    258       par[k] = fAsymLo[j];
    259     }
    260     k0 += ncutpar;
    261 
    262     for (UInt_t j=0; j<ncutpar; j++)
    263     {
    264       UInt_t k = k0 + j;
    265       par[k] = fAlphaUp[j];
    266     }
    267 }
    268 
    269 // --------------------------------------------------------------------------
    270 //
     55
     56// --------------------------------------------------------------------------
     57//
     58// constructor
     59//
     60
    27161MCT1SupercutsCalc::MCT1SupercutsCalc(const char *hilname,
    27262                                     const char *hilsrcname, const char *name, const char *title)
    273 : fHadronnessName("MHadronness"), fHilName(hilname), fHilSrcName(hilsrcname)
     63  : fHadronnessName("MHadronness"), fHilName(hilname), fHilSrcName(hilsrcname),
     64    fSuperName("MCT1Supercuts")
    27465{
    27566    fName  = name  ? name  : "MCT1SupercutsCalc";
    27667    fTitle = title ? title : "Class to evaluate the Supercuts";
    27768
    278     InitParams();
    279 
    28069    fMatrix = NULL;
    28170}
     
    30190    }
    30291
     92    fSuper = (MCT1Supercuts*)pList->FindObject(fSuperName, "MCT1Supercuts");
     93    if (!fSuper)
     94    {
     95        *fLog << err << fSuperName << " [MCT1Supercuts] not found... aborting." << endl;
     96        return kFALSE;
     97    }
     98
     99
    303100    if (fMatrix)
    304101        return kTRUE;
    305102
     103    //-----------------------------------------------------------
    306104    fHil = (MHillas*)pList->FindObject(fHilName, "MHillas");
    307105    if (!fHil)
     
    325123    }
    326124
     125
    327126    return kTRUE;
    328127}
     
    332131// Calculation of upper and lower limits
    333132//
    334 Double_t MCT1SupercutsCalc::CtsMCut(
    335 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)
    336 const
    337 #endif
    338                                     TArrayD &a,  Double_t ls, Double_t ct,
     133Double_t MCT1SupercutsCalc::CtsMCut(TArrayD &a,  Double_t ls, Double_t ct,
    339134                                    Double_t ls2, Double_t dd2)
    340135{
     
    398193    fMap[5] = fMatrix->AddColumn("MHillas.fMeanY");
    399194    fMap[6] = fMatrix->AddColumn("MHillasSrc.fDist");
    400     fMap[7] = fMatrix->AddColumn("MHillasSrc.fAlpha");
     195    fMap[7] = fMatrix->AddColumn("fabs(MHillasSrc.fAlpha)");
    401196}
    402197
     
    437232    const Double_t width   = width0  * fMm2Deg;
    438233
    439     if (newdist < 1.05                                         &&
    440         newdist < CtsMCut (fDistUp,   dmls, dmcza, dmls2, dd2) &&
    441         newdist > CtsMCut (fDistLo,   dmls, dmcza, dmls2, dd2) &&
    442         dist    < 1.05                                         &&
    443         length  < CtsMCut (fLengthUp, dmls, dmcza, dmls2, dd2) &&
    444         length  > CtsMCut (fLengthLo, dmls, dmcza, dmls2, dd2) &&
    445         width   < CtsMCut (fWidthUp,  dmls, dmcza, dmls2, dd2) &&
    446         width   > CtsMCut (fWidthLo,  dmls, dmcza, dmls2, dd2) &&
    447         //asym  < CtsMCut (asymup,    dmls, dmcza, dmls2, dd2) &&
    448         //asym  > CtsMCut (asymlow,   dmls, dmcza, dmls2, dd2) &&
    449         dist    < CtsMCut (fDistUp,   dmls, dmcza, dmls2, dd2) &&
    450         dist    > CtsMCut (fDistLo,   dmls, dmcza, dmls2, dd2)  )
     234    if (newdist < 1.05                                                     &&
     235        newdist < CtsMCut (fSuper->GetDistUp(),   dmls, dmcza, dmls2, dd2) &&
     236        newdist > CtsMCut (fSuper->GetDistLo(),   dmls, dmcza, dmls2, dd2) &&
     237        dist    < 1.05                                                     &&
     238        length  < CtsMCut (fSuper->GetLengthUp(), dmls, dmcza, dmls2, dd2) &&
     239        length  > CtsMCut (fSuper->GetLengthLo(), dmls, dmcza, dmls2, dd2) &&
     240        width   < CtsMCut (fSuper->GetWidthUp(),  dmls, dmcza, dmls2, dd2) &&
     241        width   > CtsMCut (fSuper->GetWidthLo(),  dmls, dmcza, dmls2, dd2) &&
     242        //asym  < CtsMCut (fSuper->GetAsymUp(),   dmls, dmcza, dmls2, dd2) &&
     243        //asym  > CtsMCut (fSuper->GetAsymLo(),   dmls, dmcza, dmls2, dd2) &&
     244        dist    < CtsMCut (fSuper->GetDistUp(),   dmls, dmcza, dmls2, dd2) &&
     245        dist    > CtsMCut (fSuper->GetDistLo(),   dmls, dmcza, dmls2, dd2)  )
    451246        fHadronness->SetHadronness(0.25);
    452247    else
     
    458253}
    459254//==========================================================================
     255
     256
     257
     258
  • trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h

    r2272 r2300  
    1818class MHadronness;
    1919class MHMatrix;
     20class MCT1Supercuts;
    2021
    2122
     
    2324{
    2425private:
    25     MHillas     *fHil;
    26     MHillasSrc  *fHilSrc;
    27     MMcEvt      *fMcEvt;
    28     MHadronness *fHadronness;     //! output container for hadronness
     26    MHillas       *fHil;
     27    MHillasSrc    *fHilSrc;
     28    MMcEvt        *fMcEvt;
     29    MHadronness   *fHadronness;   //! output container for hadronness
     30    MCT1Supercuts *fSuper;        // container for supercut parameters
    2931
    3032    TString     fHadronnessName;  // name of container to store hadronness
    3133    TString     fHilName;
    3234    TString     fHilSrcName;
     35    TString     fSuperName;       // name of container for supercut parameters
    3336
    3437    Double_t    fMm2Deg;
     
    3740    MHMatrix *fMatrix;
    3841
    39     //---------------------------------
    40     // cut parameters
    41     TArrayD fLengthUp;
    42     TArrayD fLengthLo;
    43     TArrayD fWidthUp;
    44     TArrayD fWidthLo;
    45     TArrayD fDistUp;
    46     TArrayD fDistLo;
    47     TArrayD fAsymUp;
    48     TArrayD fAsymLo;
    49     TArrayD fAlphaUp;
    50     //---------------------------------
    51 
    52     void InitParams();
    53 
    5442    Int_t PreProcess(MParList *pList);
    5543    Int_t Process();
    5644
    57     void Set(TArrayD &a, const TArrayD &b) { if (a.GetSize()==b.GetSize()) a=b; }
    5845    Double_t GetVal(Int_t i) const;
    5946
    60     Double_t CtsMCut(
    61 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)
    62 const
    63 #endif
    64                      TArrayD &a, Double_t ls, Double_t ct,
     47    Double_t CtsMCut(TArrayD &a, Double_t ls, Double_t ct,
    6548                     Double_t ls2, Double_t dd2);
    6649
     
    7053                      const char *name=NULL, const char *title=NULL);
    7154
    72     void SetParams(Double_t *par);
    73     void GetParams(Double_t *par);
    74 
    7555    void SetHadronnessName(const TString name) { fHadronnessName = name; }
    7656    TString GetHadronnessName() const { return fHadronnessName; }
     
    7959    void StopMapping() { InitMapping(NULL); }
    8060
    81     void SetLengthUp(const TArrayD &d) { Set(fLengthUp, d); }
    82     void SetLengthLo(const TArrayD &d) { Set(fLengthLo, d); }
    83     void SetWidthUp (const TArrayD &d) { Set(fWidthUp,  d); }
    84     void SetWidthLo (const TArrayD &d) { Set(fWidthLo,  d); }
    85     void SetDistUp  (const TArrayD &d) { Set(fDistUp,   d); }
    86     void SetDistLo  (const TArrayD &d) { Set(fDistLo,   d); }
    87     void SetAsymUp  (const TArrayD &d) { Set(fAsymUp,   d); }
    88     void SetAsymLo  (const TArrayD &d) { Set(fAsymLo,   d); }
    89     void SetAlphaUp (const TArrayD &d) { Set(fAlphaUp,  d); }
    90 
    91     const TArrayD &GetLengthUp() const { return fLengthUp; }
    92     const TArrayD &GetLengthLo() const { return fLengthLo; }
    93     const TArrayD &GetWidthUp() const  { return fWidthUp; }
    94     const TArrayD &GetWithLo() const   { return fWidthLo; }
    95     const TArrayD &GetDistUp() const   { return fDistUp; }
    96     const TArrayD &GetDistLo() const   { return fDistLo; }
    97     const TArrayD &GetAsymUp() const   { return fAsymUp; }
    98     const TArrayD &GetAsymLo() const   { return fAsymLo; }
    99     const TArrayD &GetAlphaUp() const  { return fAlphaUp; }
    10061
    10162    ClassDef(MCT1SupercutsCalc, 0) // A class to evaluate the Supercuts
     
    11172
    11273
     74
     75
     76
     77
     78
     79
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r2272 r2300  
    2424INCLUDES = -I. -I../mbase -I../mmc -I../mraw -I../mgeom -I../mfilter \
    2525           -I../mdata -I../mhist -I../mgui -I../mimage -I../mhistmc \
    26            -I../mfileio
     26           -I../mfileio -I../mmain
    2727
    2828
     
    6060           MMcTriggerLvl2.cc \
    6161           MMcTriggerLvl2Calc.cc \
     62           MCT1Supercuts.cc \
    6263           MCT1SupercutsCalc.cc \
     64           MCT1FindSupercuts.cc \
     65           MMinuitInterface.cc \
    6366           MFiltercutsCalc.cc
    6467#          MCT1PadONOFF.cc \
  • trunk/MagicSoft/Mars/mhist/HistLinkDef.h

    r2244 r2300  
    3939#pragma link C++ class MHSigmaTheta+;
    4040#pragma link C++ class MHSigmaPixel+;
     41#pragma link C++ class MHOnSubtraction+;
     42#pragma link C++ class MHFindSignificance+;
     43#pragma link C++ class MHCT1Supercuts+;
    4144
    4245#pragma link C++ class MHCompProb+;
     
    4750
    4851#endif
     52
     53
     54
     55
     56
     57
     58
     59
     60
  • trunk/MagicSoft/Mars/mhist/MH3.cc

    r2173 r2300  
    241241Bool_t MH3::SetupFill(const MParList *plist)
    242242{
     243    // reset histogram (necessary if the same eventloop is run more than once)
     244    fHist->Reset();
    243245
    244246    TString bname("Binning");
  • trunk/MagicSoft/Mars/mhist/MHMatrix.cc

    r2296 r2300  
    635635    MEvtLoop evtloop;
    636636    evtloop.SetParList(plist);
     637    evtloop.SetName("EvtLoopMatrix");
    637638    //evtloop.SetProgressBar(&bar);
     639
    638640
    639641    if (!evtloop.Eventloop())
  • trunk/MagicSoft/Mars/mhist/Makefile

    r2244 r2300  
    6060           MHSigmaTheta.cc \
    6161           MHTriggerLvl0.cc \
     62           MHOnSubtraction.cc \
     63           MHFindSignificance.cc \
     64           MHCT1Supercuts.cc \
    6265           MHCamera.cc
    6366#           MHCurrents.cc \
    64 #          MHOnSubtraction.cc \
     67
    6568
    6669SRCS    = $(SRCFILES)
Note: See TracChangeset for help on using the changeset viewer.