Ignore:
Timestamp:
04/23/03 15:02:13 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhistmc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhistmc/MHMcCT1CollectionArea.cc

    r1974 r1986  
    3434#include <TCanvas.h>
    3535
     36#include "MMcEvt.hxx"
    3637#include "MH.h"
    3738#include "MBinning.h"
     39#include "MParList.h"
     40#include "MLog.h"
     41#include "MLogManip.h"
     42
    3843
    3944ClassImp(MHMcCT1CollectionArea);
     
    4651//   - collection area (result)
    4752//
    48 MHMcCT1CollectionArea::MHMcCT1CollectionArea(const char *name, const char *title, Int_t nbins, Axis_t minEnergy, Axis_t maxEnergy)
     53MHMcCT1CollectionArea::MHMcCT1CollectionArea(const char *name, const char *title)
    4954{
    5055  //
     
    6469  fHistCol = new TH2D;
    6570
    66   SetBins(nbins, minEnergy, maxEnergy);
    67 
    6871  fHistCol->SetName(fName);
    6972  fHistAll->SetName("AllEvents");
     
    9396// --------------------------------------------------------------------------
    9497//
    95 // Set binning of histograms. Binning of energy axis can be changed, that
    96 //   of theta axis is always the same (to match the CT1 MC sample theta dist):
    97 //
    98 void MHMcCT1CollectionArea::SetBins(Int_t nbins, Axis_t minEnergy, Axis_t maxEnergy)
    99 {
    100   MBinning binsx;
    101   binsx.SetEdges(nbins, minEnergy, maxEnergy);
    102 
    103   MBinning binsy;
    104   const Double_t yedge[7] = {12.5, 17.5, 23.5, 29.5, 35.5, 42., 48.};
    105   const TArrayD yed(7,yedge);
    106   binsy.SetEdges(yed);
    107 
    108   MH::SetBinning(fHistAll, &binsx, &binsy);
    109   MH::SetBinning(fHistSel, &binsx, &binsy);
    110   MH::SetBinning(fHistCol, &binsx, &binsy);
    111 }
    112 
    113 
    114 // --------------------------------------------------------------------------
    115 //
    11698// Delete the three histograms
    11799//
     
    125107// --------------------------------------------------------------------------
    126108//
     109// Set the binnings and prepare the filling of the histograms
     110//
     111Bool_t MHMcCT1CollectionArea::SetupFill(const MParList *plist)
     112{
     113    const MBinning* binsenergy = (MBinning*)plist->FindObject("MBinningE");
     114    const MBinning* binstheta  = (MBinning*)plist->FindObject("MBinningTheta");
     115
     116    if (!binsenergy || !binstheta)
     117    {
     118        *fLog << err << dbginf << "At least one MBinning not found... aborting."
     119 << endl;
     120        return kFALSE;
     121    }
     122
     123    SetBinning(fHistAll, binsenergy, binstheta);
     124    SetBinning(fHistSel, binsenergy, binstheta);
     125    SetBinning(fHistCol, binsenergy, binstheta);
     126
     127    fHistAll->Sumw2();
     128    fHistSel->Sumw2();
     129    fHistCol->Sumw2();
     130
     131    return kTRUE;
     132}
     133
     134
     135// --------------------------------------------------------------------------
     136//
    127137// Fill data into the histogram which contains the selected showers
    128138//
    129 void MHMcCT1CollectionArea::FillSel(Double_t energy, Double_t theta)
    130 {
    131   fHistSel->Fill(log10(energy), theta);
     139Bool_t MHMcCT1CollectionArea::Fill(const MParContainer *par)
     140{
     141  MMcEvt &mcevt = *(MMcEvt*)par;
     142
     143  fHistSel->Fill(log10(mcevt.GetEnergy()), kRad2Deg*mcevt.GetTelescopeTheta());
     144  return kTRUE;
    132145}
    133146
     
    209222  // set here by hand, so make sure that the MC sample you are using is the
    210223  // right one (check all these quantities in your files and compare with
    211   // is written below. In some theta bins, there are two different
     224  // what is written below. In some theta bins, there are two different
    212225  // productions, with different energy limits but with the same spectral
    213226  // slope. We account for this when calculating the original number of
     
    354367
    355368          const Double_t eff = Ns/Na;
    356           const Double_t err = sqrt((1.-eff)*Ns)/Na;
     369          const Double_t efferr = sqrt((1.-eff)*Ns)/Na;
    357370
    358371
     
    360373
    361374          fHistCol->SetBinContent(ix, thetabin, eff*area);
    362           fHistCol->SetBinError(ix, thetabin, err*area);
     375          fHistCol->SetBinError(ix, thetabin, efferr*area);
    363376
    364377        }
  • trunk/MagicSoft/Mars/mhistmc/MHMcCT1CollectionArea.h

    r1974 r1986  
    22#define MARS_MHMcCT1CollectionArea
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
     4#ifndef MARS_MH
     5#include "MH.h"
    66#endif
    77
    88class TH2D;
    99
    10 
    11 class MHMcCT1CollectionArea : public MParContainer
     10class MHMcCT1CollectionArea : public MH
    1211{
    1312private:
     
    1514    TH2D *fHistSel; //  the selected showers
    1615    TH2D *fHistCol; //  the collection area
    17     void SetBins(Int_t nbins, Axis_t minEnergy, Axis_t maxEnergy);
    1816
    1917public:
    20     MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL, Int_t nbins=30, Axis_t minEnergy=2., Axis_t maxEnergy=5.);
     18    MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL);
    2119    ~MHMcCT1CollectionArea();
    2220
    23     void FillSel(Double_t energy, Double_t radius);
     21    virtual Bool_t SetupFill(const MParList *pList);
     22    virtual Bool_t Fill(const MParContainer *par);
    2423
    2524    void DrawAll(Option_t *option="");
Note: See TracChangeset for help on using the changeset viewer.