Ignore:
Timestamp:
06/03/05 18:02:36 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc

    r2744 r7130  
    109109Bool_t MTFillMatrix::CheckResult(MHMatrix *m, Int_t num) const
    110110{
    111     if (!m)
     111    if (!m || num==0)
    112112        return kTRUE;
    113113
     
    190190    fLog->Separator(GetDescriptor());
    191191    *fLog << "Fill " << fDestMatrix1->GetDescriptor() << " with " << fNumDestEvents1 << endl;
    192     *fLog << "Fill " << fDestMatrix2->GetDescriptor() << " with " << fNumDestEvents2 << endl;
     192    if (fDestMatrix2)
     193        *fLog << "Fill " << fDestMatrix2->GetDescriptor() << " with " << fNumDestEvents2 << endl;
    193194    *fLog << "Distribution choosen ";
    194195    if (fReference && fReference->GetHist().GetEntries()>0)
     
    210211    // FIXME: Merge MFEventSelector and MFEventSelector2
    211212    MFilter *selector=0;
    212     if (fReference)
    213     {
    214         // Case of a reference/nominal distribution
    215         // The events must be read before selection
    216         MFEventSelector2 *sel = new MFEventSelector2(*fReference);
    217         sel->SetNumMax(fNumDestEvents1+fNumDestEvents2);
    218         sel->SetInverted();
    219 
    220         selector = sel;
    221     }
    222     else
    223     {
    224         // Case of a random distribution
    225         // The events can be selected before reading
    226         MFEventSelector *sel = new MFEventSelector;
    227         sel->SetNumSelectEvts(fNumDestEvents1+fNumDestEvents2);
    228         fReader->SetSelector(sel);
    229 
    230         selector = sel;
     213    if (fNumDestEvents1>0 || fNumDestEvents2>0)
     214    {
     215        if (fReference)
     216        {
     217            // Case of a reference/nominal distribution
     218            // The events must be read before selection
     219            MFEventSelector2 *sel = new MFEventSelector2(*fReference);
     220            sel->SetNumMax(fNumDestEvents1+fNumDestEvents2);
     221            sel->SetInverted();
     222
     223            selector = sel;
     224        }
     225        else
     226        {
     227            // Case of a random distribution
     228            // The events can be selected before reading
     229            MFEventSelector *sel = new MFEventSelector;
     230            sel->SetNumSelectEvts(fNumDestEvents1+fNumDestEvents2);
     231            fReader->SetSelector(sel);
     232
     233            selector = sel;
     234        }
    231235    }
    232236
     
    256260    MFillH fill1(fDestMatrix1);
    257261    MFillH fill2(fDestMatrix2);
    258     fill1.SetFilter(&split);
    259     fill2.SetFilter(&invsplit);
     262    if (selector)
     263    {
     264        fill1.SetFilter(&split);
     265        fill2.SetFilter(&invsplit);
     266    }
    260267
    261268    // entries in MTaskList
    262269    tlist.AddToList(fReader);        // Read events
    263     if (fReference)
     270    if (fReference && selector)
    264271        tlist.AddToList(&cont);      // select a sample of events
    265272    tlist.AddToList(&invsplit);      // process invsplit (which implicitly processes split)
    266     if (fDestMatrix1 && fNumDestEvents1>0)
     273    if (fDestMatrix1)
    267274        tlist.AddToList(&fill1);     // fill matrix 1
    268     if (fDestMatrix2 && fNumDestEvents2>0)
     275    if (fDestMatrix2)
    269276        tlist.AddToList(&fill2);     // fill matrix 2
    270277    if (fWriteFile1)
     
    289296    const Bool_t rc = evtloop.Eventloop();
    290297
    291     // Print execution statistics of the tasklist
    292     if (rc)
    293         tlist.PrintStatistics();
    294 
    295     delete selector;
     298    if (selector)
     299        delete selector;
    296300
    297301    if (!rc)
Note: See TracChangeset for help on using the changeset viewer.