00001 #include <iomanip>
00002
00003 void RunGammaPythiaMaker(
00004 int nevents = 10,
00005 const char *dir ="",
00006 const char* file="/star/institutions/mit/betan/Simulation/photon_9_11.MuDst.root",
00007 const char *fname="/star/institutions/mit/betan/Simulation/photon_9_11.geant.root",
00008 const char *filter = "",
00009 )
00010 {
00011 gROOT->LoadMacro("StRoot/StGammaMaker/macros/loadGammaLibs.C");
00012 loadGammaLibs();
00013
00014 StChain* chain = new StChain("StChain");
00015 chain->SetDebug(1);
00016 gMessMgr->SwitchOff("D");
00017 gMessMgr->SwitchOff("I");
00018
00019 StIOMaker* ioMaker = new StIOMaker();
00020 ioMaker->SetFile(fname);
00021 ioMaker->SetIOMode("r");
00022 ioMaker->SetBranch("*",0,"0");
00023 ioMaker->SetBranch("geantBranch",0,"r");
00024
00025 StMuDebug::setLevel(1);
00026 StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1e6,"MuDst");
00027
00028 StMcEventMaker* mcEventReader = new StMcEventMaker;
00029
00030 StGammaPythiaMaker *weight = new StGammaPythiaMaker("GammaPythia");
00031
00032 TChain* fileChain = muDstMaker->chain();
00033 int total = 0;
00034 int ntotal = fileChain->GetEntries();
00035
00036 for (Int_t iev=0;iev<nevents; iev++) {
00037 cout << "****************************************** " << endl;
00038 cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<ntotal<<endl;
00039 cout << "*************************1***************** " << endl;
00040 chain->Clear();
00041 int iret = chain->Make(iev);
00042 total++;
00043 if (iret) {
00044 cout << "Bad return code!" << endl;
00045 break;
00046 }
00047 cout << "Number of pi0: " << weight->numberOfPion0() << '\n';
00048 cout << "Number of prompt photons: " << weight->numberOfPrompt() <<'\n';
00049 cout << "Number of decay photons: " << weight->numberOfDecay() << '\n';
00050 cout << endl;
00051 }
00052
00053 chain->Finish();
00054 cout << "****************************************** " << endl;
00055 cout << "total number of events " << total << endl;
00056 cout << "****************************************** " << endl;
00057 }