Changeset 4348 for trunk/MagicSoft/Mars/macros
- Timestamp:
- 06/23/04 14:23:48 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/macros
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/bootcampstandardanalysis.C
r4292 r4348 46 46 ////////////////////////////////////////////////////////////////////////////////// 47 47 const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_02_10/"; 48 const TString outpath = "./"; 48 49 const Int_t dpedrun = 14607; 49 50 const Int_t dcalrun1 = 14608; … … 52 53 const Int_t ddatrun2 = 14614; 53 54 const Bool_t usedisplay = kTRUE; 54 55 // 56 // A switch to use the Blind Pixel 57 // 58 const Bool_t blindpix = kTRUE; 59 // 60 // A switch to use the PIN Diode 61 // 62 const Bool_t pindiode = kFALSE; 63 // 55 64 void bootcampstandardanalysis(const Int_t prun=dpedrun, // pedestal file 56 65 const Int_t crun1=dcalrun1, const Int_t crun2=dcalrun2, // calibration file(s) … … 120 129 MJPedestal pedloop; 121 130 pedloop.SetInput(&pruns); 131 pedloop.SetOutputPath(outpath.Data()); 122 132 if (usedisplay) 123 133 { … … 144 154 MJCalibration calloop; 145 155 calloop.SetInput(&cruns); 156 calloop.SetOutputPath(outpath.Data()); 146 157 calloop.SetExtractor(&extractor); 147 158 // … … 155 166 calloop.SetQECam(qecam); 156 167 calloop.SetBadPixels(pedloop.GetBadPixels()); 168 // 169 // Choose if you want to use the blind pixel and/or the pin diode 170 // 171 calloop.SetUseBlindPixel(blindpix); 172 calloop.SetUsePINDiode(pindiode); 157 173 // 158 174 // The next two commands are for the display: … … 172 188 /*************************************/ 173 189 174 // 175 // Create a empty Parameter List and an empty Task List 176 // 177 MParList plist3; 178 MTaskList tlist3; 179 plist3.AddToList(&tlist3); 180 181 // 182 // Now setup the tasks and tasklist to calculate the pedestal rms in number of photons 183 // ----------------------------------------------------------------------------------- 184 // 185 186 MCerPhotEvt nphot; 187 MPedPhotCam nphotrms; 188 189 plist3.AddToList(&geomcam); 190 191 // 192 // Retrieve the cameras from the previous runs: 193 // 194 plist3.AddToList(&pedloop.GetPedestalCam()); 195 plist3.AddToList(&calloop.GetCalibrationCam()); 196 plist3.AddToList(&calloop.GetQECam()); 197 plist3.AddToList(&calloop.GetRelTimeCam()); 198 plist3.AddToList(&calloop.GetBadPixels()); 199 plist3.AddToList(&nphot); 200 plist3.AddToList(&nphotrms); 201 202 //tasks 203 MReadMarsFile read3("Events"); 204 read3.DisableAutoScheme(); 205 static_cast<MRead&>(read3).AddFiles(pruns); 206 207 MCalibrate photcalc; 208 photcalc.SetCalibrationMode(MCalibrate::kFfactor); 209 // MPedPhotCalc photrmscalc; //It doesn't exist yet 210 211 tlist3.AddToList(&read3); 212 tlist3.AddToList(&geomapl); 213 tlist3.AddToList(&extractor); 214 tlist3.AddToList(&photcalc); 215 // tlist3.AddToList(&photrmscalc); 216 217 // 218 // Create and setup the eventloop 219 // 220 MEvtLoop evtloop3; 221 evtloop3.SetParList(&plist3); 222 223 // 224 // Execute first analysis 225 // 226 if (!evtloop3.Eventloop()) 190 MJExtractSignal pedphotloop; 191 192 pedphotloop.SetExtractor(&extractor); 193 pedphotloop.SetTimeExtractor(&timeext); 194 pedphotloop.SetInput(&pruns); 195 pedphotloop.SetOutputPath(outpath); 196 if (useDisplay) 197 pedphotloop.SetDisplay(display); 198 pedphotloop.SetBadPixels(calloop.GetBadPixels()); 199 200 if (!pedphotloop.ProcessP(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 227 201 return; 228 229 tlist3.PrintStatistics(); 230 202 231 203 /*************************************/ 232 204 /* FOURTH LOOP: DATA CALIBRATION */ … … 244 216 // ----------------------------------------------------- 245 217 // 246 247 218 plist4.AddToList(&geomcam); 248 219 // … … 254 225 plist4.AddToList(&calloop.GetRelTimeCam()); 255 226 plist4.AddToList(&calloop.GetBadPixels()); 227 plist4.AddToList(&pedphotloop.GetPedPhotCam()); 228 229 MCerPhotEvt nphot; 256 230 plist4.AddToList(&nphot); 257 plist4.AddToList(&nphotrms);258 231 259 232 MArrivalTime times; … … 265 238 static_cast<MRead&>(read4).AddFiles(druns); 266 239 240 MCalibrate photcalc; 241 photcalc.SetCalibrationMode(MCalibrate::kFfactor); 267 242 MCalibrateRelTimes timecal; 268 243 -
trunk/MagicSoft/Mars/macros/calibration.C
r4236 r4348 57 57 #include "MJPedestal.h" 58 58 #include "MJCalibration.h" 59 #include "MJExtractSignal.h" 59 60 #include "MJExtractCalibTest.h" 60 #include "TObject.h"61 #include "TObjectTable.h"62 61 #include "MExtractFixedWindowPeakSearch.h" 63 62 #include "MExtractSlidingWindow.h" 64 63 #include "MExtractFixedWindow.h" 64 #include "MExtractFixedWindowSpline.h" 65 #include "MExtractAmplitudeSpline.h" 65 66 #include "MExtractTimeHighestIntegral.h" 66 67 #include "MExtractTimeFastSpline.h" 67 68 #include "MRunIter.h" 68 69 #include "MStatusDisplay.h" 69 #include "TStyle.h"70 70 #include "MCalibrationQECam.h" 71 71 #include "MHCalibrationTestCam.h" … … 77 77 #include "MParContainer.h" 78 78 79 #include "TStyle.h" 80 #include "TObject.h" 81 #include "TObjectTable.h" 82 #include "TSystem.h" 83 84 #include <fstream> 85 79 86 using namespace std; 80 87 81 88 static TString outpath = "./"; 82 static TString inpath = "./"; 89 static TString inpath = "/home/rootdata/Calib/2004_05_24/"; 90 static TString badfile = ""; 83 91 // 84 92 // the default pedestal run for the calibration 85 93 // 86 static const Int_t pedrun = 26 851;94 static const Int_t pedrun = 26569; 87 95 // 88 96 // the default start calibration run 89 97 // 90 static const Int_t calrun1 = 26 849;98 static const Int_t calrun1 = 26568; 91 99 // 92 100 // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs … … 109 117 // Tell if you want to calibrate times: 110 118 // 111 static Bool_t useTimes = k FALSE;119 static Bool_t useTimes = kTRUE; 112 120 // 113 121 // Tell if you want to use the display: 114 122 // 115 123 static Bool_t useDisplay = kTRUE; 124 // 125 // Tell if you want to test the result afterwards 126 // 127 static Bool_t useTest = kTRUE; 116 128 // 117 129 Int_t calibration(const Int_t prun=pedrun, … … 127 139 // MExtractFixedWindowPeakSearch extractor; 128 140 // MExtractSlidingWindow extractor; 129 MExtractFixedWindow extractor; 130 141 MExtractFixedWindowSpline extractor; 142 // MExtractAmplitudeSpline extractor; 143 // MExtractTimeAndChargeSpline extractor; 131 144 // 132 145 // Set Ranges or Windows 133 146 // 134 extractor.SetRange(0,15,3,14); 135 // extractor.SetRange(5,9 ,5,9 ); 147 extractor.SetRange(1,14,2,13); 136 148 // extractor.SetWindows(8,8); 137 149 … … 144 156 // Set Ranges or Windows 145 157 // 146 timeext.SetRange( 1,14,3,14);158 timeext.SetRange(0,7,3,8); 147 159 148 160 MRunIter pruns; … … 156 168 cruns.AddRuns(crun1,crun2,inpath); 157 169 158 gStyle->SetOptStat(1111 11);170 gStyle->SetOptStat(1111); 159 171 gStyle->SetOptFit(); 172 gStyle->SetTitleSize(0.1,"u"); 173 gStyle->SetLineWidth(1); 160 174 161 175 MStatusDisplay *display = NULL; … … 178 192 // an ascii-file with the corr. pixel numbers (see MBadPixelsCam) 179 193 // 180 // badcam.AsciiRead("badpixels.dat"); 194 if (!badfile.IsNull()) 195 { 196 ifstream f(badfile.Data()); 197 badcam.AsciiRead(f); 198 f.close(); 199 } 181 200 182 201 MJPedestal pedloop; … … 197 216 MJCalibration calloop; 198 217 218 if (debug) 219 calloop.SetDebug(); 199 220 // 200 221 // If you want to run the data-check on RAW DATA!!!, choose: 201 // calloop.SetDataCheck();222 // calloop.SetDataCheck(); 202 223 // 203 224 // If you want to see the data-check plots only, choose: 204 //calloop.SetDataCheckDisplay();225 calloop.SetDataCheckDisplay(); 205 226 // 206 227 // For everything, you have ever dreamed of, choose: … … 249 270 /********************************************************************/ 250 271 251 MJExtractCalibTest testloop; 252 253 testloop.SetExtractor(&extractor); 254 testloop.SetTimeExtractor(&timeext); 255 testloop.SetInput(&cruns); 256 testloop.SetOutputPath(outpath); 272 if (useTest) 273 { 274 275 MJExtractCalibTest testloop; 276 277 testloop.SetExtractor(&extractor); 278 testloop.SetTimeExtractor(&timeext); 279 testloop.SetInput(&cruns); 280 testloop.SetOutputPath(outpath); 281 if (useDisplay) 282 testloop.SetDisplay(display); 283 testloop.SetBadPixels(calloop.GetBadPixels()); 284 285 if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 286 return 3; 287 288 if (useTimes) 289 if (!testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam())) 290 return 4; 291 292 gLog << endl; 293 gLog << "Mean equiv. number of photons from cascades per mm^2 Inner pixels: " 294 << testloop.GetTestCam().GetMeanMeanPhotPerArea(0) 295 << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(0) << endl; 296 gLog << "Sigma equiv. number of photons from cascades per mm^2 Inner pixels: " 297 << testloop.GetTestCam().GetMeanSigmaPhotPerArea(0) 298 << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(0) << endl; 299 300 gLog << endl; 301 gLog << "Mean equiv. number of photons from cascades per mm^2 Outer pixels: " 302 << testloop.GetTestCam().GetMeanMeanPhotPerArea(1) 303 << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(1) << endl; 304 gLog << "Sigma equiv. number of photons from cascades per mm^2 Outer pixels: " 305 << testloop.GetTestCam().GetMeanSigmaPhotPerArea(1) 306 << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(1) << endl; 307 gLog << endl; 308 309 } 310 311 /********************************************************************/ 312 /* FOURTH LOOP: APPLY CALIBRATION TO THE PEDESTAL FILES */ 313 /********************************************************************/ 314 315 MJExtractSignal pedphotloop; 316 317 pedphotloop.SetExtractor(&extractor); 318 pedphotloop.SetTimeExtractor(&timeext); 319 pedphotloop.SetInput(&pruns); 320 pedphotloop.SetOutputPath(outpath); 257 321 if (useDisplay) 258 testloop.SetDisplay(display); 259 testloop.SetBadPixels(calloop.GetBadPixels()); 260 261 if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 262 return 3; 263 264 if (useTimes) 265 if (!testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam())) 266 return 4; 267 268 gLog << endl; 269 gLog << "Mean equiv. number of photons from cascades per mm^2 Inner pixels: " 270 << testloop.GetTestCam().GetMeanMeanPhotPerArea(0) 271 << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(0) << endl; 272 gLog << "Sigma equiv. number of photons from cascades per mm^2 Inner pixels: " 273 << testloop.GetTestCam().GetMeanSigmaPhotPerArea(0) 274 << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(0) << endl; 275 276 gLog << endl; 277 gLog << "Mean equiv. number of photons from cascades per mm^2 Outer pixels: " 278 << testloop.GetTestCam().GetMeanMeanPhotPerArea(1) 279 << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(1) << endl; 280 gLog << "Sigma equiv. number of photons from cascades per mm^2 Outer pixels: " 281 << testloop.GetTestCam().GetMeanSigmaPhotPerArea(1) 282 << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(1) << endl; 283 gLog << endl; 322 pedphotloop.SetDisplay(display); 323 pedphotloop.SetBadPixels(calloop.GetBadPixels()); 324 325 if (!pedphotloop.ProcessP(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 326 return 5; 284 327 285 328 … … 296 339 // List of useful containers: 297 340 // 298 MHCalibrationTestCam &testcam = testloop.GetTestCam();299 testcam[100].DrawClone("events");300 301 341 /* 302 342 MPedestalCam &pedcam = pedloop.GetPedestalCam(); … … 312 352 // 313 353 /* 354 testcam[200].DrawClone("fourierevents"); 314 355 testcam.GetAverageHiGainArea(0).DrawClone(); 315 356 testcam.GetAverageLoGainArea(0).DrawClone(); … … 330 371 testcam.GetAverageLoGainSector(6).DrawClone(); 331 372 */ 373 332 374 return 0; 333 375 … … 351 393 gLog << " --inpath=# Find the data in inpath" << endl; 352 394 gLog << " --outpath=# Write the output containers to outpath" << endl; 395 gLog << " --badfile=# Use the file # to exclude pixels from the beginning" << endl; 353 396 gLog << " --debug Use the TObjectTable for debugging " << endl; 354 397 gLog << " and write out the pixels as ascii tables" << endl; 355 398 gLog << " --useTimes Calibrate the relative arrival times" << endl; 399 gLog << " --useTest Use the class MJExtractCalibTest to test the calibration on itself" << endl; 356 400 gLog << " --skipBlindPix Skip the blind pixel calibration" << endl; 357 401 gLog << " --skipPINDiode Skip the PIN Diode calibration" << endl; … … 374 418 debug = arg.HasOnlyAndRemove("--debug") || arg.HasOnlyAndRemove("-d"); 375 419 useTimes = arg.HasOnlyAndRemove("--useTimes") || arg.HasOnlyAndRemove("-t"); 420 useTest = arg.HasOnlyAndRemove("--useTest") || arg.HasOnlyAndRemove("-e"); 376 421 blindpix = !(arg.HasOnlyAndRemove("--skipBlindPix")); 377 422 pindiode = !(arg.HasOnlyAndRemove("--skipPINDiode")); … … 383 428 outpath = arg.GetStringAndRemove("--outpath="); 384 429 385 // 430 if (arg.HasOption("--badfile=")) 431 badfile = arg.GetStringAndRemove("--badfile="); 432 433 if (gSystem->AccessPathName(badfile,kFileExists)) 434 { 435 gLog << "WARNING: the bad pixels file '" << badfile.Data() << "' doesn't exist." << endl; 436 badfile = ""; 437 } 438 386 439 // check for the right usage of the program 387 440 //
Note:
See TracChangeset
for help on using the changeset viewer.