/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #include "RPCTool.h" 00002 00003 #include "FecReadoutFormat/FecReadout.h" 00004 #include "FecReadoutFormat/FecData.h" 00005 #include "RtmReadoutFormat/RtmReadout.h" 00006 #include "RtmReadoutFormat/RtmData.h" 00007 00008 #include "EventReadoutFormat/EventHeader.h" 00009 #include "EventReadoutFormat/EventTraits.h" 00010 #include "EventReadoutFormat/EventReadout.h" 00011 #include "EventReadoutFormat/RomFragment.h" 00012 #include "EventReadoutFormat/RomHeader.h" 00013 #include "DaqReadoutFormat/RomData.h" 00014 00015 #include "Event/ReadoutHeader.h" 00016 #include "Event/Readout.h" 00017 #include "Event/DaqCrate.h" 00018 00019 #include "StatisticsSvc/IStatisticsSvc.h" 00020 #include "GaudiKernel/IHistogramSvc.h" 00021 #include "GaudiKernel/ITHistSvc.h" 00022 #include "TH1D.h" 00023 00024 using DayaBay::ReadoutHeader; 00025 using DayaBay::Readout; 00026 using DayaBay::DaqCrate; 00027 using namespace DybDaq; 00028 00029 00030 RPCTool::RPCTool(const std::string& type, const std::string& name, const IInterface* parent) 00031 : GaudiTool(type, name, parent) 00032 { 00033 declareInterface< IRPCTool >(this); 00034 } 00035 00036 RPCTool::~RPCTool() 00037 { 00038 } 00039 00040 StatusCode RPCTool::initialize() 00041 { 00042 info() << " @ initialize()" << endreq; 00043 return StatusCode::SUCCESS; 00044 } 00045 00046 StatusCode RPCTool::finalize() 00047 { 00048 info() << " @ finalize()" << endreq; 00049 00050 return StatusCode::SUCCESS; 00051 } 00052 std::vector<int> RPCTool::ReturnModule(unsigned int triggerrot, unsigned int rpcCFId) 00053 { 00054 int row,col; 00055 std::vector<int> module; 00056 for(int i=0;i<32;i++) 00057 { 00058 if(i>=0&&i<=14){ 00059 if((triggerrot>>i)&&1==1) 00060 { 00061 col = i/5+1+3*(rpcCFId+1); 00062 row = 9-i%5; 00063 module.push_back(row*10+col); 00064 //if(row>1&&row<9) 00065 // if(col>1&&col<6) ReadoutModule.push_back(); 00066 } 00067 } 00068 else if(i>=16&&i<=27) 00069 if((triggerrot>>i)&&1==1) 00070 { 00071 col = i/5+1+3*(rpcCFId+1); 00072 row = 4-(i-16)%4; 00073 module.push_back(row*10+col); 00074 } 00075 00076 } 00077 00078 return module; 00079 } 00080 std::vector<int> RPCTool::AjacentModule(int row, int col) 00081 { 00082 std::vector<int> module; 00083 if(row > 1 && row < 6) 00084 { 00085 if(col > 1 && col < 9) 00086 { 00087 module.push_back((row + 1) * 10 + col); 00088 module.push_back(row * 10 + col - 1); 00089 module.push_back(row * 10 + col + 1); 00090 module.push_back((row - 1) * 10 + col); 00091 } 00092 else if(col == 1) 00093 { 00094 module.push_back((row + 1)* 10 + col); 00095 module.push_back(row * 10 + col + 1); 00096 module.push_back((row - 1) * 10 + col); 00097 } 00098 else if(col == 9){ 00099 module.push_back((row + 1) * 10 + col); 00100 module.push_back(row * 10 + col - 1); 00101 module.push_back((row - 1) * 10 + col); 00102 } 00103 } 00104 else if(row == 1){ 00105 module.push_back((row + 1) * 10 + col); 00106 if(col != 1) 00107 module.push_back(row * 10 + col- 1); 00108 if(col != 9) 00109 module.push_back(row*10 + col + 1); 00110 if(col == 5) module.push_back(5); 00111 } 00112 else if(row == 6) 00113 { 00114 module.push_back((row - 1) * 10 + col); 00115 if(col != 1) 00116 module.push_back(row * 10 + col - 1); 00117 if(col != 9) 00118 module.push_back(row * 10 + col + 1); 00119 if(col == 5) module.push_back(75); 00120 } 00121 return module; 00122 } 00123 00124 00125 int RPCTool::rowCol(int cfId, int fecId) 00126 { 00127 int rpcRow,rpcCol; 00128 int cfRow = cfId / 2; 00129 if(cfId%2 == 0) //left 00130 { 00131 rpcRow = 6 - (fecId / 5 + cfRow * 3); 00132 rpcCol = fecId%5 + 1; 00133 } 00134 else //right 00135 { 00136 if(fecId == 14) 00137 { 00138 if(cfId == 3) 00139 { 00140 rpcRow = 0; 00141 rpcCol = 5; 00142 } 00143 else if(cfId == 1) 00144 { 00145 //rpcRow = ArrayRow + 1; 00146 rpcRow = 7; 00147 rpcCol = 5; 00148 } 00149 } 00150 else 00151 { 00152 rpcRow = 6 - (fecId / 4 +cfRow * 3);// the index starts from 1 00153 rpcCol = fecId%4 + 6;// the index starts from 1 00154 } 00155 } 00156 00157 debug() << "(cfId,fecId,rpcRow,rpcCol)=" << cfId << "," << fecId << "," << rpcRow << "," << rpcCol << endreq; 00158 00159 return (rpcRow<<4) | rpcCol; 00160 }