[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ repository ]

STAR Offline Software Cross Reference

./StRoot/macros/examples/StHbtExample.C

Version: [ .DEV ] [ DEV00 ] [ SL00b_2 ] [ SL99f ]

  1 // $Id: StHbtExample.C,v 1.9 2000/04/13 21:46:22 kathy Exp $
  2 // $Log: StHbtExample.C,v $
  3 // Revision 1.9  2000/04/13 21:46:22  kathy
  4 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
  5 //
  6 // Revision 1.8  2000/04/12 17:39:02  kathy
  7 // change to only load table libraries needed: lib*_Tables instead of all tables: St_Tables
  8 //
  9 // Revision 1.7  2000/03/20 17:50:40  kathy
 10 // fix all macros so that they set all branches on that are needed - otherwise won't work with soft links
 11 //
 12 // Revision 1.6  2000/01/19 15:52:46  kathy
 13 // change default input file to be the one in /afs/rhic/star/data/samples
 14 //
 15 // Revision 1.5  1999/09/24 00:00:34  lisa
 16 // HBT example macro updated to use TrackCuts not ParticleCuts
 17 //
 18 // Revision 1.4  1999/07/27 21:09:18  lisa
 19 // do event loop with goto because Cint pukes on for loop
 20 //
 21 // Revision 1.3  1999/07/13 02:31:39  lisa
 22 // Update StHbtExample macro for new StHbtMaker
 23 //
 24 // Revision 1.2  1999/07/13 01:13:02  kathy
 25 // moved rch.C to obsolete, put in id,log,owner into HbtExample, removed loading of StRootEvent and changed default input file in bfcread.C and Example_readdst_qa_tables.C
 26 //
 27 
 28 //======================================================================
 29 // owner:  Mike Lisa
 30 // what it does: 
 31 //     runs the StHbt framework.  Runs two simultaneous correlation
 32 //     analyses.  The first one is pi-pi HBT, building two simultaneous
 33 //     correlation functions.  The second in K+K-, building an invariant
 34 //     mass spectrum with background subtraction
 35 //=======================================================================
 36 
 37 class StChain;
 38 StChain *chain=0;    
 39 
 40 // keep pointers to Correlation Functions global, so you can have access to them...
 41 class QinvCorrFctn;
 42 QinvCorrFctn* QinvCF;
 43 class QvecCorrFctn;
 44 QvecCorrFctn* QvecCF;
 45 class MinvCorrFctn;
 46 MinvCorrFctn* MinvCF;
 47 
 48 void StHbtExample(Int_t nevents=1,
 49                   const char *MainFile=
 50 "/afs/rhic/star/data/samples/gstar.dst.root")
 51 {
 52 
 53     // Dynamically link needed shared libs
 54     gSystem->Load("St_base");
 55     gSystem->Load("StChain");
 56     gSystem->Load("libglobal_Tables");
 57     gSystem->Load("libsim_Tables");
 58     gSystem->Load("libgen_Tables");
 59     gSystem->Load("StUtilities");  // new addition 22jul99
 60     gSystem->Load("StAnalysisUtilities");  // needed by V0dstMaker
 61     gSystem->Load("StMagF");
 62     gSystem->Load("StIOMaker");
 63     gSystem->Load("StarClassLibrary");
 64     gSystem->Load("StEvent");
 65     gSystem->Load("StEventMaker");
 66     gSystem->Load("StHbtMaker");
 67     gSystem->Load("StV0MiniDstMaker");
 68 
 69     cout << "Dynamic loading done" << endl;
 70 
 71     chain = new StChain("StChain"); 
 72     chain->SetDebug();
 73    
 74 
 75     // Now we add Makers to the chain...
 76 
 77     StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree");
 78     ioMaker->SetDebug();
 79 
 80     ioMaker->SetIOMode("r");
 81     ioMaker->SetDebug();
 82     ioMaker->SetBranch("*",0,"");                 //deactivate all branches
 83     ioMaker->SetBranch("dstBranch",0,"r"); //activate EventBranch
 84     ioMaker->SetBranch("runcoBranch",0,"r"); //activate runcoBranch
 85 
 86 
 87     StEventMaker* eventMaker = new StEventMaker("events","title");
 88     cout << "Just instantiated StEventMaker... lets go StHbtMaker!" << endl;
 89 
 90     // UNCOMMENT THIS NEXT PART OUT IF YOU WANT V0's
 91     //StV0MiniDstMaker* v0dst = new StV0MiniDstMaker("v0dst"); 
 92     //cout << "Just instantiated StV0MiniDstMaker... lets go StHbt!" << endl;
 93     //v0dst.SetV0VertexType(); //Set v0MiniDstMaker to find v0s not Xis
 94     //v0dst.SetOutputFile("muv0dst.root"); // Set V0MiniDStMaker output file
 95 
 96 
 97 
 98     StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
 99     cout << "StHbtMaker instantiated"<<endl;
100 
101 
102 
103     /* -------------- set up of hbt stuff ----- */
104     cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl;
105 
106     StHbtManager* TheManager = hbtMaker->HbtManager();
107 
108     // here, we instantiate the appropriate StHbtEventReader
109     // for STAR analyses in root4star, we instantiate StStandardHbtEventReader
110     StStandardHbtEventReader* Reader = new StStandardHbtEventReader;
111     Reader->SetTheEventMaker(eventMaker);     // gotta tell the reader where it should read from
112 
113     // UNCOMMENT THIS NEXT LINE OUT IF YOU WANT V0's
114     //    Reader->SetTheV0Maker(v0dst); //Gotta tell the reader where to read the v0 stuff from
115 
116     // here would be the palce to plug in any "front-loaded" Event or Particle Cuts...
117     TheManager->SetEventReader(Reader);
118 
119     cout << "READER SET UP.... " << endl;
120 
121     // Hey kids! Let's make a microDST!
122     // in StHbt we do this by instantiating and plugging in a StHbtEventReader as a writer!
123     // the particular StHbtEventReader that we will use will write (and read) ASCII files
124     //
125     //    StHbtAsciiReader* Writer = new StHbtAsciiReader;
126     //    Writer->SetFileName("FirstMicroDst.asc");
127     //    TheManager->SetEventWriter(Writer);
128     //    cout << "WRITER SET UP.... " << endl;
129 
130     // 0) now define an analysis...
131     StHbtAnalysis* anal = new StHbtAnalysis;
132     // 1) set the Event cuts for the analysis
133     mikesEventCut* evcut = new mikesEventCut;  // use "mike's" event cut object
134     evcut->SetEventMult(0,10000);      // selected multiplicity range
135     evcut->SetVertZPos(-35.0,35.0);    // selected range of vertex z-position
136     anal->SetEventCut(evcut);          // this is the event cut object for this analsys
137     // 2) set the Track (particle) cuts for the analysis
138     mikesTrackCut* trkcut = new mikesTrackCut;  // use "mike's" particle cut object
139     trkcut->SetNSigmaPion(-1.5,1.5);   // number of Sigma in TPC dEdx away from nominal pion dEdx
140     trkcut->SetNSigmaKaon(-1000.0,1000.0);   // number of Sigma in TPC dEdx away from nominal kaon dEdx
141     trkcut->SetNSigmaProton(-1000.0,1000.0);   // number of Sigma in TPC dEdx away from nominal proton dEdx
142     trkcut->SetNHits(5,50);            // range on number of TPC hits on the track
143     trkcut->SetPt(0.1,1.0);            // range in Pt
144     trkcut->SetRapidity(-1.0,1.0);     // range in rapidity
145     trkcut->SetDCA(0.0,0.5);           // range in Distance of Closest Approach to primary vertex
146     trkcut->SetCharge(-1);             // want negative pions
147     trkcut->SetMass(0.139);            // pion mass
148     anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
149     anal->SetSecondParticleCut(trkcut); // NOTE - it is also for the "second" particle -- i.e. identical particle HBT
150     // 3) set the Pair cuts for the analysis
151     mikesPairCut* paircut = new mikesPairCut;  // use "mike's" pair cut object
152     anal->SetPairCut(paircut);         // this is the pair cut for this analysis
153     // 4) set the number of events to mix (per event)
154     anal->SetNumEventsToMix(5);        
155     // 5) now set up the correlation functions that this analysis will make
156     // this particular analysis will have two: the first is a Q-invariant correlation function
157     QinvCF = new QinvCorrFctn("mikesQinvCF",50,0.0,0.2);  // defines a Qinv correlation function
158     anal->AddCorrFctn(QinvCF); // adds the just-defined correlation function to the analysis
159     // for this analysis, we will also (simultaneously) build a Q-vector correlation function
160     QvecCF = new QvecCorrFctn("randysQvecCF",50,0.0,0.2);
161     anal->AddCorrFctn(QvecCF); // adds the just-defined correlation function to the analysis
162     
163     // now add as many more correlation functions to the Analysis as you like..
164     
165     // 6) add the Analysis to the AnalysisCollection
166     TheManager->AddAnalysis(anal);
167 
168     // now, we define another analysis that runs simultaneously with the previous one.
169     // this one looks at K+K- correlations (so NONidentical particles) in invariant mass
170 
171     /* ****************************************** */ 
172     /* * franks phi analysis - by Frank Laue, OSU */
173     /* ****************************************** */ 
174     // 0) now define an analysis...
175     StHbtAnalysis* phiAnal = new StHbtAnalysis;
176     // 1) set the Event cuts for the analysis
177     mikesEventCut* phiEvcut = new mikesEventCut;  // use "mike's" event cut object
178     phiEvcut->SetEventMult(0,10000);      // selected multiplicity range
179     phiEvcut->SetVertZPos(-35.0,35.0);    // selected range of vertex z-position
180     phiAnal->SetEventCut(phiEvcut);          // this is the event cut object for this analsys
181     // 2) set the Track (particle) cuts for the analysis
182     mikesTrackCut* kaonTrkcut = new mikesTrackCut;  // use "mike's" particle cut object
183     kaonTrkcut->SetNSigmaPion(3,1000.0);   // number of Sigma in TPC dEdx away from nominal pion dEdx
184     kaonTrkcut->SetNSigmaKaon(-3.0,3.0);   // number of Sigma in TPC dEdx away from nominal kaon dEdx
185     kaonTrkcut->SetNSigmaProton(-1000.,-1.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
186     kaonTrkcut->SetNHits(0,50);            // range on number of TPC hits on the track
187     kaonTrkcut->SetPt(0.1,2.0);            // range in Pt
188     kaonTrkcut->SetRapidity(-2.0,2.0);     // range in rapidity
189     kaonTrkcut->SetDCA(0.0,0.5);            // range in Distance of Closest Approach to primary vertex
190     kaonTrkcut->SetCharge(+1);              // want positive kaons
191     kaonTrkcut->SetMass(0.494);             // kaon mass
192     phiAnal->SetFirstParticleCut(kaonTrkcut);  // this is the track cut for the "first" particle
193     mikesTrackCut* antikaonTrkcut = new mikesTrackCut;  // use "mike's" particle cut object
194     antikaonTrkcut->SetNSigmaPion(3.0,1000.0);   // number of Sigma in TPC dEdx away from nominal pion dEdx
195     antikaonTrkcut->SetNSigmaKaon(-3.0,3.0);   // number of Sigma in TPC dEdx away from nominal kaon dEdx
196     antikaonTrkcut->SetNSigmaProton(-1000.0,-1.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
197     antikaonTrkcut->SetNHits(0,50);            // range on number of TPC hits on the track
198     antikaonTrkcut->SetPt(0.1,2.0);            // range in Pt
199     antikaonTrkcut->SetRapidity(-2.0,2.0);     // range in rapidity
200     antikaonTrkcut->SetDCA(0.0,0.5);            // range in Distance of Closest Approach to primary vertex
201     antikaonTrkcut->SetCharge(-1);              // want negative kaons
202     antikaonTrkcut->SetMass(0.494);             // kaon mass
203     phiAnal->SetSecondParticleCut(antikaonTrkcut); // this is the track cut for the "second" particle
204     // 3) set the Pair cuts for the analysis
205     mikesPairCut* phiPaircut = new mikesPairCut;  // use "mike's" pair cut object
206     phiAnal->SetPairCut(phiPaircut);         // this is the pair cut for this analysis
207     // 4) set the number of events to mix (per event)
208     phiAnal->SetNumEventsToMix(5);        
209     // 5) now set up the correlation functions that this analysis will make
210     MinvCF = new MinvCorrFctn("franksMinvCF",100,0.98,1.18); // defines a Minv correlation function
211     phiAnal->AddCorrFctn(MinvCF);   // adds the just-defined correlation function to the analysis
212     // now add as many more correlation functions to the Analysis as you like..
213     // 6) add the Analysis to the AnalysisCollection
214     TheManager->AddAnalysis(phiAnal);
215 
216 
217 
218     /* ------------------ end of setting up hbt stuff ------------------ */
219 
220 
221   // now execute the chain member functions
222   
223   if (chain->Init()){ // This should call the Init() method in ALL makers
224     cout << "Initialization failed \n";
225     goto TheEnd;
226   }
227   chain->PrintInfo();
228 
229 
230   // Event loop
231   int istat=0,iev=1;
232  EventLoop: if (iev <= nevents && !istat) {
233    cout << "StHbtExample -- Working on eventNumber " << iev << " of " << nevents << endl;
234    chain->Clear();
235    istat = chain->Make(iev);
236    if (istat) {cout << "Last event processed. Status = " << istat << endl;}
237    iev++; goto EventLoop;
238  }
239 
240 //  good old Cint can't even handle a for-loop
241 //   for (Int_t iev=1;iev<=nevents; iev++) {
242 //     chain->Clear();
243 //     int iret = chain->Make(iev); // This should call the Make() method in ALL makers
244 //     if (iret) {
245 //       cout << "StHbtExample.C -- chain returned nonzero value " << iret 
246 //         << " on event " << iev << endl;
247 //       break;
248 //     } 
249 //   } // Event Loop
250 
251 
252 
253   cout << "StHbtExample -- Done with event loop" << endl;
254 
255   chain->Finish(); // This should call the Finish() method in ALL makers
256  TheEnd:
257 }
258 
[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ repository ]
This page was automatically generated by the LXR engine. Visit the LXR main site for more information.
STAR version by Torre Wenaus.
Information on this and other STAR code management tools