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