StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
agvEffsPoints.C
1 
2 #include <TSystem.h>
3 
4 // forward declarations
5 class StChain;
6 class StFgtDbMaker;
9 class StFgtStatusMaker;
10 class StFgtPedStatQA;
11 class St_db_Maker;
12 class StDbConfigNode;
13 class StDbManager;
14 class StFgtGenPlotter;
15 class StFgtGenAVEMaker;
16 class StFgtGeneralBase;
19 class StFgtPointMaker;
21 class StFgtPointPlotter;
22 
23 StChain *analysisChain = 0;
24 St_db_Maker *dbMkr = 0;
25 StFgtDbMaker *fgtDbMkr = 0;
26 StFgtRawDaqReader *daqRdr = 0;
27 StFgtGenPlotter *fgtGenPlotter = 0;
28 StFgtGenAVEMaker *fgtAVEffMkr = 0;
29 StFgtGeneralBase *fgtGenBase = 0;
30 StFgtStraightTrackMaker *fgtStraightTracker = 0;
31 StFgtPointMaker *fgtPointMkr =0;
32 StFgtPointPlotter *fgtPointPlotter=0;
33 StFgtSimplePointAlgo *fgtSimplePointAlgo =0;
34 
35 
36 
40 //(note: some directories might not compile, remove or ignore these)
42 
43 int agvEffsPoints( const Char_t *filenameIn = "/star/data03/daq/2012/174/13174002p_rf/st_physics_13174002_raw_1010001.daq",
44  Int_t runnumber = 13074038,
45  Int_t nevents = 500, Int_t effDisk=2,
46  Bool_t cutShortEvents = 1 ){
47  LoadLibs();
48 
49  Int_t ierr = 0;
50 
51  cout << "Constructing the chain" << endl;
52  analysisChain = new StChain("fgtEffAnalysisChain");
53 
54  std::string fgtDbMkrName = "";
55 
56  cout << "Loading St_db_Maker" << endl;
57  gSystem->Load("libStDb_Tables.so");
58  gSystem->Load("StDbLib.so");
59  gSystem->Load("St_db_Maker");
60  gSystem->Load("StDbBroker");
61 
62 
63  TString dir0 = "MySQL:StarDb";
64  TString dir1 = "$STAR/StarDb";
65  St_db_Maker *dbMkr = new St_db_Maker( "dbMkr", dir0, dir1 );
66  //dbMkr->SetDateTime(20120115,1);
67  //for run 13061024, watch out for GMT!!
68  //dbMkr->SetDateTime(20120301,162844); // run 13025001 2012-01-25 08:03:34 GMT
69  //run 13064033
70  // dbMkr->SetDateTime(20120304,173144); // run 13025001 2012-01-25 08:03:34 GMT
71  //for 1305459
72  // dbMkr->SetDateTime(20120223,201805);
74  // dbMkr->SetDateTime(20120404,043459); ///
76  // dbMkr->SetDateTime(20120622,043459); ///z
77  dbMkr->SetDateTime(20130301,043459);
78  // dbMkr->SetDateTime(20120803,043459); ///for cosmic teststand
79  // dbMkr->SetDateTime(20120903,043459); ///for cosmic teststand
80 
82  // dbMkr->SetDateTime(20120128,204320); // run ???
83 
84  cout << "Constructing StFgtDbMaker" << endl;
85  fgtDbMkr = new StFgtDbMaker( "fgtDb" );
86  //fgtDbMkr->SetFlavor("ideal",""); // mapping is wrong, but at least the code runs...
87  fgtDbMkrName = fgtDbMkr->GetName();
88 
89  //
90  // NOW THE OTHER READERS AND MAKERS
91  //
92  cout << "Constructing the daq reader" << endl;
93  daqRdr = new StFgtRawDaqReader( "daqReader", filenameIn, fgtDbMkrName.data() );
94  daqRdr->setIsCosmic( false );
95  daqRdr->cutShortEvents( cutShortEvents );
96  daqRdr->setIsCosmic( false );
97  daqRdr->setZSdataOnly();
98  gSystem->Load("libStFgtA2CMaker");
99  StFgtA2CMaker* a2cMkr = new StFgtA2CMaker( "FgtA2CMaker" );
100  a2cMkr->setFgtDb(fgtDbMkr->getDbTables());
101  a2cMkr ->setAbsThres( -5000 ); // set to below -4096 to skip cut
102  // a2cMkr ->setAbsThres( 300 ); // set to below -4096 to skip cut
103  a2cMkr ->setRelThres( 4.); // set to zero to skip cut
104  // a2cMkr->doCutBadStatus(true);//parameter is useless from looking at the function
105  a2cMkr->doCutBadStatus();
106  a2cMkr->acceptLongPulses(true);
108  a2cMkr->setClusterThreshold(0.8);
109 
111  // a2cMkr->doRemoveNonSignal(false);
112  // a2cMkr->doRemoveNonPulse(false);
113 
114  Char_t *myMaker = "StFgtClusterMaker";
115  if (gClassTable->GetID(myMaker) < 0) {
116  gSystem->Load(myMaker);// TString ts("load "; ts+=myMaker; StMemStat::PrintMem(ts.Data());
117  }
118  if (gClassTable->GetID("StFgtPointMaker") < 0) {
119  gSystem->Load("StFgtPointMaker");// TString ts("load "; ts+=myMaker; StMemStat::PrintMem(ts.Data());
120  }
121  StFgtClusterMaker* myMk =new StFgtClusterMaker("FgtClustMaker");
122  //simplePointAlgo is default
123  // simpleClusAlgo = new StFgtSimpleClusterAlgo();
124  seededClusAlgo = new StFgtSeededClusterAlgo();
125  seededClusAlgo->setJumpSingleStrip(true); // if a strip in cluster has no charge
126 
127  myMk->setClusterAlgo( seededClusAlgo );
128 
129  cout <<"1" <<endl;
130  // StFgtAVEfficiencyMaker* effMkr=new StFgtAVEfficiencyMaker("FgtAVEfficiencyMaker");
131  // StFgtClusterPlotter* clusPlot=new StFgtClusterPlotter("FgtClusterPlotter");
132  // fgtAVEffMkr = new StFgtGenAVEMaker( "avEffMkr" );
133 
134  fgtPointMkr = new StFgtPointMaker("fgtPointMaker");
135  fgtSimplePointAlgo=new StFgtSimplePointAlgo();
136  fgtPointMkr->setPointAlgo(fgtSimplePointAlgo);
137 
138  // fgtStraightTracker = new StFgtStraightTrackMaker( "fgtStraightTracker" );
139  // fgtStraightPlotter = new StFgtStraightPlotter( "fgtStraightPlotter" );
140 
141  fgtPointPlotter=new StFgtPointPlotter("fgtPointPlotter");
142 
143  // fgtAVEffMkr->setChargeMatchCut(2.0);
144  // fgtAVEffMkr->setUseChargeMatch();
145  // fgtAVEffMkr->SetEffDisk(effDisk);
146  // fgtGenPlotter = new StFgtGenPlotter( "genPlotter" );
147 
148  // debug
149  // analysisChain->ls(4);
150 
151  cout << "Initializing" << endl;
152  ierr = analysisChain->Init();
153 
154  if( ierr ){
155  cout << "Error initializing" << endl;
156  return;
157  };
158 
159  if( nevents < 0 )
160  nevents = 1<<30; // a big number
161 
162  cout << "max nevents = " << nevents << endl;
163  for( int i=0; i<nevents && !ierr; ++i ){
164  // if( i+1 % 100 == 1 )
165  cout << "\ton event number **************" << i << endl;
166  cout << "clear (agv)" << endl;
167  analysisChain->Clear();
168  cout << "make" << endl;
169  ierr = analysisChain->Make();
170  cout <<" done " <<endl;
171  };
172 
173  // fgtDbMkr->printFgtDumpCSV("fgtMapDump.csv");
174  //
175  // Calls the ::Finish() method on all makers
176  //
177  cout << "finish" << endl;
178  analysisChain->Finish();
179 
180  // Now write a status table
181 
182  /*
183  if( runnumber ){
184  std::stringstream ss;
185  fout << "Times given in the run log are " << endl;
186  ss << "lynx -dump 'http://online.star.bnl.gov/RunLogRun12/index.php?r=" << runnumber << "' | grep GMT";
187  FILE *f = gSystem->OpenPipe(ss.str().data(),"r");
188  Char_t c;
189  while((c=fgetc(f))!=EOF)
190  fout << c;
191  };*/
192 
193 
194  doOutputPdf=false;
195  // convert ps to pdf
196  if( doOutputPdf ){
197  cout << "converting ps to pdf" << endl;
198  gSystem->Exec(( std::string("ps2pdf -dAutoRotatePages=/None ") + pdfFile ).data());
199  };
200 
201  cerr << "\tall done" << endl;
202  return;
203 };
204 
205 
206 // load the shared libraries
207 void LoadLibs() {
208  // common shared libraries
209  gROOT->Macro("loadMuDst.C");
210  gSystem->Load("libPhysics");
211  gSystem->Load("St_base");
212  gSystem->Load("StChain");
213  // gSystem->Load("StFgtUtil");
214  gSystem->Load("StUtilities");
215  gSystem->Load("StEvent");
216  cout << "loaded StEvent library" << endl;
217 
218  gSystem->Load("RTS");
219  gSystem->Load("StFgtUtil");
220  gSystem->Load("StFgtDbMaker");
221  gSystem->Load("StFgtClusterTools");
222  // gSystem->Load("StFgtPedPlotter");
223  // gSystem->Load("StFgtPool");
224  // gSystem->Load("StFgtPedMaker");
225  gSystem->Load("StFgtRawDaqReader");
226  // gSystem->Load("StFgtQaMakers");
227 
228 
229 };
void acceptLongPulses(Bool_t accept)
set status mask to some other value
void setRelThres(Float_t thres)
set to below -kFgtMaxAdc (-4096) to skip cut
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
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
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237