Changeset 4002 for trunk/MagicSoft/Mars
- Timestamp:
- 05/07/04 12:46:57 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstroCamera.h
r3957 r4002 31 31 ~MAstroCamera(); 32 32 33 void SetStarList(TList*) 34 { 35 } 36 37 void FillStarList() 38 { 39 } 40 33 41 void SetMirrors(TClonesArray &arr); 34 42 void SetMirrors(const char *fname); -
trunk/MagicSoft/Mars/mtemp/MFindStars.cc
r3808 r4002 58 58 { 59 59 fName = name ? name : "MFindStars"; 60 fTitle = title ? title : "Tool to find stars from BaseCurrents";60 fTitle = title ? title : "Tool to find stars from DC Currents"; 61 61 62 62 fMaxNumIntegratedEvents = 10; 63 fRingInterest = 100; //[mm] ~ 0.3 deg 64 63 fRingInterest = 100.; //[mm] ~ 0.3 deg 64 fMinDCForStars = 3.; //[uA] 65 65 66 fPixelsUsed.Set(577); 66 67 fPixelsUsed.Reset((Char_t)kTRUE); … … 94 95 } 95 96 96 fDrive = (MReportDrive*)pList->FindObject(AddSerialNumber("MReportDrive"));97 fDrive = (MReportDrive*)pList->FindObject(AddSerialNumber("MReportDrive")); 97 98 98 99 if (!fDrive) … … 101 102 return kFALSE; 102 103 } 104 else 105 { 106 //Initialitation MAstroCamera 107 // Name of a MC file having MGeomCam and MMcConfigRunHeader 108 TString fname = "../data/Gamma_zbin9_90_7_1480to1489_w0.root"; 109 110 // Time for which to get the picture 111 // MTime time; 112 // time.Set(2004, 2, 28, 01, 32, 15); 113 114 // Current observatory 115 MObservatory magic1; 116 117 // Right Ascension [h] and declination [deg] of source 118 // Currently 'perfect' pointing is assumed 119 // const Double_t ra = MAstro::Hms2Rad(5, 34, 31.9); 120 // const Double_t dec = MAstro::Dms2Rad(22, 0, 52.0); 121 122 // -------------------------------------------------------------------------- 123 // Create camera display from geometry 124 MMcConfigRunHeader *config=0; 125 MGeomCam *geom=0; 126 127 TFile file(fname); 128 TTree *tree = (TTree*)file.Get("RunHeaders"); 129 tree->SetBranchAddress("MMcConfigRunHeader", &config); 130 if (tree->GetBranch("MGeomCam")) 131 tree->SetBranchAddress("MGeomCam", &geom); 132 tree->GetEntry(0); 133 134 fAstro.SetMirrors(*config->GetMirrors()); 135 fAstro.SetGeom(*geom); 136 137 138 fAstro.SetLimMag(6); 139 fAstro.SetRadiusFOV(3); 140 fAstro.ReadBSC("../data/bsc5.dat"); 141 142 fAstro.SetObservatory(magic1); 143 // Time for which to get the picture 144 // MTime time; 145 // time.Set(2004, 2, 28, 01, 32, 15); 146 // fAstro.SetTime(time); 147 fAstro.SetTime(*fTimeCurr); 148 fAstro.SetGuiActive(); 149 150 fAstro.SetStarList(fStars->GetList()); 151 152 } 153 103 154 104 155 fStars = (MStarLocalCam*)pList->FindCreateObj(AddSerialNumber("MStarLocalCam")); … … 109 160 } 110 161 111 //Initialitation MAstroCamera112 // Name of a MC file having MGeomCam and MMcConfigRunHeader113 TString fname = "../data/Gamma_zbin9_90_7_1480to1489_w0.root";114 115 // Time for which to get the picture116 // MTime time;117 // time.Set(2004, 2, 28, 01, 32, 15);118 119 // Current observatory120 MObservatory magic1;121 122 // Right Ascension [h] and declination [deg] of source123 // Currently 'perfect' pointing is assumed124 // const Double_t ra = MAstro::Hms2Rad(5, 34, 31.9);125 // const Double_t dec = MAstro::Dms2Rad(22, 0, 52.0);126 127 // --------------------------------------------------------------------------128 // Create camera display from geometry129 MMcConfigRunHeader *config=0;130 MGeomCam *geom=0;131 132 TFile file(fname);133 TTree *tree = (TTree*)file.Get("RunHeaders");134 tree->SetBranchAddress("MMcConfigRunHeader", &config);135 if (tree->GetBranch("MGeomCam"))136 tree->SetBranchAddress("MGeomCam", &geom);137 tree->GetEntry(0);138 139 fAstro.SetMirrors(*config->GetMirrors());140 fAstro.SetGeom(*geom);141 142 143 fAstro.SetLimMag(6);144 fAstro.SetRadiusFOV(3);145 fAstro.ReadBSC("../data/bsc5.dat");146 147 fAstro.SetObservatory(magic1);148 // Time for which to get the picture149 // MTime time;150 // time.Set(2004, 2, 28, 01, 32, 15);151 // fAstro.SetTime(time);152 fAstro.SetTime(*fTimeCurr);153 fAstro.SetGuiActive();154 155 fAstro.SetStarList(fStars->GetList());156 157 162 return kTRUE; 158 163 } … … 160 165 Int_t MFindStars::Process() 161 166 { 162 163 Float_t ra = fDrive->GetRa();164 Float_t dec = fDrive->GetDec();165 166 fAstro.SetRaDec(ra, dec);167 fAstro.SetGuiActive();168 169 fAstro.FillStarList();170 171 167 if (fNumIntegratedEvents < fMaxNumIntegratedEvents) 172 168 { … … 176 172 else 177 173 { 178 //loop to extract position of stars on the camera 179 TIter Next(fStars->GetList()); 180 MStarLocalPos* star; 181 while ((star=(MStarLocalPos*)Next())) 182 FindStar(star); 183 184 //After finding stars reset all vairables 185 fDisplay.Reset(); 186 fNumIntegratedEvents=0; 174 if (fDrive) 175 { 176 Float_t ra = fDrive->GetRa(); 177 Float_t dec = fDrive->GetDec(); 178 179 fAstro.SetRaDec(ra, dec); 180 fAstro.SetGuiActive(); 181 182 fAstro.FillStarList(); 183 } 184 else 185 { 186 Float_t maxPixelDC; 187 MGeomPix maxPixel; 188 while(1) 189 { 190 FindPixelWithMaxDC(maxPixelDC, maxPixel); 191 if (maxPixelDC<fMinDCForStars) 192 break; 193 194 MStarLocalPos *starpos = new MStarLocalPos; 195 starpos->SetExpValues(maxPixelDC,maxPixel.GetX(),maxPixel.GetY()); 196 fStars->GetList()->Add(starpos); 197 } 198 } 199 200 //loop to extract position of stars on the camera 201 TIter Next(fStars->GetList()); 202 MStarLocalPos* star; 203 while ((star=(MStarLocalPos*)Next())) 204 { 205 FindStar(star); 206 ShadowStar(star); 207 } 208 209 210 //After finding stars reset all vairables 211 fDisplay.Reset(); 212 fNumIntegratedEvents=0; 187 213 } 188 214 … … 206 232 } 207 233 208 Bool_t MFindStars::FindStar(MStarLocalPos* star) 209 { 210 211 Float_t expX = star->GetXExp(); 212 Float_t expY = star->GetYExp(); 213 234 Bool_t MFindStars::FindPixelWithMaxDC(Float_t &maxDC, MGeomPix &maxPix) 235 { 214 236 UInt_t numPixels = fGeomCam->GetNumPixels(); 215 237 216 // First define a area of interest around the expected position of the star 238 // Find the two close pixels with the maximun dc 239 UInt_t maxPixIdx[2]; 240 217 241 for (UInt_t pix=1; pix<numPixels; pix++) 218 242 { 219 220 Float_t pixXpos=(*fGeomCam)[pix].GetX(); 221 Float_t pixYpos=(*fGeomCam)[pix].GetY(); 222 Float_t dist = sqrt((pixXpos-expX)*(pixXpos-expX)+ 223 (pixYpos-expY)*(pixYpos-expY)); 224 225 if (dist < fRingInterest) 226 fPixelsUsed[pix]=(Char_t)kTRUE; 227 } 228 229 fDisplay.SetUsed(fPixelsUsed); 230 231 // Find the two close pixels with the maximun dc 232 for (UInt_t pix=1; pix<numPixels; pix++) 233 { 234 Float_t maxDC = 0; 243 maxDC = 0; 235 244 236 245 if(fDisplay.IsUsed(pix)) 237 246 { 238 247 Float_t dc[2]; 239 Float_t maxPix[2];240 248 dc[0] = fDisplay.GetBinContent(pix+1); 241 249 242 MGeomPix g = (*fGeomCam)[pix];250 MGeomPix &g = (*fGeomCam)[pix]; 243 251 Int_t numNextNeighbors = g.GetNumNeighbors(); 244 252 … … 256 264 if(dcsum > maxDC*2) 257 265 { 258 maxPix[0] = pix; 259 maxPix[1] = swneighbor; 260 maxDC = dcsum/2; 266 if(dc[0]>=dc[1]) 267 { 268 maxPixIdx[0] = pix; 269 maxPixIdx[1] = swneighbor; 270 } 271 else 272 { 273 maxPixIdx[1] = pix; 274 maxPixIdx[0] = swneighbor; 275 } 276 maxDC = dcsum/2; 261 277 } 262 278 } … … 264 280 } 265 281 } 282 283 maxPix = (*fGeomCam)[maxPixIdx[0]]; 284 return kTRUE; 285 } 286 287 Bool_t MFindStars::FindStar(MStarLocalPos* star) 288 { 289 290 MHCamera cam = fDisplay; 291 292 Float_t expX = star->GetXExp(); 293 Float_t expY = star->GetYExp(); 294 295 UInt_t numPixels = fGeomCam->GetNumPixels(); 296 297 // First define a area of interest around the expected position of the star 298 for (UInt_t pix=1; pix<numPixels; pix++) 299 { 300 301 Float_t pixXpos=(*fGeomCam)[pix].GetX(); 302 Float_t pixYpos=(*fGeomCam)[pix].GetY(); 303 Float_t dist = sqrt((pixXpos-expX)*(pixXpos-expX)+ 304 (pixYpos-expY)*(pixYpos-expY)); 305 306 if (dist < fRingInterest && cam.IsUsed(pix)) 307 fPixelsUsed[pix]=(Char_t)kTRUE; 308 } 309 310 cam.SetUsed(fPixelsUsed); 311 266 312 267 313 // determine mean x and mean y of the selected px … … 274 320 for(UInt_t pix=0; pix<numPixels; pix++) 275 321 { 276 if( fDisplay.IsUsed(pix))322 if(cam.IsUsed(pix)) 277 323 { 278 324 usedPx++; 279 325 280 Float_t charge= fDisplay.GetBinContent(pix+1);326 Float_t charge=cam.GetBinContent(pix+1); 281 327 Float_t pixXpos=(*fGeomCam)[pix].GetX(); 282 328 Float_t pixYpos=(*fGeomCam)[pix].GetY(); … … 287 333 meanSqY+=charge*pixYpos*pixYpos; 288 334 sumCharge+=charge; 289 // fDisplay.ResetUsed(i); // this px must not be used again!335 // cam.ResetUsed(i); // this px must not be used again! 290 336 } //for... use 291 337 } 292 338 293 339 star->SetCalcValues(sumCharge,meanX,meanY,meanSqX,meanSqY); 294 fStars->GetList()->Add(star);295 340 296 341 return kTRUE; 297 342 } 298 343 299 300 301 344 Bool_t MFindStars::ShadowStar(MStarLocalPos* star) 345 { 346 UInt_t numPixels = fGeomCam->GetNumPixels(); 347 348 // Define an area around the star which will be set unused. 349 for (UInt_t pix=1; pix<numPixels; pix++) 350 { 351 352 Float_t pixXpos = (*fGeomCam)[pix].GetX(); 353 Float_t pixYpos = (*fGeomCam)[pix].GetY(); 354 Float_t starXpos = star->GetMeanXCalc(); 355 Float_t starYpos = star->GetMeanYCalc(); 356 357 Float_t starSize = 2*star->GetSigmaMajorAxisCalc(); 358 359 Float_t dist = sqrt((pixXpos-starXpos)*(pixXpos-starXpos)+ 360 (pixYpos-starYpos)*(pixYpos-starYpos)); 361 362 if (dist > starSize && fDisplay.IsUsed(pix)) 363 fPixelsUsed[pix]=(Char_t)kTRUE; 364 } 365 366 fDisplay.SetUsed(fPixelsUsed); 367 368 return kTRUE; 369 } 370 371 372 -
trunk/MagicSoft/Mars/mtemp/MFindStars.h
r3808 r4002 23 23 24 24 class MGeomCam; 25 class MGeomPix; 25 26 class MCameraDC; 26 27 class MTime; … … 48 49 49 50 Float_t fRingInterest; //[mm] 51 Float_t fMinDCForStars; 50 52 51 public: 53 Bool_t FindPixelWithMaxDC(Float_t &maxDC, MGeomPix &maxPix); 54 Bool_t FindStar(MStarLocalPos* star); 55 Bool_t ShadowStar(MStarLocalPos* star); 56 57 public: 52 58 MFindStars(const char *name=NULL, const char *title=NULL); 53 59 … … 60 66 void SetBlindPixels(TArrayS blindpixels); 61 67 62 Bool_t FindStar(MStarLocalPos* star);63 68 64 ClassDef(MFindStars, 0) // Tool to find stars from BaseCurrents69 ClassDef(MFindStars, 0) // Tool to find stars from DC Currents 65 70 }; 66 71 -
trunk/MagicSoft/Mars/mtemp/Makefile
r3927 r4002 11 11 #------------------------------------------------------------------------------ 12 12 13 INCLUDES = -I.14 15 13 CINT = Temp 16 14 17 SRCFILES = 15 #------------------------------------------------------------------------------ 16 17 INCLUDES = -I. \ 18 -I../mbase \ 19 -I../mjobs \ 20 -I../mpedestal \ 21 -I../mbadpixels \ 22 -I../mfileio \ 23 -I../mraw \ 24 -I../manalysis \ 25 -I../mgui \ 26 -I../mgeom \ 27 -I../msignal \ 28 -I../mcalib \ 29 -I../mfilter \ 30 -I../mhbase \ 31 -I../mimage \ 32 -I../mpointing \ 33 -I../mcamera \ 34 -I../mhist \ 35 -I../mmc \ 36 -I../mreport \ 37 -I../mastro 38 39 SRCFILES = \ 40 MStarLocalPos.cc \ 41 MStarLocalCam.cc \ 42 MFindStars.cc 18 43 19 44 ############################################################ … … 23 48 include ../Makefile.rules 24 49 50 clean: rmcint rmobjs rmcore rmlib 25 51 mrproper: clean rmbak -
trunk/MagicSoft/Mars/mtemp/TempLinkDef.h
r3927 r4002 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MStarLocalPos+; 8 #pragma link C++ class MStarLocalCam+; 9 #pragma link C++ class MFindStars+; 10 11 #endif
Note:
See TracChangeset
for help on using the changeset viewer.