| 22 | 
     // | 
     // | 
| 23 | 
     TFile f(file); | 
     TFile f(file); | 
| 24 | 
     // | 
     // | 
| 25 | 
     TTree *T = pam_event->LoadPamTrees(&f);         // << load Pamela trees from file f | 
     TTree *T = pam_event->GetPamTree(&f);          // << get Pamela trees from file f | 
| 26 | 
     Int_t nevent = T->GetEntries(); | 
     Int_t nevent = T->GetEntries(); | 
| 27 | 
     // | 
     // | 
| 28 | 
     cout << endl<<" Start loop over events   "; | 
     cout << endl<<" Start loop over events   "; | 
| 29 | 
     for (Int_t i=0; i<nevent;i++){ | 
     for (Int_t i=0; i<nevent;i++){ | 
 | 
         // | 
  | 
 | 
         T->GetEntry(i); | 
  | 
 | 
         //================================================================================ | 
  | 
 | 
         // some general quantities | 
  | 
 | 
         //================================================================================ | 
  | 
 | 
         // tracker | 
  | 
 | 
         ntrack->Fill( pam_event->GetNTracks());  | 
  | 
 | 
         // calorimeter | 
  | 
 | 
         qtot->Fill(pam_event->qtot); | 
  | 
 | 
         // ToF | 
  | 
 | 
         Int_t npa=0; | 
  | 
 | 
         for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetNHitPaddles(ipa); | 
  | 
 | 
         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  | 
  | 
| 30 | 
                 // | 
                 // | 
| 31 | 
                 Float_t rxs = track->tbar[0][0] - pam_event->cbar[0][0]; | 
                 T->GetEntry(i); | 
| 32 | 
                 Float_t rys = track->tbar[0][1] - pam_event->cbar[0][1]; | 
                 //================================================================================ | 
| 33 | 
                 resxs->Fill(rxs); | 
                 // some general quantities | 
| 34 | 
                 resys->Fill(rys); | 
                 //================================================================================ | 
| 35 | 
                 // | 
                 // tracker | 
| 36 | 
                 rig->Fill( track->GetRigidity() ); | 
                 ntrack->Fill( pam_event->GetNTracks() );                                                                        //<< | 
| 37 | 
                 // | 
                 // calorimeter | 
| 38 | 
                 // << spatial residuals on the first calorimeter plane for the image track  | 
                 qtot->Fill( pam_event->qtot );                                                                                          //<< | 
| 39 | 
                 // | 
                 // ToF | 
| 40 | 
                 if(track->HasImage()){                                // << if the sorted track has an image... | 
                 Int_t npa=0; | 
| 41 | 
                     // | 
                 for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetNHitPaddles(ipa);       //<< | 
| 42 | 
                     PamTrack *image = pam_event->GetTrackImage(it);   // << ...get the image track | 
                 npaddle->Fill(npa); | 
| 43 | 
                     // | 
                 //================================================================================ | 
| 44 | 
                     Float_t rxi = image->tbar[0][0] - pam_event->cbar[0][0]; | 
                 // track related variables | 
| 45 | 
                     Float_t ryi = image->tbar[0][1] - pam_event->cbar[0][1]; | 
                 //================================================================================ | 
| 46 | 
                     resxi->Fill(rxi); | 
                 for(Int_t it=0; it<pam_event->GetNTracks(); it++){     // << loop over the "physical" tracks (no track images) | 
| 47 | 
                     resyi->Fill(ryi); | 
                         // | 
| 48 | 
                 }; | 
                         // << get the it-th physical pamela track  | 
| 49 | 
             }; | 
                         // << PamTrack combines the tracker, calorimeter and ToF track-related variables | 
| 50 | 
         };  // end loop over tracks | 
                         // << (in case of image, choose the best track by means of calorimeter and ToF data) | 
| 51 | 
         //================================================================================ | 
                         // | 
| 52 | 
  | 
                         PamTrack *track = pam_event->GetTrack(it);                                                              //<< | 
| 53 | 
  | 
                         // | 
| 54 | 
  | 
                         // << if the track fit is good, fill some histos | 
| 55 | 
  | 
                         // | 
| 56 | 
  | 
                         if( track->chi2 > 0 && track->chi2 < 100){ | 
| 57 | 
  | 
                         //  | 
| 58 | 
  | 
                         // << spatial residuals on the first calorimeter plane for the sorted track  | 
| 59 | 
  | 
                         // | 
| 60 | 
  | 
                         Float_t rxs = track->tbar[0][0] - pam_event->cbar[0][0]; | 
| 61 | 
  | 
                         Float_t rys = track->tbar[0][1] - pam_event->cbar[0][1]; | 
| 62 | 
  | 
                         resxs->Fill(rxs); | 
| 63 | 
  | 
                         resys->Fill(rys); | 
| 64 | 
  | 
                         // | 
| 65 | 
  | 
                         rig->Fill( track->GetRigidity() ); | 
| 66 | 
  | 
                         // | 
| 67 | 
  | 
                         // << spatial residuals on the first calorimeter plane for the image track  | 
| 68 | 
  | 
                         // | 
| 69 | 
  | 
                         if(track->HasImage()){                                // << if the sorted track has an image... | 
| 70 | 
  | 
                                 // | 
| 71 | 
  | 
                                 PamTrack *image = pam_event->GetTrackImage(it);   // << ...get the image track | 
| 72 | 
  | 
                                 // | 
| 73 | 
  | 
                                 Float_t rxi = image->tbar[0][0] - pam_event->cbar[0][0]; | 
| 74 | 
  | 
                                 Float_t ryi = image->tbar[0][1] - pam_event->cbar[0][1]; | 
| 75 | 
  | 
                                 resxi->Fill(rxi); | 
| 76 | 
  | 
                                 resyi->Fill(ryi); | 
| 77 | 
  | 
                         }; | 
| 78 | 
  | 
                                 }; | 
| 79 | 
  | 
                 };  // end loop over tracks | 
| 80 | 
  | 
                         //================================================================================ | 
| 81 | 
  | 
  | 
| 82 | 
     };                                       // end loop over the events | 
     };                                       // end loop over the events | 
| 83 | 
     cout << endl << endl << " Done "<< endl<<endl; | 
     cout << endl << endl << " Done "<< endl<<endl; |