StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtKaonTTree.C
1 // NOTE - chain needs to be declared global so for StHbtEventReader
2 class StChain;
3 StChain *chain=0;
4 
5 // keep pointers to Analysis global, so you can have access to them ...
7 StHbtVertexAnalysis* kaonAnal;
8 
9 // File-scope stuff needed by setFiles, nextFile. Someone ambitious
10 // can clean this up by putting it all into a nice clean class.
11 Int_t usePath = 0;
12 Int_t nFile = 0;
13 TString thePath;
14 TString theFileName;
15 TString originalPath;
16 //class StChain;
17 //StChain *chain=0;
18 
19 const char *venusFile ="set*geant.root";
20 const char *venusPath ="/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/tfs_4/";
21 const char *dstFile ="/disk00001/star/auau200/two_photon/starlight/twogam/year_1b/hadronic_on/tfs/ric0022_01_14552evts.dst.root";
22 const char *xdfFile ="/afs/rhic.bnl.gov/star/data/samples/psc0054_07_40evts_dst.xdf";
23 const char *mdcFile ="/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/tss/psc0081_07_40evts.root";
24 const char *geantFile ="/disk00000/star/auau200/hijing135/jetq_off/b0_3/year_1b/hadronic_on/tfsr/set0041_01_53evts.geant.root";
25 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
26 
27 void wait(int n=1) {
28  for ( int i=0; i<n*1e6; i++) { /*no-op*/ }
29 }
30 
31 
32 //==========================================================================================
33 void StHbtKaonTTree(const Int_t nevents=9999,
34  const Char_t *path="/star/data02/scratch/laue/dataSomeEyesOnly/",
35  const Char_t *fileName="",
36  const Char_t *extention=".hbtTTreeMuDst",
37  const Char_t *filter=".",
38  const int maxFiles=10) {
39 
40  gStyle->SetTextFont(41);
41  gStyle->SetStatH(.3);
42  gStyle->SetStatW(.3);
43 
44  // Dynamically link needed shared libs
45  gSystem->Load("St_base");
46  gSystem->Load("StChain");
47  gSystem->Load("St_Tables");
48  gSystem->Load("StMagF");
49  gSystem->Load("StUtilities"); // new addition 22jul99
50  gSystem->Load("StTreeMaker");
51  gSystem->Load("StIOMaker");
52  gSystem->Load("StarClassLibrary");
53  gSystem->Load("StTpcDb");
54  gSystem->Load("StDbUtilities");
55  gSystem->Load("StEvent");
56  gSystem->Load("StEventMaker");
57  gSystem->Load("StEventUtilities");
58  gSystem->Load("StEmcUtil");
59  gSystem->Load("St_emc_Maker");
60  gSystem->Load("StMcEvent");
61  gSystem->Load("StMcEventMaker");
62  gSystem->Load("StAssociationMaker");
63  gSystem->Load("StMcAnalysisMaker");
64  // gSystem->Load("StFlowMaker");
65  // gSystem->Load("StFlowTagMaker");
66  // gSystem->Load("StFlowAnalysisMaker");
67  gSystem->Load("StStrangeMuDstMaker");
68  gSystem->Load("StHbtMaker");
69  // gSystem->Load("global_Tables");
70 
71  // cout << " loading done " << endl;
72  chain = new StChain("StChain");
73  chain->SetDebug(1);
74 
75 
76  // *********
77  // Hbt Maker
78  // *********
79 
80  StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
81  StHbtManager* TheManager = hbtMaker->HbtManager();
82 
83  StHbtTTreeReader* Reader = new StHbtTTreeReader(0,0,path,fileName,extention,filter,maxFiles);
84  TheManager->SetEventReader(Reader);
85 
86  // define example particle cut and cut monitors to use in the analyses
87  // example particle cut
88  franksTrackCut* aTrackCut = new franksTrackCut; // use "frank's" particle cut object
89  aTrackCut->SetPidProbKaon(0.8,10);
90  aTrackCut->SetNHits(23,50); // range on number of TPC hits on the track
91  aTrackCut->SetP(0.1,1.); // range in P
92  aTrackCut->SetPt(0.1,1.); // range in Pt
93  aTrackCut->SetEta(-1.1,+1.1); // range in rapidity
94  aTrackCut->SetRapidity(-10.,10.); // range in rapidity
95  aTrackCut->SetDCA(0.0,3.); // range in Distance of Closest Approach to primary vertex
96  aTrackCut->SetCharge(+1); // want positive kaons
97  aTrackCut->SetMass(0.494); // kaon mass
98  // define example track cut monitor
99  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);
100  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);
101 
102  // now, we define another analysis that runs simultaneously with the previous one.
103  // this one looks at K+K- correlations (so NONidentical particles) in invariant mass
104 
105  // ****************************************** //
106  // * franks phiLikeSign analysis - by Frank Laue, OSU //
107  // ****************************************** //
108  // ****************************************** //
109  // * franks kaon analysis - by Frank Laue, OSU //
110  // ****************************************** //
111  // 0) now define an analysis...
112  // StHbtVertexAnalysis* kaonAnal = new StHbtVertexAnalysis();
113  kaonAnal = new StHbtVertexAnalysis(20,-50.,50.);
114  // kaonAnal->SetDebug(10);
115  // 1) set the Event cuts for the analysis
116  rotationEventCut* kaonEvcut = new rotationEventCut(); // use "mike's" event cut object
117  kaonEvcut->SetEventRefMult(124,1000); // selected multiplicity range
118  kaonEvcut->SetVertZPos(-50.0,+50.0); // selected range of vertex z-position
119  kaonEvcut->RotationOff(); // turn of rotation
120  kaonEvcut->SetSmear(0); // selected range of vertex z-position
121  kaonEvcut->RotationOff(); // selected range of vertex z-position
122  eventCutMonitor_Mult* multMoniPass = new eventCutMonitor_Mult("mult","multiplicity",100,0.,5000);
123  eventCutMonitor_Mult* multMoniFail = new eventCutMonitor_Mult("mult","multiplicity",100,0.,5000);
124  kaonEvcut->AddCutMonitor(multMoniPass, multMoniFail);
125  kaonAnal->SetEventCut(kaonEvcut); // this is the event cut object for this analsys
126  // 2) set the Track (particle) cuts for the analysis
127  franksTrackCut* kaonTrackCut = new franksTrackCut(*aTrackCut); // copy from example
128  // new particle cut moni
129  trackCutMonitor_P_vs_Dedx* dedxMoniNegPass = new trackCutMonitor_P_vs_Dedx( *aDedxMoniNeg);
130  trackCutMonitor_P_vs_Dedx* dedxMoniNegFail = new trackCutMonitor_P_vs_Dedx( *aDedxMoniNeg);
131  kaonTrackCut->AddCutMonitor( dedxMoniNegPass, dedxMoniNegFail);
132  kaonAnal->SetFirstParticleCut(kaonTrackCut); // this is the track cut for the "first" particle
133  // copy second particle cut from first particle cut
134  kaonAnal->SetSecondParticleCut(kaonTrackCut); // this is the track cut for the "first" particle
135  // 3) set the Pair cuts for the analysis
136  franksPairCut* kaonPairCut = new franksPairCut; // use "mike's" pair cut object
137  kaonPairCut->SetQuality(-1,+0.65); // this is the pair cut for this analysis
138  kaonPairCut->SetEntranceSeparation(2.,1000.); // this is the pair cut for this analysis
139  kaonAnal->SetPairCut(kaonPairCut); // this is the pair cut for this analysis
140  // 4) set the number of events to mix (per event)
141  kaonAnal->SetNumEventsToMix(5);
142  // ********************************************************************
143  // 5) now set up the correlation functions that this analysis will make
144  // ********************************************************************
145  // define correlation function
146  QinvCorrFctnPidProbWeight* Qinv = new QinvCorrFctnPidProbWeight("Qinv5MeV","Qinv5MeV",40,0.,+0.2);
147  kaonAnal->AddCorrFctn(Qinv); // adds the just-defined correlation function to the analysis
148  TheManager->AddAnalysis(kaonAnal);
149 
150  cout << " kaonAnal - setup done " << endl;
151 // // ------------------ end of setting up hbt stuff ------------------ //
152 
153  chain->Init(); // This should call the Init() method in ALL makers
154  chain->PrintInfo();
155 
156  // exit();
157  for (Int_t iev=0;iev<nevents; iev++) {
158  cout << "StHbtExample -- Working on eventNumber " << iev << endl;
159  chain->Clear();
160 // cout << "before make" << endl;
161  int iret = chain->Make(iev); // This should call the Make() method in ALL makers
162 // cout << "after make" << endl;
163  if (iret) {
164  // cout << "Bad return code!" << endl;
165  break;
166  }
167  } // Event Loop
168  chain->Finish(); // This should call the Finish() method in ALL makers
169 
170  TFile file("KaonPidProbWeight.root","RECREATE");
171  StHbtHistoCollector* collector = StHbtHistoCollector::Instance();
172  collector->Write();
173  file.Close();
174 }
175 
176 
177 
178 
179 
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