mirror of
https://github.com/OpenCMT/uLib.git
synced 2025-12-06 07:21:31 +01:00
Compare commits
6 Commits
v0.5.1
...
820730bc84
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
820730bc84 | ||
|
|
06c363ab8c | ||
|
|
b7c775ee35 | ||
|
|
7bc4932d09 | ||
|
|
8832f47e75 | ||
|
|
043a44150c |
@@ -79,8 +79,31 @@ include(${EIGEN3_USE_FILE})
|
||||
find_package(ROOT CONFIG REQUIRED)
|
||||
include(${ROOT_USE_FILE})
|
||||
|
||||
find_package(VTK CONFIG REQUIRED)
|
||||
include(${VTK_USE_FILE})
|
||||
option(CENTOS_SUPPORT "VTK definitions for CentOS" OFF)
|
||||
if(CENTOS_SUPPORT)
|
||||
find_package(VTK CONFIG REQUIRED)
|
||||
include(${VTK_USE_FILE})
|
||||
else()
|
||||
find_package(VTK REQUIRED
|
||||
COMPONENTS CommonColor
|
||||
CommonCore
|
||||
FiltersCore
|
||||
FiltersModeling
|
||||
FiltersSources
|
||||
IOLegacy
|
||||
IOXML
|
||||
IOXMLParser
|
||||
ImagingCore
|
||||
InteractionStyle
|
||||
InteractionWidgets
|
||||
RenderingAnnotation
|
||||
RenderingContextOpenGL2
|
||||
RenderingCore
|
||||
RenderingFreeType
|
||||
RenderingGL2PSOpenGL2
|
||||
RenderingOpenGL2
|
||||
RenderingVolumeOpenGL2)
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_INCLUDES math.h)
|
||||
set(CMAKE_REQUIRED_LIBRARIES CMAKE_REQUIRED_LIBRARIES m)
|
||||
|
||||
@@ -4,18 +4,27 @@ set(HEADERS RootMathDense.h
|
||||
muCastorMCTrack.h
|
||||
muCastorHit.h
|
||||
muCastorInfo.h
|
||||
muCastorSkinHit.h)
|
||||
muCastorSkinHit.h
|
||||
muCastorPrimaryVertex.h
|
||||
muCastorMuDetDIGI.h
|
||||
SkinDetectorWriter.h)
|
||||
|
||||
set(SOURCES ${HEADERS} RootMuonScatter.cpp
|
||||
muCastorMCTrack.cpp
|
||||
muCastorHit.cpp
|
||||
muCastorInfo.cpp
|
||||
muCastorSkinHit.cpp)
|
||||
muCastorSkinHit.cpp
|
||||
muCastorPrimaryVertex.cpp
|
||||
muCastorMuDetDIGI.cpp
|
||||
SkinDetectorWriter.cpp)
|
||||
|
||||
set(DICTIONARY_HEADERS muCastorMCTrack.h
|
||||
muCastorHit.h
|
||||
muCastorInfo.h
|
||||
muCastorSkinHit.h)
|
||||
muCastorSkinHit.h
|
||||
muCastorPrimaryVertex.h
|
||||
muCastorMuDetDIGI.h
|
||||
SkinDetectorWriter.h)
|
||||
|
||||
set(LIBRARIES ${ROOT_LIBRARIES}
|
||||
${PACKAGE_LIBPREFIX}Math)
|
||||
|
||||
@@ -74,12 +74,13 @@ using namespace ROOT::Mutom;
|
||||
#pragma link C++ function HitRaw::Tdc() const;
|
||||
#pragma link C++ function HitRaw::Ch() const;
|
||||
|
||||
#pragma link C++ class muBlastMCTrack+;
|
||||
#pragma link C++ class muBlastHit+;
|
||||
#pragma link C++ class muCastorMCTrack+;
|
||||
#pragma link C++ class muCastorHit+;
|
||||
#pragma link C++ class muCastorInfo+;
|
||||
#pragma link C++ class muCastorSkinHit+;
|
||||
#pragma link C++ class muCastorPrimaryVertex+;
|
||||
#pragma link C++ class muCastorMuDetDIGI+;
|
||||
#pragma link C++ class SkinDetectorWriter+;
|
||||
|
||||
#endif // __CINT__
|
||||
|
||||
|
||||
47
src/Root/SkinDetectorWriter.cpp
Normal file
47
src/Root/SkinDetectorWriter.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "SkinDetectorWriter.h"
|
||||
#include "muCastorSkinHit.h"
|
||||
#include "TVector3.h"
|
||||
|
||||
SkinDetectorWriter::SkinDetectorWriter(string filename) :
|
||||
t_file(nullptr),
|
||||
t_tree(nullptr),
|
||||
t_buffer(nullptr),
|
||||
i_status(0)
|
||||
{
|
||||
t_file = new TFile(filename.c_str(), "RECREATE");
|
||||
t_tree = new TTree("muCastorMC", "muCastorMC");
|
||||
t_buffer = new TClonesArray("muCastorSkinHit");
|
||||
|
||||
t_tree->Branch("CastorSkinHits", "TClonesArray", t_buffer, 32000, 99);
|
||||
|
||||
if (t_file->IsZombie()) i_status = 1;
|
||||
}
|
||||
|
||||
SkinDetectorWriter::~SkinDetectorWriter()
|
||||
{}
|
||||
|
||||
void SkinDetectorWriter::add(int detID, float p_x, float p_y, float p_z,
|
||||
float m_x, float m_y, float m_z)
|
||||
{
|
||||
TClonesArray& ref = *t_buffer;
|
||||
int size = ref.GetEntriesFast();
|
||||
|
||||
muCastorSkinHit* new_hit = new(ref[size]) muCastorSkinHit();
|
||||
new_hit->SetDetID(detID);
|
||||
new_hit->SetPdgCode(13);
|
||||
new_hit->SetMotherID(-1);
|
||||
new_hit->SetPos (TVector3(p_x, p_y, p_z));
|
||||
new_hit->SetMom (TVector3(m_x, m_y, m_z));
|
||||
}
|
||||
|
||||
void SkinDetectorWriter::write()
|
||||
{
|
||||
if (t_tree->Fill() < 0) i_status = 2;
|
||||
t_buffer->Delete(); // or t_buffer->Clear() ??
|
||||
}
|
||||
|
||||
void SkinDetectorWriter::close()
|
||||
{
|
||||
if (t_tree->Write() == 0) i_status = 3;
|
||||
t_file->Close();
|
||||
}
|
||||
32
src/Root/SkinDetectorWriter.h
Normal file
32
src/Root/SkinDetectorWriter.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef SkinDetectorWriter_h
|
||||
#define SkinDetectorWriter_h
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "TFile.h"
|
||||
#include "TTree.h"
|
||||
#include "TClonesArray.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
class SkinDetectorWriter
|
||||
{
|
||||
public:
|
||||
SkinDetectorWriter(string filename);
|
||||
virtual ~SkinDetectorWriter();
|
||||
|
||||
void add(int detID, float p_x, float p_y, float p_z, float m_x, float m_y, float m_z);
|
||||
int status() { return i_status; }
|
||||
void write();
|
||||
void close();
|
||||
|
||||
private:
|
||||
TFile* t_file;
|
||||
TTree* t_tree;
|
||||
TClonesArray* t_buffer;
|
||||
int i_status;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //SkinDetectorWriter_h
|
||||
41
src/Root/muCastorMuDetDIGI.cpp
Normal file
41
src/Root/muCastorMuDetDIGI.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/// \file muCastorMuDetDIGI.cxx
|
||||
/// \brief Implementation of the muCastorMuDetDIGI class
|
||||
// This class build the DIGI for the scintillator detectors
|
||||
/// \author G. Bonomi, M. Subieta - INFN
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "muCastorMuDetDIGI.h"
|
||||
|
||||
/// \cond CLASSIMP
|
||||
ClassImp(muCastorMuDetDIGI)
|
||||
/// \endcond
|
||||
|
||||
using namespace std;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
muCastorMuDetDIGI::muCastorMuDetDIGI() :
|
||||
fDetID(-1),
|
||||
fLayID(-1),
|
||||
fTubID(-1),
|
||||
fDistMC(0.),
|
||||
fDriftMC(0.),
|
||||
fDist(0.),
|
||||
fDrift(0.),
|
||||
fEnergy(0.)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
muCastorMuDetDIGI::~muCastorMuDetDIGI()
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void muCastorMuDetDIGI::Print(const Option_t* /*opt*/) const
|
||||
{
|
||||
cout << " DetID: " << fDetID
|
||||
<< " LayID: " << fLayID
|
||||
<< " TubID: " << fTubID
|
||||
<< " energy deposit (keV): " << fEnergy
|
||||
<< endl;
|
||||
}
|
||||
|
||||
75
src/Root/muCastorMuDetDIGI.h
Normal file
75
src/Root/muCastorMuDetDIGI.h
Normal file
@@ -0,0 +1,75 @@
|
||||
#ifndef muCastor_MuDetDIGI_H
|
||||
#define muCastor_MuDetDIGI_H
|
||||
|
||||
/// \file muCastorMuDetDIGI.h
|
||||
/// \brief Definition of the muCastorMuDetDIGI class
|
||||
///
|
||||
/// \authors G. Bonomi, M. Subieta - INFN
|
||||
|
||||
#include <TObject.h>
|
||||
|
||||
class muCastorMuDetDIGI : public TObject
|
||||
{
|
||||
public:
|
||||
muCastorMuDetDIGI();
|
||||
virtual ~muCastorMuDetDIGI();
|
||||
|
||||
// -------> PUBLIC FUNCTIONS
|
||||
virtual void Print(const Option_t* option = "") const;
|
||||
|
||||
// -------> SET METHODS
|
||||
|
||||
/// Set Det ID (Detector module)
|
||||
void SetDetID(Int_t id) { fDetID = id; };
|
||||
|
||||
/// Set Layer ID (Layer [0,5])
|
||||
void SetLayID(Int_t id) { fLayID = id; };
|
||||
|
||||
/// Set Tube ID (Tube inside each layer)
|
||||
void SetTubID(Int_t id) { fTubID = id; };
|
||||
|
||||
void SetDistMC (Double_t v) { fDistMC = v; };
|
||||
void SetDriftMC (Double_t v) { fDriftMC= v; };
|
||||
void SetDist (Double_t v) { fDist = v; };
|
||||
void SetDrift (Double_t v) { fDrift = v; };
|
||||
|
||||
// Set energy
|
||||
void SetEnergy(Double_t e) { fEnergy = e; };
|
||||
|
||||
// -------> GET METHODS
|
||||
|
||||
/// \return The Module number
|
||||
Int_t GetDetID() { return fDetID; };
|
||||
|
||||
/// \return The Layer number
|
||||
Int_t GetLayID() { return fLayID; };
|
||||
|
||||
/// \return The Tube number
|
||||
Int_t GetTubID() { return fTubID; };
|
||||
|
||||
Double_t GetDistMC() { return fDistMC; };
|
||||
Double_t GetDriftMC() { return fDriftMC; };
|
||||
Double_t GetDist() { return fDist; };
|
||||
Double_t GetDrift() { return fDrift; };
|
||||
|
||||
/// \return Get energy
|
||||
Double_t GetEnergy() { return fEnergy; };
|
||||
|
||||
|
||||
// -------> PRIVATE VARIABLES
|
||||
private:
|
||||
Int_t fDetID; // Detector module ID
|
||||
Int_t fLayID; // Detector layer ID
|
||||
Int_t fTubID; // Layer tube ID
|
||||
Double_t fDistMC; // Minimum distance of particle tracks to the wire
|
||||
Double_t fDriftMC; // Minimum drift time to the wire
|
||||
Double_t fDist; // Minimum distance of particle tracks to the wire (with smearing)
|
||||
Double_t fDrift; // Minimum drift time to the wire (with smearing)
|
||||
Double_t fEnergy; // Energy released in the element
|
||||
|
||||
ClassDef(muCastorMuDetDIGI,1) //muCastorMuDetDIGI
|
||||
};
|
||||
|
||||
#endif //muCastorMuDetDIGI_H
|
||||
|
||||
|
||||
47
src/Root/muCastorPrimaryVertex.cpp
Normal file
47
src/Root/muCastorPrimaryVertex.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
#include "muCastorPrimaryVertex.h"
|
||||
|
||||
/// \cond CLASSIMP
|
||||
ClassImp(muCastorPrimaryVertex)
|
||||
/// \endcond
|
||||
|
||||
using namespace std;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
muCastorPrimaryVertex::muCastorPrimaryVertex() {
|
||||
/// Default constructor
|
||||
Reset();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
muCastorPrimaryVertex::~muCastorPrimaryVertex()
|
||||
{
|
||||
/// Destructor
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void muCastorPrimaryVertex::Reset()
|
||||
{
|
||||
fPdgCode = 0;
|
||||
fVx = std::numeric_limits<double>::quiet_NaN();
|
||||
fVy = std::numeric_limits<double>::quiet_NaN();
|
||||
fVz = std::numeric_limits<double>::quiet_NaN();
|
||||
fPx = std::numeric_limits<double>::quiet_NaN();
|
||||
fPy = std::numeric_limits<double>::quiet_NaN();
|
||||
fPz = std::numeric_limits<double>::quiet_NaN();
|
||||
fE = std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void muCastorPrimaryVertex::Print(const Option_t* /*opt*/) const
|
||||
{
|
||||
/// Printing
|
||||
|
||||
cout << " Primary particle PDG Code " << fPdgCode << endl;
|
||||
cout << " Vertex: (" << fVx << ", " << fVy << ", " << fVz << ") cm" << endl;
|
||||
cout << " Mom: (" << fPx << ", " << fPy << ", " << fPz << ") MeV/c" << endl;
|
||||
|
||||
}
|
||||
|
||||
53
src/Root/muCastorPrimaryVertex.h
Normal file
53
src/Root/muCastorPrimaryVertex.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef muCastor_PVTX_H
|
||||
#define muCastor_PVTX_H
|
||||
|
||||
/// \brief Definition of the muCastorPrimaryVertex class
|
||||
///
|
||||
/// \authors G. Bonomi (04/02/2020)
|
||||
|
||||
#include <TObject.h>
|
||||
|
||||
class muCastorPrimaryVertex : public TObject
|
||||
{
|
||||
public:
|
||||
muCastorPrimaryVertex();
|
||||
virtual ~muCastorPrimaryVertex();
|
||||
|
||||
// -------> PUBLIC FUNCTIONS
|
||||
virtual void Print(const Option_t* option = "") const;
|
||||
|
||||
// -------> SET METHODS
|
||||
|
||||
void SetPdgCode(Int_t code) { fPdgCode = code; };
|
||||
|
||||
void SetVx(Double_t Vx) { fVx = Vx; };
|
||||
void SetVy(Double_t Vy) { fVy = Vy; };
|
||||
void SetVz(Double_t Vz) { fVz = Vz; };
|
||||
|
||||
void SetPx(Double_t Px) { fPx = Px; };
|
||||
void SetPy(Double_t Py) { fPy = Py; };
|
||||
void SetPz(Double_t Pz) { fPz = Pz; };
|
||||
|
||||
void SetE(Double_t E) { fE = E; };
|
||||
|
||||
void Reset();
|
||||
private:
|
||||
// -------> PRIVATE VARIABLES
|
||||
Int_t fPdgCode; // PDG code of the particle
|
||||
|
||||
Double_t fVx; // x of production vertex
|
||||
Double_t fVy; // y of production vertex
|
||||
Double_t fVz; // z of production vertex
|
||||
|
||||
Double_t fPx; // x component of momentum
|
||||
Double_t fPy; // y component of momentum
|
||||
Double_t fPz; // z component of momentum
|
||||
Double_t fE; // Energy
|
||||
|
||||
|
||||
ClassDef(muCastorPrimaryVertex,1) //muCastorPrimaryVertex
|
||||
};
|
||||
|
||||
#endif //muCastor_PVTX_H
|
||||
|
||||
|
||||
@@ -27,6 +27,12 @@ public:
|
||||
void SetMom(TVector3 xyz) { fMomX = xyz.X(); fMomY = xyz.Y(); fMomZ = xyz.Z(); };
|
||||
void SetPos(TVector3 xyz) { fPosX = xyz.X(); fPosY = xyz.Y(); fPosZ = xyz.Z(); };
|
||||
|
||||
Int_t GetDetID() { return fDetID; }
|
||||
Int_t GetPdgCode() { return fPdgCode; }
|
||||
Int_t GetMotherID() { return fMotherID; }
|
||||
TVector3 GetMom() { return TVector3(fMomX, fMomY, fMomZ); }
|
||||
TVector3 GetPos() { return TVector3(fPosX, fPosY, fPosZ); }
|
||||
|
||||
private:
|
||||
Int_t fDetID; // Detector module ID
|
||||
Int_t fPdgCode; // Particle PDG Code
|
||||
|
||||
Reference in New Issue
Block a user