File indexing completed on 2025-01-18 09:14:58
0001 void test_energy_deposition(TString sim_file_name="sim.root") {
0002
0003
0004 const Double_t min_edep = 2 ;
0005 const Double_t max_edep = 5 ;
0006
0007
0008 auto sim_file = new TFile(sim_file_name);
0009 auto t = (TTree*) sim_file->Get("EVENT");
0010 auto h = new TH1D("h","energy deposition",100,-1,20);
0011 t->Project("h","PFRICHHits.energyDeposit");
0012 auto ave_edep = h->GetMean() * 1e6;
0013
0014
0015 bool pass_test = ave_edep > min_edep && ave_edep < max_edep;
0016 std::cout << "TEST: " << (pass_test ? "passed" : "failed")
0017 << " with average energy deposition = " << ave_edep << " eV"
0018 << " (expected in range (" << min_edep << "," << max_edep << ") eV)"
0019 << std::endl;
0020 }