00001 #ifndef MCSHOWER_CC
00002 #define MCSHOWER_CC
00003
00004 #include "mcshower.hh"
00005
00006 namespace larlight {
00007
00008
00009 mcshower::mcshower(DATA::DATA_TYPE type) : data_base(type)
00010
00011 {
00012 if(_type != DATA::MCShower) {
00013
00014 Message::send(MSG::ERROR,__FUNCTION__,
00015 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00016
00017 _type=DATA::MCShower;
00018 }
00019
00020 clear_data();
00021
00022 }
00023
00024
00025
00026 void mcshower::clear_data()
00027
00028 {
00029 data_base::clear_data();
00030 fMotherPDGID = DATA::INVALID_INT;
00031 fMotherTrackID = DATA::INVALID_UINT;
00032 fMotherVtx.clear();
00033 fMotherVtx.resize(4,0);
00034 fMotherMomentum.clear();
00035 fMotherMomentum.resize(4,0);
00036 fMotherPhi = fMotherTheta = DATA::INVALID_DOUBLE;
00037 fMotherAngleU = fMotherAngleV = fMotherAngleW = DATA::INVALID_FLOAT;
00038 fDaughterTrackID.clear();
00039 fDaughterMomentum.clear();
00040 fDaughterMomentum.resize(4,0);
00041 fDaughterVtx.clear();
00042 fDaughterVtx.resize(4,0);
00043 fDaughterTheta = fDaughterPhi = DATA::INVALID_DOUBLE;
00044 fDaughterAngleU = fDaughterAngleV = fDaughterAngleW = DATA::INVALID_FLOAT;
00045 fChargeU = fChargeV = fChargeW = 0;
00046 fEdepVtx.clear();
00047 }
00048
00049 void mcshower::SetMotherPoint(const std::vector<Double_t> &vtx)
00050 {
00051 if(vtx.size()!=4) {
00052 Message::get()->send(MSG::ERROR,__FUNCTION__,"Input must have 4 dimension (x,y,z,t)!");
00053 return;
00054 }
00055 fMotherVtx = vtx;
00056 }
00057
00058 void mcshower::SetMotherMomentum(const std::vector<Double_t> &mom)
00059 {
00060 if(mom.size()!=4) {
00061 Message::get()->send(MSG::ERROR,__FUNCTION__,"Input must have 4 dimension (Px,Py,Pz,E)!");
00062 return;
00063 }
00064 fMotherMomentum = mom;
00065 }
00066
00067 void mcshower::SetDaughterPosition(const std::vector<Float_t> &vtx)
00068 {
00069 if(vtx.size()!=4) {
00070 Message::get()->send(MSG::ERROR,__FUNCTION__,"Input must have 4 dimension (x,y,z,t)!");
00071 return;
00072 }
00073 fDaughterVtx = vtx;
00074 }
00075
00076 void mcshower::SetDaughterMomentum(const std::vector<Float_t> &mom)
00077 {
00078 if(mom.size()!=4) {
00079 Message::get()->send(MSG::ERROR,__FUNCTION__,"Input must have 4 dimension (Px,Py,Pz,E)!");
00080 return;
00081 }
00082 fDaughterMomentum = mom;
00083 }
00084
00085 void mcshower::AddEdepVtx(const std::vector<Float_t>& vtx)
00086 {
00087 if(vtx.size()!=4) {
00088 Message::get()->send(MSG::ERROR,__FUNCTION__,"Input must have 4 dimension (x,y,z,E)!");
00089 return;
00090 }
00091 fEdepVtx.push_back(vtx);
00092 }
00093
00094 void mcshower::SetEdepVtx(const std::vector<std::vector<Float_t> >& vtx)
00095 {
00096
00097 for(auto const point : vtx) {
00098 if(point.size()!=4) {
00099 Message::get()->send(MSG::ERROR,__FUNCTION__,"Input must have 4 dimension (x,y,z,E)!");
00100 return;
00101 }
00102 }
00103
00104 fEdepVtx = vtx;
00105 }
00106
00107
00108 Double_t mcshower::MotherAngle2D(const GEO::View_t view) const
00109
00110 {
00111 switch(view) {
00112 case GEO::kU: return fMotherAngleU;
00113 case GEO::kV: return fMotherAngleV;
00114 case GEO::kW: return fMotherAngleW;
00115 case GEO::k3D:
00116 case GEO::kUnknown:
00117 Message::get()->send(MSG::ERROR,__FUNCTION__,Form("No angle stored for view: %d",view));
00118 break;
00119 }
00120 return 0;
00121 }
00122
00123
00124 Float_t mcshower::DaughterAngle2D(const GEO::View_t view) const
00125
00126 {
00127 switch(view) {
00128 case GEO::kU: return fDaughterAngleU;
00129 case GEO::kV: return fDaughterAngleV;
00130 case GEO::kW: return fDaughterAngleW;
00131 case GEO::k3D:
00132 case GEO::kUnknown:
00133 Message::get()->send(MSG::ERROR,__FUNCTION__,Form("No angle stored for view: %d",view));
00134 break;
00135 }
00136 return 0;
00137 }
00138
00139
00140 Float_t mcshower::Charge(const GEO::View_t view) const
00141
00142 {
00143 switch(view) {
00144 case GEO::kU: return fChargeU;
00145 case GEO::kV: return fChargeV;
00146 case GEO::kW: return fChargeW;
00147 case GEO::k3D:
00148 case GEO::kUnknown:
00149 Message::get()->send(MSG::ERROR,__FUNCTION__,Form("No angle stored for view: %d",view));
00150 break;
00151 }
00152 return 0;
00153 }
00154
00155
00156 event_mcshower::event_mcshower(DATA::DATA_TYPE type)
00157 : std::vector<larlight::mcshower>(),
00158 event_base(type)
00159
00160 {
00161 if(_type != DATA::MCShower) {
00162
00163 Message::send(MSG::ERROR,__FUNCTION__,
00164 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00165
00166 _type=DATA::MCShower;
00167 }
00168
00169 clear_data();
00170 }
00171 }
00172
00173 #endif