StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rdDaq2sanity.C
1 /***************************************************************************
2  *
3  * Author: Jan Balewski , February 2012
4  *
5  ***************************************************************************
6  *
7  * Description: detects & counts bad APVs in FGT events
8  *
9  ***************************************************************************/
10 
11 
12 int rdDaq2sanity( const Char_t *filenameIn = "st_physics_13027045_raw_0010001.daq",
13  Int_t nevents = 1000 ){
14  LoadLibs();
15  Int_t ierr = 0;
16 
17  std::string daqFileName( filenameIn );
18 
19  // create histogram storage array (everybody needs it):
20  TObjArray* HList=new TObjArray;
21 
22  cout << "Constructing the chain" << endl;
23  analysisChain = new StChain("eemcAnalysisChain");
24 
25  std::string fgtDbMkrName = "";
26 
27  cout << "Loading St_db_Maker" << endl;
28  gSystem->Load("libStDb_Tables.so");
29  gSystem->Load("StDbLib.so");
30  gSystem->Load("St_db_Maker");
31  gSystem->Load("StDbBroker");
32 
33  TString dir0 = "MySQL:StarDb";
34  TString dir1 = "$STAR/StarDb";
35  St_db_Maker *dbMkr = new St_db_Maker( "dbMkr", dir0, dir1 );
36  dbMkr->SetDateTime(20120207,0); // Feb 7
37  //dbMkr->SetDateTime(20120125,80350); // run 13025001 2012-01-25 08:03:34 GMT
38  cout << "Loading StFgtDbMaker" << endl;
39  gSystem->Load("StFgtDbMaker");
40 
41  cout << "Constructing StFgtDbMaker" << endl;
42  fgtDbMkr = new StFgtDbMaker( "fgtDbMkr" );
43 
44  fgtDbMkrName = fgtDbMkr->GetName();
45 
46  cout << "Fgt DB Maker Name " << fgtDbMkrName << endl;
47 
48  cout << "Constructing the daq reader" << endl;
49  daqRdr = new StFgtRawDaqReader( "daqReader", filenameIn, fgtDbMkrName.data() );
50  daqRdr->setIsCosmic( 0 );
51  daqRdr->cutShortEvents( true );
52  cout << "Fgt DB Maker Name " << fgtDbMkrName.data() << endl;
53  cout << "Constructing the Time Shape Maker" << endl;
54  // new StFgtSanityMaker( "FgtTimeShapeMaker", fgtDbMkrName.data() );
55  gainMk=new StFgtJanGainMaker( fgtDbMkrName.data() );
56  gainMk->setHList(HList);
57 
58  // debug
59  analysisChain->ls(3);
60 
61  cout << "Initializing" << endl;
62  ierr = analysisChain->Init();
63 
64  if( nevents < 0 )nevents = 1<<30; // a big number
65 
66  cout << "max nevents = " << nevents << endl;
67  for( int i=0; i<nevents && !ierr; ++i ){
68  // if( i % 100 == 0 )
69  cout << "\ton event number **************" << i << endl;
70 
71  analysisChain->Clear();
72  ierr = analysisChain->Make();
73  };
74 
75  cout << "M: finish" << endl;
76  analysisChain->Finish();
77 
78  cerr << "\tall done" << endl;
79 
80  TString outFh=filenameIn; outFh="pulse.hist.root";
81  //outFh.ReplaceAll(".daq",".wana.hist.root");
82  cout<<"Output histo file "<<outFh<<endl;
83  hf=new TFile(outFh,"recreate");
84  if(hf->IsOpen()) {
85  HList->ls();
86  HList->Write();
87  printf("\n Histo saved -->%s<\n",outFh.Data());
88  } else {
89  printf("\n Failed to open Histo-file -->%s<, continue\n",outFh.Data());
90  }
91 
92 
93  fgtDbMkr->printFgtDumpCSV("fgtMapDump.csv"); // to dump whole FGT DB mapping
94 
95 
96 };
97 
98 
99 // load the shared libraries
100 void LoadLibs() {
101  // common shared libraries
102 
103  gSystem->Load("libPhysics");
104  gSystem->Load("St_base");
105  gSystem->Load("StChain");
106  gSystem->Load("StFgtUtil");
107  gSystem->Load("StUtilities");
108  gSystem->Load("StEvent");
109  cout << "loaded StEvent library" << endl;
110 
111  gSystem->Load("StFgtUtil");
112  gSystem->Load("StFgtRawMaker");
113  gSystem->Load("StFgtRawDaqReader");
114  gSystem->Load("RTS");
115  gSystem->Load("StFgtSanityMaker");
116  gSystem->Load("StFgtDbMaker");
117 };
118 
119 /**************************************************************************
120  *
121  * $Log: rdDaq2sanity.C,v $
122  * Revision 1.4 2012/02/07 08:25:32 balewski
123  * *** empty log message ***
124  *
125  * Revision 1.3 2012/02/07 05:33:33 balewski
126  * *** empty log message ***
127  *
128  * Revision 1.2 2012/02/06 04:17:43 balewski
129  * added 2012 APV exclusions
130  *
131  * Revision 1.1 2012/02/04 22:03:43 balewski
132  * start
133  *
134  *
135  **************************************************************************/
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
virtual Int_t Make()
Definition: StChain.cxx:110
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237