00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00050 #ifndef STSSDWAFER_HH
00051 #define STSSDWAFER_HH
00052 #include "tables/St_ssdWafersPosition_Table.h"
00053 #include "tables/St_ssdConfiguration_Table.h"
00054 #include "tables/St_ssdDimensions_Table.h"
00055 #include "tables/St_sdm_condition_db_Table.h"
00056 #include "StSsdStripList.hh"
00057 #include "StSsdStrip.hh"
00058 #include "StSpaNoise.hh"
00059 #include "StSpaListNoise.hh"
00060 #include "StSsdUtil/StSsdClusterList.hh"
00061 #include "StSsdUtil/StSsdCluster.hh"
00062 #include "StSsdUtil/StSsdPackageList.hh"
00063 #include "StSsdUtil/StSsdPackage.hh"
00064 #include "StSsdUtil/StSsdPointList.hh"
00065 #include "StSsdUtil/StSsdPoint.hh"
00066 #include "StSsdUtil/StSsdClusterControl.h"
00067 #include "StSsdDynamicControl.h"
00068 #include "TGeoMatrix.h"
00069 class St_ssdGainCalib;
00070
00071 class StSsdWafer: public TGeoHMatrix {
00072 public:
00073
00074 StSsdWafer(Int_t id);
00075 ~StSsdWafer();
00076 StSsdWafer(const StSsdWafer & originalWafer);
00077 StSsdWafer& operator=(const StSsdWafer originalWafer);
00078
00079 void init(Int_t rId, Double_t *rD, Double_t *rT, Double_t *rN, Double_t *rX);
00080
00081 void setID(Int_t i){mId = i;}
00082 void setDriftDirection(Double_t x1, Double_t x2, Double_t x3)
00083 {Double_t *r = GetRotationMatrix(); r[0] = x1; r[3] = x2; r[6] = x3;}
00084 void setTransverseDirection(Double_t x1, Double_t x2, Double_t x3)
00085 {Double_t *r = GetRotationMatrix(); r[1] = x1; r[4] = x2; r[7] = x3;}
00086 void setNormalDirection(Double_t x1, Double_t x2, Double_t x3)
00087 {Double_t *r = GetRotationMatrix(); r[2] = x1; r[5] = x2; r[8] = x3;}
00088 void setCenterPosition(Double_t x1, Double_t x2, Double_t x3) {Double_t *t = GetTranslation(); t[0] = x1; t[1] = x2; t[2] = x3;}
00089 StSsdClusterList* getClusterP() { return mClusterP; }
00090 StSsdClusterList* getClusterN() { return mClusterN; }
00091 StSsdPointList* getDeadHits(Float_t ActiveLargeEdge, Float_t ActiveSmallEdge,Float_t Test);
00092 StSsdPointList* getNonActivePointBorder(Float_t ActiveLargeEdge, Float_t ActiveSmallEdge);
00093 StSsdPointList* getNonActivePointTriangle(Float_t Test);
00094 StSsdStripList* getStripP() { return mStripP; }
00095 StSsdStripList* getStripN() { return mStripN; }
00096 StSsdPackageList* getPackage() { return mPackage; }
00097 StSsdPointList* getPoint() { return mPoint; }
00098 Int_t getIdWafer() { return mId; }
00099 Int_t getId() {return getIdWafer();}
00100 Double_t d(Int_t i){Double_t *r = GetRotationMatrix(); return r[3*i]; }
00101 Double_t t(Int_t i){Double_t *r = GetRotationMatrix(); return r[3*i+1];}
00102 Double_t n(Int_t i){Double_t *r = GetRotationMatrix(); return r[3*i+2];}
00103 Double_t x(Int_t i){Double_t *t = GetTranslation(); return t[i]; }
00104
00105 void addCluster(StSsdCluster *ptr, Int_t iSide);
00106 void addHit(Int_t rNId , Int_t rMcHit, Int_t rMcTrack, Float_t *rXg , Float_t rDe, Float_t *p);
00107 void addNoiseToStripSignal(StSpaNoise *ptr, Int_t iSide);
00108 void addNoiseToStripSignal(long nElectronInAMip,long adcDynamic);
00109 void addPackage(StSsdPackage *ptr);
00110 void addPoint(StSsdPoint *ptr);
00111 void addStrip(StSsdStrip *ptr, Int_t iSide);
00112
00113 Int_t geoMatched(ssdDimensions_st *dimensions, StSsdCluster *ptr1, StSsdCluster *ptr2);
00114 Double_t matchDistr(StSsdClusterControl *clusterControl, Double_t x);
00115 static Double_t myErf(Double_t x);
00116 void setIsActive(Int_t rIsActive, Int_t iSide, Int_t rNStrip);
00117 Int_t setMatcheds(ssdDimensions_st *dimensions, StSsdPoint *Point, StSsdCluster *pMatched, StSsdCluster *nMatched);
00118 void setPedestalSigmaStrip(Int_t iStrip, Int_t iSide, Int_t iPedestal, Int_t iSigma, StSsdDynamicControl *dynamicControl);
00119
00120 void Reset();
00121 void sortCluster();
00122 void sortNoise();
00123 void sortPoint();
00124 void sortStrip();
00125
00126 void doClusterisation(Int_t *numberOfCluster, StSsdClusterControl *clusterControl);
00127 Int_t doClusterSplitting(StSsdClusterControl *clusterControl, Int_t iSide);
00128 Int_t doFindCluster(StSsdClusterControl *clusterControl, Int_t iSide);
00129 Int_t doFindPackage(ssdDimensions_st *dimensions, StSsdClusterControl *clusterControl);
00130 Int_t doSolvePackage(ssdDimensions_st *dimensions, StSsdClusterControl *clusterControl,Float_t CalibArray);
00131 Int_t doSolvePerfect(ssdDimensions_st *dimensions, StSsdClusterControl *clusterControl,Float_t CalibArray);
00132 void doStatPerfect(Int_t nPerfectPoint, StSsdClusterControl *clusterControl);
00133 void doLorentzShift(ssdDimensions_st *dimensions,Float_t mShift_hole,Float_t mShift_elec);
00134 Int_t doLorentzShiftSide(Int_t side,Float_t shift,ssdDimensions_st *dimensions);
00135 void convertAnalogToDigit(Double_t pairCreationEnergy);
00136 void convertAnalogToDigit(Long_t nElectronInAMip,Long_t adcDynamic,Long_t nbitEncoding, Float_t daqCutValue);
00137 Int_t convertDigitToAnalog(Double_t pairCreationEnergy);
00138 Int_t convertUFrameToLocal(ssdDimensions_st *dimensions);
00139 Int_t convertLocalToGlobal();
00140 Int_t convertGlobalToLocal();
00141 Int_t convertLocalToUFrame(Float_t ActiveLargeEdge, Float_t ActiveSmallEdge, Float_t Theta);
00142 void convertHitToStrip(Float_t Pitch,
00143 Int_t nStripPerSide,
00144 Int_t nstripInACluster,
00145 Double_t parDiffP,
00146 Double_t parDiffN,
00147 Double_t parIndRightP,
00148 Double_t parIndRightN,
00149 Double_t parIndLeftP,
00150 Double_t parIndLeftN,
00151 Float_t mShift_hole,
00152 Float_t mShift_elec
00153 );
00154 void convertToStrip(Float_t Pitch,
00155 Int_t nStripPerSide,
00156 Double_t pairCreationEnergy,
00157 Int_t nstripInACluster,
00158 Double_t parDiffP,
00159 Double_t parDiffN,
00160 Double_t parIndRightP,
00161 Double_t parIndRightN,
00162 Double_t parIndLeftP,
00163 Double_t parIndLeftN,
00164 Float_t mShift_hole,
00165 Float_t mShift_elec
00166 );
00167 void debugStrips();
00168 void debugClusters();
00169 Float_t* findAngle(Float_t *p, Float_t *alpha);
00170 void pedestalSubstraction();
00171 Int_t printborder();
00172 void updateStripList();
00173 void zeroSubstraction();
00174 void UndoLorentzShift(StSsdPoint *ptr, Int_t iSide,Float_t mShift_hole,Float_t mShift_elec,Float_t pitch);
00175 void doCleanListStrip(StSsdStripList *myListStrip);
00176 void SetDebug(Int_t k = 0) {mDebug = k;}
00177 Int_t Debug() {return mDebug;}
00178
00179 private:
00180 Char_t first[1];
00181 Int_t mId;
00182 Float_t mPerfectMean;
00183 Float_t mPerfectSigma;
00184
00185
00186
00187 StSsdStripList *mStripP;
00188 StSsdStripList *mStripN;
00189 StSpaListNoise *mNoiseP;
00190 StSpaListNoise *mNoiseN;
00191 StSsdClusterList *mClusterP;
00192 StSsdClusterList *mClusterN;
00193 StSsdPackageList *mPackage;
00194 StSsdPointList *mPoint;
00195 Int_t mDebug;
00196 Char_t last[1];
00197 StSsdStripList *cleanListStrip;
00198 StSsdStripList *myStripList;
00199
00200 };
00201 #endif