Files
uLib/src/HEP/Detectors/DetectorChamber.h

85 lines
2.5 KiB
C++

/*//////////////////////////////////////////////////////////////////////////////
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
All rights reserved
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
------------------------------------------------------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
//////////////////////////////////////////////////////////////////////////////*/
#ifndef U_CHAMBERDETECTOR_H
#define U_CHAMBERDETECTOR_H
#include "Core/Types.h"
#include "Math/ContainerBox.h"
#include "HEP/Detectors/Hit.h"
#include "HEP/Detectors/HitMC.h"
#include "HEP/Detectors/MuonEvent.h"
namespace uLib {
class DetectorChamber : public ContainerBox {
public:
uLibTypeMacro(DetectorChamber, ContainerBox)
DetectorChamber() : BaseClass() {
m_ProjectionPlane.origin = HPoint3f(0, 0, 0);
m_ProjectionPlane.direction = HVector3f(0, 0, 1);
}
DetectorChamber(const Vector3f &size) : BaseClass(size) {
m_ProjectionPlane.origin = HPoint3f(0, 0, 0);
m_ProjectionPlane.direction = HVector3f(0, 0, 1);
}
// set the plane where muons hit is projected
// coordinates are local to the container box
void SetProjectionPlane(const HLine3f &normal) { m_ProjectionPlane = normal; }
const HLine3f &GetProjectionPlane() const { return m_ProjectionPlane; }
HLine3f GetWorldProjectionPlane() const {
HLine3f worldPlane;
Matrix4f M = this->GetWorldMatrix();
worldPlane.origin = M * m_ProjectionPlane.origin;
HVector3f dirNorm = M * m_ProjectionPlane.direction;
dirNorm.normalize(); // Normalize for consistent dot products
worldPlane.direction = dirNorm;
return worldPlane;
}
MuonEvent ProjectMuonEvent(const MuonEvent &muon) const;
private:
HLine3f m_ProjectionPlane;
};
}
#endif // CHAMBERDETECTOR_H