Changeset 7115


Ignore:
Timestamp:
05/31/05 11:53:09 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7112 r7115  
    2121
    2222                                                 -*-*- END OF LINE -*-*-
     23 2005/05/31 Thomas Bretz
     24
     25   * mfileio/MReadReports.[h,cc]:
     26     - changed such that it can force prereading of the first event of
     27       a sequence after PreProcess
     28
     29   * mfileio/MReadTree.h:
     30     - added some comment about the new bits used in MReadReports
     31
     32   * mhflux/MHDisp.cc:
     33     - changed fit limit from 1.1 to 1.0
     34     - fixed access to wrong axis
     35
     36   * mhflux/MHEffectiveOnTime.cc:
     37     - fixed a bug which caused the first bin of the histograms
     38       vs time to disapear in PostProcess, which gave wrong results
     39       on the screen. The output and all following programs not
     40       directly accessing the histograms haven't been affected
     41
     42   * mjobs/MJCalib.cc:
     43     - HasEnv for boolean type resources is obsolete and has been
     44       removed
     45
     46   * mjobs/MJCalibrateSignal.cc:
     47     - removed MPointingPosInterpolate
     48     - adapted usage of MReadReports to changes
     49
     50   * mjobs/MJCut.cc, mjobs/MJStar.cc:
     51     - adapted usage of MReadReports to changes
     52     - made Drive-tree a 'required' tree
     53
     54   * mjobs/MJStar.cc:
     55     - removed "Events" from setting up rate and effective on time
     56       tasks to tlist2. It is obsolete because calibration events
     57       don't enter star at all.
     58
     59   * mpointing/MPointingPosCalc.[h,cc]:
     60     - assume that the run-type is real-data if Process is called before
     61       ReInit
     62
    2363
    2464
  • trunk/MagicSoft/Mars/NEWS

    r7100 r7115  
    55   - general: MMcEvt now derived from MMcEvtBasic which should
    66     have no influence on compatibility with older camera files
     7
     8   - general: Implemented a new option to MReadReports which allows
     9     to force reading of the first event of some trees (eg. Drive-tree)
     10     before any other tree.
     11
     12   - general: Made a fix to MPointingPosCalc which assumes that the
     13     run-type is real-data if Process is called before ReInit, such
     14     that also the very first Drive-events in a run are treated
     15     correctly.
    716
    817   - callisto: changed default of fgFallTimeHiGain in
     
    1827     Wrongly the calibration_UV weights were used instead
    1928     of the cosmics weights set in callisto.rc.
     29
     30   - star: fixed a bug which caused the first bin of the histograms
     31     vs time to disapear in PostProcess. This gave wrong results
     32     on the screen. The output and all following programs not
     33     directly accessing the histograms haven't been affected
     34
     35   - star, ganymed: Made sure that always the first Drive-tree event
     36     is read and Processed before the first data event was read.
     37
     38   - ganymed: implemented the possibility to replace the standard
     39     false source plot with a different one. For example: If
     40     you want to use a Disp based FS plot use the resource:
     41       NameHistFS: MHDisp
     42     For details about the requirements of these plots look
     43     at the corresponding classes
    2044
    2145   - sponde: The input MC spectrum can now be weighted to fake a
     
    3155
    3256
    33  *** Version 0.9.2
     57 *** Version 0.9.2 (2005/05/20)
    3458
    3559   - general: Changed the default paths for calibrated data and image
  • trunk/MagicSoft/Mars/mfileio/MReadReports.cc

    r6499 r7115  
    165165// To be done: A flag(?) telling whether the headers can be skipped.
    166166//
    167 void MReadReports::AddTree(const char *tree, const char *time, Bool_t master)
     167void MReadReports::AddTree(const char *tree, const char *time, Type_t master)
    168168{
    169169    /*
     
    176176    */
    177177
    178     if (master && TestBit(kHasMaster))
     178    if (master==kMaster && TestBit(kHasMaster))
    179179    {
    180180        *fLog << warn << GetDescriptor() << " already has a master tree... ignored." << endl;
    181         master = kFALSE;
    182     }
    183 
    184     MReadTree *t = master ? new MReadMarsFile(tree) : new MReadTree(tree);
     181        master = kStandard;
     182    }
     183
     184    MReadTree *t = master==kMaster ? new MReadMarsFile(tree) : new MReadTree(tree);
    185185    t->SetName(tree);
    186186    t->SetTitle(time?time:"");
    187     if (master)
     187    if (master==kMaster)
    188188        SetBit(kHasMaster);
     189    if (master==kRequired)
     190        t->SetBit(kIsRequired);
    189191
    190192    if (!fEnableAutoScheme)
     
    219221
    220222    return n;
     223}
     224
     225// --------------------------------------------------------------------------
     226//
     227// Count the number of required trees and store the number if fNumRequired.
     228// Reset the kIsProcessed bit.
     229//
     230void MReadReports::ForceRequired()
     231{
     232    fNumRequired = 0;
     233
     234    TIter Next(fTrees->GetList());
     235    TObject *o=0;
     236    while ((o=Next()))
     237        if (o->TestBit(kIsRequired))
     238        {
     239            o->ResetBit(kIsProcessed);
     240            fNumRequired++;
     241        }
     242
     243    *fLog << dbg << "Number of required trees: " << fNumRequired << endl;
    221244}
    222245
     
    297320    fPosEntry.Set(i);
    298321
     322    // Force that with the next call to Process the required events are read
     323    ForceRequired();
     324    //fFirstReInit=kTRUE;
     325
     326    // Preprocess all tasks in fTrees
    299327    return fTrees->CallPreProcess(plist);
     328}
     329
     330// --------------------------------------------------------------------------
     331//
     332// If this is not the first ReInit after PreProcess force the required
     333// trees to be read first (call FirstRequired())
     334//
     335/*
     336Bool_t MReadReports::ReInit(MParList *plist)
     337{
     338    if (!fFirstReInit)
     339        ForceRequired();
     340    fFirstReInit=kFALSE;
     341    return kTRUE;
     342}
     343*/
     344
     345// --------------------------------------------------------------------------
     346//
     347// Return the number of the tree which is the next one to be read.
     348// The condition for this decision is the time-stamp.
     349//
     350Int_t MReadReports::FindNextTime()
     351{
     352    TIter NextC(fChains);
     353    TChain *c=0;
     354
     355    Int_t nmin=0;
     356    MTime tmin(**GetTime((TChain*)NextC()));
     357
     358    Int_t i=0;
     359
     360    while ((c=(TChain*)NextC()))
     361    {
     362        MTime &t = **GetTime(c);
     363        i++;
     364
     365        if (t >= tmin)
     366            continue;
     367
     368        tmin = t;
     369        nmin = i;
     370    }
     371    return nmin;
     372}
     373
     374// --------------------------------------------------------------------------
     375//
     376// Return the number of the tree which is the next one to be read.
     377// The condition for this decision kIsRequired but not kIsProcessed is set.
     378//
     379Int_t MReadReports::FindNextRequired()
     380{
     381    Int_t n = 0;
     382
     383    TIter Next(fTrees->GetList());
     384    TObject *o=0;
     385    while ((o=Next()))
     386    {
     387        if (o->TestBit(kIsRequired) && !o->TestBit(kIsProcessed))
     388        {
     389            o->SetBit(kIsProcessed);
     390            fNumRequired--;
     391            *fLog << dbg << "Reading from tree " << n << " " << o->GetName() << endl;
     392            return n;
     393        }
     394        n++;
     395    }
     396
     397    return -1;
    300398}
    301399
     
    312410// --------------------------------------------------------------------------
    313411//
    314 // Do not use if fChains->GetSize()==0 !!!
    315 //
    316 Int_t MReadReports::FindNextTime()
    317 {
    318     Int_t i=0;
    319 
    320     TIter NextC(fChains);
    321     TChain *c=0;
    322 
    323     Int_t nmin=0;
    324     MTime tmin(**GetTime((TChain*)NextC()));
    325 
    326     while ((c=(TChain*)NextC()))
    327     {
    328         MTime &t = **GetTime(c);
    329         i++;
    330 
    331         if (t >= tmin)
    332             continue;
    333 
    334         tmin = t;
    335         nmin = i;
    336     }
    337     return nmin;
    338 }
    339 
    340 /*
    341 Bool_t MReadReports::Notify()
    342 {
    343     Bool_t same = kTRUE;
    344     for (int i=1; i<fPosTree.GetSize(); i++)
    345         if (fPosTree[i]!=fPosTree[0])
    346         {
    347             same = kFALSE;
    348             break;
    349         }
    350 
    351     Int_t tn = chain->GetTreeNumber();
    352 
    353     Bool_t read=kFALSE;
    354     if (fPosTree[nmin] != tn)
    355     {
    356         fPosTree[nmin] = tn;
    357         read = kTRUE;
    358     }
    359 
    360     if (!same || !read)
    361         return kTRUE;
    362 
    363 
    364     *fLog << dbg << "Read Run Headers!" << endl;
    365 
    366     return kTRUE;
    367 }
    368 */
    369 
    370 // --------------------------------------------------------------------------
    371 //
    372412// Check which is the next tree to read from. Read an event from this tree.
    373413// Sets the StreamId accordingly.
     
    377417    while (fChains->GetSize())
    378418    {
    379         const Int_t nmin=FindNextTime();
     419        const Int_t nmin=FindNext();
     420        if (nmin<0)
     421        {
     422            *fLog << err << "MReadReports::Process: ERROR - Determination of next tree failed... abort." << endl;
     423            return kERROR;
     424        }
    380425
    381426        TChain *chain = (TChain*)fChains->At(nmin);
  • trunk/MagicSoft/Mars/mfileio/MReadReports.h

    r6499 r7115  
    1717class MReadReports : public MRead
    1818{
     19public:
     20    enum Type_t {
     21        kStandard,
     22        kMaster,
     23        kRequired
     24    };
     25
    1926private:
    2027    MTaskList *fTrees;    // Hold the trees which are scheduled for reading
     
    2532
    2633    Bool_t     fEnableAutoScheme;
     34    Int_t      fNumRequired;
     35    //Bool_t     fFirstReInit;
    2736
     37    void    ForceRequired();
    2838    MTime** GetTime(TChain *c) const;
    2939    Int_t   FindNextTime();
     40    Int_t   FindNextRequired();
     41    Int_t   FindNext() { return fNumRequired==0 ? FindNextTime() : FindNextRequired(); }
    3042
    3143    UInt_t  GetEntries();
    3244    TString GetFullFileName() const;
    3345
     46    //Bool_t  ReInit(MParList *plist);
    3447    Int_t   PreProcess(MParList *plist);
    3548    Int_t   Process();
     
    3750
    3851    enum {
    39         kHasMaster = BIT(14)
     52        kHasMaster   = BIT(14),
     53        kIsRequired  = BIT(22),
     54        kIsProcessed = BIT(23)
    4055    };
    4156
     
    4459    ~MReadReports();
    4560
    46     void  AddTree(const char *tree, const char *time=NULL, Bool_t master=kFALSE);
    47     void  AddTree(const char *tree, Bool_t master)
     61    void  AddTree(const char *tree, const char *time=NULL, Type_t master=kStandard);
     62    void  AddTree(const char *tree, Type_t master)
    4863    {
    4964        AddTree(tree, NULL, master);
  • trunk/MagicSoft/Mars/mfileio/MReadTree.h

    r6499 r7115  
    3131
    3232    enum { kChainWasChanged = BIT(14) };
     33    // MReadReports::kIsRequired  = BIT(22)
     34    // MReadReports::kIsProcessed = BIT(23)
    3335
    3436private:
     
    4749
    4850    enum { kIsOwner = BIT(14) };
     51    // MReadReports::kIsRequired  = BIT(22)
     52    // MReadReports::kIsProcessed = BIT(23)
    4953
    5054public:
  • trunk/MagicSoft/Mars/mhflux/MHDisp.cc

    r7114 r7115  
    278278            {
    279279                const Double_t r = TMath::Hypot(h1->GetXaxis()->GetBinCenter(x+1)-x0,
    280                                                 h1->GetXaxis()->GetBinCenter(y+1)-y0);
     280                                                h1->GetYaxis()->GetBinCenter(y+1)-y0);
    281281                h2->Fill(r, h1->GetBinContent(x+1, y+1));
    282282            }
     
    286286        func.SetLineColor(kBlue);
    287287
    288         func.SetParLimits(2, h2->GetBinWidth(1), 1.1);
     288        func.SetParLimits(2, h2->GetBinWidth(1), 1.0);
    289289
    290290        func.SetParameter(0, h2->GetBinContent(1));
     
    292292        func.SetParameter(2, 0.15);
    293293        func.SetParameter(4, h2->GetBinContent(10));
    294         h2->Fit(&func, "IMQ", "", 0, 1.1);
     294        h2->Fit(&func, "IMQ", "", 0, 1.0);
    295295
    296296        const Double_t r0 = 2*func.GetParameter(2);
  • trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc

    r7091 r7115  
    749749    FitThetaBins();
    750750    FitTimeBin();
    751     MH::RemoveFirstBin(fHTimeEffOn);
    752     MH::RemoveFirstBin(fHTimeProb);
    753     MH::RemoveFirstBin(fHTimeLambda);
    754     //MH::RemoveFirstBin(fHTimeNDF);
    755751
    756752    fIsFinalized = kTRUE;
  • trunk/MagicSoft/Mars/mjobs/MJCalib.cc

    r6985 r7115  
    6060Bool_t MJCalib::CheckEnvLocal()
    6161{
    62     if (HasEnv("PixelCheck"))
    63         SetPixelCheck(GetEnv("PixelCheck", fIsPixelCheck));
    64 
    65     if (HasEnv("PulsePosCheck"))
    66         SetPulsePosCheck(GetEnv("PulsePosCheck", fIsPulsePosCheck));
    67 
    68     if (HasEnv("CheckedPixId"))
    69         SetCheckedPixId(GetEnv("CheckedPixId",fCheckedPixId));
    70 
    71     if (HasEnv("HiLoCalibration"))   
    72       SetHiLoCalibration(GetEnv("HiLoCalibration", fIsHiLoCalibration));
     62    SetPixelCheck(GetEnv("PixelCheck", fIsPixelCheck));
     63    SetPulsePosCheck(GetEnv("PulsePosCheck", fIsPulsePosCheck));
     64    SetCheckedPixId(GetEnv("CheckedPixId",fCheckedPixId));
     65    SetHiLoCalibration(GetEnv("HiLoCalibration", fIsHiLoCalibration));
    7366
    7467    if (HasEnv("StorageType"))
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r7073 r7115  
    9595//#include "MMcPedestalCopy.h"
    9696#include "MPointingPosCalc.h"
    97 #include "MPointingPosInterpolate.h"
    9897#include "MPedCalcFromLoGain.h"
    9998#include "MExtractor.h"
     
    378377
    379378    MReadReports readreal;
    380     readreal.AddTree("Events", "MTime.", kTRUE);
     379    readreal.AddTree("Events", "MTime.", MReadReports::kMaster);
    381380    readreal.AddTree("Trigger");
    382381    readreal.AddTree("Camera");
     
    407406    MContinue contmc("MRawEvtData.GetNumPixels<0.5", "ContEmptyMC");
    408407
    409     MPointingPosInterpolate pextr;
    410     pextr.AddFiles(&iter);
     408    //MPointingPosInterpolate pextr;
     409    //pextr.AddFiles(&iter);
    411410   
    412411    MGeomApply             apply; // Only necessary to create geometry
     
    725724    // Now setup main tasklist
    726725    tlist.AddToList(read);
     726
    727727    if (IsUseMC())
    728728    {
     
    731731    }
    732732
    733     if (IsUseRootData())
    734       tlist2.AddToList(&pextr);
     733    //if (IsUseRootData())
     734    //  tlist2.AddToList(&pextr);
    735735    tlist.AddToList(&tlist2, IsUseRootData() ? "Events" : "All");
    736736
  • trunk/MagicSoft/Mars/mjobs/MJCut.cc

    r7113 r7115  
    494494    // ------------- Loop Off Data --------------------
    495495    MReadReports readoffdata;
    496     readoffdata.AddTree("Events", "MTime.", kTRUE);
    497     readoffdata.AddTree("Drive");
     496    readoffdata.AddTree("Events", "MTime.", MReadReports::kMaster);
     497    readoffdata.AddTree("Drive", MReadReports::kRequired);
    498498    readoffdata.AddTree("EffectiveOnTime");
    499499
     
    637637    // ------------- Loop On Data --------------------
    638638    MReadReports readondata;
    639     readondata.AddTree("Events", "MTime.", kTRUE);
    640     readondata.AddTree("Drive");
     639    readondata.AddTree("Events", "MTime.", MReadReports::kMaster);
     640    readondata.AddTree("Drive", MReadReports::kRequired);
    641641    readondata.AddTree("EffectiveOnTime");
    642642
  • trunk/MagicSoft/Mars/mjobs/MJStar.cc

    r7091 r7115  
    191191
    192192    MReadReports readreal;
    193     readreal.AddTree("Events", "MTime.", kTRUE);
    194     readreal.AddTree("Drive");
     193    readreal.AddTree("Events", "MTime.", MReadReports::kMaster);
     194    readreal.AddTree("Drive", MReadReports::kRequired);
    195195    readreal.AddTree("CC");
    196196    //read.AddTree("Trigger");
     
    368368    if (!ismc)
    369369    {
    370         tlist2.AddToList(&rate,   "Events");
    371         tlist2.AddToList(&fillvs, "Events");
    372         tlist2.AddToList(&fill8,  "Events");
    373         tlist2.AddToList(&fill9,  "Events");
     370        // Calibration events don't enter star at all.
     371        tlist2.AddToList(&rate);
     372        tlist2.AddToList(&fillvs);
     373        tlist2.AddToList(&fill8);
     374        tlist2.AddToList(&fill9);
    374375    }
    375376    //tlist2.AddToList(&fillb);
  • trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc

    r5583 r7115  
    3434//  * Real Data: Copy the nominal poiting position (Nominal Zd, Nominal Az
    3535//               in MReportDrive) to MPointingPosition
     36//
     37// We do a trick: Because it is not guranteed, that MReadReports calls
     38//  ReInit before the first event from the drive-tree is read (because
     39//  the first data event may have a time-stamp later than the first
     40//  drive event) we always assume that the current run is a data run.
     41//  If the assumption is true fReport should be initialized correctly.
     42//  For MC runs this should never happen, Because they are read though
     43//  MReadMarsFile which gurantees, that ReInit is always called before
     44//  Process. If we encounter such a case we stop execution.
    3645//
    3746// Future: Interpolate the pointing position for each event between two
     
    8190    {
    8291    case MRawRunHeader::kRTData:
    83         fReport = (MReportDrive*)plist->FindObject("MReportDrive");
    8492        if (!fReport)
    8593        {
     
    121129{
    122130    fPosition = (MPointingPos*)plist->FindCreateObj("MPointingPos");
     131    fReport   = (MReportDrive*)plist->FindObject("MReportDrive");
     132
     133    // We use kRTNone here as a placeholder for data runs.
     134    fRunType  = MRawRunHeader::kRTNone;
     135
    123136    return fPosition ? kTRUE : kFALSE;
    124137}
     
    130143Int_t MPointingPosCalc::Process()
    131144{
    132     if (!fReport && fRunType == MRawRunHeader::kRTData)
    133     {
    134         *fLog << warn << "WARNING - MPointingPosCalc::Process was called BEFORE the first" << endl;
    135         *fLog <<         "          data event was read (means ReInit was executed!" << endl;
    136         return kTRUE;
    137     }
    138 
    139145    switch (fRunType)
    140146    {
     147    case MRawRunHeader::kRTNone:
    141148    case MRawRunHeader::kRTData:
     149        if (!fReport)
     150        {
     151            *fLog << warn;
     152            *fLog << "MPointingPosCalc::Process: fReport==NULL && fRunType!=kRTMonteCarlo... abort!" << endl;
     153            return kERROR;
     154        }
    142155        fPosition->SetLocalPosition(fReport->GetNominalZd(), fReport->GetNominalAz());
    143156        fPosition->SetSkyPosition(fReport->GetRa(), fReport->GetDec());
     
    145158
    146159    case MRawRunHeader::kRTMonteCarlo:
     160        if (!fMcEvt)
     161        {
     162            *fLog << warn;
     163            *fLog << "MPointingPosCalc::Process: fMcEvt==NULL && fRunType==kRTMonteCarlo... abort!" << endl;
     164            return kERROR;
     165        }
    147166        fPosition->SetLocalPosition(fMcEvt->GetTelescopeTheta()*TMath::RadToDeg(), fMcEvt->GetTelescopePhi()*TMath::RadToDeg());
    148167        return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.