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 |
// |
// |
55 |
// |
// |
56 |
cout << endl<<" Start loop over events "; |
cout << endl<<" Start loop over events "; |
57 |
for (Int_t i=0; i<nevent;i++){ |
for (Int_t i=0; i<nevent;i++){ |
58 |
|
// |
59 |
|
pam_event->Clear(); |
60 |
|
|
61 |
|
T->GetEntry(i); |
62 |
|
//================================================================================ |
63 |
|
// some general quantities |
64 |
|
//================================================================================ |
65 |
|
// tracker |
66 |
|
ntrack->Fill( pam_event->GetTrkLevel2()->GetNTracks() ); //<< |
67 |
|
// calorimeter |
68 |
|
qtot->Fill( pam_event->GetCaloLevel2()->qtot ); //<< |
69 |
|
// ToF |
70 |
|
Int_t npa=0; |
71 |
|
for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetToFLevel2()->GetNHitPaddles(ipa); //<< |
72 |
|
npaddle->Fill(npa); |
73 |
|
//================================================================================ |
74 |
|
// track related variables |
75 |
|
//================================================================================ |
76 |
|
for(Int_t it=0; it<pam_event->GetTrkLevel2()->GetNTracks(); it++){ // << loop over the "physical" tracks (no track images) |
77 |
|
// |
78 |
|
// << get the it-th physical pamela track |
79 |
|
// << PamTrack combines the tracker, calorimeter and ToF track-related variables |
80 |
|
// << (in case of image, choose the best track by means of calorimeter and ToF data) |
81 |
|
// |
82 |
|
PamTrack *track = pam_event->GetTrack(it); //<< |
83 |
|
// |
84 |
|
// << if the track fit is good, fill some histos |
85 |
|
// |
86 |
|
if( track->GetTrkTrack()->chi2 > 0 && track->GetTrkTrack()->chi2 < 100){ |
87 |
|
// |
88 |
|
// << spatial residuals on the first calorimeter plane for the sorted track |
89 |
|
// |
90 |
|
Float_t rxs = track->GetCaloTrack()->tbar[0][0] - pam_event->GetCaloLevel2()->cbar[0][0]; |
91 |
|
Float_t rys = track->GetCaloTrack()->tbar[0][1] - pam_event->GetCaloLevel2()->cbar[0][1]; |
92 |
|
resxs->Fill(rxs); |
93 |
|
resys->Fill(rys); |
94 |
|
// |
95 |
|
rig->Fill( track->GetTrkTrack()->GetRigidity() ); |
96 |
|
// |
97 |
|
// << spatial residuals on the first calorimeter plane for the image track |
98 |
// |
// |
99 |
T->GetEntry(i); |
if(track->GetTrkTrack()->HasImage()){ // << if the sorted track has an image... |
100 |
//================================================================================ |
// |
101 |
// some general quantities |
PamTrack *image = pam_event->GetTrackImage(it); // << ...get the image track |
102 |
//================================================================================ |
// |
103 |
// tracker |
Float_t rxi = image->GetCaloTrack()->tbar[0][0] - pam_event->GetCaloLevel2()->cbar[0][0]; |
104 |
ntrack->Fill( pam_event->GetNTracks() ); //<< |
Float_t ryi = image->GetCaloTrack()->tbar[0][1] - pam_event->GetCaloLevel2()->cbar[0][1]; |
105 |
// calorimeter |
resxi->Fill(rxi); |
106 |
qtot->Fill( pam_event->qtot ); //<< |
resyi->Fill(ryi); |
107 |
// ToF |
}; |
108 |
Int_t npa=0; |
}; |
109 |
for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetNHitPaddles(ipa); //<< |
}; // end loop over tracks |
110 |
npaddle->Fill(npa); |
//================================================================================ |
|
//================================================================================ |
|
|
// track related variables |
|
|
//================================================================================ |
|
|
for(Int_t it=0; it<pam_event->GetNTracks(); it++){ // << loop over the "physical" tracks (no track images) |
|
|
// |
|
|
// << get the it-th physical pamela track |
|
|
// << PamTrack combines the tracker, calorimeter and ToF track-related variables |
|
|
// << (in case of image, choose the best track by means of calorimeter and ToF data) |
|
|
// |
|
|
PamTrack *track = pam_event->GetTrack(it); //<< |
|
|
// |
|
|
// << if the track fit is good, fill some histos |
|
|
// |
|
|
if( track->chi2 > 0 && track->chi2 < 100){ |
|
|
// |
|
|
// << spatial residuals on the first calorimeter plane for the sorted track |
|
|
// |
|
|
Float_t rxs = track->tbar[0][0] - pam_event->cbar[0][0]; |
|
|
Float_t rys = track->tbar[0][1] - pam_event->cbar[0][1]; |
|
|
resxs->Fill(rxs); |
|
|
resys->Fill(rys); |
|
|
// |
|
|
rig->Fill( track->GetRigidity() ); |
|
|
// |
|
|
// << spatial residuals on the first calorimeter plane for the image track |
|
|
// |
|
|
if(track->HasImage()){ // << if the sorted track has an image... |
|
|
// |
|
|
PamTrack *image = pam_event->GetTrackImage(it); // << ...get the image track |
|
|
// |
|
|
Float_t rxi = image->tbar[0][0] - pam_event->cbar[0][0]; |
|
|
Float_t ryi = image->tbar[0][1] - pam_event->cbar[0][1]; |
|
|
resxi->Fill(rxi); |
|
|
resyi->Fill(ryi); |
|
|
}; |
|
|
}; |
|
|
}; // end loop over tracks |
|
|
//================================================================================ |
|
111 |
|
|
112 |
}; // end loop over the events |
}; // end loop over the events |
113 |
cout << endl << endl << " Done "<< endl<<endl; |
cout << endl << endl << " Done "<< endl<<endl; |