Changeset 5844


Ignore:
Timestamp:
01/14/05 15:58:24 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5843 r5844  
    3535
    3636
     37
    3738 2005/01/14 Thomas Bretz
    3839 
     
    4243   * manalysis/MGeomApply.cc:
    4344     - removed some old code already in comments
     45     - added possibility to switch off automatic processing (used
     46       if two different geometries around)
    4447
    4548   * manalysis/MMultiDimDistCalc.cc, mhbase/MHMatrix.[h,cc],
  • trunk/MagicSoft/Mars/manalysis/MGeomApply.cc

    r5832 r5844  
    4747//  specified in the constructor. The default geometry is
    4848//  MGeomCamMagic.
     49//
     50// In a standard setup all containers in the parameter list which derive
     51// from MCamEvent are processed automatically in ReInit. To allow having
     52// two parallel geometries in the parameter list or for MCamEvent in the
     53// parameter list you can switch off the automatic procedure by adding
     54// the containers to be processed using AddCamEvent().
     55//
    4956//
    5057//  Input Containers:
    5158//   [MGeomCam]
     59//   [all MCamEvent]
    5260//
    5361//  Output Containers:
    54 //   [MPedestalCam]
    55 //   [MCalibrationChargeCam]
    56 //   [MCalibrationRelTimeCam]
    57 //   [MCalibrationQECam]
    58 //   [MCalibrationPedCam]
    59 //   [MPedPhotCam]
    60 //   [MExtractedSignalCam]
    61 //   [MArrivalTime]
    62 //   [MArrivalTimeCam]
     62//   [all MCamEvent]
    6363//
    6464//////////////////////////////////////////////////////////////////////////////
     
    6767#include <fstream>
    6868
     69#include <TObjString.h>
     70
    6971#include "MLog.h"
    7072#include "MLogManip.h"
     
    7375
    7476#include "MGeomCam.h"
    75 #include "MPedestalCam.h"
    76 #include "MCalibrationCam.h"
    77 #include "MPedPhotCam.h"
    78 #include "MExtractedSignalCam.h"
    79 #include "MArrivalTimeCam.h"
    80 #include "MArrivalTime.h"
    81 #include "MBadPixelsCam.h"
     77#include "MCamEvent.h"
    8278
    8379ClassImp(MGeomApply);
     
    8985//  Default constructor. MGeomCamMagic is the default geometry.
    9086//
    91 MGeomApply::MGeomApply(const char *name, const char *title) : fGeomName("MGeomCamMagic")
     87MGeomApply::MGeomApply(const char *name, const char *title)
     88    : fGeomName("MGeomCamMagic"), fNamesList(0), fList(0)
    9289{
    9390    fName  = name  ? name  : "MGeomApply";
    9491    fTitle = title ? title : "Task to apply geometry settings";
     92}
     93
     94// --------------------------------------------------------------------------
     95//
     96//  Delete fList if available.
     97//
     98MGeomApply::~MGeomApply()
     99{
     100    if (fList)
     101        delete fList;
     102    if (fNamesList)
     103        delete fNamesList;
    95104}
    96105
     
    109118
    110119    return cam ? kTRUE : kFALSE;
     120}
     121
     122// --------------------------------------------------------------------------
     123//
     124//  Check the whole parameter list for MCamEvent. For all MCamEvent
     125//  MCamEvent::Init(MGeomCam&) is called.
     126//
     127void MGeomApply::ProcessAutomatic(MParList &list, const MGeomCam &geom) const
     128{
     129    TIter Next(list);
     130    TObject *o = 0;
     131
     132    while ((o=Next()))
     133    {
     134        MCamEvent *cam = dynamic_cast<MCamEvent*>(o);
     135        if (cam)
     136            cam->Init(geom);
     137    }
     138}
     139
     140// --------------------------------------------------------------------------
     141//
     142//  Check all containers in fNamesList and fList. For all MCamEvent
     143//  MCamEvent::Init(MGeomCam&) is called.
     144//
     145Bool_t MGeomApply::ProcessManual(MParList &list, const MGeomCam &geom) const
     146{
     147    TIter NextN(fNamesList);
     148    TObject *o = 0;
     149
     150    while ((o=NextN()))
     151    {
     152        TObject *cont = list.FindObject(o->GetName(), "MCamEvent");
     153        if (!cont)
     154        {
     155            *fLog << err << o->GetName() << " [MCamEvent] not found... abort." << endl;
     156            return kFALSE;
     157        }
     158
     159        MCamEvent *cam = dynamic_cast<MCamEvent*>(o);
     160        cam->Init(geom);
     161    }
     162
     163    TIter NextL(fList);
     164    while ((o=NextL()))
     165    {
     166        MCamEvent *cam = dynamic_cast<MCamEvent*>(o);
     167        cam->Init(geom);
     168    }
     169
     170    return kTRUE;
    111171}
    112172
     
    130190    geom->CalcPixRatio();
    131191
    132     TIter Next(*pList);
    133     TObject *o = 0;
    134 
    135     while ((o=Next()))
    136     {
    137         MCamEvent *cam = dynamic_cast<MCamEvent*>(o);
    138         if (cam)
    139             cam->Init(*geom);
    140     }
     192    if (fList)
     193        return ProcessManual(*pList, *geom);
     194
     195    ProcessAutomatic(*pList, *geom);
    141196
    142197    return kTRUE;
     
    160215    out << fGeomName << "\");" << endl;
    161216}
     217
     218// --------------------------------------------------------------------------
     219//
     220// Add a MCamEvent to be processed. This switches off the automatic
     221// processing of all MCamEvent in the parameter list completely!
     222//
     223void MGeomApply::AddCamEvent(TObject *obj)
     224{
     225    if (!obj->InheritsFrom(MCamEvent::Class()))
     226    {
     227        *fLog << warn << "MGeomApply::AddCamEvent - WARNING: Object doesn't inherit from MCamEvent... ignored." << endl;
     228        return;
     229    }
     230
     231    if (!fList)
     232    {
     233        fList = new TList;
     234        fNamesList = new TList;
     235
     236        fNamesList->SetOwner();
     237    }
     238
     239    fList->Add(obj);
     240}
     241
     242// --------------------------------------------------------------------------
     243//
     244// Add a MCamEvent to be processed. This switches off the automatic
     245// processing of all MCamEvent in the parameter list completely!
     246//
     247void MGeomApply::AddCamEvent(const char *name)
     248{
     249    if (!fList)
     250    {
     251        fList = new TList;
     252        fNamesList = new TList;
     253
     254        fNamesList->SetOwner();
     255    }
     256
     257    fNamesList->Add(new TObjString(name));
     258}
  • trunk/MagicSoft/Mars/manalysis/MGeomApply.h

    r2899 r5844  
    77
    88class MParList;
     9class MGeomCam;
    910
    1011class MGeomApply : public MTask
     
    1213private:
    1314    TString fGeomName; // Name of geometry class
     15
     16    TList *fNamesList;
     17    TList *fList;
     18
     19    void ProcessAutomatic(MParList &plist, const MGeomCam &geom) const;
     20    Bool_t ProcessManual(MParList &plist, const MGeomCam &geom) const;
    1421
    1522    Int_t  PreProcess(MParList *plist);
     
    1926public:
    2027    MGeomApply(const char *name=NULL, const char *title=NULL);
     28    ~MGeomApply();
    2129
    2230    void SetGeometry(TString geom) { fGeomName = geom; }
     31
     32    void AddCamEvent(TObject *obj);
     33    void AddCamEvent(const char *name);
    2334
    2435    ClassDef(MGeomApply, 0) // Task to apply geometry settings
Note: See TracChangeset for help on using the changeset viewer.