00001 // $Id: StMcEventReadMacro.C,v 1.2 2006/08/15 21:41:50 jeromel Exp $ 00002 // $Log: StMcEventReadMacro.C,v $ 00003 // Revision 1.2 2006/08/15 21:41:50 jeromel 00004 // Fix rhic -> rhic.bnl.gov 00005 // 00006 // Revision 1.1 2004/10/12 18:53:48 mmiller 00007 // Added simu macros and some scripts. 00008 // 00009 // Revision 1.1 2004/10/12 18:20:20 mmiller 00010 // *** empty log message *** 00011 // 00012 // Revision 1.18 2002/08/15 14:49:27 calderon 00013 // Go back to loading St_Tables instead of loading each table individually... 00014 // (as was the case since revision 1.12 back in April 2000!) 00015 // 00016 // Revision 1.17 2001/04/09 17:47:15 calderon 00017 // load StEmcUtil instead of St_emc_Maker 00018 // 00019 // Revision 1.16 2000/06/22 23:54:30 calderon 00020 // add gSystemLoad->("libglobal_Tables"); because it is needed for year2a 00021 // 00022 // Revision 1.15 2000/06/06 03:03:30 calderon 00023 // Use with new Emc classes. 00024 // 00025 // Revision 1.14 2000/04/20 17:02:42 calderon 00026 // Modified macros to continue looping when status = 3 00027 // Pick up maker with name "StMcAnalysisMaker" instead of "McAnalysis" 00028 // in StAssociator.C 00029 // 00030 // Revision 1.13 2000/04/13 22:00:24 calderon 00031 // set dst branch and appropriate tables as per Kathy 00032 // 00033 // Revision 1.12 2000/04/12 17:39:02 kathy 00034 // change to only load table libraries needed: lib*_Tables instead of all tables: St_Tables 00035 // 00036 // Revision 1.11 2000/01/19 21:00:40 kathy 00037 // update macros to use standard default xdf files in /afs/rhic.bnl.gov/star/data/samples 00038 // 00039 // Revision 1.10 2000/01/12 20:29:15 calderon 00040 // Changed default file to the one produced weekly by Lidia in 00041 // /star/rcf/test/dev/tfs_Linux/Tue/year_2a/hc_standard/ 00042 // 00043 // Revision 1.9 1999/12/14 18:18:01 calderon 00044 // using new StMcEvent, StEvent & StAssociationMaker 00045 // 00046 // Revision 1.8 1999/12/03 01:01:33 calderon 00047 // Updated for new StMcEvent 2.0 and StMcEventMaker. 00048 // Uses StTpcDb to get the geometry info (calib has some problems still). 00049 // 00050 // Revision 1.7 1999/11/03 22:47:33 calderon 00051 // Changed default file. Previous one no longer existed. 00052 // 00053 // Revision 1.6 1999/07/28 21:29:34 calderon 00054 // Modified event loop: use 'if' and 'goto' to avoid using 'for' 00055 // 00056 // Revision 1.5 1999/07/28 20:27:46 calderon 00057 // Version with SL99f libraries 00058 // 00059 // Revision 1.4 1999/07/23 19:57:26 calderon 00060 // Load StarClassLibrary before loading StMcEvent 00061 // 00062 // Revision 1.3 1999/07/23 14:35:43 calderon 00063 // Updated names of default files and of packages 00064 // 00065 // Revision 1.2 1999/07/23 10:53:52 kathy 00066 // put in header info in Manuel's macros 00067 // 00068 // 00070 // owner: Manuel Calderon de la Barca Sanchez 00071 // 00072 // what it does: reads .geant.root file, 00073 // loads StMcEvent by putting StMcEventMaker in chain 00074 // 00075 // note: for more info on StMcEvent and StAssociationMaker, do a 00076 // cvs checkout and say "make" in the doc/tex directory - you'll 00077 // get a ps file with user guide and reference manual. 00079 // 00080 // 00081 //====================================================================== 00082 class StChain; 00083 class St_DataSet; 00084 St_DataSet *Event; 00085 StChain *chain; 00086 TBrowser *brow=0; 00087 00088 00089 // The acual file to be used is passed as an argument to the macro, or a default can be set 00090 00091 void StMcEventReadMacro(Int_t nevents=100, 00092 const char *MainFile="/star/data19/reco/pp200/pythia6_203/default/minbias/y2004a/gheisha_on/trs_ii/rcf1210_95_4255evts.geant.root") 00093 { 00094 // Load all the System libraries 00095 gSystem->Load("St_base"); 00096 gSystem->Load("StChain"); 00097 gSystem->Load("St_Tables"); 00098 gSystem->Load("StUtilities"); 00099 gSystem->Load("StIOMaker"); 00100 gSystem->Load("StarClassLibrary"); 00101 gSystem->Load("StDetectorDbMaker"); 00102 gSystem->Load("StTpcDb"); 00103 gSystem->Load("StEvent"); 00104 gSystem->Load("StEmcUtil"); 00105 gSystem->Load("StMcEvent"); 00106 gSystem->Load("StMcEventMaker"); 00107 00108 // TOP maker 00109 chain = new StChain("StMcEventMainChain"); 00110 chain->SetDebug(); 00111 00112 // IO Maker 00113 StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree"); 00114 IOMk->SetDebug(); 00115 IOMk->SetIOMode("r"); 00116 IOMk->SetBranch("*",0,"0"); //deactivate all branches 00117 IOMk->SetBranch("geantBranch",0,"r"); 00118 IOMk->SetBranch("dstBranch",0,"r"); 00119 00120 00121 // StMcEvent 00122 StMcEventMaker *mcEventReader = new StMcEventMaker; // Make an instance... 00123 mcEventReader->doPrintEventInfo = true; 00124 mcEventReader->doPrintMemoryInfo = false; 00125 mcEventReader->doUseTpc = true; 00126 mcEventReader->doUseSvt = true; 00127 mcEventReader->doUseFtpc = true; 00128 mcEventReader->doUseRich = true; 00129 mcEventReader->doUseBemc = true; 00130 mcEventReader->doUseBsmd = true; 00131 mcEventReader->SetDebug(); 00132 // now execute the chain member functions 00133 00134 chain->PrintInfo(); 00135 Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers 00136 if (initStat) chain->Fatal(initStat, "during Init()"); 00137 00138 int istat=0,iev=1; 00139 EventLoop: if (iev<=nevents && istat!=2) { 00140 chain->Clear(); 00141 cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl; 00142 istat = chain->Make(iev); // This should call the Make() method in ALL makers 00143 if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; } 00144 if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; } 00145 iev++; goto EventLoop; 00146 00147 // this next part is just for doing the browser: 00148 //create browser with name=BName,title=Btitle 00149 00150 // Event = chain->GetDataSet("geant"); 00151 // Event->ls(9); 00152 // brow = new TBrowser("BName","BTitle"); 00153 00154 // // To view tables in Ntuple format 00155 // St_DataSetIter geantDstI(Event); 00156 // St_g2t_vertex *g2t_vertexTablePointer = (St_g2t_vertex *) geantDstI("g2t_vertex"); 00157 // St_g2t_track *g2t_trackTablePointer = (St_g2t_track *) geantDstI("g2t_track"); 00158 // St_g2t_tpc_hit *g2t_tpc_hitTablePointer = (St_g2t_tpc_hit *) geantDstI("g2t_tpc_hit"); 00159 // St_g2t_svt_hit *g2t_svt_hitTablePointer = (St_g2t_svt_hit *) geantDstI("g2t_svt_hit"); 00160 // St_g2t_ftp_hit *g2t_ftp_hitTablePointer = (St_g2t_ftp_hit *) geantDstI("g2t_ftp_hit"); 00161 00162 // gSystem->Load("xdf2root"); // Needed for some reason 00163 00164 // St_TableNtuple vertexNtuple(*g2t_vertexTablePointer); 00165 // St_TableNtuple trackNtuple(*g2t_trackTablePointer); 00166 // St_TableNtuple tpc_hitNtuple(*g2t_tpc_hitTablePointer); 00167 // St_TableNtuple svt_hitNtuple(*g2t_svt_hitTablePointer); 00168 // St_TableNtuple ftp_hitNtuple(*g2t_ftp_hitTablePointer); 00169 00170 // vertexNtuple.Fill(*g2t_vertexTablePointer); 00171 // trackNtuple.Fill(*g2t_trackTablePointer); 00172 // tpc_hitNtuple.Fill(*g2t_tpc_hitTablePointer); 00173 // svt_hitNtuple.Fill(*g2t_svt_hitTablePointer); 00174 // ftp_hitNtuple.Fill(*g2t_ftp_hitTablePointer); 00175 00176 00177 } // Event Loop 00178 //chain->Finish(); // This should call the Finish() method in ALL makers 00179 // Comment this line out if you want to access the information 00180 // at the command line. 00181 }
1.5.9