StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtSplittingMacro.C
1 
2 // this macro is not really for HBT, it is a tool requested by the
3 // reco group to estimate the track splittin in the TPC from the data
4 // it makes an upper and lower limit on its estimate of the splitting
5 // malisa 15aug2000 (updated 05nov2001)
6 // an example of an analysis done with this is at:
7 //http://sol.star.bnl.gov/star/starlib/doc/www/protected/hbt/lisa/SplittingEstimate/
8 
9 class StChain;
10 StChain *chain=0;
11 
12 // keep pointers to Analysis global, so you can have access to them ...
15 
16 
17 // File-scope stuff needed by setFiles, nextFile. Someone ambitious
18 // can clean this up by putting it all into a nice clean class.
19 Int_t usePath = 0;
20 Int_t nFile = 0;
21 TString thePath;
22 TString theFileName;
23 TString originalPath;
24 
25 
26 
27 //==========================================================================================
28 void StHbtSplittingEstimate(const Int_t nevents=9999,
29  const Char_t *path="/star/data01/pwg/hbt/RandTheMan/uDSTs/P01hi/minbias/08/",
30  const Char_t *fileName="",
31  const Char_t *extention=".hbtTTreeMuDst",
32  const Char_t *filter=".",
33  const int maxFiles=10) {
34 
35  gStyle->SetTextFont(41);
36  gStyle->SetStatH(.3);
37  gStyle->SetStatW(.3);
38 
39  // Dynamically link needed shared libs
40  gSystem->Load("St_base");
41  gSystem->Load("StChain");
42  gSystem->Load("St_Tables");
43  gSystem->Load("StMagF");
44  gSystem->Load("StUtilities"); // new addition 22jul99
45  gSystem->Load("StTreeMaker");
46  gSystem->Load("StIOMaker");
47  gSystem->Load("StarClassLibrary");
48  gSystem->Load("StTpcDb");
49  gSystem->Load("StDbUtilities");
50  gSystem->Load("StEvent");
51  gSystem->Load("StEventMaker");
52  gSystem->Load("StEventUtilities");
53  gSystem->Load("StEmcUtil");
54  gSystem->Load("St_emc_Maker");
55  gSystem->Load("StMcEvent");
56  gSystem->Load("StMcEventMaker");
57  gSystem->Load("StAssociationMaker");
58  gSystem->Load("StMcAnalysisMaker");
59  // gSystem->Load("StFlowMaker");
60  // gSystem->Load("StFlowTagMaker");
61  // gSystem->Load("StFlowAnalysisMaker");
62  gSystem->Load("StStrangeMuDstMaker");
63  gSystem->Load("StHbtMaker");
64  // gSystem->Load("global_Tables");
65 
66  // cout << " loading done " << endl;
67  chain = new StChain("StChain");
68  chain->SetDebug(1);
69 
70 
71  // *********
72  // Hbt Maker
73  // *********
74 
75  StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
76  StHbtManager* TheManager = hbtMaker->HbtManager();
77 
78  StHbtTTreeReader* Reader = new StHbtTTreeReader(0,0,path,fileName,extention,filter,maxFiles);
79  TheManager->SetEventReader(Reader);
80 
81  // define example particle cut and cut monitors to use in the analyses
82  // example particle cut
83  franksTrackCut* aTrackCut = new franksTrackCut; // use "frank's" particle cut object
84  aTrackCut->SetPidProbPion(0.3,10); // make it loose
85  aTrackCut->SetNHits(10,50); // range on number of TPC hits on the track
86  aTrackCut->SetP(0.1,4.); // range in P
87  aTrackCut->SetPt(0.1,2.); // range in Pt
88  aTrackCut->SetEta(-1.1,+1.1); // range in rapidity
89  // aTrackCut->SetRapidity(-10.,10.); // range in rapidity
90  aTrackCut->SetDCA(0.0,3.); // range in Distance of Closest Approach to primary vertex
91  aTrackCut->SetCharge(-1); // want piminux
92  aTrackCut->SetMass(0.138); // pion mass
93  // define example track cut monitor
94  // trackCutMonitor_P_vs_Dedx* aDedxMoniPos = new trackCutMonitor_P_vs_Dedx(+1,"P_vs_Dedx+","Momentum (GeV/c) vs Energy loss (a.u.)",100,0.,2.,100,0.,1e-5);
95  // trackCutMonitor_P_vs_Dedx* aDedxMoniNeg = new trackCutMonitor_P_vs_Dedx(-1,"P_vs_Dedx-","Momentum (GeV/c) vs Energy loss (a.u.)",100,0.,2.,100,0.,1e-5);
96 
97  // ****************************************** //
98  // 0) now define an analysis...
99  anal = new StHbtSplitEvalAnalysis;
100  anal->SetQinvCut(0.03);
101  // 1) set the Event cuts for the analysis
102  mikesEventCut* evcut = new mikesEventCut; // use "mike's" event cut object
103  evcut->SetEventMult(30,10000); // selected multiplicity range
104  evcut->SetVertZPos(-70.0,70.0); // selected range of vertex z-position
105  anal->SetEventCut(evcut); // this is the event cut object for this analsys
106  // 2) set the Track (particle) cuts for the analysis
107  anal->SetFirstParticleCut(aTrackCut);
108  anal->SetSecondParticleCut(aTrackCut); // identical-particle analysis...
109 
110  // 3) set the Pair cuts for the analysis
111  qualityPairCut* qpc = new qualityPairCut;
112  qpc->SetQualityCut(-0.5,0.65);
113  anal->SetPairCut(qpc);
114 
115  // 4) set the number of events to mix (per event)
116  anal->SetNumEventsToMix(1);
117  // 5) now set up the correlation functions that this analysis will make
118  // THIS ANALYSIS WILL MAKE NO CORRELATION FUNCTIONS!!
119 
120  TheManager->AddAnalysis(anal);
121 
122  cout << " StHbt Analysis - setup done " << endl;
123 // // ------------------ end of setting up hbt stuff ------------------ //
124 
125  chain->Init(); // This should call the Init() method in ALL makers
126  chain->PrintInfo();
127 
128  for (Int_t iev=0;iev<nevents; iev++) {
129  cout << "StHbtExample -- Working on eventNumber " << iev << endl;
130  chain->Clear();
131  int iret = chain->Make(iev); // This should call the Make() method in ALL makers
132  if (iret) {
133  // cout << "Bad return code!" << endl;
134  break;
135  }
136  } // Event Loop
137  chain->Finish(); // This should call the Finish() method in ALL makers
138 
139  TFile file("SplittingHistos.root","RECREATE");
140  anal->mRealSplits->Write();
141  anal->mRealAll->Write();
142  anal->mMixedSplits->Write();
143  anal->mMixedAll->Write();
144  anal->mSplitFractionUpperLimit->Write();
145  anal->mSplitFractionLowerLimit->Write();
146  file.Close();
147 
148 
149  // plotting:
150  TCanvas can;
151  can->Divide(2,3);
152  can->cd(1);
153  anal->mRealAll->Draw();
154  can->cd(2);
155  anal->mRealSplits->Draw();
156  can->cd(3);
157  anal->mMixedAll->Draw();
158  can->cd(4);
159  anal->mMixedSplits->Draw();
160  can->cd(5);
161  anal->mSplitFractionUpperLimit->Draw();
162  can->cd(6);
163  anal->mSplitFractionLowerLimit->Draw();
164 
165 
166 
167 }
168 
169 
170 
171 
172 
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual Int_t Make()
Definition: StChain.cxx:110