Changeset 1132 for trunk/MagicSoft


Ignore:
Timestamp:
12/19/01 15:44:07 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1130 r1132  
    11                                                                  -*-*- END -*-*-
     2 2001/12/19: Thomas Bretz
     3 
     4   * mbase/MEvtLoop.cc:
     5     - added #ifdef directive to make it work on older root also
     6     
     7   * mbase/MReadTree.cc:
     8     - added #ifdef directive to get rid of the memory leak in prior
     9       root 3.02/* versions
     10
     11   * macros/MagicHillas.C, macros/readMagic.C, meventdisp/MGCamDisplay.cc,
     12     mmain/MAnalysis.cc:
     13     - changes MMcPedestalNSB to MMcPedestalNSBAdd
     14     
     15   * manalysis/MMcPedestalCopy.[h,cc], manalysis/MMcPedestalNSBAdd.[h,cc]:
     16     - reorganized ReInit, PreProcess.
     17     - moved some code from ReInit to PreProcess to make the code
     18       simpler. At the moment we don't intend to change the
     19       objects in the parlist while runtime.
     20
     21   * manalysis/MMcPedestalNSB.[h,cc]:
     22     - removed
     23
     24   * mbase/MReadMarsFile.cc:
     25     - read the first run header twice. To make it available in the
     26       PreProcess of all tasks
     27   
     28   * mbase/MTaskList.cc:
     29     - fixed a bug in the ReInit function. The ReInits where calles with
     30       a NULL-pointer
     31
     32
     33
    234 2001/12/18: Oscar Blanch
    335                                                                 
     
    2658     - remove fNumLoGainFadcSlices and fNumHiGainFadcSlices members
    2759     - fix bug of Pedestal and Pedestal fluctuaions correspondence.
    28 
    29  2001/12/19: Thomas Bretz
    30  
    31    * mbase/MEvtLoop.cc:
    32      - added #ifdef directive to make it work on older root also
    33      
    34    * mbase/MReadTree.cc:
    35      - added #ifdef directive to get rid of the memory leak in prior
    36        root 3.02/* versions
    3760
    3861
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h

    r1124 r1132  
    2323class MMcPedestalCopy : public MTask
    2424{
     25private:
     26    const MMcFadcHeader *fMcPed;
     27    MPedestalCam *fPedCam;
     28
     29    Bool_t CheckRunType(MParList *pList) const;
     30
    2531public:
    2632    MMcPedestalCopy(const char *name=NULL, const char *title=NULL);
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSB.h

    r1098 r1132  
    2727                   const char *name=NULL, const char *title=NULL);
    2828
    29     Bool_t PreProcess(MParList *pList);
     29    Bool_t ReInit(MParList *pList);
    3030
    3131    ClassDef(MMcPedestalNSB, 0)   // Task which adds the NSB fluctuations to the pedestals rms
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc

    r1130 r1132  
    7171//
    7272MMcPedestalNSBAdd::MMcPedestalNSBAdd(const Float_t difnsb,
    73                                const char *name, const char *title)
     73                                     const char *name, const char *title)
     74    : fDnsbPixel(difnsb)
    7475{
    7576    fName  = name  ? name  : "MMcPedestalNSBAdd";
     
    8283    AddToBranchList("fPedesMean");
    8384    AddToBranchList("fElecNoise");
    84 
    85     fDnsbPixel=difnsb;
     85}
     86
     87Bool_t MMcPedestalNSBAdd::CheckRunType(MParList *pList) const
     88{
     89    MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     90    if (!runheader)
     91    {
     92        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     93        return kTRUE;
     94    }
     95
     96    return runheader->GetRunType() == kRTMonteCarlo;
    8697}
    8798
     
    97108   // implemented then this line should be removed.
    98109
    99     ReInit(pList);   
     110    if (!CheckRunType(pList))
     111    {
     112        *fLog << warn << dbginf << "Warning - MMcPedestalNSB is for Monte Carlo files only... removing this task from list." << endl;
     113        return kSKIP;
     114    }
     115
     116    fFadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
     117    if (!fFadc)
     118    {
     119        *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;
     120        return kFALSE;
     121    }
     122
     123    fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
     124    if (!fGeom)
     125    {
     126        *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
     127        return kFALSE;
     128    }
     129
     130    fPedCam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
     131    if (!fPedCam)
     132        return kFALSE;
     133
     134    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
     135    if (!mcrunheader && fDnsbPixel < 0 )
     136    {
     137        *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() ";
     138        *fLog << "only allowed if MMcRunHeader is available... aborting." << endl;
     139        return kFALSE;
     140    }
    100141
    101142    return kTRUE;
     
    117158//   - MPedestalCam
    118159//
    119 Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList)
    120 {
    121 
    122     MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
    123     if (runheader)
    124     {
    125         if (runheader->GetRunType() != kRTMonteCarlo)
    126         {
    127             *fLog << warn << dbginf << "Warning - MMcPedestalNSB is for Monte Carlo files only... removing this task from list." << endl;
    128             return kSKIP;
    129         }
    130     }   
    131     else
    132         *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
    133 
    134 
    135     MMcFadcHeader *fadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
    136     if (!fadc)
    137     {
    138         *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;
    139         return kFALSE;
    140     }
    141 
    142 
     160Float_t MMcPedestalNSBAdd::GetDnsb(MParList *pList) const
     161{
    143162    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
    144163    if (!mcrunheader && fDnsbPixel < 0 )
     
    146165        *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() ";
    147166        *fLog << "only allowed if MMcRunHeader is available... aborting." << endl;
     167        return -1;
     168    }
     169
     170    if (!mcrunheader)
     171        return fDnsbPixel;
     172
     173    if (fDnsbPixel >= 0 && fDnsbPixel != mcrunheader->GetNumPheFromDNSB())
     174    {
     175        *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrunheader->GetNumPheFromDNSB();
     176        *fLog <<" but you set up the diffuse NSB to " << fDnsbPixel << endl;
     177
     178        return fDnsbPixel;
     179    }
     180
     181    return mcrunheader->GetNumPheFromDNSB();
     182}
     183
     184Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList)
     185{
     186    if (!CheckRunType(pList))
    148187        return kFALSE;
    149     }
    150 
    151     if (mcrunheader)
    152     {
    153         if (fDnsbPixel >= 0 && fDnsbPixel != mcrunheader->GetNumPheFromDNSB())
    154         {
    155             *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrunheader->GetNumPheFromDNSB();
    156             *fLog <<" but you set up the diffuse NSB to " << fDnsbPixel << endl;
    157         }
    158         else
    159             fDnsbPixel = mcrunheader->GetNumPheFromDNSB();
    160     }
    161 
    162     fDnsbPixel *= 50.0/15.0;
    163 
    164 
    165     MGeomCam *geometry = (MGeomCam*)pList->FindObject("MGeomCam");
    166     if (!geometry)
    167     {
    168         *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
    169         return kFALSE;
    170     }
    171 
    172 
    173     MPedestalCam *pedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    174     if (!pedestals)
    175         return kFALSE;
    176 
    177 
    178     const int num = fadc->GetNumPixel();
     188
     189    Float_t dnsbpix = GetDnsb(pList) * 50.0/15.0;
     190
     191    if (dnsbpix < 0)
     192        return kFALSE;
     193
     194    const int num = fFadc->GetNumPixel();
    179195   
    180     pedestals->InitSize(num);
    181 
    182     const Float_t size0 = (*geometry)[0].GetR()*(*geometry)[0].GetR();
     196    fPedCam->InitSize(num);
     197
     198    const Float_t size0 = (*fGeom)[0].GetR() * (*fGeom)[0].GetR();
    183199
    184200    for (int i=0; i<num; i++)
    185201    {
    186         MPedestalPix &pix     = (*pedestals)[i];
    187         MGeomPix     &pixgeom = (*geometry)[i];
     202        MPedestalPix &pix     = (*fPedCam)[i];
     203        MGeomPix     &pixgeom = (*fGeom)[i];
    188204
    189205        const Float_t pedrms  = pix.GetSigma();
    190206        const Float_t size    = pixgeom.GetR()*pixgeom.GetR()/size0;
    191207
    192         const Float_t ampl    = fadc->GetAmplitud();
    193 
    194         pix.SetSigma(sqrt(pedrms*pedrms + fDnsbPixel*ampl*ampl*size));
     208        const Float_t ampl    = fFadc->GetAmplitud();
     209
     210        pix.SetSigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl*size));
    195211    }
    196212
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h

    r1126 r1132  
    1616
    1717class MMcFadcHeader;
     18class MGeomCam;
    1819class MPedestalCam;
    19 class MRawRunHeader;
    20 class MMcRunHeader;
    2120
    2221class MMcPedestalNSBAdd : public MTask
    2322{
     23private:
     24    MMcFadcHeader *fFadc;
     25    const MGeomCam *fGeom;
     26    MPedestalCam *fPedCam;
    2427
    2528    Float_t fDnsbPixel;
    2629
     30    Bool_t CheckRunType(MParList *pList) const;
     31    Float_t GetDnsb(MParList *pList) const;
     32
    2733public:
    2834    MMcPedestalNSBAdd(const Float_t difnsb = -1.0,
    29                    const char *name=NULL, const char *title=NULL);
     35                      const char *name=NULL, const char *title=NULL);
    3036
    3137    Bool_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc

    r1114 r1132  
    138138        return kFALSE;
    139139
     140    if (!fRun->Process())
     141        return kFALSE;
     142
     143    fRun->SetEventNum(0);
     144
    140145    return MReadTree::PreProcess(pList);
    141146}
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1118 r1132  
    234234        *fLog << all << task->GetName() << "... " << flush;
    235235
    236         if (!task->ReInit(pList?fParList:pList))
     236        if (!task->ReInit(pList?pList:fParList))
    237237            return kFALSE;
    238238    }
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc

    r1102 r1132  
    2525#include "MGCamDisplay.h"
    2626
    27 #include <TList.h>            // TList::Add
    28 #include <TCanvas.h>          // TCanvas::cd
    29 #include <TGButton.h>         // TGPictureButton
    30 #include <TGButtonGroup.h>    // TGVButtonGroup
    31 
    32 #include "MGTask.h"           // MGTask::CreateGui
    33 #include "MClone.h"           // MClone
    34 #include "MHillas.h"          // MHillas
    35 #include "MParList.h"         // MParList::AddToList
    36 #include "MEvtLoop.h"         // MEvtLoop::GetParList
    37 #include "MTaskList.h"        // MTaskList::AddToList
    38 #include "MCamDisplay.h"      // MCamDisplay
    39 #include "MHillasCalc.h"      // MHillasCalc
    40 #include "MPedestalCam.h"     // MPedestalCam
    41 #include "MCerPhotCalc.h"     // MCerPhotCalc
    42 #include "MMcPedestalCopy.h"  // MMcPedestalCopy
    43 #include "MMcPedestalNSB.h"   // MMcPedestalNSB
    44 #include "MImgCleanStd.h"     // MImgCleanStd
    45 #include "MGeomCamMagic.h"    // MGeomMagicCam
     27#include <TList.h>               // TList::Add
     28#include <TCanvas.h>             // TCanvas::cd
     29#include <TGButton.h>            // TGPictureButton
     30#include <TGButtonGroup.h>       // TGVButtonGroup
     31
     32#include "MGTask.h"              // MGTask::CreateGui
     33#include "MClone.h"              // MClone
     34#include "MHillas.h"             // MHillas
     35#include "MParList.h"            // MParList::AddToList
     36#include "MEvtLoop.h"            // MEvtLoop::GetParList
     37#include "MTaskList.h"           // MTaskList::AddToList
     38#include "MCamDisplay.h"         // MCamDisplay
     39#include "MHillasCalc.h"         // MHillasCalc
     40#include "MPedestalCam.h"        // MPedestalCam
     41#include "MCerPhotCalc.h"        // MCerPhotCalc
     42#include "MMcPedestalCopy.h"     // MMcPedestalCopy
     43#include "MMcPedestalNSBAdd.h"   // MMcPedestalNSBAdd
     44#include "MImgCleanStd.h"        // MImgCleanStd
     45#include "MGeomCamMagic.h"       // MGeomMagicCam
    4646
    4747ClassImp(MGCamDisplay);
     
    115115    MParList  *plist = GetParList();
    116116
    117     MMcPedestalCopy *pcopy = new MMcPedestalCopy;
    118     MMcPedestalNSB  *pdnsb = new MMcPedestalNSB;
    119     MCerPhotCalc    *ncalc = new MCerPhotCalc;
    120     MClone          *clone = new MClone("MCerPhotEvt");
    121     MImgCleanStd    *clean = new MImgCleanStd;
    122     MHillasCalc     *hcalc = new MHillasCalc;
     117    MMcPedestalCopy   *pcopy = new MMcPedestalCopy;
     118    MMcPedestalNSBAdd *pdnsb = new MMcPedestalNSBAdd;
     119    MCerPhotCalc      *ncalc = new MCerPhotCalc;
     120    MClone            *clone = new MClone("MCerPhotEvt");
     121    MImgCleanStd      *clean = new MImgCleanStd;
     122    MHillasCalc       *hcalc = new MHillasCalc;
    123123
    124124    tlist->AddToList(pcopy);
  • trunk/MagicSoft/Mars/mmain/MAnalysis.cc

    r1103 r1132  
    126126#include "MHStarMap.h"
    127127#include "MReadMarsFile.h"
    128 #include "MMcPedestalCopy.h"  // MMcPedestalCopy
    129 #include "MMcPedestalNSB.h"   // MMcPedestalNSB
     128#include "MMcPedestalCopy.h"     // MMcPedestalCopy
     129#include "MMcPedestalNSBAdd.h"   // MMcPedestalNSB
    130130#include "MCerPhotCalc.h"
    131131#include "MImgCleanStd.h"
     
    181181    MReadMarsFile read("Events", fInputFile);
    182182
    183     MMcPedestalCopy pcopy;
    184     MMcPedestalNSB  pdnsb;
    185     MCerPhotCalc    ncalc;
    186     MHillasCalc     hcalc;
     183    MMcPedestalCopy    pcopy;
     184    MMcPedestalNSBAdd  pdnsb;
     185    MCerPhotCalc       ncalc;
     186    MHillasCalc        hcalc;
    187187
    188188    tlist.AddToList(&read);
Note: See TracChangeset for help on using the changeset viewer.