Changeset 7555 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
03/01/06 17:29:22 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7554 r7555  
    5252     - updated how the units are printed in Print()
    5353
     54   * mjobs/MJCut.cc:
     55     - added a new loop to fill the source position of the on-data
     56     - the acceleration of the two main loops are disabled because
     57       they are not yet tested.
    5458
    5559
  • trunk/MagicSoft/Mars/mjobs/MJCut.cc

    r7517 r7555  
    8686    : fStoreSummary(kFALSE), fStoreResult(kTRUE), fWriteOnly(kFALSE),
    8787    fIsWobble(kFALSE), fIsMonteCarlo(kFALSE),  fFullDisplay(kTRUE),
    88     fNameHist("MHThetaSq"), fCalcHadronness(0), fCalcDisp(0)
     88    fRndmSrcPos(kFALSE), fNameHist("MHThetaSq"), fCalcHadronness(0), fCalcDisp(0)
    8989{
    9090    fName  = name  ? name  : "MJCut";
     
    323323    EnableMonteCarloMode(GetEnv("MonteCarlo", fIsMonteCarlo));
    324324    EnableFullDisplay(GetEnv("FullDisplay", fFullDisplay));
     325    EnableRandomSrcPos(GetEnv("RandomSourcePosition", fRndmSrcPos));
    325326    //EnableSubstraction(GetEnv("HistogramSubstraction", fSubstraction));
    326327
     
    426427}
    427428
     429Bool_t MJCut::FillSrcPosCam(const MDataSet &set, MPointingPos &source)
     430{
     431    *fLog << inf;
     432    fLog->Separator(GetDescriptor());
     433    *fLog << "Filling MHSrcPosCam " << set.GetName() << endl;
     434    *fLog << endl;
     435
     436    // --------------------------------------------------------------------------------
     437
     438    // Setup Parlist
     439    MParList plist;
     440    plist.AddToList(this); // take care of fDisplay!
     441
     442    // Setup Tasklist
     443    MTaskList tlist;
     444    plist.AddToList(&tlist);
     445
     446    // La Palma Magic1, Possible source position
     447    MObservatory obs;
     448    plist.AddToList(&obs);
     449    plist.AddToList(&source);
     450
     451    // Initialize default binnings
     452    // MBinning bins1(18,  0,     90,    "BinningSrcPosCam", "lin");
     453    // plist.AddToList(&bins1);
     454
     455    // ------------- Loop Off Data --------------------
     456    MReadReports read;
     457
     458    read.EnableAutoScheme();
     459    read.AddToBranchList("MTimeEffectiveOnTime.*");
     460    read.AddToBranchList("MEffectiveOnTime.*");
     461
     462    read.AddTree("Events", "MTime.", MReadReports::kMaster);
     463    read.AddTree("Drive",            MReadReports::kRequired);
     464    read.AddTree("Starguider",       MReadReports::kRequired);
     465    read.AddTree("EffectiveOnTime");
     466
     467    set.AddFilesOn(read);
     468
     469    MFillH fill("MHSrcPosCam", "MSrcPosCam", "FillSrcPosCam");
     470    fill.SetNameTab("SrcPos");
     471
     472    // How to get source position from off- and on-data?
     473    MSrcPosCorrect scor;
     474    MSrcPosCalc scalc;
     475    scalc.SetMode(MSrcPosCalc::kDefault);
     476
     477    MPointingDevCalc devcalc;
     478
     479    tlist.AddToList(&read);
     480    tlist.AddToList(&devcalc, "Starguider");
     481    tlist.AddToList(&scalc,   "Events");
     482    tlist.AddToList(&scor,    "Events");
     483    tlist.AddToList(&fill,    "Events");
     484
     485    // by setting it here it is distributed to all consecutive tasks
     486    tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
     487    read.SetAccelerator();//MTask::kAccDontReset|MTask::kAccDontCount);
     488
     489    // Create and setup the eventloop
     490    MEvtLoop evtloop(fName);
     491    evtloop.SetParList(&plist);
     492    evtloop.SetDisplay(fDisplay);
     493    evtloop.SetLogStream(fLog);
     494    if (!SetupEnv(evtloop))
     495        return kFALSE;
     496
     497    // Execute first analysis
     498    if (!evtloop.Eventloop(fMaxEvents))
     499    {
     500        *fLog << err << GetDescriptor() << ": Processing of on-sequences failed." << endl;
     501        return kFALSE;
     502    }
     503
     504    if (!evtloop.GetDisplay())
     505    {
     506        *fLog << err << GetDescriptor() << ": Execution stopped by user." << endl;
     507        return kFALSE;
     508    }
     509
     510    *fLog << all << GetDescriptor() << ": Done." << endl;
     511    *fLog << endl << endl;
     512
     513    return kTRUE;
     514}
     515
    428516Bool_t MJCut::Process(const MDataSet &set)
    429517{
     
    435523
    436524    CheckEnv();
     525
     526    // --------------------------------------------------------------------------------
     527
     528    // Possible source position (eg. Wobble Mode)
     529    MPointingPos source("MSourcePos");
     530    if (set.HasSource())
     531    {
     532        if (!set.GetSourcePos(source))
     533            return kFALSE;
     534        *fLog << all;
     535        source.Print("RaDec");
     536    }
     537    else
     538        *fLog << all << "No source position applied..." << endl;
     539
     540    if (!fIsWobble && source.IsInitialized() && fRndmSrcPos)
     541        if (!FillSrcPosCam(set, source))
     542            return kFALSE;
    437543
    438544    // --------------------------------------------------------------------------------
     
    460566    plist.AddToList(&obs);
    461567
    462     // Possible source position (eg. Wobble Mode)
    463     MPointingPos source("MSourcePos");
    464     if (set.HasSource())
    465     {
    466         if (!set.GetSourcePos(source))
    467             return kFALSE;
     568    if (source.IsInitialized())
    468569        plist.AddToList(&source);
    469         *fLog << all;
    470         source.Print("RaDec");
    471     }
    472     else
    473         *fLog << inf << "No source position applied..." << endl;
    474570
    475571    // Initialize default binnings
     
    546642    SetupWriter(write1, "WriteAfterCut3");
    547643
    548 /*
    549     MEnergyEstimate est;
    550 
    551     MTaskEnv taskenv1("EstimateEnergy");
    552     taskenv1.SetDefault(fEstimateEnergy ? fEstimateEnergy : &est);
    553   */
    554644    MTaskEnv taskenv2("CalcHadronness");
    555645    taskenv2.SetDefault(fCalcHadronness);
     
    632722    tlist.AddToList(&devcalc, "Starguider");
    633723    tlist.AddToList(&tlist2,  "Events");
     724
     725    // by setting it here it is distributed to all consecutive tasks
     726    //tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
    634727 
    635728    par.SetVal(0);
     
    795888    }
    796889
     890    // by setting it here it is distributed to all consecutive tasks
     891    //tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
     892
    797893    par.SetVal(1);
    798894
  • trunk/MagicSoft/Mars/mjobs/MJCut.h

    r7413 r7555  
    1212class MH;
    1313class MWriteRootFile;
     14class MPointingPos;
    1415
    1516class MJCut : public MJob
     
    2223    Bool_t  fIsMonteCarlo;
    2324    Bool_t  fFullDisplay;
     25    Bool_t  fRndmSrcPos;
    2426    //Bool_t  fSubstraction;
    2527
     
    3234
    3335    //MTask *fEstimateEnergy;
    34     MTask *fCalcHadronness;
    35     MTask *fCalcDisp;
     36    MTask  *fCalcHadronness;
     37    MTask  *fCalcDisp;
    3638
    3739    TString  GetOutputFile(UInt_t num) const;
     
    4547    Bool_t   CanStoreSummary() const { return !fPathOut.IsNull() && fStoreSummary; }
    4648    Bool_t   CanStoreResult() const  { return !fPathOut.IsNull() && fStoreResult;  }
     49
     50    Bool_t   FillSrcPosCam(const MDataSet &set, MPointingPos &source);
    4751
    4852public:
     
    5862    void EnableMonteCarloMode(Bool_t b=kTRUE)    { fIsMonteCarlo = b; }
    5963    void EnableFullDisplay(Bool_t b=kTRUE)       { fFullDisplay  = b; }
     64    void EnableRandomSrcPos(Bool_t b=kTRUE)      { fRndmSrcPos   = b; }
    6065    //void EnableSubstraction(Bool_t b=kTRUE)      { fSubstraction = b; }
    6166
Note: See TracChangeset for help on using the changeset viewer.