00001 #ifndef MCTRUTH_CC
00002 #define MCTRUTH_CC
00003
00004 #include "mctruth.hh"
00005
00006 namespace larlight {
00007
00008
00009 mctruth::mctruth(DATA::DATA_TYPE type) : data_base(type),
00010 fMCNeutrino(DATA::MCNeutrino)
00011
00012 {
00013
00014 if(_type!=DATA::MCTruth) {
00015
00016 Message::send(MSG::ERROR,__FUNCTION__,
00017 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00018
00019 _type=DATA::MCTruth;
00020 }
00021
00022 clear_data();
00023 }
00024
00025
00026 void mctruth::clear_data()
00027
00028 {
00029 data_base::clear_data();
00030 fPartList.clear();
00031 fMCNeutrino.clear_data();
00032 fNeutrinoSet=false;
00033 fOrigin=MC::kUnknown;
00034 }
00035
00036
00037 void mctruth::SetNeutrino(Int_t CCNC,
00038 Int_t mode,
00039 Int_t interactionType,
00040 Int_t target,
00041 Int_t nucleon,
00042 Int_t quark,
00043 Double_t w,
00044 Double_t x,
00045 Double_t y,
00046 Double_t qsqr)
00047
00048 {
00049
00050 if( !fNeutrinoSet ){
00051 fNeutrinoSet = true;
00052
00053
00054
00055 mcpart nu = fPartList[0];
00056 mcpart lep = fPartList[0];
00057
00058
00059 for(unsigned int i = 1; i < fPartList.size(); ++i){
00060 if(fPartList[i].Mother() == nu.TrackId() &&
00061 (fPartList[i].PdgCode() == nu.PdgCode() ||
00062 abs(fPartList[i].PdgCode()) == abs(nu.PdgCode())-1) ){
00063 lep = fPartList[i];
00064 break;
00065 }
00066 }
00067
00068
00069 fMCNeutrino = mcnu(nu, lep,
00070 CCNC, mode, interactionType,
00071 target, nucleon, quark,
00072 w, x, y, qsqr);
00073
00074 }
00075
00076 else
00077
00078 Message::send(MSG::ERROR,__FUNCTION__,"Attempt to set neutrino when already set");
00079
00080 return;
00081
00082 }
00083
00084
00085 event_mctruth::event_mctruth(DATA::DATA_TYPE type) : std::vector<larlight::mctruth>(),
00086 event_base(type)
00087
00088 {
00089 if(_type!=DATA::MCTruth) {
00090
00091 Message::send(MSG::ERROR,__FUNCTION__,
00092 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00093
00094 _type=DATA::MCTruth;
00095 }
00096 clear_data();
00097 }
00098
00099 }
00100 #endif
00101