Changeset 8636 for trunk


Ignore:
Timestamp:
07/15/07 19:25:45 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8634 r8636  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21
     22 2007/07/15 Thomas Bretz
     23
     24   * mdata/MDataPhrase.[h,cc]:
     25     - fixed a problem with predefined variables (such as used for
     26       disp optimization [0])
     27     - added a debug member function GetRuleRaw()
     28
     29   * mhflux/MHAlpha.[h,cc]:
     30     - allow to set the watermark from the DrawNice menu entry
     31
     32   * mjobs/MDataSet.cc:
     33     - allow to set the default sequence- and data-path from
     34       the dataset file
     35
     36   * mjobs/MJCut.cc:
     37     - set the number of random off-source position for the on-data
     38     - fixed a "&", should have been a logical And
     39     - make sure that even for MCs the source position is always
     40       calculated (this is necessary for more than one wobble position)
     41
     42   * mjoptim/MJOptimizeDisp.cc:
     43     - fixed a typo which made the optimtrain.C fail (kDegToRad does
     44       not exist)
     45
     46   * mjtrain/MJTrainEnergy.cc:
     47     - some cosmetics: changed kRad2Deg to TMath::RadToDeg()
     48
     49   * mpointing/MSrcPosCalc.[h,cc]:
     50     - added a random off-source position calculation to make the
     51       more-than-one-off-source-position analysis symmetric in case of
     52       on-source
     53     - added lots of comments
     54
    2055
    2156
  • trunk/MagicSoft/Mars/NEWS

    r8632 r8636  
    1111     resource file (to check it open it in the TBrowser and choose Print()
    1212     from the context menu)
     13
     14   - general: Dataset files now allow to overwrite the default path
     15     to search for sequence and data files. Note, that the program
     16     option and individual resources will overwrite it. For example:
     17        SequencePath: /magic/montecarlo/sequences
     18        DataPath:     /magic/montecarlo/star
     19
     20   - general: Fixed a problem with variables in MDataPhrase. It seems
     21     that only optimdisp (didn't work) was effected.
    1322
    1423   - merpp: Merpp can read file format version 9 now. Please realize
     
    113122     is not properly set.
    114123     (Rem: ThetaSqN is no longer needed)
     124
     125   - ganymed: is now storing the events of all source (on- and off-
     126     source positions) even in the case of more than one off-source
     127     position. This should allow sponde to work properly and the
     128     energy estimation is done correctly in all cases (without any
     129     "nearest position" trick)
     130
     131   - ganymed: From XXXX on a real starguider calibration with a real
     132     pointing model for the starguider is done.
    115133
    116134   - ganymed: From 85340 (19.3.2006) on a real starguider calibration
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.cc

    r8601 r8636  
    885885}
    886886
    887 void MHAlpha::DrawNicePlot(Bool_t newc, const char *title)
     887void MHAlpha::DrawNicePlot(Bool_t newc, const char *title, const char *watermark)
    888888{
    889889    if (!newc && !fDisplay)
     
    972972    text.SetTextSize(0.07);
    973973    text.SetTextAngle(2.5);
    974     text.DrawLatex(0.45, 0.2, "preliminary");
     974    if (watermark)
     975        text.DrawLatex(0.45, 0.2, watermark);
    975976    //enum { kTextNDC = BIT(14) };
    976977
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.h

    r8136 r8636  
    132132    void ForceUsingSize(Bool_t b=kTRUE) { fForceUsingSize=b; }
    133133
    134     void DrawNicePlot(const char *title="MAGIC Telescope observation") { DrawNicePlot(kTRUE, title); } //*MENU*
    135     void DrawNicePlot(Bool_t newc, const char *title=0);
     134    void DrawNicePlot(const char *title="MAGIC Telescope observation", const char *watermark="preliminary") { DrawNicePlot(kTRUE, title, watermark); } //*MENU*
     135    void DrawNicePlot(Bool_t newc, const char *title=0, const char *watermark=0);
    136136    void DrawAll() { DrawAll(kTRUE); } //*MENU*
    137137    void DrawAll(Bool_t newc);
  • trunk/MagicSoft/Mars/mjobs/MDataSet.cc

    r8441 r8636  
    3838//       SequencesOff: 36817
    3939//
     40//       SequencePath: /magic/sequences
     41//       DataPath:     /magic/data/star
     42//
    4043//       Sequence00035222.File: sequences/sequence035222.txt
    4144//       Sequence00036817.File: sequences/sequence036817.txt
     
    4447//       Sequence00036817.Dir: /data2/wuerzburg/Crab-Analyse/images/036817
    4548//
    46 // The analysis number is an artifical number used to name the output
    47 // files automatically if the names are not overwritten in the corresponding
    48 // programs.
    49 //
    50 // The sequence number are used to concatenate the filenames of the
    51 // sequences using the file structure used in the datacenter. Each sequence
    52 // can be added to the on and off data at the same time but only once.
     49//       MonteCarlo: No
     50//
     51// AnalysisNumber: The analysis number is an artifical number used to name
     52// the output files automatically if the names are not overwritten in the
     53// corresponding programs.
     54//
     55// SequencePath: In case it is not specified the datacenter default path is
     56// used. If it is given it is the place at which the sequence files
     57// are searched, if not overwritten by either a program command line
     58// option (aka. a argument to the constructor) or a resource for
     59// an individual sequence file. Note, that the four digits high-level
     60// directories to sort the sequences are added to the given path.
     61//
     62// DataPath: In case it is not specified the datacenter default path is
     63// used. If it is given it is the place at which the data files
     64// are searched, if not overwritten by either a program command line
     65// option (aka. a argument to the constructor) or a resource for
     66// an individual data path.  Note, that the four digits high-level
     67// directories to sort the sequences are added to the given path.
     68//
     69// SequencesOn/Off: The sequence number are used to concatenate the filenames
     70// of the sequences using the file structure used in the datacenter. Each
     71// sequence can be added to the on and off data at the same time but only
     72// once.
    5373//
    5474// If you have different file names you can overwrite the default file names
     
    5979// overwrite the directories in which the sequence-files (eg I-files) are
    6080// stored using Sequence%08d.Dir (make sure you have 8 digits!)
     81//
     82//
    6183//
    6284// Resource file entries are case sensitive!
     
    226248    fComment      = env.GetValue("Comment",    "");
    227249
    228     SetupDefaultPath(sequences, GetDefPathSequences());
    229     SetupDefaultPath(data,      GetDefPathDataFiles());
     250    const TString defpathseq  = env.GetValue("SequencePath", GetDefPathSequences());
     251    const TString defpathdata = env.GetValue("DataPath",     GetDefPathDataFile());
     252
     253    SetupDefaultPath(sequences, defpathseq);
     254    SetupDefaultPath(data,      defpathdata);
    230255
    231256    fPathSequences = sequences;
  • trunk/MagicSoft/Mars/mjobs/MJCut.cc

    r8633 r8636  
    873873
    874874    scalc.SetMode(MSrcPosCalc::kDefault);
     875    scalc.SetNumRandomOffPositions(fNumOffSourcePos);
    875876
    876877    MFillH fill1b("MHHillasOnPre  [MHHillas]",      "MHillas",      "FillHillasPre");
     
    947948    MFillH fillsrc(&hsrcpos, "MSrcPosCam", "FillSrcPosCam");
    948949    fillsrc.SetNameTab("SrcPos");
    949     if (set.IsWobbleMode() & !set.IsMonteCarlo())
     950
     951    if (set.IsWobbleMode() && !set.IsMonteCarlo())
    950952        tlist2.AddToListBefore(&fillsrc, &hcalc);
    951953
     
    983985        if (!set.IsMonteCarlo())
    984986            tlist.AddToList(&fillvs, "EffectiveOnTime");
    985         else
    986             tlist2.AddToListBefore(&fillvs, &scalc);
     987
     988        // It is not really necessary to re-calculate the image parameters
     989        // for the the on-source for MCs, but it is done for symmetry reasons
     990        tlist2.AddToListBefore(&fillvs, &scalc);
    987991    }
    988992
  • trunk/MagicSoft/Mars/mjoptim/MJOptimizeDisp.cc

    r8223 r8636  
    117117    parlist.AddToList(&fit);
    118118
     119    // To avoid this hard-coded we have to switch to MReadMarsFile
    119120    MGeomCamMagic geom; // For GetConvMm2Deg
    120121    parlist.AddToList(&geom);
     
    125126
    126127    const Int_t num1 = m.AddColumn("MHillasSrc.fDist*MGeomCam.fConvMm2Deg");
    127     const Int_t num2 = m.AddColumn("MHillasSrc.fAlpha*kDegToRad");
     128    const Int_t num2 = m.AddColumn("MHillasSrc.fAlpha*TMath::DegToRad()");
    128129    const Int_t num3 = m.AddColumn("MHillas.fSize");
    129130
     
    202203
    203204    // Print the result
    204     *fLog << inf << "Finished processing of " << fname << endl;
    205     *fLog << inf << "With Rule: " << rule << endl;
     205    *fLog << inf;
     206    *fLog << "Finished processing of " << fname << endl;
     207    *fLog << "With Rule: " << rule << endl;
    206208    hist.GetAlphaFitter().Print("result");
    207209
  • trunk/MagicSoft/Mars/mjtrain/MJTrainEnergy.cc

    r8223 r8636  
    112112        train.AddColumn("MWeight.fVal");
    113113    train.AddColumn("MMcEvt.fImpact/100");
    114     train.AddColumn("MMcEvt.fTelescopeTheta*kRad2Deg");
     114    train.AddColumn("MMcEvt.fTelescopeTheta*TMath::RadToDeg()");
    115115    train.AddColumn("MMcEvt.fEnergy");
    116116
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc

    r8618 r8636  
    4242// is taken from MGeomCam. The time is taken from MTime, and the
    4343// coordinates of the observatory from MObservatory.
    44 //
     44//
     45// FIXME: Add here some information about the more-cycle calculation
     46//
    4547// Input Container:
    4648//   MPointingPos
     
    6567#include "MSrcPosCalc.h"
    6668
     69#include <TRandom.h>
    6770#include <TVector2.h>
    6871
     
    9699    : fObservatory(NULL), fPointPos(NULL), fSourcePos(NULL), fDeviation(NULL),
    97100    fSrcPosCam(NULL), fSrcPosAnti(NULL), fGeom(NULL), fTime(NULL), fCallback(NULL),
    98     fMode(kDefault)
     101    fMode(kDefault), fNumRandomOffPositions(0)
    99102{
    100103    fName  = name  ? name  : "MSrcPosCalc";
     
    157160Int_t MSrcPosCalc::PreProcess(MParList *pList)
    158161{
     162    // Reset fixed position
     163    fFixedPos = TVector2();
     164
    159165    fSrcPosCam = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam");
    160166    if (!fSrcPosCam)
     
    172178            *fLog << inf;
    173179            *fLog << "MSourcePos [MPointPos] not found... The source position" << endl;
    174             *fLog << "set in MSrcPosCam will be set to  (0/0)  or in the case" << endl;
     180            *fLog << "set in MSrcPosCam will be set to (0/0)  or in the case" << endl;
    175181            *fLog << "of  Monte Carlo set to the appropriate wobble position." << endl;
    176182            return kTRUE;
     
    199205    *fLog << "Source Position: " << GetRaDec(*fSourcePos) << endl;
    200206    if (fCallback)
    201         *fLog << "Using " << fCallback->GetNumPasses() << " off-regions." << endl;
     207        *fLog << "Calculating " << fCallback->GetNumPasses() << " off-regions." << endl;
     208    if (fNumRandomOffPositions)
     209        *fLog << "Calculating " << fNumRandomOffPositions << " random off-regions." << endl;
    202210
    203211    // For the case ReInit is never called we try:
     
    211219// --------------------------------------------------------------------------
    212220//
     221// Divide the 360deg into num+1 positions. Rotate the given vector
     222// by pass+1 steps and return the result.
     223//
     224TVector2 MSrcPosCalc::Rotate(TVector2 v, Int_t pass, Int_t num) const
     225{
     226    const Double_t step = TMath::TwoPi()/(num+1);
     227    return v.Rotate(step*(pass+1));
     228}
     229
     230// --------------------------------------------------------------------------
     231//
    213232// If fIsWobbleMode==kFALSE set source position to v and anto-source
    214233// position to -v, if fIsWobbleMode==kTRUE vice versa.
     
    218237    if (fMode==kWobble)
    219238    {
     239        // The trick here is that the anti-source position in case
     240        // of the off-source regions is always the on-source positon
     241        // thus a proper anti-source cut is possible.
    220242        fSrcPosAnti->SetXY(v);
    221 
    222243        if (fCallback)
    223         {
    224             const Double_t step = TMath::TwoPi()/(fCallback->GetNumPasses()+1);
    225             v = v.Rotate(step*(fCallback->GetNumPass()+1));
    226         }
     244            v = Rotate(v, fCallback->GetNumPass(), fCallback->GetNumPasses());
    227245        else
    228246            v *= -1;
    229 
    230247        fSrcPosCam->SetXY(v);
    231248    }
    232249    else
    233250    {
     251        // Because we don't process this three times like in the
     252        // wobble case we have to find another way to determine which
     253        // off-source region is the right anti-source position
     254        // We do it randomly.
    234255        fSrcPosCam->SetXY(v);
    235         v *= -1;
     256        if (fNumRandomOffPositions>1)
     257            v = Rotate(v, gRandom->Integer(fNumRandomOffPositions), fNumRandomOffPositions);
     258        else
     259            v *= -1;
    236260        fSrcPosAnti->SetXY(v);
    237261    }
     
    247271    if (fMode==kOffData)
    248272    {
    249         SetSrcPos(TVector2());
     273        // Set fixed position to camera center
     274        fFixedPos = TVector2();
     275
     276        // It is set here for the cases in which Process is not called at all
     277        fSrcPosCam->SetXY(fFixedPos);
    250278        return kTRUE;
    251279    }
     
    284312    }
    285313
     314    // Determine Monte Carlo position from Monte Carlo header
    286315    TVector2 v(0, 0);
    287316    if (h->GetWobbleMode()>0.5)
     
    290319        v.Set(-120., 0.);
    291320
    292     SetSrcPos(v);
    293 
     321    // Set fixed position
     322    fFixedPos = v;
     323
     324    // It is set here for the cases in which Process is not called at all
     325    fSrcPosCam->SetXY(fFixedPos);
     326
     327    // Informal message output
    294328    *fLog << inf;
    295     *fLog << "Source Position set to x=" << fSrcPosCam->GetX() << "mm ";
    296     *fLog << "y=" << fSrcPosCam->GetY() << "mm" << endl;
     329    *fLog << "Source Position set to x=" << fFixedPos.X() << "mm ";
     330    *fLog << "y=" << fFixedPos.Y() << "mm" << endl;
    297331
    298332    return kTRUE;
     
    350384    if (fRunType==MRawRunHeader::kRTMonteCarlo || !fSourcePos || !fTime || !fObservatory || fMode==kOffData)
    351385    {
    352         // If this is MC data do not change source position
    353         if (fRunType==MRawRunHeader::kRTMonteCarlo)
    354             return kTRUE;
    355 
    356         // For real data reset source position to 0/0
    357         SetSrcPos();
     386        SetSrcPos(fFixedPos);
    358387        return kTRUE;
    359388    }
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h

    r8618 r8636  
    2323public:
    2424    enum Mode_t {
    25         kDefault = 0,
    26         kOffData = 1,
    27         kWobble  = 2
     25        kDefault = 0,   // Set source position to on-position
     26        kOffData = 1,   // The source position is fixed to (0/0)
     27        kWobble  = 2    // The source position is set to the wobble aka. anti-source position depending on the cycle number
    2828    };
    2929private:
     
    3232    };
    3333
    34     MObservatory *fObservatory;
    35     MPointingPos *fPointPos;
    36     MPointingPos *fSourcePos;
    37     MPointingDev *fDeviation;
    38     MSrcPosCam   *fSrcPosCam;
    39     MSrcPosCam   *fSrcPosAnti;
    40     MGeomCam     *fGeom;
    41     MTime        *fTime;
    42     MTaskList    *fCallback;
     34    MObservatory *fObservatory;   //! Observatory location
     35    MPointingPos *fPointPos;      //! Present pointing position of the telescope in Zd/Az
     36    MPointingPos *fSourcePos;     //! Source Postion in sky coordinates
     37    MPointingDev *fDeviation;     //! Deviation calculated from starguider data
     38    MSrcPosCam   *fSrcPosCam;     //! Output: Source position in the camera
     39    MSrcPosCam   *fSrcPosAnti;    //! Output: Anti Source position in the camera
     40    MGeomCam     *fGeom;          //! Camera geomety
     41    MTime        *fTime;          //! Time of the current event
     42    MTaskList    *fCallback;      //! Callback function to get the number of the cycle
    4343
    4444    UShort_t fRunType;            //! Run Type to decide where to get pointing position from
    4545
    46     Int_t fMode;
     46    TVector2 fFixedPos;           //! Fixed source position
     47
     48    Int_t fMode;                  // Mode how the source position is calculated
     49
     50    Int_t fNumRandomOffPositions; // Number of possible random off-sourcr position
    4751
    4852    // MSrcPosCalc
    4953    void     SetSrcPos(TVector2 v=TVector2()) const;
     54    TVector2 Rotate(TVector2 v, Int_t pass, Int_t num) const;
    5055    TVector2 CalcXYinCamera(const MVector3 &pos0, const MVector3 &pos) const;
    5156    TString  GetRaDec(const MPointingPos &pos) const;
     
    7176    void SetMode(Mode_t m=kDefault) { fMode = m; }
    7277    void SetCallback(MTaskList *list) { fCallback=list; }
     78    void SetNumRandomOffPositions(Int_t num=0) { fNumRandomOffPositions=num; }
    7379
    7480    ClassDef(MSrcPosCalc, 0) // Calculates the source position in the camera
Note: See TracChangeset for help on using the changeset viewer.