Changeset 2002 for trunk/MagicSoft


Ignore:
Timestamp:
04/24/03 11:58:54 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2001 r2002  
    33 2003/04/24: Thomas Bretz
    44   
    5     * mfilter/MFCT1Supercuts.[h,cc]:
    6       - removed
    7 
    8     * manalysis/MPadSchweizer.[h,cc]:
    9       - renamed arguments of SetHistograms to Mars style
    10       - removed default argument for SetHistograms (usage would result
    11         in a crash)
    12       - removed empty destructor
    13 
    14     * mhistmc/MHMcTriggerLvl2.h:
    15       - removed the wrong f in GetHistf
     5   * mfilter/MFCT1Supercuts.[h,cc]:
     6     - removed
     7   
     8   * manalysis/MPadSchweizer.[h,cc]:
     9     - renamed arguments of SetHistograms to Mars style
     10     - removed default argument for SetHistograms (usage would result
     11       in a crash)
     12     - removed empty destructor
     13
     14   * mhistmc/MHMcTriggerLvl2.h:
     15     - removed the wrong f in GetHistf
     16
     17   * manalysis/MSigmabarParam.h:
     18     - added const qualifiers to getters
     19     
     20   * mfileio/MWriteRootFile.[h,cc]:
     21     - fixed support for UPDATE
     22     
     23   * mfilter/MFEnergySlope.cc:
     24     - cleaned
     25     - removed empty PostProcess
     26     
     27   * mhist/MHCerPhotEvt.cc:
     28     - removed ratio from Fill
    1629
    1730
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r1664 r2002  
    208208Bool_t MWriteRootFile::GetContainer(MParList *pList)
    209209{
     210    //
     211    // loop over all branches which are 'marked' as branches to get written.
     212    //
    210213    MRootFileBranch *entry;
    211214
    212     //
    213     // loop over all branches which are 'marked' as branches to get written.
    214     //
    215215    TIter Next(&fBranches);
    216216    while ((entry=(MRootFileBranch*)Next()))
     
    274274            fTrees.AddLast(tree);
    275275
     276            //
     277            // If the tree does not already exist in the file mark this
     278            // tree as a branch created by MWriteRootFile
     279            //
     280            entry->SetBit(kIsNewTree);
     281
    276282            gDirectory = save;
    277283
     
    280286
    281287        //
     288        // In case the file is opened as 'UPDATE' the tree may still not
     289        // be in the list. Because it neither was created previously,
     290        // nor this time, so the corresponding entries is marked as a
     291        // single branch to be filled. --> Add it to the list of trees.
     292        //
     293        if (!fTrees.FindObject(tree))
     294            fTrees.AddLast(tree);
     295
     296        //
    282297        // Now we have a valid tree. Search the list of trees for this tree
    283         // (either it is already there, or we created and add it previously)
    284298        // Add a pointer to the entry in the tree list to this branch-entry
    285299        //
    286         TObject *obj;
    287         TIter NextTree(&fTrees);
    288         while ((obj=NextTree()))
    289         {
    290             if (obj == tree)
    291                 entry->SetTree((TTree*)obj);
    292         }
     300        entry->SetTree(tree);
    293301
    294302        //
     
    315323        branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress());
    316324
    317         *fLog << "Created Branch " << cname << " of " << cont->ClassName() << "." << endl;
    318 
    319325        //
    320326        // If the branch couldn't be created we have a problem.
     
    325331            return kFALSE;
    326332        }
     333
     334        //
     335        // Tell the entry also which branch belongs to it (this is necessary
     336        // for branches belonging to already existing tree, UPDATE-mode)
     337        //
     338        entry->SetBranch(branch);
     339        *fLog << "Created Branch " << cname << " of " << cont->ClassName() << "." << endl;
    327340    }
    328341    return kTRUE;
     
    333346// Checks all given containers (branch entries) for the write flag.
    334347// If the write flag is set the corresponding Tree is marked to get filled.
    335 // All Trees which are marked to be filled are filled with the corresponding
     348// All Trees which are marked to be filled are filled with all their
    336349// branches.
     350// In case of a file opened in 'UPDATE' mode, single branches can be
     351// filled, too. WARNING - for the moment there is no check whether
     352// you filled the correct number of events into the branch, so that
     353// each of the other branches in the tree has the correct corresponding
     354// number of new entries in the new branch!
    337355// Be carefull: If only one container (corresponding to a branch) of a tree
    338356// has the write flag, all containers in this tree are filled!
     
    362380        // the corresponding tree entry.
    363381        //
    364         b->GetTree()->SetBit(kFillTree);
     382        if (b->TestBit(kIsNewTree))
     383            b->GetTree()->SetBit(kFillTree);
     384        else
     385            b->GetBranch()->Fill();
    365386    }
    366387
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h

    r1664 r2002  
    5757    void SetContainer(MParContainer *cont) { fContainer = cont; }
    5858    void SetTree(TTree *tree)              { fTree = tree; }
     59    void SetBranch(TBranch *branch)        { fBranch = branch; }
    5960
    6061    ClassDef(MRootFileBranch, 1) // Storage container for MWriteRootFile to store TBranch informations
     
    6970    TObjArray fTrees;     //!
    7071
     72    //UInt_t fNumEvents; //! Number of events written in a run
     73
    7174    void        CheckAndWrite() const;
    7275    Bool_t      IsFileOpen() const;
     
    7578
    7679    void StreamPrimitive(ofstream &out) const;
     80    //Bool_t ReInit(MParList *pList);
     81
     82    enum {
     83        kIsNewTree = BIT(15)
     84    };
    7785
    7886public:
  • trunk/MagicSoft/Mars/mfilter/MFEnergySlope.cc

    r1984 r2002  
    2020!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    22 !   Filter to select events with a energy slope. 02/2003
    2322!
    2423\* ======================================================================== */
     
    4342//                                                                         //
    4443//  With this filter the statistics of the MC sample is reduced.           //
    45 //  camera ver.0.6 and reflector ver.0.6 are required to fetch            //
     44//  camera ver.0.6 and reflector ver.0.6 are required to fetch             //
    4645//   the correct MC information                                            //
    4746//                                                                         //
     
    4948#include "MFEnergySlope.h"
    5049
    51 //#include <fstream.h>
     50#include <fstream.h>
    5251#include <TRandom.h>
    5352
     
    5655#include "MLog.h"
    5756#include "MLogManip.h"
    58 
    5957
    6058#include "MMcEvt.hxx"
     
    7371  fName  = name  ? name  : "MFEnergySlope";
    7472  fTitle = title ? title : "Filter to select energy with given slope";
    75 }
    76 
    77 // --------------------------------------------------------------------------
    78 //
    79 // Destructor
    80 //
    81 MFEnergySlope::~MFEnergySlope()
    82 {
    8373}
    8474
     
    110100      fMcMaxEnergy = runheader->GetEUppLim();
    111101
    112     *fLog << "MFEnergySlope::PreProcess; fetched MC info:" << endl <<
    113       "  E Slope: "<< fMcSlope << endl <<
    114       "  E Min:   "<< fMcMinEnergy << endl << 
    115       "  E Max:   "<< fMcMaxEnergy << endl <<
    116       "  New E Slope: "<< fNewSlope << endl;
     102    *fLog << inf;
     103    *fLog << "MFEnergySlope::PreProcess: fetched MC info:" << endl;
     104    *fLog << "  E Slope:     " << fMcSlope << endl;
     105    *fLog << "  E Min:       " << fMcMinEnergy << endl;
     106    *fLog << "  E Max:       " << fMcMaxEnergy << endl;
     107    *fLog << "  New E Slope: " << fNewSlope << endl;
    117108   
    118109    // Slope is used with positive values in the code
     
    180171  fResult = Nexp > Nrnd;
    181172
    182     if (fResult)
    183     {
    184         fNumSelectedEvts++;
    185         return kTRUE;
    186     }
    187    
     173  if (!fResult)
     174      return kTRUE;
     175
     176  fNumSelectedEvts++;
    188177  return kTRUE;
    189178}
    190179
    191 
    192 // --------------------------------------------------------------------------
    193 //
    194 //  Postprocess all filters.
    195 //
    196 Bool_t MFEnergySlope::PostProcess()
    197 {
    198     //---------------------------------
    199 
    200     return kTRUE;
    201 }
    202 
    203 void MFEnergySlope::StreamPrimitive(ofstream &out) const
    204 {
    205   /*
    206    if (fEvt)
    207         fEvt->SavePrimitive(out);
    208 
    209     out << "   MFEnergySlope " << GetUniqueName() << "(";
    210 
    211     if (fEvt)
    212         out << "&" << fEvt->GetUniqueName();
    213     else
    214         out << "\"" << fContName << "\"";
    215 
    216     out << ", New Energy Slope= " << fValue << "  Normalization factor: "
    217         << fN0 <<" );" << endl;
    218   */
    219 }
    220 
    221 
    222 
    223 
    224 
    225 
    226 
    227 
    228 
  • trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc

    r1990 r2002  
    131131        const Int_t id = pix.GetPixId();
    132132
    133         const Double_t ratio = fCam ? fCam->GetPixRatio(id) : 1;
    134 
    135         const Double_t val = pix.GetNumPhotons()/ratio;
    136 
    137133        fSum[id].SetPixelUsed();
    138         fSum[id].AddNumPhotons(val);
     134        fSum[id].AddNumPhotons(pix.GetNumPhotons());
    139135    }
    140136
Note: See TracChangeset for help on using the changeset viewer.