| 1 | /* | 
| 2 | * TrackRedGeomCut.cpp | 
| 3 | * | 
| 4 | *  Created on: 30-nov-2009 | 
| 5 | *      Author: Sergio Ricciarini | 
| 6 | */ | 
| 7 |  | 
| 8 | /*! @file TrackRedGeomCut.cpp The TrackRedGeomCut class implementation file */ | 
| 9 |  | 
| 10 | #include "TrackRedGeomCut.h" | 
| 11 |  | 
| 12 | int TrackRedGeomCut::Check(PamLevel2 *event) { | 
| 13 |  | 
| 14 | #ifndef NO_CALOAXIS | 
| 15 | if ((!(_xCaloAxis) || !(_yCaloAxis)) && !(_pamTrack)) { // check that one of the two possible initializations has been correctly done | 
| 16 | return 0; | 
| 17 | } | 
| 18 | #else | 
| 19 | if ( !(_pamTrack) ) { // check that the initialization has been correctly done | 
| 20 | return 0; | 
| 21 | } | 
| 22 | #endif /* NO_CALOAXIS */ | 
| 23 | #ifndef NO_CALOAXIS | 
| 24 | if (!(_pamTrack)) { // CALOAXIS track | 
| 25 |  | 
| 26 | Double_t xCaloTrack; | 
| 27 | Double_t yCaloTrack; | 
| 28 |  | 
| 29 | for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { | 
| 30 | xCaloTrack = _xCaloAxis->par[0] + (_xCaloAxis->par[1]) * TrkParams::zGF[igf]; // cm | 
| 31 | if (!(-_xDim / 2. < xCaloTrack && xCaloTrack < _xDim / 2.)) { | 
| 32 | return 0; | 
| 33 | } | 
| 34 |  | 
| 35 | yCaloTrack = _yCaloAxis->par[0] + (_yCaloAxis->par[1]) * TrkParams::zGF[igf]; // cm | 
| 36 | if (!(-_yDim / 2. < yCaloTrack && yCaloTrack < _yDim / 2.)) { | 
| 37 | return 0; | 
| 38 | } | 
| 39 | } | 
| 40 |  | 
| 41 | } | 
| 42 | #endif /* NO_CALOAXIS */ | 
| 43 |  | 
| 44 | if (_pamTrack) { // PAMELA track | 
| 45 |  | 
| 46 | TrkTrack *trkTrack = event->GetTrack(0)->GetTrkTrack(); | 
| 47 |  | 
| 48 | for (int igf = 0; igf < TrkParams::nGF; igf++) { // loop on GF planes | 
| 49 |  | 
| 50 | // check done for all 14 planes | 
| 51 | if (!(-_xDim / 2. < trkTrack->xGF[igf] && trkTrack->xGF[igf] < _xDim / 2.)) | 
| 52 | return 0; | 
| 53 | if (!(-_yDim / 2. < trkTrack->yGF[igf] && trkTrack->yGF[igf] < _yDim / 2.)) | 
| 54 | return 0; | 
| 55 |  | 
| 56 | } // end loop on GF planes | 
| 57 |  | 
| 58 | } | 
| 59 |  | 
| 60 | return CUTOK; | 
| 61 |  | 
| 62 | } |