Changeset 84 in svn for trunk/Examples
- Timestamp:
- Dec 4, 2008, 1:11:27 PM (16 years ago)
- Location:
- trunk/Examples
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Examples/Analysis_Ex.cpp
r81 r84 72 72 //*********************Output root file of the analysis************************ 73 73 //***************************************************************************** 74 TString outputFile(argv[2]);75 76 74 ExRootTreeReader *treeReaderGen = new ExRootTreeReader(&chainGen); 77 75 ExRootTreeReader *treeReaderRec = new ExRootTreeReader(&chainRec); … … 84 82 ofstream f_out(LogName.c_str(),ofstream::app); 85 83 84 //create the output tree 85 string outputfilename = argv[2]; 86 TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE"); // Creates the file, but should be closed just after 87 outputFile->Close(); 88 89 ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputfilename, "Analysis"); 90 86 91 //***************************************************************************** 87 92 //***************************Run the analysis********************************** … … 89 94 90 95 Analysis_Ex *DefaultOne = new Analysis_Ex("Examples/Datacard_Analysis_Ex.dat",LogName); 91 DefaultOne->Run(treeReaderGen,treeReaderRec,treeReaderTrig );96 DefaultOne->Run(treeReaderGen,treeReaderRec,treeReaderTrig,treeWriter); 92 97 DefaultOne->WriteOutput(LogName); 93 98 delete DefaultOne; -
trunk/Examples/interface/Analysis_Ex.h
r81 r84 35 35 ~Analysis_Ex(); 36 36 37 void Run(ExRootTreeReader *treeReaderGen, ExRootTreeReader *treeReaderRec, ExRootTreeReader *treeReaderTrig );//Analyze de l'event37 void Run(ExRootTreeReader *treeReaderGen, ExRootTreeReader *treeReaderRec, ExRootTreeReader *treeReaderTrig, ExRootTreeWriter *treeWriter);//Analyze de l'event 38 38 void WriteOutput(string LogName); 39 39 … … 51 51 }; 52 52 53 //------------------------------------------------------------------------------ 54 55 class TRootInvm: public TObject 56 { 57 public: 58 59 Float_t M; 60 61 ClassDef(TRootInvm, 1) 62 }; 63 64 53 65 #endif -
trunk/Examples/src/Analysis_Ex.cc
r81 r84 44 44 } 45 45 46 void Analysis_Ex::Run(ExRootTreeReader *treeReaderGen, ExRootTreeReader *treeReaderRec, ExRootTreeReader *treeReaderTrig )46 void Analysis_Ex::Run(ExRootTreeReader *treeReaderGen, ExRootTreeReader *treeReaderRec, ExRootTreeReader *treeReaderTrig, ExRootTreeWriter *treeWriter) 47 47 { 48 48 total=0;//initialisation of total number of events … … 70 70 //to get the trigger information 71 71 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; 73 76 //******************************************* 74 77 … … 296 299 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); 297 300 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 298 305 if((Lept[0]+Lept[1]).M() > INV_MASS_LL )continue;// the invariant mass should be < INV_MASS_LL 299 306 cut_2++;//event accepted 307 308 treeWriter->Fill(); 300 309 } 310 treeWriter->Write(); 301 311 302 312 } … … 350 360 } 351 361 352
Note:
See TracChangeset
for help on using the changeset viewer.