Changeset 5859


Ignore:
Timestamp:
01/16/05 17:34:30 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5858 r5859  
    3636  * mcalib/MCalibCalcFromPast.[h,cc]
    3737    - committed final version, now also in the Makefile
     38
     39 
     40  * mjobs/MJCalibrateSignalFromOutside.[h,cc]
     41  * macros/calibration.C
     42    - committed final version, now able to calibrate interlaced cal.
     43      events.
    3844
    3945
  • trunk/MagicSoft/Mars/macros/calibration.C

    r5811 r5859  
    8383using namespace std;
    8484
    85 static TString outpath = "./";
    86 static TString inpath  = "/home/rootdata/Calib/2004_09_22";
     85static TString outpath = ".";
     86//static TString inpath  = "/home/rootdata/Calib/2004_07_06";
     87//static TString inpath  = "/home/rootdata/Calib/2004_09_22";
     88static TString inpath  = "/home/rootdata/Calib/2004_12_18";
    8789static TString badfile;
    8890//static TString badfile = "badpixels_only0_388_559.dat";
     
    134136static Bool_t useIntensity  = kFALSE;
    135137//
     138// Tell if you to calibrated interlaced calibration events
     139//
     140static Bool_t useInterlaced = kTRUE;
     141//
    136142// Tell if you want to store and read the F0 and F1- files
    137143//
    138 static Bool_t useStorage   = kTRUE;
     144static Bool_t useStorage    = kTRUE;
    139145//
    140146// Tell which extractor you want to use. The flags are counted according
     
    209215
    210216  MJPedestal pedloop1;
    211   pedloop1.SetNoStorage(!useStorage);
     217  pedloop1.SetNoStorage();
    212218  pedloop1.SetEnvDebug(debug);
    213219  pedloop1.SetExtractor(extractor);
     
    239245     
    240246      pedloop2.SetUseData();
    241       pedloop2.SetNoStorage(!useStorage);
     247      pedloop2.SetNoStorage();
    242248      pedloop2.SetEnvDebug(debug);
    243249      pedloop2.SetExtractor(extractor);
     
    365371  calibloop.SetExtractor(extractor);
    366372  calibloop.SetInput(&druns);
    367   //  calibloop.SetOutputPath(outpath);
     373  calibloop.SetPathOut(outpath);
    368374  if (useDisplay)
    369375    calibloop.SetDisplay(display);
    370376  calibloop.SetBadPixels(calloop.GetBadPixels());
    371377  calibloop.SetNoStorage(!useStorage);
     378  calibloop.SetInterlaced(useInterlaced);
    372379 
    373380  if (!calibloop.ProcessFile(pedloop1.GetPedestalCam(),timeandcharge ? pedloop2.GetPedestalCam() : pedloop1.GetPedestalCam(), calloop.GetCalibrationCam(),calloop.GetQECam(), calloop.GetRelTimeCam()))
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.h

    r5854 r5859  
    4242  MBadPixelsCam         *fBadPixels;     //! Bad Pixels information
    4343  MCalibrationChargeCam *fCalibrations;  //! Calibration constants
     44  MCalibrationChargeCam *fCalibUpdate;   //! Calibration constants update (for interlaced cal events)
    4445  MCalibrationQECam     *fQEs;           //! Quantum efficiencies
    4546  MExtractedSignalCam   *fSignals;       //! Integrated charge in FADCs counts
     
    111112  void   SetSignalType      ( SignalType_t      sigtype=kPhot    ) { fSignalType     =sigtype; } 
    112113
     114  void   SetCalibUpdate     ( MCalibrationChargeCam *cam=NULL )    { fCalibUpdate    = cam;  }
     115
    113116  Bool_t UpdateConversionFactors();
    114117 
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignalFromOutside.cc

    r5810 r5859  
    2222!
    2323\* ======================================================================== */
    24 
    2524/////////////////////////////////////////////////////////////////////////////
    2625//
     
    5453#include "MHCamEvent.h"
    5554#include "MPedestalCam.h"
     55#include "MPedPhotCam.h"
     56#include "MCalibrationHiLoCam.h"
    5657#include "MBadPixelsCam.h"
    5758
     
    6263#include "MCalibrationChargePINDiode.h"
    6364
     65#include "MCalibrationChargeCalc.h"
     66#include "MCalibrationRelTimeCalc.h"
     67
     68#include "MCalibrationIntensityChargeCam.h"
     69#include "MCalibrationIntensityBlindCam.h"
     70#include "MCalibrationIntensityRelTimeCam.h"
     71#include "MCalibrationIntensityQECam.h"
     72#include "MBadPixelsIntensityCam.h"
     73
     74#include "MHCalibrationChargeCam.h"
     75#include "MHCalibrationChargeBlindCam.h"
     76#include "MHCalibrationChargePINDiode.h"
     77#include "MHCalibrationRelTimeCam.h"
     78
     79#include "MCalibCalcFromPast.h"
     80
    6481#include "MReadReports.h"
    6582#include "MReadMarsFile.h"
    6683#include "MRawFileRead.h"
     84#include "MTriggerPatternDecode.h"
     85#include "MFTriggerPattern.h"
     86#include "MContinue.h"
    6787#include "MGeomApply.h"
    6888#include "MMcPedestalCopy.h"
     
    7090#include "MPedCalcFromLoGain.h"
    7191#include "MExtractor.h"
     92#include "MExtractPINDiode.h"
     93#include "MExtractBlindPixel.h"
    7294#include "MTaskEnv.h"
    7395#include "MCalibrateData.h"
     
    90112//
    91113MJCalibrateSignalFromOutside::MJCalibrateSignalFromOutside(const char *name, const char *title)
    92     : fIsDataCheck(kFALSE), fGeometry("MGeomCamMagic")
     114    : fIsDataCheck(kFALSE), fGeometry("MGeomCamMagic"), fInterlaced(kFALSE)
    93115{
    94116    fName  = name  ? name  : "MJCalibrateSignalFromOutside";
     
    121143}
    122144
    123 Bool_t MJCalibrateSignalFromOutside::ProcessFile(MPedestalCam &pedcamab, MPedestalCam &pedcamrms, MCalibrationChargeCam &chargecam, MCalibrationQECam &qecam, MCalibrationRelTimeCam &relcam, Byte_t filetype)
     145Bool_t MJCalibrateSignalFromOutside::ProcessFile(MPedestalCam &pedcamab, MPedestalCam &pedcam2, MCalibrationChargeCam &chargecam, MCalibrationQECam &qecam, MCalibrationRelTimeCam &relcam, Byte_t filetype)
    124146{
    125147    // --------------------------------------------------------------------------------
     
    153175    plist.AddToList(this); // take care of fDisplay!
    154176    plist.AddToList(&fBadPixels);
    155     plist.AddToList(&pedcamrms);
     177    plist.AddToList(&pedcam2);
     178    plist.AddToList(&pedcamab);
    156179    plist.AddToList(&chargecam);
    157180    plist.AddToList(&qecam);
    158181    plist.AddToList(&relcam);
    159182
     183    MCalibrationIntensityChargeCam  intenscharge;
     184    MCalibrationIntensityRelTimeCam intensreltime;
     185    MCalibrationIntensityQECam      intensqe;
     186    MCalibrationIntensityBlindCam   intensblind;
     187    MBadPixelsIntensityCam          intensbad;
     188
     189    MHCalibrationChargeCam      hchargecam;
     190    MHCalibrationChargeBlindCam hblindcam;
     191    MHCalibrationChargePINDiode hpindiode;
     192    MHCalibrationRelTimeCam     hrelcam;
     193
     194    //
     195    // Calibration Results containers
     196    //
     197    if (fInterlaced)
     198      {
     199        plist.AddToList(&intensqe);
     200        plist.AddToList(&intenscharge);
     201        plist.AddToList(&intensblind);
     202        //        plist.AddToList(&intensCalibrationPINDiode);
     203        plist.AddToList(&intensreltime);
     204        plist.AddToList(&intensbad);
     205
     206        hchargecam.SetLast(499.5);
     207        hchargecam.SetNbins(300);
     208
     209        hchargecam.SetLoGain(kFALSE);
     210        hrelcam.SetLoGain(kFALSE);
     211
     212        hchargecam.SetOscillations(kFALSE);
     213        hrelcam.SetOscillations(kFALSE);
     214
     215        plist.AddToList(&hchargecam);
     216        plist.AddToList(&hblindcam);
     217        plist.AddToList(&hrelcam);
     218        plist.AddToList(&hpindiode);
     219    }
     220
     221    MPedPhotCam pedphotcam;
     222    plist.AddToList(&pedphotcam);
     223
     224    MFillH fillhilo("MHCalibrationHiLoCam",      "MExtractedSignalCam",        "FillHiLoCam");
     225    fillhilo.SetBit(MFillH::kDoNotDisplay);
     226
     227    MCalibrationHiLoCam hilocam;
     228    plist.AddToList(&hilocam);
    160229    // Setup Tasklist
    161230    MTaskList tlist;
     
    181250      }
    182251
     252    // Check for interleaved events
     253    MTriggerPatternDecode decode;
     254
    183255    MGeomApply             apply; // Only necessary to create geometry
    184256    apply.SetGeometry(fGeometry);
    185257    MBadPixelsMerge        merge(&fBadPixels);
    186258
    187     MPedCalcFromLoGain     pedlo1("MPedCalcMeanFromLoGain");
     259    MPedestalCam pedcam;
     260
     261    pedcamab.SetName("MPedestalFundamental");
     262    pedcam2.SetName("MPedestalFromExtractorRndm");
     263    pedcam.SetName("MPedestalFromExtractor");
     264    plist.AddToList(&pedcam);
     265    plist.AddToList(&pedcam2);
     266    plist.AddToList(&pedcamab);
     267
     268    // Do signal and pedestal calculation
     269    MPedCalcFromLoGain     pedlo1("MPedCalcFundamental");
    188270    pedlo1.SetPedestalUpdate(kTRUE);
    189     pedlo1.SetPedestalsOut(&pedcamab);
    190 
    191     MPedCalcFromLoGain     pedlo2("MPedCalcRmsFromLoGain");
     271    pedlo1.SetNamePedestalCamOut("MPedestalFundamental");
     272
     273    MPedCalcFromLoGain     pedlo2("MPedCalcWithExtractorRndm");
    192274    pedlo2.SetPedestalUpdate(kTRUE);
    193     pedlo2.SetPedestalsIn(&pedcamab);
    194     pedlo2.SetPedestalsOut(&pedcamrms);
    195 
    196     if (fExtractor->InheritsFrom("MExtractTimeAndCharge"))
    197       pedlo2.SetExtractor((MExtractTimeAndCharge*)fExtractor);
     275    pedlo2.SetRandomCalculation(kTRUE);
     276    pedlo2.SetNamePedestalCamIn("MPedestalFundamental");
     277    pedlo2.SetNamePedestalCamOut("MPedestalFromExtractorRndm");
     278
     279    MPedCalcFromLoGain     pedlo3("MPedCalcWithExtractor");
     280    pedlo3.SetPedestalUpdate(kTRUE);
     281    pedlo3.SetRandomCalculation(kFALSE);
     282    pedlo3.SetNamePedestalCamIn("MPedestalFundamental");
     283    pedlo3.SetNamePedestalCamOut("MPedestalFromExtractor");
     284
     285    if (fExtractor)
     286    {
     287        fExtractor->SetPedestals(&pedcamab);
     288
     289        if (fExtractor->InheritsFrom("MExtractTimeAndCharge"))
     290        {
     291            pedlo2.SetExtractor((MExtractTimeAndCharge*)fExtractor);
     292            pedlo3.SetExtractor((MExtractTimeAndCharge*)fExtractor);
     293            pedlo1.SetExtractWindow(15, 0/*obsolete*/);
     294            pedlo2.SetExtractWindow(15, 0/*obsolete*/);
     295            pedlo3.SetExtractWindow(15, 0/*obsolete*/);
     296        }
     297        else
     298        {
     299            // FIXME: How to get the fixed value 15 automatically?
     300            const Int_t f = (Int_t)(15.5+fExtractor->GetHiGainFirst());
     301            const Int_t n = (Int_t)(15.5+fExtractor->GetNumHiGainSamples());
     302            pedlo1.SetExtractWindow(f, n);
     303            pedlo2.SetExtractWindow(f, n);
     304            pedlo3.SetExtractWindow(f, n);
     305        }
     306    }
    198307
    199308    MMcPedestalCopy        pcopy;
     
    205314        calib.SetCalibrationMode(MCalibrateData::kFfactor);
    206315        calib.SetPedestalFlag(MCalibrateData::kRun);
     316        calib.AddPedestal("MPedestalCam", "MPedPhotFundamental");
     317        calib.AddPedestal("MPedestalCam", "MPedPhotFromExtractor");
     318        calib.AddPedestal("MPedestalCam", "MPedPhotFromExtractorRndm");
    207319    }
    208320    else
    209321    {
    210         calib.AddPedestal("MPedestalCam", "MPedPhotFromExtractorRndm");
    211322        calib.AddPedestal("Fundamental");
     323        calib.AddPedestal("FromExtractor");
     324        calib.AddPedestal("FromExtractorRndm");
    212325        calib.SetPedestalFlag(MCalibrateData::kEvent);
    213     }
    214 
     326        calib.SetSignalType(MCalibrateData::kPhe);
     327    }
     328   
    215329    MCalibrateRelTimes     caltm;
    216330    MBadPixelsCalc         bpcal;
     
    225339    MHCamEvent evt6(2, "Unsuitable",  "Unsuitable event ratio;;%");
    226340    MHCamEvent evt7(0, "Times",       "Arrival Time;;T [slice]");
     341    MHCamEvent evt8(0, "HiLoConv",    "Ratio Hi-Lo Gain Signal;;Ratio [1]");
     342
    227343    evt0.EnableVariance();
    228344    evt1.EnableVariance();
     
    232348    evt5.EnableVariance();
    233349    evt7.EnableVariance();
    234 
    235     MFillH fill0(&evt0, &pedcamab,             "FillPedFLG");
    236     MFillH fill1(&evt1, "MPedestalCam",        "FillPedRmsFLG");
    237     MFillH fill2(&evt2, "MExtractedSignalCam", "FillExtracted");
    238     MFillH fill3(&evt3, "MPedPhotCam",         "FillPedPhot");
    239     MFillH fill4(&evt4, "MPedPhotCam",         "FillPedRMS");
    240     MFillH fill5(&evt5, "MCerPhotEvt",         "FillInterpolated");
     350    evt8.EnableVariance();
     351
     352    MFillH fill0(&evt0, "MPedestalFundamental",   "FillPedFLG");
     353    MFillH fill1(&evt1, "MPedestalFromExtractorRndm", "FillPedRmsFLG");
     354    MFillH fill2(&evt2, "MExtractedSignalCam",    "FillExtracted");
     355    MFillH fill3(&evt3, "MPedPhotFundamental",    "FillPedPhot");
     356    MFillH fill4(&evt4, "MPedPhotFromExtractorRndm","FillPedRMS");
     357    MFillH fill5(&evt5, "MCerPhotEvt",            "FillInterpolated");
    241358    MFillH fill6(&evt6, "MBadPixelsCam",       "FillUnsuitable");
    242359    MFillH fill7(&evt7, "MArrivalTime",        "FillTimes");
     360    MFillH fill8(&evt8, &hilocam,              "FillHiLo");
    243361
    244362    MWriteRootFile write(2, Form("%s{s/_D_/_Y_}", fPathOut.Data()), fOverwrite);
     
    288406    tlist2.AddToList(&apply);
    289407    tlist2.AddToList(&merge);
     408    tlist2.AddToList(&decode);
    290409    if (filetype==3)
    291410        tlist2.AddToList(&pcopy);
     
    295414        tlist2.AddToList(&pedlo2);
    296415    }
     416    MExtractPINDiode        pinext;
     417    MExtractBlindPixel      blindext;
     418
     419    MFTriggerPattern fcalib;
     420   
     421    MCalibrationChargeCalc  chargecalc;
     422    MCalibrationRelTimeCalc relcalc;
     423
     424    MCalibCalcFromPast      pastcalc;
     425
     426    pinext.SetPedestals(&pedcamab);
     427    blindext.SetPedestals(&pedcamab);
     428    chargecalc.SetPedestals(&pedcam2);
     429
     430    pastcalc.SetChargeCalc(&chargecalc);
     431    pastcalc.SetRelTimeCalc(&relcalc);
     432    pastcalc.SetCalibrate(&calib);
     433
    297434    tlist2.AddToList(&fill0);
    298435    tlist2.AddToList(&fill1);
    299436    tlist2.AddToList(&taskenv1);
    300437    tlist2.AddToList(&fill2);
     438    tlist2.AddToList(&pinext);
     439    tlist2.AddToList(&blindext);
     440    //
     441    // Calibration histogramming
     442    //
     443    MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode",   "FillPINDiode");
     444    MFillH fillbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel", "FillBlindCam");
     445    MFillH fillcam("MHCalibrationChargeCam",      "MExtractedSignalCam",        "FillChargeCam");
     446    MFillH filltme("MHCalibrationRelTimeCam",     "MArrivalTimeCam",            "FillRelTime");
     447    fillpin.SetBit(MFillH::kDoNotDisplay);
     448    fillbnd.SetBit(MFillH::kDoNotDisplay);
     449    fillcam.SetBit(MFillH::kDoNotDisplay);
     450    filltme.SetBit(MFillH::kDoNotDisplay);
     451
     452    //
     453    // Calibration Results containers
     454    //
     455    if (fInterlaced)
     456      {
     457        fcalib.DenyCalibration();
     458        fcalib.SetInverted();
     459
     460        chargecalc.SetFilter(&fcalib);
     461        pastcalc.SetFilter(  &fcalib);
     462        fillcam.SetFilter(&fcalib);
     463        filltme.SetFilter(&fcalib);
     464        fillbnd.SetFilter(&fcalib);
     465        fillpin.SetFilter(&fcalib);
     466
     467        tlist2.AddToList(&fcalib);
     468        tlist2.AddToList(&pastcalc);
     469        tlist2.AddToList(&fillcam);
     470        tlist2.AddToList(&filltme);
     471        tlist2.AddToList(&fillbnd);
     472        tlist2.AddToList(&fillpin);
     473        tlist2.AddToList(&chargecalc);
     474        tlist2.AddToList(&relcalc);
     475      }
     476   
    301477    tlist2.AddToList(&calib);
    302478    if (&relcam)
    303479      tlist2.AddToList(&caltm);
     480    tlist2.AddToList(&fillhilo);
    304481    tlist2.AddToList(&fill3);
    305482    tlist2.AddToList(&bpcal);
     
    309486    tlist2.AddToList(&fill6);
    310487    tlist2.AddToList(&fill7);
     488    tlist2.AddToList(&fill8);
    311489
    312490    // Setup List for Drive-tree
     
    316494    tlist.AddToList(IsDataCheck() ? (MTask*)&rawread : (MTask*)&readreal);
    317495    tlist.AddToList(&tlist2, IsDataCheck()?"All":"Events");
    318     if (!IsDataCheck())
    319         tlist.AddToList(&pcalc, "Drive");
     496
     497    //    if (!IsDataCheck())
     498    //        tlist.AddToList(&pcalc, "Drive");
     499
    320500    tlist.AddToList(&write);
    321501
     
    337517    tlist.PrintStatistics();
    338518
     519   
     520    if (fInterlaced)
     521      {
     522        TObjArray cont;
     523        cont.Add(&intensqe);
     524        cont.Add(&intenscharge);
     525        cont.Add(&intensblind);
     526        //        cont.Add(&intensCalibrationPINDiode);
     527        cont.Add(&intensreltime);
     528        cont.Add(&intensbad);
     529        WriteContainer(cont);
     530      }
     531
    339532    if (!WriteResult())
    340533        return kFALSE;
Note: See TracChangeset for help on using the changeset viewer.