StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunMCAsym.C
1 class StChain *chain;
2 int total=0;
3 
4 void RunMCAsym(
5  const char *dir ="",
6  const char* file="/star/data13/reco/pp200/pythia6_205/55_65gev/cdf_a/y2004y/gheisha_on/p05ih/rcf1271_10_4000evts.MuDst.root",
7  const char *fname="/star/data13/reco/pp200/pythia6_205/55_65gev/cdf_a/y2004y/gheisha_on/p05ih/rcf1271_10_4000evts.geant.root",
8  const char *filter = "",
9  )
10 {
11  int nevents =100;
12 
13  gROOT->Macro("loadMuDst.C");
14  gSystem->Load("StMcEvent");
15  gSystem->Load("StMcEventMaker");
16  gSystem->Load("StEEmcUtil");
17  gSystem->Load("StJetSkimEvent");
18  gSystem->Load("StMCAsymMaker");
19 
20  chain= new StChain("StChain");
21  chain->SetDebug(1);
22  gMessMgr->SwitchOff("D");
23  gMessMgr->SwitchOff("I");
24 
25  StIOMaker* ioMaker = new StIOMaker();
26  ioMaker->SetFile(fname);
27  ioMaker->SetIOMode("r");
28  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
29  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
30 
32  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1e6,"MuDst");
33  StMcEventMaker *mcEventMaker = new StMcEventMaker();
34  StMCAsymMaker *weight = new StMCAsymMaker("MCAsym");
35 
36  TChain* fileChain = muDstMaker->chain();
37  int ntotal = fileChain->GetEntries();
38 
39  for (Int_t iev=0;iev<nevents; iev++) {
40  cout << "****************************************** " << endl;
41  cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<ntotal<<endl;
42  cout << "*************************1***************** " << endl;
43  chain->Clear();
44  int iret = chain->Make(iev);
45 
46  StPythiaEvent *ev = weight->pythiaEvent();
47  cout << "runId = " << ev->runId() << ", eventId = " << ev->eventId() << ", pid = " << ev->processId() << endl;
48  cout << "vertexPos = (" << ev->vertex().X() << ", " << ev->vertex().Y() << ", " << ev->vertex().Z() << ")" << endl;
49  cout << "GRSV STD A_LL = " << ev->ALL(StPythiaEvent::STD) << endl;
50  cout << "incoming parton1 ID = " << ev->particle(0)->GetPdgCode() << endl;
51  cout << "incoming parton2 status = " << ev->particle(1)->GetStatusCode() << endl;
52  cout << "outgoing parton1 daughter1 = " << ev->particle(2)->GetDaughter(0) << endl;
53 
54  total++;
55  if (iret) {
56  cout << "Bad return code!" << endl;
57  break;
58  }
59  }
60 
61  chain->Finish();
62  cout << "****************************************** " << endl;
63  cout << "total number of events " << total << endl;
64  cout << "****************************************** " << endl;
65 }
66 
67 
68 
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