98 #include "StThreeVectorD.hh"
99 #include "StLorentzVectorD.hh"
100 #include "tables/St_fcsDetectorPosition_Table.h"
101 #include "tables/St_fcsEcalGain_Table.h"
102 #include "tables/St_fcsHcalGain_Table.h"
103 #include "tables/St_fcsPresGain_Table.h"
104 #include "tables/St_fcsEcalGainCorr_Table.h"
105 #include "tables/St_fcsHcalGainCorr_Table.h"
106 #include "tables/St_fcsPresValley_Table.h"
107 #include "tables/St_fcsEcalGainOnline_Table.h"
108 #include "tables/St_fcsHcalGainOnline_Table.h"
109 #include "tables/St_fcsPresThreshold_Table.h"
110 #include "tables/St_vertexSeed_Table.h"
111 #include "tables/St_g2t_track_Table.h"
112 #include "tables/St_g2t_vertex_Table.h"
121 StFcsDb(
const char *name=
"fcsDb");
124 int InitRun(
int runNumber);
126 void setDebug(
int v=1) {mDebug=v;}
127 void setDbAccess(
int v=1);
128 void setRun(
int run);
129 void setRun19(
int v=1);
130 void setLeakyHcal(
int v=1);
134 void setFcsDetectorPosition(fcsDetectorPosition_st* t);
135 void setFcsEcalGain(fcsEcalGain_st*);
136 void setFcsHcalGain(fcsHcalGain_st*);
137 void setFcsPresGain(fcsPresGain_st*);
138 void setFcsEcalGainCorr(fcsEcalGainCorr_st*);
139 void setFcsHcalGainCorr(fcsHcalGainCorr_st*);
140 void setFcsPresValley(fcsPresValley_st*);
141 void setFcsEcalGainOnline(fcsEcalGainOnline_st*);
142 void setFcsHcalGainOnline(fcsHcalGainOnline_st*);
143 void setFcsPresThreshold(fcsPresThreshold_st*);
146 int maxDetectorId()
const;
147 int detectorId(
int eh,
int ns)
const;
148 int ecalHcalPres(
int det)
const;
149 int northSouth(
int det)
const;
150 int nRow(
int det)
const;
151 int nColumn(
int det)
const;
152 int maxId(
int det)
const;
153 int getRowNumber(
int det,
int id)
const;
154 int getColumnNumber(
int det,
int id)
const ;
155 int getId(
int det,
int row,
int col)
const ;
156 int getDepCh(
int dep,
int ch)
const ;
157 void getName(
int det,
int id,
char name[]);
158 void getName(
int ehp,
int ns,
int dep,
int ch,
char name[]);
159 static void getFromName(
const char name[],
int& det,
int&
id);
160 static int getDetFromName(
const std::string& detname);
161 static unsigned short getKey(
unsigned short detid,
unsigned short id);
162 static void getDetIdFromKey(
unsigned short key,
unsigned short& detid,
unsigned short&
id);
163 static unsigned short getDetFromKey(
unsigned short key);
164 static unsigned short getIdFromKey(
unsigned short key);
174 StThreeVectorD getDetectorOffset(
int det,
double zdepth=-1)
const;
176 float getDetectorAngle(
int det)
const;
177 float getXWidth(
int det)
const;
178 float getYWidth(
int det)
const;
180 float getZDepth(
int det)
const;
181 float getShowerMaxZ(
int det)
const;
184 void getLocalXYinCell(
StFcsHit*
hit,
float &x,
float &y)
const;
185 void getLocalXYinCell(
int det,
int id,
float &x,
float &y)
const;
186 void getLocalXYinCell(
int det,
int col,
int row,
float &x,
float &y)
const;
189 StThreeVectorD getStarXYZ(
int det,
float FcsX,
float FcsY,
float FcsZ=-1.0,
float zVertex=0.0)
const;
191 float getPhi(
int det,
float FcsX,
float FcsY,
float FcsZ=-1.0)
const;
193 float getEta(
int det,
float FcsX,
float FcsY,
float FcsZ=-1.0,
float zVertex=0.0)
const;
196 StThreeVectorD getStarXYZfromColumnRow(
int det,
float col,
float row,
float FcsZ=-1.0)
const;
197 StThreeVectorD getStarXYZ(
int det,
int col,
int row,
float FcsZ=-1.0)
const;
200 StThreeVectorD getStarXYZ(
int det,
int id,
float FcsZ=-1.0)
const;
210 double getHcalProjectedToEcalX(
int ns,
double hcalLocalX,
double zvtx=0.0);
211 double getHcalProjectedToEcalY(
int ns,
double hcalLocalY,
double zvtx=0.0);
216 int getZeroSuppression(
int det)
const;
217 float getSamplingFraction(
int det)
const;
218 float getGain(
int det,
int id)
const;
220 float getGain8(
int det,
int id)
const;
222 float getGainCorrection(
int det,
int id)
const;
224 float getPresValley(
int det,
int id)
const;
226 float getGainOnline(
int det,
int id)
const;
228 float getPresThreshold(
int det,
int id)
const;
235 mGainMode=GAINMODE::FORCED;
236 mForceUniformGainEcal=ecal;
237 mForceUniformGainHcal=hcal;
238 mForceUniformGainPres=pres;
241 mGainCorrMode=GAINMODE::FORCED;
242 mForceUniformGainCorrectionEcal=ecal;
243 mForceUniformGainCorrectionHcal=hcal;
244 mForceUniformGainCorrectionPres=pres;
247 mGainCorrMode=GAINMODE::FORCED;
248 mForceUniformGainOnlineEcal=ecal;
249 mForceUniformGainOnlineHcal=hcal;
250 mForceUniformGainOnlinePres=pres;
254 void setReadGainFromText(
const char* file=
"fcsgain.txt") {strcpy(mGainFilename,file); mGainMode=GAINMODE::TXT;}
255 void setReadGainCorrFromText(
const char* file=
"fcsgaincorr.txt") {strcpy(mGainCorrFilename,file); mGainCorrMode=GAINMODE::TXT;}
258 float getEtGain(
int det,
int id,
float factor=1.0)
const;
262 void getDepfromId(
int detectorId,
int id,
int &ehp,
int &ns,
int &crt,
int &slt,
int &dep,
int &ch)
const;
263 void getIdfromDep(
int ehp,
int ns,
int dep,
int ch,
int &detectorId,
int &
id,
int &crt,
int &slt)
const;
264 int getNDep(
int ehp,
int ns)
const;
265 void getSCmap(
int det,
int id,
266 int &ehp,
int &ns,
int &scdep,
int &branch,
int &fee_i2c,
int &sipm,
267 int &pp,
int &jacket)
const;
268 void getIdfromSCmap(
int ehp,
int ns,
int scdep,
int branch,
int fee_i2c,
int sipm,
269 int &det,
int &
id)
const;
273 int jacketColor(
int ehp,
int ns,
int dep,
int ch);
276 void printHeader(FILE* f,
int flag,
int csv);
277 void printHeader2(FILE* f);
278 void printHeader3(FILE* f);
279 void printHeader4(FILE* f,
int flag);
282 void getIdfromEPD(
int pp,
int tt,
int &det,
int &
id);
283 void getEPDfromId(
int det,
int id,
int &pp,
int &tt);
286 float pedestal(
int ehp,
int ns,
int dep,
int ch);
287 void setPedestal(
int ehp,
int ns,
int dep,
int ch,
float ped);
288 void readPedFromText(
const char* file=
"fcsped.txt");
291 unsigned int backTraceG2tTrack(
unsigned int id, g2t_track_st* g2ttrk);
298 const g2t_track_st* getParentG2tTrack(
StFcsHit* h, g2t_track_st* g2ttrk,
float& fraction,
int& ntrk,
unsigned int order=0);
299 const g2t_track_st* getParentG2tTrack(
StFcsCluster* c, g2t_track_st* g2ttrk,
float& fraction,
int& ntrk,
unsigned int order=0);
300 const g2t_track_st* getPrimaryG2tTrack(
StFcsHit* h, g2t_track_st* g2ttrk,
float& fraction,
int& ntrk,
unsigned int order=0);
301 const g2t_track_st* getPrimaryG2tTrack(
StFcsCluster* c, g2t_track_st* g2ttrk,
float& fraction,
int& ntrk,
unsigned int order=0);
303 StThreeVectorD projectTrackToEcal(
const g2t_track_st* g2ttrk,
const g2t_vertex_st* g2tvert=0)
const;
304 StThreeVectorD projectTrackToHcal(
const g2t_track_st* g2ttrk,
const g2t_vertex_st* g2tvert=0)
const;
305 StThreeVectorD projectTrackToEcalSMax(
const g2t_track_st* g2ttrk,
const g2t_vertex_st* g2tvert=0)
const;
306 StThreeVectorD projectTrackToHcalSMax(
const g2t_track_st* g2ttrk,
const g2t_vertex_st* g2tvert=0)
const;
307 StThreeVectorD projectTrack(
int det,
const g2t_track_st* g2ttrk,
const g2t_vertex_st* g2tvert,
double showermaxz=-1)
const;
320 StThreeVectorD projectLine(
int det,
double* linedirection,
double* lineorigin,
double showermaxz=-1)
const;
330 GAINMODE mGainMode = GAINMODE::DB;
331 float mForceUniformGainEcal=-1.0;
332 float mForceUniformGainHcal=-1.0;
333 float mForceUniformGainPres=-1.0;
334 char mGainFilename[256];
335 void readGainFromText();
337 GAINMODE mGainCorrMode = GAINMODE::DB;
338 float mForceUniformGainCorrectionEcal=-1.0;
339 float mForceUniformGainCorrectionHcal=-1.0;
340 float mForceUniformGainCorrectionPres=-1.0;
341 char mGainCorrFilename[256];
342 void readGainCorrFromText();
344 GAINMODE mGainOnlineMode = GAINMODE::DB;
345 float mForceUniformGainOnlineEcal=-1.0;
346 float mForceUniformGainOnlineHcal=-1.0;
347 float mForceUniformGainOnlinePres=-1.0;
350 float mPed[kFcsEHP][kFcsNorthSouth][kFcsMaxDepBd][kFcsMaxDepCh];
351 float mGain[kFcsEHP][kFcsNorthSouth][kFcsMaxDepBd][kFcsMaxDepCh];
352 float mGainCorr[kFcsEHP][kFcsNorthSouth][kFcsMaxDepBd][kFcsMaxDepCh];
353 float mGainOnline[kFcsEHP][kFcsNorthSouth][kFcsMaxDepBd][kFcsMaxDepCh];
364 fcsDetectorPosition_st mFcsDetectorPosition;
365 fcsEcalGain_st mFcsEcalGain;
366 fcsHcalGain_st mFcsHcalGain;
367 fcsPresGain_st mFcsPresGain;
368 fcsEcalGainCorr_st mFcsEcalGainCorr;
369 fcsHcalGainCorr_st mFcsHcalGainCorr;
370 fcsPresValley_st mFcsPresValley;
371 fcsEcalGainOnline_st mFcsEcalGainOnline;
372 fcsHcalGainOnline_st mFcsHcalGainOnline;
373 fcsPresThreshold_st mFcsPresThreshold;
377 const g2t_track_st* getG2tTrack(
StFcsCluster* c, g2t_track_st* g2ttrk,
float& fraction,
int& ntrk,
unsigned int order=0,
int mode=0);
379 virtual const Char_t *GetCVS()
const {
static const Char_t cvs[]=
"Tag " __DATE__
" " __TIME__ ;
return cvs;}
void forceUniformGainOnline(float ecal, float hcal=1.0, float pres=0.5)
void forceFixGainCorrection()
fixed default gain
void setReadGainFromText(const char *file="fcsgain.txt")
reading gain from text files
void forceUniformGain(float ecal, float hcal=0.0053, float pres=0.01)
fixed default gaincorr
void setEtGainMode(int v=0)
set leaky Hcal
void forceUniformGainCorrection(float ecal, float hcal=1.0, float pres=0.5)
GAINMODE
get the pres valley position for cut
void forceFixGain()
Gain mode switch.