00001 /* Class MdcCosWire describes the sense wire property */ 00002 /* Created by Wu Linghui, 2006/05/26 */ 00003 00004 #ifndef MDCCOSWIRE_H 00005 #define MDCCOSWIRE_H 00006 00007 #include <cstdio> 00008 #include <cstring> 00009 00010 #include "MdcCosLayer.h" 00011 00012 class MdcCosWire{ 00013 public: 00014 /* /\* constructor *\/ */ 00015 /* MdcCosWire(); */ 00016 00017 /* /\* destructor *\/ */ 00018 /* ~MdcCosWire(); */ 00019 00020 /* get wire index, 0 ~ 6796 */ 00021 int getWireId() const { return m_iWire; } 00022 00023 /* get layer index, 0 ~ 42 */ 00024 int getLayerId() const { return m_iLay; } 00025 00026 /* get cell index in the layer */ 00027 int getCellId() const { return m_iCell; } 00028 00029 /* get pre-amplifier index */ 00030 int getPreAmpId() const { return m_iAmp; } 00031 00032 int getChannel() const { return m_ch; } 00033 int getFanId() const { return m_iFan; } 00034 int getEndId() const { return m_iEnd; } 00035 00036 /* get wire label, e.g. "1S01-1" */ 00037 const char* getWireLabel() const { return m_label; } 00038 00039 /* get wire tag, "layerid_cellid_wireid_preampid" */ 00040 /* layer, cell, wire begin from 0, preamp begins from 1 */ 00041 const char* getWireTag() const { return m_tag; } 00042 00043 /* get coordinate of the wire of each endplate */ 00044 /* 0-2: xf, yf, zf; 3-5: xb, yb, zb */ 00045 void getWirePos(double wpos[]) const; 00046 00047 /* get coordinate of the center of the wire */ 00048 void getWireCenPos(double wcenpos[]) const; 00049 00050 /* get coordinate of the wire at the forward(east, z>0) endplate, [mm] */ 00051 double getXf() const { return m_wpos[0]; } 00052 double getYf() const { return m_wpos[1]; } 00053 double getZf() const { return m_wpos[2]; } 00054 00055 /* get coordinate of the wire at the backward(west, z<0) endplate, [mm] */ 00056 double getXb() const { return m_wpos[3]; } 00057 double getYb() const { return m_wpos[4]; } 00058 double getZb() const { return m_wpos[5]; } 00059 00060 /* get phi of the wire at the forward endpoint */ 00061 double getPhiForward() const { return m_phif; } 00062 00063 double getPhi(double z) const; 00064 00065 /* get tension of the wire, [g] */ 00066 double getTension() const { return m_ten; } 00067 00068 /* get sag of the wire, [mm] */ 00069 double getSag() const { return m_sag; } 00070 00071 /* get pointer to the layer which the wire belongs to */ 00072 const MdcCosLayer* getLayerPtr() const { return m_play; } 00073 00074 /* get wire type, 0 for axial, 1 for stereo-, 2 for stereo+ */ 00075 int getWireType() const { return m_play -> getLayerType(); } 00076 00077 /* get radius at the endplate */ 00078 double getRad() const { return m_play -> getLayerRad(); } 00079 00080 /* get length of the wire in z direction, [mm] */ 00081 double getLength() const { return m_play -> getLength(); } 00082 00083 /* get number of twist cells */ 00084 double getTwistCell() const { return m_play -> getTwistCell(); } 00085 00086 /* get slant angle */ 00087 double getSlant() const { return m_play -> getSlant(); } 00088 00089 /* get flag of inner chamber, true for inner, false for outer */ 00090 bool isInner() const { return m_play -> isInner(); } 00091 00092 /* print function */ 00093 void print(FILE* fout = stdout) const; 00094 00095 00096 /* set wire properties */ 00097 void setWireId(int iWire) { m_iWire = iWire; } 00098 void setLayerId(int iLay) { m_iLay = iLay; } 00099 void setCellId(int iCell) { m_iCell = iCell; } 00100 void setPreAmpId(int iPreamp) { m_iAmp = iPreamp; } 00101 00102 void setChannel(int ch) { m_ch = ch; } 00103 void setFanId(int iFan) { m_iFan = iFan; } 00104 void setEndId(int iEnd) { m_iEnd = iEnd; } 00105 00106 void setWireLabel(char* label) { strcpy(m_label, label); } 00107 void setWireTag(char* tag) { strcpy(m_tag, tag); } 00108 00109 /* set coordinate of the wire of each endplate */ 00110 /* 0-2: xf, yf, zf; 3-5: xb, yb, zb */ 00111 void setWirePos(double wpos[]); 00112 00113 /* set coordinate of the wire at the forward(east, z>0) endplate, [mm] */ 00114 void setXf(double xf) { m_wpos[0] = xf; } 00115 void setYf(double yf) { m_wpos[1] = yf; } 00116 void setZf(double zf) { m_wpos[2] = zf; } 00117 00118 /* set coordinate of the wire at the backward(west, z<0) endplate, [mm] */ 00119 void setXb(double xb) { m_wpos[3] = xb; } 00120 void setYb(double yb) { m_wpos[4] = yb; } 00121 void setZb(double zb) { m_wpos[5] = zb; } 00122 00123 /* set layer radius and phi of the forward endpoint */ 00124 void setPhiForward(double phi) { m_phif = phi; } 00125 00126 void setTension(double tension) { m_ten = tension; } 00127 void setSag(double sag) { m_sag = sag; } 00128 00129 /* set pointer to the layer which the wire belongs */ 00130 void setLayerPtr(MdcCosLayer* layerptr) { m_play = layerptr; } 00131 00132 private: 00133 /* wire id of the wire, 0 ~ 6796 */ 00134 int m_iWire; 00135 00136 /* layer id of the wire, 0 ~ 42 */ 00137 int m_iLay; 00138 00139 /* cell id of the wire in the layer */ 00140 int m_iCell; 00141 00142 /* index of pre-amplifier, beginning from 1 */ 00143 int m_iAmp; 00144 00145 int m_ch; 00146 int m_iFan; 00147 int m_iEnd; /* 1 for east, 0 for west */ 00148 00149 /* label of the wire, e.g. "1S01-1" */ 00150 char m_label[100]; 00151 00152 /* tag of the wire, "layid_cellid_wireid_ampid" */ 00153 /* layid, cellid, wireid begin from 0; ampid begins from 1 */ 00154 char m_tag[100]; 00155 00156 /* coordinate of the wire at each endplate, [mm] */ 00157 /* 0-2: xf, yf, zf; 3-5: xb, yb, zb */ 00158 double m_wpos[6]; 00159 00160 /* phi of the wire at the forward endpoint */ 00161 double m_phif; 00162 00163 /* tension of the wire, [g] */ 00164 double m_ten; 00165 00166 /* sag of the wire, [mm] */ 00167 double m_sag; 00168 00169 /* pointer to the layer which the wire belongs */ 00170 const MdcCosLayer* m_play; 00171 00172 }; 00173 00174 inline void MdcCosWire::getWirePos(double wpos[]) const { 00175 for(int i=0; i<6; i++){ 00176 wpos[i] = m_wpos[i]; 00177 } 00178 } 00179 00180 inline void MdcCosWire::getWireCenPos(double wcenpos[]) const{ 00181 wcenpos[0] = 0.5 * (m_wpos[0] + m_wpos[3]); 00182 wcenpos[1] = 0.5 * (m_wpos[1] + m_wpos[4]); 00183 wcenpos[2] = 0.5 * (m_wpos[2] + m_wpos[5]); 00184 } 00185 00186 #endif /* MDCCOSWIRE_H */