CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/CondCore/EcalPlugins/plugins/EcalFunParamsPyWrapper.cc

Go to the documentation of this file.
00001 #include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
00002 #include "CondTools/Ecal/interface/EcalCondHeader.h"
00003 #include "CondTools/Ecal/interface/EcalClusterEnergyCorrectionXMLTranslator.h"
00004 #include "CondTools/Ecal/interface/EcalClusterCrackCorrXMLTranslator.h"
00005 #include "CondTools/Ecal/interface/EcalClusterLocalContCorrXMLTranslator.h"
00006 #include "CondTools/Ecal/interface/EcalClusterEnergyCorrectionObjectSpecificXMLTranslator.h"
00007 #include "TROOT.h"
00008 #include "TH2F.h"
00009 #include "TCanvas.h"
00010 #include "TStyle.h"
00011 #include "TColor.h"
00012 #include "TLine.h"
00013 
00014 #include "CondCore/Utilities/interface/PayLoadInspector.h"
00015 #include "CondCore/Utilities/interface/InspectorPythonWrapper.h"
00016 
00017 #include <string>
00018 #include <sstream>
00019 #include <algorithm>
00020 #include <numeric>
00021 #include <iterator>
00022 #include <boost/ref.hpp>
00023 #include <boost/bind.hpp>
00024 #include <boost/function.hpp>
00025 #include <boost/iterator/transform_iterator.hpp>
00026 
00027 #include <fstream>
00028 
00029 namespace cond {
00030   template<>
00031   std::string PayLoadInspector<EcalFunParams>::dump() const {
00032     std::cout << "EcalFunParamsPyWrapper dump " << std::endl;
00033     //    std::cout << " token " << object().token() << "\n";
00034     //    PayLoadInspector::dump();
00035     std::cout << " Collection size " << object().params().size() << "\n";
00036     //    for ( EcalFunctionParameters::const_iterator it = object().params().begin(); it != object().params().end(); ++it ) {
00037     //      std::cout << " " << *it;
00038     //    }
00039     //    std::cout << "\n";
00040     std::stringstream ss;
00041     EcalCondHeader header;
00042     if(object().params().size() == 56)
00043       ss << EcalClusterEnergyCorrectionXMLTranslator::dumpXML(header,object());
00044     else if(object().params().size() == 20)
00045       ss << EcalClusterCrackCorrXMLTranslator::dumpXML(header,object());
00046     else if(object().params().size() == 11 || object().params().size() == 24)
00047       ss << EcalClusterLocalContCorrXMLTranslator::dumpXML(header,object());
00048     else if(object().params().size() == 208)
00049       ss << EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::dumpXML(header,object());
00050     else
00051       ss << " EcalFunParamsPyWrapper dump : unknown tag. Please send a mail to jean.fay@cern.ch";
00052     return ss.str();
00053   }
00054 
00055   template<>
00056   std::string PayLoadInspector<EcalFunParams>::summary() const {
00057     std::cout << "EcalFunParamsPyWrapper summary " << std::endl;
00058     std::stringstream ss;
00059     ss << "EcalFunParamsPyWrapper nb of parameters : " << object().params().size();
00060 
00061     return ss.str();
00062   }
00063 
00064   template<>
00065   std::string PayLoadInspector<EcalFunParams>::plot(std::string const & filename,
00066                                                     std::string const &, 
00067                                                     std::vector<int> const&, 
00068                                                     std::vector<float> const& ) const {
00069     std::cout << "EcalFunParamsPyWrapper plot " << std::endl;
00070     return filename;
00071   }  // plot
00072 }
00073 PYTHON_WRAPPER(EcalFunParams,EcalFunParams);