Changeset 2038
- Timestamp:
- 04/29/03 10:12:17 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2037 r2038 14 14 - fixed MHillas, MHillasExt and MNewImagePar stuff 15 15 16 * manalysis/MImgCleanStd.[h,cc]: 17 - added Nadia to the list of authors 18 19 * manalysis/MCT1SupercutsCalc.[h,cc]: 20 - changed the default "MHillasExt" to "MHillas" 21 16 22 17 23 … … 36 42 37 43 * mimage/MImgCleanStd.[h,cc] 38 - added the option kDemocratic using sigmabar of the 39 inner pixels 44 - added the option kDemocratic using sigmabar of the inner pixels 40 45 - added the option to select the number of rings of pixels 41 46 to analyze around the core pixels 42 47 - added documentation 43 48 -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc
r2030 r2038 152 152 if (!fHil) 153 153 { 154 *fLog << err << fHilName << " [MHillas Ext] not found... aborting." << endl;154 *fLog << err << fHilName << " [MHillas] not found... aborting." << endl; 155 155 return kFALSE; 156 156 } -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h
r2030 r2038 54 54 55 55 public: 56 MCT1SupercutsCalc(const char *hilname="MHillas Ext",57 58 56 MCT1SupercutsCalc(const char *hilname="MHillas", 57 const char *hilsrcname="MHillasSrc", 58 const char *name=NULL, const char *title=NULL); 59 59 60 60 Double_t CtsMCut(Double_t *a, Double_t ls, Double_t ct, -
trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc
r2035 r2038 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de> 19 ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de) 18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@uni-sw.gwdg.de> 19 ! Author(s): Harald Kornmayer, 1/2001 20 ! Author(s): Nadia Tonello, 4/2003 <mailto:tonello@mppmu.mpg.de> 20 21 ! 21 ! Copyright: MAGIC Software Development, 2000-200 222 ! Copyright: MAGIC Software Development, 2000-2003 22 23 ! 23 24 ! … … 25 26 26 27 ///////////////////////////////////////////////////////////////////////////// 27 // // 28 // MImgCleanStd // 29 // // 30 // The Image Cleaning task selects the pixels you use for the Hillas // 31 // parameters calculation. // 32 // // 33 // There are two methods to make the selection: the standard one, as done // 34 // in the analysis of CT1 data, and the democratic one, as suggested by // 35 // W.Wittek. The number of photo-electrons of a pixel is compared with the // 36 // pedestal RMS of the pixel itself (standard method) or with the average // 37 // RMS of the inner pixels (democratic method). // 38 // In both cases, the possibility to have a camera with pixels of // 39 // different area is taken into account. // 40 // The too noisy pixels can be recognized and eventally switched off // 41 // (Unmap: set blinb pixels to UNUSED) separately, using the // 42 // MBlindPixelCalc Class. In the MBlindPixelCalc class there is also the // 43 // function to replace the value of the noisy pixels with the interpolation// 44 // of the content of the neighbors (SetUseInterpolation). // 45 // // 46 // Example: // 47 // ... // 48 // MBlindPixelCalc blind; // 49 // blind.SetUseInterpolation(); // 50 // blind.SetUseBlindPixels(); // 51 // // 52 // MImgCleanStd clean; // 53 // ... // 54 // tlist.AddToList(&blind); // 55 // tlist.AddToList(&clean); // 56 // // 57 // Look at the MBlindPixelCalc Class for more details. // 58 // // 59 // Starting point: default values ---------------------------------------- // 60 // // 61 // When an event is read, before the image cleaning, all the pixels that // 62 // are in MCerPhotEvt are set as USED and NOT CORE. All the pixels belong // 63 // to RING number 1 (like USED pixels). // 64 // Look at MCerPhotPix.h to see how these informations of the pixel are // 65 // stored. // 66 // The default cleaning METHOD is the STANDARD one and the number of the // 67 // rings around the CORE pixel it analyzes is 1. Look at the Constructor // 68 // of the class in MImgCleanStd.cc to see (or change) the default values. // 69 // // 70 // Example: To modify this setting, use the member functions // 71 // SetMethod(MImgCleanStd::kDemocratic) and SetCleanRings(UShort_t n). // 72 // // 73 // MImgCleanStd:CleanStep1 -------------------------------------------- ---// 74 // // 75 // The first step of cleaning defines the CORE pixels. The CORE pixels are // 76 // the ones which contain the informations about the core of the electro- // 77 // magnetic shower. // 78 // The ratio (A_0/A_i) is calculated from fCam->GetPixRatio(i). A_0 is // 79 // the area of the central pixel of the camera, A_i is the area of the // 80 // examined pixel. In this way, if we have a MAGIC-like camera, with the // 81 // outer pixels bigger than the inner ones, the level of cleaning in the // 82 // two different regions is weighted. // 83 // This avoids problems of deformations of the shower images. // 84 // The signal S_i and the pedestal RMS Prms_i of the pixel are called from // 85 // the object MCerPhotPix. // 86 // If (default method = kStandard) // 87 // // 88 // S_i > L_1 * Prms_i / sqrt(A_0/A_i) // 89 // // 90 // the pixel is set as CORE pixel. L_1 is called "first level of cleaning" // 91 // (default: fCleanLvl1 = 3). // 92 // All the other pixels are set as UNUSED and belong to RING 0. // 93 // After this point, only the CORE pixels are set as USED, with RING // 94 // number 1. // 95 // // 96 // MImgCleanStd:CleanStep2 ---------------------------------------------- // 97 // // 98 // The second step of cleaning looks at the isolated CORE pixels and sets // 99 // them to UNUSED. An isolated pixel is a pixel without CORE neighbors. // 100 // At the end of this point, we have set as USED only CORE pixels with at // 101 // least one CORE neighbor. // 102 // // 103 // MImgCleanStd:CleanStep3 ---------------------------------------------- // 104 // // 105 // The third step of cleaning looks at all the pixels (USED or UNUSED) that// 106 // surround the USED pixels. // 107 // If the content of the analyzed pixel survives at the second level of // 108 // cleaning, i.e. if // 109 // // 110 // S_i > L_2 * Prms_i / sqrt(A_0/A_i) // 111 // // 112 // the pixel is set as USED. L_2 is called "second level of cleaning" // 113 // (default:fCleanLvl2 = 2.5). // 114 // // 115 // When the number of RINGS to analyze is 1 (default value), only the // 116 // pixels that have a neighbor CORE pixel are analyzed. // 117 // // 118 // There is the option to decide the number of times you want to repeat // 119 // this procedure (number of RINGS analyzed around the core pixels = n). // 120 // Every time the level of cleaning is the same (fCleanLvl2) and the pixel // 121 // will belong to ring r+1, 1 < r < n+1. This is described in // 122 // MImgCleanStd:CleanStep4 . // 123 // // 124 // Dictionary and member functions --------------------------------------- // 125 // // 126 // Here there is the detailed description of the member functions and of // 127 // the terms commonly used in the class. // 128 // // 129 // STANDARD CLEANING: // 130 // ================= // 131 // This is the method used for the CT1 data analysis. It is the default // 132 // method of the class. // 133 // The number of photo-electrons of a pixel (S_i) is compared to the // 134 // pedestal RMS of the pixel itself (Prms_i). To have the comparison to // 135 // the same photon density for all the pixels, taking into account they // 136 // can have different areas, we have to keep in mind that the number of // 137 // photons that hit each pixel, goes linearly with the area of the pixel. // 138 // The fluctuations of the LONS are proportional to sqrt(A_i), so when we // 139 // compare S_i with Prms_i, only a factor sqrt(A_0/A_i) is missing to // 140 // have the same (N.photons/Area) threshold for all the pixels. // 141 // // 142 // !!WARNING: if noise independent from the // 143 // pixel size is considered, // 144 // this weight can give wrong results!! // 145 // If // 146 // // 147 // S_i > L_n * Prms_i / sqrt(A_0/A_i) // 148 // // 149 // the pixel survives the cleaning and it is set as CORE (when L_n is the // 150 // first level of cleaning, fCleanLvl1) or USED ((when L_n is the second // 151 // level of cleaning, fCleanLvl2). // 152 // // 153 // Example: // 154 // // 155 // MImgCleanStd clean; // 156 // //creates a default Cleaning object, with default setting // 157 // ... // 158 // tlist.AddToList(&clean); // 159 // // add the image cleaning to the main task list // 160 // // 161 // DEMOCRATIC CLEANING: // 162 // =================== // 163 // You use this cleaning method when you want to compare the number of // 164 // photo-electons of each pixel with the average pedestal RMS // 165 // (fInnerNoise = fSgb->GetSigmabarInner()) of the inner pixels (for the // 166 // MAGIC camera they are the smaller ones): // 167 // // 168 // S_i > L_n * fInnerNoise / (A_0/A_i) // 169 // // 170 // In this case, the simple ratio (A_0/A_i) is used to weight the level of // 171 // cleaning, because both the inner and the outer pixels (that in MAGIC // 172 // have a different area) are compared to the same pedestal RMS, coming // 173 // from the inner pixels. // 174 // To calculate the average pedestal RMS of the inner pixels, you have to // 175 // add to the main task list an object of type MSigmabarCalc before the // 176 // MImgCleanStd object. To know how the calculation of fInnerNoise is done // 177 // look at the MSigmabarCalc Class. // 178 // // 179 // Example: // 180 // // 181 // MSigmabarCalc sbcalc; // 182 // //creates an object that calcutates the average pedestal RMS // 183 // MImgCleanStd clean; // 184 // ... // 185 // tlist.AddToList(&sbcalc); // 186 // tlist.AddToList(&clean); // 187 // // 188 // Member Function: SetMethod() // 189 // ============================ // 190 // When you call the MImgCleanStd task, the default method is kStandard. // 191 // // 192 // If you want to switch to the kDemocratic method you have to // 193 // call this member function. // 194 // // 195 // Example: // 196 // // 197 // MImgCleanStd clean; // 198 // //creates a default Cleaning object, with default setting // 199 // // 200 // clean.SetMethod(MImgCleanStd::kDemocratic); // 201 // //now the method of cleaning is changed to Democratic // 202 // // 203 // FIRST AND SECOND CLEANING LEVEL // 204 // =============================== // 205 // When you call the MImgCleanStd task, the default cleaning levels are // 206 // fCleanLvl1 = 3, fCleanLvl2 = 2.5. You can change them easily when you // 207 // create the MImgCleanStd object. // 208 // // 209 // Example: // 210 // // 211 // MImgCleanStd clean(Float_t lvl1,Float_t lvl2); // 212 // //creates a default cleaning object, but the cleaning levels are now // 213 // //lvl1 and lvl2. // 214 // // 215 // RING NUMBER // 216 // =========== // 217 // The standard cleaning procedure is such that it looks for the // 218 // informations of the boundary part of the shower only on the first // 219 // neighbors of the CORE pixels. // 220 // There is the possibility now to look not only at the firs neighbors // 221 // (first ring),but also further away, around the CORE pixels. All the new // 222 // pixels you can find with this method, are tested with the second level // 223 // of cleaning and have to have at least an USED neighbor. // 224 // // 225 // They will be also set as USED and will be taken into account during the // 226 // calculation of the image parameters. // 227 // The only way to distinguish them from the other USED pixels, is the // 228 // Ring number, that is bigger than 1. // 229 // // 230 // Example: You can decide how many rings you want to analyze using: // 231 // // 232 // MImgCleanStd clean; // 233 // //creates a default cleaning object (default number of rings =1) // 234 // clean.SetCleanRings(UShort\_t r); // 235 // //now it looks r times around the CORE pixels to find new pixels with // 236 // //signal. // 237 // // 238 // // 239 // FIXME: MImgCleanStd is not yet completely optimized for speed. // 240 // Maybe we don't have to loop over all pixels all the time... // 241 // // 242 // Input Containers: // 243 // MGeomCam, MCerPhotEvt, MSigmabar // 244 // // 245 // Output Containers: // 246 // -/- // 247 // // 248 ////////////////////////////////////////////////////////////////////////// // 249 #include "MImgCleanStd.h" 28 // 29 // MImgCleanStd 30 // 31 // The Image Cleaning task selects the pixels you use for the Hillas 32 // parameters calculation. 33 // 34 // There are two methods to make the selection: the standard one, as done 35 // in the analysis of CT1 data, and the democratic one, as suggested by 36 // W.Wittek. The number of photo-electrons of a pixel is compared with the 37 // pedestal RMS of the pixel itself (standard method) or with the average 38 // RMS of the inner pixels (democratic method). 39 // In both cases, the possibility to have a camera with pixels of 40 // different area is taken into account. 41 // The too noisy pixels can be recognized and eventally switched off 42 // (Unmap: set blind pixels to UNUSED) separately, using the 43 // MBlindPixelCalc Class. In the MBlindPixelCalc class there is also the 44 // function to replace the value of the noisy pixels with the interpolation 45 // of the content of the neighbors (SetUseInterpolation). 46 // 47 // Example: 48 // ... 49 // MBlindPixelCalc blind; 50 // blind.SetUseInterpolation(); 51 // blind.SetUseBlindPixels(); 52 // 53 // MImgCleanStd clean; 54 // ... 55 // tlist.AddToList(&blind); 56 // tlist.AddToList(&clean); 57 // 58 // Look at the MBlindPixelCalc Class for more details. 59 // 60 // Starting point: default values ---------------------------------------- 61 // 62 // When an event is read, before the image cleaning, all the pixels that 63 // are in MCerPhotEvt are set as USED and NOT CORE. All the pixels belong 64 // to RING number 1 (like USED pixels). 65 // Look at MCerPhotPix.h to see how these informations of the pixel are 66 // stored. 67 // The default cleaning METHOD is the STANDARD one and the number of the 68 // rings around the CORE pixel it analyzes is 1. Look at the Constructor 69 // of the class in MImgCleanStd.cc to see (or change) the default values. 70 // 71 // Example: To modify this setting, use the member functions 72 // SetMethod(MImgCleanStd::kDemocratic) and SetCleanRings(UShort_t n). 73 // 74 // MImgCleanStd:CleanStep1 -------------------------------------------- --- 75 // 76 // The first step of cleaning defines the CORE pixels. The CORE pixels are 77 // the ones which contain the informations about the core of the electro- 78 // magnetic shower. 79 // The ratio (A_0/A_i) is calculated from fCam->GetPixRatio(i). A_0 is 80 // the area of the central pixel of the camera, A_i is the area of the 81 // examined pixel. In this way, if we have a MAGIC-like camera, with the 82 // outer pixels bigger than the inner ones, the level of cleaning in the 83 // two different regions is weighted. 84 // This avoids problems of deformations of the shower images. 85 // The signal S_i and the pedestal RMS Prms_i of the pixel are called from 86 // the object MCerPhotPix. 87 // If (default method = kStandard) 88 // 89 // S_i > L_1 * Prms_i / sqrt(A_0/A_i) 90 // 91 // the pixel is set as CORE pixel. L_1 is called "first level of cleaning" 92 // (default: fCleanLvl1 = 3). 93 // All the other pixels are set as UNUSED and belong to RING 0. 94 // After this point, only the CORE pixels are set as USED, with RING 95 // number 1. 96 // 97 // MImgCleanStd:CleanStep2 ---------------------------------------------- 98 // 99 // The second step of cleaning looks at the isolated CORE pixels and sets 100 // them to UNUSED. An isolated pixel is a pixel without CORE neighbors. 101 // At the end of this point, we have set as USED only CORE pixels with at 102 // least one CORE neighbor. 103 // 104 // MImgCleanStd:CleanStep3 ---------------------------------------------- 105 // 106 // The third step of cleaning looks at all the pixels (USED or UNUSED) that 107 // surround the USED pixels. 108 // If the content of the analyzed pixel survives at the second level of 109 // cleaning, i.e. if 110 // 111 // S_i > L_2 * Prms_i / sqrt(A_0/A_i) 112 // 113 // the pixel is set as USED. L_2 is called "second level of cleaning" 114 // (default:fCleanLvl2 = 2.5). 115 // 116 // When the number of RINGS to analyze is 1 (default value), only the 117 // pixels that have a neighbor CORE pixel are analyzed. 118 // 119 // There is the option to decide the number of times you want to repeat 120 // this procedure (number of RINGS analyzed around the core pixels = n). 121 // Every time the level of cleaning is the same (fCleanLvl2) and the pixel 122 // will belong to ring r+1, 1 < r < n+1. This is described in 123 // MImgCleanStd:CleanStep4 . 124 // 125 // Dictionary and member functions --------------------------------------- 126 // 127 // Here there is the detailed description of the member functions and of 128 // the terms commonly used in the class. 129 // 130 // STANDARD CLEANING: 131 // ================= 132 // This is the method used for the CT1 data analysis. It is the default 133 // method of the class. 134 // The number of photo-electrons of a pixel (S_i) is compared to the 135 // pedestal RMS of the pixel itself (Prms_i). To have the comparison to 136 // the same photon density for all the pixels, taking into account they 137 // can have different areas, we have to keep in mind that the number of 138 // photons that hit each pixel, goes linearly with the area of the pixel. 139 // The fluctuations of the LONS are proportional to sqrt(A_i), so when we 140 // compare S_i with Prms_i, only a factor sqrt(A_0/A_i) is missing to 141 // have the same (N.photons/Area) threshold for all the pixels. 142 // 143 // !!WARNING: if noise independent from the 144 // pixel size is considered, 145 // this weight can give wrong results!! 146 // If 147 // 148 // S_i > L_n * Prms_i / sqrt(A_0/A_i) 149 // 150 // the pixel survives the cleaning and it is set as CORE (when L_n is the 151 // first level of cleaning, fCleanLvl1) or USED ((when L_n is the second 152 // level of cleaning, fCleanLvl2). 153 // 154 // Example: 155 // 156 // MImgCleanStd clean; 157 // //creates a default Cleaning object, with default setting 158 // ... 159 // tlist.AddToList(&clean); 160 // // add the image cleaning to the main task list 161 // 162 // DEMOCRATIC CLEANING: 163 // =================== 164 // You use this cleaning method when you want to compare the number of 165 // photo-electons of each pixel with the average pedestal RMS 166 // (fInnerNoise = fSgb->GetSigmabarInner()) of the inner pixels (for the 167 // MAGIC camera they are the smaller ones): 168 // 169 // S_i > L_n * fInnerNoise / (A_0/A_i) 170 // 171 // In this case, the simple ratio (A_0/A_i) is used to weight the level of 172 // cleaning, because both the inner and the outer pixels (that in MAGIC 173 // have a different area) are compared to the same pedestal RMS, coming 174 // from the inner pixels. 175 // To calculate the average pedestal RMS of the inner pixels, you have to 176 // add to the main task list an object of type MSigmabarCalc before the 177 // MImgCleanStd object. To know how the calculation of fInnerNoise is done 178 // look at the MSigmabarCalc Class. 179 // 180 // Example: 181 // 182 // MSigmabarCalc sbcalc; 183 // //creates an object that calcutates the average pedestal RMS 184 // MImgCleanStd clean; 185 // ... 186 // tlist.AddToList(&sbcalc); 187 // tlist.AddToList(&clean); 188 // 189 // Member Function: SetMethod() 190 // ============================ 191 // When you call the MImgCleanStd task, the default method is kStandard. 192 // 193 // If you want to switch to the kDemocratic method you have to 194 // call this member function. 195 // 196 // Example: 197 // 198 // MImgCleanStd clean; 199 // //creates a default Cleaning object, with default setting 200 // 201 // clean.SetMethod(MImgCleanStd::kDemocratic); 202 // //now the method of cleaning is changed to Democratic 203 // 204 // FIRST AND SECOND CLEANING LEVEL 205 // =============================== 206 // When you call the MImgCleanStd task, the default cleaning levels are 207 // fCleanLvl1 = 3, fCleanLvl2 = 2.5. You can change them easily when you 208 // create the MImgCleanStd object. 209 // 210 // Example: 211 // 212 // MImgCleanStd clean(Float_t lvl1,Float_t lvl2); 213 // //creates a default cleaning object, but the cleaning levels are now 214 // //lvl1 and lvl2. 215 // 216 // RING NUMBER 217 // =========== 218 // The standard cleaning procedure is such that it looks for the 219 // informations of the boundary part of the shower only on the first 220 // neighbors of the CORE pixels. 221 // There is the possibility now to look not only at the firs neighbors 222 // (first ring),but also further away, around the CORE pixels. All the new 223 // pixels you can find with this method, are tested with the second level 224 // of cleaning and have to have at least an USED neighbor. 225 // 226 // They will be also set as USED and will be taken into account during the 227 // calculation of the image parameters. 228 // The only way to distinguish them from the other USED pixels, is the 229 // Ring number, that is bigger than 1. 230 // 231 // Example: You can decide how many rings you want to analyze using: 232 // 233 // MImgCleanStd clean; 234 // //creates a default cleaning object (default number of rings =1) 235 // clean.SetCleanRings(UShort_t r); 236 // //now it looks r times around the CORE pixels to find new pixels with 237 // //signal. 238 // 239 // 240 // Input Containers: 241 // MGeomCam, MCerPhotEvt, MSigmabar 242 // 243 // Output Containers: 244 // MCerPhotEvt 245 // 246 ///////////////////////////////////////////////////////////////////////////// 247 #include "MImgCleanStd.h" 248 250 249 #include <stdlib.h> // atof 251 250 #include <fstream.h> // ofstream, SavePrimitive … … 373 372 const Double_t ratio = fCam->GetPixRatio(id); 374 373 375 // COBB: '<=' to skip entry=noise=0 376 374 // COBB: '<=' to skip entry=noise=0 377 375 if (entry <= fCleanLvl1 * fInnerNoise / ratio) 378 376 pix.SetPixelUnused(); … … 433 431 { 434 432 // get entry i from list 435 //436 433 MCerPhotPix &pix = (*fEvt)[i]; 437 434 438 435 // get pixel id of this entry 439 //440 436 const Int_t id = pix.GetPixId(); 441 437 442 438 // check if pixel is in use, if not goto next pixel in list 443 //444 439 if (ispixused[id] == 0) 445 440 continue; 446 441 447 442 // check for 'used' neighbors of this pixel 448 //449 443 const MGeomPix &gpix = (*fCam)[id]; 450 444 const Int_t nnmax = gpix.GetNumNeighbors(); … … 453 447 454 448 //loop on the neighbors to check if they are used 455 //456 449 for (Int_t j=0; j<nnmax; j++) 457 450 { … … 459 452 460 453 // when you find an used neighbor, break the loop 461 if (ispixused[id2] == 1 462 454 if (ispixused[id2] == 1) 455 { 463 456 hasNeighbor = kTRUE ; 464 457 break; 465 458 } 466 459 } 467 460 -
trunk/MagicSoft/Mars/mimage/MImgCleanStd.h
r2035 r2038 58 58 void Print(Option_t *o="") const; 59 59 60 Float_t GetCleanLvl1() const { return fCleanLvl1; }61 Float_t GetCleanLvl2() const { return fCleanLvl2; }62 UShort_t 60 Float_t GetCleanLvl1() const { return fCleanLvl1; } 61 Float_t GetCleanLvl2() const { return fCleanLvl2; } 62 UShort_t GetCleanRings() const { return fCleanRings;} 63 63 64 64 void SetCleanRings(UShort_t r) { fCleanRings=r; } … … 71 71 72 72 #endif 73 74 75 76 77 78 79 80
Note:
See TracChangeset
for help on using the changeset viewer.