// Author: David Lawrence June 25, 2004 // // // MyProcessor.cc // #include using namespace std; #include #include #include "MyProcessor.h" #include "PID/DPhoton.h" #include "PID/DKinFit.h" #include "TRACKING/DMCThrown.h" #include "TRACKING/DTrack.h" int PAUSE_BETWEEN_EVENTS = 1; int SKIP_BORING_EVENTS = 0; int PRINT_ALL=0; float MAX_EVENTS = 1e20; int COUNT = 0; //TFile *fout = NULL; //TH1F *hpi0[4]; vector toprint; #define ansi_escape ((char)0x1b) #define ansi_bold ansi_escape<<"[1m" #define ansi_black ansi_escape<<"[30m" #define ansi_red ansi_escape<<"[31m" #define ansi_green ansi_escape<<"[32m" #define ansi_blue ansi_escape<<"[34m" #define ansi_normal ansi_escape<<"[0m" #define ansi_up(A) ansi_escape<<"["<<(A)<<"A" #define ansi_down(A) ansi_escape<<"["<<(A)<<"B" #define ansi_forward(A) ansi_escape<<"["<<(A)<<"C" #define ansi_back(A) ansi_escape<<"["<<(A)<<"D" //------------------------------------------------------------------ // brun //------------------------------------------------------------------ jerror_t MyProcessor::init(void) { char name[256]; ///< Called once at program start. fout = new TFile(OUTNAME, "RECREATE","Output file"); cout << "Opened ROOT file " << OUTNAME < factory_names = eventLoop->GetFactoryNames(); usleep(100000); //this just gives the Main thread a chance to finish printing the "Launching threads" message cout< really_toprint; for(unsigned int i=0; i mcthrown; vector tracks; if(eventLoop->Get(mcthrown)) { for(int i=0;i<(int)mcthrown.size();i++) { if(VERBOSE) { cerr << i << "\t" << mcthrown[i]->momentum().Mag() << "\t"; cerr << mcthrown[i]->momentum().Theta()*180.0/3.14159 << " "; cerr << mcthrown[i]->momentum().Phi() << endl; } } } if(eventLoop->Get(tracks, "THROWN")) { for(int i=0;i<(int)tracks.size();i++) { if(VERBOSE) { cerr << i << "\t" << tracks[i]->momentum().Mag() << "\t"; cerr << tracks[i]->momentum().Theta()*180.0/3.14159 << " "; cerr << tracks[i]->momentum().Phi() << endl; } } } COUNT++; if(COUNT>=MAX_EVENTS) { fini(); exit(1); } return NOERROR; } //------------------------------------------------------------------ // fini //------------------------------------------------------------------ jerror_t MyProcessor::fini(void) { fout->cd(); fout->Write(); fout->cd(); fout->Close(); // delete fout; cout<