Ignore:
Timestamp:
06/24/03 10:15:42 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHHadronness.cc

    r2180 r2225  
    5656// MFillH.
    5757//
     58// If you are using filtercuts which gives you only two discrete values
     59// of the hadronness (0.25 and 0.75) you may want to use MHHadronness(2).
     60// If you request Q05() from such a MHHadronness instance you will get
     61// Acc_g/sqrt(Acc_h)
     62//
    5863////////////////////////////////////////////////////////////////////////////
    5964#include "MHHadronness.h"
     
    6570#include <TMarker.h>
    6671
     72#include "MParList.h"
     73#include "MBinning.h"
     74#include "MHMatrix.h"
     75#include "MHadronness.h"
     76
    6777#include "MLog.h"
    6878#include "MLogManip.h"
    6979
    70 #include "MParList.h"
    71 #include "MBinning.h"
    72 #include "MHadronness.h"
    73 
    7480#include "MMcEvt.hxx"
    7581
     
    8490//
    8591MHHadronness::MHHadronness(Int_t nbins, const char *name, const char *title)
     92    : fMatrix(NULL)
    8693{
    8794    //
     
    95102    fGraph->SetMarkerStyle(kFullDotSmall);
    96103
    97     fGhness = new TH1D("Ghness", "H. Gammas",  nbins, 0, 1);
    98     fPhness = new TH1D("Phness", "H. Hadrons", nbins, 0, 1);
     104    fGhness = new TH1D("Ghness", "Acceptance vs. Hadronness (Gammas)",  nbins, 0, 1);
     105    fPhness = new TH1D("Phness", "Acceptance vs. Hadronness (Hadrons)", nbins, 0, 1);
    99106    fGhness->SetXTitle("Hadronness");
    100107    fPhness->SetXTitle("Hadronness");
    101     fGhness->SetYTitle("Counts");
    102     fPhness->SetYTitle("Counts");
     108    fGhness->SetYTitle("Acceptance");
     109    fPhness->SetYTitle("Acceptance");
    103110    fPhness->SetLineColor(kRed);
    104111    fGhness->SetDirectory(NULL);
    105112    fPhness->SetDirectory(NULL);
    106113   
    107     fIntGhness = new TH1D("AccGammas",  "Acceptance", nbins, 0, 1);
    108     fIntPhness = new TH1D("AccHadrons", "Acceptance", nbins, 0, 1);
     114    fIntGhness = new TH1D("AccGammas",  "Integral Acceptance vs. Hadronness (Gammas)", nbins, 0, 1);
     115    fIntPhness = new TH1D("AccHadrons", "Integral Acceptance vs. Hadronness (Hadrons)", nbins, 0, 1);
    109116    fIntGhness->SetXTitle("Hadronness");
    110117    fIntPhness->SetXTitle("Hadronness");
     
    145152Bool_t MHHadronness::SetupFill(const MParList *plist)
    146153{
    147     fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
    148     if (!fMcEvt)
    149     {
    150         *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
    151         return kFALSE;
     154    if (!fMatrix)
     155    {
     156        fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
     157        if (!fMcEvt)
     158        {
     159            *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
     160            return kFALSE;
     161        }
    152162    }
    153163
    154164    fHadronness = (MHadronness*)plist->FindObject("MHadronness");
     165
     166    fGhness->Reset();
     167    fPhness->Reset();
    155168
    156169    /*
     
    200213        return kCONTINUE;
    201214
    202     if (fMcEvt->GetPartId()==kGAMMA)
     215    const Int_t particleid = fMatrix ? (Int_t)(*fMatrix)[fMap] : fMcEvt->GetPartId();
     216
     217    if (particleid==kGAMMA)
    203218        fGhness->Fill(h, w);
    204219    else
     
    208223}
    209224
     225// --------------------------------------------------------------------------
     226//
     227// Returns the quality factor at gamma acceptance 0.5.
     228//
     229// If the histogram containes only two bins we return the
     230// naive quality: ag/sqrt(ah)
     231// with ag the acceptance of gammas and ah the acceptance of hadrons.
     232//
     233// You can use this (nbins=2) in case of some kind of filter cuts giving
     234// only a result: gamma yes/no (means discrete values of hadronness 0.25
     235// or 0.75)
     236//
     237// FIXME: In the later case weights cannot be used!
     238//
    210239Float_t MHHadronness::GetQ05() const
    211240{
    212     Int_t n = fQfac->GetN();
     241    if (fGhness->GetNbinsX()==2)
     242    {
     243        // acceptance of all gamma-like gammas  (h<0.5)
     244        const Double_t ig = fGhness->GetBinContent(1);
     245
     246        // acceptance of all gamma-like hadrons (h<0.5)
     247        const Double_t ip = fPhness->GetBinContent(1);
     248
     249        if (ip==0)
     250            return 0; // FIXME!
     251
     252        // naive quality factor
     253        const Double_t q = ig / sqrt(ip);
     254
     255        *fLog << all << ip << "/" << ig << ": " << q << endl;
     256
     257        return q;
     258    }
     259
     260    const Int_t n = fQfac->GetN();
    213261
    214262    Double_t val1x=0;
     
    479527    }
    480528}
     529
     530// --------------------------------------------------------------------------
     531//
     532// You can use this function if you want to use a MHMatrix instead of
     533// MMcEvt. This function adds all necessary columns to the
     534// given matrix. Afterward you should fill the matrix with the corresponding
     535// data (eg from a file by using MHMatrix::Fill). If you now loop
     536// through the matrix (eg using MMatrixLoop) MHHadronness::Fill
     537// will take the values from the matrix instead of the containers.
     538//
     539void MHHadronness::InitMapping(MHMatrix *mat)
     540{
     541    if (fMatrix)
     542        return;
     543
     544    fMatrix = mat;
     545    fMap = fMatrix->AddColumn("MMcEvt.fPartId");
     546}
     547
     548void MHHadronness::StopMapping()
     549{
     550    fMatrix = NULL;
     551}
     552
  • trunk/MagicSoft/Mars/mhist/MHHadronness.h

    r2043 r2225  
    1111class MMcEvt;
    1212class MHadronness;
     13class MHMatrix;
    1314
    1415class MHHadronness : public MH
     
    1718    const MMcEvt *fMcEvt;           //!
    1819    const MHadronness *fHadronness; //!
     20    MHMatrix *fMatrix;        //!
     21    Int_t fMap;                     //!
    1922
    2023    TH1D* fPhness;    //-> Hadrons Hadronness
     
    4851    Bool_t Finalize();
    4952
     53    void InitMapping(MHMatrix *mat);
     54    void StopMapping();
     55
    5056    void Print(Option_t *option="") const;
    5157
Note: See TracChangeset for help on using the changeset viewer.