/[PAMELA software]/PamCut/TrkCuts/TrkDedxHeCut/TrkDedxHeCut.cpp
ViewVC logotype

Diff of /PamCut/TrkCuts/TrkDedxHeCut/TrkDedxHeCut.cpp

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

revision 1.1 by pam-fi, Wed Jun 10 12:37:57 2009 UTC revision 1.2 by pam-fi, Mon May 3 14:36:27 2010 UTC
# Line 1  Line 1 
1  /*  /*
2   * TrkDedxHeCut.cpp   * TrkDedxHeCut.cpp
3   *   *
4   *  Created on: 19-may-2009   *  Created on: 28/gen/2010
5   *      Author: N. Nikonov   *      Author: Nicola Mori
6   */   */
7    
8  /*! @file TrkDedxHeCut.cpp The TrkDedxHeCut class implementation file. */  /*! @file TrkDedxHeCut.cpp The TrkDedxHeCut class implementation file. */
# Line 11  Line 11 
11    
12  int TrkDedxHeCut::Check(PamLevel2 *event) {  int TrkDedxHeCut::Check(PamLevel2 *event) {
13    
14    TrkTrack* trk2 = event->GetTrack(0)->GetTrkTrack();    TrkTrack *track = event->GetTrack(0)->GetTrkTrack();
15    Double_t rig = trk2->GetRigidity();    float R = track->GetRigidity();
16    Double_t dedxtr = trk2->GetDEDX();    //float dEdx = track->GetDEDX();
17    
18  #ifdef DEBUGPAMCUT    // New smart dE/dx computation
19    h_dedx_rig_before->Fill(rig, dedxtr);    // This procedure removes high releases and computes dE/dx
20  #endif    float totReleaseX = 0., maxReleaseX = 0.;
21      float totReleaseY = 0., maxReleaseY = 0.;
22    if ( !CutHeDEDXrig(rig,dedxtr,1.15,_cuthededxrig) ||    int nX = 0, nY = 0;
23         CutHeDEDXrig(rig,dedxtr,0.5,_cuthededxrig)) return 0;    float dEdxView = 0;
24      /*
25  #ifdef DEBUGPAMCUT     ToFLevel2 *tofL2 = event->GetToFLevel2();
26    h_dedx_rig_after->Fill(rig, dedxtr);     int trkSeqNo = 0;
27  #endif     for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
28       if (tofL2->GetToFTrkVar(i)->trkseqno == track->GetSeqNo()) {
29    return CUTOK;     trkSeqNo = i;
30  }     break;
31       }
32       }
33  TF1* TrkDedxHeCut::BBbetagamma(Float_t m_GeV, Float_t z, Int_t Z, Float_t A, Float_t I_eV, Double_t xmin, Double_t xmax, Float_t C_positive, Float_t a, Float_t m, Float_t x0, Float_t x1, Float_t scale)     if ((tofL2->GetdEdx(trkSeqNo, 0, 100) + tofL2->GetdEdx(trkSeqNo, 1, 100) + tofL2->GetdEdx(trkSeqNo, 2, 100)
34  {     + tofL2->GetdEdx(trkSeqNo, 3, 100)) / 4. < 2) {
35    TF1* f;     cout << "Check" << endl;
36    if(C_positive != 0.) {     for (int ip = 0; ip < 6; ip++) {
37      // do density correction     cout << "TOF" << ip << ": " << tofL2->GetdEdx(trkSeqNo, ip, 100) << endl;
38      // x<x_0 ( delta = 0)     dEdxView = track->GetDEDX(ip, 0);
39      // I don't need a function in this range     if (dEdxView > 0 && track->XGood(ip))
40      // x0<x<x1     cout << "X" << ip << ": " << dEdxView << endl;
41      // I build the function as a string.     dEdxView = track->GetDEDX(ip, 1);
42      TString delta2 = "(4.6052*log([1]*x/[0])/log(10)-[5]+[6]*pow(([9]-log([1]*x/[0])/log(10)),[7])) * (([8] <= log([1]*x/[0])) && ( log([1]*x/[0])/log(10)  < [9] ) )";     if (dEdxView > 0 && track->YGood(ip))
43      // x>x1     cout << "Y" << ip << ": " << dEdxView << endl;
44      TString delta3 = "(4.6052*log([1]*x/[0])/log(10)-[5]) * (log([1]*x/[0])/log(10) >= [9])";     }
45       }
46      TString fstring = "[10]*(.3071 * ([2]/[3]) * [1]^2 / ([0]^2/([1]*x)^2+1)^-1 * ( 1./2 * log( (2 * 511e3 * ([1]*x/[0])^2 )^2 ) - log([4]) - ([0]^2/([1]*x)^2+1)^-1 - (";     */
47      fstring += delta2.Data();    for (int ip = 0; ip < 6; ip++) {
48      fstring += "+";      // X view
49      fstring += delta3.Data();      dEdxView = track->GetDEDX(ip, 0);
50      fstring += ")/2))";      if (dEdxView > 0 && track->XGood(ip)) {
51      f = new TF1("bethebloch", fstring.Data());        totReleaseX += dEdxView;
52          nX++;
53          if (dEdxView > maxReleaseX)
54            maxReleaseX = dEdxView;
55        }
56        // Y view
57        dEdxView = track->GetDEDX(ip, 1);
58        if (dEdxView > 0 && track->YGood(ip)) {
59          totReleaseY += dEdxView;
60          nY++;
61          if (dEdxView > maxReleaseY)
62            maxReleaseY = dEdxView;
63        }
64    }    }
   else  
     f = new TF1("bethebloch", ".3071 * ([2]/[3]) * [1]^2 / ([0]^2/([1]*x)^2+1)^-1 * ( 1./2 * log( (2 * 511e3 * ([1]*x/[0])^2 )^2 ) - log([4]) - ([0]^2/([1]*x)^2+1)^-1)");  
   f->SetParameters(m_GeV, z, Z, A, I_eV, C_positive, a, m, x0, x1,scale);  
65    
66    return f;    // Discard highest release, eventually
67  }    if (maxReleaseX > -9. + 4. * totReleaseX / (float) nX) {
68        totReleaseX -= maxReleaseX;
69        nX--;
70      }
71      if (maxReleaseY > -8. + 4. * totReleaseY / (float) nY) {
72        totReleaseY -= maxReleaseY;
73        nY--;
74      }
75    
76      // Compute dE/dx
77      //float dEdx = (totReleaseX + totReleaseY) / (float) (nX + nY);
78      float dEdxX = totReleaseX / nX;
79      float dEdxY = totReleaseY / nY;
80    
81      // Analyze the event
82      // X
83      float denLow = pow(R, 1.8); // The power of the denominator is the same for X and Y (with current calibration)
84      float denHigh = pow(R, 1.5);
85      if (dEdxX < 3.7 + 4.6 / denLow)
86        return 0;
87      if (dEdxX > 8.9 + 17. / denHigh)
88        return 0;
89      // Y
90      if (dEdxY < 3.3 + 4.9 / denLow)
91        return 0;
92      if (dEdxY > 8.0 + 17. / denHigh)
93        return 0;
94      //X+Y
95      /*if (dEdx < 3.7 + 4.8 / (R * R))
96        return 0;
97      if (dEdx > 8.9 + 17. / (R * R))
98        return 0;*/
99    
100  Bool_t TrkDedxHeCut::CutHeDEDXrig(Float_t rig, Float_t dedx,    return CUTOK;
                                          Float_t factor, TF1* _cuthededxrig){  
   if(factor != 1.) dedx = dedx*factor;  
   if(rig < 0.2)  return kFALSE;  
   if(dedx > 0.55*_cuthededxrig->Eval(rig)) return kTRUE;  
   else return kFALSE;  
101  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.23