// $Id$ // // File: JEventProcessor_pi_min_theta.cc // Created: Tue Feb 5 06:51:44 EST 2013 // Creator: davidl (on Linux gluon02.jlab.org 2.6.32-279.14.1.el6.x86_64 x86_64) // #include "JEventProcessor_pi_min_theta.h" using namespace jana; using namespace std; #include // Routine used to create our JEventProcessor #include extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new JEventProcessor_pi_min_theta()); } } // "C" //------------------ // JEventProcessor_pi_min_theta (Constructor) //------------------ JEventProcessor_pi_min_theta::JEventProcessor_pi_min_theta() { } //------------------ // ~JEventProcessor_pi_min_theta (Destructor) //------------------ JEventProcessor_pi_min_theta::~JEventProcessor_pi_min_theta() { } //------------------ // init //------------------ jerror_t JEventProcessor_pi_min_theta::init(void) { min_theta = new TH1D("min_theta", "Min. #theta of all charged #pis", 500, 0.0, 10.0); min_p = new TH1D("min_p", "Min. total momentum of all charged #pis", 500, 0.0, 8.0); min_pt = new TH1D("min_pt", "Min. transverse momentum of all charged #pis", 500, 0.0, 0.4); pip_theta = new TH1D("pip_theta", "#pi^{+} #theta", 500, 0.0, 10.0); pim_theta = new TH1D("pim_theta", "#pi^{-} #theta", 500, 0.0, 10.0); pip_p = new TH1D("pip_p", "#pi^{+} total momentum", 500, 0.0, 8.0); pim_p = new TH1D("pim_p", "#pi^{-} total momentum", 500, 0.0, 8.0); pip_pt = new TH1D("pip_pt", "#pi^{+} transverse momentum", 500, 0.0, 0.4); pim_pt = new TH1D("pim_pt", "#pi^{-} transverse momentum", 500, 0.0, 0.4); min_theta->SetLineColor(kMagenta); min_p->SetLineColor(kMagenta); min_pt->SetLineColor(kMagenta); pip_theta->SetLineColor(kBlue); pip_p->SetLineColor(kBlue); pip_pt->SetLineColor(kBlue); pim_theta->SetLineColor(kRed); pim_p->SetLineColor(kRed); pim_pt->SetLineColor(kRed); return NOERROR; } //------------------ // brun //------------------ jerror_t JEventProcessor_pi_min_theta::brun(JEventLoop *eventLoop, int runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t JEventProcessor_pi_min_theta::evnt(JEventLoop *loop, int eventnumber) { // Get all generated particles vector throwns; loop->Get(throwns); // Sort generated particles into pi+ and pi- lists vector pips; vector pims; for(unsigned int i=0; itype == 8)pips.push_back(thrown); if(thrown->type == 9)pims.push_back(thrown); } // Make sure there are exactly one of each type if(pips.size()!=1 || pims.size()!=1){ jerr<<"Wrong number of pi+ and pi- !!!!"<lorentzMomentum(); DLorentzVector pim = pims[0]->lorentzMomentum(); // Fill histos if(pip.Theta() < pim.Theta()){ min_theta->Fill(pip.Theta()*57.2958); }else{ min_theta->Fill(pim.Theta()*57.2958); } if(pip.P() < pim.P()){ min_p->Fill(pip.P()); }else{ min_p->Fill(pim.P()); } if(pip.Pt() < pim.Pt()){ min_pt->Fill(pip.Pt()); }else{ min_pt->Fill(pim.Pt()); } pip_theta->Fill(pip.Theta()*57.2958); pim_theta->Fill(pim.Theta()*57.2958); pip_p->Fill(pip.P()); pim_p->Fill(pim.P()); pip_pt->Fill(pip.Pt()); pim_pt->Fill(pim.Pt()); return NOERROR; } //------------------ // erun //------------------ jerror_t JEventProcessor_pi_min_theta::erun(void) { // This is called whenever the run number changes, before it is // changed to give you a chance to clean up before processing // events from the next run number. return NOERROR; } //------------------ // fini //------------------ jerror_t JEventProcessor_pi_min_theta::fini(void) { // Called before program exit after event processing is finished. return NOERROR; }