/[PAMELA software]/calo/flight/CaloNuclei/doc/example.cpp
ViewVC logotype

Annotation of /calo/flight/CaloNuclei/doc/example.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed Apr 4 11:31:25 2007 UTC (17 years, 8 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r01, HEAD
Small changes in name of methods, added Process(track) method and example.cpp file

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 <CaloNuclei.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     CaloNuclei *cn = new CaloNuclei(pam_event); // CREATE CaloNuclei OBJECT GIVING PamLevel2 POINTER
50    
51    
52     Int_t nevent = pam_event->GetEntries();
53     cout<< " Events= "<<nevent<<"\n";
54    
55     const Int_t size=nevent;
56    
57     //
58     // loop over events
59     //
60     // for (Int_t i=0; i<nevent;i++){
61     for (Int_t i=0; i<50;i++){
62    
63     if ( i%10000 == 0) cout<<i<<endl;
64     //
65     T->GetEntry(i); // get the entry, also pam_event->GetEntry is fine
66    
67     cn->Print(); // this will simply print on the terminal the determined CaloNuclei values
68    
69     Float_t mip1 = cn->Get_dEdx1(); // here how you can use the "old" dE/dx on the first plane
70    
71     if ( cn->Get_qpremeanN() > 0. && cn->Get_interplane()>9 ) { // other new variables
72     //
73     // do something
74     //
75     };
76    
77     // if ( nrig > 5. ) caloz->Fill(mip1);
78    
79     //
80     // if you want to do it for other tracks and not only for the track number 0 (default) you can do this way:
81     //
82     Float_t mipt[100];
83     memset(mipt,0.,100*sizeof(Float_t));
84     for (Int_t nt = 0; nt < pam_event->GetTrkLevel2()->GetNTracks(); nt++){
85     PamTrack *track = pam_event->GetTrack(nt);
86     cn->Process(nt);
87     if ( nt < 100 ) mipt[nt] = cn->Get_dEdx1();
88     if ( nt > 0 ){
89     cn->Print();
90     };
91     };
92     //
93    
94     }
95     printf(" end!\n");
96    
97     };
98     //
99    
100    
101    

  ViewVC Help
Powered by ViewVC 1.1.23