/[PAMELA software]/PamCut/CaloCuts/CaloGeomCut/CaloGeomCut.cpp
ViewVC logotype

Diff of /PamCut/CaloCuts/CaloGeomCut/CaloGeomCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pam-fi, Wed May 27 13:30:09 2009 UTC revision 1.6 by pam-fi, Fri Sep 2 16:25:38 2011 UTC
# Line 7  Line 7 
7    
8  /*! @file CaloGeomCut.cpp The CaloCrossCut class implementation file */  /*! @file CaloGeomCut.cpp The CaloCrossCut class implementation file */
9    
10    #ifndef NO_CALOAXIS
11    
12  #include "CaloGeomCut.h"  #include "CaloGeomCut.h"
13    const Int_t CaloGeomCut::_nPoint = TrkParams::nGF + 1;
14    const Float_t CaloGeomCut::_zCaloTop = -26.181;
15    
16    CaloGeomCut::CaloGeomCut(const char *cutName, CaloAxis *xCaloAxis, CaloAxis *yCaloAxis, UInt_t iMethod,
17        Float_t xTolCaloTrack, Float_t yTolCaloTrack, Float_t mass, Float_t zeta, Float_t resMax, Float_t qualCut, Float_t chi2Cut) :
18        PamCut(cutName), _xCaloAxis(xCaloAxis), _yCaloAxis(yCaloAxis), _iMethod(iMethod), _xTolCaloTrack(xTolCaloTrack), _yTolCaloTrack(
19            yTolCaloTrack), _mass(mass),  _zeta(zeta), _resMax(resMax), _qualCut(qualCut), _chi2Cut(chi2Cut), _traj(NULL), _zIn(_nPoint) {
20    
21      if (_iMethod == 1) {
22        _traj = (Trajectory*) new Trajectory(_nPoint);
23    
24        for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {
25          _zIn[igf] = TrkParams::zGF[igf];
26        }
27        _zIn[TrkParams::nGF] = _zCaloTop;
28    
29      }
30    }
31    
32    /*! @brief Destructor. */
33    CaloGeomCut::~CaloGeomCut() {
34    
35      delete _traj;
36    }
37    
38  int CaloGeomCut::Check(PamLevel2 *event) {  int CaloGeomCut::Check(PamLevel2 *event) {
39    
40    float xCaloTrack;    Float_t xCaloTrack = 0.;
41    float yCaloTrack;    Float_t yCaloTrack = 0.;
42    
43      Double_t tanx, tany, beta;
44      Float_t alCaloTop[5]; // MUST be Float_t
45    
46      tanx = _xCaloAxis->par[1];
47      tany = _yCaloAxis->par[1];
48    
49      if (_iMethod == 0) {
50      }
51      else if (_iMethod == 1) { // curved track in the Pamela acceptance (back-propagated starting from the straight track in the calorimeter, evaluated at the top of calorimeter, which is of course better than at higher z coordinates)
52    
53        alCaloTop[0] = _xCaloAxis->GetYfit(_zCaloTop); // Yfit   [xCaloTop]
54        alCaloTop[1] = _yCaloAxis->GetYfit(_zCaloTop); // Yfit  [yCaloTop]
55        alCaloTop[2] = sin(atan(sqrt(pow(tanx, 2) + pow(tany, 2)))); // [sintheta]
56        alCaloTop[3] = TMath::Pi() + atan2(tany, tanx); // [phi]
57    
58        beta = event->GetToFLevel2()->CalcBeta(0, _resMax, _qualCut, _chi2Cut); // TOF stand-alone beta
59        alCaloTop[4] = 1. / ((_mass/_zeta) * beta / sqrt(1. - pow(beta, 2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))]
60    
61        _traj->DoTrack(alCaloTop, _zCaloTop);
62    
63      }
64      else {
65        return 1;
66      }
67    
68    for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {    for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {
69      xCaloTrack = _xCaloAxis->par[0] + (_xCaloAxis->par[1]) * TrkParams::zGF[igf]; // cm  
70      if (! (TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack && xCaloTrack < TrkParams::xGF_max[igf]      if (_iMethod == 0) { // straight track
71          - _xTolCaloTrack) ) {        // NOTE: par[0] is the x (y) coordinate on plane z=0 in PAMELA reference (magnet centre)
72          xCaloTrack = _xCaloAxis->par[0] + tanx * TrkParams::zGF[igf]; // cm
73          yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm
74        }
75        else if (_iMethod == 1) {
76          xCaloTrack = _traj->x[igf];
77          yCaloTrack = _traj->y[igf];
78        }
79    
80        if (!(TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack
81            && xCaloTrack < TrkParams::xGF_max[igf] - _xTolCaloTrack)) {
82        return 0;        return 0;
83      }      }
84    
85      yCaloTrack = _yCaloAxis->par[0] + (_yCaloAxis->par[1]) * TrkParams::zGF[igf]; // cm      if (!(TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack
86      if (! (TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack && yCaloTrack < TrkParams::yGF_max[igf]          && yCaloTrack < TrkParams::yGF_max[igf] - _yTolCaloTrack)) {
         - _yTolCaloTrack) ) {  
87        return 0;        return 0;
88      }      }
89    
90    }    }
91    
92    return CUTOK;    return CUTOK;
93    
94  }  }
95    
96    #endif /* NO_CALOAXIS */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23