/* This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus
*
* MAUS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MAUS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MAUS. If not, see .
*/
#ifndef _SRC_COMMON_CPP_JSONCPPPROCESSORS_HITPROCESSOR_HH_
#define _SRC_COMMON_CPP_JSONCPPPROCESSORS_HITPROCESSOR_HH_
#include "json/value.h"
#include "src/common_cpp/JsonCppProcessors/PrimaryProcessor.hh"
#include "src/common_cpp/JsonCppProcessors/ObjectProcessor.hh"
#include "src/common_cpp/JsonCppProcessors/ProcessorBase.hh"
#include "src/common_cpp/DataStructure/Hit.hh"
namespace MAUS {
/** @class Hit processor for converting json <-> cpp data */
template
class HitProcessor : public ObjectProcessor > {
public:
/** Constructor - registers the branch structure */
HitProcessor();
/** delete the channel_id processor */
~HitProcessor();
void RegisterBranches();
private:
ProcessorBase* _channel_id_proc;
ThreeVectorProcessor _three_vec_proc;
DoubleProcessor _double_proc;
IntProcessor _int_proc;
};
typedef HitProcessor SciFiHitProcessor;
typedef HitProcessor TOFHitProcessor;
typedef HitProcessor CkovHitProcessor;
typedef HitProcessor KLHitProcessor;
typedef HitProcessor EMRHitProcessor;
typedef HitProcessor SpecialVirtualHitProcessor;
template
void HitProcessor::RegisterBranches() {
this->RegisterValueBranch("track_id", &_int_proc,
&Hit::GetTrackId,
&Hit::SetTrackId, true);
this->RegisterValueBranch("particle_id", &_int_proc,
&Hit::GetParticleId,
&Hit::SetParticleId, true);
this->RegisterValueBranch("path_length", &_double_proc,
&Hit::GetPathLength,
&Hit::SetPathLength, true);
this->RegisterValueBranch("energy", &_double_proc,
&Hit::GetEnergy,
&Hit::SetEnergy, true);
this->RegisterValueBranch("charge", &_double_proc,
&Hit::GetCharge,
&Hit::SetCharge, true);
this->RegisterValueBranch("mass", &_double_proc,
&Hit::GetMass,
&Hit::SetMass, true);
this->RegisterValueBranch("time", &_double_proc,
&Hit::GetTime,
&Hit::SetTime, true);
this->RegisterValueBranch("energy_deposited", &_double_proc,
&Hit::GetEnergyDeposited,
&Hit::SetEnergyDeposited, true);
this->RegisterValueBranch("position", &_three_vec_proc,
&Hit::GetPosition,
&Hit::SetPosition, true);
this->RegisterValueBranch("momentum", &_three_vec_proc,
&Hit::GetMomentum,
&Hit::SetMomentum, true);
this->RegisterPointerBranch("channel_id", _channel_id_proc,
&Hit::GetChannelId,
&Hit::SetChannelId, true);
}
template
HitProcessor::~HitProcessor() {
if (_channel_id_proc != NULL) {
delete _channel_id_proc;
}
}
}
#endif