Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:54

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