StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunGammaPythiaMaker.C
1 #include <iomanip>
2 
3 void RunGammaPythiaMaker(
4  int nevents = 10,
5  const char *dir ="",
6  const char* file="/star/institutions/mit/betan/Simulation/photon_9_11.MuDst.root",
7  const char *fname="/star/institutions/mit/betan/Simulation/photon_9_11.geant.root",
8  const char *filter = "",
9  )
10 {
11  gROOT->LoadMacro("StRoot/StGammaMaker/macros/loadGammaLibs.C");
12  loadGammaLibs();
13 
14  StChain* chain = new StChain("StChain");
15  chain->SetDebug(1);
16  gMessMgr->SwitchOff("D");
17  gMessMgr->SwitchOff("I");
18 
19  StIOMaker* ioMaker = new StIOMaker();
20  ioMaker->SetFile(fname);
21  ioMaker->SetIOMode("r");
22  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
23  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
24 
26  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1e6,"MuDst");
27 
28  StMcEventMaker* mcEventReader = new StMcEventMaker;
29 
30  StGammaPythiaMaker *weight = new StGammaPythiaMaker("GammaPythia");
31 
32  TChain* fileChain = muDstMaker->chain();
33  int total = 0;
34  int ntotal = fileChain->GetEntries();
35 
36  for (Int_t iev=0;iev<nevents; iev++) {
37  cout << "****************************************** " << endl;
38  cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<ntotal<<endl;
39  cout << "*************************1***************** " << endl;
40  chain->Clear();
41  int iret = chain->Make(iev);
42  total++;
43  if (iret) {
44  cout << "Bad return code!" << endl;
45  break;
46  }
47  cout << "Number of pi0: " << weight->numberOfPion0() << '\n';
48  cout << "Number of prompt photons: " << weight->numberOfPrompt() <<'\n';
49  cout << "Number of decay photons: " << weight->numberOfDecay() << '\n';
50  cout << endl;
51  }
52 
53  chain->Finish();
54  cout << "****************************************** " << endl;
55  cout << "total number of events " << total << endl;
56  cout << "****************************************** " << endl;
57 }
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
virtual Int_t Finish()
Definition: StChain.cxx:85
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
virtual Int_t Make()
Definition: StChain.cxx:110
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426