Changeset 4087
- Timestamp:
- 05/17/04 11:36:24 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4084 r4087 23 23 library/MSrcTranslate.cc 24 24 - Assign the internal histogram a class-dependent name 25 - Add some log lines to trace the classes behaviour 26 - Remove function SearchForSrcPos 25 27 26 28 * library/MSrcPosFromFile.[cc,h] 27 - Correct behaviour for not found runs. 29 - Correct behaviour for not found runs 30 - Keep latest good MSrcPosCam to fill for next events 28 31 - Initialize pointers to NULL 32 - Fill also MDCA 29 33 30 34 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.cc
r4084 r4087 30 30 // It keeps a 2D histogram with the assigned positions, so that the same 31 31 // distribution can be applied later to any data set (tipically the OFF data) 32 // Classes inheritating MSrcPlace should override the ComputeNewSrcPosition() 33 // method and probably include a call to MsrcPlace::PreProcess in their 34 // PreProcess method (see, e.g., MSrcPosFromFile or MSrcRotate classes) 32 35 // 33 36 // Input Containers: … … 92 95 if(fHistPos) 93 96 delete fHistPos; 94 }95 // -------------------------------------------------------------------------96 //97 // Look for/create the needed containers98 // Check whether RA and DEC have been initialized99 //100 Int_t MSrcPlace::SearchForSrcPos(MParList *pList)101 {102 // look for/create MSrcPosCam103 fSrcPos = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fSrcPosName), "MSrcPosCam");104 if (!fSrcPos)105 {106 *fLog << warn << AddSerialNumber(fSrcPosName) << " [MSrcPosCam] not found... creating default container." << endl;107 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fSrcPosName));108 if(!fSrcPos)109 return kFALSE;110 }111 112 // look for/create MDCA113 fDCA = (MDCA*)pList->FindObject(AddSerialNumber(fDCAName), "MDCA");114 if (!fDCA)115 {116 *fLog << warn << AddSerialNumber(fDCAName) << " [MDCA] not found... creating default container." << endl;117 fDCA = (MDCA*)pList->FindCreateObj("MDCA", AddSerialNumber(fDCAName));118 if(!fDCA)119 return kFALSE;120 }121 122 return kTRUE;123 97 } 124 98 … … 146 120 // ------------------------------------------------------------------------- 147 121 // 148 // Look for needed containers 149 // 150 Int_t MSrcPlace::PreProcess(MParList* plist) 122 // Look for needed containers. 123 // Check processing mode and if histogram is filled in case kOff mode 124 // 125 Int_t MSrcPlace::PreProcess(MParList* pList) 151 126 { 152 return SearchForSrcPos(plist); 127 // look for/create MSrcPosCam 128 fSrcPos = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fSrcPosName), "MSrcPosCam"); 129 if (!fSrcPos) 130 { 131 *fLog << warn << AddSerialNumber(fSrcPosName) << " [MSrcPosCam] not found... creating default container." << endl; 132 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fSrcPosName)); 133 if(!fSrcPos) 134 return kFALSE; 135 } 136 137 // look for/create MDCA 138 fDCA = (MDCA*)pList->FindObject(AddSerialNumber(fDCAName), "MDCA"); 139 if (!fDCA) 140 { 141 *fLog << warn << AddSerialNumber(fDCAName) << " [MDCA] not found... creating default container." << endl; 142 fDCA = (MDCA*)pList->FindCreateObj("MDCA", AddSerialNumber(fDCAName)); 143 if(!fDCA) 144 return kFALSE; 145 } 146 147 // check mode, look for a filled histogram in case kOff 148 if(fMode==kOn) 149 *fLog << inf << "MSrcPlace PreProcess Message: source postions will be stored in internal histo (" << fHistPos->GetName() << ")" << endl; 150 else 151 { 152 if(fHistPos->GetEntries()) 153 *fLog << inf << "MSrcPlace PreProcess Message: source postions will be read from internal histo (" << fHistPos->GetName() << ")" << endl; 154 else 155 { 156 *fLog << err << "MSrcPlace PreProcess Error: source postions attempted to be read from empty histo (" << fHistPos->GetName() << ")" << endl; 157 return kFALSE; 158 } 159 } 160 return kTRUE; 153 161 } 154 162 … … 183 191 Int_t MSrcPlace::PostProcess() 184 192 { 185 *fLog << inf << endl; 186 *fLog << inf << "MSrcPlace::PostProcess Message: Created internal histogram with: "; 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; 192 193 if(fMode==kOn) 194 { 195 *fLog << inf << endl; 196 *fLog << inf << "MSrcPlace::PostProcess Message: Created internal histogram with: " << endl; 197 *fLog << inf << "Entries: " << fHistPos->GetEntries() << endl; 198 *fLog << inf << "X projection mean: " << fHistPos->ProjectionX()->GetMean() << endl; 199 *fLog << inf << "X projection rms: " << fHistPos->ProjectionX()->GetRMS() << endl; 200 *fLog << inf << "Y projection mean: " << fHistPos->ProjectionY()->GetMean() << endl; 201 *fLog << inf << "Y projection rms: " << fHistPos->ProjectionY()->GetRMS() << endl; 202 } 193 203 return kTRUE; 194 204 } -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.h
r4084 r4087 25 25 OnOffMode_t fMode; // On/Off data mode (write/read to/from the histogram) 26 26 27 virtual Int_t PreProcess(MParList *plist); 27 void SavePosIntoHisto(); 28 void ReadPosFromHisto(); 29 28 30 virtual Int_t Process(); 29 31 virtual Int_t PostProcess(); 30 32 31 void SavePosIntoHisto(); 32 void ReadPosFromHisto(); 33 33 protected: 34 virtual Int_t PreProcess(MParList *plist); 34 35 35 36 public: … … 49 50 MDCA* GetDCA() {return fDCA;} 50 51 51 Int_t SearchForSrcPos(MParList *plist);52 52 virtual Int_t ComputeNewSrcPosition() {return kTRUE;} 53 53 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc
r4084 r4087 42 42 #include "MRawRunHeader.h" 43 43 #include "MSrcPosCam.h" 44 #include "MDCA.h" 44 45 45 46 #include "MLog.h" … … 92 93 Int_t MSrcPosFromFile::PreProcess(MParList *pList) 93 94 { 94 // Count the number of runs in the card with the source poistions 95 ReadSourcePositionsFile(kCount); 96 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); 103 104 // Read card with the source poistions 105 ReadSourcePositionsFile(kRead); 106 107 108 if(!SearchForSrcPos(pList)) 95 if(GetMode()==MSrcPlace::kOn) 96 { 97 // Count the number of runs in the card with the source poistions 98 ReadSourcePositionsFile(kCount); 99 100 if(!fRunList) 101 fRunList = new Int_t[fNumRuns]; 102 if(!fRunSrcPos) 103 fRunSrcPos = new MSrcPosCam[fNumRuns]; 104 if(!fRunMap) 105 fRunMap = new TExMap(fNumRuns); 106 107 // Read card with the source poistions 108 ReadSourcePositionsFile(kRead); 109 } 110 111 if(!MSrcPlace::PreProcess(pList)) 109 112 return kFALSE; 110 113 … … 131 134 fLastRun=run; 132 135 MSrcPosCam* srcpos = (MSrcPosCam*)fRunMap->GetValue(run); 133 134 Float_t x; 135 Float_t y; 136 136 137 137 *fLog << inf << "Source position for run " << run; 138 if (srcpos) 138 139 if(srcpos) 140 fLastValidSrcPosCam = srcpos; 141 else 142 *fLog << inf << " not found in file. Taking previous position: "; 143 144 if(fLastValidSrcPosCam) 139 145 { 140 fLastValidSrcPosCam = srcpos; 141 x = srcpos->GetX(); 142 y = srcpos->GetY(); 143 } 144 else if(fLastValidSrcPosCam) 145 { 146 x = fLastValidSrcPosCam->GetX(); 147 y = fLastValidSrcPosCam->GetY(); 148 149 *fLog << inf << " not found in file. Taking previous position: "; 146 *fLog << inf << "\tX\t" << setprecision(3) << fLastValidSrcPosCam->GetX(); 147 *fLog << inf << "\tY\t" << setprecision(3) << fLastValidSrcPosCam->GetY() << endl; 150 148 } 151 else 152 { 153 *fLog << err << "MSrcPosFromFile::ComputeNewSrcPosition error: no value for the first run. Don't know what values to take" << endl; 154 return kFALSE; 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; 161 } 162 149 } 150 151 if(fLastValidSrcPosCam) 152 { 153 GetSrcPosCam()->SetXY(fLastValidSrcPosCam->GetX(),fLastValidSrcPosCam->GetY()); 154 GetDCA()->SetRefPoint(fLastValidSrcPosCam->GetX(),fLastValidSrcPosCam->GetY()); 155 } 156 else 157 { 158 *fLog << err << "MSrcPosFromFile::ComputeNewSrcPosition error: no value for the first run. Don't know what values to take" << endl; 159 return kFALSE; 160 } 161 163 162 return kTRUE; 164 163 } -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcRotate.cc
r4084 r4087 83 83 Int_t MSrcRotate::PreProcess(MParList *pList) 84 84 { 85 if(! SearchForSrcPos(pList))85 if(!MSrcPlace::PreProcess(pList)) 86 86 return kFALSE; 87 87 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.cc
r4084 r4087 28 28 // Task to translate the position of the source, starting from previous source 29 29 // position (fTranslationIsRelative=kTRUE) or from camera center 30 // (fTranslationIsRelative=kFALSE) 30 // (fTranslationIsRelative=kFALSE). This task allows you to modify the position 31 // of the source in an event-by-event basis 31 32 // 32 33 // Input Containers: … … 82 83 { 83 84 // look for/create MSrcPosCam and DCA 84 if(! SearchForSrcPos(pList))85 if(!MSrcPlace::PreProcess(pList)) 85 86 return kFALSE; 86 87 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.h
r4074 r4087 24 24 virtual Int_t ComputeNewSrcPosition(); 25 25 26 ClassDef(MSrcTranslate, 0) // task to rotate the position of the source as a function of Azimuth and Zenith angles26 ClassDef(MSrcTranslate, 0) // task to set the position of the source within the camera in an event by event basis 27 27 }; 28 28 -
trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard
r4084 r4087 1 1 2 2 // Maximun number of on and off events to be processed) 3 NEVENTS 999999993 NEVENTS 20000 4 4 5 5 // Input file name pattern
Note:
See TracChangeset
for help on using the changeset viewer.