--- quicklook/OrbitalRate/src/OrbitalRate.cpp 2006/12/06 16:25:52 1.3 +++ quicklook/OrbitalRate/src/OrbitalRate.cpp 2006/12/07 13:27:30 1.4 @@ -346,19 +346,7 @@ /********** Magnetic Field **************/ // Check that all this is correct! - float dimo = 0.0; // dipole moment (computed from dat files) - float bnorth, beast, bdown, babs; - float xl; // L value - float icode; // code value for L accuracy (see fortran code) - float bab1; // What's the difference with babs? - float stps = 0.005; // step size for field line tracing - float bdel = 0.01; // required accuracy - float bequ; // equatorial b value (also called b_0) - bool value = 0; // false if bequ is not the minimum b value - float rr0; // equatorial radius normalized to earth radius - - // Initialize fortran routines!!! - initize_(); + float br, btheta, bphi; // I can now compute the magnetic dipole moment at the actual date, // using the cJulian date. I don't to recompute it for every event @@ -368,8 +356,8 @@ Int_t d = tledate.GetDay(); float year = (float) y + (m*31+d)/365; - // Compute the magnetic dipole moment. - feldcof_(&year, &dimo); + // Initialize common data for geopack + recalc_(y, m*31+d, 0, 0, 0); /********** Magnetic Field **************/ tr = (TTree*)rootFile->Get("Physics"); @@ -469,9 +457,8 @@ alt = coo.m_Alt; /********** Magnetic Field **************/ - feldg_(&lat, &lon, &alt, &bnorth, &beast, &bdown, &babs); - shellg_(&lat, &lon, &alt, &dimo, &xl, &icode, &bab1); - findb0_(&stps, &bdel, &value, &bequ, &rr0); + igrf_geo__((coo.m_Alt+6371.2)/6371.2, M_PI/2.-coo.m_Lat, coo.m_Lon, br, btheta, bphi); + // cout<<"("<<(coo.m_Alt+6371.2)/6371.2<<", "<Fill(lon, lat, babs); - hbnorth_counter->Fill(lon, lat, bnorth); - hbdown_counter->Fill(lon, lat, bdown); - hbeast_counter->Fill(lon, lat, beast); - hb0_counter->Fill(lon, lat, bequ); - hl_counter->Fill(lon, lat, xl); + hbabs_counter->Fill(lon, lat, sqrt(br*br+btheta*btheta+bphi*bphi)*1e-5); + hbnorth_counter->Fill(lon, lat, -btheta*1e-5); + hbdown_counter->Fill(lon, lat, -br*1e-5); + hbeast_counter->Fill(lon, lat, bphi*1e-5); // This histograms is now filled with the number of entries. // Below we will divide with the time (in seconds) to get @@ -574,8 +559,6 @@ TH2F *hbnorth_norm = (TH2F*) hbnorth_counter->Clone("hbnorth_norm"); TH2F *hbdown_norm = (TH2F*) hbabs_counter->Clone("hbdown_norm"); TH2F *hbeast_norm = (TH2F*) hbabs_counter->Clone("hbeast_norm"); - TH2F *hb0_norm = (TH2F*) hb0_counter->Clone("hb0_norm"); - TH2F *hl_norm = (TH2F*) hl_counter->Clone("hl_norm"); // Now we divide each histogram _counter with the time histogram // obtBinTime to have an histogram _rate. Note that, when a second @@ -662,16 +645,6 @@ oss << basename.Data() << "_orbit_Beast.png"; printHist(hbeast_norm, mapFile, outDirectory, oss.str().c_str(), "B east (G)", -width, height, 0, 1); - hb0_norm->Divide(hb0_counter, event_counter, 1, 1, ""); - oss.str(""); - oss << basename.Data() << "_orbit_B0.png"; - printHist(hb0_norm, mapFile, outDirectory, oss.str().c_str(), "B_0 (G)", -width, height, 0, 0); - - hl_norm->Divide(hl_counter, event_counter, 1, 1, ""); - oss.str(""); - oss << basename.Data() << "_orbit_L.png"; - printHist(hl_norm, mapFile, outDirectory, oss.str().c_str(), "L shell", -width, height, 0, 0); - delete obtBinTime; delete event_counter; @@ -699,14 +672,10 @@ delete hbnorth_counter; delete hbdown_counter; delete hbeast_counter; - delete hb0_counter; - delete hl_counter; delete hbabs_norm; delete hbnorth_norm; delete hbdown_norm; delete hbeast_norm; - delete hb0_norm; - delete hl_norm; rootFile->Close(); }