Changeset 4074


Ignore:
Timestamp:
05/14/04 17:24:17 (21 years ago)
Author:
rico
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mifae
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/Changelog

    r4072 r4074  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
    20 
     20       
    2121 2004/05/14  Javier Rico
    2222   * library/MSrcPlace.[cc,h]
    2323     - added
    2424
    25    * library/MSrcPosFromFile.[cc,h], library/MSrcRotate.[cc,h]
     25   * library/MSrcPosFromFile.[cc,h], library/MSrcRotate.[cc,h],
     26     library/MSrcTranslate.[cc,h]
    2627     - inherit from MSrcPlace
    2728
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc

    r4072 r4074  
    3636
    3737#include <fstream>
    38 
    39 #include <TH2F.h>
    4038
    4139#include "MParList.h"
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.h

    r4072 r4074  
    3636    enum ReadMode_t {kCount=0,kRead};
    3737
    38     MSrcPosFromFile(TString cardpath, OnOffMode_t mode=kOn, const char *name=NULL, const char *title=NULL);
     38    MSrcPosFromFile(TString cardpath=0, OnOffMode_t mode=kOn, const char *name=NULL, const char *title=NULL);
    3939    ~MSrcPosFromFile();
     40
     41    void SetInputFileName(TString fname) {fSourcePositionFilePath=fname;}
    4042
    4143    ClassDef(MSrcPosFromFile, 0) // task to calculate the position of the source as a function of the run number
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.cc

    r3973 r4074  
    3232//  Input Containers:
    3333//    MSrcPosCam
     34//    [MDCA]
    3435//
    3536//  Output Containers:
     
    4748#include "MSrcPosCam.h"
    4849#include "MDCA.h"
    49 
    5050
    5151#include "MLog.h"
     
    6666//
    6767MSrcTranslate::MSrcTranslate(const char* srcPos, const char* dca, const char *name, const char *title)
    68   : fSrcPos(NULL), fDCA(NULL), fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)
     68  : fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)
    6969{
    7070    fName  = name  ? name  : gsDefName.Data();
    7171    fTitle = title ? title : gsDefTitle.Data();
    7272
    73     fSrcPosName  = srcPos;
    74     fDCAName     = dca;
     73    SetSrcPosName(srcPos);
     74    SetDCAName(dca);
    7575}
    7676
     
    8181Int_t MSrcTranslate::PreProcess(MParList *pList)
    8282{
    83     // look for/create MSrcPosCam
    84   fSrcPos = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fSrcPosName), "MSrcPosCam");
    85   if (!fSrcPos)
    86     {
    87       *fLog << warn << AddSerialNumber(fSrcPosName) << " [MSrcPosCam] not found... creating default container." << endl;
    88       fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fSrcPosName));
    89       if(!fSrcPos)
    90         return kFALSE;
    91     }
    92 
    93   // look for/create MDCA
    94   fDCA = (MDCA*)pList->FindObject(AddSerialNumber(fDCAName), "MDCA");
    95   if (!fDCA)
    96     {
    97       *fLog << warn << AddSerialNumber(fDCAName) << " [MDCA] not found... creating default container." << endl;
    98       fDCA = (MDCA*)pList->FindCreateObj("MDCA", AddSerialNumber(fDCAName));
    99       if(!fDCA)
    100         return kFALSE;
    101     }
     83  // look for/create MSrcPosCam and DCA
     84  if(!SearchForSrcPos(pList))
     85    return kFALSE;
    10286
    10387  if(fShiftX==0. && fShiftY==0.)
     
    11195// Perform the translation of the source position
    11296//
    113 Int_t MSrcTranslate::Process()
     97Int_t MSrcTranslate::ComputeNewSrcPosition()
    11498
    11599  Double_t newX,newY;
    116100
     101  MSrcPosCam* srcPos = GetSrcPosCam();
     102  MDCA*       dca    = GetDCA();
     103
    117104  if(fTranslationIsRelative)
    118105    {
    119       newX=fSrcPos->GetX()+fShiftX;
    120       newY=fSrcPos->GetY()+fShiftY;
     106      newX=srcPos->GetX()+fShiftX;
     107      newY=srcPos->GetY()+fShiftY;
    121108    }
    122109  else
     
    126113    }
    127114
    128   fSrcPos->SetX(newX);
    129   fSrcPos->SetY(newY);
    130   fDCA->SetRefPoint(newX,newY);
     115  srcPos->SetX(newX);
     116  srcPos->SetY(newY);
     117  dca->SetRefPoint(newX,newY);
    131118
    132119  return kTRUE;
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.h

    r3973 r4074  
    22#define MARS_MSrcTranslate
    33
    4 #ifndef MARS_MTask
    5 #include "MTask.h"
     4#ifndef MARS_MSrcPlace
     5#include "MSrcPlace.h"
    66#endif
    77
    8 #include <TArrayF.h>
    9 #include "MTime.h"
    10 #include "MSrcPosCam.h"
     8class MSrcTranslate : public MSrcPlace
     9{
     10 private:
     11 
     12  Double_t fShiftX;
     13  Double_t fShiftY;
     14  Bool_t   fTranslationIsRelative;
     15 
     16  Int_t PreProcess(MParList *plist);
    1117
    12 class MDCA;
    13 class MObservatory;
    14 class MRawEvtHeader;
    15 class MRawRunHeader;
     18 public:
     19  MSrcTranslate(const char* src="MSrcPosCam", const char* dca="MDCA",
     20                const char* name=NULL, const char* title=NULL);
     21 
     22  void SetTranslation(Double_t x=0.,Double_t y=0) {fShiftX=x,fShiftY=y;};
     23  void SetRelativeTranslation(Bool_t inp=kTRUE) {fTranslationIsRelative=inp;};
     24  virtual Int_t ComputeNewSrcPosition();
    1625
    17 class MSrcTranslate : public MTask
    18 {
    19 private:
    20     MSrcPosCam*    fSrcPos;      //!  Pointer to the source position
    21     MDCA*          fDCA;         //!  Pointer to the MDCA object
    22 
    23     TString     fSrcPosName;
    24     TString     fDCAName;
    25 
    26     Double_t fShiftX;
    27     Double_t fShiftY;
    28     Bool_t   fTranslationIsRelative;
    29 
    30     Int_t PreProcess(MParList *plist);
    31     Int_t Process();
    32 
    33 public:
    34     MSrcTranslate(const char* src="MSrcPosCam", const char* dca="MDCA",
    35                const char* name=NULL, const char* title=NULL);
    36 
    37     void SetTranslation(Double_t x=0.,Double_t y=0) {fShiftX=x,fShiftY=y;};
    38     void SetRelativeTranslation(Bool_t inp=kTRUE) {fTranslationIsRelative=inp;};
    39 
    40     ClassDef(MSrcTranslate, 0) // task to rotate the position of the source as a function of Azimuth and Zenith angles
     26  ClassDef(MSrcTranslate, 0) // task to rotate the position of the source as a function of Azimuth and Zenith angles
    4127};
    4228
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/srcPos.cc

    r4072 r4074  
    2020#include "MHillasSrc.h"
    2121#include "MSrcRotate.h"
     22#include "MSrcPosFromFile.h"
    2223#include "MSrcTranslate.h"
    2324#include "MParList.h"
     
    4748Float_t  xsrcpos=0.;
    4849Float_t  ysrcpos=0.;
    49 Double_t mjdpos=53050;
     50Double_t mjdpos=0;
    5051Bool_t   kRotate=0;
    5152Bool_t   kSrcPolicy=kFALSE;
     
    113114  read.DisableAutoScheme(); 
    114115
    115   MSrcTranslate srctranslate;
    116   srctranslate.SetTranslation(xpos,ypos);
    117   srctranslate.SetRelativeTranslation(kSrcPolicy);
    118 
    119   MSrcRotate    srcrotate;
    120   srcrotate.SetRAandDECandRefMJD(fRA,fDEC,mjdpos);
     116  MSrcTranslate   srctranslate;
     117  MSrcRotate      srcrotate;
     118  MSrcPosFromFile srcfromfile;
     119
     120  if(srcFile.Length())
     121    {
     122      srcfromfile.SetInputFileName(srcFile);
     123      srcfromfile.SetMode(MSrcPlace::kOn);
     124    }
     125  else
     126    {
     127      srctranslate.SetTranslation(xpos,ypos);
     128      srctranslate.SetRelativeTranslation(kSrcPolicy);
     129      srcrotate.SetRAandDECandRefMJD(fRA,fDEC,mjdpos);
     130      srcrotate.SetMode(MSrcPlace::kOn);
     131    }
    121132
    122133  MHillasSrcCalc csrc1;   
     
    134145  // include tasks in task list
    135146  tlist.AddToList(&read);
    136   tlist.AddToList(&srctranslate);
    137   if(kRotate)
    138     tlist.AddToList(&srcrotate); 
     147  if(srcFile.Length())
     148    tlist.AddToList(&srcfromfile);
     149  else
     150    {
     151      tlist.AddToList(&srctranslate);
     152      if(kRotate)
     153        tlist.AddToList(&srcrotate); 
     154    }
    139155  tlist.AddToList(&csrc1); 
    140156  tlist.AddToList(&write);
     
    170186  tlist.RemoveFromList(&write);
    171187
    172   srcrotate.SetMode(MSrcPlace::kOff);
     188  if(srcFile.Length())
     189    srcfromfile.SetMode(MSrcPlace::kOff);
     190  else
     191    srcrotate.SetMode(MSrcPlace::kOff);
    173192
    174193  if (!evtloop.Eventloop(nmaxevents))
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard

    r4072 r4074  
    3131
    3232
    33 // File containing source position as a function of run number (overrides SRCPOS, SRCABS, ROTFLAG and SRCCOORDS values)
    34 // SRCFILE ./20040215_Mrk421.B.pos
     33// File containing source position as a function of run number (invalidates SRCPOS, SRCABS, ROTFLAG and SRCCOORDS values)
     34SRCFILE ./20040215_Mrk421.B.pos
    3535
    3636
Note: See TracChangeset for help on using the changeset viewer.