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 #include <Stiostream.h>
00044
00045 #include "StDaqLib/GENERIC/EventReader.hh"
00046 #include "TPCV1P0.hh"
00047
00048
00049 using namespace OLDEVP;
00050
00051 TPCV1P0_CPP_SR::TPCV1P0_CPP_SR(int s, TPCV1P0_Reader *det)
00052 {
00053
00054 sector = s-1;
00055 detector = det;
00056
00057
00058 memset((char *)banks, 0, sizeof(banks));
00059 }
00060
00061 int TPCV1P0_CPP_SR::initialize()
00062 {
00063
00064
00065 padkr = detector->getPADKReader(sector);
00066 if (!padkr) return FALSE;
00067
00068
00069
00070 for(int rcb = 0; rcb < 6; rcb++)
00071 {
00072 for(int mz = 0; mz < 3; mz++)
00073 {
00074 banks[rcb][mz] = detector->getBankTPCCPPR(sector,rcb,mz);
00075 }
00076 }
00077 return TRUE;
00078 }
00079
00080 TPCV1P0_CPP_SR::~TPCV1P0_CPP_SR()
00081 {
00082
00083 }
00084
00085 int TPCV1P0_CPP_SR::getClusters(int PadRow, int Pad,
00086 int *nClusters, struct ASIC_Cluster **clusters)
00087 {
00088
00089 int i, mz, rb;
00090 PADK_entry ent;
00091
00092
00093 if (PadRow==0 || PadRow>TPC_PADROWS) {
00094 printf(" %s %d padrow not a legal value: %d\n", __FILE__,__LINE__,PadRow);
00095 return -1;
00096 }
00097 padkr->get(PadRow, Pad, &ent);
00098 if(((mz=ent.mz) == 0) || ((rb=ent.rb) == 0)) {
00099 printf(" %s %d mz: %d rb: %d\n", __FILE__,__LINE__,rb,mz);
00100 printf(" PadRow %d, Pad %d\n", PadRow, Pad);
00101 return -1;
00102 }
00103 if (!(void *)banks[rb-1][mz-1]) {
00104 printf(" %s %d no CPP bank for rb: %d mz: %d\n", __FILE__,__LINE__,rb,mz);
00105 printf(" PadRow %d, Pad %d\n", PadRow, Pad);
00106 return -1;
00107
00108 }
00109
00110 clusters[Pad-1] = (ASIC_Cluster *)(banks[rb-1][mz-1]->entry + 32*ent.offset);
00111 for (i=0; i<31; i++) {
00112 if (clusters[Pad-1][i].start_time_bin < 0) break;
00113 }
00114
00115 *nClusters = i;
00116 return 0;
00117 }
00118
00119
00120 int TPCV1P0_CPP_SR::MemUsed()
00121 {
00122 return 0;
00123 }
00124
00125
00126