diff --git a/Inputs/DetectorConfiguration/gaspHyde.detector b/Inputs/DetectorConfiguration/gaspHyde.detector index bf200543d101f23e60fd1fec6b4306a2cd911973..6656f5d2ff0ebf8d2cd85b34716066e152fd7c09 100644 --- a/Inputs/DetectorConfiguration/gaspHyde.detector +++ b/Inputs/DetectorConfiguration/gaspHyde.detector @@ -19,7 +19,7 @@ GeneralTarget %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Target - THICKNESS= 0.001 + THICKNESS= 5 RADIUS= 7.5 MATERIAL= CD2 X= 0 @@ -38,7 +38,7 @@ GaspardTracker THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel -GPDTrapezoid +%GPDTrapezoid X1_Y1= -25.0 -25.00 200.00 X128_Y1= 25.0 -25.00 200.00 X1_Y128= -25.0 25.00 200.00 diff --git a/Inputs/EventGenerator/alpha.source b/Inputs/EventGenerator/alpha.source index 734a625482fe1def06458662252b6976f487be90..c8597743e64e8350bf44c2373cbfe555a5d69b1e 100644 --- a/Inputs/EventGenerator/alpha.source +++ b/Inputs/EventGenerator/alpha.source @@ -5,9 +5,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Isotropic EnergyLow= 0 - EnergyHigh= 25 - HalfOpenAngleMin= 155 - HalfOpenAngleMax= 180 + EnergyHigh= 5 + HalfOpenAngleMin= 0 + HalfOpenAngleMax= 45 x0= 0 y0= 0 z0= 0 diff --git a/NPAnalysis/Gaspard/include/ObjectManager.hh b/NPAnalysis/Gaspard/include/ObjectManager.hh index 99f611bd1a2fbecaac28dab01c18ad7218c9f0f3..f9e4038e881c11c18621009d880300e536d3c079 100644 --- a/NPAnalysis/Gaspard/include/ObjectManager.hh +++ b/NPAnalysis/Gaspard/include/ObjectManager.hh @@ -7,7 +7,7 @@ // NPA #include "DetectorManager.h" -#include "GaspardTrackerNew.h" +#include "GaspardTracker.h" // STL C++ #include <iostream> diff --git a/NPAnalysis/Gaspard/src/Analysis.cc b/NPAnalysis/Gaspard/src/Analysis.cc index b8dcba8a113417dd23a2b814532ae09340548969..dff09815c0a0aa6158bd65a7197723d4eb4f542b 100644 --- a/NPAnalysis/Gaspard/src/Analysis.cc +++ b/NPAnalysis/Gaspard/src/Analysis.cc @@ -36,7 +36,6 @@ int main(int argc,char** argv) cout << BeamEnergyNominal << endl; // Slow beam at target middle Double_t BeamEnergy = BeamEnergyNominal - BeamTarget.Slow(BeamEnergyNominal, myDetector->GetTargetThickness()/2 * micrometer, 0); -// Double_t BeamEnergy = 1293.56 * MeV; cout << BeamEnergy << endl; // Set energy beam at target middle myReaction->SetBeamEnergy(BeamEnergy); @@ -71,7 +70,6 @@ int main(int argc,char** argv) // Analysis is here! int nentries = chain->GetEntries(); -// nentries = 106; cout << "Number of entries to be analysed: " << nentries << endl; // Default initialization @@ -94,7 +92,7 @@ int main(int argc,char** argv) // Get total energy double E = GPDTrack->GetEnergyDeposit(); -// cout << i << " " << E << endl; + cout << i << " " << E << endl; // if there is a hit in the detector array, treat it. double Theta, ThetaStrip, angle, ThetaCM; @@ -113,7 +111,8 @@ int main(int argc,char** argv) DetecX = interCoord->GetDetectedPositionX(0); DetecY = interCoord->GetDetectedPositionY(0); DetecZ = interCoord->GetDetectedPositionZ(0); -// cout << DetecX << " " << DetecY << " " << DetecZ << endl; + cout << "Detected position :" << endl; + cout << "\t" << DetecX << " " << DetecY << " " << DetecZ << endl; TVector3 Detec(DetecX, DetecY, DetecZ); // Get interaction position in detector @@ -156,7 +155,7 @@ int main(int argc,char** argv) // if (Theta/deg > 35 && Theta/deg < 45 && E/MeV < 17) { // if (Theta/deg < 45) { // if (E/MeV < 38) { // for (p,t) reaction - if (Theta/deg > 90) { // for (d,p) reaction + if (Theta/deg > 30) { // for (d,p) reaction ExNoStrips = myReaction->ReconstructRelativistic(E, Theta / rad); Ex = myReaction->ReconstructRelativistic(E, ThetaStrip); } diff --git a/NPAnalysis/Gaspard/src/AnalysisNew.cc b/NPAnalysis/Gaspard/src/AnalysisNew.cc deleted file mode 100644 index 5ecc006eebc8364b4e50a571e8e1b3a4e6fd8138..0000000000000000000000000000000000000000 --- a/NPAnalysis/Gaspard/src/AnalysisNew.cc +++ /dev/null @@ -1,198 +0,0 @@ -#include "ObjectManager.hh" - -using namespace std; - - -int main(int argc,char** argv) -{ - // test if number of arguments is correct - if (argc != 4) { - cout << - "you need to specify both a Reaction file and a Detector file such as : Analysis myReaction.reaction myDetector.detector runToRead.run" - << endl; - return 0; - } - - // get arguments - string reactionfileName = argv[1]; - string detectorfileName = argv[2]; - string runToReadfileName = argv[3]; - - // Instantiate RootInput and RootOutput singleton classes - RootInput:: getInstance(runToReadfileName); - RootOutput::getInstance("Analysis/Gaspard_AnalyzedData", "AnalyzedTree"); - - // Initialize the reaction - NPL::Reaction* myReaction = new Reaction(); - myReaction->ReadConfigurationFile(reactionfileName); - - // Initialize the detector - NPA::DetectorManager* myDetector = new DetectorManager; - myDetector->ReadConfigurationFile(detectorfileName); - - // Calculate beam energy at target middle - // Get nominal beam energy - Double_t BeamEnergyNominal = myReaction->GetBeamEnergy() * MeV; - cout << BeamEnergyNominal << endl; - // Slow beam at target middle - Double_t BeamEnergy = BeamEnergyNominal - BeamTarget.Slow(BeamEnergyNominal, myDetector->GetTargetThickness()/2 * micrometer, 0); - cout << BeamEnergy << endl; - // Set energy beam at target middle - myReaction->SetBeamEnergy(BeamEnergy); - - // Print target thickness - cout << myDetector->GetTargetThickness() << endl; - - // Attach more branch to the output - double Ex = 0 ; double ExNoStrips = 0 ; double EE = 0 ; double TT = 0 ; double X = 0 ; double Y = 0 ; int det ; - RootOutput::getInstance()->GetTree()->Branch("ExcitationEnergy",&Ex,"Ex/D") ; - RootOutput::getInstance()->GetTree()->Branch("ExcitationEnergyNoStrips",&ExNoStrips,"ExNoStrips/D") ; - RootOutput::getInstance()->GetTree()->Branch("E",&EE,"EE/D") ; - RootOutput::getInstance()->GetTree()->Branch("A",&TT,"TT/D") ; - RootOutput::getInstance()->GetTree()->Branch("X",&X,"X/D") ; - RootOutput::getInstance()->GetTree()->Branch("Y",&Y,"Y/D") ; - - // Get GaspardTracker pointer - GaspardTrackerNew* GPDTrack = (GaspardTrackerNew*) myDetector->m_Detector["GASPARD"]; - - // Get the input TChain and treat it - TChain* chain = RootInput:: getInstance() -> GetChain(); - - // Connect TInitialConditions branch - TInitialConditions *initCond = 0; - chain->SetBranchAddress("InitialConditions", &initCond); - chain->SetBranchStatus("InitialConditions", 1); - - // Connect TInteractionCoordinates branch - TInteractionCoordinates *interCoord = 0; - chain->SetBranchAddress("InteractionCoordinates", &interCoord); - chain->SetBranchStatus("InteractionCoordinates", 0); - - // Analysis is here! - int nentries = chain->GetEntries(); - cout << "Number of entries to be analysed: " << nentries << endl; - - // Default initialization - double XTarget = 0; - double YTarget = 0; - double BeamTheta = 0; - double BeamPhi = 0; - - // random generator - TRandom3 *gene = new TRandom3(); - - // Loop on all events - for (int i = 0; i < nentries; i ++) { - if (i%10000 == 0 && i!=0) cout << "\r" << i << " analyzed events" << flush; - chain -> GetEntry(i); - - // Treat Gaspard event - myDetector->ClearEventPhysics(); - myDetector->BuildPhysicalEvent(); - - // Get total energy - double E = GPDTrack->GetEnergyDeposit(); - cout << i << " " << E << endl; - - // if there is a hit in the detector array, treat it. - double Theta, ThetaStrip, angle, ThetaCM; - double DetecX, DetecY, DetecZ; - double r; - TVector3 A; - if (E > -1000) { - // Get c.m. angle - ThetaCM = initCond->GetICEmittedAngleThetaCM(0) * deg; - - // Get exact scattering angle from TInteractionCoordinates object -// Theta = interCoord->GetDetectedAngleTheta(0) * deg; -// cout << interCoord << endl; -// interCoord->Dump(); -// cout << i << " mult: " << interCoord->GetDetectedMultiplicity() << endl; - DetecX = interCoord->GetDetectedPositionX(0); - DetecY = interCoord->GetDetectedPositionY(0); - DetecZ = interCoord->GetDetectedPositionZ(0); - cout << "Detected position :" << endl; - cout << "\t" << DetecX << " " << DetecY << " " << DetecZ << endl; - TVector3 Detec(DetecX, DetecY, DetecZ); - - // Get interaction position in detector - // This takes into account the strips - A = GPDTrack->GetPositionOfInteraction(); - - // Get beam interaction coordinates on target (from initial condition) - XTarget = initCond->GetICPositionX(0); - YTarget = initCond->GetICPositionY(0); -// cout << XTarget << " " << YTarget << endl; - BeamTheta = initCond->GetICIncidentAngleTheta(0)*deg; - BeamPhi = initCond->GetICIncidentAnglePhi(0)*deg; - TVector3 BeamDirection = TVector3(cos(BeamPhi)*sin(BeamTheta), sin(BeamPhi)*sin(BeamTheta), cos(BeamTheta)); -// cout << BeamDirection.X() << " " << BeamDirection.Y() << " " << BeamDirection.Z() << endl; - - // Hit direction taking into account beam position on target - TVector3 HitDirection = A - TVector3(XTarget, YTarget, 0); -// cout << "A: " << A.X() << " " << A.Y() << " " << A.Z() << endl; -// cout << "HitDirection: " << HitDirection.X() << " " << HitDirection.Y() << " " << HitDirection.Z() << endl; - - // Calculate scattering angle w.r.t. optical beam axis (do not take into account beam position on target) - ThetaStrip = ThetaCalculation(A, TVector3(0,0,1)); - Theta = ThetaCalculation(Detec, TVector3(0, 0, 1)); - // Calculate scattering angle w.r.t. beam (ideal case) -// ThetaStrip = ThetaCalculation(HitDirection, BeamDirection); -// Theta = ThetaCalculation(Detec - TVector3(XTarget, YTarget, 0), BeamDirection); - // Calculate scattering angle w.r.t. beam (finite spatial resolution) -// double resol = 800; // in micrometer -// angle = gene->Rndm() * 2*3.14; -// r = fabs(gene->Gaus(0, resol)) * micrometer; -// ThetaStrip = ThetaCalculation(A - TVector3(XTarget + r*cos(angle), YTarget + r*sin(angle), 0), BeamDirection); -// Theta = ThetaCalculation(Detec - TVector3(XTarget + r*cos(angle), YTarget + r*sin(angle), 0), BeamDirection); -// - // Correct for energy loss in the target - E = LightTarget.EvaluateInitialEnergy(E, myDetector->GetTargetThickness()/2 * micrometer, ThetaStrip); - - // Calculate excitation energy -// if (Theta/deg > 150 && Theta/deg < 180) { -// if (Theta/deg < 60 && ThetaCM/deg < 90) { -// if (Theta/deg > 35 && Theta/deg < 45 && E/MeV < 17) { -// if (Theta/deg < 45) { -// if (E/MeV < 38) { // for (p,t) reaction - if (Theta/deg > 30) { // for (d,p) reaction - ExNoStrips = myReaction->ReconstructRelativistic(E, Theta / rad); - Ex = myReaction->ReconstructRelativistic(E, ThetaStrip); - } - else { - Ex = -200; - ExNoStrips = -200; - } - } - else { - Ex = -100; - ExNoStrips = -100; - } - - EE = E ; TT = ThetaStrip/deg; - if (E>-1000) { - X = A . X(); - Y = A . Y(); - } - else { - X = -1000 ; Y = -1000; - } - - // Fill output tree - RootOutput::getInstance()->GetTree()->Fill(); - } - - // delete singleton classes - RootOutput::getInstance()->Destroy(); - RootInput::getInstance()->Destroy(); - - return 0; -} - - -double ThetaCalculation (TVector3 A , TVector3 B) -{ - double Theta = acos( (A.Dot(B)) / (A.Mag()*B.Mag()) ); - return Theta ; -} - diff --git a/NPAnalysis/Gaspard/src/GNUmakefile b/NPAnalysis/Gaspard/src/GNUmakefile index 7f69bd79db5d67a597bdf82f0f400673b23e93e8..f6161b9f82e029dc18fb7568942a73af11abc948 100644 --- a/NPAnalysis/Gaspard/src/GNUmakefile +++ b/NPAnalysis/Gaspard/src/GNUmakefile @@ -2,7 +2,6 @@ # Made to compile the ROOT Analyser for MUST2 experiment CPP=g++ -#EXEC=AnalysisNew EXEC=Analysis # local includes @@ -27,10 +26,6 @@ OBJ=$(SRC:.cc=.o) #all:$(EXEC) # @$(CPP) -o $@ -c $< $(CXXFLAGS) -AnalysisNew: AnalysisNew.o $(INC) - @$(CPP) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) - mv AnalysisNew ../AnalysisNew - Analysis: Analysis.o $(INC) @$(CPP) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) mv Analysis ../Analysis diff --git a/NPLib/GASPARD/GaspardTracker.cxx b/NPLib/GASPARD/GaspardTracker.cxx index 055ad78fff3c759c17999665354eca90edbac9d6..66a35eddd507140242ac672ef97f173fedf95279 100644 --- a/NPLib/GASPARD/GaspardTracker.cxx +++ b/NPLib/GASPARD/GaspardTracker.cxx @@ -39,14 +39,20 @@ // ROOT headers #include "TChain.h" +// Gaspard headers +#include "GaspardTrackerDummyShape.h" +#include "GaspardTrackerTrapezoid.h" +#include "GaspardTrackerAnnular.h" +#include "GaspardTrackerSquare.h" + using namespace std ; - -// Default Constructor + + + GaspardTracker::GaspardTracker() - : m_NumberOfModule(0), - m_EventData(new TGaspardTrackerData), - m_EventPhysics(new TGaspardTrackerPhysics) + : m_EventData (new TGaspardTrackerData()), + m_EventPhysics (new TGaspardTrackerPhysics()) { } @@ -54,390 +60,92 @@ GaspardTracker::GaspardTracker() GaspardTracker::~GaspardTracker() { - m_NumberOfModule = 0; delete m_EventData; delete m_EventPhysics; } +void GaspardTracker::Clear() +{ +} + + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token void GaspardTracker::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; - - // A:X1_Y1 --> X:1 Y:1 - // B:X128_Y1 --> X:128 Y:1 - // C:X1_Y128 --> X:1 Y:128 - // D:X128_Y128 --> X:128 Y:128 - - double Ax, Bx, Cx, Dx, Ay, By, Cy, Dy, Az, Bz, Cz, Dz; - TVector3 A, B, C, D; - double Theta = 0, Phi = 0, R = 0, beta_u = 0 , beta_v = 0 , beta_w = 0; - - bool check_A = false; - bool check_C = false; - bool check_B = false; - bool check_D = false; - - bool check_Theta = false; - bool check_Phi = false; - bool check_R = false; - bool check_beta = false; - - bool ReadingStatus = false; - - bool isSquare = false; - bool isDummyShape = false; - bool isTrapezoid = false; - bool isAnnular = false; + // 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(m_ModulesMap, m_EventPhysics); + + // 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, m_EventPhysics); + + // 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(m_ModulesMap, m_EventPhysics); + + // 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); - // If line is a GaspardXXX bloc, reading toggle to true - // and toggle to true flags indicating which shape is treated. - if (LineBuffer.compare(0, 9, "GPDSquare") == 0 || - LineBuffer.compare(0, 12, "GPDTrapezoid") == 0 || - LineBuffer.compare(0, 10, "GPDAnnular") == 0 || - LineBuffer.compare(0, 13, "GPDDummyShape") == 0) { - cout << "///////////////////////" << endl; - cout << "Module found:" << endl; - - if (LineBuffer.compare(0, 9, "GPDSquare") == 0) isSquare = true; - if (LineBuffer.compare(0, 13, "GPDDummyShape") == 0) isDummyShape = true; - if (LineBuffer.compare(0, 12, "GPDTrapezoid") == 0) isTrapezoid = true; - if (LineBuffer.compare(0, 10, "GPDAnnular") == 0) isAnnular = true; - ReadingStatus = true; + // read part of the configuration file corresponding to shape elements + ConfigFile.close(); + myDetector->ReadConfiguration(Path); + ConfigFile.open(Path.c_str()); } - // Else don't toggle to Reading Block Status - else ReadingStatus = false; - - // Reading Block - while (ReadingStatus) { - if (isSquare) { // square shape - ConfigFile >> DataBuffer ; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) { - ConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n' ); - } - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 9, "GPDSquare") == 0) { - cout << "WARNING: Another Module is find before standard sequence of Token, Error may occured in Telecope definition" << endl; - ReadingStatus = false; - } - - // Position method - else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { - check_A = true; - ConfigFile >> DataBuffer ; - Ax = atof(DataBuffer.c_str()) ; - Ax = Ax ; - ConfigFile >> DataBuffer ; - Ay = atof(DataBuffer.c_str()) ; - Ay = Ay ; - ConfigFile >> DataBuffer ; - Az = atof(DataBuffer.c_str()) ; - Az = Az ; - - A = TVector3(Ax, Ay, Az); - cout << "X1 Y1 corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; - } - else if (DataBuffer.compare(0, 8, "X128_Y1=") == 0) { - check_B = true; - ConfigFile >> DataBuffer ; - Bx = atof(DataBuffer.c_str()) ; - Bx = Bx ; - ConfigFile >> DataBuffer ; - By = atof(DataBuffer.c_str()) ; - By = By ; - ConfigFile >> DataBuffer ; - Bz = atof(DataBuffer.c_str()) ; - Bz = Bz ; - - B = TVector3(Bx, By, Bz); - cout << "X128 Y1 corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; - } - else if (DataBuffer.compare(0, 8, "X1_Y128=") == 0) { - check_C = true; - ConfigFile >> DataBuffer ; - Cx = atof(DataBuffer.c_str()) ; - Cx = Cx ; - ConfigFile >> DataBuffer ; - Cy = atof(DataBuffer.c_str()) ; - Cy = Cy ; - ConfigFile >> DataBuffer ; - Cz = atof(DataBuffer.c_str()) ; - Cz = Cz ; - - C = TVector3(Cx, Cy, Cz); - cout << "X1 Y128 corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; - } - else if (DataBuffer.compare(0, 10, "X128_Y128=") == 0) { - check_D = true; - ConfigFile >> DataBuffer ; - Dx = atof(DataBuffer.c_str()) ; - Dx = Dx ; - ConfigFile >> DataBuffer ; - Dy = atof(DataBuffer.c_str()) ; - Dy = Dy ; - ConfigFile >> DataBuffer ; - Dz = atof(DataBuffer.c_str()) ; - Dz = Dz ; - - D = TVector3(Dx, Dy, Dz); - cout << "X128 Y128 corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; - } // End Position Method - - // Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta ; - cout << "Theta: " << Theta << endl; - } - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi ; - cout << "Phi: " << Phi << endl; - } - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R ; - cout << "R: " << R << endl; - } - else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; - ConfigFile >> DataBuffer ; - beta_u = atof(DataBuffer.c_str()) ; - beta_u = beta_u ; - ConfigFile >> DataBuffer ; - beta_v = atof(DataBuffer.c_str()) ; - beta_v = beta_v ; - ConfigFile >> DataBuffer ; - beta_w = atof(DataBuffer.c_str()) ; - beta_w = beta_w ; - cout << "Beta: " << beta_u << " " << beta_v << " " << beta_w << endl ; - } - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) { - ReadingStatus = false; - - // Add The previously define telescope - // With position method - if ( check_A && check_B && check_C && check_D ) { - AddModuleSquare(A , - B , - C , - D ) ; - } - - // with angle method - else if ( check_Theta && check_Phi && check_R && check_beta ) { - AddModuleSquare(Theta , - Phi , - R , - beta_u , - beta_v , - beta_w ); - } - - // reset boolean flag for point positioning - check_A = false; - check_B = false; - check_C = false; - check_D = false; - - // reset boolean flag for angle positioning - check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - - // reset boolean flag for shape determination - isSquare = false; - isDummyShape = false; - isTrapezoid = false; - isAnnular = false; - } // end test for adding a module - } // end test for Square shape - - else if (isDummyShape) { // dummyshape shape - ConfigFile >> DataBuffer ; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) { - ConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n' ); - } - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 13, "GPDDummyShape") == 0) { - cout << "WARNING: Another Module is find before standard sequence of Token, Error may occured in Telecope definition" << endl; - ReadingStatus = false; - } - - // Position method - else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { - check_A = true; - ConfigFile >> DataBuffer ; - Ax = atof(DataBuffer.c_str()) ; - Ax = Ax ; - ConfigFile >> DataBuffer ; - Ay = atof(DataBuffer.c_str()) ; - Ay = Ay ; - ConfigFile >> DataBuffer ; - Az = atof(DataBuffer.c_str()) ; - Az = Az ; - - A = TVector3(Ax, Ay, Az); - cout << "X1 Y1 corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; - } - else if (DataBuffer.compare(0, 8, "X128_Y1=") == 0) { - check_B = true; - ConfigFile >> DataBuffer ; - Bx = atof(DataBuffer.c_str()) ; - Bx = Bx ; - ConfigFile >> DataBuffer ; - By = atof(DataBuffer.c_str()) ; - By = By ; - ConfigFile >> DataBuffer ; - Bz = atof(DataBuffer.c_str()) ; - Bz = Bz ; - - B = TVector3(Bx, By, Bz); - cout << "X128 Y1 corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; - } - else if (DataBuffer.compare(0, 8, "X1_Y128=") == 0) { - check_C = true; - ConfigFile >> DataBuffer ; - Cx = atof(DataBuffer.c_str()) ; - Cx = Cx ; - ConfigFile >> DataBuffer ; - Cy = atof(DataBuffer.c_str()) ; - Cy = Cy ; - ConfigFile >> DataBuffer ; - Cz = atof(DataBuffer.c_str()) ; - Cz = Cz ; - - C = TVector3(Cx, Cy, Cz); - cout << "X1 Y128 corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; - } - else if (DataBuffer.compare(0, 10, "X128_Y128=") == 0) { - check_D = true; - ConfigFile >> DataBuffer ; - Dx = atof(DataBuffer.c_str()) ; - Dx = Dx ; - ConfigFile >> DataBuffer ; - Dy = atof(DataBuffer.c_str()) ; - Dy = Dy ; - ConfigFile >> DataBuffer ; - Dz = atof(DataBuffer.c_str()) ; - Dz = Dz ; - - D = TVector3(Dx, Dy, Dz); - cout << "X128 Y128 corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; - } // End Position Method - - // Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta ; - cout << "Theta: " << Theta << endl; - } - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi ; - cout << "Phi: " << Phi << endl; - } - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R ; - cout << "R: " << R << endl; - } - else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; - ConfigFile >> DataBuffer ; - beta_u = atof(DataBuffer.c_str()) ; - beta_u = beta_u ; - ConfigFile >> DataBuffer ; - beta_v = atof(DataBuffer.c_str()) ; - beta_v = beta_v ; - ConfigFile >> DataBuffer ; - beta_w = atof(DataBuffer.c_str()) ; - beta_w = beta_w ; - cout << "Beta: " << beta_u << " " << beta_v << " " << beta_w << endl ; - } - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) { - ReadingStatus = false; - - // Add The previously define telescope - // With position method - if ( check_A && check_B && check_C && check_D ) { - AddModuleDummyShape(A , - B , - C , - D ) ; - } - - // with angle method - else if ( check_Theta && check_Phi && check_R && check_beta ) { - AddModuleDummyShape(Theta, - Phi, - R, - beta_u, - beta_v, - beta_w); - } - - // reset boolean flag for point positioning - check_A = false; - check_B = false; - check_C = false; - check_D = false; - - // reset boolean flag for angle positioning - check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - - // reset boolean flag for shape determination - isSquare = false; - isDummyShape = false; - isTrapezoid = false; - isAnnular = false; - } // end test for adding a module - } // end test for DummyShape shape - - else if (isTrapezoid) { // trapezoid shape - cout << "Trapezoid treatment not implemented yet!" << endl; - } // end test for Trapezoid shape - - else if (isAnnular) { // annular shape - cout << "Annular treatment not implemented yet!" << endl; - } // end test for Annular shape - - } // end while for reading block - } // end while for reading file - - cout << endl << "/////////////////////////////" << endl<<endl; + } } @@ -445,7 +153,9 @@ void GaspardTracker::ReadConfiguration(string Path) // If argument is "Simulation" no change calibration is loaded void GaspardTracker::ReadCalibrationFile(string Path) { - // Order of Polynom function used for calibration + Path.c_str(); // remove warning at compilation time + +/* // Order of Polynom function used for calibration int Calibration_Si_E_Order; int Calibration_Si_T_Order; int Calibration_SiLi_E_Order; @@ -486,6 +196,7 @@ void GaspardTracker::ReadCalibrationFile(string Path) } else { } +*/ } @@ -514,7 +225,12 @@ void GaspardTracker::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 GaspardTracker::BuildPhysicalEvent() { - m_EventPhysics -> BuildPhysicalEvent(m_EventData); + 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(); + } + } } @@ -524,334 +240,30 @@ void GaspardTracker::BuildPhysicalEvent() // NB: This method can eventually be the same as BuildPhysicalEvent. void GaspardTracker::BuildSimplePhysicalEvent() { - m_EventPhysics -> BuildSimplePhysicalEvent(m_EventData); + BuildPhysicalEvent(); } -void GaspardTracker::AddModuleSquare(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128) +void GaspardTracker::DumpModulesMap() { - m_NumberOfModule++; - - // remove warning using C_X128_Y128 - C_X128_Y128.Unit(); - - // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U = C_X128_Y1 - C_X1_Y1; - U = U.Unit(); - - // Vector V on Module Face (parallele to X Strip) - TVector3 V = C_X1_Y128 - C_X1_Y1; - V = V.Unit(); - - // Position Vector of Strip Center - TVector3 StripCenter = TVector3(0,0,0); - // Position Vector of X=1 Y=1 Strip - TVector3 Strip_1_1; + cout << "GaspardTracker::DumpMap()" << endl; - // Geometry Parameter - double Face = 98; // mm - double NumberOfStrip = 128; - double StripPitch = Face/NumberOfStrip; // mm + map<int, GaspardTrackerModule*>::iterator it; - // Buffer object to fill Position Array - vector<double> lineX; - vector<double> lineY; - vector<double> lineZ; - - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - - // Moving StripCenter to 1.1 corner: - Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); - - for (int i = 0; i < NumberOfStrip; i++) { - lineX.clear(); - lineY.clear(); - lineZ.clear(); - - for (int j = 0; j < NumberOfStrip; j++) { - StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ); -// StripCenter += -TargetPosition; - - lineX.push_back( StripCenter.X() ); - lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); - } - - OneModuleStripPositionX.push_back(lineX); - OneModuleStripPositionY.push_back(lineY); - OneModuleStripPositionZ.push_back(lineZ); + for (it = m_ModulesMap.begin(); it != m_ModulesMap.end(); ++it) { + cout << "Module " << it->first << " -> Address " << it->second << endl; } - - m_StripPositionX.push_back( OneModuleStripPositionX ); - m_StripPositionY.push_back( OneModuleStripPositionY ); - m_StripPositionZ.push_back( OneModuleStripPositionZ ); -} - - - -void GaspardTracker::AddModuleSquare(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - double beta_w) -{ - m_NumberOfModule++; - - // convert from degree to radian: - double Pi = 3.141592654; - theta = theta * Pi/180. ; - phi = phi * Pi/180. ; - - // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; - // Vector V on Module Face (parallele to X Strip) - TVector3 V ; - // Vector W normal to Module Face (pointing CsI) - TVector3 W ; - // Vector position of Module Face center - TVector3 C ; - - C = TVector3(distance * sin(theta) * cos(phi), - distance * sin(theta) * sin(phi), - distance * cos(theta)); - - TVector3 YperpC = TVector3( cos(theta) * cos(phi), - cos(theta) * sin(phi), - -sin(theta)); - - W = C.Unit(); - U = W.Cross(YperpC); - V = W.Cross(U); - - U = U.Unit(); - V = V.Unit(); - - U.Rotate( beta_u * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; - - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; - - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; - - double Face = 98; // mm - double NumberOfStrip = 128; - double StripPitch = Face/NumberOfStrip; // mm - - vector<double> lineX; - vector<double> lineY; - vector<double> lineZ; - - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - - double X, Y, Z; - - // Moving C to the 1.1 corner: - C.SetX( C.X() - ( Face/2 - StripPitch/2 ) * ( V.X() + U.X() ) ) ; - C.SetY( C.Y() - ( Face/2 - StripPitch/2 ) * ( V.Y() + U.Y() ) ) ; - C.SetZ( C.Z() - ( Face/2 - StripPitch/2 ) * ( V.Z() + U.Z() ) ) ; - - for (int i = 0; i < NumberOfStrip; i++) { - lineX.clear(); - lineY.clear(); - lineZ.clear(); - - for (int j = 0; j < NumberOfStrip; j++) { - X = C.X() + StripPitch * ( U.X()*i + V.X()*j ); - Y = C.Y() + StripPitch * ( U.Y()*i + V.Y()*j ); - Z = C.Z() + StripPitch * ( U.Z()*i + V.Z()*j ); - - lineX.push_back(X); - lineY.push_back(Y); - lineZ.push_back(Z); - } - - OneModuleStripPositionX.push_back(lineX); - OneModuleStripPositionY.push_back(lineY); - OneModuleStripPositionZ.push_back(lineZ); - } - - m_StripPositionX.push_back( OneModuleStripPositionX ); - m_StripPositionY.push_back( OneModuleStripPositionY ); - m_StripPositionZ.push_back( OneModuleStripPositionZ ); -} - - - -void GaspardTracker::AddModuleDummyShape(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128) -{ - m_NumberOfModule++; - - // remove warning using C_X128_Y128 - C_X128_Y128.Unit(); - - // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U = C_X128_Y1 - C_X1_Y1; - U = U.Unit(); - - // Vector V on Module Face (parallele to X Strip) - TVector3 V = C_X1_Y128 - C_X1_Y1; - V = V.Unit(); - - // Position Vector of Strip Center - TVector3 StripCenter = TVector3(0,0,0); - // Position Vector of X=1 Y=1 Strip - TVector3 Strip_1_1; - - // Geometry Parameter - double Face = 50; // mm - double NumberOfStrip = 128; - double StripPitch = Face/NumberOfStrip; // mm - - // Buffer object to fill Position Array - vector<double> lineX; - vector<double> lineY; - vector<double> lineZ; - - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - - // Moving StripCenter to 1.1 corner: - Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); - - for (int i = 0; i < NumberOfStrip; i++) { - lineX.clear(); - lineY.clear(); - lineZ.clear(); - - for (int j = 0; j < NumberOfStrip; j++) { - StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ); -// StripCenter += -TargetPosition; - - lineX.push_back( StripCenter.X() ); - lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); - } - - OneModuleStripPositionX.push_back(lineX); - OneModuleStripPositionY.push_back(lineY); - OneModuleStripPositionZ.push_back(lineZ); - } - - m_StripPositionX.push_back( OneModuleStripPositionX ); - m_StripPositionY.push_back( OneModuleStripPositionY ); - m_StripPositionZ.push_back( OneModuleStripPositionZ ); -} - - - -void GaspardTracker::AddModuleDummyShape(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - double beta_w) -{ - m_NumberOfModule++; - - // convert from degree to radian: - double Pi = 3.141592654; - theta = theta * Pi/180. ; - phi = phi * Pi/180. ; - - // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; - // Vector V on Module Face (parallele to X Strip) - TVector3 V ; - // Vector W normal to Module Face (pointing CsI) - TVector3 W ; - // Vector position of Module Face center - TVector3 C ; - - C = TVector3(distance * sin(theta) * cos(phi), - distance * sin(theta) * sin(phi), - distance * cos(theta)); - - TVector3 YperpW = TVector3( cos(theta) * cos(phi), - cos(theta) * sin(phi), - -sin(theta)); - - W = C.Unit(); - U = W.Cross(YperpW); - V = W.Cross(U); - - U = U.Unit(); - V = V.Unit(); - - U.Rotate( beta_u * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; - - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; - - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; - - double Face = 50; // mm - double NumberOfStrip = 100; - double StripPitch = Face/NumberOfStrip; // mm - - vector<double> lineX; - vector<double> lineY; - vector<double> lineZ; - - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - - double X, Y, Z; - - // Moving C to the 1.1 corner: - C.SetX( C.X() - ( Face/2 - StripPitch/2 ) * ( V.X() + U.X() ) ) ; - C.SetY( C.Y() - ( Face/2 - StripPitch/2 ) * ( V.Y() + U.Y() ) ) ; - C.SetZ( C.Z() - ( Face/2 - StripPitch/2 ) * ( V.Z() + U.Z() ) ) ; - - for (int i = 0; i < NumberOfStrip; i++) { - lineX.clear(); - lineY.clear(); - lineZ.clear(); - - for (int j = 0; j < NumberOfStrip; j++) { - X = C.X() + StripPitch * ( U.X()*i + V.X()*j ); - Y = C.Y() + StripPitch * ( U.Y()*i + V.Y()*j ); - Z = C.Z() + StripPitch * ( U.Z()*i + V.Z()*j ); - - lineX.push_back(X); - lineY.push_back(Y); - lineZ.push_back(Z); - } - - OneModuleStripPositionX.push_back(lineX); - OneModuleStripPositionY.push_back(lineY); - OneModuleStripPositionZ.push_back(lineZ); - } - - m_StripPositionX.push_back( OneModuleStripPositionX ); - m_StripPositionY.push_back( OneModuleStripPositionY ); - m_StripPositionZ.push_back( OneModuleStripPositionZ ); } double GaspardTracker::GetEnergyDeposit() { - if (m_EventPhysics->TotalEnergy.size() > 0) - return m_EventPhysics->TotalEnergy[0]; - else + if (m_EventPhysics->GetEventMultiplicity() > 0) { + return m_EventPhysics->GetTotalEnergy(0); + } + else return -1000; } @@ -861,32 +273,14 @@ TVector3 GaspardTracker::GetPositionOfInteraction() { 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])); + 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); -} - - - -void GaspardTracker::Print() -{ - cout << "Number of Modules: " << m_NumberOfModule << endl; - - for (int f = 0; f < m_NumberOfModule; f++) { - cout << "Module " << f+1 << endl; - - for (int i = 0; i < 128; i++) { - for (int j = 0; j < 128; j++) { - cout << i+1 << " "<< j+1 << " " - << m_StripPositionX[f][i][j] << " " - << m_StripPositionY[f][i][j] << " " - << m_StripPositionZ[f][i][j] << " " - << endl ; - } - } - } + return Position; } diff --git a/NPLib/GASPARD/GaspardTracker.h b/NPLib/GASPARD/GaspardTracker.h index 346728d1b9858cac48786d5b56d03760680ad5a4..49b1a3332d500f2ef2489cb82c5d55d2592cac01 100644 --- a/NPLib/GASPARD/GaspardTracker.h +++ b/NPLib/GASPARD/GaspardTracker.h @@ -24,13 +24,20 @@ *****************************************************************************/ #ifndef GaspardTracker_H +#define GaspardTracker_H // NPL #include "../include/VDetector.h" #include "TGaspardTrackerData.h" #include "TGaspardTrackerPhysics.h" +#include "GaspardTrackerModule.h" + +// C++ +#include <map> +#include <vector> // Root +#include "TObject.h" #include "TVector3.h" class GaspardTracker : public NPA::VDetector @@ -39,6 +46,10 @@ public: GaspardTracker(); virtual ~GaspardTracker(); +public: + void Clear() ; + void Clear(const Option_t*) {}; + public: ///////////////////////////////////// // Innherited from VDetector Class // @@ -72,45 +83,12 @@ public: public: - //////////////////////////////// - // Specific to GaspardTracker // - //////////////////////////////// - // Case of a Square module - // Add a Module using Corner Coordinate information - void AddModuleSquare(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128); - - // Add a Module using R Theta Phi of Si center information - void AddModuleSquare(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - double beta_w); - - // Case of a DummyShape module - // Add a Module using Corner Coordinate information - void AddModuleDummyShape(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128); - - // Add a Module using R Theta Phi of Si center information - void AddModuleDummyShape(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - 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 GetNumberOfModule() { return m_NumberOfModule; } + void DumpModulesMap(); + +private: + map<int, GaspardTrackerModule*> m_ModulesMap; +public: // Get Root input and output objects TGaspardTrackerData* GetEventData() {return m_EventData;} TGaspardTrackerPhysics* GetEventPhysics() {return m_EventPhysics;} @@ -119,8 +97,6 @@ public: double GetEnergyDeposit(); TVector3 GetPositionOfInteraction(); - void Print(); - private: //////////////////////////////////////// @@ -128,14 +104,6 @@ private: //////////////////////////////////////// TGaspardTrackerData* m_EventData; TGaspardTrackerPhysics* m_EventPhysics; - - -private: - // Spatial Position of Strip Calculated on basis of detector position - int m_NumberOfModule; - vector< vector < vector < double > > > m_StripPositionX; - vector< vector < vector < double > > > m_StripPositionY; - vector< vector < vector < double > > > m_StripPositionZ; }; #endif diff --git a/NPLib/GASPARD/GaspardTrackerAnnular.cxx b/NPLib/GASPARD/GaspardTrackerAnnular.cxx index e5a665fd94af017964922858a67c78788f9f80b6..2eee7aad06b82a5f9e1078f1a9f124c67166db91 100644 --- a/NPLib/GASPARD/GaspardTrackerAnnular.cxx +++ b/NPLib/GASPARD/GaspardTrackerAnnular.cxx @@ -7,13 +7,13 @@ #include <cmath> // Gaspard -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" using namespace std; GaspardTrackerAnnular::GaspardTrackerAnnular(map<int, GaspardTrackerModule*> &Module, - TGaspardTrackerPhysicsNew* &EventPhysics) + TGaspardTrackerPhysics* &EventPhysics) : m_ModuleTest(Module), m_EventPhysics(EventPhysics), m_EventData(0), @@ -153,13 +153,10 @@ void GaspardTrackerAnnular::BuildPhysicalEvent() 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["Annular"]; - // case of same detector if (detecXE*detecXT*detecYE*detecYT == 1) { // store module number - m_EventPhysics->SetModuleNumber(det_ref + m_index["Annular"]); + m_EventPhysics->SetModuleNumber(det_ref); // calculate strip number int stripXE = m_EventData->GetGPDTrkFirstStageFrontEStripNbr(0); int stripXT = m_EventData->GetGPDTrkFirstStageFrontTStripNbr(0); diff --git a/NPLib/GASPARD/GaspardTrackerAnnular.h b/NPLib/GASPARD/GaspardTrackerAnnular.h index 05e0d7e48913d0016f980ec40df46aeb3c91dc3c..33b9522d25f592a966c85e1ba052d0770241564f 100644 --- a/NPLib/GASPARD/GaspardTrackerAnnular.h +++ b/NPLib/GASPARD/GaspardTrackerAnnular.h @@ -9,7 +9,7 @@ // Gaspard headers #include "TGaspardTrackerData.h" -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" #include "GaspardTrackerModule.h" using namespace std; @@ -22,7 +22,7 @@ public: //////////////////////////////////////////////////// /////// Default Constructor and Destructor ///////// //////////////////////////////////////////////////// - GaspardTrackerAnnular(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysicsNew* &EventPhysics); + GaspardTrackerAnnular(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics); virtual ~GaspardTrackerAnnular(); public: @@ -40,8 +40,8 @@ public: void BuildSimplePhysicalEvent(); private: - map<int, GaspardTrackerModule*> &m_ModuleTest; - TGaspardTrackerPhysicsNew* &m_EventPhysics; + map<int, GaspardTrackerModule*> &m_ModuleTest; + TGaspardTrackerPhysics* &m_EventPhysics; public: void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; diff --git a/NPLib/GASPARD/GaspardTrackerDummyShape.cxx b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx index a79427a6dd29a2d13cb003a3e714d78bc6c6c460..7b1e104f359838256e75d88d23bdff32fe7ab85f 100644 --- a/NPLib/GASPARD/GaspardTrackerDummyShape.cxx +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx @@ -7,11 +7,11 @@ #include <cmath> // Gaspard -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" GaspardTrackerDummyShape::GaspardTrackerDummyShape(map<int, GaspardTrackerModule*> &Module, - TGaspardTrackerPhysicsNew* &EventPhysics) + TGaspardTrackerPhysics* &EventPhysics) : m_ModuleTest(Module), m_EventPhysics(EventPhysics), m_EventData(0), @@ -260,13 +260,10 @@ void GaspardTrackerDummyShape::BuildPhysicalEvent() 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"]); + m_EventPhysics->SetModuleNumber(det_ref); // calculate strip number int stripXE = m_EventData->GetGPDTrkFirstStageFrontEStripNbr(0); int stripXT = m_EventData->GetGPDTrkFirstStageFrontTStripNbr(0); diff --git a/NPLib/GASPARD/GaspardTrackerDummyShape.h b/NPLib/GASPARD/GaspardTrackerDummyShape.h index 7bce3135d7ebfefc43963b3fabd27c3ee7323682..9c32fb403deb97189b7d4f1ff457ff707368322a 100644 --- a/NPLib/GASPARD/GaspardTrackerDummyShape.h +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.h @@ -11,7 +11,7 @@ // Gaspard headers #include "TGaspardTrackerData.h" -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" #include "GaspardTrackerModule.h" using namespace std; @@ -24,7 +24,7 @@ public: //////////////////////////////////////////////////// /////// Default Constructor and Destructor ///////// //////////////////////////////////////////////////// - GaspardTrackerDummyShape(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysicsNew* &EventPhysics); + GaspardTrackerDummyShape(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics); virtual ~GaspardTrackerDummyShape(); public: @@ -43,7 +43,7 @@ public: private: map<int, GaspardTrackerModule*> &m_ModuleTest; - TGaspardTrackerPhysicsNew* &m_EventPhysics; + TGaspardTrackerPhysics* &m_EventPhysics; public: void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; diff --git a/NPLib/GASPARD/GaspardTrackerNew.cxx b/NPLib/GASPARD/GaspardTrackerNew.cxx deleted file mode 100644 index d234361dd69db30a931bb679485ee81f194c2bf6..0000000000000000000000000000000000000000 --- a/NPLib/GASPARD/GaspardTrackerNew.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/***************************************************************************** - * 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" -#include "GaspardTrackerAnnular.h" -#include "GaspardTrackerSquare.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(m_ModulesMap, m_EventPhysics); - - // 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, m_EventPhysics); - - // 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(m_ModulesMap, m_EventPhysics); - - // 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 deleted file mode 100644 index 98d6fe1ccfcd5eeeb589e2f789a58ea4258238c9..0000000000000000000000000000000000000000 --- a/NPLib/GASPARD/GaspardTrackerNew.h +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************** - * 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/GaspardTrackerSquare.cxx b/NPLib/GASPARD/GaspardTrackerSquare.cxx index 5def545406f484ef718ffb86ef37802a8ae84075..73bcd1acd3b688cba7da2f7d3d9e887ba8e8c0f4 100644 --- a/NPLib/GASPARD/GaspardTrackerSquare.cxx +++ b/NPLib/GASPARD/GaspardTrackerSquare.cxx @@ -7,11 +7,11 @@ #include <cmath> // Gaspard -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" GaspardTrackerSquare::GaspardTrackerSquare(map<int, GaspardTrackerModule*> &Module, - TGaspardTrackerPhysicsNew* &EventPhysics) + TGaspardTrackerPhysics* &EventPhysics) : m_ModuleTest(Module), m_EventPhysics(EventPhysics), m_EventData(0), @@ -260,13 +260,10 @@ void GaspardTrackerSquare::BuildPhysicalEvent() 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["Square"]; - // case of same detector if (detecXE*detecXT*detecYE*detecYT == 1) { // store module number - m_EventPhysics->SetModuleNumber(det_ref + m_index["Square"]); + m_EventPhysics->SetModuleNumber(det_ref); // calculate strip number int stripXE = m_EventData->GetGPDTrkFirstStageFrontEStripNbr(0); int stripXT = m_EventData->GetGPDTrkFirstStageFrontTStripNbr(0); diff --git a/NPLib/GASPARD/GaspardTrackerSquare.h b/NPLib/GASPARD/GaspardTrackerSquare.h index 8d2a6439c0f11c9736b28d71ea65984735f9165d..e77d17dc7cccaaeb4e61e51c5c05372d12f09bdf 100644 --- a/NPLib/GASPARD/GaspardTrackerSquare.h +++ b/NPLib/GASPARD/GaspardTrackerSquare.h @@ -11,7 +11,7 @@ // Gaspard headers #include "TGaspardTrackerData.h" -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" #include "GaspardTrackerModule.h" using namespace std; @@ -24,7 +24,7 @@ public: //////////////////////////////////////////////////// /////// Default Constructor and Destructor ///////// //////////////////////////////////////////////////// - GaspardTrackerSquare(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysicsNew* &EventPhysics); + GaspardTrackerSquare(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics); virtual ~GaspardTrackerSquare(); public: @@ -42,8 +42,8 @@ public: void BuildSimplePhysicalEvent(); private: - map<int, GaspardTrackerModule*> &m_ModuleTest; - TGaspardTrackerPhysicsNew* &m_EventPhysics; + map<int, GaspardTrackerModule*> &m_ModuleTest; + TGaspardTrackerPhysics* &m_EventPhysics; public: void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; diff --git a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx index 0b02f740bbe270f604106e9b36d4f20e83f85a75..0d7be723e3a8ed751c6be08579b43c86529bcc37 100644 --- a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx @@ -7,17 +7,23 @@ #include <cmath> // Gaspard -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" GaspardTrackerTrapezoid::GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> &Module, - TGaspardTrackerPhysicsNew* &EventPhysics) + TGaspardTrackerPhysics* &EventPhysics) : m_ModuleTest(Module), m_EventPhysics(EventPhysics), m_EventData(0), m_PreTreatData(new TGaspardTrackerData), - m_NumberOfModule(0) + m_NumberOfModule(0), + m_FirstStageBaseLarge(97.5), // mm + m_FirstStageHeight(113.5), // mm + m_NumberOfStripsX(128), + m_NumberOfStripsY(128) { + m_StripPitchX = m_FirstStageBaseLarge / (double)m_NumberOfStripsX; + m_StripPitchY = m_FirstStageHeight / (double)m_NumberOfStripsY; } @@ -257,13 +263,10 @@ void GaspardTrackerTrapezoid::BuildPhysicalEvent() 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"]); + m_EventPhysics->SetModuleNumber(det_ref); // calculate strip number int stripXE = m_EventData->GetGPDTrkFirstStageFrontEStripNbr(0); int stripXT = m_EventData->GetGPDTrkFirstStageFrontTStripNbr(0); @@ -354,15 +357,14 @@ void GaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, { m_NumberOfModule++; - // remove warning using C_X128_Y128 - C_X128_Y128.Unit(); - - // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) + // Definition of vectors U and V are *identical* with definition + // in NPS. + // Vector U parallel to BaseLarge TVector3 U = C_X128_Y1 - C_X1_Y1; U = U.Unit(); - // Vector V on Module Face (parallele to X Strip) - TVector3 V = C_X1_Y128 - C_X1_Y1; + // Vector V parallel to height + TVector3 V = 0.5 * (C_X1_Y128 + C_X128_Y128 - C_X1_Y1 - C_X128_Y1); V = V.Unit(); // Position Vector of Strip Center @@ -370,11 +372,6 @@ void GaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, // Position Vector of X=1 Y=1 Strip TVector3 Strip_1_1; - // Geometry Parameter - double Face = 50; // mm - double NumberOfStrip = 128; - double StripPitch = Face/NumberOfStrip; // mm - // Buffer object to fill Position Array vector<double> lineX; vector<double> lineY; @@ -385,16 +382,15 @@ void GaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: - Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); + Strip_1_1 = C_X1_Y1 + m_StripPitchX/2*U + m_StripPitchY/2*V; - for (int i = 0; i < NumberOfStrip; i++) { + for (int i = 0; i < m_NumberOfStripsX; i++) { lineX.clear(); lineY.clear(); lineZ.clear(); - for (int j = 0; j < NumberOfStrip; j++) { - StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ); -// StripCenter += -TargetPosition; + for (int j = 0; j < m_NumberOfStripsY; j++) { + StripCenter = Strip_1_1 + i*m_StripPitchX*U + j*m_StripPitchY*V; lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); diff --git a/NPLib/GASPARD/GaspardTrackerTrapezoid.h b/NPLib/GASPARD/GaspardTrackerTrapezoid.h index 23dabc56b10bc7f6ac04fdfceac4b17cdda3ca85..567c0c5343816fd3d6fee24334d0fbd37d8cfed8 100644 --- a/NPLib/GASPARD/GaspardTrackerTrapezoid.h +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.h @@ -11,7 +11,7 @@ // Gaspard headers #include "TGaspardTrackerData.h" -#include "TGaspardTrackerPhysicsNew.h" +#include "TGaspardTrackerPhysics.h" #include "GaspardTrackerModule.h" using namespace std; @@ -24,7 +24,7 @@ public: //////////////////////////////////////////////////// /////// Default Constructor and Destructor ///////// //////////////////////////////////////////////////// - GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysicsNew* &EventPhysics); + GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics); virtual ~GaspardTrackerTrapezoid(); public: @@ -42,8 +42,8 @@ public: void BuildSimplePhysicalEvent(); private: - map<int, GaspardTrackerModule*> &m_ModuleTest; - TGaspardTrackerPhysicsNew* &m_EventPhysics; + map<int, GaspardTrackerModule*> &m_ModuleTest; + TGaspardTrackerPhysics* &m_EventPhysics; public: void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; @@ -85,6 +85,17 @@ private: vector< vector < vector < double > > > m_StripPositionX; vector< vector < vector < double > > > m_StripPositionY; vector< vector < vector < double > > > m_StripPositionZ; + +private: + ////////////////////////////// + // Geometry and stip number // + ////////////////////////////// + double m_FirstStageBaseLarge; // mm + double m_FirstStageHeight; // mm + int m_NumberOfStripsX; + int m_NumberOfStripsY; + double m_StripPitchX; // mm + double m_StripPitchY; // mm }; #endif diff --git a/NPLib/GASPARD/Makefile b/NPLib/GASPARD/Makefile index 7a0170c5730c28c101cb2aaf5ef1e22ea19a996e..8fea1b0d1a283014996c119feadf57bfa0464dbc 100644 --- a/NPLib/GASPARD/Makefile +++ b/NPLib/GASPARD/Makefile @@ -268,8 +268,8 @@ GLIBS = $(ROOTGLIBS) $(SYSLIBS) INCLUDE = -I$(CLHEP_BASE_DIR)/include -I$(NPLIB)/include #------------------------------------------------------------------------------ -SHARELIB = libGaspardData.so libGaspardPhysics.so \ - libGaspardTrackerModules.so libGaspardPhysicsNew.so +SHARELIB = libGaspardData.so \ + libGaspardTrackerModules.so libGaspardPhysics.so all: $(SHARELIB) #------------------------------------------------------------------------------ ############### Detector ############## @@ -281,19 +281,13 @@ libGaspardData.so: TGaspardTrackerData.o TGaspardTrackerDataDict.o TGaspardTrackerDataDict.cxx: TGaspardTrackerData.h rootcint -f $@ -c $^ -libGaspardPhysics.so: GaspardTracker.o TGaspardTrackerPhysics.o TGaspardTrackerPhysicsDict.o +libGaspardPhysics.so: GaspardTracker.o TGaspardTrackerPhysics.o \ + TGaspardTrackerPhysicsDict.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ TGaspardTrackerPhysicsDict.cxx: TGaspardTrackerPhysics.h rootcint -f $@ -c $^ -libGaspardPhysicsNew.so: GaspardTrackerNew.o TGaspardTrackerPhysicsNew.o \ - TGaspardTrackerPhysicsNewDict.o - $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ - -TGaspardTrackerPhysicsNewDict.cxx: TGaspardTrackerPhysicsNew.h - rootcint -f $@ -c $^ - libGaspardTrackerModules.so: GaspardTrackerModule.o GaspardTrackerDummyShape.o \ GaspardTrackerTrapezoid.o GaspardTrackerAnnular.o \ GaspardTrackerSquare.o @@ -303,10 +297,8 @@ libGaspardTrackerModules.so: GaspardTrackerModule.o GaspardTrackerDummyShape.o \ # 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 GaspardTrackerModule.o: GaspardTrackerModule.cxx GaspardTrackerModule.h GaspardTrackerDummyShape.o: GaspardTrackerDummyShape.cxx GaspardTrackerDummyShape.h GaspardTrackerTrapezoid.o: GaspardTrackerTrapezoid.cxx GaspardTrackerTrapezoid.h diff --git a/NPLib/GASPARD/TGaspardTrackerPhysics.cxx b/NPLib/GASPARD/TGaspardTrackerPhysics.cxx index 09c69515c360efc13d32aab0106566ece3f2976d..add29608820c47f4d2686eefdc5a54103be5fbad 100644 --- a/NPLib/GASPARD/TGaspardTrackerPhysics.cxx +++ b/NPLib/GASPARD/TGaspardTrackerPhysics.cxx @@ -22,8 +22,6 @@ *****************************************************************************/ #include "TGaspardTrackerPhysics.h" -#include <iostream> -#include <cstdlib> ClassImp(TGaspardTrackerPhysics) @@ -31,7 +29,6 @@ ClassImp(TGaspardTrackerPhysics) TGaspardTrackerPhysics::TGaspardTrackerPhysics() { - EventMultiplicity = 0; } @@ -43,165 +40,26 @@ TGaspardTrackerPhysics::~TGaspardTrackerPhysics() -void TGaspardTrackerPhysics::BuildSimplePhysicalEvent(TGaspardTrackerData* Data) -{ - BuildPhysicalEvent(Data); -} - - - -void TGaspardTrackerPhysics::BuildPhysicalEvent(TGaspardTrackerData* Data) -{ - // indexes for each kind of detector - // this should follow the indexes given in NPSimulation - // 0: Square - // 100: Trapezoid - // 200: Annular - // 1000: DummyShape - const int dim = 4; - int index[dim] = {0, 100, 200, 1000}; - - // Check - 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 = Data->GetGPDTrkFirstStageFrontEMult(); - int multYE = Data->GetGPDTrkFirstStageBackEMult(); - int multXT = Data->GetGPDTrkFirstStageFrontTMult(); - int multYT = Data->GetGPDTrkFirstStageBackTMult(); - // calculate multiplicity of 2nd and third stages - int mult2E = Data->GetGPDTrkSecondStageEMult(); - int mult2T = Data->GetGPDTrkSecondStageTMult(); - int mult3E = Data->GetGPDTrkThirdStageEMult(); - int mult3T = Data->GetGPDTrkThirdStageTMult(); - - // Deal with multiplicity 1 for the first layer - if (multXE==1 && multYE==1 && multXT==1 && multYT==1) { - // calculate detector number - int det_ref = Data->GetGPDTrkFirstStageFrontEDetectorNbr(0); - int detecXE = Data->GetGPDTrkFirstStageFrontEDetectorNbr(0) / det_ref; - int detecXT = Data->GetGPDTrkFirstStageFrontTDetectorNbr(0) / det_ref; - int detecYE = Data->GetGPDTrkFirstStageBackEDetectorNbr(0) / det_ref; - int detecYT = Data->GetGPDTrkFirstStageBackTDetectorNbr(0) / det_ref; - // convert detector number in order to it begins at 0 - // this is needed to access the strip position information - // WARNING: this method may not work for an heteregneous detector - // configuration, e.g. Trapezoid + Annular - int good_index = -100; - int diff_ref = 10000; - for (int i = 0; i < dim; i++) { - int diff = abs(det_ref - index[i]); - if (diff < diff_ref) { - diff_ref = diff; - good_index = i; - } - } - det_ref -= index[good_index]; - - // case of same detector - if (detecXE*detecXT*detecYE*detecYT == 1) { - // store module number - ModuleNumber.push_back(det_ref); - // calculate strip number - int stripXE = Data->GetGPDTrkFirstStageFrontEStripNbr(0); - int stripXT = Data->GetGPDTrkFirstStageFrontTStripNbr(0); - int stripYE = Data->GetGPDTrkFirstStageBackEStripNbr(0); - int stripYT = Data->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 - FirstStage_X.push_back(stripXE); - FirstStage_Y.push_back(stripYE); - // get energy from strips and store it - double EnergyStripFront = Data->GetGPDTrkFirstStageFrontEEnergy(0); -// double EnergyStripBack = Data->GetGPDTrkFirstStageBackEEnergy(0); -// double EnergyStrip = 0.5 * (EnergyStripFront + EnergyStripBack); - double EnergyStrip = EnergyStripFront; -// if (EnergyStripBack > EnergyStrip) EnergyStrip = EnergyStripBack; - FirstStage_E.push_back(EnergyStrip); - double EnergyTot = EnergyStrip; - // get time from strips and store it - double TimeStripFront = Data->GetGPDTrkFirstStageFrontEEnergy(0); - double TimeStripBack = Data->GetGPDTrkFirstStageBackEEnergy(0); - double TimeStrip = 0.5 * (TimeStripFront + TimeStripBack); -// double TimeStrip = TimeStripFront; -// if (TimeStripBack > TimeStrip) TimeStrip = TimeStripBack; - FirstStage_T.push_back(TimeStrip); - - // check if we have a 2nd stage event - if (mult2E==1 && mult2T==1) { - Check_SecondStage = true; - double EnergySecond = Data->GetGPDTrkSecondStageEEnergy(0); - SecondStage_E.push_back(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 = Data->GetGPDTrkThirdStageEEnergy(0); - ThirdStage_E.push_back(EnergyThird); - EnergyTot += EnergyThird; - } - else if (mult3E>1 || mult3T>1) { - cout << "Warning: multiplicity in third stage greater than in firststage" << endl; - } - - // Fill total energy - TotalEnergy.push_back(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 TGaspardTrackerPhysics::Clear() { - EventMultiplicity= 0; - ModuleNumber.clear(); - EventType.clear(); - TotalEnergy.clear(); - - // Si X - FirstStage_E.clear(); - FirstStage_T.clear(); - FirstStage_X.clear(); - FirstStage_Y.clear(); - - // Si(Li) - SecondStage_E.clear(); - SecondStage_T.clear(); - SecondStage_N.clear(); - - // CsI - ThirdStage_E.clear(); - ThirdStage_T.clear(); - ThirdStage_N.clear(); + // 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/TGaspardTrackerPhysics.h b/NPLib/GASPARD/TGaspardTrackerPhysics.h index b770f564ed1716024ba010f34ff4e697764ec119..651730df308eed49c3265e5ff284564244b337e7 100644 --- a/NPLib/GASPARD/TGaspardTrackerPhysics.h +++ b/NPLib/GASPARD/TGaspardTrackerPhysics.h @@ -9,7 +9,7 @@ * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * * * Creation Date : 31/08/09 * - * Last update : * + * Last update : 08/10/10 * *---------------------------------------------------------------------------* * Decription: This class stores the physical results after NPAnalysis is run* * for the tracker part of the Gaspard detector. * @@ -17,6 +17,9 @@ * stored in the output TTree of NPAnalysis. * *---------------------------------------------------------------------------* * Comment: * + * + 08/10/10: Change private member names and add setters and getters * + * methods. BuildPhysicalEvent() method is moved to the * + * TGaspardTracker*** classes (N. de Sereville) * * * * * *****************************************************************************/ @@ -26,13 +29,15 @@ #include "TGaspardTrackerData.h" +// ROOT #include "TObject.h" +// C++ #include <vector> -#include <cstdlib> using namespace std ; + class TGaspardTrackerPhysics : public TObject { public: @@ -41,40 +46,83 @@ public: public: void Clear(); - void Clear(const Option_t*) {}; - void BuildPhysicalEvent(TGaspardTrackerData* Data); - void BuildSimplePhysicalEvent(TGaspardTrackerData* Data); + void Clear(const Option_t*) {}; -public: - // Provide Physical Multiplicity - Int_t EventMultiplicity; - // Provide a Classification of Event - vector<int> EventType; +private: + vector<Int_t> fEventType; + vector<Int_t> fModuleNumber; - // Telescope - vector<int> ModuleNumber; + // First stage + vector<Double_t> fFirstStage_Energy; + vector<Double_t> fFirstStage_Time; + vector<Int_t> fFirstStage_FrontPosition; + vector<Int_t> fFirstStage_BackPosition; - // FirstStage - vector<double> FirstStage_E; - vector<double> FirstStage_T; - vector<int> FirstStage_X; - vector<int> FirstStage_Y; + // Second stage + vector<Double_t> fSecondStage_Energy; + vector<Double_t> fSecondStage_Time; + vector<Int_t> fSecondStage_Position; - // SecondStage - vector<double> SecondStage_E; - vector<double> SecondStage_T; - vector<int> SecondStage_N; + // Third stage + vector<Double_t> fThirdStage_Energy; + vector<Double_t> fThirdStage_Time; + vector<Int_t> fThirdStage_Position; - // ThirdStage - vector<double> ThirdStage_E; - vector<double> ThirdStage_T; - vector<int> ThirdStage_N; + vector<Double_t> fTotalEnergy; - // Physical Value - vector<double> TotalEnergy; - ClassDef(TGaspardTrackerPhysics,1) // GaspardTrackerPHysics structure +public: + ///////////////////////////////////// + // 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);} + + ///////////////////////////////////// + // 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(TGaspardTrackerPhysics,1) // TGaspardTrackerPhysics structure }; #endif diff --git a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx b/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx deleted file mode 100644 index 239a9de3b33d02592e9a4b59e7a6c603d90028ff..0000000000000000000000000000000000000000 --- a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************** - * 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 : * - *---------------------------------------------------------------------------* - * 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: * - * * - * * - *****************************************************************************/ - -#include "TGaspardTrackerPhysicsNew.h" - - -ClassImp(TGaspardTrackerPhysicsNew) - - -TGaspardTrackerPhysicsNew::TGaspardTrackerPhysicsNew() -{ -} - - - -TGaspardTrackerPhysicsNew::~TGaspardTrackerPhysicsNew() -{ - Clear(); -} - - - -void TGaspardTrackerPhysicsNew::Clear() -{ - // 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 deleted file mode 100644 index 4dcf45a208516c280b88e324fd38527185c909ec..0000000000000000000000000000000000000000 --- a/NPLib/GASPARD/TGaspardTrackerPhysicsNew.h +++ /dev/null @@ -1,128 +0,0 @@ -/***************************************************************************** - * 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 : 08/10/10 * - *---------------------------------------------------------------------------* - * 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: * - * + 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 -#define TGASPARDTRACKERPHYSICSNEW_H - -#include "TGaspardTrackerData.h" - -// ROOT -#include "TObject.h" - -// C++ -#include <vector> - -using namespace std ; - - -class TGaspardTrackerPhysicsNew : public TObject -{ -public: - TGaspardTrackerPhysicsNew(); - ~TGaspardTrackerPhysicsNew(); - -public: - void Clear(); - void Clear(const Option_t*) {}; - - -private: - vector<Int_t> fEventType; - vector<Int_t> fModuleNumber; - - // First stage - vector<Double_t> fFirstStage_Energy; - vector<Double_t> fFirstStage_Time; - vector<Int_t> fFirstStage_FrontPosition; - vector<Int_t> fFirstStage_BackPosition; - - // 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; - - vector<Double_t> fTotalEnergy; - - -public: - ///////////////////////////////////// - // 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);} - - ///////////////////////////////////// - // 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/INSTALL b/NPLib/INSTALL index ab085fec55c70335fa113f662cd9deb55755fad2..a873f0b3b9f90c56820e985f8ab6a51a785b54d1 100644 --- a/NPLib/INSTALL +++ b/NPLib/INSTALL @@ -48,4 +48,5 @@ following commands: the include directory and the shared libraries (*.so) associated to each library are copied to the lib directory. If you are using a Mac OS system a symbolic link *.dylib is done with respect to - each *.so library. + each *.so library. The 'liblist' file used for linking NPS and NPA + is created. diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx index e64af68be2201350914283bb6ff10005ced77d27..613ee835897b337da3457c1f22d906aa2c95832d 100644 --- a/NPLib/MUST2/TMust2Physics.cxx +++ b/NPLib/MUST2/TMust2Physics.cxx @@ -758,7 +758,7 @@ void TMust2Physics::AddTelescope( TVector3 C_X1_Y1 , TVector3 C_X128_Y128 ) { // To avoid warning - C_X1_Y128 *= 1; + C_X128_Y128 *= 1; NumberOfTelescope++; diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 08fbcb0ea7fbed6ad04a7281e32c1c3780c5c4f7..a1cd19be3844e516e5a678780bf621630e46bb56 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -10,7 +10,6 @@ #include "../SSSD/TSSSDPhysics.h" #include "../Plastic/TPlasticPhysics.h" #include "../GASPARD/GaspardTracker.h" -#include "../GASPARD/GaspardTrackerNew.h" #include "../Paris/Paris.h" #include "../Shield/Shield.h" @@ -78,7 +77,7 @@ void DetectorManager::ReadConfigurationFile(string Path) cout << "//////// Gaspard Tracker ////////" << endl; // Instantiate the new array as a VDetector Object - VDetector* myDetector = new GaspardTrackerNew(); + VDetector* myDetector = new GaspardTracker(); // Read Position of Telescope ConfigFile.close(); diff --git a/NPSimulation/src/GaspardScorers.cc b/NPSimulation/src/GaspardScorers.cc index d6031b89d2ebce7faed25f498eed0c302862e78a..0ec6364a2ae69b416243970fa2b932fee364b6e1 100644 --- a/NPSimulation/src/GaspardScorers.cc +++ b/NPSimulation/src/GaspardScorers.cc @@ -529,7 +529,7 @@ G4bool GPDScorerFirstStageFrontStripTrapezoid::ProcessHits(G4Step* aStep, G4Touc G4double StripPitch = GPDTRAP::FirstStageBaseLarge / m_NumberOfStrip; G4double temp = (POS(0) + GPDTRAP::FirstStageBaseLarge / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; + G4double X = int(temp) + 1; //Rare case where particle is close to edge of silicon plan if (X == 129) X = 128; G4double edep = aStep->GetTotalEnergyDeposit();