Changeset 653 for trunk/MagicSoft/Mars
- Timestamp:
- 03/01/01 15:42:32 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 added
- 4 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r651 r653 1 1 -*-*- END -*-*- 2 2 3 2000/03/01: Thomas Bretz 4 5 * manalysis/AnalysisLinkDef.h 6 removed MReadCT1Ascii, added MCT1ReadAscii 7 added MCT1Pedestals 8 9 * manalysis/MCerPhotEvt.[h,cc]: 10 changed the constructor a little bit, rewrote Print() to make it 11 a bit more readable, moved MCerphotPix to new File, added many lines 12 of comments, exchanged old stylish new call with new stylish(=) one, 13 replaced all accesses to fPixels with the [] operator to make this 14 lines more readable, made all variable declarations const-correct, 15 I changed the style of the cleaning method from if(a){if()b{if(c){}}} 16 to if(!a)continue; if(!b)continue if(!c) continue; to make it more 17 compact, readable and easier to understand, renamed the Boolean- 18 functions to Is* to get a stricter structure, replaced mapping 19 function to access the pixel list entries by the new operator to 20 get rid of more than the necessary number of member functions without 21 loosing speed or readability, renamed GetMinimum/MaximumPhoton to 22 GetMin/MaxNumPhotons to be more exact 23 24 * mgui/MCamGeom.* splitted and changed to MGeomCam/Pix: 25 added a new operator to access the TObjArray, removed unnecessary 26 code from CreateCT1 27 28 * mbase/MAGIC.h: added kPI 29 30 * mbase/MReadTree.cc: added some comments 31 32 * mgui/MCamDisplay.[h,cc]: 33 added some comments, reordered a bit the calls in the constructor 34 to get a 'straight forward structure', MGeomCam is now only 35 locally used where it is needed, replaced access to the 36 TClonesArrays by new member-function to get a more readable code, 37 replaced old stylish new call with new stylish one, made 38 variable decleration const-correct, introduced a new member function 39 to set the pixel color, renamed the overloaded Draw functions to 40 DrawPhotons, DrawPhotErr to prevent missunderstatements, changed 41 the 'layout' of GetColor to make it easier to understand the algorithm, 42 43 * mgui/MCamNeighbor.[h, cc]: 44 changed to new log-interface, exchanged -9999 by -1, skipped the 45 exits, you must check for -1 one in any case, this means a warning 46 should be enough 47 48 * mgui/MHexagon.[h,cc]: 49 added new constructor whcih uses a MGeomPix-object, 50 51 52 2000/02/28: Thomas Bretz 53 54 * mraw/MRawEvtPixelIter.h: added GetSum* functions 55 56 * mbase/MParList.[h,cc]: changed return type of FindObject back to TObject, 57 it seems so, that some compilers don't like overriding the 58 return type of a virtual member function 59 60 3 61 2000/02/23: Thomas Bretz 4 62 … … 18 76 mraw/MRawRunHeader.cc: 19 77 exchanged cout with the new logging style (gLog, *fLog) 20 78 \\ \hline 79 &&&{\em Gesamt:}&{\bfseries 549.00 DM}\\ 80 \hline 81 21 82 * mraw/MRawEvtData.cc: added 'dec' option to Print 22 83 -
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r601 r653 8 8 #pragma link C++ class MCerPhotEvt; 9 9 10 #pragma link C++ class MReadCT1Ascii; 11 12 10 #pragma link C++ class MCT1ReadAscii; 11 #pragma link C++ class MCT1Pedestals; 13 12 14 13 #endif -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r603 r653 2 2 3 3 #include <math.h> 4 #include <fstream.h> 5 6 #include <TCanvas.h> 4 7 #include <TClonesArray.h> 5 #include <TCanvas.h> 6 7 #include "M CamGeom.h"8 9 #include "MLog.h" 10 #include "MGeomCam.h" 8 11 #include "MCamNeighbor.h" 9 12 #include "MCamDisplay.h" 10 13 #include "MHexagon.h" 11 14 12 ClassImp(MCerPhotPix)13 15 ClassImp(MCerPhotEvt) 14 16 15 MCerPhotPix::MCerPhotPix(Int_t pix, Float_t phot , Float_t errphot ) 16 { 17 // default constructor 18 fPixId = pix ; 19 fIsUsed = kTRUE ; 20 fIsCore = kFALSE ; 21 fPhot = phot ; 22 fErrPhot = errphot ; 23 } 24 25 void MCerPhotPix::SetPixelContent(Int_t pix, Float_t phot , Float_t errphot) 26 { 27 fPixId = pix ; 28 fIsUsed = kTRUE ; 29 fIsUsed = kFALSE ; 30 fPhot = phot ; 31 fErrPhot = errphot ; 32 } 33 34 void MCerPhotPix::Print() 35 { 36 // information about a pixel 37 cout << "MCerPhotPix: Pixel: "<< fPixId ; 38 39 if ( fIsUsed == kTRUE ) 40 cout << " Used " ; 41 else 42 if ( fIsUsed == kFALSE ) 43 cout << " UnUsed " ; 44 45 if ( fIsCore == kTRUE ) 46 cout << " Core " ; 47 else 48 if ( fIsCore == kFALSE ) 49 cout << " " ; 50 51 cout << " Nphot= " << fPhot 52 << " Error(Nphot) = " << fErrPhot 53 << endl ; 54 } 55 56 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 57 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 58 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 59 60 61 MCerPhotEvt::MCerPhotEvt(const char *name, const char *title ) 17 MCerPhotEvt::MCerPhotEvt(const char *name, const char *title ) : fType(0), fNbPixels(0) 62 18 { 63 19 // the default constructor … … 67 23 *fTitle = name ? name : "(Number of Photon)-Event Information"; 68 24 69 fType = 0 ;70 fNbPixels = 0 ;71 72 25 fPixels = new TClonesArray ("MCerPhotPix", 577) ; 73 74 fNN = new MCamNeighbor() ; 75 76 fPixels->Clear() ; 26 27 // 28 // FIXME: is this really necessary? 29 // 30 fPixels->Clear(); 77 31 } 78 32 … … 84 38 MCamDisplay *disp = new MCamDisplay(fType) ; 85 39 86 disp->Draw( this ) ; 87 88 // disp->Draw() ; 89 90 } 91 92 93 40 disp->DrawPhotNum(this) ; 41 } 94 42 95 43 Int_t MCerPhotEvt::GetNbPixels() 96 44 { 97 return fNbPixels ;45 return fNbPixels; 98 46 } 99 47 100 48 void MCerPhotEvt::AddPixel(Int_t id, Float_t nph, Float_t err) 101 49 { 102 TClonesArray &caP = *fPixels ; 103 new ( caP[fNbPixels++] ) MCerPhotPix( id, nph, err ) ; 104 } 105 106 void MCerPhotEvt::Clear() 107 { 108 fNbPixels = 0 ; 109 fPixels->Clear() ; 110 } 111 112 void MCerPhotEvt::Print() 113 { 114 cout << "MCerPhotEvt::Print()" 115 << "Number of Pixels: " << fNbPixels 116 << "(" << fPixels->GetEntries() << ")" 117 << endl ; 118 119 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 120 { 121 ((MCerPhotPix *) fPixels->At(il))->Print() ; 122 } 50 // 51 // add a new pixel to the list and increase the number 52 // of valid pixels in the list by one 53 // 54 (*fPixels)[fNbPixels++] = new MCerPhotPix( id, nph, err); 55 } 56 57 void MCerPhotEvt::Clear(Option_t *) 58 { 59 // 60 // reset counter and delete netries in list. 61 // 62 fNbPixels = 0 ; 63 fPixels->Clear() ; 64 } 65 66 void MCerPhotEvt::Print(Option_t *) 67 { 68 const Int_t entries = fPixels->GetEntries(); 69 70 *fLog << "MCerPhotEvt::Print()" << endl 71 << "Number of Pixels: " << fNbPixels 72 << "(" << entries << ")" 73 << endl ; 74 75 for (Int_t il=0; il<entries; il++ ) 76 (*this)[il].Print(); 123 77 } 124 78 125 79 void MCerPhotEvt::CleanLevel1() 126 { 127 // This method looks for all pixels with an entry (photons) 128 // that is three times bigger than the noise of the pixel 129 130 Float_t entry, noise ; 131 132 // first look for pixels above some noise level 133 134 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 135 { 136 entry = ((MCerPhotPix *) fPixels->At(il))->GetPhotons() ; 137 noise = ((MCerPhotPix *) fPixels->At(il))->GetErrorPhot() ; 138 139 if (entry < 3 * noise ) 140 ((MCerPhotPix *) fPixels->At(il))->SetPixelUnused() ; 141 142 } 143 } 80 { 81 // 82 // This method looks for all pixels with an entry (photons) 83 // that is three times bigger than the noise of the pixel 84 // 85 86 const Int_t entries = fPixels->GetEntries(); 87 88 // 89 // check the number of all pixels against the noise level and 90 // set them to 'unused' state if necessary 91 // 92 for (Int_t il=0; il<entries; il++ ) 93 { 94 MCerPhotPix &pix = (*this)[il]; 95 96 const Float_t entry = pix.GetNumPhotons(); 97 const Float_t noise = pix.GetErrorPhot(); 98 99 if (entry < 3 * noise ) 100 pix.SetPixelUnused(); 101 } 102 } 144 103 145 104 void MCerPhotEvt::CleanLevel2() 146 105 { 147 // check if the survived pixel have a neighbor, that also 148 // survived 149 150 Int_t id, id2 ; 151 Int_t itest ; 152 153 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 154 { 155 if ( ((MCerPhotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE ) 156 { 157 id = ((MCerPhotPix *) fPixels->At(il))->GetPixId() ; 158 159 itest = 0 ; 160 for (Int_t in=0 ; in < 6 ; in++ ) { 161 162 id2 = fNN->GetNN(id, in ) ; 163 164 if (id2 >=0 ) { 165 if ( PixelIsUsed(id2) == kTRUE ) 166 itest++ ; 167 } 168 } 169 170 // 171 // check if no neighbor, then set unused 172 // 173 if ( itest == 0 ) 174 { 175 ((MCerPhotPix *) fPixels->At(il))->SetPixelUnused() ; 176 } 177 178 } 106 // 107 // check if the survived pixel have a neighbor, that also 108 // survived 109 // 110 111 const Int_t entries = fPixels->GetEntries(); 112 113 for (Int_t il=0; il<entries; il++) 114 { 115 // 116 // get entry il from list 117 // 118 MCerPhotPix &pix = (*this)[il]; 119 120 // 121 // check if pixel is in use, if not goto next pixel in list 122 // 123 if (!pix.IsPixelUsed()) 124 continue; 125 126 // 127 // get pixel id of this entry 128 // 129 const Int_t id = pix.GetPixId() ; 130 131 // 132 // count number of next neighbors of this pixel which 133 // state is 'used' 134 // 135 Int_t itest = 0 ; 136 for (Int_t in=0 ; in < 6; in++ ) 137 { 138 const Int_t id2 = fNN.GetNN(id, in) ; 139 140 if (id2 < 0) 141 continue; 142 143 if (IsPixelUsed(id2)) 144 itest++ ; 145 } 146 147 // 148 // check if no next neighbor has the state 'used' 149 // set this pixel to 'unused', too. 150 // 151 if (itest==0) 152 pix.SetPixelUnused(); 153 } 154 155 // 156 // now we declare all pixels that survive as CorePixels 157 // 158 for (Int_t il=0; il<entries; il++) 159 { 160 MCerPhotPix &pix = (*this)[il]; 161 162 if (pix.IsPixelUsed()) 163 pix.SetCorePixel(); 164 } 165 166 } 167 168 void MCerPhotEvt::CleanLevel3() 169 { 170 // 171 // Look for the boundary pixels around the core pixels 172 // if a pixel has more than 2.5 sigma, and a core neigbor 173 // it is declared as used. 174 // 175 const Int_t entries = fPixels->GetEntries(); 176 177 for (Int_t il=0; il<entries; il++) 178 { 179 // 180 // get pixel as entry il from list 181 // 182 MCerPhotPix &pix = (*this)[il]; 183 184 // 185 // if pixel is a core pixel go to the next pixel 186 // 187 if (pix.IsCorePixel()) 188 continue; 189 190 // 191 // check the num of photons against the noise level 192 // 193 const Float_t entry = pix.GetNumPhotons(); 194 const Float_t noise = pix.GetErrorPhot(); 195 196 if (entry <= 2.5 * noise ) 197 continue; 198 199 // 200 // get pixel id of this entry 201 // 202 const Int_t id = pix.GetPixId(); 203 204 // 205 // check if the pixel's next neighbor is a core pixel. 206 // if it is a core pixel set pixel state to: used. 207 // 208 for (Int_t in=0; in<6 ; in++) 209 { 210 const Int_t id2 = fNN.GetNN(id, in); 211 212 if (id2 <0) 213 continue; 214 215 if (!IsPixelCore(id2)) 216 continue; 217 218 pix.SetPixelUsed(); 219 220 break ; 221 } 222 } 223 } 224 225 226 Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) 227 { 228 // 229 // Checks if in the pixel list is an entry with pixel id 230 // 231 const Int_t entries = fPixels->GetEntries(); 232 233 for (Int_t il=0; il<entries; il++) 234 { 235 if (id == (*this)[il].GetPixId()) 236 return kTRUE ; 237 } 238 239 return kFALSE ; 240 } 241 242 Bool_t MCerPhotEvt::IsPixelUsed(Int_t id) 243 { 244 // 245 // Checks if in the pixel list is an entry with pixel id 246 // 247 const Int_t entries = fPixels->GetEntries(); 248 249 for (Int_t il=0; il<entries; il++ ) 250 { 251 MCerPhotPix &pix = (*this)[il]; 252 253 if (id == pix.GetPixId() && pix.IsPixelUsed()) 254 return kTRUE ; 255 } 256 257 return kFALSE ; 258 } 259 260 Bool_t MCerPhotEvt::IsPixelCore(Int_t id) 261 { 262 // 263 // Checks if in the pixel list is an entry with pixel id 264 // 265 const Int_t entries = fPixels->GetEntries(); 266 267 for (Int_t il=0; il<entries; il++ ) 268 { 269 MCerPhotPix &pix = (*this)[il]; 270 271 if ( id == pix.GetPixId() && pix.IsCorePixel()) 272 return kTRUE ; 179 273 } 180 181 // now we declare all pixels that survive as CorePixels 182 183 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 184 { 185 if ( ((MCerPhotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE ) 186 { 187 ((MCerPhotPix *) fPixels->At(il))->SetCorePixel() ; 188 } 189 } 190 191 } 192 193 void MCerPhotEvt::CleanLevel3() 194 { 195 // Look for the boundary pixels around the core pixels 196 // if a pixel has more than 2.5 sigma, and a core neigbor 197 // it is declared as used. 198 199 Float_t entry, noise ; 200 Int_t id, id2 ; 201 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 202 { 203 if ( ((MCerPhotPix *) fPixels->At(il))->IsCorePixel() == kFALSE ) 204 { 205 entry = ((MCerPhotPix *) fPixels->At(il))->GetPhotons() ; 206 noise = ((MCerPhotPix *) fPixels->At(il))->GetErrorPhot() ; 207 208 if (entry > 2.5 * noise ) { 209 id = ((MCerPhotPix *) fPixels->At(il))->GetPixId() ; 210 for (Int_t in=0 ; in < 6 ; in++ ) 211 { 212 id2 = fNN->GetNN(id, in ) ; 213 if (id2 >=0 ) 214 { 215 if ( PixelIsCore(id2) == kTRUE ) { 216 ((MCerPhotPix *) fPixels->At(il))->SetPixelUsed() ; 217 break ; 218 } 219 } 220 } 221 } 222 } 223 } 224 } 225 226 227 228 229 Bool_t MCerPhotEvt::PixelExist(Int_t id ) 230 { 231 // Checks if in the pixel list is an entry with pixel id 232 233 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 234 { 235 if ( id == ((MCerPhotPix *) fPixels->At(il))->GetPixId() ) { 236 237 // cout << " PixelExist " << il ; 238 return kTRUE ; 239 } 240 } 241 242 return kFALSE ; 243 244 } 245 246 Bool_t MCerPhotEvt::PixelIsUsed(Int_t id ) 247 { 248 // Checks if in the pixel list is an entry with pixel id 249 250 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 251 { 252 if ( id == ((MCerPhotPix *) fPixels->At(il))->GetPixId() && 253 ((MCerPhotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE ) { 254 255 // cout << " PixelIsUsed " << il ; 256 return kTRUE ; 257 } 258 } 259 260 return kFALSE ; 261 262 } 263 264 Bool_t MCerPhotEvt::PixelIsCore(Int_t id ) 265 { 266 // Checks if in the pixel list is an entry with pixel id 267 268 for (Int_t il=0; il<fPixels->GetEntries(); il++ ) 269 { 270 if ( id == ((MCerPhotPix *) fPixels->At(il))->GetPixId() && 271 ((MCerPhotPix *) fPixels->At(il))->IsCorePixel() == kTRUE ) { 272 273 return kTRUE ; 274 } 275 } 276 277 return kFALSE ; 278 279 } 280 281 Int_t MCerPhotEvt::GetPixelId(Int_t i ) 282 { 283 return ( ( (MCerPhotPix *) fPixels->At(i))->GetPixId() ) ; 284 } 285 286 Bool_t MCerPhotEvt::IsPixelUsed(Int_t i ) 287 { 288 return ( ( (MCerPhotPix *) fPixels->At(i))->IsPixelUsed() ) ; 289 } 290 291 Float_t MCerPhotEvt::GetPhotons(Int_t i ) 292 { 293 return ( ( (MCerPhotPix *) fPixels->At(i))->GetPhotons() ) ; 294 } 295 296 Float_t MCerPhotEvt::GetErrorPhot(Int_t i ) 297 { 298 return ( ( (MCerPhotPix *) fPixels->At(i))->GetErrorPhot() ) ; 299 } 300 301 302 Float_t MCerPhotEvt::GetMinimumPhoton() 303 { 304 if ( fNbPixels <= 0 ) 305 return -5. ; 306 307 Float_t minWert ; 308 minWert = ((MCerPhotPix *) fPixels->At(0))->GetPhotons() ; 309 310 Float_t testWert ; 311 312 for ( Int_t i =0 ; i<fNbPixels ; i++ ) { 313 testWert = ((MCerPhotPix *) fPixels->At(i))->GetPhotons() ; 314 315 if ( minWert >= testWert ) 316 minWert = testWert ; 317 } 318 319 return minWert ; 320 } 321 322 Float_t MCerPhotEvt::GetMaximumPhoton() 323 { 324 if ( fNbPixels <= 0 ) 325 return 50. ; 326 327 Float_t maxWert ; 328 maxWert = ((MCerPhotPix *) fPixels->At(0))->GetPhotons() ; 329 330 Float_t testWert ; 331 332 for ( Int_t i =0 ; i<fNbPixels ; i++ ) { 333 testWert = ((MCerPhotPix *) fPixels->At(i))->GetPhotons() ; 334 335 if ( maxWert <= testWert ) 336 maxWert = testWert ; 337 } 338 339 return maxWert ; 340 } 341 274 275 return kFALSE ; 276 } 277 278 Float_t MCerPhotEvt::GetMinNumPhotons() 279 { 280 // 281 // get the minimum number of photons of all valid pixels in the list 282 // 283 if (fNbPixels <= 0) 284 return -5. ; 285 286 Float_t minval = (*this)[0].GetNumPhotons(); 287 288 Float_t testval; 289 for (Int_t i=1 ; i<fNbPixels; i++ ) 290 { 291 testval = (*this)[i].GetNumPhotons(); 292 293 if (testval < minval) 294 minval = testval; 295 } 296 297 return minval; 298 } 299 300 Float_t MCerPhotEvt::GetMaxNumPhotons() 301 { 302 // 303 // get the maximum number of photons of all valid pixels in the list 304 // 305 if (fNbPixels <= 0) 306 return 50.; 307 308 Float_t maxval = (*this)[0].GetNumPhotons(); 309 310 Float_t testval; 311 for (Int_t i=1; i<fNbPixels; i++) 312 { 313 testval = (*this)[i].GetNumPhotons(); 314 315 if (testval > maxval) 316 maxval = testval; 317 } 318 return maxval; 319 } 320 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r603 r653 1 #ifndef M NPHOTEVENT_H2 #define M NPHOTEVENT_H1 #ifndef MCERPHOTEVT_H 2 #define MCERPHOTEVT_H 3 3 4 #ifndef MAGIC_h 5 #include "MAGIC.h" 6 #endif 7 #ifndef ROOT_TClonesArray 8 #include "TClonesArray.h" 9 #endif 4 10 #ifndef MPARCONTAINER_H 5 11 #include "MParContainer.h" 6 12 #endif 13 #ifndef MCAMNEIGHBOR_H 14 #include "MCamNeighbor.h" 15 #endif 7 16 8 #include <iostream> 9 #include <TROOT.h> 10 class TClonesArray ; 11 class TObjArray ; 12 class MCamNeighbor ; 13 14 class MCerPhotPix : public TObject 15 { 16 private: 17 18 Int_t fPixId ; // the pixel Id 19 Bool_t fIsUsed ; // the pixel is used for calculations --> kTRUE 20 Bool_t fIsCore ; // the pixel is a Core pixel --> kTRUE 21 Float_t fPhot ; // The number of Cerenkov photons 22 Float_t fErrPhot ; // the error of fPhot 23 24 public: 25 26 MCerPhotPix(Int_t pix = -9999, Float_t phot=0. , Float_t errphot=0.) ; 27 28 void Print() ; 29 30 Int_t GetPixId() 31 { 32 return fPixId ; 33 } 34 35 Float_t GetPhotons() 36 { 37 return fPhot ; 38 } 39 40 Float_t GetErrorPhot() 41 { 42 return fErrPhot ; 43 } 44 45 void SetPixelContent(Int_t pix , Float_t phot , Float_t errphot ) ; 46 47 Bool_t IsPixelUsed() 48 { 49 return fIsUsed ; 50 } 51 52 void SetPixelUnused() 53 { 54 fIsUsed = kFALSE ; 55 } 56 57 void SetPixelUsed() 58 { 59 fIsUsed = kTRUE ; 60 } 61 62 void SetCorePixel() 63 { 64 fIsCore = kTRUE ; 65 } 66 67 Bool_t IsCorePixel() 68 { 69 return fIsCore ; 70 } 71 72 73 ClassDef(MCerPhotPix, 1) // Cerenkov Photons class for the pixel 74 } ; 75 76 77 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 78 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 79 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 17 class MCerPhotPix; 80 18 81 19 class MCerPhotEvt : public MParContainer 82 20 { 83 private: 21 private: 84 22 85 Int_t fType ; //86 Int_t fNbPixels ; //87 TClonesArray *fPixels ; //23 Int_t fType; 24 Int_t fNbPixels; 25 TClonesArray *fPixels; 88 26 27 MCamNeighbor fNN; //! the class with the information about neighbors 89 28 90 MCamNeighbor *fNN ; //! the class with the information about neighbors 91 92 public: 93 94 MCerPhotEvt(const char *name=NULL, const char *title=NULL) ; 29 public: 30 MCerPhotEvt(const char *name=NULL, const char *title=NULL) ; 95 31 96 32 void Draw(Option_t* option = "" ) ; … … 100 36 void AddPixel(Int_t id, Float_t nph, Float_t err ); 101 37 102 void Clear( ) ;38 void Clear(Option_t *opt=NULL) ; 103 39 104 void Print( ) ;40 void Print(Option_t *opt=NULL) ; 105 41 106 42 void CleanLevel1() ; … … 108 44 void CleanLevel3() ; 109 45 110 Bool_t PixelExist( Int_t id ) ;111 Bool_t PixelIsUsed( Int_t id ) ;112 Bool_t PixelIsCore( Int_t id ) ;46 Bool_t IsPixelExisting( Int_t id ) ; 47 Bool_t IsPixelUsed ( Int_t id ) ; 48 Bool_t IsPixelCore ( Int_t id ) ; 113 49 114 Int_t GetPixelId(Int_t i ) ; 115 Bool_t IsPixelUsed(Int_t i ) ; 116 Float_t GetPhotons(Int_t i ) ; 117 Float_t GetErrorPhot(Int_t i ) ; 118 119 Float_t GetMinimumPhoton() ; 120 Float_t GetMaximumPhoton() ; 121 50 Float_t GetMinNumPhotons(); 51 Float_t GetMaxNumPhotons(); 52 53 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->At(i)); } 54 122 55 ClassDef(MCerPhotEvt, 1) // class for Nphotons Events 123 56 }; … … 125 58 #endif 126 59 127 -
trunk/MagicSoft/Mars/mbase/MAGIC.h
r609 r653 30 30 const Int_t kIRON = 5626; 31 31 32 const Double_t kPI = 3.1415926535897932384626433832795028841971693993751; 33 const Double_t kRad2Deg = 180.0/kPI; 34 32 35 // 33 36 // This is the definition of a global output stream, which by -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r602 r653 2 2 3 3 #include <math.h> 4 4 5 #include <TClonesArray.h> 5 6 #include <TCanvas.h> … … 9 10 10 11 #include "MHexagon.h" 11 #include "M CamGeom.h"12 #include "MGeomCam.h" 12 13 13 14 #include "MCerPhotEvt.h" 14 15 16 #define kITEMS_LEGEND 25 15 17 16 18 ClassImp(MCamDisplay) 17 19 18 MCamDisplay::MCamDisplay (Int_t type ) 20 MCamDisplay::MCamDisplay (Int_t type ) : fAutoScale(kTRUE) 19 21 { 20 // default constructor 21 22 // set the color palette 23 24 gStyle->SetPalette(1,0) ; 25 26 fAutoScale = kTRUE ; 27 28 MCamGeom *geometry = new MCamGeom( type ) ; 29 30 fNbPixels = geometry->GetNbPixels() ; 31 fPixels = new TClonesArray("MHexagon", fNbPixels ) ; 32 33 // create the hexagons of the display 34 35 TClonesArray &obj = *fPixels ; 36 37 for (Int_t i=0; i< fNbPixels; i++ ) 38 { 39 new (obj[i]) MHexagon(geometry->GetX(i) , 40 geometry->GetY(i) , 41 geometry->GetR(i) ) ; 42 } 43 44 // set the range to default 45 46 fMinPhe = -2. ; 47 fMaxPhe = 50. ; 48 49 // set up the Legend 50 51 fLegend = new TClonesArray("TBox", ITEMS_LEGEND ) ; 52 TClonesArray &obj1 = *fLegend ; 53 54 fLegText = new TClonesArray("TText", ITEMS_LEGEND ) ; 55 TClonesArray &obj2 = *fLegText ; 56 57 char text[100] ; 58 59 Float_t help ; 60 61 help = 50. / ITEMS_LEGEND ; 62 63 for ( Int_t il = 0 ; il < ITEMS_LEGEND ; il++ ) 64 { 65 new ( obj1[il] ) TBox(650, il*40-500 , 700, il*40-460 ) ; 66 ( (TBox*) fLegend->At(il))->SetFillColor( GetColor ( (Float_t) help*il) ) ; 67 68 sprintf ( text, "%5.1f", (Float_t) help * il ) ; 69 new ( obj2[il] ) TText(720, il*40-480, text ) ; 70 ( (TText*) fLegText->At(il))->SetTextSize (0.025) ; 71 ( (TText*) fLegText->At(il))->SetTextAlign(12) ; 72 } 73 } 22 // default constructor 23 24 // 25 // create a object which contains the camera geometry 26 // 27 MGeomCam geom(type) ; 28 29 // 30 // set the color palette 31 // 32 gStyle->SetPalette(1,0) ; 33 34 // 35 // create the hexagons of the display 36 // 37 fNbPixels = geom.GetNbPixels() ; 38 fPixels = new TClonesArray("MHexagon", fNbPixels ) ; 39 40 for (Int_t i=0; i< fNbPixels; i++ ) 41 { 42 (*fPixels)[i] = new MHexagon(geom[i]) ; 43 } 44 45 // 46 // set the range to default 47 // 48 fMinPhe = -2. ; 49 fMaxPhe = 50. ; 50 51 // 52 // set up the Legend 53 // 54 fLegend = new TClonesArray("TBox", kITEMS_LEGEND ) ; 55 fLegText = new TClonesArray("TText", kITEMS_LEGEND ) ; 56 57 char text[10] ; 58 for ( Int_t il = 0 ; il < kITEMS_LEGEND ; il++ ) 59 { 60 const Int_t y = il*40; 61 62 TBox *newbox = new TBox (650, y-500, 700, y-460 ); 63 TText *newtxt = new TText(720, y-480, text ); 64 65 const Float_t lvl = 50. / kITEMS_LEGEND * il; 66 67 newbox->SetFillColor( GetColor(lvl) ); 68 69 sprintf ( text, "%5.1f", lvl ) ; 70 71 newtxt->SetTextSize (0.025) ; 72 newtxt->SetTextAlign(12) ; 73 74 (*fLegend) [il] = newbox; 75 (*fLegText)[il] = newtxt; 76 } 77 } 74 78 75 79 MCamDisplay::~MCamDisplay() 76 80 { 77 delete fPixels ;78 } 81 delete fPixels ; 82 } 79 83 80 84 81 85 void MCamDisplay::Init() 82 86 { 83 84 // Set the right colors 85 86 gStyle->SetPalette(1, 0) ; 87 88 if ( ! gPad ) new TCanvas("display", "MAGIC display", 0, 0, 650, 500) ; 89 90 for (Int_t i=0; i< fNbPixels; i++) 91 { 92 ( (MHexagon*) fPixels->At(i))->Draw() ; 93 } 94 95 for (Int_t i=0; i< ITEMS_LEGEND; i++) 96 { 97 98 ( (TBox*) fLegend->At(i))->Draw() ; 99 100 ( (TText*) fLegText->At(i))->Draw() ; 101 } 102 87 // 88 // Set the right colors 89 // 90 gStyle->SetPalette(1, 0) ; 91 92 // 93 // if no canvas is yet existing to draw into, create a new one 94 // 95 if ( !gPad ) new TCanvas("display", "MAGIC display", 0, 0, 650, 500) ; 96 97 // 98 // draw all pixels of the camera 99 // 100 for (Int_t i=0; i< fNbPixels; i++) 101 (*this)[i].Draw(); 102 103 // 104 // draw legend 105 // 106 for (Int_t i=0; i< kITEMS_LEGEND; i++) 107 { 108 GetBox(i)->Draw(); 109 GetText(i)->Draw(); 110 } 103 111 } 104 112 … … 108 116 // 109 117 110 // check if there a pad exists 111 112 if ( ! gPad ) Init() ; 113 114 gPad->Range (-600, -600, 900, 600) ; 115 gPad->SetFillColor(22) ; 116 117 // 118 119 gPad->Modified() ; 120 gPad->Update() ; 121 122 //gPad->Update() ; 118 // 119 // check if there a pad exists, if not create one 120 // 121 if ( !gPad ) Init() ; 122 123 // 124 // set init values 125 // 126 gPad->Range (-600, -600, 900, 600) ; 127 gPad->SetFillColor(22) ; 128 129 // 130 // mark pad as modified and update screen 131 // 132 gPad->Modified() ; 133 gPad->Update() ; 123 134 } 124 135 125 void MCamDisplay::Draw( MCerPhotEvt *event) 126 { 127 128 // loop over all pixels in the MCerPhotEvt and 129 // determine the Pixel Id and the content 130 131 Reset() ; 132 133 // if the autoscale is true, set the values for the range for 134 // each event 135 136 if ( fAutoScale == kTRUE ) 137 { 138 fMinPhe = event->GetMinimumPhoton() ; 139 fMaxPhe = event->GetMaximumPhoton() ; 140 141 if ( fMaxPhe < 20. ) fMaxPhe = 20. ; 142 143 144 UpdateLegend() ; 145 } 146 147 // update the picture 148 149 for (Int_t i=0 ; i<event->GetNbPixels() ; i++ ) 150 { 151 if ( event->IsPixelUsed(i) == kTRUE ) 152 ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetPhotons(i))) ; 153 154 } 155 156 Draw() ; 157 136 void MCamDisplay::DrawPhotNum( MCerPhotEvt *event) 137 { 138 139 // 140 // loop over all pixels in the MCerPhotEvt and 141 // determine the Pixel Id and the content 142 // 143 Reset() ; 144 145 // 146 // if the autoscale is true, set the values for the range for 147 // each event 148 // 149 if ( fAutoScale ) 150 { 151 fMinPhe = event->GetMinNumPhotons() ; 152 fMaxPhe = event->GetMaxNumPhotons() ; 153 154 if (fMaxPhe < 20.) 155 fMaxPhe = 20. ; 156 157 UpdateLegend() ; 158 } 159 160 // 161 // update the colors in the picture 162 // 163 const Int_t entries = event->GetNbPixels(); 164 165 for (Int_t i=0 ; i<entries; i++ ) 166 { 167 MCerPhotPix &pix = (*event)[i]; 168 169 if (!pix.IsPixelUsed()) 170 continue; 171 172 SetPixColor(pix); 173 } 174 175 // 176 // update the picture 177 // 178 Draw() ; 158 179 } 159 180 160 void MCamDisplay::DrawError( MCerPhotEvt *event) 161 { 162 // 163 164 // loop over all pixels in the MCerPhotEvt and 165 // determine the Pixel Id and the content 166 Reset() ; 167 168 for (Int_t i=0 ; i<event->GetNbPixels() ; i++ ) 169 { 170 ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetErrorPhot(i)) ) ; 171 } 172 173 Draw() ; 174 181 void MCamDisplay::DrawPhotErr( MCerPhotEvt *event) 182 { 183 // 184 // reset the all pixel colors to a default value 185 // 186 Reset() ; 187 188 // 189 // loop over all pixels in the MCerPhotEvt and 190 // determine the Pixel Id and the content 191 // 192 const Int_t entries = event->GetNbPixels() ; 193 194 for (Int_t i=0 ; i<entries; i++ ) 195 { 196 MCerPhotPix &pix = (*event)[i]; 197 198 SetPixColor(pix); 199 } 200 201 // 202 // update display 203 // 204 Draw() ; 175 205 } 176 206 … … 178 208 void MCamDisplay::Reset() 179 209 { 180 for ( Int_t i=0 ; i< fNbPixels ; i++ )181 {182 ( (MHexagon*) fPixels->At(i))->SetFillColor(10) ;183 }184 210 // 211 // reset the all pixel colors to a default value 212 // 213 for ( Int_t i=0 ; i< fNbPixels ; i++ ) 214 (*this)[i].SetFillColor(10) ; 185 215 } 186 216 187 Int_t MCamDisplay::GetColor(Float_t wert )188 { 189 // Here we calculate the color index for the current value.190 // The color index is defined with the class TStyle and the191 // Color palette inside. We use the command gStyle->SetPalette(1,0)192 // for the display. So we have to convert the value "wert" into193 // a color index that fits the color palette.194 // The range of the color palette is defined by the values fMinPhe195 // and fMaxRange. Between this values we have 50 color index, starting196 // with 0 up to 49.197 //198 199 // first treat the over- and under-flows 200 201 if ( wert >= fMaxPhe )202 return gStyle->GetColorPalette( 49 ) ;203 204 if ( wert <= fMinPhe ) 205 return gStyle->GetColorPalette( 0 ) ;206 207 // calculate the color index 208 209 Int_t ColIndex ;210 211 ColIndex = (Int_t) wert ;212 213 ColIndex = (Int_t) ( .5 + ( (wert-fMinPhe) * 49. / (fMaxPhe-fMinPhe) ) ) ;214 215 return (gStyle->GetColorPalette(ColIndex) ) ;216 217 } 218 217 Int_t MCamDisplay::GetColor(Float_t val) 218 { 219 // 220 // Here we calculate the color index for the current value. 221 // The color index is defined with the class TStyle and the 222 // Color palette inside. We use the command gStyle->SetPalette(1,0) 223 // for the display. So we have to convert the value "wert" into 224 // a color index that fits the color palette. 225 // The range of the color palette is defined by the values fMinPhe 226 // and fMaxRange. Between this values we have 50 color index, starting 227 // with 0 up to 49. 228 // 229 230 // 231 // first treat the over- and under-flows 232 // 233 const Float_t maxcolidx = 49.0; 234 235 if (val >= fMaxPhe ) 236 return gStyle->GetColorPalette(maxcolidx); 237 238 if (val <= fMinPhe ) 239 return gStyle->GetColorPalette( 0 ); 240 241 // 242 // calculate the color index 243 // 244 const Float_t ratio = (val-fMinPhe) / (fMaxPhe-fMinPhe); 245 const Int_t colidx = (Int_t)(maxcolidx*ratio + .5) ; 246 247 return gStyle->GetColorPalette(colidx) ; 248 } 219 249 220 250 void MCamDisplay::UpdateLegend() 221 { 222 // change the text on the legend according to the range of the 223 // Display 224 225 char text[100] ; 226 227 Float_t x, y, wert, help ; 228 229 help = 50./ITEMS_LEGEND ; 230 231 for (Int_t il=0; il < ITEMS_LEGEND; il++) 232 { 233 wert = fMinPhe + (il*help)/50 * (fMaxPhe-fMinPhe) ; 234 235 sprintf ( text, "%5.1f", wert ) ; 236 237 x = ( (TText*) fLegText->At(il))->GetX () ; 238 y = ( (TText*) fLegText->At(il))->GetY () ; 239 ( (TText*) fLegText->At(il))->SetText (x, y, text ) ; 240 } 241 242 } 251 { 252 // 253 // change the text on the legend according to the range of the 254 // Display 255 // 256 257 char text[10] ; 258 259 for (Int_t il=0; il < kITEMS_LEGEND; il++) 260 { 261 const Float_t val = fMinPhe + (Float_t)il/kITEMS_LEGEND * (fMaxPhe-fMinPhe) ; 262 263 sprintf(text, "%5.1f", val); 264 265 TText &txt = *GetText(il); 266 267 txt.SetText(txt.GetX(), txt.GetY(), text) ; 268 } 269 } -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r602 r653 2 2 #define MCAMDISPLAY_H 3 3 4 #include <iostream> 4 #ifndef MAGIC_H 5 #include "MAGIC.h" 6 #endif 7 #ifndef MHEXAGON_H 8 #include "MHexagon.h" 9 #endif 10 #ifndef MCERPHOTPIX_H 11 #include "MCerPhotPix.h" 12 #endif 13 #ifndef MCERPHOTEVT_H 14 #include "MCerPhotEvt.h" 15 #endif 16 #ifndef ROOT_TClonesArray 17 #include <TClonesArray.h> 18 #endif 5 19 6 #include "MAGIC.h" 7 8 #define ITEMS_LEGEND 25 9 10 class TClonesArray ; 11 class MCerPhotEvt ; 20 class TClonesArray ; 21 class MCerPhotEvt ; 22 class TBox; 23 class TText; 12 24 13 25 class MCamDisplay : public TObject 14 26 { 15 27 private: 16 Bool_t fAutoScale ; //indicating the autoscale function28 Bool_t fAutoScale ; //! indicating the autoscale function 17 29 18 Int_t fNbPixels ; //19 TClonesArray *fPixels ; //!30 Int_t fNbPixels ; //! 31 TClonesArray *fPixels ; //! 20 32 21 Float_t fMinPhe ; //The minimal number of Phe22 Float_t fMaxPhe ; // The maximum number of Phe33 Float_t fMinPhe ; //! The minimal number of Phe 34 Float_t fMaxPhe ; //! The maximum number of Phe 23 35 24 36 TClonesArray *fLegend ; //! 25 37 TClonesArray *fLegText ; //! 38 39 TBox *GetBox(Int_t i) { return (TBox*) fLegend->At(i); } 40 TText *GetText(Int_t i) { return (TText*)fLegText->At(i); } 41 42 void SetPixColor(MCerPhotPix &pix) 43 { 44 (*this)[pix.GetPixId()].SetFillColor( GetColor(pix.GetNumPhotons())); 45 } 26 46 27 47 public: … … 35 55 void Draw(Option_t *option = "" ) ; 36 56 37 void Draw ( MCerPhotEvt *event) ;38 void Draw Error( MCerPhotEvt *event) ;57 void DrawPhotNum( MCerPhotEvt *event) ; 58 void DrawPhotErr( MCerPhotEvt *event) ; 39 59 40 60 void Reset() ; 61 62 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 41 63 42 64 Int_t GetColor( Float_t wert ) ; … … 49 71 } 50 72 51 //Int_t GetNbPixels() ; 52 53 ClassDef(MCamDisplay, 1) // Base (abstract) class for a task 73 ClassDef(MCamDisplay, 1) // Display the magic camera 54 74 }; 55 75 -
trunk/MagicSoft/Mars/mgui/MCamNeighbor.cc
r603 r653 1 1 #include "MCamNeighbor.h" 2 2 3 #include <stdlib.h>4 5 ClassImp(MCamNeighbor) 3 #include "MLog.h" 4 5 ClassImp(MCamNeighbor) 6 6 7 7 MCamNeighbor::MCamNeighbor() … … 341 341 { 269, 270, 328, 330, 394, 395} , 342 342 { 217, 270, 271, 329, 395, 396} , 343 { 271, 332, 396, 397, 432, - 9999} ,344 { 271, 272, 331, 333, 397, - 9999} ,345 { 272, 273, 332, 334, 398, - 9999} ,346 { 273, 274, 333, 335, 398, - 9999} ,347 { 274, 275, 334, 336, 399, - 9999} ,348 { 275, 276, 335, 337, 399, - 9999} ,349 { 276, 277, 336, 338, 400, - 9999} ,350 { 277, 278, 337, 339, 400, - 9999} ,351 { 278, 279, 338, 340, 401, - 9999} ,352 { 279, 280, 339, 341, 401, - 9999} ,353 { 280, 281, 340, 342, 402, - 9999} ,354 { 281, 341, 343, 402, 403, - 9999} ,355 { 281, 282, 342, 344, 403, - 9999} ,356 { 282, 283, 343, 345, 404, - 9999} ,357 { 283, 284, 344, 346, 404, - 9999} ,358 { 284, 285, 345, 347, 405, - 9999} ,359 { 285, 286, 346, 348, 405, - 9999} ,360 { 286, 287, 347, 349, 406, - 9999} ,361 { 287, 288, 348, 350, 406, - 9999} ,362 { 288, 289, 349, 351, 407, - 9999} ,363 { 289, 290, 350, 352, 407, - 9999} ,364 { 290, 291, 351, 353, 408, - 9999} ,365 { 291, 352, 354, 408, 409, - 9999} ,366 { 291, 292, 353, 355, 409, - 9999} ,367 { 292, 293, 354, 356, 410, - 9999} ,368 { 293, 294, 355, 357, 410, - 9999} ,369 { 294, 295, 356, 358, 411, - 9999} ,370 { 295, 296, 357, 359, 411, - 9999} ,371 { 296, 297, 358, 360, 412, - 9999} ,372 { 297, 298, 359, 361, 412, - 9999} ,373 { 298, 299, 360, 362, 413, - 9999} ,374 { 299, 300, 361, 363, 413, - 9999} ,375 { 300, 301, 362, 364, 414, - 9999} ,376 { 301, 363, 365, 414, 415, - 9999} ,377 { 301, 302, 364, 366, 415, - 9999} ,378 { 302, 303, 365, 367, 416, - 9999} ,379 { 303, 304, 366, 368, 416, - 9999} ,380 { 304, 305, 367, 369, 417, - 9999} ,381 { 305, 306, 368, 370, 417, - 9999} ,382 { 306, 307, 369, 371, 418, - 9999} ,383 { 307, 308, 370, 372, 418, - 9999} ,384 { 308, 309, 371, 373, 419, - 9999} ,385 { 309, 310, 372, 374, 419, - 9999} ,386 { 310, 311, 373, 375, 420, - 9999} ,387 { 311, 374, 376, 420, 421, - 9999} ,388 { 311, 312, 375, 377, 421, - 9999} ,389 { 312, 313, 376, 378, 422, - 9999} ,390 { 313, 314, 377, 379, 422, - 9999} ,391 { 314, 315, 378, 380, 423, - 9999} ,392 { 315, 316, 379, 381, 423, - 9999} ,393 { 316, 317, 380, 382, 424, - 9999} ,394 { 317, 318, 381, 383, 424, - 9999} ,395 { 318, 319, 382, 384, 425, - 9999} ,396 { 319, 320, 383, 385, 425, - 9999} ,397 { 320, 321, 384, 386, 426, - 9999} ,398 { 321, 385, 387, 426, 427, - 9999} ,399 { 321, 322, 386, 388, 427, - 9999} ,400 { 322, 323, 387, 389, 428, - 9999} ,401 { 323, 324, 388, 390, 428, - 9999} ,402 { 324, 325, 389, 391, 429, - 9999} ,403 { 325, 326, 390, 392, 429, - 9999} ,404 { 326, 327, 391, 393, 430, - 9999} ,405 { 327, 328, 392, 394, 430, - 9999} ,406 { 328, 329, 393, 395, 431, - 9999} ,407 { 329, 330, 394, 396, 431, - 9999} ,408 { 271, 330, 331, 395, 432, - 9999} ,343 { 271, 332, 396, 397, 432, -1} , 344 { 271, 272, 331, 333, 397, -1} , 345 { 272, 273, 332, 334, 398, -1} , 346 { 273, 274, 333, 335, 398, -1} , 347 { 274, 275, 334, 336, 399, -1} , 348 { 275, 276, 335, 337, 399, -1} , 349 { 276, 277, 336, 338, 400, -1} , 350 { 277, 278, 337, 339, 400, -1} , 351 { 278, 279, 338, 340, 401, -1} , 352 { 279, 280, 339, 341, 401, -1} , 353 { 280, 281, 340, 342, 402, -1} , 354 { 281, 341, 343, 402, 403, -1} , 355 { 281, 282, 342, 344, 403, -1} , 356 { 282, 283, 343, 345, 404, -1} , 357 { 283, 284, 344, 346, 404, -1} , 358 { 284, 285, 345, 347, 405, -1} , 359 { 285, 286, 346, 348, 405, -1} , 360 { 286, 287, 347, 349, 406, -1} , 361 { 287, 288, 348, 350, 406, -1} , 362 { 288, 289, 349, 351, 407, -1} , 363 { 289, 290, 350, 352, 407, -1} , 364 { 290, 291, 351, 353, 408, -1} , 365 { 291, 352, 354, 408, 409, -1} , 366 { 291, 292, 353, 355, 409, -1} , 367 { 292, 293, 354, 356, 410, -1} , 368 { 293, 294, 355, 357, 410, -1} , 369 { 294, 295, 356, 358, 411, -1} , 370 { 295, 296, 357, 359, 411, -1} , 371 { 296, 297, 358, 360, 412, -1} , 372 { 297, 298, 359, 361, 412, -1} , 373 { 298, 299, 360, 362, 413, -1} , 374 { 299, 300, 361, 363, 413, -1} , 375 { 300, 301, 362, 364, 414, -1} , 376 { 301, 363, 365, 414, 415, -1} , 377 { 301, 302, 364, 366, 415, -1} , 378 { 302, 303, 365, 367, 416, -1} , 379 { 303, 304, 366, 368, 416, -1} , 380 { 304, 305, 367, 369, 417, -1} , 381 { 305, 306, 368, 370, 417, -1} , 382 { 306, 307, 369, 371, 418, -1} , 383 { 307, 308, 370, 372, 418, -1} , 384 { 308, 309, 371, 373, 419, -1} , 385 { 309, 310, 372, 374, 419, -1} , 386 { 310, 311, 373, 375, 420, -1} , 387 { 311, 374, 376, 420, 421, -1} , 388 { 311, 312, 375, 377, 421, -1} , 389 { 312, 313, 376, 378, 422, -1} , 390 { 313, 314, 377, 379, 422, -1} , 391 { 314, 315, 378, 380, 423, -1} , 392 { 315, 316, 379, 381, 423, -1} , 393 { 316, 317, 380, 382, 424, -1} , 394 { 317, 318, 381, 383, 424, -1} , 395 { 318, 319, 382, 384, 425, -1} , 396 { 319, 320, 383, 385, 425, -1} , 397 { 320, 321, 384, 386, 426, -1} , 398 { 321, 385, 387, 426, 427, -1} , 399 { 321, 322, 386, 388, 427, -1} , 400 { 322, 323, 387, 389, 428, -1} , 401 { 323, 324, 388, 390, 428, -1} , 402 { 324, 325, 389, 391, 429, -1} , 403 { 325, 326, 390, 392, 429, -1} , 404 { 326, 327, 391, 393, 430, -1} , 405 { 327, 328, 392, 394, 430, -1} , 406 { 328, 329, 393, 395, 431, -1} , 407 { 329, 330, 394, 396, 431, -1} , 408 { 271, 330, 331, 395, 432, -1} , 409 409 { 331, 332, 398, 432, 433, 434} , 410 { 333, 334, 397, 399, 434, - 9999} ,411 { 335, 336, 400, 435, 436, - 9999} ,412 { 337, 338, 399, 401, 437, - 9999} ,413 { 339, 340, 400, 402, 438, - 9999} ,410 { 333, 334, 397, 399, 434, -1} , 411 { 335, 336, 400, 435, 436, -1} , 412 { 337, 338, 399, 401, 437, -1} , 413 { 339, 340, 400, 402, 438, -1} , 414 414 { 341, 342, 401, 403, 438, 439} , 415 415 { 342, 343, 402, 404, 440, 441} , 416 { 344, 345, 403, 441, 442, - 9999} ,417 { 346, 347, 404, 442, 443, - 9999} ,418 { 348, 349, 405, 443, 444, - 9999} ,419 { 350, 351, 406, 444, 445, - 9999} ,416 { 344, 345, 403, 441, 442, -1} , 417 { 346, 347, 404, 442, 443, -1} , 418 { 348, 349, 405, 443, 444, -1} , 419 { 350, 351, 406, 444, 445, -1} , 420 420 { 352, 353, 407, 409, 445, 446} , 421 421 { 353, 354, 408, 410, 447, 448} , 422 { 355, 356, 409, 411, 448, - 9999} ,423 { 357, 358, 410, 412, 449, - 9999} ,424 { 359, 360, 411, 450, 451, - 9999} ,425 { 361, 362, 412, 414, 452, - 9999} ,422 { 355, 356, 409, 411, 448, -1} , 423 { 357, 358, 410, 412, 449, -1} , 424 { 359, 360, 411, 450, 451, -1} , 425 { 361, 362, 412, 414, 452, -1} , 426 426 { 363, 364, 413, 415, 452, 453} , 427 427 { 364, 365, 414, 416, 454, 455} , 428 { 366, 367, 415, 417, 455, - 9999} ,429 { 368, 369, 418, 456, 457, - 9999} ,430 { 370, 371, 417, 419, 458, - 9999} ,431 { 372, 373, 418, 420, 459, - 9999} ,428 { 366, 367, 415, 417, 455, -1} , 429 { 368, 369, 418, 456, 457, -1} , 430 { 370, 371, 417, 419, 458, -1} , 431 { 372, 373, 418, 420, 459, -1} , 432 432 { 374, 375, 419, 421, 459, 460} , 433 433 { 375, 376, 420, 422, 461, 462} , 434 { 377, 378, 421, 462, 463, - 9999} ,435 { 379, 380, 422, 463, 464, - 9999} ,436 { 381, 382, 423, 464, 465, - 9999} ,437 { 383, 384, 424, 465, 466, - 9999} ,434 { 377, 378, 421, 462, 463, -1} , 435 { 379, 380, 422, 463, 464, -1} , 436 { 381, 382, 423, 464, 465, -1} , 437 { 383, 384, 424, 465, 466, -1} , 438 438 { 385, 386, 425, 427, 466, 467} , 439 439 { 386, 387, 426, 428, 468, 469} , 440 { 388, 389, 427, 429, 469, - 9999} ,441 { 390, 391, 428, 430, 470, - 9999} ,442 { 392, 393, 429, 471, 472, - 9999} ,443 { 394, 395, 430, 432, 473, - 9999} ,440 { 388, 389, 427, 429, 469, -1} , 441 { 390, 391, 428, 430, 470, -1} , 442 { 392, 393, 429, 471, 472, -1} , 443 { 394, 395, 430, 432, 473, -1} , 444 444 { 331, 396, 397, 431, 473, 474} , 445 { 397, 434, 474, 475, 476, - 9999} ,445 { 397, 434, 474, 475, 476, -1} , 446 446 { 397, 398, 433, 435, 476, 477} , 447 447 { 398, 399, 434, 436, 477, 478} , … … 449 449 { 400, 401, 436, 438, 479, 480} , 450 450 { 401, 402, 437, 439, 480, 481} , 451 { 402, 438, 440, 481, 482, - 9999} ,452 { 403, 439, 441, 483, 484, - 9999} ,451 { 402, 438, 440, 481, 482, -1} , 452 { 403, 439, 441, 483, 484, -1} , 453 453 { 403, 404, 440, 442, 484, 485} , 454 454 { 404, 405, 441, 443, 485, 486} , … … 456 456 { 406, 407, 443, 445, 487, 488} , 457 457 { 407, 408, 444, 446, 488, 489} , 458 { 408, 445, 447, 489, 490, - 9999} ,459 { 409, 446, 448, 491, 492, - 9999} ,458 { 408, 445, 447, 489, 490, -1} , 459 { 409, 446, 448, 491, 492, -1} , 460 460 { 409, 410, 447, 449, 492, 493} , 461 461 { 410, 411, 448, 450, 493, 494} , … … 463 463 { 412, 413, 450, 452, 495, 496} , 464 464 { 413, 414, 451, 453, 496, 497} , 465 { 414, 452, 454, 497, 498, - 9999} ,466 { 415, 453, 455, 499, 500, - 9999} ,465 { 414, 452, 454, 497, 498, -1} , 466 { 415, 453, 455, 499, 500, -1} , 467 467 { 415, 416, 454, 456, 500, 501} , 468 468 { 416, 417, 455, 457, 501, 502} , … … 470 470 { 418, 419, 457, 459, 503, 504} , 471 471 { 419, 420, 458, 460, 504, 505} , 472 { 420, 459, 461, 505, 506, - 9999} ,473 { 421, 460, 462, 507, 508, - 9999} ,472 { 420, 459, 461, 505, 506, -1} , 473 { 421, 460, 462, 507, 508, -1} , 474 474 { 421, 422, 461, 463, 508, 509} , 475 475 { 422, 423, 462, 464, 509, 510} , … … 477 477 { 424, 425, 464, 466, 511, 512} , 478 478 { 425, 426, 465, 467, 512, 513} , 479 { 426, 466, 468, 513, 514, - 9999} ,480 { 427, 467, 469, 515, 516, - 9999} ,479 { 426, 466, 468, 513, 514, -1} , 480 { 427, 467, 469, 515, 516, -1} , 481 481 { 427, 428, 468, 470, 516, 517} , 482 482 { 428, 429, 469, 471, 517, 518} , … … 484 484 { 430, 431, 471, 473, 519, 520} , 485 485 { 431, 432, 472, 474, 520, 521} , 486 { 432, 433, 473, 521, 522, - 9999} ,487 { 433, 476, 522, 523, 524, - 9999} ,486 { 432, 433, 473, 521, 522, -1} , 487 { 433, 476, 522, 523, 524, -1} , 488 488 { 433, 434, 475, 477, 524, 525} , 489 489 { 434, 435, 476, 478, 525, 526} , … … 492 492 { 437, 438, 479, 481, 528, 529} , 493 493 { 438, 439, 480, 482, 529, 530} , 494 { 439, 481, 483, 530, 531, - 9999} ,495 { 440, 482, 484, 532, 533, - 9999} ,494 { 439, 481, 483, 530, 531, -1} , 495 { 440, 482, 484, 532, 533, -1} , 496 496 { 440, 441, 483, 485, 533, 534} , 497 497 { 441, 442, 484, 486, 534, 535} , … … 500 500 { 444, 445, 487, 489, 537, 538} , 501 501 { 445, 446, 488, 490, 538, 539} , 502 { 446, 489, 491, 539, 540, - 9999} ,503 { 447, 490, 492, 541, 542, - 9999} ,502 { 446, 489, 491, 539, 540, -1} , 503 { 447, 490, 492, 541, 542, -1} , 504 504 { 447, 448, 491, 493, 542, 543} , 505 505 { 448, 449, 492, 494, 543, 544} , … … 508 508 { 451, 452, 495, 497, 546, 547} , 509 509 { 452, 453, 496, 498, 547, 548} , 510 { 453, 497, 499, 548, 549, - 9999} ,511 { 454, 498, 500, 550, 551, - 9999} ,510 { 453, 497, 499, 548, 549, -1} , 511 { 454, 498, 500, 550, 551, -1} , 512 512 { 454, 455, 499, 501, 551, 552} , 513 513 { 455, 456, 500, 502, 552, 553} , … … 516 516 { 458, 459, 503, 505, 555, 556} , 517 517 { 459, 460, 504, 506, 556, 557} , 518 { 460, 505, 507, 557, 558, - 9999} ,519 { 461, 506, 508, 559, 560, - 9999} ,518 { 460, 505, 507, 557, 558, -1} , 519 { 461, 506, 508, 559, 560, -1} , 520 520 { 461, 462, 507, 509, 560, 561} , 521 521 { 462, 463, 508, 510, 561, 562} , … … 524 524 { 465, 466, 511, 513, 564, 565} , 525 525 { 466, 467, 512, 514, 565, 566} , 526 { 467, 513, 515, 566, 567, - 9999} ,527 { 468, 514, 516, 568, 569, - 9999} ,526 { 467, 513, 515, 566, 567, -1} , 527 { 468, 514, 516, 568, 569, -1} , 528 528 { 468, 469, 515, 517, 569, 570} , 529 529 { 469, 470, 516, 518, 570, 571} , … … 532 532 { 472, 473, 519, 521, 573, 574} , 533 533 { 473, 474, 520, 522, 574, 575} , 534 { 474, 475, 521, 575, 576, -9999} , 535 { 475, 524, 576, -9999, -9999, -9999} , 536 { 475, 476, 523, 525, -9999, -9999} , 537 { 476, 477, 524, 526, -9999, -9999} , 538 { 477, 478, 525, 527, -9999, -9999} , 539 { 478, 479, 526, 528, -9999, -9999} , 540 { 479, 480, 527, 529, -9999, -9999} , 541 { 480, 481, 528, 530, -9999, -9999} , 542 { 481, 482, 529, 531, -9999, -9999} , 543 { 482, 530, 532, -9999, -9999, -9999} , 544 { 483, 531, 533, -9999, -9999, -9999} , 545 { 483, 484, 532, 534, -9999, -9999} , 546 { 484, 485, 533, 535, -9999, -9999} , 547 { 485, 486, 534, 536, -9999, -9999} , 548 { 486, 487, 535, 537, -9999, -9999} , 549 { 487, 488, 536, 538, -9999, -9999} , 550 { 488, 489, 537, 539, -9999, -9999} , 551 { 489, 490, 538, 540, -9999, -9999} , 552 { 490, 539, 541, -9999, -9999, -9999} , 553 { 491, 540, 542, -9999, -9999, -9999} , 554 { 491, 492, 541, 543, -9999, -9999} , 555 { 492, 493, 542, 544, -9999, -9999} , 556 { 493, 494, 543, 545, -9999, -9999} , 557 { 494, 495, 544, 546, -9999, -9999} , 558 { 495, 496, 545, 547, -9999, -9999} , 559 { 496, 497, 546, 548, -9999, -9999} , 560 { 497, 498, 547, 549, -9999, -9999} , 561 { 498, 548, 550, -9999, -9999, -9999} , 562 { 499, 549, 551, -9999, -9999, -9999} , 563 { 499, 500, 550, 552, -9999, -9999} , 564 { 500, 501, 551, 553, -9999, -9999} , 565 { 501, 502, 552, 554, -9999, -9999} , 566 { 502, 503, 553, 555, -9999, -9999} , 567 { 503, 504, 554, 556, -9999, -9999} , 568 { 504, 505, 555, 557, -9999, -9999} , 569 { 505, 506, 556, 558, -9999, -9999} , 570 { 506, 557, 559, -9999, -9999, -9999} , 571 { 507, 558, 560, -9999, -9999, -9999} , 572 { 507, 508, 559, 561, -9999, -9999} , 573 { 508, 509, 560, 562, -9999, -9999} , 574 { 509, 510, 561, 563, -9999, -9999} , 575 { 510, 511, 562, 564, -9999, -9999} , 576 { 511, 512, 563, 565, -9999, -9999} , 577 { 512, 513, 564, 566, -9999, -9999} , 578 { 513, 514, 565, 567, -9999, -9999} , 579 { 514, 566, 568, -9999, -9999, -9999} , 580 { 515, 567, 569, -9999, -9999, -9999} , 581 { 515, 516, 568, 570, -9999, -9999} , 582 { 516, 517, 569, 571, -9999, -9999} , 583 { 517, 518, 570, 572, -9999, -9999} , 584 { 518, 519, 571, 573, -9999, -9999} , 585 { 519, 520, 572, 574, -9999, -9999} , 586 { 520, 521, 573, 575, -9999, -9999} , 587 { 521, 522, 574, 576, -9999, -9999} , 588 { 522, 523, 575, -9999, -9999, -9999} } ; 589 534 { 474, 475, 521, 575, 576, -1} , 535 { 475, 524, 576, -1, -1, -1} , 536 { 475, 476, 523, 525, -1, -1} , 537 { 476, 477, 524, 526, -1, -1} , 538 { 477, 478, 525, 527, -1, -1} , 539 { 478, 479, 526, 528, -1, -1} , 540 { 479, 480, 527, 529, -1, -1} , 541 { 480, 481, 528, 530, -1, -1} , 542 { 481, 482, 529, 531, -1, -1} , 543 { 482, 530, 532, -1, -1, -1} , 544 { 483, 531, 533, -1, -1, -1} , 545 { 483, 484, 532, 534, -1, -1} , 546 { 484, 485, 533, 535, -1, -1} , 547 { 485, 486, 534, 536, -1, -1} , 548 { 486, 487, 535, 537, -1, -1} , 549 { 487, 488, 536, 538, -1, -1} , 550 { 488, 489, 537, 539, -1, -1} , 551 { 489, 490, 538, 540, -1, -1} , 552 { 490, 539, 541, -1, -1, -1} , 553 { 491, 540, 542, -1, -1, -1} , 554 { 491, 492, 541, 543, -1, -1} , 555 { 492, 493, 542, 544, -1, -1} , 556 { 493, 494, 543, 545, -1, -1} , 557 { 494, 495, 544, 546, -1, -1} , 558 { 495, 496, 545, 547, -1, -1} , 559 { 496, 497, 546, 548, -1, -1} , 560 { 497, 498, 547, 549, -1, -1} , 561 { 498, 548, 550, -1, -1, -1} , 562 { 499, 549, 551, -1, -1, -1} , 563 { 499, 500, 550, 552, -1, -1} , 564 { 500, 501, 551, 553, -1, -1} , 565 { 501, 502, 552, 554, -1, -1} , 566 { 502, 503, 553, 555, -1, -1} , 567 { 503, 504, 554, 556, -1, -1} , 568 { 504, 505, 555, 557, -1, -1} , 569 { 505, 506, 556, 558, -1, -1} , 570 { 506, 557, 559, -1, -1, -1} , 571 { 507, 558, 560, -1, -1, -1} , 572 { 507, 508, 559, 561, -1, -1} , 573 { 508, 509, 560, 562, -1, -1} , 574 { 509, 510, 561, 563, -1, -1} , 575 { 510, 511, 562, 564, -1, -1} , 576 { 511, 512, 563, 565, -1, -1} , 577 { 512, 513, 564, 566, -1, -1} , 578 { 513, 514, 565, 567, -1, -1} , 579 { 514, 566, 568, -1, -1, -1} , 580 { 515, 567, 569, -1, -1, -1} , 581 { 515, 516, 568, 570, -1, -1} , 582 { 516, 517, 569, 571, -1, -1} , 583 { 517, 518, 570, 572, -1, -1} , 584 { 518, 519, 571, 573, -1, -1} , 585 { 519, 520, 572, 574, -1, -1} , 586 { 520, 521, 573, 575, -1, -1} , 587 { 521, 522, 574, 576, -1, -1} , 588 { 522, 523, 575, -1, -1, -1} } ; 590 589 591 590 for (Int_t ip=0; ip<577; ip++) 592 for (Int_t in=0; in<6; in++) 593 fNN[ip][in] = help[ip][in] ; 594 595 591 for (Int_t in=0; in<6; in++) 592 fNN[ip][in] = help[ip][in]; 596 593 } 597 594 598 Int_t MCamNeighbor::GetNN(Int_t pix, Int_t inn )595 Int_t MCamNeighbor::GetNN(Int_t pix, Int_t inn) 599 596 { 600 // return the number of one neighbor 601 602 if ( pix >= 577 ) { 603 cout << "ERROR GetNN -> pixel out of range" << endl ; 604 exit (123) ; 605 } 606 607 if ( inn >= 6 ) { 608 cout << "ERROR GetNN -> not more than 6 neighbors" << endl ; 609 exit (123) ; 610 } 611 612 return fNN[pix][inn] ; 597 // return the number of one neighbor 598 599 if ( pix >= 577 ) 600 { 601 gLog << "WARNING: GetNN -> pixel out of range" << endl; 602 return -1; 603 } 604 605 if ( inn >= 6 ) 606 { 607 gLog << "WARNING: GetNN -> not more than 6 neighbors" << endl; 608 return -1; 609 } 610 611 return fNN[pix][inn] ; 613 612 } 614 613 615 614 void MCamNeighbor::CheckPixel(Int_t pix) 616 615 { 617 cout << " Pixel " << pix << " has neighbors " ; 618 for (Int_t i=0; i<6; i++ ) 619 cout << fNN[pix][i] << "/" ; 620 cout << endl ; 621 616 gLog << " Pixel " << pix << " has neighbors " ; 617 618 gLog << fNN[pix][0]; 619 620 for (Int_t i=1; i<6; i++ ) 621 if (fNN[pix][i] >= 0) 622 gLog << ", " << fNN[pix][i]; 623 624 gLog << endl ; 625 622 626 } 623 627 624 void MCamNeighbor::Print( )628 void MCamNeighbor::Print(Option_t *) 625 629 { 626 for (Int_t i=0; i<577; i++ ) { 627 628 cout << " Pixel " << i ; 629 630 for (Int_t j=0; j<6; j++ ) { 631 cout << " ->" << fNN[i][j] ; 632 } 633 cout << endl ; 634 635 } 630 for (Int_t i=0; i<577; i++ ) 631 { 632 gLog << " Pixel " << i << ":"; 633 634 for (Int_t j=0; j<6; j++ ) 635 gLog << " " << fNN[i][j]; 636 637 gLog << endl; 638 } 636 639 } -
trunk/MagicSoft/Mars/mgui/MCamNeighbor.h
r597 r653 2 2 #define MCAMNEIGHBOR_H 3 3 4 #include <iostream> 5 4 #ifndef MAGIC_H 6 5 #include "MAGIC.h" 6 #endif 7 7 8 8 class MCamNeighbor … … 18 18 Int_t GetNN(Int_t pix, Int_t inn) ; 19 19 void CheckPixel(Int_t pix) ; 20 void Print( ) ;20 void Print(Option_t *opt=NULL) ; 21 21 22 ClassDef(MCamNeighbor, 1) //22 ClassDef(MCamNeighbor, 1) // Conatins the neighbors in the magic camera 23 23 } ; 24 24 -
trunk/MagicSoft/Mars/mgui/MHexagon.cc
r589 r653 1 #include <stdlib.h> 2 #include <fstream.h> 3 #include <iostream.h> 4 5 #include "TROOT.h" 6 #include "TVirtualPad.h" 7 #include "TMath.h" 8 9 #include "MHexagon.h" 10 1 // 2 // The class MHexagon is needed for the Event Display of 3 // MAGIC. 4 // 5 #include "MHexagon.h" 6 7 #include <TVirtualPad.h> // gPad 8 9 #include "MGeomPix.h" // GetX 11 10 12 11 ClassImp(MHexagon) 13 12 14 // 15 // The class MHexagon is needed for the Event Display of 16 // MAGIC. 17 18 19 20 MHexagon::MHexagon() : TObject(), TAttLine(), TAttFill() 13 MHexagon::MHexagon() 21 14 { 22 15 // default constructor for MHexagon … … 24 17 } 25 18 26 MHexagon::MHexagon(Float_t x, Float_t y, Float_t d ) : TObject(), TAttLine(), TAttFill(0, 1001) 19 MHexagon::MHexagon(Float_t x, Float_t y, Float_t d ) 20 : TAttFill(0, 1001), fX(x), fY(y), fD(d) 27 21 { 28 22 // normal constructor for MHexagon 29 fX = x ; 30 fY = y ; 31 fD = d ; 32 33 } 23 } 24 25 MHexagon::MHexagon(MGeomPix &pix) 26 : TAttFill(0, 1001) 27 { 28 // normal constructor for MHexagon 29 fX = pix.GetX(); 30 fY = pix.GetY(); 31 fD = pix.GetR(); 32 } 33 34 34 MHexagon::MHexagon( const MHexagon &hexagon) 35 35 { … … 41 41 { 42 42 // default destructor for MHexagon 43 44 43 } 45 44 … … 47 46 { 48 47 // copy this hexagon to hexagon 49 50 TObject::Copy ( obj ) ; 51 TAttLine::Copy (((MHexagon&) obj ) ) ; 52 TAttFill::Copy (((MHexagon&) obj ) ) ; 53 54 ((MHexagon&) obj).fX = fX ; 55 ((MHexagon&) obj).fY = fY ; 56 ((MHexagon&) obj).fD = fD ; 57 } 58 Int_t MHexagon::DistancetoPrimitive( Int_t px, Int_t py ) 59 { 60 // compute the distance of a point (px,py) to the Hexagon 61 // this functions needed for graphical primitives, that 62 // means without this function you are not able to interact 63 // with the graphical primitive with the mouse!!! 64 // 65 // All calcutations are running in pixel coordinates 66 67 // compute the distance of the Point to the center of the Hexagon 68 69 Int_t pxhex = gPad->XtoAbsPixel( fX ) ; 70 Int_t pyhex = gPad->YtoAbsPixel( fY ) ; 71 72 Double_t DistPointHexagon = TMath::Sqrt( Double_t ((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py))) ; 73 Double_t cosa = TMath::Abs(px-pxhex) / DistPointHexagon ; 74 Double_t sina = TMath::Abs(py-pyhex) / DistPointHexagon ; 48 TObject::Copy ( obj ) ; 49 TAttLine::Copy (((MHexagon&) obj ) ) ; 50 TAttFill::Copy (((MHexagon&) obj ) ) ; 51 52 ((MHexagon&) obj).fX = fX ; 53 ((MHexagon&) obj).fY = fY ; 54 ((MHexagon&) obj).fD = fD ; 55 } 56 Int_t MHexagon::DistancetoPrimitive( Int_t px, Int_t py ) 57 { 58 // compute the distance of a point (px,py) to the Hexagon 59 // this functions needed for graphical primitives, that 60 // means without this function you are not able to interact 61 // with the graphical primitive with the mouse!!! 62 // 63 // All calcutations are running in pixel coordinates 64 65 // compute the distance of the Point to the center of the Hexagon 66 67 const Int_t pxhex = gPad->XtoAbsPixel( fX ) ; 68 const Int_t pyhex = gPad->YtoAbsPixel( fY ) ; 69 70 const Double_t DistPointHexagon = TMath::Sqrt( Double_t ((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py))) ; 71 const Double_t cosa = TMath::Abs(px-pxhex) / DistPointHexagon ; 72 const Double_t sina = TMath::Abs(py-pyhex) / DistPointHexagon ; 75 73 76 74 // comput the distance to pixel border 77 75 78 Double_t dx = fD * cosa / 2 ;79 Double_t dy = fD * sina / 2 ;80 81 Double_t xborder = fX + dx ;82 Double_t yborder = fY + dy ;83 84 Int_t pxborder = gPad->XtoAbsPixel( xborder ) ;85 Int_t pyborder = gPad->YtoAbsPixel( yborder ) ;86 87 Double_t DistBorderHexagon = TMath::Sqrt( Double_t ((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex))) ;76 const Double_t dx = fD * cosa / 2 ; 77 const Double_t dy = fD * sina / 2 ; 78 79 const Double_t xborder = fX + dx ; 80 const Double_t yborder = fY + dy ; 81 82 const Int_t pxborder = gPad->XtoAbsPixel( xborder ) ; 83 const Int_t pyborder = gPad->YtoAbsPixel( yborder ) ; 84 85 const Double_t DistBorderHexagon = TMath::Sqrt( Double_t ((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex))) ; 88 86 89 87 … … 91 89 // here in the first implementation is just circle inside 92 90 93 if ( DistBorderHexagon < DistPointHexagon ) 94 return 999999 ; 95 else 96 // return Int_t ( DistBorderHexagon - DistPointHexagon ) ; 97 return 0 ; 91 return DistBorderHexagon < DistPointHexagon ? 999999 : 0; 98 92 } 99 93 … … 147 141 // list this hexagon with its attributes 148 142 TROOT::IndentLevel() ; 149 printf ("%s: X= %f Y= %f R= %f \n", GetName , fX, fY, fD ) ;143 printf ("%s: X= %f Y= %f R= %f \n", GetName(), fX, fY, fD ) ; 150 144 } 151 145 … … 164 158 const Int_t np = 6 ; 165 159 166 Float_t dx[np+1] = { .5 , 0. , -.5 , -.5 , 0. , .5 , .5 } ;167 Float_t dy[np+1] = { .2886, .5772, .2886, -.2886, -.5772, -.2886, .2886 } ;160 const Float_t dx[np+1] = { .5 , 0. , -.5 , -.5 , 0. , .5 , .5 } ; 161 const Float_t dy[np+1] = { .2886, .5772, .2886, -.2886, -.5772, -.2886, .2886 } ; 168 162 169 163 static Float_t x[np+1], y[np+1] ; … … 189 183 { 190 184 // print/dump this hexagon with its attributes 191 printf ("Ellipse: X= %f Y= %f R= %f ", fX, fY, fD ) ; 185 printf ("Ellipse: X= %f Y= %f R= %f ", fX, fY, fD ) ; 192 186 193 187 if ( GetLineColor() != 1 ) printf (" Color=%d", GetLineColor() ) ; -
trunk/MagicSoft/Mars/mgui/MHexagon.h
r609 r653 22 22 #endif 23 23 24 class MGeomPix; 25 24 26 class MHexagon : public TObject, public TAttLine, public TAttFill 25 27 { … … 33 35 34 36 MHexagon() ; 35 MHexagon(Float_t x, Float_t y, Float_t d ) ; 37 MHexagon(Float_t x, Float_t y, Float_t d ) ; 38 MHexagon(MGeomPix &pix); 36 39 MHexagon( const MHexagon &hexagon) ; 37 40 virtual ~MHexagon() ;
Note:
See TracChangeset
for help on using the changeset viewer.