Changeset 6078 for trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
- Timestamp:
- 01/28/05 11:18:44 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r6065 r6078 1346 1346 const char* MJCalibration::GetOutputFile() const 1347 1347 { 1348 const TString name(GetOutputFileName()); 1349 if (name.IsNull()) 1350 return ""; 1351 1352 return Form("%s/%s", fPathOut.Data(), name.Data()); 1353 } 1354 1355 const char* MJCalibration::GetOutputFileName() const 1356 { 1348 1357 if (fSequence.IsValid()) 1349 return Form(" %s/calib%08d.root", (const char*)fPathOut, fSequence.GetSequence());1358 return Form("calib%08d.root", fSequence.GetSequence()); 1350 1359 if (!fRuns) 1351 1360 return ""; 1352 1361 1353 return Form("%s /%s-F1.root", (const char*)fPathOut, (const char*)fRuns->GetRunsAsFileName());1362 return Form("%s-F1.root", (const char*)fRuns->GetRunsAsFileName()); 1354 1363 } 1355 1364 … … 1814 1823 DisplayResult(plist); 1815 1824 1816 if (!IsNoStorage()) 1817 if (!WriteResult(plist.FindObject("MGeomCam"))) 1825 if (!WriteResult(plist)) 1818 1826 return kFALSE; 1819 1827 1820 if (IsHistsStorage())1821 {1822 if (!WriteHists(plist))1823 return kFALSE;1824 }1825 1826 1828 *fLog << all << GetDescriptor() << ": Done." << endl; 1827 1829 … … 1909 1911 } 1910 1912 1913 /* 1911 1914 Bool_t MJCalibration::WriteEventloop(MEvtLoop &evtloop) const 1912 1915 { 1913 1914 if (IsNoStorage()) 1915 return kTRUE; 1916 if (IsNoStorage()) 1917 return kTRUE; 1916 1918 1917 1919 if (fPathOut.IsNull()) … … 1924 1926 TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9); 1925 1927 if (!file.IsOpen()) 1926 1928 { 1927 1929 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; 1928 1930 return kFALSE; 1929 1930 1931 } 1932 1931 1933 if (evtloop.Write(fName)<=0) 1932 1934 { 1933 1935 *fLog << err << "Unable to write MEvtloop to " << oname << endl; 1934 1935 1936 return kFALSE; 1937 } 1936 1938 1937 1939 return kTRUE; 1938 1940 } 1941 */ 1939 1942 1940 1943 Bool_t MJCalibration::WriteTasks(MTask *t1, MTask *t2) const … … 1943 1946 return kTRUE; 1944 1947 1945 if (fPathOut.IsNull()) 1946 return kTRUE; 1947 1948 const TString oname(GetOutputFile()); 1949 1950 *fLog << inf << "Writing to file: " << oname << endl; 1951 1952 TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9); 1953 if (!file.IsOpen()) 1954 { 1955 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; 1956 return kFALSE; 1957 } 1958 1948 TObjArray cont; 1959 1949 if (t1) 1960 { 1961 *fLog << inf << " - Writing Task " << t1->GetName() << " [" << t1->ClassName() << "]..." << flush; 1962 if (t1->Write()<=0) 1963 { 1964 *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl; 1965 return kFALSE; 1966 } 1967 *fLog << "ok." << endl; 1968 } 1969 1950 cont.Add(t1); 1970 1951 if (t2) 1971 { 1972 *fLog << inf << " - Writing Task " << t2->GetName() << " [" << t2->ClassName() << "]..." << flush; 1973 if (t2->Write()<=0) 1974 { 1975 *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl; 1976 return kFALSE; 1977 } 1978 *fLog << "ok." << endl; 1979 } 1980 1981 return kTRUE; 1952 cont.Add(t2); 1953 1954 return WriteContainer(cont, GetOutputFileName(), fOverwrite?"RECREATE":"NEW"); 1982 1955 } 1983 1956 … … 1996 1969 // - MCalibrationRelTimeCam or MCalibrationIntensityRelTimeCam 1997 1970 // 1998 Bool_t MJCalibration::WriteResult( TObject *geom)1971 Bool_t MJCalibration::WriteResult(MParList &plist) 1999 1972 { 2000 if (fPathOut.IsNull())2001 {2002 *fLog << inf << "No output path specified via SetPathOut - no output written." << endl;2003 return kTRUE;2004 }2005 2006 const TString oname(GetOutputFile());2007 2008 *fLog << inf << "Writing to file: " << oname << endl;2009 2010 TFile file(oname, "UPDATE", "File created by MJCalibration", 9);2011 if (!file.IsOpen())2012 {2013 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;2014 return kFALSE;2015 }2016 2017 1973 TObjArray cont; 2018 if (fDisplay) 2019 cont.Add(fDisplay); 2020 2021 if (IsIntensity()) 2022 { 2023 cont.Add(&fIntensBadCam); 2024 cont.Add(&fIntensCalibCam); 2025 cont.Add(&fIntensQECam); 2026 cont.Add(&fIntensBlindCam); 2027 } 2028 else 2029 { 2030 cont.Add(&fBadPixels); 2031 cont.Add(&fCalibrationCam); 2032 cont.Add(&fQECam); 2033 cont.Add(&fCalibrationBlindCam); 2034 } 2035 cont.Add(&fCalibrationPINDiode); 2036 2037 //if (IsRelTimes()) 2038 cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam); 2039 2040 if (!geom) 2041 *fLog << warn << " - WARNING - MGeomCam... not found!" << endl; 2042 else 2043 cont.Add(geom); 2044 2045 return WriteContainer(cont); 2046 } 2047 2048 // -------------------------------------------------------------------------- 2049 // 2050 // Write the calibration histograms into the output file GetOutputFile(), 2051 // if fOutputPath exists. 2052 // 2053 // The following containers are written: 2054 // - MHCalibrationChargeCam 2055 // - MHCalibrationChargeBlindCam 2056 // - MHCalibrationChargePINDiode 2057 // If the flag kRelTimes is set, then also: 2058 // - MHCalibrationRelTimeBlindCam 2059 // 2060 Bool_t MJCalibration::WriteHists(MParList &plist) 2061 { 2062 if (fPathOut.IsNull()) 2063 return kTRUE; 2064 2065 const TString oname(GetOutputFile()); 2066 2067 *fLog << inf << "Writing to file: " << oname << endl; 2068 2069 TFile file(oname, "UPDATE", "File created by MJCalibration", 9); 2070 if (!file.IsOpen()) 2071 { 2072 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; 2073 return kFALSE; 2074 } 2075 2076 TObjArray cont; 2077 cont.Add(plist.FindObject("MHCalibrationChargeCam")); 2078 cont.Add(plist.FindObject("MHCalibrationChargeBlindCam")); 2079 cont.Add(plist.FindObject("MHCalibrationChargePINDiode")); 2080 if (IsRelTimes()) 2081 cont.Add(plist.FindObject("MHCalibrationRelTimeCam")); 2082 2083 return WriteContainer(cont); 1974 1975 if (!IsNoStorage()) 1976 { 1977 if (IsIntensity()) 1978 { 1979 cont.Add(&fIntensBadCam); 1980 cont.Add(&fIntensCalibCam); 1981 cont.Add(&fIntensQECam); 1982 cont.Add(&fIntensBlindCam); 1983 } 1984 else 1985 { 1986 cont.Add(&fBadPixels); 1987 cont.Add(&fCalibrationCam); 1988 cont.Add(&fQECam); 1989 cont.Add(&fCalibrationBlindCam); 1990 } 1991 cont.Add(&fCalibrationPINDiode); 1992 1993 //if (IsRelTimes()) 1994 cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam); 1995 1996 TObject *geom = plist.FindObject("MGeomCam"); 1997 if (!geom) 1998 *fLog << warn << " - WARNING - MGeomCam... not found for writing!" << endl; 1999 else 2000 cont.Add(geom); 2001 } 2002 2003 if (IsHistsStorage()) 2004 { 2005 cont.Add(plist.FindObject("MHCalibrationChargeCam")); 2006 cont.Add(plist.FindObject("MHCalibrationChargeBlindCam")); 2007 cont.Add(plist.FindObject("MHCalibrationChargePINDiode")); 2008 if (IsRelTimes()) 2009 cont.Add(plist.FindObject("MHCalibrationRelTimeCam")); 2010 } 2011 2012 return WriteContainer(cont, GetOutputFileName(), "UPDATE"); 2084 2013 } 2085 2014
Note:
See TracChangeset
for help on using the changeset viewer.