Changeset 1998 for trunk/MagicSoft/Mars
- Timestamp:
- 04/24/03 09:23:11 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1993 r1998 1 1 -*-*- END OF LINE -*-*- 2 2 3 2003/04/24: Antonio Stamerra 4 5 * mhistmc/MHMcTriggerLvl2.[h,cc] 6 - renamed some variable (hf->fHist) 7 - added fHist*Norm and fFNorm in the destructor 8 9 * manalysis/MMcTriggerLvl2.[h,cc] 10 - added CalcCompactPixel() public method 11 - implemented CalcPseudoSize method (still under construction...) 12 - added inline method SetNewCamera(), used in the costructor 13 - renamed global variables pixels_in_cell->gsPixelsInCell 14 and pixels_in_lut->gsPixelsInLut 15 - added destructor 16 3 17 4 18 2003/04/23: Thomas Bretz -
trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc
r1920 r1998 24 24 \* ======================================================================== */ 25 25 26 26 27 ///////////////////////////////////////////////////////////////////////////// 27 28 // // … … 31 32 // // 32 33 // input parameter: // 33 // fCompactNN number of next neighboors that define a compact pixel//34 // fCompactNN number of next neighboors that define a compact pixel // 34 35 // // 35 36 // // 36 37 // Basic L2T Selection Parameters: // 37 38 // // 38 // fLutPseudoSize number of compact pixels in one LUT//39 // fPseudoSize Multiplicity of the bigger cluster//40 // fSizeBiggerCell higher number of fired pixel in cell//39 // fLutPseudoSize number of compact pixels in one LUT // 40 // fPseudoSize Multiplicity of the bigger cluster // 41 // fSizeBiggerCell higher number of fired pixel in cell // 41 42 // // 42 43 ///////////////////////////////////////////////////////////////////////////// … … 44 45 #include "MMcTriggerLvl2.h" 45 46 47 #include "MGeomCam.h" 48 #include "MGeomPix.h" 46 49 #include "MGeomCamMagic.h" 47 50 #include "MCamDisplay.h" 51 52 #include "MCluster.h" 48 53 49 54 #include "MMcTrig.hxx" … … 64 69 // (Note: Pixels start to count from 1 instead of 0) 65 70 // 66 const Int_t MMcTriggerLvl2:: pixels_in_cell[36][19] = {71 const Int_t MMcTriggerLvl2::gsPixelsInCell[36][19] = { 67 72 {26, 91, 66, 71, 76, 81, 86, 269, 224, 233, 242, 251, 260, 391, 336, 347, 358, 369, 380}, 68 73 {25, 61, 41, 45, 49, 53, 57, 215, 175, 183, 191, 199, 207, 325, 275, 285, 295, 305, 315}, … … 106 111 // corrispondence between pixels in cell and lut (pix numbering starts from 1) 107 112 // 108 const Int_t MMcTriggerLvl2:: pixels_in_lut[3][12] = {113 const Int_t MMcTriggerLvl2::gsPixelsInLut[3][12] = { 109 114 { 1, 2, 3, 4, 6, 7, 8, 9, 12, 13, 14, 15}, 110 115 {34, 29, 23, 16, 30, 24, 17, 10, 25, 18, 11, 5}, … … 127 132 // Initialization of the fPixels array to zero 128 133 // 129 130 134 memset (fPixels,0,36*19*sizeof(Int_t)); 131 135 memset (fFiredPixel,0,397*sizeof(Int_t)); 136 137 // create a new camera 138 SetNewCamera(new MGeomCamMagic); 139 } 140 141 // -------------------------------------------------------------------------- 142 // 143 // Destructor 144 // 145 MMcTriggerLvl2::~MMcTriggerLvl2() 146 { 147 delete fCam; 148 delete fGeomCam; 132 149 } 133 150 … … 161 178 { 162 179 // *fLog.width(3); 163 *fLog << pixels_in_cell[i][j]-1 << ":" << fPixels[i][j] << "\t ";180 *fLog <<gsPixelsInCell[i][j]-1 << ":" << fPixels[i][j] << "\t "; 164 181 } 165 182 *fLog << endl; … … 173 190 for(int j=0; j<9; j++) 174 191 { 175 *fLog << pixels_in_cell[i][j]-1 << "\t";192 *fLog << gsPixelsInCell[i][j]-1 << "\t"; 176 193 } 177 194 *fLog << endl; … … 208 225 for(int j=0; j<19; j++) 209 226 { 210 int pixel = pixels_in_cell[i][j]-1;227 int pixel = gsPixelsInCell[i][j]-1; 211 228 fPixels[i][j] = (fMcTrig->IsPixelFired(pixel,0)) ? 1 : 0; 229 fFiredPixel[pixel]=(fMcTrig->IsPixelFired(pixel,0)) ? 1 : 0; 212 230 } 213 231 } … … 227 245 for(int j=0; j<19; j++) 228 246 { 229 if( pixels_in_cell[i][j]-1==pixel) fPixels[i][j]=fired;247 if(gsPixelsInCell[i][j]-1==pixel) fPixels[i][j]=fired; 230 248 } 231 249 } … … 241 259 void MMcTriggerLvl2::Calc() 242 260 { 261 262 // MCluster temp; 263 //MCluster &clust = (temp).FindCluster(); 264 // temp=*clust; 265 243 266 // Reads the number of NN that define a compact pixel 244 int neighpix=(*this).fCompactNN;245 267 246 268 // Find the Lut and cell with the higher LutPseudoSize. 247 int lutcell = CalcBiggerLutPseudoSize( neighpix);269 int lutcell = CalcBiggerLutPseudoSize(); 248 270 int maxcell = lutcell/10; 249 271 int maxlut = lutcell-maxcell*10; 250 fLutPseudoSize = GetLutCompactPixel(maxcell,maxlut ,neighpix);251 252 fPseudoSize = CalcPseudoSize(neighpix);272 fLutPseudoSize = GetLutCompactPixel(maxcell,maxlut); 273 274 CalcPseudoSize(); 253 275 254 276 fSizeBiggerCell = GetCellNumberFired(CalcBiggerFiredCell()); … … 272 294 // the same camera pad 273 295 // 274 if (!fGeom cam)275 fGeom cam = new MGeomCamMagic;296 if (!fGeomCam) 297 fGeomCam = new MGeomCamMagic; 276 298 if (!fCam) 277 299 { 278 fCam = new MCamDisplay(fGeom cam);300 fCam = new MCamDisplay(fGeomCam); 279 301 fCam->Draw(); 280 302 fCam->DrawPixelNumbers(); … … 289 311 { 290 312 color = (fPixels[i][cell]) ? 5 : 3; 291 fCam->SetPix( pixels_in_cell[i][cell]-1, color, 1, 5 );313 fCam->SetPix( gsPixelsInCell[i][cell]-1, color, 1, 5 ); 292 314 } 293 315 … … 316 338 // !FixMe! Delete this method when the trigger display is available! 317 339 // 318 if (!fGeom cam)319 fGeom cam = new MGeomCamMagic;340 if (!fGeomCam) 341 fGeomCam = new MGeomCamMagic; 320 342 if (!fCam) 321 343 { 322 fCam = new MCamDisplay(fGeom cam);344 fCam = new MCamDisplay(fGeomCam); 323 345 fCam->Draw(); 324 346 fCam->DrawPixelNumbers(); … … 401 423 // accordingly to: cell*10 + LUT 402 424 // 403 Int_t MMcTriggerLvl2::CalcBiggerLutPseudoSize( int neighpix)425 Int_t MMcTriggerLvl2::CalcBiggerLutPseudoSize() 404 426 { 405 427 int size=0; … … 411 433 for(int i=0; i<3; i++) 412 434 { 413 if (GetLutCompactPixel(j,i ,neighpix) >size)435 if (GetLutCompactPixel(j,i) >= size) 414 436 { 415 size = GetLutCompactPixel(j,i ,neighpix);437 size = GetLutCompactPixel(j,i); 416 438 cell = j; 417 439 lut = i; … … 421 443 422 444 // *fLog <<"Max cell: " << cell+1 << " Max Lut: " << lut+1 << " PseudoSize: " << size <<endl; 423 424 445 425 446 return cell*10+lut; 426 447 } … … 443 464 // the number of compact pixels in one LUT. 444 465 // 445 Int_t MMcTriggerLvl2::GetLutCompactPixel(int cell, int lut , int neighpix)466 Int_t MMcTriggerLvl2::GetLutCompactPixel(int cell, int lut) 446 467 { 447 468 int size=0; 448 469 int lutpix, a[12]; 470 int neighpix= (*this).fCompactNN; 471 472 // check on input variables 449 473 450 474 if (neighpix >3 || neighpix < 2) … … 462 486 for(int j=0; j<12; j++) 463 487 { 464 lutpix = pixels_in_lut[lut][j]-1;488 lutpix = gsPixelsInLut[lut][j]-1; 465 489 // *fLog << "j=" <<j<<" lutpix="<<lutpix<<" Cell="<<cell<<endl; 466 490 a[j] = fPixels[lutpix][cell]; … … 668 692 } 669 693 694 695 if(size<0 ||size>12) 696 *fLog << "*" << size <<"-"; 670 697 671 698 return size; … … 678 705 // defined as the multiplicity of the bigger cluster. 679 706 // 707 // 708 // 709 void MMcTriggerLvl2::CalcPseudoSize() 710 { 711 *fLog <<" In CalcPseudoSize "; 712 CalcCompactPixels(fGeomCam); 713 714 // seek the LUT with higher number of compact pixels 715 // 716 int cellut = CalcBiggerLutPseudoSize(); 717 int maxcell = cellut/10; 718 int maxlut = cellut - maxcell*10; 719 int startpix; 720 721 // 722 // seek a starting pixel in the lut for the iteration 723 // 724 int check=1; 725 for (int pixlut=0;pixlut<12;pixlut++) 726 { 727 int pixcell =gsPixelsInLut[maxlut][pixlut]; 728 startpix = gsPixelsInCell[pixcell][maxcell]-1; 729 if (fCompactPixel[startpix]) // a starting pixel was found 730 break; 731 check++; 732 } 733 734 // A LUT contains 12 pixels 735 if (check >= 12) 736 { 737 *fLog <<"Error: a starting pixels was not found!"<<endl; 738 return; 739 } 740 // 741 // Bulding cluster 742 // 743 Int_t cluster[397]; 744 int pnt=0; 745 int pnt2=0; //pointer in the array fCluster_pix, needed for filling 746 747 memset (cluster,0,397*sizeof(Int_t)); 748 memset (fCluster_pix,-1,397*sizeof(Int_t)); 749 750 cluster[startpix]=1; 751 fCluster_pix[0]=startpix; //the starting pix is the first in cluster 752 753 // Look at neighbour pixs if they are compact (iterative search) 754 // until the array (fCluster_pix) has no more compact pixels. 755 // pnt points to the pixel in the array fCluster_pix whose neighbors are 756 // under study; pnt2 points to the last element of this array. 757 // 758 while (fCluster_pix[pnt] != -1) 759 { 760 const MGeomPix &pix=(*fGeomCam)[fCluster_pix[pnt]]; 761 762 for (int i=0;i<pix.GetNumNeighbors();i++) 763 { 764 int pix_neigh = pix.GetNeighbor(i); 765 // check if pixel is fired and doesn't belong to cluster 766 if (fFiredPixel[pix_neigh] && !cluster[pix_neigh]) 767 { 768 cluster[pix_neigh] = 1; 769 fCluster_pix[++pnt2] = pix_neigh; 770 } 771 } 772 pnt++; 773 } 774 775 fPseudoSize = pnt; 776 777 // *fLog << "ClusterID:" <<(*clust).GetClusterId() << " Mult:" << (*clust).GetMultiplicity()<<endl; 778 779 *fLog <<"PSize: "<< fPseudoSize << " in cell:" << maxcell << " lut:" <<maxlut <<endl; 780 781 return; 782 } 783 784 // -------------------------------------------------------------------------- 785 // 786 // Fill the fCompactPixels array with the pixels which are compact 787 // 680 788 // neighpix is the number of Next-Neighbors which defines the compact pixel 681 789 // topology (it can be 2-NN or 3-NN) 682 790 // 683 // !Not yet implemented!! 684 // 685 Int_t MMcTriggerLvl2::CalcPseudoSize(int neighpix) 686 { 687 int size=0; 688 689 return size; 690 } 691 791 // Note: it is a *global* method; it looks in the all camera as a whole 792 // 793 // 794 void MMcTriggerLvl2::CalcCompactPixels(MGeomCam *geom) 795 { 796 memset (fCompactPixel,0,397*sizeof(Int_t)); 797 798 for(UInt_t pixid=0;pixid<397;pixid++) 799 { 800 // Look if the pixel is fired, otherwise continue 801 if (!fFiredPixel[pixid]) 802 continue; 803 804 const MGeomPix &pix=(*geom)[pixid]; 805 806 // Look for compact pixels. 807 // A compact pixel must have at least fCompactNN adjacent neighbors 808 // It checks the 6 different configurations of neighbors pixels 809 for (int i=0;i<pix.GetNumNeighbors();i++) 810 { 811 int j=0; 812 while (fFiredPixel[pix.GetNeighbor(i+j)]==1 && j < fCompactNN) 813 j++; 814 if (j!=fCompactNN) continue; // configuration doesn't satisfy compact condition 815 816 fCompactPixel[pixid]=1; // pixel is compact 817 break; 818 } 819 } 820 } 821 822 823 -
trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h
r1920 r1998 7 7 8 8 class MMcTrig; 9 10 class MCamDisplay; 9 11 class MGeomCamMagic; 10 class MCamDisplay; 12 13 class MGeomCam; 14 class MGeomPix; 15 16 class MCluster; 11 17 12 18 class MMcTriggerLvl2 : public MParContainer … … 15 21 private: 16 22 17 Int_t fPixels[36][19]; // Array with thetriggered pixels. 1st idx:pixels in trigger cell; 2nd idx:trigger cell number23 Int_t fPixels[36][19]; // Array with flag for triggered pixels. 1st idx:pixels in trigger cell; 2nd idx:trigger cell number 18 24 19 static const Int_t pixels_in_cell[36][19]; 20 static const Int_t pixels_in_lut[3][12]; 25 Int_t fFiredPixel[397]; // Array with flag for triggered pixel. idx: pixel id 26 27 static const Int_t gsPixelsInCell[36][19]; 28 static const Int_t gsPixelsInLut[3][12]; 21 29 22 30 Int_t fLutPseudoSize; // number of compact pixels in one lut … … 26 34 Int_t fCompactNN; //Number of NN pixels that define a compact pixel 27 35 36 Int_t fCompactPixel[397]; //Array with flag for compact pixels 37 38 Int_t fCluster_pix[397]; //Array with pixel in cluster 39 28 40 MMcTrig *fMcTrig; 29 MGeomCam Magic *fGeomcam;41 MGeomCam *fGeomCam; 30 42 MCamDisplay *fCam; 43 // MCluster *fClust; 31 44 32 45 Int_t CalcBiggerFiredCell(); 33 Int_t CalcBiggerLutPseudoSize( int neighpix);34 Int_t CalcPseudoSize(int neighpix);46 Int_t CalcBiggerLutPseudoSize(); 47 void CalcPseudoSize(); 35 48 49 void SetNewCamera(MGeomCam *geom) {fGeomCam = geom;} 50 36 51 public: 37 52 38 53 MMcTriggerLvl2(const char* name = NULL, const char* title = NULL); 39 54 ~MMcTriggerLvl2(); 40 55 41 56 void DrawCell(Int_t cell); … … 51 66 void SetCompactNN(Int_t neighpix) {fCompactNN=neighpix;} 52 67 53 Int_t GetPseudoSize() const{return fPseudoSize;}54 Int_t GetLutPseudoSize() const{return fLutPseudoSize;}68 Int_t GetPseudoSize() const {return fPseudoSize;} 69 Int_t GetLutPseudoSize() const {return fLutPseudoSize;} 55 70 Int_t GetSizeBiggerCell() const {return fSizeBiggerCell;} 56 Int_t GetCompactNN() const{return fCompactNN;}71 Int_t GetCompactNN() const {return fCompactNN;} 57 72 58 73 Int_t GetCellNumberFired(int cell); 59 Int_t GetLutCompactPixel(int cell, int lut, int neighpix); 74 Int_t GetLutCompactPixel(int cell, int lut); 75 76 void CalcCompactPixels(MGeomCam *fCam); 77 60 78 61 79 ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
Note:
See TracChangeset
for help on using the changeset viewer.