Changeset 8360 for trunk


Ignore:
Timestamp:
03/04/07 11:23:03 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r8310 r8360  
    1818!   Author(s): Thomas Bretz, 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2007
    2121!
    2222!
     
    5353#include "MGeomCam.h"
    5454#include "MHCamEvent.h"
    55 //#include "MHCamEventTH.h"
    5655#include "MPedestalCam.h"
    5756#include "MBadPixelsCam.h"
     
    9190#include "MTriggerPatternDecode.h"
    9291#include "MFTriggerPattern.h"
     92#include "MFilterList.h"
    9393#include "MGeomApply.h"
    9494#include "MPedestalSubtract.h"
     
    9696#include "MPointingPosCalc.h"
    9797#include "MPedCalcFromLoGain.h"
     98#include "MPedestalSubtract.h"
    9899#include "MExtractor.h"
    99100#include "MExtractTimeAndCharge.h"
     
    261262    MHCalibrationRelTimeCam     hrelcam;
    262263    //MHCalibrationHiLoCam        hilocam;
    263     MHCalibrationPulseTimeCam   hpulcam;
     264    //MHCalibrationPulseTimeCam   hpulcam;
    264265
    265266    hchacam.SetOscillations(kFALSE);
     
    455456    pedlo3.SetNamePedestalCamOut("MPedestalFromExtractor");
    456457
    457     if (extractor1)
    458     {
    459         extractor1->SetPedestals(&pedcamab);
    460 
    461         // Setup to use the hi-gain extraction window in the lo-gain
    462         // range (the start of the lo-gain range is added automatically
    463         // by MPedCalcFromLoGain)
    464         //
    465         // The window size of the extractor is not yet initialized,
    466         // so we have to stick to the extraction range
    467         //
    468         // Even if we would like to use a range comparable to the
    469         // hi-gain extraction we use the lo-gain range to make
    470         // sure that exclusions (eg. due to switching noise)
    471         // are correctly handled.
    472         //
    473         const Int_t f = extractor1->GetLoGainFirst();
    474         const Int_t l = extractor1->GetLoGainLast();
    475         const Int_t w = (l-f+1);
    476         //const Int_t f = extractor1->GetHiGainFirst();
    477         //const Int_t l = extractor1->GetHiGainLast();
    478         //const Int_t w = (l-f+1)&~1;
    479 
    480         pedlo1.SetExtractWindow(f, w);
    481 
    482         if (extractor1->InheritsFrom("MExtractTimeAndCharge"))
    483         {
    484             pedlo2.SetExtractor((MExtractTimeAndCharge*)extractor1);
    485             pedlo3.SetExtractor((MExtractTimeAndCharge*)extractor1);
    486             /*
    487             const Int_t win = ((MExtractTimeAndCharge*)extractor1)->GetWindowSizeHiGain();
    488             pedlo1.SetExtractWindow(15, win);
    489             pedlo2.SetExtractWindow(15, win//obsolete//);
    490             pedlo3.SetExtractWindow(15, win//obsolete//);
    491             */
    492         }
    493         else
    494         {
    495             /*
    496             // FIXME: How to get the fixed value 15 automatically?
    497             const Int_t f = (Int_t)(15.5+extractor1->GetHiGainFirst());
    498             const Int_t n = (Int_t)(15.5+extractor1->GetNumHiGainSamples());
    499             pedlo1.SetExtractWindow(f, n);
    500             pedlo2.SetExtractWindow(f, n);
    501             pedlo3.SetExtractWindow(f, n);
    502             */
    503             pedlo2.SetExtractWindow(f, w);
    504             pedlo3.SetExtractWindow(f, w);
    505 
    506         }
    507     }
     458    if (!extractor1)
     459    {
     460        *fLog << err << "ERROR - extractor1 == NULL" << endl;
     461        return kFALSE;
     462    }
     463
     464    extractor1->SetPedestals(&pedcamab);
     465
     466    // Setup to use the hi-gain extraction window in the lo-gain
     467    // range (the start of the lo-gain range is added automatically
     468    // by MPedCalcFromLoGain)
     469    //
     470    // The window size of the extractor is not yet initialized,
     471    // so we have to stick to the extraction range
     472    //
     473    // Even if we would like to use a range comparable to the
     474    // hi-gain extraction we use the lo-gain range to make
     475    // sure that exclusions (eg. due to switching noise)
     476    // are correctly handled.
     477    //
     478    pedlo1.SetRangeFromExtractor(*extractor1);
     479
     480    if (extractor1->InheritsFrom("MExtractTimeAndCharge"))
     481    {
     482        pedlo2.SetExtractor((MExtractTimeAndCharge*)extractor1);
     483        pedlo3.SetExtractor((MExtractTimeAndCharge*)extractor1);
     484    }
     485    else
     486    {
     487        pedlo2.SetRangeFromExtractor(*extractor1);
     488        pedlo3.SetRangeFromExtractor(*extractor1);
     489    }
     490
    508491    if (extractor2)
    509       extractor2->SetPedestals(&pedcamab);
     492        extractor2->SetPedestals(&pedcamab);
    510493
    511494    if (extractor3)
    512       extractor3->SetPedestals(&pedcamab);
     495        extractor3->SetPedestals(&pedcamab);
     496
     497    //------------------------------
     498    MFTriggerPattern ftp2;
     499    ftp2.SetDefault(kTRUE);
     500    ftp2.DenyCalibration();
     501    if (!extractor1->HasLoGain())
     502        ftp2.RequirePedestal();
     503
     504    pedlo1.SetFilter(&ftp2);
     505    pedlo2.SetFilter(&ftp2);
     506    pedlo3.SetFilter(&ftp2);
     507
     508    MContinue contftp2(&ftp2, "ContPedestal");
     509    //------------------------------
    513510
    514511    MFCosmics fcosmics;
     
    525522    taskenv3.SetDefault(extractor3);
    526523
    527     //
     524    MFilterList flistftp2("PedestalFilter");
     525    flistftp2.SetInverted();
     526    flistftp2.AddToList(&ftp2);
     527
     528    if (!extractor1->HasLoGain())
     529    {
     530        taskenv1.SetFilter(&flistftp2);
     531        taskenv2.SetFilter(&flistftp2);
     532        taskenv3.SetFilter(&flistftp2);
     533    }
     534
     535    //
    528536    // This is new calibration to photo-electrons, hard-coded
    529537    // as decided at the Wuerzburg software meeting 26.01.05
     
    531539    MCalibrateData calib;
    532540    calib.SetSignalType(MCalibrateData::kPhe);
    533     calib.AddPedestal("Fundamental");
     541    //calib.AddPedestal("Fundamental");
    534542    calib.AddPedestal("FromExtractor");
    535543    calib.AddPedestal("FromExtractorRndm");
     
    567575    MFillH filtme(&hrelcam, "MArrivalTimeCam",            "FillRelTime");
    568576    //MFillH filhil(&hilocam, "MExtractedSignalCam",        "FillHiLoRatio");
    569     MFillH filpul(&hpulcam, "MRawEvtData",                "FillPulseTime");
     577    //MFillH filpul(&hpulcam, "MRawEvtData",                "FillPulseTime");
    570578    filpin.SetBit(MFillH::kDoNotDisplay);
    571579    filbnd.SetBit(MFillH::kDoNotDisplay);
     
    573581    filtme.SetBit(MFillH::kDoNotDisplay);
    574582    //filhil.SetBit(MFillH::kDoNotDisplay);
    575     filpul.SetBit(MFillH::kDoNotDisplay);
     583    //filpul.SetBit(MFillH::kDoNotDisplay);
    576584
    577585    MCalibrateRelTimes caltm;
     
    579587    MBadPixelsTreat    treat;
    580588
    581     bpcal.SetNamePedPhotCam("MPedPhotFromExtractor");
    582     treat.AddNamePedPhotCam("MPedPhotFundamental");
     589    //bpcal.SetNamePedPhotCam("MPedPhotFromExtractor");
     590    bpcal.SetNamePedPhotCam("MPedPhotFromExtractorRndm");
     591
     592    //treat.AddNamePedPhotCam("MPedPhotFundamental");
    583593    treat.AddNamePedPhotCam("MPedPhotFromExtractor");
    584594    treat.AddNamePedPhotCam("MPedPhotFromExtractorRndm");
     
    677687    tlist2.AddToList(&merge);
    678688    tlist2.AddToList(&pedsub);
     689    tlist2.AddToList(&ftp2);
    679690    tlist2.AddToList(&pedlo1);
    680691    tlist2.AddToList(&pedlo2);
    681692    tlist2.AddToList(&pedlo3);
     693
    682694    //-----------------------------------------------------------
    683695
     
    709721
    710722    // Continue for all non-cosmic events
    711     tlist2.AddToList(&conttp);
     723    tlist2.AddToList(&fill0);        // fill pedestal events
     724    tlist2.AddToList(&fill1);        // fill pedestal events
     725    if (!extractor1->HasLoGain())
     726        tlist2.AddToList(&contftp2); // remove pedestal events from processing
     727    tlist2.AddToList(&conttp);       // remove calib events from processing
    712728    if (extractor1)
    713729      tlist2.AddToList(&taskenv1);
    714730    if (extractor2)
    715731      tlist2.AddToList(&taskenv2);
    716     tlist2.AddToList(&fill0);
    717     tlist2.AddToList(&fill1);
    718732    tlist2.AddToList(&contcos);
    719733    /*
     
    723737        tlist2.AddToList(&filhil);
    724738        }
    725         */
     739
    726740    if (fIsPulsePosCheck)
    727741    {
     
    729743        tlist2.AddToList(&filpul);
    730744    }
    731 
     745    */
    732746    tlist2.AddToList(&fill2);
    733747    tlist2.AddToList(&calib);
     
    745759    //    tlist2.AddToList(&fill7);
    746760    tlist2.AddToList(&fill9);
    747     tlist2.AddToList(&fillR);
    748     tlist2.AddToList(&fillO);
    749 
     761    if (extractor1->HasLoGain())
     762    {
     763        tlist2.AddToList(&fillR);
     764        tlist2.AddToList(&fillO);
     765    }
    750766    tlist2.AddToList(&fillflorian);
    751767
     
    800816    DisplayResult(plist);
    801817
     818    /*
    802819    if (fIsPixelCheck)
    803820      {
     
    808825        //    hilocam[fCheckedPixId].DrawClone("");
    809826      }
    810 
     827    */
    811828    interlacedcont.Add(&pulcam);
    812829
     
    814831    //  interlacedcont.Add(&hilcam);
    815832
    816     if (fIsPulsePosCheck)
    817         interlacedcont.Add(plist.FindObject("MHCalibrationPulseTimeCam"));
     833    //if (fIsPulsePosCheck)
     834    //    interlacedcont.Add(plist.FindObject("MHCalibrationPulseTimeCam"));
    818835
    819836    //if (fIsHiLoCalibration)
Note: See TracChangeset for help on using the changeset viewer.