1 |
mocchiut |
1.1 |
//Nella release 4 ci sono i TGraph e i fit sui TGraph. Ho perso così l'info in Z che avevo. |
2 |
|
|
|
3 |
|
|
|
4 |
|
|
#include <fstream> |
5 |
|
|
#include <sstream> |
6 |
|
|
#include <string> |
7 |
|
|
#include <math.h> |
8 |
|
|
#include <iostream> |
9 |
|
|
#include <TTree.h> |
10 |
|
|
#include <TClassEdit.h> |
11 |
|
|
#include <TObject.h> |
12 |
|
|
#include <TList.h> |
13 |
|
|
#include <TSystem.h> |
14 |
|
|
#include <TSystemDirectory.h> |
15 |
|
|
#include <TString.h> |
16 |
|
|
#include <TFile.h> |
17 |
|
|
#include <TClass.h> |
18 |
|
|
#include <TCanvas.h> |
19 |
|
|
#include <TH1.h> |
20 |
|
|
#include <TH1F.h> |
21 |
|
|
#include <TH2D.h> |
22 |
|
|
#include <TLatex.h> |
23 |
|
|
#include <TPad.h> |
24 |
|
|
#include <TPaveLabel.h> |
25 |
|
|
#include <TChain.h> |
26 |
|
|
#include <TGraph.h> |
27 |
|
|
#include <TMultiGraph.h> |
28 |
|
|
#include <TLine.h> |
29 |
|
|
#include <TStyle.h> |
30 |
|
|
#include <TF1.h> |
31 |
|
|
#include <TH1F.h> |
32 |
|
|
#include <TTree.h> |
33 |
|
|
#include <TCanvas.h> |
34 |
|
|
#include <PamLevel2.h> |
35 |
|
|
|
36 |
|
|
#include <CaloDoubleShower.h> // ADD HEADER FILE HERE |
37 |
|
|
|
38 |
|
|
using namespace std; |
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
void example(TString dir, TString flist, TString treelist="+ALL"){ |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
PamLevel2 *pam_event = new PamLevel2(dir,flist); // << create pamela event |
47 |
|
|
TChain *T = pam_event->GetPamTree(); |
48 |
|
|
|
49 |
|
|
CaloDoubleShower *cn = new CaloDoubleShower(pam_event); // CREATE CaloDoubleShower OBJECT GIVING PamLevel2 POINTER |
50 |
|
|
|
51 |
|
|
cn->LoadMagneticField(); // THIS IS NEEDED SINCE FROM THE FORTRAN ROUTINES THE MAGNETIC FIELD IS NOT AUTOMATICALLY LOADED. NOT NEEDED IF THE FIELD WILL BE OR HAS BEEN LOADED BY |
52 |
|
|
// OTHER ROUTINES (LIKE TrkTrajectory or similar) |
53 |
|
|
|
54 |
|
|
Int_t nevent = pam_event->GetEntries(); |
55 |
|
|
cout<< " Events= "<<nevent<<"\n"; |
56 |
|
|
|
57 |
|
|
const Int_t size=nevent; |
58 |
|
|
|
59 |
|
|
// |
60 |
|
|
// loop over events |
61 |
|
|
// |
62 |
|
|
// for (Int_t i=0; i<nevent;i++){ |
63 |
|
|
for (Int_t i=0; i<50;i++){ |
64 |
|
|
|
65 |
|
|
if ( i%10000 == 0) cout<<i<<endl; |
66 |
|
|
// |
67 |
|
|
T->GetEntry(i); // get the entry, also pam_event->GetEntry is fine |
68 |
|
|
|
69 |
|
|
cn->Print(); // this will simply print on the terminal the determined CaloNuclei values |
70 |
|
|
|
71 |
|
|
Float_t dblsq = cn->GetDblsQ(); // double shower energy on the x |
72 |
|
|
Int_t dbls = cn->GetDblsFlag(); // double shower flag |
73 |
|
|
// |
74 |
|
|
// do something |
75 |
|
|
// |
76 |
|
|
// |
77 |
|
|
// if you want to do it for other tracks and not only for the track number 0 (default) you can do this way: |
78 |
|
|
// |
79 |
|
|
Float_t mipt[100]; |
80 |
|
|
memset(mipt,0.,100*sizeof(Float_t)); |
81 |
|
|
for (Int_t nt = 0; nt < pam_event->GetTrkLevel2()->GetNTracks(); nt++){ |
82 |
|
|
PamTrack *track = pam_event->GetTrack(nt); |
83 |
|
|
cn->Process(nt); |
84 |
|
|
cn->Print(nt); |
85 |
|
|
// |
86 |
|
|
// do something as before |
87 |
|
|
// |
88 |
|
|
}; |
89 |
|
|
// |
90 |
|
|
|
91 |
|
|
} |
92 |
|
|
printf(" end!\n"); |
93 |
|
|
|
94 |
|
|
}; |
95 |
|
|
// |
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|