StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFcsTriggerSimMaker.h
1 // \class StFcsEventDisplay
2 // \author Akio Ogawa
3 //
4 // This is FCS trigger simulation.
5 //
6 
7 #ifndef STAR_StFcsTriggerSimMaker_HH
8 #define STAR_StFcsTriggerSimMaker_HH
9 
10 #include "StMaker.h"
11 #include <stdint.h>
12 
13 class StFcsDb;
14 class StFcsCollection;
15 class StMuFcsCollection;
16 class TFile;
17 class fcs_trg_base;
18 class link_t;
19 class geom_t;
20 class TTree;
21 class TH1F;
22 class StFcsHit;
23 class StMuFcsHit;
24 
26 public:
27  StFcsTriggerSimMaker(const char* name="FcsTrgSim");
29  int Init();
30  int InitRun(int runNumber);
31  int Make();
32  int Finish();
33 
34  void setTrigger(int v) {mTrgSelect=v;};
35  void setDebug(int v) {mDebug=v;};
36  void setWriteEventText(char* filename) {mFilename=filename;};
37  void setWriteQaTree(char* filename) {mQaTreeFilename=filename;};
38  void setWriteQaHist(char* filename) {mQaHistFilename=filename;};
39  void setReadPresMask(char* filename) {mPresMask=filename;};
40  void setSimMode(int v, int tb=50) {mSimMode=v; mTrgTimebin=tb;}
41  void setTrgTimeBin(int v) {mTrgTimebin=v;} //8 timebin = v-3 to v+4. v=52 for 49~56
42  void setThresholdFile(char* file) {mThresholdFile=file;}
43  void setTrgIdFile(char* file) {mTrgIdFile=file;}
44  void setThresholdDb(int run) {mThresholdDb=run;}
45  void setOverwriteGain(int v) {mOverwriteGain=v;} // 0=use text Et andelectronics gain file 1=from FscDb(default)
46 
47  //factor= 1(ET Match), 0(E Match), 0.5(halfway)
48  void setEtGain(float v) {mEtFactor=v;}
49 
50  fcs_trg_base* getTriggerEmu() {return mTrgSim;}
51 
52  const char* getTriggerName(int i){return mTrgIdName[i].Data();}
53 
54  template<typename T> void feedADC(T* hit, int ns, int ehp, uint16_t data_array[]);
55 
56  //this is for just running stage2 from macro
57  void runStage2(link_t ecal[], link_t hcal[], link_t pres[], geom_t &geo, link_t output[], unsigned short& dsm,
58  int dta[], int dsmout, int sim[], int simdsmout, int iev);
59 
60 
61 private:
62  StFcsDb* mFcsDb=0;
63  StFcsCollection* mFcsColl=0;
64  StMuFcsCollection* mMuFcsColl = 0;
65 
66  int mTrgSelect=0;
67  int mDebug=0;
68  char* mFilename=0;
69  FILE* mFile=0;
70 
71  int mSimMode=0;
72  int mTrgTimebin=50;
73 
74  fcs_trg_base* mTrgSim;
75 
76  char* mPresMask=0;
77  char* mQaTreeFilename=0;
78  char* mQaHistFilename=0;
79  TFile* mQaTreeFile=0;
80  TFile* mQaHistFile=0;
81  TTree* mTree=0;
82  TH1F* mTrgRate=0;
83  int mFlt=0;
84  int mTcu=0;
85  int mTrg=0;
86  float mEtFactor=1.0;
87  char* mThresholdFile=0;
88  int mThresholdDb=0;
89  int mOverwriteGain=1;
90  char* mTrgIdFile=0;
91 
92  void print4B4();
93  void printJP();
94  void readThresholdFile();
95  void readThresholdDb();
96 
97  TString mTrgIdName[64];
98  void readTrgId();
99 
100  virtual const char *GetCVS() const
101  {static const char cvs[]="Tag $Name: $ $Id: StFcsTriggerSimMaker.h,v 1.2 2021/05/30 21:40:56 akio Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
102 
103  ClassDef(StFcsTriggerSimMaker,0);
104 };
105 
106 #endif