Ignore:
Timestamp:
11/12/08 16:16:11 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
3 edited

Legend:

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

    r9143 r9157  
    7777#include "MReadMarsFile.h"
    7878#include "MRawFileRead.h"
    79 #include "MRawEvtData.h"
    8079#include "MGeomApply.h"
     80#include "MContinue.h"
    8181#include "MPedestalSubtract.h"
    8282#include "MTriggerPatternDecode.h"
     
    8585#include "MPedCalcPedRun.h"
    8686#include "MPedCalcFromLoGain.h"
    87 #include "MFTriggerPattern.h"
    8887#include "MBadPixelsCalc.h"
    8988#include "MPedestalSubtract.h"
     89
     90// filter
     91#include "MFilterList.h"
     92#include "MFTriggerPattern.h"
     93#include "MFDataMember.h"
    9094
    9195// Display helpers
     
    114118    : fExtractor(NULL), fDisplayType(kDisplayDataCheck),
    115119    fExtractType(kUsePedRun), fExtractionType(kFundamental),
    116     /*fIsUseHists(kFALSE),*/ fDeadPixelCheck(kFALSE), fMinEvents(50)
     120    /*fIsUseHists(kFALSE),*/ fDeadPixelCheck(kFALSE), fMinEvents(50),
     121    fMinPedestals(100), fMaxPedestals(0), fMinCosmics(25), fMaxCosmics(100)
    117122{
    118123    fName  = name  ? name  : "MJPedestal";
     
    682687    fMinEvents = (UInt_t)GetEnv("MinEvents", (Int_t)fMinEvents);
    683688
     689    fMinPedestals = (UInt_t)GetEnv("MinPedestals", (Int_t)fMinPedestals);
     690    fMaxPedestals = (UInt_t)GetEnv("MaxPedestals", (Int_t)fMaxPedestals);
     691
     692    fMinCosmics   = (UInt_t)GetEnv("MinCosmics", (Int_t)fMinCosmics);
     693    fMaxCosmics   = (UInt_t)GetEnv("MaxCosmics", (Int_t)fMaxCosmics);
     694
    684695    if (!MJCalib::CheckEnvLocal())
    685696        return kFALSE;
     
    10221033    }
    10231034
    1024     // This will make that for data with version less than 5, where
    1025     // trigger patterns were not yet correct, all the events in the real
    1026     // data file will be processed. In any case there are no interleaved
    1027     // calibration events in such data, so this is fine.
    1028     // The selection is done with the trigger bits before prescaling
    1029     // Extract pulse position from Lvl1 events.
    10301035    MTriggerPatternDecode decode;
    1031     MFTriggerPattern fcalib("SelectCosmics");
    1032     fcalib.SetDefault(kTRUE);
    1033     fcalib.DenyAll();
    1034     fcalib.RequireTriggerLvl1();
    1035     fcalib.AllowTriggerLvl2();
    1036     fcalib.AllowSumTrigger();
    1037 
    10381036    tlist.AddToList(&decode);
    10391037
     
    10461044    tlist.AddToList(&pedsub);
    10471045
     1046    // ----------------------------------------------------------------
     1047    //  Setup filter for pulse position extraction and its extraction
     1048
     1049    // This will make that for data with version less than 5, where
     1050    // trigger patterns were not yet correct, all the events in the real
     1051    // data file will be processed. In any case there are no interleaved
     1052    // calibration events in such data, so this is fine.
     1053    // The selection is done with the trigger bits before prescaling
     1054    // Extract pulse position from Lvl1 events.
     1055    MFTriggerPattern fcos("SelectCosmics");
     1056    fcos.SetDefault(kTRUE);
     1057    fcos.DenyAll();
     1058    fcos.RequireTriggerLvl1();
     1059    fcos.AllowTriggerLvl2();
     1060    fcos.AllowSumTrigger();
     1061
     1062    // Number of events filled into the histogram presenting the
     1063    // trigger area
     1064    MFDataMember filterc("MHCalibrationPulseTimeCam.GetNumEvents", '<', fMaxCosmics, "LimitNumCosmics");
     1065
     1066    // Combine both filters
     1067    MFilterList flistc("&&", "FilterCosmics");
     1068    flistc.AddToList(&fcos);
     1069
     1070    // For the case the pulse positon check is switched on
     1071    // compile the tasklist accordingly
    10481072    // FIXME: MUX Monte Carlos?!??
    10491073    if (fIsPulsePosCheck)
    10501074    {
    1051         fillpul.SetFilter(&fcalib);
    1052         tlist.AddToList(&fcalib);
     1075        flistc.AddToList(&filterc);
     1076        fillpul.SetFilter(&flistc);
     1077
     1078        tlist.AddToList(&flistc);
    10531079        tlist.AddToList(&fillpul);
    10541080    }
     
    10591085    //    tlist.AddToList(&fillC);
    10601086
    1061     // ----------------------------------------------------------------------
    1062     //   Now we make sure, that in all cases the ranges are setup correctly
    1063     // ----------------------------------------------------------------------
    1064     MTaskEnv taskenv("ExtractPedestal");
    1065 
    1066     //------------------------------
    1067     // Require that before the Prescaling we had only a pedestal trigger
     1087    // ------------------------------------------------------------
     1088    //  Setup filter for pedestal extraction
    10681089    MFTriggerPattern ftp2("SelectPedestals");
    10691090    ftp2.SetDefault(kTRUE);
     
    10711092    ftp2.RequirePedestal();
    10721093
    1073     // FIXME: WHAT D WE DO IN CASE OF MUX MCs????
    1074     if (!fSequence.IsMonteCarlo() && (!fExtractor || !fExtractor->HasLoGain()))
    1075     {
    1076         taskenv.SetFilter(&ftp2);
    1077         tlist.AddToList(&ftp2);
    1078     }
    1079     //------------------------------
    1080 
    1081     switch (fExtractType)
    1082     {
    1083     case kUsePedRun:
    1084         // In case  other than 'fundamental' second argument is obsolete
    1085         // pedcalc.SetExtractWindow(0,14);  // kUsePedRun (take default from class)
    1086         taskenv.SetDefault(&pedcalc);
    1087         tlist.AddToList(&taskenv);
    1088         break;
    1089 
    1090     case kUseData:
    1091         // In case  other than 'fundamental' second argument is obsolete
    1092         // pedlogain.SetExtractWindow(15,14); // kUseData (take default from class)
    1093         taskenv.SetDefault(&pedlogain);
    1094         tlist.AddToList(&taskenv);
    1095         break;
    1096     }
     1094    // Limit number of events from which a pedestal is extracted
     1095    MFDataMember filterp(Form("%s.fNumEvents", fPedestalCamOut.GetName()), '<', fMaxPedestals, "LimitNumPedestal");
     1096
     1097    // Combine both filters together
     1098    MFilterList flistp("&&", "FilterPedestal");
     1099    // If data is not MC and has no lo-gains select pedestals from trigger pattern
     1100    if (!fSequence.IsMonteCarlo() && !(fExtractor && fExtractor->HasLoGain()))
     1101        flistp.AddToList(&ftp2);
     1102    if (fMaxPedestals>0)
     1103        flistp.AddToList(&filterp);
     1104
     1105    // ------------------------------------------------------------
     1106    //  Setup pedestal extraction
     1107    MTaskEnv taskenv("ExtractPedestal");
     1108
     1109    taskenv.SetDefault(fExtractType==kUsePedRun ?
     1110                       static_cast<MTask*>(&pedcalc) :
     1111                       static_cast<MTask*>(&pedlogain));
     1112
     1113    taskenv.SetFilter(&flistp);
     1114    tlist.AddToList(&flistp);
     1115    tlist.AddToList(&taskenv);
     1116
     1117    // ------------------------------------------------------------
     1118    //  Setup a filter which defines when the loop is stopped
     1119    MFilterList flist("||");
     1120    flist.SetInverted();
     1121    if (fMaxPedestals>0)
     1122        flist.AddToList(&filterp);
     1123    if (fIsPulsePosCheck && fMaxCosmics>0)
     1124        flist.AddToList(&filterc);
     1125
     1126    MContinue stop(&flist, "Stop");
     1127    stop.SetRc(kFALSE);
     1128    if (flist.GetNumEntries()>0)
     1129        tlist.AddToList(&stop);
     1130
    10971131/*
    10981132    if (fIsUseHists && fExtractor)
     
    11861220    }
    11871221
     1222    if (fIsPulsePosCheck && pulcam.GetNumEvents()<fMinCosmics)
     1223    {
     1224        *fLog << err << GetDescriptor() << ": Failed. Less than the required " << fMinCosmics << " cosmics evts processed." << endl;
     1225        return kFALSE;
     1226    }
     1227
     1228    if (fPedestalCamOut.GetNumEvents()<fMinPedestals)
     1229    {
     1230        *fLog << err << GetDescriptor() << ": Failed. Less than the required " << fMinPedestals << " pedetsl evts processed." << endl;
     1231        return kFALSE;
     1232    }
     1233
    11881234    if (fDeadPixelCheck)
    11891235    {
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r8990 r9157  
    7575
    7676    UInt_t  fMinEvents;                      // Minimum number of events
     77    UInt_t  fMinPedestals;                   // Minimum number of events
     78    UInt_t  fMaxPedestals;                   // Maximum number of events for pedestal extraction
     79    UInt_t  fMinCosmics;                     // Minimum number of events
     80    UInt_t  fMaxCosmics;                     // Maximum number of events for pulse    extraction
    7781
    7882    MExtractor *ReadCalibration();
  • trunk/MagicSoft/Mars/mjobs/MJStar.cc

    r9028 r9157  
    411411    MFillH fillsp("MHSrcPosCam", "MSrcPosCam", "FillSrcPosCam");
    412412    fillsp.SetNameTab("Src");
    413     tlist2.AddToList(&fillsp);
     413    if (fSequence.IsMonteCarlo())
     414        tlist2.AddToList(&fillsp);
    414415
    415416
Note: See TracChangeset for help on using the changeset viewer.