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