From 205aeb0b40b3e24b8da262fc14db3b3804933be0 Mon Sep 17 00:00:00 2001 From: matta <matta@npt> Date: Wed, 21 Oct 2009 03:54:53 +0000 Subject: [PATCH] * Adding file to support Strip Number on the ThinSi detector --- .../DetectorConfiguration/Riken_65mm.detector | 2 +- NPLib/SSSD/Makefile | 303 ++++++++++++++++++ NPLib/SSSD/TSSSDData.cxx | 77 +++++ NPLib/SSSD/TSSSDData.h | 76 +++++ NPSimulation/GNUmakefile | 2 +- NPSimulation/include/ThinSi.hh | 6 +- NPSimulation/src/ThinSi.cc | 21 +- 7 files changed, 475 insertions(+), 12 deletions(-) create mode 100755 NPLib/SSSD/Makefile create mode 100644 NPLib/SSSD/TSSSDData.cxx create mode 100644 NPLib/SSSD/TSSSDData.h diff --git a/Inputs/DetectorConfiguration/Riken_65mm.detector b/Inputs/DetectorConfiguration/Riken_65mm.detector index 4e86c36cc..31d9cbda5 100644 --- a/Inputs/DetectorConfiguration/Riken_65mm.detector +++ b/Inputs/DetectorConfiguration/Riken_65mm.detector @@ -115,7 +115,7 @@ CSI= 0 VIS= all %%%%%%%%%%%%%%%%%%%% -%AddThinSi +AddThinSi %%%%%%%%% Det 1 %%%%%%%% ThinSi A= 17.61 9.85 104.11 diff --git a/NPLib/SSSD/Makefile b/NPLib/SSSD/Makefile new file mode 100755 index 000000000..9ceff2d71 --- /dev/null +++ b/NPLib/SSSD/Makefile @@ -0,0 +1,303 @@ +# Makefile for the ROOT test programs. +# This Makefile shows nicely how to compile and link applications +# using the ROOT libraries on all supported platforms. +# +# Copyright (c) 2000 Rene Brun and Fons Rademakers +# +# Author: Fons Rademakers, 29/2/2000 + +ROOTCONFIG := root-config + +ARCH := $(shell $(ROOTCONFIG) --arch) +PLATFORM := $(shell $(ROOTCONFIG) --platform) +ALTCC := $(shell $(ROOTCONFIG) --cc) +ALTCXX := $(shell $(ROOTCONFIG) --cxx) +ALTF77 := $(shell $(ROOTCONFIG) --f77) +ALTLD := $(shell $(ROOTCONFIG) --ld) + +#CXX = +ObjSuf = o +SrcSuf = cxx +ExeSuf = +DllSuf = so +OutPutOpt = -o # keep whitespace after "-o" + +ifeq (debug,$(findstring debug,$(ROOTBUILD))) +OPT = -g +OPT2 = -g +else +ifneq ($(findstring debug, $(strip $(shell $(ROOTCONFIG) --config))),) +OPT = -g +OPT2 = -g +else +OPT = -O +OPT2 = -O2 +endif +endif + +ROOTCFLAGS := $(shell $(ROOTCONFIG) --cflags) +ROOTLDFLAGS := $(shell $(ROOTCONFIG) --ldflags) +ROOTLIBS := $(shell $(ROOTCONFIG) --libs) +ROOTGLIBS := $(shell $(ROOTCONFIG) --glibs) +HASTHREAD := $(shell $(ROOTCONFIG) --has-thread) +ROOTDICTTYPE := $(shell $(ROOTCONFIG) --dicttype) +NOSTUBS := $(shell $(ROOTCONFIG) --nostubs) +ROOTCINT := rootcint + +ifeq ($(ARCH),linux) +# Linux with egcs, gcc 2.9x, gcc 3.x +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxkcc) +# Linux with the KAI compiler +CXX = KCC --one_instantiation_per_object +CXXFLAGS = $(OPT) -fPIC +K0 +LD = KCC +LDFLAGS = $(OPT) $(shell $(ROOTCONFIG) --cflags) +SOFLAGS = +endif + +ifeq ($(ARCH),linuxicc) +# Linux with Intel icc compiler +ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ + cut -d'.' -f1) +ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ + cut -d'.' -f2) +CXX = icc +CXXFLAGS = $(OPT) -fPIC -wd1476 +LD = icpc +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxppcgcc) +# PPC Linux with gcc and glibc +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxia64gcc) +# Itanium Linux with gcc 2.9x +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxia64sgi) +# Itanium Linux with sgiCC +CXX = sgiCC +CXXFLAGS = $(OPT) -Wall -fPIC +LD = gsgiCC +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxia64ecc) +# Itanium Linux with Intel icc (was ecc) +ICC_MAJOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ + cut -d'.' -f1) +ICC_MINOR := $(shell icc -v 2>&1 | awk '{ if (NR==1) print $$2 }' | \ + cut -d'.' -f2) +CXX = icc +CXXFLAGS = $(OPT) -fPIC -wd1476 -ftz +LD = icpc +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxx8664gcc) +# AMD Opteron and Intel EM64T (64 bit mode) Linux with gcc 3.x +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxppc64gcc) +# PPC64 Linux with gcc 3.x +CXX = g++ +CXXFLAGS = $(OPT) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxx8664icc) +# AMD Opteron and Intel EM64T (64 bit mode) Linux with Intel icc compiler +CXX = icc +CXXFLAGS = $(OPT) -fPIC -wd1476 -wd1572 +LD = icpc +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxalphagcc) +# Alpha Linux with gcc +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxmips) +# GNU/Linux on mips (BE/LE, O32/N32/N64) with gcc +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxhppa) +# GNU/Linux on hppa with gcc +CXX = g++ +CXXFLAGS = $(OPT2) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT2) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),linuxarm) +# ARM Linux with egcs +CXX = g++ +CXXFLAGS = $(OPT) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + +ifeq ($(ARCH),macosx) +# MacOS X with cc (GNU cc 2.95.2 and gcc 3.3) +MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) +MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) +CXX = g++ +CXXFLAGS = $(OPT2) -pipe -Wall -W -Woverloaded-virtual +LD = $(MACOSXTARGET) g++ +LDFLAGS = $(OPT2) -bind_at_load +# The SOFLAGS will be used to create the .dylib, +# the .so will be created separately +ifeq ($(subst $(MACOSX_MINOR),,1234),1234) +DllSuf = so +else +DllSuf = dylib +endif +UNDEFOPT = dynamic_lookup +ifneq ($(subst $(MACOSX_MINOR),,12),12) +UNDEFOPT = suppress +LD = g++ +endif +SOFLAGS = -dynamiclib -single_module -undefined $(UNDEFOPT) +endif + +ifeq ($(ARCH),macosxicc) +# MacOS X with Intel icc compiler +MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) +MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) +ifeq ($(MACOSX_MINOR),5) +MACOSX_MINOR := 4 +endif +CXX = icc +CXXFLAGS = $(OPT) -fPIC -wd1476 +LD = $(MACOSXTARGET) icpc +LDFLAGS = $(OPT) +# The SOFLAGS will be used to create the .dylib, +# the .so will be created separately +ifeq ($(subst $(MACOSX_MINOR),,1234),1234) +DllSuf = so +else +DllSuf = dylib +endif +SOFLAGS = -dynamiclib -single_module -undefined dynamic_lookup +endif + +ifeq ($(ARCH),macosx64) +# MacOS X >= 10.4 with gcc 64 bit mode (GNU gcc 4.*) +# Only specific option (-m64) comes from root-config +MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) +MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) +CXX = g++ +CXXFLAGS = $(OPT2) -pipe -Wall -W -Woverloaded-virtual +LD = $(MACOSXTARGET) g++ -m64 +LDFLAGS = $(OPT2) -bind_at_load +# The SOFLAGS will be used to create the .dylib, +# the .so will be created separately +ifeq ($(subst $(MACOSX_MINOR),,1234),1234) +DllSuf = so +else +DllSuf = dylib +endif +SOFLAGS = -m64 -dynamiclib -single_module -undefined dynamic_lookup +endif + +ifeq ($(ARCH),macosxxlc) +# MacOS X with IBM xlC compiler +MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2) +MACOSXTARGET := MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) +CXX = xlC +CXXFLAGS = $(OPT) +LD = $(MACOSXTARGET) xlC +LDFLAGS = $(OPT) -Wl,-bind_at_load +# The SOFLAGS will be used to create the .dylib, +# the .so will be created separately +DllSuf = dylib +UNDEFOPT = dynamic_lookup +ifneq ($(subst $(MACOSX_MINOR),,12),12) +UNDEFOPT = suppress +LD = xlC +endif +SOFLAGS = -qmkshrobj -single_module -undefined $(UNDEFOPT) +endif + +CXXFLAGS += $(ROOTCFLAGS) +LDFLAGS += $(ROOTLDFLAGS) +LIBS = $(ROOTLIBS) $(SYSLIBS) +GLIBS = $(ROOTGLIBS) $(SYSLIBS) + +INCLUDE = -I$(CLHEP_BASE_DIR)/include -I$(NPLIB)/include + +#------------------------------------------------------------------------------ +SHARELIB = libSSSDData.so + +all: $(SHARELIB) +#------------------------------------------------------------------------------ +############### Detector ############## + +## SSSD ## +libSSSDData.so: TSSSDData.o TSSSDDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TSSSDDataDict.cxx: TSSSDData.h + rootcint -f $@ -c $^ + + +# dependances +TSSSDData.o: TSSSDData.cxx TSSSDData.h +####################################### + +############# Clean and More ########## +clean: + @rm -f core *~ *.o *Dict* + +distclean: + make clean; rm -f *.so + +.SUFFIXES: .$(SrcSuf) + +### + +.$(SrcSuf).$(ObjSuf): + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< + + diff --git a/NPLib/SSSD/TSSSDData.cxx b/NPLib/SSSD/TSSSDData.cxx new file mode 100644 index 000000000..3877b7174 --- /dev/null +++ b/NPLib/SSSD/TSSSDData.cxx @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright (C) 2009 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: Adrien MATTA contact address: matta@ipno.in2p3.fr * + * * + * Creation Date : febuary 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold SSSD Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <iostream> +using namespace std; + +#include "TSSSDData.h" + +ClassImp(TSSSDData) + +TSSSDData::TSSSDData() +{ + // Default constructor + + // SSSD + // Energy + fSSSD_StripE_DetectorNbr.clear() ; + fSSSD_StripE_StripNbr.clear() ; + fSSSD_StripE_Energy.clear() ; + // Time + fSSSD_StripT_DetectorNbr.clear() ; + fSSSD_StripT_StripNbr.clear() ; + fSSSD_StripT_Time.clear() ; + +} + +TSSSDData::~TSSSDData() +{} + +void TSSSDData::Clear() +{ + // DSSD + // Energy + fSSSD_StripE_DetectorNbr.clear() ; + fSSSD_StripE_StripNbr.clear() ; + fSSSD_StripE_Energy.clear() ; + // Time + fSSSD_StripT_DetectorNbr.clear() ; + fSSSD_StripT_StripNbr.clear() ; + fSSSD_StripT_Time.clear() ; +} + + + +void TSSSDData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // SSSD + // Energy + cout << "SSSD_StripE_Mult = " << fSSSD_StripE_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fSSSD_StripE_DetectorNbr.size(); i++) + cout << "DetNbr: " << fSSSD_StripE_DetectorNbr[i] << " Strip: " << fSSSD_StripE_StripNbr[i] << " Energy: " << fSSSD_StripE_Energy[i] << endl; + // Time + cout << "SSSD_StripXT_Mult = " << fSSSD_StripT_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fSSSD_StripT_DetectorNbr.size(); i++) + cout << "DetNbr: " << fSSSD_StripT_DetectorNbr[i] << " Strip: " << fSSSD_StripT_StripNbr[i] << " Time: " << fSSSD_StripT_Time[i] << endl; + +} diff --git a/NPLib/SSSD/TSSSDData.h b/NPLib/SSSD/TSSSDData.h new file mode 100644 index 000000000..a57f0061d --- /dev/null +++ b/NPLib/SSSD/TSSSDData.h @@ -0,0 +1,76 @@ +#ifndef __SSSDDATA__ +#define __SSSDDATA__ +/***************************************************************************** + * Copyright (C) 2009 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: Adrien MATTA contact address: matta@ipno.in2p3.fr * + * * + * Creation Date : febuary 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold the Single Side Striped Detector raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <vector> +#include "TObject.h" + +using namespace std ; +class TSSSDData : public TObject { + private: + // SSSD + // Energy + vector<UShort_t> fSSSD_StripE_DetectorNbr; + vector<UShort_t> fSSSD_StripE_StripNbr; + vector<Double_t> fSSSD_StripE_Energy; + // Time + vector<UShort_t> fSSSD_StripT_DetectorNbr; + vector<UShort_t> fSSSD_StripT_StripNbr; + vector<Double_t> fSSSD_StripT_Time; + + + public: + TSSSDData(); + virtual ~TSSSDData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// SETTERS //////////////////////// + // DSSD + // (X,E) + void SetStripEDetectorNbr(UShort_t DetNbr) {fSSSD_StripE_DetectorNbr.push_back(DetNbr);} + void SetStripEStripNbr(UShort_t StripNbr) {fSSSD_StripE_StripNbr.push_back(StripNbr);} + void SetStripEEnergy(Double_t Energy) {fSSSD_StripE_Energy.push_back(Energy);} + // (X,T) + void SetStripTDetectorNbr(UShort_t DetNbr) {fSSSD_StripT_DetectorNbr.push_back(DetNbr);} + void SetStripTStripNbr(UShort_t StripNbr) {fSSSD_StripT_StripNbr.push_back(StripNbr);} + void SetStripTTime(Double_t Time) {fSSSD_StripT_Time.push_back(Time);} + + ///////////////////// GETTERS //////////////////////// + // DSSD + // (X,E) + UShort_t GetStripEMult() {return fSSSD_StripE_DetectorNbr.size();} + UShort_t GetStripEDetectorNbr(Int_t i) {return fSSSD_StripE_DetectorNbr.at(i);} + UShort_t GetStripEStripNbr(Int_t i) {return fSSSD_StripE_StripNbr.at(i);} + Double_t GetStripEEnergy(Int_t i) {return fSSSD_StripE_Energy.at(i);} + // (X,T) + UShort_t GetStripTMult() {return fSSSD_StripT_DetectorNbr.size();} + UShort_t GetStripTDetectorNbr(Int_t i) {return fSSSD_StripT_DetectorNbr.at(i);} + UShort_t GetStripTStripNbr(Int_t i) {return fSSSD_StripT_StripNbr.at(i);} + Double_t GetStripTTime(Int_t i) {return fSSSD_StripT_Time.at(i);} + + ClassDef(TSSSDData,2) // SSSDData structure +}; + +#endif diff --git a/NPSimulation/GNUmakefile b/NPSimulation/GNUmakefile index 31206791b..3d960a57e 100644 --- a/NPSimulation/GNUmakefile +++ b/NPSimulation/GNUmakefile @@ -19,7 +19,7 @@ G4WORKDIR = ./ CPPFLAGS += $(shell root-config --cflags) CPPFLAGS += -I$(NPLIB)/include EXTRALIBS = $(shell root-config --glibs) -EXTRALIBS += -L$(NPLIB)/lib -lMust2Data -lAnnularS1Data -lGaspardData -lPlasticData -lDUMMYDetectorData\ +EXTRALIBS += -L$(NPLIB)/lib -lMust2Data -lAnnularS1Data -lGaspardData -lPlasticData -lDUMMYDetectorData -lSSSDData\ -lInitialConditions -lInteractionCoordinates \ -lReaction -lIORoot .PHONY: all diff --git a/NPSimulation/include/ThinSi.hh b/NPSimulation/include/ThinSi.hh index a1fc1e8c5..c0a01c935 100644 --- a/NPSimulation/include/ThinSi.hh +++ b/NPSimulation/include/ThinSi.hh @@ -32,9 +32,11 @@ #include "G4RotationMatrix.hh" #include "G4LogicalVolume.hh" -// NPTool header +// NPSimulation header #include "VDetector.hh" +// NPLib +#include "TSSSDData.h" using namespace std; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -119,7 +121,7 @@ public: ///////////Event class to store Data//////////////// //////////////////////////////////////////////////// private: - G4double m_Energy ; + TSSSDData* m_Event ; //////////////////////////////////////////////////// ///////////////// Scorer Related /////////////////// diff --git a/NPSimulation/src/ThinSi.cc b/NPSimulation/src/ThinSi.cc index c3a6158a8..2aa8a5e37 100644 --- a/NPSimulation/src/ThinSi.cc +++ b/NPSimulation/src/ThinSi.cc @@ -62,7 +62,8 @@ using namespace CLHEP; // ThinSi Specific Method ThinSi::ThinSi() { - InitializeMaterial(); + InitializeMaterial() ; + m_Event = new TSSSDData() ; } ThinSi::~ThinSi() @@ -553,15 +554,15 @@ void ThinSi::InitializeRootOutput() { RootOutput *pAnalysis = RootOutput::getInstance(); TTree *pTree = pAnalysis->GetTree(); - pTree->Branch("ThinSiEnergy", &m_Energy, "ThinSiEnergy/D") ; + pTree->Branch("ThinSi", "TSSSDData", &m_Event) ; } // Read sensitive part and fill the Root tree. // Called at in the EventAction::EndOfEventAvtion void ThinSi::ReadSensitive(const G4Event* event) { - G4String DetectorNumber ; - m_Energy = 0 ; + G4String DetectorNumber ; + m_Event->Clear(); ////////////////////////////////////////////////////////////////////////////////////// //////////////////////// Used to Read Event Map of detector ////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -610,11 +611,13 @@ void ThinSi::ReadSensitive(const G4Event* event) // Energy Energy_itr = EnergyHitMap->GetMap()->begin(); for (G4int h = 0 ; h < sizeE ; h++) { - G4int ETrackID = Energy_itr->first - N ; - G4double E = *(Energy_itr->second) ; + G4int ETrackID = Energy_itr->first - N ; + G4double E = *(Energy_itr->second) ; if (ETrackID == NTrackID) { - m_Energy=RandGauss::shoot(E, ResoEnergy ) ; + m_Event->SetStripEDetectorNbr(1) ; + m_Event->SetStripEStripNbr(1) ; + m_Event->SetStripEEnergy( RandGauss::shoot(E, ResoEnergy ) ) ; } Energy_itr++; @@ -628,7 +631,9 @@ void ThinSi::ReadSensitive(const G4Event* event) G4double T = *(Time_itr->second) ; if (TTrackID == NTrackID) { - /*m_Event->SetTime(RandGauss::shoot(T, ResoTime))*/ ; + m_Event->SetStripTDetectorNbr(1) ; + m_Event->SetStripTStripNbr(1) ; + m_Event->SetStripTTime( RandGauss::shoot(T, ResoTime ) ) ; } Time_itr++; -- GitLab