Changeset 4074 for trunk/MagicSoft/Mars/mtemp
- Timestamp:
- 05/14/04 17:24:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4072 r4074 18 18 19 19 -*-*- END OF LINE -*-*- 20 20 21 21 2004/05/14 Javier Rico 22 22 * library/MSrcPlace.[cc,h] 23 23 - added 24 24 25 * library/MSrcPosFromFile.[cc,h], library/MSrcRotate.[cc,h] 25 * library/MSrcPosFromFile.[cc,h], library/MSrcRotate.[cc,h], 26 library/MSrcTranslate.[cc,h] 26 27 - inherit from MSrcPlace 27 28 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc
r4072 r4074 36 36 37 37 #include <fstream> 38 39 #include <TH2F.h>40 38 41 39 #include "MParList.h" -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.h
r4072 r4074 36 36 enum ReadMode_t {kCount=0,kRead}; 37 37 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); 39 39 ~MSrcPosFromFile(); 40 41 void SetInputFileName(TString fname) {fSourcePositionFilePath=fname;} 40 42 41 43 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 32 32 // Input Containers: 33 33 // MSrcPosCam 34 // [MDCA] 34 35 // 35 36 // Output Containers: … … 47 48 #include "MSrcPosCam.h" 48 49 #include "MDCA.h" 49 50 50 51 51 #include "MLog.h" … … 66 66 // 67 67 MSrcTranslate::MSrcTranslate(const char* srcPos, const char* dca, const char *name, const char *title) 68 : fS rcPos(NULL), fDCA(NULL), fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)68 : fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE) 69 69 { 70 70 fName = name ? name : gsDefName.Data(); 71 71 fTitle = title ? title : gsDefTitle.Data(); 72 72 73 fSrcPosName = srcPos;74 fDCAName = dca;73 SetSrcPosName(srcPos); 74 SetDCAName(dca); 75 75 } 76 76 … … 81 81 Int_t MSrcTranslate::PreProcess(MParList *pList) 82 82 { 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; 102 86 103 87 if(fShiftX==0. && fShiftY==0.) … … 111 95 // Perform the translation of the source position 112 96 // 113 Int_t MSrcTranslate:: Process()97 Int_t MSrcTranslate::ComputeNewSrcPosition() 114 98 { 115 99 Double_t newX,newY; 116 100 101 MSrcPosCam* srcPos = GetSrcPosCam(); 102 MDCA* dca = GetDCA(); 103 117 104 if(fTranslationIsRelative) 118 105 { 119 newX= fSrcPos->GetX()+fShiftX;120 newY= fSrcPos->GetY()+fShiftY;106 newX=srcPos->GetX()+fShiftX; 107 newY=srcPos->GetY()+fShiftY; 121 108 } 122 109 else … … 126 113 } 127 114 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); 131 118 132 119 return kTRUE; -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.h
r3973 r4074 2 2 #define MARS_MSrcTranslate 3 3 4 #ifndef MARS_M Task5 #include "M Task.h"4 #ifndef MARS_MSrcPlace 5 #include "MSrcPlace.h" 6 6 #endif 7 7 8 #include <TArrayF.h> 9 #include "MTime.h" 10 #include "MSrcPosCam.h" 8 class 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); 11 17 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(); 16 25 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 41 27 }; 42 28 -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcPos.cc
r4072 r4074 20 20 #include "MHillasSrc.h" 21 21 #include "MSrcRotate.h" 22 #include "MSrcPosFromFile.h" 22 23 #include "MSrcTranslate.h" 23 24 #include "MParList.h" … … 47 48 Float_t xsrcpos=0.; 48 49 Float_t ysrcpos=0.; 49 Double_t mjdpos= 53050;50 Double_t mjdpos=0; 50 51 Bool_t kRotate=0; 51 52 Bool_t kSrcPolicy=kFALSE; … … 113 114 read.DisableAutoScheme(); 114 115 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 } 121 132 122 133 MHillasSrcCalc csrc1; … … 134 145 // include tasks in task list 135 146 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 } 139 155 tlist.AddToList(&csrc1); 140 156 tlist.AddToList(&write); … … 170 186 tlist.RemoveFromList(&write); 171 187 172 srcrotate.SetMode(MSrcPlace::kOff); 188 if(srcFile.Length()) 189 srcfromfile.SetMode(MSrcPlace::kOff); 190 else 191 srcrotate.SetMode(MSrcPlace::kOff); 173 192 174 193 if (!evtloop.Eventloop(nmaxevents)) -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard
r4072 r4074 31 31 32 32 33 // File containing source position as a function of run number ( overrides SRCPOS, SRCABS, ROTFLAG and SRCCOORDS values)34 //SRCFILE ./20040215_Mrk421.B.pos33 // File containing source position as a function of run number (invalidates SRCPOS, SRCABS, ROTFLAG and SRCCOORDS values) 34 SRCFILE ./20040215_Mrk421.B.pos 35 35 36 36
Note:
See TracChangeset
for help on using the changeset viewer.