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