Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:07

0001 // $Id: $
0002 
0003 /*!
0004  * \file Draw_HFJetTruth.C
0005  * \brief 
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision:   $
0008  * \date $Date: $
0009  */
0010 
0011 #include <TFile.h>
0012 #include <TGraphAsymmErrors.h>
0013 #include <TGraphErrors.h>
0014 #include <TLatex.h>
0015 #include <TLine.h>
0016 #include <TString.h>
0017 #include <TTree.h>
0018 #include <cassert>
0019 #include <cmath>
0020 #include "SaveCanvas.C"
0021 #include "sPhenixStyle.C"
0022 
0023 TFile *_file0 = NULL;
0024 TTree *T = NULL;
0025 int total_event = 0;
0026 
0027 void Draw_EICRate(const TString infile =
0028                       //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS/DIS_3197.cfg_DSTReader.root",
0029                   //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS/DIS_ALL.cfg_DSTReader.root",
0030                   //                  double xsection = 6.613184211e-4  // mb for 10 f + f' -> f + f' (QFD)
0031                   //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS2/DIS2_3197.cfg_DSTReader.root",
0032                   //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS2/DIS2_ALL.cfg_DSTReader.root",
0033                   //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS/DIS_ALL.cfg_DSTReader.root",
0034                   //                  double xsection = 1.05E-03  // mb for all subprocesses
0035                   //                  "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS20x250/DIS20x250_3179.cfg_DSTReader.root",
0036                   //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/DIS20x250/DIS20x250_ALL.cfg_DSTReader.root",
0037                   //    double xsection = 1.15E-03  // mb for all subprocesses
0038                   //    "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/pythiaEIC_MB/ALL_DSTReader.root", double xsection = 5.488E-02  //  I   0 All included subprocesses    I      1000000      30948998 I  5.488D-02 I
0039 
0040                   "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/pythia8_FixedTarget5/pythia8_FixedTarget5_3333.cfg_output/G4EICDetector.root_DSTReader.root",
0041                   double xsection = 26
0042                   //                  "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/pythiaEIC_MB/49610_DSTReader.root",
0043 )
0044 {
0045   SetsPhenixStyle();
0046   gStyle->SetOptStat(0);
0047   gStyle->SetOptFit(1111);
0048   TVirtualFitter::SetDefaultFitter("Minuit2");
0049 
0050   gSystem->Load("libg4eval.so");
0051 
0052   if (!_file0)
0053   {
0054     TString chian_str = infile;
0055     chian_str.ReplaceAll("ALL", "*");
0056 
0057     TChain *t = new TChain("T");
0058     const int n = t->Add(chian_str);
0059 
0060     cout << "Loaded " << n << " root files with " << chian_str << endl;
0061     assert(n > 0);
0062     T = t;
0063 
0064     _file0 = new TFile;
0065     _file0->SetName(infile);
0066   }
0067 
0068   const double lumi = 1e33;  // cm^-2/s
0069   const double event_rate = (xsection * 1e-3 * 1e-24) * lumi;
0070   total_event = T->GetEntries();
0071   const double time = total_event / event_rate;
0072 
0073   cout << "Config summary: " << endl;
0074   cout << "lumi = " << lumi << "/cm2/s" << endl;
0075   cout << "xsection = " << xsection << " mb" << endl;
0076   cout << "event_rate = " << event_rate << " hz" << endl;
0077   cout << "total_event = " << total_event << "" << endl;
0078   cout << "time = " << time << "s" << endl;
0079 
0080   T->SetAlias("p_Q2", "PHG4Particle.fpx**2 + PHG4Particle.fpy**2 + (PHG4Particle.fpz+20)**2 - (PHG4Particle.fe-20)**2");
0081   T->SetAlias("PHG4Particle_p",
0082               "1*sqrt(PHG4Particle.fpx**2+PHG4Particle.fpy**2+PHG4Particle.fpz**2)");
0083   T->SetAlias("PHG4Particle_pT",
0084               "1*sqrt(PHG4Particle.fpx**2+PHG4Particle.fpy**2)");
0085   T->SetAlias("p_eta",
0086               "0.5*log((PHG4Particle_p+PHG4Particle.fpz)/(PHG4Particle_p-PHG4Particle.fpz))");
0087   T->SetAlias("p_rapidity",
0088               "0.5*log((PHG4Particle.fe+PHG4Particle.fpz)/(PHG4Particle.fe - PHG4Particle.fpz))");
0089   T->SetAlias("PrimVertex","Sum$(PHG4VtxPoint[].vz * (PHG4VtxPoint[].t0==0))/Sum$(PHG4VtxPoint[].t0==0)");
0090 
0091   T->SetAlias("SVTXHitLength",
0092               "1*sqrt((G4HIT_SVTX.get_x(0) - G4HIT_SVTX.get_x(1))**2 + (G4HIT_SVTX.get_y(0) - G4HIT_SVTX.get_y(1))**2 + (G4HIT_SVTX.get_z(0) - G4HIT_SVTX.get_z(1))**2)");
0093 
0094   VertexChecks();
0095   KinematicsChecks();
0096   TrackerRate();
0097 
0098   CentralCalorimeterRate();
0099   ForwardCalorimeterRate();
0100 }
0101 
0102 void TrackerRate()
0103 {
0104   TText *t;
0105   TCanvas *c1 = new TCanvas("TrackerRate",
0106                             "TrackerRate", 1900, 600);
0107 
0108   c1->Divide(3, 1, 0, 0);
0109   int idx = 1;
0110   TPad *p;
0111 
0112   p = (TPad *) c1->cd(idx++);
0113   c1->Update();
0114   p->SetLogy();
0115 
0116   T->Draw("Sum$(G4HIT_MAPS.edep>0)>>hMAPSHit(2000,-.5,1999.5)");
0117   TH1 *h = (TH1 *) gDirectory->Get("hMAPSHit");
0118   assert(h);
0119   h->SetTitle(";# of MAPS vertex tracker hit per event;Count [A.U.]");
0120   h->SetMaximum(h->GetMaximum() * 10);
0121   h->GetXaxis()->SetRangeUser(0, 200);
0122   //  h->GetXaxis()->SetRangeUser(0, 1000);
0123   double meanhit = h->GetMean();
0124 
0125   TLegend *leg = new TLegend(.2, .70, .95, .93);
0126   leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0127   leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0128   leg->AddEntry(h, Form("Average MAPS hit / event = %.1f", meanhit), "l");
0129   leg->Draw();
0130 
0131   p = (TPad *) c1->cd(idx++);
0132   c1->Update();
0133   p->SetLogy();
0134 
0135   T->Draw("Sum$(G4HIT_SVTX.edep>1e-7 && SVTXHitLength>1)>>hSVTXHit(2000,-.5,1999.5)");
0136   TH1 *h = (TH1 *) gDirectory->Get("hSVTXHit");
0137   h->SetTitle(";# of TPC hit per event;Count [A.U.]");
0138   h->SetMaximum(h->GetMaximum() * 10);
0139   h->GetXaxis()->SetRangeUser(0, 1000);
0140   double meanhit = h->GetMean();
0141 
0142   TLegend *leg = new TLegend(.1, .80, .95, .93);
0143   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0144   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0145   leg->AddEntry(h, Form("Average TPC cluster / event = %.1f", meanhit), "l");
0146   leg->Draw();
0147 
0148   //
0149   p = (TPad *) c1->cd(idx++);
0150   c1->Update();
0151   p->SetLogy();
0152   p->SetRightMargin(.05);
0153 
0154   T->Draw("Sum$(G4HIT_EGEM_1.edep>1e-7)+Sum$(G4HIT_FGEM_1.edep>1e-7)+Sum$(G4HIT_FGEM_2.edep>1e-7)+Sum$(G4HIT_FGEM_3.edep>1e-7)+Sum$(G4HIT_FGEM_4.edep>1e-7)>>hGEMHit(1000,-.5,999.5)");
0155 
0156   TH1 *h = (TH1 *) gDirectory->Get("hGEMHit");
0157   h->SetTitle(";Total GEM hit per event (E>0.1 keV);Count [A.U.]");
0158   h->SetMaximum(h->GetMaximum() * 10);
0159   h->GetXaxis()->SetRangeUser(0, 400);
0160   double meanhit = h->GetMean();
0161 
0162   TLegend *leg = new TLegend(.1, .80, .95, .93);
0163   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0164   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0165   leg->AddEntry(h, Form("Average GEM hit / event = %.1f", meanhit), "l");
0166   leg->Draw();
0167 
0168   SaveCanvas(c1,
0169              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0170 }
0171 
0172 void CentralCalorimeterRate()
0173 {
0174   TText *t;
0175   TCanvas *c1 = new TCanvas("CentralCalorimeterRate_Energy",
0176                             "CentralCalorimeterRate_Energy", 1900, 425);
0177 
0178   c1->Divide(3, 1, 0, 0);
0179   int idx = 1;
0180   TPad *p;
0181 
0182   p = (TPad *) c1->cd(idx++);
0183   c1->Update();
0184 
0185   p->SetLogy();
0186   T->Draw("TOWER_SIM_CEMC.energy/0.026>>hEMCalADC(210,0,20)");
0187   TH1 *h = (TH1 *) gDirectory->Get("hEMCalADC");
0188   assert(h);
0189   h->SetTitle(";Central EMCal Tower Energy [GeV];Count [A.U.]");
0190   h->SetMaximum(h->GetMaximum() * 10);
0191 
0192   TLegend *leg = new TLegend(.2, .70, .95, .93);
0193   leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0194   leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0195   leg->AddEntry(h, Form("Central EMCal Energy/Tower"), "l");
0196   leg->Draw();
0197 
0198   p = (TPad *) c1->cd(idx++);
0199   c1->Update();
0200 
0201   p->SetLogy();
0202   T->Draw("TOWER_SIM_HCALIN.energy/ 0.162166>>hHCalInADC(210,0,20)");
0203   TH1 *h = (TH1 *) gDirectory->Get("hHCalInADC");
0204   assert(h);
0205   h->SetTitle(";Central Inner HCal Tower Energy [GeV];Count [A.U.]");
0206   h->SetMaximum(h->GetMaximum() * 10);
0207 
0208   TLegend *leg = new TLegend(.1, .80, .95, .93);
0209   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0210   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0211   leg->AddEntry(h, Form("Central Inner HCal Energy/Tower"), "l");
0212   leg->Draw();
0213 
0214   p = (TPad *) c1->cd(idx++);
0215   c1->Update();
0216   p->SetRightMargin(.05);
0217 
0218   p->SetLogy();
0219   T->Draw("TOWER_SIM_HCALOUT.energy/3.38021e-02>>hHCalOutADC(210,0,20)");
0220   TH1 *h = (TH1 *) gDirectory->Get("hHCalOutADC");
0221   assert(h);
0222   h->SetTitle(";Central Outer HCal Tower Energy [GeV];Count [A.U.]");
0223   h->SetMaximum(h->GetMaximum() * 10);
0224 
0225   TLegend *leg = new TLegend(.1, .80, .95, .93);
0226   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0227   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0228   leg->AddEntry(h, Form("Central Outer HCal Energy/Tower"), "l");
0229   leg->Draw();
0230 
0231   SaveCanvas(c1,
0232              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0233 
0234   c1 = new TCanvas("CentralCalorimeterRate_Multiplicity",
0235                    "CentralCalorimeterRate_Multiplicity", 1900, 425);
0236 
0237   c1->Divide(3, 1, 0, 0);
0238   int idx = 1;
0239   TPad *p;
0240 
0241   p = (TPad *) c1->cd(idx++);
0242   c1->Update();
0243   p->SetLogy();
0244 
0245   T->Draw("Sum$(TOWER_SIM_CEMC.energy/0.026>0.03)>>hCEMCHit(200,-.5,199.5)");
0246   TH1 *h = (TH1 *) gDirectory->Get("hCEMCHit");
0247   assert(h);
0248   h->SetTitle(";# of CEMC tower per event (E>30 MeV);Count [A.U.]");
0249   h->SetMaximum(h->GetMaximum() * 10);
0250   h->GetXaxis()->SetRangeUser(0, 100);
0251   double meanhit = h->GetMean();
0252 
0253   TLegend *leg = new TLegend(.2, .70, .95, .93);
0254   leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0255   leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0256   leg->AddEntry(h, Form("Average CEMC tower / event = %.1f", meanhit), "l");
0257   leg->Draw();
0258 
0259   p = (TPad *) c1->cd(idx++);
0260   c1->Update();
0261   p->SetLogy();
0262   T->Draw("Sum$(TOWER_SIM_HCALIN.energy/ 0.162166>0.03)>>hHCALINHit(200,-.5,199.5)");
0263   TH1 *h = (TH1 *) gDirectory->Get("hHCALINHit");
0264   assert(h);
0265   h->SetTitle(";# of Inner HCal tower per event (E>30 MeV);Count [A.U.]");
0266   h->SetMaximum(h->GetMaximum() * 10);
0267   h->GetXaxis()->SetRangeUser(0, 100);
0268   double meanhit = h->GetMean();
0269 
0270   TLegend *leg = new TLegend(.1, .80, .95, .93);
0271   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0272   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0273   leg->AddEntry(h, Form("Average Inner HCal tower / event = %.1f", meanhit), "l");
0274   leg->Draw();
0275 
0276   p = (TPad *) c1->cd(idx++);
0277   c1->Update();
0278   p->SetLogy();
0279   p->SetRightMargin(.05);
0280 
0281   T->Draw("Sum$(TOWER_SIM_HCALOUT.energy/3.38021e-02>0.03)>>hHCALOUTHit(200,-.5,199.5)");
0282   TH1 *h = (TH1 *) gDirectory->Get("hHCALOUTHit");
0283   assert(h);
0284   h->SetTitle(";# of Outer HCal tower per event (E>30 MeV);Count [A.U.]");
0285   h->SetMaximum(h->GetMaximum() * 10);
0286   h->GetXaxis()->SetRangeUser(0, 100);
0287   double meanhit = h->GetMean();
0288 
0289   TLegend *leg = new TLegend(.1, .80, .95, .93);
0290   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0291   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0292   leg->AddEntry(h, Form("Average Outer HCal tower / event = %.1f", meanhit), "l");
0293   leg->Draw();
0294 
0295   SaveCanvas(c1,
0296              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0297 }
0298 
0299 void ForwardCalorimeterRate()
0300 {
0301   TText *t;
0302   TCanvas *c1 = new TCanvas("ForwardCalorimeterRate_Energy",
0303                             "ForwardCalorimeterRate_Energy", 1900, 425);
0304 
0305   c1->Divide(3, 1, 0, 0);
0306   int idx = 1;
0307   TPad *p;
0308 
0309   p = (TPad *) c1->cd(idx++);
0310   c1->Update();
0311 
0312   p->SetLogy();
0313   T->Draw("TOWER_SIM_EEMC.energy>>hEEMCal(801,0,20)");
0314   TH1 *h = (TH1 *) gDirectory->Get("hEEMCal");
0315   assert(h);
0316   h->SetTitle(";e-going EMCal Tower Energy [GeV];Count [A.U.]");
0317   h->SetMaximum(h->GetMaximum() * 10);
0318 
0319   TLegend *leg = new TLegend(.2, .70, .95, .93);
0320   leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0321   leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0322   leg->AddEntry(h, Form("e-going EMCal Energy/Tower"), "l");
0323   leg->Draw();
0324 
0325   p = (TPad *) c1->cd(idx++);
0326   c1->Update();
0327 
0328   p->SetLogy();
0329   T->Draw("TOWER_SIM_FEMC.energy/0.249>>hFEMCal(801,0,200)");
0330   TH1 *h = (TH1 *) gDirectory->Get("hFEMCal");
0331   assert(h);
0332   h->SetTitle(";h-going EMCal Tower Energy [GeV];Count [A.U.]");
0333   h->SetMaximum(h->GetMaximum() * 10);
0334 
0335   TLegend *leg = new TLegend(.1, .80, .95, .93);
0336   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0337   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0338   leg->AddEntry(h, Form("h-going EMCal Energy/Tower"), "l");
0339   leg->Draw();
0340 
0341   p = (TPad *) c1->cd(idx++);
0342   c1->Update();
0343   p->SetRightMargin(.05);
0344 
0345   p->SetLogy();
0346   T->Draw("TOWER_SIM_FHCAL.energy/0.03898>>hFHCAL(801,0,200)");
0347   TH1 *h = (TH1 *) gDirectory->Get("hFHCAL");
0348   assert(h);
0349   h->SetTitle(";h-going HCal Tower Energy [GeV];Count [A.U.]");
0350   h->SetMaximum(h->GetMaximum() * 10);
0351 
0352   TLegend *leg = new TLegend(.1, .80, .95, .93);
0353   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0354   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0355   leg->AddEntry(h, Form("h-going HCal Energy/Tower"), "l");
0356   leg->Draw();
0357 
0358   SaveCanvas(c1,
0359              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0360 
0361   c1 = new TCanvas("ForwardCalorimeterRate_Multiplicity",
0362                    "ForwardCalorimeterRate_Multiplicity", 1900, 425);
0363 
0364   c1->Divide(3, 1, 0, 0);
0365   int idx = 1;
0366   TPad *p;
0367 
0368   p = (TPad *) c1->cd(idx++);
0369   c1->Update();
0370   p->SetLogy();
0371 
0372   T->Draw("Sum$(TOWER_SIM_EEMC.energy>0.03)>>hEEMCHit(400,-.5,399.5)");
0373   TH1 *h = (TH1 *) gDirectory->Get("hEEMCHit");
0374   assert(h);
0375   h->SetTitle(";# of e-going EMCal tower per event (E>30 MeV);Count [A.U.]");
0376   h->SetMaximum(h->GetMaximum() * 10);
0377   h->GetXaxis()->SetRangeUser(0, 100);
0378   double meanhit = h->GetMean();
0379 
0380   TLegend *leg = new TLegend(.2, .70, .95, .93);
0381   leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0382   leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0383   leg->AddEntry(h, Form("Average e-going EMCal tower / event = %.1f", meanhit), "l");
0384   leg->Draw();
0385   //
0386   p = (TPad *) c1->cd(idx++);
0387   c1->Update();
0388   p->SetLogy();
0389 
0390   T->Draw("Sum$(TOWER_SIM_FEMC.energy/0.249>0.03)>>hHEMCHit(800,-.5,799.5)");
0391   TH1 *h = (TH1 *) gDirectory->Get("hHEMCHit");
0392   assert(h);
0393   h->SetTitle(";# of h-going EMCal tower per event (E>30 MeV);Count [A.U.]");
0394   h->SetMaximum(h->GetMaximum() * 10);
0395   h->GetXaxis()->SetRangeUser(0, 300);
0396   double meanhit = h->GetMean();
0397 
0398   TLegend *leg = new TLegend(.1, .80, .95, .93);
0399   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0400   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0401   leg->AddEntry(h, Form("Average h-going EMCal tower / event = %.1f", meanhit), "l");
0402   leg->Draw();
0403 
0404   p = (TPad *) c1->cd(idx++);
0405   c1->Update();
0406   p->SetRightMargin(.05);
0407   p->SetLogy();
0408 
0409   T->Draw("Sum$(TOWER_SIM_FHCAL.energy/0.03898>0.03)>>hHHCalHit(400,-.5,399.5)");
0410   TH1 *h = (TH1 *) gDirectory->Get("hHHCalHit");
0411   assert(h);
0412   h->SetTitle(";# of h-going HCal tower per event (E>30 MeV);Count [A.U.]");
0413   h->SetMaximum(h->GetMaximum() * 10);
0414   h->GetXaxis()->SetRangeUser(0, 100);
0415   double meanhit = h->GetMean();
0416 
0417   TLegend *leg = new TLegend(.1, .80, .95, .93);
0418   //  leg->AddEntry("", "#it{#bf{EIC-sPHENIX}} Simualtion", "");
0419   //  leg->AddEntry("", "e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV", "");
0420   leg->AddEntry(h, Form("Average h-going HCal tower / event = %.1f", meanhit), "l");
0421   leg->Draw();
0422 
0423   SaveCanvas(c1,
0424              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0425 }
0426 
0427 void KinematicsChecks()
0428 {
0429   TText *t;
0430   TCanvas *c1 = new TCanvas("KinematicsChecks",
0431                             "KinematicsChecks", 1900, 500);
0432 
0433   c1->Divide(3, 1);
0434   int idx = 1;
0435   TPad *p;
0436 
0437   p = (TPad *) c1->cd(idx++);
0438   c1->Update();
0439   p->SetLogy();
0440   T->Draw("p_Q2>>hQ2_inc(400,0,100)", "PHG4Particle.fpid==11 && PHG4Particle[].trkid>=0");
0441   hQ2_inc->SetTitle(";Q2 from truth electron [(GeV/c)^2];Count / bin");
0442 
0443   p = (TPad *) c1->cd(idx++);
0444   c1->Update();
0445 
0446   T->Draw("p_eta>>hp_eta(100,-5,5)", "PHG4Particle_pT>0.01 && PHG4Particle[].trkid>=0");
0447   TH1 *hp_eta = (TH1 *) gDirectory->GetObjectChecked("hp_eta", "TH1");
0448   hp_eta->SetTitle(";#eta for primary particle with p_{T}>10 MeV;dN/d#eta/Event");
0449   hp_eta->Scale(1. / total_event / hp_eta->GetXaxis()->GetBinWidth(1));
0450 
0451   p = (TPad *) c1->cd(idx++);
0452   c1->Update();
0453 
0454   T->Draw("p_rapidity>>hp_rapidity(200,-10,10)", "PHG4Particle_pT>0.01 && PHG4Particle[].trkid>=0");
0455   TH1 *hp_rapidity = (TH1 *) gDirectory->GetObjectChecked("hp_rapidity", "TH1");
0456   hp_rapidity->SetTitle(";y for primary particle with p_{T}>10 MeV;dN/dy /Event");
0457   hp_rapidity->Scale(1. / total_event / hp_rapidity->GetXaxis()->GetBinWidth(1));
0458 
0459   SaveCanvas(c1,
0460              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0461 }
0462 
0463 void VertexChecks()
0464 {
0465   TText *t;
0466   TCanvas *c1 = new TCanvas("VertexChecks",
0467                             "VertexChecks", 1900, 1100);
0468 
0469   c1->Divide(3, 2);
0470   int idx = 1;
0471   TPad *p;
0472 
0473   p = (TPad *) c1->cd(idx++);
0474   c1->Update();
0475 
0476   T->Draw("PrimVertex>>hVertexPrim(900,-500,500)", "");
0477   hVertexPrim->SetTitle(";Vertex position [cm]");
0478 
0479   p = (TPad *) c1->cd(idx++);
0480   c1->Update();
0481 
0482   T->Draw("PrimVertex>>hVertexPrimTPC(900,-500,500)", "Sum$(G4HIT_SVTX.edep>1e-7 && SVTXHitLength>1)");
0483   hVertexPrimTPC->SetTitle(";TPC hit weighted vertex position [cm];Event * hit");
0484 
0485   p = (TPad *) c1->cd(idx++);
0486   c1->Update();
0487 
0488   T->Draw("PrimVertex>>hVertexPrimFGEM4(900,-500,500)", "Sum$(G4HIT_FGEM_4.edep>1e-7)");
0489   hVertexPrimFGEM4->SetTitle(";Last-FGEM hit weighted vertex position [cm];Event * hit");
0490 
0491   p = (TPad *) c1->cd(idx++);
0492   c1->Update();
0493 
0494   T->Draw("PrimVertex>>hVertexPrimEEMC(900,-500,500)", "Sum$(TOWER_SIM_EEMC.energy>0.03)");
0495   hVertexPrimEEMC->SetTitle(";EEMC hit weighted vertex position [cm];Event * Tower hit");
0496 
0497   p = (TPad *) c1->cd(idx++);
0498   c1->Update();
0499 
0500   T->Draw("PrimVertex>>hVertexPrimCEMC(900,-500,500)", "Sum$(TOWER_SIM_CEMC.energy>0.03)");
0501   hVertexPrimCEMC->SetTitle(";CEMC hit weighted vertex position [cm];Event * Tower hit");
0502 
0503   p = (TPad *) c1->cd(idx++);
0504   c1->Update();
0505 
0506   T->Draw("PrimVertex>>hVertexPrimFEMC(900,-500,500)", "Sum$(TOWER_SIM_FEMC.energy>0.03)");
0507   hVertexPrimFEMC->SetTitle(";FEMC hit weighted vertex position [cm];Event * Tower hit");
0508 
0509   SaveCanvas(c1,
0510              TString(_file0->GetName()) + TString("_Draw_EICRate_") + TString(c1->GetName()), true);
0511 }