]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx
Fixing Effective C++ warnings
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / Cut / AliFemtoShareQualityPairCut.cxx
1 /***************************************************************************
2  *
3  * $Id$
4  *
5  * Author: Adam Kisiel, Ohio State, kisiel@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: AliFemtoMaker package
9  *   a cut to remove "shared" and "split" pairs
10  *
11  ***************************************************************************
12  *
13  *
14  **************************************************************************/
15
16 #include "AliFemtoShareQualityPairCut.h"
17 #include <string>
18 #include <cstdio>
19
20 #ifdef __ROOT__
21 ClassImp(AliFemtoShareQualityPairCut)
22 #endif
23
24 //__________________
25 AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut():
26   fNPairsPassed(0),
27   fNPairsFailed(0),
28   fShareQualityMax(1.0)
29 {
30 }
31 //__________________
32 AliFemtoShareQualityPairCut::~AliFemtoShareQualityPairCut(){
33   /* no-op */
34 }
35 //__________________
36 bool AliFemtoShareQualityPairCut::Pass(const AliFemtoPair* pair){
37   bool temp;
38   
39   Int_t nh = 0;
40   Int_t an = 0;
41   Int_t ns = 0;
42   
43   for (unsigned int imap=0; imap<pair->track1()->Track()->TPCclusters().GetNbits(); imap++) {
44     // If both have clusters in the same row
45     if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) && 
46         pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
47       // Do they share it ?
48       if (pair->track1()->Track()->TPCsharing().TestBitNumber(imap) &&
49           pair->track2()->Track()->TPCsharing().TestBitNumber(imap))
50         {
51           //      cout << "A shared cluster !!!" << endl;
52           //    cout << "imap idx1 idx2 " 
53           //         << imap << " "
54           //         << tP1idx[imap] << " " << tP2idx[imap] << endl;
55           an++;
56           nh+=2;
57           ns+=2;
58         }
59       
60       // Different hits on the same padrow
61       else {
62         an--;
63         nh+=2;
64       }
65     }
66     else if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) ||
67              pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
68       // One track has a hit, the other does not
69       an++;
70       nh++;
71     }
72   }
73   
74   Float_t hsmval = 0.0;
75   Float_t hsfval = 0.0;
76
77   if (nh >0) {
78     hsmval = an*1.0/nh;
79     hsfval = ns*1.0/nh;
80   }
81   //  if (hsmval > -0.4) {
82   cout << "Pair quality: " << hsmval << " " << an << " " << nh << " " 
83        << (pair->track1()->Track()) << " " 
84        << (pair->track2()->Track()) << endl;
85   cout << "Bits: " << pair->track1()->Track()->TPCclusters().GetNbits() << endl;
86     //  }
87   if (hsfval > 0.0) {
88     cout << "Pair sharity: " << hsfval << " " << ns << " " << nh << "    " << hsmval << " " << an << " " << nh << endl;
89   }
90
91   temp = hsmval < fShareQualityMax;
92
93   temp ? fNPairsPassed++ : fNPairsFailed++;
94   return temp;
95 }
96 //__________________
97 AliFemtoString AliFemtoShareQualityPairCut::Report(){
98   string Stemp = "AliFemtoShareQuality Pair Cut - remove shared and split pairs\n";  char Ctemp[100];
99   sprintf(Ctemp,"Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
100   Stemp += Ctemp;
101   AliFemtoString returnThis = Stemp;
102   return returnThis;}
103 //__________________
104
105 void AliFemtoShareQualityPairCut::SetShareQualityMax(Double_t aShareQualityMax) {
106   fShareQualityMax = aShareQualityMax;
107 }
108
109 Double_t AliFemtoShareQualityPairCut::GetAliFemtoShareQualityMax() {
110   return fShareQualityMax;
111 }