Changeset 4084 for trunk/MagicSoft/Mars/mtemp
- Timestamp:
- 05/17/04 09:35:10 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4074 r4084 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2004/05/17 Javier Rico 22 * library/MSrcPlace.[cc,h], library/MSrcRotate.cc, 23 library/MSrcTranslate.cc 24 - Assign the internal histogram a class-dependent name 25 26 * library/MSrcPosFromFile.[cc,h] 27 - Correct behaviour for not found runs. 28 - Initialize pointers to NULL 29 20 30 21 31 2004/05/14 Javier Rico -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.cc
r4072 r4084 62 62 // ------------------------------------------------------------------------- 63 63 // 64 // Default constructor. The first (second) argument is the name of a container 64 // Default constructor. The first argument is the name of the internal histo, 65 // the second (third) argument is the name of a container 65 66 // containing the source position in the camera plain, MScrPosCam (MDCA). 66 67 // The default is "MSrcPosCam" ("MDCA"). 67 68 // 68 MSrcPlace::MSrcPlace(const char* srcPos, const char* dca, const char *name, const char *title)69 MSrcPlace::MSrcPlace(const char* histname, const char* srcPos, const char* dca, const char *name, const char *title) 69 70 : fSrcPos(NULL), fDCA(NULL) 70 71 { … … 76 77 77 78 const Float_t cameraSize = 600; //[mm] 78 const Float_t binPrecision = 1; //[mm] ~ 0.0033 deg 79 79 const Float_t binPrecision = 1; //[mm] ~ 0.0033 deg 80 80 const UInt_t nbins = (UInt_t)(cameraSize*2/binPrecision); 81 fHistSrcPos = new TH2F("HistSrcPos","",nbins,-cameraSize,cameraSize,nbins,-cameraSize,cameraSize); 81 82 fHistPos = new TH2F(histname,"",nbins,-cameraSize,cameraSize,nbins,-cameraSize,cameraSize); 82 83 83 84 fMode=kOn; … … 89 90 MSrcPlace::~MSrcPlace() 90 91 { 91 delete fHistSrcPos; 92 if(fHistPos) 93 delete fHistPos; 92 94 } 93 95 // ------------------------------------------------------------------------- … … 127 129 void MSrcPlace::SavePosIntoHisto() 128 130 { 129 fHist SrcPos->Fill(fSrcPos->GetX(),fSrcPos->GetY());131 fHistPos->Fill(fSrcPos->GetX(),fSrcPos->GetY()); 130 132 } 131 133 // ------------------------------------------------------------------------- … … 138 140 Axis_t y; 139 141 140 fHist SrcPos->GetRandom2(x,y);142 fHistPos->GetRandom2(x,y); 141 143 fSrcPos->SetXY(x,y); 142 144 fDCA->SetRefPoint(x,y); … … 147 149 // 148 150 Int_t MSrcPlace::PreProcess(MParList* plist) 149 { 151 { 150 152 return SearchForSrcPos(plist); 151 153 } … … 183 185 *fLog << inf << endl; 184 186 *fLog << inf << "MSrcPlace::PostProcess Message: Created internal histogram with: "; 185 *fLog << inf << "Entries: " << fHist SrcPos->GetEntries() << endl;186 *fLog << inf << "X projection mean: " << fHist SrcPos->ProjectionX()->GetMean() << endl;187 *fLog << inf << "X projection rms: " << fHist SrcPos->ProjectionX()->GetRMS() << endl;188 *fLog << inf << "Y projection mean: " << fHist SrcPos->ProjectionY()->GetMean() << endl;189 *fLog << inf << "Y projection rms: " << fHist SrcPos->ProjectionY()->GetRMS() << endl;187 *fLog << inf << "Entries: " << fHistPos->GetEntries() << endl; 188 *fLog << inf << "X projection mean: " << fHistPos->ProjectionX()->GetMean() << endl; 189 *fLog << inf << "X projection rms: " << fHistPos->ProjectionX()->GetRMS() << endl; 190 *fLog << inf << "Y projection mean: " << fHistPos->ProjectionY()->GetMean() << endl; 191 *fLog << inf << "Y projection rms: " << fHistPos->ProjectionY()->GetRMS() << endl; 190 192 191 193 return kTRUE; -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.h
r4072 r4084 22 22 TString fDCAName; // Name of the MDCA object 23 23 24 TH2F* fHist SrcPos; // histogram of the used source positions24 TH2F* fHistPos; // histogram of the used source positions 25 25 OnOffMode_t fMode; // On/Off data mode (write/read to/from the histogram) 26 26 … … 34 34 35 35 public: 36 MSrcPlace(const char* src="MSrcPosCam", const char* dca="MDCA", 36 MSrcPlace(const char* histname="HistSrcPos", 37 const char* src="MSrcPosCam", const char* dca="MDCA", 37 38 const char* name=NULL, const char* title=NULL); 38 39 … … 43 44 void SetDCAName(TString name) {fDCAName=name;} 44 45 45 OnOffMode_t GetMode() {return fMode;} 46 TH2F* GetPositionHisto() {return fHistSrcPos;} 47 MSrcPosCam* GetSrcPosCam() {return fSrcPos;} 48 MDCA* GetDCA() {return fDCA;} 49 50 46 OnOffMode_t GetMode() {return fMode;} 47 TH2F* GetPositionHisto() {return fHistPos;} 48 MSrcPosCam* GetSrcPosCam() {return fSrcPos;} 49 MDCA* GetDCA() {return fDCA;} 50 51 51 Int_t SearchForSrcPos(MParList *plist); 52 52 virtual Int_t ComputeNewSrcPosition() {return kTRUE;} -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc
r4074 r4084 60 60 // 61 61 MSrcPosFromFile::MSrcPosFromFile(TString cardpath, OnOffMode_t mode, const char *name, const char *title) 62 : fRawRunHeader(NULL), fSourcePositionFilePath(cardpath)62 : MSrcPlace(TString(gsDefName+"Hist").Data()), fRawRunHeader(NULL), fSourcePositionFilePath(cardpath) 63 63 { 64 64 fName = name ? name : gsDefName.Data(); … … 66 66 SetMode(mode); 67 67 68 fRunList=0x0; 69 fRunSrcPos=0x0; 70 fRunMap=0x0; 71 68 72 fLastRun = 0; 69 73 fLastValidSrcPosCam=0x0; 74 } 75 // ------------------------------------------------------------------------- 76 // 77 // Destructor 78 // 79 MSrcPosFromFile::~MSrcPosFromFile() 80 { 81 if(fRunList) 82 delete [] fRunList; 83 if(fRunSrcPos) 84 delete [] fRunSrcPos; 85 if(fRunMap) 86 delete fRunMap; 87 } 88 89 // ------------------------------------------------------------------------- 90 // 91 // Open and read the input file. 92 Int_t MSrcPosFromFile::PreProcess(MParList *pList) 93 { 70 94 // Count the number of runs in the card with the source poistions 71 95 ReadSourcePositionsFile(kCount); 72 96 73 fRunList = new Int_t[fNumRuns]; 74 fRunSrcPos = new MSrcPosCam[fNumRuns]; 75 fRunMap = new TExMap(fNumRuns); 97 if(!fRunList) 98 fRunList = new Int_t[fNumRuns]; 99 if(!fRunSrcPos) 100 fRunSrcPos = new MSrcPosCam[fNumRuns]; 101 if(!fRunMap) 102 fRunMap = new TExMap(fNumRuns); 76 103 77 104 // Read card with the source poistions 78 105 ReadSourcePositionsFile(kRead); 79 } 80 81 MSrcPosFromFile::~MSrcPosFromFile() 82 { 83 delete [] fRunList; 84 delete [] fRunSrcPos; 85 delete fRunMap; 86 } 87 88 // ------------------------------------------------------------------------- 89 // 90 Int_t MSrcPosFromFile::PreProcess(MParList *pList) 91 { 106 107 92 108 if(!SearchForSrcPos(pList)) 93 109 return kFALSE; … … 119 135 Float_t y; 120 136 137 *fLog << inf << "Source position for run " << run; 121 138 if (srcpos) 122 139 { 140 fLastValidSrcPosCam = srcpos; 123 141 x = srcpos->GetX(); 124 142 y = srcpos->GetY(); 143 } 144 else if(fLastValidSrcPosCam) 145 { 146 x = fLastValidSrcPosCam->GetX(); 147 y = fLastValidSrcPosCam->GetY(); 125 148 126 GetSrcPosCam()->SetXY(x,y); 127 128 *fLog << inf << "Source position for run " << run; 129 *fLog << inf << "\tX\t" << setprecision(3) << x; 130 *fLog << inf << "\tY\t" << setprecision(3) << y << endl; 131 } 149 *fLog << inf << " not found in file. Taking previous position: "; 150 } 132 151 else 133 152 { 134 *fLog << inf << "Source position for run " << run << " not found in file. "; 135 *fLog << inf << "Taking previous position: "; 136 *fLog << inf << "\tX\t" << setprecision(3) << x; 137 *fLog << inf << "\tY\t" << setprecision(3) << y << endl; 153 *fLog << err << "MSrcPosFromFile::ComputeNewSrcPosition error: no value for the first run. Don't know what values to take" << endl; 154 return kFALSE; 138 155 } 156 157 GetSrcPosCam()->SetXY(x,y); 158 159 *fLog << inf << "\tX\t" << setprecision(3) << x; 160 *fLog << inf << "\tY\t" << setprecision(3) << y << endl; 139 161 } 140 162 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.h
r4074 r4084 24 24 Int_t *fRunList; 25 25 MSrcPosCam *fRunSrcPos; 26 MSrcPosCam *fLastValidSrcPosCam; 26 27 TExMap *fRunMap; // list of run numbers positions 27 28 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcRotate.cc
r4072 r4084 67 67 // 68 68 MSrcRotate::MSrcRotate(const char* srcPos, const char* dca, const char *name, const char *title) 69 : fRA(0), fDEC(0), fRefMJD(0), fRunNumber(0)69 : MSrcPlace(TString(gsDefName+"Hist").Data()), fRA(0), fDEC(0), fRefMJD(0), fRunNumber(0) 70 70 { 71 71 fName = name ? name : gsDefName.Data(); -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.cc
r4074 r4084 66 66 // 67 67 MSrcTranslate::MSrcTranslate(const char* srcPos, const char* dca, const char *name, const char *title) 68 : fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)68 : MSrcPlace(TString(gsDefName+"Hist").Data()), fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE) 69 69 { 70 70 fName = name ? name : gsDefName.Data(); -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcPos.cc
r4074 r4084 93 93 return -1; 94 94 } 95 95 96 srcPos(); 96 97 } -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard
r4074 r4084 32 32 33 33 // File containing source position as a function of run number (invalidates SRCPOS, SRCABS, ROTFLAG and SRCCOORDS values) 34 SRCFILE ./20040215_Mrk421.B.pos34 SRCFILE /mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/programs/20040215_Mrk421.B.pos 35 35 36 36
Note:
See TracChangeset
for help on using the changeset viewer.