StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fzd2EEevent.C
1 #include <iostream.h>
2 
3 class St_geant_Maker;
4 class EEmcMCData;
5 
6 
7 TBrowser *b = 0;
8 St_geant_Maker *geant= 0;
9 // reads .fzd file and prints on the screen
10 
11 // ______________________________________________
12 void fzd2EEevent(const Int_t Nevents=10000, TString fzFile ="../sim2003/mc_eve2.fzd") {
13  fzFile ="pid6.fzd";
14  fzFile ="dAu83.fzd";
15  //fzFile ="../sim2003/mc_pi0-1.5.fzd";
16  //fzFile ="../sim2003/mc_eve3.fzd";
17  Int_t i=0;
18  gSystem->Load("St_base");
19  gSystem->Load("StChain");
20  gSystem->Load("StarClassLibrary");
21 
22  gROOT->LoadMacro("$STAR/StRoot/macros/bfc.C");
23  gSystem->Load("StEEmcUtil.so");
24  bfc(0,"fzin sim_T gen_T",fzFile);
25 
26  TString outFile=fzFile.ReplaceAll(".fzd",".root");
27  TFile f(outFile,"RECREATE"); //create a Tree file
28  TTree t4("EEtree","A Tree with Events"); // Create a ROOT Tree
29 
30  EEeventDst eveR;// Raw MC event, local, not saved
31  EEeventDst *eve=new EEeventDst(); // 'Fast sim' Event stored in TTRee
32  t4.Branch("EEdst", "EEeventDst", &eve,16000,99);
33  EEmcMCData *evIN = new EEmcMCData;
34 
35  for (i=1; i<=Nevents; i++ ) {
36  chain->Clear();
37  if (chain->Make(i)>=kStEOF) break;
38  printf("%2d ====================================\n",i);
39  int nh=-1;
40  nh = evIN->readEventFromChain(chain);
41 
42  if(nh<=0) {
43  printf("EEMC/CTF hits not found");
44  continue;
45  }
46 
47  if(i==1) {
48  printf(" actual RAW geant EEMC hits =%d nh\n",nh);
49  evIN->print();
50  }
51 
52  // generation of TTree
53  evIN->write(&eveR); // Clear & Store EEeventDst
54  //printf("XXXXXXXXX raw event.print():\n");eveR.print();
55 
56  eveR.sumRawMC(eve); //sum hits with any detector
57  //printf("XXXXXXXXX summed event.print():\n");eve->print();
58 
59  t4.Fill(); // Fill the tree
60  }
61 
62  Int_t nevent = (Int_t)t4->GetEntries();
63  printf("Total events in TTree=%d file=%s\n",nevent,outFile.Data());
64  t4->Print();
65 
66  f.Write() ; // Write the TTree file header
67 
68 
69 }
70 
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
Definition: Stypes.h:43
virtual Int_t Make()
Definition: StChain.cxx:110