Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:11:06

0001 //
0002 // plot all the charge histograms from the laser output
0003 //
0004 
0005 int icv = 0;
0006 TCanvas *ac[10];
0007 TH1 *h_mbdq[128];
0008 
0009 void plot_laser_q(const std::string rootfname = "LASER-00040000-0000.root")
0010 {
0011   gStyle->SetOptStat(0);
0012 
0013   ac[icv] = new TCanvas("laser_q","Laser Charge",1600,800);
0014   //ac[icv]->Divide(16,8,-1,-1);
0015   ac[icv]->Divide(16,8,0.0001,0.0001);
0016 
0017   TFile *tfile = new TFile(rootfname.c_str(),"READ"); 
0018   
0019   TString name;
0020   for (int ipmt=0; ipmt<128; ipmt++)
0021   {
0022     name = "h_mbdq"; name += ipmt;
0023     h_mbdq[ipmt] = (TH1*)tfile->Get( name );
0024 
0025     double mean = h_mbdq[ipmt]->GetMean();
0026     double rms = h_mbdq[ipmt]->GetRMS();
0027 
0028     h_mbdq[ipmt]->GetXaxis()->SetRangeUser(mean-5*rms,mean+5*rms);
0029 
0030     ac[icv]->cd(ipmt+1);
0031     h_mbdq[ipmt]->SetLineColor(2);
0032     h_mbdq[ipmt]->Draw();
0033   }
0034 
0035   ac[icv]->SaveAs(".png");
0036 }
0037