2 |
// Example to integrate all detector info by means of the PamLevel2 class |
// Example to integrate all detector info by means of the PamLevel2 class |
3 |
// |
// |
4 |
// An object of this class has access to all the public members of all the detector classes. |
// An object of this class has access to all the public members of all the detector classes. |
5 |
// Some local methods allows to sort tracks and solve the tracker y-view ambiguity (reject track images) |
// Some methods allows to sort tracks and solve the tracker y-view ambiguity (reject track images) |
6 |
|
// |
7 |
|
// --- Modified on January 2007 --- |
8 |
|
// |
9 |
|
// In order to access the members of the detector classes you have now to call the |
10 |
|
// methods |
11 |
|
// |
12 |
|
// TrkLevel2* PamLevel2::GetTrkLevel2() |
13 |
|
// CaloLevel2* PamLevel2::GetCaloLevel2() |
14 |
|
// OrbitalInfo* PamLevel2::GetOrbitalInfo() |
15 |
|
// ecc... |
16 |
|
// |
17 |
|
// For example: |
18 |
|
// |
19 |
|
// PamLevel2* pam_event = new PamLevel2(); |
20 |
|
// cout << pam_event->GetCaloLevel2()->qtot << endl; |
21 |
|
// |
22 |
|
// The same is for the track. The class PamTrack combines the track-related info from |
23 |
|
// tracker, calorimeter and TOF. To access the members of these detector track-related members |
24 |
|
// you have to call the methods: |
25 |
|
// |
26 |
|
// TrkTrack* PamTrack::GetTrkTrack() |
27 |
|
// CaloTrkVar* PamTrack::GetCaloTrack() |
28 |
|
// ToFTrkVar* PamTrack::GetToFTrack() |
29 |
|
// |
30 |
|
// For example: |
31 |
|
// |
32 |
|
// PamTrack *track = pam_event->GetTrack(0); //<< retrieve first track, solving the track-image ambiguity |
33 |
|
// if(track)cout<< track->GetTrkTrack()->GetRigidity()<<endl; |
34 |
// |
// |
35 |
void example1(TString file){ |
void example1(TString file){ |
36 |
// |
// |
50 |
// |
// |
51 |
TFile f(file); |
TFile f(file); |
52 |
// |
// |
53 |
TTree *T = pam_event->LoadPamTrees(&f); // << load Pamela trees from file f |
TTree *T = pam_event->GetPamTree(&f); // << get Pamela trees from file f |
54 |
|
|
55 |
Int_t nevent = T->GetEntries(); |
Int_t nevent = T->GetEntries(); |
56 |
// |
// |
57 |
cout << endl<<" Start loop over events "; |
cout << endl<<" Start loop over events "; |
58 |
for (Int_t i=0; i<nevent;i++){ |
for (Int_t i=0; i<nevent;i++){ |
59 |
// |
// |
60 |
|
pam_event->Clear(); |
61 |
|
|
62 |
T->GetEntry(i); |
T->GetEntry(i); |
63 |
//================================================================================ |
//================================================================================ |
64 |
// some general quantities |
// some general quantities |
65 |
//================================================================================ |
//================================================================================ |
66 |
// tracker |
// tracker |
67 |
ntrack->Fill( pam_event->GetNTracks()); |
ntrack->Fill( pam_event->GetTrkLevel2()->GetNTracks() ); //<< |
68 |
// calorimeter |
// calorimeter |
69 |
qtot->Fill(pam_event->qtot); |
qtot->Fill( pam_event->GetCaloLevel2()->qtot ); //<< |
70 |
// ToF |
// ToF |
71 |
Int_t npa=0; |
Int_t npa=0; |
72 |
for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetNHitPaddles(ipa); |
for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetToFLevel2()->GetNHitPaddles(ipa); //<< |
73 |
npaddle->Fill(npa); |
npaddle->Fill(npa); |
74 |
//================================================================================ |
//================================================================================ |
75 |
// track related variables |
// track related variables |
76 |
//================================================================================ |
//================================================================================ |
77 |
for(Int_t it=0; it<pam_event->GetNTracks(); it++){ // << loop over the "physical" tracks (no track images) |
for(Int_t it=0; it<pam_event->GetTrkLevel2()->GetNTracks(); it++){ // << loop over the "physical" tracks (no track images) |
78 |
// |
// |
79 |
// << get the it-th physical pamela track |
// << get the it-th physical pamela track |
80 |
// << PamTrack combines the tracker, calorimeter and ToF track-related variables |
// << PamTrack combines the tracker, calorimeter and ToF track-related variables |
81 |
// << (in case of image, choose the best track by means of calorimeter and ToF data) |
// << (in case of image, choose the best track by means of calorimeter and ToF data) |
82 |
// |
// |
83 |
PamTrack *track = pam_event->GetTrack(it); |
PamTrack *track = pam_event->GetTrack(it); //<< |
84 |
// |
// |
85 |
// << if the track fit is good, fill some histos |
// << if the track fit is good, fill some histos |
86 |
// |
// |
87 |
if( track->chi2 > 0 && track->chi2 < 100){ |
if( track->GetTrkTrack()->chi2 > 0 && track->GetTrkTrack()->chi2 < 100){ |
88 |
// |
// |
89 |
// << spatial residuals on the first calorimeter plane for the sorted track |
// << spatial residuals on the first calorimeter plane for the sorted track |
90 |
// |
// |
91 |
Float_t rxs = track->tbar[0][0] - pam_event->cbar[0][0]; |
Float_t rxs = track->GetCaloTrack()->tbar[0][0] - pam_event->GetCaloLevel2()->cbar[0][0]; |
92 |
Float_t rys = track->tbar[0][1] - pam_event->cbar[0][1]; |
Float_t rys = track->GetCaloTrack()->tbar[0][1] - pam_event->GetCaloLevel2()->cbar[0][1]; |
93 |
resxs->Fill(rxs); |
resxs->Fill(rxs); |
94 |
resys->Fill(rys); |
resys->Fill(rys); |
95 |
// |
// |
96 |
rig->Fill( track->GetRigidity() ); |
rig->Fill( track->GetTrkTrack()->GetRigidity() ); |
97 |
// |
// |
98 |
// << spatial residuals on the first calorimeter plane for the image track |
// << spatial residuals on the first calorimeter plane for the image track |
99 |
// |
// |
100 |
if(track->HasImage()){ // << if the sorted track has an image... |
if(track->GetTrkTrack()->HasImage()){ // << if the sorted track has an image... |
101 |
// |
// |
102 |
PamTrack *image = pam_event->GetTrackImage(it); // << ...get the image track |
PamTrack *image = pam_event->GetTrackImage(it); // << ...get the image track |
103 |
// |
// |
104 |
Float_t rxi = image->tbar[0][0] - pam_event->cbar[0][0]; |
Float_t rxi = image->GetCaloTrack()->tbar[0][0] - pam_event->GetCaloLevel2()->cbar[0][0]; |
105 |
Float_t ryi = image->tbar[0][1] - pam_event->cbar[0][1]; |
Float_t ryi = image->GetCaloTrack()->tbar[0][1] - pam_event->GetCaloLevel2()->cbar[0][1]; |
106 |
resxi->Fill(rxi); |
resxi->Fill(rxi); |
107 |
resyi->Fill(ryi); |
resyi->Fill(ryi); |
108 |
}; |
}; |
109 |
}; |
}; |
110 |
}; // end loop over tracks |
}; // end loop over tracks |
111 |
//================================================================================ |
//================================================================================ |
112 |
|
|
113 |
}; // end loop over the events |
}; // end loop over the events |
114 |
cout << endl << endl << " Done "<< endl<<endl; |
cout << endl << endl << " Done "<< endl<<endl; |