]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityPairCut.cxx
removed obsolete commented methods
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoShareQualityPairCut.cxx
1 /////////////////////////////////////////////////////////////////////////////
2 //                                                                         //
3 // AliFemtoShareQualityPairCut - a pair cut which checks for some pair     //
4 // qualities that attempt to identify slit/doubly reconstructed tracks     //
5 //                                                                         //
6 /////////////////////////////////////////////////////////////////////////////
7 /***************************************************************************
8  *
9  * $Id$
10  *
11  * Author: Adam Kisiel, Ohio State, kisiel@mps.ohio-state.edu
12  ***************************************************************************
13  *
14  * Description: part of STAR HBT Framework: AliFemtoMaker package
15  *   a cut to remove "shared" and "split" pairs
16  *
17  ***************************************************************************
18  *
19  *
20  **************************************************************************/
21
22 #include "AliFemtoShareQualityPairCut.h"
23 #include <string>
24 #include <cstdio>
25
26 #ifdef __ROOT__
27 ClassImp(AliFemtoShareQualityPairCut)
28 #endif
29
30 //__________________
31 AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut():
32   fNPairsPassed(0),
33   fNPairsFailed(0),
34   fShareQualityMax(1.0),
35   fShareFractionMax(1.0),
36   fRemoveSameLabel(0)
37 {
38   // Default constructor
39   // Nothing to do
40 }
41 //__________________
42 AliFemtoShareQualityPairCut::~AliFemtoShareQualityPairCut(){
43   /* no-op */
44 }
45 //__________________
46 bool AliFemtoShareQualityPairCut::Pass(const AliFemtoPair* pair){
47   // Check for pairs that are possibly shared/double reconstruction
48   bool temp;
49   
50   Int_t nh = 0;
51   Int_t an = 0;
52   Int_t ns = 0;
53   
54   for (unsigned int imap=0; imap<pair->Track1()->Track()->TPCclusters().GetNbits(); imap++) {
55     // If both have clusters in the same row
56     if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) && 
57         pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
58       // Do they share it ?
59       if (pair->Track1()->Track()->TPCsharing().TestBitNumber(imap) &&
60           pair->Track2()->Track()->TPCsharing().TestBitNumber(imap))
61         {
62           //      cout << "A shared cluster !!!" << endl;
63           //    cout << "imap idx1 idx2 " 
64           //         << imap << " "
65           //         << tP1idx[imap] << " " << tP2idx[imap] << endl;
66           an++;
67           nh+=2;
68           ns+=2;
69         }
70       
71       // Different hits on the same padrow
72       else {
73         an--;
74         nh+=2;
75       }
76     }
77     else if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) ||
78              pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
79       // One track has a hit, the other does not
80       an++;
81       nh++;
82     }
83   }
84   
85   Float_t hsmval = 0.0;
86   Float_t hsfval = 0.0;
87
88   if (nh >0) {
89     hsmval = an*1.0/nh;
90     hsfval = ns*1.0/nh;
91   }
92   //  if (hsmval > -0.4) {
93 //   cout << "Pair quality: " << hsmval << " " << an << " " << nh << " " 
94 //        << (pair->Track1()->Track()) << " " 
95 //        << (pair->Track2()->Track()) << endl;
96 //   cout << "Bits: " << pair->Track1()->Track()->TPCclusters().GetNbits() << endl;
97     //  }
98 //   if (hsfval > 0.0) {
99 //     cout << "Pair sharity: " << hsfval << " " << ns << " " << nh << "    " << hsmval << " " << an << " " << nh << endl;
100 //   }
101
102   temp = (hsmval < fShareQualityMax) && (hsfval < fShareFractionMax);
103
104   if (fRemoveSameLabel) {
105     if (abs(pair->Track1()->Track()->Label()) == abs(pair->Track2()->Track()->Label())) {
106       cout << "Found a pair with same label " << pair->Track1()->Track()->Label() << endl;
107       cout << "Quality Sharity Passed " << hsmval << " " << hsfval << " " << pair->QInv() << " " << temp << endl;
108       temp = kFALSE;
109     }
110   }
111
112   temp ? fNPairsPassed++ : fNPairsFailed++;
113   return temp;
114 }
115 //__________________
116 AliFemtoString AliFemtoShareQualityPairCut::Report(){
117   // Prepare the report from the execution
118   string stemp = "AliFemtoShareQuality Pair Cut - remove shared and split pairs\n";  char ctemp[100];
119   sprintf(ctemp,"Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
120   stemp += ctemp;
121   AliFemtoString returnThis = stemp;
122   return returnThis;}
123 //__________________
124
125 void AliFemtoShareQualityPairCut::SetShareQualityMax(Double_t aShareQualityMax) {
126   fShareQualityMax = aShareQualityMax;
127 }
128
129 Double_t AliFemtoShareQualityPairCut::GetAliFemtoShareQualityMax() const {
130   return fShareQualityMax;
131 }
132
133 void AliFemtoShareQualityPairCut::SetShareFractionMax(Double_t aShareFractionMax) {
134   fShareFractionMax = aShareFractionMax;
135 }
136 Double_t AliFemtoShareQualityPairCut::GetAliFemtoShareFractionMax() const {
137   return fShareFractionMax;
138 }
139
140 TList *AliFemtoShareQualityPairCut::ListSettings()
141 {
142   // return a list of settings in a writable form
143   TList *tListSetttings = new TList();
144   char buf[200];
145   snprintf(buf, 200, "AliFemtoShareQualityPairCut.sharequalitymax=%f", fShareQualityMax);
146   snprintf(buf, 200, "AliFemtoShareQualityPairCut.sharefractionmax=%f", fShareFractionMax);
147   tListSetttings->AddLast(new TObjString(buf));
148
149   return tListSetttings;
150 }
151
152 void     AliFemtoShareQualityPairCut::SetRemoveSameLabel(Bool_t aRemove)
153 {
154   fRemoveSameLabel = aRemove;
155 }