diff --git a/source/branches/CLASSV3/include/CLASSLogger.hxx b/source/branches/CLASSV3/include/CLASSLogger.hxx index 4f8e0f12c1928fe7d47d5bdec133e8467f58fdae..859287e0ae0bbfd4474bfdb9cb5364576df29922 100755 --- a/source/branches/CLASSV3/include/CLASSLogger.hxx +++ b/source/branches/CLASSV3/include/CLASSLogger.hxx @@ -131,9 +131,9 @@ public: \name Constructor/Desctructor */ //@{ + CLASSLogger(); - - CLASSLogger(string CLASSLoggerName = "CLASS_OUTPUT.log", int VerboseLvl = 0, int OutputLvl = 1 ); //!< Normal Constructor + CLASSLogger(string CLASSLoggerName, int VerboseLvl = 0, int OutputLvl = 1 ); //!< Normal Constructor ~CLASSLogger(); //!< Normal Destructor diff --git a/source/branches/CLASSV3/include/Scenario.hxx b/source/branches/CLASSV3/include/Scenario.hxx index 772d2664af9a709121e5ee98d44743ee17abf611..c22f026434be01a194eb92c1bdf773f8814d6c4b 100755 --- a/source/branches/CLASSV3/include/Scenario.hxx +++ b/source/branches/CLASSV3/include/Scenario.hxx @@ -49,15 +49,18 @@ public : \name Constructor/Desctructor */ //@{ + + Scenario(); ///< Normal Constructor. - Scenario(CLASSLogger* Log= new CLASSLogger(), cSecond abstime = 0); ///< Log Constructor. + Scenario(CLASSLogger* Log, cSecond abstime = 0); ///< Log Constructor. /*! Use to load a CLASSLogger \param CLASSLogger: CLASSLogger used for the log... */ + Scenario(cSecond abstime); ///< Time Constructor. - Scenario(cSecond abstime, CLASSLogger* log = new CLASSLogger()); ///< Time Constructor. + Scenario(cSecond abstime, CLASSLogger* log); ///< Time Constructor. /*! Use to set the starting time of the Parc \param abstime: Starting time of the Parc in second diff --git a/source/branches/CLASSV3/src/CLASSLogger.cxx b/source/branches/CLASSV3/src/CLASSLogger.cxx index 7ea89237106e5e582000f5394f736e6ad2dbc25c..7a23f4b497669433e0001bada8687d1e1f75ebb7 100755 --- a/source/branches/CLASSV3/src/CLASSLogger.cxx +++ b/source/branches/CLASSV3/src/CLASSLogger.cxx @@ -14,6 +14,98 @@ using namespace std; // // //________________________________________________________________________ +CLASSLogger::CLASSLogger() +{ + string CLASSLoggerName = "CLASS_OUTPUT.log"; + int VerboseLvl = 0; + int OutputLvl = 1; + + + fCLASSLoggerName = CLASSLoggerName; + fOutPutFile.open(CLASSLoggerName.c_str()); + fVerboseLVL = VerboseLvl; + if(!fOutPutFile) + { + cout << "Could not open the CLASSLogger: " << CLASSLoggerName << " !" << endl; + exit(-1); + } + else + cout << "CLASSLogger: " << CLASSLoggerName << " opened." << endl; + fError = 0; + fWarning = 0; + fDebug = 0; + fInfo = 0; + + if (VerboseLvl <= OutputLvl) + fMaxOutPutLVL = OutputLvl; + else + fMaxOutPutLVL = VerboseLvl; + + if(VerboseLvl >= 0) + { + if (!fError) + fError = new LogType(std::cout); + else + fError->SetSecondOutput(std::cout); + } + + if(VerboseLvl >= 1) + { + if (!fWarning) + fWarning = new LogType(std::cout); + else + fWarning->SetSecondOutput(std::cout); + } + if(VerboseLvl >= 2) + { + if (!fInfo) + fInfo = new LogType(std::cout); + else + fInfo->SetSecondOutput(std::cout); + } + if(VerboseLvl >= 3) + { + if (!fDebug) + fDebug = new LogType(std::cout); + else + fDebug->SetSecondOutput(std::cout); + } + + + if(OutputLvl >= 0) + { + if (!fError) + fError = new LogType(fOutPutFile); + else + fError->SetSecondOutput(fOutPutFile); + } + if(OutputLvl >= 1) + { + if (!fWarning) + fWarning = new LogType(fOutPutFile); + else + fWarning->SetSecondOutput(fOutPutFile); + } + if(OutputLvl >= 2) + { + if (!fInfo) + fInfo = new LogType(fOutPutFile); + else + fInfo->SetSecondOutput(fOutPutFile); + } + if(OutputLvl >= 3) + { + if (!fDebug) + fDebug = new LogType(fOutPutFile); + else + fDebug->SetSecondOutput(fOutPutFile); + } + + + +} + + CLASSLogger::CLASSLogger(string CLASSLoggerName, int VerboseLvl, int OutputLvl ) { diff --git a/source/branches/CLASSV3/src/Scenario.cxx b/source/branches/CLASSV3/src/Scenario.cxx index b7424153b01764d58d235f4c38ac8a964e559487..af5d3f83838ce97e0f03a20ae6d2705b54ae2942 100755 --- a/source/branches/CLASSV3/src/Scenario.cxx +++ b/source/branches/CLASSV3/src/Scenario.cxx @@ -43,6 +43,62 @@ string dtoa(double num) return os.str(); } +//________________________________________________________________________ +Scenario::Scenario():CLASSObject(new CLASSLogger()) +{ + + fNewTtree = true; + fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year + fAbsoluteTime = 0; + fStartingTime = fAbsoluteTime; + + fStockManagement = true; + + fOutputFileName = "CLASS_Default.root"; + fOutputTreeName = "Data"; + fOutFile = 0; + fOutT = 0; + fParcPower = 0; + + // Warning + + INFO << "!!INFO!! !!!Scenario!!! Parc has been define :" << endl; + INFO << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; + INFO << "\t StockManagement set at : true" << endl; + INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; + INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; + +} + + +//________________________________________________________________________ +Scenario::Scenario(cSecond abstime):CLASSObject(new CLASSLogger()) +{ + + fNewTtree = true; + fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year + fAbsoluteTime = abstime; + fStartingTime = fAbsoluteTime; + + fStockManagement = true; + + fOutputFileName = "CLASS_Default.root"; + fOutputTreeName = "Data"; + fOutFile = 0; + fOutT = 0; + fParcPower = 0; + + // Warning + + INFO << "!!INFO!! !!!Scenario!!! Parc has been define :" << endl; + INFO << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; + INFO << "\t StockManagement set at : true" << endl; + INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; + INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; + +} + + //________________________________________________________________________ Scenario::Scenario(CLASSLogger* log, cSecond abstime):CLASSObject(log) {