Changeset 5690 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 12/27/04 13:13:32 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibColorSet.cc
r5677 r5690 39 39 #include "MCalibColorSet.h" 40 40 41 #include "TRegexp.h" 41 #include <stdlib.h> // needed for atoi on some platforms 42 43 #include <TRegexp.h> 42 44 43 45 #include "MLog.h" … … 51 53 ClassImp(MCalibColorSet); 52 54 53 54 55 using namespace std; 55 56 56 const Int_t MCalibColorSet::gkIFAEBoxInaugurationRun = 20113; 57 const Int_t MCalibColorSet::gkMCRunLimit = 1000; 58 const UInt_t MCalibColorSet::gkFirstRunWithFinalBits = 45626; 57 const Int_t MCalibColorSet::gkIFAEBoxInaugurationRun = 20113; 58 const Int_t MCalibColorSet::gkMCRunLimit = 1000; 59 const UInt_t MCalibColorSet::gkFirstRunWithFinalBits = 45626; 60 59 61 // -------------------------------------------------------------------------- 60 62 // … … 95 97 96 98 return kTRUE; 99 } 100 101 // -------------------------------------------------------------------------- 102 // 103 // Check if str contains regexp. 104 // If so or pat to pattern and set color to col. 105 // Otherwise do nothing. 106 // 107 // Normally this function is much to simple (more arguments than lines!) 108 // but in this particular case it is worth to have it to avois chaotic 109 // repitions of the same piece of code for many many times. 110 // 111 void MCalibColorSet::CheckAndSet(const TString &str, const char *regexp, UInt_t &pattern, UInt_t pat, Int_t &color, Int_t col) const 112 { 113 if (!str.Contains(TRegexp(regexp))) 114 return; 115 116 pattern |= pat; 117 color = col; 97 118 } 98 119 … … 295 316 296 317 if (color!=kNONE) 297 318 { 298 319 *fLog << inf << "Color determined from the run-number... "; 299 320 switch (color) 300 301 302 303 case kUV: *fLog << "UV."; fPattern |= k10LedUV;break;304 321 { 322 case kGREEN: *fLog << "Green."; fPattern |= k5LedGreen; break; 323 case kBLUE: *fLog << "Blue."; fPattern |= k5LedBlue1; break; 324 case kUV: *fLog << "UV."; fPattern |= k10LedUV; break; 325 } 305 326 *fLog << endl; 306 327 fIsValid = kTRUE; 307 328 return kTRUE; 308 } 309 else 310 { 311 312 TString proj = header->GetProjectName(); 313 proj.ToLower(); 314 315 // Possible green combinations 316 TRegexp gre0("0.1led[sS]?gree"); 317 if (proj.Contains(gre0)) 318 { fPattern |= k01LedGreen; color = kGREEN; } 319 TRegexp gre1("1led[sS]?gree"); 320 if (proj.Contains(gre1)) 321 { fPattern |= k1LedGreen; color = kGREEN; } 322 TRegexp gre2("2led[sS]?gree"); 323 if (proj.Contains(gre2)) 324 { fPattern |= k2LedGreen; color = kGREEN; } 325 TRegexp gre3("3led[sS]?gree"); 326 if (proj.Contains(gre3)) 327 { fPattern |= k3LedGreen; color = kGREEN; } 328 TRegexp gre5("5led[sS]?gree"); 329 if (proj.Contains(gre5)) 330 { fPattern |= k5LedGreen; color = kGREEN; } 331 TRegexp gre6("6led[sS]?gree"); 332 if (proj.Contains(gre6)) 333 { fPattern |= k6LedGreen; color = kGREEN; } 334 TRegexp gre7("7led[sS]?gree"); 335 if (proj.Contains(gre7)) 336 { fPattern |= k7LedGreen; color = kGREEN; } 337 TRegexp gre8("8led[sS]?gree"); 338 if (proj.Contains(gre8)) 339 { fPattern |= k8LedGreen; color = kGREEN; } 340 341 // Possible blue combinations 342 TRegexp blu0("0.1led[sS]?blue"); 343 if (proj.Contains(blu0)) 344 { fPattern |= k01LedBlue; color = kBLUE; } 345 TRegexp blu1("1led[sS]?blue"); 346 if (proj.Contains(blu1)) 347 { fPattern |= k1LedBlue; color = kBLUE; } 348 TRegexp blu2("2led[sS]?blue"); 349 if (proj.Contains(blu2)) 350 { fPattern |= k2LedBlue; color = kBLUE; } 351 TRegexp blu3("3led[sS]?blue"); 352 if (proj.Contains(blu3)) 353 { fPattern |= k3LedBlue; color = kBLUE; } 354 TRegexp blu5("5led[sS]?blue"); 355 if (proj.Contains(blu5)) 356 { fPattern |= k5LedBlue1; color = kBLUE; } 357 TRegexp blu6("6led[sS]?blue"); 358 if (proj.Contains(blu6)) 359 { fPattern |= k6LedBlue; color = kBLUE; } 360 TRegexp blu7("7led[sS]?blue"); 361 if (proj.Contains(blu7)) 362 { fPattern |= k7LedBlue; color = kBLUE; } 363 TRegexp blu8("8led[sS]?blue"); 364 if (proj.Contains(blu8)) 365 { fPattern |= k8LedBlue; color = kBLUE; } 366 TRegexp blu10("10led[sS]?blue"); 367 if (proj.Contains(blu10)) 368 { fPattern |= k10LedBlue; color = kBLUE; } 369 TRegexp blu15("15led[sS]?blue"); 370 if (proj.Contains(blu15)) 371 { fPattern |= k15LedBlue; color = kBLUE; } 372 TRegexp blu20("20led[sS]?blue"); 373 if (proj.Contains(blu20)) 374 { fPattern |= k20LedBlue; color = kBLUE; } 375 TRegexp blu21("21led[sS]?blue"); 376 if (proj.Contains(blu21)) 377 { fPattern |= k21LedBlue; color = kBLUE; } 378 TRegexp blu22("22led[sS]?blue"); 379 if (proj.Contains(blu22)) 380 { fPattern |= k22LedBlue; color = kBLUE; } 381 TRegexp blu23("23led[sS]?blue"); 382 if (proj.Contains(blu23)) 383 { fPattern |= k23LedBlue; color = kBLUE; } 384 385 // Possible UV combinations 386 TRegexp uv1("1led[sS]?uv"); 387 if (proj.Contains(uv1)) 388 { fPattern |= k1LedUV; color = kUV; } 389 TRegexp uv2("2led[sS]?uv"); 390 if (proj.Contains(uv2)) 391 { fPattern |= k2LedUV; color = kUV; } 392 TRegexp uv3("3led[sS]?uv"); 393 if (proj.Contains(uv3)) 394 { fPattern |= k3LedUV; color = kUV; } 395 TRegexp uv5("5led[sS]?uv"); 396 if (proj.Contains(uv5)) 397 { fPattern |= k5LedUV1; color = kUV; } 398 TRegexp uv6("6led[sS]?uv"); 399 if (proj.Contains(uv6)) 400 { fPattern |= k6LedUV; color = kUV; } 401 TRegexp uv7("7led[sS]?uv"); 402 if (proj.Contains(uv7)) 403 { fPattern |= k7LedUV; color = kUV; } 404 TRegexp uv8("8led[sS]?uv"); 405 if (proj.Contains(uv8)) 406 { fPattern |= k8LedUV; color = kUV; } 407 TRegexp uv10("10led[sS]?uv"); 408 if (proj.Contains(uv10)) 409 { fPattern |= k10LedUV; color = kUV; } 410 TRegexp uv11("11led[sS]?uv"); 411 if (proj.Contains(uv11)) 412 { fPattern |= k11LedUV; color = kUV; } 413 TRegexp uv12("12led[sS]?uv"); 414 if (proj.Contains(uv12)) 415 { fPattern |= k12LedUV; color = kUV; } 416 TRegexp uv13("13led[sS]?uv"); 417 if (proj.Contains(uv13)) 418 { fPattern |= k13LedUV; color = kUV; } 419 420 // Possible slot combinations 421 TRegexp slot("slot"); 422 if (proj.Contains(slot)) 423 { 424 proj.ReplaceAll("slot",""); 425 UInt_t nr = 0; 426 TRegexp slotnr("^[0-9]"); 427 428 if (proj.Contains(slotnr)) 429 { fPattern = 0; proj.Replace(2,99,""); 430 proj.ReplaceAll("u",""); 431 proj.ReplaceAll("v",""); 432 proj.ReplaceAll("g",""); 433 nr = atoi(proj.Data())-1; 434 fPattern |= BIT(nr); 435 color = nr < 2 ? kGREEN : 436 ( nr < 3 ) ? kBLUE : 437 ( nr < 5 ) ? kUV : 438 ( nr < 11 ) ? kBLUE : 439 ( nr < 13 ) ? kUV : 440 ( nr < 14 ) ? kBLUE : 441 ( nr < 16 ) ? kGREEN : 442 kCT1; 443 } 444 } 445 329 } 330 331 TString proj = header->GetProjectName(); 332 proj.ToLower(); 333 334 // Possible green combinations 335 CheckAndSet(proj, "0.1led[sS]?gree", fPattern, k01LedGreen, color, kGREEN); 336 CheckAndSet(proj, "1led[sS]?gree", fPattern, k1LedGreen, color, kGREEN); 337 CheckAndSet(proj, "2led[sS]?gree", fPattern, k2LedGreen, color, kGREEN); 338 CheckAndSet(proj, "3led[sS]?gree", fPattern, k3LedGreen, color, kGREEN); 339 CheckAndSet(proj, "5led[sS]?gree", fPattern, k5LedGreen, color, kGREEN); 340 CheckAndSet(proj, "6led[sS]?gree", fPattern, k6LedGreen, color, kGREEN); 341 CheckAndSet(proj, "7led[sS]?gree", fPattern, k7LedGreen, color, kGREEN); 342 CheckAndSet(proj, "8led[sS]?gree", fPattern, k8LedGreen, color, kGREEN); 343 344 // Possible blue combinations 345 CheckAndSet(proj, "0.1led[sS]?blue", fPattern, k01LedBlue, color, kBLUE); 346 CheckAndSet(proj, "1led[sS]?blue", fPattern, k1LedBlue, color, kBLUE); 347 CheckAndSet(proj, "2led[sS]?blue", fPattern, k2LedBlue, color, kBLUE); 348 CheckAndSet(proj, "3led[sS]?blue", fPattern, k3LedBlue, color, kBLUE); 349 CheckAndSet(proj, "5led[sS]?blue", fPattern, k5LedBlue1, color, kBLUE); 350 CheckAndSet(proj, "6led[sS]?blue", fPattern, k6LedBlue, color, kBLUE); 351 CheckAndSet(proj, "7led[sS]?blue", fPattern, k7LedBlue, color, kBLUE); 352 CheckAndSet(proj, "8led[sS]?blue", fPattern, k8LedBlue, color, kBLUE); 353 CheckAndSet(proj, "10led[sS]?blue", fPattern, k10LedBlue, color, kBLUE); 354 CheckAndSet(proj, "15led[sS]?blue", fPattern, k15LedBlue, color, kBLUE); 355 CheckAndSet(proj, "20led[sS]?blue", fPattern, k20LedBlue, color, kBLUE); 356 CheckAndSet(proj, "21led[sS]?blue", fPattern, k21LedBlue, color, kBLUE); 357 CheckAndSet(proj, "22led[sS]?blue", fPattern, k22LedBlue, color, kBLUE); 358 CheckAndSet(proj, "23led[sS]?blue", fPattern, k23LedBlue, color, kBLUE); 359 360 // Possible UV combinations 361 CheckAndSet(proj, "1led[sS]?uv", fPattern, k1LedUV, color, kUV); 362 CheckAndSet(proj, "2led[sS]?uv", fPattern, k2LedUV, color, kUV); 363 CheckAndSet(proj, "3led[sS]?uv", fPattern, k3LedUV, color, kUV); 364 CheckAndSet(proj, "5led[sS]?uv", fPattern, k5LedUV1, color, kUV); 365 CheckAndSet(proj, "6led[sS]?uv", fPattern, k6LedUV, color, kUV); 366 CheckAndSet(proj, "7led[sS]?uv", fPattern, k7LedUV, color, kUV); 367 CheckAndSet(proj, "8led[sS]?uv", fPattern, k8LedUV, color, kUV); 368 CheckAndSet(proj, "10led[sS]?uv", fPattern, k10LedUV, color, kUV); 369 CheckAndSet(proj, "11led[sS]?uv", fPattern, k11LedUV, color, kUV); 370 CheckAndSet(proj, "12led[sS]?uv", fPattern, k12LedUV, color, kUV); 371 CheckAndSet(proj, "13led[sS]?uv", fPattern, k13LedUV, color, kUV); 372 373 // Possible slot combinations 374 TRegexp slot("slot"); 375 if (proj.Contains(slot)) 376 { 377 proj.ReplaceAll("slot",""); 378 UInt_t nr = 0; 379 TRegexp slotnr("^[0-9]"); 380 381 if (proj.Contains(slotnr)) 382 { 383 fPattern = 0; 384 proj.Replace(2,99,""); 385 proj.ReplaceAll("u",""); 386 proj.ReplaceAll("v",""); 387 proj.ReplaceAll("g",""); 388 nr = atoi(proj.Data())-1; 389 390 fPattern |= BIT(nr); 391 392 color = nr < 2 ? kGREEN : 393 ( nr < 3 ) ? kBLUE : 394 ( nr < 5 ) ? kUV : 395 ( nr < 11 ) ? kBLUE : 396 ( nr < 13 ) ? kUV : 397 ( nr < 14 ) ? kBLUE : 398 ( nr < 16 ) ? kGREEN : 399 kCT1; 400 } 401 } 402 403 if (color == kNONE) 404 { 405 CheckAndSet(proj, "gree", fPattern, k5LedGreen, color, kGREEN); 406 CheckAndSet(proj, "blue", fPattern, k5LedBlue1, color, kBLUE); 407 CheckAndSet(proj, "uv", fPattern, k5LedUV1, color, kUV); 408 CheckAndSet(proj, "ct1", fPattern, kCT1Pulser, color, kCT1); 409 446 410 if (color != kNONE) 447 *fLog << inf << "Color and Intensity determined from project-name (" << proj << ")... ";411 *fLog << inf << "Color determined from project-name (" << proj << ")... "; 448 412 else 449 { 450 if (proj.Contains("gree",TString::kIgnoreCase)) 451 { fPattern |= k5LedGreen; color = kGREEN; } 452 if (proj.Contains("blue",TString::kIgnoreCase)) 453 { fPattern |=k5LedBlue1; color = kBLUE;} 454 if (proj.Contains("uv",TString::kIgnoreCase)) 455 { fPattern |=k5LedUV1 ; color = kUV; } 456 if (proj.Contains("ct1",TString::kIgnoreCase)) 457 { fPattern |=kCT1Pulser; color = kCT1; } 458 if (color != kNONE) 459 *fLog << inf << "Color determined from project-name (" << proj << ")... "; 460 else if (proj.Contains("cl",TString::kIgnoreCase)) 461 { 462 *fLog << warn << "This run has been taken with the continuous light source." << endl; 463 *fLog << warn 464 << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl; 413 if (proj.Contains("cl",TString::kIgnoreCase)) 414 { 415 *fLog << warn; 416 *fLog << "This run has been taken with the continuous light source." << endl; 417 *fLog << "It cannot be used for calibration. Try to run a pedestal extraction on it." << endl; 465 418 fPattern = 0; 466 419 fIsValid = kTRUE; 467 420 return kTRUE; 468 } 469 } 470 } 471 472 if (color==kNONE) 473 { 474 *fLog << err << "Sorry, calibration run " << num << " was taken before the events could be" << endl; 421 } 422 423 *fLog << err; 424 *fLog << "Sorry, calibration run " << num << " was taken before the events could be" << endl; 475 425 *fLog << "flagged with a color by the digital modul and no color" << endl; 476 426 *fLog << "could be determined... abort." << endl; 477 427 return kFALSE; 478 } 479 428 } 429 430 *fLog << inf << "Color and Intensity determined from project-name (" << proj << ")... "; 431 480 432 switch (color) 481 482 483 484 485 486 433 { 434 case kGREEN: *fLog << "Green."; break; 435 case kBLUE: *fLog << "Blue."; break; 436 case kUV: *fLog << "UV."; break; 437 case kCT1: *fLog << "CT1."; break; 438 } 487 439 *fLog << endl; 488 440 489 441 fIsValid = kTRUE; 490 442 491 443 return kTRUE; 492 444 } -
trunk/MagicSoft/Mars/mcalib/MCalibColorSet.h
r5621 r5690 21 21 UInt_t fPattern; // Current pulse pattern 22 22 Bool_t fIsValid; // Have to set the pulse pattern? 23 23 24 void CheckAndSet(const TString &str, const char *regexp, UInt_t &pattern, UInt_t pat, Int_t &color, Int_t col) const; 25 24 26 Bool_t ReInit(MParList *pList); 25 27 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.cc
r5660 r5690 40 40 ///////////////////////////////////////////////////////////////////////////// 41 41 #include "MCalibrationIntensityChargeCam.h" 42 43 #include <TF1.h> 44 #include <TH2.h> 45 #include <TGraphErrors.h> 46 #include <TOrdCollection.h> 47 48 #include "MLog.h" 49 50 #include "MGeomCam.h" 51 #include "MGeomPix.h" 52 42 53 #include "MCalibrationChargeCam.h" 43 54 #include "MCalibrationChargePix.h" 44 45 #include "MGeomCam.h"46 #include "MGeomPix.h"47 48 #include "MLog.h"49 50 #include <TOrdCollection.h>51 #include <TGraphErrors.h>52 #include <TH2F.h>53 #include <TF1.h>54 55 55 56 ClassImp(MCalibrationIntensityChargeCam); … … 428 429 const Float_t qe = pix.GetConvertedMeanErr(); 429 430 oneoverq [i] = 1./q; 430 oneoverqerr[i] = qe / q / q;431 oneoverqerr[i] = qe / (q * q); 431 432 } 432 433 … … 436 437 gr->SetTitle(Form("%s%3i","Pixel ",pixid)); 437 438 gr->GetXaxis()->SetTitle("1/Q [FADC counts^{-1}]"); 438 gr->GetYaxis()->SetTitle("\ sigma_{red}^{2}/Q^{2} [1]");439 gr->GetYaxis()->SetTitle("\\sigma_{red}^{2}/Q^{2} [1]"); 439 440 return gr; 440 441 }
Note:
See TracChangeset
for help on using the changeset viewer.