StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TestRead.C
1 
2 class StMuDstMaker;
3 class HistMaker;
4 
5 StMuDstMaker* maker;
6 HistMaker* myHistMaker;
7 
8 void TestRead(const char* infile, const char* outfile)
9 {
10  if (gClassTable->GetID("TTable") < 0) gSystem->Load("libTable");
11  gSystem->Load("St_base");
12  gSystem->Load("StChain");
13  gSystem->Load("St_Tables");
14  gSystem->Load("StMagF");
15  gSystem->Load("StUtilities"); // new addition 22jul99
16  gSystem->Load("StTreeMaker");
17  gSystem->Load("StIOMaker");
18  gSystem->Load("StarClassLibrary");
19  gSystem->Load("StTpcDb");
20  gSystem->Load("StDbUtilities");
21  gSystem->Load("StEvent");
22  gSystem->Load("StEventUtilities");
23  gSystem->Load("StMcEvent");
24  gSystem->Load("StMcEventMaker");
25  gSystem->Load("StAssociationMaker");
26  gSystem->Load("StMcAnalysisMaker");
27  gSystem->Load("StStrangeMuDstMaker");
28  gSystem->Load("StMuDSTMaker");
29  gSystem->Load("JetFinder");
30 
31  cout << " loading done " << endl;
32 
33  StMuDebug::setLevel(0); // switch of some debug output
34 
35  int iret=0;
36 
37  //Make histograms
38  double pi=3.14159;
39  TH2* dEtaVsdPhi = new TH2D("dEtaVsdPhi","#Delta#eta vs #Delta#phi",40, -pi, pi, 40, -1., 1.);
40 
41  cout <<" --- Set Cuts ---"<<endl;
42  //Setup cuts
43  AnaCuts cuts;
44  cuts.ptCut = 2.0; // pt for now
45  cuts.triggerPtCut = 3.0;
46  cuts.pseudoRapidityCutOff = 1.0;
47  cuts.minNumberOfFitPoints = 22;
48  cuts.minNumberOfPoints = 25;
49  cuts.verbose=false;
50 
51  cout <<" --- Create Filter ---"<<endl;
52  //This must match the enum in StJetFilter.h
53  enum ioType {kWrite=0, kRead=1};
54 
55  cout <<"Read from file:\t"<<infile<<endl;
56  myFilter = new StJetFilter(kRead, infile);
57  myFilter->setCuts(cuts);
58 
59  cout <<" --- Create HistMaker ---"<<endl;
60  HistMaker* myHister = new HistMaker();
61  myHister->setCuts(cuts);
62  myHister->setdEtaVsdPhi(dEtaVsdPhi);
63 
64  cout <<" --- Loop on events ---"<<endl;
65  int nEvents=myFilter->nEvents();
66  for (int iev=0; iev<nEvents; ++iev) {
67  //for (int iev=0; iev<nEvents && iev<10; ++iev) {
68  if (fmod(static_cast<double>(iev),1000.)==0.) {
69  cout <<"\t --- chugging on event:\t"<<iev<<"\t of :"<<nEvents<<endl;
70  }
71  myFilter->fill();
72 
73  //Get Tracks
74  StJetMuEvent* event = myFilter->event();
75  myHister->fill(event);
76  }
77 
78  cout <<" --- Save Histograms --- "<<endl;
79  TFile* ofile = new TFile(outfile,"RECREATE");
80  ofile->cd();
81  dEtaVsdPhi->Write();
82  ofile->Close();
83 
84  delete myFilter;
85  myFilter=0;
86  delete myHister;
87  myHister=0;
88 }
89 
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74