StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
makeStrangeMuDst.C
1 // $Id: makeStrangeMuDst.C,v 2.8 2010/03/16 16:23:09 fisyak Exp $
2 // $Log: makeStrangeMuDst.C,v $
3 // Revision 2.8 2010/03/16 16:23:09 fisyak
4 // StTpcDb requires StDetectorDbMaker
5 //
6 // Revision 2.7 2006/08/15 21:42:48 jeromel
7 // Fix rhic -> rhic.bnl.gov
8 //
9 // Revision 2.6 2005/08/31 15:03:09 fisyak
10 // Add dependence StMagF vs StarMagField
11 //
12 // Revision 2.5 2003/02/10 16:50:08 genevb
13 // simple updates
14 //
15 // Revision 2.4 2001/09/21 02:21:57 jeromel
16 // StTpcDb needed by StEventMaker.
17 //
18 // Revision 2.3 2001/05/04 20:18:46 genevb
19 // Update for new EMC dependencies
20 //
21 // Revision 2.2 2000/06/30 23:54:20 lansdell
22 // load St_emc_Maker so StMcEventMaker runs properly
23 //
24 // Revision 2.1 2000/06/09 22:15:10 genevb
25 // Include code for fixing track topology maps, if necessary
26 //
27 // Revision 2.0 2000/06/02 22:28:58 genevb
28 // Updated for version 2 of Strangeness mico DST package
29 //
30 // Revision 1.5 2000/05/18 19:50:48 genevb
31 // Better handling of status returned by chain.Make()
32 //
33 // Revision 1.4 2000/04/13 21:46:35 kathy
34 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
35 //
36 // Revision 1.3 2000/04/12 16:16:55 genevb
37 // Remove unnecessary library loads
38 //
39 // Revision 1.2 2000/04/12 15:06:53 kathy
40 // changed all macros that read DSTs to load Tables from libraries: gen,sim,global,dst instead of ALL Tables (previously loaded St_Tables); currently, if you are using DEV to read a DST in NEW,PRO, you must comment out the loading of libtpc_Tables because of a mismatch with tpt_track table
41 //
42 // Revision 1.1 2000/03/29 00:24:54 genevb
43 // Introduction of macro to use StStrangeMuDstMaker
44 //
45 //
46 //======================================================
47 // owner: Gene Van Buren, UCLA
48 // what it does: Uses StStrangeMuDstMaker to create a micro DST
49 // with both v0's and xi's. Uncomment lines after
50 // "using Monte Carlo" to include MC info in DST.
51 // Uncomment lines after "for MDC3 files" to fix
52 // track topology maps from MDC.
53 //======================================================
54 
55 
56 
57 void load() {
58  gSystem->Load("St_base");
59  gSystem->Load("StUtilities");
60  gSystem->Load("St_Tables");
61 
62  gSystem->Load("StChain");
63  gSystem->Load("StIOMaker");
64  gSystem->Load("StarClassLibrary");
65  gSystem->Load("StEvent");
66  gSystem->Load("StarMagField");
67  gSystem->Load("StMagF");
68  gSystem->Load("StDetectorDbMaker");
69  gSystem->Load("StTpcDb");
70  // The following is needed if reading from dst Branch instead of Event Branch
71 // gSystem->Load("StEventMaker");
72  gSystem->Load("StStrangeMuDstMaker");
73 // The following are needed for using Monte Carlo info
74 // gSystem->Load("StEmcUtil");
75 // gSystem->Load("StMcEvent");
76 // gSystem->Load("StMcEventMaker");
77 // gSystem->Load("StAssociationMaker");
78 // gSystem->Load("StMcAnalysisMaker");
79 // The following is needed for MDC3 files with incorrect track topology maps
80 // gSystem->Load("StHbtMaker");
81 }
82 
83 void run() {
84  // Open input file
85  const Char_t *file = "/afs/rhic.bnl.gov/star/data/samples/hc_standard.40_evts.dst.root";
86 
87  StFile *files = new StFile();
88  files->AddFile(file);
89 
90  // Set number of events to analyse
91  const Int_t Nevents = 10;
92 
93  // Create a chain
94  StChain chain("myChain");
95 
96  // Create Makers
97  StIOMaker IOMaker("IO","r",files,"bfcTree");
98  // The following is needed if reading from dst Branch instead of Event Branch
99 // StEventMaker eventMaker("events","title");
100 // The following are needed for using Monte Carlo info
101 // StMcEventMaker* mcEventReader = new StMcEventMaker;
102 // StAssociationMaker* associator = new StAssociationMaker;
103 // The following is needed for MDC3 files with incorrect track topology maps
104 // StRandyTopMapMaker topoMapFixer();
105  StStrangeMuDstMaker strangeDst("strangeMuDst");
106 
107  // Indicate input branches (i.e. eventBranch = *.event.root file)
108  IOMaker.SetBranch("*",0,"0"); //deactivate all branches
109  IOMaker.SetBranch("runcoBranch",0,"r"); //activate runco Branch
110  // One of the following two branches must be selected to read from
111 // IOMaker.SetBranch("dstBranch",0,"r"); //activate sst Branch
112  IOMaker.SetBranch("eventBranch",0,"r"); //activate Event Branch
113 // The following is needed for using Monte Carlo info
114 // IOMaker.SetBranch("geantBranch",0,"r"); //activate geant Branch
115 
116  // Indicate micro DST settings
117  strangeDst.DoV0(); // Selects V0 vertices for micro-DST
118  strangeDst.DoXi(); // Selects Xi vertices for micro-DST
119  strangeDst.SetWrite(); // Sets "write" mode (using default filenames)
120 // The following is needed for using Monte Carlo info
121 // strangeDst.DoMc();
122 
123  // Do init
124  Int_t istatus = chain.Init();
125  if( istatus ) { chain.Fatal(istatus,"on init"); return; }
126 
127  // Loop over events
128  for( Int_t i=0; (i<Nevents) && (istatus!=2); i++ ) {
129  switch (istatus = chain.Make(i)) {
130  case 0: break;
131  case 2: { gMessMgr->Info("Last event from input."); break; }
132  case 3: { gMessMgr->Error() << "Event " << i << " had error " <<
133  istatus << ". Now skipping event."; gMessMgr->Print(); break; }
134  default: { gMessMgr->Warning() << "Event " << i << " returned status " <<
135  istatus << ". Continuing."; gMessMgr->Print(); }
136  }
137  if( i != Nevents) chain.Clear();
138  gMessMgr->Info() << "*** Finished processing event " << i;
139  gMessMgr->Print();
140  }
141 
142  // Finish
143  if( Nevents >= 1 ) {
144  chain.Finish();
145  }
146 }
147 
148 void makeStrangeMuDst() {
149  load();
150  run();
151 }
152 
Definition: StTree.h:125
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual Int_t Make()
Definition: StChain.cxx:110