Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 
0002 
0003 enum enu_HCalOut_clusterizer
0004 {
0005   kHCalOutGraphClusterizer,
0006 
0007   kHCalOutTemplateClusterizer
0008 };
0009 
0010 //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky
0011 enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer;
0012 //! graph clusterizer, RawClusterBuilderGraph
0013 //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer;
0014 
0015 // Init is called by G4Setup.C
0016 void HCalOuterInit(){}
0017 
0018 double HCalOuter(PHG4Reco* g4Reco,
0019          double radius,
0020          const int crossings,
0021          const int absorberactive = 0,
0022          int verbosity = 0) {
0023 
0024   gSystem->Load("libg4detectors.so");
0025   gSystem->Load("libg4testbench.so");
0026 
0027   PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT");
0028   // hcal->set_double_param("inner_radius", 183.3);
0029   //-----------------------------------------
0030   // the light correction can be set in a single call
0031   // hcal->set_double_param("light_balance_inner_corr", NAN);
0032   // hcal->set_double_param("light_balance_inner_radius", NAN);
0033   // hcal->set_double_param("light_balance_outer_corr", NAN);
0034   // hcal->set_double_param("light_balance_outer_radius", NAN);
0035   // hcal->set_double_param("magnet_cutout_radius", 195.31);
0036   // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96);
0037   // hcal->SetLightCorrection(NAN,NAN,NAN,NAN);
0038   //-----------------------------------------
0039   // hcal->set_double_param("outer_radius", 264.71);
0040   // hcal->set_double_param("place_x", 0.);
0041   // hcal->set_double_param("place_y", 0.);
0042   // hcal->set_double_param("place_z", 0.);
0043   // hcal->set_double_param("rot_x", 0.);
0044   // hcal->set_double_param("rot_y", 0.);
0045   // hcal->set_double_param("rot_z", 0.);
0046   // hcal->set_double_param("scinti_eta_coverage", 1.1);
0047   // hcal->set_double_param("scinti_gap", 0.85);
0048   // hcal->set_double_param("scinti_gap_neighbor", 0.1);
0049   // hcal->set_double_param("scinti_inner_radius",183.89);
0050   // hcal->set_double_param("scinti_outer_radius",263.27);
0051   // hcal->set_double_param("scinti_tile_thickness", 0.7);
0052   // hcal->set_double_param("size_z", 304.91 * 2);
0053   // hcal->set_double_param("steplimits", NAN);
0054   // hcal->set_double_param("tilt_angle", -11.23);
0055 
0056   // hcal->set_int_param("light_scint_model", 1);
0057   // hcal->set_int_param("magnet_cutout_first_scinti", 8);
0058   // hcal->set_int_param("ncross", 0);
0059   // hcal->set_int_param("n_towers", 64);
0060   // hcal->set_int_param("n_scinti_plates_per_tower", 5);
0061   // hcal->set_int_param("n_scinti_tiles", 12);
0062 
0063   // hcal->set_string_param("material", "Steel_1006");
0064 
0065 
0066   hcal->SetActive();
0067   hcal->SuperDetector("HCALOUT");
0068   if (absorberactive)
0069     {
0070       hcal->SetAbsorberActive();
0071     }
0072   hcal->OverlapCheck(overlapcheck);
0073   g4Reco->registerSubsystem(hcal);
0074 
0075   radius = hcal->get_double_param("outer_radius");
0076   
0077   radius += no_overlapp;
0078   
0079   return radius; 
0080 }
0081 
0082 void HCALOuter_Cells(int verbosity = 0) {
0083 
0084   gSystem->Load("libfun4all.so");
0085   gSystem->Load("libg4detectors.so");
0086   Fun4AllServer *se = Fun4AllServer::instance();
0087   
0088   PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO");
0089   hc->Detector("HCALOUT");
0090   //  hc->Verbosity(2);
0091   // check for energy conservation - needs modified "infinite" timing cuts
0092   // 0-999999999 
0093   //  hc->checkenergy();
0094   // timing cuts with their default settings
0095   // hc->set_double_param("tmin",0.); 
0096   // hc->set_double_param("tmax",60.0); 
0097   // or all at once:
0098   // hc->set_timing_window(0.0,60.0);
0099   se->registerSubsystem(hc);
0100 
0101   return;
0102 }
0103 
0104 void HCALOuter_Towers(int verbosity = 0) {
0105 
0106   gSystem->Load("libg4calo.so");
0107   gSystem->Load("libcalo_reco.so");
0108   Fun4AllServer *se = Fun4AllServer::instance();
0109   
0110   HcalRawTowerBuilder* TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder");
0111   TowerBuilder->Detector("HCALOUT");
0112   TowerBuilder->set_sim_tower_node_prefix("SIM");
0113   TowerBuilder->Verbosity(verbosity);
0114   se->registerSubsystem( TowerBuilder );
0115 
0116   // From 2016 Test beam sim
0117   RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer");
0118   TowerDigitizer->Detector("HCALOUT");
0119 //  TowerDigitizer->set_raw_tower_node_prefix("RAW_LG");
0120   TowerDigitizer->set_digi_algorithm(
0121        RawTowerDigitizer::kSimple_photon_digitalization);
0122   TowerDigitizer->set_pedstal_central_ADC(0);
0123   TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update
0124   TowerDigitizer->set_photonelec_ADC(16. / 5.);
0125   TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3));
0126   TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression
0127   se->registerSubsystem(TowerDigitizer);
0128 
0129   const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf
0130 
0131   RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration");
0132   TowerCalibration->Detector("HCALOUT");
0133 //  TowerCalibration->set_raw_tower_node_prefix("RAW_LG");
0134 //  TowerCalibration->set_calib_tower_node_prefix("CALIB_LG");
0135   TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration);
0136   TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT);
0137   TowerCalibration->set_pedstal_ADC(0);
0138   TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression
0139   se->registerSubsystem(TowerCalibration);
0140 
0141   return;
0142 }
0143 
0144 void HCALOuter_Clusters(int verbosity = 0) {
0145   gSystem->Load("libcalo_reco.so");
0146 
0147   Fun4AllServer *se = Fun4AllServer::instance();
0148   
0149 
0150   if (HCalOut_clusterizer == kHCalOutTemplateClusterizer)
0151   {
0152     RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate");
0153     ClusterBuilder->Detector("HCALOUT");
0154     ClusterBuilder->Verbosity(verbosity);
0155     se->registerSubsystem( ClusterBuilder );
0156   }
0157   else if (HCalOut_clusterizer == kHCalOutGraphClusterizer)
0158   {
0159     RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph");
0160     ClusterBuilder->Detector("HCALOUT");
0161     ClusterBuilder->Verbosity(verbosity);
0162     se->registerSubsystem( ClusterBuilder );
0163   }
0164   else
0165   {
0166     cout <<"HCALOuter_Clusters - unknown clusterizer setting!"<<endl;
0167     exit(1);
0168   }
0169 
0170   
0171   return;
0172 }
0173 
0174 void HCALOuter_Eval(std::string outputfile, int verbosity = 0) {
0175 
0176   gSystem->Load("libfun4all.so");
0177   gSystem->Load("libg4eval.so");
0178   Fun4AllServer *se = Fun4AllServer::instance();
0179 
0180   CaloEvaluator* eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile.c_str());
0181   eval->Verbosity(verbosity);
0182   se->registerSubsystem( eval );
0183   
0184   return;
0185 }