/[PAMELA software]/PamCut/TofCuts/TofDedxS1Cut/TofDedxS1Cut.cpp
ViewVC logotype

Diff of /PamCut/TofCuts/TofDedxS1Cut/TofDedxS1Cut.cpp

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

revision 1.1.1.1 by pam-fi, Wed May 27 13:30:09 2009 UTC revision 1.3 by pam-fi, Tue Jan 3 08:57:21 2012 UTC
# Line 3  Line 3 
3   *   *
4   *  Created on: 13-mar-2009   *  Created on: 13-mar-2009
5   *      Author: Sergio Ricciarini, Nicola Mori   *      Author: Sergio Ricciarini, Nicola Mori
6     *  Reworked on: 21-jul-2011
7     *      Author: Nicola Mori, Valeria Di Felice
8   */   */
9    
10  /*! @file TofDedxS1Cut.cpp The TofDedxS1Cut class implementation file */  /*! @file TofDedxS1Cut.cpp The TofDedxS1Cut class implementation file */
# Line 11  Line 13 
13    
14  int TofDedxS1Cut::Check(PamLevel2 *event) {  int TofDedxS1Cut::Check(PamLevel2 *event) {
15    
16    int iTrackTof=0; // index initialized to 0 (TOF stand-alone track)    int idx = 0;
17    if (! (_trackTof==0) ) {    for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
18      iTrackTof=*_trackTof;      if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo())
19    }        idx = i;
20      }
   // for each layer of S1: check that there is one and only one hit paddle and identify it; if this condition is satisfied, do the check on DeDx for the paddle (otherwise no check is done)  
   
   for (int ipl=0; ipl<2; ipl++) {  
     
     int nhitpad = 0; // number of hit paddles  
     int ihitpad = 100; // identifier of hit paddle; maximum valid value is 24 (taking into account each possible TOF layer)  
     float dedxpad;  
   
     for (int ipad=0; ipad<TOFNPADLAYER[ipl]; ipad++) {  
       if (event->GetToFLevel2()->HitPaddle(ipl,ipad)) { // HitPaddle is true if and only if there are both TDC signal for that pad AND they are both 'good'  
         ihitpad=event->GetToFLevel2()->GetPaddleid(ipl,ipad);  
         nhitpad++;  
       }  
     }  
21    
22      if (nhitpad == 1) { // there is one and only one hit pad in the layer    float dEdx = 0;
23        int satwarnpad;    int nLayers = 0;
24        event->GetToFLevel2()->GetdEdxPaddle(iTrackTof,ihitpad,100,dedxpad,satwarnpad);    float dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 0, 100);
25        // NOTE: if dedxpad=0 then there is no dE/dL signal (i.e. no ADC signals to evaluate dE/dL): this means that ADC signals are under threshold and therefore event is good  
26        if ( ! (dedxpad < _maxDedxS1) ) {    // Patch to exclude S115b
27  //        cout << "return on check " << ipl << " hitpad " << ihitpad << " track id " << *_trackTof << " dedxpad " << dedxpad << endl;    ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(idx);
28          return ipl;    bool has8 = false, has9 = false;
29        }    float dedx9 = 0.;
30      for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) {
31        if (tofTrk->pmtadc[ib] == 8) {
32          has8 = true;
33      }      }
34                  if (tofTrk->pmtadc[ib] == 9) {
35          has9 = true;
36          dedx9 = tofTrk->dedx[ib];
37        }
38      }
39    
40      if (has9){
41        dEdxLayer -= (dedx9 / ((int) has8 + 1));
42        dEdxLayer *= 2.;
43      }
44      //End of patch
45    
46      if (dEdxLayer > 0. && dEdxLayer < 4090) {
47        dEdx += dEdxLayer;
48        nLayers++;
49      }
50      dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 1, 100);
51      if (dEdxLayer > 0. && dEdxLayer < 4090) {
52        dEdx += dEdxLayer;
53        nLayers++;
54      }
55    
56      if (nLayers > 0) {
57        dEdx /= nLayers;
58    
59        float R = event->GetTrack(0)->GetTrkTrack()->GetRigidity();
60    
61        if (dEdx >= (3.102 - 2.6 * TMath::Log(R)) * (R < 1.05) + 3. * (R >= 1.05))
62          return 0;
63    
64        return CUTOK;
65    //    if (dEdx < (3.102 - 2.6 * TMath::Log(R)) * (R < 1.05) + 3. * (R >= 1.05))
66    //      return 0;
67    //
68    //    return CUTOK;
69      }
70      else {
71        return 0;
72    }    }
73    
   return CUTOK;  
     
74  }  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23