Ignore:
Timestamp:
06/23/03 11:01:53 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
4 edited

Legend:

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

    r2178 r2206  
    360360// with the same type as the given object name.
    361361//
    362 Bool_t MFillH::PreProcess(MParList *pList)
     362Int_t MFillH::PreProcess(MParList *pList)
    363363{
    364364    if (fIndex)
     
    467467// Fills the data from the parameter conatiner into the histogram container
    468468//
    469 Bool_t MFillH::Process()
     469Int_t MFillH::Process()
    470470{
    471471    if (fIndex)
     
    485485// has been filled into the histogram.
    486486//
    487 Bool_t MFillH::PostProcess()
     487Int_t MFillH::PostProcess()
    488488{
    489489    //
  • trunk/MagicSoft/Mars/mhist/MFillH.h

    r2117 r2206  
    5959    void SetWeight(const char *name) { fWeightName = name; }
    6060
    61     Bool_t PreProcess(MParList *pList);
    62     Bool_t Process();
    63     Bool_t PostProcess();
     61    Int_t PreProcess(MParList *pList);
     62    Int_t Process();
     63    Int_t PostProcess();
    6464
    6565    ClassDef(MFillH, 2) // Task to fill a histogram with data from a parameter container
  • trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc

    r2178 r2206  
    3636
    3737#include "MParList.h"
    38 #include "MCerPhotEvt.h"
     38#include "MCamEvent.h"
    3939#include "MCamDisplay.h"
    4040
     
    4848// --------------------------------------------------------------------------
    4949//
    50 // Reset all pixels to 0 and reset fEntries to 0.
    51 //
    52 void MHCerPhotEvt::Clear(const Option_t *)
    53 {
    54     fSum.Reset();
    55 //    fSum.InitSize(577);
    56     for (int i=0; i<577; i++)
    57     {
    58         fSum.AddPixel(i, 0, 0);
    59         fSum[i].SetPixelUnused();
    60     }
    61     fSum.FixSize();
    62     fEntries = 0;
    63 }
    64 
    65 // --------------------------------------------------------------------------
    66 //
    6750// Initialize the name and title of the task.
    6851// Resets the sum histogram
    6952//
    7053MHCerPhotEvt::MHCerPhotEvt(const char *name, const char *title)
    71     : fCam(NULL), fEvt(NULL), fDispl(NULL)
     54    : fSum(NULL), fEvt(NULL)
    7255{
    7356    //
     
    7659    fName  = name  ? name  : "MHCerPhotEvt";
    7760    fTitle = title ? title : "Average of MCerPhotEvts";
    78 
    79     Clear();
    8061}
    8162
     
    8667MHCerPhotEvt::~MHCerPhotEvt()
    8768{
    88     if (fDispl)
    89         delete fDispl;
     69    if (fSum)
     70        delete fSum;
    9071}
    9172
     
    9980Bool_t MHCerPhotEvt::SetupFill(const MParList *plist)
    10081{
    101     fEvt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
     82    fEvt = (MCamEvent*)plist->FindObject(fNameEvt, "MCamEvent");
    10283    if (!fEvt)
    10384        *fLog << warn << GetDescriptor() << ": No MCerPhotEvt available..." << endl;
    10485
    105     fCam = (MGeomCam*)plist->FindObject("MGeomCam");
    106     if (!fCam)
     86    MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam");
     87    if (!cam)
    10788        *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl;
    10889
    109     Clear();
     90    if (fSum)
     91        delete (fSum);
     92    fSum = new MCamDisplay(*cam, fNameEvt+";avg", fNameEvt+" Avarage");
    11093
    11194    return kTRUE;
     
    118101Bool_t MHCerPhotEvt::Fill(const MParContainer *par, const Stat_t w)
    119102{
    120     const MCerPhotEvt *evt = par ? (MCerPhotEvt*)par : fEvt;
     103    const MCamEvent *evt = par ? dynamic_cast<const MCamEvent*>(par) : fEvt;
    121104    if (!evt)
    122105    {
     
    124107        return kFALSE;
    125108    }
    126 
    127     const UInt_t n = evt->GetNumPixels();
    128 
    129     for (UInt_t idx=0; idx<n; idx++)
    130     {
    131         Float_t val;
    132         if (!evt->GetPixelContent(val, idx))
    133             continue;
    134 
    135         fSum[idx].SetPixelUsed();
    136         fSum[idx].AddNumPhotons(val);
    137     }
    138 
    139     fEntries++;
     109    fSum->AddCamContent(*evt);
    140110
    141111    return kTRUE;
     
    148118Bool_t MHCerPhotEvt::Finalize()
    149119{
    150     if (fEntries<1)
    151         *fLog << warn << "WARNING - " << GetDescriptor() << " doesn't contain entries." << endl;
    152     else
    153         fSum.Scale(fEntries);
     120    if (fSum->GetEntries()>0)
     121        fSum->Scale(1./fSum->GetEntries());
    154122    return kTRUE;
    155123}
    156 
     124/*
    157125// --------------------------------------------------------------------------
    158126//
     
    161129void MHCerPhotEvt::Draw(Option_t *)
    162130{
    163     if (!fCam)
     131    if (!fSum)
    164132    {
    165133        *fLog << warn << "WARNING - Cannot draw " << GetDescriptor() << ": No Camera Geometry available." << endl;
     
    169137    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 750, 600);
    170138    pad->SetBorderMode(0);
     139    //pad->Divide(1,1);
     140    //gPad->SetBorderMode(0);
    171141
    172142    AppendPad("");
     
    179149void MHCerPhotEvt::Paint(Option_t *option)
    180150{
    181     if (!fCam)
    182     {
    183         *fLog << warn << "WARNING - Cannot paint " << GetDescriptor() << ": No Camera Geometry available." << endl;
     151    if (!fSum)
    184152        return;
    185     }
    186153
    187     if (!fDispl)
    188         fDispl = new MCamDisplay(fCam);
     154    fSum->Paint();
     155}
     156*/
    189157
    190     fDispl->Fill(fSum);
    191     fDispl->Paint();
     158TH1 *MHCerPhotEvt::GetHistByName(const TString name)
     159{
     160    return fSum;
    192161}
  • trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.h

    r2173 r2206  
    66#endif
    77
    8 #ifndef MARS_MCerPhotEvt
    9 #include "MCerPhotEvt.h"
    10 #endif
    11 
    12 class TH1D;
    138class MCamDisplay;
     9class MCamEvent;
    1410
    1511class MHCerPhotEvt : public MH
    1612{
    1713private:
    18     MCerPhotEvt  fSum;      // storing the sum
    19     Int_t        fEntries;  // number of entries in the histogram
    20     MGeomCam    *fCam;      // the present geometry
    21     MCerPhotEvt *fEvt;      //! the current event
    22     MCamDisplay *fDispl;    //! the camera display
     14    MCamDisplay *fSum;      // storing the sum
     15    MCamEvent   *fEvt;      //! the current event
     16
     17    TString fNameEvt;
     18
     19    Bool_t SetupFill(const MParList *pList);
     20    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
     21    Bool_t Finalize();
    2322
    2423public:
     
    2625    ~MHCerPhotEvt();
    2726
    28     void Clear(const Option_t *o="");
     27    void SetNameEvt(const TString name) { fNameEvt = name; }
    2928
    30     Bool_t SetupFill(const MParList *pList);
    31     Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    32     Bool_t Finalize();
    33 
    34     TH1 *GetHistByName(const TString name) { return NULL; }
    35 
    36     const MCerPhotEvt &GetSum() const { return fSum; }
    37 
    38     void Draw(Option_t *opt="");
    39     void Paint(Option_t *option="");
     29    TH1 *GetHistByName(const TString name="");
    4030
    4131    ClassDef(MHCerPhotEvt, 1) // Histogram to sum camera events
Note: See TracChangeset for help on using the changeset viewer.