[f118021] | 1 | /*
|
---|
[ecf5f26] | 2 | Prints complete input particle arborescence for the first 10 events. Useful for debugging purposes.
|
---|
[f118021] | 3 | root -l examples/Example5.C'("delphes_output.root")'
|
---|
| 4 | */
|
---|
| 5 |
|
---|
[391fd58] | 6 | #ifdef __CLING__
|
---|
| 7 | R__LOAD_LIBRARY(libDelphes)
|
---|
| 8 | #include "classes/DelphesClasses.h"
|
---|
| 9 | #include "external/ExRootAnalysis/ExRootTreeReader.h"
|
---|
| 10 | #include "external/ExRootAnalysis/ExRootResult.h"
|
---|
| 11 | #else
|
---|
| 12 | class ExRootTreeReader;
|
---|
| 13 | class ExRootResult;
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 |
|
---|
[f118021] | 17 | //------------------------------------------------------------------------------
|
---|
| 18 |
|
---|
| 19 | void Example5(const char *inputFile)
|
---|
| 20 | {
|
---|
| 21 | gSystem->Load("libDelphes");
|
---|
| 22 |
|
---|
| 23 | // Create chain of root trees
|
---|
| 24 | TChain chain("Delphes");
|
---|
| 25 | chain.Add(inputFile);
|
---|
| 26 |
|
---|
| 27 | // Create object of class ExRootTreeReader
|
---|
| 28 | ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
|
---|
| 29 | Long64_t numberOfEntries = treeReader->GetEntries();
|
---|
| 30 |
|
---|
| 31 | // Get pointers to branches used in this analysis
|
---|
| 32 | TClonesArray *branchParticle = treeReader->UseBranch("Particle");
|
---|
| 33 |
|
---|
| 34 | // Loop over all events
|
---|
| 35 | for(Int_t entry = 0; entry < numberOfEntries; ++entry)
|
---|
| 36 | {
|
---|
| 37 | // Load selected branches with data from specified event
|
---|
| 38 | treeReader->ReadEntry(entry);
|
---|
| 39 |
|
---|
[ecf5f26] | 40 | if(entry>10) break;
|
---|
[f118021] | 41 |
|
---|
| 42 | cout<<"" <<endl;
|
---|
| 43 | cout<<"--------- New Event ---------" <<endl;
|
---|
| 44 | cout<<"" <<endl;
|
---|
| 45 |
|
---|
| 46 | // loop over all input particles in the event
|
---|
| 47 | for(Int_t i=0; i < branchParticle->GetEntriesFast(); i++)
|
---|
| 48 | {
|
---|
| 49 | GenParticle *gen = (GenParticle*) branchParticle->At(i);
|
---|
[5e4c40d] | 50 | cout<<"N: "<<i<<", St: "<<gen->Status<<", PID: "<<gen->PID<<", E: "<<gen->E<<", Px: "<<gen->Px<<", Py: "<<gen->Py<<", Pz: "<<gen->Pz<<", M: "<<gen->Mass<<", M1: "<<gen->M1<<", M2: "<<gen->M2<<", D1: "<<gen->D1<<", D2: "<<gen->D2<<endl;
|
---|
[f118021] | 51 | }
|
---|
| 52 | }
|
---|
| 53 | }
|
---|