Last change
on this file since e72ee4b was f118021, checked in by Michele Selvaggi <michele.selvaggi@…>, 9 years ago |
added Example5: prints gen events
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /*
|
---|
2 | Prints complete input particle arborescence for the first 100 events. Useful for debugging purposes.
|
---|
3 | root -l examples/Example5.C'("delphes_output.root")'
|
---|
4 | */
|
---|
5 |
|
---|
6 | //------------------------------------------------------------------------------
|
---|
7 |
|
---|
8 | void Example5(const char *inputFile)
|
---|
9 | {
|
---|
10 | gSystem->Load("libDelphes");
|
---|
11 |
|
---|
12 | // Create chain of root trees
|
---|
13 | TChain chain("Delphes");
|
---|
14 | chain.Add(inputFile);
|
---|
15 |
|
---|
16 | // Create object of class ExRootTreeReader
|
---|
17 | ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
|
---|
18 | Long64_t numberOfEntries = treeReader->GetEntries();
|
---|
19 |
|
---|
20 | // Get pointers to branches used in this analysis
|
---|
21 | TClonesArray *branchParticle = treeReader->UseBranch("Particle");
|
---|
22 |
|
---|
23 | // Loop over all events
|
---|
24 | for(Int_t entry = 0; entry < numberOfEntries; ++entry)
|
---|
25 | {
|
---|
26 | // Load selected branches with data from specified event
|
---|
27 | treeReader->ReadEntry(entry);
|
---|
28 |
|
---|
29 | if(entry>100) break;
|
---|
30 |
|
---|
31 | cout<<"" <<endl;
|
---|
32 | cout<<"--------- New Event ---------" <<endl;
|
---|
33 | cout<<"" <<endl;
|
---|
34 |
|
---|
35 | // loop over all input particles in the event
|
---|
36 | for(Int_t i=0; i < branchParticle->GetEntriesFast(); i++)
|
---|
37 | {
|
---|
38 | GenParticle *gen = (GenParticle*) branchParticle->At(i);
|
---|
39 | cout<<"N: "<<i<<", St: "<<gen->Status<<", PID: "<<gen->PID<<", E: "<<gen->E<<", Px: "<<gen->Px<<", Py: "<<gen->Py<<", Pz: "<<gen->Pz<<", M1: "<<gen->M1<<", M2: "<<gen->M2<<", D1: "<<gen->D1<<", D2: "<<gen->D2<<endl;
|
---|
40 | }
|
---|
41 | }
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.