From 4d8a5b4dbfb0e34ca6f8e68ed0c4cd081bda6844 Mon Sep 17 00:00:00 2001
From: moukaddam <mhd.moukaddam@gmail.com>
Date: Tue, 7 Mar 2017 13:53:40 +0000
Subject: [PATCH] Randomizing uniformaly with GeTAMU uncalibrated energies

---
 NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx
index 8d01f06b5..84e90a116 100644
--- a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx
+++ b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx
@@ -38,6 +38,9 @@ using namespace NPUNITS;
 
 //   ROOT
 #include "TChain.h"
+#include "TRandom3.h"
+
+TRandom *Random = new TRandom3();
 ///////////////////////////////////////////////////////////////////////////
 
 ClassImp(TGeTAMUPhysics)
@@ -194,7 +197,7 @@ void TGeTAMUPhysics::PreTreat(){
       clover = m_EventData->GetCoreCloverNbrE(i);
       crystal = m_EventData->GetCoreCrystalNbrE(i);
       name = "GETAMU/D"+ NPL::itoa(clover)+"_CRY"+ NPL::itoa(crystal);
-      Energy =  cal->ApplyCalibration(name+"_E", Eraw);
+      Energy =  cal->ApplyCalibration(name+"_E", Eraw+Random->Rndm());
       Singles_CloverMap_CryEN[clover].push_back(crystal);
       Singles_CloverMap_CryE[clover].push_back(Energy);
       m_PreTreatedData->SetCoreE(clover,crystal,Energy);
@@ -207,7 +210,7 @@ void TGeTAMUPhysics::PreTreat(){
       clover = m_EventData->GetCoreCloverNbrT(i);
       crystal = m_EventData->GetCoreCrystalNbrT(i);
       name = "GETAMU/D"+ NPL::itoa(clover)+"_CRY"+ NPL::itoa(crystal);
-      Time =  cal->ApplyCalibration(name+"_T", Traw);
+      Time =  cal->ApplyCalibration(name+"_T", Traw+Random->Rndm());
       Singles_CloverMap_CryTN[clover].push_back(crystal);
       Singles_CloverMap_CryT[clover].push_back(Time);
       m_PreTreatedData->SetCoreT(clover,crystal,Time);
@@ -221,7 +224,7 @@ void TGeTAMUPhysics::PreTreat(){
       clover = m_EventData->GetSegmentCloverNbrE(i);
       segment = m_EventData->GetSegmentSegmentNbrE(i);
       name = "GETAMU/D"+ NPL::itoa(clover)+"_SEG"+ NPL::itoa(segment);
-      Energy =  cal->ApplyCalibration(name+"_E", Eraw);
+      Energy =  cal->ApplyCalibration(name+"_E", Eraw+Random->Rndm());
       Singles_CloverMap_SegEN[clover].push_back(segment);
       Singles_CloverMap_SegE[clover].push_back(Energy);
       m_PreTreatedData->SetSegmentE(clover,segment,Energy);
@@ -235,7 +238,7 @@ void TGeTAMUPhysics::PreTreat(){
       clover = m_EventData->GetSegmentCloverNbrT(i);
       segment = m_EventData->GetSegmentSegmentNbrT(i);
       name = "GETAMU/D"+ NPL::itoa(clover)+"_SEG"+ NPL::itoa(segment);
-      Time =  cal->ApplyCalibration(name+"_T", Traw);
+      Time =  cal->ApplyCalibration(name+"_T", Traw+Random->Rndm());
       Singles_CloverMap_CryTN[clover].push_back(segment);
       Singles_CloverMap_CryT[clover].push_back(Time);
       m_PreTreatedData->SetSegmentT(clover,segment,Time);
-- 
GitLab