// // File: DPhoton_factory.cc // Created: Tue Aprl 17 11:57:50 EST 2007 // Creator: kornicer (on Linux stan) // Last modified: Blake Leverington Mon Nov 23 #include #include #include "DPhoton.h" #include "DPhoton_factory.h" #include "JANA/JEvent.h" //---------------- // Constructor //---------------- DPhoton_factory::DPhoton_factory() { // Initialize data members bfield = NULL; stepper = NULL; // Set defaults for configuration parameters USE_BCAL_ONLY = 0; USE_FCAL_ONLY = 0; PHOTON_VERTEX_X = 0.0; PHOTON_VERTEX_Y = 0.0; PHOTON_VERTEX_Z = 65.0; gPARMS->SetDefaultParameter( "PID:USE_BCAL_ONLY", USE_BCAL_ONLY ); gPARMS->SetDefaultParameter( "PID:USE_FCAL_ONLY", USE_FCAL_ONLY ); gPARMS->SetDefaultParameter( "PID:PHOTON_VERTEX_X", PHOTON_VERTEX_X ); gPARMS->SetDefaultParameter( "PID:PHOTON_VERTEX_Y", PHOTON_VERTEX_Y ); gPARMS->SetDefaultParameter( "PID:PHOTON_VERTEX_Z", PHOTON_VERTEX_Z ); } //---------------- // brun //---------------- jerror_t DPhoton_factory::brun(JEventLoop *loop, int runnumber) { // Get Magnetic field map so we can create magnetic field stepper DApplication* dapp = dynamic_cast(loop->GetJApplication()); if(!dapp){ _DBG_<<"Cannot get DApplication from JEventLoop! (are you using a JApplication based program?)"<GetBfield(); stepper = new DMagneticFieldStepper(bfield); // Get z-position of front face of FCAL from geometry vector fcal_pos; loop->GetJGeometry()->Get("//posXYZ[@volume='ForwardEMcal']/@X_Y_Z", fcal_pos, " "); assert(fcal_pos.size()==3); fcal_origin.SetXYZ(0.0, 0.0, fcal_pos[2]); fcal_norm.SetXYZ(0.0, 0.0, 1.0); // Get calibration constants map photon_track_matching; loop->GetCalib("PID/photon_track_matching", photon_track_matching); DELTA_PHI_BCAL = photon_track_matching["DELTA_PHI_BCAL"]; DELTA_Z_BCAL = photon_track_matching["DELTA_Z_BCAL"]; MEAN_PHI_BCAL = photon_track_matching["MEAN_PHI_BCAL"]; MEAN_Z_BCAL = photon_track_matching["MEAN_Z_BCAL"]; DELTA_R_FCAL = photon_track_matching["DELTA_R_FCAL"]; MEAN_R_FCAL = photon_track_matching["MEAN_R_FCAL"]; // Optionally notify user of values if(debug_level>0){ cout<<"PID: Photon/Charged track matching parameters"<