diff --git a/app/application/appWCTESingleEvent.cc b/app/application/appWCTESingleEvent.cc index 7025dd4..9886883 100644 --- a/app/application/appWCTESingleEvent.cc +++ b/app/application/appWCTESingleEvent.cc @@ -42,10 +42,10 @@ int main(int argc, char **argv) // WCTE will use single PMT type, so define the corresponding type of 3-inch PMT const int NPMTType = 1; string fPMTType[NPMTType]; - fPMTType[0] = "PMT3inchR12199_02"; + fPMTType[0] = "PMT3inchR14374_WCTE"; MDTManager *MDT = new MDTManager(fSeed); - MDT->RegisterPMTType(fPMTType[0], new PMTResponse3inchR12199_02()); + MDT->RegisterPMTType(fPMTType[0], new Response3inchR14374_WCTE()); const vector listWCRootEvt{"wcsimrootevent"}; diff --git a/cpp/Makefile b/cpp/Makefile index 66a4904..4977fda 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -1,8 +1,8 @@ CXX=g++ LD=g++ -CXXFLAGS += -Wall -O2 -std=c++11 -g -fPIC -I./include -LDFLAGS += -shared +CXXFLAGS += -Wall -O2 -std=c++11 -g -fPIC -I./include $(shell root-config --cflags) +LDFLAGS += -shared $(shell root-config --ldflags) $(shell root-config --libs) TARGET=libMDT.so SRCDIR = ./src diff --git a/cpp/include/PMTResponse.h b/cpp/include/PMTResponse.h index b9680ee..b14b7ea 100644 --- a/cpp/include/PMTResponse.h +++ b/cpp/include/PMTResponse.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "MTRandom.h" #include "HitTube.h" @@ -78,3 +79,16 @@ class Response3inchR14374 : public GenericPMTResponse private: double fTimeResAt1PE; }; + +class Response3inchR14374_WCTE : public GenericPMTResponse +{ + public: + Response3inchR14374_WCTE(int, const string &s=""); + Response3inchR14374_WCTE(); + virtual ~Response3inchR14374_WCTE(); + float HitTimeSmearing(float); + void Initialize(int, const string &s=""); + + private: + TGraph *gTResol = nullptr; // timing resolution +}; \ No newline at end of file diff --git a/cpp/src/PMTResponse.cc b/cpp/src/PMTResponse.cc index f42f739..b1edce0 100644 --- a/cpp/src/PMTResponse.cc +++ b/cpp/src/PMTResponse.cc @@ -229,3 +229,78 @@ float Response3inchR14374::HitTimeSmearing(float Q) float timingResolution = 0.6*fSclFacTTS; return fRand->Gaus(0., timingResolution); } + +/////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +Response3inchR14374_WCTE::Response3inchR14374_WCTE(int seed, const string &pmtname) +{ + double charge[14] = + { + 0.2, 0.4, 0.6, 0.8, 1.0, + 1.2, 1.4, 1.6, 1.8, 2.0, + 2.5, 3.0, 3.5, 4.0 + }; + double resol[14] = + { + 1.1654, 0.61088, 0.4186, 0.32532, 0.26484, + 0.23084, 0.20969, 0.19297, 0.17716, 0.17046, + 0.15455, 0.1427, 0.13699, 0.13229 + }; + gTResol = new TGraph(14,charge,resol); + + this->Initialize(seed, pmtname); +} + +Response3inchR14374_WCTE::Response3inchR14374_WCTE() +{ + double charge[14] = + { + 0.2, 0.4, 0.6, 0.8, 1.0, + 1.2, 1.4, 1.6, 1.8, 2.0, + 2.5, 3.0, 3.5, 4.0 + }; + double resol[14] = + { + 1.1654, 0.61088, 0.4186, 0.32532, 0.26484, + 0.23084, 0.20969, 0.19297, 0.17716, 0.17046, + 0.15455, 0.1427, 0.13699, 0.13229 + }; + gTResol = new TGraph(14,charge,resol); +} + +Response3inchR14374_WCTE::~Response3inchR14374_WCTE() +{ + delete gTResol; +} + +void Response3inchR14374_WCTE::Initialize(int seed, const string &pmtname) +{ + fPMTType = pmtname; + fRand = new MTRandom(seed); + + map s; + s["ScalFactorTTS"] = "ScalFactorTTS"; + s["SPECDFFile"] = "SPECDFFile"; + if( fPMTType!="" ) + { + map::iterator i; + for(i=s.begin(); i!=s.end(); i++) + { + i->second += "_" + fPMTType; + } + } + Configuration *Conf = Configuration::GetInstance(); + Conf->GetValue(s["ScalFactorTTS"], fSclFacTTS); + Conf->GetValue(s["SPECDFFile"], fTxtFileSPECDF); + this->LoadCDFOfSPE(fTxtFileSPECDF); +} + +float Response3inchR14374_WCTE::HitTimeSmearing(float Q) +{ + float pmt_tts = 1.5; + if (Q>4.0) Q = 4.0; // limit Q to valid range + float val = gTResol->Eval(Q,0,"S"); + float timingResolution = sqrt(pmt_tts*pmt_tts+val*val)/2.355; // conversion from FWHM to sigma + timingResolution *= fSclFacTTS; + return fRand->Gaus(0.0,timingResolution); +} diff --git a/parameter/MDTParamenter_WCTE.txt b/parameter/MDTParamenter_WCTE.txt index c965acc..3f47a1f 100644 --- a/parameter/MDTParamenter_WCTE.txt +++ b/parameter/MDTParamenter_WCTE.txt @@ -1,36 +1,29 @@ # Parameter setting # Trigger setting -< NDigitsThreshold = 25 > -< NDigitsStepSize = 5 > -< NDigitsPostTriggerWindow = +950. > -< NDigitsPreTriggerWindow = -400. > -< FailurePostTriggerWindow = +950. > # seems to be +950 by default //+100000. -< FailurePreTriggerWindow = -400. > -< FailureTime = 100. > -< NDigitsWindow = 200. > +< NDigitsThreshold_PMT3inchR14374_WCTE = 25 > +< NDigitsStepSize_PMT3inchR14374_WCTE = 5 > +< NDigitsPostTriggerWindow_PMT3inchR14374_WCTE = +950. > +< NDigitsPreTriggerWindow_PMT3inchR14374_WCTE = -400. > +< FailurePostTriggerWindow_PMT3inchR14374_WCTE = +950. > # seems to be +950 by default //+100000. +< FailurePreTriggerWindow_PMT3inchR14374_WCTE = -400. > +< FailureTime_PMT3inchR14374_WCTE = 100. > +< NDigitsWindow_PMT3inchR14374_WCTE = 200. > +< TriggerType_PMT3inchR14374_WCTE = NDigits > # Dark noise setting -< NumOfTubes = 2014 > -< MinTubeID = 1 > -< MaxTubeID = 2014 > -< DarkAddMode = 1 > -< DarkRate = 0.0 > // kHz -< DarkM0WindowLow = 0. > // ns -< DarkM0WindowUp = 100000. > // ns -< DarkM1Window = 4000. > // ns -< NumOfTubes_PMT3inchR12199_02 = 2014 > -< MinTubeID_PMT3inchR12199_02 = 1 > -< MaxTubeID_PMT3inchR12199_02 = 2014 > -< DarkRate_PMT3inchR12199_02 = 0.0 > +< DarkAddMode_PMT3inchR14374_WCTE = 1 > +< DarkM0WindowLow_PMT3inchR14374_WCTE = 0. > // ns +< DarkM0WindowUp_PMT3inchR14374_WCTE = 100000. > // ns +< DarkM1Window_PMT3inchR14374_WCTE = 4000. > // ns +< NumOfTubes_PMT3inchR14374_WCTE = 2014 > +< MinTubeID_PMT3inchR14374_WCTE = 1 > +< MaxTubeID_PMT3inchR14374_WCTE = 2014 > +< DarkRate_PMT3inchR14374_WCTE = 0.0 > # 3" PMT setting -< TimingResConstant = 1.890 > # TTS(FWHM) = 1ns at 1 charge -< TimingResMinimum = 0.58 > -< ScalFactorTTS = 1 > -< TimingResConstant_PMT3inchR12199_02 = 1.890 > # TTS(FWHM) = 1ns at 1 charge -< TimingResMinimum_PMT3inchR12199_02 = 0.58 > -< ScalFactorTTS_PMT3inchR12199_02 = 1 > +< ScalFactorTTS_PMT3inchR14374_WCTE = 1 > +< SPECDFFile_PMT3inchR14374_WCTE = $MDTROOT/parameter/SPE_CDF_PMT3inchR14374_WCTE.txt > # Digitizer setting < DigiHitIntegrationWindow = 200 > // ns @@ -43,7 +36,4 @@ # Output setting < TimeOffset = 950. > -< FlagMultDigits = 1 > - - -< SPECDFFile_PMT3inchR12199_02 = $MDTROOT/parameter/SPE_CDF_PMT3inchR12199_02.txt > +< FlagMultDigits = 0 > diff --git a/parameter/SPE_CDF_PMT3inchR14374_WCTE.txt b/parameter/SPE_CDF_PMT3inchR14374_WCTE.txt new file mode 100644 index 0000000..cce02db --- /dev/null +++ b/parameter/SPE_CDF_PMT3inchR14374_WCTE.txt @@ -0,0 +1,113 @@ +# Extracted from PMT3inchR14374_WCTE::Getqpe() +# // 1 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 0.000000 0.000000 +#// 2 +0.000381 0.002359 0.006956 0.014050 0.021470 +0.029045 0.036750 0.044913 0.053878 0.063897 +0.075367 0.089078 0.105693 0.126747 0.152918 +0.184803 0.223584 0.268127 0.317283 0.367630 +0.417750 0.466039 0.512878 0.557372 0.598186 +0.636186 0.671044 0.701999 0.730782 0.757566 +0.782031 0.804206 0.824292 0.842793 0.859734 +0.875207 0.889501 0.902172 0.913244 0.923582 +0.932835 0.940867 0.947906 0.954192 0.959824 +0.964409 0.968364 0.971983 0.975084 0.977725 +#// 3 +0.979961 0.982130 0.984062 0.985578 0.986994 +0.988236 0.989201 0.990078 0.990896 0.991671 +0.992372 0.992994 0.993539 0.994000 0.994403 +0.994807 0.995191 0.995541 0.995831 0.996070 +0.996275 0.996491 0.996711 0.996929 0.997135 +0.997340 0.997542 0.997677 0.997806 0.997960 +0.998096 0.998204 0.998276 0.998337 0.998383 +0.998410 0.998456 0.998514 0.998578 0.998642 +0.998703 0.998759 0.998797 0.998825 0.998852 +0.998885 0.998926 0.998979 0.999029 0.999073 +#// 4 +0.999111 0.999162 0.999223 0.999272 0.999309 +0.999343 0.999407 0.999451 0.999469 0.999534 +0.999593 0.999619 0.999633 0.999653 0.999688 +0.999705 0.999714 0.999724 0.999733 0.999739 +0.999739 0.999757 0.999782 0.999800 0.999824 +0.999852 0.999879 0.999901 0.999915 0.999916 +0.999916 0.999916 0.999916 0.999916 0.999918 +0.999926 0.999940 0.999957 0.999968 0.999977 +0.999986 0.999995 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// 5 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// 6 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// 7 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// 8 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// 9 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// 10 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +1.000000 1.000000 1.000000 1.000000 1.000000 +#// Dummy element for noticing if the loop reached the end of the array +0.0