/[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.3.2.1 by pam-fi, Thu Jul 8 10:43:11 2010 UTC revision 1.5 by pam-fi, Thu Jul 28 13:26:31 2011 UTC
# Line 10  Line 10 
10  #ifndef NO_CALOAXIS  #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 resMax, Float_t qualCut, Float_t chi2Cut) :
18        PamCut(cutName), _xCaloAxis(xCaloAxis), _yCaloAxis(yCaloAxis), _iMethod(iMethod), _xTolCaloTrack(xTolCaloTrack), _yTolCaloTrack(
19            yTolCaloTrack), _mass(mass), _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_t xCaloTrack = 0.;    Float_t xCaloTrack = 0.;
41    Float_t yCaloTrack = 0.;    Float_t yCaloTrack = 0.;
42      
43    Double_t tanx, tany, beta;    Double_t tanx, tany, beta;
44    Float_t alCaloTop[5]; // MUST be Float_t    Float_t alCaloTop[5]; // MUST be Float_t
45    Int_t nPoint = TrkParams::nGF+1; // MUST be Int_t  
46    Float_t zIn[nPoint]; // MUST be Float_t    tanx = _xCaloAxis->par[1];
47        tany = _yCaloAxis->par[1];
48    Trajectory* traj = NULL;  
49        if (_iMethod == 0) {
   static const Float_t zCaloTop=-26.181; // cm MUST Float_t  
   
   tanx=_xCaloAxis->par[1];  
   tany=_yCaloAxis->par[1];  
           
   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)    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      for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {  
53        zIn[igf]=TrkParams::zGF[igf];      alCaloTop[0] = _xCaloAxis->GetYfit(_zCaloTop); // Yfit   [xCaloTop]
54      }      alCaloTop[1] = _yCaloAxis->GetYfit(_zCaloTop); // Yfit  [yCaloTop]
55      zIn[TrkParams::nGF]=zCaloTop;      alCaloTop[2] = sin(atan(sqrt(pow(tanx, 2) + pow(tany, 2)))); // [sintheta]
56            alCaloTop[3] = TMath::Pi() + atan2(tany, tanx); // [phi]
     traj = (Trajectory*) new Trajectory(nPoint,zIn);  
       
     alCaloTop[0]=_xCaloAxis->GetYfit(zCaloTop); // Yfit   [xCaloTop]  
     alCaloTop[1]=_yCaloAxis->GetYfit(zCaloTop); // Yfit  [yCaloTop]  
     alCaloTop[2]=sin(atan(sqrt(pow(tanx,2)+pow(tany,2)))); // [sintheta]  
     alCaloTop[3]=TMath::Pi()+atan2(tany,tanx); // [phi]  
57    
58      beta = event->GetToFLevel2()->CalcBeta(0,_resMax,_qualCut,_chi2Cut); // TOF stand-alone beta      beta = event->GetToFLevel2()->CalcBeta(0, _resMax, _qualCut, _chi2Cut); // TOF stand-alone beta
59      alCaloTop[4] = 1./(_mass*beta/sqrt(1.-pow(beta,2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))]      alCaloTop[4] = 1. / (_mass * beta / sqrt(1. - pow(beta, 2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))]
60    
61        _traj->DoTrack(alCaloTop, _zCaloTop);
62    
     traj->DoTrack(alCaloTop,zCaloTop);  
         
63    }    }
64    else {    else {
65      return 1;      return 1;
66    }    }
67    
68    for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {    for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {
69          
70      if (_iMethod==0) { // straight track      if (_iMethod == 0) { // straight track
71        // NOTE: par[0] is the x (y) coordinate on plane z=0 in PAMELA reference (magnet centre)        // 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        xCaloTrack = _xCaloAxis->par[0] + tanx * TrkParams::zGF[igf]; // cm
73        yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm        yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm
74      }      }
75      else if (_iMethod==1) {      else if (_iMethod == 1) {
76        xCaloTrack = traj->x[igf];        xCaloTrack = _traj->x[igf];
77        yCaloTrack = traj->y[igf];        yCaloTrack = _traj->y[igf];
78      }      }
79        
80      if (! (TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack && xCaloTrack < TrkParams::xGF_max[igf]      if (!(TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack
81          - _xTolCaloTrack) ) {          && xCaloTrack < TrkParams::xGF_max[igf] - _xTolCaloTrack)) {
82        return 0;        return 0;
83      }      }
84    
85      if (! (TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack && yCaloTrack < TrkParams::yGF_max[igf]      if (!(TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack
86          - _yTolCaloTrack) ) {          && yCaloTrack < TrkParams::yGF_max[igf] - _yTolCaloTrack)) {
87        return 0;        return 0;
88      }      }
89        
90    }    }
91    
92    return CUTOK;    return CUTOK;
93      
94  }  }
95    
96  #endif /* NO_CALOAXIS */  #endif /* NO_CALOAXIS */

Legend:
Removed from v.1.3.2.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23