StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SchedulerExample.cxx
1 /***************************************************************************
2  *
3  * $Id: SchedulerExample.cxx,v 1.2 2003/09/02 17:58:44 perev Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  *
6  ***************************************************************************/
7 
8 #include "SchedulerExample.h"
9 
10 #include "Stiostream.h"
11 
12 #include "TH1.h"
13 #include "TH2.h"
14 #include "TH3.h"
15 #include "TChain.h"
16 #include "TSystem.h"
17 #include "TFile.h"
18 
19 #include "StMuDSTMaker/COMMON/StMuDebug.h"
20 #include "StMuDSTMaker/COMMON/StMuDst.h"
21 #include "StMuDSTMaker/COMMON/StMuTrack.h"
22 #include "StMuDSTMaker/COMMON/StMuEvent.h"
23 #include "StMuDSTMaker/COMMON/StMuDbReader.h"
24 #include "StMuDSTMaker/COMMON/StMuTimer.h"
25 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
26 
27 #include "StarClassLibrary/SystemOfUnits.h"
28 #include "StarClassLibrary/StHelixD.hh"
29 #include "StarClassLibrary/StPhysicalHelixD.hh"
30 #include "StarClassLibrary/StThreeVectorF.hh"
31 #include "StarClassLibrary/StThreeVectorD.hh"
32 
33 
34 #define __ZPOS__ 25.
35 
36 ClassImp(SchedulerExample)
37 
38 SchedulerExample::SchedulerExample(const char* outputFile) {
39  mOutputFile = string(outputFile);
40  mPt = new TH1D("mPt","pt-distribution",100,0.,2.);
41  mEta = new TH1D("mEta","eta-distribution",100,-2.,2.);
42  mRefMultPos = new TH1D("mRefMultPos", "ref mult pos", 400,0.,400.);
43  mRefMultNeg = new TH1D("mRefMultNeg", "ref mult neg", 400,0.,400.);
44  mRefMult = new TH1D("mRefMult", "ref mult", 400,0.,400.);
45  mVertex = new TH3D("mVertex", "vertex", 100,-5.,+5., 100,-5.,+5., 100,-50.,+50.);
46 }
47 
48 
49 SchedulerExample::~SchedulerExample(){
50  delete mPt;
51  delete mEta;
52  delete mRefMultPos;
53  delete mRefMultNeg;
54  delete mRefMult;
55  delete mVertex;
56 }
57 
58 
60  mMuDstMaker = (StMuDstMaker*)GetMaker("MuDstMaker");
61  if (!mMuDstMaker) return 1;
62  return 0;
63 }
64 
65 
67  cout << " SchedulerExample::Finish() " << endl;
68  TFile f(mOutputFile.c_str(),"recreate");
69  mPt->Write();
70  mEta->Write();
71  mRefMultPos->Write();
72  mRefMultNeg->Write();
73  mRefMult->Write();
74  mVertex->Write();
75  f.Close();
76  cout << " SchedulerExample::Finish() file written" << endl;
77  return 0;
78 }
79 
82  if (!mMuDst) return 1;
83 
84  // here is the actual analysis code
85 
86  StMuEvent* ev = mMuDst->event();
87  // fill vertex histogram
89  mVertex->Fill( pos.x(),pos.y(),pos.z() );
90 
91  if ( fabs(pos.z())<__ZPOS__ ) {
92  mRefMultPos->Fill( ev->refMultPos() );
93  mRefMultNeg->Fill( ev->refMultNeg() );
94  mRefMult->Fill( ev->refMult() );
95 
96  int numberOfPrimaries= mMuDst->primaryTracks()->GetEntries();
97  StMuTrack* t;
98  for (int l=0; l<numberOfPrimaries; l++) {
99  t = mMuDst->primaryTracks(l);
100  mPt->Fill( t->pt() );
101  mEta->Fill( t->eta() );
102  }
103  }
104 
105 
106  return 0;
107 }
108 
109 
110 /***************************************************************************
111  *
112  * $Log: SchedulerExample.cxx,v $
113  * Revision 1.2 2003/09/02 17:58:44 perev
114  * gcc 3.2 updates + WarnOff
115  *
116  * Revision 1.1 2003/01/23 21:59:50 laue
117  * Modification to compile on Solaris.
118  *
119  *
120  **************************************************************************/
121 
122 
123 
124 
125 
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in &#39;physical events&#39;. Therefore there is only 1 primary vert...
Definition: StMuEvent.cxx:221
unsigned short refMultNeg(int vtx_id=-1)
Reference multiplicity of negative particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
Definition: StMuEvent.cxx:184
StMuDst * muDst()
Definition: StMuDstMaker.h:425
Double_t pt() const
Returns pT at point of dca to primary vertex.
Definition: StMuTrack.h:256
StMuDst * mMuDst
Pointer to the StMuDst class, which holds all the events information. Will be updated in the event lo...
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
Definition: StMuTrack.h:257
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
unsigned short refMult(int vtx_id=-1)
Reference multiplicity of charged particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
Definition: StMuEvent.cxx:195
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
StMuDstMaker * mMuDstMaker
Pointer to the StMuDstMaker which provides the events to analyse.
unsigned short refMultPos(int vtx_id=-1)
Reference multiplicity of positive particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
Definition: StMuEvent.cxx:173