StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
simpleTestStandTest.C
1 /***************************************************************************
2  *
3  * $Id: simpleTestStandTest.C,v 1.1 2012/01/31 09:07:43 sgliske Exp $
4  * Author: S. Gliske, Sept 2011
5  *
6  ***************************************************************************
7  *
8  * Description: Simple test macro to read in test stand data.
9  *
10  ***************************************************************************
11  *
12  * $Log: simpleTestStandTest.C,v $
13  * Revision 1.1 2012/01/31 09:07:43 sgliske
14  * moved StFgtRawDaqReader to StFgtPool/StFgtRawDaqReader
15  *
16  * Revision 1.4 2011/09/21 17:49:35 sgliske
17  * alternate base class with more
18  * functionality and not an StMaker
19  *
20  * Revision 1.2 2011/09/21 00:39:57 avossen
21  * added simple Fgt maker base class
22  *
23  * Revision 1.1 2011/09/20 15:53:09 sgliske
24  * Update so that everything compiles nicely
25  * and so that one can execute the macro/simpleTestStandTest.C file
26  *
27  *
28  **************************************************************************/
29 
30 // forward declarations
31 class StChain;
32 class StFgtCosmicMaker;
33 class StEvent;
34 class StFgtEvent;
35 
36 StChain *analysisChain = 0;
37 StFgtCosmicMaker *cosmicMkr = 0;
38 
39 int simpleTestStandTest( const Char_t *filename = "testfile.sfs",
40  Int_t nevents = 10,
41  Int_t numDiscs = 6 ){
42 
43  LoadLibs();
44  Int_t ierr = 0;
45 
46  cout << "Constructing the chain" << endl;
47  analysisChain = new StChain("eemcAnalysisChain");
48 
49  cout << "Constructing the maker" << endl;
50  cosmicMkr = new StFgtCosmicMaker( "cosmicMaker", filename );
51  cosmicMkr->setNumDiscs( numDiscs );
52 
53  cout << "Initializing" << endl;
54  ierr = analysisChain->Init();
55 
56  if( ierr ){
57  cout << "Error initializing" << endl;
58  return;
59  };
60 
61  if( nevents < 0 )
62  nevents = 1e100; // a big number
63 
64  for( int i=0; i<nevents && !ierr; ++i ){
65 
66  cout << "event number " << i << endl;
67 
68  cout << "clear" << endl;
69  analysisChain->Clear();
70 
71  cout << "make" << endl;
72  ierr = analysisChain->Make();
73 
74  // count number of events
75  StFgtEvent *fgtEventPtr = cosmicMkr->getFgtEventPtr();
76  for( Int_t disc = 0; disc < numDiscs; ++disc ){
77  StFgtDisc *discPtr = fgtEventPtr->getDiscPtr( disc );
78  if( discPtr )
79  cout << "\tDisc " << disc << ", number of raw hits " << discPtr->getNumRawHits() << endl;
80  };
81  };
82 
83  //
84  // Calls the ::Finish() method on all makers
85  //
86  cout << "finish" << endl;
87  analysisChain->Finish();
88 
89  cout << "all done" << endl;
90  return;
91 };
92 
93 
94 // load the shared libraries
95 void LoadLibs() {
96  // common shared libraries
97 
98  gSystem->Load("libPhysics");
99  gSystem->Load("St_base");
100  gSystem->Load("StChain");
101  gSystem->Load("StEvent");
102  cout << "loaded StEvent library" << endl;
103 
104  gSystem->Load("StFgtUtil");
105  gSystem->Load("StFgtRawMaker");
106  gSystem->Load("RTS");
107 };
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