StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtThreeParticleExample.C
1 
2 class StChain;
3 StChain *chain=0;
4 
5 // keep pointers to Correlation Functions global, so you can have access to them...
6 class Q3invCorrFctn;
7 Q3invCorrFctn* Q3invCF;
8 
9 void StHbtThreeParticleExample(Int_t nevents=1,
10  const char *MainFile="/star/rcf/pwg/hbt/July2000/HalfFieldData_new2.microDst")
11 {
12 
13  // Dynamically link needed shared libs
14  gSystem->Load("St_base");
15  gSystem->Load("StChain");
16  gSystem->Load("St_Tables");
17  gSystem->Load("StUtilities"); // new addition 22jul99
18  gSystem->Load("StAnalysisUtilities"); // needed by V0dstMaker
19  gSystem->Load("StMagF");
20  gSystem->Load("StIOMaker");
21  gSystem->Load("StarClassLibrary");
22  gSystem->Load("StEvent");
23  gSystem->Load("StEventMaker");
24  gSystem->Load("StHbtMaker");
25 
26  cout << "Dynamic loading done" << endl;
27 
28  chain = new StChain("StChain");
29  chain->SetDebug();
30 
31 
32  // Now we add Makers to the chain...
33 
34  StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
35  cout << "StHbtMaker instantiated"<<endl;
36 
37 
38 
39  /* -------------- set up of hbt stuff ----- */
40  cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl;
41 
42  StHbtManager* TheManager = hbtMaker->HbtManager();
43 
44  // use the binary reader
46  Reader->SetFileName(MainFile);
47 
48  // here would be the palce to plug in any "front-loaded" Event or Particle Cuts...
49  TheManager->SetEventReader(Reader);
50 
51  cout << "READER SET UP.... " << endl;
52 
53  // Hey kids! Let's make a microDST!
54  // in StHbt we do this by instantiating and plugging in a StHbtEventReader as a writer!
55  // the particular StHbtEventReader that we will use will write (and read) ASCII files
56  //
57  // StHbtAsciiReader* Writer = new StHbtAsciiReader;
58  // Writer->SetFileName("FirstMicroDst.asc");
59  // TheManager->SetEventWriter(Writer);
60  // cout << "WRITER SET UP.... " << endl;
61 
62  // 0) now define an analysis...
64  // 1) set the Event cuts for the analysis
65  mikesEventCut* evcut = new mikesEventCut; // use "mike's" event cut object
66  evcut->SetEventMult(0,10000); // selected multiplicity range
67  evcut->SetVertZPos(-35.0,35.0); // selected range of vertex z-position
68  anal->SetEventCut(evcut); // this is the event cut object for this analsys
69  // 2) set the Track (particle) cuts for the analysis
70  mikesTrackCut* trkcut = new mikesTrackCut; // use "mike's" particle cut object
71  trkcut->SetNSigmaPion(-1.5,1.5); // number of Sigma in TPC dEdx away from nominal pion dEdx
72  trkcut->SetNSigmaKaon(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal kaon dEdx
73  trkcut->SetNSigmaProton(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
74  trkcut->SetNHits(5,50); // range on number of TPC hits on the track
75  trkcut->SetPt(0.1,1.0); // range in Pt
76  trkcut->SetRapidity(-10.0,10.0); // range in rapidity
77  trkcut->SetDCA(0.0,0.5); // range in Distance of Closest Approach to primary vertex
78  trkcut->SetCharge(-1); // want negative pions
79  trkcut->SetMass(0.139); // pion mass
80  anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
81  anal->SetSecondParticleCut(trkcut); // NOTE - it is also for the "second" particle -- i.e. identical particle HBT
82  anal->SetThirdParticleCut(trkcut); // NOTE - it is also for the "third" particle -- i.e. identical particle HBT
83  // 3) set the Triplet cuts for the analysis
84  GenericTripletCut* tripletcut = new GenericTripletCut; // use gereric triplet cut object
85  anal->SetTripletCut(tripletcut); // this is the triplet cut for this analysis
86  // 4) set the number of events to mix (per event)
87  anal->SetNumEventsToMix(2);
88  // 5) now set up the correlation functions that this analysis will make
89  // this particular analysis will have one: a Q-invariant correlation function
90  Q3invCF = new Q3invCorrFctn("Q3invCF",100,0.0,1.0); // defines a Q3inv correlation function
91  anal->AddCorrFctn(Q3invCF); // adds the just-defined correlation function to the analysis
92 
93  // now add as many more correlation functions to the Analysis as you like..
94 
95  // 6) add the Analysis to the AnalysisCollection
96  TheManager->AddAnalysis(anal);
97 
98 
99  /* ------------------ end of setting up hbt stuff ------------------ */
100 
101 
102  // now execute the chain member functions
103 
104  if (chain->Init()){ // This should call the Init() method in ALL makers
105  cout << "Initialization failed \n";
106  goto TheEnd;
107  }
108  chain->PrintInfo();
109 
110 
111  // Event loop
112  int istat=0,iev=1;
113  EventLoop: if (iev <= nevents && !istat) {
114  cout << "StHbtExample -- Working on eventNumber " << iev << " of " << nevents << endl;
115  chain->Clear();
116  istat = chain->Make(iev);
117  if (istat) {cout << "Last event processed. Status = " << istat << endl;}
118  iev++; goto EventLoop;
119  }
120 
121 
122  cout << "StHbtExample -- Done with event loop" << endl;
123 
124  chain->Finish(); // This should call the Finish() method in ALL makers
125  TheEnd:
126 }
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