Changeset 3274
- Timestamp:
- 02/24/04 15:49:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3273 r3274 5 5 -*-*- END OF LINE -*-*- 6 6 7 8 9 10 2004/02/24: Wolfgang Wittek 11 * manalysis/MSourcPosfromStarPos.[h,cc] 12 - change member function SetSourceAndStarPosition() to expect sky 13 coordinates in the standard units 14 - generalize to more than 1 star 15 - the class is not yet fully tested 16 17 * mfilter/MFSelBasic.[h,cc] 18 - change default values of cuts 19 7 20 8 21 2004/02/24: Markus Gaug -
trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C
r3209 r3274 172 172 //----------------------------------------------- 173 173 //const char *offfile = "~magican/ct1test/wittek/offdata.preproc"; 174 const char *offfile = "20040126_OffCrab_"; 174 //const char *offfile = "20040126_OffCrab_"; 175 //const char *offfile = "*.OFF"; 176 const char *offfile = "12*.OFF"; 175 177 176 178 //const char *onfile = "~magican/ct1test/wittek/mkn421_on.preproc"; 177 179 // const char *onfile = "~magican/ct1test/wittek/mkn421_00-01"; 178 const char *onfile = "20040126_Crab_"; 180 //const char *onfile = "20040126_Crab_"; 181 //const char *onfile = "MCerPhot_output"; 182 //const char *onfile = "*.ON"; 183 const char *onfile = "12*.ON"; 179 184 180 185 const char *mcfile = "/data/MAGIC/mc_eth/magLQE_3/gh/0/0/G_M0_00_0_550*.root"; … … 184 189 185 190 // path for input for Mars 186 TString inPath = "/.magic/magicserv01/scratch/"; 191 //TString inPath = "/.magic/magicserv01/scratch/"; 192 TString inPath = "/mnt/data17a/hbartko/"; 193 //TString inPath = "~wittek/datacrab_feb04/"; 187 194 188 195 // path for output from Mars 189 TString outPath = "~wittek/datacrab /";196 TString outPath = "~wittek/datacrab_feb04/"; 190 197 191 198 //----------------------------------------------- … … 235 242 Bool_t JobB_SC_UP = kFALSE; 236 243 Bool_t CMatrix = kFALSE; // create training and test matrices 237 Bool_t RMatrix = k TRUE; // read training and test matrices from file238 Bool_t WOptimize = k TRUE; // do optimization using the training sample244 Bool_t RMatrix = kFALSE; // read training and test matrices from file 245 Bool_t WOptimize = kFALSE; // do optimization using the training sample 239 246 // and write supercuts parameter values 240 247 // onto the file parSCfile 241 248 Bool_t RTest = kFALSE; // test the supercuts using the test matrix 242 Bool_t WSC = k FALSE; // update input root file ?249 Bool_t WSC = kTRUE; // update input root file ? 243 250 244 251 … … 316 323 TString fileON = inPath; 317 324 fileON += onfile; 318 fileON += "CalibratedEvts";319 325 fileON += ".root"; 320 326 321 327 TString fileOFF = inPath; 322 328 fileOFF += offfile; 323 fileOFF += "CalibratedEvts";324 329 fileOFF += ".root"; 325 330 326 331 TString fileMC = mcfile; 327 332 fileMC += mcfile; 328 fileMC += "CalibratedEvts";329 333 fileMC += ".root"; 330 334 … … 339 343 //-------------------------------------------------- 340 344 // type of data to be padded 341 //TString typeInput = "ON";342 TString typeInput = "OFF";345 TString typeInput = "ON"; 346 //TString typeInput = "OFF"; 343 347 //TString typeInput = "MC"; 344 348 gLog << "typeInput = " << typeInput << endl; … … 366 370 outNameImage += "Hillas"; 367 371 outNameImage += typeInput; 368 outNameImage += "1 .root";372 outNameImage += "1a.root"; 369 373 gLog << "padded data to be written onto : " << outNameImage << endl; 370 374 … … 680 684 MGeomApply apply; 681 685 682 MPedestalWorkaround waround;686 //MPedestalWorkaround waround; 683 687 684 688 // a way to find out whether one is dealing with MC : … … 693 697 // "MCT1PointingCorrCalc"); 694 698 //} 699 MSourcePosfromStarPos sourcefromstar; 700 sourcefromstar.SetSourceAndStarPosition("Crab", 22, 0, 52, 5, 34, 32, 701 "Zeta-Tau", 21, 8, 33, 5, 37, 38.7); 702 sourcefromstar.AddFile("~wittek/datacrab_feb04/positions.4.txt", 0); 695 703 696 704 MBlindPixelCalc blindbeforepad; … … 706 714 contbasic.SetName("SelBasic"); 707 715 708 //MFillH fillblind("BlindPixels[MHBlindPixels]", "MBlindPixels");709 //fillblind.SetName("HBlind");716 MFillH fillblind("BlindPixels[MHBlindPixels]", "MBlindPixels"); 717 fillblind.SetName("HBlind"); 710 718 711 719 MSigmabarCalc sigbarcalc; … … 750 758 selstandard.SetHillasName(fHilName); 751 759 selstandard.SetImgParName(fImgParName); 752 selstandard.SetCuts( 100, 4, 20, 0.0, 1.0, 0.0, 0.0);760 selstandard.SetCuts(200, 6, 600, 0.4, 1.1, 0.0, 0.0); 753 761 MContinue contstandard(&selstandard); 754 762 contstandard.SetName("SelStandard"); … … 786 794 //tliston.AddToList(&f2); 787 795 tliston.AddToList(&apply); 788 tliston.AddToList(&waround); 796 //tliston.AddToList(&waround); 797 tliston.AddToList(&sourcefromstar); 789 798 790 799 //tliston.AddToList(&blindbeforepad); … … 793 802 // tliston.AddToList(&pointcorr); 794 803 795 //tliston.AddToList(&blind);796 tliston.AddToList(&contbasic);797 798 //tliston.AddToList(&fillblind);804 tliston.AddToList(&blind); 805 //tliston.AddToList(&contbasic); 806 807 tliston.AddToList(&fillblind); 799 808 tliston.AddToList(&sigbarcalc); 800 809 tliston.AddToList(&fillsigtheta); … … 1783 1792 TString parSCinit = outPath; 1784 1793 //parSCinit += "parSC_060204"; 1794 //parSCinit = "parSC_240204a"; 1785 1795 parSCinit = ""; 1786 1796 … … 1802 1812 1803 1813 TString parSCfile = outPath; 1804 parSCfile += "parSC_ 130204a";1814 parSCfile += "parSC_240204a"; 1805 1815 1806 1816 gLog << "parSCfile = " << parSCfile << endl; … … 1843 1853 filenameTrain += typeInput; 1844 1854 filenameTrain += "1.root"; 1845 Int_t howManyTrain = 7000;1855 Int_t howManyTrain = 20000; 1846 1856 gLog << "filenameTrain = " << filenameTrain << ", howManyTrain = " 1847 1857 << howManyTrain << endl; … … 1853 1863 filenameTest += typeInput; 1854 1864 filenameTest += "1.root"; 1855 Int_t howManyTest = 7000;1865 Int_t howManyTest = 20000; 1856 1866 1857 1867 gLog << "filenameTest = " << filenameTest << ", howManyTest = " -
trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.cc
r3209 r3274 44 44 #include <TList.h> 45 45 #include <TSystem.h> 46 #include <TMatrixD.h> 46 47 47 48 #include <fstream> … … 53 54 #include "MGeomCam.h" 54 55 #include "MSrcPosCam.h" 56 #include "MMcEvt.hxx" 55 57 56 58 #include "MLog.h" … … 67 69 MSourcePosfromStarPos::MSourcePosfromStarPos( 68 70 const char *name, const char *title) 69 71 : fIn(NULL) 70 72 { 71 73 fName = name ? name : "MSourcePosfromStarPos"; … … 74 76 fFileNames = new TList; 75 77 fFileNames->SetOwner(); 78 79 fRuns = 0; 80 fSize = 100; 81 fStars = 1; 82 83 fRunNr.Set(fSize); 84 85 fThetaTel.Set(fSize); 86 fPhiTel.Set(fSize); 87 fdThetaTel.Set(fSize); 88 fdPhiTel.Set(fSize); 89 90 fDecStar.Set(fStars); 91 fRaStar.Set(fStars); 92 fxStar.ResizeTo(fStars,fSize); 93 fyStar.ResizeTo(fStars,fSize); 94 fdxStar.ResizeTo(fStars,fSize); 95 fdyStar.ResizeTo(fStars,fSize); 76 96 } 77 97 … … 92 112 // Set the sky coordinates of the source and of the star 93 113 // 114 // Input : 115 // declination in units of (Deg, Min, Sec) 116 // right ascension in units of (Hour, Min, Sec) 117 // 118 94 119 void MSourcePosfromStarPos::SetSourceAndStarPosition( 95 Double_t decSource, Double_t raSource, 96 Double_t decStar, Double_t raStar) 97 { 98 fDecSource = decSource; 99 fRaSource = raSource; 100 101 fDecStar = decStar; 102 fRaStar = raStar; 103 104 *fLog << all << "MSourcePosfromStarPos::SetSourceAndStarPosition; fDecSource, fRaSource, fDecStar, fRaStar were set to : " 120 TString nameSource, 121 Double_t decSourceDeg, Double_t decSourceMin, Double_t decSourceSec, 122 Double_t raSourceHour, Double_t raSourceMin, Double_t raSourceSec, 123 TString nameStar, 124 Double_t decStarDeg, Double_t decStarMin, Double_t decStarSec, 125 Double_t raStarHour, Double_t raStarMin, Double_t raStarSec ) 126 { 127 *fLog << "MSourcePosfromStarPos::SetSourceAndStarPosition :" << endl; 128 *fLog << " Source : " << nameSource << " " << decSourceDeg << ":" 129 << decSourceMin << ":" << decSourceSec << endl; 130 *fLog << " Star : " << nameStar << " " << decStarDeg << ":" 131 << decStarMin << ":" << decStarSec << endl; 132 133 // convert into radians 134 fDecSource = (decSourceDeg + decSourceMin/60.0 + decSourceSec/3600.0) 135 / kRad2Deg; 136 fRaSource = (raSourceHour + raSourceMin/60.0 + raSourceSec/3600.0) 137 * 360.0 / (24.0 * kRad2Deg); 138 139 fDecStar.Set(fStars); 140 fDecStar[fStars-1] = (decStarDeg + decStarMin/60.0 + decStarSec/3600.0) 141 / kRad2Deg; 142 fRaStar[fStars-1] = (raStarHour + raStarMin/60.0 + raStarSec/3600.0) 143 * 360.0 / (24.0 * kRad2Deg); 144 145 *fLog << all << "MSourcePosfromStarPos::SetSourceAndStarPosition; fDecSource, fRaSource, fDecStar, fRaStar were set to : [radians] " 105 146 << fDecSource << ", " << fRaSource << ", " 106 << fDecStar << ", " << fRaStar << endl; 147 << fDecStar[fStars-1] << ", " << fRaStar[fStars-1] << endl; 148 } 149 150 // -------------------------------------------------------------------------- 151 // 152 // Set the sky coordinates of another star 153 // 154 // Input : 155 // declination in units of (Deg, Min, Sec) 156 // right ascension in units of (Hour, Min, Sec) 157 // 158 159 void MSourcePosfromStarPos::AddStar( 160 TString nameStar, 161 Double_t decStarDeg, Double_t decStarMin, Double_t decStarSec, 162 Double_t raStarHour, Double_t raStarMin, Double_t raStarSec ) 163 { 164 *fLog << "MSourcePosfromStarPos::AddStar :" << endl; 165 *fLog << " Star : " << nameStar << " " << decStarDeg << ":" 166 << decStarMin << ":" << decStarSec << endl; 167 168 // convert into radians 169 Int_t fStars = fDecStar.GetSize() + 1; 170 fDecStar.Set(fStars); 171 fDecStar[fStars-1] = (decStarDeg + decStarMin/60.0 + decStarSec/3600.0) 172 / kRad2Deg; 173 fRaStar[fStars-1] = (raStarHour + raStarMin/60.0 + raStarSec/3600.0) 174 * 360.0 / (24.0 * kRad2Deg); 175 176 *fLog << all << "MSourcePosfromStarPos::AddStar; fDecStar, fRaStar were set to : [radians] " 177 << fDecStar[fStars-1] << ", " << fRaStar[fStars-1] << endl; 107 178 } 108 179 … … 119 190 } 120 191 fMm2Deg = geom->GetConvMm2Deg(); 192 // fDistCameraReflector is the distance of the camera from the reflector center in [mm] 193 fDistCameraReflector = kRad2Deg / fMm2Deg; 194 *fLog << all << "MSourcePosfromStarPos::PreProcess; fMm2Deg, fDistCameraReflector = " 195 << fMm2Deg << ", " << fDistCameraReflector << endl; 121 196 122 197 … … 124 199 if (!fRun) 125 200 { 126 *fLog << err << "M RawRunHeader not found... aborting." << endl;201 *fLog << err << "MSourcePosfromStarPos::PreProcess; MRawRunHeader not found... aborting." << endl; 127 202 return kFALSE; 128 203 } 204 205 206 fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt"); 207 if (!fMcEvt) 208 { 209 *fLog << err << "MSourcePosfromStarPos::PreProcess; MMcEvt not found... aborting." << endl; 210 return kFALSE; 211 } 129 212 130 213 … … 132 215 if (!fSrcPos) 133 216 { 134 *fLog << err << "MSourcePosfromStarPos :MSrcPosCam not found... aborting" << endl;217 *fLog << err << "MSourcePosfromStarPos::PreProcess; MSrcPosCam not found... aborting" << endl; 135 218 return kFALSE; 136 219 } … … 140 223 // 141 224 142 fRuns = 0;143 fSize = 0;144 145 225 while(1) 146 226 { 147 if (!OpenNextFile()) break; 148 149 if (fIn->eof()) 150 if (!OpenNextFile()) break; 151 152 // FIXME! Set InputStreamID 153 154 ReadData(); 227 if (!OpenNextFile()) 228 { 229 *fLog << "there is no more file to open" << endl; 230 break; 231 } 232 233 *fLog << "read data" << endl; 234 while (1) 235 { 236 if (fIn->eof()) 237 { 238 *fLog << "eof encountered; open next file" << endl; 239 240 if (!OpenNextFile()) break; 241 } 242 243 // FIXME! Set InputStreamID 244 245 ReadData(); 246 } 155 247 } 156 248 249 *fLog << "all data were read" << endl; 157 250 FixSize(); 158 251 //------------------------------------------------------------- … … 186 279 187 280 void MSourcePosfromStarPos::SourcefromStar(Double_t &f, 188 Double_t &decStar, Double_t&raStar,281 TArrayD &decStar, TArrayD &raStar, 189 282 Double_t &decSource, Double_t &raSource, 190 283 Double_t &thetaTel, Double_t &phiTel, 191 Double_t &xStar, Double_t&yStar,192 Double_t &dxStar, Double_t&dyStar,284 TArrayD &xStar, TArrayD &yStar, 285 TArrayD &dxStar, TArrayD &dyStar, 193 286 Double_t &xSource, Double_t &ySource, 194 287 Double_t &dxSource, Double_t &dySource) 195 288 { 289 *fLog << "MSourcePosfromStarPos::SourcefromStar : printout in degrees" << endl; 290 *fLog << " decStar, raStar = " << decStar[0]*kRad2Deg << ", " 291 << raStar[0]*kRad2Deg << endl; 292 *fLog << " decSource, raSource = " << decSource*kRad2Deg << ", " 293 << raSource*kRad2Deg << endl; 294 *fLog << " thetaTel, phiTel = " << thetaTel*kRad2Deg << ", " 295 << phiTel*kRad2Deg << endl; 296 *fLog << " xStar, yStar = " << xStar[0]*fMm2Deg << ", " 297 << yStar[0]*fMm2Deg << endl; 298 299 *fLog << "MSourcePosfromStarPos::SourcefromStar : printout in radians and mm" << endl; 300 *fLog << " decStar, raStar = " << decStar[0] << ", " 301 << raStar[0] << endl; 302 *fLog << " decSource, raSource = " << decSource << ", " 303 << raSource << endl; 304 *fLog << " thetaTel, phiTel = " << thetaTel << ", " 305 << phiTel << endl; 306 *fLog << " xStar, yStar = " << xStar[0] << ", " 307 << yStar[0] << endl; 308 309 196 310 // the units are assumed to be radians for theta, phi, dec and ra 197 311 // and mm for f, x and y 198 312 199 // calculate coordinates of star and source in system B (see TDAS 00-11, eqs. (2)) 200 Double_t xB = cos(decStar) * cos(raStar); 201 Double_t yB = cos(decStar) * sin(raStar); 202 Double_t zB = -sin(decStar); 203 204 Double_t xB0 = cos(decSource) * cos(raSource); 205 Double_t yB0 = cos(decSource) * sin(raSource); 206 Double_t zB0 = -sin(decSource); 207 313 208 314 // calculate rotation angle alpha of sky image in camera 209 315 // (see TDAS 00-11, eqs. (18) and (20)) … … 218 324 Double_t sinal = a1 * sin(phiTel) * denom; 219 325 220 221 // calculate coordinates of star in a system with the basis vectors e1, e2, e3222 // where e1 is in the direction (r0 x a)223 // e2 is in the direction (e1 x r0)224 // and e3 is in the direction -r0;225 // r0 is the direction the telescope is pointing to226 // and a is the earth rotation axis (pointing to the celestial north pole)227 //228 Double_t x = (-xB*yB0 + xB0*yB) / sqrt( xB0*xB0 + yB0*yB0 );229 Double_t y = ( xB*xB0*zB0 + yB*yB0*zB0 - zB*(xB0*xB0 + yB0*yB0) )230 / sqrt( xB0*xB0 + yB0*yB0 );231 Double_t z = -(xB*xB0 + yB*yB0 + zB*zB0);232 233 // calculate coordinates of star in camera234 Double_t xtilde = -f/z * (cosal*x - sinal*y);235 Double_t ytilde = -f/z * (sinal*x + cosal*y);236 237 // calculate coordinates of source in camera238 // note : in real camera signs are inverted (therefore s = -1.0)239 Double_t s = -1.0;240 xSource = s * (s*xStar - xtilde);241 ySource = s * (s*yStar - ytilde);242 243 326 *fLog << "thetaTel, phiTel, cosal, sinal = " << thetaTel << ", " 244 327 << phiTel << ", " << cosal << ", " << sinal << endl; 245 } 246 328 329 330 // calculate coordinates of source in system B (see TDAS 00-11, eqs. (2)) 331 Double_t xB0 = cos(decSource) * cos(raSource); 332 Double_t yB0 = cos(decSource) * sin(raSource); 333 Double_t zB0 = -sin(decSource); 334 335 *fLog << "xB0, yB0, zB0 = " << xB0 << ", " << yB0 << ", " 336 << zB0 << endl; 337 338 //----------------------------------------------------- 339 // loop over stars 340 Double_t sumx = 0.0; 341 Double_t sumy = 0.0; 342 Double_t sumwx = 0.0; 343 Double_t sumwy = 0.0; 344 345 for (Int_t i=0; i<decStar.GetSize(); i++) 346 { 347 // calculate weights 348 Double_t weightx = 1.0 / (dxStar[i]*dxStar[i]); 349 Double_t weighty = 1.0 / (dyStar[i]*dyStar[i]); 350 sumwx += weightx; 351 sumwy += weighty; 352 353 *fLog << "weightx, weighty = " << weightx << ", " << weighty << endl; 354 355 // calculate coordinates of star in system B (see TDAS 00-11, eqs. (2)) 356 Double_t xB = cos(decStar[i]) * cos(raStar[i]); 357 Double_t yB = cos(decStar[i]) * sin(raStar[i]); 358 Double_t zB = -sin(decStar[i]); 359 360 361 *fLog << "xB, yB, zB = " << xB << ", " << yB << ", " 362 << zB << endl; 363 364 365 // calculate coordinates of star in a system with the basis vectors e1, e2, e3 366 // where e1 is in the direction (r0 x a) 367 // e2 is in the direction (e1 x r0) 368 // and e3 is in the direction -r0; 369 // r0 is the direction to the source 370 // and a is the earth rotation axis (pointing to the celestial north pole) 371 // 372 Double_t x = (-xB*yB0 + xB0*yB) / sqrt( xB0*xB0 + yB0*yB0 ); 373 Double_t y = ( xB*xB0*zB0 + yB*yB0*zB0 - zB*(xB0*xB0 + yB0*yB0) ) 374 / sqrt( xB0*xB0 + yB0*yB0 ); 375 Double_t z = -(xB*xB0 + yB*yB0 + zB*zB0); 376 377 *fLog << "x, y, z = " << x << ", " << y << ", " 378 << z << endl; 379 380 381 // calculate coordinates of star in camera 382 Double_t xtilde = -f/z * (cosal*x - sinal*y); 383 Double_t ytilde = -f/z * (sinal*x + cosal*y); 384 385 *fLog << "xtilde, ytile = " << xtilde << ", " << ytilde << endl; 386 387 388 // calculate coordinates of source in camera 389 // note : in real camera signs are inverted (therefore s = -1.0) 390 Double_t s = -1.0; 391 sumx += s * (s*xStar[i] - xtilde) * weightx; 392 sumy += s * (s*yStar[i] - ytilde) * weighty; 393 } 394 //----------------------------------------------------- 395 396 xSource = sumx / sumwx; 397 ySource = sumy / sumwy; 398 dxSource = 1.0 / sqrt(sumwx); 399 dySource = 1.0 / sqrt(sumwy); 400 401 *fLog << all << "MSourcePosfromStarPos::SourcefromStar; xSource, ySource = " 402 << xSource << " +- " << dxSource << ", " 403 << ySource << " +- " << dySource << endl; 404 } 247 405 248 406 // -------------------------------------------------------------------------- … … 253 411 Bool_t MSourcePosfromStarPos::ReInit(MParList *pList) 254 412 { 255 if (fDecStar == 0.0 || fRaStar == 0.0 || 256 fDecSource == 0.0 || fRaSource == 0.0) 257 { 258 *fLog << err << "MSourcePosfromStarPos::ReInit; sky coordinates of star and source are not defined ... aborting" 259 << endl; 260 return kFALSE; 261 } 262 263 // f is the distance of the camera from the reflector center in [mm] 264 Double_t f = kRad2Deg / fMm2Deg; 265 413 //if (fDecSource == 0.0 || fRaSource == 0.0 || fStars == 0) 414 //{ 415 // *fLog << err << "MSourcePosfromStarPos::ReInit; sky coordinates of star and source are not defined ... aborting" 416 // << endl; 417 //return kFALSE; 418 //} 419 420 Int_t run = fRun->GetRunNumber(); 421 422 *fLog << "MSourcePosfromStarPos::ReInit; run = " << run << endl; 423 424 //------------------------------------------------------------------- 425 // search this run in the list 266 426 for (Int_t i=0; i<fSize; i++) 267 427 { 268 Int_t run = fRun->GetRunNumber();269 428 if (run == fRunNr[i]) 270 429 { 271 MSourcePosfromStarPos::SourcefromStar( f, 272 fDecStar, fRaStar, fDecSource, fRaSource, 273 fThetaTel[i], fPhiTel[i], 274 fxStar[i], fyStar[i], 275 fdxStar[i], fdyStar[i], 276 fxSource, fySource, 277 fdxSource, fdySource); 430 //----------------------------------------- 431 // put the zenith angle into MMcEvt 432 433 Double_t thetarad = fThetaTel[i]; 434 Double_t phirad = fPhiTel[i]; 435 fMcEvt->SetTelescopeTheta(thetarad); 436 fMcEvt->SetTelescopePhi(phirad); 437 fMcEvt->SetReadyToSave(); 438 439 *fLog << "theta, phi = " << thetarad*kRad2Deg << ", " 440 << phirad*kRad2Deg << endl; 441 442 //----------------------------------------- 443 // Get source position and put it into MSrcPosCam 444 445 /* 446 if (fStars > 0) 447 { 448 TArrayD xStar(fxStar.GetNrows()); 449 TArrayD dxStar(fdxStar.GetNrows()); 450 TArrayD yStar(fyStar.GetNrows()); 451 TArrayD dyStar(fdyStar.GetNrows()); 452 for (Int_t j=0; j<fxStar.GetNrows(); j++) 453 { 454 xStar[j] = fxStar(j, i); 455 dxStar[j] = fdxStar(j, i); 456 yStar[j] = fyStar(j, i); 457 dyStar[j] = fdyStar(j, i); 458 } 459 460 MSourcePosfromStarPos::SourcefromStar( fDistCameraReflector, 461 fDecStar, fRaStar, fDecSource, fRaSource, 462 fThetaTel[i], fPhiTel[i], 463 xStar, yStar, 464 dxStar, dyStar, 465 fxSource, fySource, 466 fdxSource, fdySource); 278 467 279 fSrcPos->SetXY(fxSource, fySource); 280 281 *fLog << all << "MSourcePosfromStarPos::ReInit; f = " << f << endl; 282 *fLog << all << "MSourcePosfromStarPos::ReInit; fRunNr, fxSource, fySource = " 283 << fRunNr[i] << ", " << fxSource << ", " << fySource 284 << endl; 468 fSrcPos->SetXY(fxSource, fySource); 469 470 *fLog << all << "MSourcePosfromStarPos::ReInit; fRunNr, fxSource, fySource = " 471 << fRunNr[i] << ", " << fxSource << ", " << fySource 472 << endl; 285 473 286 fSrcPos->SetReadyToSave(); 474 fSrcPos->SetReadyToSave(); 475 } 476 */ 477 478 return kTRUE; 287 479 } 288 480 } 481 //------------------------------------------------------------------- 482 *fLog << warn << "MSourcePosfromStarPos::ReInit; no information for run number = " 483 << run << endl; 484 485 Double_t thetadeg = 90.0; 486 Double_t thetarad = thetadeg / kRad2Deg; 487 fMcEvt->SetTelescopeTheta(thetarad); 488 489 Double_t phideg = 0.0; 490 Double_t phirad = phideg / kRad2Deg; 491 fMcEvt->SetTelescopePhi(phirad); 492 fMcEvt->SetReadyToSave(); 289 493 290 494 return kTRUE; … … 296 500 Int_t MSourcePosfromStarPos::Process() 297 501 { 502 Int_t run = fRun->GetRunNumber(); 503 504 //*fLog << "MSourcePosfromStarPos::Process; run = " << run << endl; 505 298 506 299 507 return kTRUE; … … 315 523 void MSourcePosfromStarPos::FixSize() 316 524 { 525 *fLog << "MSourcePosfromStarPos::FixSize; fix size of arrays : fRuns = " 526 << fRuns << endl; 527 317 528 fSize = fRuns; 318 529 … … 324 535 fdPhiTel.Set(fSize); 325 536 326 fxStar.Set(fSize); 327 fyStar.Set(fSize); 328 fdxStar.Set(fSize); 329 fdyStar.Set(fSize); 537 fStars = fxStar.GetNrows(); 538 fxStar.ResizeTo(fStars, fSize); 539 fyStar.ResizeTo(fStars, fSize); 540 fdxStar.ResizeTo(fStars, fSize); 541 fdyStar.ResizeTo(fStars, fSize); 330 542 } 331 543 … … 337 549 { 338 550 Float_t val; 339 340 if (fRuns >= fSize) 551 Int_t ival; 552 553 // extend size of arrays if necessary 554 if ( fRuns >= (fSize-1) ) 341 555 { 342 556 fSize += 100; … … 349 563 fdPhiTel.Set(fSize); 350 564 351 fxStar.Set(fSize); 352 fyStar.Set(fSize); 353 fdxStar.Set(fSize); 354 fdyStar.Set(fSize); 565 fStars = fxStar.GetNrows(); 566 fxStar.ResizeTo(fStars, fSize); 567 fyStar.ResizeTo(fStars, fSize); 568 fdxStar.ResizeTo(fStars, fSize); 569 fdyStar.ResizeTo(fStars, fSize); 355 570 } 356 571 572 //------------------- 573 // read header line 574 //*fIn >> val; 575 576 //*fLog << "val =" << val << endl; 577 578 //*fIn >> val; 579 //*fIn >> val; 580 //*fIn >> val; 581 //*fIn >> val; 582 //*fIn >> val; 583 //*fIn >> val; 584 //*fIn >> val; 585 //*fIn >> val; 586 //*fIn >> val; 587 //*fIn >> val; 588 //------------------- 589 590 357 591 fRuns += 1; 358 592 593 *fIn >> ival; 594 595 *fLog << fRuns <<"th run : " << ival << endl; 596 597 fRunNr.AddAt(ival, fRuns-1); 598 599 *fLog << "check : fRuns, fRunNr[fRuns-1], fRunNr[fRuns] = " << fRuns << ", " 600 << fRunNr[fRuns-1] << ", " << fRunNr[fRuns] << endl; 601 602 // read mjdS, hmsS, mjdE, hmsE 603 *fIn >> val; 604 *fIn >> val; 605 *fIn >> val; 606 *fIn >> val; 607 608 *fIn >> val; 609 *fIn >> val; 610 *fIn >> val; 611 *fIn >> val; 612 613 359 614 *fIn >> val; 360 fRunNr.AddAt(val, fRuns-1); 615 fThetaTel.AddAt(val/kRad2Deg, fRuns-1); 616 *fLog << "val, fThetaTel[fRuns-1] = " << val << ", " 617 << fThetaTel[fRuns-1] << endl; 618 361 619 362 620 *fIn >> val; 363 fThetaTel.AddAt(val, fRuns-1); 364 *fIn >> val; 365 fPhiTel.AddAt(val, fRuns-1); 366 367 *fIn >> val; 368 fdThetaTel.AddAt(val, fRuns-1); 369 *fIn >> val; 370 fdPhiTel.AddAt(val, fRuns-1); 371 372 *fIn >> val; 373 fxStar.AddAt(val, fRuns-1); 374 *fIn >> val; 375 fyStar.AddAt(val, fRuns-1); 376 377 *fIn >> val; 378 fdxStar.AddAt(val, fRuns-1); 379 *fIn >> val; 380 fdyStar.AddAt(val, fRuns-1); 621 fPhiTel.AddAt(val/kRad2Deg, fRuns-1); 622 *fLog << "val, fPhiTel[fRuns-1] = " << val << ", " 623 << fPhiTel[fRuns-1] << endl; 624 625 626 //*fIn >> val; 627 //fdThetaTel.AddAt(val/kRad2Deg, fRuns-1); 628 //*fIn >> val; 629 //fdPhiTel.AddAt(val/kRad2Deg, fRuns-1); 630 631 // input is in [deg], convert to [mm] 632 fStars = fxStar.GetNrows(); 633 for (Int_t i=0; i<fStars; i++) 634 { 635 *fIn >> val; 636 fxStar(i, fRuns-1) = val / fMm2Deg;; 637 *fLog << "val, fxStar(i, fRuns-1) = " << val << ", " 638 << fxStar(i, fRuns-1) << endl; 639 640 *fIn >> val; 641 fyStar(i, fRuns-1) = val / fMm2Deg; 642 *fLog << "val, fyStar(i, fRuns-1) = " << val << ", " 643 << fyStar(i, fRuns-1) << endl; 644 645 646 *fIn >> val; 647 //*fLog << "y=dxStar = " << val << endl; 648 649 fdxStar(i, fRuns-1) = val / fMm2Deg; 650 *fIn >> val; 651 //*fLog << "y=dyStar = " << val << endl; 652 653 fdyStar(i, fRuns-1) = val / fMm2Deg; 654 } 655 381 656 } 382 657 … … 389 664 TNamed *name = new TNamed(txt, ""); 390 665 fFileNames->AddLast(name); 666 667 *fLog << "MSourcePosfromStarPos::AddFile; add file '" << txt << "'" 668 << endl; 669 391 670 return 1; 392 671 } … … 447 726 448 727 728 -
trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.h
r3209 r3274 23 23 #endif 24 24 25 #ifndef ROOT_TMatrixD 26 #include <TMatrixD.h> 27 #endif 28 25 29 class TList; 26 30 class MRawRunHeader; 31 class MMcEvt; 27 32 class MGeomCam; 28 33 class MSrcPosCam; … … 34 39 const MRawRunHeader *fRun; //! 35 40 const MGeomCam *fGeomCam; //! Camera Geometry used to calculate Hillas 41 MMcEvt *fMcEvt; 36 42 MSrcPosCam *fSrcPos; //! 37 43 … … 39 45 TList *fFileNames; // array which contains the \0-terminated file names 40 46 41 Float_t fMm2Deg; 47 Double_t fMm2Deg; 48 Double_t fDistCameraReflector; 42 49 43 Int_t fRuns; // current number of entries in TArray 44 Int_t fSize; // final number of entries in TArray 50 Int_t fRuns; // current number of runs 51 Int_t fSize; // final number of runs 52 Int_t fStars; // number of stars 45 53 46 Double_t fDecStar;47 Double_t fRaStar;48 54 49 55 Double_t fDecSource; 50 56 Double_t fRaSource; 51 52 57 Double_t fxSource; 53 58 Double_t fySource; … … 60 65 TArrayD fdThetaTel; 61 66 TArrayD fdPhiTel; 62 TArrayD fxStar;63 TArrayD fyStar;64 TArrayD fdxStar;65 TArrayD fdyStar;66 67 67 Int_t AddFile(const char *fname, Int_t dummy=-1); 68 TArrayD fDecStar; 69 TArrayD fRaStar; 70 TMatrixD fxStar; 71 TMatrixD fyStar; 72 TMatrixD fdxStar; 73 TMatrixD fdyStar; 74 75 68 76 Bool_t OpenNextFile(); 69 77 void ReadData(); … … 79 87 ~MSourcePosfromStarPos(); 80 88 81 void SetSourceAndStarPosition(Double_t decSource, Double_t raSource, 82 Double_t decStar, Double_t raStar); 89 void SetSourceAndStarPosition( 90 TString nameSource, 91 Double_t decSourceDeg, Double_t decSourceMin, Double_t decSourceSec, 92 Double_t raSourceHour, Double_t raSourceMin, Double_t raSourceSec, 93 TString nameStar, 94 Double_t decStarDeg, Double_t decStarMin, Double_t decStarSec, 95 Double_t raStarHour, Double_t raStarMin, Double_t raStarSec ); 83 96 84 void SourcefromStar(Double_t &, Double_t &, Double_t &, 85 Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, 86 Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t & ); 97 Int_t AddFile(const char *fname, Int_t dummy=-1); 98 99 void AddStar( 100 TString nameStar, 101 Double_t decStarDeg, Double_t decStarMin, Double_t decStarSec, 102 Double_t raStarHour, Double_t raStarMin, Double_t raStarSec ); 103 104 void SourcefromStar(Double_t &, 105 TArrayD &, TArrayD &, Double_t &, Double_t &, Double_t &, Double_t &, 106 TArrayD &, TArrayD &, TArrayD &, TArrayD &, Double_t &, Double_t &, 107 Double_t &, Double_t & ); 87 108 88 109 ClassDef(MSourcePosfromStarPos, 0) // Task to calculate the source position from a star position -
trunk/MagicSoft/Mars/mfilter/MFSelBasic.cc
r2781 r3274 71 71 72 72 // default values of cuts 73 SetCuts( 13.0, 0.0, 60.0);73 SetCuts(20.0, 0.0, 60.0); 74 74 } 75 75 … … 151 151 152 152 // remove bad runs for MC gammas 153 if (fMcEvt->GetEnergy() == 0.0 && fMcEvt->GetImpact() == 0.0)154 {155 if (fRawRun->GetRunNumber() == 601 ||156 fRawRun->GetRunNumber() == 613 ||157 fRawRun->GetRunNumber() == 614 )158 return Set(1);159 }153 //if (fMcEvt->GetEnergy() == 0.0 && fMcEvt->GetImpact() == 0.0) 154 //{ 155 // if (fRawRun->GetRunNumber() == 601 || 156 // fRawRun->GetRunNumber() == 613 || 157 // fRawRun->GetRunNumber() == 614 ) 158 // return Set(1); 159 //} 160 160 161 161 if (theta<fThetaMin)
Note:
See TracChangeset
for help on using the changeset viewer.