Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:16:03

0001 #include "CommonFuncs.C"
0002 #include <onlmon/tpot/TpotMonDraw.h>
0003 #include <onlmon/OnlMonClient.h>
0004 
0005 #include <array>
0006 #include <fstream>
0007 
0008 R__LOAD_LIBRARY(libonltpotmon_client.so)
0009 
0010 void tpotDrawInit(const int online = 0)
0011 {
0012   // client
0013   auto cl = OnlMonClient::instance();
0014 
0015   // create drawing object and register
0016   auto tpotmon = new TpotMonDraw("TPOT");
0017   std::string servername = "TPOTMON_0";
0018   tpotmon->AddServer(servername);
0019 
0020   // prefer local calibration filename if exists
0021   const std::string local_calibration_filename( "TPOT_Pedestal-000.root" );
0022   if( std::ifstream( local_calibration_filename ).good() )
0023   { tpotmon->set_calibration_file( local_calibration_filename ); }
0024 
0025   tpotmon->set_sample_window( {0, 50} );
0026   tpotmon->set_sample_window_signal( {3, 18} );
0027   cl->registerDrawer(tpotmon);
0028 
0029   // get detector names
0030   const auto detector_names = tpotmon->get_detnames_sphenix();
0031 
0032   // register histograms
0033   for( const std::string& hname: { "m_counters", "m_detector_occupancy_phi", "m_detector_occupancy_z", "m_resist_occupancy_phi", "m_resist_occupancy_z" } )
0034   { cl->registerHisto( hname, "TPOTMON_0" ); }
0035 
0036   for( const std::string& hname: { "m_adc_sample", "m_adc_channel", "m_sample_channel" , "m_counts_sample", "m_hit_charge", "m_hit_multiplicity", "m_wf_vs_channel", "m_hit_vs_channel", "m_heartbeat_vs_channel" } )
0037   {
0038     for( const auto& detname : detector_names )
0039     { cl->registerHisto( hname+"_"+detname, "TPOTMON_0" ); }
0040   }
0041 
0042   // for local host, just call tpotDrawInit(2)
0043   CreateSubsysHostlist("tpot_hosts.list", online);
0044 
0045   // get my histos from server, the second parameter = 1
0046   // says I know they are all on the same node
0047   cl->requestHistoBySubSystem("TPOTMON_0", 1);
0048 }
0049 
0050 void tpotDraw(const char *what = "ALL")
0051 {
0052   auto cl = OnlMonClient::instance();
0053   cl->requestHistoBySubSystem("TPOTMON_0",1);
0054   cl->Draw("TPOT", what);
0055 }
0056 
0057 void tpotSavePlot()
0058 { OnlMonClient::instance()->SavePlot("TPOT"); }
0059 
0060 void tpotHtml()
0061 { OnlMonClient::instance()->MakeHtml("TPOT"); }