StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtAlignmentMaker.h
1 
10 /* -------------------------------------------------------------------------
11  * $Log: StFgtAlignmentMaker.h,v $
12  * Revision 1.7 2014/08/06 11:43:10 jeromel
13  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
14  *
15  * Revision 1.6 2014/03/05 17:58:01 akio
16  * New version
17  *
18  * Revision 1.5 2013/06/04 23:19:33 akio
19  * *** empty log message ***
20  *
21  * Revision 1.4 2013/04/23 16:47:22 akio
22  * Added TPC prompt hit support
23  *
24  * Revision 1.3 2013/04/04 17:08:30 akio
25  * make steps settable from macro
26  *
27  * Revision 1.2 2013/02/07 00:39:33 akio
28  * Adding run# for naming output files
29  *
30  * Revision 1.1 2013/02/05 21:08:01 akio
31  * *** empty log message ***
32  *
33  * -------------------------------------------------------------------------
34  */
35 
36 //setStep define alignment procedure by with different parameter space search in sequence
37 //
38 // setStep(discmask,quadmask,parmask,hitmask,residmask,trackType,minHit,minFgtHit,minVtx,minTpcHit,minPromptHit,minEemcHit)
39 // 3 masks to specify which parameters are free(1) or fixed(0)
40 // discmask = 3f(all),3e(fix d1) (note: discmask=3f & hitmask=3f causes unstable result)
41 // quadmask = 1(A),2(B),4(C),8(D)
42 // parmask = 3f(all),38(xyz),19(xy,phi),39(xyz&phi),1f(xy&3angles) : see StDb/idl/fgtAlignment.idl
43 //
44 // hitmask to specify wihch hits to be used for each track fit
45 // residmask to specify wihch hits to be used for FGT alignment (residuals added over tracks)
46 // bit0-5=fgt d1-6, bit6=vtx, bit7=tpc, bit8=TPCpromptHit, bit9=EEMCall, bit10=EemcMip, bit11=EEmcElectron
47 // hitmask/residmask = fff(FGT+VTX+TPC+PROMPT+EEMC+MIP+ELE),ff(FGT+VTX+TPC),c0(TPC+VTX, no FGT),
48 // 3f(FGT only), 7f(FGT+VTX), e7f(FGT+VTX+EEMC+MIP+ELE)
49 // f7f(FGT+VTX+Prompt+EEMC+MIP+ELE)
50 //
51 // Specify track type to be used for refit
52 // trackType= 0(straight line), 1(Helix)
53 //
54 // 1st step should have 3 masks all 0 for making "before" histos
55 // "after" histos will use last step's paramters except 3 masks are set to 0
56 
57 #ifndef StFgtAlignmentMaker_hh
58 #define StFgtAlignmentMaker_hh
59 
60 #include "StMaker.h"
61 #include "TString.h"
62 #include "StEnumerations.h"
63 
64 class TMinuit;
65 
66 struct fgtAlignment_st;
67 
68 class StFgtAlignmentMaker : public StMaker {
69 public:
70 
71  StFgtAlignmentMaker(const Char_t *name="fgtalg"); // constructor
72  ~StFgtAlignmentMaker() {} // destructor
73 
74  Int_t Init(); // called once for initilization
75  Int_t InitRun(Int_t runnum); // called once per run
76  Int_t Make(); // invoked for every event
77  Int_t Finish(); // called once at the end
78 
79  inline void setDataSource(Int_t v) {mDataSource=v;}
80  // 0=StEvent(Primary) [default] : didn't work
81  // 1=StEvent(Global) : didn't work
82  // 2=AVTrack : internal alignment
83  // 3=TTree(alignment.root) : read output from this maker
84  // 4=Fake : create fake data
85  // 5=AVTrack and StEvent(vertex, tpc & eemc hits) : FGT+vetex+TPC+EEMC tracking
86  // 6=AVTrack and MuDST (vertex, eemc hits) : FGT+vetex+EEMC tracking (no TPC hits in MUDST)
87 
88  inline void setWriteTree(int v=1) {mOutTreeFile=v;}
89  inline void setReadTree(const char* v="alignment.root") {mInTreeFile=v;}
90 
91  //Set resolution for each detector to normalize residuals (also used for fake data gaussian sigma)
92  inline void setError(Float_t fgt, Float_t vtx, Float_t vtxz, Float_t tpci, Float_t tpco, Float_t tpcz, Float_t ppt, Float_t emc) {
93  mErrFgt=fgt; mErrVtx=vtx; mErrVtxZ=vtxz;mErrTpcI=tpci; mErrTpcO=tpco; mErrTpcZ=tpcz; mErrPpt=ppt; mErrEmc=emc;
94  }
95  //Fake track kinematics
96  inline void setFakeKine(Int_t n, Float_t emin, Float_t emax, Float_t etamin, Float_t etamax, Float_t phimin, Float_t phimax, Float_t vsig){
97  mFakeNtrk=n; mFakeEmin=emin; mFakeEmax=emax; mFakeEtamin=etamin; mFakeEtamax=etamax; mFakePhimin=phimin; mFakePhimax=phimax; mFakeVtxSig=vsig;
98  }
99  inline void setRunNumber(Int_t v, Int_t s=0, Int_t d=0) {mRunNumber=v; mSeqNumber=s; mDay=d;}
100  inline void setReadParFile(const char* v="alignment.dat") {mReadParFile=v;}
101 
102  void setStep(int discmask,int quadmask, int parmask, int hitmask_disc, int residmask,
103  int trackType, int minHit, int minFgtHit, int minVtx, int minTpcHit, int minPromptHit, int minEemcHit,
104  float dzcut=0, float dcacut=0, float fgtrcut=0, float fgtpcut=0, float tpcrcut=0, float tpcpcut=0, float emcrcut=0, float emcpcut=0);
105 
106  virtual const char *GetCVS() const {
107  static const char cvs[]="Tag $Name: $ $Id: StFgtAlignmentMaker.h,v 1.7 2014/08/06 11:43:10 jeromel Exp $ built " __DATE__ " " __TIME__ ;
108  return cvs;
109  };
110 
111 protected:
112  void fakeData();
113  void readFromStEvent();
114  void readFromStEventGlobal();
115  void readFromStraightTrackMaker();
116  void readFromStraightTrackAndStEvent();
117  void readFromStraightTrackAndMudst();
118 
119  void calcETBalanceFromStEvent();
120  void fillETBalance(int itrk);
121 
122  void writeTree();
123  void readFromTree();
124 
125  void DispFromStraightTrackMaker();
126  void overWriteError();
127 
128  void setPar(TMinuit* m, fgtAlignment_st* algpar,int discmask,int quadmask, int parmask);
129  void getPar(TMinuit* m, fgtAlignment_st* algpar);
130  void setHitMask(int hitmask_disc);
131 
132  void doAlignment(fgtAlignment_st* input,
133  int discmask,int quadmask, int parmask, int hitmask_disc, int residmask,
134  int trackType, int minHit, int minFgtHit, int minVtx, int minTpcHit, int minPromptHit, int minEemcHit,
135  fgtAlignment_st* result);
136 
137  void readPar(fgtAlignment_st* algpar);
138  void writePar(fgtAlignment_st* algpar);
139 
140  void bookHist();
141  void resetHist();
142  void saveHist();
143 
144 private:
145  Int_t mEventCounter;
146  Float_t mErrFgt,mErrVtx,mErrVtxZ,mErrTpcI,mErrTpcO,mErrTpcZ,mErrPpt,mErrEmc; //hit errors
147  Int_t mFakeNtrk;
148  Float_t mFakeEmin, mFakeEmax, mFakeEtamin, mFakeEtamax, mFakePhimin, mFakePhimax, mFakeVtxSig; //fake track kinematics
149  Int_t mDataSource;
150  Int_t mOutTreeFile;
151  const Char_t* mInTreeFile;
152  const Char_t* mReadParFile;
153  Int_t mRunNumber;
154  Int_t mSeqNumber;
155  Int_t mDay;
156 
157  static const int mMaxStep=100;
158  int mNStep;
159  int mDiscMask[mMaxStep];
160  int mQuadMask[mMaxStep];
161  int mParMask[mMaxStep];
162  int mHitMask[mMaxStep];
163  int mResidMask[mMaxStep];
164  int mTrackType[mMaxStep];
165  int mMinHit[mMaxStep];
166  int mMinFgtHit[mMaxStep];
167  int mMinVtx[mMaxStep];
168  int mMinTpcHit[mMaxStep];
169  int mMinPromptHit[mMaxStep];
170  int mMinEemcHit[mMaxStep];
171  float mDzCut[mMaxStep];
172  float mDcaCut[mMaxStep];
173  float mFgtRCut[mMaxStep];
174  float mFgtPCut[mMaxStep];
175  float mTpcRCut[mMaxStep];
176  float mTpcPCut[mMaxStep];
177  float mEmcRCut[mMaxStep];
178  float mEmcPCut[mMaxStep];
179 
180  ClassDef(StFgtAlignmentMaker,0)
181 };
182 #endif
A typical Analysis Class.