Changeset 4908


Ignore:
Timestamp:
09/09/04 17:56:49 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4907 r4908  
    7272   * mcalib/MHCalibrationTestTimeCam.cc
    7373     - able to recognize an *Intensity*Cam if in MParList
     74
     75   * mcalib/MCalibrationChargeCalc.[h,cc]
     76   * mcalib/MCalibrationRelTimeCalc.[h,cc]
     77     - able to recognize an *Intensity*Cam if in MParList
     78     - set pulser pattern accordingly in Process from MRawEvtHeader     
    7479
    7580   * msignal/MExtractor.cc
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r4882 r4908  
    194194#include "MParList.h"
    195195
    196 #include "MRawRunHeader.h"
    197 #include "MRawEvtPixelIter.h"
     196#include "MRawEvtHeader.h"
    198197
    199198#include "MGeomCam.h"
     
    203202#include "MPedestalCam.h"
    204203#include "MPedestalPix.h"
     204
     205#include "MCalibrationIntensityChargeCam.h"
    205206
    206207#include "MCalibrationChargeCam.h"
     
    260261//
    261262MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
    262     : fQECam(NULL), fGeom(NULL)
     263    : fQECam(NULL), fGeom(NULL), fSignal(NULL), fHeader(NULL)
    263264{
    264265       
     
    307308    fBadPixels  = NULL;
    308309    fCam        = NULL;
     310    fIntensCam  = NULL;
    309311    fBlindPixel = NULL;
    310312    fBlindCam   = NULL;
     
    312314    fPedestals  = NULL;
    313315
     316    fPulserPattern = 0;
    314317    SetPulserColor ( MCalibrationCam::kNONE );
    315318   
     
    333336{
    334337 
     338  fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
     339  if (!fHeader)
     340    {
     341      *fLog << err << "MRawEvtHeader not found... abort." << endl;
     342      return kFALSE;
     343    }
     344
    335345  //
    336346  // Containers that have to be there.
     
    343353    }
    344354 
     355  fSignal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
     356  if (!fSignal)
     357    {
     358      *fLog << err << "MExtractedSignalCam not found... aborting" << endl;
     359      return kFALSE;
     360    }
     361 
    345362  //
    346363  // Containers that are created in case that they are not there.
     
    360377    }
    361378
    362  
    363   //
    364   // Check the pulser colour --> FIXME: this solution is only valid until the arrival of the DM's
    365   //
    366   if (fPulserColor == MCalibrationCam::kNONE)
    367     {
    368       *fLog << endl;
    369       *fLog << err << GetDescriptor()
    370             << ": No Pulser colour has been chosen. Since the installation of the IFAE pulser box,"
    371             << " you HAVE to provide the LEDs colour, otherwise there is no calibration. " << endl;
    372       *fLog << "See e.g. the macro calibration.C " << endl;
     379  fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
     380  if (!fHeader)
     381    {
     382      *fLog << err << "MRawEvtHeader not found... abort." << endl;
    373383      return kFALSE;
    374384    }
    375  
     385
     386
    376387  return kTRUE;
    377388}
     
    395406// It defines the PixId of every pixel in:
    396407//
     408// - MCalibrationIntensityChargeCam
    397409// - MCalibrationChargeCam
    398410// - MCalibrationQECam
     
    419431    }
    420432 
    421   fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
    422   if (!fCam)
    423     {
    424       *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl;
    425       *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
    426       return kFALSE;
    427     }
    428 
     433  fIntensCam = (MCalibrationIntensityChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam"));
     434  if (fIntensCam)
     435    *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl;
     436  else
     437    {
     438      fCam = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
     439      if (!fCam)
     440        {
     441          *fLog << err << "Cannot find MCalibrationChargeCam ... abort." << endl;
     442          *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
     443          return kFALSE;
     444        }
     445    }
     446 
    429447  //
    430448  // Optional Containers
     
    451469    }
    452470 
    453 
    454   //
    455   // Initialize the pulser colours
    456   //
    457   if (fCam->GetPulserColor() == MCalibrationCam::kNONE)
    458     {
    459       fCam->SetPulserColor( fPulserColor );
    460      
    461       if (fBlindPixel)
    462         fBlindPixel->SetColor( fPulserColor );
    463      
    464       if (fBlindCam)
    465         fBlindCam->SetColor( fPulserColor );
    466      
    467       if (fPINDiode)
    468         fPINDiode->SetColor( fPulserColor );
    469     }
    470 
    471   if (fPulserColor != fCam->GetPulserColor())
    472     {
    473       *fLog << err << GetDescriptor()
    474             << ": Pulser colour has changed w.r.t. last file in MCalibrationChargeCam" << endl;
    475       *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl;
    476       return kFALSE;
    477     }
    478 
    479   if (fBlindPixel)
    480     if (fPulserColor != fBlindPixel->GetColor())
    481       {
    482         *fLog << err << GetDescriptor()
    483               << ": Pulser colour has changed w.r.t. last file in MCalibrationChargeBlindPix." << endl;
    484         *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl;
    485         return kFALSE;
    486       }
    487 
    488   if (fBlindCam)
    489     if (fPulserColor != fBlindCam->GetColor())
    490       {
    491         *fLog << err << GetDescriptor()
    492               << ": Pulser colour has changed w.r.t. last file in MCalibrationChargeBlindCam." << endl;
    493         *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl;
    494         return kFALSE;
    495       }
    496  
    497   if (fPINDiode)
    498     if (fPulserColor != fPINDiode->GetColor())
    499       {
    500         *fLog << err << GetDescriptor()
    501               << ": Pulser colour has changed w.r.t. last file in MCalibrationChargePINDiode." << endl;
    502         *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl;
    503         return kFALSE;
    504       }
    505  
    506 
    507   fNumHiGainSamples  =  fCam->GetNumHiGainFADCSlices();
    508   fNumLoGainSamples  =  fCam->GetNumLoGainFADCSlices();
     471  fNumHiGainSamples  =  fSignal->GetNumUsedHiGainFADCSlices();
     472  fNumLoGainSamples  =  fSignal->GetNumUsedLoGainFADCSlices();
    509473
    510474  fSqrtHiGainSamples =  TMath::Sqrt(fNumHiGainSamples);
     
    516480    {
    517481     
    518       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)  [i];
     482      MCalibrationChargePix &pix = fIntensCam
     483        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     484        : (MCalibrationChargePix&)(*fCam)      [i];
    519485      MCalibrationQEPix     &pqe = (MCalibrationQEPix&)    (*fQECam)[i];
    520486      MBadPixelsPix         &bad = (*fBadPixels)[i];
     
    539505// ----------------------------------------------------------------------------------
    540506// 
    541 // Nothing to be done in Process, but have a look at MHCalibrationChargeCam, instead
     507// Set the correct colour to the charge containers
    542508//
    543509Int_t MCalibrationChargeCalc::Process()
    544510{
     511
     512  const UInt_t pattern = fHeader->GetCalibrationPattern();
     513
     514  if (pattern == fPulserPattern)
     515    return kTRUE;
     516
     517  enum ColorCode_t
     518    {
     519      kSlot1Green     = BIT(0),
     520      kSlot2Green     = BIT(1),
     521      kSlot3Blue      = BIT(2),
     522      kSlot4UV        = BIT(3),
     523      kSlot5UV        = BIT(4),
     524      kSlot6Blue      = BIT(5),
     525      kSlot7Blue      = BIT(6),
     526      kSlot8Blue      = BIT(7),
     527      kSlot9AttBlue   = BIT(8),
     528      kSlot10Blue     = BIT(9),
     529      kSlot11Blue     = BIT(10),
     530      kSlot12UV       = BIT(11),
     531      kSlot13UV       = BIT(12),
     532      kSlot14Blue     = BIT(13),
     533      kSlot15Green    = BIT(14),
     534      kSlot16AttGreen = BIT(15),
     535      kCT1Pulser      = BIT(16),
     536      kAnyGreen       = kSlot1Green  | kSlot2Green | kSlot15Green | kSlot16AttGreen,
     537      kAnyUV          = kSlot4UV     | kSlot5UV    | kSlot12UV    | kSlot13UV,
     538      kAnyBlue        = kSlot3Blue   | kSlot6Blue  | kSlot7Blue   | kSlot8Blue
     539                      | kSlot9AttBlue| kSlot10Blue | kSlot11Blue  | kSlot14Blue
     540    };
     541
     542  //
     543  // The pattern has changed, we have to initialize everything new!!!
     544  //
     545  *fLog << inf << " New pulser pattern: " ;
     546  for (Int_t i=16; i>= 0; i--)
     547    *fLog << (pattern >> i & 1);
     548  *fLog  << endl;
     549  fPulserPattern = pattern;
     550 
     551  //
     552  // Now retrieve the colour and check if not various colours have been used
     553  //
     554  fPulserColor = MCalibrationCam::kNONE;
     555 
     556  if (fPulserPattern & kAnyGreen )
     557    fPulserColor = MCalibrationCam::kGREEN;
     558 
     559  if (fPulserPattern & kAnyBlue )
     560    if (fPulserColor != MCalibrationCam::kNONE)
     561      {
     562        *fLog << err << GetDescriptor()
     563              << "Multiple colours used simultaneously in calibration file. Will skip this part!" << endl;
     564        return kCONTINUE;
     565      }
     566    else
     567      fPulserColor = MCalibrationCam::kBLUE;
     568 
     569  if (fPulserPattern & kAnyUV )
     570    if (fPulserColor != MCalibrationCam::kNONE)
     571      {
     572        *fLog << err << GetDescriptor()
     573              << "Multiple colours used simultaneously in calibration file. Will skip this part!" << endl;
     574        return kCONTINUE;
     575      }
     576    else
     577      fPulserColor = MCalibrationCam::kUV;
     578 
     579  if (fPulserPattern & kCT1Pulser )
     580    if (fPulserColor != MCalibrationCam::kNONE)
     581      {
     582        *fLog << err << GetDescriptor()
     583              << "Multiple colours used simultaneously in calibration file. Will skip this part!" << endl;
     584        return kCONTINUE;
     585      }
     586    else
     587      fPulserColor = MCalibrationCam::kCT1;
     588 
     589  *fLog << inf << GetDescriptor() << ": Found new colour ... " << endl;
     590 
     591  switch (fPulserColor)
     592    {
     593    case MCalibrationCam::kGREEN: *fLog << "Green.";  break;
     594    case MCalibrationCam::kBLUE:  *fLog << "Blue.";   break;
     595    case MCalibrationCam::kUV:    *fLog << "UV.";     break;
     596    case MCalibrationCam::kCT1:   *fLog << "CT1.";    break;
     597    }
     598  *fLog << endl;
     599 
     600  //
     601  // Initialize the pulser colours
     602  //
     603  if (fIntensCam)
     604    fIntensCam->SetPulserColor( fPulserColor );
     605  else
     606    fCam->SetPulserColor( fPulserColor );
     607 
     608  if (fBlindPixel)
     609    fBlindPixel->SetColor( fPulserColor );
     610 
     611  if (fBlindCam)
     612    fBlindCam->SetColor( fPulserColor );
     613 
     614  if (fPINDiode)
     615    fPINDiode->SetColor( fPulserColor );
     616
    545617  return kTRUE;
    546618}
     
    570642// Call  FinalizeUnsuitablePixels()
    571643// 
    572 // Call MParContainer::SetReadyToSave() for fCam, fQECam, fBadPixels and
     644// Call MParContainer::SetReadyToSave() for fIntensCam, fCam, fQECam, fBadPixels and
    573645//                                          fBlindPixel and fPINDiode if they exist
    574646//
     
    608680    {
    609681
    610       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid];
     682      MCalibrationChargePix &pix = fIntensCam
     683        ? (MCalibrationChargePix&)(*fIntensCam)[pixid]
     684        : (MCalibrationChargePix&)(*fCam)[pixid];
    611685      //
    612686      // Check if the pixel has been excluded from the fits
     
    643717
    644718      const MPedestalPix     &ped = fPedestals->GetAverageArea(aidx);
    645       MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     719      MCalibrationChargePix &pix = fIntensCam
     720        ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx)
     721        : (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    646722
    647723      FinalizePedestals(ped,pix,aidx);
    648       FinalizeCharges(pix, fCam->GetAverageBadArea(aidx),"area id");
     724      FinalizeCharges(pix,
     725                      fIntensCam ? fIntensCam->GetAverageBadArea(aidx) : fCam->GetAverageBadArea(aidx),
     726                      "area id");
    649727    }
    650728 
     
    656734      const MPedestalPix     &ped = fPedestals->GetAverageSector(sector);
    657735
    658       MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
     736      MCalibrationChargePix &pix = fIntensCam
     737        ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector)
     738        : (MCalibrationChargePix&)fCam->GetAverageSector(sector);
    659739      FinalizePedestals(ped,pix, 0);
    660740    }
     
    673753    {
    674754      *fLog << warn << "Could not calculate the photons flux from the F-Factor method " << endl;
    675       fCam->SetFFactorMethodValid(kFALSE);
     755      if (fIntensCam)
     756        fIntensCam->SetFFactorMethodValid(kFALSE);
     757      else
     758        fCam->SetFFactorMethodValid(kFALSE);
    676759      return kFALSE;
    677760    }
    678761  else
    679     fCam->SetFFactorMethodValid(kTRUE);
     762    if (fIntensCam)
     763      fIntensCam->SetFFactorMethodValid(kTRUE);
     764    else
     765      fCam->SetFFactorMethodValid(kTRUE);
    680766 
    681767  *fLog << endl;
     
    721807  FinalizeUnsuitablePixels();
    722808
    723   fCam      ->SetReadyToSave();
     809  if (fIntensCam)
     810    fIntensCam->SetReadyToSave();
     811  else
     812    fCam      ->SetReadyToSave();
     813
    724814  fQECam    ->SetReadyToSave();
    725815  fBadPixels->SetReadyToSave();
     
    9231013     
    9241014      MBadPixelsPix    &bad    = (*fBadPixels)[i];
    925       MCalibrationPix  &pix    = (*fCam)[i];
     1015      MCalibrationPix  &pix    = fIntensCam ? (*fIntensCam)[i] : (*fCam)[i];
    9261016
    9271017      if (bad.IsUncalibrated( MBadPixelsPix::kChargeIsPedestal))
     
    9901080{
    9911081
    992   const UInt_t npixels  = fGeom->GetNumPixels();
    993   const UInt_t nareas   = fGeom->GetNumAreas();
    994   const UInt_t nsectors = fGeom->GetNumSectors();
     1082  const Int_t npixels  = fGeom->GetNumPixels();
     1083  const Int_t nareas   = fGeom->GetNumAreas();
     1084  const Int_t nsectors = fGeom->GetNumSectors();
    9951085
    9961086  TArrayF lowlim        (nareas);
     
    10101100  MHCamera camphes(*fGeom,"Camphes","Phes in Camera");
    10111101
    1012   for (UInt_t i=0; i<npixels; i++)
    1013     {
    1014      
    1015       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)  [i];
     1102  for (Int_t i=0; i<npixels; i++)
     1103    {
     1104     
     1105      MCalibrationChargePix &pix = fIntensCam
     1106        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1107        : (MCalibrationChargePix&)(*fCam)  [i];
    10161108      MBadPixelsPix         &bad = (*fBadPixels)[i];
    10171109     
     
    10391131    }
    10401132
    1041   for (UInt_t i=0; i<nareas; i++)
     1133  for (Int_t i=0; i<nareas; i++)
    10421134    {
    10431135      if (numareavalid[i] == 0)
     
    10711163      upplim  [i] = areaphes[i] + fPheErrLimit*TMath::Sqrt(areavars[i]);
    10721164
    1073       TArrayI area(1);
    1074       area[0] = i;
    1075 
    1076       TH1D *hist = camphes.ProjectionS(TArrayI(),area,"_py",100);
     1165      TH1D *hist = camphes.ProjectionS(TArrayI(),TArrayI(1,&i),"_py",100);
    10771166      hist->Fit("gaus","Q");
    10781167      const Float_t mean  = hist->GetFunction("gaus")->GetParameter(1);
     
    10811170
    10821171      if (IsDebug())
    1083         camphes.DrawClone();
     1172        hist->DrawClone();
    10841173
    10851174      if (ndf < 2)
     
    11261215  //              Set the conversion factor FADC counts to photo-electrons
    11271216  //
    1128   for (UInt_t i=0; i<npixels; i++)
    1129     {
    1130      
    1131       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1217  for (Int_t i=0; i<npixels; i++)
     1218    {
     1219     
     1220      MCalibrationChargePix &pix = fIntensCam
     1221        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1222        : (MCalibrationChargePix&)(*fCam)[i];
    11321223
    11331224      if (!pix.IsFFactorMethodValid())
     
    11771268  *fLog << endl;
    11781269
    1179   for (UInt_t aidx=0; aidx<nareas; aidx++)
    1180     {
    1181 
    1182       MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     1270  for (Int_t aidx=0; aidx<nareas; aidx++)
     1271    {
     1272
     1273      MCalibrationChargePix &apix = fIntensCam
     1274        ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx)
     1275        : (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    11831276
    11841277      if (numareavalid[aidx] == 1)
     
    12181311  *fLog << endl;
    12191312
    1220   for (UInt_t sector=0; sector<nsectors; sector++)
     1313  for (Int_t sector=0; sector<nsectors; sector++)
    12211314    {
    12221315
     
    12371330        }
    12381331     
    1239       MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
     1332      MCalibrationChargePix &spix = fIntensCam
     1333        ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector)
     1334        : (MCalibrationChargePix&)fCam->GetAverageSector(sector);
    12401335
    12411336      if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.)
     
    12641359  //             only excluded as: MBadPixelsPix::kChargeSigmaNotValid
    12651360  //
    1266   for (UInt_t i=0; i<npixels; i++)
    1267     {
    1268      
    1269       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1361  for (Int_t i=0; i<npixels; i++)
     1362    {
     1363     
     1364      MCalibrationChargePix &pix = fIntensCam
     1365        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1366        : (MCalibrationChargePix&)(*fCam)[i];
    12701367      MBadPixelsPix         &bad = (*fBadPixels)[i];
    12711368
     
    12761373        {
    12771374          const Int_t            aidx = (*fGeom)[i].GetAidx();
    1278           MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     1375          MCalibrationChargePix &apix = fIntensCam
     1376            ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx)
     1377            : (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    12791378          pix.SetPheFFactorMethod   ( apix.GetPheFFactorMethod()    );
    12801379          pix.SetPheFFactorMethodVar( apix.GetPheFFactorMethodVar() );
     
    14171516
    14181517  const Float_t photons = flux * (*fGeom)[0].GetA() / fQECam->GetPlexiglassQE();
    1419   fCam->SetNumPhotonsBlindPixelMethod(photons);
     1518  if (fIntensCam)
     1519    fIntensCam->SetNumPhotonsBlindPixelMethod(photons);
     1520  else
     1521    fCam->SetNumPhotonsBlindPixelMethod(photons);
    14201522 
    14211523  const Float_t photrelvar = fluxvar / flux / flux + fQECam->GetPlexiglassQERelVar();
    14221524  if (photrelvar > 0.)
    1423     fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1525    if (fIntensCam)
     1526      fIntensCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1527    else
     1528      fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
    14241529
    14251530  return kTRUE;
     
    15291634    }
    15301635 
    1531   MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
     1636  MCalibrationChargePix &avpix = fIntensCam
     1637    ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(0)
     1638    : (MCalibrationChargePix&)fCam->GetAverageArea(0);
    15321639  MCalibrationQEPix     &qepix = (MCalibrationQEPix&)  fQECam->GetAverageArea(0); 
    15331640
     
    15491656  // Set the results in the MCalibrationChargeCam
    15501657  //
    1551   fCam->SetNumPhotonsFFactorMethod   (avphotons);
     1658  if (fIntensCam)
     1659    fIntensCam->SetNumPhotonsFFactorMethod   (avphotons);
     1660  else
     1661    fCam->SetNumPhotonsFFactorMethod   (avphotons);
     1662
    15521663  if (avphotrelvar > 0.)
    1553     fCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 
     1664    if (fIntensCam)
     1665      fIntensCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 
     1666    else
     1667      fCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 
    15541668
    15551669  TArrayF lowlim           (nareas);
     
    15661680    {
    15671681     
    1568       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1682      MCalibrationChargePix &pix = fIntensCam
     1683        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1684        : (MCalibrationChargePix&)(*fCam)[i];
    15691685      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
    15701686      MBadPixelsPix         &bad =                   (*fBadPixels)[i];
     
    16811797    {
    16821798     
    1683       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1799      MCalibrationChargePix &pix = fIntensCam
     1800        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1801        : (MCalibrationChargePix&)(*fCam)[i];
    16841802      MBadPixelsPix         &bad =                   (*fBadPixels)[i];
    16851803
     
    17041822    {
    17051823     
    1706       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1824      MCalibrationChargePix &pix = fIntensCam
     1825        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1826        : (MCalibrationChargePix&)(*fCam)[i];
    17071827      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
    17081828      MBadPixelsPix         &bad =                   (*fBadPixels)[i];
     
    17521872          const Float_t photons = fBlindPixel->GetFluxInsidePlexiglass() * (*fGeom)[0].GetA()
    17531873                               / fQECam->GetPlexiglassQE();
    1754           fCam->SetNumPhotonsBlindPixelMethod(photons);
     1874          if (fIntensCam)
     1875            fCam->SetNumPhotonsBlindPixelMethod(photons);
     1876          else
     1877            fCam->SetNumPhotonsBlindPixelMethod(photons);
    17551878
    17561879          const Float_t photrelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar()
    17571880                                   + fQECam->GetPlexiglassQERelVar();
    17581881          if (photrelvar > 0.)
    1759             fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1882            if (fIntensCam)
     1883              fIntensCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1884            else
     1885              fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
    17601886        }
    17611887    }
     
    17881914        }
    17891915     
    1790       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1916      MCalibrationChargePix &pix = fIntensCam
     1917        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     1918        : (MCalibrationChargePix&)(*fCam)[i];       
    17911919      MGeomPix              &geo =                        (*fGeom)[i];
    17921920     
     
    18611989        }
    18621990     
    1863       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1991      MCalibrationChargePix &pix = fIntensCam
     1992        ?  (MCalibrationChargePix&)(*fIntensCam)[i]     
     1993        :  (MCalibrationChargePix&)(*fCam)[i];
    18641994      MGeomPix              &geo =                        (*fGeom)[i];
    18651995     
     
    19102040//
    19112041// - Print out statistics about BadPixels of type UnsuitableType_t
    1912 // - store numbers of bad pixels of each type in fCam
     2042// - store numbers of bad pixels of each type in fCam or fIntensCam
    19132043//
    19142044void MCalibrationChargeCalc::FinalizeUnsuitablePixels()
     
    19502080
    19512081  for (Int_t aidx=0; aidx<nareas; aidx++)
    1952     fCam->SetNumUnsuitable(counts[aidx], aidx);
     2082    if (fIntensCam)
     2083      fIntensCam->SetNumUnsuitable(counts[aidx], aidx);
     2084    else
     2085      fCam->SetNumUnsuitable(counts[aidx], aidx);
    19532086
    19542087  if (fGeom->InheritsFrom("MGeomCamMagic"))
     
    19692102
    19702103  for (Int_t aidx=0; aidx<nareas; aidx++)
    1971     fCam->SetNumUnreliable(counts[aidx], aidx);
     2104    if (fIntensCam)
     2105      fIntensCam->SetNumUnreliable(counts[aidx], aidx);
     2106    else
     2107      fCam->SetNumUnreliable(counts[aidx], aidx);
    19722108
    19732109  *fLog << " " << setw(7) << "Unreliable Pixels:              "
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r4882 r4908  
    2727#endif
    2828
    29 class MRawEvtData;
    30 class MRawRunHeader;
     29class MRawEvtHeader;
    3130class MPedestalCam;
    3231class MPedestalPix;
     
    3635class MCalibrationChargePix;
    3736class MCalibrationChargeCam;
     37class MCalibrationIntensityChargeCam;
    3838class MCalibrationQECam;
    3939class MGeomCam;
    4040class MExtractedSignalCam;
    41 class MExtractedSignalBlindPixel;
    42 class MExtractedSignalPINDiode;
    4341class MBadPixelsCam;
    4442class MTime;
     
    6866  Float_t fSqrtHiGainSamples;                  // Square root nr. High-Gain FADC slices used by extractor
    6967  Float_t fSqrtLoGainSamples;                  // Square root nr. Low -Gain FADC slices used by extractor
     68
    7069  MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour
     70  UInt_t  fPulserPattern;                      // Calibration LEDs Pulser Pattern
     71
    7172  Int_t   fNumInnerFFactorMethodUsed;          // Number of inner pixels used for F-Factor Method calibration
    7273
     
    8081 
    8182  // Pointers
    82   MBadPixelsCam              *fBadPixels;      //  Bad Pixels
     83  MBadPixelsCam              *fBadPixels;      //  Bad Pixels
     84  MCalibrationIntensityChargeCam *fIntensCam;  //  Calibrated Charges of all pixels   
    8385  MCalibrationChargeCam      *fCam;            //  Calibrated Charges of all pixels
    8486  MCalibrationChargeBlindPix *fBlindPixel;     //  Calibrated Charges of the Blind Pixel
     
    8789  MCalibrationQECam          *fQECam;          //  Calibrated Quantum Efficiencies of all pixels
    8890  MGeomCam                   *fGeom;           //! Camera geometry
     91  MExtractedSignalCam        *fSignal;         //! Extracted Signal
     92  MRawEvtHeader              *fHeader;         //! Event header
    8993  MPedestalCam               *fPedestals;      //! Pedestals all pixels (calculated previously from ped.file)
    9094
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r4811 r4908  
    6161#include "MGeomPix.h"
    6262
     63#include "MCalibrationIntensityRelTimeCam.h"
     64
    6365#include "MCalibrationRelTimeCam.h"
    6466#include "MCalibrationRelTimePix.h"
     
    7274using namespace std;
    7375
    74 const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 0.75;
     76const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 1.0;
    7577// --------------------------------------------------------------------------
    7678//
     
    8890//
    8991MCalibrationRelTimeCalc::MCalibrationRelTimeCalc(const char *name, const char *title)
    90     : fBadPixels(NULL), fCam(NULL), fGeom(NULL)
     92    : fGeom(NULL)
    9193{
    9294       
     
    106108// Sets:
    107109// - all flags to kFALSE
     110// - all pointers to NULL
    108111//
    109112void MCalibrationRelTimeCalc::Clear(const Option_t *o)
    110113{
    111     SkipHiLoGainCalibration( kFALSE );   
     114
     115  fBadPixels  = NULL;
     116  fCam        = NULL;
     117  fIntensCam  = NULL;
     118
    112119}
    113120
     
    160167    }
    161168 
    162   fCam = (MCalibrationRelTimeCam*)pList->FindObject("MCalibrationRelTimeCam");
    163   if (!fCam)
    164     {
    165       *fLog << err << "Cannot find MCalibrationRelTimeCam... aborting" << endl;
    166       *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationRelTimeCam before..." << endl;
    167       return kFALSE;
    168     }
    169 
     169  fIntensCam = (MCalibrationIntensityRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam"));
     170  if (fIntensCam)
     171    *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl;
     172  else
     173    {
     174      fCam = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam"));
     175      if (!fCam)
     176        {
     177          *fLog << err << "Cannot find MCalibrationRelTimeCam ... abort." << endl;
     178          *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationRelTimeCam before..." << endl;
     179          return kFALSE;
     180        }
     181    }
    170182 
    171183  UInt_t npixels     = fGeom->GetNumPixels();
     
    174186    {
    175187     
    176       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)  [i];
    177       MBadPixelsPix         &bad = (*fBadPixels)[i];
     188      MCalibrationRelTimePix &pix = fIntensCam
     189        ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
     190        : (MCalibrationRelTimePix&)(*fCam)      [i];
     191      MBadPixelsPix          &bad = (*fBadPixels)[i];
    178192     
    179193      pix.SetPixId(i);
     
    184198          continue;
    185199        }
    186      
     200
     201      if (IsDebug())
     202        pix.SetDebug();
    187203    }
    188204
     
    245261  FinalizeUnsuitablePixels();
    246262
    247   fCam      ->SetReadyToSave();
     263  if (fIntensCam)
     264    fIntensCam->SetReadyToSave();
     265  else
     266    fCam      ->SetReadyToSave();
    248267  fBadPixels->SetReadyToSave();
    249268
     
    321340    {
    322341     
    323       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
     342      MCalibrationRelTimePix &pix = fIntensCam
     343        ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
     344        : (MCalibrationRelTimePix&)(*fCam)      [i];
    324345      MBadPixelsPix          &bad = (*fBadPixels)[i];
    325346     
     
    369390    {
    370391     
    371       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
     392      MCalibrationRelTimePix &pix = fIntensCam
     393        ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
     394        : (MCalibrationRelTimePix&)(*fCam)      [i];
    372395      MBadPixelsPix          &bad = (*fBadPixels)[i];
    373396     
     
    378401        continue;
    379402     
    380       const Float_t res  = pix.GetTimePrecision();
     403      const Float_t res    = pix.GetTimePrecision();
    381404      const Int_t   aidx   = (*fGeom)[i].GetAidx();
    382405     
     
    408431    {
    409432     
    410       MBadPixelsPix    &bad    = (*fBadPixels)[i];
    411       MCalibrationPix  &pix    = (*fCam)[i];
     433      MBadPixelsPix          &bad = (*fBadPixels)[i];
     434      MCalibrationRelTimePix &pix = fIntensCam
     435        ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
     436        : (MCalibrationRelTimePix&)(*fCam)      [i];
    412437
    413438      if (bad.IsUncalibrated( MBadPixelsPix::kDeviatingTimeResolution))
     
    430455//
    431456// - Print out statistics about BadPixels of type UnsuitableType_t
    432 // - store numbers of bad pixels of each type in fCam
     457// - store numbers of bad pixels of each type in fIntensCam or fCam
    433458//
    434459void MCalibrationRelTimeCalc::FinalizeUnsuitablePixels()
     
    454479
    455480  for (Int_t aidx=0; aidx<nareas; aidx++)
    456     fCam->SetNumUnsuitable(counts[aidx], aidx);
     481    if (fIntensCam)
     482      fIntensCam->SetNumUnsuitable(counts[aidx], aidx);
     483    else
     484      fCam->SetNumUnsuitable(counts[aidx], aidx);
    457485
    458486  if (fGeom->InheritsFrom("MGeomCamMagic"))
     
    473501
    474502  for (Int_t aidx=0; aidx<nareas; aidx++)
    475     fCam->SetNumUnreliable(counts[aidx], aidx);
     503    if (fIntensCam)
     504      fIntensCam->SetNumUnreliable(counts[aidx], aidx);
     505    else
     506      fCam->SetNumUnreliable(counts[aidx], aidx);
    476507
    477508  *fLog << " " << setw(7) << "Unreliable Pixels:              "
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h

    r4882 r4908  
    1919#endif
    2020
     21class MCalibrationIntensityRelTimeCam;
    2122class MCalibrationRelTimeCam;
    2223class MGeomCam;
     
    3031 
    3132  // Variables
    32   Float_t fRelTimeResolutionLimit;              // Limit acceptance rel. time resolution (in FADC slices)
    33   Byte_t  fFlags;                               // Bit-field for the flags
    34  
    35   TString fOutputPath;                          // Path to the output file
    36   TString fOutputFile;                          // Name of the output file 
     33  Float_t fRelTimeResolutionLimit;               //  Limit acceptance rel. time resolution (in FADC slices)
     34  TString fOutputPath;                           //  Path to the output file
     35  TString fOutputFile;                           //  Name of the output file 
    3736 
    3837  // Pointers
    39   MBadPixelsCam              *fBadPixels;      //  Bad Pixels
    40   MCalibrationRelTimeCam     *fCam;            //  Calibrated RelTimes of all pixels
    41   MGeomCam                   *fGeom;           //! Camera geometry
     38  MBadPixelsCam              *fBadPixels;        //  Bad Pixels
     39  MCalibrationIntensityRelTimeCam *fIntensCam;   //  Calibrated RelTimes for different intensities
     40  MCalibrationRelTimeCam     *fCam;              //  Calibrated RelTimes of all pixels
     41  MGeomCam                   *fGeom;             //! Camera geometry
    4242
    43   // enums
    44   enum  { kHiLoGainCalibration };
     43  enum  { kDebug };                              //  Possible flags
    4544
     45  Byte_t  fFlags;                                //  Bit-field for the general flags
     46 
    4647  // functions
    47   const char* GetOutputFile();
     48  const char* GetOutputFile       ();
    4849  void   FinalizeAverageResolution();
    49   void   FinalizeRelTimes     ();
    50   void   FinalizeBadPixels      ();
    51   void   FinalizeUnsuitablePixels();
     50  void   FinalizeRelTimes         ();
     51  void   FinalizeBadPixels        ();
     52  void   FinalizeUnsuitablePixels ();
    5253
    5354  void   PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
     
    6465  void Clear(const Option_t *o="");
    6566 
    66   void SetOutputPath        ( TString path="."                   );
    67   void SetOutputFile        ( TString file="TimeCalibStat.txt"   ) { fOutputFile        = file; }
    68   void SetRelTimeResolutionLimit ( const Float_t f=fgRelTimeResolutionLimit    ) { fRelTimeResolutionLimit = f;   }
     67  Bool_t IsDebug() const  {  return TESTBIT(fFlags,kDebug); }
    6968
    70   void SkipHiLoGainCalibration ( const Bool_t b=kTRUE )
    71       { b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration); }
     69  void SetDebug                 ( const Bool_t  b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); }   
     70  void SetOutputPath            ( TString path="."                         );
     71  void SetOutputFile            ( TString file="TimeCalibStat.txt"         ) { fOutputFile          = file; }
     72  void SetRelTimeResolutionLimit( const Float_t f=fgRelTimeResolutionLimit ) { fRelTimeResolutionLimit = f; }
    7273
    7374  ClassDef(MCalibrationRelTimeCalc, 1)   // Task finalizing the relative time Calibration
Note: See TracChangeset for help on using the changeset viewer.