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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 #include "StTriggerData.h"
00075
00076 static const char rcsid[] = "$Id: StTriggerData.cxx,v 2.20 2012/04/30 15:19:11 ullrich Exp $";
00077
00078 ClassImp(StTriggerData)
00079
00080 StTriggerData::StTriggerData() : mYear(0), mZdcVertexZ(-999), mRun(0), mErrorFlag(0)
00081 {
00082 mDebug = 0;
00083 }
00084
00085 StTriggerData::~StTriggerData() { }
00086
00087 void StTriggerData::setDebug(unsigned int val) { mDebug=val; }
00088
00089 int StTriggerData::prepostAddress(int prepost) const
00090 {
00091 if (prepost == 0) return 0;
00092 int npre = numberOfPreXing();
00093 if (prepost < 0 && -prepost <= npre) return 1+npre+prepost;
00094 int npost = numberOfPostXing();
00095 if (prepost > 0 && prepost <= npost) return npre+prepost;
00096 gMessMgr->Warning() << "Wrong prepost " << prepost << " (pre=" << numberOfPreXing() << ", post=" << numberOfPostXing() << ")" << endm;
00097 return -1;
00098 }
00099
00100 unsigned short StTriggerData::decodeEmc12bit(const int dsm, const int channel, const unsigned char *raw) const
00101 {
00102 static const int dsmmap[16]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
00103 const unsigned char *crate_p=raw+dsm*16;
00104
00105 if (channel%2) {
00106
00107 int k=(channel-1)/2*3+1;
00108 return (crate_p[dsmmap[k+1]]<<4) + (crate_p[dsmmap[k]]>>4);
00109 }
00110 else {
00111
00112 int k=channel/2*3;
00113 return ((crate_p[dsmmap[k+1]]&0xF) << 8) + crate_p[dsmmap[k]];
00114 }
00115 }
00116
00117 void StTriggerData::decodeQT(unsigned int ndata, unsigned int* data, unsigned short adc[16][32], unsigned char tdc[16][32])
00118 {
00119 if (ndata==0) return;
00120 if (ndata>MaxQTData) { printf("QT data length %d is too long (max is %d)\n",ndata,MaxQTData); return;}
00121 if (data[ndata-1] != 0xac10) { printf("Wrong QT data last word %x (should be 0xAC10)\n",data[ndata-1]); return;}
00122 int header=1;
00123 unsigned int crate,addr,ch,nline,oldch;
00124 for (unsigned int i=0; i<ndata-1; i++){
00125 unsigned int d = data[i];
00126 if (header==1){
00127 crate = (d & 0xff000000) >> 24;
00128 addr = ((d & 0x00ff0000) >> 16) - 0x10;
00129 nline = (d & 0x000000ff);
00130 oldch = 0;
00131 if(nline>0) header=0;
00132
00133 }
00134 else {
00135 ch = (d & 0xf8000000) >> 27;
00136 adc[addr][ch] = (unsigned short) (d & 0x00000fff);
00137 tdc[addr][ch] = (unsigned char) ((d & 0x0001f000) >> 12);
00138
00139
00140
00141 oldch=ch;
00142 nline--;
00143 if (nline==0) header=1;
00144 }
00145 }
00146 }
00147
00148
00149
00150
00151
00152
00153 int StTriggerData::year() const {return mYear;}
00154 unsigned int StTriggerData::errorFlag() const {return mErrorFlag;}
00155 unsigned int StTriggerData::eventNumber() const {return 0;}
00156 float StTriggerData::zdcVertexZ() const {return mZdcVertexZ;}
00157 void StTriggerData::setZdcVertexZ(float val) {mZdcVertexZ = val;}
00158 unsigned short StTriggerData::dsmInput() const {return 0;}
00159 unsigned short StTriggerData::trgToken() const {return 0;}
00160 unsigned short StTriggerData::dsmAddress() const {return 0;}
00161 unsigned short StTriggerData::mAddBits() const {return 0;}
00162 unsigned short StTriggerData::bcData(int address) const {return 0;}
00163 unsigned short StTriggerData::busyStatus() const {return 0;}
00164 unsigned int StTriggerData::bunchCounterHigh() const {return 0;}
00165 unsigned int StTriggerData::bunchCounterLow() const {return 0;}
00166 unsigned int StTriggerData::bunchId48Bit() const {return 0;}
00167 unsigned int StTriggerData::bunchId7Bit() const {return 0;}
00168 unsigned int StTriggerData::spinBit() const {return 0;}
00169 unsigned int StTriggerData::spinBitYellowFilled() const {return 0;}
00170 unsigned int StTriggerData::spinBitYellowUp() const {return 0;}
00171 unsigned int StTriggerData::spinBitYellowDown() const {return 0;}
00172 unsigned int StTriggerData::spinBitYellowUnpol() const {return 0;}
00173 unsigned int StTriggerData::spinBitBlueFilled() const {return 0;}
00174 unsigned int StTriggerData::spinBitBlueUp() const {return 0;}
00175 unsigned int StTriggerData::spinBitBlueDown() const {return 0;}
00176 unsigned int StTriggerData::spinBitBlueUnpol() const {return 0;}
00177 unsigned short StTriggerData::lastDSM(int channel) const {return 0;};
00178 unsigned short StTriggerData::vertexDSM(int channel) const {return 0;}
00179 unsigned short StTriggerData::ctbLayer1DSM(int channel) const {return 0;}
00180 unsigned short StTriggerData::ctbLayer2DSM(int channel) const {return 0;}
00181 unsigned short StTriggerData::bemcLayer1DSM(int channel, int prepost) const {return 0;}
00182 unsigned short StTriggerData::eemcLayer1DSM(int channel, int prepost) const {return 0;}
00183 unsigned short StTriggerData::emcLayer2DSM(int channel) const {return 0;}
00184 unsigned short StTriggerData::tpcMaskDSM(int channel) const {return 0;}
00185 unsigned short StTriggerData::fpdLayer1DSMRaw(StBeamDirection eastwest, int channel, int prepost) const {return 0;}
00186 unsigned short StTriggerData::fpdLayer1DSM(StBeamDirection eastwest, int module, int board, int prepost) const {return 0;}
00187 unsigned short StTriggerData::fpdLayer2DSMRaw(int channel) const {return 0;}
00188 unsigned short StTriggerData::fpdLayer2DSM(StBeamDirection eastwest, int module) const {return 0;}
00189 unsigned short StTriggerData::ctbRaw(int address, int prepost) const {return 0;}
00190 unsigned short StTriggerData::ctb(int pmt, int prepost) const {return 0;}
00191 unsigned short StTriggerData::ctbTraySlat(int tray, int slat, int prepost) const {return 0;}
00192 unsigned short StTriggerData::ctbSum(int prepost) const {return 0;}
00193 unsigned short StTriggerData::mwc(int sector, int prepost) const {return 0;}
00194 bool StTriggerData::zdcPresent(int prepost) const {return 1;}
00195 unsigned short StTriggerData::zdcAtChannel(int channel, int prepost) const {return 0;}
00196 unsigned short StTriggerData::zdcAtAddress(int address, int prepost) const {return 0;}
00197 unsigned short StTriggerData::zdcUnAttenuated(StBeamDirection eastwest, int prepost) const {return 0;}
00198 unsigned short StTriggerData::zdcAttenuated(StBeamDirection eastwest, int prepost) const {return 0;}
00199 unsigned short StTriggerData::zdcADC(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00200 unsigned short StTriggerData::zdcTDC(StBeamDirection eastwest, int prepost) const {return 0;}
00201 unsigned short StTriggerData::zdcPmtTDC(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00202 unsigned short StTriggerData::zdcHardwareSum(int prepost) const {return 0;}
00203 unsigned short StTriggerData::zdcEarliestTDC(StBeamDirection eastwest, int prepost) const {return 0;}
00204 bool StTriggerData::zdcSumADCaboveThreshold(StBeamDirection eastwest, int prepost) const {return 0;}
00205 bool StTriggerData::zdcFrontADCaboveThreshold(StBeamDirection eastwest, int prepost) const {return 0;}
00206 bool StTriggerData::zdcBackADCaboveThreshold(StBeamDirection eastwest, int prepost) const {return 0;}
00207 bool StTriggerData::zdcSumADCaboveThresholdL2(StBeamDirection eastwest) const {return 0;}
00208 bool StTriggerData::zdcFrontADCaboveThresholdL2(StBeamDirection eastwest) const {return 0;}
00209 bool StTriggerData::zdcBackADCaboveThresholdL2(StBeamDirection eastwest) const {return 0;}
00210 unsigned short StTriggerData::zdcTimeDifference() const {return 0;}
00211 bool StTriggerData::zdcSumADCaboveThresholdL3(StBeamDirection eastwest) const {return 0;}
00212 bool StTriggerData::zdcFrontADCaboveThresholdL3(StBeamDirection eastwest) const {return 0;}
00213 bool StTriggerData::zdcBackADCaboveThresholdL3(StBeamDirection eastwest) const {return 0;}
00214 bool StTriggerData::zdcTimeDifferenceInWindow() const {return 0;}
00215 bool StTriggerData::zdcSMDPresent(int prepost) const {return 1;}
00216 unsigned short StTriggerData::zdcTruncatedSum(StBeamDirection eastwest, int prepost) const {return 0;}
00217 unsigned short StTriggerData::zdcSMDHighestStrip(StBeamDirection eastwest, int verthori, int prepost) const {return 0;}
00218 unsigned short StTriggerData::zdcSMD(StBeamDirection eastwest, int verthori, int strip, int prepost) const {return 0;}
00219 unsigned char StTriggerData::bemcHighTower(int patch_id, int prepost) const {return 0;}
00220 unsigned char StTriggerData::bemcJetPatch (int patch_id, int prepost) const {return 0;}
00221 unsigned char StTriggerData::eemcHighTower(int patch_id, int prepost) const {return 0;}
00222 unsigned char StTriggerData::eemcJetPatch (int patch_id, int prepost) const {return 0;}
00223 unsigned char StTriggerData::bemcHighestTowerADC(int prepost) const {return 0;}
00224 unsigned char StTriggerData::eemcHighestTowerADC(int prepost) const {return 0;}
00225 unsigned short StTriggerData::bbcADC(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00226 unsigned short StTriggerData::bbcTDC(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00227 unsigned short StTriggerData::bbcADCSum(StBeamDirection eastwest, int prepost) const {return 0;}
00228 unsigned short StTriggerData::bbcADCSumLargeTile(StBeamDirection eastwest, int prepost) const {return 0;}
00229 unsigned short StTriggerData::bbcEarliestTDC(StBeamDirection eastwest, int prepost) const {return 0;}
00230 unsigned short StTriggerData::bbcTimeDifference() const {return 0;}
00231 unsigned short StTriggerData::bbcEarliestTDCLarge(StBeamDirection eastwest, int prepost) const {return 0;}
00232 unsigned short StTriggerData::bbcTimeDifferenceLarge() const {return 0;}
00233 unsigned short StTriggerData::fpd(StBeamDirection eastwest, int module, int pmt, int prepost) const {return 0;}
00234 unsigned short StTriggerData::fpdSum(StBeamDirection eastwest, int module) const {return 0;}
00235 unsigned short StTriggerData::nQTdata(int prepost) const {return 0;}
00236 unsigned int* StTriggerData::QTdata(int prepost) const {return 0;}
00237 unsigned short StTriggerData::vpdADC(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00238 unsigned short StTriggerData::vpdTDC(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00239 unsigned short StTriggerData::vpdADCHighThr(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00240 unsigned short StTriggerData::vpdTDCHighThr(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00241 unsigned short StTriggerData::vpdEarliestTDC(StBeamDirection eastwest, int prepost) const {return 0;}
00242 unsigned short StTriggerData::vpdEarliestTDCHighThr(StBeamDirection eastwest, int prepost) const {return 0;}
00243 unsigned short StTriggerData::vpdTimeDifference() const {return 0;}
00244 unsigned short StTriggerData::mtdAtAddress(int address, int prepost) const {return 0;}
00245 unsigned short StTriggerData::mtdgemAtAddress(int address, int prepost) const {return 0;}
00246 unsigned short StTriggerData::mtdAdc(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00247 unsigned short StTriggerData::mtdTdc(StBeamDirection eastwest, int pmt, int prepost) const {return 0;}
00248 unsigned char StTriggerData::mtdDsmAtCh(int ch, int prepost) const {return 0;}
00249 bool StTriggerData::mtdDsmHit(int pmt, int prepost) const {return 0;}
00250 unsigned short StTriggerData::mtdVpdTacDiff() const {return 0;}
00251 unsigned short StTriggerData::tofAtAddress(int address, int prepost) const {return 0;}
00252 unsigned short StTriggerData::tofTrayMultiplicity(int tray, int prepost) const {return 0;}
00253 unsigned short StTriggerData::tofMultiplicity(int prepost) const {return 0;}
00254 unsigned short StTriggerData::pp2ppADC(StBeamDirection eastwest, int vh, int udio, int ch, int prepost) const {return 0;}
00255 unsigned short StTriggerData::pp2ppTAC(StBeamDirection eastwest, int vh, int udio, int ch, int prepost) const {return 0;}
00256 unsigned long StTriggerData::pp2ppDSM(int prepost) const {return 0;}
00257 unsigned short StTriggerData::fmsADC(int crt, int adr, int ch, int prepost) const {return 0;}
00258 unsigned short StTriggerData::fmsTDC(int crt, int adr, int ch, int prepost) const {return 0;}
00259 unsigned char* StTriggerData::getDsm_FMS(int prepost) const {return 0;}
00260 unsigned char* StTriggerData::getDsm01_FMS(int prepost) const {return 0;}
00261 unsigned char* StTriggerData::getDsm02_FMS(int prepost) const {return 0;}
00262 unsigned short* StTriggerData::getDsm1_FMS(int prepost) const {return 0;}
00263 unsigned short* StTriggerData::getDsm2_FMS() const {return 0;}
00264 int StTriggerData::L2ResultsOffset(StL2AlgorithmId id) const {return -1;}
00265 bool StTriggerData::isL2Triggered(StL2TriggerResultType id) const {return false;}
00266 unsigned long long StTriggerData::l2sum() const {return 0;}
00267 void StTriggerData::killFMS() {return;}