#include using namespace std; #include "MyProcessor.h" #include "HDDM/hddm_s.h" #include "HDDM/DEventSourceHDDM.h" #include "TRACKING/DMCThrown.h" #include "PID/DPhoton.h" //#include "FCAL/DFCALPhoton.h" #include "PID/DBeamPhoton.h" //#include "PID/DTwoGammaFit_factory_PI0.h" //#include "PID/DParticle.h" #include #include void MyProcessor::center_axis(TH1* hist) { hist->GetXaxis()->CenterTitle(kTRUE); hist->GetYaxis()->CenterTitle(kTRUE); } //========================================= void MyProcessor::center_axis(TH1* hist, TDirectory* dir) { hist->SetDirectory(dir); hist->GetXaxis()->CenterTitle(kTRUE); hist->GetYaxis()->CenterTitle(kTRUE); } //============================================ void MyProcessor::center_axis(TH2* hist) { hist->GetXaxis()->CenterTitle(kTRUE); hist->GetYaxis()->CenterTitle(kTRUE); } //=========================================== void MyProcessor::center_axis(TH2* hist, TDirectory* dir) { hist->SetDirectory(dir); hist->GetXaxis()->CenterTitle(kTRUE); hist->GetYaxis()->CenterTitle(kTRUE); } //------------------------------------------------------------------ // init -Open output file here (e.g. a ROOT file) //------------------------------------------------------------------ jerror_t MyProcessor::init(void) { // open ROOT file ROOTfile = new TFile("hd_ana.root","RECREATE","Produced by hd_ana"); cout<<"Opened ROOT file \"hd_ana.root\""<>>General Histograms //------------------------- E_beam = new TH1F("E_beam", "; E_{#gamma} (GeV); counts/1.0MeV", 12000, 0., 12.); center_axis(E_beam); fcal_time = new TH1F("fcal_time", "; FCAL time (ns); counts/0.5ns", 480, -120., 120.); center_axis(fcal_time); xy_position = new TH2F("xy_position", "; X_{FCAL} (cm); Y_{FCAL} (cm)", 2000, -100., 100., 2000, -100., 100.); center_axis(xy_position); num_photons = new TH1F("num_photons", "; number of #gamma's in FCAL per event; counts/event", 14, -0.5, 13.5); center_axis(num_photons); num_charged = new TH1F("num_charged", "; number of charged tracks per event; counts/event", 14, -0.5, 13.5); center_axis(num_charged); total_energy_vs_elast = new TH2F("total_energy_vs_elast", "; E_{total, FCAL}/E_{#gamma}; E_{total, FCAL} (GeV)", 300, 0., 1.5, 12000, 0., 12.); center_axis(total_energy_vs_elast); // //->>>>>>>General Histograms N_FCAL_PHOTONS>2; E_FCAL_Total>9.0 // fcal_time_cut = new TH1F("fcal_time_cut", "; FCAL time (ns); counts/0.5ns", 480, -120., 120.); center_axis(fcal_time_cut); xy_position_cut = new TH2F("xy_position_cut", "; X_{FCAL} (cm); Y_{FCAL} (cm)", 2000, -100., 100., 2000, -100., 100.); center_axis(xy_position); num_photons_cut = new TH1F("num_photons_cut", "; number of #gamma's in FCAL per event; counts/event", 14, -0.5, 13.5); center_axis(num_photons_cut); num_charged_cut = new TH1F("num_charged_cut", "; number of charged tracks per event; counts/event", 14, -0.5, 13.5); center_axis(num_charged); //========================================================================// //>>>>>>>>>>>>> 2gamma histos /// TDirectory * dir_2gamma = ROOTfile->mkdir("histos_2gamma"); tree_2gamma = new TTree("tree_2gamma", "event number for background under 2gamma peak"); tree_2gamma->SetDirectory(dir_2gamma); tree_2gamma->Branch("ev_num", &ev_num, "ev_num/I"); mass_vs_elast_2gamma = new TH2F("mass_vs_elast_2gamma", "; E_{#eta} rec./E_{#gamma}; M_{#gamma#gamma} (GeV/c^{2})", 200, 0., 2., 1400, 0., 0.7); center_axis(mass_vs_elast_2gamma, dir_2gamma); mass_vs_total_e_2gamma = new TH2F("mass_vs_total_e_2gamma", "; E_{total, FCAL} (GeV); M_{#gamma#gamma} (GeV/c^{2})", 12000, 0., 12., 1400, 0., 0.7); center_axis(mass_vs_total_e_2gamma, dir_2gamma); theta_eta_2gamma = new TH1F("theta_eta_2gamma", "; #theta_{#eta, rec.} (deg.); counts/0.04#circ", 200, 0., 8.); center_axis(theta_eta_2gamma, dir_2gamma); mass_vs_elast_2gamma_cut = new TH2F("mass_vs_elast_2gamma_cut", "; E_{#eta} rec./E_{#gamma}; M_{#gamma#gamma} (GeV/c^{2})", 200, 0., 2., 1400, 0., 0.7); center_axis(mass_vs_elast_2gamma_cut, dir_2gamma); theta_eta_2gamma_cut = new TH1F("theta_eta_2gamma_cut", "; #theta_{#eta, rec.} (deg.); counts/0.04#circ", 200, 0., 8.); center_axis(theta_eta_2gamma_cut, dir_2gamma); //========================================================================// //>>>>>>>>>>>>>>> 6 gamma histos /// TDirectory * dir_6gamma = ROOTfile->mkdir("histos_6gamma"); tree_6gamma = new TTree("tree_6gamma", "event number for background under 6gamma peak"); tree_6gamma->SetDirectory(dir_6gamma); tree_6gamma->Branch("ev_num", &ev_num, "ev_num/I"); mass_vs_elast_6gamma = new TH2F("mass_vs_elast_6gamma", "; E_{#eta} rec./E_{#gamma}; M_{#gamma#gamma} (GeV/c^{2})", 200, 0., 2., 1400, 0., 0.7); center_axis(mass_vs_elast_6gamma, dir_6gamma); mass_vs_total_e_6gamma = new TH2F("mass_vs_total_e_6gamma", "; E_{total, FCAL} (GeV); M_{#gamma#gamma} (GeV/c^{2})", 12000, 0., 12., 1400, 0., 0.7); center_axis(mass_vs_total_e_6gamma, dir_6gamma); theta_eta_6gamma = new TH1F("theta_eta_6gamma", "; #theta_{#eta, rec.} (deg.); counts/0.04#circ", 200, 0., 8.); center_axis(theta_eta_6gamma, dir_6gamma); mass_vs_elast_6gamma_cut = new TH2F("mass_vs_elast_6gamma_cut", "; E_{#eta} rec./E_{#gamma}; M_{#gamma#gamma} (GeV/c^{2})", 200, 0., 2., 1400, 0., 0.7); center_axis(mass_vs_elast_6gamma_cut, dir_6gamma); theta_eta_6gamma_cut = new TH1F("theta_eta_6gamma_cut", "; #theta_{#eta, rec.} (deg.); counts/0.04#circ", 200, 0., 8.); center_axis(theta_eta_6gamma_cut, dir_6gamma); //=========================================================================// fPDGdatabase = TDatabasePDG::Instance(); return NOERROR; } //------------------------------------------------------------------ // evnt -Fill histograms here //------------------------------------------------------------------ jerror_t MyProcessor::evnt(JEventLoop *eventLoop, int eventnumber) { // JEvent& event = eventLoop->GetJEvent(); // JEventSource *source = event.GetJEventSource(); // DEventSourceHDDM *hddm_source = dynamic_cast(source); // if(!hddm_source){ // cerr<<" This program MUST be used with an HDDM file as input!"<