// $Id$ // // File: DEventProcessor_track_hists.cc // Created: Sun Apr 24 06:45:21 EDT 2005 // Creator: davidl (on Darwin Harriet.local 7.8.0 powerpc) // #include #include #include using namespace std; #include "DEventProcessor_track_hists.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Routine used to create our DEventProcessor extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new DEventProcessor_track_hists()); } } // "C" //------------------ // DEventProcessor_track_hists //------------------ DEventProcessor_track_hists::DEventProcessor_track_hists() { cdchit_ptr = &cdchit; fdchit_ptr = &fdchit; trk_ptr = &trk; target.origin.SetXYZ(0.0, 0.0, 65.0); target.sdir.SetXYZ(1.0, 0.0, 0.0); target.tdir.SetXYZ(0.0, 1.0, 0.0); target.udir.SetXYZ(0.0, 0.0, 1.0); target.L = 30.0; pthread_mutex_init(&mutex, NULL); NLRgood = 0; NLRbad = 0; NLRfit_unknown = 0; Nevents = 0; } //------------------ // ~DEventProcessor_track_hists //------------------ DEventProcessor_track_hists::~DEventProcessor_track_hists() { } //------------------ // init //------------------ jerror_t DEventProcessor_track_hists::init(void) { // Create TRACKING directory TDirectory *dir = (TDirectory*)gROOT->FindObject("TRACKING"); if(!dir)dir = new TDirectoryFile("TRACKING","TRACKING"); dir->cd(); cdchits = new TTree("cdchit","CDC hits"); cdchits->Branch("cdchit","dchit",&cdchit_ptr); fdchits = new TTree("fdchit","FDC hits"); fdchits->Branch("fdchit","dchit",&fdchit_ptr); ttrack = new TTree("track","Track"); ttrack->Branch("track","trackpar",&trk_ptr); dir->cd("../"); return NOERROR; } //------------------ // brun //------------------ jerror_t DEventProcessor_track_hists::brun(JEventLoop *loop, int runnumber) { DApplication* dapp = dynamic_cast(loop->GetJApplication()); if(!dapp){ _DBG_<<"Cannot get DApplication from JEventLoop! (are you using a JApplication based program perhaps?)"<GetLorentzDeflections(); return NOERROR; } //------------------ // erun //------------------ jerror_t DEventProcessor_track_hists::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t DEventProcessor_track_hists::fini(void) { char str[256]; sprintf(str,"%3.4f%%", 100.0*(double)NLRbad/(double)(NLRbad+NLRgood)); cout< chargedtracks; vector candidates; vector mcthrowns; vector mctrackhits; loop->Get(chargedtracks); loop->Get(candidates); loop->Get(mcthrowns); loop->Get(mctrackhits); Nevents++; // Only look at events with one thrown and one reconstructed particle if(chargedtracks.size() <1 || mcthrowns.size() !=1 || candidates.size()<1 || chargedtracks[0]->hypotheses.size()<1){ _DBG_<<"chargedtracks.size()="<