Commit cdaa779e authored by Elidiano Tronchin's avatar Elidiano Tronchin
Browse files

* Uploading Detector DALI

parent f4191f7f
;; -*- mode: emacs-lisp; coding: utf-8-unix -*-
;; Minibuffer history file, automatically generated by `savehist'.
(setq savehist-minibuffer-history-variables '(query-replace-history extended-command-history))
(setq query-replace-history '("^\\1" "\\^{\\([0-9]?\\)}" "\\^{\\([0-9]?\\)}" "_\\1" "_{\\([0-9]?\\)}" "_{\\([0-9]?\\)}" "_\\1" "_{\\([0_9]?\\)}" "_{\\([0_9]?\\)}" "_\\&" "_{\\([0_9]?\\)}" "_{\\([0_9]?\\)}" "_" "_{1}"))
(setq extended-command-history '("query-replace-regexp" "query-replace" "query-replace-regexp"))
add_custom_command(OUTPUT TDaliPhysicsDict.cxx COMMAND ../../scripts/build_dict.sh TDaliPhysics.h TDaliPhysicsDict.cxx TDaliPhysics.rootmap libNPDali.dylib DEPENDS TDaliPhysics.h)
add_custom_command(OUTPUT TDaliDataDict.cxx COMMAND ../../scripts/build_dict.sh TDaliData.h TDaliDataDict.cxx TDaliData.rootmap libNPDali.dylib DEPENDS TDaliData.h)
add_library(NPDali SHARED TDaliSpectra.cxx TDaliData.cxx TDaliPhysics.cxx TDaliDataDict.cxx TDaliPhysicsDict.cxx )
target_link_libraries(NPDali ${ROOT_LIBRARIES} NPCore)
install(FILES TDaliData.h TDaliPhysics.h TDaliSpectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
/*****************************************************************************
* Copyright (C) 2009-2018 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it *
* *
* Creation Date : septembre 2018 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold Dali Raw data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
#include "TDaliData.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
ClassImp(TDaliData)
//////////////////////////////////////////////////////////////////////
TDaliData::TDaliData() {
}
//////////////////////////////////////////////////////////////////////
TDaliData::~TDaliData() {
}
//////////////////////////////////////////////////////////////////////
void TDaliData::Clear() {
// Energy
fDali_E_DetectorNbr.clear();
fDali_Energy.clear();
// Time
fDali_T_DetectorNbr.clear();
fDali_Time.clear();
}
//////////////////////////////////////////////////////////////////////
void TDaliData::Dump() const {
// This method is very useful for debuging and worth the dev.
cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TDaliData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
// Energy
size_t mysize = fDali_E_DetectorNbr.size();
cout << "Dali_E_Mult: " << mysize << endl;
for (size_t i = 0 ; i < mysize ; i++){
cout << "DetNbr: " << fDali_E_DetectorNbr[i]
<< " Energy: " << fDali_Energy[i];
}
// Time
mysize = fDali_T_DetectorNbr.size();
cout << "Dali_T_Mult: " << mysize << endl;
for (size_t i = 0 ; i < mysize ; i++){
cout << "DetNbr: " << fDali_T_DetectorNbr[i]
<< " Time: " << fDali_Time[i];
}
}
#ifndef __DaliDATA__
#define __DaliDATA__
/*****************************************************************************
* Copyright (C) 2009-2018 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it *
* *
* Creation Date : septembre 2018 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold Dali Raw data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
// STL
#include <vector>
using namespace std;
// ROOT
#include "TObject.h"
class TDaliData : public TObject {
//////////////////////////////////////////////////////////////
// data members are hold into vectors in order
// to allow multiplicity treatment
private:
// Energy
vector<UShort_t> fDali_E_DetectorNbr;
vector<Double_t> fDali_Energy;
// Time
vector<UShort_t> fDali_T_DetectorNbr;
vector<Double_t> fDali_Time;
//////////////////////////////////////////////////////////////
// Constructor and destructor
public:
TDaliData();
~TDaliData();
//////////////////////////////////////////////////////////////
// Inherited from TObject and overriden to avoid warnings
public:
void Clear();
void Clear(const Option_t*) {};
void Dump() const;
//////////////////////////////////////////////////////////////
// Getters and Setters
// Prefer inline declaration to avoid unnecessary called of
// frequently used methods
// add //! to avoid ROOT creating dictionnary for the methods
public:
////////////////////// SETTERS ////////////////////////
// Energy
inline void SetEnergy(const UShort_t& DetNbr,const Double_t& Energy){
fDali_E_DetectorNbr.push_back(DetNbr);
fDali_Energy.push_back(Energy);
};//!
// Time
inline void SetTime(const UShort_t& DetNbr,const Double_t& Time) {
fDali_T_DetectorNbr.push_back(DetNbr);
fDali_Time.push_back(Time);
};//!
// (E&T)
inline void SetEnergyAndTime(const UShort_t& DetNbr,const Double_t& Energy,const Double_t& Time){
fDali_Energy.push_back(Energy);
fDali_Time.push_back(Time);
fDali_T_DetectorNbr.push_back(DetNbr);
};//!
//
////////////////////// GETTERS ////////////////////////
// Energy
inline UShort_t GetMultEnergy() const
{return fDali_E_DetectorNbr.size();}
inline UShort_t GetE_DetectorNbr(const unsigned int &i) const
{return fDali_E_DetectorNbr[i];}//!
inline Double_t Get_Energy(const unsigned int &i) const
{return fDali_Energy[i];}//!
// Time
inline UShort_t GetMultTime() const
{return fDali_T_DetectorNbr.size();}
inline UShort_t GetT_DetectorNbr(const unsigned int &i) const
{return fDali_T_DetectorNbr[i];}//!
inline Double_t Get_Time(const unsigned int &i) const
{return fDali_Time[i];}//!
//////////////////////////////////////////////////////////////
// Required for ROOT dictionnary
ClassDef(TDaliData,1) // DaliData structure
};
#endif
#ifndef __DaliDATA__
#define __DaliDATA__
/*****************************************************************************
* Copyright (C) 2009-2018 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it *
* *
* Creation Date : septembre 2018 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold Dali Raw data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
// STL
#include <vector>
using namespace std;
// ROOT
#include "TObject.h"
class TDaliData : public TObject {
//////////////////////////////////////////////////////////////
// data members are hold into vectors in order
// to allow multiplicity treatment
private:
// Energy
vector<UShort_t> fDali_E_DetectorNbr;
vector<Double_t> fDali_Energy;
// Time
vector<UShort_t> fDali_T_DetectorNbr;
vector<Double_t> fDali_Time;
//////////////////////////////////////////////////////////////
// Constructor and destructor
public:
TDaliData();
~TDaliData();
//////////////////////////////////////////////////////////////
// Inherited from TObject and overriden to avoid warnings
public:
void Clear();
void Clear(const Option_t*) {};
void Dump() const;
//////////////////////////////////////////////////////////////
// Getters and Setters
// Prefer inline declaration to avoid unnecessary called of
// frequently used methods
// add //! to avoid ROOT creating dictionnary for the methods
public:
////////////////////// SETTERS ////////////////////////
// Energy
inline void SetEnergy(const UShort_t& DetNbr,const Double_t& Energy){
fDali_E_DetectorNbr.push_back(DetNbr);
fDali_Energy.push_back(Energy);
};//!
// Time
inline void SetTime(const UShort_t& DetNbr,const Double_t& Time) {
fDali_T_DetectorNbr.push_back(DetNbr);
fDali_Time.push_back(Time);
};//!
////////////////////// GETTERS ////////////////////////
// Energy
inline UShort_t GetMultEnergy() const
{return fDali_E_DetectorNbr.size();}
inline UShort_t GetE_DetectorNbr(const unsigned int &i) const
{return fDali_E_DetectorNbr[i];}//!
inline Double_t Get_Energy(const unsigned int &i) const
{return fDali_Energy[i];}//!
// Time
inline UShort_t GetMultTime() const
{return fDali_T_DetectorNbr.size();}
inline UShort_t GetT_DetectorNbr(const unsigned int &i) const
{return fDali_T_DetectorNbr[i];}//!
inline Double_t Get_Time(const unsigned int &i) const
{return fDali_Time[i];}//!
//////////////////////////////////////////////////////////////
// Required for ROOT dictionnary
ClassDef(TDaliData,1) // DaliData structure
};
#endif
#ifndef __DaliDATA__
#define __DaliDATA__
/*****************************************************************************
* Copyright (C) 2009-2018 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it *
* *
* Creation Date : septembre 2018 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold Dali Raw data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
// STL
#include <vector>
using namespace std;
// ROOT
#include "TObject.h"
class TDaliData : public TObject {
//////////////////////////////////////////////////////////////
// data members are hold into vectors in order
// to allow multiplicity treatment
private:
// Energy
vector<UShort_t> fDali_E_DetectorNbr;
vector<Double_t> fDali_Energy;
// Time
vector<UShort_t> fDali_T_DetectorNbr;
vector<Double_t> fDali_Time;
//////////////////////////////////////////////////////////////
// Constructor and destructor
public:
TDaliData();
~TDaliData();
//////////////////////////////////////////////////////////////
// Inherited from TObject and overriden to avoid warnings
public:
void Clear();
void Clear(const Option_t*) {};
void Dump() const;
//////////////////////////////////////////////////////////////
// Getters and Setters
// Prefer inline declaration to avoid unnecessary called of
// frequently used methods
// add //! to avoid ROOT creating dictionnary for the methods
public:
////////////////////// SETTERS ////////////////////////
// Energy
inline void SetEnergy(const UShort_t& DetNbr,const Double_t& Energy){
fDali_E_DetectorNbr.push_back(DetNbr);
fDali_Energy.push_back(Energy);
};//!
// Time
inline void SetTime(const UShort_t& DetNbr,const Double_t& Time) {
fDali_T_DetectorNbr.push_back(DetNbr);
fDali_Time.push_back(Time);
};//!
////////////////////// GETTERS ////////////////////////
// Energy
inline UShort_t GetMultEnergy() const
{return fDali_E_DetectorNbr.size();}
inline UShort_t GetE_DetectorNbr(const unsigned int &i) const
{return fDali_E_DetectorNbr[i];}//!
inline Double_t Get_Energy(const unsigned int &i) const
{return fDali_Energy[i];}//!
// Time
inline UShort_t GetMultTime() const
{return fDali_T_DetectorNbr.size();}
inline UShort_t GetT_DetectorNbr(const unsigned int &i) const
{return fDali_T_DetectorNbr[i];}//!
inline Double_t Get_Time(const unsigned int &i) const
{return fDali_Time[i];}//!
//////////////////////////////////////////////////////////////
// Required for ROOT dictionnary
ClassDef(TDaliData,1) // DaliData structure
};
#endif
#ifndef __DaliDATA__
#define __DaliDATA__
/*****************************************************************************
* Copyright (C) 2009-2018 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it *
* *
* Creation Date : septembre 2018 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold Dali Raw data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
// STL
#include <vector>
using namespace std;
// ROOT
#include "TObject.h"
class TDaliData : public TObject {
//////////////////////////////////////////////////////////////
// data members are hold into vectors in order
// to allow multiplicity treatment
private:
// Energy
vector<UShort_t> fDali_E_DetectorNbr;
vector<Double_t> fDali_Energy;
// Time
vector<UShort_t> fDali_T_DetectorNbr;
vector<Double_t> fDali_Time;
//////////////////////////////////////////////////////////////
// Constructor and destructor
public:
TDaliData();
~TDaliData();
//////////////////////////////////////////////////////////////
// Inherited from TObject and overriden to avoid warnings
public:
void Clear();
void Clear(const Option_t*) {};
void Dump() const;
//////////////////////////////////////////////////////////////
// Getters and Setters
// Prefer inline declaration to avoid unnecessary called of
// frequently used methods
// add //! to avoid ROOT creating dictionnary for the methods
public:
////////////////////// SETTERS ////////////////////////
// Energy
inline void SetEnergy(const UShort_t& DetNbr,const Double_t& Energy){
fDali_E_DetectorNbr.push_back(DetNbr);
fDali_Energy.push_back(Energy);
};//!
// Time
inline void SetTime(const UShort_t& DetNbr,const Double_t& Time) {
fDali_T_DetectorNbr.push_back(DetNbr);
fDali_Time.push_back(Time);
};//!
// (E&T)
inline void SetEnergyAndTime(const int& N, const double& E, const double& T)
{ fPlastic_Energy.push_back(E);
fPlastic_Time.push_back(T) ;
fPlastic_Number.push_back(N); }
//
////////////////////// GETTERS ////////////////////////
// Energy
inline UShort_t GetMultEnergy() const
{return fDali_E_DetectorNbr.size();}
inline UShort_t GetE_DetectorNbr(const unsigned int &i) const
{return fDali_E_DetectorNbr[i];}//!
inline Double_t Get_Energy(const unsigned int &i) const
{return fDali_Energy[i];}//!
// Time
inline UShort_t GetMultTime() const
{return fDali_T_DetectorNbr.size();}
inline UShort_t GetT_DetectorNbr(const unsigned int &i) const
{return fDali_T_DetectorNbr[i];}//!
inline Double_t Get_Time(const unsigned int &i) const
{return fDali_Time[i];}//!
//////////////////////////////////////////////////////////////
// Required for ROOT dictionnary
ClassDef(TDaliData,1) // DaliData structure
};
#endif
/*****************************************************************************
* Copyright (C) 2009-2018 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it *
* *
* Creation Date : septembre 2018 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold Dali Treated data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
#include "TDaliPhysics.h"
// STL
#include <sstream>
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <limits>
using namespace std;
// NPL
#include "RootInput.h"
#include "RootOutput.h"
#include "NPDetectorFactory.h"
#include "NPOptionManager.h"
// ROOT
#include "TChain.h"
ClassImp(TDaliPhysics)
///////////////////////////////////////////////////////////////////////////
TDaliPhysics::TDaliPhysics()
: m_EventData(new TDaliData),
m_PreTreatedData(new TDaliData),
m_EventPhysics(this),
m_Spectra(0),
m_E_RAW_Threshold(0), // adc channels
m_E_Threshold(0), // MeV
m_NumberOfDetectors(0) {
}
///////////////////////////////////////////////////////////////////////////
/// A usefull method to bundle all operation to add a detector
void TDaliPhysics::AddDetector(TVector3 , string ){
// In That simple case nothing is done
// Typically for more complex detector one would calculate the relevant
// positions (stripped silicon) or angles (gamma array)
m_NumberOfDetectors++;
}
///////////////////////////////////////////////////////////////////////////
void TDaliPhysics::AddDetector(double R, double Theta, double Phi, string shape){
// Compute the TVector3 corresponding
TVector3 Pos(R*sin(Theta)*cos(Phi),R*sin(Theta)*sin(Phi),R*cos(Theta));
// Call the cartesian method
AddDetector(Pos,shape);
}
///////////////////////////////////////////////////////////////////////////
void TDaliPhysics::BuildSimplePhysicalEvent() {
BuildPhysicalEvent();
}
///////////////////////////////////////////////////////////////////////////
void TDaliPhysics::BuildPhysicalEvent() {
// apply thresholds and calibration
PreTreat();
// match energy and time together
unsigned int mysizeE = m_PreTreatedData->GetMultEnergy();
unsigned int mysizeT = m_PreTreatedData->GetMultTime();
for (UShort_t e = 0; e < mysizeE ; e++) {
for (UShort_t t = 0; t < mysizeT ; t++) {
if (m_PreTreatedData->GetE_DetectorNbr(e) == m_PreTreatedData->GetT_DetectorNbr(t)) {
DetectorNumber.push_back(m_PreTreatedData->GetE_DetectorNbr(e));
Energy.push_back(m_PreTreatedData->Get_Energy(e));
Time.push_back(m_PreTreatedData->Get_Time(t));
}
}
}