// $Id: smear.cc 2432 2007-02-06 04:19:48Z davidl $ // // Created June 22, 2005 David Lawrence #include #include #include using namespace std; #include #include "HDDM/hddm_s.h" #define rad2deg 57.29577951308 #ifndef _DBG_ #define _DBG_ cerr<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ _DBG_< etas; vector protons; vector neutrons; vector pi0s; vector pips; vector gammas; vector gammas_not_from_eta; vector gammas_not_from_pi0; vector gammas_not_from_eta_or_pi0; vector pi0s_not_from_eta; vector pips_not_from_eta; //----------- // Filter //----------- bool Filter(s_HDDM_t *hddm_s) { // Return "true" to keep event, "false" to throw it away. We also // fill in some global variables with info we find so that we don't // have to go through this more than once per event. // Reset globals hddm_s_global = hddm_s; // allows us to verify that global variables hold values for this event etas.clear(); protons.clear(); neutrons.clear(); pi0s.clear(); pips.clear(); gammas.clear(); gammas_not_from_eta.clear(); gammas_not_from_pi0.clear(); pi0s_not_from_eta.clear(); pips_not_from_eta.clear(); gammas_not_from_eta_or_pi0.clear(); // Find pointer to s_Product_t array and number of elements s_Product_t *prods = NULL; int Nprods = 0; s_PhysicsEvents_t* PE = hddm_s->physicsEvents; if(!PE) return false; int eventnumber = 0; for(unsigned int i=0; imult; i++){ eventnumber = PE->in[i].eventNo; // ------------ Reactions -------------- s_Reactions_t *reactions=PE->in[i].reactions; if(!reactions)continue; for(unsigned int j=0; jmult; j++){ s_Vertices_t *vertices = reactions->in[j].vertices; if(vertices){ for(unsigned int k=0; kmult; k++){ s_Origin_t *origin = vertices->in[k].origin; s_Products_t *products = vertices->in[k].products; if(products && origin){ prods = products->in; Nprods = products->mult; } } } } } // Make lists of each type of particle of interest from all // levels of the decay chain for(int i=0; i0){ _DBG_<<"---------- Event: "<0; } //----------- // DescendedFrom //----------- bool DescendedFrom(s_Product_t *start, int pdgtype, s_Product_t *prods, int Nprods) { do{ if(start->pdgtype == pdgtype)return true; start = GetParent(start, prods, Nprods); }while(start!=NULL); return false; } //----------- // GetParent //----------- s_Product_t* GetParent(s_Product_t *start, s_Product_t *prods, int Nprods) { // Loop over products until parent is found for(int i=0; iparentid)return &prods[i]; } return NULL; } //----------- // Filter_eta_p //----------- bool Filter_eta_p(s_HDDM_t *hddm_s) { return etas.size()==1 && protons.size()==1 && neutrons.size()==0 && pi0s_not_from_eta.size()==0 && pips_not_from_eta.size()==0 && gammas_not_from_eta.size()==0; } //----------- // Filter_eta_p_pi0 //----------- bool Filter_eta_p_pi0(s_HDDM_t *hddm_s) { return etas.size()==1 && protons.size()==1 && neutrons.size()==0 && pi0s_not_from_eta.size()==1 && pips_not_from_eta.size()==0 && gammas_not_from_eta_or_pi0.size()==0; } //----------- // Filter_eta_n_pip //----------- bool Filter_eta_n_pip(s_HDDM_t *hddm_s) { return etas.size()==1 && protons.size()==0 && neutrons.size()==1 && pi0s_not_from_eta.size()==0 && pips_not_from_eta.size()==1 && gammas_not_from_eta_or_pi0.size()==0; } //----------- // Filter_eta_p_gamma //----------- bool Filter_eta_p_gamma(s_HDDM_t *hddm_s) { return etas.size()==1 && protons.size()==1 && neutrons.size()==0 && pi0s_not_from_eta.size()==0 && pips_not_from_eta.size()==0 && gammas_not_from_eta_or_pi0.size()==1; }