Skip to content
Snippets Groups Projects
Commit ff2f7b53 authored by de Séréville Nicolas's avatar de Séréville Nicolas
Browse files

+ Add support for S2 detector in NPLib

parent 3903c833
No related branches found
No related tags found
No related merge requests found
include ../Makefile.arch
#------------------------------------------------------------------------------
SHARELIB = libS2.so
all: $(SHARELIB)
#------------------------------------------------------------------------------
############### Detector ##############
## S2 detector ##
libS2.so: TS2Data.o TS2DataDict.o TS2Physics.o TS2PhysicsDict.o
$(LD) $(SOFLAGS) $^ $(OutPutOpt) $@
TS2DataDict.cxx: TS2Data.h
rootcint -f $@ -c $^
TS2PhysicsDict.cxx: TS2Physics.h
rootcint -f $@ -c $^
# dependances
TS2Data.o: TS2Data.cxx TS2Data.h
TS2Physics.o: TS2Physics.cxx TS2Physics.h
#######################################
############# Clean and More ##########
clean:
@rm -f core *~ *.o *Dict*
distclean:
make clean; rm -f *.so
.SUFFIXES: .$(SrcSuf)
###
.$(SrcSuf).$(ObjSuf):
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $<
#include <iostream>
using namespace std;
#include "TS2Data.h"
ClassImp(TS2Data)
TS2Data::TS2Data()
{
// Default constructor
Clear();
}
TS2Data::~TS2Data()
{
}
void TS2Data::Clear()
{
// DSSD
// (Th,E)
fS2_Theta_E_DetNbr.clear();
fS2_Theta_E_StripNbr.clear();
fS2_Theta_E_Energy.clear();
// (Th,T)
fS2_Theta_T_DetNbr.clear();
fS2_Theta_T_StripNbr.clear();
fS2_Theta_T_Time.clear();
// (Ph,E)
fS2_Phi_E_DetNbr.clear();
fS2_Phi_E_StripNbr.clear();
fS2_Phi_E_Energy.clear();
// (Ph,T)
fS2_Phi_T_DetNbr.clear();
fS2_Phi_T_StripNbr.clear();
fS2_Phi_T_Time.clear();
}
void TS2Data::Dump() const
{
cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl;
// DSSD
// (Th,E)
cout << "S2_MultThE = " << fS2_Theta_E_DetNbr.size() << endl;
for (UShort_t i = 0; i < fS2_Theta_E_DetNbr.size(); i++)
cout << "DetThE: " << fS2_Theta_E_DetNbr[i] << " StripThE: " << fS2_Theta_E_StripNbr[i] << " EnergyTh: " << fS2_Theta_E_Energy[i] << endl;
// (Th,T)
cout << "S2_MultThT = " << fS2_Theta_T_DetNbr.size() << endl;
for (UShort_t i = 0; i < fS2_Theta_T_DetNbr.size(); i++)
cout << "DetThT: " << fS2_Theta_T_DetNbr[i] << " StripThT: " << fS2_Theta_T_StripNbr[i] << " TimeTh: " << fS2_Theta_T_Time[i] << endl;
// (Ph,E)
cout << "S2_MultPhE = " << fS2_Phi_E_DetNbr.size() << endl;
for (UShort_t i = 0; i < fS2_Phi_E_DetNbr.size(); i++)
cout << "DetPhE: " << fS2_Phi_E_DetNbr[i] << " StripPhE: " << fS2_Phi_E_StripNbr[i] << " EnergyPh: " << fS2_Phi_E_Energy[i] << endl;
// (Ph,T)
cout << "S2_MultThT = " << fS2_Phi_T_DetNbr.size() << endl;
for (UShort_t i = 0; i < fS2_Phi_T_DetNbr.size(); i++)
cout << "DetThT: " << fS2_Phi_T_DetNbr[i] << " StripThT: " << fS2_Phi_T_StripNbr[i] << " TimeTh: " << fS2_Phi_T_Time[i] << endl;
}
#ifndef __S2DATA__
#define __S2DATA__
#include <vector>
#include "TObject.h"
using namespace std;
class TS2Data : public TObject {
private:
// DSSD
// Theta strips
// ADC
vector<UShort_t> fS2_Theta_E_DetNbr;
vector<UShort_t> fS2_Theta_E_StripNbr;
vector<Double_t> fS2_Theta_E_Energy;
// TDC
vector<UShort_t> fS2_Theta_T_DetNbr;
vector<UShort_t> fS2_Theta_T_StripNbr;
vector<Double_t> fS2_Theta_T_Time;
// Phi strips
// ADC
vector<UShort_t> fS2_Phi_E_DetNbr;
vector<UShort_t> fS2_Phi_E_StripNbr;
vector<Double_t> fS2_Phi_E_Energy;
// TDC
vector<UShort_t> fS2_Phi_T_DetNbr;
vector<UShort_t> fS2_Phi_T_StripNbr;
vector<Double_t> fS2_Phi_T_Time;
public:
TS2Data();
virtual ~TS2Data();
void Clear();
void Clear(const Option_t*) {};
void Dump() const;
///////////////////// GETTERS ////////////////////////
// (Th,E)
UShort_t GetS2ThetaEMult() {return fS2_Theta_E_DetNbr.size();}
UShort_t GetS2ThetaEDetectorNbr(Int_t i) {return fS2_Theta_E_DetNbr.at(i);}
UShort_t GetS2ThetaEStripNbr(Int_t i) {return fS2_Theta_E_StripNbr.at(i);}
Double_t GetS2ThetaEEnergy(Int_t i) {return fS2_Theta_E_Energy.at(i);}
// (Th,T)
UShort_t GetS2ThetaTMult() {return fS2_Theta_T_DetNbr.size();}
UShort_t GetS2ThetaTDetectorNbr(Int_t i) {return fS2_Theta_T_DetNbr.at(i);}
UShort_t GetS2ThetaTStripNbr(Int_t i) {return fS2_Theta_T_StripNbr.at(i);}
Double_t GetS2ThetaTTime(Int_t i) {return fS2_Theta_T_Time.at(i);}
// (Ph,E)
UShort_t GetS2PhiEMult() {return fS2_Phi_E_DetNbr.size();}
UShort_t GetS2PhiEDetectorNbr(Int_t i) {return fS2_Phi_E_DetNbr.at(i);}
UShort_t GetS2PhiEStripNbr(Int_t i) {return fS2_Phi_E_StripNbr.at(i);}
Double_t GetS2PhiEEnergy(Int_t i) {return fS2_Phi_E_Energy.at(i);}
// (Ph,T)
UShort_t GetS2PhiTMult() {return fS2_Phi_T_DetNbr.size();}
UShort_t GetS2PhiTDetectorNbr(Int_t i) {return fS2_Phi_T_DetNbr.at(i);}
UShort_t GetS2PhiTStripNbr(Int_t i) {return fS2_Phi_T_StripNbr.at(i);}
Double_t GetS2PhiTTime(Int_t i) {return fS2_Phi_T_Time.at(i);}
///////////////////// SETTERS ////////////////////////
// (Th,E)
void SetS2ThetaEDetectorNbr(UShort_t det) {fS2_Theta_E_DetNbr.push_back(det);}
void SetS2ThetaEStripNbr(UShort_t Nr) {fS2_Theta_E_StripNbr.push_back(Nr);}
void SetS2ThetaEEnergy(Double_t E) {fS2_Theta_E_Energy.push_back(E);}
// (Th,T)
void SetS2ThetaTDetectorNbr(UShort_t det) {fS2_Theta_T_DetNbr.push_back(det);}
void SetS2ThetaTStripNbr(UShort_t Nr) {fS2_Theta_T_StripNbr.push_back(Nr);}
void SetS2ThetaTTime(Double_t T) {fS2_Theta_T_Time.push_back(T);}
// (Ph,E)
void SetS2PhiEDetectorNbr(UShort_t det) {fS2_Phi_E_DetNbr.push_back(det);}
void SetS2PhiEStripNbr(UShort_t Nr) {fS2_Phi_E_StripNbr.push_back(Nr);}
void SetS2PhiEEnergy(Double_t E) {fS2_Phi_E_Energy.push_back(E);}
// (Ph,T)
void SetS2PhiTDetectorNbr(UShort_t det) {fS2_Phi_T_DetNbr.push_back(det);}
void SetS2PhiTStripNbr(UShort_t Nr) {fS2_Phi_T_StripNbr.push_back(Nr);}
void SetS2PhiTTime(Double_t T) {fS2_Phi_T_Time.push_back(T);}
ClassDef(TS2Data,1) // S2Data structure
};
#endif
This diff is collapsed.
#ifndef TS2PHYSICS_H
#define TS2PHYSICS_H
/*****************************************************************************
* Copyright (C) 2009-2010 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: Sandra GIRON contact address: giron@ipno.in2p3.fr *
* *
* Creation Date : april 2011 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold annular S2 treated data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
* *
*****************************************************************************/
// STL
#include <vector>
// NPL
#include "TS2Data.h"
#include "../include/CalibrationManager.h"
#include "../include/VDetector.h"
// ROOT
#include "TVector2.h"
#include "TVector3.h"
#include "TObject.h"
using namespace std ;
class TS2Physics : public TObject, public NPA::VDetector
{
public:
TS2Physics() ;
~TS2Physics() {};
public:
void Clear() ;
void Clear(const Option_t*) {};
public:
vector < TVector2 > Match_Theta_Phi() ;
// bool Match_Theta_Phi(int Theta, int Phi);
int CheckEvent();
bool ResolvePseudoEvent();
public:
// Provide Physical Multiplicity
Int_t EventMultiplicity ;
// Provide a Classification of Event
vector<int> EventType ;
// Annular
vector<int> AnnularNumber ;
// Strips
vector<double> Si_E ;
vector<double> Si_T ;
vector<int> Si_Theta ;
vector<int> Si_Phi ;
vector<int> AnnularNumber_Theta ; //!
vector<int> AnnularNumber_Phi ; //!
// Use for checking purpose
vector<double> Si_ETheta ;
vector<double> Si_TTheta ;
vector<double> Si_EPhi ;
vector<double> Si_TPhi ;
/*
vector<int> NTheta ; //!
vector<int> StrTheta ;
vector<double> ETheta ;
vector<double> TTheta ;
vector<int> NPhi ; //!
vector<int> StrPhi ;
vector<double> EPhi ;
vector<double> TPhi ;
*/
public: // Innherited from VDetector Class
// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token
void ReadConfiguration(string) ;
// Add Parameter to the CalibrationManger
void AddParameterToCalibrationManager() ;
// Activated associated Branches and link it to the private member DetectorData address
// In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated
void InitializeRootInput() ;
// Create associated branches and associated private member DetectorPhysics address
void InitializeRootOutput() ;
// This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter.
void BuildPhysicalEvent() ;
// Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...).
// This method aimed to be used for analysis performed during experiment, when speed is requiered.
// NB: This method can eventually be the same as BuildPhysicalEvent.
void BuildSimplePhysicalEvent() ;
// Those two method all to clear the Event Physics or Data
void ClearEventPhysics() { Clear(); }
void ClearEventData() {m_EventData->Clear();}
public: // Specific to S2 Array
// Clear The PreTeated object
void ClearPreTreatedData() {m_PreTreatedData->Clear();}
// Remove bad channel, calibrate the data and apply threshold
void PreTreat();
// Return false if the channel is disabled by user
// First argument is either "THETA","PHI"
bool IsValidChannel(string DetectorType, int telescope , int channel);
// Initialize the standard parameter for analysis
// ie: all channel enable, maximum multiplicity for strip = number of telescope (must2)
void InitializeStandardParameter();
// Read the user configuration file; if no file found, load standard one
void ReadAnalysisConfig();
// Add a Annular using Corner Coordinate information
void AddAnnular(TVector3 C_Center ,
TVector3 C_Phi2_Phi3 ,
TVector3 C_Phi6_Phi7 ,
TVector3 C_Phi10_Phi11 ,
TVector3 C_Phi14_Phi15 );
// Use for reading Calibration Run, very simple methods; only apply calibration, no condition
void ReadCalibrationRun();
bool Match_Theta_Phi_Position(int theta, int phi);
// Use to access the strip position
double GetStripPositionX( const int N, const int Phi , const int Theta ) const{ return m_StripPositionX[N-1][Phi-1][Theta-1] ; } ;
double GetStripPositionY( const int N, const int Phi , const int Theta ) const{ return m_StripPositionY[N-1][Phi-1][Theta-1] ; } ;
double GetStripPositionZ( const int N, const int Phi , const int Theta ) const{ return m_StripPositionZ[N-1][Phi-1][Theta-1] ; } ;
double GetNumberOfAnnular() const { return m_NumberOfAnnular ; } ;
// To be called after a build Physical Event
int GetEventMultiplicity() const { return EventMultiplicity; } ;
void Dump_Positions();
TVector3 GetPositionOfInteraction(const int i) const ;
TVector3 GetAnnularNormal( const int i) const ;
private: // Parameter used in the analysis
// By default take ETheta and TPhi.
bool m_Take_E_Phi;//!
bool m_Take_T_Phi;//!
// Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event
int m_MaximumStripMultiplicityAllowed ;//!
// Give the allowance in percent of the difference in energy between Theta and Phi
double m_StripEnergyMatchingSigma ; //!
double m_StripEnergyMatchingNumberOfSigma ; //!
// Raw Threshold
int m_S2_Theta_E_RAW_Threshold ;//!
int m_S2_Phi_E_RAW_Threshold ;//!
// Calibrated Threshold
double m_S2_Theta_T_Threshold; //!
double m_S2_Phi_T_Threshold; //!
double m_S2_Theta_E_Threshold ; //!
double m_S2_Phi_E_Threshold ; //!
double m_S2_Theta_E_Threshold_sup ;//!
double m_S2_Phi_E_Threshold_sup ; //!
private: // Root Input and Output tree classes
TS2Data* m_EventData ;//!
TS2Data* m_PreTreatedData ;//!
TS2Physics* m_EventPhysics ;//!
private: // Map of activated channel
map< int, vector<bool> > m_ThetaChannelStatus;//!
map< int, vector<bool> > m_PhiChannelStatus;//!
private: // Spatial Position of Strip Calculated on bases of detector position
int m_NumberOfAnnular ;//!
private:
//////////////////////////////
// Geometry and strip number //
//////////////////////////////
int m_NumberOfStripsTheta; //!
int m_NumberOfStripsPhi; //!
int m_NumberOfQuadrants; //!
vector < vector < vector < double > > > m_StripPositionX ;//!
vector < vector < vector < double > > > m_StripPositionY ;//!
vector < vector < vector < double > > > m_StripPositionZ ;//!
ClassDef(TS2Physics,1) // S2Physics structure
};
namespace S2_LOCAL
{
// tranform an integer to a string
string itoa(int value);
// DSSD
// X
double fS2_Theta_E(TS2Data* Data, const int i);
double fS2_Theta_T(TS2Data* Data, const int i);
// Y
double fS2_Phi_E(TS2Data* Data, const int i);
double fS2_Phi_T(TS2Data* Data, const int i);
}
#endif
......@@ -42,6 +42,7 @@
#include "Hyde2Tracker.h"
#include "Paris.h"
#include "TW1Physics.h"
#include "TS2Physics.h"
#include "Shield.h"
#include "TSpegPhysics.h"
#include "TExlPhysics.h"
......@@ -95,6 +96,7 @@ void DetectorManager::ReadConfigurationFile(string Path)
Bool_t ParisDet = false;
Bool_t ShieldDet = false;
Bool_t W1 = false;
Bool_t S2 = false;
Bool_t SPEG = false;
Bool_t EXL = false;
Bool_t TAC = false;
......@@ -272,6 +274,26 @@ void DetectorManager::ReadConfigurationFile(string Path)
#endif
}
////////////////////////////////////////////
////////// Search for S2 (Micron) /////////
////////////////////////////////////////////
else if (LineBuffer.compare(0, 2, "S2") == 0 && S2 == false) {
#ifdef INC_S2
S2 = true;
cout << "//////// S2 ////////" << endl;
// Instantiate the new array as a VDetector Object
VDetector* myDetector = new TS2Physics();
// Read Position of Telescope
ConfigFile.close();
myDetector->ReadConfiguration(Path);
ConfigFile.open(Path.c_str());
// Add array to the VDetector Vector
AddDetector("S2", myDetector);
#endif
}
////////////////////////////////////////////
////////// Search for W1 (Micron) /////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment