StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runFgtLHTracking_DaqRdr.C
1 /*
2  * Author: S. Gliske (sgliske@anl.gov), March 2012
3  *
4  * Macro to run the simple text based occupancy QA maker and FGT
5  * Helix-Hough tracking using the raw daq reader to read DAQ files.
6  *
7  */
8 
9 // forward declarations
10 class StChain;
11 class StFgtDbMaker;
12 class StFgtRawDaqReader;
13 class St_db_Maker;
14 class StDbConfigNode;
15 class StDbManager;
16 class StFgtLHTracking;
17 
18 
19 StChain *analysisChain = 0;
20 St_db_Maker *dbMkr = 0;
21 StFgtDbMaker *fgtDbMkr = 0;
22 StFgtRawDaqReader *daqRdr = 0;
23 StFgtLHTracking *fgtTrkMkr = 0;
24 
25 void runFgtLHTracking_DaqRdr( const Char_t *filenameIn,
26  Int_t date = 20120125,
27  Int_t time = 80350, // run 13025001 2012-01-25 08:03:34 GMT
28  Int_t neventsIn = 10 ){
29 
30  // load the shared libraries
31  std::cout << "***** Loading libraries *****" << endl;
32  LoadLibs();
33 
34  std::cout << "***** Done loading libraries *****" << endl;
35  std::cout << "***** Instanciating all the classes *****" << endl;
36 
37  //
38  // Create the analysis chain
39  //
40  analysisChain = new StChain("fgtTrackingChain");
41 
42  //
43  // Set up the date base
44  //
45  TString dir0 = "MySQL:StarDb";
46  TString dir1 = "$STAR/StarDb";
47  St_db_Maker *dbMkr = new St_db_Maker( "dbMkr", dir0, dir1 );
48 
49  dbMkr->SetDateTime(date,time);
50 
51  cout << "Loading StFgtDbMaker" << endl;
52  gSystem->Load("StFgtDbMaker");
53 
54  cout << "Constructing StFgtDbMaker" << endl;
55  fgtDbMkr = new StFgtDbMaker( "fgtDbMkr" );
56 
57  //
58  // Raw DAQ reader
59  //
60  cout << "Constructing the daq reader" << endl;
61  daqRdr = new StFgtRawDaqReader( "daqReader", filenameIn, "fgtDbMkr" );
62  daqRdr->setIsCosmic( 0 );
63  daqRdr->cutShortEvents( 1 );
64 
65  //
66  // A2C Maker
67  //
68  cout << "Constructing the A2CMaker" << endl;
69  StFgtA2CMaker* a2cMkr = new StFgtA2CMaker( "FgtA2CMaker" );
70  a2cMkr->setFgtDb( fgtDbMkr->getDbTables() );
71  a2cMkr ->setAbsThres( -5000 ); // set to below -4096 to skip cut
72  a2cMkr ->setRelThres( 4.); // set to zero to skip cut
73  a2cMkr->doCutBadStatus(); //
74  a2cMkr->doRemoveNonPulse(1); //
75 
76 
77  //
78  // Cluster maker
79  //
80  cout << "Constructing the cluster maker" << endl;
81  StFgtClusterMaker* fgtClusMkr = new StFgtClusterMaker("FgtClustMaker");
82  StFgtSeededClusterAlgo* seededClusAlgo = new StFgtSeededClusterAlgo();
83  fgtClusMkr->setClusterAlgo( seededClusAlgo );
84 
85  //
86  // the track maker
87  //
88  fgtTrkMkr = new StFgtLHTracking( "fgtTrkMkr" );
89  fgtTrkMkr->setFitThres( 1 ); // cm
90  fgtTrkMkr->setIncludeThres( 1 ); // cm
91  fgtTrkMkr->setNumPoints( 3 ); // cm
92  fgtTrkMkr->setNumAgreeThres( 3 ); // cm
93 
94 
95  // debugging info
96  std::cout << "***** Done instanciating all the classes *****" << endl;
97  analysisChain->ls(3);
98 
99  //
100  // Initialize all makers
101  //
102  std::cout << "***** Initializing all makers in the analysis chain *****" << std::endl;
103 
104  analysisChain->Init();
105 
106  std::cout << "***** Initialization done *****" << std::endl;
107 
108  //
109  // Finally ready to loop over the events
110  //
111 
112  // If nEvents is negative, reset to the maximum possible value
113  // for an Int_t
114  if( neventsIn < 0 )
115  neventsIn = 1<<31-1;
116 
117  Int_t ierr = kStOK; // err flag
118  Int_t nevents = 0; // cumulative number of events in
119  for( ; nevents < neventsIn && !ierr; ++nevents ){
120  // clear
121  analysisChain->Clear();
122 
123  // make
124  ierr = analysisChain->Make();
125  };
126 
127  //---------------------------------------------------------------
128 
129 
130  //
131  // Calls the ::Finish() method on all makers
132  //
133  analysisChain->Finish();
134 
135  //
136  // Delete the chain
137  //
138  analysisChain->Delete();
139 
140  return;
141 };
142 
143 
144 
145 // load the shared libraries
146 void LoadLibs() {
147  // commong shared libraries
148  gROOT->Macro("loadMuDst.C");
149  //gROOT->Macro("LoadLogger.C");
150 
151  // and a few others
152  gSystem->Load("libStDb_Tables.so");
153  gSystem->Load("StDbLib");
154  gSystem->Load("StDbBroker");
155  gSystem->Load("St_db_Maker");
156  gSystem->Load("StStarLogger");
157  gSystem->Load("StFgtDbMaker");
158 
159  gSystem->Load("RTS");
160 
161  gSystem->Load("StFgtUtil");
162  gSystem->Load("StFgtRawDaqReader");
163  gSystem->Load("StFgtA2CMaker");
164  gSystem->Load("StFgtClusterMaker");
165  gSystem->Load("StFgtTracking");
166 };
167 
168 
169 /*
170  * $Id: runFgtLHTracking_DaqRdr.C,v 1.1 2012/04/09 21:08:58 sgliske Exp $
171  * $Log: runFgtLHTracking_DaqRdr.C,v $
172  * Revision 1.1 2012/04/09 21:08:58 sgliske
173  * creation
174  *
175  * Revision 1.1 2012/04/09 16:14:23 sgliske
176  * creation
177  *
178  *
179  */
void setRelThres(Float_t thres)
set to below -kFgtMaxAdc (-4096) to skip cut
virtual void Delete(Option_t *opt="")
Definition: TDataSet.cxx:320
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
Int_t setClusterAlgo(StFgtIClusterAlgo *)
clear function is empty at the moment
void doCutBadStatus()
set pointer to StFgtDb
void setFgtDb(StFgtDb *fgtDb)
set to zero to skip cut
virtual Int_t Make()
Definition: StChain.cxx:110
Definition: Stypes.h:40