// $Id: DEventProcessor_eta_tree.cc 1816 2006-06-06 14:38:18Z davidl $ // // File: DEventProcessor_eta_tree.cc // Created: Sun Apr 24 06:45:21 EDT 2005 // Creator: davidl (on Darwin Harriet.local 7.8.0 powerpc) // #include using namespace std; #include #include #include using namespace jana; #include "DEventProcessor_eta_tree.h" #include #include #include #define ETA_MASS 0.54775 // Routine used to create our JEventProcessor extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new DEventProcessor_eta_tree()); } } //------------------ // DEventProcessor_eta_tree //------------------ DEventProcessor_eta_tree::DEventProcessor_eta_tree() { pthread_mutex_init(&mutex, NULL); } //------------------ // ~DEventProcessor_eta_tree //------------------ DEventProcessor_eta_tree::~DEventProcessor_eta_tree() { } //------------------ // init //------------------ jerror_t DEventProcessor_eta_tree::init(void) { // Create "tree tree = new TTree("T","Thrown Event parameters"); // Create branches for thrown and reconstructed values evt = new Event(); tree->Branch("T",&evt); return NOERROR; } //------------------ // evnt //------------------ jerror_t DEventProcessor_eta_tree::evnt(JEventLoop *loop, int eventnumber) { vector throwns; loop->Get(throwns); // Lock mutex pthread_mutex_lock(&mutex); // Fill in Event object evt->Clear(); // Loop over thrown values for(unsigned int i=0; ipdgtype == 221){ // Particle is an eta TClonesArray &etas = *(evt->eta); new(etas[evt->Neta++]) TLorentzVector(thrown->momentum(), ETA_MASS); } } // Copy event number to tres and add this event evt->event = eventnumber; tree->Fill(); // Unlock mutex pthread_mutex_unlock(&mutex); return NOERROR; } //------------------ // erun //------------------ jerror_t DEventProcessor_eta_tree::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t DEventProcessor_eta_tree::fini(void) { return NOERROR; }