Changeset 6078 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 01/28/05 11:18:44 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r6077 r6078 126 126 Bool_t MJCalibrateSignal::WriteResult(TObjArray &cont) 127 127 { 128 if (fPathOut.IsNull()) 129 { 130 *fLog << inf << "No output path specified via SetPathOut - no output written." << endl; 131 return kTRUE; 132 } 133 134 const TString oname = Form("%s/signal%08d.root", (const char*)fPathOut, fSequence.GetSequence()); 135 136 *fLog << inf << "Writing to file: " << oname << endl; 137 138 TFile file(oname, "RECREATE"); 139 140 *fLog << inf << " - MStatusDisplay..." << flush; 141 if (fDisplay && fDisplay->Write()<=0) 142 { 143 *fLog << err << "Unable to write MStatusDisplay to " << oname << endl; 144 return kFALSE; 145 } 146 *fLog << inf << "ok." << endl; 147 148 return fIsInterlaced ? WriteContainer(cont) : kTRUE; 128 const TString name(Form("signal%08d.root", fSequence.GetSequence())); 129 return WriteContainer(cont, name); 149 130 } 150 131 … … 272 253 MBadPixelsIntensityCam ibdcam; 273 254 274 TObjArray interlacedcont;275 interlacedcont.Add(&ichcam);276 interlacedcont.Add(&iqecam);277 interlacedcont.Add(&iblcam);278 interlacedcont.Add(&itmcam);279 interlacedcont.Add(&ibdcam);280 281 255 MHCalibrationChargeCam hchacam; 282 256 MHCalibrationChargeBlindCam hbndcam; 283 257 MHCalibrationChargePINDiode hpndiod; 284 258 MHCalibrationRelTimeCam hrelcam; 285 286 interlacedcont.Add(&hchacam);287 interlacedcont.Add(&hbndcam);288 interlacedcont.Add(&hpndiod);289 if (fIsRelTimesUpdate)290 interlacedcont.Add(&hrelcam);291 259 292 260 MCalibrationChargeCam calcam; … … 297 265 MCalibrationHiLoCam hilcam; 298 266 299 if (fIsHiLoCalibration)300 interlacedcont.Add(&hilcam);301 302 267 MBadPixelsCam badpix; 303 268 … … 351 316 plist.AddToList(&calibcont); 352 317 plist.AddToList(&hilcam); 353 354 if (fIsInterlaced)355 plist.AddToList(&interlacedcont);356 318 357 319 // Setup Tasklist … … 739 701 DisplayResult(plist); 740 702 703 TObjArray interlacedcont; 704 if (fIsInterlaced) 705 { 706 interlacedcont.Add(&ichcam); 707 interlacedcont.Add(&iqecam); 708 interlacedcont.Add(&iblcam); 709 interlacedcont.Add(&itmcam); 710 interlacedcont.Add(&ibdcam); 711 interlacedcont.Add(&hchacam); 712 interlacedcont.Add(&hbndcam); 713 interlacedcont.Add(&hpndiod); 714 if (fIsRelTimesUpdate) 715 interlacedcont.Add(&hrelcam); 716 if (fIsHiLoCalibration) 717 interlacedcont.Add(&hilcam); 718 } 719 741 720 if (!WriteResult(interlacedcont)) 742 721 return kFALSE; -
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 -
trunk/MagicSoft/Mars/mjobs/MJCalibration.h
r6065 r6078 160 160 void FixDataCheckHist ( TH1D *hist ) const; 161 161 162 Bool_t WriteResult ( TObject *geom ); 163 Bool_t WriteHists ( MParList &plist ); 164 Bool_t WriteEventloop( MEvtLoop &evtloop ) const; 162 Bool_t WriteResult (MParList &plist); 163 //Bool_t WriteEventloop( MEvtLoop &evtloop ) const; 165 164 Bool_t WriteTasks ( MTask *t1, MTask *t2) const; 166 165 Bool_t CheckEnvLocal (); … … 169 168 void InitBlindPixel(MExtractBlindPixel &blindext, 170 169 MHCalibrationChargeBlindCam &blindcam); 170 171 const char* GetOutputFileName() const; 171 172 172 173 public: … … 189 190 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; } 190 191 void SetExtractor ( MExtractor* ext) { fExtractor = ext; } 191 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); }192 void SetExtractorCam ( const MPedestalCam &ped) { ped.Copy(fExtractorCam); fExtractorCam.SetName(ped.GetName()); } 192 193 void SetInput ( MRunIter *iter) { fRuns = iter; } 193 194 void SetQECam ( const MCalibrationQECam &qe) { qe.Copy(fQECam); } -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r6063 r6078 141 141 const char* MJPedestal::GetOutputFile() const 142 142 { 143 const TString name(GetOutputFileName()); 144 if (name.IsNull()) 145 return ""; 146 147 return Form("%s/%s", fPathOut.Data(), name.Data()); 148 } 149 150 const char* MJPedestal::GetOutputFileName() const 151 { 143 152 if (fSequence.IsValid()) 144 return Form(" %s/pedest%08d.root", (const char*)fPathOut, fSequence.GetSequence());153 return Form("pedest%08d.root", fSequence.GetSequence()); 145 154 146 155 if (!fRuns) 147 156 return ""; 148 157 149 return Form("%s /%s-F0.root", (const char*)fPathOut, (const char*)fRuns->GetRunsAsFileName());158 return Form("%s-F0.root", (const char*)fRuns->GetRunsAsFileName()); 150 159 } 151 160 … … 785 794 return kTRUE; 786 795 787 if (fPathOut.IsNull())788 {789 *fLog << inf << "No output path specified via SetPathOut - no output written." << endl;790 return kTRUE;791 }792 793 const TString oname(GetOutputFile());794 795 *fLog << inf << "Writing to file: " << oname << endl;796 797 TFile file(oname, "UPDATE", "File created by MJPedestal", 9);798 if (!file.IsOpen())799 {800 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;801 return kFALSE;802 }803 804 796 TObjArray cont; 805 806 if (fDisplay)807 cont.Add(fDisplay);808 797 809 798 cont.Add(&fPedestalCamOut); 810 799 cont.Add(&fBadPixels); 811 800 812 return WriteContainer(cont );801 return WriteContainer(cont, GetOutputFileName(), fOverwrite?"RECREATE":"NEW"); 813 802 } 814 803 -
trunk/MagicSoft/Mars/mjobs/MJob.cc
r5557 r6078 35 35 #include <TFile.h> 36 36 #include <TSystem.h> 37 #include <TObjArray.h> 37 38 38 39 #include "MIter.h" … … 173 174 } 174 175 176 //------------------------------------------------------------------------ 177 // 178 // Write containers in list to gFile. Returns kFALSE if no gFile or any 179 // container couldn't be written. kTRUE otherwise. 180 // 175 181 Bool_t MJob::WriteContainer(TCollection &list) const 176 182 { … … 196 202 } 197 203 204 //------------------------------------------------------------------------ 205 // 206 // Read containers in list into list from gFile 207 // Returns kFALSE if no gFile or any container couldn't be read. 208 // 198 209 Bool_t MJob::ReadContainer(TCollection &list) const 199 210 { … … 218 229 return kTRUE; 219 230 } 231 232 //------------------------------------------------------------------------ 233 // 234 // Write containers in cont (and - if available) the status display to 235 // fPathOut+"/"+name 236 // 237 Bool_t MJob::WriteContainer(TCollection &cont, const char *name, const char *option, const int compr) const 238 { 239 if (fPathOut.IsNull()) 240 { 241 *fLog << inf << "No output path specified via SetPathOut - no output written." << endl; 242 return kTRUE; 243 } 244 245 TString oname(fPathOut); 246 oname += "/"; 247 oname += name; 248 249 *fLog << inf << "Writing to file: " << oname << endl; 250 251 TString title("File Written by "); 252 title += fName; 253 254 TFile file(oname, option, title, compr); 255 if (!file.IsOpen()) 256 { 257 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; 258 return kFALSE; 259 } 260 261 if (fDisplay) 262 cont.Add((TObject*)(fDisplay)); 263 264 return WriteContainer(cont); 265 } -
trunk/MagicSoft/Mars/mjobs/MJob.h
r5957 r6078 44 44 Bool_t WriteContainer(TCollection &list) const; 45 45 Bool_t ReadContainer(TCollection &list) const; 46 Bool_t WriteContainer(TCollection &cont, const char *name, const char *option="RECREATE", const int compr=2) const; 46 47 47 48 public:
Note:
See TracChangeset
for help on using the changeset viewer.