Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:19:44

0001 // $Id: $
0002 
0003 /*!
0004  * \file RawCluster.cc
0005  * \brief
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \author Francesco Vassalli <Francesco.Vassalli@colorado.edu>
0008  * \version $Revision: 2  $
0009  * \date $Date: 07/13/18$
0010  */
0011 
0012 #include "RawCluster.h"
0013 
0014 #include <cstdlib>
0015 #include <iostream>
0016 
0017 std::pair<const std::string, RawCluster::PROPERTY_TYPE>
0018 RawCluster::get_property_info(const PROPERTY prop_id)
0019 {
0020   switch (prop_id)
0021   {
0022   case prop_ecore:
0023     return std::make_pair("EM cluster energy estimated with its core towers", RawCluster::type_float);
0024     break;
0025   case prop_prob:
0026     return std::make_pair("cluster template probability for EM shower", RawCluster::type_float);
0027     break;
0028   case prop_chi2:
0029     return std::make_pair("reduced chi2 for EM shower", RawCluster::type_float);
0030     break;
0031   case prop_merged_cluster_prob:
0032     return std::make_pair("cluster template merged pi0 cluster probability for EM shower", RawCluster::type_float);
0033     break;
0034 
0035   case prop_et_iso_calotower_sub_R01:
0036     return std::make_pair("subtracted calortower isolation ET R=.1", RawCluster::type_float);
0037     break;
0038 
0039   case prop_et_iso_calotower_sub_R02:
0040     return std::make_pair("subtracted calortower isolation ET R=.2", RawCluster::type_float);
0041     break;
0042   case prop_et_iso_calotower_sub_R03:
0043     return std::make_pair("subtracted calortower isolation ET R=.3", RawCluster::type_float);
0044     break;
0045   case prop_et_iso_calotower_sub_R04:
0046     return std::make_pair("subtracted calortower isolation ET R=.4", RawCluster::type_float);
0047     break;
0048   case prop_et_iso_calotower_R01:
0049     return std::make_pair("calortower isolation ET R=.1", RawCluster::type_float);
0050     break;
0051   case prop_et_iso_calotower_R02:
0052     return std::make_pair("calortower isolation ET R=.2", RawCluster::type_float);
0053 
0054     break;
0055   case prop_et_iso_calotower_R03:
0056     return std::make_pair("calortower isolation ET R=.3", RawCluster::type_float);
0057     break;
0058   case prop_et_iso_calotower_R04:
0059     return std::make_pair("calortower isolation ET R=.4", RawCluster::type_float);
0060     break;
0061 
0062   case prop_tower_x_raw:
0063     return std::make_pair("tower-space CoG x (raw, tower units)", RawCluster::type_float);
0064     break;
0065   case prop_tower_y_raw:
0066     return std::make_pair("tower-space CoG y (raw, tower units)", RawCluster::type_float);
0067     break;
0068   case prop_tower_x_corr:
0069     return std::make_pair("tower-space CoG x (corrected, tower units)", RawCluster::type_float);
0070     break;
0071   case prop_tower_y_corr:
0072     return std::make_pair("tower-space CoG y (corrected, tower units)", RawCluster::type_float);
0073     break;
0074   case prop_tower_t_mean:
0075     return std::make_pair("energy-weighted mean time", RawCluster::type_float);
0076     break;
0077 
0078   case prop_incidence_alpha_phi:
0079     return std::make_pair("mechanical incidence alpha_phi (signed, rad)", RawCluster::type_float);
0080     break;
0081   case prop_incidence_alpha_eta:
0082     return std::make_pair("mechanical incidence alpha_eta (signed, rad)", RawCluster::type_float);
0083     break;
0084 
0085     //  case prop_truth_track_ID:
0086     //    return std::make_pair("truth cluster's PHG4Particle ID", RawCluster::type_int);
0087     //    break;
0088     //  case prop_truth_flavor:
0089     //    return std::make_pair("truth cluster's PHG4Particle flavor", RawCluster::type_int);
0090     //    break;
0091 
0092   default:
0093     std::cout << "RawCluster::get_property_info - Fatal Error - unknown index " << prop_id << std::endl;
0094     exit(1);
0095   }
0096 }
0097 
0098 bool RawCluster::check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type)
0099 {
0100   std::pair<const std::string, PROPERTY_TYPE> property_info = get_property_info(prop_id);
0101   if (property_info.second != prop_type)
0102   {
0103     return false;
0104   }
0105   return true;
0106 }
0107 
0108 std::string
0109 RawCluster::get_property_type(const PROPERTY_TYPE prop_type)
0110 {
0111   switch (prop_type)
0112   {
0113   case type_int:
0114     return "int";
0115   case type_uint:
0116     return "unsigned int";
0117   case type_float:
0118     return "float";
0119   default:
0120     return "unkown";
0121   }
0122 }