From ddeecd6fb7a78070d7a143d5bfcacb0436670018 Mon Sep 17 00:00:00 2001 From: moukaddam <mhd.moukaddam@gmail.com> Date: Tue, 28 Mar 2017 12:29:51 +0100 Subject: [PATCH] Update energy thresholds, store partial matchsticked data for Ballis. Defic. correction, teddy-up calibration --- NPLib/Detectors/Tiara/TTiaraBarrelPhysics.cxx | 128 +++++++++++------- 1 file changed, 76 insertions(+), 52 deletions(-) diff --git a/NPLib/Detectors/Tiara/TTiaraBarrelPhysics.cxx b/NPLib/Detectors/Tiara/TTiaraBarrelPhysics.cxx index 9c1e0c9a4..f467cd523 100644 --- a/NPLib/Detectors/Tiara/TTiaraBarrelPhysics.cxx +++ b/NPLib/Detectors/Tiara/TTiaraBarrelPhysics.cxx @@ -52,15 +52,16 @@ ClassImp(TTiaraBarrelPhysics) EventMultiplicity = 0 ; m_EventData = new TTiaraBarrelData ; m_PreTreatedData = new TTiaraBarrelData ; + m_PreTreatedMSData = new TTiaraBarrelData ; m_EventPhysics = this ; m_NumberOfDetector = 0 ; m_Take_E_Strip= true; m_Take_T_Back=true; - m_Strip_E_Threshold = 0.40 ; - m_Back_E_Threshold = 0.40 ; - m_Maximum_FrontBack_Difference = 0.4; - m_OuterBack_E_Threshold =0; + m_Strip_E_Threshold = 10 ; //keV + m_Back_E_Threshold = 10 ; //keV + m_Maximum_FrontBack_Difference = 30 ; // keV + m_OuterBack_E_Threshold = 0; m_Spectra = NULL ; } @@ -86,25 +87,52 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){ == m_PreTreatedData->GetFrontDownstreamEDetectorNbr(j) && m_PreTreatedData->GetFrontUpstreamEStripNbr(i) == m_PreTreatedData->GetFrontDownstreamEStripNbr(j)) { - - double ChU = Match_Strip_Upstream_E(i) ; // matchsticked - double ChD = Match_Strip_Downstream_E(j); // matchsticked - double RowPos = (ChU-ChD)/(ChU+ChD); // order of U and D in numerator is crucial - + + int det = m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i); + int strip = m_PreTreatedData->GetFrontUpstreamEStripNbr(i) ; double EU = m_PreTreatedData->GetFrontUpstreamEEnergy(i) ; // energy calibrated double ED = m_PreTreatedData->GetFrontDownstreamEEnergy(j); // energy calibrated + double msU = m_PreTreatedMSData->GetFrontUpstreamEEnergy(i) ; // energy matchsticked + double msD = m_PreTreatedMSData->GetFrontDownstreamEEnergy(j); // energy matchsticked + double RowPos = (msU-msD)/(msU+msD); + + //Calculate position + // Apply correction factor on RowPos + name = "TIARABARREL/B"; + name+=NPL::itoa(det); + name+="_STRIP"; + name+=NPL::itoa(strip); + name+="_POS"; + double Pos = CalibrationManager::getInstance() + ->ApplyResistivePositionCalibration(name,RowPos); // returns ((RowPos-d)/k) + + //Fix Balistic deficit + // calibration is applied as: (U+D)*( 1 + BD*(pow(k,2)-pow(pos-d,2)) ), + // While BD > 0 and |k| >= |pos-d| for good events + // + // Get resistive shift and length, this will fix asymetries + double d = CalibrationManager::getInstance()->GetValue(name,0); // resistive strip length shift + double k = CalibrationManager::getInstance()->GetValue(name,1); // resistive strip half-length + name ="TIARABARREL/B"; + name+=NPL::itoa(det); + name+="_STRIP"; + name+=NPL::itoa(strip); + name+="_BALLISTIC"; + double BD_x_k2 =CalibrationManager::getInstance()->ApplyCalibration(name, k ); + double BD_x_Pos2 =CalibrationManager::getInstance()->ApplyCalibration(name, (RowPos-d) ); + double BD = (BD_x_k2 - BD_x_Pos2); + + DetectorNumber.push_back(det); + Strip_N.push_back(strip); + Strip_Pos.push_back(Pos); // position expressed in [-1;+1] + UpStream_E.push_back(EU); + DownStream_E.push_back(ED); + Strip_E.push_back( (EU+ED) * (1+BD) ); + // Front back Energy match + /* + // check if back and front detectors are matched if(true){ - name = "TIARABARREL/B"; - name+=NPL::itoa(m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i)); - name+="_STRIP"; - name+=NPL::itoa(m_PreTreatedData->GetFrontUpstreamEStripNbr(i)); - name+="_POS"; - double Pos = CalibrationManager::getInstance() - ->ApplyResistivePositionCalibration(name,RowPos); - double d = CalibrationManager::getInstance()->GetValue(name,0); // resistive strip length shift - double k = CalibrationManager::getInstance()->GetValue(name,1); // resistive strip half-length - /* double EO = -1000; double EO1 = -500; double EO2 = -500; @@ -122,24 +150,6 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){ } } } - */ - UpStream_E.push_back(EU); - DownStream_E.push_back(ED); - Strip_Pos.push_back(Pos); // position expressed in [-1;+1] - Strip_N.push_back(m_PreTreatedData->GetFrontUpstreamEStripNbr(i)); - DetectorNumber.push_back(m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i)); - name ="TIARABARREL/B"; - name+=NPL::itoa(m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i)); - name+="_STRIP"; - name+=NPL::itoa(m_PreTreatedData->GetFrontUpstreamEStripNbr(i)); - name+="_BALLISTIC"; - // calibration is applied as: (U+D)*( 1 - BD*( pow(k,2)-pow(pos-d,2) ) ), While BD < 0 - // k is typically the max value of RowPos and is the same value used in the Position calibration - double BD_x_k2 =CalibrationManager::getInstance()->ApplyCalibration(name,fabs(k)); - double BD_x_Pos2 =CalibrationManager::getInstance()->ApplyCalibration(name,fabs(RowPos-d)); - //correction is multiplicative and used as perturbation on unit - Strip_E.push_back( (EU+ED) * (1-(BD_x_k2 - BD_x_Pos2)) ); - /* if(sizeO == 1) EO = EO1; else if(sizeO == 2) @@ -147,8 +157,9 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){ else EO = -1000; Outer_Strip_E.push_back(EO); - */ - } // if true? + + } // if(true) + */ } } // downstream } // upstream @@ -166,20 +177,29 @@ void TTiaraBarrelPhysics::PreTreat(){ unsigned int sizeD = m_EventData->GetFrontDownstreamEMult(); unsigned int sizeB = m_EventData->GetBackEMult(); unsigned int sizeO = m_EventData->GetOuterEMult(); + for(unsigned int i = 0 ; i < sizeU ; i++){ double EU = Cal_Strip_Upstream_E(i) ; - if(EU > m_Strip_E_Threshold) + if(EU > m_Strip_E_Threshold){ m_PreTreatedData->SetFrontUpstreamE(m_EventData->GetFrontUpstreamEDetectorNbr(i), m_EventData->GetFrontUpstreamEStripNbr(i), EU); + m_PreTreatedMSData->SetFrontUpstreamE(m_EventData->GetFrontUpstreamEDetectorNbr(i), + m_EventData->GetFrontUpstreamEStripNbr(i), + Match_Strip_Upstream_E(i)); + } } for(unsigned int j = 0 ; j < sizeD ; j++){ double ED = Cal_Strip_Downstream_E(j) ; - if(ED>m_Strip_E_Threshold) + if(ED>m_Strip_E_Threshold){ m_PreTreatedData->SetFrontDownstreamE(m_EventData->GetFrontDownstreamEDetectorNbr(j), m_EventData->GetFrontDownstreamEStripNbr(j), ED); + m_PreTreatedMSData->SetFrontDownstreamE(m_EventData->GetFrontDownstreamEDetectorNbr(j), + m_EventData->GetFrontDownstreamEStripNbr(j), + Match_Strip_Downstream_E(j)); + } } for(unsigned int k = 0 ; k < sizeB ; k++){ @@ -192,7 +212,8 @@ void TTiaraBarrelPhysics::PreTreat(){ double EO = m_EventData->GetOuterEEnergy(l) ; if(EO > m_OuterBack_E_Threshold) m_PreTreatedData->SetOuterE(m_EventData->GetOuterEDetectorNbr(l),m_EventData->GetOuterEStripNbr(l),EO); - } + } + } //////////////////////////////////////////////////////////////////////////// @@ -431,9 +452,8 @@ TVector3 TTiaraBarrelPhysics::GetPositionOfInteraction(const int i) const{ double X = (Strip_N[i]*StripPitch-0.5*INNERBARREL_ActiveWafer_Width)-(0.5*StripPitch); double Y = INNERBARREL_PCB_Width*(0.5+sin(45*deg)); double Z = Strip_Pos[i]*(0.5*INNERBARREL_ActiveWafer_Length); - //original version of the line above = double Z = (Strip_Pos[i]-0.5)*INNERBARREL_ActiveWafer_Length; TVector3 POS(X,Y,-Z); // since RowPos = (U-D)/(U+D) => Downstream hit (i.e. Z>0) has RowPos<0, thus the sign - POS.RotateZ((5-DetectorNumber[i])*45*deg);// looking downstream Detector 1 is at 3'oclock + POS.RotateZ((5-DetectorNumber[i])*45*deg);// looking downstream Detector 1 is at 3 o'clock return( POS ) ; } /////////////////////////////////////////////////////////////////////////////// @@ -478,8 +498,9 @@ double TTiaraBarrelPhysics::Cal_Strip_Upstream_E(const int i){ name+= "_UPSTREAM" ; name+= NPL::itoa( m_EventData->GetFrontUpstreamEStripNbr(i) ) ; name+= "_E"; - return CalibrationManager::getInstance()->ApplyCalibration(name, - Match_Strip_Upstream_E(i) ); + double MSEnergy = Match_Strip_Upstream_E(i); + double CalEnergy = CalibrationManager::getInstance()->ApplyCalibration(name,MSEnergy); + return CalEnergy ; } /////////////////////////////////////////////////////////////////////////////// double TTiaraBarrelPhysics::Cal_Strip_Downstream_E(const int i){ @@ -488,8 +509,9 @@ double TTiaraBarrelPhysics::Cal_Strip_Downstream_E(const int i){ name+= "_DOWNSTREAM" ; name+= NPL::itoa( m_EventData->GetFrontDownstreamEStripNbr(i) ) ; name+= "_E"; - return CalibrationManager::getInstance()->ApplyCalibration(name, - Match_Strip_Downstream_E(i) ); + double MSEnergy = Match_Strip_Downstream_E(i); + double CalEnergy = CalibrationManager::getInstance()->ApplyCalibration(name, MSEnergy); + return CalEnergy ; } /////////////////////////////////////////////////////////////////////////////// double TTiaraBarrelPhysics::Match_Strip_Upstream_E(const int i){ @@ -498,8 +520,9 @@ double TTiaraBarrelPhysics::Match_Strip_Upstream_E(const int i){ name+= "_UPSTREAM" ; name+= NPL::itoa( m_EventData->GetFrontUpstreamEStripNbr(i) ) ; name+= "_MATCHSTICK"; - return CalibrationManager::getInstance()->ApplyCalibration(name, - m_EventData->GetFrontUpstreamEEnergy(i) ); + double RawEnergy = m_EventData->GetFrontUpstreamEEnergy(i); + double MSEnergy = CalibrationManager::getInstance()->ApplyCalibration(name,RawEnergy); + return MSEnergy ; } /////////////////////////////////////////////////////////////////////////////// double TTiaraBarrelPhysics::Match_Strip_Downstream_E(const int i){ @@ -508,8 +531,9 @@ double TTiaraBarrelPhysics::Match_Strip_Downstream_E(const int i){ name+= "_DOWNSTREAM" ; name+= NPL::itoa( m_EventData->GetFrontDownstreamEStripNbr(i) ) ; name+= "_MATCHSTICK"; - return CalibrationManager::getInstance()->ApplyCalibration(name, - m_EventData->GetFrontDownstreamEEnergy(i) ); + double RawEnergy = m_EventData->GetFrontDownstreamEEnergy(i); + double MSEnergy = CalibrationManager::getInstance()->ApplyCalibration(name,RawEnergy); + return MSEnergy; } /////////////////////////////////////////////////////////////////////////////// double TTiaraBarrelPhysics::Cal_Back_E(const int i){ -- GitLab