CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CondCore/RPCPlugins/plugins/RPCObGasPyWrapper.cc

Go to the documentation of this file.
00001 #include "CondFormats/RPCObjects/interface/RPCObGas.h"
00002 #include "CondFormats/RPCObjects/interface/RPCObPVSSmap.h"
00003 
00004 #include "CondCore/DBCommon/interface/DbConnection.h"
00005 #include "CondCore/DBCommon/interface/DbConnectionConfiguration.h"
00006 //#include "CondCore/DBCommon/interface/DbSession.h"
00007 #include "CondCore/DBCommon/interface/DbTransaction.h"
00008 
00009 //#include "CondCore/ORA/interface/Database.h"
00010 //#include "CondCore/DBCommon/interface/PoolToken.h"
00011 
00012 #include "CondCore/Utilities/interface/PayLoadInspector.h"
00013 #include "CondCore/Utilities/interface/InspectorPythonWrapper.h"
00014 //#include "CondCore/IOVService/interface/IOVProxy.h"
00015 
00016 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00017 #include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
00018 
00019 //timestamp stuff
00020 //#include "DataFormats/Provenance/interface/Timestamp.h"
00021 //#include "CondTools/RPC/interface/RPCRunIOV.h"
00022 #include <sys/time.h>
00023 
00025 #include "TROOT.h"
00026 #include "TCanvas.h"
00027 #include "TStyle.h"
00028 #include "TColor.h"
00029 #include "TLine.h"
00030 #include "TVirtualPad.h"
00031 #include "TH1D.h"
00032 #include "TH2D.h"
00033 #include "TGraph.h"
00034 #include "TMultiGraph.h"
00035 #include "TLegend.h"
00036 #include "TF1.h"
00037 #include "TDatime.h"
00038 
00039 #include <string>
00040 #include <fstream>
00041 #include <sstream>
00042 #include <algorithm>
00043 #include <numeric>
00044 #include <iterator>
00045 #include <iostream>
00046 #include <fstream>
00047 #include <utility>
00048 #include <iomanip>
00049 #include <boost/ref.hpp>
00050 #include <boost/bind.hpp>
00051 #include <boost/function.hpp>
00052 #include <boost/shared_ptr.hpp>
00053 #include <boost/iterator/transform_iterator.hpp>
00054 
00055 using std::pair;
00056 using std::make_pair;
00057 
00058 namespace cond {
00059 
00060   namespace rpcobgas {
00061     enum How { detid, flowin, flowout, day, time};
00062 
00063     void extractDetId(RPCObGas const & pl, std::vector<int> const & which,std::vector<float> & result,const float& starttime, const float& endtime) {
00064       std::vector<RPCObGas::Item> const & gas = pl.ObGas_rpc;
00065       for(unsigned int i = 0; i < gas.size(); ++i ){
00066         if (which[0] == 0){
00067           result.push_back(gas[i].dpid);
00068         }
00069         else{
00070           if(gas[i].dpid == which[0])
00071             result.push_back(gas[i].dpid);
00072         }
00073       }
00074     }
00075     
00076     void extractFlowin(RPCObGas const & pl, std::vector<int> const & which,std::vector<float> & result,const float& starttime,const float& endtime) {
00077       std::vector<RPCObGas::Item> const & gas = pl.ObGas_rpc;
00078       for(unsigned int i = 0; i < gas.size(); ++i ){
00079         if (which[0] == 0){
00080           result.push_back(gas[i].flowin);
00081         }
00082         else{
00083           if(gas[i].dpid == which[0])
00084             result.push_back(gas[i].flowin);
00085         }
00086       }
00087     }
00088 
00089     void extractFlowout(RPCObGas const & pl, std::vector<int> const & which,std::vector<float> & result,const float& starttime,const float& endtime) {
00090       std::vector<RPCObGas::Item> const & gas = pl.ObGas_rpc;
00091       for(unsigned int i = 0; i < gas.size(); ++i ){
00092         if (which[0] == 0){
00093           result.push_back(gas[i].flowout);
00094         }
00095         else{
00096           if(gas[i].dpid == which[0])
00097             result.push_back(gas[i].flowout);
00098         }
00099       }
00100     }
00101 
00102     void extractDay(RPCObGas const & pl, std::vector<int> const & which,std::vector<float> & result,const float& starttime, const float& endtime) {
00103       std::vector<RPCObGas::Item> const & gas = pl.ObGas_rpc;
00104       for(unsigned int i = 0; i < gas.size(); ++i ){
00105         if (which[0] == 0){
00106           result.push_back(gas[i].day);
00107         }
00108         else{
00109           if(gas[i].dpid == which[0])
00110             result.push_back(gas[i].day);
00111         }
00112       }
00113     }
00114 
00115     void extractTime(RPCObGas const & pl, std::vector<int> const & which,std::vector<float> & result,const float& starttime, const float& endtime) {
00116       std::vector<RPCObGas::Item> const & gas = pl.ObGas_rpc;
00117       for(unsigned int i = 0; i < gas.size(); ++i ){
00118         if (which[0] == 0){
00119           result.push_back(gas[i].time);
00120         }
00121         else{
00122           if(gas[i].dpid == which[0])
00123             result.push_back(gas[i].time);
00124         }
00125       }
00126     }
00127 
00128     typedef boost::function<void(RPCObGas const & pl, std::vector<int> const & which,std::vector<float> & result/*In, std::vector<float> & resultOut*/,const float& starttime,const float& endtime)> RPCObGasExtractor;
00129   }
00130 
00131   template<>
00132   struct ExtractWhat<RPCObGas> {
00133 
00134     rpcobgas::How m_how;
00135     std::vector<int> m_which;
00136     float m_starttime;
00137     float m_endtime;
00138 
00139     rpcobgas::How const & how() const { return m_how;}
00140     std::vector<int> const & which() const { return m_which;}
00141     float const & startTime() const {return m_starttime;}
00142     float const & endTime() const {return m_endtime;}
00143 
00144     void set_how(rpcobgas::How i) {m_how=i;}
00145     void set_which(std::vector<int> & i) { m_which.swap(i);}
00146     void set_starttime(float& i){m_starttime = i;}
00147     void set_endtime(float& i){m_endtime = i;}
00148 
00149   };
00150 
00151 
00152   template<>
00153   class ValueExtractor<RPCObGas>: public  BaseValueExtractor<RPCObGas> {
00154   public:
00155 
00156     static rpcobgas::RPCObGasExtractor & extractor(rpcobgas::How how) {
00157       static  rpcobgas::RPCObGasExtractor fun[5] = { 
00158         rpcobgas::RPCObGasExtractor(rpcobgas::extractDetId),
00159         rpcobgas::RPCObGasExtractor(rpcobgas::extractFlowin),
00160         rpcobgas::RPCObGasExtractor(rpcobgas::extractFlowout),
00161         rpcobgas::RPCObGasExtractor(rpcobgas::extractDay),
00162         rpcobgas::RPCObGasExtractor(rpcobgas::extractTime),
00163      };
00164       return fun[how];
00165     }
00166 
00167     typedef RPCObGas Class;
00168     typedef ExtractWhat<Class> What;
00169     static What what() { return What();}
00170 
00171     ValueExtractor(){}
00172     ValueExtractor(What const & what)
00173       : m_what(what)
00174     {
00175       // here one can make stuff really complicated... (select mean rms, 12,6,1)
00176       // ask to make average on selected channels...
00177     }
00178 
00179     void compute(Class const & it){
00180        std::vector<float> res;
00181        extractor(m_what.how())(it,m_what.which(),res,m_what.startTime(),m_what.endTime());
00182        swap(res);
00183        //       this->add(it.dpid);
00184        //       this->add(it.flowin);
00185        //       this->add(it.flowout);
00186        //       this->add(it.day);
00187        //       this->add(it.time);
00188     }
00189     
00190   private:
00191     What  m_what;
00192     
00193   };
00194 
00195   //   template<>
00196   //   std::string
00197   //   PayLoadInspector<RPCObGas>::dump() const {return std::string();}
00198 
00199   template<>
00200   std::string PayLoadInspector<RPCObGas>::summary() const {
00201 
00202 //     std::stringstream ss;
00203    
00204 //     //BEGIN OF NEW DB-SESSION PART
00205 //     //hardcoded values
00206 //     std::string authPath="/afs/cern.ch/cms/DB/conddb";
00207 //     std::string conString="oracle://cms_orcoff_prod/CMS_COND_31X_RPC";
00208     
00209 //     //frontend sends token instead of filename
00210 //     std::string token="[DB=00000000-0000-0000-0000-000000000000][CNT=RPCObPVSSmap][CLID=53B2D2D9-1F4E-9CA9-4D71-FFCCA123A454][TECH=00000B01][OID=0000000C-00000000]";
00211     
00212 //     //make connection object
00213 //     DbConnection dbConn;
00214     
00215 //     //set in configuration object authentication path
00216 //     dbConn.configuration().setAuthenticationPath(authPath);
00217 //     dbConn.configure();
00218     
00219 //     //create session object from connection
00220 //     DbSession dbSes=dbConn.createSession();
00221     
00222 //     //try to make connection
00223 //     dbSes.open(conString,true);
00224     
00225 //     //start a transaction (true=readOnly)
00226 //     //cond::DbTransaction dbTr=
00227 //     dbSes.transaction().start(true);
00228     
00229 //     //get the actual object
00230 //     boost::shared_ptr<RPCObPVSSmap> pvssPtr;
00231 //     pvssPtr=dbSes.getTypedObject<RPCObPVSSmap>(token);
00232 
00233 //     //we have the object...
00234 //     std::vector<RPCObPVSSmap::Item> pvssCont=pvssPtr->ObIDMap_rpc;
00235 //     //END OF NEW DB-SESSION PART
00236 
00237 //     std::vector<RPCObGas::Item> const & gas = object().ObGas_rpc;
00238     
00239 //     ss<<"DetID\t\t\tI(uA)\tTime\tDay\n";
00240 //     for(unsigned int i = 0; i < gas.size(); ++i ){
00241 //       for(unsigned int p = 0; p < pvssCont.size(); ++p){
00242 //      if(gas[i].dpid!=pvssCont[p].dpid || pvssCont[p].suptype!=0 || pvssCont[p].region!=0)continue;
00243 //      RPCDetId rpcId(pvssCont[p].region,pvssCont[p].ring,pvssCont[p].station,pvssCont[p].sector,pvssCont[p].layer,pvssCont[p].subsector,1);
00244 //      RPCGeomServ rGS(rpcId);
00245 //      std::string chName(rGS.name().substr(0,rGS.name().find("_Backward")));
00246 //              ss <<chName <<"\t"<<gas[i].value<<"\t"<<gas[i].time<<"\t"<<gas[i].day<<"\n";
00247 //       }
00248 //     }
00249     
00250 //     //close db session
00251 //     dbSes.close();
00252     
00253 //    return ss.str();
00254 
00255     return "";
00256 
00257   }
00258 
00259   
00260   Double_t linearF(Double_t *x, Double_t *par){
00261     Double_t y=0.;
00262     y=par[0]*(*x);
00263     return y;
00264   }
00265   
00266   
00267   // return the real name of the file including extension...
00268   template<>
00269   std::string PayLoadInspector<RPCObGas>::plot(std::string const & filename,
00270                                                 std::string const & str,
00271                                                 std::vector<int> const & vInt,
00272                                                 std::vector<float> const& vFlt) const {
00273 
00274 //     gStyle->SetPalette(1);
00275 
00276 //     TH1D *iDistr=new TH1D("iDistr","IOV-averaged Current Distribution;Average Current (#muA);Entries/0.2 #muA",500,0.,100.);
00277 //     TH1D *rmsDistr=new TH1D("rmsDistr","RMS over IOV-Current Distribution;Current RMS (#muA);Entries/0.2 #muA",5000,0.,1000.);
00278 
00279 //     //BEGIN OF NEW DB-SESSION PART
00280 //     //hardcoded values
00281 //     std::string authPath="/afs/cern.ch/cms/DB/conddb";
00282 //     std::string conString="oracle://cms_orcoff_prod/CMS_COND_31X_RPC";
00283     
00284 //     //frontend sends token instead of filename
00285 //     std::string token="[DB=00000000-0000-0000-0000-000000000000][CNT=RPCObPVSSmap][CLID=53B2D2D9-1F4E-9CA9-4D71-FFCCA123A454][TECH=00000B01][OID=0000000C-00000000]";
00286     
00287 //     //make connection object
00288 //     DbConnection dbConn;
00289     
00290 //     //set in configuration object authentication path
00291 //     dbConn.configuration().setAuthenticationPath(authPath);
00292 //     dbConn.configure();
00293     
00294 //     //create session object from connection
00295 //     DbSession dbSes=dbConn.createSession();
00296     
00297 //     //try to make connection
00298 //     dbSes.open(conString,true);
00299     
00300 //     //start a transaction (true=readOnly)
00301 //     dbSes.transaction().start(true);
00302     
00303 //     //get the actual object
00304 //     boost::shared_ptr<RPCObPVSSmap> pvssPtr;
00305 //     pvssPtr=dbSes.getTypedObject<RPCObPVSSmap>(token);
00306 
00307 //     //we have the object...
00308 //     std::vector<RPCObPVSSmap::Item> pvssCont=pvssPtr->ObIDMap_rpc;
00309 //     //END OF NEW DB-SESSION PART
00310 
00311 //     std::vector<RPCObGas::Item> const & gas = object().ObGas_rpc;
00312     
00313 //     RPCRunIOV *iovHelp=new RPCRunIOV();
00314     
00315 //     std::map<int,std::pair<std::vector<double>,std::vector<double> > > dpidMap;
00316 //     for(unsigned int i = 0;i < gas.size(); ++i){
00317 //       for(unsigned int p = 0; p < pvssCont.size(); ++p){
00318 //      if(gas[i].dpid!=pvssCont[p].dpid || pvssCont[p].suptype!=0 || pvssCont[p].region!=0)continue;
00319 //      if(dpidMap.find(gas[i].dpid)==dpidMap.end()){
00320 //        std::vector<double> dumVec1;dumVec1.push_back(gas[i].value);
00321 //        std::vector<double> dumVec2;dumVec2.push_back((double)iovHelp->toUNIX(gas[i].day,gas[i].time));
00322 //        dpidMap[gas[i].dpid]=make_pair(dumVec1,dumVec2);
00323 //      }
00324 //      else {
00325 //        dpidMap[gas[i].dpid].first.push_back(gas[i].value);
00326 //        dpidMap[gas[i].dpid].second.push_back((double)iovHelp->toUNIX(gas[i].day,gas[i].time));
00327 //      }
00328 //       }
00329 //     }
00330     
00331 //     delete iovHelp;
00332 
00333 //     double maxMean(-1.),maxRms(-1.);
00334 //     double minMean(9999.),minRms(9999.);
00335 //     std::map<int,std::pair<std::vector<double>,std::vector<double> > >::const_iterator minIt,maxIt;
00336 //     std::vector<float> means,rmss;
00337 //     for(std::map<int,std::pair<std::vector<double>,std::vector<double> > >::const_iterator mIt=dpidMap.begin();
00338 //      mIt!=dpidMap.end();mIt++){
00339 //       std::pair<double, std::vector<double> > meanAndVals =
00340 //      make_pair(accumulate(mIt->second.first.begin(),mIt->second.first.end(),0.)/(double)mIt->second.first.size(),mIt->second.first);
00341        
00342 //       iDistr->Fill(meanAndVals.first);
00343 //       if(meanAndVals.first>maxMean)maxMean=meanAndVals.first;
00344 //       if(meanAndVals.first<minMean)minMean=meanAndVals.first;
00345 //       double rms(0.);
00346 //       for(std::vector<double>::iterator rmsIt=meanAndVals.second.begin();
00347 //        rmsIt!=meanAndVals.second.end();++rmsIt){
00348 //      rms+=pow((*rmsIt-meanAndVals.first)/(double)meanAndVals.second.size(),2);
00349 //       }
00350 //       rmsDistr->Fill(sqrt(rms));
00351 //       if(sqrt(rms)>maxRms){
00352 //      maxRms=sqrt(rms);
00353 //      maxIt=mIt;
00354 //       }
00355 //       if(sqrt(rms)<minRms){
00356 //      minRms=sqrt(rms);
00357 //      if(mIt->second.first.size()>10)
00358 //        minIt=mIt;
00359 //       }
00360 //       means.push_back(meanAndVals.first);
00361 //       rmss.push_back(sqrt(rms));
00362 //     }
00363 
00364 //     if(maxMean<100.)
00365 //       iDistr->GetXaxis()->SetRangeUser(minMean-0.00001,maxMean+1.);
00366 //     if(maxRms<1000.)
00367 //       rmsDistr->GetXaxis()->SetRangeUser(minRms-0.00001,maxRms+1.);
00368     
00369 //     TCanvas c("Gas","Gas",1200,700);
00370 //     c.Divide(2,2);
00371     
00372 //     TVirtualPad *p1=c.cd(1);
00373 //     p1->SetLogy(1);
00374 //     iDistr->SetFillColor(4);
00375 //     iDistr->SetLineColor(4);
00376 //     iDistr->Draw();
00377 //     c.cd(1);
00378     
00379 //     TVirtualPad *p2=c.cd(2);
00380 //     p2->SetLogy(1);
00381 //     rmsDistr->SetFillColor(3);
00382 //     rmsDistr->SetLineColor(3);
00383 //     rmsDistr->Draw();
00384 
00385 //     c.cd(3);
00386 //     TGraph *iRmsDistr=new TGraph(means.size(),static_cast<const float *>(&rmss[0]),static_cast<const float *>(&means[0]));
00387 //     iRmsDistr->SetMarkerStyle(7);
00388 //     iRmsDistr->SetMarkerColor(2);
00389 //     TF1 *func=new TF1("linearF",linearF,minRms,maxRms,1);
00390 //     iRmsDistr->Fit("linearF","r");
00391 //     iRmsDistr->GetXaxis()->SetTitle("Current RMS (#muA)");
00392 //     iRmsDistr->GetYaxis()->SetTitle("Current Means (#muA)");
00393 //     iRmsDistr->Draw("AP");
00394     
00395 
00396 //     TVirtualPad *p4=c.cd(4);
00397 //     p4->SetLogy(1);
00398 //     TMultiGraph *mProf=new TMultiGraph();
00399 //     TLegend *leg=new TLegend(0.65,0.91,0.99,0.99);
00400 //     TGraph *minProf=new TGraph(minIt->second.first.size(),&minIt->second.second[0],&minIt->second.first[0]);
00401 //     TGraph *maxProf=new TGraph(maxIt->second.first.size(),&maxIt->second.second[0],&maxIt->second.first[0]);
00402 //     minProf->SetMarkerStyle(20);
00403 //     maxProf->SetMarkerStyle(20);
00404 //     minProf->SetMarkerColor(2);
00405 //     maxProf->SetMarkerColor(4);
00406 //     mProf->Add(minProf);
00407 //     leg->AddEntry(minProf,"I vs IOV for Min RMS case","lpf");
00408 //     mProf->Add(maxProf);
00409 //     leg->AddEntry(maxProf,"I vs IOV for Max RMS case","lpf");
00410 //     leg->Draw();
00411 //     mProf->Draw("AP");
00412 //     mProf->GetXaxis()->SetTitle("IOV");
00413 //     mProf->GetYaxis()->SetTitle("I (#muA)");
00414 
00415 //     c.SaveAs(filename.c_str());
00416 
00417 //     return filename.c_str();
00418 
00419     return "";
00420 
00421   }
00422   
00423   template <>
00424   std::string PayLoadInspector<RPCObGas>::trend_plot(std::string const & filename,
00425                                                       std::string const & opt_string, 
00426                                                       std::vector<int> const& nts,
00427                                                       std::vector<float> const& floats,
00428                                                       std::vector<std::string> const& strings) const {
00429 
00430 //     std::stringstream ss("");
00431     
00432 //     if(strings.size()<2)
00433 //       return ("Error!Not enough data for initializing connection for making plots!(from template<> std::string PayLoadInspector<BeamSpotObjects>::trend_plot)");
00434    
00435 //     std::vector<std::string>::const_iterator strIt=strings.begin();
00436 
00437 //     std::string conString=(*strIt);strIt++;
00438 //     std::string authPath=(*strIt);strIt++;
00439  
00440 //     //BEGIN OF NEW DB-SESSION PART
00441 
00442 //     //make connection object
00443 //     DbConnection dbConn;
00444     
00445 //     //set in configuration object authentication path
00446 //     dbConn.configuration().setAuthenticationPath(authPath);
00447 //     dbConn.configure();
00448     
00449 //     //create session object from connection
00450 //     DbSession dbSes=dbConn.createSession();
00451     
00452 //     //try to make connection
00453 //     dbSes.open(conString,true);
00454     
00455 //     //start a transaction (true=readOnly)
00456 //     dbSes.transaction().start(true);
00457     
00458 //     std::string pvssToken="[DB=00000000-0000-0000-0000-000000000000][CNT=RPCObPVSSmap][CLID=53B2D2D9-1F4E-9CA9-4D71-FFCCA123A454][TECH=00000B01][OID=0000000C-00000000]";
00459 //     //get the actual object
00460 //     boost::shared_ptr<RPCObGas> gasPtr;
00461 //     boost::shared_ptr<RPCObPVSSmap> pvssPtr;
00462 //     pvssPtr=dbSes.getTypedObject<RPCObPVSSmap>(pvssToken);
00463 
00464 //     //we get the objects...
00465 //     std::vector<RPCObPVSSmap::Item> pvssCont=pvssPtr->ObIDMap_rpc,pvssZero;
00466 
00467 //     for(unsigned int p=0;p<pvssCont.size();p++){
00468 //       if(pvssCont[p].suptype!=0)
00469 //      pvssZero.push_back(pvssCont[p]);
00470 //     }
00471     
00472 //     std::string token;
00473 //     std::vector<float> vecI;vecI.assign(floats.size(),0.);
00474 //     int elCount(0);
00475 
00476 //     for(;strIt!=strings.end();++strIt){
00477       
00478 //       token=(*strIt);
00479 //       gasPtr=dbSes.getTypedObject<RPCObGas>(token);      
00480 //       std::vector<RPCObGas::Item> const & gas = gasPtr->ObGas_rpc;
00481 
00482 //       float iCount(0.);
00483 //       for(unsigned int i=0;i<gas.size();i++){
00484 //      for(unsigned int p=0;p<pvssZero.size();p++){
00485 //        if(gas[i].dpid!=pvssZero[p].dpid || pvssZero[p].region!=0)continue;
00486 //        iCount++;
00487 //        vecI[elCount]+=gas[i].value;
00488 //      }
00489 //       }
00490 //       if(iCount!=0)
00491 //      vecI[elCount]/=iCount;
00492 //       elCount++;
00493 //     }
00494     
00495 //     //END OF NEW DB-SESSION PART
00496     
00497 //     dbSes.close();
00498     
00499 //     std::vector<unsigned long long> lngs ;
00500 //     for(std::vector<float>::const_iterator fIt=floats.begin();fIt!=floats.end();fIt++){
00501 //       lngs.push_back((unsigned long long)*fIt);
00502 //       //      std::cout<<*fIt<<" "<<(long double)*fIt<<" "<<(unsigned long long)*fIt<<" "<<vecI[0]<<" "<<(unsigned long long)vecI[0]<<std::endl;
00503 //     }
00504 //     std::vector<unsigned long long> const longs=lngs;
00505 
00506 //     //    TGraph trend(vecI.size(),static_cast<const float *>(&longs[0]),static_cast<const float *>(&vecI[0]));
00507 //     std::cout<<(int)longs[longs.size()-1]-longs[0]<<std::endl;
00508 //     TH1F trend("trend","trend",(int)longs[longs.size()-1]-longs[0],longs[0],longs[longs.size()-1]);
00509 //     //TH1F trend("trend","trend",floats.size(),static_cast<const float* >(&floats[0]));
00510 //     trend.GetXaxis()->SetTimeDisplay(1);
00511 //     trend.GetXaxis()->SetTimeFormat("%d/%m/%y %H:%M");
00512 //     trend.SetLineColor(2);
00513 //     trend.SetLineWidth(2);
00514 //     trend.GetYaxis()->SetTitle("<I> (#muA)");
00515 
00516 //     std::cout<<"Bins "<<trend.GetNbinsX()<<std::endl;
00517 //     for(unsigned int fill=0;fill<=longs.size();fill++){
00518 //       trend.SetBinContent(longs[fill]-longs[0],vecI[fill]);
00519 //       std::cout<<fill<<" "<<floats[fill]<<" "<<longs[fill]-longs[0]<<" "<<vecI[fill]<<std::endl;
00520 //     }
00521 
00522 //     float min(*(floats.begin())),max(*(floats.end()-1));
00523 //     float scaleToggle((max-min)/max);
00524 //     TCanvas c("Itrend","Itrend",1200,700);
00525 
00526 //     if(scaleToggle>=0.1)
00527 //       c.SetLogx(1);
00528 
00529 //     trend.Draw(/*"LA*"*/);
00530 
00531 //     TLegend leg(0.65,0.91,0.99,0.99);
00532 //     leg.AddEntry(&trend,"Gas trend","lpf");
00533 
00534 //     leg.Draw("");
00535 
00536 //     ss.str("");
00537 //     ss<<filename<<".C";
00538 //     c.SaveAs((ss.str()).c_str());
00539 
00540 //     return ss.str();
00541 
00542     return "";
00543     
00544   }
00545   
00546   template<>
00547   std::string PayLoadInspector<RPCObGas>::dumpFile(std::string const & filename,
00548                                                    std::string const & opt_string, 
00549                                                    std::vector<int> const& nts,
00550                                                    std::vector<float> const& floats,
00551                                                    std::vector<std::string> const& strings) const { return filename; }
00552 }
00553 
00554 
00555 namespace condPython {
00556   template<>
00557   void defineWhat<RPCObGas>() {
00558     using namespace boost::python;
00559     enum_<cond::rpcobgas::How>("How")
00560       .value("detid",cond::rpcobgas::detid)
00561       .value("flowin",cond::rpcobgas::flowin)
00562       .value("flowout",cond::rpcobgas::flowout)
00563       .value("day",cond::rpcobgas::day) 
00564       .value("time",cond::rpcobgas::time)
00565       ;
00566 
00567     typedef cond::ExtractWhat<RPCObGas> What;
00568     class_<What>("What",init<>())
00569       .def("set_how",&What::set_how)
00570       .def("set_which",&What::set_which)
00571       .def("how",&What::how, return_value_policy<copy_const_reference>())
00572       .def("which",&What::which, return_value_policy<copy_const_reference>())
00573       .def("set_starttime",&What::set_starttime)
00574       .def("set_endtime",&What::set_endtime)
00575       .def("startTime",&What::startTime, return_value_policy<copy_const_reference>())
00576       .def("endTime",&What::endTime, return_value_policy<copy_const_reference>())
00577       ;
00578   }
00579 }
00580 
00581 PYTHON_WRAPPER(RPCObGas,RPCObGas);