Changeset 7188 for trunk/MagicSoft
- Timestamp:
- 07/13/05 19:06:26 (19 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7183 r7188 19 19 While an underscore is a placeholder for a white-space or an empty line. 20 20 21 22 21 -*-*- END OF LINE -*-*- 22 23 2005/07/13 Abelardo Moralejo (2005/07/12) 24 25 * manalysis/MGeomApply.cc 26 - Now, if the MGeomApply task has a serial number >0 (indicating 27 most likely a specific telescope in a multi-telescope file), then 28 apply the geometry only to objects with the same serial number. 29 This is important for stereo setups in which the telescopes have 30 cameras with different numbers of pixels. If the MGeomApply task 31 has serial number 0 (default), it will apply the geometry to all 32 found objects as it used to do. 33 34 * manalysis/MMcCalibrationUpdate.cc, mpedestal/MMcPedestalCopy.cc 35 - Now the PreProcess adds the serial number also to MRawRunHeader 36 and MMcRunHeader, since in stereo MC files produced with the 37 current camera simulation at CVS there is one such container per 38 telescope. There is no difference in behaviour for single 39 telescope files. Old MC stereo files will no longer be readable. 40 41 * mimage/MNewImagePar.cc 42 - Made calculation of "Inner size" valid also for camera geometries 43 other than MAGIC standard one. The calculation of "inner leakage" 44 is now made only for MAGIC standard geometry (there is no easy 45 fix for that, but having fInnerSize and MHillas.fSize, the inner 46 leakage is a completely unnecessary parameter). Added a comment on 47 a possible fix for the calculation of fConc. 48 49 * mcalib/MMcCalibrationCalc.[h,cc] 50 - Added member fMinSize and setter for it. It is the minimum 51 (uncalibrated) size of events to be used in the calibration. 52 Previously it was fixed at 1000 ADC counts, but the value depends 53 on the extractor used, so it must be possible to change it. 54 - Add the serial number to MRawRunHeader and MMcConfigRunHeader 55 (now there is one per telescope in stereo files). 56 - Moved the creation of histograms from the constructor to the 57 PreProcess, otherwise the serial number is not added to the 58 histogram name. 59 - In PostProcess, set the average QE for area 0 (inner pixels) in 60 MCalibrationQECam object, to be used later by MCalibrateData. 61 62 * macros/starmcstereo.C 63 - Big update. Adapted to all changes above. Now not only relative, but 64 also absolute calibration (=SIZE in phes) is made. 65 66 67 68 2005/07/13 Raquel de los Reyes (2005/07/12) 69 70 * merpp.cc 71 - Added the container MCameraActiveLoad to the rootified central 72 control files 73 74 * mreport/MReportCC.[h,cc] 75 - Changes in the InterpreteBody to write the variable UPS status and 76 the Time difference between GPS and rubidium clock. 77 78 * mreport/MReportCamera.cc 79 - Changes in the InterpreteCamera and InterpreteBody functions to allow 80 the data merpping from 2005_06_30. 81 82 83 84 2005/07/13 Abelardo Moralejo (2005/07/12) 85 86 * macros/starmcstereo.C 87 - Fixed error which made some objects to be written twice in the 88 _test_ output file. 89 90 91 92 2005/07/13 Patricia Liebing (2005/07/06) 93 94 * mhcalib/MHCalibrationChargeCam.cc: 95 - include new flag (kLoGainBlackout) into the "uncalibrated" 96 pixel classification (see docu from 28/06/2005 Markus Gaug) 97 98 * mbadpixels/MBadPixelsPix.[cc.h], mcalib/MCalibrationChargeCalc.cc 99 - included flag kLoGainBlackout for unsuitable pixels w/ 100 corresponding docu/printout (see MHCalibrationChargeCam.cc) 101 102 * mhcalib/MHCalibrationPulseTimeCam.cc, MHCalibrationCam.cc 103 - add Pixel ID to Debug printout statements 104 105 * mjobs/MJCalibration.cc 106 - include new display for kLoGainBlackout unsuitable pixels 107 108 109 110 2005/07/13 Antonio Stamerra (2005/07/04) 111 112 * manalysis/MMcTriggerLvl2Calc.cc 113 - the checks written on ReInit for MC have been moved to PreProcess() 114 - kFALSE substituted with kSKIP in the check for the standard MAGIC 115 geometry 116 117 118 119 2005/07/13 Abelardo Moralejo (2005/07/01) 120 121 * macros/starmc.C 122 - Set two different cleaning tasks for the calibration loop and 123 for the second (analysis) loop. Otherwise, some pixels were 124 cleaned out in the first loop (we do not want this) if the 125 absolute method was chosen. 126 127 128 129 2005/07/13 Abelardo Moralejo (2005/06/30) 130 131 * mmc/MTriggerDefine.h 132 - Added TRIGGER_PIXELS_4, a provisional number of trigger pixels 133 for the MGeomCamMagic1183 geometry. 134 135 * mgeom/MGeomCamMagic1183.[h,cc] 136 - added. Possible design for a MAGIC-II camera. Preliminary 137 version, not yet ready to use. 138 139 140 141 2005/07/13 Abelardo Moralejo (2005/06/29) 142 143 * mgeom/MGeomCamMagic1183.[h,cc] 144 - added. Possible design for a MAGIC-II camera 145 146 * mgeom/Makefile, GeomLinkDef.h 147 - added new class above. 148 149 150 151 2005/07/13 Markus Gaug (2005/06/28) 152 153 * mhcalib/MHCalibrationChargeCam.[h,cc] 154 - set the fPickupLimit and fBlackoutLimit for the low-gain arrays 155 to a 3.5 instead of the default used in MHCalibrationPix (5.0). 156 - use a new criterium to exclude bad pixels: If the high-gain was 157 saturated and the blackout-events in the low-gain exceed the 158 fNumLoGainBlackoutLimit, the pixel is declared unsuitable. 159 This excludes those pixels which have a saturating high-gain 160 channel, but the low-gain switch does not switch often enough 161 to make the distribution reliable. 162 163 164 165 2005/07/13 Markus Gaug (2005/06/23) 166 167 * mhcalib/MHCalibrationChargeCam.cc 168 - fix a bug counting the number of saturated events. Up to now, the 169 number of saturated slices was counted (which is one for a not too 170 high number), but for some (pathological) pixels, many more slices 171 saturated and produced wrong limits. 172 - make the PickupLimit und BlackoutLimit for the low-gain explicitely 173 smaller. The too large limits caused a failed fit for some channels 174 which resulted in wrong calibration constants. (M. Gaug) 175 176 177 178 2005/07/13 Markus Gaug (2005/06/22) 179 180 * mjobs/MJPedestal.cc 181 - change order of reading local environmnet variables in lines 1044 182 to 1068. Reason: The lines: 183 if (fExtractor==tenv.GetTask()) 184 return kTRUE; 185 yielded sometimes a return before the rest of the env-variables 186 could be read in. This affected ONLY the reading of the pedestal 187 reference file and the bad pixels file name. (M. Gaug) 188 - Added "decode" task (MTriggerPatternDecode) task to the list also 189 for MC runs. 190 191 * mhcalib/MHCalibrationChargeCam.cc 192 - fixed the setting of unreliability for saturated events where the 193 high-gain signal was not stable over time. Now, saturation is 194 asked for before (like in the high-gain fitted-case). (M. Gaug) 195 - fixed a small bug in the precise setting of the histogram ranges. 196 May have introduced a bias of typically 1 FADC cnt in the mean 197 fitted signal (< 0.5%). 198 199 * mbadpixels/MBadPixelsPix.[h,cc] 200 - took out the un-used bad pixels information in function: 201 GetUnsuitableCalLevel(). 202 - debugged the class-documentation 203 204 * mcalib/MCalibrationIntensityChargeCam.cc 205 - a very small fix in the axis title from N_phe to N_{phe} 206 - fixed one bug in the draw-functions of this class. Not (yet) used by 207 standard calibration. 208 - +some undocumented changes 209 210 * mjobs/MJCalibration.cc 211 - changed order in tasklist between MCalibColorSet and 212 MPedCalcFromPedRun. Caused crashes in the intensity calibrations. 213 Does not affect ordinary calibration since MPedCalcFromPedRun is 214 then not in the tasklist anyhow. 215 - changed order of MHCalibrationChargeCam and MCalibrationRelTimeCalc. 216 This wrong order caused MCalibrationRelTimeCalc to print out 217 unreliable pixels which were not set by the rel. time calibration. 218 This caused some confusion in the reading of the output because of 219 the un-logical order of flag settings and posterior output. 220 - set the error of the hi-logain intercalibration constants 221 as the real error on the mean instead of the sigma. 222 - took out the those bad pixel-informations which are not used 223 any more in the "Defect" - display. (M. Gaug) 224 225 226 227 2005/07/13 Markus Gaug (2005/06/21) 228 229 * mhcalib/MHCalibrationChargePix.h 230 - take out one un-necessary 'virtual'-declaration for the Draw- 231 function 232 233 * mhcalib/MHGausEvents.cc 234 - fixed a small bug in the non-standard display with options. 235 236 237 238 2005/07/13 Markus Gaug (2005/06/19) 239 240 * msignal/MExtractTimeAndChargeSpline.cc 241 - set fgOffsetLoGain from 1.7 to 1.39. This is the correct time 242 shift between high-gain and low-gain. Affects only very detailed 243 timing studies. 244 245 * msignal/MExtractTimeAndChargeDigitalFilter.cc 246 - set fOffsetLoGain from 1.7 to 1.4 which corrects now exactly for 247 the arrival time difference between low-gain and high-gain pulses. 248 This wrong number could have had some effect on image cleanings 249 using the time information. (M. Gaug) 250 251 * mcalib/MCalibrationBlindCam.[h,cc] 252 - remove obsolete Copy-function 253 254 * mcalib/MCalibConstPix.h, mcalib/MCalibConstCam.h 255 - introduce Copy-functions 256 - set class index to 1 (was 0) 257 258 * mcalib/MCalibrationChargePix.[h,cc] 259 - introduce Copy() function. 260 261 262 263 2005/07/13 Markus Gaug (2005/06/18) 264 265 * mpedestal/MPedestalCam.cc 266 - modify Print() function to print out also the event-by-event 267 averaged results. 268 269 * mpedestal/MExtractPedestal.[h,cc] 270 - new flag fUseSpecialPixels (set to kFALSE per default) 271 - new data member: fNameRawEvtData which can be set from outside 272 (e.g. to "MRawEvtData2"). 273 - with these two changes, the special pixels can be extracted. 274 Difference to previous version: if flag fUseSpecialPixels is set, 275 * the area and sector averages are not calculated. 276 * the MPedestalCam will get initialized to 277 MRawRunHeader->GetNumSpecialPixels(). 278 - fix a bug in the calculation of the event-by-event averaged 279 pedestal RMS (one total number of areas or sectors was not taken 280 into account). 281 - make local variables in the calculation of rms and mean doubles 282 instead of floats. 283 284 * mpedestal/MPedCalcPedRun.cc 285 - do not calculate the area and sector averages in case flag 286 fUseSpecialPixels is set. 287 - check for existence of pointer fRawEvt in PostProcess. 288 289 290 291 2005/07/13 Markus Gaug (2005/06/15) 292 293 * mcalib/MCalibrationIntensityConstCam.[h,cc] 294 - new class to store the actual applied conversion factors (now with 295 averaged photo-electrons not in the MCalibrationIntensityChargeCam 296 any more). 297 298 * mjobs/MJCalibration.cc 299 - set the correct (statistical) error of the inter-calibraiton factor 300 into MCalibrationChargePix::SetConversionHiLoErr() and the 301 sigma of the distribution 302 into MCalibrationChargePix::SetConversionHiLoSigma(). 303 - In MCalibrationChargePix, the mean conversion error is used for the 304 statistical error of the conversion factor. 305 - In CalibrateData, the sigma is used for the statistical error of the 306 converted signal to equiv. high-gain charges. 307 308 309 2005/07/13 Markus Gaug (2005/06/14) 310 311 * mcalib/MCalibrationHiLoPix.[h,cc] 312 - store also results from profile fits. 313 - increades class version 314 315 * mhcalib/MHCalibrationHiLoPix.[h,cc], mhcalib/MHCalibrationHiLoCam.[h,cc] 316 - added TProfiles for every pixel filled with the high-gain signal 317 vs. low-gain signal which can be fitted to extract gain and 318 offset. 319 320 * mhcalib/Makefile, mhcalib/HCalibLinkDef.h 321 - added MHCalibrationHiLoPix 322 323 324 325 2005/07/13 Markus Gaug (2005/06/10) 326 327 * mcalib/MCalibrationRelTimeCalc.cc 328 - print out forgotten successfully calibrated pixels 329 - small change in spacing of one output 330 331 * mhcalib/MHCalibrationCam.[h,cc] 332 - introduce max. number of events, the rest gets skipped before the 333 next ReInit() is called. Default: 4096 334 Reason: The calibration causes too many un-reliable pixels if more 335 than about 5000 events are treated (@500 Hz) because of the 336 mode hopping of the VCSels. However, in the past, some 337 calibration runs have been taken (erroneously) with more 338 than 5000 events, especially the intensity scans where 339 a good precision is needed. 340 - increased version number 341 - introduce a Getter for the fAverageAreaNum array. 342 - re-normalize the area-averaged sigmas to the equivalent number per 343 pixel also for the intensity calibration. 344 345 * mcalib/MCalibrationChargePix.[h,cc] 346 - divide errors in stat. and syst. errors. Both can be retrieved 347 now, depending on the study, one wants to make. 348 349 350 351 2005/07/13 Markus Gaug (2005/06/06) 352 353 * mhcalib/MHGausEvents.[h,cc] 354 - put small functions into header file to speed up calculations a bit. 355 356 * mcalib/MCalibrationRelTimeCalc.cc 357 - introduce flags to steer the setting of unreliability like done 358 in MCalibrationChargeCalc. Can be steered from the conf-file. 359 360 361 362 2005/07/13 Thomas Bretz 363 364 * mbase/MTaskInteractive.[h,cc]: 365 - fixed a bug with calling ReInit... PostProcess was called instead. 366 - added the missing initialisation of fReInit in constructor 367 368 * sinope.cc: 369 - removed plotting the tasklist statistics twice 370 - replaced DrawClone by DrawCopy (DrawClone gave problems) 371 372 * mhflux/MAlphaFitter.[h,cc]: 373 - fixed the ThetaSq function. It was wrongly defined as 374 exp(-((x-c)/s)^2) instead of exp(-1/2*((x-c)/s)) 375 - Set start value for corresponding fit back to same value 376 as for a standard gauss-fit. 377 378 23 379 24 380 2005/07/12 Daniela Dorner -
trunk/MagicSoft/Mars/NEWS
r7180 r7188 33 33 - callisto: MCalibrationHiLoCam can now be printed from its context 34 34 menu, eg in the TBrowser 35 36 - callisto: fixed logain offset (fgOffsetLoGain) from 1.7 to 37 - 1.39 (MExtractTimeAndChargeSpline) 38 - 1.40 (MExtractTimeAndChargeDigitalFilter) 39 This is important mainly for timing studies. 40 41 - callisto: Changed limits in MHCalibrationChargeCalc from 42 - -100.125 to -98 (fgChargeHiGainFirst) 43 - 1899.875 to 1902. (fgChargeHiGainLast) 44 - -100.25 to -99 (fgChargeLoGainFirst) 45 - 899.75 to 901. (fgChargeLoGainLast) 46 Introduced new limits: 47 - fgNumLoGainBlackoutLimit: 0.05 48 - fgLoGainBlackoutLimit: 3.5 49 - fgLoGainPickupLimit: 3.5 50 51 - callisto: use a new criterium to exclude bad pixels: If the high-gain 52 was saturated and the blackout-events in the low-gain exceed the 53 fNumLoGainBlackoutLimit, the pixel is declared unsuitable. 54 This excludes those pixels which have a saturating high-gain 55 channel, but the low-gain switch does not switch often enough 56 to make the distribution reliable. 57 58 - callisto: fix a bug counting the number of saturated events. Up to now, 59 the number of saturated slices was counted (which is one for a not too 60 high number), but for some (pathological) pixels, many more slices 61 saturated and produced wrong limits. 62 63 - callisto: New options in in callisto.rc for MCalibrationRelTimeCalc: 64 + MCalibrationRelTimeCam.CheckFitResults: Yes 65 + MCalibrationRelTimeCam.CheckDeviatingBehavior: Yes 66 + MCalibrationRelTimeCam.CheckHistOverflow: Yes 67 + MCalibrationRelTimeCam.CheckOscillations: Yes 68 69 - callisto: introduce max. number of events for intercalibration, 70 the rest gets skipped. Default: 4096 71 The calibration causes too many un-reliable pixels if more 72 than about 5000 events are treated (@500 Hz) because of the 73 mode hopping of the VCSels. However, in the past, some 74 calibration runs have been taken (erroneously) with more 75 than 5000 events, especially the intensity scans where 76 a good precision is needed. 35 77 36 78 - star: fixed a bug which caused MEffectiveOnTime containers not to -
trunk/MagicSoft/Mars/callisto.rc
r7130 r7188 237 237 # Use this to change the behaviour of the calibration 238 238 # ------------------------------------------------------------------------- 239 # Type if you set a colour explicitely from outside ( only for MC!!!)239 # Type if you set a colour explicitely from outside (TEST purposes!!) 240 240 #MJCalibration.MCalibColorSet.ExplicitColor: green,blue,uv,ct1 241 241 … … 258 258 #MJCalibration.MHCalibrationChargeCam.Averageing: yes 259 259 #MJCalibration.MHCalibrationChargeCam.HiGainNbins: 500 260 #MJCalibration.MHCalibrationChargeCam.HiGainFirst: - 100.125261 #MJCalibration.MHCalibrationChargeCam.HiGainLast: 1 899.875260 #MJCalibration.MHCalibrationChargeCam.HiGainFirst: -98. 261 #MJCalibration.MHCalibrationChargeCam.HiGainLast: 1902. 262 262 #MJCalibration.MHCalibrationChargeCam.LoGainNbins: 500 263 #MJCalibration.MHCalibrationChargeCam.LoGainFirst: - 100.25264 #MJCalibration.MHCalibrationChargeCam.LoGainLast: 899.75263 #MJCalibration.MHCalibrationChargeCam.LoGainFirst: -99. 264 #MJCalibration.MHCalibrationChargeCam.LoGainLast: 901. 265 265 #MJCalibration.MHCalibrationChargeCam.TimeLowerLimit: 1. 266 266 #MJCalibration.MHCalibrationChargeCam.TimeUpperLimit: 3. … … 270 270 #MJCalibration.MHCalibrationChargeCam.OverflowLimit: 0.005 271 271 #MJCalibration.MHCalibrationChargeCam.PulserFrequency: 500 272 272 273 273 274 #MJCalibration.MHCalibrationRelTimeCam.Debug: no … … 392 393 # Type of used data format: raw,root,MC 393 394 #MJCalibrateSignal.DataType: Root 394 # Type if you set a colour explicitely from outside (only for MC!!!)395 # Type if you set a colour explicitely from outside (only TESTS!!!) 395 396 #MJCalibrateSignal.MCalibColorSet.ExpicitColor: green,blue,uv,ct1 396 397 #MJCalibrateSignal.MCalibrateData.PedestalFlag: Event … … 426 427 #MJCalibrateSignal.MHCalibrationChargeCam.Averageing: yes 427 428 #MJCalibrateSignal.MHCalibrationChargeCam.HiGainNbins: 500 428 #MJCalibrateSignal.MHCalibrationChargeCam.HiGainFirst: -100.5 429 #MJCalibrateSignal.MHCalibrationChargeCam.HiGainFirst: -98. 430 #MJCalibrateSignal.MHCalibrationChargeCam.HiGainLast: 1902. 429 431 #MJCalibrateSignal.MHCalibrationChargeCam.HiGainLast: 1899.5 430 432 MJCalibrateSignal.MHCalibrationChargeCam.LoGainNbins: 250 431 #MJCalibrateSignal.MHCalibrationChargeCam.LoGainFirst: - 100.5432 #MJCalibrateSignal.MHCalibrationChargeCam.LoGainLast: 899.5433 #MJCalibrateSignal.MHCalibrationChargeCam.LoGainFirst: -99. 434 #MJCalibrateSignal.MHCalibrationChargeCam.LoGainLast: 901. 433 435 #MJCalibrateSignal.MHCalibrationChargeCam.TimeLowerLimit: 1. 434 436 #MJCalibrateSignal.MHCalibrationChargeCam.TimeUpperLimit: 3. -
trunk/MagicSoft/Mars/macros/starmc.C
r7005 r7188 52 52 // differences in gain of outer pixels) 53 53 // 54 CalibrationFilename = new TString(" /data1/magic/mc_data/root/Period025/gammas_nonoise/Gamma_zbin0_*.root");54 CalibrationFilename = new TString("nonoise/Gamma_zbin0_0_7_1000to1009_w0.root"); 55 55 // File to be used in the calibration (must be a camera file without added noise) 56 56 57 58 Char_t* AnalysisFilename = "Gamma_zbin1_0_*.root"; // File to be analyzed 59 57 Char_t* AnalysisFilename = "Gamma_zbin0_0_*.root"; // File to be analyzed 60 58 61 59 … … 76 74 // USER CHANGE: tail cuts for image analysis 77 75 78 Float_t CleanLev[2] = {7., 5.}; 79 MImgCleanStd clean(CleanLev[0], CleanLev[1]); // Applies tail cuts to image. 80 clean.SetMethod(MImgCleanStd::kAbsolute); // In absolute units (phot or phe- as chosen below) 81 76 Float_t CleanLev[2] = {10., 5.}; // Tail cuts for the analysis loop 77 MImgCleanStd clean2(CleanLev[0], CleanLev[1]); // Applies tail cuts to image. 78 clean2.SetMethod(MImgCleanStd::kAbsolute); 82 79 83 80 // USER CHANGE: signal extraction 84 //85 // MExtractFixedWindowPeakSearch sigextract;86 // sigextract.SetWindows(6, 6, 4);87 81 88 82 // MExtractTimeAndChargeDigitalFilter sigextract; … … 91 85 92 86 MExtractTimeAndChargeSpline sigextract; 87 sigextract.SetChargeType(MExtractTimeAndChargeSpline::kIntegral); 93 88 sigextract.SetRiseTimeHiGain(0.5); 94 89 sigextract.SetFallTimeHiGain(0.5); … … 96 91 // USER CHANGE: high to low gain ratio. DEPENDS on EXTRACTOR!! 97 92 // One should calculate somewhere else what this factor is for each extractor! 98 Float_t hi2low = 12.; // tentative value for spline with risetime 0.5, fall time 0.5 93 94 // Float_t hi2low = 10.83; 95 // value for digital filter, HG window 4, LG window 6 96 97 Float_t hi2low = 11.28; 98 // value for spline with risetime 0.5, fall time 0.5, low gain stretch 1.5 99 99 100 100 … … 108 108 109 109 110 MImgCleanStd clean(0.,0.); 111 // All pixels containing any photon will be accepted. This is what we want 112 // for the calibration loop (since no noise is added) 113 clean.SetMethod(MImgCleanStd::kAbsolute); 114 // In absolute units (phot or phe- as chosen below) 115 110 116 MSrcPosCam src; 111 117 // 112 // ONLY FOR WOBBLE MODE!! 113 // src.SetX(120.); // units: mm 118 // ONLY FOR WOBBLE MODE!! : set the rigt source position on camera! 119 // src.SetX(120.); // units: mm. Value for MC w+ files 120 // src.SetX(-120.); // units: mm. Value for MC w- files 114 121 115 122 src.SetReadyToSave(); … … 244 251 // 245 252 253 246 254 MProgressBar bar; 247 255 bar.SetWindowName("Calibrating..."); … … 273 281 tlist.RemoveFromList(&read); 274 282 283 tlist.AddToListBefore(&clean2, &clean); 284 tlist.RemoveFromList(&clean); 285 275 286 // 276 287 // Analyzed only the desired fraction of events, skip the rest: -
trunk/MagicSoft/Mars/macros/starmcstereo.C
r3439 r7188 17 17 ! 18 18 ! Author(s): Abelardo Moralejo 1/2004 <mailto:moralejo@pd.infn.it> 19 ! Thomas Bretz, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>20 19 ! 21 20 ! Copyright: MAGIC Software Development, 2000-2004 … … 33 32 ///////////////////////////////////////////////////////////////////////////// 34 33 35 // 36 // User change. 37 // 38 39 Float_t ctx[7] = {0., 0., 0., 0., 0., 0., 0.}; 40 Float_t cty[7] = {-70., -40., -30., 30., 50., 60., 70.}; // in meters 41 // 42 // FIXME: unfortunately present version of reflector was not prepared for 43 // stereo configurations and keeps no track of CT position. So the positions 44 // must be set above by the user, making sure that they correspond to the 45 // files one is analysing. 46 // 47 48 void starmcstereo(Int_t ct1 = 2, Int_t ct2 = 5) 34 void starmcstereo(Int_t ct1 = 1, Int_t ct2 = 2) 49 35 { 50 if (ct1 > sizeof(ctx)/sizeof(ctx[0]) || 51 ct2 > sizeof(ctx)/sizeof(ctx[0]) ) 52 { 53 cout << endl << "Wrong CT id number!" << endl; 36 // ------------- user change ----------------- 37 38 TString* CalibrationFilename = 0; 39 40 // Calibration file: a file with no added noise. Comment out next line if you 41 // do not want to calibrate the data (means SIZE will be in ADC counts) 42 43 CalibrationFilename = new TString("nonoise/Gamma_20_0_7_200000to200009_XX_w0.root"); 44 45 Char_t* AnalysisFilename = "Gamma_20_0_7_*_XX_w0.root"; // File to be analyzed 46 Char_t* OutFileTag = "gammas"; // Output file tag 47 48 // First open input files to check that the required telescopes 49 // are in the file, and get telescope coordinates. 50 51 TChain *rh = new TChain("RunHeaders"); 52 rh->Add(AnalysisFilename); 53 MMcCorsikaRunHeader *corsrh = new MMcCorsikaRunHeader(); 54 rh->SetBranchAddress("MMcCorsikaRunHeader.", &corsrh); 55 rh->GetEvent(0); 56 // We assume that all the read files will have the same telescopes inside, 57 // so we look only into the first runheader. 58 Int_t allcts = corsrh->GetNumCT(); 59 if (ct1 > allcts || ct2 > allcts) 60 { 61 cout << endl << "Wrong CT id number, not contained in input file!" << endl; 54 62 return; 55 63 } 64 // Set telescope coordinates as read from first runheader: 65 Float_t ctx[2]; 66 Float_t cty[2]; 67 ctx[0] = ((*corsrh)[ct1-1])->GetCTx(); 68 cty[0] = ((*corsrh)[ct1-1])->GetCTy(); 69 ctx[1] = ((*corsrh)[ct2-1])->GetCTx(); 70 cty[1] = ((*corsrh)[ct2-1])->GetCTy(); 71 72 // Now find out number of pixels in each camera: 73 MMcConfigRunHeader* confrh1 = new MMcConfigRunHeader(); 74 MMcConfigRunHeader* confrh2 = new MMcConfigRunHeader(); 75 rh->SetBranchAddress("MMcConfigRunHeader;1.", &confrh1); 76 rh->SetBranchAddress("MMcConfigRunHeader;2.", &confrh2); 77 rh->GetEvent(0); 78 Int_t npix[2]; 79 npix[0] = confrh1->GetNumPMTs(); 80 npix[1] = confrh2->GetNumPMTs(); 81 82 rh->Delete(); 83 56 84 57 85 Int_t CT[2] = {ct1, ct2}; // Only 2-telescope analysis for the moment 58 Int_t NCTs = sizeof(CT)/sizeof(CT[0]);86 Int_t NCTs = 2; 59 87 60 88 61 89 // ------------- user change ----------------- 62 90 63 Char_t* AnalysisFilename = "gam-yXX-00001.root"; // File to be analyzed 64 Char_t* OutFileTag = "gammas"; // Output file tag 65 66 Float_t CleanLev[2] = {4., 3.}; // Tail cuts for image analysis 67 68 Int_t BinsHigh[2] = {5, 9}; // First and last FADC bin of the range to be integrated, 69 Int_t BinsLow[2] = {5, 9}; // for high and low gain respectively. 91 Float_t BinsHigh[2] = {0, 79}; 92 Float_t BinsLow[2] = {0, 79}; // FADC slices (2GHz sampling) 93 Float_t CleanLev[2] = {7., 5.}; // Units: phes (absolute cleaning will be used later!) 94 // Tail cuts for the analysis loop. In the first (calibration) loop they will not 95 // be used; we run over a noiseless file and we want to accept all pixels with any 96 // number of phes. 97 98 99 MImgCleanStd** clean = new MImgCleanStd*[NCTs]; 100 101 MImgCleanStd* clean[0] = new MImgCleanStd(1.,1.); 102 MImgCleanStd* clean[1] = new MImgCleanStd(1.,1.); 103 // Just dummy levels. Since the calibration file will be a noiseless file, RMS of 104 // pedestal will be 0, and all events will be accepted, regardless of the cleaning level. 105 // For some reason the above lines do not work if made on a loop! (???) 106 clean[0]->SetSerialNumber(CT[0]); 107 clean[1]->SetSerialNumber(CT[1]); 108 109 MExtractTimeAndChargeSpline* sigextract = new MExtractTimeAndChargeSpline[NCTs]; 110 MMcCalibrationUpdate* mccalibupdate = new MMcCalibrationUpdate[NCTs]; 111 MCalibrateData* calib = new MCalibrateData[NCTs]; 112 MMcCalibrationCalc* mccalibcalc = new MMcCalibrationCalc[NCTs]; 70 113 71 114 // ------------------------------------------- 72 73 //74 // This is a demonstration program which calculates the image75 // parameters from a Magic Monte Carlo root file. Units of Size are76 // for the moment, FADC counts.77 //78 //79 115 // Create a empty Parameter List and an empty Task List 80 116 // The tasklist is identified in the eventloop by its name 81 117 // 82 118 MParList plist; 83 84 119 MTaskList tlist; 85 86 120 plist.AddToList(&tlist); 87 121 … … 89 123 MBadPixelsCam badpix[NCTs]; 90 124 91 for (Int_t ict = 0; ict < NCTs; ict++) 125 Float_t hi2lowratio = 10.0; 126 127 for (Int_t i = 0; i < NCTs; i++) 92 128 { 93 129 TString s = "MSrcPosCam;"; 94 s += CT[i ct];95 src[i ct].SetName(s);96 src[i ct].SetReadyToSave();97 plist.AddToList(&(src[i ct]));130 s += CT[i]; 131 src[i].SetName(s); 132 src[i].SetReadyToSave(); 133 plist.AddToList(&(src[i])); 98 134 99 135 TString b = "MBadPixelsCam;"; 100 b += CT[ict]; 101 badpix[ict].SetName(b); 102 badpix[ict].SetReadyToSave(); 103 plist.AddToList(&(badpix[ict])); 104 } 136 b += CT[i]; 137 badpix[i].SetName(b); 138 badpix[i].InitSize(npix[i]); 139 badpix[i].SetReadyToSave(); 140 plist.AddToList(&(badpix[i])); 141 142 sigextract[i].SetSerialNumber(CT[i]); 143 sigextract[i].SetRange(BinsHigh[0], BinsHigh[1], BinsLow[0], BinsLow[1]); 144 sigextract[i].SetRiseTimeHiGain(0.5); 145 sigextract[i].SetFallTimeHiGain(0.5); 146 sigextract[i].SetLoGainStretch(1.); 147 148 mccalibupdate[i].SetSerialNumber(CT[i]); 149 mccalibupdate[i].SetUserLow2HiGainFactor(hi2lowratio); 150 mccalibupdate[i].SetSignalType(MCalibrateData::kPhe); 151 152 calib[i].SetSerialNumber(CT[i]); 153 calib[i].SetCalibConvMinLimit(0.); 154 calib[i].SetCalibConvMaxLimit(100.); // Override limits for real data 155 calib[i].SetCalibrationMode(MCalibrateData::kFfactor); 156 // Do not change CalibrationMode (just indicates where the cal. constants will be stored) 157 calib[i].SetSignalType(mccalibupdate[i].GetSignalType()); 158 159 mccalibcalc[i].SetSerialNumber(CT[i]); 160 mccalibcalc[i].SetMinSize(200); 161 // Minimum SIZE for an event to be used in the calculation of calibration constants. 162 // Units are ADC counts, and value depends on signal extractor! 163 } 164 165 105 166 // 106 167 // Now setup the tasks and tasklist: … … 110 171 read.DisableAutoScheme(); 111 172 112 read.AddFile(AnalysisFilename); 173 if (CalibrationFilename) 174 read.AddFile(CalibrationFilename->Data()); 175 113 176 114 177 MGeomApply* apply = new MGeomApply[NCTs]; 115 116 178 MMcPedestalCopy* pcopy = new MMcPedestalCopy[NCTs]; 117 118 MExtractSignal* sigextract = new MExtractSignal[NCTs];119 120 MMcCalibrationUpdate* mccalibupdate = new MMcCalibrationUpdate[NCTs];121 MCalibrate* calib = new MCalibrate[NCTs];122 123 MImgCleanStd** clean = new MImgCleanStd*[NCTs];124 125 179 MHillasCalc* hcalc = new MHillasCalc[NCTs]; 126 MHillasSrcCalc* scalc = new MHillasSrcCalc[NCTs];127 180 128 181 TString outfile = "star_"; 129 182 outfile += CT[0]; 130 if (NCTs==2) 131 { 132 outfile += "_"; 133 outfile += CT[1]; 134 } 183 outfile += "_"; 184 outfile += CT[1]; 135 185 136 186 // … … 144 194 outfile = "star_"; 145 195 outfile += CT[0]; 146 if (NCTs==2) 147 { 148 outfile += "_"; 149 outfile += CT[1]; 150 } 196 outfile += "_"; 197 outfile += CT[1]; 151 198 152 199 outfile += "_"; … … 159 206 { 160 207 apply[i]->SetSerialNumber(CT[i]); 161 162 208 pcopy[i]->SetSerialNumber(CT[i]); 163 209 164 sigextract[i]->SetSerialNumber(CT[i]);165 sigextract[i].SetRange(BinsHigh[0], BinsHigh[1], BinsLow[0], BinsLow[1]);166 167 mccalibupdate[i]->SetSerialNumber(CT[i]);168 calib[i]->SetSerialNumber(CT[i]);169 170 clean[i] = new MImgCleanStd(CleanLev[0], CleanLev[1]);171 clean[i]->SetSerialNumber(CT[i]);172 173 210 hcalc[i]->SetSerialNumber(CT[i]); 174 scalc[i]->SetSerialNumber(CT[i]); 211 hcalc[i].Disable(MHillasCalc::kCalcHillasSrc); 212 // Source-dependent parameters not needed in the first loop (calibration) 175 213 176 214 write1.SetSerialNumber(CT[i]); 177 215 write2.SetSerialNumber(CT[i]); 178 216 179 write1.AddContainer(write1.AddSerialNumber("MMcEvt"), "Events"); 180 write1.AddContainer(write1.AddSerialNumber("MHillas"), "Events"); 181 write1.AddContainer(write1.AddSerialNumber("MHillasExt"), "Events"); 182 write1.AddContainer(write1.AddSerialNumber("MHillasSrc"), "Events"); 183 write1.AddContainer(write1.AddSerialNumber("MNewImagePar"), "Events"); 184 write1.AddContainer(write1.AddSerialNumber("MSrcPosCam"), "RunHeaders"); 185 write2.AddContainer(write2.AddSerialNumber("MMcEvt"), "Events"); 186 write2.AddContainer(write2.AddSerialNumber("MHillas"), "Events"); 187 write2.AddContainer(write2.AddSerialNumber("MHillasExt"), "Events"); 188 write2.AddContainer(write2.AddSerialNumber("MHillasSrc"), "Events"); 189 write2.AddContainer(write2.AddSerialNumber("MNewImagePar"), "Events"); 190 write2.AddContainer(write2.AddSerialNumber("MSrcPosCam"), "RunHeaders"); 191 } 192 193 if (NCTs==2) 194 { 195 write1.AddContainer("MStereoPar", "Events"); 196 write2.AddContainer("MStereoPar", "Events"); 197 } 217 write1.AddContainer("MMcEvt", "Events"); 218 write1.AddContainer("MHillas", "Events"); 219 write1.AddContainer("MHillasExt", "Events"); 220 write1.AddContainer("MHillasSrc", "Events"); 221 write1.AddContainer("MNewImagePar", "Events"); 222 write1.AddContainer("MSrcPosCam", "Events"); 223 write2.AddContainer("MMcEvt", "Events"); 224 write2.AddContainer("MHillas", "Events"); 225 write2.AddContainer("MHillasExt", "Events"); 226 write2.AddContainer("MHillasSrc", "Events"); 227 write2.AddContainer("MNewImagePar", "Events"); 228 write2.AddContainer("MSrcPosCam", "Events"); 229 } 230 231 MStereoPar* mstereo = new MStereoPar; 232 plist.AddToList(mstereo); 233 234 write1.AddContainer(mstereo, "Events"); 235 write2.AddContainer(mstereo, "Events"); 236 // We use MWriteRootFile::AddContainer(MParContainer* ,...) instead 237 // of using the container name as above, because in the former case the 238 // serial number tag (indicating the telescope id) is added to the 239 // container name, which is fine for containers of which there is one 240 // per telescope. However, the container MStereoPar is unique, since it 241 // is filled with information coming from both telescopes. 198 242 199 243 write1.AddContainer("MRawRunHeader", "RunHeaders"); … … 204 248 205 249 tlist.AddToList(&read); 250 251 // Skip untriggered events (now camera simulation output contains by default all simulated events) 252 MContinue* trigger = new MContinue("(MMcTrig;1.fNumFirstLevel<1) && (MMcTrig;2.fNumFirstLevel<1)","Events"); 253 tlist.AddToList(trigger); 206 254 207 255 for (i = 0; i < NCTs; i++) … … 214 262 tlist.AddToList(clean[i]); 215 263 tlist.AddToList(&(hcalc[i])); 216 tlist.AddToList(&(scalc[i])); 217 } 218 264 tlist.AddToList(&(mccalibcalc[i])); 265 } 266 267 268 MF filter1("{MMcEvt;1.fEvtNumber%2}<0.5"); 269 MF filter2("{MMcEvt;1.fEvtNumber%2}>0.5"); 270 // 271 // ^^^^ Filters to divide output in two: test and train samples. 272 // 273 write1.SetFilter (&filter1); 274 write2.SetFilter (&filter2); 275 276 // 277 // Create and set up the eventloop 278 // 279 MProgressBar bar; 280 bar.SetWindowName("Calibrating"); 281 282 MEvtLoop evtloop; 283 evtloop.SetProgressBar(&bar); 284 evtloop.SetParList(&plist); 285 286 // 287 // First loop: calibration loop. Go over MC events simulated with 288 // no noise, to correlate SIZE with the number of phes and get the 289 // conversion factor (this is done by MMcCalibrationCalc). 290 // 291 if (CalibrationFilename) 292 { 293 if (!evtloop.Eventloop()) 294 return; 295 } 296 297 tlist.PrintStatistics(); 298 299 /////////////////////////////////////////////////////////////////////// 300 301 302 // Now prepare the second loop: go over the events you want to analyze. 303 // This time the MMcCalibrationUpdate tasks will apply the previously 304 // calculated calibration factors. 305 306 // First substitute the reading task: 307 MReadMarsFile read2("Events"); 308 read2.AddFile(AnalysisFilename); 309 read2.DisableAutoScheme(); 310 tlist.AddToListBefore(&read2, &read); 311 tlist.RemoveFromList(&read); 312 313 // Delete cleaning tasks and create new ones with absolute cleaning method: 314 for (Int_t i= 0; i < NCTs; i++ ) 315 { 316 tlist.RemoveFromList(clean[i]); 317 delete clean[i]; 318 } 319 320 // New cleaning tasks: 321 clean[0] = new MImgCleanStd(CleanLev[0], CleanLev[1]); 322 clean[1] = new MImgCleanStd(CleanLev[0], CleanLev[1]); 323 clean[0]->SetMethod(MImgCleanStd::kAbsolute); 324 clean[1]->SetMethod(MImgCleanStd::kAbsolute); 325 clean[0]->SetSerialNumber(CT[0]); 326 clean[1]->SetSerialNumber(CT[1]); 327 tlist.AddToListBefore(clean[0],&(hcalc[0])); 328 tlist.AddToListBefore(clean[1],&(hcalc[1])); 329 330 tlist.RemoveFromList(&(mccalibcalc[0])); 331 tlist.RemoveFromList(&(mccalibcalc[1])); // Remove calibration tasks from list. 332 333 // Now calculate also source-dependent Hillas parameters: 334 for (i = 0; i < NCTs; i++) 335 hcalc[i].Enable(MHillasCalc::kCalcHillasSrc); 336 337 // Add task to calculate stereo parameters: 219 338 MStereoCalc stereocalc; 220 339 stereocalc.SetCTids(CT[0],CT[1]); 221 222 // 223 // FIXME: telescope coordinates must be introduced by the user, since 224 // they are not available nor in the camera file, neither in the reflector 225 // output. 226 // 227 228 stereocalc.SetCT1coor(ctx[CT[0]-1],cty[CT[0]-1]); 229 stereocalc.SetCT2coor(ctx[CT[1]-1],cty[CT[1]-1]); 230 340 stereocalc.SetCT1coor(ctx[0],cty[0]); 341 stereocalc.SetCT2coor(ctx[1],cty[1]); 231 342 tlist.AddToList(&stereocalc); 232 343 233 234 MF filter1("{MMcEvt;1.fEvtNumber%2}<0.5"); 235 MF filter2("{MMcEvt;1.fEvtNumber%2}>0.5"); 236 // 237 // ^^^^ Filters to divide output in two: test and train samples. 238 // 239 240 write1.SetFilter (&filter1); 241 write2.SetFilter (&filter2); 242 344 // Add writing tasks: 243 345 tlist.AddToList(&filter1); 244 346 tlist.AddToList(&write1); … … 246 348 tlist.AddToList(&write2); 247 349 248 // 249 // Create and set up the eventloop 250 // 251 MProgressBar bar; 252 253 MEvtLoop evtloop; 254 evtloop.SetProgressBar(&bar); 255 evtloop.SetParList(&plist); 256 257 // 258 // Execute your analysis 259 // 350 bar.SetWindowName("Analyzing"); 351 260 352 if (!evtloop.Eventloop()) 261 353 return; 262 354 355 tlist.PrintStatistics(); 356 263 357 for (Int_t i= 0; i < NCTs; i++ ) 264 358 delete clean[i]; 265 359 266 tlist.PrintStatistics(); 360 plist.FindObject("MCalibrationChargeCam;1")->Write(); 361 plist.FindObject("MCalibrationChargeCam;2")->Write(); 362 363 plist.FindObject("MCalibrationQECam;1")->Write(); 364 plist.FindObject("MCalibrationQECam;2")->Write(); 365 366 return; 267 367 } -
trunk/MagicSoft/Mars/manalysis/MGeomApply.cc
r5844 r7188 133 133 { 134 134 MCamEvent *cam = dynamic_cast<MCamEvent*>(o); 135 if (cam) 136 cam->Init(geom); 135 if (!cam) 136 continue; 137 138 // If the MGeomApply task has a serial number >0 (indicating most likely 139 // a specific telescope in a multi-telescope file), then apply the 140 // geometry only to objects with the same serial number. This is important 141 // for stereo setups in which the telescopes have cameras with different 142 // numbers of pixels. If the MGeomApply task has serial number 0 (default), 143 // it will apply the geometry to all found objects as it used to do. 144 const TString name(o->GetName()); 145 146 // Extract serial number from name: 147 const Int_t serial = atoi(name.Data()+name.Last(';')+1); 148 149 // Compare with the serial number of this task: 150 if (serial>0 && serial!=GetSerialNumber()) 151 continue; 152 153 // Initialize object according to camera geometry: 154 cam->Init(geom); 137 155 } 138 156 } … … 186 204 187 205 // FIXME, workaround: this call to CalcPixRatio is here just to allow 188 // the use of some camera files from the 0.7 beta version in which the206 // the use of some MC camera files from the 0.7 beta version in which the 189 207 // array containing pixel ratios is not initialized. 190 208 geom->CalcPixRatio(); -
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r7005 r7188 95 95 Bool_t MMcCalibrationUpdate::CheckRunType(MParList *pList) const 96 96 { 97 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject( "MRawRunHeader");97 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 98 98 if (!run) 99 99 { … … 176 176 } 177 177 178 MMcRunHeader* mcrunh = (MMcRunHeader*) pList->FindObject("MMcRunHeader"); 178 MMcRunHeader* mcrunh = (MMcRunHeader*) pList->FindObject(AddSerialNumber("MMcRunHeader")); 179 if (!mcrunh) 180 { 181 *fLog << err << AddSerialNumber("MMcRunHeader") << " not found... aborting." << endl; 182 return kFALSE; 183 } 179 184 180 185 // … … 247 252 // perpendicular to the camera plane. 248 253 // 249 // FIXME! We look for AddSerialNumber("MMcConfigRunHeader") but250 // for the moment the stereo version of camera does not write one such251 // header per telescope (it should!)254 // As it happens with most containers, we look for AddSerialNumber("MMcConfigRunHeader") 255 // because in the stereo option the camera simulation writes one such header 256 // per telescope. 252 257 // 253 258 MMcConfigRunHeader* mcconfig = (MMcConfigRunHeader*) pList->FindObject(AddSerialNumber("MMcConfigRunHeader")); -
trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc
r3795 r7188 17 17 ! 18 18 ! Author(s): Antonio Stamerra 1/2003 <mailto:antono.stamerra@pi.infn.it> 19 ! Author(s): Marcos Lopez 1/2003 <mailto:marcos@gae.ucm.es>20 19 ! 21 20 ! Copyright: MAGIC Software Development, 2000-2003 … … 71 70 // run type 72 71 // 73 Bool_t MMcTriggerLvl2Calc:: CheckRunType(MParList *pList) const72 Bool_t MMcTriggerLvl2Calc::IsMCRun(MParList *pList) const 74 73 { 75 74 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); … … 90 89 Bool_t MMcTriggerLvl2Calc::ReInit(MParList *pList) 91 90 { 92 //93 // If it is no MC file skip this function...94 //95 if (!CheckRunType(pList))96 {97 *fLog << inf << "This is no MC file... skipping." << endl;98 return kTRUE;99 }100 101 //102 // Check all necessary containers103 //104 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");105 if (!fMcEvt)106 {107 *fLog << err << dbginf << "MMcEvt not found... exit." << endl;108 return kFALSE;109 }110 111 fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig");112 if (!fMcTrig)113 {114 *fLog << err << dbginf << "MMcTrig not found... exit." << endl;115 return kFALSE;116 }117 118 fCam = (MGeomCam*)pList->FindObject("MGeomCam");119 if (!fCam)120 {121 *fLog << dbginf << "MGeomCam not found (no geometry information available)... aborting." << endl;122 return kFALSE;123 }124 // Check if fCam is a Magic geometry: only MGeomCamMagic geometry and125 // geometries with 577 pixels are now accepted by MMcTriggerLvl2126 if (fCam->GetNumPixels()!= 577)127 {128 *fLog << dbginf << "MGeomCam has a wrong geometry; only MAGIC geometry (577 pixels) is accepted by now... aborting" <<endl;129 return kFALSE;130 }131 132 91 return kTRUE; 133 92 } 93 134 94 135 95 … … 168 128 *fLog << "Compact pixel is set with at least "<<fMMcTriggerLvl2->GetCompactNN() << " NN" <<endl; 169 129 130 //------------------------------------------------------------ 131 // 132 // If it is no MC file skip this function... 133 // 134 if (!IsMCRun(pList)) 135 { 136 *fLog << inf << "Reading a data file...skipping the rest of PreProcess()" << endl; 137 return kTRUE; 138 } 139 140 // 141 // Check all necessary containers in case of a MC run 142 // 143 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt"); 144 if (!fMcEvt) 145 { 146 *fLog << err << dbginf << "MMcEvt not found... exit." << endl; 147 return kFALSE; 148 } 149 150 fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig"); 151 if (!fMcTrig) 152 { 153 *fLog << err << dbginf << "MMcTrig not found... exit." << endl; 154 return kFALSE; 155 } 156 157 fCam = (MGeomCam*)pList->FindObject("MGeomCam"); 158 if (!fCam) 159 { 160 *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl; 161 return kFALSE; 162 } 163 // Check if fCam is a Magic geometry: only MGeomCamMagic geometry and 164 // geometries with 577 pixels are now accepted by MMcTriggerLvl2 165 if (fCam->GetNumPixels()!= 577) 166 { 167 *fLog << warn << "MGeomCam has a wrong geometry; only MAGIC geometry (577 pixels) is accepted by now... the Task is skipped." <<endl; 168 return kSKIP; 169 } 170 170 171 171 return kTRUE; 172 172 173 } 173 174 -
trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h
r3795 r7188 33 33 34 34 Bool_t ReInit(MParList *pList); 35 Bool_t CheckRunType(MParList *pList) const;35 Bool_t IsMCRun(MParList *pList) const; 36 36 37 37 public: -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.cc
r5797 r7188 44 44 // are coded in the following form: 45 45 // 46 // 47 // * Set bits leading to an unsuitable flag: 48 // 49 // BIT(7 ): kLoGainSaturation : The Low Gain signals were saturated during calibration 50 // BIT(8 ): kChargeIsPedestal : The calibration signal contained only pedestals - presumably dead pixel 51 // BIT(12): kMeanTimeInFirstBin : The signal has its mean maximum in the first used FADC slice - signal extractor bad 52 // BIT(13): kMeanTimeInLast2Bins : The signal has its mean maximum in the last two used FADC slice - signal extractor bad 53 // BIT(14): kDeviatingNumPhes : The calculated number of phes deviates by more than +6-5.5 sigma of the phes mean of the same area idx. 54 // BIT(19): kHiGainOverFlow : The Hi-Gain calibration histogram showed overflow in more than 0.5% of the events 55 // BIT(20): kLoGainOverFlow : The Lo-Gain calibration histogram showed overflow in more than 0.5% of the events 56 // BIT(23): kDeadPedestalRms : The pedestal RMS was 4.5 sigma below or 25 sigma above the average per area idx. 57 // BIT(24): kFluctuatingArivalTimes: The RMS of the position of the pulse maximum is larger than 3.5 FADC slices. 58 // BIT(24): kLoGainBlackout : A high gain saturated pixel had too many blackout events in the low gain 59 // 60 // 46 61 // * Set bits leading to an unreliable flag: 47 62 // … … 52 67 // BIT(5 ): kLoGainOscillating : The Low Gain signals fourier transform showed abnormal behavior 53 68 // BIT(6 ): kRelTimeOscillating : The High Gain arrival times fourier transform showed abnormal behavior 54 // BIT(1 4): kDeviatingNumPhes : The calculated number of photo-electrons deviates too much from the mean - inconsistency69 // BIT(11): kChargeSigmaNotValid : The sigma of the signal distribution is smaller than the pedestal RMS - presumably a pixel with a star in its FOV only during the pedestal taking 55 70 // BIT(16): kDeviatingFFactor : The calculated overall F-Factor deviates too much from the mean - inconsistency 56 71 // BIT(15): kDeviatingNumPhots : The calculated number of calibrated photons deviates too much from the mean - inconsistency 57 72 // 58 // * Set bits leading to an unsuitable flag:59 //60 // BIT(7 ): kLoGainSaturation : The Low Gain signals were saturated during calibration61 // BIT(8 ): kChargeIsPedestal : The calibration signal contained only pedestals - presumably dead pixel62 // BIT(9 ): kChargeErrNotValid : The absolute error of the derived charge has given non-sense - presumably pedestal63 // BIT(10): kChargeRelErrNotValid: The relative error of the derived charge was too large or too small64 // BIT(11): kChargeSigmaNotValid : The sigma of the pedestal distribution smaller than the pedestal RMS - presumably a pixel with a star in its FOV only during the pedestal taking65 // BIT(12): kMeanTimeInFirstBin : The signal has its mean maximum in the first used FADC slice - signal extractor bad66 // BIT(13): kMeanTimeInLast2Bins : The signal has its mean maximum in the last two used FADC slice - signal extractor bad67 // BIT(19): kHiGainOverFlow : The Hi-Gain calibration histogram showed overflow without saturating the FADC68 // BIT(20): kLoGainOverFlow : The Lo-Gain calibration histogram showed overflow69 73 // 70 74 // * Set bits leading to not useable low-gain signal: 71 75 // 72 // BIT(17): kConversionHiLoNotValid: The calibrated Conversion between Hi-Gain and Low Gain gives absurd results76 // BIT(17): kConversionHiLoNotValid: The inter-calibration constant between Hi-Gain and Low Gain does not exist. 73 77 // 74 78 // These bits can be called with the enum MBadPixelsPix::UncalibratedType_t in combination -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h
r7103 r7188 55 55 kHiLoOscillating = BIT(22), 56 56 kDeadPedestalRms = BIT(23), 57 kFluctuatingArrivalTimes = BIT(24) 57 kFluctuatingArrivalTimes = BIT(24), 58 kLoGainBlackout = BIT(25) 58 59 }; 59 60 … … 90 91 || IsUncalibrated(kLoGainSaturation ) 91 92 || IsUncalibrated(kConversionHiLoNotValid) 92 || IsUncalibrated(kLoGainOscillating ) ; } 93 || IsUncalibrated(kLoGainOscillating ) 94 || IsUncalibrated(kLoGainBlackout ); } 93 95 Bool_t IsHiGainBad() const { return IsUnsuitable (kUnsuitableRun ) 94 96 || IsUncalibrated(kHiGainOscillating ) ; } 95 97 96 98 Int_t GetUnsuitableCalLevel() const { 97 if (!IsUnsuitable()) return 0; 98 if (IsUncalibrated( kChargeIsPedestal )) return 1; 99 if (IsUncalibrated( kChargeRelErrNotValid)) return 2; 100 if (IsUncalibrated( kLoGainSaturation )) return 3; 101 if (IsUncalibrated( kMeanTimeInFirstBin )) return 4; 102 if (IsUncalibrated( kMeanTimeInLast2Bins )) return 5; 103 if (IsUncalibrated( kDeviatingNumPhots )) return 6; 104 if (IsUncalibrated( kHiGainOverFlow )) return 7; 105 if (IsUncalibrated( kLoGainOverFlow )) return 8; 106 if (IsUncalibrated( kDeadPedestalRms )) return 9; 107 if (IsUncalibrated( kFluctuatingArrivalTimes)) return 10; 108 if (IsUncalibrated( kDeviatingNumPhes )) return 11; 109 if (IsUncalibrated( kPreviouslyExcluded )) return 12; 110 return 13; 99 if (!IsUnsuitable()) return 0; 100 if (IsUncalibrated( kChargeIsPedestal )) return 1; 101 if (IsUncalibrated( kLoGainSaturation )) return 2; 102 if (IsUncalibrated( kMeanTimeInFirstBin )) return 3; 103 if (IsUncalibrated( kMeanTimeInLast2Bins )) return 4; 104 if (IsUncalibrated( kHiGainOverFlow )) return 5; 105 if (IsUncalibrated( kLoGainOverFlow )) return 6; 106 if (IsUncalibrated( kDeadPedestalRms )) return 7; 107 if (IsUncalibrated( kFluctuatingArrivalTimes)) return 8; 108 if (IsUncalibrated( kDeviatingNumPhes )) return 9; 109 if (IsUncalibrated( kLoGainBlackout )) return 10; 110 if (IsUncalibrated( kPreviouslyExcluded )) return 11; 111 return 12; 111 112 } 112 113 -
trunk/MagicSoft/Mars/mbase/MParameters.h
r6915 r7188 54 54 ClassDef(MParameterI, 1) // Container to hold a generalized parameters (integer) 55 55 }; 56 56 57 /* 57 58 class MParameters : public MParContainer -
trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h
r6663 r7188 19 19 #pragma link C++ class MCalibrationIntensityCam+; 20 20 #pragma link C++ class MCalibrationIntensityChargeCam+; 21 #pragma link C++ class MCalibrationIntensityConstCam+; 21 22 #pragma link C++ class MCalibrationIntensityBlindCam+; 22 23 #pragma link C++ class MCalibrationIntensityQECam+; 23 24 #pragma link C++ class MCalibrationIntensityRelTimeCam+; 24 25 #pragma link C++ class MCalibrationIntensityTestCam+; 26 25 27 #pragma link C++ class MCalibrationCam+; 26 28 #pragma link C++ class MCalibrationPix+; -
trunk/MagicSoft/Mars/mcalib/MCalibConstCam.cc
r6457 r7188 85 85 // -------------------------------------------------------------------------- 86 86 // 87 // Set the size of the camera 88 // 89 void MCalibConstCam::InitSize(const UInt_t i) 90 { 91 fArray->ExpandCreate(i); 92 } 93 94 // ------------------------------------------------------------------- 95 // 96 // Calls TClonesArray::ExpandCreate() for: 97 // - fAverageAreas 98 // 99 void MCalibConstCam::InitAverageAreas(const UInt_t i) 100 { 101 fAverageAreas->ExpandCreate(i); 102 } 103 104 // ------------------------------------------------------------------- 105 // 106 // Calls TClonesArray::ExpandCreate() for: 107 // - fAverageSectors 108 // 109 void MCalibConstCam::InitAverageSectors(const UInt_t i) 110 { 111 fAverageSectors->ExpandCreate(i); 112 } 87 // Copy 'constructor' 88 // 89 void MCalibConstCam::Copy(TObject &obj) const 90 { 91 92 MParContainer::Copy(obj); 93 94 MCalibConstCam &cam = (MCalibConstCam&)obj; 95 96 Int_t n = GetSize(); 97 98 if (n==0) 99 return; 100 101 cam.InitSize(n); 102 for (int i=0; i<n; i++) 103 (*this)[i].Copy(cam[i]); 104 105 n = GetNumAverageArea(); 106 cam.InitAverageAreas(n); 107 for (int i=0; i<n; i++) 108 GetAverageArea(i).Copy(cam.GetAverageArea(i)); 109 110 n = GetNumAverageSector(); 111 cam.InitAverageSectors(n); 112 for (int i=0; i<n; i++) 113 GetAverageSector(i).Copy(cam.GetAverageSector(i)); 114 } 115 113 116 114 117 // ------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mcalib/MCalibConstCam.h
r6073 r7188 9 9 #endif 10 10 11 class TClonesArray; 11 #ifndef ROOT_TClonesArray 12 #include <TClonesArray.h> 13 #endif 14 12 15 13 16 class MGeomCam; … … 21 24 TClonesArray *fAverageSectors; //-> Array of MCalibConstPix, one per camera sector 22 25 26 Int_t fRunNumber; // Run number 27 23 28 public: 24 29 … … 27 32 28 33 void Clear(Option_t *o=""); 34 void Copy(TObject &object) const; 29 35 30 36 // Getters 31 MCalibConstPix &GetAverageArea ( UInt_t i );32 const MCalibConstPix &GetAverageArea ( UInt_t i )const;33 const Int_t GetNumAverageArea ()const;34 MCalibConstPix &GetAverageSector ( UInt_t i );35 const MCalibConstPix &GetAverageSector ( UInt_t i )const;36 const Int_t GetNumAverageSector() 37 Int_t GetSize ()const;37 MCalibConstPix &GetAverageArea ( UInt_t i ); 38 const MCalibConstPix &GetAverageArea ( UInt_t i ) const; 39 const Int_t GetNumAverageArea () const; 40 MCalibConstPix &GetAverageSector ( UInt_t i ); 41 const MCalibConstPix &GetAverageSector ( UInt_t i ) const; 42 const Int_t GetNumAverageSector() const; 43 Int_t GetSize () const; 38 44 39 MCalibConstPix &operator[] ( Int_t i);40 const MCalibConstPix &operator[] ( Int_t i )const;45 MCalibConstPix &operator[] ( Int_t i ); 46 const MCalibConstPix &operator[] ( Int_t i ) const; 41 47 42 48 void Init ( const MGeomCam &geom); 43 void InitSize ( const UInt_t i );44 void InitAverageAreas ( const UInt_t i );45 void InitAverageSectors ( const UInt_t i );49 void InitSize ( const UInt_t i ) { fArray->ExpandCreate(i); } 50 void InitAverageAreas ( const UInt_t i ) { fAverageAreas->ExpandCreate(i); } 51 void InitAverageSectors ( const UInt_t i ) { fAverageSectors->ExpandCreate(i); } 46 52 47 53 void Print(Option_t *o="") const; 54 55 // Setters 56 void SetRunNumber( const Int_t n ) { fRunNumber = n; } 48 57 49 Bool_t GetPixelContent (Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;50 void DrawPixelContent(Int_t idx) const;58 Bool_t GetPixelContent (Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 59 void DrawPixelContent(Int_t idx) const; 51 60 52 ClassDef(MCalibConstCam, 0) // Temporary Storage for calibration constants61 ClassDef(MCalibConstCam, 1) // Temporary Storage for calibration constants 53 62 }; 54 63 -
trunk/MagicSoft/Mars/mcalib/MCalibConstPix.h
r6073 r7188 9 9 { 10 10 private: 11 12 11 Float_t fCalibConst; // conversion factor (modified after each interlaced cal. update) 13 12 Float_t fCalibFFactor; // global F-Factor (modified after each interlaced cal. update) 14 13 15 14 public: 16 17 15 MCalibConstPix(); 18 16 17 // TObject 19 18 void Clear(Option_t *o="") 20 { 21 fCalibConst = -1.; 22 fCalibFFactor = -1.; 23 } 24 19 { 20 fCalibConst = -1.; 21 fCalibFFactor = -1.; 22 } 23 24 void Copy(TObject &object) const 25 { 26 MCalibConstPix &pix = (MCalibConstPix&)object; 27 pix.fCalibConst = fCalibConst; 28 pix.fCalibFFactor = fCalibFFactor; 29 } 30 25 31 // Getters 26 32 Float_t GetCalibConst() const { return fCalibConst; } … … 31 37 void SetCalibFFactor( const Float_t f ) { fCalibFFactor = f; } 32 38 33 ClassDef(MCalibConstPix, 0) // Temporay Storage Calibraion Constant of one pixel39 ClassDef(MCalibConstPix, 1) // Temporay Storage Calibraion Constant of one pixel 34 40 }; 35 41 -
trunk/MagicSoft/Mars/mcalib/MCalibrationBlindCam.cc
r5128 r7188 71 71 72 72 } 73 74 // --------------------------------------------------------------------------75 //76 // Copy 'constructor'77 //78 void MCalibrationBlindCam::Copy(TObject& object) const79 {80 81 MCalibrationBlindCam &calib = (MCalibrationBlindCam&)object;82 83 MCalibrationCam::Copy(calib);84 85 /*86 const UInt_t n = GetSize();87 if (n != 0)88 {89 calib.InitSize(n);90 for (UInt_t i=0; i<n; i++)91 (*this)[i].Copy(calib[i]);92 }93 */94 }95 96 97 73 98 74 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mcalib/MCalibrationBlindCam.h
r5128 r7188 13 13 14 14 public: 15 16 15 MCalibrationBlindCam(Int_t nblind=1,const char *name=NULL, const char *title=NULL); 17 16 18 void Copy(TObject& object) const;19 20 17 // Inits 21 18 void Init ( const MGeomCam &geom ) {} 22 19 20 // Getter 23 21 Bool_t IsFluxInsidePlexiglassAvailable () const; 24 22 … … 27 25 Float_t GetFluxInsidePlexiglassRelVar() const; 28 26 27 // Setter 29 28 void SetPulserColor( const MCalibrationCam::PulserColor_t col ); 30 29 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r7099 r7188 73 73 // + fNumSaturated 74 74 // 75 // Class Version 4: 76 // + Float_t fConversionHiLoSigma; // Sigma of conversion factor betw. Hi and Lo Gain 77 // - Float_t fMeanConvFADC2PheVar; // Variance conversion factor (F-factor method) 78 // + Float_t fMeanConvFADC2PheStatVar; // Variance conversion factor, only stat. error 79 // + Float_t fMeanConvFADC2PheSystVar; // Variance conversion factor, only syst. error 80 // - Float_t fMeanFFactorFADC2PhotVar; // Variance mean F-Factor photons (F-factor method) 81 // + Float_t fMeanFFactorFADC2PhotVar; // Variance mean F-Factor photons, only stat. error 82 // - Float_t fPheFFactorMethod; // Number Phe's calculated (F-factor method) 83 // - Float_t fPheFFactorMethodVar; // Variance number of Phe's (F-factor method) 84 // + Float_t fPheFFactorMethod; // Number Phe's calculated with F-factor method) 85 // + Float_t fPheFFactorMethodStatVar; // Variance number of Phe's, only stat. error 86 // + Float_t fPheFFactorMethodSystVar; // Variance number of Phe's, only syst. error 87 // 75 88 ///////////////////////////////////////////////////////////////////////////// 76 89 #include "MCalibrationChargePix.h" … … 90 103 const Float_t MCalibrationChargePix::gkFFactorErr = 0.02; 91 104 92 const Float_t MCalibrationChargePix::fgConversionHiLo = 10.; 93 const Float_t MCalibrationChargePix::fgConversionHiLoErr = 2.5; 94 const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit = 1.; 95 const Float_t MCalibrationChargePix::fgConvFFactorRelErrLimit = 0.85; 105 const Float_t MCalibrationChargePix::fgConversionHiLo = 10.; 106 const Float_t MCalibrationChargePix::fgConversionHiLoErr = 0.05; 107 const Float_t MCalibrationChargePix::fgConversionHiLoSigma = 2.5; 108 const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit = 1.; 109 const Float_t MCalibrationChargePix::fgConvFFactorRelErrLimit = 0.85; 96 110 97 111 // -------------------------------------------------------------------------- … … 157 171 158 172 fPheFFactorMethod = -1.; 159 fPheFFactorMethodVar = -1.; 173 fPheFFactorMethodStatVar = -1.; 174 fPheFFactorMethodSystVar = -1.; 160 175 161 176 fMeanConvFADC2Phe = -1.; 162 fMeanConvFADC2PheVar = -1.; 177 fMeanConvFADC2PheStatVar = -1.; 178 fMeanConvFADC2PheSystVar = -1.; 163 179 fMeanFFactorFADC2Phot = -1.; 164 180 fMeanFFactorFADC2PhotVar = -1.; … … 168 184 MCalibrationPix::Clear(); 169 185 } 186 187 // ----------------------------------------------------- 188 // 189 void MCalibrationChargePix::Copy(TObject& object) const 190 { 191 MCalibrationChargePix &pix = (MCalibrationChargePix&)object; 192 193 MCalibrationPix::Copy(pix); 194 195 // 196 // Copy the data members 197 // 198 pix.fAbsTimeMean = fAbsTimeMean ; 199 pix.fAbsTimeRms = fAbsTimeRms ; 200 pix.fCalibFlags = fCalibFlags ; 201 pix.fConversionHiLo = fConversionHiLo ; 202 pix.fConversionHiLoVar = fConversionHiLoVar ; 203 pix.fConversionHiLoSigma = fConversionHiLoSigma ; 204 pix.fConvFFactorRelVarLimit = fConvFFactorRelVarLimit ; 205 pix.fLoGainPedRmsSquare = fLoGainPedRmsSquare ; 206 pix.fLoGainPedRmsSquareVar = fLoGainPedRmsSquareVar ; 207 pix.fMeanConvFADC2Phe = fMeanConvFADC2Phe ; 208 pix.fMeanConvFADC2PheStatVar = fMeanConvFADC2PheStatVar ; 209 pix.fMeanConvFADC2PheSystVar = fMeanConvFADC2PheSystVar ; 210 pix.fMeanFFactorFADC2Phot = fMeanFFactorFADC2Phot ; 211 pix.fMeanFFactorFADC2PhotVar = fMeanFFactorFADC2PhotVar ; 212 pix.fPed = fPed ; 213 pix.fPedVar = fPedVar ; 214 pix.fPedRms = fPedRms ; 215 pix.fPedRmsVar = fPedRmsVar ; 216 pix.fPheFFactorMethod = fPheFFactorMethod ; 217 pix.fPheFFactorMethodStatVar = fPheFFactorMethodStatVar ; 218 pix.fPheFFactorMethodSystVar = fPheFFactorMethodSystVar ; 219 pix.fPheFFactorMethodLimit = fPheFFactorMethodLimit ; 220 pix.fRSigmaSquare = fRSigmaSquare ; 221 pix.fRSigmaSquareVar = fRSigmaSquareVar ; 222 pix.fNumSaturated = fNumSaturated ; 223 } 170 224 171 225 … … 185 239 void MCalibrationChargePix::SetPedestal(const Float_t ped, const Float_t pedrms, const Float_t pederr) 186 240 { 187 188 241 fPed = ped; 189 242 fPedRms = pedrms; … … 197 250 void MCalibrationChargePix::SetPed(const Float_t ped, const Float_t pederr) 198 251 { 199 200 252 fPed = ped; 201 253 fPedVar = pederr*pederr; … … 208 260 void MCalibrationChargePix::SetPedRMS( const Float_t pedrms, const Float_t pedrmserr) 209 261 { 210 211 262 fPedRms = pedrms; 212 263 fPedRmsVar = pedrmserr*pedrmserr; 213 214 } 215 216 217 // ------------------------------------------------------------------------------- 218 // 219 // Get the conversion Error Hi-Gain to Low-Gain: 220 // - If fConversionHiLoVar is smaller than 0 (i.e. has not yet been set), return -1. 264 } 265 266 267 // Inline Functions: 268 // ----------------- 269 // 270 // GetConversionHiLoErr: 271 // Get the conversion Error Hi-Gain to Low-Gain: 272 // If fConversionHiLoVar is smaller than 0 (i.e. has not yet 273 // been set), return -1. 221 274 // 222 Float_t MCalibrationChargePix::GetConversionHiLoErr() const 223 { 224 if (fConversionHiLoVar < 0.) 225 return -1.; 226 227 return TMath::Sqrt(fConversionHiLoVar); 228 } 275 // GetPedRms(): Get the pedestals RMS: Test bit kHiGainSaturation: 276 // If yes, return square root of fLoGainPedRmsSquare (if greater than 0, 277 // otherwise -1.), If no, return fPedRms 278 // 279 // GetConvertedMean(): Get the Low Gain Mean Charge converted to High Gain 280 // amplification: Returns fLoGainMean multiplied with fConversionHiLo if 281 // IsHiGainSaturation(), else return fHiGainMean 282 // 283 // GetConvertedMeanErr(): Get the Error of the converted Low Gain Mean: 284 // Returns -1 if the variable fLoGainMean or fLoGainMeanVar are smaller than 0. 285 // Returns the square root of the quadratic sum of the relative variances of 286 // the fLoGainMean and fConversionHiLo, mulitplied with GetConvertedMean() 287 // in case of HiGain Saturation, 288 // else return GetMeanErr() 289 // 290 // GetConvertedSigma(): Get the Low Gain Sigma converted to High Gain 291 // amplification: Returns fLoGainSigma multiplied with fConversionHiLo 292 // if IsHiGainSaturation() else return fHiGainSigma 293 // 294 // GetConvertedSigmaErr(): Get the Error of the converted Sigma: 295 // Returns -1 if the variable fLoGainSigma or fLoGainSigmaVar are smaller than 0. 296 // if IsHiGainSaturatio() 297 // returns the square root of the quadratic sum of the relative variances of 298 // the fLoGainSigma and fConversionHiLo, mulitplied with GetConvertedSigma() 299 // else returns GetSigmaErr() 300 // 301 // GetConvertedRSigma(): Get the converted reduced Sigma: 302 // If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1. 303 // Test bit kHiGainSaturation: 304 // If yes, return square root of fRSigmaSquare, multiplied with fConversionHiLo, 305 // If no , return square root of fRSigmaSquare 306 // 307 // GetRSigma(): Get the reduced Sigma: 308 // If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1. 309 // 310 // GetConvertedRSigmaSquare(): Get the reduced Sigma Square: 311 // If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1. 312 // Test bit kHiGainSaturation: 313 // If yes, return fRSigmaSquare, multiplied with fConversionHiLo^2, 314 // If no , return fRSigmaSquare 315 // 316 // GetPheFFactorMethodErr(): Get the error on the number of photo-electrons 317 // (F-Factor Method): If fPheFFactorMethodVar is smaller than 0 (i.e. has 318 // not yet been set), return -1. Else returns the square root of 319 // fPheFFactorMethodVar 320 // 321 // GetMeanFFactorFADC2PhotErr(): Get the error on the mean total F-Factor 322 // of the signal readout (F-Factor Method): If fMeanFFactorFADC2PhotVar 323 // is smaller than 0 (i.e. has not yet been set), return -1. Else returns 324 // the square root of fMeanFFactorFADC2PhotVar 325 // 326 // GetPheFFactorMethodRelVar(): Get the relative variance on the number of 327 // photo-electrons (F-Factor Method): If fPheFFactorMethodVar is smaller 328 // than 0 (i.e. has not yet been set), return -1. If fPheFFactorMethod 329 // is 0, return -1. Else returns fPheFFactorMethodVar / fPheFFactorMethod^2 330 // 331 // GetMeanConvFADC2PheErr(): Get the error on the mean conversion factor 332 // (FFactor Method): If fMeanConvFADC2PheVar is smaller than 0 (i.e. has 333 // not yet been set), return -1. Else returns the square root of 334 // fMeanConvFADC2PheVar 229 335 230 336 // -------------------------------------------------------------------------- … … 278 384 279 385 280 // --------------------------------------------------------------------------281 //282 // Get the pedestals RMS:283 // - Test bit kHiGainSaturation:284 // If yes, return square root of fLoGainPedRmsSquare (if greater than 0, otherwise -1.),285 // If no, return fPedRms286 //287 Float_t MCalibrationChargePix::GetPedRms() const288 {289 290 if (IsHiGainSaturation())291 if (fLoGainPedRmsSquare < 0.)292 return -1.;293 else294 return TMath::Sqrt(fLoGainPedRmsSquare);295 296 return fPedRms;297 }298 386 299 387 // -------------------------------------------------------------------------- … … 321 409 // -------------------------------------------------------------------------- 322 410 // 323 // Get the Low Gain Mean Charge converted to High Gain amplification:324 // Returns fLoGainMean multiplied with fConversionHiLo if IsHiGainSaturation(),325 // else return fHiGainMean326 //327 Float_t MCalibrationChargePix::GetConvertedMean() const328 {329 330 if (IsHiGainSaturation())331 return fLoGainMean * fConversionHiLo;332 333 return fHiGainMean;334 }335 336 // --------------------------------------------------------------------------337 //338 // Get the Error of the converted Low Gain Mean:339 //340 // Returns -1 if the variable fLoGainMean or fLoGainMeanVar are smaller than 0.341 //342 // Returns the square root of the quadratic sum of the relative variances of343 // the fLoGainMean and fConversionHiLo, mulitplied with GetConvertedMean()344 // in case of HiGain Saturation,345 // else return GetMeanErr()346 //347 Float_t MCalibrationChargePix::GetConvertedMeanErr() const348 {349 350 if (IsHiGainSaturation())351 {352 const Float_t logainrelvar = GetLoGainMeanRelVar();353 354 if (logainrelvar < 0.)355 return -1.;356 357 return TMath::Sqrt(logainrelvar + GetConversionHiLoRelVar()) * GetConvertedMean();358 }359 else360 return GetMeanErr();361 362 }363 364 // --------------------------------------------------------------------------365 //366 // Get the Low Gain Sigma converted to High Gain amplification:367 // Returns fLoGainSigma multiplied with fConversionHiLo if IsHiGainSaturation()368 // else return fHiGainSigma369 //370 Float_t MCalibrationChargePix::GetConvertedSigma() const371 {372 373 if (IsHiGainSaturation())374 return fLoGainSigma * fConversionHiLo;375 else376 return fHiGainSigma;377 }378 379 // --------------------------------------------------------------------------380 //381 // Get the Error of the converted Sigma:382 //383 // Returns -1 if the variable fLoGainSigma or fLoGainSigmaVar are smaller than 0.384 //385 // if IsHiGainSaturatio()386 // returns the square root of the quadratic sum of the relative variances of387 // the fLoGainSigma and fConversionHiLo, mulitplied with GetConvertedSigma()388 // else returns GetSigmaErr()389 //390 Float_t MCalibrationChargePix::GetConvertedSigmaErr() const391 {392 393 if (IsHiGainSaturation())394 {395 if (fLoGainSigmaVar < 0.)396 return -1.;397 398 if (fLoGainSigma < 0.)399 return -1.;400 401 const Float_t sigmaRelVar = fLoGainSigmaVar402 /( fLoGainSigma * fLoGainSigma );403 404 return TMath::Sqrt(sigmaRelVar+GetConversionHiLoRelVar()) * GetConvertedSigma();405 }406 else407 return GetSigmaErr();408 409 410 }411 412 // --------------------------------------------------------------------------413 //414 // Get the converted reduced Sigma:415 // - If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1.416 // - Test bit kHiGainSaturation:417 // If yes, return square root of fRSigmaSquare, multiplied with fConversionHiLo,418 // If no , return square root of fRSigmaSquare419 //420 Float_t MCalibrationChargePix::GetConvertedRSigma() const421 {422 if (fRSigmaSquare < 0)423 return -1;424 425 const Float_t rsigma = TMath::Sqrt(fRSigmaSquare);426 427 return IsHiGainSaturation() ? rsigma*fConversionHiLo : rsigma ;428 }429 430 // --------------------------------------------------------------------------431 //432 411 // Get the error of the converted reduced Sigma: 433 412 // - If fRSigmaSquareVar is smaller than 0 (i.e. has not yet been set), return -1. … … 460 439 // -------------------------------------------------------------------------- 461 440 // 462 // Get the reduced Sigma:463 // - If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1.464 //465 Float_t MCalibrationChargePix::GetRSigma() const466 {467 if (fRSigmaSquare < 0)468 return -1;469 470 return TMath::Sqrt(fRSigmaSquare);471 472 }473 474 // --------------------------------------------------------------------------475 //476 441 // Get the error of the reduced Sigma: 477 442 // - If fRSigmaSquareVar is smaller than 0 (i.e. has not yet been set), return -1. … … 540 505 541 506 return TMath::Sqrt(rsigmarelvar + meanrelvar) * GetRSigmaPerCharge(); 542 }543 544 // --------------------------------------------------------------------------545 //546 // Get the reduced Sigma Square:547 // - If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1.548 // - Test bit kHiGainSaturation:549 // If yes, return fRSigmaSquare, multiplied with fConversionHiLo^2,550 // If no , return fRSigmaSquare551 //552 Float_t MCalibrationChargePix::GetConvertedRSigmaSquare() const553 {554 if (fRSigmaSquare < 0)555 return -1;556 557 return IsHiGainSaturation() ? fRSigmaSquare*fConversionHiLo*fConversionHiLo : fRSigmaSquare ;558 507 } 559 508 … … 582 531 } 583 532 584 // -------------------------------------------------------------------------- 585 // 586 // Get the error on the number of photo-electrons (F-Factor Method): 587 // - If fPheFFactorMethodVar is smaller than 0 (i.e. has not yet been set), return -1. 588 // - Else returns the square root of fPheFFactorMethodVar 589 // 590 Float_t MCalibrationChargePix::GetPheFFactorMethodErr() const 591 { 592 if (fPheFFactorMethodVar < 0.) 593 return -1.; 594 return TMath::Sqrt(fPheFFactorMethodVar); 595 } 596 597 // -------------------------------------------------------------------------- 598 // 599 // Get the error on the mean total F-Factor of the signal readout (F-Factor Method): 600 // - If fMeanFFactorFADC2PhotVar is smaller than 0 (i.e. has not yet been set), return -1. 601 // - Else returns the square root of fMeanFFactorFADC2PhotVar 602 // 603 Float_t MCalibrationChargePix::GetMeanFFactorFADC2PhotErr() const 604 { 605 if (fMeanFFactorFADC2PhotVar < 0.) 606 return -1.; 607 return TMath::Sqrt(fMeanFFactorFADC2PhotVar); 608 } 609 610 // -------------------------------------------------------------------------- 611 // 612 // Get the relative variance on the number of photo-electrons (F-Factor Method): 613 // - If fPheFFactorMethodVar is smaller than 0 (i.e. has not yet been set), return -1. 614 // - If fPheFFactorMethod is 0, return -1. 615 // - Else returns fPheFFactorMethodVar / fPheFFactorMethod^2 616 // 617 Float_t MCalibrationChargePix::GetPheFFactorMethodRelVar() const 618 { 619 if (fPheFFactorMethodVar < 0.) 620 return -1.; 621 if (fPheFFactorMethod == 0.) 622 return -1.; 623 624 return fPheFFactorMethodVar / (fPheFFactorMethod * fPheFFactorMethod); 625 } 626 627 628 // -------------------------------------------------------------------------- 629 // 630 // Get the error on the mean conversion factor (FFactor Method): 631 // - If fMeanConvFADC2PheVar is smaller than 0 (i.e. has not yet been set), return -1. 632 // - Else returns the square root of fMeanConvFADC2PheVar 633 // 634 Float_t MCalibrationChargePix::GetMeanConvFADC2PheErr() const 635 { 636 if (fMeanConvFADC2PheVar < 0.) 637 return -1.; 638 return TMath::Sqrt(fMeanConvFADC2PheVar); 639 } 533 640 534 641 535 // -------------------------------------------------------------------------- … … 803 697 // Calculate the Error of Nphe 804 698 // 805 const Float_t pheRelVar = ffactorsquareRelVar + meanSquareRelVar + rsigmaSquareRelVar; 806 fPheFFactorMethodVar = pheRelVar * fPheFFactorMethod * fPheFFactorMethod; 699 const Float_t pheRelVar = meanSquareRelVar + rsigmaSquareRelVar; 700 fPheFFactorMethodStatVar = pheRelVar * fPheFFactorMethod * fPheFFactorMethod; 701 fPheFFactorMethodSystVar = ffactorsquareRelVar * fPheFFactorMethod * fPheFFactorMethod; 807 702 808 703 if (IsDebug()) … … 816 711 } 817 712 818 if (fPheFFactorMethod Var < 0. )713 if (fPheFFactorMethodStatVar < 0. ) 819 714 return kFALSE; 820 715 … … 879 774 // the errors, but have to take account of this cancellation: 880 775 // 881 Float_t convrelvar = ffactorsquareRelVar + GetMeanRelVar() + rsigmaSquareRelVar; 776 Float_t convrelvar = GetMeanRelVar() + rsigmaSquareRelVar; 777 if (IsHiGainSaturation()) 778 convrelvar += GetConversionHiLoRelVar(); 779 882 780 const Float_t limit = IsHiGainSaturation() ? fConvFFactorRelVarLimit * 4. : fConvFFactorRelVarLimit; 883 781 … … 906 804 } 907 805 908 fMeanConvFADC2PheVar = convrelvar * fMeanConvFADC2Phe * fMeanConvFADC2Phe; 806 fMeanConvFADC2PheStatVar = convrelvar * fMeanConvFADC2Phe * fMeanConvFADC2Phe; 807 fMeanConvFADC2PheSystVar = ffactorsquareRelVar * fMeanConvFADC2Phe * fMeanConvFADC2Phe; 909 808 910 809 SetFFactorMethodValid(kTRUE); … … 967 866 + 0.25 * nphotonsrelvar; 968 867 969 fMeanFFactorFADC2PhotVar 868 fMeanFFactorFADC2PhotVar = ffactorrelvar * fMeanFFactorFADC2Phot * fMeanFFactorFADC2Phot; 970 869 971 870 if (IsDebug()) -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r7099 r7188 17 17 static const Float_t fgConversionHiLo; //! Default fConversionHiLo (now set to: 10.) 18 18 static const Float_t fgConversionHiLoErr; //! Default fConversionHiLoVar (now set to: 2.5) 19 static const Float_t fgConversionHiLoSigma; //! Default fConversionHiLoSigma (now set to: 2.5) 19 20 static const Float_t fgPheFFactorMethodLimit; //! Default fPheFFactorMethodLimit (now set to: 5.) 20 21 static const Float_t fgConvFFactorRelErrLimit; //! Default fConvFFactorRelErrLimit (now set to: 0.35) … … 25 26 Float_t fConversionHiLo; // Conversion factor betw. Hi Gain and Lo Gain 26 27 Float_t fConversionHiLoVar; // Variance Conversion factor betw. Hi and Lo Gain 28 Float_t fConversionHiLoSigma; // Sigma of conversion factor betw. Hi and Lo Gain 27 29 Float_t fConvFFactorRelVarLimit; // Limit for acceptance rel. variance Conversion FADC2Phe 28 30 Float_t fLoGainPedRmsSquare; // Pedestal RMS square of Low Gain 29 31 Float_t fLoGainPedRmsSquareVar; // Pedestal RMS square Variance of Low Gain 30 32 Float_t fMeanConvFADC2Phe; // Conversion factor (F-factor method) 31 Float_t fMeanConvFADC2PheVar; // Variance conversion factor (F-factor method) 33 Float_t fMeanConvFADC2PheStatVar; // Variance conversion factor, only stat. error 34 Float_t fMeanConvFADC2PheSystVar; // Variance conversion factor, only syst. error 32 35 Float_t fMeanFFactorFADC2Phot; // Total mean F-Factor to photons (F-factor method) 33 Float_t fMeanFFactorFADC2PhotVar; // Variance mean F-Factor photons (F-factor method)36 Float_t fMeanFFactorFADC2PhotVar; // Variance mean F-Factor photons, only stat. error 34 37 Float_t fPed; // Pedestal (from MPedestalPix) times number FADC slices 35 38 Float_t fPedVar; // Variance of pedestal 36 39 Float_t fPedRms; // Pedestal RMS (from MPedestalPix) times sqrt nr. FADC slices 37 40 Float_t fPedRmsVar; // Pedestal RMS (from MPedestalPix) times sqrt nr. FADC slices 38 Float_t fPheFFactorMethod; // Number Phe's calculated (F-factor method) 39 Float_t fPheFFactorMethodVar; // Variance number of Phe's (F-factor method) 41 Float_t fPheFFactorMethod; // Number Phe's calculated with F-factor method) 42 Float_t fPheFFactorMethodStatVar; // Variance number of Phe's, only stat. error 43 Float_t fPheFFactorMethodSystVar; // Variance number of Phe's, only syst. error 40 44 Float_t fPheFFactorMethodLimit; // Min. number Photo-electrons for pix to be accepted. 41 45 Float_t fRSigmaSquare; // Square of Reduced sigma … … 51 55 52 56 public: 57 MCalibrationChargePix(const char *name=NULL, const char *title=NULL); 53 58 54 MCalibrationChargePix(const char *name=NULL, const char *title=NULL); 55 59 // TObject 56 60 void Clear(Option_t *o=""); 61 void Copy(TObject& object) const; 57 62 58 63 // Setter 59 void SetAbsTimeMean ( const Float_t f ) { fAbsTimeMean = f; } 60 void SetAbsTimeRms ( const Float_t f ) { fAbsTimeRms = f; } 61 void SetConversionHiLo ( const Float_t c=fgConversionHiLo ) { fConversionHiLo = c; } 62 void SetConversionHiLoErr ( const Float_t e=fgConversionHiLoErr ) { fConversionHiLoVar = e*e; } 64 /* 63 65 void SetConvFFactorRelErrLimit ( const Float_t f=fgConvFFactorRelErrLimit) { fConvFFactorRelVarLimit = f*f;} 64 void SetFFactorMethodValid ( const Bool_t b = kTRUE );65 66 void SetMeanConvFADC2Phe ( const Float_t f) { fMeanConvFADC2Phe = f; } 66 67 void SetMeanConvFADC2PheVar ( const Float_t f) { fMeanConvFADC2PheVar = f; } 67 68 void SetMeanFFactorFADC2Phot ( const Float_t f) { fMeanFFactorFADC2Phot = f; } 68 void SetPedestal ( const Float_t ped, const Float_t pedrms, const Float_t pederr);69 void SetPed ( const Float_t ped, const Float_t pederr);70 void SetPedRMS ( const Float_t pedrms, const Float_t pedrmserr);71 69 void SetPheFFactorMethod ( const Float_t f) { fPheFFactorMethod = f; } 72 70 void SetPheFFactorMethodVar ( const Float_t f) { fPheFFactorMethodVar = f; } 73 71 void SetPheFFactorMethodLimit ( const Float_t f=fgPheFFactorMethodLimit ) { fPheFFactorMethodLimit = f; } 74 72 void SetNumSaturated ( const Int_t i) { fNumSaturated = i; } 73 */ 74 void SetFFactorMethodValid (const Bool_t b = kTRUE ); 75 void SetPedestal (const Float_t ped, const Float_t pedrms, const Float_t pederr); 76 void SetPed ( const Float_t ped, const Float_t pederr); 77 void SetPedRMS ( const Float_t pedrms, const Float_t pedrmserr); 78 79 void SetAbsTimeMean (const Float_t f) { fAbsTimeMean = f; } 80 void SetAbsTimeRms (const Float_t f) { fAbsTimeRms = f; } 81 void SetConversionHiLo (const Float_t c=fgConversionHiLo ) { fConversionHiLo = c; } 82 void SetConversionHiLoErr (const Float_t e=fgConversionHiLoErr ) { fConversionHiLoVar = e*e;} 83 void SetConversionHiLoSigma (const Float_t s=fgConversionHiLoSigma ) { fConversionHiLoSigma = s; } 84 void SetConvFFactorRelErrLimit (const Float_t f=fgConvFFactorRelErrLimit) { fConvFFactorRelVarLimit = f*f;} 85 void SetMeanConvFADC2Phe (const Float_t f) { fMeanConvFADC2Phe = f; } 86 void SetMeanConvFADC2PheVar (const Float_t f) { fMeanConvFADC2PheStatVar= f; } 87 void SetMeanConvFADC2PheSystVar(const Float_t f) { fMeanConvFADC2PheSystVar= f; } 88 void SetMeanFFactorFADC2Phot (const Float_t f) { fMeanFFactorFADC2Phot = f; } 89 void SetNumSaturated (const Int_t i) { fNumSaturated = i; } 90 void SetPheFFactorMethod (const Float_t f) { fPheFFactorMethod = f; } 91 void SetPheFFactorMethodVar (const Float_t f) { fPheFFactorMethodStatVar= f; } 92 void SetPheFFactorMethodSystVar(const Float_t f) { fPheFFactorMethodSystVar= f; } 93 void SetPheFFactorMethodLimit (const Float_t f=fgPheFFactorMethodLimit ) { fPheFFactorMethodLimit = f; } 75 94 76 95 // Getters 77 Float_t GetAbsTimeMean () const { return fAbsTimeMean; } 78 Float_t GetAbsTimeRms () const { return fAbsTimeRms; } 79 Float_t GetConversionHiLo () const { return fConversionHiLo; } 80 Float_t GetConversionHiLoErr () const; 81 Float_t GetConvertedMean () const; 82 Float_t GetConvertedMeanErr () const; 83 Float_t GetConvertedSigma () const; 84 Float_t GetConvertedSigmaErr () const; 85 Float_t GetConvertedRSigma () const; 86 Float_t GetConvertedRSigmaErr () const; 87 Float_t GetConvertedRSigmaSquare () const; 88 Float_t GetMeanConvFADC2Phe () const { return fMeanConvFADC2Phe; } 89 Float_t GetMeanConvFADC2PheErr () const; 90 Float_t GetMeanConvFADC2PheVar () const { return fMeanConvFADC2PheVar; } 91 Float_t GetMeanFFactorFADC2Phot () const { return fMeanFFactorFADC2Phot; } 92 Float_t GetMeanFFactorFADC2PhotErr () const; 93 Float_t GetMeanFFactorFADC2PhotVar () const { return fMeanFFactorFADC2PhotVar; } 94 Int_t GetNumSaturated () const { return fNumSaturated; } 95 Float_t GetPed () const { return fPed; } 96 Float_t GetPedErr () const { return TMath::Sqrt(fPedVar); } 97 Float_t GetPedRms () const; 98 Float_t GetPedRmsErr () const; 99 Float_t GetPheFFactorMethod () const { return fPheFFactorMethod; } 100 Float_t GetPheFFactorMethodErr () const; 101 Float_t GetPheFFactorMethodVar () const { return fPheFFactorMethodVar; } 102 Float_t GetPheFFactorMethodRelVar () const; 103 Float_t GetRSigma () const; 104 Float_t GetRSigmaErr () const; 105 Float_t GetRSigmaRelVar () const; 106 Float_t GetRSigmaPerCharge () const; 107 Float_t GetRSigmaPerChargeErr () const; 96 Float_t GetAbsTimeMean () const { return fAbsTimeMean; } 97 Float_t GetAbsTimeRms () const { return fAbsTimeRms; } 98 Float_t GetConversionHiLo () const { return fConversionHiLo; } 99 Float_t GetConversionHiLoErr () const { return fConversionHiLoVar<0 ? -1 : TMath::Sqrt(fConversionHiLoVar); } 100 Float_t GetConversionHiLoSigma() const { return fConversionHiLoSigma; } 101 Float_t GetConvertedMean () const { return IsHiGainSaturation() ? fLoGainMean * fConversionHiLo : fHiGainMean; } 102 Float_t GetConvertedMeanErr () const 103 { 104 if (!IsHiGainSaturation()) 105 return GetMeanErr(); 106 const Float_t logainrelvar = GetLoGainMeanRelVar(); 107 return logainrelvar<0 ? -1 : TMath::Sqrt(logainrelvar + GetConversionHiLoRelVar()) * GetConvertedMean(); 108 } 109 Float_t GetConvertedSigma() const { return IsHiGainSaturation() ? fLoGainSigma * fConversionHiLo : fHiGainSigma; } 110 Float_t GetConvertedSigmaErr() const 111 { 112 if (!IsHiGainSaturation()) 113 return GetSigmaErr(); 108 114 109 Bool_t IsFFactorMethodValid () const; 115 if (fLoGainSigmaVar<0 || fLoGainSigma<0) 116 return -1.; 117 118 const Float_t sigmaRelVar = fLoGainSigmaVar/(fLoGainSigma*fLoGainSigma); 119 return TMath::Sqrt(sigmaRelVar+GetConversionHiLoRelVar()) * GetConvertedSigma(); 120 } 121 Float_t GetConvertedRSigma() const 122 { 123 if (fRSigmaSquare < 0) 124 return -1; 125 const Float_t rsigma = TMath::Sqrt(fRSigmaSquare); 126 return IsHiGainSaturation() ? rsigma*fConversionHiLo : rsigma ; 127 } 128 Float_t GetConvertedRSigmaErr() const; 129 Float_t GetConvertedRSigmaSquare() const 130 { 131 if (fRSigmaSquare < 0) 132 return -1; 133 return IsHiGainSaturation() ? fRSigmaSquare*fConversionHiLo*fConversionHiLo : fRSigmaSquare ; 134 } 135 Float_t GetMeanConvFADC2Phe() const { return fMeanConvFADC2Phe; } 136 Float_t GetMeanConvFADC2PheErr () const { return fMeanConvFADC2PheStatVar<0 ? -1 : TMath::Sqrt(fMeanConvFADC2PheStatVar); } 137 Float_t GetMeanConvFADC2PheSystErr() const { return fMeanConvFADC2PheSystVar<0 ? -1 : TMath::Sqrt(fMeanConvFADC2PheSystVar); } 138 Float_t GetMeanConvFADC2PheTotErr() const 139 { 140 if (fMeanConvFADC2PheSystVar<0 || fMeanConvFADC2PheStatVar<0) 141 return -1.; 142 return TMath::Sqrt(fMeanConvFADC2PheSystVar+fMeanConvFADC2PheStatVar); 143 } 144 Float_t GetFFactorFADC2Phe () const { return gkFFactor; } 145 Float_t GetMeanConvFADC2PheVar () const { return fMeanConvFADC2PheStatVar; } 146 Float_t GetMeanConvFADC2PheSystVar() const { return fMeanConvFADC2PheSystVar; } 147 148 Float_t GetMeanFFactorFADC2Phot () const { return fMeanFFactorFADC2Phot; } 149 Float_t GetMeanFFactorFADC2PhotErr() const { return fMeanFFactorFADC2PhotVar<0 ? -1. : TMath::Sqrt(fMeanFFactorFADC2PhotVar); } 150 Float_t GetMeanFFactorFADC2PhotVar() const { return fMeanFFactorFADC2PhotVar; } 151 Int_t GetNumSaturated () const { return fNumSaturated; } 152 Float_t GetPed () const { return fPed; } 153 Float_t GetPedErr () const { return TMath::Sqrt(fPedVar); } 154 Float_t GetPedRms () const 155 { 156 if (!IsHiGainSaturation()) 157 return fPedRms; 158 return fLoGainPedRmsSquare<0 ? -1 : TMath::Sqrt(fLoGainPedRmsSquare); 159 } 160 Float_t GetPedRmsErr () const; 161 Float_t GetPheFFactorMethod () const { return fPheFFactorMethod; } 162 Float_t GetPheFFactorMethodErr () const { return fPheFFactorMethodStatVar<0 ? -1 : TMath::Sqrt(fPheFFactorMethodStatVar); } 163 Float_t GetPheFFactorMethodSystErr() const { return fPheFFactorMethodSystVar<0 ? -1 : TMath::Sqrt(fPheFFactorMethodSystVar); } 164 Float_t GetPheFFactorMethodTotErr () const 165 { 166 if (fPheFFactorMethodStatVar<0 || fPheFFactorMethodSystVar<0) 167 return -1.; 168 return TMath::Sqrt(fPheFFactorMethodStatVar+fPheFFactorMethodSystVar); 169 } 170 Float_t GetPheFFactorMethodVar () const { return fPheFFactorMethodStatVar; } 171 Float_t GetPheFFactorMethodSystVar() const { return fPheFFactorMethodSystVar; } 172 Float_t GetPheFFactorMethodRelVar () const { return fPheFFactorMethodStatVar<=0 ? -1 : fPheFFactorMethodStatVar / (fPheFFactorMethod * fPheFFactorMethod); } 173 Float_t GetPheFFactorMethodRelSystVar() const { return fPheFFactorMethodSystVar<=0 ? -1. : fPheFFactorMethodSystVar / (fPheFFactorMethod * fPheFFactorMethod); } 174 Float_t GetRSigma () const { return fRSigmaSquare<0 ? -1 : TMath::Sqrt(fRSigmaSquare); } 175 176 Float_t GetRSigmaErr () const; 177 Float_t GetRSigmaRelVar () const; 178 Float_t GetRSigmaPerCharge () const; 179 Float_t GetRSigmaPerChargeErr() const; 180 181 Bool_t IsFFactorMethodValid() const; 110 182 111 183 // Calculations -
trunk/MagicSoft/Mars/mcalib/MCalibrationHiLoPix.cc
r5749 r7188 18 18 ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2005 21 21 ! 22 22 \* ======================================================================== */ 23 23 ///////////////////////////////////////////////////////////////////////////// 24 // //25 // MCalibrationHiLoPix //26 // //27 // Storage container for high-gain vs. low-gain charge calibration results //28 // of one Pixel (PMT). //29 // The following "calibration" constants can be retrieved: //24 // 25 // MCalibrationHiLoPix 26 // 27 // Storage container for high-gain vs. low-gain charge calibration results 28 // of one Pixel (PMT). 29 // The following "calibration" constants can be retrieved: 30 30 // - GetHiLoRatio(): The mean conversion High-gain vs. Low-gain 31 31 // with which the low-gain result has to be multiplied 32 // - GetHiLoSigma(): The Gauss sigma of histogrammed High-gain vs. Low-gain ratios 32 // - GetHiLoSigma(): The Gauss sigma of histogrammed High-gain vs. 33 // Low-gain ratios 33 34 // 34 // See also: MHCalibrationHiLoPix, MHCalibrationHiLoCam // 35 // // 35 // See also: MHCalibrationHiLoPix, MHCalibrationHiLoCam 36 // 37 // Class Version 2: 38 // + Float_t fOffsetPerSlice; // Offset from fit (per FADC slice) 39 // + Float_t fGainRatio; // Ratio of gains from fit 40 // 36 41 ///////////////////////////////////////////////////////////////////////////// 37 42 #include "MCalibrationHiLoPix.h" … … 46 51 // 47 52 MCalibrationHiLoPix::MCalibrationHiLoPix(const char *name, const char *title) 53 : fOffsetPerSlice(-9999.), fGainRatio(-1.) 48 54 { 49 55 … … 52 58 53 59 } 54 -
trunk/MagicSoft/Mars/mcalib/MCalibrationHiLoPix.h
r5946 r7188 9 9 { 10 10 private: 11 Float_t fOffsetPerSlice; // Offset from fit (per FADC slice) 12 Float_t fGainRatio; // Ratio of gains from fit 11 13 12 14 public: 15 MCalibrationHiLoPix(const char *name=NULL, const char *title=NULL); 13 16 14 MCalibrationHiLoPix(const char *name=NULL, const char *title=NULL); 15 ~MCalibrationHiLoPix() {} 16 17 // Setter 18 void SetGainRatio (const Float_t f) { fGainRatio = f; } 19 void SetOffsetPerSlice(const Float_t f) { fOffsetPerSlice = f; } 20 21 // Getter 17 22 Float_t GetHiLoChargeRatio() const { return GetHiGainMean(); } 18 23 Float_t GetHiLoChargeRatioErr() const { return GetHiGainMeanErr(); } … … 26 31 Float_t GetHiLoTimeDiffSigmaErr() const { return GetLoGainSigmaErr(); } 27 32 Float_t GetHiLoTimeDiffProb() const { return GetLoGainProb(); } 33 Float_t GetGainRatio () const { return fGainRatio; } 34 Float_t GetOffsetPerSlice() const { return fOffsetPerSlice; } 28 35 29 ClassDef(MCalibrationHiLoPix, 1) // Container HiLo conversion Calibration Results Pixel36 ClassDef(MCalibrationHiLoPix, 2) // Container HiLo conversion Calibration Results Pixel 30 37 }; 31 38 -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.cc
r6412 r7188 594 594 varerr[i] = pix.GetRSigmaErr(); 595 595 } 596 if (option.Contains("abstime "))596 if (option.Contains("abstimemean")) 597 597 { 598 598 var [i] = pix.GetAbsTimeMean(); 599 599 varerr[i] = pix.GetAbsTimeRms(); 600 600 } 601 if (option.Contains("abstimerms")) 602 { 603 var [i] = pix.GetAbsTimeRms(); 604 varerr[i] = pix.GetAbsTimeRms()/2.; 605 } 601 606 if (option.Contains("blackout")) 602 607 { … … 663 668 var [i] = pix.GetRSigmaPerCharge(); 664 669 varerr[i] = pix.GetRSigmaPerChargeErr(); 670 } 671 if (option.Contains("conversionfactor")) 672 { 673 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(0); 674 const Float_t mean = pix.GetConvertedMean(); 675 const Float_t phe = apix.GetPheFFactorMethod(); 676 677 var[i] = phe/mean; 678 varerr[i] = TMath::Sqrt(apix.GetPheFFactorMethodErr()*apix.GetPheFFactorMethodErr()/mean/mean 679 + phe*phe/mean/mean/mean/mean*pix.GetConvertedMeanErr()*pix.GetConvertedMeanErr()); 665 680 } 666 681 } … … 735 750 736 751 if (option.Contains("rsigma")) 752 pvar = pix.GetRSigma(); 753 if (option.Contains("abstimemean")) 754 pvar = pix.GetAbsTimeMean(); 755 if (option.Contains("abstimerms")) 756 pvar = pix.GetAbsTimeRms(); 757 if (option.Contains("conversionhilo")) 758 pvar = pix.GetConversionHiLo(); 759 if (option.Contains("convertedmean")) 760 pvar = pix.GetConvertedMean(); 761 if (option.Contains("convertedsigma")) 762 pvar = pix.GetConvertedSigma(); 763 if (option.Contains("convertedrsigma")) 764 pvar = pix.GetConvertedRSigma(); 765 if (option.Contains("meanconvfadc2phe")) 766 pvar = pix.GetMeanConvFADC2Phe(); 767 if (option.Contains("meanffactorfadc2phot")) 768 pvar = pix.GetMeanFFactorFADC2Phot(); 769 if (option.Contains("ped")) 770 pvar = pix.GetPed(); 771 if (option.Contains("pedrms")) 772 pvar = pix.GetPedRms(); 773 if (option.Contains("pheffactormethod")) 774 pvar = pix.GetPheFFactorMethod(); 775 if (option.Contains("rsigmapercharge")) 776 pvar = pix.GetRSigmaPerCharge(); 777 if (option.Contains("conversionfactor")) 778 { 779 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 780 pvar = apix.GetPheFFactorMethod()/pix.GetConvertedMean(); 781 } 782 783 784 variab += pvar; 785 variab2 += pvar*pvar; 786 num++; 787 788 camcharge.Fill(j,pvar); 789 camcharge.SetUsed(j); 790 } 791 792 if (num > 1) 793 { 794 variab /= num; 795 variance = (variab2 - variab*variab*num) / (num-1); 796 797 vararea[i] = variab; 798 varareaerr[i] = variance>0 ? TMath::Sqrt(variance/num) : 999999999.; 799 800 // 801 // Make also a Gauss-fit to the distributions. The RMS can be determined by 802 // outlier, thus we look at the sigma and the RMS and take the smaller one, afterwards. 803 // 804 h = camcharge.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750); 805 h->SetDirectory(NULL); 806 h->Fit("gaus","QL"); 807 TF1 *fit = h->GetFunction("gaus"); 808 809 Float_t ci2 = fit->GetChisquare(); 810 Float_t sigma = fit->GetParameter(2); 811 812 if (ci2 > 500. || sigma > varareaerr[i]) 813 { 814 h->Fit("gaus","QLM"); 815 fit = h->GetFunction("gaus"); 816 817 ci2 = fit->GetChisquare(); 818 sigma = fit->GetParameter(2); 819 } 820 821 const Float_t mean = fit->GetParameter(1); 822 const Float_t ndf = fit->GetNDF(); 823 824 *fLog << inf << "Camera Nr: " << i << endl; 825 *fLog << inf << option.Data() << " area idx: " << aidx << " Results: " << endl; 826 *fLog << inf << "Mean: " << Form("%4.3f",mean) 827 << "+-" << Form("%4.3f",fit->GetParError(1)) 828 << " Sigma: " << Form("%4.3f",sigma) << "+-" << Form("%4.3f",fit->GetParError(2)) 829 << " Chisquare: " << Form("%4.3f",ci2) << " NDF : " << ndf << endl; 830 delete h; 831 gROOT->GetListOfFunctions()->Remove(fit); 832 833 if (sigma<varareaerr[i] && ndf>2 && ci2<500.) 834 { 835 vararea [i] = mean; 836 varareaerr[i] = sigma/TMath::Sqrt((Float_t)num); 837 } 838 } 839 else 840 { 841 vararea[i] = -1.; 842 varareaerr[i] = 0.; 843 } 844 845 nr[i] = i; 846 nrerr[i] = 0.; 847 } 848 849 TGraphErrors *gr = new TGraphErrors(size, 850 nr.GetArray(),vararea.GetArray(), 851 nrerr.GetArray(),varareaerr.GetArray()); 852 gr->SetTitle(Form("%s Area %3i Average",option.Data(),aidx)); 853 gr->GetXaxis()->SetTitle("Camera Nr."); 854 // gr->GetYaxis()->SetTitle("<Q> [1]"); 855 return gr; 856 } 857 858 859 // ------------------------------------------------------------------- 860 // 861 // Returns a TGraphErrors with the mean effective number of photon 862 // vs. the calibration camera number. With the string 'method', different 863 // calibration methods can be called. 864 // 865 TGraphErrors *MCalibrationIntensityChargeCam::GetPhotVsTime( const Option_t *method ) 866 { 867 868 const Int_t size = GetSize(); 869 870 if (size == 0) 871 return NULL; 872 873 TString option(method); 874 875 TArrayF photarr(size); 876 TArrayF photarrerr(size); 877 TArrayF nr(size); 878 TArrayF nrerr(size); 879 880 for (Int_t i=0;i<GetSize();i++) 881 { 882 // 883 // Get the calibration cam from the intensity cam 884 // 885 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 886 887 // 888 // Get the calibration pix from the calibration cam 889 // 890 Float_t phot = 0.; 891 Float_t photerr = 0.; 892 893 if (option.Contains("BlindPixel")) 894 { 895 phot = cam->GetNumPhotonsBlindPixelMethod(); 896 photerr = cam->GetNumPhotonsBlindPixelMethodErr(); 897 } 898 if (option.Contains("FFactor")) 899 { 900 phot = cam->GetNumPhotonsFFactorMethod(); 901 photerr = cam->GetNumPhotonsFFactorMethodErr(); 902 } 903 if (option.Contains("PINDiode")) 904 { 905 phot = cam->GetNumPhotonsPINDiodeMethod(); 906 photerr = cam->GetNumPhotonsPINDiodeMethodErr(); 907 } 908 909 photarr[i] = phot; 910 photarrerr[i] = photerr; 911 912 nr[i] = i; 913 nrerr[i] = 0.; 914 } 915 916 TGraphErrors *gr = new TGraphErrors(size, 917 nr.GetArray(),photarr.GetArray(), 918 nrerr.GetArray(),photarrerr.GetArray()); 919 gr->SetTitle("Photons Average"); 920 gr->GetXaxis()->SetTitle("Camera Nr."); 921 gr->GetYaxis()->SetTitle("<N_{phot}> [1]"); 922 return gr; 923 } 924 925 // ------------------------------------------------------------------- 926 // 927 // Returns a TGraphErrors with the mean effective number of photo-electrons per 928 // area index 'aidx' vs. the calibration camera number 929 // 930 TGraphErrors *MCalibrationIntensityChargeCam::GetPhePerAreaVsTime( const Int_t aidx, const MGeomCam &geom) 931 { 932 933 const Int_t size = GetSize(); 934 935 if (size == 0) 936 return NULL; 937 938 TArrayF phearea(size); 939 TArrayF pheareaerr(size); 940 TArrayF time(size); 941 TArrayF timeerr(size); 942 943 for (Int_t i=0;i<GetSize();i++) 944 { 945 // 946 // Get the calibration cam from the intensity cam 947 // 948 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 949 950 // 951 // Get the calibration pix from the calibration cam 952 // 953 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 954 const Float_t phe = apix.GetPheFFactorMethod(); 955 const Float_t pheerr = apix.GetPheFFactorMethodErr(); 956 957 phearea[i] = phe; 958 pheareaerr[i] = pheerr; 959 960 time[i] = i; 961 timeerr[i] = 0.; 962 } 963 964 TGraphErrors *gr = new TGraphErrors(size, 965 time.GetArray(),phearea.GetArray(), 966 timeerr.GetArray(),pheareaerr.GetArray()); 967 gr->SetTitle(Form("Phes Area %d Average",aidx)); 968 gr->GetXaxis()->SetTitle("Camera Nr."); 969 gr->GetYaxis()->SetTitle("<N_{phe}> [1]"); 970 return gr; 971 } 972 973 // ------------------------------------------------------------------- 974 // 975 // Returns a TGraphErrors with the event-by-event averaged charge per 976 // area index 'aidx' vs. the calibration camera number 977 // 978 TGraphErrors *MCalibrationIntensityChargeCam::GetChargePerAreaVsTime( const Int_t aidx, const MGeomCam &geom) 979 { 980 981 const Int_t size = GetSize(); 982 983 if (size == 0) 984 return NULL; 985 986 TArrayF chargearea(size); 987 TArrayF chargeareaerr(size); 988 TArrayF nr(size); 989 TArrayF nrerr(size); 990 991 for (Int_t i=0;i<GetSize();i++) 992 { 993 // 994 // Get the calibration cam from the intensity cam 995 // 996 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 997 998 // 999 // Get the calibration pix from the calibration cam 1000 // 1001 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 1002 const Float_t charge = apix.GetConvertedMean(); 1003 const Float_t chargeerr = apix.GetConvertedSigma(); 1004 1005 chargearea[i] = charge; 1006 chargeareaerr[i] = chargeerr; 1007 1008 nr[i] = i; 1009 nrerr[i] = 0.; 1010 } 1011 1012 TGraphErrors *gr = new TGraphErrors(size, 1013 nr.GetArray(),chargearea.GetArray(), 1014 nrerr.GetArray(),chargeareaerr.GetArray()); 1015 gr->SetTitle(Form("Averaged Charges Area Idx %d",aidx)); 1016 gr->GetXaxis()->SetTitle("Camera Nr."); 1017 gr->GetYaxis()->SetTitle("<Q> [FADC cnts]"); 1018 return gr; 1019 } 1020 1021 TH1F *MCalibrationIntensityChargeCam::GetVarFluctuations( const Int_t aidx, const MGeomCam &geom, const Option_t *varname ) 1022 { 1023 1024 const Int_t size = GetSize(); 1025 1026 if (size == 0) 1027 return NULL; 1028 1029 TString option(varname); 1030 option.ToLower(); 1031 1032 TH1F *hist = new TH1F("hist",Form("%s - Rel. Fluctuations %s Pixel",option.Data(),aidx ? "Outer" : "Inner"), 1033 200,0.,100.); 1034 hist->SetXTitle("Relative Fluctuation [%]"); 1035 hist->SetYTitle("Nr. channels [1]"); 1036 hist->SetFillColor(kRed+aidx); 1037 1038 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(); 1039 1040 // 1041 // Loop over pixels 1042 // 1043 for (Int_t npix=0;npix<cam->GetSize();npix++) 1044 { 1045 if (geom[npix].GetAidx() != aidx) 1046 continue; 1047 1048 Double_t variab = 0.; 1049 Double_t variab2 = 0.; 1050 Double_t variance = 0.; 1051 Int_t num = 0; 1052 Float_t pvar = 0.; 1053 Float_t relrms = 99.9; 1054 // 1055 // Loop over the Cams for each pixel 1056 // 1057 for (Int_t i=0; i<GetSize(); i++) 1058 { 1059 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 1060 // 1061 // Get the calibration pix from the calibration cam 1062 // 1063 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[npix]; 1064 // 1065 // Don't use bad pixels 1066 // 1067 if (!pix.IsFFactorMethodValid()) 1068 continue; 1069 1070 if (option.Contains("rsigma")) 737 1071 pvar = pix.GetRSigma(); 738 if (option.Contains("abstime "))1072 if (option.Contains("abstimemean")) 739 1073 pvar = pix.GetAbsTimeMean(); 1074 if (option.Contains("abstimerms")) 1075 pvar = pix.GetAbsTimeRms(); 740 1076 if (option.Contains("conversionhilo")) 741 1077 pvar = pix.GetConversionHiLo(); … … 758 1094 if (option.Contains("rsigmapercharge")) 759 1095 pvar = pix.GetRSigmaPerCharge(); 1096 if (option.Contains("conversionfactor")) 1097 { 1098 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(0); 1099 pvar = apix.GetPheFFactorMethod()/pix.GetConvertedMean(); 1100 } 1101 760 1102 761 1103 variab += pvar; 762 1104 variab2 += pvar*pvar; 763 1105 num++; 764 765 camcharge.Fill(j,pvar);766 camcharge.SetUsed(j);767 }768 769 if (num > 1)770 {771 variab /= num;772 variance = (variab2 - variab*variab*num) / (num-1);773 774 vararea[i] = variab;775 if (variance > 0.)776 varareaerr[i] = TMath::Sqrt(variance);777 else778 varareaerr[i] = 999999999.;779 780 //781 // Make also a Gauss-fit to the distributions. The RMS can be determined by782 // outlier, thus we look at the sigma and the RMS and take the smaller one, afterwards.783 //784 h = camcharge.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750);785 h->SetDirectory(NULL);786 h->Fit("gaus","QL");787 TF1 *fit = h->GetFunction("gaus");788 789 Float_t ci2 = fit->GetChisquare();790 Float_t sigma = fit->GetParameter(2);791 792 if (ci2 > 500. || sigma > varareaerr[i])793 {794 h->Fit("gaus","QLM");795 fit = h->GetFunction("gaus");796 797 ci2 = fit->GetChisquare();798 sigma = fit->GetParameter(2);799 }800 801 const Float_t mean = fit->GetParameter(1);802 const Float_t ndf = fit->GetNDF();803 804 *fLog << inf << "Camera Nr: " << i << endl;805 *fLog << inf << option.Data() << " area idx: " << aidx << " Results: " << endl;806 *fLog << inf << "Mean: " << Form("%4.3f",mean)807 << "+-" << Form("%4.3f",fit->GetParError(1))808 << " Sigma: " << Form("%4.3f",sigma) << "+-" << Form("%4.3f",fit->GetParError(2))809 << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl;810 delete h;811 gROOT->GetListOfFunctions()->Remove(fit);812 813 if (sigma < varareaerr[i] && ndf > 2)814 {815 vararea [i] = mean;816 varareaerr[i] = sigma;817 }818 }819 else820 {821 vararea[i] = -1.;822 varareaerr[i] = 0.;823 }824 825 nr[i] = i;826 nrerr[i] = 0.;827 }828 829 TGraphErrors *gr = new TGraphErrors(size,830 nr.GetArray(),vararea.GetArray(),831 nrerr.GetArray(),varareaerr.GetArray());832 gr->SetTitle(Form("%s Area %3i Average",option.Data(),aidx));833 gr->GetXaxis()->SetTitle("Camera Nr.");834 // gr->GetYaxis()->SetTitle("<Q> [1]");835 return gr;836 }837 838 839 // -------------------------------------------------------------------840 //841 // Returns a TGraphErrors with the mean effective number of photon842 // vs. the calibration camera number. With the string 'method', different843 // calibration methods can be called.844 //845 TGraphErrors *MCalibrationIntensityChargeCam::GetPhotVsTime( const Option_t *method )846 {847 848 const Int_t size = GetSize();849 850 if (size == 0)851 return NULL;852 853 TString option(method);854 855 TArrayF photarr(size);856 TArrayF photarrerr(size);857 TArrayF nr(size);858 TArrayF nrerr(size);859 860 for (Int_t i=0;i<GetSize();i++)861 {862 //863 // Get the calibration cam from the intensity cam864 //865 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i);866 867 //868 // Get the calibration pix from the calibration cam869 //870 Float_t phot = 0.;871 Float_t photerr = 0.;872 873 if (option.Contains("BlindPixel"))874 {875 phot = cam->GetNumPhotonsBlindPixelMethod();876 photerr = cam->GetNumPhotonsBlindPixelMethodErr();877 }878 if (option.Contains("FFactor"))879 {880 phot = cam->GetNumPhotonsFFactorMethod();881 photerr = cam->GetNumPhotonsFFactorMethodErr();882 }883 if (option.Contains("PINDiode"))884 {885 phot = cam->GetNumPhotonsPINDiodeMethod();886 photerr = cam->GetNumPhotonsPINDiodeMethodErr();887 }888 889 photarr[i] = phot;890 photarrerr[i] = photerr;891 892 nr[i] = i;893 nrerr[i] = 0.;894 }895 896 TGraphErrors *gr = new TGraphErrors(size,897 nr.GetArray(),photarr.GetArray(),898 nrerr.GetArray(),photarrerr.GetArray());899 gr->SetTitle("Photons Average");900 gr->GetXaxis()->SetTitle("Camera Nr.");901 gr->GetYaxis()->SetTitle("<N_phot> [1]");902 return gr;903 }904 905 // -------------------------------------------------------------------906 //907 // Returns a TGraphErrors with the mean effective number of photo-electrons per908 // area index 'aidx' vs. the calibration camera number909 //910 TGraphErrors *MCalibrationIntensityChargeCam::GetPhePerAreaVsTime( const Int_t aidx, const MGeomCam &geom)911 {912 913 const Int_t size = GetSize();914 915 if (size == 0)916 return NULL;917 918 TArrayF phearea(size);919 TArrayF pheareaerr(size);920 TArrayF time(size);921 TArrayF timeerr(size);922 923 for (Int_t i=0;i<GetSize();i++)924 {925 //926 // Get the calibration cam from the intensity cam927 //928 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i);929 930 //931 // Get the calibration pix from the calibration cam932 //933 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx);934 const Float_t phe = apix.GetPheFFactorMethod();935 const Float_t pheerr = apix.GetPheFFactorMethodErr();936 937 phearea[i] = phe;938 pheareaerr[i] = pheerr;939 940 time[i] = i;941 timeerr[i] = 0.;942 }943 944 TGraphErrors *gr = new TGraphErrors(size,945 time.GetArray(),phearea.GetArray(),946 timeerr.GetArray(),pheareaerr.GetArray());947 gr->SetTitle(Form("Phes Area %d Average",aidx));948 gr->GetXaxis()->SetTitle("Camera Nr.");949 gr->GetYaxis()->SetTitle("<N_phes> [1]");950 return gr;951 }952 953 // -------------------------------------------------------------------954 //955 // Returns a TGraphErrors with the event-by-event averaged charge per956 // area index 'aidx' vs. the calibration camera number957 //958 TGraphErrors *MCalibrationIntensityChargeCam::GetChargePerAreaVsTime( const Int_t aidx, const MGeomCam &geom)959 {960 961 const Int_t size = GetSize();962 963 if (size == 0)964 return NULL;965 966 TArrayF chargearea(size);967 TArrayF chargeareaerr(size);968 TArrayF nr(size);969 TArrayF nrerr(size);970 971 for (Int_t i=0;i<GetSize();i++)972 {973 //974 // Get the calibration cam from the intensity cam975 //976 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i);977 978 //979 // Get the calibration pix from the calibration cam980 //981 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx);982 const Float_t charge = apix.GetConvertedMean();983 const Float_t chargeerr = apix.GetConvertedSigma();984 985 chargearea[i] = charge;986 chargeareaerr[i] = chargeerr;987 988 nr[i] = i;989 nrerr[i] = 0.;990 }991 992 TGraphErrors *gr = new TGraphErrors(size,993 nr.GetArray(),chargearea.GetArray(),994 nrerr.GetArray(),chargeareaerr.GetArray());995 gr->SetTitle(Form("Averaged Charges Area Idx %d",aidx));996 gr->GetXaxis()->SetTitle("Camera Nr.");997 gr->GetYaxis()->SetTitle("<Q> [FADC cnts]");998 return gr;999 }1000 1001 TH1F *MCalibrationIntensityChargeCam::GetVarFluctuations( const Int_t aidx, const MGeomCam &geom, const Option_t *varname )1002 {1003 1004 const Int_t size = GetSize();1005 1006 if (size == 0)1007 return NULL;1008 1009 TString option(varname);1010 1011 TH1F *hist = new TH1F("hist",Form("%s - Rel. Fluctuations %s Pixel",option.Data(),aidx ? "Outer" : "Inner"),1012 200,0.,100.);1013 hist->SetXTitle("Relative Fluctuation [%]");1014 hist->SetYTitle("Nr. channels [1]");1015 hist->SetFillColor(kRed+aidx);1016 1017 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam();1018 1019 //1020 // Loop over pixels1021 //1022 for (Int_t npix=0;npix<cam->GetSize();npix++)1023 {1024 if (geom[npix].GetAidx() != aidx)1025 continue;1026 1027 Double_t variab = 0.;1028 Double_t variab2 = 0.;1029 Double_t variance = 0.;1030 Int_t num = 0;1031 Float_t pvar = 0.;1032 Float_t relrms = 99.9;1033 //1034 // Loop over the Cams for each pixel1035 //1036 for (Int_t i=0; i<GetSize(); i++)1037 {1038 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i);1039 //1040 // Get the calibration pix from the calibration cam1041 //1042 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[npix];1043 //1044 // Don't use bad pixels1045 //1046 if (!pix.IsFFactorMethodValid())1047 continue;1048 1049 if (option.Contains("RSigma"))1050 pvar = pix.GetRSigma();1051 if (option.Contains("AbsTime"))1052 pvar = pix.GetAbsTimeMean();1053 if (option.Contains("ConversionHiLo"))1054 pvar = pix.GetConversionHiLo();1055 if (option.Contains("ConvertedMean"))1056 pvar = pix.GetConvertedMean();1057 if (option.Contains("ConvertedSigma"))1058 pvar = pix.GetConvertedSigma();1059 if (option.Contains("ConvertedRSigma"))1060 pvar = pix.GetConvertedRSigma();1061 if (option.Contains("MeanConvFADC2Phe"))1062 pvar = pix.GetMeanConvFADC2Phe();1063 if (option.Contains("MeanFFactorFADC2Phot"))1064 pvar = pix.GetMeanFFactorFADC2Phot();1065 if (option.Contains("Ped"))1066 pvar = pix.GetPed();1067 if (option.Contains("PedRms"))1068 pvar = pix.GetPedRms();1069 if (option.Contains("PheFFactorMethod"))1070 pvar = pix.GetPheFFactorMethod();1071 if (option.Contains("RSigmaPerCharge"))1072 pvar = pix.GetRSigmaPerCharge();1073 1074 variab += pvar;1075 variab2 += pvar*pvar;1076 num++;1077 1106 } 1078 1107 -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
r6963 r7188 40 40 // - FinalizeBadPixels() 41 41 // 42 // Class Version 2: 43 // + Byte_t fCheckFlags; // Bit-field to hold the possible check flags 44 // 45 // 42 46 // Input Containers: 43 47 // MCalibrationRelTimeCam … … 71 75 #include "MBadPixelsPix.h" 72 76 73 74 77 ClassImp(MCalibrationRelTimeCalc); 75 78 … … 77 80 78 81 const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 1.0; 82 79 83 // -------------------------------------------------------------------------- 80 84 // … … 97 101 fName = name ? name : "MCalibrationRelTimeCalc"; 98 102 fTitle = title ? title : "Task to finalize the relative time calibration"; 99 103 104 SetCheckFitResults ( kFALSE ); 105 SetCheckDeviatingBehavior( kFALSE ); 106 SetCheckHistOverflow ( kFALSE ); 107 SetCheckOscillations ( kFALSE ); 108 100 109 SetRelTimeResolutionLimit(); 101 110 SetOutputPath(); 102 111 SetOutputFile(""); 103 112 104 113 Clear(); 105 114 106 115 } 107 116 … … 268 277 269 278 PrintUncalibrated(MBadPixelsPix::kDeviatingTimeResolution, 270 Form("%s%2.1f%s","Time resol ution less than ",fRelTimeResolutionLimit," FADC slices from Mean:"));279 Form("%s%2.1f%s","Time resol. less than ",fRelTimeResolutionLimit," FADC sl. from Mean: ")); 271 280 PrintUncalibrated(MBadPixelsPix::kRelTimeOscillating, 272 281 "Pixels with changing Rel. Times over time: "); … … 437 446 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i]; 438 447 439 if (bad.IsUncalibrated( MBadPixelsPix::kDeviatingTimeResolution)) 440 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 441 442 if (bad.IsUncalibrated( MBadPixelsPix::kRelTimeNotFitted)) 443 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 444 445 if (bad.IsUncalibrated( MBadPixelsPix::kRelTimeOscillating)) 446 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 447 448 if (bad.IsUnsuitable( MBadPixelsPix::kUnsuitableRun )) 449 pix.SetExcluded(); 450 451 } 448 if (IsCheckDeviatingBehavior()) 449 if (bad.IsUncalibrated(MBadPixelsPix::kDeviatingTimeResolution)) 450 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 451 452 if (IsCheckFitResults()) 453 if (bad.IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted)) 454 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 455 456 if (IsCheckOscillations()) 457 if (bad.IsUncalibrated(MBadPixelsPix::kRelTimeOscillating)) 458 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 459 460 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 461 pix.SetExcluded(); 462 } 463 452 464 } 453 465 … … 488 500 489 501 if (fGeom->InheritsFrom("MGeomCamMagic")) 490 *fLog << " " << setw(7) << "Uncalibrated Pixels: "491 << Form("% s%3i%s%3i","Inner: ",counts[0]," Outer:",counts[1]) << endl;502 *fLog << " " << setw(7) << "Uncalibrated Pixels: Inner: " 503 << Form("%3i",counts[0]) << " Outer: " << Form("%3i",counts[1]) << endl; 492 504 493 505 counts.Reset(); … … 506 518 relcam->SetNumUnreliable(counts[aidx], aidx); 507 519 508 *fLog << " " << setw(7) << "Unreliable Pixels: "509 << Form("% s%3i%s%3i","Inner: ",counts[0]," Outer:",counts[1]) << endl;520 *fLog << " " << setw(7) << "Unreliable Pixels: Inner: " 521 << Form("%3i",counts[0]) << " Outer: " << Form("%3i",counts[1]) << endl; 510 522 511 523 } … … 545 557 void MCalibrationRelTimeCalc::SetOutputPath(TString path) 546 558 { 547 fOutputPath = path;548 if (fOutputPath.EndsWith("/"))549 fOutputPath = fOutputPath(0, fOutputPath.Length()-1);559 fOutputPath = path; 560 if (fOutputPath.EndsWith("/")) 561 fOutputPath = fOutputPath(0, fOutputPath.Length()-1); 550 562 } 551 563 … … 556 568 const char* MCalibrationRelTimeCalc::GetOutputFile() 557 569 { 558 return Form("%s/%s", (const char*)fOutputPath, (const char*)fOutputFile); 559 } 570 return Form("%s/%s", (const char*)fOutputPath, (const char*)fOutputFile); 571 } 572 573 574 // -------------------------------------------------------------------------- 575 // 576 // MCalibrationRelTimeCam.CheckFitResults: Yes 577 // MCalibrationRelTimeCam.CheckDeviatingBehavior: Yes 578 // MCalibrationRelTimeCam.CheckHistOverflow: Yes 579 // MCalibrationRelTimeCam.CheckOscillations: Yes 580 // 581 Int_t MCalibrationRelTimeCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 582 { 583 Bool_t rc = kFALSE; 584 585 if (IsEnvDefined(env, prefix, "CheckFitResults", print)) 586 { 587 SetCheckFitResults(GetEnvValue(env, prefix, "CheckFitResults", IsCheckFitResults())); 588 rc = kTRUE; 589 } 590 if (IsEnvDefined(env, prefix, "CheckDeviatingBehavior", print)) 591 { 592 SetCheckDeviatingBehavior(GetEnvValue(env, prefix, "CheckDeviatingBehavior", IsCheckDeviatingBehavior())); 593 rc = kTRUE; 594 } 595 if (IsEnvDefined(env, prefix, "CheckHistOverflow", print)) 596 { 597 SetCheckHistOverflow(GetEnvValue(env, prefix, "CheckHistOverflow", IsCheckHistOverflow())); 598 rc = kTRUE; 599 } 600 601 if (IsEnvDefined(env, prefix, "CheckOscillations", print)) 602 { 603 SetCheckOscillations(GetEnvValue(env, prefix, "CheckOscillations", IsCheckOscillations())); 604 rc = kTRUE; 605 } 606 607 return rc; 608 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h
r5679 r7188 43 43 MGeomCam *fGeom; //! Camera geometry 44 44 45 // enums 46 enum Check_t 47 { 48 kCheckHistOverflow, 49 kCheckDeviatingBehavior, 50 kCheckOscillations, 51 kCheckFitResults 52 }; // Possible Checks 53 54 Byte_t fCheckFlags; // Bit-field to hold the possible check flags 55 45 56 enum { kDebug }; // Possible flags 46 57 … … 56 67 void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const; 57 68 69 // Query checks 70 Bool_t IsCheckDeviatingBehavior() const { return TESTBIT(fCheckFlags,kCheckDeviatingBehavior); } 71 Bool_t IsCheckHistOverflow () const { return TESTBIT(fCheckFlags,kCheckHistOverflow); } 72 Bool_t IsCheckOscillations () const { return TESTBIT(fCheckFlags,kCheckOscillations); } 73 Bool_t IsCheckFitResults () const { return TESTBIT(fCheckFlags,kCheckFitResults); } 74 75 // MTask 58 76 Bool_t ReInit (MParList *pList); 59 77 Int_t Process () { return kTRUE; } 60 78 Int_t PostProcess(); 61 79 80 // MParContainer 81 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 82 62 83 public: 63 64 84 MCalibrationRelTimeCalc(const char *name=NULL, const char *title=NULL); 65 85 86 // TObject 66 87 void Clear(const Option_t *o=""); 67 88 89 // MCalibrationRelTimeCalc 68 90 Int_t Finalize(); 69 91 92 // Getter 70 93 Bool_t IsDebug() const { return TESTBIT(fFlags,kDebug); } 71 94 72 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }95 // Setter 73 96 void SetOutputPath ( TString path="." ); 74 97 void SetOutputFile ( TString file="TimeCalibStat.txt" ) { fOutputFile = file; } 75 98 void SetRelTimeResolutionLimit( const Float_t f=fgRelTimeResolutionLimit ) { fRelTimeResolutionLimit = f; } 76 99 77 ClassDef(MCalibrationRelTimeCalc, 1) // Task finalizing the relative time Calibration 100 // Checks 101 void SetCheckFitResults(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckFitResults) : CLRBIT(fCheckFlags,kCheckFitResults); } 102 void SetCheckDeviatingBehavior(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckDeviatingBehavior) : CLRBIT(fCheckFlags,kCheckDeviatingBehavior); } 103 void SetCheckHistOverflow(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckHistOverflow) : CLRBIT(fCheckFlags,kCheckHistOverflow); } 104 void SetCheckOscillations(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckOscillations) : CLRBIT(fCheckFlags,kCheckOscillations); } 105 void SetDebug(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kDebug) : CLRBIT(fFlags, kDebug); } 106 107 ClassDef(MCalibrationRelTimeCalc, 2) // Task finalizing the relative time Calibration 78 108 }; 79 109 -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
r7005 r7188 71 71 using namespace std; 72 72 73 MMcCalibrationCalc::MMcCalibrationCalc(const char *name, const char *title) 73 // -------------------------------------------------------------------------- 74 // 75 // Constructor. Default value for fMinSize is 1000 ADC counts. This must be 76 // set in general by the user (SetMinSize), since it depends among other things 77 // on the signal extractor used. 78 // 79 MMcCalibrationCalc::MMcCalibrationCalc(const char *name, const char *title): fMinSize(1000) 74 80 { 75 81 fName = name ? name : "MMcCalibrationCalc"; 76 82 fTitle = title ? title : "Calculate and write conversion factors into MCalibrationChargeCam and MCalibrationQECam containers"; 77 78 fHistADC2PhotEl = new TH1F(AddSerialNumber("ADC2PhotEl"), "log10(fPhotElfromShower/fSize)", 1500, -3., 3.);79 fHistADC2PhotEl->SetXTitle("log_{10}(fPhotElfromShower / fSize) [photel/ADC count]");80 81 82 fHistPhot2PhotEl = new TH1F(AddSerialNumber("Phot2PhotEl"), "Photon conversion efficiency", 1000, 0., 1.);83 fHistPhot2PhotEl->SetXTitle("Overall photon conversion efficiency [photoelectron/photon]");84 85 83 } 86 84 … … 93 91 Bool_t MMcCalibrationCalc::CheckRunType(MParList *pList) const 94 92 { 95 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject( "MRawRunHeader");93 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 96 94 if (!run) 97 95 { 98 *fLog << warn << "Warning - cannot check file type, MRawRunHeader not found." << endl; 99 return kTRUE; 96 *fLog << warn << "Warning - cannot check file type, " << AddSerialNumber("MRawRunHeader") 97 << " not found." << endl; 98 return kTRUE; 100 99 } 101 100 … … 105 104 // -------------------------------------------------------------------------- 106 105 // 107 // Make sure, that there is an MCalibrationCam Object in the Parameter List.106 // Look for all necessary containers and create histograms 108 107 // 109 108 Int_t MMcCalibrationCalc::PreProcess(MParList *pList) 110 109 { 111 fHistADC2PhotEl->Reset();112 fHistPhot2PhotEl->Reset();113 114 110 fADC2PhotEl = 0; 115 111 fPhot2PhotEl = 0; … … 156 152 return kFALSE; 157 153 } 154 155 // 156 // Create histograms: 157 // 158 159 fHistADC2PhotEl = new TH1F(AddSerialNumber("ADC2PhotEl"), "log10(fPhotElfromShower/fSize)", 1500, -3., 3.); 160 fHistADC2PhotEl->SetXTitle("log_{10}(fPhotElfromShower / fSize) [photel/ADC count]"); 161 162 163 fHistPhot2PhotEl = new TH1F(AddSerialNumber("Phot2PhotEl"), "Photon conversion efficiency", 1000, 0., 1.); 164 fHistPhot2PhotEl->SetXTitle("Overall photon conversion efficiency [photoelectron/photon]"); 165 158 166 159 167 return kTRUE; … … 210 218 // perpendicular to the camera plane. 211 219 // 212 // FIXME! We should look for AddSerialNumber("MMcConfigRunHeader") but 213 // for the moment the stereo version of camera does not write one such 214 // header per telescope (it should!) 215 // 216 MMcConfigRunHeader* mcconfig = (MMcConfigRunHeader*) pList->FindObject("MMcConfigRunHeader"); 220 MMcConfigRunHeader* mcconfig = (MMcConfigRunHeader*) pList->FindObject(AddSerialNumber("MMcConfigRunHeader")); 217 221 if (!mcconfig) 218 222 { 219 *fLog << err << "MMcConfigRunHeader"<< " not found... aborting." << endl;223 *fLog << err << AddSerialNumber("MMcConfigRunHeader") << " not found... aborting." << endl; 220 224 return kFALSE; 221 225 } … … 253 257 // 254 258 // Exclude events with low Size (larger fluctuations) 255 // FIXME? The present cut (1000 "inner-pixel-counts") is somehow256 // arbitrary. Might it be optimized?257 259 // 258 260 259 if (size < 1000)261 if (size < fMinSize) 260 262 return kTRUE; 261 263 … … 288 290 } 289 291 290 fPhot2PhotEl = fHistPhot2PhotEl->GetMean(); // Average quantum efficiency 292 fPhot2PhotEl = fHistPhot2PhotEl->GetMean(); 293 // Average quantum efficiency. For now we will set this value for all pixels, although 294 // even in MC there may be differences from pixel to pixel, if the .dat file containing 295 // QE vs lambda, input of the camera simulation, has different QE curves for different 296 // pixels. FIXME? 297 298 MCalibrationQEPix &avqepix = (MCalibrationQEPix&)(fQECam->GetAverageArea(0)); 299 avqepix.SetAverageQE(fPhot2PhotEl); // Needed by MCalibrateData! 291 300 292 301 // … … 335 344 // FIXME: we are now assuming that all inner pixels have the same gain, and all 336 345 // outer pixels have the same gain (different from inner ones though). This can 337 // only be like this in camera 0.7, but m aychange in future versions of camera.346 // only be like this in camera 0.7, but might change in future versions of camera. 338 347 // 339 348 … … 347 356 } 348 357 358 349 359 return kTRUE; 350 360 } -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h
r4710 r7188 35 35 // outer pixels w.r.t inner ones 36 36 37 Float_t fMinSize; 38 // Minimum SIZE (before calibration, ADC counts) an event must have to be considered in the 39 // calculation of the calibration constants. 40 37 41 TH1F* fHistADC2PhotEl; 38 42 TH1F* fHistPhot2PhotEl; // Histograms for monitoring the calibration. … … 50 54 TH1F* GetHistPhot2PhotEl() { return fHistPhot2PhotEl; } 51 55 56 void SetMinSize(Float_t x) { fMinSize = x; } 57 52 58 ClassDef(MMcCalibrationCalc, 0) // Task which obtains, for MC files, the calibration factor from ADC counts to photons. 53 59 }; -
trunk/MagicSoft/Mars/mcalib/Makefile
r6662 r7188 40 40 MCalibrateRelTimes.cc \ 41 41 MCalibrationIntensityCam.cc \ 42 MCalibrationIntensityConstCam.cc \ 42 43 MCalibrationIntensityChargeCam.cc \ 43 44 MCalibrationIntensityBlindCam.cc \ -
trunk/MagicSoft/Mars/merpp.cc
r7116 r7188 332 332 w->AddContainer("MCameraCalibration", "Camera"); 333 333 w->AddContainer("MCameraCooling", "Camera"); 334 w->AddContainer("MCameraActiveLoad", "Camera"); 334 335 w->AddContainer("MCameraHV", "Camera"); 335 336 w->AddContainer("MCameraLV", "Camera"); -
trunk/MagicSoft/Mars/mhcalib/HCalibLinkDef.h
r6598 r7188 15 15 #pragma link C++ class MHCalibrationTestCam+; 16 16 #pragma link C++ class MHCalibrationHiLoCam+; 17 #pragma link C++ class MHCalibrationHiLoPix+; 17 18 #pragma link C++ class MHCalibrationPulseTimeCam+; 18 19 #pragma link C++ class MHPedestalCam+; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
r7095 r7188 60 60 // + Bool_t fIsLoGainFitRanges; // Are low-gain fit ranges defined? 61 61 // 62 // Class Version 5: 63 // + Int_t fMaxNumEvts; // Max Number of events 62 64 // 63 65 ///////////////////////////////////////////////////////////////////////////// … … 103 105 const Float_t MHCalibrationCam::fgProbLimit = 0.0001; 104 106 const Float_t MHCalibrationCam::fgOverflowLimit = 0.005; 107 const Int_t MHCalibrationCam::fgMaxNumEvts = 4096; 105 108 106 109 const TString MHCalibrationCam::gsHistName = "Hist"; … … 141 144 fHistName(gsHistName),fHistTitle(gsHistTitle), 142 145 fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle), 146 fCurrentNumEvts(0), 143 147 fColor(MCalibrationCam::kNONE), fIntensBad(NULL), 144 148 fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL), … … 167 171 SetProbLimit(); 168 172 SetOverflowLimit(); 173 SetMaxNumEvts(); 169 174 170 175 SetAverageing (kTRUE); … … 385 390 { 386 391 SetIsReset(); 392 393 fCurrentNumEvts = 0; 387 394 388 395 ResetHistTitles(); … … 543 550 } 544 551 552 fCurrentNumEvts = 0; 553 545 554 return SetupHists(pList); 546 555 } … … 630 639 631 640 MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i]; 632 if (bad.Is Bad())641 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 633 642 continue; 634 643 … … 649 658 SetLoGain(fRunHeader->GetNumSamplesLoGain()); 650 659 } 660 661 fCurrentNumEvts = 0; 651 662 652 663 if (!ReInitHists(pList)) … … 874 885 Bool_t MHCalibrationCam::Fill(const MParContainer *par, const Stat_t w) 875 886 { 887 if (fCurrentNumEvts >= fMaxNumEvts) 888 return kTRUE; 889 890 fCurrentNumEvts++; 891 876 892 SetIsReset(kFALSE); 877 893 … … 950 966 if (GetNumExecutions() < 2) 951 967 return kTRUE; 968 969 *fLog << inf << GetDescriptor() << ": Number of event used to fill histograms == " << fCurrentNumEvts << endl; 952 970 953 971 if (fHiGainArray->GetSize() == 0 && fLoGainArray->GetSize() == 0) … … 1180 1198 void MHCalibrationCam::CalcAverageSigma() 1181 1199 { 1182 1183 if (!fCam)1184 return;1185 1186 1200 if (!IsAverageing()) 1187 1201 return; 1188 1202 1203 MCalibrationCam *cam = fIntensCam ? fIntensCam->GetCam() : fCam; 1204 if (!cam) 1205 return; 1206 1189 1207 for (UInt_t j=0; j<fGeom->GetNumAreas(); j++) 1190 1208 { 1191 1209 1192 MCalibrationPix &pix = fCam->GetAverageArea(j);1210 MCalibrationPix &pix = cam->GetAverageArea(j); 1193 1211 1194 1212 const Float_t numsqr = TMath::Sqrt((Float_t)fAverageAreaNum[j]); … … 1203 1221 fAverageAreaRelSigmaVar[j] += pix.GetMeanRelVar(); 1204 1222 fAverageAreaRelSigmaVar[j] *= fAverageAreaRelSigma[j]; 1223 } 1224 1225 for (UInt_t j=0; j<fGeom->GetNumSectors(); j++) 1226 { 1227 MCalibrationPix &pix = cam->GetAverageSector(j); 1228 1229 const Float_t numsqr = TMath::Sqrt((Float_t)fAverageSectorNum[j]); 1230 pix.SetSigma (pix.GetSigma() * numsqr); 1231 pix.SetSigmaVar(pix.GetSigmaErr() * pix.GetSigmaErr() * numsqr); 1205 1232 } 1206 1233 } … … 1283 1310 { 1284 1311 *fLog << dbginf << GetDescriptor() << ": ID " << GetName() 1312 << " "<<pix.GetPixId() 1285 1313 << " HiGainSaturation: " << pix.IsHiGainSaturation() 1286 1314 << " HiGainMean: " << hist.GetMean () … … 1374 1402 { 1375 1403 *fLog << dbginf << GetDescriptor() << "ID: " << hist.GetName() 1376 << " HiGainSaturation: " << pix.IsHiGainSaturation() 1404 << " "<<pix.GetPixId() 1405 << " HiGainSaturation: " << pix.IsHiGainSaturation() 1377 1406 << " LoGainMean: " << hist.GetMean () 1378 1407 << " LoGainMeanErr: " << hist.GetMeanErr () … … 1546 1575 rc = kTRUE; 1547 1576 } 1577 1578 if (IsEnvDefined(env, prefix, "MaxNumEvts", print)) 1579 { 1580 SetMaxNumEvts(GetEnvValue(env, prefix, "MaxNumEvts", fMaxNumEvts)); 1581 rc = kTRUE; 1582 } 1548 1583 1549 1584 if (IsEnvDefined(env, prefix, "OverflowLimit", print)) -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h
r7095 r7188 40 40 41 41 private: 42 static const Double_t fgLowerFitLimitHiGain; //! The default for fLowerFitLimitHiGain (now at: 0) 43 static const Double_t fgUpperFitLimitHiGain; //! The default for fUpperFitLimitHiGain (now at: 0) 44 static const Double_t fgLowerFitLimitLoGain; //! The default for fLowerFitLimitLoGain (now at: 0) 45 static const Double_t fgUpperFitLimitLoGain; //! The default for fUpperFitLimitLoGain (now at: 0) 46 47 static const Int_t fgPulserFrequency; //! The default for fPulserFrequency (now set to: 500) 48 static const Float_t fgProbLimit; //! The default for fProbLimit (now set to: 0.0001) 49 static const Float_t fgOverflowLimit; //! The default for fOverflowLimit (now at: 0.005) 42 static const Double_t fgLowerFitLimitHiGain; //! Default for fLowerFitLimitHiGain 43 static const Double_t fgUpperFitLimitHiGain; //! Default for fUpperFitLimitHiGain 44 static const Double_t fgLowerFitLimitLoGain; //! Default for fLowerFitLimitLoGain 45 static const Double_t fgUpperFitLimitLoGain; //! Default for fUpperFitLimitLoGain 46 47 static const Int_t fgPulserFrequency; //! Default for fPulserFrequency 48 static const Float_t fgProbLimit; //! Default for fProbLimit 49 static const Float_t fgOverflowLimit; //! Default for fOverflowLimit 50 static const Int_t fgMaxNumEvts; //! Default for fMaxNumEvts 50 51 51 52 static const TString gsHistName; //! Default Histogram names … … 78 79 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated 79 80 Float_t fNumLoGainSaturationLimit; // Rel. amount sat. logain FADC slices until pixel is called saturated 81 82 Int_t fMaxNumEvts; // Max Number of events 83 Int_t fCurrentNumEvts; //! Current number of events 80 84 81 85 MArrayI fRunNumbers; // Numbers of runs used … … 191 195 void DrawPixelContent( Int_t num ) const {} 192 196 197 const MArrayI &GetAverageAreaNum () const { return fAverageAreaNum; } 193 198 const Int_t GetAverageAreas () const; 194 199 MHCalibrationPix &GetAverageHiGainArea (UInt_t i); … … 200 205 MHCalibrationPix &GetAverageLoGainSector(UInt_t i); 201 206 const MHCalibrationPix &GetAverageLoGainSector(UInt_t i) const; 202 const Int_t GetAverageSectors () const; 207 const MArrayI &GetAverageSectorNum () const { return fAverageSectorNum; } 208 const Int_t GetAverageSectors () const; 203 209 const MCalibrationCam::PulserColor_t GetColor () const { return fColor; } 204 210 const Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; } … … 234 240 void SetFirst ( const Axis_t f ) { fFirst = f; } 235 241 void SetLast ( const Axis_t f ) { fLast = f; } 242 void SetMaxNumEvts ( const Int_t i=fgMaxNumEvts ) { fMaxNumEvts = i; } 236 243 237 244 void SetProbLimit ( const Float_t f=fgProbLimit) { fProbLimit = f; } … … 242 249 void SetPulserFrequency ( const Int_t i=fgPulserFrequency ) { fPulserFrequency = i; } 243 250 244 ClassDef(MHCalibrationCam, 5) // Base Histogram class for Calibration Camera251 ClassDef(MHCalibrationCam, 6) // Base Histogram class for Calibration Camera 245 252 }; 246 253 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
r7126 r7188 64 64 // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup) 65 65 // 66 // Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC66 // If more than fNumHiGainSaturationLimit (default: 15%) of the overall FADC 67 67 // slices show saturation, the following flag is set: 68 68 // - MCalibrationChargePix::SetHiGainSaturation(); … … 108 108 // sigmas in the camera. 109 109 // 110 // Class Version 2: 111 // + Float_t fNumLoGainBlackoutLimit; // Rel. amount blackout logain events until pixel is declared unsuitable 112 // 110 113 ///////////////////////////////////////////////////////////////////////////// 111 114 #include "MHCalibrationChargeCam.h" … … 157 160 158 161 const Int_t MHCalibrationChargeCam::fgChargeHiGainNbins = 500; 159 const Axis_t MHCalibrationChargeCam::fgChargeHiGainFirst = - 100.125;160 const Axis_t MHCalibrationChargeCam::fgChargeHiGainLast = 1 899.875;162 const Axis_t MHCalibrationChargeCam::fgChargeHiGainFirst = -98.; 163 const Axis_t MHCalibrationChargeCam::fgChargeHiGainLast = 1902.; 161 164 const Int_t MHCalibrationChargeCam::fgChargeLoGainNbins = 500; 162 const Axis_t MHCalibrationChargeCam::fgChargeLoGainFirst = - 100.25;163 const Axis_t MHCalibrationChargeCam::fgChargeLoGainLast = 899.75;165 const Axis_t MHCalibrationChargeCam::fgChargeLoGainFirst = -99.; 166 const Axis_t MHCalibrationChargeCam::fgChargeLoGainLast = 901.; 164 167 const Float_t MHCalibrationChargeCam::fgProbLimit = 0.00000001; 165 168 const TString MHCalibrationChargeCam::gsHistName = "Charge"; … … 173 176 const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.15; 174 177 const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005; 178 const Float_t MHCalibrationChargeCam::fgNumLoGainBlackoutLimit = 0.05; 179 const Float_t MHCalibrationChargeCam::fgLoGainBlackoutLimit = 3.5; 180 const Float_t MHCalibrationChargeCam::fgLoGainPickupLimit = 3.5; 175 181 const Float_t MHCalibrationChargeCam::fgTimeLowerLimit = 1.; 176 182 const Float_t MHCalibrationChargeCam::fgTimeUpperLimit = 3.; … … 189 195 // - fTimeLowerLimit to fgTimeLowerLimit 190 196 // - fTimeUpperLimit to fgTimeUpperLimit 197 // - fNumLoGainBlackoutLimit to fgNumLoGainBlackoutLimit 191 198 // 192 199 // - fNbins to fgChargeHiGainNbins … … 217 224 SetNumHiGainSaturationLimit(fgNumHiGainSaturationLimit); 218 225 SetNumLoGainSaturationLimit(fgNumLoGainSaturationLimit); 226 227 SetNumLoGainBlackoutLimit (fgNumLoGainBlackoutLimit); 219 228 220 229 SetTimeLowerLimit(); … … 571 580 pix.SetAbsTimeFirst(-0.5); 572 581 pix.SetAbsTimeLast(logainsamples-0.5); 573 582 pix.SetPickupLimit(fgLoGainPickupLimit); 583 pix.SetBlackoutLimit(fgLoGainBlackoutLimit); 584 574 585 InitHists(pix,(*badcam)[i],i); 575 586 … … 708 719 709 720 const Float_t sumhi = pix.GetExtractedSignalHiGain(); 710 const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated();721 const Bool_t sathi = pix.GetNumHiGainSaturated()>0; 711 722 712 723 if (IsOscillations()) … … 715 726 histhi.FillHist(sumhi); 716 727 717 histhi.AddSaturated(sathi); 728 histhi.AddSaturated(sathi); 718 729 719 730 const Int_t aidx = (*fGeom)[i].GetAidx(); … … 721 732 722 733 fSumhiarea[aidx] += sumhi; 723 fSathiarea[aidx] += sathi;724 725 734 fSumhisector[sector] += sumhi; 726 fSathisector[sector] += sathi; 735 if (sathi) 736 { 737 fSathiarea[aidx]++; 738 fSathisector[sector]++; 739 } 727 740 728 741 if (IsLoGain()) … … 939 952 continue; 940 953 } 954 955 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i] ; 956 if (!pix.IsHiGainSaturation()) 957 continue; 941 958 942 959 h = histlo.GetHGausHist(); … … 960 977 } 961 978 962 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i] ; 963 964 if (pix.IsHiGainSaturation()) 965 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 979 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 966 980 } 967 981 … … 1063 1077 MBadPixelsPix::kLoGainOscillating); 1064 1078 1079 // 1080 // Check for pixels which have the high-gain saturated, but the low-gain 1081 // switch not applied in sufficient cases. Have to exclude these pixels, 1082 // although they not abnormal. They simply cannot be calibrated... 1083 // 1084 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 1085 { 1086 1087 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i); 1088 if (histlo.IsExcluded()) 1089 continue; 1090 1091 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i] ; 1092 if (!pix.IsHiGainSaturation()) 1093 continue; 1094 1095 // 1096 // Now,treat only low-gain calibrated pixels: 1097 // 1098 const Double_t lim = fNumLoGainBlackoutLimit*histlo.GetHGausHist()->GetEntries(); 1099 if (histlo.GetBlackout() <= lim) 1100 continue; 1101 1102 MBadPixelsPix &bad = (*badcam)[i]; 1103 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 1104 bad.SetUncalibrated(MBadPixelsPix::kLoGainBlackout); 1105 } 1065 1106 1066 1107 return kTRUE; … … 1128 1169 MCalibrationPix &pix = (*chargecam)[i]; 1129 1170 1130 if (bad.IsUncalibrated( MBadPixelsPix::kHiGainNotFitted))1131 if (!pix.IsHiGainSaturation())1132 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun);1171 if (bad.IsUncalibrated(MBadPixelsPix::kHiGainNotFitted)) 1172 if (!pix.IsHiGainSaturation()) 1173 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 1133 1174 1134 if (bad.IsUncalibrated( MBadPixelsPix::kLoGainNotFitted))1135 if (pix.IsHiGainSaturation())1136 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun);1137 1138 if (bad.IsUncalibrated( MBadPixelsPix::kLoGainSaturation))1139 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun);1175 if (bad.IsUncalibrated(MBadPixelsPix::kLoGainNotFitted)) 1176 if (pix.IsHiGainSaturation()) 1177 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 1178 1179 if (bad.IsUncalibrated(MBadPixelsPix::kLoGainSaturation)) 1180 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 1140 1181 1141 1182 if (IsOscillations()) 1142 1183 { 1143 if (bad.IsUncalibrated( MBadPixelsPix::kHiGainOscillating )) 1144 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 1145 1146 if (bad.IsUncalibrated( MBadPixelsPix::kLoGainOscillating )) 1147 if (pix.IsHiGainSaturation()) 1148 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 1184 if (bad.IsUncalibrated(MBadPixelsPix::kHiGainOscillating)) 1185 if (!pix.IsHiGainSaturation()) 1186 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 1187 1188 if (bad.IsUncalibrated(MBadPixelsPix::kLoGainOscillating)) 1189 if (pix.IsHiGainSaturation()) 1190 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 1149 1191 } 1150 1192 } 1151 1152 1153 1154 1193 } 1155 1194 … … 1437 1476 } 1438 1477 1478 if (IsEnvDefined(env, prefix, "NumLoGainBlackoutLimit", print)) 1479 { 1480 SetNumLoGainBlackoutLimit(GetEnvValue(env, prefix, "NumLoGainBlackoutLimit", fNumLoGainBlackoutLimit)); 1481 rc = kTRUE; 1482 } 1483 1484 1439 1485 TEnv refenv(fReferenceFile); 1440 1486 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.h
r7043 r7188 44 44 static const TString gsAbsHistYTitle; //! Default Histogram y-axis titles abs.times 45 45 46 static const Float_t fgNumHiGainSaturationLimit; //! The default for fNumHiGainSaturationLimit 47 static const Float_t fgNumLoGainSaturationLimit; //! The default for fNumLoGainSaturationLimit 46 static const Float_t fgNumHiGainSaturationLimit; //! Default for fNumHiGainSaturationLimit 47 static const Float_t fgNumLoGainSaturationLimit; //! Default for fNumLoGainSaturationLimit 48 static const Float_t fgNumLoGainBlackoutLimit; //! Default for fNumLoGainBlackoutLimit (now at: 0.05) 49 50 static const Float_t fgLoGainBlackoutLimit; //! Default for low-gain blackout limit (now at: 3.5) 51 static const Float_t fgLoGainPickupLimit; //! Default for low-gian pickup limit (now at: 3.5) 48 52 49 53 static const Float_t fgTimeLowerLimit; //! Default for fTimeLowerLimit … … 53 57 Axis_t fLoGainFirst; // Lower histogram limit low gain 54 58 Axis_t fLoGainLast; // Upper histogram limit low gain 59 60 Float_t fNumLoGainBlackoutLimit; // Rel. amount blackout logain events until pixel is declared unsuitable 55 61 56 62 TString fAbsHistName; // Histogram names abs.times … … 124 130 void SetLoGainLast ( const Axis_t f ) { fLoGainLast = f; } 125 131 132 void SetNumLoGainBlackoutLimit( const Float_t f=fgNumLoGainBlackoutLimit ) { fNumLoGainBlackoutLimit = f; } 133 126 134 void SetReferenceFile ( const TString ref=fgReferenceFile ) { fReferenceFile = ref; } 127 135 128 136 void SetTimeLowerLimit( const Float_t f=fgTimeLowerLimit ) { fTimeLowerLimit = f; } 129 137 void SetTimeUpperLimit( const Float_t f=fgTimeUpperLimit ) { fTimeUpperLimit = f; } 130 138 139 // MHCamEvent 131 140 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; } 132 141 void DrawPixelContent( Int_t num ) const; 133 142 134 ClassDef(MHCalibrationChargeCam, 1) // Histogram class for Charge Camera Calibration143 ClassDef(MHCalibrationChargeCam, 2) // Histogram class for Charge Camera Calibration 135 144 }; 136 145 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargePix.h
r5137 r7188 42 42 43 43 // Draws 44 v irtual void Draw(Option_t *opt="");44 void Draw(Option_t *opt=""); 45 45 46 46 ClassDef(MHCalibrationChargePix, 1) // Base Histogram class for Charge Pixel Calibration -
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
r6800 r7188 483 483 option.ToLower(); 484 484 485 Int_t win = 1;485 Int_t win = 1; 486 486 Int_t nofit = 0; 487 487 488 488 if (option.Contains("events")) 489 { 490 option.ReplaceAll("events",""); 491 win += 1; 492 } 489 win += 1; 493 490 if (option.Contains("fourier")) 494 { 495 option.ReplaceAll("fourier",""); 496 win += 2; 497 } 491 win += 2; 498 492 499 493 if (IsEmpty()) … … 779 773 } 780 774 781 782 const Double_t MHGausEvents::GetChiSquare() const783 {784 return ( fFGausFit ? fFGausFit->GetChisquare() : 0.);785 }786 787 788 const Double_t MHGausEvents::GetExpChiSquare() const789 {790 return ( fFExpFit ? fFExpFit->GetChisquare() : 0.);791 }792 793 794 const Int_t MHGausEvents::GetExpNdf() const795 {796 return ( fFExpFit ? fFExpFit->GetNDF() : 0);797 }798 799 800 const Double_t MHGausEvents::GetExpProb() const801 {802 return ( fFExpFit ? fFExpFit->GetProb() : 0.);803 }804 805 806 const Int_t MHGausEvents::GetNdf() const807 {808 return ( fFGausFit ? fFGausFit->GetNDF() : 0);809 }810 811 const Double_t MHGausEvents::GetOffset() const812 {813 return ( fFExpFit ? fFExpFit->GetParameter(0) : 0.);814 }815 816 817 818 // --------------------------------------------------------------------------819 //820 // If fFExpFit exists, returns fit parameter 1 (Slope of Exponential fit),821 // otherwise 0.822 //823 const Double_t MHGausEvents::GetSlope() const824 {825 return ( fFExpFit ? fFExpFit->GetParameter(1) : 0.);826 }827 828 775 // -------------------------------------------------------------------------- 829 776 // … … 839 786 // att.Copy(fHGausHist.GetXaxis()); 840 787 } 841 842 // --------------------------------------------------------------------------843 //844 // Return kFALSE if number of entries is 0845 //846 const Bool_t MHGausEvents::IsEmpty() const847 {848 return !(fHGausHist.GetEntries());849 }850 851 // --------------------------------------------------------------------------852 //853 // Return kTRUE if number of entries is bin content of fNbins+1854 //855 const Bool_t MHGausEvents::IsOnlyOverflow() const856 {857 return fHGausHist.GetEntries() == fHGausHist.GetBinContent(fNbins+1);858 }859 860 // --------------------------------------------------------------------------861 //862 // Return kTRUE if number of entries is bin content of 0863 //864 const Bool_t MHGausEvents::IsOnlyUnderflow() const865 {866 return fHGausHist.GetEntries() == fHGausHist.GetBinContent(0);867 }868 869 870 const Bool_t MHGausEvents::IsExcluded() const871 {872 return TESTBIT(fFlags,kExcluded);873 }874 875 876 const Bool_t MHGausEvents::IsExpFitOK() const877 {878 return TESTBIT(fFlags,kExpFitOK);879 }880 881 const Bool_t MHGausEvents::IsFourierSpectrumOK() const882 {883 return TESTBIT(fFlags,kFourierSpectrumOK);884 }885 886 887 const Bool_t MHGausEvents::IsGausFitOK() const888 {889 return TESTBIT(fFlags,kGausFitOK);890 }891 892 788 893 789 // ----------------------------------------------------------------------------------- … … 929 825 } 930 826 931 // --------------------------------------------------------------------------932 //933 // Set Excluded bit from outside934 //935 void MHGausEvents::SetExcluded(const Bool_t b)936 {937 b ? SETBIT(fFlags,kExcluded) : CLRBIT(fFlags,kExcluded);938 }939 940 941 // -------------------------------------------------------------------942 //943 // The flag setters are to be used ONLY for Monte-Carlo!!944 //945 void MHGausEvents::SetExpFitOK(const Bool_t b)946 {947 948 b ? SETBIT(fFlags,kExpFitOK) : CLRBIT(fFlags,kExpFitOK);949 }950 951 // -------------------------------------------------------------------952 //953 // The flag setters are to be used ONLY for Monte-Carlo!!954 //955 void MHGausEvents::SetFourierSpectrumOK(const Bool_t b)956 {957 958 b ? SETBIT(fFlags,kFourierSpectrumOK) : CLRBIT(fFlags,kFourierSpectrumOK);959 }960 961 962 // -------------------------------------------------------------------963 //964 // The flag setters are to be used ONLY for Monte-Carlo!!965 //966 void MHGausEvents::SetGausFitOK(const Bool_t b)967 {968 b ? SETBIT(fFlags,kGausFitOK) : CLRBIT(fFlags,kGausFitOK);969 970 }971 972 827 // ---------------------------------------------------------------------------- 973 828 // -
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h
r6800 r7188 4 4 #ifndef ROOT_TH1 5 5 #include <TH1.h> 6 #endif 7 8 #ifndef ROOF_TF1 9 #include <TF1.h> 6 10 #endif 7 11 … … 16 20 class TVirtualPad; 17 21 class TGraph; 18 class MArrayF;19 22 class TH1F; 20 23 class TH1I; 21 24 class TF1; 25 22 26 class MHGausEvents : public MH 23 27 { … … 28 32 const static Int_t fgPowerProbabilityBins; //! Default for fPowerProbabilityBins (now set to: 20) 29 33 30 Float_t *CreateEventXaxis(Int_t n); // Create an x-axis for the Event TGraphs31 Float_t *CreatePSDXaxis (Int_t n);// Create an x-axis for the PSD TGraphs34 Float_t *CreateEventXaxis(Int_t n); // Create an x-axis for the Event TGraphs 35 Float_t *CreatePSDXaxis (Int_t n); // Create an x-axis for the PSD TGraphs 32 36 33 37 protected: 34 38 35 Float_t fEventFrequency; // Event frequency in Hertz (to be set)36 37 39 Int_t fBinsAfterStripping; // Bins for the Gauss Histogram after stripping off the zeros at both ends 38 40 UInt_t fCurrentSize; // Current size of the array fEvents 41 Float_t fEventFrequency; // Event frequency in Hertz (to be set) 39 42 Byte_t fFlags; // Bit field for the fit result bits 40 43 Int_t fPowerProbabilityBins; // Bins for the projected power spectrum … … 82 85 83 86 // Draws 84 void Draw (Option_t *option="");// *MENU*85 void DrawEvents (Option_t *option="");// *MENU*86 void DrawPowerSpectrum (Option_t *option="");// *MENU*87 void DrawPowerProjection( Option_t *option="");// *MENU*87 void Draw ( Option_t *option="" ); // *MENU* 88 void DrawEvents ( Option_t *option="" ); // *MENU* 89 void DrawPowerSpectrum ( Option_t *option="" ); // *MENU* 90 void DrawPowerProjection( Option_t *option="" ); // *MENU* 88 91 89 92 // Fill 90 void FillArray ( const Float_t f );91 Bool_t FillHist ( const Float_t f );92 Bool_t FillHistAndArray ( const Float_t f );93 void FillArray ( const Float_t f ); 94 Bool_t FillHist ( const Float_t f ); 95 Bool_t FillHistAndArray ( const Float_t f ); 93 96 94 97 // Fits 95 Bool_t FitGaus (Option_t *option="RQ0",96 97 const Double_t xmax=0.);// *MENU*98 Bool_t FitGaus ( Option_t *option="RQ0", 99 const Double_t xmin=0., 100 const Double_t xmax=0.); // *MENU* 98 101 99 102 // Inits … … 101 104 102 105 // Getters 103 const Double_t GetChiSquare() const ;104 const Double_t GetExpChiSquare() const ;105 const Int_t GetExpNdf() const ;106 const Double_t GetExpProb() const ;106 const Double_t GetChiSquare() const { return ( fFGausFit ? fFGausFit->GetChisquare() : 0.); } 107 const Double_t GetExpChiSquare() const { return ( fFExpFit ? fFExpFit->GetChisquare() : 0.); } 108 const Int_t GetExpNdf() const { return ( fFExpFit ? fFExpFit->GetNDF() : 0 ); } 109 const Double_t GetExpProb() const { return ( fFExpFit ? fFExpFit->GetProb() : 0.); } 107 110 MArrayF *GetEvents() { return &fEvents; } 108 111 const MArrayF *GetEvents() const { return &fEvents; } 109 const Float_t GetEventFrequency () const { return fEventFrequency;}110 TF1 *GetFExpFit() { return fFExpFit; }112 const Float_t GetEventFrequency () const { return fEventFrequency; } 113 TF1 *GetFExpFit() { return fFExpFit; } 111 114 const TF1 *GetFExpFit() const { return fFExpFit; } 112 115 TF1 *GetFGausFit() { return fFGausFit; } … … 125 128 const Double_t GetMean() const { return fMean; } 126 129 const Double_t GetMeanErr() const { return fMeanErr; } 127 const Int_t GetNdf() const ;128 const Int_t GetNbins() const { return fNbins;}129 const Double_t GetOffset() const ;130 const Int_t GetNdf() const { return ( fFGausFit ? fFGausFit->GetNDF() : 0); } 131 const Int_t GetNbins() const { return fNbins; } 132 const Double_t GetOffset() const { return ( fFExpFit ? fFExpFit->GetParameter(0) : 0.); } 130 133 MArrayF *GetPowerSpectrum() { return fPowerSpectrum; } 131 134 const MArrayF *GetPowerSpectrum() const { return fPowerSpectrum; } … … 133 136 const Double_t GetSigma() const { return fSigma; } 134 137 const Double_t GetSigmaErr() const { return fSigmaErr; } 135 const Double_t GetSlope() const ;138 const Double_t GetSlope() const { return ( fFExpFit ? fFExpFit->GetParameter(1) : 0.); } 136 139 137 const Bool_t IsExcluded() const;138 const Bool_t IsExpFitOK() const;139 const Bool_t IsEmpty() const;140 const Bool_t IsFourierSpectrumOK() const;141 const Bool_t IsGausFitOK() const;142 const Bool_t IsOnlyOverflow() const;143 const Bool_t IsOnlyUnderflow() const;140 const Bool_t IsExcluded() const { return TESTBIT(fFlags,kExcluded); } 141 const Bool_t IsExpFitOK() const { return TESTBIT(fFlags,kExpFitOK); } 142 const Bool_t IsEmpty() const { return !(fHGausHist.GetEntries()); } 143 const Bool_t IsFourierSpectrumOK() const { return TESTBIT(fFlags,kFourierSpectrumOK); } 144 const Bool_t IsGausFitOK() const { return TESTBIT(fFlags,kGausFitOK); } 145 const Bool_t IsOnlyOverflow() const { return fHGausHist.GetEntries() == fHGausHist.GetBinContent(fNbins+1); } 146 const Bool_t IsOnlyUnderflow() const { return fHGausHist.GetEntries() == fHGausHist.GetBinContent(0); } 144 147 145 148 // Prints … … 148 151 // Setters 149 152 void SetEventFrequency ( const Float_t f ) { fEventFrequency = f; } 150 void SetExcluded ( const Bool_t b=kTRUE ) ;151 void SetExpFitOK ( const Bool_t b=kTRUE ) ;152 void SetFourierSpectrumOK( const Bool_t b=kTRUE ) ;153 void SetGausFitOK ( const Bool_t b=kTRUE ) ;153 void SetExcluded ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kExcluded) : CLRBIT(fFlags,kExcluded); } 154 void SetExpFitOK ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kExpFitOK) : CLRBIT(fFlags,kExpFitOK); } 155 void SetFourierSpectrumOK( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kFourierSpectrumOK) : CLRBIT(fFlags,kFourierSpectrumOK); } 156 void SetGausFitOK ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kGausFitOK) : CLRBIT(fFlags,kGausFitOK);} 154 157 void SetLast ( const Double_t d ) { fLast = d; } 155 158 void SetFirst ( const Double_t d ) { fFirst = d; } -
trunk/MagicSoft/Mars/mhcalib/Makefile
r6598 r7188 41 41 MHCalibrationRelTimeCam.cc \ 42 42 MHCalibrationHiLoCam.cc \ 43 MHCalibrationHiLoPix.cc \ 43 44 MHCalibrationTestCam.cc \ 44 45 MHCalibrationPulseTimeCam.cc \ -
trunk/MagicSoft/Mars/mhflux/MHFalseSource.h
r7178 r7188 47 47 48 48 TObject *GetCatalog(); 49 void MakeSymmetric(TH1 *h); 49 50 50 51 private: … … 56 57 void ProjectOn(const TH3D &src, TH2D *h, TH2D *all); 57 58 void ProjectOnOff(TH2D *h, TH2D *all); 58 59 void MakeSymmetric(TH1 *h);60 59 61 60 public: -
trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
r7176 r7188 141 141 Float_t maxpix2 = 0; // [#phot] 142 142 143 /*144 MSignalPix *pix = 0;145 TIter Next(evt);146 while ((pix=(MSignalPix*)Next()))147 */ 143 const Bool_t ismagiclike = 144 geom.GetNumPixels() == 577 && 145 geom.GetNumAreas() == 2 && 146 geom.GetPixRatio(396) > geom.GetPixRatio(397); 147 148 148 UInt_t npix = evt.GetNumPixels(); 149 149 for (UInt_t i=0; i<npix; i++) … … 182 182 edgepix2 += nphot; 183 183 184 // 185 // Now we are working on absolute values of nphot, which 186 // must take pixel size into account 187 // 188 nphot *= geom.GetPixRatio(i/*pixid*/); 189 190 // count inner pixels: To dependent on MAGIC Camera --> FIXME 191 192 if (i<397){ 184 const Double_t ratio = geom.GetPixRatio(i); 185 if (TMath::Nint(ratio)==1) // Means this is a small (= inner pixel) 186 { 193 187 fInnerSize += nphot; 194 if(i>270){ 195 edgepixin2 += nphot; 196 if(i>330) 197 edgepixin1 += nphot; 188 189 // Do calculation of "inner leakage" only for MAGIC-like geometry, 190 // i.e., 577 pixels, pixels of 2 different areas, inner part 191 // from pixel 0 to 396: 192 if (ismagiclike) 193 { 194 if(i > 270) // last two "rings" of inner pixels 195 { 196 edgepixin2 += nphot; 197 if(i > 330) // last "ring" of inner pixels 198 edgepixin1 += nphot; 199 } 198 200 } 199 201 } 200 202 201 // Compute Concentration 1-2 203 // 204 // Now convert nphot from absolute number of photons or phe to signal 205 // density (divide by pixel area), to find the pixel with highest signal 206 // density: 207 // 208 nphot *= ratio; 209 210 // Look for signal density in two highest pixels: 202 211 if (nphot>maxpix1) 203 212 { … … 213 222 fInnerLeakage1 = edgepixin1 / fInnerSize; 214 223 fInnerLeakage2 = edgepixin2 / fInnerSize; 224 215 225 fLeakage1 = edgepix1 / hillas.GetSize(); 216 226 fLeakage2 = edgepix2 / hillas.GetSize(); 217 227 228 // FIXME?: in case the pixel with highest signal density is an outer pixel, 229 // the value of fConc (ratio of signal in two highest pixels to SIZE) should 230 // rather be 2*fConc1, under the simplest assumption that the light density 231 // inside the outer (large) pixel is uniform. 218 232 fConc = (maxpix1+maxpix2)/hillas.GetSize(); // [ratio] 219 233 fConc1 = maxpix1/hillas.GetSize(); // [ratio] -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r7126 r7188 760 760 gPad->SetBorderMode(0); 761 761 if (geomcam.InheritsFrom("MGeomCamMagic")) 762 DisplayDoubleProject(&disp3 5, "noisy", "dead");762 DisplayDoubleProject(&disp37, "noisy", "dead"); 763 763 764 764 // … … 842 842 // for the datacheck, fix the ranges!! 843 843 // 844 const Double_t max = 1 2.;844 const Double_t max = 10.; 845 845 obj8->SetMinimum(0.); 846 846 obj8->SetMaximum(max); … … 863 863 t1->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol))); 864 864 t1->SetTextAlign(12); 865 TText *t2 = pave->AddText(Form("%s%3i%s","Signal Rel. error too large: ",866 CountBadPixels(&disp24,2)," pixels"));867 t2->SetTextColor(gStyle->GetColorPalette(Int_t(2./max*numcol)));868 t2->SetTextAlign(12);869 865 TText *t4 = pave->AddText(Form("Low Gain Saturation: %3i pixels", 870 CountBadPixels(&disp24, 3)));871 t4->SetTextColor(gStyle->GetColorPalette(Int_t( 3./max*numcol)));866 CountBadPixels(&disp24,2))); 867 t4->SetTextColor(gStyle->GetColorPalette(Int_t(2./max*numcol))); 872 868 t4->SetTextAlign(12); 873 869 TText *t5 = pave->AddText(Form("Mean Arr. Time In First Extraction Bin: %3i pixels", 874 CountBadPixels(&disp24, 4)));875 t5->SetTextColor(gStyle->GetColorPalette(Int_t( 4./max*numcol)));870 CountBadPixels(&disp24,3))); 871 t5->SetTextColor(gStyle->GetColorPalette(Int_t(3./max*numcol))); 876 872 t5->SetTextAlign(12); 877 873 TText *t6 = pave->AddText(Form("Mean Arr. Time In Last 2 Extraction Bins: %3i pixels", 878 CountBadPixels(&disp24, 5)));879 t6->SetTextColor(gStyle->GetColorPalette(Int_t( 5./max*numcol)));874 CountBadPixels(&disp24,4))); 875 t6->SetTextColor(gStyle->GetColorPalette(Int_t(4./max*numcol))); 880 876 t6->SetTextAlign(12); 881 TText *t9 = pave->AddText(Form("Deviating Number of Photons: %3i pixels",882 CountBadPixels(&disp24,6)));883 t9->SetTextColor(gStyle->GetColorPalette(Int_t(6./max*numcol)));884 t9->SetTextAlign(12);885 877 TText *t10= pave->AddText(Form("High-Gain Histogram Overflow: %3i pixels", 886 CountBadPixels(&disp24, 7)));887 t10->SetTextColor(gStyle->GetColorPalette(Int_t( 7./max*numcol)));878 CountBadPixels(&disp24,5 ))); 879 t10->SetTextColor(gStyle->GetColorPalette(Int_t(5./max*numcol))); 888 880 t10->SetTextAlign(12); 889 881 TText *t11= pave->AddText(Form("Low-Gain Histogram Overflow: %3i pixels", 890 CountBadPixels(&disp24, 8)));891 t11->SetTextColor(gStyle->GetColorPalette(Int_t( 8./max*numcol)));882 CountBadPixels(&disp24,6 ))); 883 t11->SetTextColor(gStyle->GetColorPalette(Int_t(6./max*numcol))); 892 884 t11->SetTextAlign(12); 893 885 TText *t12= pave->AddText(Form("Presumably dead from Ped. Rms: %3i pixels", 894 CountBadPixels(&disp24, 9)));895 t12->SetTextColor(gStyle->GetColorPalette(Int_t( 9./max*numcol)));886 CountBadPixels(&disp24,7 ))); 887 t12->SetTextColor(gStyle->GetColorPalette(Int_t(7./max*numcol))); 896 888 t12->SetTextAlign(12); 897 889 TText *t13= pave->AddText(Form("Fluctuating Pulse Arrival Times: %3i pixels", 898 CountBadPixels(&disp24, 10)));899 t13->SetTextColor(gStyle->GetColorPalette(Int_t( 10./max*numcol)));890 CountBadPixels(&disp24,8 ))); 891 t13->SetTextColor(gStyle->GetColorPalette(Int_t(8./max*numcol))); 900 892 t13->SetTextAlign(12); 901 893 TText *t17 = pave->AddText(Form("Deviating Number of Photo-electrons: %3i pixels", 902 CountBadPixels(&disp24, 11)));903 t17->SetTextColor(gStyle->GetColorPalette(Int_t( 11./max*numcol)));894 CountBadPixels(&disp24,9 ))); 895 t17->SetTextColor(gStyle->GetColorPalette(Int_t(9./max*numcol))); 904 896 t17->SetTextAlign(12); 905 897 TText *t14= pave->AddText(Form("Previously Excluded: %3i pixels", 906 CountBadPixels(&disp24,1 2)));907 t14->SetTextColor(gStyle->GetColorPalette(Int_t(1 2./max*numcol)));898 CountBadPixels(&disp24,10))); 899 t14->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol))); 908 900 t14->SetTextAlign(12); 901 TText *t15= pave->AddText(Form("Too many Low-Gain Blackout Events %3i pixels", 902 CountBadPixels(&disp24,25 ))); 903 t15->SetTextColor(gStyle->GetColorPalette(Int_t(11./max*numcol))); 904 t15->SetTextAlign(12); 909 905 pave->Draw(); 910 906 … … 1514 1510 const MCalibrationHiLoPix &pix = (MCalibrationHiLoPix&)hilocam[i]; 1515 1511 1516 const Float_t ratio = pix.GetHiLoChargeRatio(); 1517 const Float_t sigma = pix.GetHiLoChargeRatioSigma(); 1512 const Float_t ratio = pix.GetHiLoChargeRatio(); 1513 const Float_t raterr = pix.GetHiLoChargeRatioErr(); 1514 const Float_t sigma = pix.GetHiLoChargeRatioSigma(); 1518 1515 1519 1516 if (ratio < 0.) … … 1526 1523 1527 1524 cpix.SetConversionHiLo(ratio); 1528 cpix.SetConversionHiLoErr(sigma); 1525 cpix.SetConversionHiLoErr(raterr); 1526 cpix.SetConversionHiLoSigma(sigma); 1529 1527 } 1530 1528 … … 1943 1941 tlist.AddToList(&steer); 1944 1942 1945 tlist.AddToList(&fillcam);1946 1947 1943 if (IsRelTimes()) 1948 1944 { … … 1950 1946 tlist.AddToList(&timecalc); 1951 1947 } 1948 1949 tlist.AddToList(&fillcam); 1952 1950 1953 1951 if (IsUseBlindPixel()) … … 1999 1997 if (fIsPixelCheck) 2000 1998 { 2001 chargecam[fCheckedPixId].DrawClone(" ");2002 chargecam(fCheckedPixId).DrawClone(" ");1999 chargecam[fCheckedPixId].DrawClone("datacheck"); 2000 chargecam(fCheckedPixId).DrawClone("datacheck"); 2003 2001 2004 2002 if (IsRelTimes()) -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r7130 r7188 786 786 fDeadPixelCheck = GetEnv("DeadPixelsCheck", fDeadPixelCheck); 787 787 788 fBadPixelsFile = GetEnv("BadPixelsFile",fBadPixelsFile.Data()); 789 fReferenceFile = GetEnv("ReferenceFile",fReferenceFile.Data()); 790 ReadReferenceFile(); 791 792 // ------------- Do not put simple resource below -------------- 793 788 794 // Setup an environment task 789 795 MTaskEnv tenv("ExtractSignal"); … … 810 816 // ..and store it 811 817 SetExtractor((MExtractor*)tenv.GetTask()); 812 813 fBadPixelsFile = GetEnv("BadPixelsFile",fBadPixelsFile.Data());814 fReferenceFile = GetEnv("ReferenceFile",fReferenceFile.Data());815 ReadReferenceFile();816 818 817 819 return kTRUE; … … 1119 1121 fcalib.SetInverted(); 1120 1122 1123 tlist.AddToList(&decode); 1124 1121 1125 if (fIsPulsePosCheck) 1122 1126 { 1123 1127 fillpul.SetFilter(&fcalib); 1124 tlist.AddToList(&decode);1125 1128 tlist.AddToList(&fcalib); 1126 1129 tlist.AddToList(&fillpul); -
trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
r7176 r7188 594 594 // Now read event... 595 595 // 596 // FIXME: Can we safly replace ReadinEvent() by RedinEvent(1)? 596 597 ReadinEvent(); 598 597 599 598 600 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead"); -
trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc
r7070 r7188 175 175 176 176 const TString MExtractPedestal::fgNamePedestalCam = "MPedestalCam"; 177 const TString MExtractPedestal::fgNameRawEvtData = "MRawEvtData"; 177 178 const UInt_t MExtractPedestal::fgNumDump = 500; 178 179 … … 191 192 MExtractPedestal::MExtractPedestal(const char *name, const char *title) 192 193 : fGeom(NULL), fPedestalsIn(NULL), fPedestalsInter(NULL), fPedestalsOut(NULL), 193 fExtractor(NULL), fExtractWinFirst(0), fExtractWinSize(0) 194 fExtractor(NULL), fExtractWinFirst(0), fExtractWinSize(0), fUseSpecialPixels(kFALSE) 194 195 { 195 196 fName = name ? name : "MExtractPedestal"; … … 207 208 SetNamePedestalCamIn(); 208 209 SetNamePedestalCamOut(); 210 SetNamePedestalCamInter(); 211 SetNameRawEvtData(); 209 212 SetNumDump(); 210 213 … … 311 314 312 315 Clear(); 313 316 317 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber(fNameRawEvtData)); 318 if (!fRawEvt) 319 if (!fUseSpecialPixels) 320 { 321 *fLog << err << AddSerialNumber(fNameRawEvtData) << " not found... aborting." << endl; 322 return kFALSE; 323 } 324 325 314 326 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData")); 315 327 if (!fRawEvt) … … 372 384 Int_t MExtractPedestal::Process() 373 385 { 386 // 387 // Necessary check for extraction of special pixels 388 // together with data which does not yet have them 389 // 390 if (fSumx.GetSize()==0) 391 return kTRUE; 392 374 393 if (fExtractor) 375 394 fExtractor->SetNoiseCalculation(fRandomCalculation); … … 405 424 Bool_t MExtractPedestal::ReInit(MParList *pList) 406 425 { 407 // If the size is not yet set, set the size 408 if (fSumx.GetSize()==0) 409 { 410 const Int_t npixels = fPedestalsOut->GetSize(); 411 const Int_t areas = fPedestalsOut->GetNumAverageArea(); 412 const Int_t sectors = fPedestalsOut->GetNumAverageSector(); 413 414 fSumx. Set(npixels); 415 fSumx2. Set(npixels); 416 fSumAB0.Set(npixels); 417 fSumAB1.Set(npixels); 418 419 fAreaSumx. Set(areas); 420 fAreaSumx2. Set(areas); 421 fAreaSumAB0.Set(areas); 422 fAreaSumAB1.Set(areas); 423 fAreaFilled.Set(areas); 424 fAreaValid .Set(areas); 425 426 fSectorSumx. Set(sectors); 427 fSectorSumx2. Set(sectors); 428 fSectorSumAB0.Set(sectors); 429 fSectorSumAB1.Set(sectors); 430 fSectorFilled.Set(sectors); 431 fSectorValid .Set(sectors); 432 433 for (Int_t i=0; i<npixels; i++) 434 { 435 const UInt_t aidx = (*fGeom)[i].GetAidx(); 436 const UInt_t sector = (*fGeom)[i].GetSector(); 437 438 fAreaValid [aidx] ++; 439 fSectorValid[sector]++; 440 } 441 } 442 443 if (fExtractor) 444 { 445 if (!((MTask*)fExtractor)->ReInit(pList)) 446 return kFALSE; 447 448 SetExtractWindow(fExtractor->GetHiGainFirst(), (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples())); 449 } 450 451 return kTRUE; 426 // Necessary check for special pixels which might not yet have existed 427 if (!fRawEvt) 428 { 429 if (fRunHeader->GetFormatVersion() > 3) 430 return kTRUE; 431 432 *fLog << err << "ERROR - " << fNameRawEvtData << " [MRawEvtData] has not "; 433 *fLog << "been found and format version > 3... abort." << endl; 434 return kFALSE; 435 } 436 437 // If the size is not yet set, set the size 438 if (fSumx.GetSize()==0) 439 { 440 // Initialize the normal pixels (size of MPedestalCam already set by MGeomApply) 441 const Int_t npixels = fPedestalsOut->GetSize(); 442 443 fSumx. Set(npixels); 444 fSumx2. Set(npixels); 445 fSumAB0.Set(npixels); 446 fSumAB1.Set(npixels); 447 448 if (fUseSpecialPixels) 449 { 450 // Initialize size of MPedestalCam in case of special pixels (not done by MGeomApply) 451 const UShort_t nspecial = fRunHeader->GetNumSpecialPixels(); 452 if (nspecial == 0) 453 { 454 *fLog << warn << "WARNING - Number of special pixels is 0." << endl; 455 return kTRUE; 456 } 457 458 fPedestalsOut->InitSize((UInt_t)nspecial); 459 } 460 else 461 { 462 // Initialize the averaged areas and sectors (do not exist for special pixels) 463 const Int_t areas = fPedestalsOut->GetNumAverageArea(); 464 const Int_t sectors = fPedestalsOut->GetNumAverageSector(); 465 466 fAreaSumx. Set(areas); 467 fAreaSumx2. Set(areas); 468 fAreaSumAB0.Set(areas); 469 fAreaSumAB1.Set(areas); 470 fAreaFilled.Set(areas); 471 fAreaValid .Set(areas); 472 473 fSectorSumx. Set(sectors); 474 fSectorSumx2. Set(sectors); 475 fSectorSumAB0.Set(sectors); 476 fSectorSumAB1.Set(sectors); 477 fSectorFilled.Set(sectors); 478 fSectorValid .Set(sectors); 479 480 for (Int_t i=0; i<npixels; i++) 481 { 482 const UInt_t aidx = (*fGeom)[i].GetAidx(); 483 const UInt_t sector = (*fGeom)[i].GetSector(); 484 485 fAreaValid [aidx] ++; 486 fSectorValid[sector]++; 487 } 488 } 489 } 490 491 if (fExtractor) 492 { 493 if (!((MTask*)fExtractor)->ReInit(pList)) 494 return kFALSE; 495 496 SetExtractWindow(fExtractor->GetHiGainFirst(), (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples())); 497 } 498 499 return kTRUE; 452 500 } 453 501 454 502 Int_t MExtractPedestal::PostProcess() 455 503 { 456 fPedestalsIn = NULL;457 return fExtractor ? fExtractor->CallPostProcess() : kTRUE;504 fPedestalsIn = NULL; 505 return fExtractor ? fExtractor->CallPostProcess() : kTRUE; 458 506 } 459 507 … … 486 534 } 487 535 536 // find resource for fUseSpecialPixels 537 if (IsEnvDefined(env, prefix, "UseSpecialPixels", print)) 538 { 539 SetUseSpecialPixels(GetEnvValue(env, prefix, "UseSpecialPixels", fUseSpecialPixels)); 540 rc = kTRUE; 541 } 542 488 543 // find resource for numeventsdump 489 544 if (IsEnvDefined(env, prefix, "NumEventsDump", print)) … … 577 632 void MExtractPedestal::CalcPixResults(const UInt_t nevts, const UInt_t pixid) 578 633 { 579 const Float_t sum = fSumx[pixid];580 const Float_t sum2 = fSumx2[pixid];634 const Double_t sum = fSumx[pixid]; 635 const Double_t sum2 = fSumx2[pixid]; 581 636 582 637 // 1. Calculate the mean of the sums: 583 Float_t ped= sum/nevts;638 Double_t ped = sum/nevts; 584 639 585 640 // 2. Calculate the Variance of the sums: 586 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);641 Double_t var = (sum2-sum*sum/nevts)/(nevts-1.); 587 642 588 643 // 3. Calculate the amplitude of the 150MHz "AB" noise 589 Float_t abOffs = (fSumAB0[pixid] - fSumAB1[pixid]) / nevts;644 Double_t abOffs = (fSumAB0[pixid] - fSumAB1[pixid]) / nevts; 590 645 591 646 // 4. Scale the mean, variance and AB-noise to the number of slices: … … 595 650 596 651 // 5. Calculate the RMS from the Variance: 597 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);652 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var); 598 653 599 654 (*fPedestalsOut)[pixid].Set(ped, rms, abOffs, nevts); … … 612 667 void MExtractPedestal::CalcAreaResults(const UInt_t nevts, const UInt_t napix, const UInt_t aidx) 613 668 { 614 const Float_t sum = fAreaSumx[aidx];615 const Float_t sum2 = fAreaSumx2[aidx];669 const Double_t sum = fAreaSumx[aidx]; 670 const Double_t sum2 = fAreaSumx2[aidx]; 616 671 617 672 // 1. Calculate the mean of the sums: 618 Float_t ped= sum/nevts;673 Double_t ped = sum/nevts; 619 674 620 675 // 2. Calculate the Variance of the sums: 621 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);676 Double_t var = (sum2/napix-sum*sum/nevts)/(nevts-1.); 622 677 623 678 // 3. Calculate the amplitude of the 150MHz "AB" noise 624 Float_t abOffs = (fAreaSumAB0[aidx] - fAreaSumAB1[aidx]) / nevts;679 Double_t abOffs = (fAreaSumAB0[aidx] - fAreaSumAB1[aidx]) / nevts; 625 680 626 681 // 4. Scale the mean, variance and AB-noise to the number of slices: … … 635 690 636 691 // 6. Calculate the RMS from the Variance: 637 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);692 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var); 638 693 639 694 fPedestalsOut->GetAverageArea(aidx).Set(ped, rms, abOffs, nevts); … … 652 707 void MExtractPedestal::CalcSectorResults(const UInt_t nevts, const UInt_t nspix, const UInt_t sector) 653 708 { 654 const Float_t sum = fSectorSumx[sector];655 const Float_t sum2 = fSectorSumx2[sector];709 const Double_t sum = fSectorSumx[sector]; 710 const Double_t sum2 = fSectorSumx2[sector]; 656 711 657 712 // 1. Calculate the mean of the sums: 658 Float_t ped = sum/nevts;713 Double_t ped = sum/nevts; 659 714 660 715 // 2. Calculate the Variance of the sums: 661 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);716 Double_t var = (sum2/nspix-sum*sum/nevts)/(nevts-1.); 662 717 663 718 // 3. Calculate the amplitude of the 150MHz "AB" noise 664 Float_t abOffs = (fSectorSumAB0[sector] - fSectorSumAB1[sector]) / nevts;719 Double_t abOffs = (fSectorSumAB0[sector] - fSectorSumAB1[sector]) / nevts; 665 720 666 721 // 4. Scale the mean, variance and AB-noise to the number of slices: … … 675 730 676 731 // 6. Calculate the RMS from the Variance: 677 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);732 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var); 678 733 679 734 fPedestalsOut->GetAverageSector(sector).Set(ped, rms, abOffs, nevts); … … 688 743 *fLog << "Intermediate Storage is " << (fIntermediateStorage?"on":"off") << endl; 689 744 *fLog << "Pedestal Update is " << (fPedestalUpdate?"on":"off") << endl; 745 *fLog << "Special pixel mode " << (fUseSpecialPixels?"on":"off") << endl; 690 746 if (fPedestalUpdate) 691 747 { -
trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h
r6913 r7188 25 25 private: 26 26 static const TString fgNamePedestalCam; //! "MPedestalCam" 27 static const TString fgNameRawEvtData; //! "MRawEvtData" 27 28 static const UInt_t fgNumDump; //! 28 29 29 30 TString fNamePedestalCamIn; // Name of the incoming 'MPedestalCam' container 30 31 TString fNamePedestalCamOut; // Name of the outgoing 'MPedestalCam' container 31 TString fNamePedestalCamInter; // Name of the intermediate 'MPedestalCam' container 32 TString fNamePedestalCamInter; // Name of the intermediate 'MPedestalCam' container 33 TString fNameRawEvtData; // Name of MRawEvtData 32 34 33 35 Bool_t fRandomCalculation; // Is pedestalextraction by extractor random? … … 55 57 56 58 Bool_t fPedestalUpdate; // Flag if the pedestal shall be updated after every fNumEventsDump 59 Bool_t fUseSpecialPixels; // Flag if the special pixels shall be treated 57 60 58 61 MArrayD fSumx; // sum of values … … 103 106 104 107 // names 105 void SetNamePedestalCamIn (const char *name=fgNamePedestalCam.Data()) { fNamePedestalCamIn = name; } 106 void SetNamePedestalCamInter(const char *name=fgNamePedestalCam.Data()) { fNamePedestalCamInter = name; } 107 void SetNamePedestalCamOut (const char *name=fgNamePedestalCam.Data()) { fNamePedestalCamOut = name; } 108 void SetNamePedestalCamIn (const char *name=fgNamePedestalCam) { fNamePedestalCamIn = name; } 109 void SetNamePedestalCamInter(const char *name=fgNamePedestalCam) { fNamePedestalCamInter = name; } 110 void SetNamePedestalCamOut (const char *name=fgNamePedestalCam) { fNamePedestalCamOut = name; } 111 void SetNameRawEvtData (const char *name=fgNameRawEvtData) { fNameRawEvtData = name; } 108 112 109 113 // pointers … … 115 119 // flags 116 120 void SetIntermediateStorage (Bool_t b=kTRUE) { fIntermediateStorage = b; } 121 void SetUseSpecialPixels (Bool_t b=kTRUE) { fUseSpecialPixels = b; } 117 122 void SetPedestalUpdate (Bool_t b=kTRUE) { fPedestalUpdate = b; } 118 123 void SetRandomCalculation (Bool_t b=kTRUE) { fRandomCalculation = b; } -
trunk/MagicSoft/Mars/mpedestal/MMcPedestalCopy.cc
r3803 r7188 79 79 Bool_t MMcPedestalCopy::CheckRunType(MParList *pList) const 80 80 { 81 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject( "MRawRunHeader");81 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 82 82 if (!run) 83 83 { 84 *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl; 84 *fLog << warn << dbginf << "Warning - cannot check file type, " 85 << AddSerialNumber("MRawRunHeader") << " not found." << endl; 85 86 return kTRUE; 86 87 } … … 138 139 } 139 140 140 MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject( "MMcRunHeader");141 MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject(AddSerialNumber("MMcRunHeader")); 141 142 if (!mcrun) 142 *fLog << warn << dbginf << "MMcRunHeader not found... assuming camera<0.7" << endl; 143 *fLog << warn << dbginf << AddSerialNumber("MMcRunHeader") 144 << " not found... assuming camera<0.7" << endl; 143 145 144 146 const int num = pedcam->GetSize(); -
trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
r7130 r7188 276 276 277 277 // 278 // In the other case, produce the MPedestalCam to be use the subsequent (non-pedestal) events 278 // In the other case, produce the MPedestalCam to be use the subsequent 279 // (non-pedestal) events 279 280 // 280 281 *fLog << inf << "Finalizing pedestal calculations..." << flush; … … 299 300 Int_t MPedCalcPedRun::Calc() 300 301 { 301 302 302 if (fIsNotPedRun && !IsPedBitSet()) 303 303 return kTRUE; … … 317 317 while (pixel.Next()) 318 318 { 319 const UInt_t idx = pixel.GetPixelId(); 320 const UInt_t aidx = (*fGeom)[idx].GetAidx(); 321 const UInt_t sector = (*fGeom)[idx].GetSector(); 319 const UInt_t idx = pixel.GetPixelId(); 322 320 323 321 Float_t sum = 0.; … … 330 328 CalcSums(pixel, sum, ab0, ab1); 331 329 332 fSumx[idx] += sum; 330 fSumx[idx] += sum; 331 332 if (fIntermediateStorage) 333 (*fPedestalsInter)[idx].Set(sum,0.,0.,fUsedEvents); 334 335 const Float_t sqrsum = sum*sum; 336 337 fSumx2[idx] += sqrsum; 338 fSumAB0[idx] += ab0; 339 fSumAB1[idx] += ab1; 340 341 if (fUseSpecialPixels) 342 continue; 343 344 const UInt_t aidx = (*fGeom)[idx].GetAidx(); 345 const UInt_t sector = (*fGeom)[idx].GetSector(); 346 333 347 fAreaSumx[aidx] += sum; 334 348 fSectorSumx[sector] += sum; 335 349 336 if (fIntermediateStorage) 337 (*fPedestalsInter)[idx].Set(sum,0.,0.,fUsedEvents); 338 339 const Float_t sqrsum = sum*sum; 340 fSumx2[idx] += sqrsum; 341 fAreaSumx2[aidx] += sqrsum; 342 fSectorSumx2[sector] += sqrsum; 343 344 fSumAB0[idx] += ab0; 345 fSumAB1[idx] += ab1; 350 fAreaSumx2[aidx] += sqrsum; 351 fSectorSumx2[sector] += sqrsum; 346 352 347 353 fAreaSumAB0[aidx] += ab0; … … 422 428 } 423 429 424 425 430 // -------------------------------------------------------------------------- 426 431 // … … 429 434 Int_t MPedCalcPedRun::Finalize() 430 435 { 431 432 if (fUsedEvents == 0) 436 if (fUsedEvents == 0) 437 return kTRUE; 438 439 // 440 // Necessary check for extraction of special pixels 441 // together with data which does not yet have them 442 // 443 if (fSumx.GetSize()==0) 444 return kTRUE; 445 446 MRawEvtPixelIter pixel(fRawEvt); 447 while (pixel.Next()) 448 CalcPixResults(fUsedEvents, pixel.GetPixelId()); 449 450 if (!fUseSpecialPixels) 451 { 452 453 // 454 // Loop over the (two) area indices to get the averaged pedestal per aidx 455 // 456 for (UInt_t aidx=0; aidx<fAreaValid.GetSize(); aidx++) 457 if (fAreaValid[aidx]>0) 458 CalcAreaResults(fUsedEvents, fAreaValid[aidx], aidx); 459 460 // 461 // Loop over the (six) sector indices to get the averaged pedestal per sector 462 // 463 for (UInt_t sector=0; sector<fSectorValid.GetSize(); sector++) 464 if (fSectorValid[sector]>0) 465 CalcSectorResults(fUsedEvents, fSectorValid[sector], sector); 466 } 467 468 fPedestalsOut->SetTotalEntries(fUsedEvents*fExtractWinSize); 469 fPedestalsOut->SetReadyToSave(); 470 433 471 return kTRUE; 434 435 MRawEvtPixelIter pixel(fRawEvt);436 while (pixel.Next())437 CalcPixResults(fUsedEvents, pixel.GetPixelId());438 439 //440 // Loop over the (two) area indices to get the averaged pedestal per aidx441 //442 for (UInt_t aidx=0; aidx<fAreaValid.GetSize(); aidx++)443 if (fAreaValid[aidx]>0)444 CalcAreaResults(fUsedEvents, fAreaValid[aidx], aidx);445 446 //447 // Loop over the (six) sector indices to get the averaged pedestal per sector448 //449 for (UInt_t sector=0; sector<fSectorValid.GetSize(); sector++)450 if (fSectorValid[sector]>0)451 CalcSectorResults(fUsedEvents, fSectorValid[sector], sector);452 453 fPedestalsOut->SetTotalEntries(fUsedEvents*fExtractWinSize);454 fPedestalsOut->SetReadyToSave();455 456 return kTRUE;457 472 } 458 473 459 474 Int_t MPedCalcPedRun::PostProcess() 460 475 { 461 if (!Finalize()) 462 return kFALSE; 463 464 return MExtractPedestal::PostProcess(); 476 if (!fRawEvt) 477 return kTRUE; 478 479 if (!Finalize()) 480 return kFALSE; 481 482 return MExtractPedestal::PostProcess(); 465 483 } 466 484 … … 485 503 void MPedCalcPedRun::Print(Option_t *o) const 486 504 { 487 488 505 MExtractPedestal::Print(o); 489 506 -
trunk/MagicSoft/Mars/mpedestal/MPedestalCam.cc
r5558 r7188 276 276 } 277 277 278 void MPedestalCam::PrintArr(const TCollection &list) const 279 { 280 Int_t id = 0; 281 282 TIter Next(&list); 283 MPedestalPix *pix = 0; 284 285 while ((pix=(MPedestalPix*)Next())) 286 *fLog << Form("Nr.: %4i Pedestal: %5.2f RMS: %5.2f ABOffset: %5.2f ", 287 id++, pix->GetPedestal(), pix->GetPedestalRms(), pix->GetPedestalABoffset()) << endl; 288 } 289 278 290 void MPedestalCam::Print(Option_t *o) const 279 291 { 280 292 *fLog << all << GetDescriptor() << ":" << endl; 281 int id = 0; 282 283 TIter Next(fArray); 284 MPedestalPix *pix; 285 while ((pix=(MPedestalPix*)Next())) 286 { 287 id++; 288 289 if (!pix->IsValid()) 290 continue; 291 292 *fLog << id-1 << ": "; 293 *fLog << pix->GetPedestal() << " " << pix->GetPedestalRms() << endl; 294 } 293 *fLog << "Pixels:" << endl; 294 *fLog << endl; 295 296 PrintArr(*fArray); 297 298 *fLog << endl; 299 *fLog << "Event-by-event averaged areas:" << endl; 300 *fLog << endl; 301 302 PrintArr(*fAverageAreas); 303 304 *fLog << endl; 305 *fLog << "Event-by-event averaged sectors:" << endl; 306 *fLog << endl; 307 308 PrintArr(*fAverageSectors); 295 309 } 296 310 -
trunk/MagicSoft/Mars/mpedestal/MPedestalCam.h
r5558 r7188 24 24 25 25 UInt_t fTotalEntries; // Total number of times, the Process was executed (to estimate the error of pedestal) 26 27 void PrintArr(const TCollection &list) const; 26 28 27 29 public: -
trunk/MagicSoft/Mars/mreport/MReportCC.cc
r7026 r7188 31 31 // From here maily weather station data is decoded such as 32 32 // temperature, humidity, wind-speed and solar radiation 33 // 34 // Class Version 2: 35 // ---------------- 36 // + Float_t fUPSStatus; // arbitrary units (still not properly defined) 37 // + Float_t fDifRubGPS; // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver 38 // 33 39 // 34 40 ////////////////////////////////////////////////////////////////////////////// … … 74 80 Int_t len; 75 81 const Int_t n=sscanf(str.Data(), 76 "%*f %*f %*f %*f %f %f %f %f % *f %*f %n",82 "%*f %*f %*f %*f %f %f %f %f %f %f %n", 77 83 &fTemperature, &fSolarRadiation, &fWindSpeed, 78 &fHumidity, & len);79 if (n!= 4)84 &fHumidity, &fUPSStatus, &fDifRubGPS, &len); 85 if (n!=6) 80 86 { 81 87 *fLog << warn << "WARNING - Wrong number of arguments." << endl; -
trunk/MagicSoft/Mars/mreport/MReportCC.h
r7027 r7188 14 14 Float_t fSolarRadiation; // [W/m^2] IR-Radiation 15 15 16 Float_t fUPSStatus; // arbitrary units (still not properly defined) 17 Float_t fDifRubGPS; // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver 18 16 19 Int_t InterpreteBody(TString &str, Int_t ver); 17 20 … … 26 29 void Print(Option_t *opt) const; 27 30 28 ClassDef(MReportCC, 1) // Class for CC-REPORT information31 ClassDef(MReportCC, 2) // Class for CC-REPORT information 29 32 }; 30 33 -
trunk/MagicSoft/Mars/mreport/MReportCamera.cc
r6962 r7188 568 568 return kCONTINUE; 569 569 570 if (ver > gkActiveLoadControlVersNum)570 if (ver >= gkActiveLoadControlVersNum) 571 571 { 572 572 if (!InterpreteActiveLoad(str)) -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc
r7099 r7188 159 159 const Float_t MExtractTimeAndChargeSpline::fgFallTimeHiGain = 0.5; 160 160 const Float_t MExtractTimeAndChargeSpline::fgLoGainStretch = 1.5; 161 const Float_t MExtractTimeAndChargeSpline::fgOffsetLoGain = 1. 7; // 5 ns161 const Float_t MExtractTimeAndChargeSpline::fgOffsetLoGain = 1.39; // 5 ns 162 162 const Float_t MExtractTimeAndChargeSpline::fgLoGainStartShift = -1.8; 163 163 -
trunk/MagicSoft/include-Classes/MMcFormat/MTriggerDefine.h
r5253 r7188 3 3 // In this file are the fundamental definitions for the class MCTrigger 4 4 // 5 // Number of pixels in the trigger region (used by camera simulation, 6 // see camera.cxx. 5 7 // 6 8 #define TRIGGER_PIXELS_1 397 7 9 #define TRIGGER_PIXELS_2 397 8 10 #define TRIGGER_PIXELS_3 1657 11 #define TRIGGER_PIXELS_4 547 // For MGeomCamMagic1183, PRELIMINARY! 9 12 #define TRIGGER_PIXELS_5 397 10 13 #define TRIGGER_PIXELS_6 1657
Note:
See TracChangeset
for help on using the changeset viewer.