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

Diff of /PamCut/CaloCuts/CaloGeomYSensCut/CaloGeomYSensCut.cpp

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

revision 1.1 by pam-fi, Thu May 6 17:08:03 2010 UTC revision 1.2 by pam-fi, Thu Jul 8 14:00:08 2010 UTC
# Line 0  Line 1 
1    /*
2     * CaloGeomYSensCut.cpp
3     *
4     *  Created on: 13-apr-2010
5     *      Author: S. Ricciarini
6     */
7    
8    /*! @file CaloGeomYSensCut.cpp The CaloGeomYSens class implementation file */
9    
10    #ifndef NO_CALOAXIS
11    
12    #include "CaloGeomYSensCut.h"
13    
14    int CaloGeomYSensCut::Check(PamLevel2 *event) {
15    
16      Float_t ySensBorder=-0.25; // cm for TRK planes T1-T5
17      Float_t ySensBorderT6=+0.25; // cm for TRK plane T6
18    
19      Float_t xCaloTrack = 0.;
20      Float_t yCaloTrack = 0.;
21      
22      Double_t tanx, tany, beta;
23      Float_t alCaloTop[5]; // MUST be Float_t
24      Int_t nPoint = TrkParams::nGF+1; // MUST be Int_t
25      Float_t zIn[nPoint]; // MUST be Float_t
26      
27      Trajectory* traj = NULL;
28      
29      static const Float_t zCaloTop=-26.181; // cm MUST Float_t
30    
31      tanx=_xCaloAxis->par[1];
32      tany=_yCaloAxis->par[1];
33            
34      if (_iMethod==0) {
35      }
36      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)
37        for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {
38          zIn[igf]=TrkParams::zGF[igf];
39        }
40        zIn[TrkParams::nGF]=zCaloTop;
41        
42        traj = (Trajectory*) new Trajectory(nPoint,zIn);
43        
44        alCaloTop[0]=_xCaloAxis->GetYfit(zCaloTop); // Yfit   [xCaloTop]
45        alCaloTop[1]=_yCaloAxis->GetYfit(zCaloTop); // Yfit  [yCaloTop]
46        alCaloTop[2]=sin(atan(sqrt(pow(tanx,2)+pow(tany,2)))); // [sintheta]
47        alCaloTop[3]=TMath::Pi()+atan2(tany,tanx); // [phi]
48    
49        beta = event->GetToFLevel2()->CalcBeta(0,_resMax,_qualCut,_chi2Cut); // TOF stand-alone beta
50        alCaloTop[4] = 1./(_mass*beta/sqrt(1.-pow(beta,2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))]
51    
52        traj->DoTrack(alCaloTop,zCaloTop);
53          
54      }
55      else {
56        return 1;
57      }
58    
59      for (Int_t igf = 0; igf < TrkParams::nGF; igf++) {
60          
61        if (_iMethod==0) { // straight track
62          // NOTE: par[0] is the x (y) coordinate on plane z=0 in PAMELA reference (magnet centre)
63          xCaloTrack = _xCaloAxis->par[0] + tanx * TrkParams::zGF[igf]; // cm
64          yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm
65        }
66        else if (_iMethod==1) {
67          xCaloTrack = traj->x[igf];
68          yCaloTrack = traj->y[igf];
69        }
70        
71        if (! (TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack && xCaloTrack < TrkParams::xGF_max[igf]
72            - _xTolCaloTrack) ) {
73          return 0;
74        }
75    
76        if (! (TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack && yCaloTrack < TrkParams::yGF_max[igf]
77            - _yTolCaloTrack) ) {
78          return 0;
79        }
80    
81        if (_ySens==0) {    
82          if (igf==4 || (6<=igf && igf<=9) ) { // T1-T5
83    //        cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorder << endl;  
84            if (! (yCaloTrack < ySensBorder) ) {
85    //        cout << "NO" << endl;
86              return 0;
87            }
88          }
89          else if (igf==11) { // T6
90    //        cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorderT6 << endl;
91            if (! (yCaloTrack < ySensBorderT6) ) {
92    //        cout << "NO" << endl;
93              return 0;
94            }
95          }
96        }
97        else if (_ySens==1) {
98          if (igf==4 || (6<=igf && igf<=9) ) { // T1-T5
99    //        cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorder << endl;
100            if (! (yCaloTrack > ySensBorder) ) {
101    //        cout << "NO" << endl;
102              return 0;
103            }
104          }
105          else if (igf==11) { // T6
106    //        cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorderT6 << endl;
107            if (! (yCaloTrack > ySensBorderT6) ) {
108    //        cout << "NO" << endl;
109              return 0;
110            }
111          }    
112        }
113        else {
114          return 0;
115        }
116        
117      }
118    
119      return CUTOK;
120      
121    }
122    
123    #endif /* NO_CALOAXIS */

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

  ViewVC Help
Powered by ViewVC 1.1.23