// $Id$ /** * @file adjustOCDBObject.C * @brief Tool to adjust properties of an OCDB object and write it back to OCDB. * * Usage: *
* aliroot -b -q adjustOCDBObject("file", * targetCDB="local://$PWD", * firstrun=-1, * lastrun=-1, * version=-1, * subversion=-1, * comment=NULL, * responsible=NULL, * alirootv=NULL) ** * The macro opens an OCDB entry directly as a file, changes properties * of the entry and uses the CDBmanager to write it back to some new * location. * * Required parameters: * - filename * - OCDB target * Optional parameters, if the default values are specified the * corresponding key in the entry is not changed * - first run * - last run, if smaller than first run 'AliCDBRunRange::Infinity' is used * - version * - subversion * - comment * - responsible * - aliroot version * * @author Matthias.Richter@ift.uib.no * @ingroup alihlt_tutorial */ void adjustOCDBObject(const char* file, const char* targetCDB="local://$PWD", int firstrun=-1, int lastrun=-1, int version=-1, int subversion=-1, const char* comment=NULL, const char* responsible=NULL, const char* alirootv=NULL) { TFile* origfile=new TFile(file); if (origfile->IsZombie()) { cerr << "error opening file " << file << endl; return; } AliCDBEntry* cdbEntry=NULL; origfile->GetObject("AliCDBEntry", cdbEntry); if (!cdbEntry) { cerr << "can not find CDB entry in file " << file << endl; } AliCDBId& cdbId=cdbEntry->GetId(); if (version>=0) cdbId.SetVersion(version); if (subversion>=0) cdbId.SetSubVersion(subversion); if (firstrun>=0) cdbId.SetFirstRun(firstrun); if (lastrun>=0) cdbId.SetLastRun(lastrun); if (lastrun