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 #include <Stiostream.h>
00048
00049 #include "StDaqLib/GENERIC/EventReader.hh"
00050 #include "TPCV2P0.hh"
00051
00052
00053
00054
00055
00056
00057 using namespace OLDEVP;
00058
00059 TPCV2P0_CPP_SR::TPCV2P0_CPP_SR(int s, TPCV2P0_Reader *det)
00060 {
00061
00062 sector = s-1;
00063 detector = det;
00064
00065
00066 memset((char *)banks, 0, sizeof(banks));
00067 }
00068
00069 int TPCV2P0_CPP_SR::initialize()
00070 {
00071
00072
00073 padkr = detector->getPADKReader(sector);
00074 if (!padkr) return FALSE;
00075
00076
00077
00078 for(int rcb = 0; rcb < 6; rcb++)
00079 {
00080 for(int mz = 0; mz < 3; mz++)
00081 {
00082 banks[rcb][mz] = detector->getBankTPCCPPR(sector,rcb,mz);
00083 classname(Bank_TPCCPPR) *cpp = banks[rcb][mz];
00084 if (cpp)
00085 if (detector->ercpy->verbose)
00086 printf("ASIC params sec%d RB%d MZ %d:\
00087 \nLow threshold: >%d ADC counts in >%d consecutive bins\
00088 \nHigh threshold: >%d ADC counts in >%d of these bins\n",
00089 sector+1, rcb+1, mz+1,
00090 cpp->asic_params.thresh_lo,
00091 cpp->asic_params.n_seq_lo,
00092 cpp->asic_params.thresh_hi,
00093 cpp->asic_params.n_seq_hi);
00094 }
00095 }
00096 return TRUE;
00097 }
00098
00099 int TPCV2P0_CPP_SR::getAsicParams(ASIC_params *params)
00100 {
00101 for(int rcb = 0; rcb < 6; rcb++) {
00102 for(int mz = 0; mz < 3; mz++) {
00103 classname(Bank_TPCCPPR) *cpp = banks[rcb][mz];
00104 if (cpp) {
00105 *params = cpp->asic_params;
00106 return TRUE;
00107 }
00108 }
00109 }
00110 return FALSE;
00111 }
00112
00113 TPCV2P0_CPP_SR::~TPCV2P0_CPP_SR()
00114 {
00115
00116 }
00117
00118 int TPCV2P0_CPP_SR::getClusters(int PadRow, int Pad,
00119 int *nClusters, struct ASIC_Cluster **clusters)
00120 {
00121
00122 int i, mz, rb;
00123 PADK_entry ent;
00124
00125
00126 if (PadRow==0 || PadRow>TPC_PADROWS) {
00127 if (detector->ercpy->verbose)
00128 printf(" %s %d padrow not a legal value: %d\n", __FILE__,__LINE__,PadRow);
00129 return -1;
00130 }
00131 padkr->get(PadRow, Pad, &ent);
00132 if(((mz=ent.mz) == 0) || ((rb=ent.rb) == 0)) {
00133 if (detector->ercpy->verbose)
00134 printf(" %s %d mz: %d rb: %d\n", __FILE__,__LINE__,rb,mz);
00135 if (detector->ercpy->verbose)
00136 printf(" PadRow %d, Pad %d\n", PadRow, Pad);
00137 return -1;
00138 }
00139 if (!(void *)banks[rb-1][mz-1]) {
00140 if (detector->ercpy->verbose)
00141 printf(" %s %d no CPP bank for rb: %d mz: %d\n", __FILE__,__LINE__,rb,mz);
00142 if (detector->ercpy->verbose) printf(" PadRow %d, Pad %d\n", PadRow, Pad);
00143 return -1;
00144
00145 }
00146
00147 clusters[Pad-1] = (ASIC_Cluster *)(banks[rb-1][mz-1]->entry + 32*ent.offset);
00148 for (i=0; i<31; i++) {
00149 if (clusters[Pad-1][i].start_time_bin < 0) break;
00150 }
00151
00152 *nClusters = i;
00153 return 0;
00154 }
00155
00156
00157 int TPCV2P0_CPP_SR::MemUsed()
00158 {
00159 return 0;
00160 }
00161
00162
00163