Changeset 3737 for trunk


Ignore:
Timestamp:
04/14/04 17:23:58 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3735 r3737  
    5757     - included calibration of rel.Times, to be chosen with a flag
    5858       RelTimeCalibration()
     59     - signal extractor and arrival time extractor can be chosen by
     60       flags as well (see Class description)
     61
    5962
    6063   * mbadpixels/MBadPixelsCam.cc
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r3730 r3737  
    3838//End_Html
    3939//
     40// Different signal extractors can be chosen via the command SetExtractorLevel(UInt_t i)
     41// Up to now, the following extractors are available:
     42// i=1: Use MExtractSignal  (fixed window)
     43// i=2: Use MExtractSignal2 (sliding window: default)
     44// i=3: Use MExtractSignal3 (coherent sliding window for all pixels)
     45//
    4046// At the end of the eventloop, plots and results are displayed, depending on
    4147// the flags set (see DisplayResult())
     
    6268*/
    6369//End_Html
     70//
     71// Different arrival time extractors can be chosen via the command SetArrivalTimeLevel(UInt_t i)
     72// Up to now, the following extractors are available:
     73// i=1: Use MArrivalTimeCalc  (using MCubicSpline, arrival time == position at half maximum)
     74// i=2: Use MArrivalTimeCalc2 (mean time of fWindowSize time slices with the highest integral content: default)
    6475//
    6576/////////////////////////////////////////////////////////////////////////////
     
    91102#include "MCalibrationChargeBlindPix.h"
    92103#include "MCalibrationChargeCalc.h"
     104
     105#include "MHGausEvents.h"
     106#include "MHCalibrationCam.h"
     107#include "MHCalibrationChargeCam.h"
     108#include "MHCalibrationRelTimeCam.h"
     109#include "MCalibrationRelTimeCam.h"
    93110
    94111#include "MReadMarsFile.h"
     
    100117#include "MExtractBlindPixel.h"
    101118#include "MExtractSignal2.h"
     119#include "MExtractSignal3.h"
    102120#include "MFCosmics.h"
    103121#include "MContinue.h"
    104122#include "MFillH.h"
    105123
     124#include "MArrivalTimeCam.h"
     125#include "MArrivalTimeCalc.h"
     126#include "MArrivalTimeCalc2.h"
     127
    106128#include "MJCalibration.h"
    107129#include "MStatusDisplay.h"
     
    115137// Default constructor.
    116138//
    117 // Sets fRuns to 0, fColor to kNONE, fDisplay to kNormalDisplay
     139// Sets fRuns to 0, fColor to kNONE, fDisplay to kNormalDisplay,
     140// fRelTime to kFALSE, fExtractorLevel to 2, fArrivalTimeLevel to 2
    118141//
    119142MJCalibration::MJCalibration(const char *name, const char *title)
    120     : fRuns(0), fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay)
     143    : fRuns(0), fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay),
     144      fRelTimes(kFALSE), fExtractorLevel(2), fArrivalTimeLevel(2)
    121145{
    122146  fName  = name  ? name  : "MJCalibration";
     
    265289    MHCamera disp28(geomcam, "Cal;AbsTimeMean",       "Abs. Arrival Times");
    266290    MHCamera disp29(geomcam, "Cal;AbsTimeRms",        "RMS of Arrival Times");
    267 
     291    MHCamera disp30(geomcam, "time;MeanTime",         "Mean Rel. Arrival Times");
     292    MHCamera disp31(geomcam, "time;SigmaTime",        "Sigma Rel. Arrival Times");
     293    MHCamera disp32(geomcam, "time;TimeProb",         "Probability of Time Fit");
     294    MHCamera disp33(geomcam, "time;NotFitValid",      "Pixels with not valid fit results");
     295    MHCamera disp34(geomcam, "time;Oscillating",      "Oscillating Pixels");
     296
     297
     298   
    268299    // Fitted charge means and sigmas
    269300    disp1.SetCamContent(fCalibrationCam,  0);
     
    366397    disp29.SetYTitle("RMS Abs. Time [FADC slices]");
    367398
     399    if (fRelTimes)
     400      {
     401
     402        disp30.SetCamContent(fRelTimeCam,0);
     403        disp30.SetCamError(  fRelTimeCam,1);
     404        disp31.SetCamContent(fRelTimeCam,2);
     405        disp31.SetCamError(  fRelTimeCam,3);
     406        disp32.SetCamContent(fRelTimeCam,4);
     407        disp33.SetCamContent(fBadPixels,20);
     408        disp34.SetCamContent(fBadPixels,21);
     409   
     410        disp30.SetYTitle("Time Offset [ns]");
     411        disp31.SetYTitle("Timing resolution [ns]");
     412        disp32.SetYTitle("P_{Time} [1]");
     413        disp33.SetYTitle("[1]");
     414        disp34.SetYTitle("[1]");
     415      }
     416   
    368417    gStyle->SetOptStat(1111);
    369418    gStyle->SetOptFit();
     
    401450        CamDraw(c4, 2, 3, disp24, 0);
    402451        CamDraw(c4, 3, 3, disp25, 0);
     452
     453        if (fRelTimes)
     454          {
     455            // Rel. Times
     456            TCanvas &c5 = fDisplay->AddTab("Rel. Times");
     457            c5.Divide(2,4);
     458           
     459            CamDraw(c5, 1, 2, disp30, 2);
     460            CamDraw(c5, 2, 2, disp31, 2);
     461          }
     462
    403463
    404464        return;
     
    456516        CamDraw(c16, 2, 2, disp29, 1);
    457517
     518        if (fRelTimes)
     519          {
     520            // Rel. Times
     521            TCanvas &c17 = fDisplay->AddTab("Rel. Times");
     522            c17.Divide(2,4);
     523           
     524            CamDraw(c17, 1, 2, disp30, 2, 1);
     525            CamDraw(c17, 2, 2, disp31, 2, 1);
     526          }
     527       
    458528        return;
    459529      }
     
    462532      {
    463533
     534        MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam");
     535
     536        for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++)
     537          {
     538            cam->GetAverageHiGainArea(aidx).DrawClone("all");
     539            cam->GetAverageLoGainArea(aidx).DrawClone("all");
     540          }
     541       
     542        for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
     543          {
     544            cam->GetAverageHiGainSector(sector).DrawClone("all");
     545            cam->GetAverageLoGainSector(sector).DrawClone("all");
     546          }
     547
    464548        // Charges
    465549        TCanvas &c21 = fDisplay->AddTab("Fit.Charge");
     
    535619        CamDraw(c30, 1, 2, disp28, 2);
    536620        CamDraw(c30, 2, 2, disp29, 1);
     621
     622        if (fRelTimes)
     623          {
     624            // Rel. Times
     625            TCanvas &c31 = fDisplay->AddTab("Rel. Times");
     626            c31.Divide(3,4);
     627           
     628            CamDraw(c31, 1, 3, disp30, 2, 1);
     629            CamDraw(c31, 2, 3, disp31, 2, 1);
     630            CamDraw(c31, 3, 3, disp32, 4, 1);
     631
     632            // Time Defects
     633            TCanvas &c32 = fDisplay->AddTab("Time Def.");
     634            c32.Divide(2,2);
     635           
     636            CamDraw(c32, 1, 2, disp33,0);
     637            CamDraw(c32, 2, 2, disp34,0);
     638
     639            MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam");
     640           
     641            for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++)
     642              {
     643                cam->GetAverageHiGainArea(aidx).DrawClone("all");
     644                cam->GetAverageLoGainArea(aidx).DrawClone("all");
     645              }
     646           
     647            for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
     648              {
     649                cam->GetAverageHiGainSector(sector).DrawClone("all");
     650                cam->GetAverageLoGainSector(sector).DrawClone("all");
     651              }
     652           
     653          }
    537654
    538655        return;
     
    772889//   2) MCalibrationQECam     (fQECam)
    773890//   3) MCalibrationChargeCam (fCalibrationCam)
    774 //   4) MBadPixelsCam         (fBadPixels)
    775 //   5) MCalibrationChargePINDiode
    776 //   6) MCalibrationChargeBlindPix
     891//   4) MCalibrationRelTimeCam (fRelTimeCam)   (only if flag fRelTimes is chosen)
     892//   5) MBadPixelsCam         (fBadPixels)
     893//   6) MCalibrationChargePINDiode
     894//   7) MCalibrationChargeBlindPix
    777895// - Put into the MTaskList:
    778896//   1)  MReadMarsFile
    779897//   2)  MBadPixelsMerge
    780898//   3)  MGeomApply
    781 //   4)  MExtractSignal2
     899//   4)  MExtractSignal, MExtractSignal2 or MExtractSignal3, depending on fExtractorLevel
    782900//   5)  MExtractPINDiode
    783901//   6)  MExtractBlindPixel
    784 //   7)  MContinue(MFCosmics)
    785 //   8)  MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode")
    786 //   9)  MFillH("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel")
    787 //   10) MFillH("MHCalibrationChargeCam",      "MExtractedSignalCam")
    788 //   11) MCalibrationChargeCalc
     902//   7)  MArrivalTimeCalc, MArrivalTimeCalc2, depending on fArrivalTimeLevel (only if flag fRelTimes is chosen)
     903//   8)  MContinue(MFCosmics)
     904//   9)  MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode")
     905//   10) MFillH("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel")
     906//   11) MFillH("MHCalibrationChargeCam",      "MExtractedSignalCam")
     907//   12) MFillH("MHCalibrationChargeCam",      "MExtractedSignalCam")
     908//   13) MCalibrationChargeCalc
     909//   14) MFillH("MHCalibrationRelTimeCam",     "MArrivalTimeCam") (only if flag fRelTimes is chosen)
    789910// - Execute MEvtLoop
    790911// - DisplayResult()
     
    793914Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam)
    794915{
    795     if (!fRuns)
    796     {
    797         *fLog << err << "No Runs choosen... abort." << endl;
    798         return kFALSE;
    799     }
    800 
    801     if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
    802     {
    803         *fLog << err << "Number of files found doesn't match number of runs... abort." << endl;
    804         return kFALSE;
    805     }
    806 
    807     *fLog << inf;
    808     fLog->Separator(GetDescriptor());
    809     *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl;
    810     *fLog << endl;
    811 
    812     MReadMarsFile read("Events");
    813     read.DisableAutoScheme();
    814     static_cast<MRead&>(read).AddFiles(*fRuns);
    815 
    816     //
    817     // As long, as we don't have digital modules,
    818     // we have to set the color of the pulser LED by hand
    819     //
    820     MCalibrationChargePINDiode pindiode;
    821     MCalibrationChargeBlindPix blindpix;
    822 
    823     // Setup Tasklist
    824     MParList plist;
    825     plist.AddToList(&pedcam);
    826     plist.AddToList(&fBadPixels);
    827     plist.AddToList(&fQECam);
    828     plist.AddToList(&fCalibrationCam);
    829     plist.AddToList(&pindiode);
    830     plist.AddToList(&blindpix);
    831 
    832     MTaskList tlist;
    833     plist.AddToList(&tlist);
    834 
    835     MGeomApply               apply;
    836     //    MBadPixelsMerge          merge(&fBadPixels);
    837     MExtractPINDiode         pinext;
    838     MExtractBlindPixel       blindext;
    839     // MExtractSignal   extract; // Do not use this at the moment...
    840     MExtractSignal2          extract;
    841     MCalibrationChargeCalc   calcalc;
    842 
    843     //
    844     // As long as there are no DM's, have to colour by hand
    845     //
    846     calcalc.SetPulserColor(fColor);
    847 
    848     MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
    849     MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
    850     MFillH fillcam("MHCalibrationChargeCam",      "MExtractedSignalCam");
    851     fillpin.SetNameTab("PINDiode");
    852     fillbnd.SetNameTab("BlindPix");
    853     fillcam.SetNameTab("Charge");
    854 
    855     //
    856     // Apply a filter against cosmics
    857     // (will have to be needed in the future
    858     // when the calibration hardware-trigger is working)
    859     //
    860     MFCosmics cosmics;
    861     MContinue cont(&cosmics);
    862 
    863     tlist.AddToList(&read);
    864     //    tlist.AddToList(&merge);
    865     tlist.AddToList(&apply);
    866     tlist.AddToList(&extract);
    867     tlist.AddToList(&pinext); 
    868     tlist.AddToList(&blindext);
    869     tlist.AddToList(&cont);
    870     tlist.AddToList(&fillcam);
    871     tlist.AddToList(&fillpin);
    872     tlist.AddToList(&fillbnd);
    873     tlist.AddToList(&calcalc);
    874 
    875     // Create and setup the eventloop
    876     MEvtLoop evtloop(fName);
    877     evtloop.SetParList(&plist);
    878     evtloop.SetDisplay(fDisplay);
    879     evtloop.SetLogStream(fLog);
    880 
    881     // Execute first analysis
    882     if (!evtloop.Eventloop())
    883     {
    884         *fLog << err << GetDescriptor() << ": Failed." << endl;
    885         return kFALSE;
    886     }
    887 
    888     tlist.PrintStatistics();
    889 
    890     DisplayResult(plist);
    891 
    892     if (!WriteResult())
    893         return kFALSE;
    894 
    895     *fLog << inf << GetDescriptor() << ": Done." << endl;
    896 
    897     return kTRUE;
     916  if (!fRuns)
     917    {
     918      *fLog << err << "No Runs choosen... abort." << endl;
     919      return kFALSE;
     920    }
     921 
     922  if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
     923    {
     924      *fLog << err << "Number of files found doesn't match number of runs... abort." << endl;
     925      return kFALSE;
     926    }
     927 
     928  *fLog << inf;
     929  fLog->Separator(GetDescriptor());
     930  *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl;
     931  *fLog << endl;
     932 
     933  MReadMarsFile read("Events");
     934  read.DisableAutoScheme();
     935  static_cast<MRead&>(read).AddFiles(*fRuns);
     936 
     937  MCalibrationChargePINDiode pindiode;
     938  MCalibrationChargeBlindPix blindpix;
     939 
     940  // Setup Tasklist
     941  MParList plist;
     942  plist.AddToList(&pedcam);
     943  plist.AddToList(&fBadPixels);
     944  plist.AddToList(&fQECam);
     945  plist.AddToList(&fCalibrationCam);
     946  plist.AddToList(&pindiode);
     947  plist.AddToList(&blindpix);
     948
     949  MTaskList tlist;
     950  plist.AddToList(&tlist);
     951 
     952  MGeomApply               apply;
     953  //    MBadPixelsMerge          merge(&fBadPixels);
     954  MExtractPINDiode         pinext;
     955  MExtractBlindPixel       blindext;
     956  MExtractSignal           extract1;
     957  MExtractSignal2          extract2;
     958  MExtractSignal3          extract3;
     959  MArrivalTimeCalc         tmecalc1;
     960  MArrivalTimeCalc2        tmecalc2;
     961  MCalibrationChargeCalc   calcalc;
     962 
     963  //
     964  // As long as there are no DM's, have to colour by hand
     965  //
     966  calcalc.SetPulserColor(fColor);
     967 
     968  MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
     969  MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
     970  MFillH fillcam("MHCalibrationChargeCam",      "MExtractedSignalCam");
     971  MFillH filltme("MHCalibrationRelTimeCam",     "MArrivalTimeCam");
     972  fillpin.SetNameTab("PINDiode");
     973  fillbnd.SetNameTab("BlindPix");
     974  fillcam.SetNameTab("Charge");
     975  filltme.SetNameTab("RelTimes");
     976 
     977 
     978  //
     979  // Apply a filter against cosmics
     980  // (will have to be needed in the future
     981  // when the calibration hardware-trigger is working)
     982  //
     983  MFCosmics cosmics;
     984  MContinue cont(&cosmics);
     985 
     986  tlist.AddToList(&read);
     987  //    tlist.AddToList(&merge);
     988  tlist.AddToList(&apply);
     989
     990  if (fExtractorLevel <= 1)
     991    tlist.AddToList(&extract1);
     992  else if (fExtractorLevel == 2)
     993    tlist.AddToList(&extract2);
     994  else if (fExtractorLevel == 3)
     995    tlist.AddToList(&extract3);
     996  else
     997    {
     998      *fLog << err << GetDescriptor()
     999            << ": No valid Signal extractor has been chosen, have only: " << fExtractorLevel
     1000            << " aborting..." << endl;
     1001      return kFALSE;
     1002    }
     1003 
     1004
     1005  tlist.AddToList(&pinext); 
     1006  tlist.AddToList(&blindext);
     1007 
     1008  if (fRelTimes)
     1009    {
     1010      plist.AddToList(&fRelTimeCam);
     1011      if (fArrivalTimeLevel <= 1)
     1012        tlist.AddToList(&tmecalc1);
     1013      else if (fArrivalTimeLevel == 2)
     1014        tlist.AddToList(&tmecalc2);
     1015      else
     1016        {
     1017          *fLog << err << GetDescriptor()
     1018                << ": No valid Signal ArrivalTime Level has been chosen, have only: " << fArrivalTimeLevel
     1019                << " aborting..." << endl;
     1020          return kFALSE;
     1021        }
     1022    }
     1023
     1024  tlist.AddToList(&cont);
     1025  tlist.AddToList(&fillcam);
     1026  tlist.AddToList(&fillpin);
     1027  tlist.AddToList(&fillbnd);
     1028  tlist.AddToList(&calcalc);
     1029
     1030  if (fRelTimes)
     1031    tlist.AddToList(&filltme);
     1032 
     1033  // Create and setup the eventloop
     1034  MEvtLoop evtloop(fName);
     1035  evtloop.SetParList(&plist);
     1036  evtloop.SetDisplay(fDisplay);
     1037  evtloop.SetLogStream(fLog);
     1038 
     1039  // Execute first analysis
     1040  if (!evtloop.Eventloop())
     1041    {
     1042      *fLog << err << GetDescriptor() << ": Failed." << endl;
     1043      return kFALSE;
     1044    }
     1045 
     1046  tlist.PrintStatistics();
     1047 
     1048  DisplayResult(plist);
     1049 
     1050  if (!WriteResult())
     1051    return kFALSE;
     1052 
     1053  *fLog << inf << GetDescriptor() << ": Done." << endl;
     1054 
     1055  return kTRUE;
    8981056}
    8991057
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r3726 r3737  
    44#ifndef MARS_MCalibrationChargeCam
    55#include "MCalibrationChargeCam.h"
     6#endif
     7#ifndef MARS_MCalibrationRelTimeCam
     8#include "MCalibrationRelTimeCam.h"
    69#endif
    710#ifndef MARS_MCalibrationQECam
     
    2629  MRunIter *fRuns;                                         // Calibration files
    2730 
    28   MCalibrationChargeCam fCalibrationCam;                   // Calibration conversion factors FADC2Phe
    29   MCalibrationQECam     fQECam;                            // Quantum efficiency, can be set from previous runs
    30   MBadPixelsCam         fBadPixels;                        // Bad Pixels cam, can be set from previous runs
     31  MBadPixelsCam          fBadPixels;                       // Bad Pixels cam, can be set from previous runs
     32  MCalibrationChargeCam  fCalibrationCam;                  // Calibration conversion factors FADC2Phe
     33  MCalibrationQECam      fQECam;                           // Quantum efficiency, can be set from previous runs
     34  MCalibrationRelTimeCam fRelTimeCam;                      // Calibration constants rel. times
    3135
    3236  MCalibrationCam::PulserColor_t fColor;                   // Colour of the pulsed LEDs
    3337
    34   enum  Display_t { kFullDisplay, kDataCheck, kNormalDisplay }; // Possible Display types
     38  enum  Display_t   { kFullDisplay, kDataCheck, kNormalDisplay }; // Possible Display types
     39 
    3540  Display_t fDisplayType;                                  // Chosen Display type
     41
     42  Bool_t fRelTimes;                                        // Flag if relative times have to be calibrated
     43  UInt_t fExtractorLevel;                                  // Level signal extractor (e.g. MExtractSignal2)
     44  UInt_t fArrivalTimeLevel;                                // Level arr. time extractor (e.g. MArrivalTimeCalc2)
    3645 
    3746  void DrawProjection   ( MHCamera *obj, Int_t fit) const; // Draw projection of pixels values
     
    4251  void   DisplayResult(MParList &plist);
    4352  Bool_t WriteResult();
    44  
     53
    4554public:
    4655
     
    5160 
    5261  TString GetOutputFile() const;
    53  
    54   MCalibrationChargeCam &GetCalibrationCam()     { return fCalibrationCam; }
    55   MCalibrationQECam     &GetQECam()              { return fQECam;          }   
    56   const MBadPixelsCam   &GetBadPixels() const    { return fBadPixels;      }
     62
     63  MCalibrationChargeCam  &GetCalibrationCam()     { return fCalibrationCam; } 
     64  MCalibrationRelTimeCam &GetRelTimeCam()         { return fRelTimeCam;     }
     65  MCalibrationQECam      &GetQECam()              { return fQECam;          }   
     66  const MBadPixelsCam    &GetBadPixels() const    { return fBadPixels;      }
    5767 
    5868  void SetBadPixels(const MBadPixelsCam &bad)    { bad.Copy(fBadPixels);   }
    5969  void SetQECam    (const MCalibrationQECam &qe) { qe.Copy(fQECam);        }   
    60   void SetColor    (const MCalibrationCam::PulserColor_t color) { fColor = color;   }
     70  void SetColor    (const MCalibrationCam::PulserColor_t color) { fColor = color; }
    6171
    6272  // Displays
    63   void SetFullDisplay()  { fDisplayType = kFullDisplay;  }
    64   void SetDataCheck()  { fDisplayType = kDataCheck;  }
    65   void SetNormalDisplay()  { fDisplayType = kNormalDisplay;  }
     73  void SetFullDisplay()    { fDisplayType = kFullDisplay;   }
     74  void SetDataCheck()      { fDisplayType = kDataCheck;     }
     75  void SetNormalDisplay()  { fDisplayType = kNormalDisplay; }
     76
     77  // Rel. Time
     78  void SetRelTimeCalibration(const Bool_t b=kTRUE) { fRelTimes         = b; }
     79
     80  // Extractors
     81  void SetExtractorLevel    (const UInt_t i=1    ) { fExtractorLevel   = i; }
     82  void SetArrivalTimeLevel  (const UInt_t i=1    ) { fArrivalTimeLevel = i; } 
     83     
    6684 
    6785  Bool_t ReadCalibrationCam();
Note: See TracChangeset for help on using the changeset viewer.