]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityPairCut.cxx
Remove verbose output
[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   if ((fShareFractionMax < 1.0) && ( fShareQualityMax < 1.0)) {
55     for (unsigned int imap=0; imap<pair->Track1()->Track()->TPCclusters().GetNbits(); imap++) {
56       // If both have clusters in the same row
57       if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) && 
58           pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
59         // Do they share it ?
60         if (pair->Track1()->Track()->TPCsharing().TestBitNumber(imap) &&
61             pair->Track2()->Track()->TPCsharing().TestBitNumber(imap))
62           {
63             //    cout << "A shared cluster !!!" << endl;
64             //  cout << "imap idx1 idx2 " 
65             //       << imap << " "
66             //       << tP1idx[imap] << " " << tP2idx[imap] << endl;
67             an++;
68             nh+=2;
69             ns+=2;
70           }
71         
72         // Different hits on the same padrow
73         else {
74           an--;
75           nh+=2;
76         }
77       }
78       else if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) ||
79                pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
80         // One track has a hit, the other does not
81         an++;
82         nh++;
83       }
84     }
85     
86     Float_t hsmval = 0.0;
87     Float_t hsfval = 0.0;
88     
89     if (nh >0) {
90       hsmval = an*1.0/nh;
91       hsfval = ns*1.0/nh;
92     }
93     //  if (hsmval > -0.4) {
94     //   cout << "Pair quality: " << hsmval << " " << an << " " << nh << " " 
95     //        << (pair->Track1()->Track()) << " " 
96     //        << (pair->Track2()->Track()) << endl;
97     //   cout << "Bits: " << pair->Track1()->Track()->TPCclusters().GetNbits() << endl;
98     //  }
99     //   if (hsfval > 0.0) {
100     //     cout << "Pair sharity: " << hsfval << " " << ns << " " << nh << "    " << hsmval << " " << an << " " << nh << endl;
101     //   }
102     
103     temp = (hsmval < fShareQualityMax) && (hsfval < fShareFractionMax);
104   }
105   else
106     temp = true;
107
108   if (fRemoveSameLabel) {
109     if (abs(pair->Track1()->Track()->Label()) == abs(pair->Track2()->Track()->Label())) {
110 //       cout << "Found a pair with same label " << pair->Track1()->Track()->Label() << endl;
111 //       cout << "Quality Sharity Passed " << hsmval << " " << hsfval << " " << pair->QInv() << " " << temp << endl;
112       temp = kFALSE;
113     }
114   }
115
116   temp ? fNPairsPassed++ : fNPairsFailed++;
117   return temp;
118 }
119 //__________________
120 AliFemtoString AliFemtoShareQualityPairCut::Report(){
121   // Prepare the report from the execution
122   string stemp = "AliFemtoShareQuality Pair Cut - remove shared and split pairs\n";  char ctemp[100];
123   snprintf(ctemp , 100, "Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
124   stemp += ctemp;
125   AliFemtoString returnThis = stemp;
126   return returnThis;}
127 //__________________
128
129 void AliFemtoShareQualityPairCut::SetShareQualityMax(Double_t aShareQualityMax) {
130   fShareQualityMax = aShareQualityMax;
131 }
132
133 Double_t AliFemtoShareQualityPairCut::GetAliFemtoShareQualityMax() const {
134   return fShareQualityMax;
135 }
136
137 void AliFemtoShareQualityPairCut::SetShareFractionMax(Double_t aShareFractionMax) {
138   fShareFractionMax = aShareFractionMax;
139 }
140 Double_t AliFemtoShareQualityPairCut::GetAliFemtoShareFractionMax() const {
141   return fShareFractionMax;
142 }
143
144 TList *AliFemtoShareQualityPairCut::ListSettings()
145 {
146   // return a list of settings in a writable form
147   TList *tListSetttings = new TList();
148   char buf[200];
149   snprintf(buf, 200, "AliFemtoShareQualityPairCut.sharequalitymax=%f", fShareQualityMax);
150   snprintf(buf, 200, "AliFemtoShareQualityPairCut.sharefractionmax=%f", fShareFractionMax);
151   tListSetttings->AddLast(new TObjString(buf));
152
153   return tListSetttings;
154 }
155
156 void     AliFemtoShareQualityPairCut::SetRemoveSameLabel(Bool_t aRemove)
157 {
158   fRemoveSameLabel = aRemove;
159 }