Changeset 13002 for trunk/Mars


Ignore:
Timestamp:
03/07/12 16:27:10 (13 years ago)
Author:
tbretz
Message:
Propagate the weight and allow to calculate the difference of two camera.
Location:
trunk/Mars/mhist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mhist/MHCamEvent.cc

    r12922 r13002  
    5151//   MHCamEvent myhist("Titele;;y [cm]");
    5252//
     53// Class Version 3:
     54// ----------------
     55//  + fNameSub
     56//
    5357/////////////////////////////////////////////////////////////////////////////
    5458#include "MHCamEvent.h"
     
    9195//
    9296MHCamEvent::MHCamEvent(const char *name, const char *title)
    93 : fSum(NULL), fErr(NULL), fEvt(NULL), fType(0), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
     97: fSum(NULL), fErr(NULL), fEvt(NULL), fSub(0), fType(0), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
    9498fThreshold(0), fUseThreshold(0)
    9599{
     
    104108//
    105109MHCamEvent::MHCamEvent(Int_t type, const char *name, const char *title)
    106 : fSum(NULL), fErr(NULL), fEvt(NULL), fType(type), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
     110: fSum(NULL), fErr(NULL), fEvt(NULL), fSub(0), fType(type), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
    107111fThreshold(0), fUseThreshold(0)
    108112{
     
    155159Bool_t MHCamEvent::SetupFill(const MParList *plist)
    156160{
    157     fEvt = (MCamEvent*)plist->FindObject(fNameEvt, "MCamEvent");
     161    fEvt = dynamic_cast<MCamEvent*>(plist->FindObject(fNameEvt, "MCamEvent"));
    158162    if (!fEvt)
    159163    {
     
    166170    }
    167171
     172    fSub = 0;
     173    if (!fNameSub.IsNull())
     174    {
     175        fSub = dynamic_cast<MCamEvent*>(plist->FindObject(fNameSub, "MCamEvent"));
     176        if (!fSub)
     177        {
     178            *fLog << err << GetDescriptor() << ": No " << fNameSub <<" [MCamEvent] available..." << endl;
     179            return kFALSE;
     180        }
     181        *fLog << inf << GetDescriptor() << ": Will subtract '" << fNameSub << "'" << endl;
     182    }
     183
    168184    fSum->Reset();
    169185
     
    209225    {
    210226    case kNoBound:
    211         fSum->AddCamContent(*evt, fType);
     227        if (fSub)
     228            fSum->AddCamDifference(*evt, *fSub, fType);
     229        else
     230            fSum->AddCamContent(*evt, fType, w);
    212231        break;
    213232
     
    226245
    227246    case kMeanShift:
    228         fSum->AddMeanShift(*evt, fType);
     247        fSum->AddMeanShift(*evt, fType, w);
    229248        break;
    230249
    231250    case kMedianShift:
    232         fSum->AddMedianShift(*evt, fType);
     251        fSum->AddMedianShift(*evt, fType, w);
    233252        break;
    234253
  • trunk/Mars/mhist/MHCamEvent.h

    r12922 r13002  
    1919    MHCamera  *fErr;       //! storing the err
    2020    MCamEvent *fEvt;       //! the current event
     21    MCamEvent *fSub;       //! the event to be subtracted
    2122
    2223    TString fNameEvt;      // Name of MCamEvent to fill into histogram
     24    TString fNameSub;      // Name of MCamEvent to fill into histogram
    2325    TString fNameGeom;     // Name of geometry container
    2426
     
    4951
    5052    void SetNameEvt(const TString name)  { fNameEvt = name; }
     53    void SetNameSub(const TString name)  { fNameSub = name; }
    5154    void SetNameGeom(const TString name) { fNameGeom = name; }
    5255    void SetType(Int_t type) { fType = type; }
     
    7376    void RecursiveRemove(TObject *obj);
    7477
    75     ClassDef(MHCamEvent, 2) // Histogram to sum camera events
     78    ClassDef(MHCamEvent, 3) // Histogram to sum camera events
    7679};
    7780
Note: See TracChangeset for help on using the changeset viewer.