Changeset 1035 for trunk


Ignore:
Timestamp:
11/06/01 13:44:26 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc

    r1017 r1035  
    4343
    4444#include "MPedestalCam.h"
     45#include "MRawRunHeader.h"
    4546#include "MMcFadcHeader.hxx"
    4647
     
    5859Bool_t MMcPedestalCopy::PreProcess(MParList *pList)
    5960{
    60     fMcPedestals = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
    61     if (!fMcPedestals)
     61    MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     62    if (run)
     63    {
     64        if (run->GetRunType() != kRTMonteCarlo)
     65            return kTRUE;
     66    }
     67
     68    const MMcFadcHeader *mcped = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
     69    if (!mcped)
    6270    {
    6371        *fLog << dbginf << "MMcFadcHeader not found... aborting." << endl;
     
    6573    }
    6674
    67     fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
    68     if (!fPedestals)
     75    MPedestalCam *pedcam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
     76    if (!pedcam)
    6977        return kFALSE;
    7078
    71     return kTRUE;
    72 }
     79    const int num = mcped->GetNumPixel();
    7380
    74 Bool_t MMcPedestalCopy::Process()
    75 {
    76     const int num = fMcPedestals->GetNumPixel();
    77 
    78     fPedestals->InitSize(num);
     81    pedcam->InitSize(num);
    7982
    8083    for (int i=0; i<num; i++)
    8184    {
    82         MPedestalPix &pix = (*fPedestals)[i];
     85        MPedestalPix &pix = (*pedcam)[i];
    8386
    84         const Float_t pedest = fMcPedestals->GetPedestal(i);
    85         const Float_t pedrms = fMcPedestals->GetPedestalRms(i);
     87        const Float_t pedest = mcped->GetPedestal(i);
     88        const Float_t pedrms = mcped->GetPedestalRms(i);
    8689
    8790        const Float_t sigma  = pedest*sqrt(num);
    88         const Float_t sigrms = sigma/sqrt(2*num);
     91        const Float_t sigrms = sigma/sqrt(num*2);
    8992
    9093        pix.SetPedestal(pedest, sigma);
    9194        pix.SetPedestalRms(pedrms, sigrms);
    92 
    93         *fLog << pedest << " " << sigma << " " << pedrms << " " << sigrms << endl;
    9495    }
    9596
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h

    r1017 r1035  
    2323class MMcPedestalCopy : public MTask
    2424{
    25     const MMcFadcHeader *fMcPedestals;  //
    26           MPedestalCam  *fPedestals;    //
    27 
    28           TString       *fSrc;
     25    TString *fSrc;
    2926
    3027public:
     
    3229
    3330    Bool_t PreProcess(MParList *pList);
    34     Bool_t Process();
    3531
    3632    ClassDef(MMcPedestalCopy, 0)   // Task which copies the pedestals from the MC into the standard container
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r1018 r1035  
    3535
    3636#pragma link C++ class MReadTree+;
     37#pragma link C++ class MReadMarsFile+;
    3738
    3839#pragma link C++ class MRootFileBranch+;
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r1032 r1035  
    5454#include <fstream.h>
    5555
     56#include <TFile.h>           // TFile::GetName
    5657#include <TChain.h>
    5758#include <TGProgressBar.h>
     
    8687    fVetoList->SetOwner();
    8788
     89    fNotify = new TOrdCollection;
     90
    8891    //
    8992    // open the input stream
    9093    //
    9194    fChain = new TChain(tname);
     95    fChain->SetNotify(this);
    9296
    9397    if (fname)
     
    115119    //
    116120    delete fChain;
     121    delete fNotify;
    117122    delete fVetoList;
     123}
     124
     125void MReadTree::SetOwner(Bool_t flag)
     126{
     127    flag ? fNotify->SetBit(kIsOwner) : fNotify->ResetBit(kIsOwner);
     128}
     129
     130Bool_t MReadTree::Notify()
     131{
     132    fNotify->ForEach(TObject, Notify)();
     133    return kTRUE;
    118134}
    119135
     
    464480    fVetoList->Add(branch);
    465481}
     482
     483const char *MReadTree::GetFileName() const
     484{
     485    return fChain->GetFile()->GetName();
     486}
     487
     488void MReadTree::AddNotify(TObject *obj)
     489{
     490    fNotify->Add(obj);
     491}
  • trunk/MagicSoft/Mars/mbase/MReadTree.h

    r1030 r1035  
    2222
    2323    TOrdCollection *fVetoList; // List of Branches which are not allowed to get enabled
     24    TOrdCollection *fNotify;   // List of TObjects to notify when switching files
    2425
    2526    TGProgressBar  *fProgress; // Possible display of status
     
    3233    void EnableBranchChoosing();
    3334
    34     Bool_t PreProcess(MParList *pList);
    35     Bool_t Process();
    36  
     35    enum { kIsOwner = BIT(14) };
     36
    3737public:
    3838    MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL);
    3939    ~MReadTree();
    4040
    41     Int_t  AddFile(const char *fname);
    4241    void   DisableAutoScheme() { fAutoEnable = kFALSE; }
    4342    void   EnableBranch(const char *name);
     
    5554    UInt_t GetEntries() const  { return fNumEntries; }
    5655
     56    const char *GetFileName() const;
     57
     58    virtual void   AddNotify(TObject *obj);
     59    virtual void   SetOwner(Bool_t flag=kTRUE);
     60
     61    virtual Int_t  AddFile(const char *fname);
     62
     63    virtual Bool_t PreProcess(MParList *pList);
     64    virtual Bool_t Process();
     65
     66    virtual Bool_t Notify();
     67
    5768    ClassDef(MReadTree, 0)      // Reads a tree from file(s)
    5869};
  • trunk/MagicSoft/Mars/mbase/Makefile

    r1018 r1035  
    4040           MEvtLoop.cc \
    4141           MReadTree.cc \
     42           MReadMarsFile.cc \
    4243           MWriteFile.cc \
    4344           MWriteAsciiFile.cc \
Note: See TracChangeset for help on using the changeset viewer.