Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:53

0001 // $Id: G4_FGEM_ePHENIX.C,v 1.4 2013/10/13 21:45:27 jinhuang Exp $
0002 
0003 /*!
0004  * \file G4_FGEM_ePHENIX.C
0005  * \brief
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision: 1.4 $
0008  * \date $Date: 2013/10/13 21:45:27 $
0009  */
0010 
0011 using namespace std;
0012 
0013 void
0014 EGEM_Init()
0015 {
0016 
0017 }
0018 
0019 void
0020 EGEMSetup(PHG4Reco* g4Reco)
0021 {
0022   /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be
0023    * drawn in event display but will NOT register any hits.
0024    *
0025    * Geometric constraints:
0026    * TPC length = 211 cm --> from z = -105.5 to z = +105.5
0027    */
0028   make_GEM_station("EGEM_0", g4Reco, -32., -1.72, -3.4); // increase min eta from -1.6 to -1.72 to fit into barrel tracker geometry
0029   make_GEM_station("EGEM_1", g4Reco, -58., -2.1, -3.98); // reduce max eta from -4.0 to -3.98 to avoid overlap with volume S_AL_PIPE_5 (aluminum beam pipe)
0030   make_GEM_station("EGEM_2", g4Reco, -106., -1.2, -4.5); // move station from z = -101. to z= -106. because of increased TPC length
0031 
0032 }
0033 
0034 int
0035 make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin,
0036                  double etamax)
0037 {
0038 
0039   //  cout
0040   //    << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout  of "
0041   //    << name << endl;
0042 
0043   double polar_angle = 0;
0044 
0045   if (zpos < 0)
0046     {
0047       zpos = -zpos;
0048       polar_angle = TMath::Pi();
0049 
0050     }
0051   if (etamax < etamin)
0052     {
0053       double t = etamax;
0054       etamax = etamin;
0055       etamin = t;
0056     }
0057 
0058   PHG4SectorSubsystem *gem;
0059   gem = new PHG4SectorSubsystem(name.c_str());
0060 
0061   gem->get_geometry().set_normal_polar_angle(polar_angle);
0062   gem->get_geometry().set_normal_start(
0063                                        zpos * PHG4Sector::Sector_Geometry::Unit_cm());
0064   gem->get_geometry().set_min_polar_angle(
0065                                           PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax));
0066   gem->get_geometry().set_max_polar_angle(
0067                                           PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin));
0068   gem->get_geometry().set_material("G4_METHANE");
0069   gem->get_geometry().set_N_Sector(1);
0070   gem->OverlapCheck(overlapcheck);
0071 
0072   gem->get_geometry().AddLayers_DriftVol_COMPASS();
0073   gem->get_geometry().AddLayers_HBD_GEM();
0074   g4Reco->registerSubsystem(gem);
0075 
0076 }
0077 
0078 void EGEM_FastSim_Reco(int verbosity = 0) {
0079 
0080   //---------------
0081   // Load libraries
0082   //---------------
0083 
0084   gSystem->Load("libfun4all.so");
0085   gSystem->Load("libg4hough.so");
0086 
0087   //---------------
0088   // Fun4All server
0089   //---------------
0090 
0091   Fun4AllServer *se = Fun4AllServer::instance();
0092 
0093   PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim");
0094   kalman->Verbosity(0);
0095 
0096   kalman->set_use_vertex_in_fitting(true);
0097   kalman->set_vertex_xy_resolution(50E-4);
0098   kalman->set_vertex_z_resolution(50E-4);
0099 
0100   kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder
0101   kalman->set_phi_resolution(50E-4);
0102   kalman->set_r_resolution(1.);
0103 
0104   kalman->set_pat_rec_hit_finding_eff(1.);
0105   kalman->set_pat_rec_noise_prob(0.);
0106 
0107   std::string phg4hits_names[] = {"G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2"};
0108   kalman->set_phg4hits_names(phg4hits_names, 3);
0109   kalman->set_sub_top_node_name("SVTX");
0110   kalman->set_trackmap_out_name("SvtxTrackMap_FastSimEtaMinus");
0111 
0112   // Saved track states (projections)
0113   std::string state_names[] = {"EEMC"};
0114   kalman->set_state_names(state_names, 1);
0115 
0116   kalman->set_fit_alg_name("KalmanFitterRefTrack");//
0117   kalman->set_primary_assumption_pid(-211); // -211 = pi-
0118   kalman->set_do_evt_display(false);
0119 
0120   se->registerSubsystem(kalman);
0121 
0122 }
0123