Fork me on GitHub

Changeset 84 in svn for trunk/Examples/src


Ignore:
Timestamp:
Dec 4, 2008, 1:11:27 PM (16 years ago)
Author:
uid677
Message:

add output tree to example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Examples/src/Analysis_Ex.cc

    r81 r84  
    4444}
    4545
    46 void Analysis_Ex::Run(ExRootTreeReader *treeReaderGen, ExRootTreeReader *treeReaderRec, ExRootTreeReader *treeReaderTrig)
     46void Analysis_Ex::Run(ExRootTreeReader *treeReaderGen, ExRootTreeReader *treeReaderRec, ExRootTreeReader *treeReaderTrig, ExRootTreeWriter *treeWriter)
    4747{
    4848  total=0;//initialisation of total number of events
     
    7070  //to get the trigger information
    7171  const TClonesArray *TRIGGER  = treeReaderTrig->UseBranch("TrigResult");
    72  
     72
     73  //Define the branches that will be filled during the analysis
     74  ExRootTreeBranch *INVMASS = treeWriter->NewBranch("INVMass", TRootInvm::Class());
     75  TRootInvm *inv_mass;
    7376  //*******************************************
    7477 
     
    296299     for(Int_t k = numElec; k < (numElec+mu.GetEntries()); k++)Lept[k].SetPxPyPzE(mu[k-numElec]->Px,mu[k-numElec]->Py,mu[k-numElec]->Pz,mu[k-numElec]->E);
    297300   
     301     //Example how to white a branch in the output file
     302     inv_mass=(TRootInvm*) INVMASS->NewEntry();
     303     inv_mass->M=(Lept[0]+Lept[1]).M();
     304 
    298305     if((Lept[0]+Lept[1]).M() > INV_MASS_LL )continue;// the invariant mass should be < INV_MASS_LL
    299306     cut_2++;//event accepted
     307
     308     treeWriter->Fill();
    300309   }
     310 treeWriter->Write();
    301311
    302312}
     
    350360}
    351361
    352 
Note: See TracChangeset for help on using the changeset viewer.