#include <MdcTSF.h>
Public Member Functions | |
MdcTSF () | |
~MdcTSF () | |
void | setMdcDigi (std::vector< int > &vmdcHit) |
void | CountTS () |
void | GetTS () |
void | ReadLut () |
void | Dump () |
int | GetSL1TSF (int i) |
int | GetSL2TSF (int i) |
int | GetSL3TSF (int i) |
int | GetSL4TSF (int i) |
int | GetSL5TSF (int i) |
int | GetSL10TSF (int i) |
Static Public Member Functions | |
static MdcTSF * | get_Mdc (void) |
Private Attributes | |
std::vector< int > | digiId |
std::vector< std::vector< int > > | SL1 |
std::vector< std::vector< int > > | SL2 |
std::vector< std::vector< int > > | SL3 |
std::vector< std::vector< int > > | SL4 |
std::vector< std::vector< int > > | SL5 |
std::vector< std::vector< int > > | SL10 |
int | SL1PivotCellHit [48] |
int | SL2PivotCellHit [80] |
int | SL3PivotCellHit [88] |
int | SL4PivotCellHit [112] |
int | SL5PivotCellHit [128] |
int | SL10PivotCellHit [128] |
int | SL1HitCount [48][8] |
int | SL2HitCount [80][12] |
int | SL3HitCount [88][16] |
int | SL4HitCount [112][22] |
int | SL5HitCount [128][31] |
int | SL10HitCount [128][81] |
int | SL1TSF [48] |
int | SL2TSF [80] |
int | SL3TSF [88] |
int | SL4TSF [112] |
int | SL5TSF [128] |
int | SL10TSF [128] |
Static Private Attributes | |
static MdcTSF * | mdc_Pointer = 0 |
Definition at line 6 of file MdcTSF.h.
MdcTSF::MdcTSF | ( | ) |
Definition at line 33 of file MdcTSF.cxx.
References ReadLut().
Referenced by get_Mdc().
00034 { 00035 ReadLut(); 00036 //Dump(); 00037 }
MdcTSF::~MdcTSF | ( | ) |
void MdcTSF::CountTS | ( | ) |
Definition at line 80 of file MdcTSF.cxx.
References digiId, genRecEmupikp::i, iter(), ganga-rec::j, SL1, SL10, SL10HitCount, SL10PivotCellHit, SL10TSF, SL1HitCount, SL1PivotCellHit, SL1TSF, SL2, SL2HitCount, SL2PivotCellHit, SL2TSF, SL3, SL3HitCount, SL3PivotCellHit, SL3TSF, SL4, SL4HitCount, SL4PivotCellHit, SL4TSF, SL5, SL5HitCount, SL5PivotCellHit, and SL5TSF.
Referenced by GetTS().
00081 { 00082 //============================reset each array====================================== 00083 // super layer one 00084 for(int i=0;i<48;i++) 00085 { 00086 SL1PivotCellHit[i] = 0; 00087 SL1TSF[i] = 0; 00088 for(int j=0;j<8;j++) 00089 { 00090 SL1HitCount[i][j] = 0; 00091 } 00092 } 00093 // super layer two 00094 for(int i=0;i<80;i++) 00095 { 00096 SL2PivotCellHit[i] = 0; 00097 SL2TSF[i] = 0; 00098 for(int j=0;j<12;j++) 00099 { 00100 SL2HitCount[i][j] = 0; 00101 } 00102 } 00103 // super layer three 00104 for(int i=0;i<88;i++) 00105 { 00106 SL3PivotCellHit[i] = 0; 00107 SL3TSF[i] = 0; 00108 for(int j=0;j<16;j++) 00109 { 00110 SL3HitCount[i][j] = 0; 00111 } 00112 } 00113 // super layer four 00114 for(int i=0;i<112;i++) 00115 { 00116 SL4PivotCellHit[i] = 0; 00117 SL4TSF[i] = 0; 00118 for(int j=0;j<22;j++) 00119 { 00120 SL4HitCount[i][j] = 0; 00121 } 00122 } 00123 // super layer five 00124 for(int i=0;i<128;i++) 00125 { 00126 SL5PivotCellHit[i] = 0; 00127 SL5TSF[i] = 0; 00128 for(int j=0;j<31;j++) 00129 { 00130 SL5HitCount[i][j] = 0; 00131 } 00132 } 00133 // super layer ten 00134 for(int i=0;i<128;i++) 00135 { 00136 SL10PivotCellHit[i] = 0; 00137 SL10TSF[i] = 0; 00138 for(int j=0;j<81;j++) 00139 { 00140 SL10HitCount[i][j] = 0; 00141 } 00142 } 00143 //=================================== end reset value =================================== 00144 00145 //============ counting the hit number in each super layer for each combination ======== 00146 int layer,cell,superlayer,ln; 00147 00148 for(std::vector<int>::iterator iter=digiId.begin();iter!=digiId.end();iter+=2) 00149 { 00150 layer = *iter; 00151 cell = *(iter+1); 00152 if(layer<=19) 00153 { 00154 superlayer = (int) layer/4+1; 00155 ln = layer%4; 00156 if(superlayer == 1) 00157 { 00158 if(ln==2) SL1PivotCellHit[cell] = 1; 00159 for(unsigned int i = 0;i < SL1.size(); i++) 00160 { 00161 for(unsigned int j = 0; j < SL1[i].size()/4; j++) { 00162 if(SL1[i][3-ln+j*4] == cell+1) SL1HitCount[i][j] += 1; 00163 } 00164 } 00165 } //end super layer1 00166 00167 if(superlayer == 2) 00168 { 00169 if(ln==2) SL2PivotCellHit[cell] = 1; 00170 for(unsigned int i = 0;i < SL2.size(); i++) 00171 { 00172 for(unsigned int j = 0; j < SL2[i].size()/4; j++) { 00173 if(SL2[i][3-ln+j*4] == cell+1) SL2HitCount[i][j] += 1; 00174 } 00175 } 00176 } //end super layer2 00177 00178 if(superlayer==3) 00179 { 00180 if(ln==2) SL3PivotCellHit[cell] = 1; 00181 for(unsigned int i = 0;i < SL3.size(); i++) 00182 { 00183 for(unsigned int j = 0; j < SL3[i].size()/4; j++) { 00184 if(SL3[i][3-ln+j*4] == cell+1) SL3HitCount[i][j] += 1; 00185 } 00186 } 00187 } //end super layer3 00188 00189 if(superlayer==4) 00190 { 00191 if(ln==2) SL4PivotCellHit[cell] = 1; 00192 for(unsigned int i = 0;i < SL4.size(); i++) 00193 { 00194 for(unsigned int j = 0; j < SL4[i].size()/4; j++) { 00195 if(SL4[i][3-ln+j*4] == cell+1) SL4HitCount[i][j] += 1; 00196 } 00197 } 00198 } //end super layer4 00199 00200 if(superlayer==5) 00201 { 00202 if(ln==1) SL5PivotCellHit[cell] = 1; 00203 for(unsigned int i = 0;i < SL5.size(); i++) 00204 { 00205 for(unsigned int j = 0; j < SL5[i].size()/4; j++) { 00206 if(SL5[i][3-ln+j*4] == cell+1) SL5HitCount[i][j] += 1; 00207 } 00208 } 00209 } //end super layer5 00210 } 00211 else 00212 { 00213 superlayer = (int) layer/4+1; 00214 ln = layer%4; 00215 if(ln==1) SL10PivotCellHit[cell] = 1; 00216 for(unsigned int i = 0;i < SL10.size(); i++) 00217 { 00218 for(unsigned int j = 0; j < SL10[i].size()/4; j++) { 00219 if(SL10[i][3-ln+j*4] == cell+1) SL10HitCount[i][j] += 1; 00220 } 00221 } 00222 } //end super layer10 00223 } 00224 }
void MdcTSF::Dump | ( | ) |
Definition at line 368 of file MdcTSF.cxx.
References genRecEmupikp::i, ganga-rec::j, delete_small_size::size, SL1, SL10, SL2, SL3, SL4, and SL5.
00369 { 00370 std::vector<int> combine_size; 00371 cout<<endl; 00372 cout<<" ***************check data file tsf: ***************** "<<endl; 00373 cout<<"*--------------------------BEGIN-------------------------------*"<<endl; 00374 cout<<endl; 00375 00376 cout<<" -------------------SL1---------------------- "<<endl; 00377 combine_size.clear(); 00378 for(unsigned int i=0; i<SL1.size(); i++) { 00379 cout<<"Cell ID --> "<<i<<endl; 00380 combine_size.push_back(SL1[i].size()); 00381 for(unsigned int j=0; j<SL1[i].size(); j++) { 00382 cout<<SL1[i][j]<<" "; 00383 if((j+1)%4==0) cout<<endl; 00384 } 00385 cout<<endl; 00386 } 00387 sort(combine_size.begin(),combine_size.end()); 00388 cout<<"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl; 00389 cout<<endl; 00390 00391 cout<<" -------------------SL2---------------------- "<<endl; 00392 combine_size.clear(); 00393 for(unsigned int i=0; i<SL2.size(); i++) { 00394 cout<<"Cell ID --> "<<i<<endl; 00395 combine_size.push_back(SL2[i].size()); 00396 for(unsigned int j=0; j<SL2[i].size(); j++) { 00397 cout<<SL2[i][j]<<" "; 00398 if((j+1)%4==0) cout<<endl; 00399 } 00400 cout<<endl; 00401 } 00402 sort(combine_size.begin(),combine_size.end()); 00403 cout<<"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl; 00404 cout<<endl; 00405 00406 cout<<" -------------------SL3---------------------- "<<endl; 00407 combine_size.clear(); 00408 for(unsigned int i=0; i<SL3.size(); i++) { 00409 cout<<"Cell ID --> "<<i<<endl; 00410 combine_size.push_back(SL3[i].size()); 00411 for(unsigned int j=0; j<SL3[i].size(); j++) { 00412 cout<<SL3[i][j]<<" "; 00413 if((j+1)%4==0) cout<<endl; 00414 } 00415 cout<<endl; 00416 } 00417 sort(combine_size.begin(),combine_size.end()); 00418 cout<<"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl; 00419 cout<<endl; 00420 00421 cout<<" -------------------SL4---------------------- "<<endl; 00422 combine_size.clear(); 00423 for(unsigned int i=0; i<SL4.size(); i++) { 00424 cout<<"Cell ID --> "<<i<<endl; 00425 combine_size.push_back(SL4[i].size()); 00426 for(unsigned int j=0; j<SL4[i].size(); j++) { 00427 cout<<SL4[i][j]<<" "; 00428 if((j+1)%4==0) cout<<endl; 00429 } 00430 cout<<endl; 00431 } 00432 sort(combine_size.begin(),combine_size.end()); 00433 cout<<"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl; 00434 cout<<endl; 00435 00436 cout<<" -------------------SL5---------------------- "<<endl; 00437 combine_size.clear(); 00438 for(unsigned int i=0; i<SL5.size(); i++) { 00439 cout<<"Cell ID --> "<<i<<endl; 00440 combine_size.push_back(SL5[i].size()); 00441 for(unsigned int j=0; j<SL5[i].size(); j++) { 00442 cout<<SL5[i][j]<<" "; 00443 if((j+1)%4==0) cout<<endl; 00444 } 00445 cout<<endl; 00446 } 00447 sort(combine_size.begin(),combine_size.end()); 00448 cout<<"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl; 00449 cout<<endl; 00450 00451 cout<<" -------------------SL10---------------------- "<<endl; 00452 combine_size.clear(); 00453 for(unsigned int i=0; i<SL10.size(); i++) { 00454 cout<<"Cell ID --> "<<i<<endl; 00455 combine_size.push_back(SL10[i].size()); 00456 for(unsigned int j=0; j<SL10[i].size(); j++) { 00457 cout<<SL10[i][j]<<" "; 00458 if((j+1)%4==0) cout<<endl; 00459 } 00460 cout<<endl; 00461 } 00462 sort(combine_size.begin(),combine_size.end()); 00463 cout<<"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl; 00464 cout<<endl; 00465 00466 cout<<"*---------------------------END------------------------------*"<<endl; 00467 }
MdcTSF * MdcTSF::get_Mdc | ( | void | ) | [static] |
Definition at line 28 of file MdcTSF.cxx.
References mdc_Pointer, and MdcTSF().
Referenced by BesTrigL1::initialize(), and MdcTF::MdcTF().
00028 { 00029 if(!mdc_Pointer) mdc_Pointer = new MdcTSF(); 00030 return mdc_Pointer; 00031 }
int MdcTSF::GetSL10TSF | ( | int | i | ) | [inline] |
int MdcTSF::GetSL1TSF | ( | int | i | ) | [inline] |
int MdcTSF::GetSL2TSF | ( | int | i | ) | [inline] |
int MdcTSF::GetSL3TSF | ( | int | i | ) | [inline] |
int MdcTSF::GetSL4TSF | ( | int | i | ) | [inline] |
int MdcTSF::GetSL5TSF | ( | int | i | ) | [inline] |
void MdcTSF::GetTS | ( | ) |
Definition at line 225 of file MdcTSF.cxx.
References CountTS(), genRecEmupikp::i, ganga-rec::j, SL10HitCount, SL10TSF, SL1HitCount, SL1TSF, SL2HitCount, SL2TSF, SL3HitCount, SL3TSF, SL4HitCount, SL4TSF, SL5HitCount, and SL5TSF.
Referenced by MdcTF::GetTrack().
00226 { 00227 CountTS(); 00228 // find TSF in each super layer 00229 for(int i=0; i<48; i++) 00230 for(int j=0; j<8; j++) 00231 { 00232 if(SL1HitCount[i][j] >= 3) { SL1TSF[i] = 1; break; } //cout<<"SL1 cell id : "<<i<<endl; break; } 00233 } 00234 00235 for(int i=0; i<80; i++) 00236 for(int j=0; j<12; j++) 00237 { 00238 if(SL2HitCount[i][j] >= 3) { SL2TSF[i] = 1; break; } //cout<<"SL2 cell id : "<<i<<endl; break; } 00239 } 00240 00241 for(int i = 0; i < 88; i++) 00242 for(int j = 0; j < 16; j++) 00243 { 00244 if(SL3HitCount[i][j] >= 3) { SL3TSF[i] = 1; break; } //cout<<"SL3: "<<i<<endl; break; } 00245 } 00246 00247 for(int i = 0; i < 112; i++) 00248 for(int j = 0; j < 22; j++) 00249 { 00250 if(SL4HitCount[i][j] >= 3) { SL4TSF[i] = 1; break; } //cout<<"SL4: "<<i<<endl; break; } 00251 } 00252 00253 for(int i = 0; i < 128; i++) 00254 for(int j = 0; j < 31; j++) 00255 { 00256 if(SL5HitCount[i][j] >= 3) { SL5TSF[i] = 1; break; } //cout<<"SL5: "<<i<<endl; break; } 00257 } 00258 00259 for(int i = 0; i < 128; i++) 00260 for(int j = 0; j < 81; j++) 00261 { 00262 if(SL10HitCount[i][j] >= 3) { SL10TSF[i] = 1; break; } //cout<<"SL10 : "<<i<<endl; break; } 00263 } 00264 00265 // combine the continuous TSF 00266 00267 00268 00269 }
void MdcTSF::ReadLut | ( | ) |
Definition at line 271 of file MdcTSF.cxx.
References check_raw_filter::filename, genRecEmupikp::i, ganga-rec::j, num, SL1, SL10, SL2, SL3, SL4, and SL5.
Referenced by MdcTSF().
00272 { 00273 fstream readin; 00274 int ncell=0,pl=0; 00275 int a,b,l4,l3,l2,l1; 00276 SL1.clear(); 00277 SL2.clear(); 00278 SL3.clear(); 00279 SL4.clear(); 00280 SL5.clear(); 00281 SL10.clear(); 00282 for(int n=1;n<6;n++) 00283 { 00284 if(n==1) { ncell=48; pl=3; } 00285 if(n==2) { ncell=80; pl=7; } 00286 if(n==3) { ncell=88; pl=11; } 00287 if(n==4) { ncell=112; pl=15; } 00288 if(n==5) { ncell=128; pl=18; } 00289 00290 for(int i=1;i<(ncell+1);i++) 00291 { 00292 std::vector<int> tmp; 00293 tmp.clear(); 00294 int num=0; 00295 TString filename = TString(getenv( "TRIGGERROOT" )); 00296 filename+="/data/tsf"; 00297 filename+=n; 00298 filename+="/TSF-SL"; 00299 filename+=n; 00300 filename+="-L"; 00301 filename+=pl; 00302 filename+="-C"; 00303 filename+=i; 00304 filename+=".pat"; 00305 readin.clear(); 00306 readin.open(filename,ios_base::in); 00307 if(!readin) cerr<<"can not open the file "<<filename<<endl; 00308 while(readin.good()) 00309 { 00310 readin>>a>>b>>l4>>l3>>l2>>l1; 00311 num++; 00312 } 00313 readin.close(); 00314 readin.clear(); 00315 readin.open(filename,ios_base::in); 00316 if(!readin) cerr<<"can not open the file again "<<filename<<endl; 00317 for(int j=0;j<(num-1);j++) 00318 { 00319 readin>>a>>b>>l4>>l3>>l2>>l1; 00320 tmp.push_back(l4); 00321 tmp.push_back(l3); 00322 tmp.push_back(l2); 00323 tmp.push_back(l1); 00324 } 00325 readin.close(); 00326 if(n==1) SL1.push_back(tmp); 00327 if(n==2) SL2.push_back(tmp); 00328 if(n==3) SL3.push_back(tmp); 00329 if(n==4) SL4.push_back(tmp); 00330 if(n==5) SL5.push_back(tmp); 00331 } 00332 } 00333 for(int i=1;i<129;i++) 00334 { 00335 std::vector<int> tmp1; 00336 tmp1.clear(); 00337 int num=0; 00338 //TString filename = "/ihepbatch/bes/caogf/data/tsf/tsf10C/TSF-SL10C-L38-C"; 00339 TString filename = TString(getenv( "TRIGGERROOT" )); 00340 filename+="/data/tsf10C/TSF-SL10C-L38-C"; 00341 filename+=i; 00342 filename+=".pat"; 00343 readin.clear(); 00344 readin.open(filename,ios_base::in); 00345 if(!readin) cerr<<"can not open the file "<<filename<<endl; 00346 while(readin.good()) 00347 { 00348 readin>>a>>b>>l4>>l3>>l2>>l1; 00349 num++; 00350 } 00351 readin.close(); 00352 readin.clear(); 00353 readin.open(filename,ios_base::in); 00354 if(!readin) cerr<<"can not open the file again "<<filename<<endl; 00355 00356 for(int j=0;j<(num-1);j++) 00357 { 00358 readin>>a>>b>>l4>>l3>>l2>>l1; 00359 tmp1.push_back(l4); 00360 tmp1.push_back(l3); 00361 tmp1.push_back(l2); 00362 tmp1.push_back(l1); 00363 } 00364 readin.close(); 00365 SL10.push_back(tmp1); 00366 } 00367 }
void MdcTSF::setMdcDigi | ( | std::vector< int > & | vmdcHit | ) |
Definition at line 41 of file MdcTSF.cxx.
References digiId, and iter().
Referenced by BesTrigL1::runAclock_mdc().
00042 { 00043 std::vector<int> vtmp; 00044 vtmp.clear(); 00045 digiId.clear(); 00046 00047 for(std::vector<int>::iterator iter = vmdcHit.begin(); iter != vmdcHit.end(); iter += 2) 00048 { 00049 int layer = *iter; 00050 int wire = *(iter + 1); 00051 if(layer<=19) { vtmp.push_back(layer); vtmp.push_back(wire); } 00052 if(layer>=36&&layer<=39) 00053 { 00054 wire = int(wire/2);//combine neighbor two cells 00055 vtmp.push_back(layer); 00056 vtmp.push_back(wire); 00057 } 00058 } 00059 00060 //remove the same layer, same cell, because of combine in 10 super layer; 00061 for(std::vector<int>::iterator iter = vtmp.begin(); iter != vtmp.end(); iter += 2) { 00062 bool ifsamelem = false; 00063 int layerId = *(iter); 00064 int cellId = *(iter+1); 00065 for(std::vector<int>::iterator iter_tmp = iter; iter_tmp != vtmp.end(); iter_tmp += 2) { 00066 if((iter_tmp+2) != vtmp.end()) { 00067 int layerId_tmp = *(iter_tmp+2); 00068 int cellId_tmp = *(iter_tmp+3); 00069 if((layerId == layerId_tmp) && (cellId == cellId_tmp)) ifsamelem = true; 00070 } 00071 } 00072 if(ifsamelem == false) { 00073 digiId.push_back(layerId); 00074 digiId.push_back(cellId); 00075 // std::cout<<"layer: "<<layerId<<" "<<"wire: "<<cellId<<std::endl; 00076 } 00077 } 00078 00079 }
std::vector<int> MdcTSF::digiId [private] |
MdcTSF * MdcTSF::mdc_Pointer = 0 [static, private] |
std::vector<std::vector<int> > MdcTSF::SL1 [private] |
std::vector<std::vector<int> > MdcTSF::SL10 [private] |
int MdcTSF::SL10HitCount[128][81] [private] |
int MdcTSF::SL10PivotCellHit[128] [private] |
int MdcTSF::SL10TSF[128] [private] |
int MdcTSF::SL1HitCount[48][8] [private] |
int MdcTSF::SL1PivotCellHit[48] [private] |
int MdcTSF::SL1TSF[48] [private] |
std::vector<std::vector<int> > MdcTSF::SL2 [private] |
int MdcTSF::SL2HitCount[80][12] [private] |
int MdcTSF::SL2PivotCellHit[80] [private] |
int MdcTSF::SL2TSF[80] [private] |
std::vector<std::vector<int> > MdcTSF::SL3 [private] |
int MdcTSF::SL3HitCount[88][16] [private] |
int MdcTSF::SL3PivotCellHit[88] [private] |
int MdcTSF::SL3TSF[88] [private] |
std::vector<std::vector<int> > MdcTSF::SL4 [private] |
int MdcTSF::SL4HitCount[112][22] [private] |
int MdcTSF::SL4PivotCellHit[112] [private] |
int MdcTSF::SL4TSF[112] [private] |
std::vector<std::vector<int> > MdcTSF::SL5 [private] |
int MdcTSF::SL5HitCount[128][31] [private] |
int MdcTSF::SL5PivotCellHit[128] [private] |
int MdcTSF::SL5TSF[128] [private] |