00001 00002 // File: HcalTestHistoManager.cc 00003 // Description: Histogram managing class in HcalTestAnalysis (HcalTest) 00005 00006 #include "SimG4CMS/Calo/interface/HcalTestHistoManager.h" 00007 #include "SimDataFormats/CaloTest/interface/HcalTestHistoClass.h" 00008 00009 #include "FWCore/PluginManager/interface/PluginManager.h" 00010 //#include "POOLCore/Token.h" 00011 //#include "FileCatalog/URIParser.h" 00012 //#include "FileCatalog/FCSystemTools.h" 00013 //#include "FileCatalog/IFileCatalog.h" 00014 //#include "StorageSvc/DbType.h" 00015 //#include "PersistencySvc/DatabaseConnectionPolicy.h" 00016 //#include "PersistencySvc/ISession.h" 00017 //#include "PersistencySvc/ITransaction.h" 00018 //#include "PersistencySvc/IDatabase.h" 00019 //#include "PersistencySvc/Placement.h" 00020 //#include "DataSvc/DataSvcFactory.h" 00021 //#include "DataSvc/IDataSvc.h" 00022 //#include "DataSvc/ICacheSvc.h" 00023 00024 #include <iostream> 00025 #include <cmath> 00026 00027 HcalTestHistoManager::HcalTestHistoManager(const std::string & file) // : 00028 // svc(pool::DataSvcFactory::instance(&lcat)), 00029 // placeH(file, pool::DatabaseSpecification::PFN, "HcalTestAnalysis", 00030 // ROOT::Reflex::Type(), pool::ROOTTREE_StorageType.type()), h(*svc) { 00031 { 00032 // pool::URIParser p("file:HcalTestHistoCatalog.cat"); 00033 //p.parse(); 00034 00035 //lcat.setWriteCatalog(p.contactstring()); 00036 00037 //lcat.connect(); 00038 // lcat.start(); 00039 00040 // Define the policy for the implicit file handling 00041 //pool::DatabaseConnectionPolicy policy; 00042 //policy.setWriteModeForNonExisting(pool::DatabaseConnectionPolicy::CREATE); 00043 //policy.setWriteModeForExisting(pool::DatabaseConnectionPolicy::OVERWRITE); 00045 //svc->session().setDefaultConnectionPolicy(policy); 00046 00047 edm::LogInfo("HcalSim") << "HcalTestHistoManager:===>>> Book user" 00048 << " Histograms and Root tree"; 00049 } 00050 00051 HcalTestHistoManager::~HcalTestHistoManager() { 00052 00053 edm::LogInfo("HcalSim") << "=============================================" 00054 << "==============\n" 00055 << "=== HcalTestHistoManager: Start writing user " 00056 << "histograms ==="; 00057 00058 //svc->transaction().commit(); 00059 //svc->session().disconnectAll(); 00060 //edm::LogInfo("HcalSim") << "=== HcalTestHistoManager: cache size at end " 00061 // << svc->cacheSvc().cacheSize(); 00062 //lcat.commit(); 00063 00064 edm::LogInfo("HcalSim") << "=== HcalTestHistoManager: End writing user " 00065 << "histograms ===\n" 00066 << "=============================================" 00067 << "=============="; 00068 } 00069 00070 void HcalTestHistoManager::fillTree(HcalTestHistoClass * histos) { 00071 00072 //svc->transaction().start(pool::ITransaction::UPDATE); 00073 LogDebug("HcalSim") << "HcalTestHistoManager: tree pointer = " << histos; 00074 //LogDebug("HcalSim") << "HcalTestHistoManager: cache size before assign " 00075 // << svc->cacheSvc().cacheSize(); 00076 00077 //h = histos; 00078 //h.markWrite(placeH); 00079 //svc->transaction().commitAndHold(); 00080 }