StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
readPi0.C
1 class StChain;
2 class StEEmcPi0Reader;
3 class StEEmcMixEvent;
4 
5 StChain *chain = 0;
6 StEEmcPi0Reader *reader = 0;
7 StEEmcMixEvent *realEvent = 0;
8 
9 Long64_t nevents = 0;
10 
11 TH1F *hMass = 0;
12 
13 void readPi0()
14 {
15 
16  hMass = new TH1F("hMass","Inv mass",120,0.,1.2);
17 
18  // load shared libraries
19  LoadLibs();
20 
21  // create analysis chain
22  chain = new StChain("chain");
23 
24  // add the pi0 reader and add all root files in specified directory
25  reader = new StEEmcPi0Reader();
26  chainFiles("/auto/pdsfdv34/starspin/jwebb/2006/tests/");
27  nevents = reader->getNumberOfEvents();
28 
29  chain->ls(3);
30  chain->Init();
31 
32  Int_t stat = 0;
33  Int_t event = 0;
34  while ( !stat )
35  {
36 
37  chain -> Clear();
38  stat = chain->Make();
39 
40  realEvent = reader->event();
41 
42  Int_t nPairs = reader -> event() -> nPairs;
43  for ( Int_t i=0;i<nPairs;i++ )
44  {
45  Float_t mass = reader->event()->mMass[i];
46  hMass->Fill(mass);
47 
48 
49 
50  // if ( !(event%100) )
51  std::cout << "[" << event << "/" << nevents << "]"
52  << " npair=" << realEvent->nPairs
53  << " mass=" << realEvent->mMass[i]
54  << " pt=" << realEvent->mPT[i]
55  << " bx=" << realEvent->bxStar
56  << " zgg=" << realEvent->mZgg[i]
57  << " spin4=" << realEvent->mSpin4
58  << " dsmvtx=" << realEvent->mBbcTrigger.onlineTimeDifference()
59  << std::endl;
60 
61 
62 
63 
64  }
65  event++;
66 
67 
68 
69  }
70 
71 
72 }
73 // ----------------------------------------------------------------------------
74 void chainFiles(const Char_t *path)
75 {
76 
77  TSystemDirectory dir("dir",path);
78  TIter next( dir.GetListOfFiles() );
79  TObject *file = 0;
80  while ( file = (TObject*)next() )
81  {
82  TString name=file->GetName();
83  if ( name.Contains("root") ) reader->chainFile(name);
84 
85  }
86 
87 
88 }
89 
90 // ----------------------------------------------------------------------------
91 void LoadLibs()
92 {
93  //-- Load muDst shared libraries --
94  gROOT -> LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
95  loadSharedLibraries();
96 
97  gSystem->Load("StDbLib");
98  gSystem->Load("StDbBroker");
99  gSystem->Load("St_db_Maker");
100  gSystem->Load("StEEmcUtil");
101  gSystem->Load("StEEmcDbMaker");
102  gSystem->Load("StEEmcSimulatorMaker");
103 
104  gSystem->Load("StEEmcA2EMaker");
105  gSystem->Load("StEEmcClusterMaker");
106  gSystem->Load("StEEmcPointMaker");
107  gSystem->Load("StEEmcPi0Mixer");
108  gSystem->Load("StSpinDbMaker");
109 
110 }
Int_t nPairs
From EEMC point-maker.
copied from muDst
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110