// $Id: mcsmear.cc 2388 2007-01-10 16:46:03Z davidl $ // // Created August 24, 2007 David Lawrence #include #include using namespace std; #include #include #include "HDDM/hddm_s.h" bool Filter(s_HDDM_t *hddm_s); bool Filter_eta_p(s_HDDM_t *hddm_s); bool Filter_eta_p_pi0(s_HDDM_t *hddm_s); bool Filter_eta_n_pip(s_HDDM_t *hddm_s); bool Filter_eta_p_gamma(s_HDDM_t *hddm_s); void ParseCommandLineArguments(int narg, char* argv[]); void Usage(void); void ctrlCHandle(int x); s_iostream_t* NewHDDMFile(char *fname); s_HDDM_t* CloneEvent(s_HDDM_t *hddm_s); char *INFILENAME = NULL; char *OUTFILENAME = NULL; int QUIT = 0; bool CREATE_SINGLE_CHANNEL_FILES = false; #ifndef _DBG_ #define _DBG_ cerr<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ _DBG_<physicsEvents; if(!PE){ hddm_s_copy->physicsEvents = NULL; return hddm_s_copy; } s_PhysicsEvents_t* PE_copy = hddm_s_copy->physicsEvents = make_s_PhysicsEvents(PE->mult); PE_copy->mult = PE->mult; for(unsigned int i=0; imult; i++){ PE_copy->in[i].eventNo = PE->in[i].eventNo; PE_copy->in[i].runNo = PE->in[i].runNo; PE_copy->in[i].hitView = (s_HitView_t*)HDDM_NULL; // never copy hits // ------------ Reactions -------------- s_Reactions_t *reactions=PE->in[i].reactions; if(!reactions){ PE_copy->in[i].reactions = NULL; continue; } s_Reactions_t *reactions_copy = PE_copy->in[i].reactions = make_s_Reactions(reactions->mult); reactions_copy->mult = reactions->mult; for(unsigned int j=0; jmult; j++){ reactions_copy->in[j].type = reactions->in[j].type; reactions_copy->in[j].weight = reactions->in[j].weight; // ------------ Beam -------------- s_Beam_t *beam = reactions->in[j].beam; s_Beam_t *beam_copy = reactions_copy->in[j].beam = beam ? make_s_Beam():NULL; if(beam_copy){ beam_copy->type = beam->type; s_Momentum_t *mom = beam_copy->momentum = make_s_Momentum(); s_Properties_t *prop = beam_copy->properties = make_s_Properties(); *mom = *beam->momentum; *prop = *beam->properties; } // ------------ Target -------------- s_Target_t *target = reactions->in[j].target; s_Target_t *target_copy = reactions_copy->in[j].target = target ? make_s_Target():NULL; if(target_copy){ target_copy->type = target->type; s_Momentum_t *mom = target_copy->momentum = make_s_Momentum(); s_Properties_t *prop = target_copy->properties = make_s_Properties(); *mom = *target->momentum; *prop = *target->properties; } // ------------ Vertices -------------- s_Vertices_t *vertices = reactions->in[j].vertices; if(vertices){ s_Vertices_t* vertices_copy = reactions_copy->in[j].vertices = make_s_Vertices(vertices->mult); vertices_copy->mult = vertices->mult; for(unsigned int k=0; kmult; k++){ s_Origin_t *origin = vertices->in[k].origin; s_Products_t *products = vertices->in[k].products; s_Origin_t *origin_copy = vertices_copy->in[k].origin = origin ? make_s_Origin():NULL; s_Products_t *products_copy = vertices_copy->in[k].products = products ? make_s_Products(products->mult):NULL; if(origin && origin_copy){ origin_copy->t = origin->t; origin_copy->vx = origin->vx; origin_copy->vy = origin->vy; origin_copy->vz = origin->vz; } if(products && products_copy){ products_copy->mult = products->mult; for(unsigned int m=0;mmult;m++){ s_Product_t *product = &products->in[m]; s_Product_t *product_copy = &products_copy->in[m]; product_copy->decayVertex = product->decayVertex; product_copy->id = product->id; product_copy->mech = product->mech; product_copy->parentid = product->parentid; product_copy->pdgtype = product->pdgtype; product_copy->type = product->type; product_copy->momentum = (s_Momentum_t*)HDDM_NULL; product_copy->properties = (s_Properties_t*)HDDM_NULL; if((product->momentum!=NULL) && (product->momentum!=HDDM_NULL)){ s_Momentum_t *mom = product_copy->momentum = make_s_Momentum(); mom->E = product->momentum->E; mom->px = product->momentum->px; mom->py = product->momentum->py; mom->pz = product->momentum->pz; } if((product->properties!=NULL) && (product->properties!=HDDM_NULL)){ s_Properties_t *prop = product_copy->properties = make_s_Properties(); prop->charge = product->properties->charge; prop->mass = product->properties->mass; } } } } }else{ reactions_copy->in[j].vertices = NULL; } } } return hddm_s_copy; }