Changeset 855


Ignore:
Timestamp:
07/05/01 13:23:12 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r852 r855  
    11                                                                  -*-*- END -*-*-
    22
     3 2001/07/05: Thomas Bretz
     4
     5   * macros/CT1Hillas.C:
     6     - changed the wrong pointers to dots.
     7     
     8   * macros/getThreshold.C:
     9     - added some comments
     10     - removed the canvas creation
     11     - drawing replaced by a loop
     12     - changed trigger conditions to 1 (should work with any MC file)
     13     
     14   * macros/readMagic.C:
     15     - changed the event counter to the number of the event in the file
     16     - removed icound
     17     
     18   * manalysis/MPedCalcPedRun.cc, manalysis/MCerPhotCalc.cc,
     19     mbase/MParContainer.cc, mbase/MParContainer.h, mbase/MParList.cc,
     20     mbase/MParList.h, mbase/MTaskList.cc, mbase/MWriteAsciiFile.cc,
     21     mbase/MWriteRootFile.cc, mhist/MFillHFadc.cc, mhist/MFillHHillas.cc,
     22     mhist/MFillHStarMap.cc,
     23     - changed HasChanged to ReadyToSave
     24     
     25   * mbase/MReadTree.cc:
     26     - added some comments
     27     
     28   * mhist/MHMcEnergies.h:
     29     - fixed bug in []-operator
     30     
     31   * mhist/MHMcEnergy.cc:
     32     - added canvas creation to draw function
     33   
     34   * mmontecarlo/MMcThresholdCalc.cc:
     35     - fixed a bug in the constructor
     36 
     37 
     38 
    339 2001/06/20: Thomas Bretz
    440 
  • trunk/MagicSoft/Mars/macros/getThreshold.C

    r851 r855  
    1 void getThreshold( char* filename = "/hdb1/users/jlopez/temp_loop.root")
     1void getThreshold( char* filename = "data/oscar_protons.root")
    22{
     3    //
    34    // This macro fill the container MMcEnerThre using the task
    45    // MMcEnerThreCalc and shows the results.
     6    //
     7    MParList  parlist;
    58
    6     MParList parlist;
    79    MTaskList tasklist;
     10    parlist.AddToList(&tasklist);
    811
     12    //
    913    // Setup the parameter list
    1014    // - You need create the container MMcEnerThre.
    1115    //    + You need to put the number of trigger conditions when
    12     //      you declarete the MMcEnerThre
    13     //    + If you don't put any dimension to MMcEnerThre it works
     16    //      you declarete the MHMcEnergies
     17    //    + If you don't put any dimension to MHMcEnergies it works
    1418    //      taking only the trigger information from MMcTrig
    15     // - You can control the number of bins in the energy distribution
    16     //   histogram used to compute the energy threshold using
    17     //   the SetBins() function.
     19    //
     20    const UInt_t numtriggerconditions = 1;
    1821
    19     Int_t numtrigcond = 5;
    20     MHMcEnergies *hists = new MHMcEnergies(numtrigcond);
    21 
    22     parlist.AddToList(&tasklist);
     22    MHMcEnergies *hists = new MHMcEnergies(numtriggerconditions);
    2323    hists->AddEntriesToList(&parlist);
    2424
     25    //
    2526    // Setup the task list
    26     // - You need the read and the MMcEnerThreCalc tasks
     27    // - You need the read and the MMcThresholdCalc tasks
     28    // - You have to fill the histograms for the Energy threshold
    2729    //    + You need to put the number of trigger conditions when
    28     //      you declarete the MMcEnerThreCalc
    29     //    + If you don't put any dimension to MMcEnerThreCalc it works
    30     //      like one dimension MMcEnerThreCalc
    31 
    32     MReadTree read("Events", filename);
    33 
    34     MMcThresholdCalc tcalc(numtrigcond);
     30    //      you declarete the MMcThresholdCalc
     31    //    + If you don't put any dimension to MMcThresholdCalc it works
     32    //      like one dimension MMcThresholdCalc
     33    //
     34    MReadTree        read("Events", filename);
     35    MMcThresholdCalc calc(numtriggerconditions);
    3536
    3637    tasklist.AddToList(&read);
    37     tasklist.AddToList(&tcalc);
     38    tasklist.AddToList(&calc);
    3839
    3940    MEvtLoop evtloop;
    4041    evtloop.SetParList(&parlist);
    4142
     43    //
    4244    // Begin the loop
    43 
     45    //
    4446    evtloop.Eventloop();
    4547
     48    //
    4649    // Now you can display the results
    47 
    48     TCanvas *c;
    49 
    50     c=new TCanvas("c0","Energy distribution for triggered events", 50, 50, 850, 550);
    51     hists[0].Print();
    52     hists[0].Draw();
    53     c->Update();
    54 
    55     c= new TCanvas("c1","Energy distribution for triggered events", 50, 50, 850, 550);
    56     hists[1].Print();
    57     hists[1].Draw();
    58     c->Update();
    59 
    60     c= new TCanvas("c2","Energy distribution for triggered events", 50, 50, 850, 550);
    61     hists[2].Print();
    62     hists[2].Draw();
    63     c->Update();
    64 
    65     c= new TCanvas("c3","Energy distribution for triggered events", 50, 50, 850, 550);
    66     hists[3].Print();
    67     hists[3].Draw();
    68     c->Update();
    69 
    70     c= new TCanvas("c4","Energy distribution for triggered events", 50, 50, 850, 550);
    71     hists[4].Print();
    72     hists[4].Draw();
    73     c->Update();
     50    //
     51    for (UInt_t i=0; i<numtriggerconditions; i++)
     52        ((*hists)[i]).Draw();
    7453}
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r706 r855  
    3131    MCerPhotEvt &phevt = *(MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
    3232
    33     Int_t icount = 0 ;
    3433    MCamDisplay display(&geomcam) ;
    3534
    3635    while (read.Process())
    3736    {
    38         cout << "Event: " << icount++  << endl  ;
     37        cout << "Event #" << read.GetEventNum() ":" << endl;
    3938
    4039        ncalc.Process();
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc

    r842 r855  
    113113    }
    114114
    115     fCerPhotEvt->SetHasChanged();
     115    fCerPhotEvt->SetReadyToSave();
    116116
    117117    return kTRUE;
  • trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc

    r845 r855  
    9292    }
    9393
    94     fPedestals->SetHasChanged();
     94    fPedestals->SetReadyToSave();
    9595
    9696    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r851 r855  
    5151MParContainer::MParContainer(const MParContainer &named)
    5252{
    53     *fName = *(named.fName);
     53    *fName  = *(named.fName);
    5454    *fTitle = *(named.fTitle);
    5555
    5656    fLog = named.fLog;
    5757
    58     fHasChanged = named.fHasChanged;
     58    fReadyToSave = named.fReadyToSave;
    5959}
    6060
     
    7373    *fTitle = *(rhs.fTitle);
    7474
    75     fLog        = rhs.fLog;
    76     fHasChanged = rhs.fHasChanged;
     75    fLog         = rhs.fLog;
     76    fReadyToSave = rhs.fReadyToSave;
    7777
    7878    return *this;
     
    103103    *cont.fTitle = *fTitle;
    104104
    105     cont.fLog        = fLog;
    106     cont.fHasChanged = fHasChanged;
     105    cont.fLog         = fLog;
     106    cont.fReadyToSave = fReadyToSave;
    107107}
    108108
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r848 r855  
    3535
    3636protected:
    37     MLog    *fLog;        //! The general log facility for this object, initialized with the global object
     37    MLog    *fLog;         //! The general log facility for this object, initialized with the global object
    3838
    39     TString *fName;       //! parameter container identifier (name)
    40     TString *fTitle;      //! parameter container title
     39    TString *fName;        //! parameter container identifier (name)
     40    TString *fTitle;       //! parameter container title
    4141
    42     Bool_t   fHasChanged; //! should be set to true if the contents of the container is changed somehow
     42    Bool_t   fReadyToSave; //! should be set to true if the contents of the container is changed somehow
    4343
    4444public:
    45     MParContainer(const char *name="", const char *title="") : fLog(&gLog), fHasChanged(kFALSE) { Init(name, title); }
    46     MParContainer(const TString &name, const TString &title) : fLog(&gLog), fHasChanged(kFALSE) { Init(name, title); }
     45    MParContainer(const char *name="", const char *title="") : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
     46    MParContainer(const TString &name, const TString &title) : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
    4747    MParContainer(const MParContainer &named);
    4848    MParContainer& operator=(const MParContainer& rhs);
     
    6969    virtual void     Reset() {};
    7070
    71     virtual Bool_t HasChanged() { return fHasChanged; }
    72     virtual void   SetHasChanged(Bool_t flag=kTRUE) { fHasChanged=flag; }
     71    virtual Bool_t IsReadyToSave() { return fReadyToSave; }
     72    virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
    7373
    7474    virtual void AsciiRead(ifstream &fin);
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r852 r855  
    265265//   itself) to unchanged
    266266//
    267 void MParList::SetHasChanged(Bool_t flag)
     267void MParList::SetReadyToSave(Bool_t flag)
    268268{
    269269    TIter Next(&fContainer);
     
    275275    //
    276276    while ( (cont=(MParContainer*)Next()) )
    277         cont->SetHasChanged(flag);
    278 
    279     MParContainer::SetHasChanged(flag);
     277        cont->SetReadyToSave(flag);
     278
     279    MParContainer::SetReadyToSave(flag);
    280280}
    281281
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r843 r855  
    4545
    4646    void Reset();
    47     void SetHasChanged(Bool_t flag=kTRUE);
     47    void SetReadyToSave(Bool_t flag=kTRUE);
    4848
    4949    void Print(Option_t *t = NULL);
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r768 r855  
    3535// outside. It makes also possible to go back by decreasing the number.    //
    3636//                                                                         //
     37// If you don't want to start reading the first event you have to call     //
     38// MReadTree::SetEventNum after instantiating your MReadTree-object.       //
     39//                                                                         //
    3740/////////////////////////////////////////////////////////////////////////////
    3841
     
    178181        // the actual branch should be stored - enable branch.
    179182        //
     183        // FIXME: is it correct, that the pointer is deleted immediatly afterwards?
    180184        branch->SetAddress(&pcont);
    181185    }
     
    190194//  (Remark: The position can also be set by some member functions
    191195//  If the end of the file is reached the Eventloop is stopped.
     196//
    192197Bool_t MReadTree::Process()
    193198{
     
    267272// this function makes Process() read event number nr next
    268273//
    269 // Remark: You can use this function to set the event number from which
    270 //         you want to start reading.
     274// Remark: You can use this function after instatiating you MReadTree-object
     275//         to set the event number from which you want to start reading.
    271276//
    272277Bool_t MReadTree::SetEventNum(UInt_t nr)
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r851 r855  
    5959MTaskList::MTaskList(MTaskList &ts)
    6060{
    61   fTasks.AddAll(&ts.fTasks);
    62 }
    63 
    64 // --------------------------------------------------------------------------
    65 //
    66 //  create the Iterator over the tasklist
     61    fTasks.AddAll(&ts.fTasks);
     62}
     63
     64// --------------------------------------------------------------------------
     65//
     66//  Set the logging stream for the all tasks in the list and the tasklist
     67//  itself.
    6768//
    6869void MTaskList::SetLogStream(MLog *log)
    6970{
     71    //
     72    // create the Iterator over the tasklist
     73    //
    7074    TIter Next(&fTasks);
    7175
     
    167171{
    168172    //
    169     // Reset the HasChanged flag.
     173    // Reset the ReadyToSave flag.
    170174    // Reset all containers.
    171175    //
    172     fParList->SetHasChanged(kFALSE);
     176    // FIXME: To run a tasklist as a single task in another tasklist we
     177    //        have to make sure, that the Parameter list isn't reset.
     178    //
     179    fParList->SetReadyToSave(kFALSE);
    173180    fParList->Reset();
    174181
     
    231238
    232239    //
    233     // Reset the HasChanged flag.
     240    // Reset the ReadyToSave flag.
    234241    // Reset all containers.
    235242    //
    236     fParList->SetHasChanged(kFALSE);
     243    // FIXME: To run a tasklist as a single task in another tasklist we
     244    //        have to make sure, that the Parameter list isn't reset.
     245    //
     246    fParList->SetReadyToSave(kFALSE);
    237247    fParList->Reset();
    238248
  • trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc

    r852 r855  
    3232// This can be the name of the class or a given name, which identifies     //
    3333// the container in a parameter container list (MParList).                 //
    34 // The container is writte to the ascii file if its HasChanged flag is     //
     34// The container is writte to the ascii file if its ReadyToSave flag is     //
    3535// set (MParContainer)                                                     //
    3636//                                                                         //
     
    102102void MWriteAsciiFile::CheckAndWrite() const
    103103{
    104     if (fContainer->HasChanged())
     104    if (fContainer->IsReadyToSave())
    105105        fContainer->AsciiWrite(*fOut);
    106106}
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc

    r852 r855  
    322322        // Check for the Write flag
    323323        //
    324         if (!entry->GetContainer()->HasChanged())
     324        if (!entry->GetContainer()->IsReadyToSave())
    325325            continue;
    326326
  • trunk/MagicSoft/Mars/mhist/MFillHFadc.cc

    r852 r855  
    112112Bool_t MFillHFadc::PostProcess()
    113113{
    114     fHistos->SetHasChanged();
     114    fHistos->SetReadyToSave();
    115115    return kTRUE;
    116116}
  • trunk/MagicSoft/Mars/mhist/MFillHHillas.cc

    r852 r855  
    7575Bool_t MFillHHillas::PostProcess()
    7676{
    77     fHistos->SetHasChanged();
     77    fHistos->SetReadyToSave();
    7878    return kTRUE;
    7979}
  • trunk/MagicSoft/Mars/mhist/MFillHStarMap.cc

    r852 r855  
    7676Bool_t MFillHStarMap::PostProcess()
    7777{
    78     fHistos->SetHasChanged();
    79 
     78    fHistos->SetReadyToSave();
    8079    return kTRUE;
    8180}
  • trunk/MagicSoft/Mars/mhist/MHMcEnergies.h

    r851 r855  
    3030    void AddEntriesToList(MParList *plist);
    3131
    32     MHMcEnergy &operator[](UInt_t idx) { return (MHMcEnergy&)fHists[idx]; }
     32    MHMcEnergy &operator[](UInt_t idx) { return *(MHMcEnergy*)(*fHists)[idx]; }
    3333
    3434    ClassDef(MHMcEnergies, 1)  // container to hold several MHMcEnergy histograms
  • trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc

    r851 r855  
    2929#include <TH1.h>
    3030#include <TF1.h>
     31#include <TCanvas.h>
    3132#include <TPaveLabel.h>
    3233
     
    5859        sprintf(aux+10, ";%i", idx);
    5960    hLogEner = new TH1F(aux, "", 100, 0.5, 4.5);
     61    hLogEner->SetXTitle("log(E) [GeV]");
     62    hLogEner->SetYTitle("dN/dE");
    6063    //hLogEner->SetBins(60);
    6164}
     
    7578{
    7679    //
     80    // 0: don't draw the function (it is drawn together with the histogram)
     81    // +: add these function to the list of fits. Don't delete the last fit.
     82    //
    7783    // FIXME: R means: use the range specified in the function (xxmin, xxmax are ignored!)
    7884    //        Q means: quiet (why?)
    7985    //
    8086    //
    81     hLogEner->Fit(fLogEner->GetName(), "RQ", "", xxmin, xxmax);
     87    hLogEner->Fit(fLogEner->GetName(), "Q0+", "", xxmin, xxmax);
    8288}
    8389
     
    9298    const Float_t sum = min+max;
    9399
     100    TCanvas *c=new TCanvas("Energy Distribution","Energy distribution for triggered events");
     101
     102    hLogEner->Draw(option);
     103
    94104    TPaveLabel* label = new TPaveLabel(2.2, 0.75*sum, 4.4, 0.90*sum, text);
    95 
    96     hLogEner->SetYTitle("dN/dE") ;
    97     hLogEner->SetXTitle("log(E) [GeV]") ;
    98     hLogEner->Draw(option) ;
    99105    label->SetFillColor(10);
    100106    label->SetTextSize(0.3);
    101107    label->Draw();
     108
     109    c->Modified();
     110    c->Update();
    102111}
    103112
  • trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc

    r851 r855  
    5757
    5858    for (unsigned int i=0; i<fDimension; i++)
    59         fMustDelete=kFALSE;
     59        fMustDelete[i]=kFALSE;
    6060}
    6161
Note: See TracChangeset for help on using the changeset viewer.