- Timestamp:
- 07/23/08 14:15:14 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9038 r9039 40 40 * mjobs/MJCalibrateSignal.cc: 41 41 - changed again the wrong names of the tasklists 42 43 * mjobs/MSequence.[h,cc]: 44 - set default telescope to 1 so that reading old sequence files 45 gives valid sequences. 46 - overwrote Read to allow reading also old sequences which 47 have no default name in the files 48 - removed output of "DataPath" from Print 49 50 * msql/MSQLMagic.[h,cc]: 51 - added a second InsertUpdate 52 - added ExistRow 42 53 43 54 -
trunk/MagicSoft/Mars/mbase/MStatusArray.cc
r9026 r9039 44 44 #include "MStatusArray.h" 45 45 46 #include <TH1.h> // TH1::AddDirectoryStatus(); 46 #include <TH1.h> // TH1::AddDirectoryStatus(); 47 #include <TFile.h> // gFile 47 48 #include <TClass.h> 48 49 #include <TCanvas.h> … … 344 345 Delete(); 345 346 347 const TString keyname = name?name:"MStatusDisplay"; 348 349 // Check if key exists (to suppress an error on the console 350 if (!gDirectory->GetListOfKeys()->FindObject(keyname)) 351 { 352 gLog << inf << keyname << " [MStatusArray] not found." << endl; 353 return 0; 354 } 355 346 356 // Make sure newly read histograms are not added to the current directory 347 357 const Bool_t store = TH1::AddDirectoryStatus(); 348 358 TH1::AddDirectory(kFALSE); 349 const Int_t rc = TObjArray::Read( name?name:"MStatusDisplay");359 const Int_t rc = TObjArray::Read(keyname); 350 360 TH1::AddDirectory(store); 351 361 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r9038 r9039 2239 2239 list.Add(new TNamed(GetName(), GetTitle())); 2240 2240 2241 c->SetTitle(gFile->GetName()); 2241 2242 list.Add(c); 2242 2243 } … … 2246 2247 if (list.GetEntries()==0) 2247 2248 { 2248 *fLog << warn << "MStatusDisplay::Read: No objects read ."<< endl;2249 *fLog << warn << "MStatusDisplay::Read: No objects read from " << gFile->GetName() << endl; 2249 2250 return 0; 2250 2251 } -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r9028 r9039 1394 1394 } 1395 1395 1396 if (!fDataPath.IsNull())1397 out << endl << pre << "DataPath: " << fDataPath << endl;1396 // if (!fDataPath.IsNull()) 1397 // out << endl << pre << "DataPath: " << fDataPath << endl; 1398 1398 1399 1399 if (!str.IsNull()) … … 1512 1512 1513 1513 fPeriod = fNight.GetMagicPeriod(); 1514 } 1515 1516 // -------------------------------------------------------------------------- 1517 // 1518 // Read a sequence from gDirectory. If the default is given we try 1519 // to find a sequence with name GetName. If a key with name name 1520 // exists in the file read this key. Otherwise loop over all keys 1521 // and return the first key matching the TPRegex (regular expression) 1522 // matching defined by the argument. 1523 // 1524 Int_t MSequence::Read(const char *name) 1525 { 1526 if (!name || !gFile) 1527 return MParContainer::Read(name); 1528 1529 if (!gDirectory->GetListOfKeys()->FindObject(name)) 1530 return MParContainer::Read(name); 1531 1532 TPRegexp regexp(name); 1533 1534 TIter NextK(gDirectory->GetListOfKeys()); 1535 TObject *key = 0; 1536 while ((key=NextK())) 1537 if (TString(key->GetName())(regexp)==key->GetName()) 1538 return MParContainer::Read(key->GetName()); 1539 1540 *fLog << warn << "WARNING - No key in " << gDirectory->GetName() << " matching " << name << "." << endl; 1541 return 0; 1514 1542 } 1515 1543 -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r9023 r9039 131 131 132 132 public: 133 MSequence() : fTelescope( 0), fSequence((UInt_t)-1), fLastRun((UInt_t)-1),133 MSequence() : fTelescope(1), fSequence((UInt_t)-1), fLastRun((UInt_t)-1), 134 134 fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fLightCondition(kNA), fMonteCarlo(kFALSE) 135 135 { … … 158 158 159 159 // I/O 160 Int_t Read(const char *name=0); 160 161 Bool_t ReadDatabase(TString sql, UInt_t seq=0, UShort_t tel=0); 161 162 Bool_t ReadFile(const char *filename, UInt_t id=(UInt_t)-1); -
trunk/MagicSoft/Mars/msql/MSQLMagic.cc
r9001 r9039 195 195 Bool_t MSQLMagic::ExistStr(const char *column, const char *table, const char *test, const char *where) 196 196 { 197 TString query(Form("SELECT %s FROM %s WHERE %s='%s' %s %s", column, table, column, test, where?"AND":"", where?where:"")); 197 TString query = test ? 198 Form("SELECT %s FROM %s WHERE %s='%s' %s %s", column, table, column, test, where?"AND":"", where?where:"") : 199 Form("SELECT %s FROM %s WHERE %s", column, table, where); 200 198 201 TSQLResult *res = Query(query); 199 202 if (!res) … … 211 214 delete res; 212 215 return rc; 216 } 217 218 // -------------------------------------------------------------------------- 219 // 220 // Check if at least one row with one field exists in table 221 // defined by where 222 // 223 Bool_t MSQLMagic::ExistRow(const char *table, const char *where) 224 { 225 return ExistStr("*", table, 0, where); 213 226 } 214 227 … … 306 319 // -------------------------------------------------------------------------- 307 320 // 321 // An abbreviation for checking whether a row with the condition where 322 // exists. If no such row exist Insert vars into table, otherwise update 323 // vars in table at row(s) defined by where. 324 // 325 Int_t MSQLMagic::InsertUpdate(const char *table, const char *vars, const char *where) 326 { 327 return ExistRow(table, where) ? 328 Update(table, vars, where) : 329 Insert(table, vars); 330 } 331 332 // -------------------------------------------------------------------------- 333 // 308 334 // An abbreviation for a Dalete-Query. 309 335 // -
trunk/MagicSoft/Mars/msql/MSQLMagic.h
r9001 r9039 45 45 Int_t QueryKeyOf(const char *col, const char *ext, const char *val); 46 46 Bool_t ExistStr(const char *column, const char *table, const char *test, const char *where=0); 47 Bool_t ExistRow(const char *table, const char *where); 47 48 48 49 Int_t Insert(const char *table, const char *vars, const char *where=0); … … 50 51 Int_t Delete(const char *table, const char *where); 51 52 Int_t InsertUpdate(const char *table, const char *col, const char *val, const char *vars); 53 Int_t InsertUpdate(const char *table, const char *vars, const char *where); 52 54 53 55 void Delete(const Option_t *o) { TObject::Delete(o); } -
trunk/MagicSoft/Mars/showplot.cc
r9038 r9039 199 199 // 200 200 const TString kInput = InflatePath(arg); 201 const TString kTitle = kInput.IsNull() ? kInput+ "..." : kInput;201 const TString kTitle = kInput.IsNull() ? arg.GetArgumentStr(0) + "..." : kInput; 202 202 203 203 //
Note:
See TracChangeset
for help on using the changeset viewer.