Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoCorrFctnTPCNcls.cxx
CommitLineData
2e704fab 1////////////////////////////////////////////////////////////////////////////////
2// //
3// AliFemtoCorrFctnTPCNcls - A correlation function that saves the correlation//
4// function as a function of number of TPC clusters of the track //
5// //
6// Authors: Adam Kisiel kisiel@mps.ohio-state.edu //
7// //
8////////////////////////////////////////////////////////////////////////////////
9
10#include "AliFemtoCorrFctnTPCNcls.h"
11//#include "AliFemtoHisto.hh"
12#include <cstdio>
13
14#ifdef __ROOT__
15ClassImp(AliFemtoCorrFctnTPCNcls)
16#endif
17
18//____________________________
19AliFemtoCorrFctnTPCNcls::AliFemtoCorrFctnTPCNcls(char* title, const int& nbins, const float& QinvLo, const float& QinvHi):
20 AliFemtoCorrFctn(),
21 fNclsTPCMinNumerator(0),
22 fNclsTPCMinDenominator(0)
23{
24 // set up numerator
95647492 25 char tTitNum[101] = "NumNclsTPCMin";
adecdc37 26 strncat(tTitNum,title, 100);
2e704fab 27 fNclsTPCMinNumerator = new TH2D(tTitNum,title,nbins,QinvLo,QinvHi,159,0.5,159.5);
28 // set up denominator
95647492 29 char tTitDen[101] = "DenNclsTPCMin";
adecdc37 30 strncat(tTitDen,title, 100);
2e704fab 31 fNclsTPCMinDenominator = new TH2D(tTitDen,title,nbins,QinvLo,QinvHi,159,0.5,159.5);
32
33 // to enable error bar calculation...
34 fNclsTPCMinNumerator->Sumw2();
35 fNclsTPCMinDenominator->Sumw2();
36}
37
38//____________________________
39AliFemtoCorrFctnTPCNcls::AliFemtoCorrFctnTPCNcls(const AliFemtoCorrFctnTPCNcls& aCorrFctn) :
40 AliFemtoCorrFctn(),
41 fNclsTPCMinNumerator(0),
42 fNclsTPCMinDenominator(0)
43{
44 // copy constructor
45 if (aCorrFctn.fNclsTPCMinNumerator)
46 fNclsTPCMinNumerator = new TH2D(*aCorrFctn.fNclsTPCMinNumerator);
47 if (aCorrFctn.fNclsTPCMinDenominator)
48 fNclsTPCMinDenominator = new TH2D(*aCorrFctn.fNclsTPCMinDenominator);
49}
50//____________________________
51AliFemtoCorrFctnTPCNcls::~AliFemtoCorrFctnTPCNcls(){
52 // destructor
53 delete fNclsTPCMinNumerator;
54 delete fNclsTPCMinDenominator;
55}
56//_________________________
57AliFemtoCorrFctnTPCNcls& AliFemtoCorrFctnTPCNcls::operator=(const AliFemtoCorrFctnTPCNcls& aCorrFctn)
58{
59 // assignment operator
60 if (this == &aCorrFctn)
61 return *this;
62
63 if (aCorrFctn.fNclsTPCMinNumerator)
64 fNclsTPCMinNumerator = new TH2D(*aCorrFctn.fNclsTPCMinNumerator);
65 else
66 fNclsTPCMinNumerator = 0;
67 if (aCorrFctn.fNclsTPCMinDenominator)
68 fNclsTPCMinDenominator = new TH2D(*aCorrFctn.fNclsTPCMinDenominator);
69 else
70 fNclsTPCMinDenominator = 0;
71
72 return *this;
73}
74//_________________________
75void AliFemtoCorrFctnTPCNcls::Finish(){
76 // here is where we should normalize, fit, etc...
77 // we should NOT Draw() the histos (as I had done it below),
78 // since we want to insulate ourselves from root at this level
79 // of the code. Do it instead at root command line with browser.
80 // mShareNumerator->Draw();
81 //mShareDenominator->Draw();
82 //mRatio->Draw();
83
84}
85
86//____________________________
87AliFemtoString AliFemtoCorrFctnTPCNcls::Report(){
88 // create report
89 string stemp = "TPC Ncls Correlation Function Report:\n";
90 char ctemp[100];
adecdc37 91 snprintf(ctemp , 100, "Number of entries in numerator:\t%E\n",fNclsTPCMinNumerator->GetEntries());
2e704fab 92 stemp += ctemp;
adecdc37 93 snprintf(ctemp , 100, "Number of entries in denominator:\t%E\n",fNclsTPCMinDenominator->GetEntries());
2e704fab 94 stemp += ctemp;
95 // stemp += mCoulombWeight->Report();
96 AliFemtoString returnThis = stemp;
97 return returnThis;
98}
99//____________________________
100void AliFemtoCorrFctnTPCNcls::AddRealPair( AliFemtoPair* pair){
101 // add real (effect) pair
102 double tQinv = fabs(pair->QInv()); // note - qInv() will be negative for identical pairs...
103
104 if (pair->Track1()->Track()->TPCncls()>pair->Track2()->Track()->TPCncls())
105 fNclsTPCMinNumerator->Fill(tQinv, pair->Track2()->Track()->TPCncls());
106 else
107 fNclsTPCMinNumerator->Fill(tQinv, pair->Track1()->Track()->TPCncls());
108}
109//____________________________
110void AliFemtoCorrFctnTPCNcls::AddMixedPair( AliFemtoPair* pair){
111 // add mixed (background) pair
112 double tQinv = fabs(pair->QInv()); // note - qInv() will be negative for identical pairs...
113
114 if (pair->Track1()->Track()->TPCncls()>pair->Track2()->Track()->TPCncls())
115 fNclsTPCMinDenominator->Fill(tQinv, pair->Track2()->Track()->TPCncls());
116 else
117 fNclsTPCMinDenominator->Fill(tQinv, pair->Track1()->Track()->TPCncls());
118}
119
120
121void AliFemtoCorrFctnTPCNcls::WriteHistos()
122{
123 // Write out result histograms
124 fNclsTPCMinNumerator->Write();
125 fNclsTPCMinDenominator->Write();
126}
127
128TList* AliFemtoCorrFctnTPCNcls::GetOutputList()
129{
130 // Prepare the list of objects to be written to the output
131 TList *tOutputList = new TList();
132
133 tOutputList->Add(fNclsTPCMinNumerator);
134 tOutputList->Add(fNclsTPCMinDenominator);
135
136 return tOutputList;
137
138}