Changeset 4164 for trunk/MagicSoft


Ignore:
Timestamp:
05/25/04 10:52:15 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4163 r4164  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2004/05/25: Markus Gaug
     22
     23   * mjobs/MJCalibration.[h,cc]
     24     - add possibility to switch on and off the blind pixel or pin diode
     25       calibration
    2026
    2127 2004/05/24: Javier Rico
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r4159 r4164  
    223223using namespace std;
    224224
    225 const Float_t MCalibrationChargeCalc::fgChargeLimit            = 3.;
     225const Float_t MCalibrationChargeCalc::fgChargeLimit            = 2.5
    226226const Float_t MCalibrationChargeCalc::fgChargeErrLimit         = 0.;
    227227const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit      = 1.;
     
    421421  fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindObject("MCalibrationChargeBlindPix");
    422422  if (!fBlindPixel)
    423     *fLog << warn << GetDescriptor()
    424           << ": MCalibrationChargeBlindPix not found... no blind pixel method! " << endl;
     423    {
     424      *fLog << endl;
     425      *fLog << warn << GetDescriptor()
     426            << ": MCalibrationChargeBlindPix not found... no Blind Pixel method! " << endl;
     427    }
    425428 
    426429  fPINDiode = (MCalibrationChargePINDiode*)pList->FindObject("MCalibrationChargePINDiode");
    427430  if (!fPINDiode)
    428     *fLog << warn << GetDescriptor()
    429           << "MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
     431    {
     432      *fLog << endl;
     433      *fLog << warn << GetDescriptor()
     434            << ": MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
     435    }
    430436 
    431437
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r4134 r4164  
    5252//
    5353// If the flag SetDataCheck() is set, the calibration is used as in the data check at
    54 // La Palma, which mean especially running it on raw data files.
     54// La Palma, which mean especially running on raw data files.
    5555//
     56// The absolute light calibration devices Blind Pixel and PIN Diode can be switched on
     57// and off with the commands:
     58//
     59// - SetUseBlindPixel(Bool_t )
     60// - SetUsePINDiode(Bool_t )
     61//
    5662// See also: MHCalibrationChargePix, MHCalibrationChargeCam, MHGausEvents
    5763//           MHCalibrationChargeBlindPix, MHCalibrationChargePINDiode
     
    7278//End_Html
    7379//
    74 // Different arrival time extractors can be chosen via the command SetArrivalTimeLevel(UInt_t i)
    75 // Up to now, the following extractors are available:
    76 // i=1: Use MArrivalTimeCalc  (using MCubicSpline, arrival time == position at half maximum)
    77 // i=2: Use MArrivalTimeCalc2 (mean time of fWindowSize time slices with the highest integral content: default)
     80// Different arrival time extractors can be set directly with the command SetTimeExtractor(MExtractor *)
    7881//
    7982// See also: MHCalibrationRelTimePix, MHCalibrationRelTimeCam, MHGausEvents
     
    144147// Default constructor.
    145148//
    146 // Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE,
    147 // fDisplay to kNormalDisplay, fRelTime to kFALSE, fDataCheck to kFALSE
     149// - Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE,
     150//   fDisplay to kNormalDisplay, fRelTime to kFALSE, fDataCheck to kFALSE,
     151// - SetUseBlindPixel()
     152// - SetUsePINDiode()
    148153//
    149154MJCalibration::MJCalibration(const char *name, const char *title)
     
    152157      fRelTimes(kFALSE), fDataCheck(kFALSE)
    153158{
     159
    154160  fName  = name  ? name  : "MJCalibration";
    155161  fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
     162
     163  SetUseBlindPixel();
     164  SetUsePINDiode();
    156165
    157166}
     
    728737          }
    729738
     739      if (filenames.Contains("_26568_"))
     740        if (fColor == MCalibrationCam::kNONE)
     741          {
     742            *fLog << "Found colour: kGREEN  in " << filenames << endl;
     743            fColor = MCalibrationCam::kGREEN;
     744          }
     745        else if (fColor != MCalibrationCam::kGREEN)
     746          {
     747            *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
     748            return kFALSE;
     749          }
    730750      //
    731751      // Here start the runs where the shifter put
     
    807827  return Form("%s/%s-F1.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName());
    808828}
     829
     830
     831Bool_t MJCalibration::IsUseBlindPixel() const
     832{
     833  return TESTBIT(fDevices,kUseBlindPixel);
     834}
     835
     836
     837Bool_t MJCalibration::IsUsePINDiode() const
     838{
     839  return TESTBIT(fDevices,kUsePINDiode);
     840}
     841
     842 
     843
    809844
    810845
     
    909944  plist.AddToList(&fCalibrationCam);
    910945  plist.AddToList(&fRelTimeCam);
    911   plist.AddToList(&pindiode);
    912   plist.AddToList(&blindpix);
     946  if (IsUsePINDiode())
     947    plist.AddToList(&pindiode);
     948  if (IsUseBlindPixel())
     949    plist.AddToList(&blindpix);
    913950
    914951  MGeomApply               apply;
     
    9811018
    9821019  tlist.AddToList(&fillcam);
    983   tlist.AddToList(&fillpin);
    984   tlist.AddToList(&fillbnd);
     1020
     1021  if (IsUsePINDiode())
     1022    tlist.AddToList(&fillpin);
     1023  if (IsUseBlindPixel())
     1024    tlist.AddToList(&fillbnd);
     1025
    9851026  tlist.AddToList(&calcalc);
    9861027
     
    10261067Bool_t MJCalibration::ReadCalibrationCam()
    10271068{
    1028     const TString fname = GetOutputFile();
    1029 
    1030     if (gSystem->AccessPathName(fname, kFileExists))
    1031     {
    1032         *fLog << err << "Input file " << fname << " doesn't exist." << endl;
    1033         return kFALSE;
    1034     }
    1035 
    1036     *fLog << inf << "Reading from file: " << fname << endl;
    1037 
    1038     TFile file(fname, "READ");
    1039     if (fCalibrationCam.Read()<=0)
    1040     {
    1041         *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
    1042         return kFALSE;
    1043     }
    1044 
    1045     if (fQECam.Read()<=0)
    1046     {
    1047         *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
    1048         return kFALSE;
    1049     }
    1050 
    1051     if (fRelTimeCam.Read()<=0)
    1052     {
    1053         *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
    1054         return kFALSE;
    1055     }
    1056 
    1057     if (file.FindKey("MBadPixelsCam"))
    1058     {
    1059         MBadPixelsCam bad;
    1060         if (bad.Read()<=0)
     1069
     1070  const TString fname = GetOutputFile();
     1071 
     1072  if (gSystem->AccessPathName(fname, kFileExists))
     1073    {
     1074      *fLog << err << "Input file " << fname << " doesn't exist." << endl;
     1075      return kFALSE;
     1076    }
     1077 
     1078  *fLog << inf << "Reading from file: " << fname << endl;
     1079
     1080  TFile file(fname, "READ");
     1081  if (fCalibrationCam.Read()<=0)
     1082    {
     1083      *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
     1084      return kFALSE;
     1085    }
     1086 
     1087  if (fQECam.Read()<=0)
     1088    {
     1089      *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
     1090      return kFALSE;
     1091    }
     1092 
     1093  if (fRelTimeCam.Read()<=0)
     1094    {
     1095      *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
     1096      return kFALSE;
     1097    }
     1098 
     1099  if (file.FindKey("MBadPixelsCam"))
     1100    {
     1101      MBadPixelsCam bad;
     1102      if (bad.Read()<=0)
    10611103        {
    1062             *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
    1063             return kFALSE;
     1104          *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
     1105          return kFALSE;
    10641106        }
    1065         fBadPixels.Merge(bad);
    1066     }
    1067 
    1068     if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
    1069         fDisplay->Read();
    1070 
    1071     return kTRUE;
     1107      fBadPixels.Merge(bad);
     1108    }
     1109 
     1110  if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
     1111    fDisplay->Read();
     1112 
     1113  return kTRUE;
    10721114}
    10731115
     
    10841126}
    10851127
     1128// --------------------------------------------------------------------------
     1129//
     1130// Set the useage of the Blind Pixel device
     1131//
     1132void MJCalibration::SetUseBlindPixel(const Bool_t b)
     1133{
     1134  b ? SETBIT(fDevices,kUseBlindPixel) : CLRBIT(fDevices,kUseBlindPixel);
     1135}
     1136
     1137// --------------------------------------------------------------------------
     1138//
     1139// Set the useage of the PIN Diode device
     1140//
     1141void MJCalibration::SetUsePINDiode(const Bool_t b)
     1142{
     1143  b ? SETBIT(fDevices,kUsePINDiode) : CLRBIT(fDevices,kUsePINDiode);
     1144}
    10861145
    10871146// --------------------------------------------------------------------------
     
    11411200}
    11421201
    1143 
    1144 
    1145 
    1146 
    1147 
    1148 
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r4134 r4164  
    4646  Display_t fDisplayType;                                  // Chosen Display type
    4747
     48  enum  Device_t    { kUseBlindPixel, kUsePINDiode  };     // Possible devices for calibration
     49
     50  Byte_t fDevices;                                         // Bit-field for used devices for calibration
     51 
    4852  Bool_t fRelTimes;                                        // Flag if relative times have to be calibrated
    4953  Bool_t fDataCheck;                                       // Flag if the data check is run on raw data
     
    5862  ~MJCalibration() {}
    5963 
    60   void SetInput(MRunIter *iter) { fRuns=iter; }
    61   void SetOutputPath(const char *path=".");
    62  
    6364  const char* GetOutputFile() const;
    6465
     
    6768  MCalibrationQECam      &GetQECam()              { return fQECam;          }   
    6869  MBadPixelsCam          &GetBadPixels()          { return fBadPixels;      }
     70
     71  Bool_t IsUseBlindPixel() const;
     72  Bool_t IsUsePINDiode()   const;
    6973 
    7074  void SetBadPixels(const MBadPixelsCam &bad)     { bad.Copy(fBadPixels);   }
     
    7478  void SetColor    (const MCalibrationCam::PulserColor_t color) { fColor = color; }
    7579
     80  void SetInput(MRunIter *iter) { fRuns=iter; }
     81  void SetOutputPath(const char *path=".");
     82 
    7683  // Displays
    7784  void SetFullDisplay()      { fDisplayType = kFullDisplay;      }
     
    8592  void SetDataCheck         (const Bool_t b=kTRUE) { fDataCheck        = b; SetDataCheckDisplay(); }
    8693
     94  // Devices
     95  void SetUseBlindPixel( const Bool_t b=kTRUE );
     96  void SetUsePINDiode  ( const Bool_t b=kTRUE ); 
     97 
    8798  Bool_t ReadCalibrationCam();
    8899  Bool_t ProcessFile( MPedestalCam &pedcam );
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r4134 r4164  
    7979const char* MJPedestal::GetOutputFile() const
    8080{
     81
    8182  if (!fRuns)
    8283    return "";
    8384
    8485  return Form("%s/%s-F0.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName());
     86
    8587}
    8688
    8789Bool_t MJPedestal::ReadPedestalCam()
    8890{
     91
    8992    const TString fname = GetOutputFile();
    9093
Note: See TracChangeset for help on using the changeset viewer.