Changeset 706 for trunk/MagicSoft


Ignore:
Timestamp:
03/27/01 16:05:54 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r704 r706  
    44                                                                 
    55   * manalysis/MHillas.[h,cc]:
    6      fixed some minor errors, added sanity check (N<2) to Calc
     6     - fixed some minor errors, added sanity check (N<2) to Calc
    77
    88   * manalysis/MFillHHillas.cc:
    9      skip event if Hillas calculations fails
    10 
     9     - skip event if Hillas calculations fails
     10     
     11   * macros/getCollArea.C, macros/readMagic.C,
     12     mdatacheck/MViewAdcSpectra.cc, meventdisp/MGFadcDisp.cc:
     13     - changed order in MReadTree constructor
     14
     15   * manalysis/MCT1ReadAscii.[h,cc]:
     16     - changed to use MPedestalCam
     17     
     18   * manalysis/Makefile:
     19     - removed MCT1Pedestals
     20     
     21   * mbase/BaseLinkDef.h:
     22     - added const values from Magic.h
     23     
     24   * mbase/MLogManip.h:
     25     - changed style of dbginf
     26   
     27   * mbase/MParList.cc:
     28     - make use of dbginf
     29     
     30   * mbase/MReadTree.[h,cc]:
     31     - switched from a TTree to a TChain object
     32     - chnaged order of variables of the constructor
     33     
    1134     
    1235 2000/03/21: Thomas Bretz
  • trunk/MagicSoft/Mars/NEWS

    r704 r706  
    33 
    44    * Hillas Calculation added
     5   
     6    * MReadTree is now able to handle more than one file
     7      (Remark: of the same structure)
    58   
    69   
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r705 r706  
    1414
    1515    MReadTree    read("Events", "oscar_protons.root");
    16     MReadTree    read.AddFile("test.root");
    1716    MCerPhotCalc ncalc;
    1817    MImgCleanStd clean;
  • trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc

    r695 r706  
    1010
    1111#include "MHillas.h"
     12#include "MCerPhotEvt.h"
    1213
    1314#include "MLog.h"
     
    4748Bool_t MHillasCalc::Process()
    4849{
    49     fHillas->Calc(*fGeomCam, *fCerPhotEvt);
    50 
    51     return kTRUE;
     50    //
     51    // If you want do complex descisions inside the calculations
     52    // we must move the calculation code inside this function
     53    //
     54    // If the calculation wasn't sucessfull skip this event
     55    //
     56    return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE;
    5257}
    5358
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r666 r706  
    1818
    1919#include <TFile.h>
    20 #include <TTree.h>
     20#include <TChain.h>
    2121#include <TObjArray.h>
    2222
    2323#include "MLog.h"
     24#include "MLogManip.h"
     25
    2426#include "MTime.h"
    2527#include "MParList.h"
     
    2729ClassImp(MReadTree)
    2830
    29 MReadTree::MReadTree(const char *fname, const char *tname,
     31MReadTree::MReadTree(const char *tname, const char *fname,
    3032                     const char *name, const char *title)
    3133{
     
    3638    // open the input stream
    3739    //
    38     fFileName = fname;
    39     fTreeName = tname;
     40    fChain = new TChain(tname);
     41
     42    if (fname)
     43        fChain->Add(fname);
     44}
     45
     46MReadTree::~MReadTree()
     47{
     48    delete fChain;
     49}
     50
     51/*Int_t*/ void MReadTree::AddFile(const char *fname)
     52{
     53    //
     54    // FIXME! A check is missing whether the file already exists or not.
     55    //
     56    //
     57    // returns the number of file which were added
     58    //
     59    /*return  root >3.0*/ fChain->Add(fname);
    4060}
    4161
     
    4565    // open file and check if file is really open
    4666    //
    47     fFile = new TFile(fFileName, "READ");
    48 
    49     if (!fFile->IsOpen())
    50     {
    51         *fLog << "MReadTree::PreProcess: ERROR: Cannot open file '";
    52         *fLog << fFileName << "'" << endl;
    53         return kFALSE;
    54     }
    55 
    56     //
    57     // try to get the tree and check if it was found
    58     //
    59     fTree = (TTree*)fFile->Get(fTreeName);
    60     if (!fTree)
    61     {
    62         *fLog << "MReadTree::PreProcess: ERROR: Cannot open tree '";
    63         *fLog << fTreeName << "'" << endl;
    64         return kFALSE;
    65     }
    6667
    6768    //
    6869    // get number of events in this tree
    6970    //
    70     fNumEntries = (UInt_t)fTree->GetEntries();
     71    fNumEntries = (UInt_t)fChain->GetEntries();
     72
     73    if (!fNumEntries)
     74    {
     75        *fLog << dbginf << "No Entries found in chain (file/s)." << endl;
     76        return kFALSE;
     77    }
    7178
    7279    //
     
    7885    // output logging information
    7986    //
    80     *fLog << "File: '" << fFileName << "'  Tree: '" << fTreeName;
    81     *fLog << "' with " << fNumEntries << " Entries opened." << endl;
     87    *fLog << fNumEntries << " Entries found in file(s)." << endl;
    8288
    8389    //
     
    8591    // create the Iterator to loop over all branches
    8692    //
    87     TIter Next(fTree->GetListOfBranches());
     93    TIter Next(fChain->GetListOfBranches());
    8894    TBranch *branch=NULL;
    8995   
     
    102108        //
    103109        MParContainer *pcont = pList->FindCreateObj(name);
     110       
    104111
    105112        if (!pcont)
     
    134141    // get entry
    135142    //
    136     fTree->GetEntry(fNumEntry );
     143    fChain->GetEntry(fNumEntry );
    137144
    138145    fNumEntry ++ ;
     
    146153    // Close File
    147154    //
    148     fFile->Close();
     155    //fFile->Close();
    149156
    150157    return kTRUE;
     
    156163    // Get the Event with the current EventNumber fNumEntry
    157164    //
    158     fTree->GetEntry(fNumEntry);
     165    fChain->GetEntry(fNumEntry);
    159166
    160167    return kTRUE;
  • trunk/MagicSoft/Mars/mdatacheck/MHHillas.cc

    r698 r706  
    1111#include <TH1.h>
    1212#include <TPad.h>
     13#include <TCanvas.h>
    1314
    1415#include "MHillas.h"
     
    3637    //
    3738    fAlpha  = new TH1F("Alpha [deg]", "Alpha of Hillas",   90, 0,  90);
    38     fWidth  = new TH1F("Width [mm]",  "Width of Hillas",  150, 0, 150);
    39     fLength = new TH1F("Length [mm]", "Length of Hillas", 150, 0, 150);
    40     fDist   = new TH1F("Dist [mm]",   "Dist of Hillas",   200, 0, 200);
     39    fWidth  = new TH1F("Width [mm]",  "Width of Hillas",  100, 0, 300);
     40    fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300);
     41    fDist   = new TH1F("Dist [mm]",   "Dist of Hillas",   100, 0, 300);
    4142}
    4243
     
    5152void MHHillas::Fill(MHillas *par)
    5253{
    53     fAlpha ->Fill(par->GetAlpha());
     54    fAlpha ->Fill(fabs(par->GetAlpha()));
    5455    fWidth ->Fill(par->GetWidth());
    5556    fLength->Fill(par->GetLength());
     
    5758}
    5859
    59 #include <TCanvas.h>
    6060void MHHillas::Draw(Option_t *)
    6161{
    6262
     63    //
     64    // Fixme! Check for an existing canvas.
     65    // And create one if no canvas exists only!
     66    //
    6367    TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters");
    6468    c->Divide(2,2);
  • trunk/MagicSoft/Mars/mgui/MGMarsMain.h

    r698 r706  
    2626  //  the things for the menu bar
    2727   
    28   TGMenuBar         *fMenuBar ;
    29   TGPopupMenu       *fFileMenu ;
    30   TGLayoutHints     *fLayMenuBar, *fLayMenuItem ;
     28  TGMenuBar          *fMenuBar ;
     29  TGPopupMenu        *fFileMenu ;
     30  TGLayoutHints      *fLayMenuBar;
     31  TGLayoutHints      *fLayMenuItem ;
    3132  TGHorizontal3DLine *fLineSep ;
    3233
     
    4041  //   the object in the top part of the frame
    4142 
    42   TGPictureButton *fPicMagic, *fPicMars ;
     43  TGPictureButton  *fPicMagic;
     44  TGPictureButton  *fPicMars ;
    4345 
    4446  //   the object in the low part of the frame
    4547 
    46   TGVerticalFrame  *fTabF1, *fTabF2 ;
     48  TGVerticalFrame  *fTabF1;
     49  TGVerticalFrame  *fTabF2 ;
    4750 
    48   TGTextButton     *fButEvtDisp, *fButDataCheck, *fButAnalys, *fButMonteCarlo ;
     51  TGTextButton     *fButEvtDisp;
     52  TGTextButton     *fButDataCheck;
     53  TGTextButton     *fButAnalys;
     54  TGTextButton     *fButMonteCarlo ;
    4955  TGLayoutHints    *fButLayout ;
    5056 
  • trunk/MagicSoft/Mars/mgui/MGMonteCarloMain.cc

    r571 r706  
    2727MGMonteCarloMain::MGMonteCarloMain(const TGWindow *p, const TGWindow *main,
    2828                            UInt_t w, UInt_t h )
    29         : TGTransientFrame(p, main, w, h ) 
     29        : TGTransientFrame(p, main, w, h )
    3030{
    3131  //
     
    222222  //   Checks if there is a selected input root file
    223223   
    224   if ( strcmp ( fInputFile, "\n") == 0 )
    225     {
    226       return ( kFALSE ) ;
    227     }
    228  
    229   return (kTRUE) ;
     224    return strcmp ( fInputFile, "\n") == 0 ? kFALSE : kTRUE;
    230225}
    231226
  • trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.cc

    r686 r706  
    2323 
    2424  fMcEvt  = (MMcEvt*)pList->FindCreateObj("MMcEvt") ;
    25   if (!fMcEvt) {
    26     *fLog << dbginf << " Error: MMcEvt not found... exit." << endl;
     25  if (!fMcEvt)
    2726    return kFALSE;
    28   }
    2927
    3028  fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig") ;
    31   if (!fMcTrig) {
    32     *fLog << dbginf << " Error: MMcTrig not found... exit." << endl;
     29  if (!fMcTrig)
    3330    return kFALSE;
    34   }
    3531
    3632  fCollArea = (MCollArea*)pList->FindCreateObj("MCollArea") ;
    37   if (!fCollArea) {
    38     *fLog << dbginf << " Error: MCollArea not found... exit." << endl;
     33  if (!fCollArea)
    3934    return kFALSE;
    40   }
    4135
    4236  return kTRUE ;
Note: See TracChangeset for help on using the changeset viewer.