Changeset 3551 for trunk/MagicSoft


Ignore:
Timestamp:
03/19/04 16:56:19 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3549 r3551  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2004/03/19: Markus Gaug
     21
     22   * mcalib/MHCalibrationChargePix.cc
     23     - added some style sto the default Draw in order to see the
     24       label and axis titles better
     25
     26   * mcalib/MHCalibrationChargeCam.[h,cc]
     27     - store and display more informaiton on the average pxiels
     28
     29   * mcalib/MCalibrationCam.cc
     30     - the GetPixelContent flag were not correct any more, fixed them
     31       
     32   * macros/calibration.C
     33     - fixed GetPixelContent flags
     34     - draw radial profile of the variables
     35
     36   * mjobs/MJCalibration.cc
     37     - fixed GetPixelContent flags
     38
     39
    2040 2004/03/18: Raquel de los Reyes
    2141
  • trunk/MagicSoft/Mars/macros/calibration.C

    r3463 r3551  
    2424#include "MAGIC.h"
    2525
    26 
    2726void calibration()
    2827{
    2928
    30 //    const char *inpath = "/remote/home/pc2/operator/NewCalBoxTest/";
    31 //    const char *inpath = "/remote/home/pc2/operator/Crab20040214/";
    32 //    const char *inpath = "./";
    33     //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_02_10/";
    34     //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_26/";
     29  //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_02_10/";
     30  //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_26/";
    3531  const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_27/";
    36     //const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/";
    37 
    38     MRunIter pruns;
    39     MRunIter cruns;
    40 
    41     pruns.AddRun(12386,inpath);
    42     cruns.AddRun(12525,inpath);
    43     //    pruns.AddRun(14400,inpath);
    44     //    cruns.AddRuns(14401,14409,inpath);
    45 //    pruns.AddRuns(15487,15494,inpath);
    46 //    cruns.AddRuns(15495,15508,inpath);
    47 //    pruns.AddRun(19816,inpath);  // CalboxTest
    48 //    cruns.AddRun(19820,inpath); // 3blue
    49 //    cruns.AddRun(19820,inpath);   // 1blue
    50 
    51     gStyle->SetOptStat(1111);
    52     gStyle->SetOptFit();
    53 
    54     MStatusDisplay *display = new MStatusDisplay;
    55     display->SetUpdateTime(3000);
    56     display->Resize(850,700);
    57 
    58     MJPedestal pedloop;
    59     pedloop.SetInput(&pruns);
    60     pedloop.SetDisplay(display);
    61 
    62     if (!pedloop.Process())
    63         return;
    64 
    65     //
    66     // Now the short version:
    67     //
    68 /*
     32  //const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/";
     33  //  const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2004_03_03/";
     34  //    const TString inpath = "/home/rootdata/BlindPixel/";
     35
     36  //  const TString inpath = ".";
     37  MRunIter pruns;
     38  MRunIter cruns;
     39
     40  //  pruns.AddRun(20491,inpath);
     41  //  pruns.AddRun(20123,inpath);
     42
     43  pruns.AddRun(12386,inpath);
     44  //    pruns.AddRun(14400,inpath);
     45  //    cruns.AddRuns(14401,14409,inpath);
     46  //    pruns.AddRuns(15487,15494,inpath);
     47 //  cruns.AddRuns(12525,12529,inpath);
     48  cruns.AddRun(12525,inpath);
     49  //    cruns.AddRuns(15495,15508,inpath);
     50  //  cruns.AddRun(20491,inpath);
     51  //  cruns.AddRun(20129,inpath);
     52
     53  gStyle->SetOptStat(1111);
     54  gStyle->SetOptFit();
     55 
     56  MStatusDisplay *display = new MStatusDisplay;
     57  display->SetUpdateTime(3000);
     58  display->Resize(850,700);
     59 
     60  MBadPixelsCam badcam;
     61  badcam.AsciiRead("badpixels.dat");
     62
     63  /************************************/
     64  /* FIRST LOOP: PEDESTAL COMPUTATION */
     65  /************************************/
     66 
     67  MJPedestal pedloop;
     68  pedloop.SetInput(&pruns);
     69  pedloop.SetDisplay(display);
     70  pedloop.SetBadPixels(badcam);
     71
     72  if (!pedloop.Process())
     73    return;
     74
     75  //
     76  // Now the short version:
     77  //
     78  /*
    6979    MJCalibration calloop;
    7080    calloop.SetInput(&cruns);
     
    7282    if (!calloop.Process(pedloop.GetPedestalCam()))
    7383        return;
    74 #if 0
    75 */
    76     //
    77     // The longer version:
    78     //
    79 
    80     //
    81     // Create a empty Parameter List and an empty Task List
    82     //
    83     MParList  plist;
    84     MTaskList tlist;
    85     plist.AddToList(&tlist);
    86     plist.AddToList(&pedloop.GetPedestalCam());
    87 
    88     gLog << endl;;
    89     gLog << "Calculate MCalibrationCam from Runs " << cruns.GetRunsAsString() << endl;
    90     gLog << endl;
    91 
    92     MReadMarsFile read("Events");
    93     read.DisableAutoScheme();
    94     static_cast<MRead&>(read).AddFiles(cruns);
    95 
    96     MGeomCamMagic              geomcam;
    97     MExtractedSignalCam        sigcam;
    98     MArrivalTimeCam            timecam;
    99     MCalibrationChargeCam      calcam;
    100     MCalibrationChargePINDiode pindiode;   
    101     MCalibrationChargeBlindPix blindpix;   
    102    
    103     MHCalibrationRelTimeCam     histtime;
    104     MHCalibrationChargeCam      histcharge;
    105     MHCalibrationChargePINDiode histpin;
    106     MHCalibrationChargeBlindPix histblind;
    107 //    histblind.SetSinglePheCut(80);
    108     //
    109     // As long, as we don't have digital modules,
    110     // we have to set the color of the pulser LED by hand
    111     //
    112     blindpix.SetColor(kCT1);
    113     //    pindiode.SetColor(kCT1);
    114     //
    115     // Get the previously created MPedestalCam into the new Parameter List
    116     //
    117     plist.AddToList(&geomcam);
    118     plist.AddToList(&sigcam);
    119     plist.AddToList(&timecam);
    120     plist.AddToList(&calcam);
    121     plist.AddToList(&histtime);
    122     plist.AddToList(&histcharge);
    123 //    plist.AddToList(&histpin);
    124     plist.AddToList(&histblind);
    125     plist.AddToList(&pedloop.GetBadPixels());   
    126 
    127     //
    128     // We saw that the signal jumps between slices,
    129     // thus take the sliding window
    130     //         
    131     MExtractSignal2        sigcalc2;
    132     MExtractPINDiode       pincalc;
    133     MExtractBlindPixel     blindcalc;
    134 //    blindcalc.SetRange(11,16);
    135 
    136     MArrivalTimeCalc2      timecalc;
    137     MCalibrationChargeCalc calcalc;
    138     MGeomApply             geomapl;
    139 
    140     MFillH filltime( "MHCalibrationRelTimeCam"    , "MArrivalTimeCam");
    141 //   MFillH fillpin  ("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
    142     MFillH fillblind("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
    143     MFillH fillcam  ("MHCalibrationChargeCam"     , "MExtractedSignalCam");
    144 
    145     //
    146     // Skip the HiGain vs. LoGain calibration
    147     //
    148     calcalc.SkipHiLoGainCalibration();
    149 
    150     //
    151     // Apply a filter against cosmics
    152     // (was directly in MCalibrationCalc in earlier versions)
    153     //
    154     MFCosmics            cosmics;
    155     MContinue            cont(&cosmics);
    156 
    157     tlist.AddToList(&read);
    158     tlist.AddToList(&geomapl);
    159     tlist.AddToList(&sigcalc2);
    160     tlist.AddToList(&blindcalc);
    161 //    tlist.AddToList(&pincalc);
    162     //
    163     // In case, you want to skip the cosmics rejection,
    164     // uncomment the next line
    165     //
    166     tlist.AddToList(&cont);
    167     //
    168     // In case, you want to skip the somewhat lengthy calculation
    169     // of the arrival times using a spline, uncomment the next two lines
    170     //
    171     tlist.AddToList(&timecalc);
    172     tlist.AddToList(&filltime);
    173 //    tlist.AddToList(&fillpin);
    174     tlist.AddToList(&fillblind);
    175     tlist.AddToList(&fillcam);
    176     //
    177     tlist.AddToList(&calcalc);
    178     //
    179     // Create and setup the eventloop
    180     //
    181     MEvtLoop evtloop;
    182     evtloop.SetParList(&plist);
    183     evtloop.SetDisplay(display);
    184    
    185     //
    186     // Execute second analysis
    187     //
    188     if (!evtloop.Eventloop())
    189         return;
    190 
    191     tlist.PrintStatistics();
    192 
    193     //
    194     // print the most important results of all pixels to a file
    195     //
    196     MLog gauglog;
    197     gauglog.SetOutputFile(Form("%s%s",calcam.GetName(),".txt"),1);
    198     calcam.SetLogStream(&gauglog);
    199     calcam.Print();
    200     calcam.SetLogStream(&gLog);
    201     //
    202     // just one example how to get the plots of individual pixels
    203     //
    204     //    histblind.DrawClone("all");
    205     //    histcharge[5].DrawClone("all");
    206     //    histcharge(5).DrawClone("all");
    207     //    histtime[5].DrawClone("fourierevents");
    208 
    209     // Create histograms to display
    210     MHCamera disp1  (geomcam, "Cal;Charge",         "Fitted Mean Charges");
    211     MHCamera disp2  (geomcam, "Cal;SigmaCharge",    "Sigma of Fitted Charges");
    212     MHCamera disp3  (geomcam, "Cal;FitProb",        "Probability of Fit");
    213     MHCamera disp4  (geomcam, "Cal;RSigma",         "Reduced Sigmas");
    214     MHCamera disp5  (geomcam, "Cal;RSigma/Charge",  "Reduced Sigma per Charge");
    215     MHCamera disp6  (geomcam, "Cal;FFactorPh",      "Nr. of Photo-electrons (F-Factor Method)");
    216     MHCamera disp7  (geomcam, "Cal;FFactorConv",    "Conversion Factor to photons (F-Factor Method)");
    217     MHCamera disp8  (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)");
    218     MHCamera disp9  (geomcam, "Cal;BlindPixPh",     "Photon flux inside plexiglass (Blind Pixel Method)");
    219     MHCamera disp10 (geomcam, "Cal;BlindPixConv",   "Conversion Factor to photons (Blind Pixel Method)");
    220     MHCamera disp11 (geomcam, "Cal;BlindPixFFactor","Total F-Factor (Blind Pixel Method)");
    221     MHCamera disp12 (geomcam, "Cal;PINDiodePh",     "Photon flux outside plexiglass (PIN Diode Method)");
    222     MHCamera disp13 (geomcam, "Cal;PINDiodeConv",   "Conversion Factor tp photons (PIN Diode Method)");
    223     MHCamera disp14 (geomcam, "Cal;PINDiodeFFactor","Total F-Factor (PIN Diode Method)");
    224     MHCamera disp15 (geomcam, "Cal;Excluded",       "Pixels previously excluded");
    225     MHCamera disp16 (geomcam, "Cal;NotFitted",      "Pixels that could not be fitted");
    226     MHCamera disp17 (geomcam, "Cal;NotFitValid",    "Pixels with not valid fit results");
    227     MHCamera disp18 (geomcam, "Cal;HiGainOscillating",     "Oscillating Pixels HI Gain");
    228     MHCamera disp19 (geomcam, "Cal;LoGainOscillating",     "Oscillating Pixels LO Gain");
    229     MHCamera disp20 (geomcam, "Cal;HiGainPickup",          "Number Pickup events Hi Gain");
    230     MHCamera disp21 (geomcam, "Cal;LoGainPickup",          "Number Pickup events Lo Gain");
    231     MHCamera disp22 (geomcam, "Cal;Saturation",            "Pixels with saturated Hi Gain");
    232     MHCamera disp23 (geomcam, "Cal;FFactorValid",          "Pixels with valid F-Factor calibration");
    233     MHCamera disp24 (geomcam, "Cal;BlindPixelValid",       "Pixels with valid BlindPixel calibration");
    234     MHCamera disp25 (geomcam, "Cal;PINdiodeFFactorValid",  "Pixels with valid PINDiode calibration");
    235 
    236     MHCamera disp26 (geomcam, "Cal;Ped",         "Pedestals");
    237     MHCamera disp27 (geomcam, "Cal;PedRms",      "Pedestal RMS");
    238 
    239     MHCamera disp28 (geomcam, "time;Time",        "Rel. Arrival Times");
    240     MHCamera disp29 (geomcam, "time;SigmaTime",   "Sigma of Rel. Arrival Times");
    241     MHCamera disp30 (geomcam, "time;TimeProb",    "Probability of Time Fit");
    242     MHCamera disp31 (geomcam, "time;NotFitValid", "Pixels with not valid fit results");
    243     MHCamera disp32 (geomcam, "time;Oscillating", "Oscillating Pixels");
    244 
    245     MHCamera disp33 (geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times");
    246     MHCamera disp34 (geomcam, "Cal;AbsTimeRms",  "RMS of Arrival Times");
    247 
    248     // Fitted charge means and sigmas
    249     disp1.SetCamContent(calcam,  0);
    250     disp1.SetCamError(  calcam,  1);
    251     disp2.SetCamContent(calcam,  2);
    252     disp2.SetCamError(  calcam,  3);
    253 
    254     // Fit probabilities
    255     disp3.SetCamContent(calcam,  4);
    256 
    257     // Reduced Sigmas and reduced sigmas per charge
    258     disp4.SetCamContent(calcam,  5);
    259     disp4.SetCamError(  calcam,  6);
    260     disp5.SetCamContent(calcam,  7);
    261     disp5.SetCamError(  calcam,  8);
    262 
    263     // F-Factor Method
    264     disp6.SetCamContent(calcam,  9);
    265     disp6.SetCamError(  calcam, 10);
    266     disp7.SetCamContent(calcam, 11);
    267     disp7.SetCamError(  calcam, 12);
    268     disp8.SetCamContent(calcam, 13);
    269     disp8.SetCamError(  calcam, 14);
    270 
    271     /// Blind Pixel Method
    272     disp9.SetCamContent(calcam, 15);
    273     disp9.SetCamError(  calcam, 16);
    274     disp10.SetCamContent(calcam,17);
    275     disp10.SetCamError(  calcam,18);
    276     disp11.SetCamContent(calcam,19);
    277     disp11.SetCamError(  calcam,20);
    278 
    279     // PIN Diode Method
    280     disp12.SetCamContent(calcam,21);
    281     disp12.SetCamError(  calcam,22);
    282     disp13.SetCamContent(calcam,23);
    283     disp13.SetCamError(  calcam,24);
    284     disp14.SetCamContent(calcam,25);
    285     disp14.SetCamError(  calcam,26);
    286 
    287     // Pixels with defects
    288     disp15.SetCamContent(calcam,27);
    289     disp16.SetCamContent(calcam,28);
    290     disp17.SetCamContent(calcam,29);
    291     disp18.SetCamContent(calcam,30);
    292     disp19.SetCamContent(calcam,31);
    293     disp20.SetCamContent(calcam,32);
    294     disp21.SetCamContent(calcam,33);
    295 
    296     // Lo Gain calibration
    297     disp22.SetCamContent(calcam,34);
    298 
    299     // Valid flags
    300     disp23.SetCamContent(calcam,35);
    301     disp24.SetCamContent(calcam,36);
    302     disp25.SetCamContent(calcam,37);
    303 
    304     // Pedestals
    305     disp26.SetCamContent(calcam,38);
    306     disp26.SetCamError(  calcam,39);
    307     disp27.SetCamContent(calcam,40);
    308     disp27.SetCamError(  calcam,41);
    309 
    310     // Relative Times
    311     disp28.SetCamContent(histtime,0);
    312     disp28.SetCamError(  histtime,1);
    313     disp29.SetCamContent(histtime,2);
    314     disp29.SetCamError(  histtime,3);
    315     disp30.SetCamContent(histtime,4);
    316     disp31.SetCamContent(histtime,5);
    317     disp32.SetCamContent(histtime,6);
    318 
    319     // Absolute Times
    320     disp33.SetCamContent(calcam,42);
    321     disp33.SetCamError(  calcam,43);
    322     disp34.SetCamContent(calcam,43);
    323 
    324     disp1.SetYTitle("Charge [FADC units]");
    325     disp2.SetYTitle("\\sigma_{Charge} [FADC units]");
    326     disp3.SetYTitle("P_{Charge} [1]");
    327 
    328     disp4.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]");
    329     disp5.SetYTitle("Reduced Sigma / Mean Charge [1]");
    330 
    331     disp6.SetYTitle("Nr. Photo-electrons [1]");
    332     disp7.SetYTitle("Conversion Factor [Ph/FADC Count]");
    333     disp8.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1] ");
    334 
    335     disp9.SetYTitle("Photon flux [ph/mm^2]");
    336     disp10.SetYTitle("Conversion Factor [Phot/FADC Count]");
    337     disp11.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
    338 
    339     disp12.SetYTitle("Photon flux [ph/mm^2]");
    340     disp13.SetYTitle("Conversion Factor [Phot/FADC Count]");
    341     disp14.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
    342 
    343     disp15.SetYTitle("[1]");
    344     disp16.SetYTitle("[1]");
    345     disp17.SetYTitle("[1]");
    346     disp18.SetYTitle("[1]");
    347     disp19.SetYTitle("[1]");
    348     disp20.SetYTitle("[1]");
    349     disp21.SetYTitle("[1]");
    350     disp22.SetYTitle("[1]");
    351     disp23.SetYTitle("[1]");
    352     disp24.SetYTitle("[1]");
    353     disp25.SetYTitle("[1]");
    354 
    355     disp26.SetYTitle("Ped [FADC Counts ]");
    356     disp27.SetYTitle("RMS_{Ped} [FADC Counts ]");
    357 
    358     disp28.SetYTitle("Time Offset [ns]");
    359     disp29.SetYTitle("Timing resolution [ns]");
    360     disp30.SetYTitle("P_{Time} [1]");
    361 
    362     disp31.SetYTitle("[1]");
    363     disp32.SetYTitle("[1]");
    364 
    365     disp33.SetYTitle("Mean Abs. Time [FADC slice]");
    366     disp34.SetYTitle("RMS Abs. Time [FADC slices]");
    367 
    368     gStyle->SetOptStat(1111);
    369     gStyle->SetOptFit();
    370    
    371     // Charges
    372     TCanvas &c1 = display->AddTab("Fit.Charge");
    373     c1.Divide(2, 3);
    374 
    375     CamDraw(c1, disp1,calcam,1, 2 , 2);
    376     CamDraw(c1, disp2,calcam,2, 2 , 2);
    377 
    378     // Fit Probability
    379     TCanvas &c2 = display->AddTab("Fit.Prob");
    380     c2.Divide(1,3);
    381 
    382     CamDraw(c2, disp3,calcam,1, 1 , 4);
    383 
    384     // Reduced Sigmas
    385     TCanvas &c3 = display->AddTab("Red.Sigma");
    386     c3.Divide(2,3);
    387 
    388     CamDraw(c3, disp4,calcam,1, 2 , 2);
    389     CamDraw(c3, disp5,calcam,2, 2 , 2);
    390 
    391     // F-Factor Method
    392     TCanvas &c4 = display->AddTab("F-Factor");
    393     c4.Divide(3,3);
    394 
    395     CamDraw(c4, disp6,calcam,1, 3 , 2);
    396     CamDraw(c4, disp7,calcam,2, 3 , 2);
    397     CamDraw(c4, disp8,calcam,3, 3 , 2);
    398 
    399     // Blind Pixel Method
    400     TCanvas &c5 = display->AddTab("BlindPix");
    401     c5.Divide(3, 3);
    402 
    403     CamDraw(c5, disp9,calcam,1, 3 ,  9);
    404     CamDraw(c5, disp10,calcam,2, 3 , 2);
    405     CamDraw(c5, disp11,calcam,3, 3 , 2);
    406 
    407     // PIN Diode Method
    408     TCanvas &c6 = display->AddTab("PINDiode");
    409     c6.Divide(3,3);
    410 
    411     CamDraw(c6, disp12,calcam,1, 3 , 9);
    412     CamDraw(c6, disp13,calcam,2, 3 , 2);
    413     CamDraw(c6, disp14,calcam,3, 3 , 2);
    414 
    415     // Defects
    416     TCanvas &c7 = display->AddTab("Defects");
    417     c7.Divide(7,2);
    418 
    419     CamDraw(c7, disp15,calcam,1,7, 0);
    420     CamDraw(c7, disp16,calcam,2,7, 0);
    421     CamDraw(c7, disp17,calcam,3,7, 0);
    422     CamDraw(c7, disp18,calcam,4,7, 0);
    423     CamDraw(c7, disp19,calcam,5,7, 0);
    424     CamDraw(c7, disp20,calcam,6,7, 0);
    425     CamDraw(c7, disp21,calcam,7,7, 0);
    426 
    427     // Valid flags
    428     TCanvas &c8 = display->AddTab("Validity");
    429     c8.Divide(4,2);
    430 
    431     CamDraw(c8, disp22,calcam,1,4,0);
    432     CamDraw(c8, disp23,calcam,2,4,0);
    433     CamDraw(c8, disp24,calcam,3,4,0);
    434     CamDraw(c8, disp25,calcam,4,4,0);
    435 
    436 
    437     // Pedestals
    438     TCanvas &c9 = display->AddTab("Pedestals");
    439     c9.Divide(2,3);
    440 
    441     CamDraw(c9,disp26,calcam,1,2,1);
    442     CamDraw(c9,disp27,calcam,2,2,2);
    443 
    444     // Rel. Times
    445     TCanvas &c10 = display->AddTab("Fitted Rel. Times");
    446     c10.Divide(3,3);
    447 
    448     CamDraw(c10,disp28,calcam,1,3,2);
    449     CamDraw(c10,disp29,calcam,2,3,2);
    450     CamDraw(c10,disp30,calcam,3,3,4);
    451 
    452     // Time Defects
    453     TCanvas &c11 = display->AddTab("Time Def.");
    454     c11.Divide(2,2);
    455 
    456     CamDraw(c11, disp31,calcam,1,2, 0);
    457     CamDraw(c11, disp32,calcam,2,2, 0);
    458 
    459     // Abs. Times
    460     TCanvas &c12 = display->AddTab("Abs. Times");
    461     c12.Divide(2,3);
    462 
    463     CamDraw(c12,disp33,calcam,1,2,2);
    464     CamDraw(c12,disp34,calcam,2,2,2);
    465 
    466 #endif
     84        //        #if 0
     85  */
     86  //
     87  // The longer version:
     88  //
     89 
     90  //
     91  // Create a empty Parameter List and an empty Task List
     92  //
     93  MParList  plist;
     94  MTaskList tlist;
     95  plist.AddToList(&tlist);
     96  plist.AddToList(&pedloop.GetPedestalCam());
     97  plist.AddToList(&badcam);
     98
     99  gLog << endl;;
     100  gLog << "Calculate MCalibrationCam from Runs " << cruns.GetRunsAsString() << endl;
     101  gLog << endl;
     102 
     103  MReadMarsFile read("Events");
     104  read.DisableAutoScheme();
     105  static_cast<MRead&>(read).AddFiles(cruns);
     106 
     107  MGeomCamMagic              geomcam;
     108  MExtractedSignalCam        sigcam;
     109  MArrivalTimeCam            timecam;
     110  MCalibrationChargeCam      calcam;
     111  MCalibrationChargePINDiode pindiode;   
     112  MCalibrationChargeBlindPix blindpix;   
     113 
     114  MHCalibrationRelTimeCam     histtime;
     115  MHCalibrationChargeCam      histcharge;
     116  MHCalibrationChargePINDiode histpin;
     117  MHCalibrationChargeBlindPix histblind;
     118  histblind.SetSinglePheCut(1000);
     119  //
     120  // As long, as we don't have digital modules,
     121  // we have to set the color of the pulser LED by hand
     122  //
     123  blindpix.SetColor(kCT1);
     124  //    pindiode.SetColor(kCT1);
     125  //
     126  // Get the previously created MPedestalCam into the new Parameter List
     127  //
     128  plist.AddToList(&geomcam);
     129  plist.AddToList(&sigcam);
     130  plist.AddToList(&timecam);
     131  plist.AddToList(&calcam);
     132  plist.AddToList(&histtime);
     133  plist.AddToList(&histcharge);
     134  //    plist.AddToList(&histpin);
     135  plist.AddToList(&histblind);
     136  plist.AddToList(&pedloop.GetBadPixels());   
     137 
     138  //
     139  // We saw that the signal jumps between slices,
     140  // thus take the sliding window
     141  //           
     142  MExtractSignal2        sigcalc2;
     143  MExtractPINDiode       pincalc;
     144  MExtractBlindPixel     blindcalc;
     145  sigcalc2.SetRange(2,15,6,5,14,6);
     146  blindcalc.SetRange(11,29);
     147
     148  MArrivalTimeCalc2      timecalc;
     149  MCalibrationChargeCalc calcalc;
     150  MGeomApply             geomapl;
     151 
     152  MFillH filltime( "MHCalibrationRelTimeCam"    , "MArrivalTimeCam");
     153  //   MFillH fillpin  ("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
     154  MFillH fillblind("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
     155  MFillH fillcam  ("MHCalibrationChargeCam"     , "MExtractedSignalCam");
     156 
     157  //
     158  // Skip the HiGain vs. LoGain calibration
     159  //
     160  calcalc.SkipHiLoGainCalibration();
     161 
     162  //
     163  // Apply a filter against cosmics
     164  // (was directly in MCalibrationCalc in earlier versions)
     165  //
     166  MFCosmics            cosmics;
     167  MContinue            cont(&cosmics);
     168 
     169  tlist.AddToList(&read);
     170  tlist.AddToList(&geomapl);
     171  tlist.AddToList(&sigcalc2);
     172  tlist.AddToList(&blindcalc);
     173  //    tlist.AddToList(&pincalc);
     174  //
     175  // In case, you want to skip the cosmics rejection,
     176  // uncomment the next line
     177  //
     178  tlist.AddToList(&cont);
     179  //
     180  // In case, you want to skip the somewhat lengthy calculation
     181  // of the arrival times using a spline, uncomment the next two lines
     182  //
     183  tlist.AddToList(&timecalc);
     184  tlist.AddToList(&filltime);
     185  //    tlist.AddToList(&fillpin);
     186  tlist.AddToList(&fillblind);
     187  tlist.AddToList(&fillcam);
     188  //
     189  tlist.AddToList(&calcalc);
     190  //
     191  // Create and setup the eventloop
     192  //
     193  MEvtLoop evtloop;
     194  evtloop.SetParList(&plist);
     195  evtloop.SetDisplay(display);
     196 
     197  //
     198  // Execute second analysis
     199  //
     200  if (!evtloop.Eventloop())
     201    return;
     202 
     203  tlist.PrintStatistics();
     204 
     205  //
     206  // print the most important results of all pixels to a file
     207  //
     208  MLog gauglog;
     209  gauglog.SetOutputFile(Form("%s%s",calcam.GetName(),".txt"),1);
     210  calcam.SetLogStream(&gauglog);
     211  badcam.Print();
     212  //    calcam.Print();
     213  calcam.SetLogStream(&gLog);
     214  //
     215  // just one example how to get the plots of individual pixels
     216  //
     217  //    histblind.DrawClone("all");
     218  //histcharge[5].DrawClone("all");
     219  //    histcharge(5).DrawClone("all");
     220  //    histtime[5].DrawClone("fourierevents");
     221 
     222  // Create histograms to display
     223  MHCamera disp1  (geomcam, "Cal;Charge",         "Fitted Mean Charges");
     224  MHCamera disp2  (geomcam, "Cal;SigmaCharge",    "Sigma of Fitted Charges");
     225  MHCamera disp3  (geomcam, "Cal;FitProb",        "Probability of Fit");
     226  MHCamera disp4  (geomcam, "Cal;RSigma",         "Reduced Sigmas");
     227  MHCamera disp5  (geomcam, "Cal;RSigma/Charge",  "Reduced Sigma per Charge");
     228  MHCamera disp6  (geomcam, "Cal;FFactorPh",      "Nr. of Photo-electrons (F-Factor Method)");
     229  MHCamera disp7  (geomcam, "Cal;FFactorConv",    "Conversion Factor to photons (F-Factor Method)");
     230  MHCamera disp8  (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)");
     231  MHCamera disp9  (geomcam, "Cal;BlindPixConv",   "Conversion Factor to photons (Blind Pixel Method)");
     232  MHCamera disp10 (geomcam, "Cal;BlindPixFFactor","Total F-Factor (Blind Pixel Method)");
     233  MHCamera disp11 (geomcam, "Cal;PINDiodeConv",   "Conversion Factor tp photons (PIN Diode Method)");
     234  MHCamera disp12 (geomcam, "Cal;PINDiodeFFactor","Total F-Factor (PIN Diode Method)");
     235  MHCamera disp13 (geomcam, "Cal;Excluded",       "Pixels previously excluded");
     236  MHCamera disp14 (geomcam, "Cal;NotFitted",      "Pixels that could not be fitted");
     237  MHCamera disp15 (geomcam, "Cal;NotFitValid",    "Pixels with not valid fit results");
     238  MHCamera disp16 (geomcam, "Cal;HiGainOscillating",     "Oscillating Pixels HI Gain");
     239  MHCamera disp17 (geomcam, "Cal;LoGainOscillating",     "Oscillating Pixels LO Gain");
     240  MHCamera disp18 (geomcam, "Cal;HiGainPickup",          "Number Pickup events Hi Gain");
     241  MHCamera disp19 (geomcam, "Cal;LoGainPickup",          "Number Pickup events Lo Gain");
     242  MHCamera disp20 (geomcam, "Cal;Saturation",            "Pixels with saturated Hi Gain");
     243  MHCamera disp21 (geomcam, "Cal;FFactorValid",          "Pixels with valid F-Factor calibration");
     244  MHCamera disp22 (geomcam, "Cal;BlindPixelValid",       "Pixels with valid BlindPixel calibration");
     245  MHCamera disp23 (geomcam, "Cal;PINdiodeFFactorValid",  "Pixels with valid PINDiode calibration");
     246 
     247  MHCamera disp24 (geomcam, "Cal;Ped",         "Pedestals");
     248  MHCamera disp25 (geomcam, "Cal;PedRms",      "Pedestal RMS");
     249 
     250  MHCamera disp26 (geomcam, "time;Time",        "Rel. Arrival Times");
     251  MHCamera disp27 (geomcam, "time;SigmaTime",   "Sigma of Rel. Arrival Times");
     252  MHCamera disp28 (geomcam, "time;TimeProb",    "Probability of Time Fit");
     253  MHCamera disp29 (geomcam, "time;NotFitValid", "Pixels with not valid fit results");
     254  MHCamera disp30 (geomcam, "time;Oscillating", "Oscillating Pixels");
     255 
     256  MHCamera disp31 (geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times");
     257  MHCamera disp32 (geomcam, "Cal;AbsTimeRms",  "RMS of Arrival Times");
     258 
     259  // Fitted charge means and sigmas
     260  disp1.SetCamContent(calcam,  0);
     261  disp1.SetCamError(  calcam,  1);
     262  disp2.SetCamContent(calcam,  2);
     263  disp2.SetCamError(  calcam,  3);
     264 
     265  // Fit probabilities
     266  disp3.SetCamContent(calcam,  4);
     267 
     268  // Reduced Sigmas and reduced sigmas per charge
     269  disp4.SetCamContent(calcam,  5);
     270  disp4.SetCamError(  calcam,  6);
     271  disp5.SetCamContent(calcam,  7);
     272  disp5.SetCamError(  calcam,  8);
     273 
     274  // F-Factor Method
     275  disp6.SetCamContent(calcam,  9);
     276  disp6.SetCamError(  calcam, 10);
     277  disp7.SetCamContent(calcam, 11);
     278  disp7.SetCamError(  calcam, 12);
     279  disp8.SetCamContent(calcam, 13);
     280  disp8.SetCamError(  calcam, 14);
     281 
     282  // Blind Pixel Method
     283  disp9.SetCamContent(calcam, 16);
     284  disp9.SetCamError(  calcam, 17);
     285  disp10.SetCamContent(calcam,18);
     286  disp10.SetCamError(  calcam,19);
     287 
     288  // PIN Diode Method
     289  disp11.SetCamContent(calcam,21);
     290  disp11.SetCamError(  calcam,22);
     291  disp12.SetCamContent(calcam,23);
     292  disp12.SetCamError(  calcam,24);
     293 
     294  // Pixels with defects
     295  disp13.SetCamContent(calcam,26);
     296  disp14.SetCamContent(calcam,27);
     297  disp15.SetCamContent(badcam,9);
     298  disp16.SetCamContent(badcam,16);
     299  disp17.SetCamContent(badcam,15);
     300  disp18.SetCamContent(calcam,28);
     301  disp19.SetCamContent(calcam,29);
     302 
     303  // Lo Gain calibration
     304  disp20.SetCamContent(calcam,30);
     305 
     306  // Valid flags
     307  disp21.SetCamContent(calcam,15);
     308  disp22.SetCamContent(calcam,20);
     309  disp23.SetCamContent(calcam,25);
     310 
     311  // Pedestals
     312  disp24.SetCamContent(calcam,31);
     313  disp24.SetCamError(  calcam,32);
     314  disp25.SetCamContent(calcam,33);
     315  disp25.SetCamError(  calcam,34);
     316 
     317  // Relative Times
     318  disp26.SetCamContent(histtime,0);
     319  disp26.SetCamError(  histtime,1);
     320  disp27.SetCamContent(histtime,2);
     321  disp27.SetCamError(  histtime,3);
     322  disp28.SetCamContent(histtime,4);
     323  disp29.SetCamContent(histtime,5);
     324  disp30.SetCamContent(histtime,6);
     325 
     326  // Absolute Times
     327  disp31.SetCamContent(calcam,35);
     328  disp31.SetCamError(  calcam,35);
     329  disp32.SetCamContent(calcam,36);
     330 
     331  disp1.SetYTitle("Charge [FADC units]");
     332  disp2.SetYTitle("\\sigma_{Charge} [FADC units]");
     333  disp3.SetYTitle("P_{Charge} [1]");
     334 
     335  disp4.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]");
     336  disp5.SetYTitle("Reduced Sigma / Mean Charge [1]");
     337 
     338  disp6.SetYTitle("Nr. Photo-electrons [1]");
     339  disp7.SetYTitle("Conversion Factor [Ph/FADC Count]");
     340  disp8.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1] ");
     341 
     342  disp9.SetYTitle("Conversion Factor [Phot/FADC Count]");
     343  disp10.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
     344 
     345  disp11.SetYTitle("Conversion Factor [Phot/FADC Count]");
     346  disp12.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
     347 
     348  disp13.SetYTitle("[1]");
     349  disp14.SetYTitle("[1]");
     350  disp15.SetYTitle("[1]");
     351  disp16.SetYTitle("[1]");
     352  disp17.SetYTitle("[1]");
     353  disp18.SetYTitle("[1]");
     354  disp19.SetYTitle("[1]");
     355  disp20.SetYTitle("[1]");
     356  disp21.SetYTitle("[1]");
     357  disp22.SetYTitle("[1]");
     358  disp23.SetYTitle("[1]");
     359 
     360  disp24.SetYTitle("Ped [FADC Counts ]");
     361  disp25.SetYTitle("RMS_{Ped} [FADC Counts ]");
     362 
     363  disp26.SetYTitle("Time Offset [ns]");
     364  disp27.SetYTitle("Timing resolution [ns]");
     365  disp28.SetYTitle("P_{Time} [1]");
     366 
     367  disp29.SetYTitle("[1]");
     368  disp30.SetYTitle("[1]");
     369 
     370  disp31.SetYTitle("Mean Abs. Time [FADC slice]");
     371  disp32.SetYTitle("RMS Abs. Time [FADC slices]");
     372 
     373  gStyle->SetOptStat(1111);
     374  gStyle->SetOptFit();
     375
     376  // Charges
     377  TCanvas &c1 = display->AddTab("Fit.Charge");
     378  c1.Divide(2, 4);
     379 
     380  CamDraw(c1, disp1,calcam,1, 2 , 2);
     381  CamDraw(c1, disp2,calcam,2, 2 , 2);
     382 
     383  // Fit Probability
     384  TCanvas &c2 = display->AddTab("Fit.Prob");
     385  c2.Divide(1,4);
     386 
     387  CamDraw(c2, disp3,calcam,1,1,4);
     388 
     389  // Reduced Sigmas
     390  TCanvas &c3 = display->AddTab("Red.Sigma");
     391  c3.Divide(2,4);
     392 
     393  CamDraw(c3, disp4,calcam,1, 2 , 2);
     394  CamDraw(c3, disp5,calcam,2, 2 , 2);
     395
     396 
     397  // F-Factor Method
     398  TCanvas &c4 = display->AddTab("F-Factor");
     399  c4.Divide(3,4);
     400 
     401  CamDraw(c4, disp6,calcam,1, 3 , 2);
     402  CamDraw(c4, disp7,calcam,2, 3 , 2);
     403  CamDraw(c4, disp8,calcam,3, 3 , 2);
     404 
     405
     406  // Blind Pixel Method
     407  TCanvas &c5 = display->AddTab("BlindPix");
     408  c5.Divide(2, 4);
     409 
     410  CamDraw(c5, disp9 ,calcam,1,2, 2);
     411  CamDraw(c5, disp10,calcam,2,2, 2);
     412 
     413  // PIN Diode Method
     414  TCanvas &c6 = display->AddTab("PINDiode");
     415  c6.Divide(2,4);
     416 
     417  CamDraw(c6, disp11,calcam,1,2, 2);
     418  CamDraw(c6, disp12,calcam,2,2, 2);
     419 
     420  // Defects
     421  TCanvas &c7 = display->AddTab("Defects");
     422  c7.Divide(4,2);
     423 
     424  CamDraw(c7, disp13,calcam,1,4, 0);
     425  CamDraw(c7, disp14,calcam,2,4, 0);
     426  CamDraw(c7, disp18,calcam,3,4, 0);
     427  CamDraw(c7, disp19,calcam,4,4, 0);
     428 
     429  // BadCam
     430  TCanvas &c8 = display->AddTab("Defects");
     431  c8.Divide(3,2);
     432 
     433  CamDraw(c8, disp15,badcam,1,3, 0);
     434  CamDraw(c8, disp16,badcam,2,3, 0);
     435  CamDraw(c8, disp17,badcam,3,3, 0);
     436 
     437  // Valid flags
     438  TCanvas &c9 = display->AddTab("Validity");
     439  c9.Divide(4,2);
     440 
     441  CamDraw(c9, disp20,calcam,1,4,0);
     442  CamDraw(c9, disp21,calcam,2,4,0);
     443  CamDraw(c9, disp22,calcam,3,4,0);
     444  CamDraw(c9, disp23,calcam,4,4,0);
     445 
     446  // Pedestals
     447  TCanvas &c10 = display->AddTab("Pedestals");
     448  c10.Divide(2,4);
     449 
     450  CamDraw(c10,disp24,calcam,1,2,1);
     451  CamDraw(c10,disp25,calcam,2,2,2);
     452 
     453  // Rel. Times
     454  TCanvas &c11 = display->AddTab("Fitted Rel. Times");
     455  c11.Divide(3,4);
     456 
     457  CamDraw(c11,disp26,calcam,1,3,2);
     458  CamDraw(c11,disp27,calcam,2,3,2);
     459  CamDraw(c11,disp28,calcam,3,3,4);
     460 
     461  // Time Defects
     462  TCanvas &c12 = display->AddTab("Time Def.");
     463  c12.Divide(2,2);
     464 
     465  CamDraw(c12, disp29,calcam,1,2, 0);
     466  CamDraw(c12, disp30,calcam,2,2, 0);
     467 
     468  // Abs. Times
     469  TCanvas &c13 = display->AddTab("Abs. Times");
     470  c13.Divide(2,4);
     471 
     472  CamDraw(c13,disp31,calcam,1,2,2);
     473  CamDraw(c13,disp32,calcam,2,2,2);
     474
    467475}
    468476
    469 void CamDraw(TCanvas &c, MHCamera &cam, MCamEvent &evt, Int_t i, Int_t j, Int_t fit)
     477
     478void CamDraw(TCanvas &c, MHCamera &cam, TObject &evt, Int_t i, Int_t j, Int_t fit)
    470479{
     480 
     481  TArrayI s0(6);
     482  s0[0] = 1;
     483  s0[1] = 2;
     484  s0[2] = 3;
     485  s0[3] = 4;
     486  s0[4] = 5;
     487  s0[5] = 6;
     488
     489  TArrayI s1(3);
     490  s1[0] = 6;
     491  s1[1] = 1;
     492  s1[2] = 2;
     493 
     494  TArrayI s2(3);
     495  s2[0] = 3;
     496  s2[1] = 4;
     497  s2[2] = 5;
     498 
     499  TArrayI inner(1);
     500  inner[0] = 0;
     501 
     502  TArrayI outer(1);
     503  outer[0] = 1;
    471504
    472505  c.cd(i);
    473506  gPad->SetBorderMode(0);
    474   MHCamera *obj1=(MHCamera*)cam.DrawCopy("hist");
    475   //  obj1->AddNotify(evt);
    476  
     507  gPad->SetTicks();
     508  MHCamera *obj1 = (MHCamera*)cam.DrawCopy("hist");
     509  obj1->SetDirectory(NULL);
     510
    477511  c.cd(i+j);
    478   gPad->SetBorderMode(0);
     512  //  obj1->AddNotify(&evt);
     513  obj1->SetPrettyPalette();
    479514  obj1->Draw();
    480   ((MHCamera*)obj1)->SetPrettyPalette();
    481515
    482516  if (fit != 0)
    483517    {
     518
    484519      c.cd(i+2*j);
    485520      gPad->SetBorderMode(0);
    486       TH1D *obj2 = (TH1D*)obj1->Projection(obj1.GetName());
    487      
    488 //      obj2->Sumw2();
     521      gPad->SetTicks();
     522      TProfile *obj2 = obj1->RadialProfile(Form("%s%s",obj1->GetName(),"_rad"));
     523      obj2->SetDirectory(NULL);
    489524      obj2->Draw();
    490525      obj2->SetBit(kCanDelete);
    491 
    492       const Double_t min   = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
    493       const Double_t max   = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
    494       const Double_t integ = obj2->Integral("width")/2.5066283;
    495       const Double_t mean  = obj2->GetMean();
    496       const Double_t rms   = obj2->GetRMS();
     526     
     527      TProfile *hprof[2];
     528      hprof[0] = obj1->RadialProfileS(s0, inner,Form("%s%s",obj1->GetName(), "Inner"));
     529      hprof[1] = obj1->RadialProfileS(s0, outer,Form("%s%s",obj1->GetName(), "Outer"));
     530
     531     
     532      for (Int_t k=0; k<2; k++)     
     533        {
     534          Double_t min = cam.GetGeomCam().GetMinRadius(k);
     535          Double_t max = cam.GetGeomCam().GetMaxRadius(k);
     536
     537          hprof[k]->SetLineColor(kRed+k);
     538          hprof[k]->SetDirectory(0);
     539          hprof[k]->SetBit(kCanDelete);
     540          hprof[k]->Draw("same");
     541          hprof[k]->Fit("pol1","Q","",min,max);
     542          hprof[k]->GetFunction("pol1")->SetLineColor(kRed+k);
     543        }
     544     
     545      gPad->Modified();
     546      gPad->Update();
     547
     548      c.cd(i+3*j);
     549      gPad->SetBorderMode(0);
     550      gPad->SetTicks();
     551      TH1D *obj3 = (TH1D*)obj1->Projection(Form("%s%s",obj1->GetName(),"_py"));
     552      obj3->SetDirectory(NULL);
     553//      obj3->Sumw2();
     554      obj3->Draw();
     555      obj3->SetBit(kCanDelete);
     556
     557      gPad->Modified();
     558      gPad->Update();
     559
     560      const Double_t min   = obj3->GetBinCenter(obj3->GetXaxis()->GetFirst());
     561      const Double_t max   = obj3->GetBinCenter(obj3->GetXaxis()->GetLast());
     562      const Double_t integ = obj3->Integral("width")/2.5066283;
     563      const Double_t mean  = obj3->GetMean();
     564      const Double_t rms   = obj3->GetRMS();
    497565      const Double_t width = max-min;
    498566
     
    510578          sgaus->SetParLimits(1,min,max);
    511579          sgaus->SetParLimits(2,0,width/1.5);
    512           obj2->Fit("sgaus","QLR");
    513           obj2->GetFunction("sgaus")->SetLineColor(kYellow);
     580          obj3->Fit("sgaus","QLR");
     581          obj3->GetFunction("sgaus")->SetLineColor(kYellow);
    514582          break;
    515583
     
    530598          dgaus->SetParLimits(4,mean,max-(width/10.));
    531599          dgaus->SetParLimits(5,0,width/2.);
    532           obj2->Fit("dgaus","QLRM");
    533           obj2->GetFunction("dgaus")->SetLineColor(kYellow);
     600          obj3->Fit("dgaus","QLRM");
     601          obj3->GetFunction("dgaus")->SetLineColor(kYellow);
    534602          break;
    535603         
     
    558626          tgaus->SetParLimits(7,min,max);
    559627          tgaus->SetParLimits(8,width/4.,width/1.5);
    560           obj2->Fit("tgaus","QLRM");
    561           obj2->GetFunction("tgaus")->SetLineColor(kYellow);
     628          obj3->Fit("tgaus","QLRM");
     629          obj3->GetFunction("tgaus")->SetLineColor(kYellow);
    562630          break;
    563631        case 4:
    564           obj2->Fit("pol0","Q");
    565           obj2->GetFunction("pol0")->SetLineColor(kYellow);
     632          obj3->Fit("pol0","Q");
     633          obj3->GetFunction("pol0")->SetLineColor(kYellow);
    566634          break;
    567635        case 9:
    568636          break;
    569637        default:
    570           obj2->Fit("gaus","Q");
    571           obj2->GetFunction("gaus")->SetLineColor(kYellow);
     638          obj3->Fit("gaus","Q");
     639          obj3->GetFunction("gaus")->SetLineColor(kYellow);
    572640          break;
    573641        }
    574642     
    575         TArrayI s0(3);
    576         s0[0] = 6;
    577         s0[1] = 1;
    578         s0[2] = 2;
    579 
    580         TArrayI s1(3);
    581         s1[0] = 3;
    582         s1[1] = 4;
    583         s1[2] = 5;
    584 
    585         TArrayI inner(1);
    586         inner[0] = 0;
    587 
    588         TArrayI outer(1);
    589         outer[0] = 1;
     643
    590644
    591645        // Just to get the right (maximum) binning
    592646        TH1D *half[4];
    593         half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner");
    594         half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner");
    595         half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");
    596         half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");
    597 
    598         for (int i=0; i<4; i++)     
     647        half[0] = (TH1D*)obj1->ProjectionS(s1, inner, "Sector 6-1-2 Inner");
     648        half[1] = (TH1D*)obj1->ProjectionS(s2, inner, "Sector 3-4-5 Inner");
     649        half[2] = (TH1D*)obj1->ProjectionS(s1, outer, "Sector 6-1-2 Outer");
     650        half[3] = (TH1D*)obj1->ProjectionS(s2, outer, "Sector 3-4-5 Outer");
     651
     652        for (Int_t k=0; k<4; k++)     
    599653        {
    600             half[i]->SetLineColor(kRed+i);
    601             half[i]->SetDirectory(0);
    602             half[i]->SetBit(kCanDelete);
    603             half[i]->Draw("same");
     654            half[k]->SetLineColor(kRed+k);
     655            half[k]->SetDirectory(0);
     656            half[k]->SetBit(kCanDelete);
     657            half[k]->Draw("same");
    604658        }
    605659
     
    610664}
    611665
    612 
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r3511 r3551  
    6262// =============================================
    6363//
    64 // 9: Number of Photo-electrons obtained with the F-Factor method
     64//  9: Number of Photo-electrons obtained with the F-Factor method
    6565// 10: Error on Number of Photo-electrons obtained with the F-Factor method
    6666// 11: Mean conversion factor obtained with the F-Factor method
     
    6868// 13: Overall F-Factor of the readout obtained with the F-Factor method
    6969// 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
    70 // 15: Number of Photons inside Plexiglass obtained with the Blind Pixel method
    71 // 16: Error on Number of Photons inside Plexiglass obtained with the Blind Pixel method
    72 // 17: Mean conversion factor obtained with the Blind Pixel method
    73 // 18: Error on the mean conversion factor obtained with the Blind Pixel method
    74 // 19: Overall F-Factor of the readout obtained with the Blind Pixel method
    75 // 20: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
    76 // 21: Number of Photons outside Plexiglass obtained with the PIN Diode method
    77 // 22: Error on Number of Photons outside Plexiglass obtained with the PIN Diode method
    78 // 23: Mean conversion factor obtained with the PIN Diode method
    79 // 24: Error on the mean conversion factor obtained with the PIN Diode method
    80 // 25: Overall F-Factor of the readout obtained with the PIN Diode method
    81 // 26: Error on Overall F-Factor of the readout obtained with the PIN Diode method
     70// 15: Pixels with valid calibration by the F-Factor-Method
     71// 16: Mean conversion factor obtained with the Blind Pixel method
     72// 17: Error on the mean conversion factor obtained with the Blind Pixel method
     73// 18: Overall F-Factor of the readout obtained with the Blind Pixel method
     74// 19: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
     75// 20: Pixels with valid calibration by the Blind Pixel-Method
     76// 21: Mean conversion factor obtained with the PIN Diode method
     77// 22: Error on the mean conversion factor obtained with the PIN Diode method
     78// 23: Overall F-Factor of the readout obtained with the PIN Diode method
     79// 24: Error on Overall F-Factor of the readout obtained with the PIN Diode method
     80// 25: Pixels with valid calibration by the PIN Diode-Method
    8281//
    8382// Localized defects:
    8483// ==================
    8584//
    86 // 27: Excluded Pixels
    87 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms
    88 // 29: Number of probable pickup events in the Hi Gain
    89 // 30: Number of probable pickup events in the Lo Gain
     85// 26: Excluded Pixels
     86// 27: Pixels where the fit did not succeed --> results obtained only from the histograms
     87// 28: Number of probable pickup events in the Hi Gain
     88// 29: Number of probable pickup events in the Lo Gain
    9089//
    9190// Other classifications of pixels:
    9291// ================================
    9392//
    94 // 31: Pixels with saturated Hi-Gain
    95 //
    96 // Classification of validity of the calibrations:
    97 // ===============================================
    98 //
    99 // 32: Pixels with valid calibration by the F-Factor-Method
    100 // 33: Pixels with valid calibration by the Blind Pixel-Method
    101 // 34: Pixels with valid calibration by the PIN Diode-Method
     93// 30: Pixels with saturated Hi-Gain
    10294//
    10395// Used Pedestals:
    10496// ===============
    10597//
    106 // 35: Mean Pedestal over the entire range of signal extraction
    107 // 36: Error on the Mean Pedestal over the entire range of signal extraction
    108 // 37: Pedestal RMS over the entire range of signal extraction
    109 // 38: Error on the Pedestal RMS over the entire range of signal extraction
     98// 31: Mean Pedestal over the entire range of signal extraction
     99// 32: Error on the Mean Pedestal over the entire range of signal extraction
     100// 33: Pedestal RMS over the entire range of signal extraction
     101// 34: Error on the Pedestal RMS over the entire range of signal extraction
    110102//
    111103// Calculated absolute arrival times (very low precision!):
    112104// ========================================================
    113105//
    114 // 39: Absolute Arrival time of the signal
    115 // 40: RMS of the Absolute Arrival time of the signal
     106// 35: Absolute Arrival time of the signal
     107// 36: RMS of the Absolute Arrival time of the signal
    116108//
    117109/////////////////////////////////////////////////////////////////////////////
     
    422414// 8: Error of Reduced Sigma per Charge
    423415//
     416// Useful variables derived from the fit results:
     417// =============================================
     418//
     419// 4: Returned probability of Gauss fit to Charge distribution
     420// 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
     421// 6: Error Reduced Sigma of fitted Charge
     422// 7: Reduced Sigma per Charge
     423// 8: Error of Reduced Sigma per Charge
     424//
    424425// Results of the different calibration methods:
    425426// =============================================
    426427//
    427 // 9: Number of Photo-electrons obtained with the F-Factor method
     428//  9: Number of Photo-electrons obtained with the F-Factor method
    428429// 10: Error on Number of Photo-electrons obtained with the F-Factor method
    429430// 11: Mean conversion factor obtained with the F-Factor method
     
    431432// 13: Overall F-Factor of the readout obtained with the F-Factor method
    432433// 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
    433 // 15: Number of Photons inside Plexiglass obtained with the Blind Pixel method
    434 // 16: Error on Number of Photons inside Plexiglass obtained with the Blind Pixel method
    435 // 17: Mean conversion factor obtained with the Blind Pixel method
    436 // 18: Error on the mean conversion factor obtained with the Blind Pixel method
    437 // 19: Overall F-Factor of the readout obtained with the Blind Pixel method
    438 // 20: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
    439 // 21: Number of Photons outside Plexiglass obtained with the PIN Diode method
    440 // 22: Error on Number of Photons outside Plexiglass obtained with the PIN Diode method
    441 // 23: Mean conversion factor obtained with the PIN Diode method
    442 // 24: Error on the mean conversion factor obtained with the PIN Diode method
    443 // 25: Overall F-Factor of the readout obtained with the PIN Diode method
    444 // 26: Error on Overall F-Factor of the readout obtained with the PIN Diode method
     434// 15: Pixels with valid calibration by the F-Factor-Method
     435// 16: Mean conversion factor obtained with the Blind Pixel method
     436// 17: Error on the mean conversion factor obtained with the Blind Pixel method
     437// 18: Overall F-Factor of the readout obtained with the Blind Pixel method
     438// 19: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
     439// 20: Pixels with valid calibration by the Blind Pixel-Method
     440// 21: Mean conversion factor obtained with the PIN Diode method
     441// 22: Error on the mean conversion factor obtained with the PIN Diode method
     442// 23: Overall F-Factor of the readout obtained with the PIN Diode method
     443// 24: Error on Overall F-Factor of the readout obtained with the PIN Diode method
     444// 25: Pixels with valid calibration by the PIN Diode-Method
    445445//
    446446// Localized defects:
    447447// ==================
    448448//
    449 // 27: Excluded Pixels
    450 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms
    451 // 29: Number of probable pickup events in the Hi Gain
    452 // 30: Number of probable pickup events in the Lo Gain
     449// 26: Excluded Pixels
     450// 27: Pixels where the fit did not succeed --> results obtained only from the histograms
     451// 28: Number of probable pickup events in the Hi Gain
     452// 29: Number of probable pickup events in the Lo Gain
    453453//
    454454// Other classifications of pixels:
    455455// ================================
    456456//
    457 // 31: Pixels with saturated Hi-Gain
    458 //
    459 // Classification of validity of the calibrations:
    460 // ===============================================
    461 //
    462 // 32: Pixels with valid calibration by the F-Factor-Method
    463 // 33: Pixels with valid calibration by the Blind Pixel-Method
    464 // 34: Pixels with valid calibration by the PIN Diode-Method
     457// 30: Pixels with saturated Hi-Gain
    465458//
    466459// Used Pedestals:
    467460// ===============
    468461//
    469 // 35: Mean Pedestal over the entire range of signal extraction
    470 // 36: Error on the Mean Pedestal over the entire range of signal extraction
    471 // 37: Pedestal RMS over the entire range of signal extraction
    472 // 38: Error on the Pedestal RMS over the entire range of signal extraction
     462// 31: Mean Pedestal over the entire range of signal extraction
     463// 32: Error on the Mean Pedestal over the entire range of signal extraction
     464// 33: Pedestal RMS over the entire range of signal extraction
     465// 34: Error on the Pedestal RMS over the entire range of signal extraction
    473466//
    474467// Calculated absolute arrival times (very low precision!):
    475468// ========================================================
    476469//
    477 // 39: Absolute Arrival time of the signal
    478 // 40: RMS of the Absolute Arrival time of the signal
     470// 35: Absolute Arrival time of the signal
     471// 36: RMS of the Absolute Arrival time of the signal
    479472//
    480473Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
     
    592585      break;
    593586    case 15:
    594       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    595         return kFALSE;
    596       //      val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area;
    597       val = 1.;
     587      if ((*this)[idx].IsExcluded())
     588        return kFALSE;
     589      if ((*this)[idx].IsFFactorMethodValid())
     590        val = 1;
     591      else
     592        return kFALSE;
    598593      break;
    599594    case 16:
    600595      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    601596        return kFALSE;
    602       //      val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area;
    603       val = 1.;
     597      val = (*this)[idx].GetMeanConversionBlindPixelMethod();
    604598      break;
    605599    case 17:
    606600      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    607601        return kFALSE;
    608       val = (*this)[idx].GetMeanConversionBlindPixelMethod();
     602      val = (*this)[idx].GetConversionBlindPixelMethodErr();
    609603      break;
    610604    case 18:
    611605      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    612606        return kFALSE;
    613       val = (*this)[idx].GetConversionBlindPixelMethodErr();
     607      val = (*this)[idx].GetTotalFFactorBlindPixelMethod();
    614608      break;
    615609    case 19:
    616610      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    617611        return kFALSE;
    618       val = (*this)[idx].GetTotalFFactorBlindPixelMethod();
     612      val = (*this)[idx].GetTotalFFactorBlindPixelMethodErr();
    619613      break;
    620614    case 20:
    621       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    622         return kFALSE;
    623       val = (*this)[idx].GetTotalFFactorBlindPixelMethodErr();
     615      if ((*this)[idx].IsExcluded())
     616        return kFALSE;
     617      if ((*this)[idx].IsBlindPixelMethodValid())
     618        val = 1;
     619      else
     620        return kFALSE;
    624621      break;
    625622    case 21:
    626623      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    627624        return kFALSE;
    628       //      val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area;
    629       val = 1.;
     625      val = (*this)[idx].GetMeanConversionPINDiodeMethod();
    630626      break;
    631627    case 22:
    632628      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    633629        return kFALSE;
    634       //      val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area;
    635       val = 1.;
     630      val = (*this)[idx].GetConversionPINDiodeMethodErr();
    636631      break;
    637632    case 23:
    638633      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    639634        return kFALSE;
    640       val = (*this)[idx].GetMeanConversionPINDiodeMethod();
     635      val = (*this)[idx].GetTotalFFactorPINDiodeMethod();
    641636      break;
    642637    case 24:
    643638      if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    644639        return kFALSE;
    645       val = (*this)[idx].GetConversionPINDiodeMethodErr();
     640      val = (*this)[idx].GetTotalFFactorPINDiodeMethodErr();
    646641      break;
    647642    case 25:
    648       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    649         return kFALSE;
    650       val = (*this)[idx].GetTotalFFactorPINDiodeMethod();
     643      if ((*this)[idx].IsExcluded())
     644        return kFALSE;
     645      if ((*this)[idx].IsPINDiodeMethodValid())
     646        val = 1;
     647      else
     648        return kFALSE;
    651649      break;
    652650    case 26:
    653       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    654         return kFALSE;
    655       val = (*this)[idx].GetTotalFFactorPINDiodeMethodErr();
    656       break;
    657     case 27:
    658651      if ((*this)[idx].IsExcluded())
    659652        val = 1.;
     
    661654        return kFALSE;
    662655      break;
    663     case 28:
     656    case 27:
    664657      if ((*this)[idx].IsExcluded())
    665658        return kFALSE;
     
    669662        return kFALSE;
    670663      break;
     664    case 28:
     665      if ((*this)[idx].IsExcluded())
     666        return kFALSE;
     667      val = (*this)[idx].GetHiGainNumPickup();
     668      break;
    671669    case 29:
    672670      if ((*this)[idx].IsExcluded())
    673671        return kFALSE;
    674       val = (*this)[idx].GetHiGainNumPickup();
     672      val = (*this)[idx].GetLoGainNumPickup();
    675673      break;
    676674    case 30:
    677675      if ((*this)[idx].IsExcluded())
    678676        return kFALSE;
    679       val = (*this)[idx].GetLoGainNumPickup();
     677      val = (*this)[idx].IsHiGainSaturation();
    680678      break;
    681679    case 31:
    682680      if ((*this)[idx].IsExcluded())
    683681        return kFALSE;
    684       val = (*this)[idx].IsHiGainSaturation();
     682      val = (*this)[idx].GetPed();
    685683      break;
    686684    case 32:
    687685      if ((*this)[idx].IsExcluded())
    688686        return kFALSE;
    689       if ((*this)[idx].IsFFactorMethodValid())
    690         val = 1;
    691       else
    692         return kFALSE;
     687      val = (*this)[idx].GetPedErr();
    693688      break;
    694689    case 33:
    695690      if ((*this)[idx].IsExcluded())
    696691        return kFALSE;
    697       if ((*this)[idx].IsBlindPixelMethodValid())
    698         val = 1;
    699       else
    700         return kFALSE;
     692      val = (*this)[idx].GetPedRms();
    701693      break;
    702694    case 34:
    703695      if ((*this)[idx].IsExcluded())
    704696        return kFALSE;
    705       if ((*this)[idx].IsPINDiodeMethodValid())
    706         val = 1;
    707       else
    708         return kFALSE;
     697      val = (*this)[idx].GetPedErr()/2.;
    709698      break;
    710699    case 35:
    711700      if ((*this)[idx].IsExcluded())
    712701        return kFALSE;
    713       val = (*this)[idx].GetPed();
     702      val = (*this)[idx].GetAbsTimeMean();
    714703      break;
    715704    case 36:
    716       if ((*this)[idx].IsExcluded())
    717         return kFALSE;
    718       val = (*this)[idx].GetPedErr();
    719       break;
    720     case 37:
    721       if ((*this)[idx].IsExcluded())
    722         return kFALSE;
    723       val = (*this)[idx].GetPedRms();
    724       break;
    725     case 38:
    726       if ((*this)[idx].IsExcluded())
    727         return kFALSE;
    728       val = (*this)[idx].GetPedErr()/2.;
    729       break;
    730     case 39:
    731       if ((*this)[idx].IsExcluded())
    732         return kFALSE;
    733       val = (*this)[idx].GetAbsTimeMean();
    734       break;
    735     case 40:
    736705      if ((*this)[idx].IsExcluded())
    737706        return kFALSE;
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc

    r3511 r3551  
    2020!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    22 !
    2322\* ======================================================================== */
    24 
    2523/////////////////////////////////////////////////////////////////////////////
    2624//                                                                         //
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc

    r3445 r3551  
    8989const Double_t MHCalibrationChargeBlindPix::gkElectronicAmpErr   = 0.002;
    9090
    91 const Int_t    MHCalibrationChargeBlindPix::fgChargeNbins        = 1400;
    92 const Axis_t   MHCalibrationChargeBlindPix::fgChargeFirst        = -200.5;
    93 const Axis_t   MHCalibrationChargeBlindPix::fgChargeLast         = 1199.5;
     91const Int_t    MHCalibrationChargeBlindPix::fgChargeNbins        = 5300;
     92const Axis_t   MHCalibrationChargeBlindPix::fgChargeFirst        = -100.5;
     93const Axis_t   MHCalibrationChargeBlindPix::fgChargeLast         = 5199.5;
    9494
    9595const Float_t  MHCalibrationChargeBlindPix::fgSinglePheCut       = 200.;
     
    116116    SetSinglePheCut();
    117117    SetNumSinglePheLimit();
     118
     119    SetBinsAfterStripping(30);
    118120
    119121    fHGausHist.SetName("HCalibrationChargeBlindPix");
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r3496 r3551  
    6565#include <TCanvas.h>
    6666#include <TPad.h>
     67#include <TText.h>
     68#include <TPaveText.h>
    6769
    6870#include "MLog.h"
     
    151153    fNumOuterPixels = 0;
    152154    fNumExcluded    = 0;
     155
     156    fAverageInnerSat            = 0;
     157    fAverageOuterSat            = 0; 
     158    fAverageInnerPixSigma       = 0.;
     159    fAverageOuterPixSigma       = 0.; 
     160    fAverageInnerPixSigmaErr    = 0.;
     161    fAverageOuterPixSigmaErr    = 0.; 
     162    fAverageInnerPixRelSigma    = 0.;
     163    fAverageOuterPixRelSigma    = 0.; 
     164    fAverageInnerPixRelSigmaErr = 0.;
     165    fAverageOuterPixRelSigmaErr = 0.; 
     166
    153167}
    154168
     
    169183  delete fAverageHiGainOuterPix;
    170184  delete fAverageLoGainOuterPix;
     185
    171186}
    172187
     
    542557    FinalizeLoGainHists(*fAverageLoGainOuterPix,*fCam->GetAverageOuterPix(),*fCam->GetAverageOuterBadPix());
    543558
    544     fCam->GetAverageInnerPix()->SetSigmaCharge   (fCam->GetAverageInnerPix()->GetSigmaCharge() 
    545                                                   *TMath::Sqrt((Float_t)fNumInnerPixels));
    546     fCam->GetAverageOuterPix()->SetSigmaCharge   (fCam->GetAverageOuterPix()->GetSigmaCharge()   
    547                                                   *TMath::Sqrt((Float_t)fNumOuterPixels));
    548     fCam->GetAverageInnerPix()->SetSigmaChargeErr(fCam->GetAverageInnerPix()->GetSigmaChargeErr()
    549                                                   *TMath::Sqrt((Float_t)fNumInnerPixels));
    550     fCam->GetAverageOuterPix()->SetSigmaChargeErr(fCam->GetAverageOuterPix()->GetSigmaChargeErr()
    551                                                   *TMath::Sqrt((Float_t)fNumOuterPixels));
    552    
     559    FinalizeAveragePix(*fCam->GetAverageInnerPix(),fNumInnerPixels,
     560                       fAverageInnerPixSigma, fAverageInnerPixSigmaErr,
     561                       fAverageInnerPixRelSigma, fAverageInnerPixRelSigmaErr,
     562                       fAverageInnerSat);
     563    FinalizeAveragePix(*fCam->GetAverageOuterPix(),fNumOuterPixels,
     564                       fAverageOuterPixSigma, fAverageOuterPixSigmaErr,
     565                       fAverageOuterPixRelSigma, fAverageOuterPixRelSigmaErr,
     566                       fAverageOuterSat);
     567
    553568    return kTRUE;
    554569}
     
    693708      }
    694709}   
     710
     711void MHCalibrationChargeCam::FinalizeAveragePix(MCalibrationChargePix &pix, Int_t npix,
     712                                                Float_t &sigma, Float_t &sigmaerr,
     713                                                Float_t &relsigma, Float_t &relsigmaerr,
     714                                                Bool_t &b)
     715{
     716
     717  if (pix.IsHiGainSaturation())
     718    b = kTRUE;
     719
     720  sigma    = pix.GetSigmaCharge    () * TMath::Sqrt((Float_t)npix);
     721  sigmaerr = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)npix);
     722
     723  relsigma     = sigma / pix.GetMeanCharge();
     724
     725  relsigmaerr  = sigmaerr*sigmaerr / sigma / sigma;
     726  relsigmaerr += pix.GetMeanChargeErr()*pix.GetMeanChargeErr() / pix.GetMeanCharge() / pix.GetMeanCharge();
     727
     728  relsigmaerr *= relsigma;
     729  relsigmaerr  = TMath::Sqrt(relsigmaerr);
     730
     731  pix.SetSigmaCharge   (sigma);
     732  pix.SetSigmaChargeErr(sigmaerr);
     733
     734}
     735
    695736
    696737Bool_t MHCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
     
    729770  pad->cd(1);
    730771
    731   if (!fAverageHiGainInnerPix->IsEmpty())
    732     gPad->SetLogy();
    733772  fAverageHiGainInnerPix->Draw(opt);
     773 
     774  if (!fAverageInnerSat)
     775    DrawAverageSigma(fAverageInnerSat, 1,
     776                     fAverageInnerPixSigma, fAverageInnerPixSigmaErr,
     777                     fAverageInnerPixRelSigma, fAverageInnerPixRelSigmaErr);
    734778
    735779  pad->cd(2);
    736780
    737   if (!fAverageLoGainInnerPix->IsEmpty())
    738     gPad->SetLogy();
    739781  fAverageLoGainInnerPix->Draw(opt);
    740782
     783  if (fAverageInnerSat)
     784    DrawAverageSigma(fAverageInnerSat, 1,
     785                     fAverageInnerPixSigma, fAverageInnerPixSigmaErr,
     786                     fAverageInnerPixRelSigma, fAverageInnerPixRelSigmaErr);
     787
    741788  pad->cd(3);
    742789
    743   if (!fAverageHiGainOuterPix->IsEmpty())
    744     gPad->SetLogy();
    745790  fAverageHiGainOuterPix->Draw(opt);
    746791
     792  if (!fAverageOuterSat)
     793    DrawAverageSigma(fAverageOuterSat, 0,
     794                     fAverageOuterPixSigma, fAverageOuterPixSigmaErr,
     795                     fAverageOuterPixRelSigma, fAverageOuterPixRelSigmaErr);
     796
    747797  pad->cd(4);
    748798
    749   if (!fAverageLoGainOuterPix->IsEmpty())
    750     gPad->SetLogy();
    751799  fAverageLoGainOuterPix->Draw(opt);
    752800
    753 }
     801  if (fAverageOuterSat)
     802    DrawAverageSigma(fAverageOuterSat, 0,
     803                     fAverageOuterPixSigma, fAverageOuterPixSigmaErr,
     804                     fAverageOuterPixRelSigma, fAverageOuterPixRelSigmaErr);
     805}
     806
     807void MHCalibrationChargeCam::DrawAverageSigma(Bool_t sat, Bool_t inner,
     808                                              Float_t sigma, Float_t sigmaerr,
     809                                              Float_t relsigma, Float_t relsigmaerr) const
     810{
     811 
     812  if (sigma != 0)
     813    {
     814     
     815      TPad *newpad = new TPad("newpad","transparent",0,0,1,1);
     816      newpad->SetFillStyle(4000);
     817      newpad->Draw();
     818      newpad->cd();
     819     
     820      TPaveText *text = new TPaveText(sat? 0.1 : 0.35,0.7,sat ? 0.4 : 0.7,1.0);
     821      text->SetTextSize(0.07);
     822      const TString line1 = Form("%s%s%s",inner ? "Inner" : "Outer",
     823                                 " Pixels ", sat ? "Low Gain" : "High Gain");
     824      TText *txt1 = text->AddText(line1.Data());
     825      const TString line2 = Form("Sigma per Pixel: %2.2f #pm %2.2f",sigma,sigmaerr);
     826      TText *txt2 = text->AddText(line2.Data());
     827      const TString line3 = Form("Rel. Sigma per Pixel: %2.2f #pm %2.2f",relsigma,relsigmaerr);
     828      TText *txt3 = text->AddText(line3.Data());
     829      text->Draw("");
     830     
     831      text->SetBit(kCanDelete);
     832      txt1->SetBit(kCanDelete);
     833      txt2->SetBit(kCanDelete);
     834      txt3->SetBit(kCanDelete);
     835      newpad->SetBit(kCanDelete);
     836    }
     837}
     838
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h

    r3429 r3551  
    1313#endif
    1414
     15class TText;
    1516class MRawEvtData;
    1617class MGeomCam;
     
    4748  Int_t fNumExcluded;
    4849
     50  Bool_t  fAverageInnerSat;
     51  Bool_t  fAverageOuterSat; 
     52 
     53  Float_t fAverageInnerPixSigma;
     54  Float_t fAverageOuterPixSigma; 
     55 
     56  Float_t fAverageInnerPixSigmaErr;
     57  Float_t fAverageOuterPixSigmaErr; 
     58
     59  Float_t fAverageInnerPixRelSigma;
     60  Float_t fAverageOuterPixRelSigma; 
     61 
     62  Float_t fAverageInnerPixRelSigmaErr;
     63  Float_t fAverageOuterPixRelSigmaErr; 
     64
    4965  void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
    5066  void FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
    51 
     67  void FinalizeAveragePix (MCalibrationChargePix &pix, Int_t npix,
     68                           Float_t &sigma, Float_t &sigmaerr,
     69                           Float_t &relsigma, Float_t &relsigmaerr,
     70                           Bool_t &b);
     71  void DrawAverageSigma(Bool_t sat, Bool_t inner,
     72                        Float_t sigma, Float_t sigmaerr,
     73                        Float_t relsigma, Float_t relsigmaerr) const;
     74 
    5275public:
    5376
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc

    r3428 r3551  
    211211  gPad->SetTicks();
    212212
     213  fHGausHist.GetXaxis()->SetLabelSize(0.06);
     214  fHGausHist.GetYaxis()->SetLabelSize(0.07);
     215  fHGausHist.GetXaxis()->SetLabelOffset(0.01);
     216  fHGausHist.GetYaxis()->SetLabelOffset(0.01);
     217  fHGausHist.GetXaxis()->SetTitleSize(0.065);
     218  fHGausHist.GetYaxis()->SetTitleSize(0.07);
     219  fHGausHist.GetXaxis()->SetTitleOffset(0.6);
     220  fHGausHist.GetYaxis()->SetTitleOffset(0.6);
    213221  fHGausHist.Draw(opt);
    214222  if (fFGausFit)
     
    220228  pad->cd(2);
    221229  gPad->SetTicks();
     230
     231  fHAbsTime.GetXaxis()->SetLabelSize(0.06);
     232  fHAbsTime.GetYaxis()->SetLabelSize(0.07);
     233  fHAbsTime.GetXaxis()->SetLabelOffset(0.01);
     234  fHAbsTime.GetYaxis()->SetLabelOffset(0.01);
     235  fHAbsTime.GetXaxis()->SetTitleSize(0.065);
     236  fHAbsTime.GetYaxis()->SetTitleSize(0.07);
     237  fHAbsTime.GetXaxis()->SetTitleOffset(0.6);
     238  fHAbsTime.GetYaxis()->SetTitleOffset(0.6);
    222239  fHAbsTime.Draw(opt);
    223240
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r3528 r3551  
    594594TProfile *MHCamera::RadialProfileS(const TArrayI &sector, const TArrayI &aidx, const char *name, const Int_t nbins) const
    595595{
    596 
    597     // Create the projection histogram
    598     TString pname(name);
    599     if (name=="_rad")
    600     {
    601         pname.Prepend(GetName());
    602         if (sector.GetSize()>0)
     596 
     597  // Create the projection histogram
     598  TString pname(name);
     599  if (name=="_rad")
     600    {
     601      pname.Prepend(GetName());
     602      if (sector.GetSize()>0)
    603603        {
    604             pname += ";";
    605             for (int i=0; i<sector.GetSize(); i++)
    606                 pname += sector[i];
     604          pname += ";";
     605          for (int i=0; i<sector.GetSize(); i++)
     606            pname += sector[i];
    607607        }
    608         if (aidx.GetSize()>0)
     608      if (aidx.GetSize()>0)
    609609        {
    610             pname += ";";
    611             for (int i=0; i<aidx.GetSize(); i++)
    612                 pname += aidx[i];
     610          pname += ";";
     611          for (int i=0; i<aidx.GetSize(); i++)
     612            pname += aidx[i];
    613613        }
    614614    }
    615 
    616     TProfile *h1=0;
    617 
    618     //check if histogram with identical name exist
    619     TObject *h1obj = gROOT->FindObject(pname);
    620     if (h1obj && h1obj->InheritsFrom("TProfile")) {
    621         h1 = (TProfile*)h1obj;
    622         h1->Reset();
    623     }
    624 
    625     if (!h1)
    626     {
    627 
     615 
     616  TProfile *h1=0;
     617 
     618  //check if histogram with identical name exist
     619  TObject *h1obj = gROOT->FindObject(pname);
     620  if (h1obj && h1obj->InheritsFrom("TProfile")) {
     621    h1 = (TProfile*)h1obj;
     622    h1->Reset();
     623  }
     624 
     625  if (!h1)
     626    {
     627     
    628628      Double_t min = 0.;
    629629      Double_t max = fGeomCam->GetMaxRadius();
     
    638638      h1->SetYTitle(GetYaxis()->GetTitle());
    639639    }
    640    
    641     // Fill the projected histogram
    642     for (Int_t idx=0; idx<fNcells-2; idx++)
    643       if (IsUsed(idx) && MatchSector(idx, sector, aidx))
    644         h1->Fill(TMath::Hypot((*fGeomCam)[idx].GetX(),(*fGeomCam)[idx].GetY()),
    645                  GetBinContent(idx+1));
    646     return h1;
     640 
     641  // Fill the projected histogram
     642  for (Int_t idx=0; idx<fNcells-2; idx++)
     643    if (IsUsed(idx) && MatchSector(idx, sector, aidx))
     644      h1->Fill(TMath::Hypot((*fGeomCam)[idx].GetX(),(*fGeomCam)[idx].GetY()),
     645               GetBinContent(idx+1));
     646  return h1;
    647647}
    648648
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r3528 r3551  
    236236
    237237    TProfile *RadialProfile(const char *name="_rad") const { return  RadialProfileS(TArrayI(), TArrayI(), name);}
    238     TProfile *RadialProfileS(Int_t sector, Int_t aidx, const char *name="_rad", const Int_t nbins=20) const
     238    TProfile *RadialProfileS(Int_t sector, Int_t aidx, const char *name="_rad", const Int_t nbins=25) const
    239239    {
    240240        return RadialProfileS(TArrayI(1, &sector), TArrayI(1, &aidx), name, nbins);
    241241    }
    242     TProfile *RadialProfileS(const TArrayI &sector, const TArrayI &aidx, const char *name="_rad", const Int_t nbins=20) const;
     242    TProfile *RadialProfileS(const TArrayI &sector, const TArrayI &aidx, const char *name="_rad", const Int_t nbins=25) const;
    243243   
    244244    const MGeomCam &GetGeomCam() const { return *fGeomCam; }
Note: See TracChangeset for help on using the changeset viewer.