StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doSvtBadAnodes.C
1 //
3 // $Id: doSvtBadAnodes.C,v 1.1 2004/02/06 02:31:31 munhoz Exp $
4 //
6 
7 Int_t usePath = 0;
8 Int_t nFile = 0;
9 TString thePath;
10 TString theFileName;
11 TString originalPath;
12 class StChain;
13 StChain *chain=0;
14 class StEventDisplayMaker;
15 StEventDisplayMaker *dsMaker = 0;
16 TBrowser *b=0;
17 
18 const char *dstFile = 0;
19 const char *xdfFile = 0;
20 const char *mdcFile = 0;
21 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
22 
23 void doSvtBadAnodes(Int_t nevents=1,
24  const Char_t *path="/scratch_star5a/pp_sep2003_RFF_P03if/",
25  const Char_t *file="st_physics_3006053_raw_0536.MuDst.root",
26  const Char_t *fileOut = "ntuple.root");
27 
28 // ------------------ Here is the actual method -----------------------------------------
29 void doSvtBadAnodes(Int_t nevents, const Char_t **fileList, const Char_t *fileOut)
30 {
31 
32  cout << endl << endl <<" doEvents - input # events = " << nevents << endl;
33  Int_t ilist=0;
34  while(fileList[ilist]){
35  cout << " doEvents - input fileList = " << fileList[ilist] << endl;
36  ilist++;
37  }
38 
39  //
40  // First load some shared libraries we need
41  //
42 
43  gSystem->Load("St_base");
44  gSystem->Load("StUtilities");
45  gSystem->Load("StChain");
46  gSystem->Load("StBFChain");
47  gSystem->Load("St_Tables");
48 
49  gSystem->Load("libgen_Tables");
50  gSystem->Load("libsim_Tables");
51  gSystem->Load("libglobal_Tables");
52  gSystem->Load("geometry");
53 
54  gSystem->Load("StIOMaker");
55  gSystem->Load("StTreeMaker");
56  gSystem->Load("StarClassLibrary");
57 
58  gSystem->Load("StSvtClassLibrary");
59  gSystem->Load("StSvtDaqMaker");
60  gSystem->Load("StSvtCalibMaker");
61 
62  //
63  // Handling depends on whether file is a ROOT file or XDF file
64  //
65  chain = new StChain("StChain");
66 
67  StFile *setFiles =0;
68  if (fileList) { //Normal case
69  setFiles= new StFile(fileList);
70  } else { //Grand Challenge
71  gSystem->Load("StChallenger");
72  setFiles = StChallenger::Challenge();
73  setFiles->SetDebug();
74  const char *Argv[]= {
75  "-s","daq", // list of components needed
76  "-q","mRunNumber=1228023", // example of user query
77  "-c","/afs/rhic/star/incoming/GCA/daq/stacs.rc" // pointer to GC servers for daq
78  };
79  Int_t Argc=sizeof(Argv)/4;
80  setFiles->Init(Argc,Argv);
81  }
82 
83  //
84  // IO Maker
85  //
86  StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree");
87  IOMk->SetIOMode("r");
88  IOMk->SetDebug();
89 
90  //
91  // SVT DAQ Maker
92  //
93  StSvtDaqMaker *svtDaqMaker = new StSvtDaqMaker("svtDaq","FULL");
94 
95  //
96  // SVT Bad Anode Maker
97  //
98  StSvtBadAnodesMaker *svtBadAnodesMaker = new StSvtBadAnodesMaker("svtBadAnode");
99  svtBadAnodesMaker->setOutputFile(fileOut);
100  svtBadAnodesMaker->setThresholdOccup(120);
101  svtBadAnodesMaker->setFrequencyOccup(0.9);
102  svtBadAnodesMaker->setBadMeanPedMin(5);
103  svtBadAnodesMaker->setBadMeanPedMax(254);
104  svtBadAnodesMaker->setBadMeanRMSMin(0);
105  svtBadAnodesMaker->setBadMeanRMSMax(4);
106  svtBadAnodesMaker->SetDebug();
107 
108  //
109  // Initialize chain
110  //
111  IOMk->Init();
112  svtDaqMaker->Init();
113  svtDaqMaker->SetSvtPed();
114  svtDaqMaker->SetSvtRMSPed();
115  svtBadAnodesMaker->Init();
116 
117  //
118  // Event loop
119  //
120  int istat=0,i=1;
121  EventLoop: if (i <= nevents && istat!=2 && istat!=3) {
122 
123  // cout << endl << "============================ Event " << i
124  // << " start ============================" << endl;
125 
126  chain->Clear();
127  IOMk->Make();
128  svtDaqMaker->Make();
129  svtDaqMaker->GetSvtPed();
130  svtDaqMaker->GetSvtRMSPed();
131  svtBadAnodesMaker->Make();
132 
133  if (istat==2)
134  {cout << "Last event processed. Status = " << istat << endl;}
135  if (istat==3)
136  {cout << "Error event processed. Status = " << istat << endl;}
137 
138  i++;
139  goto EventLoop;
140  }
141 
142  chain->Finish();
143 
144  i--;
145  cout << endl << "============================ Event " << i
146  << " finish ============================" << endl;
147 
148 }
149 
150 //--------------------------------------------------------------------------
151 
152 void doSvtBadAnodes(const Int_t nevents, const Char_t *path, const Char_t *file,
153  const Char_t *fileOut)
154 {
155  if (nevents==-1) { Help(); return;}
156 
157  const char *fileListQQ[]={0,0};
158  if (strncmp(path,"GC",2)==0) {
159  fileListQQ=0;
160  } else if (path[0]=='-') {
161  fileListQQ[0]=file;
162  } else if (!file[0]) {
163  fileListQQ[0]=path;
164  } else {
165  fileListQQ[0] = gSystem->ConcatFileName(path,file);
166  }
167 
168  doSvtBadAnodes(nevents,fileListQQ,fileOut);
169 }
170 
171 
Definition: StTree.h:125
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
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()
virtual Int_t Make()
Definition: StIOMaker.cxx:183