diff --git a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector index 7fb5fe39e876caff4ec7d1706c889de2a8adee2f..bb2d10ec9784e8d7c337f8f47fe4e07b3e30f893 100644 --- a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector +++ b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector @@ -27,7 +27,7 @@ Target %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GaspardTracker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%0 Central Barrel -GPDTrapezoid +%GPDTrapezoid THETA= 90 PHI= 90 R= 300 diff --git a/NPAnalysis/Gaspard/include/ObjectManager.hh b/NPAnalysis/Gaspard/include/ObjectManager.hh index 31c24da0a9e21528dfb22e17929698302d6eae19..99f611bd1a2fbecaac28dab01c18ad7218c9f0f3 100644 --- a/NPAnalysis/Gaspard/include/ObjectManager.hh +++ b/NPAnalysis/Gaspard/include/ObjectManager.hh @@ -7,8 +7,7 @@ // NPA #include "DetectorManager.h" -//#include "GaspardTracker.h" -#include "TGaspardTrackerPhysicsNew.h" +#include "GaspardTrackerNew.h" // STL C++ #include <iostream> diff --git a/NPLib/GASPARD/TGaspardTrackerDummyShape.cxx b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx similarity index 65% rename from NPLib/GASPARD/TGaspardTrackerDummyShape.cxx rename to NPLib/GASPARD/GaspardTrackerDummyShape.cxx index e1e8b8d2fc85d2916ae4dbc35f90d9f94133e38d..1fd813be79d717f67ba3bda11be2dbbfaeaf211c 100644 --- a/NPLib/GASPARD/TGaspardTrackerDummyShape.cxx +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx @@ -1,4 +1,4 @@ -#include "TGaspardTrackerDummyShape.h" +#include "GaspardTrackerDummyShape.h" // C++ headers #include <iostream> @@ -6,22 +6,30 @@ #include <string> #include <cmath> +// Gaspard +#include "TGaspardTrackerPhysicsNew.h" -TGaspardTrackerDummyShape::TGaspardTrackerDummyShape(map<int, TGaspardTrackerModule*> &Module) + +GaspardTrackerDummyShape::GaspardTrackerDummyShape(map<int, GaspardTrackerModule*> &Module, + TGaspardTrackerPhysicsNew* &EventPhysics) : m_ModuleTest(Module), + m_EventPhysics(EventPhysics), + m_EventData(0), + m_PreTreatData(new TGaspardTrackerData), m_NumberOfModule(0) { } -TGaspardTrackerDummyShape::~TGaspardTrackerDummyShape() +GaspardTrackerDummyShape::~GaspardTrackerDummyShape() { + delete m_PreTreatData; } -void TGaspardTrackerDummyShape::ReadConfiguration(string Path) +void GaspardTrackerDummyShape::ReadConfiguration(string Path) { ifstream ConfigFile; ConfigFile.open(Path.c_str()); @@ -208,21 +216,134 @@ void TGaspardTrackerDummyShape::ReadConfiguration(string Path) } +void GaspardTrackerDummyShape::PreTreat() +{ +} + + -void TGaspardTrackerDummyShape::BuildPhysicalEvent() +void GaspardTrackerDummyShape::BuildPhysicalEvent() { + // Check flags + bool Check_FirstStage = false; + bool Check_SecondStage = false; + bool Check_ThirdStage = false; + + // Thresholds +/* + double FirstStage_Front_E_Threshold = 0; double FirstStage_Front_T_Threshold = 0; + double FirstStage_Back_E_Threshold = 0; double FirstStage_Back_T_Threshold = 0; + double SecondStage_E_Threshold = 0; double SecondStage_T_Threshold = 0; + double ThirdStage_E_Threshold = 0; double ThirdStage_T_Threshold = 0; +*/ + // calculate multipicity in the first stage + int multXE = m_EventData->GetGPDTrkFirstStageFrontEMult(); + int multYE = m_EventData->GetGPDTrkFirstStageBackEMult(); + int multXT = m_EventData->GetGPDTrkFirstStageFrontTMult(); + int multYT = m_EventData->GetGPDTrkFirstStageBackTMult(); + // calculate multiplicity of 2nd and third stages + int mult2E = m_EventData->GetGPDTrkSecondStageEMult(); + int mult2T = m_EventData->GetGPDTrkSecondStageTMult(); + int mult3E = m_EventData->GetGPDTrkThirdStageEMult(); + int mult3T = m_EventData->GetGPDTrkThirdStageTMult(); + + // Deal with multiplicity 1 for the first layer + if (multXE==1 && multYE==1 && multXT==1 && multYT==1) { + // calculate detector number + int det_ref = m_EventData->GetGPDTrkFirstStageFrontEDetectorNbr(0); + int detecXE = m_EventData->GetGPDTrkFirstStageFrontEDetectorNbr(0) / det_ref; + int detecXT = m_EventData->GetGPDTrkFirstStageFrontTDetectorNbr(0) / det_ref; + int detecYE = m_EventData->GetGPDTrkFirstStageBackEDetectorNbr(0) / det_ref; + int detecYT = m_EventData->GetGPDTrkFirstStageBackTDetectorNbr(0) / det_ref; + + // module number starting from 0 + det_ref -= m_index["DummyShape"]; + + // case of same detector + if (detecXE*detecXT*detecYE*detecYT == 1) { + // store module number + m_EventPhysics->SetModuleNumber(det_ref + m_index["DummyShape"]); + // calculate strip number + int stripXE = m_EventData->GetGPDTrkFirstStageFrontEStripNbr(0); + int stripXT = m_EventData->GetGPDTrkFirstStageFrontTStripNbr(0); + int stripYE = m_EventData->GetGPDTrkFirstStageBackEStripNbr(0); + int stripYT = m_EventData->GetGPDTrkFirstStageBackTStripNbr(0); + + // case of same strips on X and Y + if (stripXE == stripXT && stripYE == stripYT) { // here we have a good strip event + // various + Check_FirstStage = true; +// EventMultiplicity = 1; + // store strip ID + m_EventPhysics->SetFirstStageFrontPosition(stripXE); + m_EventPhysics->SetFirstStageBackPosition(stripYE); + // get energy from strips and store it + double EnergyStripFront = m_EventData->GetGPDTrkFirstStageFrontEEnergy(0); +// double EnergyStripBack = m_EventData->GetGPDTrkFirstStageBackEEnergy(0); +// double EnergyStrip = 0.5 * (EnergyStripFront + EnergyStripBack); + double EnergyStrip = EnergyStripFront; +// if (EnergyStripBack > EnergyStrip) EnergyStrip = EnergyStripBack; + m_EventPhysics->SetFirstStageEnergy(EnergyStrip); + double EnergyTot = EnergyStrip; + // get time from strips and store it + double TimeStripFront = m_EventData->GetGPDTrkFirstStageFrontEEnergy(0); + double TimeStripBack = m_EventData->GetGPDTrkFirstStageBackEEnergy(0); + double TimeStrip = 0.5 * (TimeStripFront + TimeStripBack); +// double TimeStrip = TimeStripFront; +// if (TimeStripBack > TimeStrip) TimeStrip = TimeStripBack; + m_EventPhysics->SetFirstStageTime(TimeStrip); + + // check if we have a 2nd stage event + if (mult2E==1 && mult2T==1) { + Check_SecondStage = true; + double EnergySecond = m_EventData->GetGPDTrkSecondStageEEnergy(0); + m_EventPhysics->SetSecondStageEnergy(EnergySecond); + EnergyTot += EnergySecond; + } + else if (mult2E>1 || mult2T>1) { + cout << "Warning: multiplicity in second stage greater than in firststage" << endl; + } + // check if we have a third stage event + if (mult3E==1 && mult3T==1) { + Check_ThirdStage = true; + double EnergyThird = m_EventData->GetGPDTrkThirdStageEEnergy(0); + m_EventPhysics->SetThirdStageEnergy(EnergyThird); + EnergyTot += EnergyThird; + } + else if (mult3E>1 || mult3T>1) { + cout << "Warning: multiplicity in third stage greater than in firststage" << endl; + } + + // Fill total energy + m_EventPhysics->SetTotalEnergy(EnergyTot); + } + else { + cout << "Not same strips" << endl; + } + } + else { + cout << "Not same detector" << endl; + } + } + else { +/* cout << "Multiplicity is not one, it is: " << endl; + cout << "\tmultXE: " << multXE << endl; + cout << "\tmultXT: " << multXT << endl; + cout << "\tmultYE: " << multYE << endl; + cout << "\tmultYT: " << multYT << endl;*/ + } } -void TGaspardTrackerDummyShape::BuildSimplePhysicalEvent() +void GaspardTrackerDummyShape::BuildSimplePhysicalEvent() { } -void TGaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, +void GaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, TVector3 C_X128_Y1, TVector3 C_X1_Y128, TVector3 C_X128_Y128) @@ -288,7 +409,7 @@ void TGaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, -void TGaspardTrackerDummyShape::AddModule(double theta, +void GaspardTrackerDummyShape::AddModule(double theta, double phi, double distance, double beta_u, diff --git a/NPLib/GASPARD/TGaspardTrackerDummyShape.h b/NPLib/GASPARD/GaspardTrackerDummyShape.h similarity index 68% rename from NPLib/GASPARD/TGaspardTrackerDummyShape.h rename to NPLib/GASPARD/GaspardTrackerDummyShape.h index 58ccf73e9be7db3d5d0362d5717da8c9d76b0e4f..05ad2134554ad7bdfefbddb7bf66e5d30a50c82f 100644 --- a/NPLib/GASPARD/TGaspardTrackerDummyShape.h +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.h @@ -1,31 +1,32 @@ -#ifndef TGaspardTrackerDummyShape_h -#define TGaspardTrackerDummyShape_h 1 +#ifndef GaspardTrackerDummyShape_h +#define GaspardTrackerDummyShape_h 1 // C++ headers +#include <iostream> #include <string> #include <map> #include <vector> -// NPTool - ROOT headers -#include "TInteractionCoordinates.h" -#include "TGaspardTrackerData.h" +// ROOT headers #include "TVector3.h" // Gaspard headers -#include "TGaspardTrackerModule.h" +#include "TGaspardTrackerData.h" +#include "TGaspardTrackerPhysicsNew.h" +#include "GaspardTrackerModule.h" using namespace std; -class TGaspardTrackerDummyShape : public TGaspardTrackerModule +class GaspardTrackerDummyShape : public GaspardTrackerModule { public: //////////////////////////////////////////////////// /////// Default Constructor and Destructor ///////// //////////////////////////////////////////////////// - TGaspardTrackerDummyShape(map<int, TGaspardTrackerModule*> &Module); - virtual ~TGaspardTrackerDummyShape(); + GaspardTrackerDummyShape(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysicsNew* &EventPhysics); + virtual ~GaspardTrackerDummyShape(); public: //////////////////////////////////////////////////// @@ -42,7 +43,18 @@ public: void BuildSimplePhysicalEvent(); private: - map<int, TGaspardTrackerModule*> &m_ModuleTest; + map<int, GaspardTrackerModule*> &m_ModuleTest; + TGaspardTrackerPhysicsNew* &m_EventPhysics; + +public: + void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; + void PreTreat(); + +private: + // Gaspard data coming from TGaspardTrackerPhysics through the + // SetGaspardDataPointer method + TGaspardTrackerData* m_EventData; + TGaspardTrackerData* m_PreTreatData; public: //////////////////////////////// @@ -63,9 +75,9 @@ public: double beta_w); // Getters to retrieve the (X,Y,Z) coordinates of a pixel defined by strips (X,Y) - double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } - double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } - double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } + double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1-m_index["DummyShape"]][X-1][Y-1]; } + double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1-m_index["DummyShape"]][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1-m_index["DummyShape"]][X-1][Y-1]; } double GetNumberOfModule() { return m_NumberOfModule; } private: diff --git a/NPLib/GASPARD/GaspardTrackerModule.cxx b/NPLib/GASPARD/GaspardTrackerModule.cxx new file mode 100644 index 0000000000000000000000000000000000000000..441266d198c1b5a70bd47e243f15848710c78903 --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerModule.cxx @@ -0,0 +1,24 @@ +#include "GaspardTrackerModule.h" + + + +GaspardTrackerModule::GaspardTrackerModule() +{ + InitializeIndex(); +} + + + +GaspardTrackerModule::~GaspardTrackerModule() +{ +} + + + +void GaspardTrackerModule::InitializeIndex() +{ + m_index["Square"] = 0; + m_index["Trapezoid"] = 100; + m_index["Annular"] = 200; + m_index["DummyShape"] = 1000; +} diff --git a/NPLib/GASPARD/TGaspardTrackerModule.h b/NPLib/GASPARD/GaspardTrackerModule.h similarity index 52% rename from NPLib/GASPARD/TGaspardTrackerModule.h rename to NPLib/GASPARD/GaspardTrackerModule.h index 1b4c5bc40122e7876bc8b5122e4382502770ec75..30b66b27b01120629a5684714fb4cf7f261c8e67 100644 --- a/NPLib/GASPARD/TGaspardTrackerModule.h +++ b/NPLib/GASPARD/GaspardTrackerModule.h @@ -1,5 +1,5 @@ -#ifndef TGaspardTrackerModule_h -#define TGaspardTrackerModule_h 1 +#ifndef GaspardTrackerModule_h +#define GaspardTrackerModule_h 1 // C++ headers #include <string> @@ -12,11 +12,11 @@ using namespace std; -class TGaspardTrackerModule +class GaspardTrackerModule { public: - TGaspardTrackerModule(); - virtual ~TGaspardTrackerModule(); + GaspardTrackerModule(); + virtual ~GaspardTrackerModule(); public: // Read stream at Configfile to pick-up parameters of detector (Position,...) @@ -32,6 +32,15 @@ public: // Initialize the Index map for the different modules of Gaspard void InitializeIndex(); + // Pass the TGaspardTrackerData object from TGaspardTrackerPhysics to the + // classes deriving from GaspardTrackerModule + virtual void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) = 0; + + // + virtual double GetStripPositionX(Int_t DetectorNumber, Int_t stripX, Int_t stripY) = 0; + virtual double GetStripPositionY(Int_t DetectorNumber, Int_t stripX, Int_t stripY) = 0; + virtual double GetStripPositionZ(Int_t DetectorNumber, Int_t stripX, Int_t stripY) = 0; + protected: map<string, int> m_index; }; diff --git a/NPLib/GASPARD/GaspardTrackerNew.cxx b/NPLib/GASPARD/GaspardTrackerNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cb6b1dfe582d9909d477ee0716b6b243d710d17a --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerNew.cxx @@ -0,0 +1,282 @@ +/***************************************************************************** + * 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: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : 31/08/09 * + * Last update : 10/09/09 * + *---------------------------------------------------------------------------* + * Decription: This class is mainly an interface to the * + * TGaspardTrackerPhysics class and it deals with the geometrical* + * correspondance between strip number and absolute coordinates * + * (X, Y, Z) of interaction. * + *---------------------------------------------------------------------------* + * Comment: * + * + 10/09/09: Add support for Square and DummyShape shapes * + * (N. de Sereville) * + * * + * * + *****************************************************************************/ + +#include "GaspardTrackerNew.h" + +// C++ headers +#include <iostream> +#include <fstream> +#include <string> +#include <cmath> +#include <stdlib.h> + +// NPL headers +#include "RootInput.h" +#include "RootOutput.h" + +// ROOT headers +#include "TChain.h" + +// Gaspard headers +#include "GaspardTrackerDummyShape.h" +#include "GaspardTrackerTrapezoid.h" + +using namespace std ; + + + + +GaspardTrackerNew::GaspardTrackerNew() + : m_EventData (new TGaspardTrackerData()), + m_EventPhysics (new TGaspardTrackerPhysicsNew()) +{ +} + + + +GaspardTrackerNew::~GaspardTrackerNew() +{ + delete m_EventData; + delete m_EventPhysics; +} + + + +void GaspardTrackerNew::Clear() +{ +} + + + +// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +void GaspardTrackerNew::ReadConfiguration(string Path) +{ + // open configuration file + ifstream ConfigFile; + ConfigFile.open(Path.c_str()); + + bool GPDTrkSquare = false; + bool GPDTrkTrapezoid = false; + bool GPDTrkAnnular = false; + bool GPDTrkDummyShape = false; + + string LineBuffer; + while (!ConfigFile.eof()) { + getline(ConfigFile, LineBuffer); + if (LineBuffer.compare(0, 9, "GPDSquare") == 0 && GPDTrkSquare == false) { + GPDTrkSquare = true; +/* + // instantiate a new "detector" corresponding to the Square elements + GaspardTrackerModule* myDetector = new GaspardTrackerSquare(); + + // Pass the data object to the GaspardTracker*** object + myDetector->SetGaspardDataPointer(m_EventData); + + // read part of the configuration file corresponding to square elements + ConfigFile.close(); + myDetector->ReadConfiguration(Path); + ConfigFile.open(Path.c_str()); +*/ } + else if (LineBuffer.compare(0, 12, "GPDTrapezoid") == 0 && GPDTrkTrapezoid == false) { + GPDTrkTrapezoid = true; + + // instantiate a new "detector" corresponding to the Trapezoid elements + GaspardTrackerModule* myDetector = new GaspardTrackerTrapezoid(m_ModulesMap); + + // Pass the data object to the GaspardTracker*** object + myDetector->SetGaspardDataPointer(m_EventData); + + // read part of the configuration file corresponding to trapezoid elements + ConfigFile.close(); + myDetector->ReadConfiguration(Path); + ConfigFile.open(Path.c_str()); + } + else if (LineBuffer.compare(0, 10, "GPDAnnular") == 0 && GPDTrkAnnular == false) { + GPDTrkAnnular = true; +/* + // instantiate a new "detector" corresponding to the Trapezoid elements + GaspardTrackerModule* myDetector = new GaspardTrackerAnnular(); + + // Pass the data object to the GaspardTracker*** object + myDetector->SetGaspardDataPointer(m_EventData); + + // read part of the configuration file corresponding to trapezoid elements + ConfigFile.close(); + myDetector->ReadConfiguration(Path); + ConfigFile.open(Path.c_str()); +*/ } + else if (LineBuffer.compare(0, 13, "GPDDummyShape") == 0 && GPDTrkDummyShape == false) { + GPDTrkDummyShape = true; + + // instantiate a new "detector" corresponding to the Shape elements + // The GaspardTrackerSquare class should be replaced by the + // GaspardTrackerShape class you need to define + GaspardTrackerModule* myDetector = new GaspardTrackerDummyShape(m_ModulesMap, m_EventPhysics); + + // Pass the data object to the GaspardTracker*** object + myDetector->SetGaspardDataPointer(m_EventData); + + // read part of the configuration file corresponding to shape elements + ConfigFile.close(); + myDetector->ReadConfiguration(Path); + ConfigFile.open(Path.c_str()); + } + } +} + + +// Read stream at Path and pick-up calibration parameter using Token +// If argument is "Simulation" no change calibration is loaded +void GaspardTrackerNew::ReadCalibrationFile(string Path) +{ +/* // Order of Polynom function used for calibration + int Calibration_Si_E_Order; + int Calibration_Si_T_Order; + int Calibration_SiLi_E_Order; + int Calibration_CsI_E_Order; + + // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] + vector< vector< vector< double > > > Calibration_Si_X_E ; + vector< vector< vector< double > > > Calibration_Si_X_T ; + vector< vector< vector< double > > > Calibration_Si_Y_E ; + vector< vector< vector< double > > > Calibration_Si_Y_T ; + + // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] + vector< vector< vector< double > > > Calibration_SiLi_E ; + + // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] + vector< vector< vector< double > > > Calibration_CsI_E ; + + if (Path == "Simulation") { // Simulation case: data already calibrated + Calibration_Si_E_Order = 1; + Calibration_Si_T_Order = 1; + Calibration_SiLi_E_Order = 1; + Calibration_CsI_E_Order = 1; + + vector<double> Coef; + // Order 0 Order 1 + Coef.push_back(0) ; Coef.push_back(1) ; + + vector< vector<double> > StripLine ; + StripLine.resize( 128 , Coef) ; + + Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; + + Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; + Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; + } + else { + } +*/ +} + + + +// 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 GaspardTrackerNew::InitializeRootInput() +{ + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("GASPARD", true); + inputChain->SetBranchStatus("fGPD*", true); + inputChain->SetBranchAddress("GASPARD", &m_EventData); +} + + + +// Create associated branches and associated private member DetectorPhysics address +void GaspardTrackerNew::InitializeRootOutput() +{ + TTree* outputTree = RootOutput::getInstance()->GetTree(); + outputTree->Branch("GASPARD", "TGaspardTrackerPhysicsNew", &m_EventPhysics); +} + + + +// 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 GaspardTrackerNew::BuildPhysicalEvent() +{ + if (m_EventData->GetGPDTrkFirstStageFrontEMult() > 0) { + for (UInt_t i = 0; i < m_EventData->GetGPDTrkFirstStageFrontEMult(); i++) { + UShort_t detecNbr = m_EventData->GetGPDTrkFirstStageFrontEDetectorNbr(i); + m_ModulesMap[detecNbr]->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 GaspardTrackerNew::BuildSimplePhysicalEvent() +{ + BuildPhysicalEvent(); +} + + + +void GaspardTrackerNew::DumpModulesMap() +{ + cout << "GaspardTrackerNew::DumpMap()" << endl; + + map<int, GaspardTrackerModule*>::iterator it; + + for (it = m_ModulesMap.begin(); it != m_ModulesMap.end(); ++it) { + cout << "Module " << it->first << " -> Address " << it->second << endl; + } +} + + + +double GaspardTrackerNew::GetEnergyDeposit() +{ + if (m_EventPhysics->GetEventMultiplicity() > 0) { + return m_EventPhysics->GetTotalEnergy(0); + } + else + return -1000; +} + + + +TVector3 GaspardTrackerNew::GetPositionOfInteraction() +{ + TVector3 Position = TVector3(-1000,-1000,-1000); + + if (m_EventPhysics->GetEventMultiplicity() == 1) { + Int_t ModuleNbr = m_EventPhysics->GetModuleNumber(0); + Int_t FrontPos = m_EventPhysics->GetFirstStageFrontPosition(0); + Int_t BackPos = m_EventPhysics->GetFirstStageBackPosition(0); + Position = TVector3(m_ModulesMap[ModuleNbr]->GetStripPositionX(ModuleNbr, FrontPos, BackPos), + m_ModulesMap[ModuleNbr]->GetStripPositionY(ModuleNbr, FrontPos, BackPos), + m_ModulesMap[ModuleNbr]->GetStripPositionZ(ModuleNbr, FrontPos, BackPos)); + } + + return Position; +} diff --git a/NPLib/GASPARD/GaspardTrackerNew.h b/NPLib/GASPARD/GaspardTrackerNew.h new file mode 100644 index 0000000000000000000000000000000000000000..98d6fe1ccfcd5eeeb589e2f789a58ea4258238c9 --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerNew.h @@ -0,0 +1,108 @@ +/***************************************************************************** + * 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: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : 31/08/09 * + * Last update : 10/09/09 * + *---------------------------------------------------------------------------* + * Decription: This class is mainly an interface to the * + * TGaspardTrackerPhysics class and it deals with the geometrical* + * correspondance between strip number and absolute coordinates * + * (X, Y, Z) of interaction. * + *---------------------------------------------------------------------------* + * Comment: * + * + 10/09/09: Add support for Square and DummyShape shapes * + * (N. de Sereville) * + * * + * * + *****************************************************************************/ + +#ifndef GaspardTrackerNew_H + +// NPL +#include "../include/VDetector.h" +#include "TGaspardTrackerData.h" +#include "TGaspardTrackerPhysicsNew.h" +#include "GaspardTrackerModule.h" + +// C++ +#include <map> +#include <vector> + +// Root +#include "TObject.h" +#include "TVector3.h" + +class GaspardTrackerNew : public NPA::VDetector +{ +public: + GaspardTrackerNew(); + virtual ~GaspardTrackerNew(); + +public: + void Clear() ; + void Clear(const Option_t*) {}; + +public: + ///////////////////////////////////// + // Innherited from VDetector Class // + ///////////////////////////////////// + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string); + + // Read stream at CalibFile and pick-up calibration parameter using Token + // If argument is "Simulation" no change calibration is loaded + void ReadCalibrationFile(string); + + // 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. + // The aim 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() {m_EventPhysics->Clear();} + void ClearEventData() {m_EventData->Clear();} + + +public: + void DumpModulesMap(); + +private: + map<int, GaspardTrackerModule*> m_ModulesMap; + +public: + // Get Root input and output objects + TGaspardTrackerData* GetEventData() {return m_EventData;} + TGaspardTrackerPhysicsNew* GetEventPhysics() {return m_EventPhysics;} + + // To be called after a build Physical Event + double GetEnergyDeposit(); + TVector3 GetPositionOfInteraction(); + + +private: + //////////////////////////////////////// + // Root Input and Output tree classes // + //////////////////////////////////////// + TGaspardTrackerData* m_EventData; + TGaspardTrackerPhysicsNew* m_EventPhysics; +}; + +#endif diff --git a/NPLib/GASPARD/TGaspardTrackerTrapezoid.cxx b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx similarity index 95% rename from NPLib/GASPARD/TGaspardTrackerTrapezoid.cxx rename to NPLib/GASPARD/GaspardTrackerTrapezoid.cxx index c5f7c7593e6e06d1faebc704d18b2cdef3a80583..3746ca78738426e96fe3c531e975c9a42c6e126c 100644 --- a/NPLib/GASPARD/TGaspardTrackerTrapezoid.cxx +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx @@ -1,4 +1,4 @@ -#include "TGaspardTrackerTrapezoid.h" +#include "GaspardTrackerTrapezoid.h" // C++ headers #include <iostream> @@ -7,21 +7,22 @@ #include <cmath> -TGaspardTrackerTrapezoid::TGaspardTrackerTrapezoid(map<int, TGaspardTrackerModule*> &Module) +GaspardTrackerTrapezoid::GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> &Module) : m_ModuleTest(Module), + m_EventData(0), m_NumberOfModule(0) { } -TGaspardTrackerTrapezoid::~TGaspardTrackerTrapezoid() +GaspardTrackerTrapezoid::~GaspardTrackerTrapezoid() { } -void TGaspardTrackerTrapezoid::ReadConfiguration(string Path) +void GaspardTrackerTrapezoid::ReadConfiguration(string Path) { ifstream ConfigFile; ConfigFile.open(Path.c_str()); @@ -209,19 +210,19 @@ void TGaspardTrackerTrapezoid::ReadConfiguration(string Path) -void TGaspardTrackerTrapezoid::BuildPhysicalEvent() +void GaspardTrackerTrapezoid::BuildPhysicalEvent() { } -void TGaspardTrackerTrapezoid::BuildSimplePhysicalEvent() +void GaspardTrackerTrapezoid::BuildSimplePhysicalEvent() { } -void TGaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, +void GaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, TVector3 C_X128_Y1, TVector3 C_X1_Y128, TVector3 C_X128_Y128) @@ -287,7 +288,7 @@ void TGaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, -void TGaspardTrackerTrapezoid::AddModule(double theta, +void GaspardTrackerTrapezoid::AddModule(double theta, double phi, double distance, double beta_u, diff --git a/NPLib/GASPARD/TGaspardTrackerTrapezoid.h b/NPLib/GASPARD/GaspardTrackerTrapezoid.h similarity index 80% rename from NPLib/GASPARD/TGaspardTrackerTrapezoid.h rename to NPLib/GASPARD/GaspardTrackerTrapezoid.h index 4c8964ed8dcdf0212b058ffd298ededd6e4e621d..57382d447892a35e7ee629556425de01b8343b80 100644 --- a/NPLib/GASPARD/TGaspardTrackerTrapezoid.h +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.h @@ -1,5 +1,5 @@ -#ifndef TGaspardTrackerTrapezoid_h -#define TGaspardTrackerTrapezoid_h 1 +#ifndef GaspardTrackerTrapezoid_h +#define GaspardTrackerTrapezoid_h 1 // C++ headers #include <string> @@ -12,20 +12,20 @@ #include "TVector3.h" // Gaspard headers -#include "TGaspardTrackerModule.h" +#include "GaspardTrackerModule.h" using namespace std; -class TGaspardTrackerTrapezoid : public TGaspardTrackerModule +class GaspardTrackerTrapezoid : public GaspardTrackerModule { public: //////////////////////////////////////////////////// /////// Default Constructor and Destructor ///////// //////////////////////////////////////////////////// - TGaspardTrackerTrapezoid(map<int, TGaspardTrackerModule*> &Module); - virtual ~TGaspardTrackerTrapezoid(); + GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> &Module); + virtual ~GaspardTrackerTrapezoid(); public: //////////////////////////////////////////////////// @@ -42,7 +42,15 @@ public: void BuildSimplePhysicalEvent(); private: - map<int, TGaspardTrackerModule*> &m_ModuleTest; + map<int, GaspardTrackerModule*> &m_ModuleTest; + +public: + void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; + +private: + // Gaspard data coming from TGaspardTrackerPhysics through the + // SetGaspardDataPointer method + TGaspardTrackerData* m_EventData; public: //////////////////////////////// diff --git a/NPLib/GASPARD/Makefile b/NPLib/GASPARD/Makefile index 0c400bab0e47f3e9f2da20167b4b1448f50d3c91..432f67eb72f205832cae20f5dca6197577ac9512 100644 --- a/NPLib/GASPARD/Makefile +++ b/NPLib/GASPARD/Makefile @@ -287,26 +287,28 @@ libGaspardPhysics.so: GaspardTracker.o TGaspardTrackerPhysics.o TGaspardTrackerP TGaspardTrackerPhysicsDict.cxx: TGaspardTrackerPhysics.h rootcint -f $@ -c $^ -libGaspardPhysicsNew.so: TGaspardTrackerPhysicsNew.o TGaspardTrackerPhysicsNewDict.o +libGaspardPhysicsNew.so: GaspardTrackerNew.o TGaspardTrackerPhysicsNew.o \ + TGaspardTrackerPhysicsNewDict.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ TGaspardTrackerPhysicsNewDict.cxx: TGaspardTrackerPhysicsNew.h rootcint -f $@ -c $^ -libGaspardTrackerModules.so: TGaspardTrackerModule.o TGaspardTrackerDummyShape.o \ - TGaspardTrackerTrapezoid.o +libGaspardTrackerModules.so: GaspardTrackerModule.o GaspardTrackerDummyShape.o \ + GaspardTrackerTrapezoid.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ # dependances GaspardTracker.o: GaspardTracker.cxx GaspardTracker.h +GaspardTrackerNew.o: GaspardTrackerNew.cxx GaspardTrackerNew.h TGaspardTrackerData.o: TGaspardTrackerData.cxx TGaspardTrackerData.h TGaspardTrackerPhysics.o: TGaspardTrackerPhysics.cxx TGaspardTrackerPhysics.h TGaspardTrackerPhysicsNew.o: TGaspardTrackerPhysicsNew.cxx TGaspardTrackerPhysicsNew.h -TGaspardTrackerModule.o: TGaspardTrackerModule.cxx TGaspardTrackerModule.h -TGaspardTrackerDummyShape.o: TGaspardTrackerDummyShape.cxx TGaspardTrackerDummyShape.h -TGaspardTrackerTrapezoid.o: TGaspardTrackerTrapezoid.cxx TGaspardTrackerTrapezoid.h +GaspardTrackerModule.o: GaspardTrackerModule.cxx GaspardTrackerModule.h +GaspardTrackerDummyShape.o: GaspardTrackerDummyShape.cxx GaspardTrackerDummyShape.h +GaspardTrackerTrapezoid.o: GaspardTrackerTrapezoid.cxx GaspardTrackerTrapezoid.h ####################################### ############# Clean and More ########## diff --git a/NPLib/GASPARD/TGaspardTrackerModule.cxx b/NPLib/GASPARD/TGaspardTrackerModule.cxx deleted file mode 100644 index fc908d0fbd4eef2a2576542911e87ca4c0c3e331..0000000000000000000000000000000000000000 --- a/NPLib/GASPARD/TGaspardTrackerModule.cxx +++ /dev/null @@ -1,24 +0,0 @@ -#include "TGaspardTrackerModule.h" - - - -TGaspardTrackerModule::TGaspardTrackerModule() -{ - InitializeIndex(); -} - - - -TGaspardTrackerModule::~TGaspardTrackerModule() -{ -} - - - -void TGaspardTrackerModule::InitializeIndex() -{ - m_index["Square"] = 0; - m_index["Trapezoid"] = 100; - m_index["Annular"] = 200; - m_index["DummyShape"] = 1000; -} diff --git a/NPLib/GASPARD/TGaspardTrackerPhysics.h b/NPLib/GASPARD/TGaspardTrackerPhysics.h index 0e9d115c39be1c0554ca118ef509fae0f20fac44..b770f564ed1716024ba010f34ff4e697764ec119 100644 --- a/NPLib/GASPARD/TGaspardTrackerPhysics.h +++ b/NPLib/GASPARD/TGaspardTrackerPhysics.h @@ -24,9 +24,11 @@ #ifndef TGASPARDTRACKERPHYSICS_H #define TGASPARDTRACKERPHYSICS_H -#include <vector> -#include "TObject.h" #include "TGaspardTrackerData.h" + +#include "TObject.h" + +#include <vector> #include <cstdlib> using namespace std ; diff --git a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx b/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx index 34fcc15abc30adecf52c9f313f6914f43d903fa2..239a9de3b33d02592e9a4b59e7a6c603d90028ff 100644 --- a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx +++ b/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx @@ -9,259 +9,57 @@ * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * * * Creation Date : 31/08/09 * - * Last update : 10/09/09 * + * Last update : * *---------------------------------------------------------------------------* - * Decription: This class is mainly an interface to the * - * TGaspardTrackerPhysics class and it deals with the geometrical* - * correspondance between strip number and absolute coordinates * - * (X, Y, Z) of interaction. * + * Decription: This class stores the physical results after NPAnalysis is run* + * for the tracker part of the Gaspard detector. * + * This class derives from TObject (ROOT) and its aim is to be * + * stored in the output TTree of NPAnalysis. * *---------------------------------------------------------------------------* * Comment: * - * + 10/09/09: Add support for Square and DummyShape shapes * - * (N. de Sereville) * * * * * *****************************************************************************/ #include "TGaspardTrackerPhysicsNew.h" -// C++ headers -#include <iostream> -#include <fstream> -#include <string> -#include <cmath> -#include <stdlib.h> -// NPL headers -#include "RootInput.h" -#include "RootOutput.h" +ClassImp(TGaspardTrackerPhysicsNew) -// ROOT headers -#include "TChain.h" -// Gaspard headers -#include "TGaspardTrackerDummyShape.h" -#include "TGaspardTrackerTrapezoid.h" - -using namespace std ; - - - - -TGaspardTrackerPhysicsNew::TGaspardTrackerPhysicsNew() - : m_EventData (new TGaspardTrackerData()), - m_EventPhysics (this) -{ -} - - - -TGaspardTrackerPhysicsNew::~TGaspardTrackerPhysicsNew() -{ - delete m_EventData; - delete m_EventPhysics; -} - - - -void TGaspardTrackerPhysicsNew::Clear() -{ -} - - - -// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void TGaspardTrackerPhysicsNew::ReadConfiguration(string Path) +TGaspardTrackerPhysicsNew::TGaspardTrackerPhysicsNew() { - // open configuration file - ifstream ConfigFile; - ConfigFile.open(Path.c_str()); - - bool GPDTrkSquare = false; - bool GPDTrkTrapezoid = false; - bool GPDTrkAnnular = false; - bool GPDTrkDummyShape = false; - - string LineBuffer; - while (!ConfigFile.eof()) { - getline(ConfigFile, LineBuffer); - if (LineBuffer.compare(0, 9, "GPDSquare") == 0 && GPDTrkSquare == false) { - GPDTrkSquare = true; -/* - // instantiate a new "detector" corresponding to the Square elements - TGaspardTrackerModule* myDetector = new TGaspardTrackerSquare(); - - // read part of the configuration file corresponding to square elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); -*/ } - else if (LineBuffer.compare(0, 12, "GPDTrapezoid") == 0 && GPDTrkTrapezoid == false) { - GPDTrkTrapezoid = true; - - // instantiate a new "detector" corresponding to the Trapezoid elements - TGaspardTrackerModule* myDetector = new TGaspardTrackerTrapezoid(m_ModulesMap); - - // read part of the configuration file corresponding to trapezoid elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); - } - else if (LineBuffer.compare(0, 10, "GPDAnnular") == 0 && GPDTrkAnnular == false) { - GPDTrkAnnular = true; -/* - // instantiate a new "detector" corresponding to the Trapezoid elements - TGaspardTrackerModule* myDetector = new TGaspardTrackerAnnular(); - - // read part of the configuration file corresponding to trapezoid elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); -*/ } - else if (LineBuffer.compare(0, 13, "GPDDummyShape") == 0 && GPDTrkDummyShape == false) { - GPDTrkDummyShape = true; - - // instantiate a new "detector" corresponding to the Shape elements - // The GaspardTrackerSquare class should be replaced by the - // GaspardTrackerShape class you need to define - TGaspardTrackerModule* myDetector = new TGaspardTrackerDummyShape(m_ModulesMap); - - // read part of the configuration file corresponding to shape elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); - } - } - - DumpMap(); } -// Read stream at Path and pick-up calibration parameter using Token -// If argument is "Simulation" no change calibration is loaded -void TGaspardTrackerPhysicsNew::ReadCalibrationFile(string Path) -{ -/* // Order of Polynom function used for calibration - int Calibration_Si_E_Order; - int Calibration_Si_T_Order; - int Calibration_SiLi_E_Order; - int Calibration_CsI_E_Order; - - // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_Si_X_E ; - vector< vector< vector< double > > > Calibration_Si_X_T ; - vector< vector< vector< double > > > Calibration_Si_Y_E ; - vector< vector< vector< double > > > Calibration_Si_Y_T ; - - // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_SiLi_E ; - - // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_CsI_E ; - - if (Path == "Simulation") { // Simulation case: data already calibrated - Calibration_Si_E_Order = 1; - Calibration_Si_T_Order = 1; - Calibration_SiLi_E_Order = 1; - Calibration_CsI_E_Order = 1; - vector<double> Coef; - // Order 0 Order 1 - Coef.push_back(0) ; Coef.push_back(1) ; - - vector< vector<double> > StripLine ; - StripLine.resize( 128 , Coef) ; - - Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; - - Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; - Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; - } - else { - } -*/ -} - - - -// 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 TGaspardTrackerPhysicsNew::InitializeRootInput() -{ - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("GASPARD", true); - inputChain->SetBranchStatus("fGPD*", true); - inputChain->SetBranchAddress("GASPARD", &m_EventData); -} - - - -// Create associated branches and associated private member DetectorPhysics address -void TGaspardTrackerPhysicsNew::InitializeRootOutput() -{ - TTree* outputTree = RootOutput::getInstance()->GetTree(); - outputTree->Branch("GASPARD", "TGaspardTrackerPhysicsNew", &m_EventPhysics); -} - - - -// 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 TGaspardTrackerPhysicsNew::BuildPhysicalEvent() -{ -/* if (m_ModulesMap.size() > 0) { - for (UInt_t i = 0; i < m_ModulesMap.size(); i++) { - m_ModulesMap[i]->BuildPhysicalEvent(); - } - }*/ -} - - - -void TGaspardTrackerPhysicsNew::DumpMap() -{ - cout << "TGaspardTrackerPhysicsNew::DumpMap()" << endl; - - map<int, TGaspardTrackerModule*>::iterator it; - - for (it = m_ModulesMap.begin(); it != m_ModulesMap.end(); ++it) { - cout << "Module " << it->first << " -> Address " << it->second << endl; - } -} - - - -// 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 TGaspardTrackerPhysicsNew::BuildSimplePhysicalEvent() +TGaspardTrackerPhysicsNew::~TGaspardTrackerPhysicsNew() { - BuildPhysicalEvent(); -} - - - -double TGaspardTrackerPhysicsNew::GetEnergyDeposit() -{ -/* if (m_EventPhysics->TotalEnergy.size() > 0) - return m_EventPhysics->TotalEnergy[0]; - else*/ - return -1000; + Clear(); } -TVector3 TGaspardTrackerPhysicsNew::GetPositionOfInteraction() +void TGaspardTrackerPhysicsNew::Clear() { - TVector3 Position = TVector3(-1000,-1000,-1000); - -/* if (m_EventPhysics->ModuleNumber.size() == 1) { - Position = TVector3(GetStripPositionX(m_EventPhysics->ModuleNumber[0], m_EventPhysics->FirstStage_X[0], m_EventPhysics->FirstStage_Y[0]), - GetStripPositionY(m_EventPhysics->ModuleNumber[0], m_EventPhysics->FirstStage_X[0], m_EventPhysics->FirstStage_Y[0]), - GetStripPositionZ(m_EventPhysics->ModuleNumber[0], m_EventPhysics->FirstStage_X[0], m_EventPhysics->FirstStage_Y[0])); - } -*/ - return(Position); + // General members + fEventType.clear(); + fModuleNumber.clear(); + fTotalEnergy.clear(); + + // First stage + fFirstStage_Energy.clear(); + fFirstStage_Time.clear(); + fFirstStage_FrontPosition.clear(); + fFirstStage_BackPosition.clear(); + + // Second stage + fSecondStage_Energy.clear(); + fSecondStage_Time.clear(); + fSecondStage_Position.clear(); + + // Third stage + fThirdStage_Energy.clear(); + fThirdStage_Time.clear(); + fThirdStage_Position.clear(); } diff --git a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.h b/NPLib/GASPARD/TGaspardTrackerPhysicsNew.h index e3715b66aa85f83285095c6f66c043d961afcc46..4dcf45a208516c280b88e324fd38527185c909ec 100644 --- a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.h +++ b/NPLib/GASPARD/TGaspardTrackerPhysicsNew.h @@ -9,99 +9,120 @@ * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * * * Creation Date : 31/08/09 * - * Last update : 10/09/09 * + * Last update : 08/10/10 * *---------------------------------------------------------------------------* - * Decription: This class is mainly an interface to the * - * TGaspardTrackerPhysics class and it deals with the geometrical* - * correspondance between strip number and absolute coordinates * - * (X, Y, Z) of interaction. * + * Decription: This class stores the physical results after NPAnalysis is run* + * for the tracker part of the Gaspard detector. * + * This class derives from TObject (ROOT) and its aim is to be * + * stored in the output TTree of NPAnalysis. * *---------------------------------------------------------------------------* * Comment: * - * + 10/09/09: Add support for Square and DummyShape shapes * - * (N. de Sereville) * + * + 08/10/10: Change private member names and add setters and getters * + * methods. BuildPhysicalEvent() method is moved to the * + * TGaspardTracker*** classes (N. de Sereville) * * * * * *****************************************************************************/ -#ifndef TGaspardTrackerPhysicsNew_H +#ifndef TGASPARDTRACKERPHYSICSNEW_H +#define TGASPARDTRACKERPHYSICSNEW_H -// NPL -#include "../include/VDetector.h" #include "TGaspardTrackerData.h" -#include "TGaspardTrackerModule.h" + +// ROOT +#include "TObject.h" // C++ -#include <map> #include <vector> -// Root -#include "TObject.h" -#include "TVector3.h" +using namespace std ; -class TGaspardTrackerPhysicsNew : public TObject, public NPA::VDetector + +class TGaspardTrackerPhysicsNew : public TObject { public: TGaspardTrackerPhysicsNew(); - virtual ~TGaspardTrackerPhysicsNew(); - -public: - void Clear() ; - void Clear(const Option_t*) {}; - -public: - ///////////////////////////////////// - // Innherited from VDetector Class // - ///////////////////////////////////// - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(string); + ~TGaspardTrackerPhysicsNew(); - // Read stream at CalibFile and pick-up calibration parameter using Token - // If argument is "Simulation" no change calibration is loaded - void ReadCalibrationFile(string); +public: + void Clear(); + void Clear(const Option_t*) {}; - // 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(); +private: + vector<Int_t> fEventType; + vector<Int_t> fModuleNumber; - // This method is called at each event read from the Input Tree. - // The aim 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(); + // First stage + vector<Double_t> fFirstStage_Energy; + vector<Double_t> fFirstStage_Time; + vector<Int_t> fFirstStage_FrontPosition; + vector<Int_t> fFirstStage_BackPosition; - // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {m_EventPhysics->Clear();} - void ClearEventData() {m_EventData->Clear();} + // Second stage + vector<Double_t> fSecondStage_Energy; + vector<Double_t> fSecondStage_Time; + vector<Int_t> fSecondStage_Position; + // Third stage + vector<Double_t> fThirdStage_Energy; + vector<Double_t> fThirdStage_Time; + vector<Int_t> fThirdStage_Position; -public: - void DumpMap(); + vector<Double_t> fTotalEnergy; -private: - map<int, TGaspardTrackerModule*> m_ModulesMap; //! public: - // Get Root input and output objects - TGaspardTrackerData* GetEventData() {return m_EventData;} - TGaspardTrackerPhysicsNew* GetEventPhysics() {return m_EventPhysics;} - - // To be called after a build Physical Event - double GetEnergyDeposit(); - TVector3 GetPositionOfInteraction(); - + ///////////////////////////////////// + // SETTERS // + ///////////////////////////////////// + // General + void SetEventType(Int_t evtType) {fEventType.push_back(evtType);} + void SetModuleNumber(Int_t moduleNbr) {fModuleNumber.push_back(moduleNbr);} + void SetTotalEnergy(Double_t ener) {fTotalEnergy.push_back(ener);} + + // First stage + void SetFirstStageEnergy(Double_t ener) {fFirstStage_Energy.push_back(ener);} + void SetFirstStageTime(Double_t time) {fFirstStage_Time.push_back(time);} + void SetFirstStageFrontPosition(Int_t x) {fFirstStage_FrontPosition.push_back(x);} + void SetFirstStageBackPosition(Int_t y) {fFirstStage_BackPosition.push_back(y);} + + // Second stage + void SetSecondStageEnergy(Double_t ener) {fSecondStage_Energy.push_back(ener);} + void SetSecondStageTime(Double_t time) {fSecondStage_Time.push_back(time);} + void SetSecondStagePosition(Int_t pos) {fSecondStage_Position.push_back(pos);} + + // Third stage + void SetThirdStageEnergy(Double_t ener) {fThirdStage_Energy.push_back(ener);} + void SetThirdStageTime(Double_t time) {fThirdStage_Time.push_back(time);} + void SetThirdStagePosition(Int_t pos) {fThirdStage_Position.push_back(pos);} -private: - //////////////////////////////////////// - // Root Input and Output tree classes // - //////////////////////////////////////// - TGaspardTrackerData* m_EventData; //! - TGaspardTrackerPhysicsNew* m_EventPhysics; //! + ///////////////////////////////////// + // GETTERS // + ///////////////////////////////////// + // General + Int_t GetEventMultiplicity() {return fTotalEnergy.size();} + Int_t GetEventType(Int_t i) {return fEventType.at(i);} + Int_t GetModuleNumber(Int_t i) {return fModuleNumber.at(i);} + Double_t GetTotalEnergy(Int_t i) {return fTotalEnergy.at(i);} + + // First stage + Double_t GetFirstStageEnergy(Int_t i) {return fFirstStage_Energy.at(i);} + Double_t GetFirstStageTime(Int_t i) {return fFirstStage_Time.at(i);} + Int_t GetFirstStageFrontPosition(Int_t i) {return fFirstStage_FrontPosition.at(i);} + Int_t GetFirstStageBackPosition(Int_t i) {return fFirstStage_BackPosition.at(i);} + + // Second stage + Double_t GetSecondStageEnergy(Int_t i) {return fSecondStage_Energy.at(i);} + Double_t GetSecondStageTime(Int_t i) {return fSecondStage_Time.at(i);} + Int_t GetSecondStagePosition(Int_t i) {return fSecondStage_Position.at(i);} + + // Third stage + Double_t GetThirdStageEnergy(Int_t i) {return fThirdStage_Energy.at(i);} + Double_t GetThirdStageTime(Int_t i) {return fThirdStage_Time.at(i);} + Int_t GetThirdStagePosition(Int_t i) {return fThirdStage_Position.at(i);} + + ClassDef(TGaspardTrackerPhysicsNew,1) // TGaspardTrackerPyysicsNew structure }; #endif diff --git a/NPLib/Makefile b/NPLib/Makefile index 7542417d5c051c374aecbb20d9b81c8a46ea5418..823892feaa19dbd05e877b93631b86c08070d908 100644 --- a/NPLib/Makefile +++ b/NPLib/Makefile @@ -294,6 +294,7 @@ Vdetec: cp ./VDetector/*.so ./lib ifeq ($(ARCH),macosx) cd lib; ln -sf libVDetector.so libVDetector.dylib + cd lib; ln -sf libDetectorManager.so libDetectorManager.dylib endif ## MUST2 ## @@ -329,6 +330,8 @@ GaspardData: ifeq ($(ARCH),macosx) cd lib; ln -sf libGaspardData.so libGaspardData.dylib cd lib; ln -sf libGaspardPhysics.so libGaspardPhysics.dylib + cd lib; ln -sf libGaspardTrackerModules.so libGaspardTrackerModules.dylib + cd lib; ln -sf libGaspardPhysicsNew.so libGaspardPhysicsNew.dylib endif ## Plastic ## diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 2764db4ffc501ed0ab5cd73909771b8f3d770c81..08fbcb0ea7fbed6ad04a7281e32c1c3780c5c4f7 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -10,7 +10,7 @@ #include "../SSSD/TSSSDPhysics.h" #include "../Plastic/TPlasticPhysics.h" #include "../GASPARD/GaspardTracker.h" -#include "../GASPARD/TGaspardTrackerPhysicsNew.h" +#include "../GASPARD/GaspardTrackerNew.h" #include "../Paris/Paris.h" #include "../Shield/Shield.h" @@ -78,8 +78,7 @@ void DetectorManager::ReadConfigurationFile(string Path) cout << "//////// Gaspard Tracker ////////" << endl; // Instantiate the new array as a VDetector Object -// VDetector* myDetector = new GaspardTracker(); - VDetector* myDetector = new TGaspardTrackerPhysicsNew(); + VDetector* myDetector = new GaspardTrackerNew(); // Read Position of Telescope ConfigFile.close();