--- PamelaLevel2/doc/examples/example1.C 2006/10/09 12:37:52 1.2 +++ PamelaLevel2/doc/examples/example1.C 2007/01/15 11:51:39 1.3 @@ -2,7 +2,35 @@ // Example to integrate all detector info by means of the PamLevel2 class // // An object of this class has access to all the public members of all the detector classes. -// 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) +// +// --- Modified on January 2007 --- +// +// In order to access the members of the detector classes you have now to call the +// methods +// +// TrkLevel2* PamLevel2::GetTrkLevel2() +// CaloLevel2* PamLevel2::GetCaloLevel2() +// OrbitalInfo* PamLevel2::GetOrbitalInfo() +// ecc... +// +// For example: +// +// PamLevel2* pam_event = new PamLevel2(); +// cout << pam_event->GetCaloLevel2()->qtot << endl; +// +// The same is for the track. The class PamTrack combines the track-related info from +// tracker, calorimeter and TOF. To access the members of these detector track-related members +// you have to call the methods: +// +// TrkTrack* PamTrack::GetTrkTrack() +// CaloTrkVar* PamTrack::GetCaloTrack() +// ToFTrkVar* PamTrack::GetToFTrack() +// +// For example: +// +// PamTrack *track = pam_event->GetTrack(0); //<< retrieve first track, solving the track-image ambiguity +// if(track)cout<< track->GetTrkTrack()->GetRigidity()<Clear(); + + T->GetEntry(i); + //================================================================================ + // some general quantities + //================================================================================ + // tracker + ntrack->Fill( pam_event->GetTrkLevel2()->GetNTracks() ); //<< + // calorimeter + qtot->Fill( pam_event->GetCaloLevel2()->qtot ); //<< + // ToF + Int_t npa=0; + for(Int_t ipa=0; ipa<6; ipa++)npa = npa + pam_event->GetToFLevel2()->GetNHitPaddles(ipa); //<< + npaddle->Fill(npa); + //================================================================================ + // track related variables + //================================================================================ + for(Int_t it=0; itGetTrkLevel2()->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->GetTrkTrack()->chi2 > 0 && track->GetTrkTrack()->chi2 < 100){ + // + // << spatial residuals on the first calorimeter plane for the sorted track + // + Float_t rxs = track->GetCaloTrack()->tbar[0][0] - pam_event->GetCaloLevel2()->cbar[0][0]; + Float_t rys = track->GetCaloTrack()->tbar[0][1] - pam_event->GetCaloLevel2()->cbar[0][1]; + resxs->Fill(rxs); + resys->Fill(rys); + // + rig->Fill( track->GetTrkTrack()->GetRigidity() ); + // + // << spatial residuals on the first calorimeter plane for the image track // - 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; itGetNTracks(); 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 - //================================================================================ + if(track->GetTrkTrack()->HasImage()){ // << if the sorted track has an image... + // + PamTrack *image = pam_event->GetTrackImage(it); // << ...get the image track + // + Float_t rxi = image->GetCaloTrack()->tbar[0][0] - pam_event->GetCaloLevel2()->cbar[0][0]; + Float_t ryi = image->GetCaloTrack()->tbar[0][1] - pam_event->GetCaloLevel2()->cbar[0][1]; + resxi->Fill(rxi); + resyi->Fill(ryi); + }; + }; + }; // end loop over tracks + //================================================================================ }; // end loop over the events cout << endl << endl << " Done "<< endl<