diff --git a/Detector/DetDriftChamber/CMakeLists.txt b/Detector/DetDriftChamber/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4a95aeec670ffdb3aa03e681041fb559964f2743
--- /dev/null
+++ b/Detector/DetDriftChamber/CMakeLists.txt
@@ -0,0 +1,37 @@
+###############################################################################
+# Package: DetDriftChamber 
+# Based on package: lcgeo
+################################################################################
+gaudi_subdir(DetDriftChamber v0r0)
+
+gaudi_depends_on_subdirs(GaudiKernel)
+
+
+find_package(DD4hep COMPONENTS DDRec DDG4 DDParsers REQUIRED)
+find_package(Geant4)
+include(${Geant4_USE_FILE})
+
+set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH}  ${DD4hep_ROOT}/cmake )
+include( DD4hep )
+
+find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED)
+
+install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetDriftChamber)
+
+set(DetDriftChamber_src
+    src/driftchamber/DriftChamber.cpp
+)
+
+gaudi_add_module(DetDriftChamber
+                  ${DetDriftChamber_src}
+		  INCLUDE_DIRS
+                  # DD4hep ROOT Geant4 src/include
+		  LINK_LIBRARIES 
+                  # GaudiKernel 
+                  DD4hep ${DD4hep_COMPONENT_LIBRARIES} 
+                  # ROOT Geant4
+)
+
+set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
+dd4hep_generate_rootmap(DetDriftChamber)
diff --git a/Detector/DetDriftChamber/compact/det.xml b/Detector/DetDriftChamber/compact/det.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c5f080cabfaf57df907032b1c04055f84cfef414
--- /dev/null
+++ b/Detector/DetDriftChamber/compact/det.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lccdd>
+ 
+  <info name="DriftChamber"
+	title="Test with Drift Chamber"
+	author="Tao Lin"
+	url="http://github.com/cepc/CEPCSW"
+	status="development"
+	version="v0">
+    <comment>Test with Drift Chamber</comment>        
+  </info>
+
+  <includes>
+    <gdmlFile  ref="elements.xml"/>
+    <gdmlFile  ref="materials.xml"/>
+  </includes>
+
+  <define>
+    <constant name="world_size" value="30*m"/>
+    <constant name="world_x" value="world_size"/>
+    <constant name="world_y" value="world_size"/>
+    <constant name="world_z" value="world_size"/>
+
+    <!-- SDT -->
+    <constant name="SDT_radius_min" value="235*mm"/>
+    <constant name="SDT_radius_max" value="1716*mm"/>
+    <constant name="SDT_half_length" value="2225*mm"/>
+    <constant name="SDT_length" value="SDT_half_length*2"/>
+
+    <constant name="SDT_inner_chamber_radius_min" value="SDT_radius_min"/>
+    <constant name="SDT_inner_chamber_radius_max" value="909*mm"/>
+    <constant name="SDT_inner_chamber_length" value="SDT_length"/>
+
+    <constant name="SDT_outer_chamber_radius_min" value="1085*mm"/>
+    <constant name="SDT_outer_chamber_radius_max" value="SDT_radius_max"/>
+    <constant name="SDT_outer_chamber_length" value="SDT_length"/>
+    
+
+  </define>
+
+  <display>
+    <vis name="Invisible" showDaughters="false" visible="false"/>
+    <vis name="InvisibleWithChildren" showDaughters="true" visible="false"/>
+    <vis name="VisibleRed"  r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/>
+    <vis name="VisibleBlue" r="0.0" g="0.0" b="1.0" showDaughters="false" visible="true"/>
+    <vis name="VisibleGreen" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" lineStyle="solid" showDaughters="true" visible="true"/>
+  </display>
+
+  <detectors>
+    <detector id="1" name="DriftChamber" type="DriftChamber" readout="DriftChamberHitsCollection" vis="VisibleBlue" sensitive="true">
+      <!-- Use cm as unit if you want to use Pandora for reconstruction -->
+    </detector>
+  </detectors>
+  
+  <readouts>
+    <readout name="DriftChamberHitsCollection">
+      <!-- <segmentation type="NoSegmentation"/> -->
+
+      <segmentation type="CartesianGridXYZ"
+                    grid_size_x="1*cm"
+                    grid_size_y="1*cm"
+                    grid_size_z="1*cm"/>
+      <id>system:8,chamber:1,x:-16,y:-16,z:-16</id>
+    </readout>
+  </readouts>
+
+  <fields>
+
+    <field name="MagnetFields_Constant" type="ConstantField" field="magnetic">
+      <strength x="0" y="0" z="3.0*tesla"/>
+    </field>
+
+  </fields>
+
+</lccdd>
diff --git a/Detector/DetDriftChamber/compact/elements.xml b/Detector/DetDriftChamber/compact/elements.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e714c3a5cd544e748dd2941967cff515c0b77efc
--- /dev/null
+++ b/Detector/DetDriftChamber/compact/elements.xml
@@ -0,0 +1,884 @@
+<materials>
+ <element Z="89" formula="Ac" name="Ac" >
+  <atom type="A" unit="g/mol" value="227.028" />
+ </element>
+ <material formula="Ac" name="Actinium" state="solid" >
+  <RL type="X0" unit="cm" value="0.601558" />
+  <NIL type="lambda" unit="cm" value="21.2048" />
+  <D type="density" unit="g/cm3" value="10.07" />
+  <composite n="1" ref="Ac" />
+ </material>
+ <element Z="47" formula="Ag" name="Ag" >
+  <atom type="A" unit="g/mol" value="107.868" />
+ </element>
+ <material formula="Ag" name="Silver" state="solid" >
+  <RL type="X0" unit="cm" value="0.854292" />
+  <NIL type="lambda" unit="cm" value="15.8546" />
+  <D type="density" unit="g/cm3" value="10.5" />
+  <composite n="1" ref="Ag" />
+ </material>
+ <element Z="13" formula="Al" name="Al" >
+  <atom type="A" unit="g/mol" value="26.9815" />
+ </element>
+ <material formula="Al" name="Aluminum" state="solid" >
+  <RL type="X0" unit="cm" value="8.89632" />
+  <NIL type="lambda" unit="cm" value="38.8766" />
+  <D type="density" unit="g/cm3" value="2.699" />
+  <composite n="1" ref="Al" />
+ </material>
+ <element Z="95" formula="Am" name="Am" >
+  <atom type="A" unit="g/mol" value="243.061" />
+ </element>
+ <material formula="Am" name="Americium" state="solid" >
+  <RL type="X0" unit="cm" value="0.42431" />
+  <NIL type="lambda" unit="cm" value="15.9812" />
+  <D type="density" unit="g/cm3" value="13.67" />
+  <composite n="1" ref="Am" />
+ </material>
+ <element Z="18" formula="Ar" name="Ar" >
+  <atom type="A" unit="g/mol" value="39.9477" />
+ </element>
+ <material formula="Ar" name="Argon" state="gas" >
+  <RL type="X0" unit="cm" value="11762.1" />
+  <NIL type="lambda" unit="cm" value="71926" />
+  <D type="density" unit="g/cm3" value="0.00166201" />
+  <composite n="1" ref="Ar" />
+ </material>
+ <element Z="33" formula="As" name="As" >
+  <atom type="A" unit="g/mol" value="74.9216" />
+ </element>
+ <material formula="As" name="Arsenic" state="solid" >
+  <RL type="X0" unit="cm" value="2.0838" />
+  <NIL type="lambda" unit="cm" value="25.7324" />
+  <D type="density" unit="g/cm3" value="5.73" />
+  <composite n="1" ref="As" />
+ </material>
+ <element Z="85" formula="At" name="At" >
+  <atom type="A" unit="g/mol" value="209.987" />
+ </element>
+ <material formula="At" name="Astatine" state="solid" >
+  <RL type="X0" unit="cm" value="0.650799" />
+  <NIL type="lambda" unit="cm" value="22.3202" />
+  <D type="density" unit="g/cm3" value="9.32" />
+  <composite n="1" ref="At" />
+ </material>
+ <element Z="79" formula="Au" name="Au" >
+  <atom type="A" unit="g/mol" value="196.967" />
+ </element>
+ <material formula="Au" name="Gold" state="solid" >
+  <RL type="X0" unit="cm" value="0.334436" />
+  <NIL type="lambda" unit="cm" value="10.5393" />
+  <D type="density" unit="g/cm3" value="19.32" />
+  <composite n="1" ref="Au" />
+ </material>
+ <element Z="5" formula="B" name="B" >
+  <atom type="A" unit="g/mol" value="10.811" />
+ </element>
+ <material formula="B" name="Boron" state="solid" >
+  <RL type="X0" unit="cm" value="22.2307" />
+  <NIL type="lambda" unit="cm" value="32.2793" />
+  <D type="density" unit="g/cm3" value="2.37" />
+  <composite n="1" ref="B" />
+ </material>
+ <element Z="56" formula="Ba" name="Ba" >
+  <atom type="A" unit="g/mol" value="137.327" />
+ </element>
+ <material formula="Ba" name="Barium" state="solid" >
+  <RL type="X0" unit="cm" value="2.37332" />
+  <NIL type="lambda" unit="cm" value="51.6743" />
+  <D type="density" unit="g/cm3" value="3.5" />
+  <composite n="1" ref="Ba" />
+ </material>
+ <element Z="4" formula="Be" name="Be" >
+  <atom type="A" unit="g/mol" value="9.01218" />
+ </element>
+ <material formula="Be" name="Beryllium" state="solid" >
+  <RL type="X0" unit="cm" value="35.276" />
+  <NIL type="lambda" unit="cm" value="39.4488" />
+  <D type="density" unit="g/cm3" value="1.848" />
+  <composite n="1" ref="Be" />
+ </material>
+ <element Z="83" formula="Bi" name="Bi" >
+  <atom type="A" unit="g/mol" value="208.98" />
+ </element>
+ <material formula="Bi" name="Bismuth" state="solid" >
+  <RL type="X0" unit="cm" value="0.645388" />
+  <NIL type="lambda" unit="cm" value="21.3078" />
+  <D type="density" unit="g/cm3" value="9.747" />
+  <composite n="1" ref="Bi" />
+ </material>
+ <element Z="97" formula="Bk" name="Bk" >
+  <atom type="A" unit="g/mol" value="247.07" />
+ </element>
+ <material formula="Bk" name="Berkelium" state="solid" >
+  <RL type="X0" unit="cm" value="0.406479" />
+  <NIL type="lambda" unit="cm" value="15.6902" />
+  <D type="density" unit="g/cm3" value="14" />
+  <composite n="1" ref="Bk" />
+ </material>
+ <element Z="35" formula="Br" name="Br" >
+  <atom type="A" unit="g/mol" value="79.9035" />
+ </element>
+ <material formula="Br" name="Bromine" state="gas" >
+  <RL type="X0" unit="cm" value="1615.12" />
+  <NIL type="lambda" unit="cm" value="21299" />
+  <D type="density" unit="g/cm3" value="0.0070721" />
+  <composite n="1" ref="Br" />
+ </material>
+ <element Z="6" formula="C" name="C" >
+  <atom type="A" unit="g/mol" value="12.0107" />
+ </element>
+ <material formula="C" name="Carbon" state="solid" >
+  <RL type="X0" unit="cm" value="21.3485" />
+  <NIL type="lambda" unit="cm" value="40.1008" />
+  <D type="density" unit="g/cm3" value="2" />
+  <composite n="1" ref="C" />
+ </material>
+ <element Z="20" formula="Ca" name="Ca" >
+  <atom type="A" unit="g/mol" value="40.078" />
+ </element>
+ <material formula="Ca" name="Calcium" state="solid" >
+  <RL type="X0" unit="cm" value="10.4151" />
+  <NIL type="lambda" unit="cm" value="77.3754" />
+  <D type="density" unit="g/cm3" value="1.55" />
+  <composite n="1" ref="Ca" />
+ </material>
+ <element Z="48" formula="Cd" name="Cd" >
+  <atom type="A" unit="g/mol" value="112.411" />
+ </element>
+ <material formula="Cd" name="Cadmium" state="solid" >
+  <RL type="X0" unit="cm" value="1.03994" />
+  <NIL type="lambda" unit="cm" value="19.46" />
+  <D type="density" unit="g/cm3" value="8.65" />
+  <composite n="1" ref="Cd" />
+ </material>
+ <element Z="58" formula="Ce" name="Ce" >
+  <atom type="A" unit="g/mol" value="140.115" />
+ </element>
+ <material formula="Ce" name="Cerium" state="solid" >
+  <RL type="X0" unit="cm" value="1.19506" />
+  <NIL type="lambda" unit="cm" value="27.3227" />
+  <D type="density" unit="g/cm3" value="6.657" />
+  <composite n="1" ref="Ce" />
+ </material>
+ <element Z="98" formula="Cf" name="Cf" >
+  <atom type="A" unit="g/mol" value="251.08" />
+ </element>
+ <material formula="Cf" name="Californium" state="solid" >
+  <RL type="X0" unit="cm" value="0.568328" />
+  <NIL type="lambda" unit="cm" value="22.085" />
+  <D type="density" unit="g/cm3" value="10" />
+  <composite n="1" ref="Cf" />
+ </material>
+ <element Z="17" formula="Cl" name="Cl" >
+  <atom type="A" unit="g/mol" value="35.4526" />
+ </element>
+ <material formula="Cl" name="Chlorine" state="gas" >
+  <RL type="X0" unit="cm" value="6437.34" />
+  <NIL type="lambda" unit="cm" value="38723.9" />
+  <D type="density" unit="g/cm3" value="0.00299473" />
+  <composite n="1" ref="Cl" />
+ </material>
+ <element Z="96" formula="Cm" name="Cm" >
+  <atom type="A" unit="g/mol" value="247.07" />
+ </element>
+ <material formula="Cm" name="Curium" state="solid" >
+  <RL type="X0" unit="cm" value="0.428706" />
+  <NIL type="lambda" unit="cm" value="16.2593" />
+  <D type="density" unit="g/cm3" value="13.51" />
+  <composite n="1" ref="Cm" />
+ </material>
+ <element Z="27" formula="Co" name="Co" >
+  <atom type="A" unit="g/mol" value="58.9332" />
+ </element>
+ <material formula="Co" name="Cobalt" state="solid" >
+  <RL type="X0" unit="cm" value="1.53005" />
+  <NIL type="lambda" unit="cm" value="15.2922" />
+  <D type="density" unit="g/cm3" value="8.9" />
+  <composite n="1" ref="Co" />
+ </material>
+ <element Z="24" formula="Cr" name="Cr" >
+  <atom type="A" unit="g/mol" value="51.9961" />
+ </element>
+ <material formula="Cr" name="Chromium" state="solid" >
+  <RL type="X0" unit="cm" value="2.0814" />
+  <NIL type="lambda" unit="cm" value="18.1933" />
+  <D type="density" unit="g/cm3" value="7.18" />
+  <composite n="1" ref="Cr" />
+ </material>
+ <element Z="55" formula="Cs" name="Cs" >
+  <atom type="A" unit="g/mol" value="132.905" />
+ </element>
+ <material formula="Cs" name="Cesium" state="solid" >
+  <RL type="X0" unit="cm" value="4.4342" />
+  <NIL type="lambda" unit="cm" value="95.317" />
+  <D type="density" unit="g/cm3" value="1.873" />
+  <composite n="1" ref="Cs" />
+ </material>
+ <element Z="29" formula="Cu" name="Cu" >
+  <atom type="A" unit="g/mol" value="63.5456" />
+ </element>
+ <material formula="Cu" name="Copper" state="solid" >
+  <RL type="X0" unit="cm" value="1.43558" />
+  <NIL type="lambda" unit="cm" value="15.5141" />
+  <D type="density" unit="g/cm3" value="8.96" />
+  <composite n="1" ref="Cu" />
+ </material>
+ <element Z="66" formula="Dy" name="Dy" >
+  <atom type="A" unit="g/mol" value="162.497" />
+ </element>
+ <material formula="Dy" name="Dysprosium" state="solid" >
+  <RL type="X0" unit="cm" value="0.85614" />
+  <NIL type="lambda" unit="cm" value="22.2923" />
+  <D type="density" unit="g/cm3" value="8.55" />
+  <composite n="1" ref="Dy" />
+ </material>
+ <element Z="68" formula="Er" name="Er" >
+  <atom type="A" unit="g/mol" value="167.256" />
+ </element>
+ <material formula="Er" name="Erbium" state="solid" >
+  <RL type="X0" unit="cm" value="0.788094" />
+  <NIL type="lambda" unit="cm" value="21.2923" />
+  <D type="density" unit="g/cm3" value="9.066" />
+  <composite n="1" ref="Er" />
+ </material>
+ <element Z="63" formula="Eu" name="Eu" >
+  <atom type="A" unit="g/mol" value="151.964" />
+ </element>
+ <material formula="Eu" name="Europium" state="solid" >
+  <RL type="X0" unit="cm" value="1.41868" />
+  <NIL type="lambda" unit="cm" value="35.6178" />
+  <D type="density" unit="g/cm3" value="5.243" />
+  <composite n="1" ref="Eu" />
+ </material>
+ <element Z="9" formula="F" name="F" >
+  <atom type="A" unit="g/mol" value="18.9984" />
+ </element>
+ <material formula="F" name="Fluorine" state="gas" >
+  <RL type="X0" unit="cm" value="20838.2" />
+  <NIL type="lambda" unit="cm" value="59094.3" />
+  <D type="density" unit="g/cm3" value="0.00158029" />
+  <composite n="1" ref="F" />
+ </material>
+ <element Z="26" formula="Fe" name="Fe" >
+  <atom type="A" unit="g/mol" value="55.8451" />
+ </element>
+ <material formula="Fe" name="Iron" state="solid" >
+  <RL type="X0" unit="cm" value="1.75749" />
+  <NIL type="lambda" unit="cm" value="16.959" />
+  <D type="density" unit="g/cm3" value="7.874" />
+  <composite n="1" ref="Fe" />
+ </material>
+ <element Z="87" formula="Fr" name="Fr" >
+  <atom type="A" unit="g/mol" value="223.02" />
+ </element>
+ <material formula="Fr" name="Francium" state="solid" >
+  <RL type="X0" unit="cm" value="6.18826" />
+  <NIL type="lambda" unit="cm" value="212.263" />
+  <D type="density" unit="g/cm3" value="1" />
+  <composite n="1" ref="Fr" />
+ </material>
+ <element Z="31" formula="Ga" name="Ga" >
+  <atom type="A" unit="g/mol" value="69.7231" />
+ </element>
+ <material formula="Ga" name="Gallium" state="solid" >
+  <RL type="X0" unit="cm" value="2.1128" />
+  <NIL type="lambda" unit="cm" value="24.3351" />
+  <D type="density" unit="g/cm3" value="5.904" />
+  <composite n="1" ref="Ga" />
+ </material>
+ <element Z="64" formula="Gd" name="Gd" >
+  <atom type="A" unit="g/mol" value="157.252" />
+ </element>
+ <material formula="Gd" name="Gadolinium" state="solid" >
+  <RL type="X0" unit="cm" value="0.947208" />
+  <NIL type="lambda" unit="cm" value="23.9377" />
+  <D type="density" unit="g/cm3" value="7.9004" />
+  <composite n="1" ref="Gd" />
+ </material>
+ <element Z="32" formula="Ge" name="Ge" >
+  <atom type="A" unit="g/mol" value="72.6128" />
+ </element>
+ <material formula="Ge" name="Germanium" state="solid" >
+  <RL type="X0" unit="cm" value="2.3013" />
+  <NIL type="lambda" unit="cm" value="27.3344" />
+  <D type="density" unit="g/cm3" value="5.323" />
+  <composite n="1" ref="Ge" />
+ </material>
+ <element Z="1" formula="H" name="H" >
+  <atom type="A" unit="g/mol" value="1.00794" />
+ </element>
+ <material formula="H" name="Hydrogen" state="gas" >
+  <RL type="X0" unit="cm" value="752776" />
+  <NIL type="lambda" unit="cm" value="421239" />
+  <D type="density" unit="g/cm3" value="8.3748e-05" />
+  <composite n="1" ref="H" />
+ </material>
+ <element Z="2" formula="He" name="He" >
+  <atom type="A" unit="g/mol" value="4.00264" />
+ </element>
+ <material formula="He" name="Helium" state="gas" >
+  <RL type="X0" unit="cm" value="567113" />
+  <NIL type="lambda" unit="cm" value="334266" />
+  <D type="density" unit="g/cm3" value="0.000166322" />
+  <composite n="1" ref="He" />
+ </material>
+ <element Z="72" formula="Hf" name="Hf" >
+  <atom type="A" unit="g/mol" value="178.485" />
+ </element>
+ <material formula="Hf" name="Hafnium" state="solid" >
+  <RL type="X0" unit="cm" value="0.517717" />
+  <NIL type="lambda" unit="cm" value="14.7771" />
+  <D type="density" unit="g/cm3" value="13.31" />
+  <composite n="1" ref="Hf" />
+ </material>
+ <element Z="80" formula="Hg" name="Hg" >
+  <atom type="A" unit="g/mol" value="200.599" />
+ </element>
+ <material formula="Hg" name="Mercury" state="solid" >
+  <RL type="X0" unit="cm" value="0.475241" />
+  <NIL type="lambda" unit="cm" value="15.105" />
+  <D type="density" unit="g/cm3" value="13.546" />
+  <composite n="1" ref="Hg" />
+ </material>
+ <element Z="67" formula="Ho" name="Ho" >
+  <atom type="A" unit="g/mol" value="164.93" />
+ </element>
+ <material formula="Ho" name="Holmium" state="solid" >
+  <RL type="X0" unit="cm" value="0.822447" />
+  <NIL type="lambda" unit="cm" value="21.8177" />
+  <D type="density" unit="g/cm3" value="8.795" />
+  <composite n="1" ref="Ho" />
+ </material>
+ <element Z="53" formula="I" name="I" >
+  <atom type="A" unit="g/mol" value="126.904" />
+ </element>
+ <material formula="I" name="Iodine" state="solid" >
+  <RL type="X0" unit="cm" value="1.72016" />
+  <NIL type="lambda" unit="cm" value="35.6583" />
+  <D type="density" unit="g/cm3" value="4.93" />
+  <composite n="1" ref="I" />
+ </material>
+ <element Z="49" formula="In" name="In" >
+  <atom type="A" unit="g/mol" value="114.818" />
+ </element>
+ <material formula="In" name="Indium" state="solid" >
+  <RL type="X0" unit="cm" value="1.21055" />
+  <NIL type="lambda" unit="cm" value="23.2468" />
+  <D type="density" unit="g/cm3" value="7.31" />
+  <composite n="1" ref="In" />
+ </material>
+ <element Z="77" formula="Ir" name="Ir" >
+  <atom type="A" unit="g/mol" value="192.216" />
+ </element>
+ <material formula="Ir" name="Iridium" state="solid" >
+  <RL type="X0" unit="cm" value="0.294142" />
+  <NIL type="lambda" unit="cm" value="9.01616" />
+  <D type="density" unit="g/cm3" value="22.42" />
+  <composite n="1" ref="Ir" />
+ </material>
+ <element Z="19" formula="K" name="K" >
+  <atom type="A" unit="g/mol" value="39.0983" />
+ </element>
+ <material formula="K" name="Potassium" state="solid" >
+  <RL type="X0" unit="cm" value="20.0871" />
+  <NIL type="lambda" unit="cm" value="138.041" />
+  <D type="density" unit="g/cm3" value="0.862" />
+  <composite n="1" ref="K" />
+ </material>
+ <element Z="36" formula="Kr" name="Kr" >
+  <atom type="A" unit="g/mol" value="83.7993" />
+ </element>
+ <material formula="Kr" name="Krypton" state="gas" >
+  <RL type="X0" unit="cm" value="3269.44" />
+  <NIL type="lambda" unit="cm" value="43962.9" />
+  <D type="density" unit="g/cm3" value="0.00347832" />
+  <composite n="1" ref="Kr" />
+ </material>
+ <element Z="57" formula="La" name="La" >
+  <atom type="A" unit="g/mol" value="138.905" />
+ </element>
+ <material formula="La" name="Lanthanum" state="solid" >
+  <RL type="X0" unit="cm" value="1.32238" />
+  <NIL type="lambda" unit="cm" value="29.441" />
+  <D type="density" unit="g/cm3" value="6.154" />
+  <composite n="1" ref="La" />
+ </material>
+ <element Z="3" formula="Li" name="Li" >
+  <atom type="A" unit="g/mol" value="6.94003" />
+ </element>
+ <material formula="Li" name="Lithium" state="solid" >
+  <RL type="X0" unit="cm" value="154.997" />
+  <NIL type="lambda" unit="cm" value="124.305" />
+  <D type="density" unit="g/cm3" value="0.534" />
+  <composite n="1" ref="Li" />
+ </material>
+ <element Z="71" formula="Lu" name="Lu" >
+  <atom type="A" unit="g/mol" value="174.967" />
+ </element>
+ <material formula="Lu" name="Lutetium" state="solid" >
+  <RL type="X0" unit="cm" value="0.703651" />
+  <NIL type="lambda" unit="cm" value="19.8916" />
+  <D type="density" unit="g/cm3" value="9.84" />
+  <composite n="1" ref="Lu" />
+ </material>
+ <element Z="12" formula="Mg" name="Mg" >
+  <atom type="A" unit="g/mol" value="24.305" />
+ </element>
+ <material formula="Mg" name="Magnesium" state="solid" >
+  <RL type="X0" unit="cm" value="14.3859" />
+  <NIL type="lambda" unit="cm" value="58.7589" />
+  <D type="density" unit="g/cm3" value="1.74" />
+  <composite n="1" ref="Mg" />
+ </material>
+ <element Z="25" formula="Mn" name="Mn" >
+  <atom type="A" unit="g/mol" value="54.938" />
+ </element>
+ <material formula="Mn" name="Manganese" state="solid" >
+  <RL type="X0" unit="cm" value="1.96772" />
+  <NIL type="lambda" unit="cm" value="17.8701" />
+  <D type="density" unit="g/cm3" value="7.44" />
+  <composite n="1" ref="Mn" />
+ </material>
+ <element Z="42" formula="Mo" name="Mo" >
+  <atom type="A" unit="g/mol" value="95.9313" />
+ </element>
+ <material formula="Mo" name="Molybdenum" state="solid" >
+  <RL type="X0" unit="cm" value="0.959107" />
+  <NIL type="lambda" unit="cm" value="15.6698" />
+  <D type="density" unit="g/cm3" value="10.22" />
+  <composite n="1" ref="Mo" />
+ </material>
+ <element Z="7" formula="N" name="N" >
+  <atom type="A" unit="g/mol" value="14.0068" />
+ </element>
+ <material formula="N" name="Nitrogen" state="gas" >
+  <RL type="X0" unit="cm" value="32602.2" />
+  <NIL type="lambda" unit="cm" value="72430.3" />
+  <D type="density" unit="g/cm3" value="0.0011652" />
+  <composite n="1" ref="N" />
+ </material>
+ <element Z="11" formula="Na" name="Na" >
+  <atom type="A" unit="g/mol" value="22.9898" />
+ </element>
+ <material formula="Na" name="Sodium" state="solid" >
+  <RL type="X0" unit="cm" value="28.5646" />
+  <NIL type="lambda" unit="cm" value="102.463" />
+  <D type="density" unit="g/cm3" value="0.971" />
+  <composite n="1" ref="Na" />
+ </material>
+ <element Z="41" formula="Nb" name="Nb" >
+  <atom type="A" unit="g/mol" value="92.9064" />
+ </element>
+ <material formula="Nb" name="Niobium" state="solid" >
+  <RL type="X0" unit="cm" value="1.15783" />
+  <NIL type="lambda" unit="cm" value="18.4846" />
+  <D type="density" unit="g/cm3" value="8.57" />
+  <composite n="1" ref="Nb" />
+ </material>
+ <element Z="60" formula="Nd" name="Nd" >
+  <atom type="A" unit="g/mol" value="144.236" />
+ </element>
+ <material formula="Nd" name="Neodymium" state="solid" >
+  <RL type="X0" unit="cm" value="1.11667" />
+  <NIL type="lambda" unit="cm" value="26.6308" />
+  <D type="density" unit="g/cm3" value="6.9" />
+  <composite n="1" ref="Nd" />
+ </material>
+ <element Z="10" formula="Ne" name="Ne" >
+  <atom type="A" unit="g/mol" value="20.18" />
+ </element>
+ <material formula="Ne" name="Neon" state="gas" >
+  <RL type="X0" unit="cm" value="34504.8" />
+  <NIL type="lambda" unit="cm" value="114322" />
+  <D type="density" unit="g/cm3" value="0.000838505" />
+  <composite n="1" ref="Ne" />
+ </material>
+ <element Z="28" formula="Ni" name="Ni" >
+  <atom type="A" unit="g/mol" value="58.6933" />
+ </element>
+ <material formula="Ni" name="Nickel" state="solid" >
+  <RL type="X0" unit="cm" value="1.42422" />
+  <NIL type="lambda" unit="cm" value="15.2265" />
+  <D type="density" unit="g/cm3" value="8.902" />
+  <composite n="1" ref="Ni" />
+ </material>
+ <element Z="93" formula="Np" name="Np" >
+  <atom type="A" unit="g/mol" value="237.048" />
+ </element>
+ <material formula="Np" name="Neptunium" state="solid" >
+  <RL type="X0" unit="cm" value="0.289676" />
+  <NIL type="lambda" unit="cm" value="10.6983" />
+  <D type="density" unit="g/cm3" value="20.25" />
+  <composite n="1" ref="Np" />
+ </material>
+ <element Z="8" formula="O" name="O" >
+  <atom type="A" unit="g/mol" value="15.9994" />
+ </element>
+ <material formula="O" name="Oxygen" state="gas" >
+  <RL type="X0" unit="cm" value="25713.8" />
+  <NIL type="lambda" unit="cm" value="66233.9" />
+  <D type="density" unit="g/cm3" value="0.00133151" />
+  <composite n="1" ref="O" />
+ </material>
+ <element Z="76" formula="Os" name="Os" >
+  <atom type="A" unit="g/mol" value="190.225" />
+ </element>
+ <material formula="Os" name="Osmium" state="solid" >
+  <RL type="X0" unit="cm" value="0.295861" />
+  <NIL type="lambda" unit="cm" value="8.92553" />
+  <D type="density" unit="g/cm3" value="22.57" />
+  <composite n="1" ref="Os" />
+ </material>
+ <element Z="15" formula="P" name="P" >
+  <atom type="A" unit="g/mol" value="30.9738" />
+ </element>
+ <material formula="P" name="Phosphorus" state="solid" >
+  <RL type="X0" unit="cm" value="9.63879" />
+  <NIL type="lambda" unit="cm" value="49.9343" />
+  <D type="density" unit="g/cm3" value="2.2" />
+  <composite n="1" ref="P" />
+ </material>
+ <element Z="91" formula="Pa" name="Pa" >
+  <atom type="A" unit="g/mol" value="231.036" />
+ </element>
+ <material formula="Pa" name="Protactinium" state="solid" >
+  <RL type="X0" unit="cm" value="0.38607" />
+  <NIL type="lambda" unit="cm" value="13.9744" />
+  <D type="density" unit="g/cm3" value="15.37" />
+  <composite n="1" ref="Pa" />
+ </material>
+ <element Z="82" formula="Pb" name="Pb" >
+  <atom type="A" unit="g/mol" value="207.217" />
+ </element>
+ <material formula="Pb" name="Lead" state="solid" >
+  <RL type="X0" unit="cm" value="0.561253" />
+  <NIL type="lambda" unit="cm" value="18.2607" />
+  <D type="density" unit="g/cm3" value="11.35" />
+  <composite n="1" ref="Pb" />
+ </material>
+ <element Z="46" formula="Pd" name="Pd" >
+  <atom type="A" unit="g/mol" value="106.415" />
+ </element>
+ <material formula="Pd" name="Palladium" state="solid" >
+  <RL type="X0" unit="cm" value="0.765717" />
+  <NIL type="lambda" unit="cm" value="13.7482" />
+  <D type="density" unit="g/cm3" value="12.02" />
+  <composite n="1" ref="Pd" />
+ </material>
+ <element Z="61" formula="Pm" name="Pm" >
+  <atom type="A" unit="g/mol" value="144.913" />
+ </element>
+ <material formula="Pm" name="Promethium" state="solid" >
+  <RL type="X0" unit="cm" value="1.04085" />
+  <NIL type="lambda" unit="cm" value="25.4523" />
+  <D type="density" unit="g/cm3" value="7.22" />
+  <composite n="1" ref="Pm" />
+ </material>
+ <element Z="84" formula="Po" name="Po" >
+  <atom type="A" unit="g/mol" value="208.982" />
+ </element>
+ <material formula="Po" name="Polonium" state="solid" >
+  <RL type="X0" unit="cm" value="0.661092" />
+  <NIL type="lambda" unit="cm" value="22.2842" />
+  <D type="density" unit="g/cm3" value="9.32" />
+  <composite n="1" ref="Po" />
+ </material>
+ <element Z="59" formula="Pr" name="Pr" >
+  <atom type="A" unit="g/mol" value="140.908" />
+ </element>
+ <material formula="Pr" name="Praseodymium" state="solid" >
+  <RL type="X0" unit="cm" value="1.1562" />
+  <NIL type="lambda" unit="cm" value="27.1312" />
+  <D type="density" unit="g/cm3" value="6.71" />
+  <composite n="1" ref="Pr" />
+ </material>
+ <element Z="78" formula="Pt" name="Pt" >
+  <atom type="A" unit="g/mol" value="195.078" />
+ </element>
+ <material formula="Pt" name="Platinum" state="solid" >
+  <RL type="X0" unit="cm" value="0.305053" />
+  <NIL type="lambda" unit="cm" value="9.46584" />
+  <D type="density" unit="g/cm3" value="21.45" />
+  <composite n="1" ref="Pt" />
+ </material>
+ <element Z="94" formula="Pu" name="Pu" >
+  <atom type="A" unit="g/mol" value="244.064" />
+ </element>
+ <material formula="Pu" name="Plutonium" state="solid" >
+  <RL type="X0" unit="cm" value="0.298905" />
+  <NIL type="lambda" unit="cm" value="11.0265" />
+  <D type="density" unit="g/cm3" value="19.84" />
+  <composite n="1" ref="Pu" />
+ </material>
+ <element Z="88" formula="Ra" name="Ra" >
+  <atom type="A" unit="g/mol" value="226.025" />
+ </element>
+ <material formula="Ra" name="Radium" state="solid" >
+  <RL type="X0" unit="cm" value="1.22987" />
+  <NIL type="lambda" unit="cm" value="42.6431" />
+  <D type="density" unit="g/cm3" value="5" />
+  <composite n="1" ref="Ra" />
+ </material>
+ <element Z="37" formula="Rb" name="Rb" >
+  <atom type="A" unit="g/mol" value="85.4677" />
+ </element>
+ <material formula="Rb" name="Rubidium" state="solid" >
+  <RL type="X0" unit="cm" value="7.19774" />
+  <NIL type="lambda" unit="cm" value="100.218" />
+  <D type="density" unit="g/cm3" value="1.532" />
+  <composite n="1" ref="Rb" />
+ </material>
+ <element Z="75" formula="Re" name="Re" >
+  <atom type="A" unit="g/mol" value="186.207" />
+ </element>
+ <material formula="Re" name="Rhenium" state="solid" >
+  <RL type="X0" unit="cm" value="0.318283" />
+  <NIL type="lambda" unit="cm" value="9.5153" />
+  <D type="density" unit="g/cm3" value="21.02" />
+  <composite n="1" ref="Re" />
+ </material>
+ <element Z="45" formula="Rh" name="Rh" >
+  <atom type="A" unit="g/mol" value="102.906" />
+ </element>
+ <material formula="Rh" name="Rhodium" state="solid" >
+  <RL type="X0" unit="cm" value="0.746619" />
+  <NIL type="lambda" unit="cm" value="13.2083" />
+  <D type="density" unit="g/cm3" value="12.41" />
+  <composite n="1" ref="Rh" />
+ </material>
+ <element Z="86" formula="Rn" name="Rn" >
+  <atom type="A" unit="g/mol" value="222.018" />
+ </element>
+ <material formula="Rn" name="Radon" state="gas" >
+  <RL type="X0" unit="cm" value="697.777" />
+  <NIL type="lambda" unit="cm" value="23532" />
+  <D type="density" unit="g/cm3" value="0.00900662" />
+  <composite n="1" ref="Rn" />
+ </material>
+ <element Z="44" formula="Ru" name="Ru" >
+  <atom type="A" unit="g/mol" value="101.065" />
+ </element>
+ <material formula="Ru" name="Ruthenium" state="solid" >
+  <RL type="X0" unit="cm" value="0.764067" />
+  <NIL type="lambda" unit="cm" value="13.1426" />
+  <D type="density" unit="g/cm3" value="12.41" />
+  <composite n="1" ref="Ru" />
+ </material>
+ <element Z="16" formula="S" name="S" >
+  <atom type="A" unit="g/mol" value="32.0661" />
+ </element>
+ <material formula="S" name="Sulfur" state="solid" >
+  <RL type="X0" unit="cm" value="9.74829" />
+  <NIL type="lambda" unit="cm" value="55.6738" />
+  <D type="density" unit="g/cm3" value="2" />
+  <composite n="1" ref="S" />
+ </material>
+ <element Z="51" formula="Sb" name="Sb" >
+  <atom type="A" unit="g/mol" value="121.76" />
+ </element>
+ <material formula="Sb" name="Antimony" state="solid" >
+  <RL type="X0" unit="cm" value="1.30401" />
+  <NIL type="lambda" unit="cm" value="25.8925" />
+  <D type="density" unit="g/cm3" value="6.691" />
+  <composite n="1" ref="Sb" />
+ </material>
+ <element Z="21" formula="Sc" name="Sc" >
+  <atom type="A" unit="g/mol" value="44.9559" />
+ </element>
+ <material formula="Sc" name="Scandium" state="solid" >
+  <RL type="X0" unit="cm" value="5.53545" />
+  <NIL type="lambda" unit="cm" value="41.609" />
+  <D type="density" unit="g/cm3" value="2.989" />
+  <composite n="1" ref="Sc" />
+ </material>
+ <element Z="34" formula="Se" name="Se" >
+  <atom type="A" unit="g/mol" value="78.9594" />
+ </element>
+ <material formula="Se" name="Selenium" state="solid" >
+  <RL type="X0" unit="cm" value="2.64625" />
+  <NIL type="lambda" unit="cm" value="33.356" />
+  <D type="density" unit="g/cm3" value="4.5" />
+  <composite n="1" ref="Se" />
+ </material>
+ <element Z="14" formula="Si" name="Si" >
+  <atom type="A" unit="g/mol" value="28.0854" />
+ </element>
+ <material formula="Si" name="Silicon" state="solid" >
+  <RL type="X0" unit="cm" value="9.36607" />
+  <NIL type="lambda" unit="cm" value="45.7531" />
+  <D type="density" unit="g/cm3" value="2.33" />
+  <composite n="1" ref="Si" />
+ </material>
+ <element Z="62" formula="Sm" name="Sm" >
+  <atom type="A" unit="g/mol" value="150.366" />
+ </element>
+ <material formula="Sm" name="Samarium" state="solid" >
+  <RL type="X0" unit="cm" value="1.01524" />
+  <NIL type="lambda" unit="cm" value="24.9892" />
+  <D type="density" unit="g/cm3" value="7.46" />
+  <composite n="1" ref="Sm" />
+ </material>
+ <element Z="50" formula="Sn" name="Sn" >
+  <atom type="A" unit="g/mol" value="118.71" />
+ </element>
+ <material formula="Sn" name="Tin" state="solid" >
+  <RL type="X0" unit="cm" value="1.20637" />
+  <NIL type="lambda" unit="cm" value="23.4931" />
+  <D type="density" unit="g/cm3" value="7.31" />
+  <composite n="1" ref="Sn" />
+ </material>
+ <element Z="38" formula="Sr" name="Sr" >
+  <atom type="A" unit="g/mol" value="87.6166" />
+ </element>
+ <material formula="Sr" name="Strontium" state="solid" >
+  <RL type="X0" unit="cm" value="4.237" />
+  <NIL type="lambda" unit="cm" value="61.0238" />
+  <D type="density" unit="g/cm3" value="2.54" />
+  <composite n="1" ref="Sr" />
+ </material>
+ <element Z="73" formula="Ta" name="Ta" >
+  <atom type="A" unit="g/mol" value="180.948" />
+ </element>
+ <material formula="Ta" name="Tantalum" state="solid" >
+  <RL type="X0" unit="cm" value="0.409392" />
+  <NIL type="lambda" unit="cm" value="11.8846" />
+  <D type="density" unit="g/cm3" value="16.654" />
+  <composite n="1" ref="Ta" />
+ </material>
+ <element Z="65" formula="Tb" name="Tb" >
+  <atom type="A" unit="g/mol" value="158.925" />
+ </element>
+ <material formula="Tb" name="Terbium" state="solid" >
+  <RL type="X0" unit="cm" value="0.893977" />
+  <NIL type="lambda" unit="cm" value="23.0311" />
+  <D type="density" unit="g/cm3" value="8.229" />
+  <composite n="1" ref="Tb" />
+ </material>
+ <element Z="43" formula="Tc" name="Tc" >
+  <atom type="A" unit="g/mol" value="97.9072" />
+ </element>
+ <material formula="Tc" name="Technetium" state="solid" >
+  <RL type="X0" unit="cm" value="0.833149" />
+  <NIL type="lambda" unit="cm" value="14.0185" />
+  <D type="density" unit="g/cm3" value="11.5" />
+  <composite n="1" ref="Tc" />
+ </material>
+ <element Z="52" formula="Te" name="Te" >
+  <atom type="A" unit="g/mol" value="127.603" />
+ </element>
+ <material formula="Te" name="Tellurium" state="solid" >
+  <RL type="X0" unit="cm" value="1.41457" />
+  <NIL type="lambda" unit="cm" value="28.1797" />
+  <D type="density" unit="g/cm3" value="6.24" />
+  <composite n="1" ref="Te" />
+ </material>
+ <element Z="90" formula="Th" name="Th" >
+  <atom type="A" unit="g/mol" value="232.038" />
+ </element>
+ <material formula="Th" name="Thorium" state="solid" >
+  <RL type="X0" unit="cm" value="0.51823" />
+  <NIL type="lambda" unit="cm" value="18.353" />
+  <D type="density" unit="g/cm3" value="11.72" />
+  <composite n="1" ref="Th" />
+ </material>
+ <element Z="22" formula="Ti" name="Ti" >
+  <atom type="A" unit="g/mol" value="47.8667" />
+ </element>
+ <material formula="Ti" name="Titanium" state="solid" >
+  <RL type="X0" unit="cm" value="3.5602" />
+  <NIL type="lambda" unit="cm" value="27.9395" />
+  <D type="density" unit="g/cm3" value="4.54" />
+  <composite n="1" ref="Ti" />
+ </material>
+ <element Z="81" formula="Tl" name="Tl" >
+  <atom type="A" unit="g/mol" value="204.383" />
+ </element>
+ <material formula="Tl" name="Thallium" state="solid" >
+  <RL type="X0" unit="cm" value="0.547665" />
+  <NIL type="lambda" unit="cm" value="17.6129" />
+  <D type="density" unit="g/cm3" value="11.72" />
+  <composite n="1" ref="Tl" />
+ </material>
+ <element Z="69" formula="Tm" name="Tm" >
+  <atom type="A" unit="g/mol" value="168.934" />
+ </element>
+ <material formula="Tm" name="Thulium" state="solid" >
+  <RL type="X0" unit="cm" value="0.754428" />
+  <NIL type="lambda" unit="cm" value="20.7522" />
+  <D type="density" unit="g/cm3" value="9.321" />
+  <composite n="1" ref="Tm" />
+ </material>
+ <element Z="92" formula="U" name="U" >
+  <atom type="A" unit="g/mol" value="238.029" />
+ </element>
+ <material formula="U" name="Uranium" state="solid" >
+  <RL type="X0" unit="cm" value="0.31663" />
+  <NIL type="lambda" unit="cm" value="11.4473" />
+  <D type="density" unit="g/cm3" value="18.95" />
+  <composite n="1" ref="U" />
+ </material>
+ <element Z="23" formula="V" name="V" >
+  <atom type="A" unit="g/mol" value="50.9415" />
+ </element>
+ <material formula="V" name="Vanadium" state="solid" >
+  <RL type="X0" unit="cm" value="2.59285" />
+  <NIL type="lambda" unit="cm" value="21.2187" />
+  <D type="density" unit="g/cm3" value="6.11" />
+  <composite n="1" ref="V" />
+ </material>
+ <element Z="74" formula="W" name="W" >
+  <atom type="A" unit="g/mol" value="183.842" />
+ </element>
+ <material formula="W" name="Tungsten" state="solid" >
+  <RL type="X0" unit="cm" value="0.350418" />
+  <NIL type="lambda" unit="cm" value="10.3057" />
+  <D type="density" unit="g/cm3" value="19.3" />
+  <composite n="1" ref="W" />
+ </material>
+ <element Z="54" formula="Xe" name="Xe" >
+  <atom type="A" unit="g/mol" value="131.292" />
+ </element>
+ <material formula="Xe" name="Xenon" state="gas" >
+  <RL type="X0" unit="cm" value="1546.2" />
+  <NIL type="lambda" unit="cm" value="32477.9" />
+  <D type="density" unit="g/cm3" value="0.00548536" />
+  <composite n="1" ref="Xe" />
+ </material>
+ <element Z="39" formula="Y" name="Y" >
+  <atom type="A" unit="g/mol" value="88.9058" />
+ </element>
+ <material formula="Y" name="Yttrium" state="solid" >
+  <RL type="X0" unit="cm" value="2.32943" />
+  <NIL type="lambda" unit="cm" value="34.9297" />
+  <D type="density" unit="g/cm3" value="4.469" />
+  <composite n="1" ref="Y" />
+ </material>
+ <element Z="70" formula="Yb" name="Yb" >
+  <atom type="A" unit="g/mol" value="173.038" />
+ </element>
+ <material formula="Yb" name="Ytterbium" state="solid" >
+  <RL type="X0" unit="cm" value="1.04332" />
+  <NIL type="lambda" unit="cm" value="28.9843" />
+  <D type="density" unit="g/cm3" value="6.73" />
+  <composite n="1" ref="Yb" />
+ </material>
+ <element Z="30" formula="Zn" name="Zn" >
+  <atom type="A" unit="g/mol" value="65.3955" />
+ </element>
+ <material formula="Zn" name="Zinc" state="solid" >
+  <RL type="X0" unit="cm" value="1.74286" />
+  <NIL type="lambda" unit="cm" value="19.8488" />
+  <D type="density" unit="g/cm3" value="7.133" />
+  <composite n="1" ref="Zn" />
+ </material>
+ <element Z="40" formula="Zr" name="Zr" >
+  <atom type="A" unit="g/mol" value="91.2236" />
+ </element>
+ <material formula="Zr" name="Zirconium" state="solid" >
+  <RL type="X0" unit="cm" value="1.56707" />
+  <NIL type="lambda" unit="cm" value="24.2568" />
+  <D type="density" unit="g/cm3" value="6.506" />
+  <composite n="1" ref="Zr" />
+ </material>
+</materials>
\ No newline at end of file
diff --git a/Detector/DetDriftChamber/compact/materials.xml b/Detector/DetDriftChamber/compact/materials.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a86e3c48cccd159c8fa873bf65f60c66bc6378de
--- /dev/null
+++ b/Detector/DetDriftChamber/compact/materials.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<materials>
+
+  <!--
+       Air by weight from
+
+       http://www.engineeringtoolbox.com/air-composition-24_212.html
+  -->
+  <material name="Air">
+    <D type="density" unit="g/cm3" value="0.0012"/>
+    <fraction n="0.754" ref="N"/>
+    <fraction n="0.234" ref="O"/>
+    <fraction n="0.012" ref="Ar"/>
+  </material>
+  
+  <!-- We model vakuum just as very thin air -->
+  <material name="Vacuum">  
+    <D type="density" unit="g/cm3" value="0.0000000001" />
+    <fraction n="0.754" ref="N"/>
+    <fraction n="0.234" ref="O"/>
+    <fraction n="0.012" ref="Ar"/>
+  </material>
+
+  <material name="Epoxy">
+    <D type="density" value="1.3" unit="g/cm3"/>
+    <composite n="44" ref="H"/>
+    <composite n="15" ref="C"/>
+    <composite n="7" ref="O"/>
+  </material>
+
+  <material name="Quartz">
+    <D type="density" value="2.2" unit="g/cm3"/>
+    <composite n="1" ref="Si"/>
+    <composite n="2" ref="O"/>
+  </material>
+
+  <material name="G10">
+    <D type="density" value="1.7" unit="g/cm3"/>
+    <fraction n="0.08" ref="Cl"/>
+    <fraction n="0.773" ref="Quartz"/>
+    <fraction n="0.147" ref="Epoxy"/>
+  </material>
+
+  <material name="Polystyrene">
+    <D value="1.032" unit="g/cm3"/>
+    <composite n="19" ref="C"/>
+    <composite n="21" ref="H"/>
+  </material>
+
+  <material name="Steel235">
+    <D value="7.85" unit="g/cm3"/>
+    <fraction n="0.998" ref="Fe"/>
+    <fraction n=".002" ref="C"/>
+  </material>
+
+  <material name="SiliconOxide">
+    <D type="density" value="2.65" unit="g/cm3"/>
+    <composite n="1" ref="Si"/>
+    <composite n="2" ref="O"/>
+  </material>
+
+  <material name="BoronOxide">
+    <D type="density" value="2.46" unit="g/cm3"/>
+    <composite n="2" ref="B"/>
+    <composite n="3" ref="O"/>
+  </material>
+
+  <material name="SodiumOxide">
+    <D type="density" value="2.65" unit="g/cm3"/>
+    <composite n="2" ref="Na"/>
+    <composite n="1" ref="O"/>
+  </material>
+
+  <material name="AluminumOxide">
+    <D type="density" value="3.89" unit="g/cm3"/>
+    <composite n="2" ref="Al"/>
+    <composite n="3" ref="O"/>
+  </material>
+
+  <material name="PyrexGlass">
+    <D type="density" value="2.23" unit="g/cm3"/>
+    <fraction n="0.806" ref="SiliconOxide"/>
+    <fraction n="0.130" ref="BoronOxide"/>
+    <fraction n="0.040" ref="SodiumOxide"/>
+    <fraction n="0.023" ref="AluminumOxide"/>
+  </material>
+
+  <material name="CarbonFiber">
+    <D type="density" value="1.5" unit="g/cm3"/>
+    <fraction n="0.65" ref="C"/>
+    <fraction n="0.35" ref="Epoxy"/>
+  </material>
+  
+  <material name="CarbonFiber_50D">
+    <D type="density" value="0.75" unit="g/cm3"/>
+    <fraction n="0.65" ref="C"/>
+    <fraction n="0.35" ref="Epoxy"/>
+  </material>  
+
+  <material name="Rohacell31">
+    <D type="density" value="0.032" unit="g/cm3"/>
+    <composite n="9" ref="C"/>
+    <composite n="13" ref="H"/>
+    <composite n="2" ref="O"/>
+    <composite n="1" ref="N"/>
+  </material>
+  
+  <material name="Rohacell31_50D">
+    <D type="density" value="0.016" unit="g/cm3"/>
+    <composite n="9" ref="C"/>
+    <composite n="13" ref="H"/>
+    <composite n="2" ref="O"/>
+    <composite n="1" ref="N"/>
+  </material>  
+
+  <material name="RPCGasDefault" state="gas">
+    <D type="density" value="0.0037" unit="g/cm3"/>
+    <composite n="209" ref="C"/>
+    <composite n="239" ref="H"/>
+    <composite n="381" ref="F"/>
+  </material>
+
+  <material name="PolystyreneFoam">
+    <D type="density" value="0.0056" unit="g/cm3"/>
+    <fraction n="1.0" ref="Polystyrene"/>
+  </material>
+
+  <material name="Kapton">
+    <D value="1.43" unit="g/cm3" />
+    <composite n="22" ref="C"/>
+    <composite n="10" ref="H" />
+    <composite n="2" ref="N" />
+    <composite n="5" ref="O" />
+  </material>
+
+  <material name="PEEK">
+    <D value="1.37" unit="g/cm3" />
+    <composite n="19" ref="C"/>
+    <composite n="12" ref="H" />
+    <composite n="3" ref="O" />
+  </material>
+
+  <material name="G4_BGO" state="solid">
+    <MEE unit="eV" value="534.1"/>
+    <D value="7.13" unit="g/cm3" />
+    <fraction n="0.154126" ref="O"/>
+    <fraction n="0.174820" ref="Ge" />
+    <fraction n="0.671054" ref="Bi" />
+  </material>
+
+
+</materials>
diff --git a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9df294c519aae1ef28ac002acc678f8fd8331d44
--- /dev/null
+++ b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp
@@ -0,0 +1,110 @@
+//====================================================================
+//  Detector description implementation of the Drift Chamber
+//--------------------------------------------------------------------
+//
+//  Author: Tao Lin
+//
+//====================================================================
+
+#include "DD4hep/DetFactoryHelper.h"
+#include "XML/Layering.h"
+#include "XML/Utilities.h"
+#include "DDRec/DetectorData.h"
+#include "DDSegmentation/Segmentation.h"
+
+#define MYDEBUG(x) std::cout << __FILE__ << ":" << __LINE__ << ": " << x << std::endl;
+#define MYDEBUGVAL(x) std::cout << __FILE__ << ":" << __LINE__ << ": " << #x << ": " << x << std::endl;
+
+static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
+                                     xml_h e,
+                                     dd4hep::SensitiveDetector sens) {
+    // =======================================================================
+    // Parameter Definition
+    // =======================================================================
+
+    xml_det_t x_det = e;
+
+    std::string det_name = x_det.nameStr();
+    std::string det_type = x_det.typeStr();
+
+    // - global 
+    double chamber_radius_min = theDetector.constant<double>("SDT_radius_min");
+    double chamber_radius_max = theDetector.constant<double>("SDT_radius_max");
+    double chamber_length     = theDetector.constant<double>("SDT_length");
+
+    // - inner chamber
+    double inner_chamber_radius_min = theDetector.constant<double>("SDT_inner_chamber_radius_min");
+    double inner_chamber_radius_max = theDetector.constant<double>("SDT_inner_chamber_radius_max");
+    double inner_chamber_length     = theDetector.constant<double>("SDT_inner_chamber_length");
+
+    // - outer chamber
+    double outer_chamber_radius_min = theDetector.constant<double>("SDT_outer_chamber_radius_min");
+    double outer_chamber_radius_max = theDetector.constant<double>("SDT_outer_chamber_radius_max");
+    double outer_chamber_length     = theDetector.constant<double>("SDT_outer_chamber_length");
+
+    // =======================================================================
+    // Detector Construction
+    // =======================================================================
+
+    dd4hep::DetElement sdet(det_name, x_det.id());
+
+    dd4hep::Volume motherVol = theDetector.pickMotherVolume(sdet);
+
+    dd4hep::Material det_mat(theDetector.material("Air"));
+    
+    // - global 
+    dd4hep::Tube det_solid(chamber_radius_min, chamber_radius_max, chamber_length*0.5);
+    dd4hep::Volume det_vol(det_name+"_vol", det_solid, det_mat);
+
+    // - inner
+    dd4hep::Tube det_inner_chamber_solid(inner_chamber_radius_min, inner_chamber_radius_max, inner_chamber_length*0.5);
+    dd4hep::Volume det_inner_chamber_vol(det_name+"_inner_chamber_vol", det_inner_chamber_solid, det_mat);
+
+    dd4hep::Transform3D transform_inner_chamber(dd4hep::Rotation3D(),
+                                                dd4hep::Position(0,0,0));
+    dd4hep::PlacedVolume det_inner_chamber_phy = det_vol.placeVolume(det_inner_chamber_vol,
+                                                                     transform_inner_chamber);
+    det_inner_chamber_phy.addPhysVolID("chamber", 0);
+    if ( x_det.isSensitive() )   {
+        dd4hep::SensitiveDetector sd = sens;
+        det_inner_chamber_vol.setSensitiveDetector(sens);
+        sd.setType("tracker");
+    }
+
+
+
+    // - outer
+    dd4hep::Tube det_outer_chamber_solid(outer_chamber_radius_min, outer_chamber_radius_max, outer_chamber_length*0.5);
+    dd4hep::Volume det_outer_chamber_vol(det_name+"_outer_chamber_vol", det_outer_chamber_solid, det_mat);
+
+    dd4hep::Transform3D transform_outer_chamber(dd4hep::Rotation3D(),
+                                                dd4hep::Position(0,0,0));
+    dd4hep::PlacedVolume det_outer_chamber_phy = det_vol.placeVolume(det_outer_chamber_vol,
+                                                                     transform_outer_chamber);
+
+    det_inner_chamber_phy.addPhysVolID("chamber", 1);
+    if ( x_det.isSensitive() )   {
+        dd4hep::SensitiveDetector sd = sens;
+        det_outer_chamber_vol.setSensitiveDetector(sens);
+        sd.setType("tracker");
+    }
+
+
+    // - place in world
+    dd4hep::Transform3D transform(dd4hep::Rotation3D(),
+                                  dd4hep::Position(0,0,0));
+    dd4hep::PlacedVolume phv = motherVol.placeVolume(det_vol,transform);
+
+
+    if ( x_det.hasAttr(_U(id)) )  {
+        phv.addPhysVolID("system",x_det.id());
+    }
+
+    sdet.setPlacement(phv);
+
+    MYDEBUG("Build Detector Drift Chamber successfully.");
+    return sdet;
+
+}
+
+DECLARE_DETELEMENT(DriftChamber, create_detector);
diff --git a/Digitisers/DCHDigi/CMakeLists.txt b/Digitisers/DCHDigi/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..33fa374effccc19a7fabd6fb841a3e34f368c067
--- /dev/null
+++ b/Digitisers/DCHDigi/CMakeLists.txt
@@ -0,0 +1,25 @@
+gaudi_subdir(DCHDigi v0r0)
+
+find_package(DD4hep COMPONENTS DDG4 REQUIRED)
+find_package(EDM4HEP REQUIRED )
+message("EDM4HEP_INCLUDE_DIRS: ${EDM4HEP_INCLUDE_DIR}")
+message("EDM4HEP_LIB: ${EDM4HEP_LIBRARIES}")
+include_directories(${EDM4HEP_INCLUDE_DIR})
+
+find_package(CLHEP REQUIRED)
+find_package(podio REQUIRED )
+
+set(srcs
+    src/*.cpp
+)
+
+gaudi_depends_on_subdirs(
+    Detector/DetInterface
+)
+## Modules
+gaudi_add_module(DCHDigi ${srcs}
+    INCLUDE_DIRS FWCore GaudiKernel GaudiAlgLib CLHEP DD4hep 
+    LINK_LIBRARIES FWCore GaudiKernel GaudiAlgLib CLHEP DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec
+    -Wl,--no-as-needed 
+    EDM4HEP::edm4hep EDM4HEP::edm4hepDict
+)
diff --git a/Digitisers/DCHDigi/src/DCHDigiAlg.cpp b/Digitisers/DCHDigi/src/DCHDigiAlg.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f179943a32f9831adcdb00a6b638dfb63132f7d3
--- /dev/null
+++ b/Digitisers/DCHDigi/src/DCHDigiAlg.cpp
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+#include "DCHDigiAlg.h"
+
+
+#include "edm4hep/SimCalorimeterHit.h"
+#include "edm4hep/CalorimeterHit.h"
+#include "edm4hep/Vector3f.h"
+
+#include "DD4hep/Detector.h"
+#include <DD4hep/Objects.h>
+
+
+#include <math.h>
+#include <cmath>
+#include <algorithm>
+
+DECLARE_COMPONENT( DCHDigiAlg )
+
+DCHDigiAlg::DCHDigiAlg(const std::string& name, ISvcLocator* svcLoc)
+  : GaudiAlgorithm(name, svcLoc),
+    _nEvt(0)
+{
+  
+  // Input collections
+  declareProperty("SimDCHitCollection", r_SimDCHCol, "Handle of the Input SimHit collection");
+  
+  // Output collections
+  declareProperty("DigiDCHitCollection", w_DigiDCHCol, "Handle of Digi DCHit collection");
+  
+  declareProperty("CaloAssociationCollection", w_AssociationCol, "Handle of Association collection");
+   
+}
+
+StatusCode DCHDigiAlg::initialize()
+{
+  /*
+  m_geosvc = service<IGeoSvc>("GeoSvc");
+  if ( !m_geosvc )  throw "DCHDigiAlg :Failed to find GeoSvc ...";
+  dd4hep::Detector* m_dd4hep = m_geosvc->lcdd();
+  if ( !m_dd4hep )  throw "DCHDigiAlg :Failed to get dd4hep::Detector ...";
+  m_cellIDConverter = new dd4hep::rec::CellIDPositionConverter(*m_dd4hep);
+  */
+  std::cout<<"DCHDigiAlg::initialized"<< std::endl;
+  return GaudiAlgorithm::initialize();
+}
+
+StatusCode DCHDigiAlg::execute()
+{
+  std::map<unsigned long long, std::vector<edm4hep::SimTrackerHit> > id_hits_map;
+  edm4hep::TrackerHitCollection* Vec   = w_DigiDCHCol.createAndPut();
+  edm4hep::MCRecoTrackerAssociationCollection* AssoVec   = w_AssociationCol.createAndPut();
+  const edm4hep::SimTrackerHitCollection* SimHitCol =  r_SimDCHCol.get();
+  if(SimHitCol == 0) 
+  {
+     std::cout<<"not found SimCalorimeterHitCollection"<< std::endl;
+     return StatusCode::SUCCESS;
+  }
+  std::cout<<"input sim hit size="<< SimHitCol->size() <<std::endl;
+  for( int i = 0; i < SimHitCol->size(); i++ ) 
+  {
+      edm4hep::SimTrackerHit SimHit = SimHitCol->at(i);
+      unsigned long long id = SimHit.getCellID();
+      
+      if ( id_hits_map.find(id) != id_hits_map.end()) id_hits_map[id].push_back(SimHit);
+      else 
+      {
+          std::vector<edm4hep::SimTrackerHit> vhit;
+          vhit.push_back(SimHit);
+          id_hits_map[id] = vhit ;
+      }
+  }
+
+  for(std::map<unsigned long long, std::vector<edm4hep::SimTrackerHit> >::iterator iter = id_hits_map.begin(); iter != id_hits_map.end(); iter++)
+  {
+    auto trkHit = Vec->create();
+    trkHit.setCellID(iter->first);
+    double tot_edep   = 0 ;
+    double tot_length = 0 ;
+    double tot_time = 0 ;
+    double tot_x = 0 ;
+    double tot_y = 0 ;
+    double tot_z = 0 ;
+    int simhit_size = iter->second.size();
+    for(unsigned int i=0; i< simhit_size; i++)
+    {
+        tot_edep   += iter->second.at(i).getEDep();//GeV
+        tot_length += iter->second.at(i).getPathLength();//mm
+        tot_time += iter->second.at(i).getTime();
+        tot_x    += iter->second.at(i).getEDep()*iter->second.at(i).getPosition()[0];
+        tot_y    += iter->second.at(i).getEDep()*iter->second.at(i).getPosition()[1];
+        tot_z    += iter->second.at(i).getEDep()*iter->second.at(i).getPosition()[2];
+ 
+        auto asso = AssoVec->create();
+        asso.setRec(trkHit);
+        asso.setSim(iter->second.at(i));
+        asso.setWeight(1.0/simhit_size);
+    }
+    
+    trkHit.setTime(tot_time/simhit_size);
+    trkHit.setEDep(tot_edep);
+    trkHit.setEdx (tot_edep*1000/(tot_length/10) ); // MeV/cm, need check!
+    trkHit.setPosition (edm4hep::Vector3d(tot_x/tot_edep, tot_y/tot_edep, tot_z/tot_edep));//center mass
+  }
+  std::cout<<"output digi DCHhit size="<< Vec->size() <<std::endl;
+  _nEvt ++ ;
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode DCHDigiAlg::finalize()
+{
+  info() << "Processed " << _nEvt << " events " << endmsg;
+  return GaudiAlgorithm::finalize();
+}
diff --git a/Digitisers/DCHDigi/src/DCHDigiAlg.h b/Digitisers/DCHDigi/src/DCHDigiAlg.h
new file mode 100644
index 0000000000000000000000000000000000000000..e51c8c31615a630b3b446deb1a7d105e50aa761b
--- /dev/null
+++ b/Digitisers/DCHDigi/src/DCHDigiAlg.h
@@ -0,0 +1,56 @@
+#ifndef DCH_DIGI_ALG_H
+#define DCH_DIGI_ALG_H
+
+#include "FWCore/DataHandle.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "edm4hep/SimTrackerHitCollection.h"
+#include "edm4hep/TrackerHitCollection.h"
+#include "edm4hep/MCRecoTrackerAssociationCollection.h"
+
+#include <DDRec/DetectorData.h>
+#include <DDRec/CellIDPositionConverter.h>
+#include "DetInterface/IGeoSvc.h"
+
+
+
+
+class DCHDigiAlg : public GaudiAlgorithm
+{
+ 
+public:
+ 
+  DCHDigiAlg(const std::string& name, ISvcLocator* svcLoc);
+ 
+  /** Called at the begin of the job before anything is read.
+   * Use to initialize the processor, e.g. book histograms.
+   */
+  virtual StatusCode initialize() ;
+ 
+  /** Called for every event - the working horse.
+   */
+  virtual StatusCode execute() ; 
+ 
+  /** Called after data processing for clean up.
+   */
+  virtual StatusCode finalize() ;
+ 
+protected:
+
+  SmartIF<IGeoSvc> m_geosvc;
+  typedef std::vector<float> FloatVec;
+  int _nEvt ;
+
+  //float m_length;
+  dd4hep::rec::CellIDPositionConverter* m_cellIDConverter;
+ 
+  //Gaudi::Property<float> m_scale     { this, "Scale", 1 };
+  //Gaudi::Property<float> m_resolution{ this, "Res", 0.01 };
+
+  // Input collections
+  DataHandle<edm4hep::SimTrackerHitCollection> r_SimDCHCol{"DriftChamberHitsCollection", Gaudi::DataHandle::Reader, this};
+  // Output collections
+  DataHandle<edm4hep::TrackerHitCollection>    w_DigiDCHCol{"DigiDCHitsCollection", Gaudi::DataHandle::Writer, this};
+  DataHandle<edm4hep::MCRecoTrackerAssociationCollection>    w_AssociationCol{"DCHitAssociationCollection", Gaudi::DataHandle::Writer, this};
+};
+
+#endif
diff --git a/Examples/options/LCIO_read_pan.py b/Examples/options/LCIO_read_pan.py
index 97b5f9e974a0db059bb5a7d4a1da503d07887a16..32292b36c7f0263841b7dc7663ebaea681b2dabf 100644
--- a/Examples/options/LCIO_read_pan.py
+++ b/Examples/options/LCIO_read_pan.py
@@ -10,57 +10,73 @@ read = LCIOInput("read")
 read.inputs = [
 #"/cefs/data/FullSim/CEPC240/CEPC_v4/higgs/smart_final_states/E240.Pffh_invi.e0.p0.whizard195//ffh_inv.e0.p0.00001_1000_sim.slcio"
 #"/junofs/users/wxfang/CEPC/CEPCOFF/doReco/reco_output/nnh_aa.e0.p0.00010_000000_rec.slcio"
-"/cefs/higgs/wxfang/cepc/Pandora/CaloDigi/gamma/Digi_sim_0.slcio"
+"/junofs/users/wxfang/MyGit/tmp/fork_update_pandora/CEPCSW/Digi_sim_0.slcio"
+]
+read.collections = [
+        "MCParticle:MCParticle",
+        #"SimCalorimeterHit:EcalBarrelSiliconCollection",
+        "CalorimeterHit:ECALBarrel",
+        "CalorimeterHit:ECALEndcap",
+        "CalorimeterHit:ECALOther" ,
+        ######### HCAL will effect the reco efficiency close to gap region ######
+        "CalorimeterHit:HCALBarrel",
+        "CalorimeterHit:HCALEndcap",
+        "CalorimeterHit:HCALOther",
+        #"TrackerHit:VXDTrackerHits",
+        #"TrackerHit:SITTrackerHits",
+        "TrackerHit:SITSpacePoints",
+        "TrackerHit:TPCTrackerHits",
+        #"TrackerHit:SETTrackerHits",
+        "TrackerHit:SETSpacePoints",
+        #"TrackerHit:FTDStripTrackerHits",
+        "TrackerHit:FTDSpacePoints",
+        #"TrackerHit:FTDPixelTrackerHits",
+        "Track:ClupatraTrackSegments", 
+        "Track:ClupatraTracks", 
+        "Track:ForwardTracks", 
+        "Track:SiTracks", 
+        "Track:SubsetTracks",
+        "Track:MarlinTrkTracks", 
+        "Vertex:KinkVertices",
+        "Vertex:ProngVertices",
+        "Vertex:V0Vertices",
+        "ReconstructedParticle:KinkRecoParticles",
+        "ReconstructedParticle:ProngRecoParticles",
+        "ReconstructedParticle:V0RecoParticles"
 ]
-read.collections = {
-        #"COILCollection" : "SimTrackerHit",
-        #"EcalBarrelSiliconCollection" : "SimCalorimeterHit",
-        "MCParticle" : "MCParticle",
-        "ECALBarrel" : "CalorimeterHit",
-        "ECALEndcap" : "CalorimeterHit",
-        "ECALOther"  : "CalorimeterHit",
-        "HCALBarrel" : "CalorimeterHit",
-        "HCALEndcap" : "CalorimeterHit",
-        "HCALOther"  : "CalorimeterHit",
-        "MUON"       : "CalorimeterHit",
-        "LCAL"       : "CalorimeterHit",
-        "LHCAL"      : "CalorimeterHit",
-        "BCAL"       : "CalorimeterHit",
-        #"MarlinTrkTracks" : "Track"
-        #"TPCCollection" : "SimTrackerHit",
-        #"VXDCollection" : "SimTrackerHit"
-}
 ##############################################################################
 from Configurables import GearSvc
 gearSvc  = GearSvc("GearSvc")
-gearSvc.GearXMLFile = "/junofs/users/wxfang/CEPC/CEPCOFF/doSim/fullDet/GearOutput.xml"
+gearSvc.GearXMLFile = "../Detector/DetCEPCv4/compact/FullDetGear.xml"
 ##############################################################################
 from Configurables import PandoraPFAlg
 
 pandoralg = PandoraPFAlg("PandoraPFAlg")
-## KEEP same with lcioinput name for the ReadXXX ###########
-pandoralg.ReadMCParticle                       = "MCParticle"                   
-pandoralg.ReadECALBarrel                       = "ECALBarrel"                   
-pandoralg.ReadECALEndcap                       = "ECALEndcap"                   
-pandoralg.ReadECALOther                        = "ECALOther"                    
-pandoralg.ReadHCALBarrel                       = "HCALBarrel"                   
-pandoralg.ReadHCALEndcap                       = "HCALEndcap"                   
-pandoralg.ReadHCALOther                        = "HCALOther"                    
-pandoralg.ReadMUON                             = "MUON"                         
-pandoralg.ReadLCAL                             = "LCAL"                         
-pandoralg.ReadLHCAL                            = "LHCAL"                        
-pandoralg.ReadBCAL                             = "BCAL"                         
-pandoralg.ReadKinkVertices                     = "KinkVertices"                 
-pandoralg.ReadProngVertices                    = "ProngVertices"                
-pandoralg.ReadSplitVertices                    = "SplitVertices"                
-pandoralg.ReadV0Vertices                       = "V0Vertices"                   
-pandoralg.ReadTracks                           = "MarlinTrkTracks"                       
+pandoralg.collections = [
+        "MCParticle:MCParticle",
+        "CalorimeterHit:ECALBarrel",
+        "CalorimeterHit:ECALEndcap",
+        "CalorimeterHit:ECALOther" ,
+        "CalorimeterHit:HCALBarrel",
+        "CalorimeterHit:HCALEndcap",
+        "CalorimeterHit:HCALOther" ,
+        "CalorimeterHit:MUON", 
+        "CalorimeterHit:LCAL", 
+        "CalorimeterHit:LHCAL", 
+        "CalorimeterHit:BCAL", 
+        "Vertex:KinkVertices", 
+        "Vertex:ProngVertices", 
+        "Vertex:SplitVertices", 
+        "Vertex:V0Vertices", 
+        "Track:MarlinTrkTracks", 
+        "MCRecoCaloAssociation:RecoCaloAssociation_ECALBarrel" 
+        ]
 pandoralg.WriteClusterCollection               = "PandoraClusters"              
 pandoralg.WriteReconstructedParticleCollection = "PandoraPFOs" 
 pandoralg.WriteVertexCollection                = "PandoraPFANewStartVertices"               
-pandoralg.AnaOutput = "/cefs/higgs/wxfang/cepc/Pandora/Ana/gamma/Ana_gamma_test.root"
+pandoralg.AnaOutput = "Pandora_Ana.root"
 
-pandoralg.PandoraSettingsDefault_xml = "/junofs/users/wxfang/MyGit/MarlinPandora/scripts/PandoraSettingsDefault_wx.xml"
+pandoralg.PandoraSettingsDefault_xml = "../Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml"
 #### Do not chage the collection name, only add or delete ###############
 pandoralg.TrackCollections      =  ["MarlinTrkTracks"]
 pandoralg.ECalCaloHitCollections=  ["ECALBarrel", "ECALEndcap", "ECALOther"]
@@ -109,7 +125,7 @@ ApplicationMgr(
         #TopAlg = [read, pandoralg, write],
         TopAlg = [read, pandoralg],
         EvtSel = 'NONE',
-        EvtMax = 10,
+        EvtMax = 1,
         ExtSvc = [dsvc, gearSvc],
         OutputLevel=INFO
 )
diff --git a/Examples/options/tut_detsim_dedx.py b/Examples/options/tut_detsim_dedx.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa49a00e87193a03bef378137157881db4893541
--- /dev/null
+++ b/Examples/options/tut_detsim_dedx.py
@@ -0,0 +1,146 @@
+#!/usr/bin/env python
+
+import os
+print(os.environ["DD4HEP_LIBRARY_PATH"])
+import sys
+# sys.exit(0)
+
+from Gaudi.Configuration import *
+
+##############################################################################
+# Random Number Svc
+##############################################################################
+from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_
+
+# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi
+rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_() # The default engine in Geant4
+rndmengine.SetSingleton = True
+rndmengine.Seeds = [42]
+
+# rndmgensvc = RndmGenSvc("RndmGenSvc")
+# rndmgensvc.Engine = rndmengine.name()
+
+
+##############################################################################
+# Event Data Svc
+##############################################################################
+from Configurables import K4DataSvc
+dsvc = K4DataSvc("EventDataSvc")
+
+
+##############################################################################
+# Geometry Svc
+##############################################################################
+
+# geometry_option = "CepC_v4-onlyTracker.xml"
+geometry_option = "CepC_v4-onlyVXD.xml"
+
+if not os.getenv("DETCEPCV4ROOT"):
+    print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." )
+    sys.exit(-1)
+
+geometry_path = os.path.join(os.getenv("DETCEPCV4ROOT"), "compact", geometry_option)
+if not os.path.exists(geometry_path):
+    print("Can't find the compact geometry file: %s"%geometry_path)
+    sys.exit(-1)
+geometry_path = "/junofs/users/wxfang/MyGit/tmp/sdt/CEPCSW/Detector/DetDriftChamber/compact/det.xml" 
+
+from Configurables import GeoSvc
+geosvc = GeoSvc("GeoSvc")
+geosvc.compact = geometry_path
+
+###### Dedx Svc ##########################################################
+from Configurables import DedxSvc
+dedxsvc = DedxSvc("DedxSvc")
+dedxsvc.scale = 1
+dedxsvc.resolution = 0.01
+dedxsvc.material_Z = 26
+dedxsvc.material_A = 53.9396
+dedxsvc.material_density = 7.874 #g/cm^3
+##############################################################################
+# Physics Generator
+##############################################################################
+from Configurables import GenAlgo
+from Configurables import GtGunTool
+from Configurables import StdHepRdr
+from Configurables import SLCIORdr
+from Configurables import HepMCRdr
+from Configurables import GenPrinter
+
+gun = GtGunTool("GtGunTool")
+gun.Particles = ["proton"]
+gun.EnergyMins = [0.1] # GeV
+gun.EnergyMaxs = [100] # GeV
+
+gun.ThetaMins = [90] # rad; 45deg
+gun.ThetaMaxs = [90] # rad; 45deg
+
+gun.PhiMins = [0] # rad; 0deg
+gun.PhiMaxs = [0] # rad; 360deg
+
+# stdheprdr = StdHepRdr("StdHepRdr")
+# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep"
+
+# lciordr = SLCIORdr("SLCIORdr")
+# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio"
+
+# hepmcrdr = HepMCRdr("HepMCRdr")
+# hepmcrdr.Input = "example_UsingIterators.txt"
+
+genprinter = GenPrinter("GenPrinter")
+
+genalg = GenAlgo("GenAlgo")
+genalg.GenTools = ["GtGunTool"]
+# genalg.GenTools = ["StdHepRdr"]
+# genalg.GenTools = ["StdHepRdr", "GenPrinter"]
+# genalg.GenTools = ["SLCIORdr", "GenPrinter"]
+# genalg.GenTools = ["HepMCRdr", "GenPrinter"]
+
+##############################################################################
+# Detector Simulation
+##############################################################################
+from Configurables import DetSimSvc
+
+detsimsvc = DetSimSvc("DetSimSvc")
+
+# from Configurables import ExampleAnaElemTool
+# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool")
+
+from Configurables import DetSimAlg
+
+detsimalg = DetSimAlg("DetSimAlg")
+
+# detsimalg.VisMacs = ["vis.mac"]
+
+detsimalg.RunCmds = [
+#    "/tracking/verbose 1",
+]
+detsimalg.AnaElems = [
+    # example_anatool.name()
+    # "ExampleAnaElemTool"
+    "Edm4hepWriterAnaElemTool"
+]
+detsimalg.RootDetElem = "WorldDetElemTool"
+
+from Configurables import AnExampleDetElemTool
+example_dettool = AnExampleDetElemTool("AnExampleDetElemTool")
+
+
+##############################################################################
+# POD I/O
+##############################################################################
+from Configurables import PodioOutput
+out = PodioOutput("outputalg")
+out.filename = "test_detsim10.root"
+out.outputCommands = ["keep *"]
+
+##############################################################################
+# ApplicationMgr
+##############################################################################
+
+from Configurables import ApplicationMgr
+ApplicationMgr( TopAlg = [genalg, detsimalg, out],
+                EvtSel = 'NONE',
+                EvtMax = 10,
+                ExtSvc = [rndmengine, dsvc, geosvc],
+)
diff --git a/Examples/options/tut_detsim_pandora.py b/Examples/options/tut_detsim_pandora.py
index b4ceaf07377898130aea5d39e6e304242cda1262..e1ac4a7fa9053fac9cd929609d125fac1ca5f727 100644
--- a/Examples/options/tut_detsim_pandora.py
+++ b/Examples/options/tut_detsim_pandora.py
@@ -134,24 +134,25 @@ gearSvc.GearXMLFile = "../Detector/DetCEPCv4/compact/FullDetGear.xml"
 from Configurables import PandoraPFAlg
 
 pandoralg = PandoraPFAlg("PandoraPFAlg")
-## KEEP same with lcioinput name for the ReadXXX ###########
-pandoralg.ReadMCParticle                       = "MCParticle"                   
-pandoralg.ReadECALBarrel                       = "ECALBarrel"                   
-pandoralg.ReadECALEndcap                       = "ECALEndcap"                   
-pandoralg.ReadECALOther                        = "ECALOther"                    
-pandoralg.ReadHCALBarrel                       = "HCALBarrel"                   
-pandoralg.ReadHCALEndcap                       = "HCALEndcap"                   
-pandoralg.ReadHCALOther                        = "HCALOther"                    
-pandoralg.ReadMUON                             = "MUON"                         
-pandoralg.ReadLCAL                             = "LCAL"                         
-pandoralg.ReadLHCAL                            = "LHCAL"                        
-pandoralg.ReadBCAL                             = "BCAL"                         
-pandoralg.ReadKinkVertices                     = "KinkVertices"                 
-pandoralg.ReadProngVertices                    = "ProngVertices"                
-pandoralg.ReadSplitVertices                    = "SplitVertices"                
-pandoralg.ReadV0Vertices                       = "V0Vertices"                   
-pandoralg.ReadTracks                           = "MarlinTrkTracks"                       
-pandoralg.MCRecoCaloAssociation                = "RecoCaloAssociation_ECALBarrel"                       
+pandoralg.collections = [
+        "MCParticle:MCParticle",
+        "CalorimeterHit:ECALBarrel",
+        "CalorimeterHit:ECALEndcap",
+        "CalorimeterHit:ECALOther" ,
+        "CalorimeterHit:HCALBarrel",
+        "CalorimeterHit:HCALEndcap",
+        "CalorimeterHit:HCALOther" ,
+        "CalorimeterHit:MUON", 
+        "CalorimeterHit:LCAL", 
+        "CalorimeterHit:LHCAL", 
+        "CalorimeterHit:BCAL", 
+        "Vertex:KinkVertices", 
+        "Vertex:ProngVertices", 
+        "Vertex:SplitVertices", 
+        "Vertex:V0Vertices", 
+        "Track:MarlinTrkTracks", 
+        "MCRecoCaloAssociation:RecoCaloAssociation_ECALBarrel" 
+        ]
 pandoralg.WriteClusterCollection               = "PandoraClusters"              
 pandoralg.WriteReconstructedParticleCollection = "PandoraPFOs" 
 pandoralg.WriteVertexCollection                = "PandoraPFANewStartVertices"               
diff --git a/README.md b/README.md
index 898d7bcfeeb28fcf3234338cc512d89041d55ea9..73de8093cbf8e17f57d963a8a7439e5f7d4a60ed 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
-# CEPCSW
+# [CEPCSW](https://cepc.github.io/CEPCSW/)
+
+[![Build Status](https://travis-ci.org/cepc/CEPCSW.svg?branch=master)](https://travis-ci.org/cepc/CEPCSW)
 
 CEPC offline software prototype based on [Key4hep](https://github.com/key4hep).
 
diff --git a/Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml b/Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml
deleted file mode 100644
index 9f2056abf76bd61b3cbb656e013a5088e599ab26..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-clean:
-  end: 2018-09-04 10:38:21.535016
-  finished: true
-  start: 2018-09-04 10:38:21.503623
-compile:
-  end: 2018-09-04 10:38:21.449716
-  finished: true
-  start: 2018-09-04 10:38:07.382890
-download:
-  end: 2018-09-04 10:35:56.326883
-  finished: true
-  start: 2018-09-04 10:35:55.941740
-extract:
-  end: 2018-09-04 10:35:56.510664
-  finished: true
-  start: 2018-09-04 10:35:56.368258
-pre_compile:
-  end: 2018-09-04 10:37:33.127719
-  finished: true
-  start: 2018-09-04 10:37:33.110630
diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced.cc b/Reconstruction/PFA/Pandora/CED/CED/ced.cc
deleted file mode 100644
index 654444652e75bb0c8c5737b6787b4e0481055d67..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/CED/CED/ced.cc
+++ /dev/null
@@ -1,382 +0,0 @@
-/* "C" event display.
- * Communications related part. 
- *
-*ik
- * Alexey Zhelezov, DESY/ITEP, 2005 */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-
-#include <ced.h>
-
-//hauke
-//#include <stropts.h>
-#include <poll.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <netdb.h>
-#include <sys/socket.h> /* for AF_INET */
-#include <iostream>
-
-
-//http://www.rhyolite.com/pipermail/dcc/2004/001986.html
-#ifndef POLLRDNORM //fg: should be defined in poll.h
-# define POLLRDNORM     0x040           /* Normal data may be read.  */
-# define POLLRDBAND     0x080           /* Priority data may be read.  */
-# define POLLWRNORM     0x100           /* Writing now will not block.  */
-# define POLLWRBAND     0x200           /* Priority data may be written.  */
-#endif
-//end hauke
-
-static int ced_fd=-1; // CED connection socket
-
-static unsigned short ced_port=7927; // port No of CED (assume localhost)
-static char ced_host[30];
-
-// Return 0 if can be connected, -1 otherwise.
-/*static*/ int ced_connect(void){
-  static time_t last_attempt=0;
-  time_t ct;
-  struct sockaddr_in addr;
-
-  if(ced_fd>=0){
-    return 0; // already connected;
-  }
-  time(&ct);
-  if(ct-last_attempt<5){
-    return -1; // don't try reconnect all the time
-  }
-  addr.sin_family=AF_INET;
-  addr.sin_port=htons(ced_port);
-  addr.sin_addr.s_addr=inet_addr(ced_host); 
-  memset(&addr.sin_zero, 0, sizeof(addr.sin_zero)); //not nessesary because sin_zero is not used!
-
-  ced_fd=socket(PF_INET,SOCK_STREAM,0);
-  if(connect(ced_fd,(struct sockaddr *)&addr,sizeof(addr)) != 0){
-    if(!last_attempt){
-        perror("WARNING:CED: can't connect to CED");
-    }
-    time(&last_attempt);
-    close(ced_fd);
-    ced_fd=-1;
-    return -1;
-  }
-  fprintf(stderr,"INFO:CED: connected to CED\n");
-  return 0;
-}
-
-
-typedef struct {
-  unsigned size;            // size of one item in bytes
-  unsigned char *b;         // "body" - data are stored here
-                            // (here is some trick :)
-  unsigned long count;      // number of usefull items
-  unsigned long alloced;    // number of allocated items
-  ced_draw_cb draw;         // draw fucation, NOT used in CED client
-} ced_element;
-
-typedef struct {
-  ced_element *e;
-  unsigned      e_count;
-} ced_event;
-
-//static ced_event eve = {0,0};
-
-static ced_event eve = {0,0};
-
-// NOT used in CED client
-static ced_event ceve = {0,0}; // current event on screen
-
-// we reserve this size just before ced_element.b data
-#define HDR_SIZE 8 
-
-unsigned ced_register_element(unsigned item_size,ced_draw_cb draw_func){
-  ced_element *pe;
-  if(!(eve.e_count&0xf)){
-    eve.e=(ced_element *) realloc(eve.e,(eve.e_count+0x10)*sizeof(ced_element));
-  }
-
-  pe=eve.e+eve.e_count;
-  memset(pe,0,sizeof(*pe));
-  pe->size=item_size;
-  pe->draw=draw_func;
-  return eve.e_count++;
-}
-
-static void ced_reset(void){
-  unsigned i;
-  
-  for(i=0;i<eve.e_count;i++){
-    eve.e[i].count=0;
-   // if( eve.e[i].alloced > 0){
-   //     eve.e[i].alloced=0; //hauke: 15.12.11
-   //     //free(eve.e[i].b-HDR_SIZE);
-   // }
-  }
-}
-
-static void ced_buf_alloc(ced_element *pe,unsigned count){
-  if(!pe->b){
-
-    //std::cout << "malloc  requestet: " << count*pe->size+HDR_SIZE << "bytes" << std::endl;
-    pe->b=(unsigned char *) malloc(count*pe->size+HDR_SIZE);
-    //printf("malloc: ask for NEW %lu bytes pointer: %p\n ", count*pe->size+HDR_SIZE, pe->b); //hauke
-    if(pe->b==NULL){ //hauke
-        printf("ERROR: malloc failed!\n");
-        exit(1);
-    }
-  }else{
-    //free(pe->b-HDR_SIZE);
-    //pe->b=(unsigned char *) malloc(count*pe->size+HDR_SIZE);
-
-    //std::cout << "realloc requestet: " << count*pe->size+HDR_SIZE << "bytes" << std::endl;
-    pe->b=(unsigned char *) realloc(pe->b-HDR_SIZE,count*pe->size+HDR_SIZE);
-
-    //printf("malloc: ask for %lu bytes, pointer: %p\n", count*pe->size+HDR_SIZE,pe->b);//hauke
-    if(pe->b==NULL){ //hauke
-        printf("ERROR: malloc failed!\n");
-        exit(1);
-    }
-  }
-  pe->b+=HDR_SIZE;
-  pe->alloced=count;
-}
-
-void *ced_add(unsigned id){
-  ced_element *pe;
-  if(id >= eve.e_count){
-    fprintf(stderr,"BUG:CED: attempt to access not registered element\n");
-    return 0;
-  }
-  pe=eve.e+id;
-
-  if(pe->count==pe->alloced){
-    ced_buf_alloc(pe,pe->alloced+256);
-  }
-
-  return (pe->b+(pe->count++)*pe->size);
-}
-
-static void ced_event_copy(ced_event *trg){
-  unsigned i;
-  ced_element *pe;
-  //std::cout << "trg->e_count: " << trg->e_count << std::endl;
-  //std::cout << "eve.e_count: " << eve.e_count << std::endl;
-
-  //eve.e_count = 0;
-  if(trg->e_count<eve.e_count){
-    //free(trg->e);
-    trg->e=(ced_element*) realloc(trg->e,eve.e_count*sizeof(ced_element));
-
-    //trg->e=(ced_element*) malloc(eve.e_count*sizeof(ced_element));
-  }
-
-
-  for(i=0;i<eve.e_count;i++){
-        pe=trg->e+i;
-        if(i<trg->e_count){
-            //if(pe->alloced > 0){
-            //  free(pe->b);
-            //  pe->b=NULL;
-            //  pe->alloced=0;
-            //}
-
-
-            //if(pe->alloced > 0){
-            //    std::cout << "try to free" << std::endl;
-            //    free(pe->b-HDR_SIZE);
-            //    pe->alloced = 0;
-            //    std::cout << "finished" << std::endl;
-            //}
-
-            if(pe->alloced<eve.e[i].alloced) {
-	          ced_buf_alloc(pe,eve.e[i].alloced);
-                //std::cout << "test1 " << std::endl;
-            }
-            pe->count=eve.e[i].count;
-
-        }else{
-            memcpy(pe,eve.e+i,sizeof(ced_element));
-            if(pe->b){
-	              pe->b=0;
-                  //  std::cout << "test2 " << std::endl;
-	              ced_buf_alloc(pe,pe->alloced);
-            }
-        }
-        if(pe->count){
-            memcpy(pe->b,eve.e[i].b,pe->count*pe->size);
-        }
-  }
-  trg->e_count=eve.e_count;
-}
-
-void ced_do_draw_event(void){
-  unsigned int i,j;
-  ced_element *pe;
-  unsigned char *pdata;
-  for(i=0;i<ceve.e_count;i++){
-    //printf("ceve.e_count: %i\n", ceve.e_count);
-    //for(i=ceve.e_count-1; i >=0;i--){ //quick hack, change order so that the detector is drawn at last
-    //printf("i = %i\n", i);
-
-    pe=ceve.e+i;
-    if(!pe->draw)
-      continue;
-    for(pdata=pe->b,j=0;j<pe->count;j++,pdata+=pe->size)
-      (*(pe->draw))(pdata);
-  }
-}
-
-typedef enum {
-  DRAW_EVENT=10000
-} MSG_TYPE;
-
-int ced_process_input(void *data){
-  struct _phdr{
-    unsigned size;
-    unsigned type;
-    unsigned char b[4];
-  } *hdr = (_phdr*) data;
-  unsigned count;
-  ced_element *pe;
-  
-  if(!data){ // new client is connected
-    ced_reset();
-    return 0;
-  }
-
-  if(hdr->type == DRAW_EVENT){
-    ced_event_copy(&ceve);
-    ced_reset();
-    return 1;
-  }
-  if(hdr->type>=eve.e_count){
-    fprintf(stderr,"WARNING:CED: undefined element type (%u), ignored\n",
-	    hdr->type);
-    return 0;
-  }
-  pe=eve.e+hdr->type;
-  if((hdr->size-HDR_SIZE)%pe->size){
-    fprintf(stderr,"BUG:CED: size alignment is wrong for element %u\n", hdr->type);
-    return 0;
-  }
-  count=(hdr->size-HDR_SIZE)/pe->size;
-  if(!count)
-    return 0;
-  if(count>=pe->alloced)
-    ced_buf_alloc(pe,count+256);
-  memcpy(pe->b,hdr->b,count*pe->size);
-  pe->count=count;
-  return 0;
-}
-
-void ced_send_event(void){
-  struct _phdr{
-    int size;
-    unsigned type;
-  } *hdr,draw_hdr;
-  unsigned i,problem=0;
-  int sent_sum;
-  char *buf;
-  int sent;
-  ced_element *pe;
-
-  if(ced_connect())
-    return;
-  for(i=0;i<eve.e_count && !problem;i++){
-    //printf("i=%i\n",i);
-    pe=eve.e+i;
-    if(!pe->count)
-      continue;
-    
-    //unsigned hauke;
-    //printf("size of unsigned %i\n", sizeof(hauke));
-    hdr=(struct _phdr *)(pe->b-HDR_SIZE); // !!! HERE is the trick :)
-    hdr->type=i;
-    //printf("pe->count %i, pe->size %i\n",pe->count, pe->size);
-    hdr->size=HDR_SIZE+pe->count*pe->size;
-    sent_sum=0;
-    //if(hdr->size > 10000000){printf("U P S!  This data set is realy big! (%f kB)(%i counts)\n",(hdr->size)/1024.0,pe->count);}
-    buf=(char *)hdr;
-    //printf("hdr->size=%i\n",hdr->size);
-    while(sent_sum<hdr->size){
-        //printf("sent_sum = %i, hdr->size=%i\n",sent_sum,hdr->size);
-	    sent=write(ced_fd,buf+sent_sum,hdr->size-sent_sum);
-        
-        //printf("byte: %u\n", buf[sent_sum]);
-	    if(sent<0){
-            printf("send < 0\n");
-	        problem=1;
-	        break;
-	    }
-	    sent_sum+=sent;
-    }
-  }
-  if(!problem){
-    draw_hdr.size=HDR_SIZE;
-    draw_hdr.type=DRAW_EVENT;
-    if(write(ced_fd,&draw_hdr,HDR_SIZE)!=HDR_SIZE)
-      problem=1;
-  }
-  if(problem){
-    perror("WARNING:CED: can't send event, till next time...");
-    close(ced_fd);
-    ced_fd=-1;
-  }
-}
-
-
-//hauke
-int ced_selected_id_noblock() {
-  int id=-1 ;
-  struct pollfd fds[1];
-  fds[0].fd=ced_fd;
-  fds[0].events = POLLRDNORM | POLLIN;
-  if(poll(fds,1,0) > 0){
-    if(recv(ced_fd, &id, sizeof(int) , 0 ) > 0){
-        return id;
-    }else{
-        return -1;
-    }
-  }else{
-   return -1;
-  }
-}
-
-int ced_selected_id() {
-  int id=-1 ;
-  if(recv(ced_fd, &id, sizeof(int) , 0 ) > 0){
-     return id;
-  }else{
-     return -1;
-  }
-}
-#include <signal.h>
-// API
-void ced_client_init(const char *hostname,unsigned short port){
-  struct hostent *host = gethostbyname(hostname);
-  snprintf(ced_host, 30, "%u.%u.%u.%u\n",(unsigned char)host->h_addr[0] ,(unsigned char)host->h_addr[1] ,(unsigned char)host->h_addr[2] ,(unsigned char)host->h_addr[3]); 
-
-
-  //printf("ip: %s\n",  ced_host);
-  //ced_host=host->h_addr;
-  ced_port=port;
-  signal(SIGPIPE,SIG_IGN);
-}
-
-void ced_new_event(void){
-  ced_reset();
-}
-
-void ced_draw_event(void){
-  ced_send_event();
-  ced_reset();
-}
diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced.h b/Reconstruction/PFA/Pandora/CED/CED/ced.h
deleted file mode 100644
index ccf355c27378db6a22b0bd473aad5b2f2aecb38b..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/CED/CED/ced.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* "C" event display.
- * Main part. 
- *
- * Alexey Zhelezov, DESY/ITEP, 2005 */
-
-/*
- * This file is internal. It must not be
- * included into enduser application.
- */
-
-#ifndef __CED_H
-#define __CED_H
-
-#include "ced_cli.h"
-
-//#ifdef __cplusplus
-// extern "C" {
-//#endif
-		
-
-//char trusted_hosts[50];
-//extern static char testchar;
-
-typedef void (*ced_draw_cb)(void *data);
-
-
-/*
- * Register new element type. Order is important!
- * Appropriate code must be defined in both
- * client and server parts.
- *
- *  item_size - size of one item in bytes.
- *  draw_func - function to call to draw one item,
- *              called from ced_do_draw_event()
- *              not used on client side.
- */
-unsigned ced_register_element(unsigned item_size,ced_draw_cb draw_func);
-
-/*
- * To be called from element functions
- * on client side.
- * Return allocated space for one item
- * with size, specified by ced_register_element()
- *
- * Example: assume struct Dummy { int i; }; is item.
- *
- *          DummyID=ced_register_element(sizeof(struct Dummy),0);
- *          ...
- *          struct Dummy *item=(struct Dummy *)ced_add_element(DummyID);
- *            item->i=0;
- * This will add one Dummy item to the event
- */
-void *ced_add(unsigned id);
-
-/*
- * To be called in paint function
- *
- * It calls user defined functions for
- * each item of all elements types.
- */
-void ced_do_draw_event(void);
-
-/*
- * Server side function.
- * Must be used to process all incoming
- * messages from client.
- *
- * It return positive value when
- * new event must be drawn.
- *
- * Example:
- *      glut_tcp_server(7285,my_process_input)
- *
- *      my_process_input(x){
- *        if(ced_process_input(x)>0)
- *          <do redraw>
- */
-int ced_process_input(void *data);
-
-//------------
-void addLayerDescriptionToMenu(int,char *);//glced.c
-void selectFromMenu(int id);//glced.c
-void toggleHelpWindow(void);//glced.c
-void updateLayerEntryInPopupMenu(int); //glced.c
-int buildMenuPopup(void);//glced.c
-
-
-#define VERSION_CONFIG 3
-struct CEDsettings{
-    bool trans;         //grid or surface view
-    bool persp;         //perspectivic view or flat projection 
-    bool antia;         //anti aliasing
-    bool light;         //light source 
-    bool picking_highlight; //marker at picking position
-    double detector_trans[NUMBER_DETECTOR_LAYER];
-    double detector_cut_angle[NUMBER_DETECTOR_LAYER];
-    double detector_cut_z[NUMBER_DETECTOR_LAYER];
-    bool detector_picking;
-//    double cut_angle; //deprecated
-//    double trans_value; //deprecated
-//    double z_cutting; //deprecated
-    bool layer[CED_MAX_LAYER];
-    bool phi_projection;
-    bool z_projection;
-    double view[3];
-    double va; //vertical angle of view
-    double ha; //horionzional angle of view
-    bool fixed_view;
-    int win_h; //height of the window (pixel)
-    int win_w; //wight of the window (pixel)
-    double zoom;
-    double fisheye_alpha;
-    double world_size;
-    double fisheye_world_size;
-    double bgcolor[4];
-    bool show_axes;
-    bool fps;
-    double screenshot_sections;
-    int font; //size of text (menu, shortcuts, text in ced window)
-    bool autoshot; // If true, generate screencapture in every new event
-    int autoshot_scale; // If true, generate screencapture in every new event
-};
-
-/*
-//important: 
-//          - sum of all layers must be smaler than max_layer!
-//          - number_popup_layer must be smaler than number_data_layer
-
-#define CED_MAX_LAYER       100 
-#define NUMBER_POPUP_LAYER      20
-#define NUMBER_DATA_LAYER       25
-#define NUMBER_DETECTOR_LAYER   20
-
-
-#define CED_MAX_LAYER_CHAR 400
-*/
-
-//-------------
-
-//#ifdef __cplusplus
-// }
-//#endif
-
-	
-
-#endif /* __CED_H  */
diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc b/Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc
deleted file mode 100644
index 8c063e12483823a54b7920d92057a2331a5d56e3..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc
+++ /dev/null
@@ -1,539 +0,0 @@
-/* "C" event display.
- * Client side elements definitions.
- *
- * Alexey Zhelezov, DESY/ITEP, 2005 */
-#include <string.h>
-
-#include <ced_cli.h>
-#include <ced.h>
-#include <stdio.h>
-//#include <iostream>
-
-#include <math.h>
-
-
-/*
- * Hit element
- */
-
-static unsigned HIT_ID=0;
-
-void ced_hit(float x,float y,float z,unsigned type,unsigned size,unsigned color){
-  ced_hit_ID(x,y,z, type & 0xFF,( type >> CED_LAYER_SHIFT ) & 0xFF, size,color, 0);
-}
-
-//deprecated
-void ced_hit_ID_old(float x,float y,float z,unsigned type, unsigned size,unsigned color, unsigned lcioID){
-  ced_hit_ID(x,y,z,type & 0xFF,(type >> CED_LAYER_SHIFT) & 0xFF,size,color,lcioID);
-}
-
-void ced_hit_ID(float x,float y,float z,unsigned type,unsigned layer, unsigned size,unsigned color, unsigned lcioID){
- CED_Hit *h=(CED_Hit *)ced_add(HIT_ID);
- if(!h)
-   return;
- h->p.x=x;
- h->p.y=y;
- h->p.z=z;
- h->type=type;
- // if(layer > 255){ //downward compability
- //    h->layer=layer >> CED_LAYER_SHIFT;
- // }else{
- h->layer=layer;
- // }
- h->size=size;
- h->color=color;
- h->lcioID=lcioID;
-}
-
-/*
- * Line element
- */
-
-static unsigned LINE_ID=0;
-
-void ced_line(float x0,float y0,float z0,
-	      float x1,float y1,float z1,
-	      unsigned type, unsigned width,unsigned color){
-    ced_line_ID(x0,y0,z0,x1,y1,z1, type, width, color, 0);
-}
-
-void ced_line_ID(float x0,float y0,float z0,
-	      float x1,float y1,float z1,
-	      unsigned layer, unsigned width,unsigned color, unsigned lcioID){
-//  //test for picking
-//  //static int anz;
-//  float length=(x1-x0)*(x1-x0) + (y1-y0)*(y1-y0) + (z1-z0)*(z1-z0);
-//  //printf("CEDLINE length: %f\n x0 %f y0 %f z0 %f, x1 %f, y1 %f z1 %f", length, x0, y0, z0, x1, y1, z1);
-//
-//  if(length > 500.0){
-//      //std::cout << "devide line (length=" << length << ")" <<   std::endl;
-//      ced_line_ID(x0,y0,z0,
-//          (x1-x0)/2.0+x0,(y1-y0)/2.0+y0,(z1-z0)/2.0+z0,
-//          layer, width, color, lcioID);
-//              ced_line_ID(
-//          (x1-x0)/2.0+x0,(y1-y0)/2.0+y0,(z1-z0)/2.0+z0,
-//
-//          x1,y1,z1,
-//          layer, width, color, lcioID);
-//          //todo
-//          //printf("seperate line %i\n", anz++);
-//      return;
-//
-//  }
-
-/*
-//test
-  if( random()%100000 > 99990){
-    double size[]={10,100,50};
-    double position[]={x0,y0,z0};
-    double rotate[] = {20,50,70};
-    int color=1;
-    int lcio_id=5;
-    int layer=5;
-    //ced_geobox(size, position, color ); 
-    ced_geobox_ID(size, position, layer, 0xff00ff, 5); 
-    ced_geobox(size, position, color);
-
-  }
-
-//end test
-*/
-
-  CED_Line *l=(CED_Line *)ced_add(LINE_ID);
-  if(!l)
-    return;
-  l->p0.x=x0;
-  l->p0.y=y0;
-  l->p0.z=z0;
-  l->p1.x=x1;
-  l->p1.y=y1;
-  l->p1.z=z1;
- if(layer > 255){ //downward compability
-    l->type=layer >> CED_LAYER_SHIFT;
- }else{
-    l->type=layer;
- }
-
-    //printf("layer pre: %i  after: %i\n" , layer, l->type); 
-
-//  l->type=type;
-  l->width=width;
-  l->color=color;
-  l->lcioID=lcioID;
-}
-/*
- * GeoCylinder
- */
-static unsigned GEOC_ID=0;
-
-void ced_geocylinder(float d,unsigned sides,float rotate,float z,float shift,
-		     unsigned color){
-  CED_GeoCylinder *c=(CED_GeoCylinder *)ced_add(GEOC_ID);
-  if(!c)
-    return;
-  c->d=d;
-  c->sides=sides;
-  c->rotate=rotate;
-  c->z=z;
-  c->shift=shift;
-  c->color=color;
-}
-
-/*
- * Rotated Geocylinder
- * Extension of the cylinder subject to a 3-DOF rotation
- * @author: SD
- * @date: 26.08.08
- */
-static unsigned GEOCR_ID=0;
-
-void ced_geocylinder_r(float d, double z, double * center, double * rotate, unsigned sides, 
-		     unsigned int color, int layer){
-	int iDim;
-  CED_GeoCylinderR *c=(CED_GeoCylinderR *)ced_add(GEOCR_ID);
-  if(!c) return;
-    for (iDim = 0; iDim < 3; iDim ++ ) {
-   		c->center[iDim]  = center[iDim];
-   		c->rotate[iDim]   = rotate[iDim];
-    }
-  c->d=d;
-  c->sides=sides;
-  c->color=color;
-  c->z=z;
- if(layer > 255){ //downward compability
-    c->layer=layer >> CED_LAYER_SHIFT;
- }else{
-    c->layer=layer;
- }
-
-  //c->layer=layer;
-}
- 
-void ced_geocylinders(unsigned n,CED_GeoCylinder *all){
-  CED_GeoCylinder *c;
-  unsigned i;
-  for(i=0;i<n;i++){
-    c=(CED_GeoCylinder *)ced_add(GEOC_ID);
-    if(!c)
-      return;
-    memcpy(c,all+i,sizeof(CED_GeoCylinder));
-  }
-}
-
-static unsigned GEOT_ID=0;
-
-void ced_geotubes(unsigned n,CED_GeoTube *all){
-  CED_GeoTube *c;
-  unsigned i;
-  for(i=0;i<n;i++){
-    c=(CED_GeoTube *)ced_add(GEOT_ID);
-    if(!c)
-      return;
-    memcpy(c,all+i,sizeof(CED_GeoTube));
-  }
-}
-
-
-static unsigned GEOB_ID=0;
-
-void ced_geobox(double * sizes, double * center, unsigned int color ) {
-  int iDim;
-  CED_GeoBox * box = (CED_GeoBox*) ced_add(GEOB_ID);
-  if ( ! box ) return;
-  for ( iDim = 0; iDim < 3; iDim ++ ) {
-    box->sizes[iDim]   = sizes[iDim];
-    box->center[iDim]  = center[iDim];
-  }
-  box->color   = color;
-
-}
-
-void rotate3d(double *vektor, double *rotate){
-    //double cords2[3]; 
-    double r_rad[3]={rotate[0]/360*2*3.14159265358979323846, rotate[1]/360*2*3.14159265358979323846, rotate[2]/360*2*3.14159265358979323846};
-    double cords1[3] = {vektor[0], vektor[1], vektor[2]};
-
-    vektor[0] = ( cos(r_rad[1])*cos(r_rad[2]) )*cords1[0] + 
-                (-cos(r_rad[0])*sin(r_rad[2]) + sin(r_rad[0])*sin(r_rad[1])*cos(r_rad[2]) )*cords1[1] + 
-                ( sin(r_rad[0])*sin(r_rad[2]) + cos(r_rad[0])*sin(r_rad[1])*cos(r_rad[2]) )*cords1[2];
-    vektor[1] = ( cos(r_rad[1])*sin(r_rad[2]) ) * cords1[0] + 
-                ( cos(r_rad[0])*cos(r_rad[2]) + sin(r_rad[0])*sin(r_rad[1])*sin(r_rad[2])) * cords1[1] + 
-                ( -sin(r_rad[0])*cos(r_rad[2]) + cos(r_rad[0])*sin(r_rad[1])*sin(r_rad[2]) ) * cords1[2];
-    vektor[2] = (-sin(r_rad[1])) * cords1[0] + 
-                ( sin(r_rad[0])*cos(r_rad[1])) * cords1[1] + 
-                ( cos(r_rad[0])*cos(r_rad[1]))  * cords1[2];
- 
-}
-
-void ced_geobox_r_ID(double *size, double *position, double *rotate, unsigned int layer, unsigned int color, unsigned int lcio_id) {
-
-    int i;
-    double vektor1[3], vektor2[3];
-    //unsigned int type = layer; //<< CED_LAYER_SHIFT;
-    //unsigned int type = layer;
-
-    double cubematrix[12][6] ={ {-1,-1,-1, +1,-1,-1},
-                                {-1,-1,-1, -1,+1,-1},
-                                {-1,-1,-1, -1,-1,+1},
-                                {+1,-1,-1, +1,+1,-1},
-                                {+1,-1,-1, +1,-1,+1},
-                                {+1,+1,-1, +1,+1,+1},
-                                {+1,+1,-1, -1,+1,-1},
-                                {+1,+1,+1, -1,+1,+1},
-                                {+1,+1,+1, +1,-1,+1},
-                                {-1,+1,+1, -1,-1,+1},
-                                {-1,+1,+1, -1,+1,-1},
-                                {-1,-1,+1, +1,-1,+1} };
-
-    for(i=0;i<12;i++){
-        vektor1[0] = cubematrix[i][0]*size[0]/2; 
-        vektor1[1] = cubematrix[i][1]*size[1]/2; 
-        vektor1[2] = cubematrix[i][2]*size[2]/2;
- 
-        vektor2[0] = cubematrix[i][3]*size[0]/2;
-        vektor2[1] = cubematrix[i][4]*size[1]/2;
-        vektor2[2] = cubematrix[i][5]*size[2]/2;
-
-        rotate3d(vektor1,rotate);
-        rotate3d(vektor2,rotate);
-
-
-        ced_line_ID(position[0]+vektor1[0], position[1]+vektor1[1], position[2]+vektor1[2],
-                    position[0]+vektor2[0], position[1]+vektor2[1], position[2]+vektor2[2],
-                    layer, 1,color, lcio_id);
-    }
-}
-
-void ced_geobox_ID(double *size, double *position, unsigned int layer, unsigned int color, unsigned int lcio_id) {
-    double rotate[3]={0.0, 0.0, 0.0};
-    ced_geobox_r_ID(size, position, rotate, layer,  color, lcio_id);
-}
-
-
-void ced_geoboxes(unsigned int nBox, CED_GeoBox * allBoxes ) {
-  
-  CED_GeoBox * box;
-  unsigned int iBox;
-  for ( iBox = 0; iBox < nBox ; iBox++ ) {
-    box = (CED_GeoBox *) ced_add(GEOB_ID);
-    if ( ! box ) return;
-    memcpy( box, allBoxes + iBox, sizeof(CED_GeoBox) );
-  }
-}
-
-static unsigned GEOBR_ID=0;
-
-void ced_geobox_r(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer) {
-  int iDim;
-  CED_GeoBoxR * box = (CED_GeoBoxR*) ced_add(GEOBR_ID);
-  if ( ! box ) return;
-  for ( iDim = 0; iDim < 3; iDim ++ ) {
-    box->sizes[iDim]   = sizes[iDim];
-    box->center[iDim]  = center[iDim];
-    box->rotate[iDim] = rotate[iDim];
-  }
-  box->color = color;
-
- if(layer > 255){ //downward compability
-    box->layer=layer >> CED_LAYER_SHIFT;
- }else{
-    box->layer=layer;
- }
-
-//  box->layer = layer;
-}
-
-static unsigned GEOBRS_ID=0;
-
-void ced_geobox_r_solid(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer) {
-  int iDim;
-  CED_GeoBoxR * box = (CED_GeoBoxR*) ced_add(GEOBRS_ID);
-  if ( ! box ) return;
-  for ( iDim = 0; iDim < 3; iDim ++ ) {
-    box->sizes[iDim]   = sizes[iDim];
-    box->center[iDim]  = center[iDim];
-    box->rotate[iDim] = rotate[iDim];
-  }
-  box->color = color;
-
- if(layer > 255){ //downward compability
-    box->layer=layer >> CED_LAYER_SHIFT;
- }else{
-    box->layer=layer;
- }
-
-//  box->layer = layer;
-}
-
-static unsigned LEGEND_ID=0;
-
-void ced_legend(float ene_min, float ene_max, unsigned int color_steps, unsigned int ** rgb_matrix, unsigned int ticks, char scale) {
-	CED_Legend * legend = (CED_Legend*) ced_add(LEGEND_ID);
-	if ( ! legend ) return;
-	
-	legend->ene_min = ene_min;
-  	legend->ene_max = ene_max;
- 	legend->color_steps = color_steps;
- 	legend->ticks = ticks;
- 	legend->scale = scale;
- 	
-  	const unsigned int numberOfColours = 3;
-  	unsigned int i,j;
-  	for (i = 0; i < numberOfColours; i ++ ) {
-  		for (j = 0; j < color_steps; j ++ ) {
-  			legend->rgb_matrix[j][i] = rgb_matrix[j][i];
-  		}
-	}
-}
-//hauke 
-static unsigned TEXT_ID=0;
-
-void ced_describe_layer(const char *message, int id) {
-    //printf("ced_describe layer id=%i text: %s\n", id, message);
-
-    if(id >= CED_MAX_LAYER){
-        printf("WARNING: ced_describe_layer: Index out of range!\n");
-        return;
-    }
-
-	CED_TEXT *text = (CED_TEXT*) ced_add(TEXT_ID);
-	if(!text){
-        printf("WARNING: ced_describe_layer: cant register CED_TEXT");  
-        return;
-    }
-
-    strncpy(text->text,message,CED_MAX_LAYER_CHAR-1);
-    text->text[CED_MAX_LAYER_CHAR-1] = 0;
-    text->id=id;
-
-    //text->x=xCordinate;
-    //text->y=yCordinate;
-}
-
-/*
-static unsigned LAYER_TEXT_ID=0;
-
-void ced_layer_text(char *message, int id) {
-	LAYER_TEXT *obj = (LAYER_TEXT*) ced_add(LAYER_TEXT_ID);
-	if (!obj){ 
-        printf("ced_layer_text FAILED\n"); 
-        return;
-    }
-    strncpy(obj->str,message,CED_MAX_LAYER_CHAR-1);
-    obj->id=id;
-    //printf("ced_layer_text\n");
-}
-*/
-
-static unsigned PICKING_TEXT_ID=0;
-
-void ced_picking_text(const char *message, int id) {
-	CED_PICKING_TEXT *text = (CED_PICKING_TEXT*) ced_add(PICKING_TEXT_ID);
-	if(!text){
-        printf("WARNING: ced_picking_text: cant register CED_PICKING_TEXT");  
-        return;
-    }
-
-    strncpy(text->text,message,999);
-    text->id=id;
-    //text->text[CED_MAX_LAYER_CHAR-1] = 0;
-    //text->id=id;
-    //text->x=xCordinate;
-    //text->y=yCordinate;
-}
-//end hauke
-
-static unsigned CONER_ID=0;
-
-void ced_cone_r(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor) {
-    ced_cone_r_ID(base,height,center,rotate,layer, RGBAcolor, 0);
-}
-
-void ced_cone_r_ID(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor, int lcioid) {
-	CED_ConeR * cone = (CED_ConeR*) ced_add(CONER_ID);
-	if ( ! cone ) return;
-	
-	cone->base = base;
-  	cone->height = height;
-
- if(layer > 255){ //downward compability
-    cone->layer=layer >> CED_LAYER_SHIFT;
- }else{
-    cone->layer=layer;
- }
-
-// 	cone->layer = layer;
-    cone->lcioid = lcioid;
- 	
-  	const unsigned int dim = 3;
-  	const unsigned int channel = 4;
-  	unsigned int i, j;
-
-    // ced_line_ID(0,0,0, center[0], center[1], center[2], type, width, RGBAcolor, lcioid);
-
-    //ced_line_ID(center[0], center[1], center[2], rotate[0], rotate[1], rotate[2], layer, 1, RGBAcolor, lcioid);
-    //printf("CONE: from %f %f %f to %f %f %f\n", center[0], center[1], center[2], rotate[0], rotate[1], rotate[2]);
-
-  	for (i = 0; i < dim; i ++ ) {
-		cone->center[i] = center[i];
-		cone->rotate[i] = rotate[i];
-	}
-	for (j = 0; j < channel; j ++ ) {
-		cone->RGBAcolor[j] = RGBAcolor[j];
-	}
-}
-
-static unsigned ELLIPSOID_ID=0;
-
-void ced_ellipsoid_r(double *size, double *center, double *rotate, unsigned int layer, int color) {
-    ced_ellipsoid_r_ID(size, center, rotate, layer, color, 0);
-}
-
-void ced_ellipsoid_r_ID(double *size, double *center, double *rotate, unsigned int layer, int color, int lcioID) {
-	
-	CED_EllipsoidR * eli = (CED_EllipsoidR*) ced_add(ELLIPSOID_ID);
-	if ( ! eli ) return;	
- 	
-  	const unsigned int dim = 3;
-  	unsigned int i;
-  	for (i = 0; i < dim; i ++ ) {
-		eli->center[i] = center[i];
-		eli->rotate[i] = rotate[i];
-		eli->size[i] = size[i];
-	}
-	eli->color = color;
-
- if(layer > 255){ //downward compability
-    eli->layer=layer >> CED_LAYER_SHIFT;
- }else{
-    eli->layer=layer;
- }
-
-//	eli->layer = layer;
-    eli->lcioid = lcioID;
-}
-
-static unsigned CLUELLIPSE_ID=0;
-
-void ced_cluellipse_r(float radius, float height, float *center, double *rotate, unsigned int layer, int color) {
-    ced_cluellipse_r_ID(radius, height, center, rotate, layer, color, 0);
-}
-
-void ced_cluellipse_r_ID(float radius, float height, float *center, double *rotate, unsigned int layer, int color, int lcioid) { //hauke
-	
-	CED_CluEllipseR * eli = (CED_CluEllipseR*) ced_add(CLUELLIPSE_ID);
-	if ( ! eli ) return;	
- 	
-  	const unsigned int dim = 3;
-  	unsigned int i;
-  	for (i = 0; i < dim; i ++ ) {
-		eli->center[i] = center[i];
-		eli->rotate[i] = rotate[i];
-	}
-	eli->radius = radius;
-	eli->height = height;
-
- if(layer > 255){ //downward compability
-    eli->layer=layer >> CED_LAYER_SHIFT;
- }else{
-    eli->layer=layer;
- }
-
-//	eli->layer = layer;
-	eli->color = color;
-    eli->lcioid=lcioid;
-}
-
-
-void ced_register_elements(void){
-
-  //1:
-  GEOC_ID		=ced_register_element(sizeof(CED_GeoCylinder),0);
-  //2:
-  GEOCR_ID	    =ced_register_element(sizeof(CED_GeoCylinderR), 0);
-  //3:
-  LINE_ID		=ced_register_element(sizeof(CED_Line),0);
-  //4:
-  HIT_ID		=ced_register_element(sizeof(CED_Hit),0);
-  //5:
-  GEOB_ID		=ced_register_element(sizeof(CED_GeoBox), 0);
-  //6:
-  GEOBR_ID	    =ced_register_element(sizeof(CED_GeoBoxR), 0);
-  //7:
-  GEOBRS_ID	    =ced_register_element(sizeof(CED_GeoBoxR), 0);
-  //8:
-  CONER_ID	    =ced_register_element(sizeof(CED_ConeR), 0);
-  //9:
-  ELLIPSOID_ID	=ced_register_element(sizeof(CED_EllipsoidR), 0);
-  //10:
-  CLUELLIPSE_ID =ced_register_element(sizeof(CED_CluEllipseR), 0);
-  //11:
-  TEXT_ID       =ced_register_element(sizeof(CED_TEXT),0); //hauke: the order of this items is important
-  //12:
-  LEGEND_ID	    =ced_register_element(sizeof(CED_Legend), 0);
-  //13: 
-  GEOT_ID       =ced_register_element(sizeof(CED_GeoTube),0);
-  //14:
-  PICKING_TEXT_ID =ced_register_element(sizeof(CED_PICKING_TEXT),0);
-}
-
diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.h b/Reconstruction/PFA/Pandora/CED/CED/ced_cli.h
deleted file mode 100644
index a92164b00f4aae239918a02e4874c058553d0cb4..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/* "C" event display.
- * Enduser accessable API.
- *
- * Alexey Zhelezov, DESY/ITEP, 2005 
- */
-
-#ifndef __CED_CLI_H
-#define __CED_CLI_H
-
-#include <ced_config.h>
-
-
-//important:
-//          - sum of all layers must be smaler than max_layer!
-//          - number_popup_layer must be smaler than number_data_layer
-
-//#define CED_MAX_LAYER       100
-//#define NUMBER_POPUP_LAYER      20
-//#define NUMBER_DATA_LAYER       25
-//#define NUMBER_DETECTOR_LAYER   20
-//
-//
-//#define CED_MAX_LAYER_CHAR 400
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This is the first function to call (before any other).
- *
- *  host - host with CED (must be "localhost")
- *  port - server port number (let say 7285 :)
- *
- * NOTE: ced_register_elements() must be called
- *       separately.
- */
-void ced_client_init(const char *host,unsigned short port);
-
-/*
- * Cancel current event output. So, all elements
- * queued will be discarded.
- *
- * Good to call at the begining of every event processing.
- */
-void ced_new_event(void);
-
-
-/*
- * This function really attempt to display event in CED.
- * When CED is not available, this function discard
- * current event information.
- *
- * NOTE: between ced_new_event() and ced_draw_event()
- *       must be some element creation calls.
- */
-void ced_draw_event(void);
-
-/*
- * This function really attempt to display event in CED.
- * Unlike ced_draw_event() does not reset the event.
- *
- * NOTE: between ced_new_event() and ced_draw_event()
- *       must be some element creation calls.
- */
-void ced_send_event(void);
-
-int ced_selected_id(void);
-
-//hauke
-int ced_selected_id_noblock(void);
-
-
-/*********************************************
- *
- * The following is elements API.
- *
- *********************************************/
-
-void ced_register_elements(void);
-
-typedef enum {
-  CED_TYPE_SHIFT=0x0,
-  CED_LAYER_SHIFT=0x8
-} CED_TYPE_BITS;
-
-/*
-typedef enum {
-  CED_TYPE_SHIFT=0x0,
-  CED_LAYER_SHIFT=0x0
-} CED_TYPE_BITS;
-*/
-
-
-typedef struct {
-  float x;
-  float y;
-  float z;
-} CED_Point;
-
-//class CED_Point{
-//  public:
-//  CED_Point(float _x, float _y, float _z){
-//       x=_x;
-//       y=_y;
-//       z=_z;
-//   }
-//
-//  CED_Point(void){
-//  }
-//  float x;
-//  float y;
-//  float z;
-//}; 
-
-
-/*
- * Hit element
- */
-
-typedef enum {
-    CED_HIT_POINT=0,
-    CED_HIT_CROSS,
-    CED_HIT_STAR,
-    CED_HIT_BOX,
-    CED_HIT_VXD
-} CED_HIT_TYPE;
-
-typedef struct {
-  CED_Point p;
-  unsigned type;  // point, star, etc
-  unsigned layer; //layer
-  unsigned color; // in ARGB form (so, 0xff0000 is RED)
-  unsigned size;  // size of point/size of cross
-  unsigned lcioID; // unique id of LICO object
-} CED_Hit;
-
-void ced_hit(float x,float y,float z,unsigned type,unsigned size,unsigned color);
-
-//to give a bit of downward compatibility
-void ced_hit_ID_old(float x,float y,float z,unsigned type, unsigned size,unsigned color, unsigned lcioID);
-
-
-void ced_hit_ID(float x,float y,float z,unsigned type,unsigned layer, unsigned size,unsigned color, unsigned lcioID);
-
-/*
- * Line element
- */
-
-typedef struct {
-  CED_Point p0;
-  CED_Point p1;
-  unsigned type;  // not yet defined...
-  unsigned width; // not yet defined...
-  unsigned color; // in ARGB form (so, 0xff0000 is RED)
-  unsigned lcioID; // unique id of LICO object
-
-} CED_Line;
-
-void ced_line(float x0,float y0,float z0,
-	      float x1,float y1,float z1,
-	      unsigned type,unsigned width,unsigned color);
-void ced_line_ID(float x0,float y0,float z0,
-	      float x1,float y1,float z1,
-	      unsigned type,unsigned width,unsigned color, unsigned lcioID);
-
-/*
- * GeoCylinder
- */
-typedef struct {
-  float d;       // radius
-  unsigned  sides;   // poligon order
-  float rotate;  // angle degree
-  float z;       // 1/2 length
-  float shift;   // in z
-  unsigned color;
-} CED_GeoCylinder;
-
-/*
- * GeoTube
- */
-typedef struct {
-  float r_o;            // outer radius
-  float r_i;            // inner radius
-  unsigned edges_o;     // edges outer
-  unsigned edges_i;     // edges inner
-  float rotate_o;       // angle degree, rotate outer cylinder
-  float rotate_i;       //rotate inner cylinder
-  float z;              // 1/2 length
-  float shift;          // shift in z
-  unsigned color;       // color
-  unsigned type;        //describes the layer where this element lies
-  bool classic_inner;   //draw the outer detector lines in classic view?
-  bool classic_outer;   //draw the inner detector lines in classic view?
-}  CED_GeoTube;
-
-
-/** Same as CED_GeoTube but here as C++ struct with contstructor. This is allows
- *  to dynamically allocate the detector structure (in an std::vector using the constructor) 
- *  without knowing the exact number of  detector elements a priori (such as the #layers in the FTD).
- *  This wasn't poassible with the static allocation using the C type struct.
- *  ( Used in MArlinCED::drawGearDetector ).
- */
-struct CEDGeoTube{
-  CEDGeoTube(double  r_out,
-	     double  r_in,
-	     int edges_out,
-	     int edges_in,
-	     double  rotate_out,
-	     double  rotate_in,
-	     double  zlength,
-	     double  zshift,
-	     int col,
-	     int layer,
-	     bool classic_i,
-	     bool classic_o ) :
-    r_o(r_out),
-    r_i(r_in),
-    edges_o(edges_out),
-    edges_i (edges_in),
-    rotate_o (rotate_out),
-    rotate_i (rotate_in),
-    z( zlength),
-    shift (zshift),
-    color (col),
-    type(layer),
-    classic_inner(classic_i),
-    classic_outer(classic_o) {} 
-  float r_o;            // outer radius
-  float r_i;            // inner radius
-  unsigned edges_o;     // edges outer
-  unsigned edges_i;     // edges inner
-  float rotate_o;       // angle degree, rotate outer cylinder
-  float rotate_i;       //rotate inner cylinder
-  float z;              // 1/2 length
-  float shift;          // shift in z
-  unsigned color;       // color
-  unsigned type;        //describes the layer where this element lies
-  bool classic_inner;   //draw the outer detector lines in classic view?
-  bool classic_outer;   //draw the inner detector lines in classic view?
-} ;
-
-void ced_geotubes(unsigned n,CED_GeoTube *all);
-
-
-void ced_geocylinder(float d,unsigned sides,float rotate,float z,float shift,
-		     unsigned color);
-
-void ced_geocylinders(unsigned n,CED_GeoCylinder *all);
-		   
-/*
- * GeoCylinder rotatable
- * @author: S.Daraszewicz (UoE)
- * @date: 01.09.09
- */
-typedef struct {
-  float d;       	// radius
-  unsigned sides; 	// poligon order
-  float center[3];  // cylinder centre z,y,z
-  float rotate[3];  // rotation angles wrt x,y,z axis
-  float z;       	// length
-  unsigned color;	// colour
-  unsigned layer; 	// layer the Cylinder to be displayed onto
-} CED_GeoCylinderR;
-		   
-		     
-void ced_geocylinder_r(float d, double z, double * center, double * rotate, unsigned sides, 
-		     unsigned int color, int layer);
-		     
-
-  /** GeoBox structure
-   */
-  typedef struct {
-    /** The three box sizes in mm */
-    double sizes[3];
-    /** position of the center of the box*/
-    double center[3];
-    /** box color */
-    unsigned int color;
-  } CED_GeoBox;
-
-  /** Send/Draw a box at position center (x,y,z in mm) with lengths along the 
-   * axes specified in sizes.
-   * 
-   * @author A.Bulgheroni, INFN
-   */
-  void ced_geobox(double * sizes, double * center, unsigned int color );
-  void ced_geobox_ID(double *size, double *position, unsigned int layer, unsigned int color, unsigned int lcio_id);
-  void ced_geobox_r_ID(double *size, double *position, double *rotate, unsigned int layer, unsigned int color, unsigned int lcio_id);
-  void rotate3d(double *vektor, double *rotate);
-
-
-
-   /* 
-   * @author A.Bulgheroni, INFN
-   */
-  void ced_geoboxes( unsigned int nBox, CED_GeoBox * allBoxes);
-
-  typedef struct {
-    /** The three box sizes in mm */
-    double sizes[3];
-    /** position of the center of the box*/
-    double center[3];
-    /** box color */
-    unsigned int color;
-    /** rotation angle in degrees */
-    double rotate[3];
-    /** layer for toggling display */
-    unsigned int layer;
-  } CED_GeoBoxR;
-
-void ced_geobox_r(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer);
-void ced_geobox_r_solid(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer);
-
-//hauke
-  typedef struct{
-    char text[1000];
-    int id;
-  } CED_PICKING_TEXT; 
-
-void ced_picking_text(const char *, int number);
-
-//--------
-
-  typedef struct{
-    char text[400];
-    int id;
-  } CED_TEXT; 
-
-
-void ced_describe_layer(const char *, int); //, int, int);
-
-
-  typedef struct{
-    char str[400];
-    unsigned int id;
-  } LAYER_TEXT; 
-
-void ced_layer_text(char *, int);
-//end hauke
-
-
-/*
- * Energy spectrum colour map legend.
- * @author: S.Daraszewicz (UoE)
- * @date: 01.09.09
- */
-  typedef struct {  
-  	/** min energy on the legend */	
-  	float ene_max;
-  	/** max energy on the legend */
-  	float ene_min;
-  	/** number of ticks on the legend */
-  	unsigned int ticks;
-  	/** spectrum colour steps */
-  	unsigned int color_steps; 
-  	/** spectrum colour matrix */
-  	unsigned int rgb_matrix[512][3]; //FIX ME: 512 size not changed with color_steps
-  	/** LOG or LIN */
-  	char scale;
-  } CED_Legend;
-
-void ced_legend(float ene_min, float ene_max, unsigned int color_steps, unsigned int ** rgb_matrix, unsigned int ticks, char scale);
-
-  typedef struct {  
-  	/** position of the centre of the base */	
-  	double center[3];
-  	/** rotation matrix */
-  	double rotate[3];
-    /** layer for toggling display */
-    unsigned int layer;
-    /** base radius */
-    float base;
-    /** height */
-    float height;
-    /** RGBA color */
-    float RGBAcolor[4];
-    unsigned lcioid; //hauke
-  } CED_ConeR;
-
-
-void ced_cone_r(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor);
-void ced_cone_r_ID(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor, int lcioid); //hauke
-
-
-  typedef struct {  
-  	/** position of the centre of the base */	
-  	double center[3];
-  	/** rotation matrix */
-  	double rotate[3];
-    /** layer for toggling display */
-    unsigned int layer;
-    /** xyz size */
-	double size[3];
-    /** RGBA color */
-   	int color;
-    unsigned lcioid; //hauke
-  } CED_EllipsoidR;
-
-
-void ced_ellipsoid_r(double *size, double *center, double *rotate, unsigned int layer, int color);
-void ced_ellipsoid_r_ID(double *size, double *center, double *rotate, unsigned int layer, int color, int lcioid); //hauke
-
-
-  typedef struct {  
-  	/** position of the centre of the base */	
-  	double center[3];
-  	/** rotation matrix */
-  	double rotate[3];
-    /** layer for toggling display */
-    unsigned int layer;
-    /** base radius */
-	float radius;
-	/** half height */
-	float height;
-    /** RGBA color */
-    int color;
-    unsigned lcioid; //hauke
-  } CED_CluEllipseR;
-
-
-void ced_cluellipse_r(float radius, float height, float *center, double *rotate, unsigned int layer, int color);
-void ced_cluellipse_r_ID(float radius, float height, float *center, double *rotate, unsigned int layer, int color, int lcioid); //hauke
-
-
-#ifdef __cplusplus
- }
-#endif
-	
-
-#endif /* __CED_CLI_H */
diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced_config.h b/Reconstruction/PFA/Pandora/CED/CED/ced_config.h
deleted file mode 100644
index 66214eada39ed69548a69765def00a0020f7a637..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/CED/CED/ced_config.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/********************************************************** 
-* ced_config.h, CED config file                           *    
-* Hauke Hoelbe, DESY, 2011                                *
-* Headerfile to adapt CED before the build.               *
-**********************************************************/
-
-#ifndef __CED_CONFIG
-#define __CED_CONFIG
-
-#include "ced_cli.h"
-
-
-/********************************************************** 
-* Handling                                                *
-**********************************************************/
-//enable zoom function by right click and pull
-#define ZOOM_RIGHT_CLICK                   0
-
-//time when 2 clicks should be a double click, in 1/1000000 secounds
-#define DOUBLE_CLICK_TIME                  300000 
-
-//data layer keys 
-#define DATALAYER_SHORTKEY_00       '0'
-#define DATALAYER_SHORTKEY_01       '1'
-#define DATALAYER_SHORTKEY_02       '2'
-#define DATALAYER_SHORTKEY_03       '3'
-#define DATALAYER_SHORTKEY_04       '4'
-#define DATALAYER_SHORTKEY_05       '5'
-#define DATALAYER_SHORTKEY_06       '6'
-#define DATALAYER_SHORTKEY_07       '7'
-#define DATALAYER_SHORTKEY_08       '8'
-#define DATALAYER_SHORTKEY_09       '9'
-#define DATALAYER_SHORTKEY_10       ')'
-#define DATALAYER_SHORTKEY_11       '!'
-#define DATALAYER_SHORTKEY_12       '@'
-#define DATALAYER_SHORTKEY_13       '#'
-#define DATALAYER_SHORTKEY_14       '$'
-#define DATALAYER_SHORTKEY_15       '%'
-#define DATALAYER_SHORTKEY_16       '^'
-#define DATALAYER_SHORTKEY_17       '&'
-#define DATALAYER_SHORTKEY_18       '*'
-#define DATALAYER_SHORTKEY_19       '('
-#define DATALAYER_SHORTKEY_20       't'
-#define DATALAYER_SHORTKEY_21       'y'
-#define DATALAYER_SHORTKEY_22       'u'
-#define DATALAYER_SHORTKEY_23       'i'
-#define DATALAYER_SHORTKEY_24       'o'
-
-//detector layer keys
-#define DETECTORLAYER_SHORTKEY_00   'j'
-#define DETECTORLAYER_SHORTKEY_01   'k'
-#define DETECTORLAYER_SHORTKEY_02   'l'
-#define DETECTORLAYER_SHORTKEY_03   ';'
-#define DETECTORLAYER_SHORTKEY_04   '\''
-#define DETECTORLAYER_SHORTKEY_05   'p'
-#define DETECTORLAYER_SHORTKEY_06   '['
-#define DETECTORLAYER_SHORTKEY_07   ']'
-#define DETECTORLAYER_SHORTKEY_08   '\\'
-#define DETECTORLAYER_SHORTKEY_09   'T'
-#define DETECTORLAYER_SHORTKEY_10   'Y'
-#define DETECTORLAYER_SHORTKEY_11   'U'
-#define DETECTORLAYER_SHORTKEY_12   'I'
-#define DETECTORLAYER_SHORTKEY_13   'O'
-#define DETECTORLAYER_SHORTKEY_14   'P'
-#define DETECTORLAYER_SHORTKEY_15   '{'
-#define DETECTORLAYER_SHORTKEY_16   '}'
-#define DETECTORLAYER_SHORTKEY_17   '|'
-#define DETECTORLAYER_SHORTKEY_18   'a'
-#define DETECTORLAYER_SHORTKEY_19   'e'
-
-
-/********************************************************** 
-* Colors and appearance                                   *
-**********************************************************/
-//size of the boarder line in filled (new view) of detector components.
-#define CED_GEOTUBE_LINE_WIDTH              0.3
-
-//maximal transparency of boarder lines 
-//#define CED_GEOTUBE_LINE_MAX_TRANS          0.2  
-#define CED_GEOTUBE_LINE_MAX_TRANS          1.0  
-
-
-//names and values of color apairs in popup menu
-#define CED_BGCOLOR_OPTION1_NAME            "Gainsboro" 
-#define CED_BGCOLOR_OPTION1_COLORCODE       0.862745,0.862745,0.862745,0 
-
-#define CED_BGCOLOR_OPTION2_NAME            "Lightgrey" 
-#define CED_BGCOLOR_OPTION2_COLORCODE       0.827451,0.827451,0.827451,0
-
-#define CED_BGCOLOR_OPTION3_NAME            "Darkgray" 
-#define CED_BGCOLOR_OPTION3_COLORCODE       0.662745,0.662745,0.662745,0
-
-#define CED_BGCOLOR_OPTION4_NAME            "Gray" 
-#define CED_BGCOLOR_OPTION4_COLORCODE       0.501961,0.501961,0.501961,0
-
-#define CED_BGCOLOR_OPTION5_NAME            "Silver" 
-#define CED_BGCOLOR_OPTION5_COLORCODE       0.7529,0.7529,0.7529,0
-
-#define CED_BGCOLOR_OPTION6_NAME            "Dimgray" 
-#define CED_BGCOLOR_OPTION6_COLORCODE       0.4118,0.4118,0.4118,0
-
-#define CED_BGCOLOR_OPTION7_NAME            "Lightsteelblue" 
-#define CED_BGCOLOR_OPTION7_COLORCODE       0.6902,0.7686 ,0.8706,0
-
-#define CED_BGCOLOR_OPTION8_NAME            "Steelblue" 
-#define CED_BGCOLOR_OPTION8_COLORCODE       0.2745,0.5098,0.70588,0
-
-#define CED_BGCOLOR_OPTION9_NAME            "Seagreen" 
-#define CED_BGCOLOR_OPTION9_COLORCODE       0.18039,0.54509,0.34117,0
-
-#define CED_BGCOLOR_OPTION10_NAME           "Orange" 
-#define CED_BGCOLOR_OPTION10_COLORCODE      1,0.647,0,0
-
-#define CED_BGCOLOR_OPTION11_NAME           "Yellow" 
-#define CED_BGCOLOR_OPTION11_COLORCODE      1,1,0,0
-
-#define CED_BGCOLOR_OPTION12_NAME           "Violett" 
-#define CED_BGCOLOR_OPTION12_COLORCODE      0.9333,0.5098,0.9333,0
-
-#define CED_BGCOLOR_OPTION13_NAME           "Black" 
-#define CED_BGCOLOR_OPTION13_COLORCODE      0,0,0,0
-
-#define CED_BGCOLOR_OPTION14_NAME           "Blue" 
-#define CED_BGCOLOR_OPTION14_COLORCODE      0,0.2,0.4,0
-
-#define CED_BGCOLOR_OPTION15_NAME           "White" 
-#define CED_BGCOLOR_OPTION15_COLORCODE      1,1,1,0
-
-
-
-
-//Color of xyz axes 
-#define AXES_COLOR                          0.2,0.2,0.8
-
-//Width of xyz axes 
-#define AXES_LINE_SIZE                      0.5
-
-
-//Help frame: Frame fill color, and transp
-#define HELP_FRAME_FILL_COLOR               0.5,1,1,0.8
-
-//Help frame: Frame boarder color and transp
-#define HELP_FRAME_BOARDER_COLOR            0.1,0.8,1.0,0.8 
-
-//Help frame: Frame boarder line width
-#define HELP_FRAME_BOARDER_LINE_SIZE        3. 
-
-//Help frame: Text color, and transp
-#define HELP_FRAME_TEXT_COLOR               0.0,0.0,0.0 
-
-
-
-
-/********************************************************** 
-* Layers                                                  *
-**********************************************************/
-//number of total number of layers 
-#define CED_MAX_LAYER                       100
-
-//number of layers shown in popup menu
-#define NUMBER_POPUP_LAYER                  20
-
-//number of layers reserved for data
-#define NUMBER_DATA_LAYER                   25
-
-//number of layers reserved for detector components 
-#define NUMBER_DETECTOR_LAYER               20
-
-//layer description text: maximal number of chars for one entry
-#define CED_MAX_LAYER_CHAR                  400
-
-/********************************************************** 
-* Graphics                                                *
-**********************************************************/
-
-//Camera field of view, in degree 
-#define CAMERA_FIELD_OF_VIEW                45
-
-//Camera min distance (hint: min and max should be close together)
-#define CAMERA_MIN_DISTANCE                 100
-
-//Camera max distance (hint: min and max should be close together)
-#define CAMERA_MAX_DISTANCE                 50000.0*mm.sf+50000/mm.sf 
-
-//Where the camera stands
-#define CAMERA_POSITION                     0,0,2000
-
-
-
-//Fisheye alpha factor
-#define FISHEYE_ALPHA                       1e-3
-#define FISHEYE_ZOOM                        8.
-
-/********************************************************** 
-* Debug                                                   *
-**********************************************************/
-
-//show pickable points:
-//#define DEBUG_PICKING 1
-
-
-
-
-#endif 
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt
index 46344f83049f4e45f51d5646fd3d24c142f70402..69a1ec90837073ba19b8038a71c0a190a1884f0a 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt
@@ -1,11 +1,6 @@
 gaudi_subdir(GaudiPandora v0r0)
 
 find_package(CLHEP REQUIRED)
-#find_package(GSL REQUIRED )##don't use this,  use CEPC LCIO version one , due to the ClusterShape.cc file which is from LCIO
-#message("GSL: ${GSL_LIBRARIES} ")
-set (gsl_include "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/include")
-set (gsl_lib1 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgsl.so")
-set (gsl_lib2 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgslcblas.so")
 find_package(LCIO REQUIRED ) 
 find_package(GEAR REQUIRED)
 message("ENV GEAR: $ENV{GEAR}")
@@ -25,13 +20,11 @@ link_libraries(${LCContent_LIBRARIES})
 list(APPEND CMAKE_MODULE_PATH "$ENV{ROOTSYS}/etc/cmake/")
 find_package(ROOT 5.26.00 REQUIRED COMPONENTS Eve Geom RGL EG)
 
-#In order to use ClusterShape.cc
-include_directories("../CED/CED/")
-include_directories("../MarlinUtil/01-08/source/")
 
 gaudi_depends_on_subdirs(
     Service/EventSeeder
     Service/GearSvc
+    Utilities/DataHelper
 )
 
 set(dir_srcs
@@ -41,14 +34,12 @@ set(dir_srcs
     src/CaloHitCreator.cpp
     src/TrackCreator.cpp
     src/PfoCreator.cpp
-    ../CED/CED/*.cc
-    ../MarlinUtil/01-08/source/*.cc
 )
 set(dir_include include)
 # Modules
 gaudi_add_module(GaudiPandora ${dir_srcs}
-    INCLUDE_DIRS ${gsl_include} ${dir_include} GaudiKernel FWCore CLHEP  ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear  
-    LINK_LIBRARIES ${gsl_lib1} ${gsl_lib2} GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so 
+    INCLUDE_DIRS ${dir_include} GaudiKernel FWCore CLHEP  ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear  
+    LINK_LIBRARIES GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so DataHelperLib 
       -Wl,--no-as-needed 
       EDM4HEP::edm4hep EDM4HEP::edm4hepDict
       -Wl,--as-needed 
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h
index 0e447790098de21001fb6c07cc3915af81ca8b8a..e357bd34b55532325758d9f45ac9ea0dbfb34868 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h
@@ -275,26 +275,12 @@ protected:
 
   Gaudi::Property< std::string >              m_AnaOutput{ this, "AnaOutput", "/junofs/users/wxfang/MyGit/CEPCSW/Reconstruction/PFA/Pandora/GaudiPandora/Ana.root" };
   //######################
+  std::map< std::string, std::string > m_collections;
+  Gaudi::Property<std::vector<std::string>> m_readCols{this, "collections", {}, "Places of collections to read"};
+ //the map of collection name to its corresponding DataHandle
+  std::map<std::string, DataObjectHandleBase*> m_dataHandles;
   
   DataHandle<edm4hep::MCParticleCollection>     m_mcParCol_r  {"MCParticle", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_ECALBarrel_r{"ECALBarrel", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_ECALEndcap_r{"ECALEndcap", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_ECALOther_r {"ECALOther", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_HCALBarrel_r{"HCALBarrel", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_HCALEndcap_r{"HCALEndcap", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_HCALOther_r {"HCALOther", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_MUON_r      {"MUON", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_LCAL_r      {"LCAL", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_LHCAL_r     {"LHCAL", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::CalorimeterHitCollection> m_BCAL_r      {"BCAL", Gaudi::DataHandle::Reader, this};
-
-  DataHandle<edm4hep::VertexCollection> m_KinkVertices_r    {"KinkVertices",Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::VertexCollection> m_ProngVertices_r   {"ProngVertices",Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::VertexCollection> m_SplitVertices_r   {"SplitVertices",Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::VertexCollection> m_V0Vertices_r      {"V0Vertices",Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::TrackCollection>  m_MarlinTrkTracks_r {"MarlinTrkTracks",Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::MCRecoCaloAssociationCollection>  m_MCRecoCaloAssociation_r {"MCRecoCaloAssociation",Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4hep::MCRecoTrackerAssociationCollection>  m_MCRecoTrackerAssociation_r {"MCRecoTrackerAssociation",Gaudi::DataHandle::Reader, this};
 
   DataHandle<edm4hep::ClusterCollection>                m_ClusterCollection_w {"PandoraClusters",Gaudi::DataHandle::Writer, this};
   DataHandle<edm4hep::ReconstructedParticleCollection>  m_ReconstructedParticleCollection_w {"PandoraPFOs"    ,Gaudi::DataHandle::Writer, this};
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h
index 7619cd9fb36210b0ee50bf3413d39c18c4a1782f..5b8942cef0fd3d7f6347f461257d8ce6ded8adfd 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h
@@ -20,7 +20,7 @@
 #include "edm4hep/CalorimeterHitCollection.h"
 #include "edm4hep/CalorimeterHit.h"
 
-#include "ClusterShapes.h"
+#include "DataHelper/ClusterShapes.h"
 #include "Api/PandoraApi.h"
 
 class CollectionMaps;
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h
index de380e3f6d4b921a422ad6414d3d772b0f755820..134ff85bc5f08b7643155624e4e82910e7cbdce7 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h
@@ -123,6 +123,7 @@ public:
      */
     pandora::StatusCode CreateTrackAssociations(const CollectionMaps& collectionMaps);
 
+    const edm4hep::Track* GetTrackAddress(const CollectionMaps& collectionMaps, const edm4hep::ConstTrack& pTrack );
     /**
      *  @brief  Create tracks, insert user code here
      * 
@@ -154,6 +155,7 @@ private:
      *  @param  pLCEvent the lcio event
      */
     //pandora::StatusCode ExtractProngsAndSplits(const EVENT::LCEvent *const pLCEvent);
+    pandora::StatusCode ExtractProngsAndSplits(const CollectionMaps& collectionMaps);
 
     /**
      *  @brief  Extract v0 information from specified lcio collections
@@ -161,6 +163,7 @@ private:
      *  @param  pLCEvent the lcio event
      */
    //pandora::StatusCode ExtractV0s(const EVENT::LCEvent *const pLCEvent);
+    pandora::StatusCode ExtractV0s(const CollectionMaps& collectionMaps);
 
     /**
      *  @brief  Whether the track vertex conflicts with previously provided relationship information
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp
index 9c7fb1da1bcbc516ee597faf3b04d6f8eec33c4a..12120d3f56e3e8b2e8de9a03ddd0ceeb90dab51d 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp
@@ -192,7 +192,8 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col
                         caloHitParameters.m_hadronicEnergy = eCalToHadGeVEndCap * pCaloHit->getEnergy();
                     }
 
-                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * eCalToMip * absorberCorrection;
+                    //caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * eCalToMip * absorberCorrection;
+                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * eCalToMip;//FIXME. is absorberCorrection it needed for digi input
 
                     if (caloHitParameters.m_mipEquivalentEnergy.Get() < eCalMipThreshold)
                         continue;
@@ -282,7 +283,8 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col
                         this->GetEndCapCaloHitProperties(pCaloHit, endcapLayerLayout, caloHitParameters, absorberCorrection);
                     }
 
-                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_hCalToMip * absorberCorrection;
+                    //caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_hCalToMip * absorberCorrection;
+                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_hCalToMip;
 
                     if (caloHitParameters.m_mipEquivalentEnergy.Get() < m_settings.m_hCalMipThreshold)
                         continue;
@@ -456,7 +458,8 @@ pandora::StatusCode CaloHitCreator::CreateLCalCaloHits(const CollectionMaps& col
                     float absorberCorrection(1.);
                     this->GetEndCapCaloHitProperties(pCaloHit, endcapLayerLayout, caloHitParameters, absorberCorrection);
 
-                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_eCalToMip * absorberCorrection;
+                    //caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_eCalToMip * absorberCorrection;
+                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_eCalToMip;
 
                     if (caloHitParameters.m_mipEquivalentEnergy.Get() < m_settings.m_eCalMipThreshold)
                         continue;
@@ -528,7 +531,8 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co
                     float absorberCorrection(1.);
                     this->GetEndCapCaloHitProperties(pCaloHit, endcapLayerLayout, caloHitParameters, absorberCorrection);
 
-                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_hCalToMip * absorberCorrection;
+                    //caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_hCalToMip * absorberCorrection;
+                    caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * m_settings.m_hCalToMip;
 
                     if (caloHitParameters.m_mipEquivalentEnergy.Get() < m_settings.m_hCalMipThreshold)
                         continue;
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp
index d2e9db69f1a2184b3bbf1f3c6d27d344a2432a2c..14d4ee1a0e82b492706e30bba8cce509823bbbe0 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp
@@ -39,24 +39,6 @@ PandoraPFAlg::PandoraPFAlg(const std::string& name, ISvcLocator* svcLoc)
 {
  m_CollectionMaps = new CollectionMaps();
   
- declareProperty("ReadMCParticle"                      , m_mcParCol_r,                        "Handle of the MCParticle    input collection" );
- declareProperty("ReadECALBarrel"                      , m_ECALBarrel_r,                      "Handle of the ECALBarrel    input collection" );
- declareProperty("ReadECALEndcap"                      , m_ECALEndcap_r,                      "Handle of the ECALEndcap    input collection" );
- declareProperty("ReadECALOther"                       , m_ECALOther_r,                       "Handle of the ECALOther     input collection" );
- declareProperty("ReadHCALBarrel"                      , m_HCALBarrel_r,                      "Handle of the HCALBarrel    input collection" );
- declareProperty("ReadHCALEndcap"                      , m_HCALEndcap_r,                      "Handle of the HCALEndcap    input collection" );
- declareProperty("ReadHCALOther"                       , m_HCALOther_r,                       "Handle of the HCALOther     input collection" );
- declareProperty("ReadMUON"                            , m_MUON_r,                            "Handle of the MUON          input collection" );
- declareProperty("ReadLCAL"                            , m_LCAL_r,                            "Handle of the LCAL          input collection" );
- declareProperty("ReadLHCAL"                           , m_LHCAL_r,                           "Handle of the LHCAL         input collection" );
- declareProperty("ReadBCAL"                            , m_BCAL_r,                            "Handle of the BCAL          input collection" );
- declareProperty("ReadKinkVertices"                    , m_KinkVertices_r,                    "Handle of the KinkVertices  input collection" );
- declareProperty("ReadProngVertices"                   , m_ProngVertices_r,                   "Handle of the ProngVertices input collection" );
- declareProperty("ReadSplitVertices"                   , m_SplitVertices_r,                   "Handle of the SplitVertices input collection" );
- declareProperty("ReadV0Vertices"                      , m_V0Vertices_r,                      "Handle of the V0Vertices    input collection" );
- declareProperty("ReadTracks"                          , m_MarlinTrkTracks_r,                 "Handle of the Tracks        input collection" );
- declareProperty("MCRecoCaloAssociation"               , m_MCRecoCaloAssociation_r,           "Handle of the MCRecoCaloAssociation input collection" );
- declareProperty("MCRecoTrackerAssociation"            , m_MCRecoTrackerAssociation_r,        "Handle of the MCRecoTrackerAssociation input collection" );
  declareProperty("WriteClusterCollection"              , m_ClusterCollection_w,               "Handle of the ClusterCollection               output collection" );
  declareProperty("WriteReconstructedParticleCollection", m_ReconstructedParticleCollection_w, "Handle of the ReconstructedParticleCollection output collection" );
  declareProperty("WriteVertexCollection"               , m_VertexCollection_w,                "Handle of the VertexCollection                output collection" );
@@ -123,6 +105,43 @@ StatusCode PandoraPFAlg::initialize()
   m_tree->Branch("m_mc_charge", &m_mc_charge);
   m_tree->Branch("m_hasConversion", &m_hasConversion);
 
+  for ( const auto& col : m_readCols ) {
+      auto seperater = col.find(':');
+      std::string colType = col.substr(0, seperater);
+      std::string colName = col.substr(seperater+1);
+      m_collections[colName] = colType;
+
+      if ( colType == "MCParticle" ) {
+          m_dataHandles[colName] =
+              new DataHandle<edm4hep::MCParticleCollection>(colName, Gaudi::DataHandle::Reader, this);
+      }
+      else if ( colType == "Track" ) {
+          m_dataHandles[colName] =
+              new DataHandle<edm4hep::TrackCollection>(colName, Gaudi::DataHandle::Reader, this);
+      }
+      else if ( colType == "CalorimeterHit" ) {
+          m_dataHandles[colName] =
+              new DataHandle<edm4hep::CalorimeterHitCollection>(colName, Gaudi::DataHandle::Reader, this);
+      }
+      else if ( colType == "Vertex" ) {
+          m_dataHandles[colName] =
+              new DataHandle<edm4hep::VertexCollection>(colName, Gaudi::DataHandle::Reader, this);
+      }
+      else if ( colType == "MCRecoTrackerAssociation" ) {
+          m_dataHandles[colName] =
+              new DataHandle<edm4hep::MCRecoTrackerAssociationCollection>(colName, Gaudi::DataHandle::Reader, this);
+      }
+      else if ( colType == "MCRecoCaloAssociation" ) {
+          m_dataHandles[colName] =
+              new DataHandle<edm4hep::MCRecoCaloAssociationCollection>(colName, Gaudi::DataHandle::Reader, this);
+      }
+      else {
+            error() << "invalid collection type: " << colType << endmsg;
+            return StatusCode::FAILURE;
+      }
+  }
+
+
   // XML file
   m_settings.m_pandoraSettingsXmlFile =  m_PandoraSettingsXmlFile ; 
   // Hadronic energy non-linearity correction
@@ -418,160 +437,103 @@ collectionMap_CaloRel.clear();
 collectionMap_TrkRel.clear();
 }
 
+
 StatusCode PandoraPFAlg::updateMap()
 {
-        const edm4hep::MCParticleCollection*     MCParticle = nullptr;
-        const edm4hep::CalorimeterHitCollection* ECALBarrel = nullptr;        
-        const edm4hep::CalorimeterHitCollection* ECALEndcap = nullptr; 
-        const edm4hep::CalorimeterHitCollection* ECALOther  = nullptr; 
-        const edm4hep::CalorimeterHitCollection* HCALBarrel = nullptr; 
-        const edm4hep::CalorimeterHitCollection* HCALEndcap = nullptr; 
-        const edm4hep::CalorimeterHitCollection* HCALOther  = nullptr; 
-        const edm4hep::CalorimeterHitCollection* MUON       = nullptr; 
-        const edm4hep::CalorimeterHitCollection* LCAL       = nullptr; 
-        const edm4hep::CalorimeterHitCollection* LHCAL      = nullptr; 
-        const edm4hep::CalorimeterHitCollection* BCAL       = nullptr; 
-        const edm4hep::VertexCollection* KinkVertices       = nullptr; 
-        const edm4hep::VertexCollection* ProngVertices      = nullptr; 
-        const edm4hep::VertexCollection* SplitVertices      = nullptr; 
-        const edm4hep::VertexCollection* V0Vertices         = nullptr; 
-        const edm4hep::TrackCollection*  MarlinTrkTracks    = nullptr; 
-        const edm4hep::MCRecoCaloAssociationCollection*  mcRecoCaloAssociation    = nullptr; 
-        const edm4hep::MCRecoTrackerAssociationCollection*  mcRecoTrackerAssociation    = nullptr; 
-        StatusCode sc = StatusCode::SUCCESS;
-        sc =  getCol(m_mcParCol_r  , MCParticle );
-        sc =  getCol(m_ECALBarrel_r, ECALBarrel );
-        sc =  getCol(m_ECALEndcap_r, ECALEndcap );
-        sc =  getCol(m_ECALOther_r , ECALOther  );
-        sc =  getCol(m_HCALBarrel_r, HCALBarrel );
-        sc =  getCol(m_HCALEndcap_r, HCALEndcap );
-        sc =  getCol(m_HCALOther_r , HCALOther  );
-        sc =  getCol(m_MUON_r      , MUON       );
-        sc =  getCol(m_LCAL_r      , LCAL       );
-        sc =  getCol(m_LHCAL_r     , LHCAL      );
-        sc =  getCol(m_BCAL_r      , BCAL       );        
-        sc =  getCol(m_KinkVertices_r  , KinkVertices );        
-        sc =  getCol(m_ProngVertices_r , ProngVertices);        
-        sc =  getCol(m_SplitVertices_r , SplitVertices);        
-        sc =  getCol(m_V0Vertices_r    , V0Vertices   );        
-        sc =  getCol(m_MarlinTrkTracks_r , MarlinTrkTracks   );        
-        sc =  getCol(m_MCRecoCaloAssociation_r , mcRecoCaloAssociation   );        
-        sc =  getCol(m_MCRecoTrackerAssociation_r , mcRecoTrackerAssociation);        
-
-        if (NULL != MCParticle   )  
-        {
-            std::vector<edm4hep::MCParticle> v_mc;
-            m_CollectionMaps->collectionMap_MC ["MCParticle"] = v_mc;
-            for(unsigned int i=0 ; i< MCParticle->size(); i++) m_CollectionMaps->collectionMap_MC ["MCParticle"].push_back(MCParticle->at(i));
-        }
-        if (NULL != ECALBarrel   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["ECALBarrel"] = v_cal ;
-            for(unsigned int i=0 ; i< ECALBarrel->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["ECALBarrel"].push_back(ECALBarrel->at(i));
-        }
-        if (NULL != ECALEndcap   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["ECALEndcap"] = v_cal ;
-            for(unsigned int i=0 ; i< ECALEndcap->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["ECALEndcap"].push_back(ECALEndcap->at(i));
-        }
-        if (NULL != ECALOther   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["ECALOther"] = v_cal ;
-            for(unsigned int i=0 ; i< ECALOther->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["ECALOther"].push_back(ECALOther->at(i));
-        }
-        if (NULL != HCALBarrel   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["HCALBarrel"] = v_cal ;
-            for(unsigned int i=0 ; i< HCALBarrel->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["HCALBarrel"].push_back(HCALBarrel->at(i));
-        }
-        if (NULL != HCALEndcap   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["HCALEndcap"] = v_cal ;
-            for(unsigned int i=0 ; i< HCALEndcap->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["HCALEndcap"].push_back(HCALEndcap->at(i));
-        }
-        if (NULL != HCALOther   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["HCALOther"] = v_cal ;
-            for(unsigned int i=0 ; i< HCALOther->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["HCALOther"].push_back(HCALOther->at(i));
-        }
-        if (NULL != MUON   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["MUON"] = v_cal ;
-            for(unsigned int i=0 ; i< MUON->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["MUON"].push_back(MUON->at(i));
-        }
-        if (NULL != LCAL   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["LCAL"] = v_cal ;
-            for(unsigned int i=0 ; i< LCAL->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["LCAL"].push_back(LCAL->at(i));
-        }
-        if (NULL != LHCAL   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["LHCAL"] = v_cal ;
-            for(unsigned int i=0 ; i< LHCAL->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["LHCAL"].push_back(LHCAL->at(i));
-        }
-        if (NULL != BCAL   )
-        {
-            std::vector<edm4hep::CalorimeterHit> v_cal;
-            m_CollectionMaps->collectionMap_CaloHit["BCAL"] = v_cal ;
-            for(unsigned int i=0 ; i< BCAL->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["BCAL"].push_back(BCAL->at(i));
-        }
-        if (NULL != KinkVertices   )
-        {
-            std::vector<edm4hep::Vertex> v_cal;
-            m_CollectionMaps->collectionMap_Vertex["KinkVertices"] = v_cal ;
-            for(unsigned int i=0 ; i< KinkVertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["KinkVertices"].push_back(KinkVertices->at(i));
-        }
-        if (NULL != ProngVertices   )
-        {
-            std::vector<edm4hep::Vertex> v_cal;
-            m_CollectionMaps->collectionMap_Vertex["ProngVertices"] = v_cal ;
-            for(unsigned int i=0 ; i< ProngVertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["ProngVertices"].push_back(ProngVertices->at(i));
-        }
-        if (NULL != SplitVertices   )
-        {
-            std::vector<edm4hep::Vertex> v_cal;
-            m_CollectionMaps->collectionMap_Vertex["SplitVertices"] = v_cal ;
-            for(unsigned int i=0 ; i< SplitVertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["SplitVertices"].push_back(SplitVertices->at(i));
-        }
-        if (NULL != V0Vertices   )
-        {
-            std::vector<edm4hep::Vertex> v_cal;
-            m_CollectionMaps->collectionMap_Vertex["V0Vertices"] = v_cal ;
-            for(unsigned int i=0 ; i< V0Vertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["V0Vertices"].push_back(V0Vertices->at(i));
-        }
-        if (NULL != MarlinTrkTracks   )
-        {
-            std::vector<edm4hep::Track> v_cal;
-            m_CollectionMaps->collectionMap_Track["MarlinTrkTracks"] = v_cal ;
-            for(unsigned int i=0 ; i< MarlinTrkTracks->size(); i++) m_CollectionMaps->collectionMap_Track ["MarlinTrkTracks"].push_back(MarlinTrkTracks->at(i));
-        }
-        if (NULL != mcRecoCaloAssociation )
-        {
-            std::vector<edm4hep::MCRecoCaloAssociation> v_cal;
-            m_CollectionMaps->collectionMap_CaloRel["RecoCaloAssociation"] = v_cal ;
-            for(unsigned int i=0 ; i< mcRecoCaloAssociation->size(); i++) m_CollectionMaps->collectionMap_CaloRel ["RecoCaloAssociation"].push_back(mcRecoCaloAssociation->at(i));
-        }
-        if (NULL != mcRecoTrackerAssociation )
-        {
-            std::vector<edm4hep::MCRecoTrackerAssociation> v_cal;
-            m_CollectionMaps->collectionMap_TrkRel["RecoTrackerAssociation"] = v_cal ;
-            for(unsigned int i=0 ; i< mcRecoTrackerAssociation->size(); i++) m_CollectionMaps->collectionMap_TrkRel ["RecoTrackerAssociation"].push_back(mcRecoTrackerAssociation->at(i));
+    for(auto &v : m_dataHandles){
+        try{
+            if(m_collections[v.first]=="MCParticle"){
+                auto handle = dynamic_cast<DataHandle<edm4hep::MCParticleCollection>*> (v.second);
+                auto po = handle->get();
+                if(po != NULL){
+                    std::vector<edm4hep::MCParticle> v_mc;
+                    m_CollectionMaps->collectionMap_MC [v.first] = v_mc;
+                    for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_MC [v.first].push_back(po->at(i));
+                    std::cout<<"saved col name="<<v.first<<std::endl;
+                }
+                else{
+                std::cout<<"don't find col name="<<v.first<<std::endl;
+                }
+            }
+            else if(m_collections[v.first]=="CalorimeterHit"){
+                auto handle = dynamic_cast<DataHandle<edm4hep::CalorimeterHitCollection>*> (v.second);
+                auto po = handle->get();
+                if(po != NULL){
+                    std::vector<edm4hep::CalorimeterHit> v_cal;
+                    m_CollectionMaps->collectionMap_CaloHit[v.first] = v_cal ;
+                    for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_CaloHit [v.first].push_back(po->at(i));
+                    std::cout<<"saved col name="<<v.first<<std::endl;
+                }
+                else{
+                std::cout<<"don't find col name="<<v.first<<std::endl;
+                }
+            }
+            else if(m_collections[v.first]=="Track"){
+                auto handle = dynamic_cast<DataHandle<edm4hep::TrackCollection>*> (v.second);
+                auto po = handle->get();
+                if(po != NULL){
+                    std::vector<edm4hep::Track> v_cal;
+                    m_CollectionMaps->collectionMap_Track[v.first] = v_cal ;
+                    for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_Track [v.first].push_back(po->at(i));
+                    std::cout<<"saved col name="<<v.first<<std::endl;
+                }
+                else{
+                std::cout<<"don't find col name="<<v.first<<std::endl;
+                }
+            }
+            else if(m_collections[v.first]=="Vertex"){
+                auto handle = dynamic_cast<DataHandle<edm4hep::VertexCollection>*> (v.second);
+                auto po = handle->get();
+                if(po != NULL){
+                    std::vector<edm4hep::Vertex> v_cal;
+                    m_CollectionMaps->collectionMap_Vertex[v.first] = v_cal ;
+                    for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_Vertex [v.first].push_back(po->at(i));
+                    std::cout<<"saved col name="<<v.first<<std::endl;
+                }
+                else{
+                std::cout<<"don't find col name="<<v.first<<std::endl;
+                }
+            }
+            else if(m_collections[v.first]=="MCRecoCaloAssociation"){
+                auto handle = dynamic_cast<DataHandle<edm4hep::MCRecoCaloAssociationCollection>*> (v.second);
+                auto po = handle->get();
+                if(po != NULL){
+                    std::vector<edm4hep::MCRecoCaloAssociation> v_cal;
+                    m_CollectionMaps->collectionMap_CaloRel[v.first] = v_cal ;
+                    for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_CaloRel [v.first].push_back(po->at(i));
+                    std::cout<<"saved col name="<<v.first<<std::endl;
+                }
+                else{
+                std::cout<<"don't find col name="<<v.first<<std::endl;
+                }
+            }
+            else if(m_collections[v.first]=="MCRecoTrackerAssociation"){
+                auto handle = dynamic_cast<DataHandle<edm4hep::MCRecoTrackerAssociationCollection>*> (v.second);
+                auto po = handle->get();
+                if(po != NULL){
+                    std::vector<edm4hep::MCRecoTrackerAssociation> v_cal;
+                    m_CollectionMaps->collectionMap_TrkRel[v.first] = v_cal ;
+                    for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_TrkRel [v.first].push_back(po->at(i));
+                    std::cout<<"saved col name="<<v.first<<std::endl;
+                }
+                else{
+                std::cout<<"don't find col name="<<v.first<<std::endl;
+                }
+            }
+            else{
+            std::cout<<"wrong type name for col :"<<v.first<<std::endl;
+            }
+        }//try
+        catch(...){
+            std::cout<<"don't find "<<v.first<<"in event"<<std::endl;
+            std::cout<<"don't find  col name="<<v.first<<",with type="<<m_collections[v.first]<<" in this event"<<std::endl;
         }
+    }
     return StatusCode::SUCCESS;
 }
 
 
 
-
 StatusCode PandoraPFAlg::Ana()
 {
     int n_current = m_tree->GetEntries()+1;
diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp
index 8dc23c5725546cdb3626cbe3b4c1281648e4da8a..c3b83199123447b624bbafbe38ec0db9d2561080 100644
--- a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp
+++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp
@@ -138,69 +138,48 @@ TrackCreator::~TrackCreator()
 
 //------------------------------------------------------------------------------------------------------------------------------------------
 
-pandora::StatusCode TrackCreator::CreateTrackAssociations(const CollectionMaps& collectionMaps)//TODO, due to the lack of full Vertex information
+pandora::StatusCode TrackCreator::CreateTrackAssociations(const CollectionMaps& collectionMaps)
 {
-//    TODO, because the Vertex.getAssociatedParticle() doesn't work for LCIO to plcio transfer
-//    PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractKinks(collectionMaps));
-//    PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractProngsAndSplits(const CollectionMaps& collectionMaps));
-//    PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractV0s(const CollectionMaps& collectionMaps));
+    PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractKinks(collectionMaps));
+    PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractProngsAndSplits(collectionMaps));
+    PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractV0s(collectionMaps));
 
     return pandora::STATUS_CODE_SUCCESS;
 }
 
 //------------------------------------------------------------------------------------------------------------------------------------------
-/*
 pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionMaps)
 {
     std::cout<<"start TrackCreator::ExtractKinks:"<<std::endl;
     for (StringVector::const_iterator iter = m_settings.m_kinkVertexCollections.begin(), iterEnd = m_settings.m_kinkVertexCollections.end();
         iter != iterEnd; ++iter)
     {
-        if(collectionMaps.CollectionMap_Vertex.find(*iter) == collectionMaps.CollectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;}
+        if(collectionMaps.collectionMap_Vertex.find(*iter) == collectionMaps.collectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;}
         try
         {
-            const edm4hep::VertexCollection *pKinkCollection = (collectionMaps.CollectionMap_Vertex.find(*iter))->second;
+            const std::vector<edm4hep::Vertex>& pKinkCollection = (collectionMaps.collectionMap_Vertex.find(*iter))->second;
 
-            for (int i = 0, iMax = pKinkCollection->size(); i < iMax; ++i)
+            for (int i = 0, iMax = pKinkCollection.size(); i < iMax; ++i)
             {
                 try
                 {
-                    const edm4hep::Vertex  pVertex0 = pKinkCollection->at(i);
+                    const edm4hep::Vertex  pVertex0 = pKinkCollection.at(i);
                     const edm4hep::Vertex* pVertex  = &(pVertex0);
 
                     if (NULL == pVertex) throw ("Collection type mismatch");
 
-                    std::cout<<"pVertex0 getChi2="<<pVertex0.getChi2()<<std::endl;
-                    std::cout<<"pVertex getChi2="<<pVertex->getChi2()<<std::endl;
-                    std::cout<<"Hi 0 "<<std::endl;
-                    const plcio::ConstReconstructedParticle pReconstructedParticle0 = pVertex0.getAssociatedParticle();
-                    std::cout<<"Hi 1"<<std::endl;
-                    //EVENT::ReconstructedParticle *pReconstructedParticle = pVertex->getAssociatedParticle();
-                    const plcio::ConstReconstructedParticle pReconstructedParticle = pVertex->getAssociatedParticle();
-                    std::cout<<"Hi 2:"<<&pReconstructedParticle<<std::endl;
-                    //const EVENT::TrackVec &trackVec(pReconstructedParticle->getTracks());
-                    //plcio::ConstTrack trackVec = pReconstructedParticle.getTracks();
-
-                    std::cout<<"pReconstructedParticle0 en="<<pReconstructedParticle0.getEnergy()<<std::endl;
-                    std::cout<<"pReconstructedParticle en="<<pReconstructedParticle.getEnergy()<<std::endl;
-                    //if (this->IsConflictingRelationship(trackVec))continue;
+                    //std::cout<<"pVertex getChi2="<<pVertex->getChi2()<<std::endl;
+                    //std::cout<<"pReconstructedParticle en="<<pReconstructedParticle.getEnergy()<<",type="<<pReconstructedParticle.getType()<<std::endl;
+                    const edm4hep::ConstReconstructedParticle pReconstructedParticle = pVertex->getAssociatedParticle();
                     if (this->IsConflictingRelationship(pReconstructedParticle))continue;
 
-                    //const int vertexPdgCode(pReconstructedParticle->getType());
                     const int vertexPdgCode(pReconstructedParticle.getType());
 
                     // Extract the kink vertex information
-                    //for (unsigned int iTrack = 0, nTracks = trackVec.size(); iTrack < nTracks; ++iTrack)
-                    //for (unsigned int iTrack = 0, nTracks = trackVec.tracks_size(); iTrack < nTracks; ++iTrack)
                     for (unsigned int iTrack = 0, nTracks = pReconstructedParticle.tracks_size(); iTrack < nTracks; ++iTrack)
                     {
-                        //EVENT::Track *pTrack = trackVec[iTrack];
-                        //plcio::ConstTrack pTrack = trackVec.getTracks(iTrack);
-                        plcio::ConstTrack pTrack = pReconstructedParticle.getTracks(iTrack);
-                        //(0 == iTrack) ? m_parentTrackList.insert(pTrack) : m_daughterTrackList.insert(pTrack);
+                        edm4hep::ConstTrack pTrack = pReconstructedParticle.getTracks(iTrack);
                         (0 == iTrack) ? m_parentTrackList.insert(pTrack.id()) : m_daughterTrackList.insert(pTrack.id());
-                       //std::cout << "KinkTrack " << iTrack << ", nHits " << pTrack.getTrackerHits().size() << std::endl;
-                       std::cout << "KinkTrack " << iTrack << ", nHits " << pTrack.trackerHits_size() << std::endl;
 
                         int trackPdgCode = pandora::UNKNOWN_PARTICLE_TYPE;
 
@@ -229,7 +208,6 @@ pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionM
                                 trackPdgCode = pandora::PI_PLUS;
                                 break;
                             default :
-                                //(pTrack->getOmega() > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PI_MINUS;
                                 (pTrack.getTrackStates(0).omega > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PI_MINUS;
                                 break;
                             }
@@ -245,9 +223,7 @@ pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionM
                         {
                             for (unsigned int jTrack = iTrack + 1; jTrack < nTracks; ++jTrack)
                             {
-                                //PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackParentDaughterRelationship(*m_pPandora, pTrack, trackVec[jTrack]));
-                                //PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackParentDaughterRelationship(*m_pPandora, (int*)(pTrack.id()), (int*)(trackVec.getTracks(jTrack).id()) ) );
-                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackParentDaughterRelationship(*m_pPandora, (int*)(pTrack.id()), (int*)(pReconstructedParticle.getTracks(jTrack).id()) ) );
+                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackParentDaughterRelationship(*m_pPandora, GetTrackAddress(collectionMaps, pTrack), GetTrackAddress(collectionMaps, pReconstructedParticle.getTracks(jTrack) ) ) );
                             }
                         }
 
@@ -256,9 +232,7 @@ pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionM
                         {
                             for (unsigned int jTrack = iTrack + 1; jTrack < nTracks; ++jTrack)
                             {
-                                //PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora, pTrack, trackVec[jTrack]));
-                                //PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora, (int*)(pTrack.id()), (int*)(trackVec.getTracks(jTrack).id()) ));
-                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora, (int*)(pTrack.id()), (int*)(pReconstructedParticle.getTracks(jTrack).id()) ));
+                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora, GetTrackAddress(collectionMaps, pTrack), GetTrackAddress(collectionMaps, pReconstructedParticle.getTracks(jTrack) ) ) );
                             }
                         }
                     }
@@ -277,50 +251,44 @@ pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionM
 
     return pandora::STATUS_CODE_SUCCESS;
 }
-*/
 //------------------------------------------------------------------------------------------------------------------------------------------
-/*
-pandora::StatusCode TrackCreator::ExtractProngsAndSplits(const EVENT::LCEvent *const pLCEvent)
+
+pandora::StatusCode TrackCreator::ExtractProngsAndSplits(const CollectionMaps& collectionMaps)
 {
-    for (StringVector::const_iterator iter = m_settings.m_prongSplitVertexCollections.begin(), iterEnd = m_settings.m_prongSplitVertexCollections.end();
-        iter != iterEnd; ++iter)
+    std::cout<<"start TrackCreator::ExtractProngsAndSplits:"<<std::endl;
+    for (StringVector::const_iterator iter = m_settings.m_prongSplitVertexCollections.begin(), iterEnd = m_settings.m_prongSplitVertexCollections.end(); iter != iterEnd; ++iter)
     {
+        if(collectionMaps.collectionMap_Vertex.find(*iter) == collectionMaps.collectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;}
         try
         {
-            const EVENT::LCCollection *pProngOrSplitCollection = pLCEvent->getCollection(*iter);
+            const std::vector<edm4hep::Vertex>& pProngOrSplitCollection = (collectionMaps.collectionMap_Vertex.find(*iter))->second;
 
-            for (int i = 0, iMax = pProngOrSplitCollection->getNumberOfElements(); i < iMax; ++i)
+            for (int i = 0, iMax = pProngOrSplitCollection.size(); i < iMax; ++i)
             {
                 try
                 {
-                    EVENT::Vertex *pVertex = dynamic_cast<Vertex*>(pProngOrSplitCollection->getElementAt(i));
-
-                    if (NULL == pVertex)
-                        throw EVENT::Exception("Collection type mismatch");
+                    const edm4hep::Vertex  pVertex0 = pProngOrSplitCollection.at(i);
+                    const edm4hep::Vertex* pVertex  = &(pVertex0);
 
-                    EVENT::ReconstructedParticle *pReconstructedParticle = pVertex->getAssociatedParticle();
-                    const EVENT::TrackVec &trackVec(pReconstructedParticle->getTracks());
+                    if (NULL == pVertex) throw ("Collection type mismatch");
+                    const edm4hep::ConstReconstructedParticle pReconstructedParticle = pVertex->getAssociatedParticle();
 
-                    if (this->IsConflictingRelationship(trackVec))
-                        continue;
+                    if (this->IsConflictingRelationship(pReconstructedParticle))continue;
 
                     // Extract the prong/split vertex information
-                    for (unsigned int iTrack = 0, nTracks = trackVec.size(); iTrack < nTracks; ++iTrack)
+                    for (unsigned int iTrack = 0, nTracks = pReconstructedParticle.tracks_size(); iTrack < nTracks; ++iTrack)
                     {
-                        EVENT::Track *pTrack = trackVec[iTrack];
-                        (0 == iTrack) ? m_parentTrackList.insert(pTrack) : m_daughterTrackList.insert(pTrack);
-                        streamlog_out(DEBUG) << "Prong or Split Track " << iTrack << ", nHits " << pTrack->getTrackerHits().size() << std::endl;
+                        edm4hep::ConstTrack pTrack = pReconstructedParticle.getTracks(iTrack);
+                        (0 == iTrack) ? m_parentTrackList.insert(pTrack.id()) : m_daughterTrackList.insert(pTrack.id());
 
-                        if (0 == m_settings.m_shouldFormTrackRelationships)
-                            continue;
+                        if (0 == m_settings.m_shouldFormTrackRelationships) continue;
 
                         // Make track parent-daughter relationships
                         if (0 == iTrack)
                         {
                             for (unsigned int jTrack = iTrack + 1; jTrack < nTracks; ++jTrack)
                             {
-                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackParentDaughterRelationship(*m_pPandora,
-                                    pTrack, trackVec[jTrack]));
+                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackParentDaughterRelationship(*m_pPandora, GetTrackAddress(collectionMaps, pTrack), GetTrackAddress(collectionMaps, pReconstructedParticle.getTracks(jTrack) ) ) );
                             }
                         }
 
@@ -329,21 +297,20 @@ pandora::StatusCode TrackCreator::ExtractProngsAndSplits(const EVENT::LCEvent *c
                         {
                             for (unsigned int jTrack = iTrack + 1; jTrack < nTracks; ++jTrack)
                             {
-                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora,
-                                    pTrack, trackVec[jTrack]));
+                                PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora, GetTrackAddress(collectionMaps, pTrack), GetTrackAddress(collectionMaps, pReconstructedParticle.getTracks(jTrack) ) ) );
                             }
                         }
                     }
                 }
-                catch (EVENT::Exception &exception)
+                catch (...)
                 {
-                    streamlog_out(WARNING) << "Failed to extract prong/split vertex: " << exception.what() << std::endl;
+                    std::cout << "Failed to extract prong/split vertex" <<std::endl;
                 }
             }
         }
-        catch (EVENT::Exception &exception)
+        catch (...)
         {
-            streamlog_out(DEBUG5) << "Failed to extract prong/split vertex collection: " << *iter << ", " << exception.what() << std::endl;
+            std::cout<< "Failed to extract prong/split vertex collection: " << *iter << std::endl;
         }
     }
 
@@ -352,88 +319,84 @@ pandora::StatusCode TrackCreator::ExtractProngsAndSplits(const EVENT::LCEvent *c
 
 //------------------------------------------------------------------------------------------------------------------------------------------
 
-pandora::StatusCode TrackCreator::ExtractV0s(const EVENT::LCEvent *const pLCEvent)
+pandora::StatusCode TrackCreator::ExtractV0s(const CollectionMaps& collectionMaps)
 {
-    for (StringVector::const_iterator iter = m_settings.m_v0VertexCollections.begin(), iterEnd = m_settings.m_v0VertexCollections.end();
-        iter != iterEnd; ++iter)
+    std::cout<<"start TrackCreator::ExtractV0s:"<<std::endl;
+    for (StringVector::const_iterator iter = m_settings.m_v0VertexCollections.begin(), iterEnd = m_settings.m_v0VertexCollections.end(); iter != iterEnd; ++iter)
     {
+        if(collectionMaps.collectionMap_Vertex.find(*iter) == collectionMaps.collectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;}
         try
         {
-            const EVENT::LCCollection *pV0Collection = pLCEvent->getCollection(*iter);
+            const std::vector<edm4hep::Vertex>& pV0Collection = (collectionMaps.collectionMap_Vertex.find(*iter))->second;
 
-            for (int i = 0, iMax = pV0Collection->getNumberOfElements(); i < iMax; ++i)
+            for (int i = 0, iMax = pV0Collection.size(); i < iMax; ++i)
             {
                 try
                 {
-                    EVENT::Vertex *pVertex = dynamic_cast<Vertex*>(pV0Collection->getElementAt(i));
+                    const edm4hep::Vertex  pVertex0 = pV0Collection.at(i);
+                    const edm4hep::Vertex* pVertex  = &(pVertex0);
 
-                    if (NULL == pVertex)
-                        throw EVENT::Exception("Collection type mismatch");
+                    if (NULL == pVertex) throw ("Collection type mismatch");
 
-                    EVENT::ReconstructedParticle *pReconstructedParticle = pVertex->getAssociatedParticle();
-                    const EVENT::TrackVec &trackVec(pReconstructedParticle->getTracks());
+                    const edm4hep::ConstReconstructedParticle pReconstructedParticle = pVertex->getAssociatedParticle();
 
-                    if (this->IsConflictingRelationship(trackVec))
-                        continue;
+                    if (this->IsConflictingRelationship(pReconstructedParticle))continue;
 
                     // Extract the v0 vertex information
-                    const int vertexPdgCode(pReconstructedParticle->getType());
+                    const int vertexPdgCode(pReconstructedParticle.getType());
 
-                    for (unsigned int iTrack = 0, nTracks = trackVec.size(); iTrack < nTracks; ++iTrack)
+                    for (unsigned int iTrack = 0, nTracks = pReconstructedParticle.tracks_size(); iTrack < nTracks; ++iTrack)
                     {
-                        EVENT::Track *pTrack = trackVec[iTrack];
-                        m_v0TrackList.insert(pTrack);
-                        streamlog_out(DEBUG) << "V0Track " << iTrack << ", nHits " << pTrack->getTrackerHits().size() << std::endl;
+                        edm4hep::ConstTrack pTrack = pReconstructedParticle.getTracks(iTrack);
+                        m_v0TrackList.insert(pTrack.id());
 
                         int trackPdgCode = pandora::UNKNOWN_PARTICLE_TYPE;
 
                         switch (vertexPdgCode)
                         {
                         case pandora::PHOTON :
-                            (pTrack->getOmega() > 0) ? trackPdgCode = pandora::E_PLUS : trackPdgCode = pandora::E_MINUS;
+                            (pTrack.getTrackStates(0).omega > 0) ? trackPdgCode = pandora::E_PLUS : trackPdgCode = pandora::E_MINUS;
                             break;
                         case pandora::LAMBDA :
-                            (pTrack->getOmega() > 0) ? trackPdgCode = pandora::PROTON : trackPdgCode = pandora::PI_MINUS;
+                            (pTrack.getTrackStates(0).omega > 0) ? trackPdgCode = pandora::PROTON : trackPdgCode = pandora::PI_MINUS;
                             break;
                         case pandora::LAMBDA_BAR :
-                            (pTrack->getOmega() > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PROTON_BAR;
+                            (pTrack.getTrackStates(0).omega > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PROTON_BAR;
                             break;
                         case pandora::K_SHORT :
-                            (pTrack->getOmega() > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PI_MINUS;
+                            (pTrack.getTrackStates(0).omega > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PI_MINUS;
                             break;
                         default :
-                            (pTrack->getOmega() > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PI_MINUS;
+                            (pTrack.getTrackStates(0).omega > 0) ? trackPdgCode = pandora::PI_PLUS : trackPdgCode = pandora::PI_MINUS;
                             break;
                         }
 
                         m_trackToPidMap.insert(TrackToPidMap::value_type(pTrack, trackPdgCode));
 
-                        if (0 == m_settings.m_shouldFormTrackRelationships)
-                            continue;
+                        if (0 == m_settings.m_shouldFormTrackRelationships) continue;
 
                         // Make track sibling relationships
                         for (unsigned int jTrack = iTrack + 1; jTrack < nTracks; ++jTrack)
                         {
-                            PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora,
-                                pTrack, trackVec[jTrack]));
+                            PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackSiblingRelationship(*m_pPandora, GetTrackAddress(collectionMaps, pTrack), GetTrackAddress(collectionMaps, pReconstructedParticle.getTracks(jTrack) ) ) );
                         }
                     }
                 }
-                catch (EVENT::Exception &exception)
+                catch (...)
                 {
-                    streamlog_out(WARNING) << "Failed to extract v0 vertex: " << exception.what() << std::endl;
+                    std::cout<< "Failed to extract v0 vertex" << std::endl;
                 }
             }
         }
-        catch (EVENT::Exception &exception)
+        catch (...)
         {
-            streamlog_out(DEBUG5) << "Failed to extract v0 vertex collection: " << *iter << ", " << exception.what() << std::endl;
+            std::cout << "Failed to extract v0 vertex collection: " << *iter << std::endl;
         }
     }
 
     return pandora::STATUS_CODE_SUCCESS;
 }
-*/
+
 //------------------------------------------------------------------------------------------------------------------------------------------
 
 bool TrackCreator::IsConflictingRelationship(const edm4hep::ConstReconstructedParticle &Particle) const
@@ -450,6 +413,20 @@ bool TrackCreator::IsConflictingRelationship(const edm4hep::ConstReconstructedPa
     return false;
 }
 
+const edm4hep::Track* TrackCreator::GetTrackAddress(const CollectionMaps& collectionMaps, const edm4hep::ConstTrack& pTrack )
+{
+    for (StringVector::const_iterator iter = m_settings.m_trackCollections.begin(), iterEnd = m_settings.m_trackCollections.end(); iter != iterEnd; ++iter)
+    {
+        if(collectionMaps.collectionMap_Track.find(*iter) == collectionMaps.collectionMap_Track.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;}
+        const std::vector<edm4hep::Track>& pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second;
+        for (int i = 0, iMax = pTrackCollection.size(); i < iMax; ++i)
+        {
+            const edm4hep::Track& pTrack0 = pTrackCollection.at(i);
+            if (pTrack.id() == pTrack0.id()) return (const edm4hep::Track*) (&pTrack0);
+        }
+    }
+    return NULL;
+}
 //------------------------------------------------------------------------------------------------------------------------------------------
 
 pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionMaps)
@@ -493,8 +470,7 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM
 
                     const int nTrackHits(static_cast<int>(pTrack->trackerHits_size()));
 
-                    if ((nTrackHits < minTrackHits) || (nTrackHits > m_settings.m_maxTrackHits))
-                        continue;
+                    if ((nTrackHits < minTrackHits) || (nTrackHits > m_settings.m_maxTrackHits)) continue;
 
                     // Proceed to create the pandora track
                     PandoraApi::Track::Parameters trackParameters;
@@ -558,7 +534,8 @@ void TrackCreator::GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi
 
     this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtEnd);
     //FIXME ? LCIO input only has 4 states, so 4 can't be used.
-    this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtCalorimeter);
+    if( pEndTrack.trackStates_size()<5) this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtCalorimeter);
+    else  this->CopyTrackState(pEndTrack.getTrackStates(4), trackParameters.m_trackStateAtCalorimeter);
     
     
     trackParameters.m_isProjectedToEndCap = ((std::fabs(trackParameters.m_trackStateAtCalorimeter.Get().GetPosition().GetZ()) < m_eCalEndCapInnerZ) ? false : true);
diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc
deleted file mode 100644
index 6582e17e49d105cd27dcef084b14e5e0c851f2fc..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc
+++ /dev/null
@@ -1,768 +0,0 @@
-#include "HelixClass.h"
-#include <math.h>
-#include <stdlib.h>
-#include <iostream>
-#include "ced_cli.h"
-
-HelixClass::HelixClass() {
-    _const_2pi = 2.0*M_PI;
-    _const_pi2 = 0.5*M_PI;
-    _FCT = 2.99792458E-4;
-}
-
-HelixClass::~HelixClass() {}
-
-void HelixClass::Initialize_VP(float * pos, float * mom, float q, float B) {
-    _referencePoint[0] = pos[0];
-    _referencePoint[1] = pos[1];
-    _referencePoint[2] = pos[2];
-    _momentum[0] = mom[0];
-    _momentum[1] = mom[1];
-    _momentum[2] = mom[2];
-    _charge = q;
-    _bField = B;
-    _pxy = sqrt(mom[0]*mom[0]+mom[1]*mom[1]);
-    _radius = _pxy / (_FCT*B);
-    _omega = q/_radius;
-    _tanLambda = mom[2]/_pxy;
-    _phiMomRefPoint = atan2(mom[1],mom[0]);
-    _xCentre = pos[0] + _radius*cos(_phiMomRefPoint-_const_pi2*q);
-    _yCentre = pos[1] + _radius*sin(_phiMomRefPoint-_const_pi2*q);
-    _phiRefPoint = atan2(pos[1]-_yCentre,pos[0]-_xCentre);
-    _phiAtPCA = atan2(-_yCentre,-_xCentre);
-    _phi0 = -_const_pi2*q + _phiAtPCA;
-    while (_phi0<0) _phi0+=_const_2pi;
-    while (_phi0>=_const_2pi) _phi0-=_const_2pi;
-    _xAtPCA = _xCentre + _radius*cos(_phiAtPCA);
-    _yAtPCA = _yCentre + _radius*sin(_phiAtPCA);
-    //    _d0 = -_xAtPCA*sin(_phi0) + _yAtPCA*cos(_phi0);
-    double pxy = double(_pxy);
-    double radius = pxy/double(_FCT*B);
-    double xCentre = double(pos[0]) + radius*double(cos(_phiMomRefPoint-_const_pi2*q));
-    double yCentre = double(pos[1]) + radius*double(sin(_phiMomRefPoint-_const_pi2*q));
-    
-    double d0;
-
-    if (q>0) {
-      d0 = double(q)*radius - double(sqrt(xCentre*xCentre+yCentre*yCentre));
-    }
-    else {
-      d0 = double(q)*radius + double(sqrt(xCentre*xCentre+yCentre*yCentre));
-    }
-
-    _d0 = float(d0);
-
-//     if (fabs(_d0)>0.001 ) {
-//       std::cout << "New helix : " << std::endl;
-//       std::cout << " Position : " << pos[0] 
-// 		<< " " << pos[1]
-// 		<< " " << pos[2] << std::endl;
-//       std::cout << " Radius = " << _radius << std::endl;
-//       std::cout << " RC = " << sqrt(_xCentre*_xCentre+_yCentre*_yCentre) << std::endl;  
-//       std::cout << " D0 = " << _d0 << std::endl;
-//     }
-
-    _pxAtPCA = _pxy*cos(_phi0);
-    _pyAtPCA = _pxy*sin(_phi0);
-    float deltaPhi = _phiRefPoint - _phiAtPCA;    
-    float xCircles = -pos[2]*q/(_radius*_tanLambda) - deltaPhi;
-    xCircles = xCircles/_const_2pi;
-    int nCircles;
-    int n1,n2;
-
-    if (xCircles >= 0.) {
-	n1 = int(xCircles);
-	n2 = n1 + 1;
-    }
-    else {
-	n1 = int(xCircles) - 1;
-	n2 = n1 + 1;
-    }
-    
-    if (fabs(n1-xCircles) < fabs(n2-xCircles)) {
-	nCircles = n1;
-    }
-    else {
-	nCircles = n2;
-    }
-    _z0 = pos[2] + _radius*_tanLambda*q*(deltaPhi + _const_2pi*nCircles);
-
-}
-
-void HelixClass::Initialize_Canonical(float phi0, float d0, float z0, 
-				      float omega, float tanLambda, float B) {
-    _omega = omega;
-    _d0 = d0;
-    _phi0 = phi0;
-    _z0 = z0;
-    _tanLambda = tanLambda;
-    _charge = omega/fabs(omega);
-    _radius = 1./fabs(omega);
-    _xAtPCA = -_d0*sin(_phi0);
-    _yAtPCA = _d0*cos(_phi0);    
-    _referencePoint[0] = _xAtPCA;
-    _referencePoint[1] = _yAtPCA;
-    _referencePoint[2] = _z0;
-    _pxy = _FCT*B*_radius;
-    _momentum[0] = _pxy*cos(_phi0);
-    _momentum[1] = _pxy*sin(_phi0);
-    _momentum[2] = _tanLambda * _pxy;    
-    _pxAtPCA = _momentum[0];
-    _pyAtPCA = _momentum[1];
-    _phiMomRefPoint = atan2(_momentum[1],_momentum[0]);
-    _xCentre = _referencePoint[0] + 
-      _radius*cos(_phi0-_const_pi2*_charge);
-    _yCentre = _referencePoint[1] + 
-      _radius*sin(_phi0-_const_pi2*_charge);
-    _phiAtPCA = atan2(-_yCentre,-_xCentre);
-    _phiRefPoint =  _phiAtPCA ;
-    _bField = B;
-}
-
-
-void HelixClass::Initialize_BZ(float xCentre, float yCentre, float radius, 
-			       float bZ, float phi0, float B, float signPz,
-			       float zBegin) {
-
-  _radius = radius;
-  _pxy = _FCT*B*_radius;
-  _charge = -(bZ*signPz)/fabs(bZ*signPz);
-  _momentum[2] = -_charge*_pxy/(bZ*_radius);
-  _xCentre = xCentre;
-  _yCentre = yCentre;
-  _omega = _charge/radius;
-  _phiAtPCA = atan2(-_yCentre,-_xCentre);
-  _phi0 = -_const_pi2*_charge + _phiAtPCA;
-  while (_phi0<0) _phi0+=_const_2pi;
-  while (_phi0>=_const_2pi) _phi0-=_const_2pi;
-  _xAtPCA = _xCentre + _radius*cos(_phiAtPCA);
-  _yAtPCA = _yCentre + _radius*sin(_phiAtPCA);
-  _d0 = -_xAtPCA*sin(_phi0) + _yAtPCA*cos(_phi0);
-  _pxAtPCA = _pxy*cos(_phi0);
-  _pyAtPCA = _pxy*sin(_phi0);
-  _referencePoint[2] = zBegin;
-  _referencePoint[0] = xCentre + radius*cos(bZ*zBegin+phi0);
-  _referencePoint[1] = yCentre + radius*sin(bZ*zBegin+phi0);
-  _phiRefPoint = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre);
-  _phiMomRefPoint =  -_const_pi2*_charge + _phiRefPoint;
-  _tanLambda = _momentum[2]/_pxy;
-  _momentum[0] = _pxy*cos(_phiMomRefPoint);
-  _momentum[1] = _pxy*sin(_phiMomRefPoint);
-  
-  float deltaPhi = _phiRefPoint - _phiAtPCA;    
-  float xCircles = bZ*_referencePoint[2] - deltaPhi;
-  xCircles = xCircles/_const_2pi;
-  int nCircles;
-  int n1,n2;
-
-  if (xCircles >= 0.) {
-    n1 = int(xCircles);
-    n2 = n1 + 1;
-  }
-  else {
-    n1 = int(xCircles) - 1;
-    n2 = n1 + 1;
-  }
-  
-  if (fabs(n1-xCircles) < fabs(n2-xCircles)) {
-    nCircles = n1;
-  }
-  else {
-    nCircles = n2;
-  }  
-  _z0 = _referencePoint[2] - (deltaPhi + _const_2pi*nCircles)/bZ;  
-  _bField = B;
-
-}
-
-const float * HelixClass::getMomentum() {
-    return _momentum;
-}
-const float * HelixClass::getReferencePoint() {
-    return _referencePoint;
-}
-float HelixClass::getPhi0() {
-  if (_phi0<0.0)
-    _phi0 += 2*M_PI;
-  return _phi0;
-}
-float HelixClass::getD0() {
-    return _d0;
-}
-float HelixClass::getZ0() {
-    return _z0;
-}
-float HelixClass::getOmega() {
-    return _omega;
-}
-float HelixClass::getTanLambda() {
-    return _tanLambda;
-}
-float HelixClass::getPXY() {
-    return _pxy;
-}
-float HelixClass::getXC() {
-  return _xCentre;
-}
-
-float HelixClass::getYC() {
-  return _yCentre;
-}
-
-float HelixClass::getRadius() {
-  return _radius;
-}
-
-float HelixClass::getBz() {
-  return _bZ;
-}
-
-float HelixClass::getPhiZ() {
-  return _phiZ;
-}
-
-float HelixClass::getCharge() {
-    return _charge;
-}
-
-float HelixClass::getPointInXY(float x0, float y0, float ax, float ay, 
-			      float * ref , float * point) {
-
-  float time;
-
-  float AA = sqrt(ax*ax+ay*ay);
-
-
-  if (AA <= 0) {
-    time = -1.0e+20; 
-    return time;
-  }
-
-
-  float BB = ax*(x0-_xCentre) + ay*(y0-_yCentre);
-  BB = BB / AA;
-
-  float CC = (x0-_xCentre)*(x0-_xCentre) 
-    + (y0-_yCentre)*(y0-_yCentre) - _radius*_radius;
-
-  CC = CC / AA;
-
-  float DET = BB*BB - CC;
-  float tt1 = 0.;
-  float tt2 = 0.;
-  float xx1,xx2,yy1,yy2; 
-
-
-  if (DET < 0 ) {
-    time = 1.0e+10;
-    point[0]=0.0;
-    point[1]=0.0;
-    point[2]=0.0;
-    return time;
-  }
-  
-  
-  tt1 = - BB + sqrt(DET);
-  tt2 = - BB - sqrt(DET);
-
-  xx1 = x0 + tt1*ax;
-  yy1 = y0 + tt1*ay;
-  xx2 = x0 + tt2*ax;
-  yy2 = y0 + tt2*ay;
-  
-  float phi1 = atan2(yy1-_yCentre,xx1-_xCentre);
-  float phi2 = atan2(yy2-_yCentre,xx2-_xCentre);
-  float phi0 = atan2(ref[1]-_yCentre,ref[0]-_xCentre);
-
-  float dphi1 = phi1 - phi0;
-  float dphi2 = phi2 - phi0;
-
-  if (dphi1 < 0 && _charge < 0) {
-    dphi1 = dphi1 + _const_2pi;
-  }
-  else if (dphi1 > 0 && _charge > 0) { 
-    dphi1 = dphi1 - _const_2pi;
-  }
-
-  if (dphi2 < 0 && _charge < 0) {
-    dphi2 = dphi2 + _const_2pi;
-  }
-  else if (dphi2 > 0 && _charge > 0) { 
-    dphi2 = dphi2 - _const_2pi;
-  }
-
-  // Times
-  tt1 = -_charge*dphi1*_radius/_pxy;
-  tt2 = -_charge*dphi2*_radius/_pxy;
-
-  if (tt1 < 0. )
-    std::cout << "WARNING " << tt1 << std::endl;
-  if (tt2 < 0. )
-    std::cout << "WARNING " << tt2 << std::endl;
-  
-
-  if (tt1 < tt2) {
-    point[0] = xx1;
-    point[1] = yy1;
-    time = tt1;
-  }
-  else {
-    point[0] = xx2;
-    point[1] = yy2;
-    time = tt2;
-  }
-
-  point[2] = ref[2]+time*_momentum[2];
-
-  
-
-  return time;
-
-}
-
-
-float HelixClass::getPointOnCircle(float Radius, float * ref, float * point) {
-
-  float distCenterToIP = sqrt(_xCentre*_xCentre + _yCentre*_yCentre);
-
-  point[0] = 0.0;
-  point[1] = 0.0;
-  point[2] = 0.0;
-
-  if ((distCenterToIP+_radius)<Radius) {
-    float xx = -1.0e+20;
-    return xx;
-  }
-
-  if ((_radius+Radius)<distCenterToIP) {
-    float xx = -1.0e+20;
-    return xx;
-  }
-
-  float phiCentre = atan2(_yCentre,_xCentre);
-  float phiStar   = Radius*Radius + distCenterToIP*distCenterToIP 
-                                    - _radius*_radius;
-
-  phiStar = 0.5*phiStar/fmax(1.0e-20,Radius*distCenterToIP);
-  
-  if (phiStar > 1.0) 
-    phiStar = 0.9999999;
-  
-  if (phiStar < -1.0)
-    phiStar = -0.9999999;
-  
-  phiStar = acos(phiStar);
-
-  float tt1,tt2,time;
-
-  float xx1 = Radius*cos(phiCentre+phiStar);
-  float yy1 = Radius*sin(phiCentre+phiStar);
-
-  float xx2 = Radius*cos(phiCentre-phiStar);
-  float yy2 = Radius*sin(phiCentre-phiStar);
-
-
-  float phi1 = atan2(yy1-_yCentre,xx1-_xCentre);
-  float phi2 = atan2(yy2-_yCentre,xx2-_xCentre);
-  float phi0 = atan2(ref[1]-_yCentre,ref[0]-_xCentre);
-
-  float dphi1 = phi1 - phi0;
-  float dphi2 = phi2 - phi0;
-
-  if (dphi1 < 0 && _charge < 0) {
-    dphi1 = dphi1 + _const_2pi;
-  }
-  else if (dphi1 > 0 && _charge > 0) { 
-    dphi1 = dphi1 - _const_2pi;
-  }
-
-  if (dphi2 < 0 && _charge < 0) {
-    dphi2 = dphi2 + _const_2pi;
-  }
-  else if (dphi2 > 0 && _charge > 0) { 
-    dphi2 = dphi2 - _const_2pi;
-  }
-
-  // Times
-  tt1 = -_charge*dphi1*_radius/_pxy;
-  tt2 = -_charge*dphi2*_radius/_pxy;
-
-  if (tt1 < 0. )
-    std::cout << "WARNING " << tt1 << std::endl;
-  if (tt2 < 0. )
-    std::cout << "WARNING " << tt2 << std::endl;
-  
-
-  float time2;
-  if (tt1 < tt2) {
-    point[0] = xx1;
-    point[1] = yy1;
-    point[3] = xx2;
-    point[4] = yy2;
-    time = tt1;
-    time2 = tt2;
-  }
-  else {
-    point[0] = xx2;
-    point[1] = yy2;
-    point[3] = xx1;
-    point[4] = yy1;
-    time = tt2;
-    time2 = tt1;
-  }
-
-  point[2] = ref[2]+time*_momentum[2];
-  point[5] = ref[2]+time2*_momentum[2];
-  
-
-  return time;
-
-}
-
-
-float HelixClass::getPointInZ(float zLine, float * ref, float * point) {
-
-  float time = zLine - ref[2];
-
-  if (_momentum[2] == 0.) {
-    time = -1.0e+20;
-    point[0] = 0.;
-    point[1] = 0.;
-    point[2] = 0.;
-    return time;
-  }
-
-  time = time/_momentum[2];
-
-  float phi0 = atan2(ref[1] - _yCentre , ref[0] - _xCentre);
-  float phi = phi0 - _charge*_pxy*time/_radius;
-  float xx = _xCentre + _radius*cos(phi);
-  float yy = _yCentre + _radius*sin(phi);
-
-  point[0] = xx;
-  point[1] = yy;
-  point[2] = zLine;
-
-  return time;
-
-
-}
-
-float HelixClass::getDistanceToPoint(float * xPoint, float * Distance) {
-
-  float zOnHelix;
-  float phi = atan2(xPoint[1]-_yCentre,xPoint[0]-_xCentre);
-  float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre);
-  //calculate distance to XYprojected centre of Helix, comparing this with distance to radius around centre gives DistXY
-  float DistXY = (_xCentre-xPoint[0])*(_xCentre-xPoint[0]) + (_yCentre-xPoint[1])*(_yCentre-xPoint[1]);
-  DistXY = sqrt(DistXY);
-  DistXY = fabs(DistXY - _radius);
-  
-  int nCircles = 0;
-
-  if (fabs(_tanLambda*_radius)>1.0e-20) {
-    float xCircles = phi0 - phi -_charge*(xPoint[2]-_referencePoint[2])/(_tanLambda*_radius);
-    xCircles = xCircles/_const_2pi;
-    int n1,n2;
-
-    if (xCircles >= 0.) {
-	n1 = int(xCircles);
-	n2 = n1 + 1;
-    }
-    else {
-	n1 = int(xCircles) - 1;
-	n2 = n1 + 1;
-    }
-    
-    if (fabs(n1-xCircles) < fabs(n2-xCircles)) {
-	nCircles = n1;
-    }
-    else {
-	nCircles = n2;
-    }
-
-  }
-  
-  float DPhi = _const_2pi*((float)nCircles) + phi - phi0;
-
-  zOnHelix = _referencePoint[2] - _charge*_radius*_tanLambda*DPhi;
-
-  float DistZ = fabs(zOnHelix - xPoint[2]);
-  float Time;
-
-  if (fabs(_momentum[2]) > 1.0e-20) {
-    Time = (zOnHelix - _referencePoint[2])/_momentum[2];
-  }
-  else {
-    Time = _charge*_radius*DPhi/_pxy;
-  }
-
-  Distance[0] = DistXY;
-  Distance[1] = DistZ;
-  Distance[2] = sqrt(DistXY*DistXY+DistZ*DistZ);
-
-  return Time;
-
-
-}
-
-//When we are not interested in the exact distance, we can check if we are
-//already far enough away in XY, before we start calculating in Z as the
-//distance will only increase
-float HelixClass::getDistanceToPoint(const std::vector<float>& xPoint, float distCut) {
-  //calculate distance to XYprojected centre of Helix, comparing this with distance to radius around centre gives DistXY
-  float tempx = xPoint[0]-_xCentre;
-  float tempy = xPoint[1]-_yCentre;
-  float tempsq = sqrt(tempx*tempx + tempy*tempy);
-  float tempdf = tempsq - _radius;
-  float DistXY = fabs( tempdf );
-  //If this is bigger than distCut, we dont have to know how much bigger this is
-  if( DistXY > distCut) {
-    return DistXY;
-  }
-
-  int nCircles = 0;
-  float phi = atan2(tempy,tempx);
-  float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre);
-  float phidiff = phi0-phi;
-  float  tempz = xPoint[2] - _referencePoint[2];//Yes referencePoint
-  float tanradius = _tanLambda*_radius;
-  if (fabs(tanradius)>1.0e-20) {
-    float xCircles = (phidiff -_charge*tempz/tanradius)/_const_2pi;
-    int n1,n2;
-    if (xCircles >= 0.) {
-	n1 = int(xCircles);
-	n2 = n1 + 1;
-    }
-    else {
-	n1 = int(xCircles) - 1;
-	n2 = n1 + 1;
-    }
-    if (fabs(n1-xCircles) < fabs(n2-xCircles)) {
-	nCircles = n1;
-    }
-    else {
-	nCircles = n2;
-    }
-  }
-  float DistZ = - tempz - _charge*tanradius*(_const_2pi*((float)nCircles) - phidiff);
-  return sqrt(DistXY*DistXY+DistZ*DistZ);
-}//getDistanceToPoint(vector,float)
-
-float HelixClass::getDistanceToPoint(const float* xPoint, float distCut) {
-  std::vector<float> xPosition(xPoint, xPoint + 3 );//We are expecting three coordinates, must be +3, last element is excluded!
-  return getDistanceToPoint(xPosition, distCut);
-}//getDistanceToPoint(float*,float)
-
-
-
-void HelixClass::setHelixEdges(float * xStart, float * xEnd) {
-  for (int i=0; i<3; ++i) {
-    _xStart[i] = xStart[i];
-    _xEnd[i] = xEnd[i];
-  }
-
-}
-
-float HelixClass::getDistanceToHelix(HelixClass * helix, float * pos, float * mom) {
-
-  float x01 = getXC();
-  float y01 = getYC();
-  
-  float x02 = helix->getXC();
-  float y02 = helix->getYC();
-  
-  float rad1 = getRadius();
-  float rad2 = helix->getRadius();
-
-  float distance = sqrt((x01-x02)*(x01-x02)+(y01-y02)*(y01-y02));
-
-  bool singlePoint = true;
-
-  float phi1 = 0;
-  float phi2 = 0;
-
-  if (rad1+rad2<distance) {
-    phi1 = atan2(y02-y01,x02-x01);
-    phi2 = atan2(y01-y02,x01-x02);
-  }
-  else if (distance+rad2<rad1) {
-    phi1 = atan2(y02-y01,x02-x01);
-    phi2 = phi1;
-  }
-  else if (distance+rad1<rad2) {
-    phi1 = atan2(y01-y02,x01-x02);
-    phi2 = phi1;
-  }
-  else {
-    singlePoint = false;
-    float cosAlpha = 0.5*(distance*distance+rad2*rad2-rad1*rad1)/(distance*rad2);
-    float alpha = acos(cosAlpha);
-    float phi0 = atan2(y01-y02,x01-x02);
-    phi1 = phi0 + alpha;
-    phi2 = phi0 - alpha;
-  }
-  
-
-  float ref1[3];
-  float ref2[3];
-  for (int i=0;i<3;++i) {
-    ref1[i]=_referencePoint[i];
-    ref2[i]=helix->getReferencePoint()[i];
-  }
-  
-  float pos1[3];
-  float pos2[3];
-  float mom1[3];
-  float mom2[3];
-
-
-  if (singlePoint ) {
-
-    float xSect1 = x01 + rad1*cos(phi1);
-    float ySect1 = y01 + rad1*sin(phi1);
-    float xSect2 = x02 + rad2*cos(phi2);
-    float ySect2 = y02 + rad2*sin(phi2);
-    float R1 = sqrt(xSect1*xSect1+ySect1*ySect1);
-    float R2 = sqrt(xSect2*xSect2+ySect2*ySect2);
-
-    getPointOnCircle(R1,ref1,pos1);
-    helix->getPointOnCircle(R2,ref2,pos2);
-    
-  }
-  else {    
-
-    float xSect1 = x02 + rad2*cos(phi1);
-    float ySect1 = y02 + rad2*sin(phi1);
-    float xSect2 = x02 + rad2*cos(phi2);
-    float ySect2 = y02 + rad2*sin(phi2);
-
-//     std::cout << "(xSect1,ySect1)=(" << xSect1 << "," << ySect1 << ")" << std::endl;
-//     std::cout << "(xSect2,ySect2)=(" << xSect2 << "," << ySect2 << ")" << std::endl;
-
-    float temp21[3];
-    float temp22[3];
-
-    float phiI2  = atan2(ref2[1]-y02,ref2[0]-x02); 
-    float phiF21 = atan2(ySect1-y02,xSect1-x02);
-    float phiF22 = atan2(ySect2-y02,xSect2-x02);
-    float deltaPhi21 = phiF21 - phiI2;
-    float deltaPhi22 = phiF22 - phiI2;
-    float charge2 = helix->getCharge();
-    float pxy2 = helix->getPXY();
-    float pz2   = helix->getMomentum()[2];
-    if (deltaPhi21 < 0 && charge2 < 0) {
-      deltaPhi21 += _const_2pi;
-    }
-    else if (deltaPhi21 > 0 && charge2 > 0) { 
-      deltaPhi21 -= _const_2pi;
-    }
-
-    if (deltaPhi22 < 0 && charge2 < 0) {
-      deltaPhi22 += _const_2pi;
-    }
-    else if (deltaPhi22 > 0 && charge2 > 0) { 
-      deltaPhi22 -= _const_2pi;
-    }
-
-    float time21 = -charge2*deltaPhi21*rad2/pxy2;
-    float time22 = -charge2*deltaPhi22*rad2/pxy2;
-
-    float Z21 = ref2[2] + time21*pz2;
-    float Z22 = ref2[2] + time22*pz2;
-
-    temp21[0] = xSect1; temp21[1] = ySect1; temp21[2] = Z21;
-    temp22[0] = xSect2; temp22[1] = ySect2; temp22[2] = Z22;
-    
-
-//     std::cout << "temp21 = " << temp21[0] << " " << temp21[1] << " " << temp21[2] << std::endl;
-//     std::cout << "temp22 = " << temp22[0] << " " << temp22[1] << " " << temp22[2] << std::endl;
-
-
-    float temp11[3];
-    float temp12[3];
-
-    float phiI1  = atan2(ref1[1]-y01,ref1[0]-x01); 
-    float phiF11 = atan2(ySect1-y01,xSect1-x01);
-    float phiF12 = atan2(ySect2-y01,xSect2-x01);
-    float deltaPhi11 = phiF11 - phiI1;
-    float deltaPhi12 = phiF12 - phiI1;
-    float charge1 = _charge;
-    float pxy1 = _pxy;
-    float pz1   = _momentum[2];
-    if (deltaPhi11 < 0 && charge1 < 0) {
-      deltaPhi11 += _const_2pi;
-    }
-    else if (deltaPhi11 > 0 && charge1 > 0) { 
-      deltaPhi11 -= _const_2pi;
-    }
-
-    if (deltaPhi12 < 0 && charge1 < 0) {
-      deltaPhi12 += _const_2pi;
-    }
-    else if (deltaPhi12 > 0 && charge1 > 0) { 
-      deltaPhi12 -= _const_2pi;
-    }
-
-    float time11 = -charge1*deltaPhi11*rad1/pxy1;
-    float time12 = -charge1*deltaPhi12*rad1/pxy1;
-
-    float Z11 = ref1[2] + time11*pz1;
-    float Z12 = ref1[2] + time12*pz1;
-
-    temp11[0] = xSect1; temp11[1] = ySect1; temp11[2] = Z11;
-    temp12[0] = xSect2; temp12[1] = ySect2; temp12[2] = Z12;
-    
-//     std::cout << "temp11 = " << temp11[0] << " " << temp11[1] << " " << temp11[2] << std::endl;
-//     std::cout << "temp12 = " << temp12[0] << " " << temp12[1] << " " << temp12[2] << std::endl;
-
-    float Dist1 = 0;
-    float Dist2 = 0;
-
-    for (int j=0;j<3;++j) {
-      Dist1 += (temp11[j]-temp21[j])*(temp11[j]-temp21[j]);
-      Dist2 += (temp12[j]-temp22[j])*(temp12[j]-temp22[j]);
-    }
-
-    if (Dist1<Dist2) {
-      for (int l=0;l<3;++l) {
-	pos1[l] = temp11[l];
-	pos2[l] = temp21[l];
-      }
-    }
-    else {
-       for (int l=0;l<3;++l) {
-	pos1[l] = temp12[l];
-	pos2[l] = temp22[l];
-      }
-    }
-
-  }
-
-  getExtrapolatedMomentum(pos1,mom1);
-  helix->getExtrapolatedMomentum(pos2,mom2);
-
-  float helixDistance = 0;
-
-  for (int i=0;i<3;++i) {
-    helixDistance += (pos1[i] - pos2[i])*(pos1[i] - pos2[i]);
-    pos[i] = 0.5*(pos1[i]+pos2[i]);
-    mom[i] = mom1[i]+mom2[i];
-  }
-  helixDistance = sqrt(helixDistance);
-
-  return helixDistance;
-
-}
-
-void HelixClass::getExtrapolatedMomentum(float * pos, float * momentum) {
-
-  float phi = atan2(pos[1]-_yCentre,pos[0]-_xCentre);
-  if (phi <0.) phi += _const_2pi;
-  phi = phi - _phiAtPCA + _phi0;
-  momentum[0] = _pxy*cos(phi);
-  momentum[1] = _pxy*sin(phi);
-  momentum[2] = _momentum[2];
-
-
-}
diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h
deleted file mode 100644
index 794f8158652a637180cb99de38e35a249c2142d9..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h
+++ /dev/null
@@ -1,302 +0,0 @@
-#ifndef HELIXAR_H
-#define HELIXAR_H 1
-#include <vector>
-/**
- *    Utility class to manipulate with different parameterisations <br>
- *    of helix. Helix can be initialized in a three different <br>
- *    ways using the following public methods : <br>
- *    1) Initialize_VP(float * pos, float * mom, float q, float B) : <br>
- *       initialization of helix is done using <br>
- *       - position of the reference point : pos[3]; <br>
- *       - momentum vector at the reference point : mom[3];<br>
- *       - particle charge : q;<br>
- *       - magnetic field (in Tesla) : B;<br>
- *    2) Initialize_BZ(float xCentre, float yCentre, float radius, <br>
- *				   float bZ, float phi0, float B, float signPz,<br>
- *				   float zBegin):<br>
- *       initialization of helix is done according to the following<br>
- *       parameterization<br>
- *       x = xCentre + radius*cos(bZ*z + phi0)<br>
- *       y = yCentre + radius*sin(bZ*z + phi0)<br>
- *       where (x,y,z) - position of point on the helix<br>
- *       - (xCentre,yCentre) is the centre of circumference in R-Phi plane<br>
- *       - radius is the radius of circumference<br>
- *       - bZ is the helix slope parameter<br>
- *       - phi0 is the initial phase of circumference<br>
- *       - B is the magnetic field (in Tesla)<br>
- *       - signPz is the sign of the z component of momentum vector<br>
- *       - zBegin is the z coordinate of the reference point;<br>
- *    3) void Initialize_Canonical(float phi0, float d0, float z0, float omega,<br> 
- *			      float tanlambda, float B) :<br>
- *    canonical (LEP-wise) parameterisation with the following parameters<br>
- *       - phi0 - Phi angle of momentum vector at the point of<br>
- *         closest approach to IP in R-Phi plane;
- *       - d0 - signed distance of closest approach to IP in R-Phi plane;<br>
- *       - z0 - z coordinate of the point of closest approach in R-Phi plane;<br>
- *       - omega - signed curvature;<br>
- *       - tanlambda - tangent of dip angle;<br>
- *       - B - magnetic field (in Tesla);<br>
- *    A set of public methods (getters) provide access to <br>
- *    various parameters associated with helix. Helix Class contains<br>
- *    also several utility methods, allowing for calculation of helix<br>
- *    intersection points with planes parallel and perpendicular to <br>
- *    z (beam) axis and determination of the distance of closest approach<br>
- *    from arbitrary 3D point to the helix. <br>
- *    @author A. Raspereza (DESY)<br>
- *    @version $Id: HelixClass.h,v 1.16 2008-06-05 13:47:18 rasp Exp $<br>
- *
- */
-
-#include "LineClass.h"
-class HelixClass;
-
-class HelixClass {
- public:
-
-/**
- *  Constructor. Initializations of constants which are used
- *  to calculate various parameters associated with helix.
- */ 
-    HelixClass();
-/**
- *  Destructor. 
- */
-    ~HelixClass();
-/**
- *   Initialization of helix using <br>
- *     - position of the reference point : pos[3]; <br>
- *     - momentum vector at the reference point : mom[3];<br>
- *     - particle charge : q;<br>
- *     - magnetic field (in Tesla) : B<br>
- */  
-    void Initialize_VP(float * pos, float * mom, float q, float B);
-
-/**
- *   Initialization of helix according to the following<br>
- *   parameterization<br>
- *   x = xCentre + radius*cos(bZ*z + phi0)<br>
- *   y = yCentre + radius*sin(bZ*z + phi0)<br>
- *     where (x,y,z) - position of point on the helix<br>
- *     - (xCentre,yCentre) is the centre of circumference in R-Phi plane<br>
- *     - radius is the radius of circumference<br>
- *     - bZ is the helix slope parameter<br>
- *     - phi0 is the initial phase of circumference<br>
- *     - B is the magnetic field (in Tesla)<br>
- *     - signPz is the sign of the z component of momentum vector<br>
- *     - zBegin is the z coordinate of the reference point<br>
- */  
-    void Initialize_BZ(float xCentre, float yCentre, float radius, 
-				   float bZ, float phi0, float B, float signPz,
-				   float zBegin);
-/**
- *  Canonical (LEP-wise) parameterisation with the following parameters<br>
- *     - phi0 - Phi angle of momentum vector at the point of<br>
- *       closest approach to IP in R-Phi plane;
- *     - d0 - signed distance of closest approach in R-Phi plane;<br>
- *     - z0 - z coordinate of the point of closest approach to IP 
- *       in R-Phi plane;<br>
- *     - omega - signed curvature;<br>
- *     - tanlambda - tangent of dip angle;<br>
- *     - B - magnetic field (in Tesla)<br>
- */  
-    void Initialize_Canonical(float phi0, float d0, float z0, float omega, 
-			      float tanlambda, float B);
-    /**
-     *  Returns momentum of particle at the point of closest approach <br>
-     *  to IP <br>
-     */
-    const float * getMomentum();
-
-    /**
-     *  Returns reference point of track <br>     
-     */
-    const float * getReferencePoint();
-
-    /**
-     *  Returns Phi angle of the momentum vector <br>
-     *  at the point of closest approach to IP <br>     
-     */
-    float getPhi0();
-
-    /**
-     *  Returns signed distance of closest approach <br>
-     *  to IP in the R-Phi plane <br>     
-     */
-    float getD0();
-
-    /**
-     *  Returns z coordinate of the point of closest 
-     *  approach to IP in the R-Phi plane <br>     
-     */
-    float getZ0();
-
-    /**
-     *  Returns signed curvature of the track <br>     
-     */
-    float getOmega();
-
-    /**
-     *  Returns tangent of dip angle of the track <br>     
-     */
-    float getTanLambda();
-
-    /**
-     *  Returns transverse momentum of the track <br>     
-     */
-    float getPXY();
-
-
-    /**
-     *  Returns x coordinate of circumference
-     */
-    float getXC();
-
-    /**
-     *  Returns y coordinate of circumference
-     */
-    float getYC();
-
-
-     /**
-     *  Returns radius of circumference
-     */
-    float getRadius();   
-
-
-    /**
-     *  Returns helix intersection point with the plane <br>
-     *  parallel to z axis. Plane is defined by two coordinates <br>
-     *  of the point belonging to the plane (x0,y0) and normal <br>
-     *  vector (ax,ay).  ref[3] is the reference point of the helix. <br>
-     *  point[3] - returned vector holding the coordinates of <br>
-     *  intersection point <br>     
-     */
-    float getPointInXY(float x0, float y0, float ax, float ay, 
-			      float * ref , float * point);
-
-    /**
-     *  Returns helix intersection point with the plane <br>
-     *  perpendicular to z axis. Plane is defined by z coordinate <br>
-     *  of the plane. ref[3] is the reference point of the helix. <br>
-     *  point[3] - returned vector holding the coordinates of <br>
-     *  intersection point <br>     
-     */
-    float getPointInZ(float zLine, float * ref, float * point);
-
-    /**
-     * Return distance of the closest approach of the helix to <br>
-     * arbitrary 3D point in space. xPoint[3] - coordinates of <br>
-     * space point. Distance[3] - vector of distances of helix to <br> 
-     * a given point in various projections : <br>
-     * Distance[0] - distance in R-Phi plane <br>
-     * Distance[1] - distance along Z axis <br>
-     * Distance[2] - 3D distance <br> 
-     */
-    float getDistanceToPoint(float * xPoint, float * Distance);
-
-    /**
-     * Return distance of the closest approach of the helix to <br>
-     * arbitrary 3D point in space. xPoint[3] - coordinates of <br>
-     * space point. distCut - limit on the distance between helix <br> 
-     * and the point to reduce calculation time <br>
-     * If R-Phi is found to be greater than distCut, rPhi distance is returned <br>
-     * If the R-Phi distance is not too big, than the exact 3D distance is returned <br>
-     * This function can be used, if the exact distance is not always needed <br>
-     */
-    float getDistanceToPoint(const float* xPoint, float distCut);
-    float getDistanceToPoint(const std::vector<float>& xPoint, float distCut);
-
-    /**
-     * This method calculates coordinates of both intersection <br>
-     * of the helix with a cylinder. <br>
-     * Rotational symmetry with respect to z axis is assumed,  <br>
-     * meaning that cylinder axis corresponds to the z axis <br>
-     * of reference frame. <br>
-     * Inputs : <br> 
-     * Radius - radius of cylinder. <br>
-     * ref[3] - point of closest approach to the origin of the helix. <br>
-     * Output : <br>
-     * point[6] - coordinates of intersection point. <br>
-     * Method returns also generic time, defined as the <br>
-     * ratio of helix length from reference point to the intersection <br>
-     * point to the particle momentum <br>
-     */
-    float getPointOnCircle(float Radius, float * ref, float * point);
-
-    /** Returns distance between two helixes <br>
-     * Output : <br> 
-     * pos[3] - position of the point of closest approach <br>
-     * mom[3] - momentum of V0 <br>
-     */
-    float getDistanceToHelix(HelixClass * helix, float * pos, float * mom);
-
-    /**
-     * Set Edges of helix 
-     */
-    void setHelixEdges(float * xStart, float * xEnd);
-
-    /**
-     * Returns starting point of helix
-     */
-    float * getStartingPoint() {return _xStart;}
-
-    /**
-     * Returns endpoint of helix
-     */
-    float * getEndPoint() {return _xEnd;}
-    
-    /**
-     * Returns BZ for the second parameterization
-     */
-    float getBz();
-
-    /**
-     * Returns Phi for the second parameterization
-     */
-    float getPhiZ();
-
-    /**
-     * Returns extrapolated momentum
-     */
-    void getExtrapolatedMomentum(float * pos, float * momentum);
-
-    /**
-     * Returns charge 
-     */
-    float getCharge();
-
- private:    
-    float _momentum[3]; // momentum @ ref point 
-    float _referencePoint[3]; // coordinates @ ref point
-    float _phi0; // phi0 in canonical parameterization 
-    float _d0;   // d0 in canonical parameterisation
-    float _z0;   // z0 in canonical parameterisation
-    float _omega; // signed curvuture in canonical parameterisation
-    float _tanLambda; // TanLambda 
-    float _pxy; // Transverse momentum
-    float _charge; // Particle Charge
-    float _bField; // Magnetic field (assumed to point to Z>0)
-    float _radius; // radius of circle in XY plane
-    float _xCentre; // X of circle centre
-    float _yCentre; // Y of circle centre
-    float _phiRefPoint; // Phi w.r.t. (X0,Y0) of circle @ ref point
-    float _phiAtPCA; // Phi w.r.t. (X0,Y0) of circle @ PCA 
-    float _xAtPCA; // X @ PCA
-    float _yAtPCA; // Y @ PCA
-    float _pxAtPCA; // PX @ PCA
-    float _pyAtPCA; // PY @ PCA
-    float _phiMomRefPoint; // Phi of Momentum vector @ ref point
-    float _const_pi; // PI
-    float _const_2pi; // 2*PI
-    float _const_pi2; // PI/2    
-    float _FCT; // 2.99792458E-4
-    float _xStart[3]; // Starting point of track segment
-    float _xEnd[3]; // Ending point of track segment
-
-    float _bZ;
-    float _phiZ;
-
-};
-
-
-#endif
diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc
deleted file mode 100644
index e23db1fa3f46982b8fff4a5ecb27a0264896f97d..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "LineClass.h"
-#include <math.h> 
-
-/*
- * Constructor
- */
-
-LineClass::LineClass(float x0,
-		     float y0,
-		     float z0,
-		     float ax,
-		     float ay,
-		     float az) {
-  _x0[0] = x0;
-  _x0[1] = y0;
-  _x0[2] = z0;
-  _ax[0] = ax;
-  _ax[1] = ay;
-  _ax[2] = az;
-}
-
-LineClass::LineClass(float *x0,
-		     float *ax) {
-
-  for (int i=0; i<3; ++i) {
-    _x0[i] = x0[i];
-    _ax[i] = ax[i];
-  }
-}
-
-float * LineClass::getReferencePoint() {
-  return _x0;
-}
-
-float * LineClass::getDirectionalVector() {
-  return _ax;
-}
-
-void LineClass::setReferencePoint(float *x0) {
-  for (int i=0; i<3; ++i)
-    _x0[i] = x0[i];
-}
- 
-void LineClass::setDirectionalVector(float *ax) {
-  for (int i=0; i<3; ++i)
-    _ax[i] = ax[i];
- 
-}
-
-float LineClass::getDistanceToPoint(float * xpoint, float * pos) {
-  
-  float dif[3];
-  float prod = 0;
-  float den = 0;
-  for (int i=0; i<3; ++i) {
-    dif[i] = xpoint[i] - _x0[i];
-    prod += _ax[i]*dif[i];
-    den += _ax[i]*_ax[i];
-  }
-  float time = prod/fmax(1e-10,den);
-
-  float dist = 0.0;
-  for (int i=0; i<3; ++i) {
-    pos[i] = _x0[i] + _ax[i]*time;
-    dist += (xpoint[i]-pos[i])*(xpoint[i]-pos[i]);
-  }
-  dist = sqrt(dist);
-
-  return dist;
-
-
-
-}
diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h
deleted file mode 100644
index 98970a263225b5a53ccfded69f33c92ae517d182..0000000000000000000000000000000000000000
--- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef LINECLASS_H
-#define LINECLASS_H  
-class LineClass {
-
-  public:
-  LineClass(float x0,
-	    float y0,
-	    float z0,
-	    float ax,
-	    float ay,
-	    float az);
-
-  LineClass(float *x0,
-	    float *ax);
-  
-  ~LineClass();
-
-  float * getReferencePoint();
-  void setReferencePoint(float *x0);
-  float * getDirectionalVector();
-  void setDirectionalVector(float *ax);
-  float getDistanceToPoint(float * xpoint, float * pos);
-
- private:
-
-  float _x0[3];
-  float _ax[3];
-
-
-};
-
-#endif
diff --git a/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt
index 73dc84e3d20f447bdf73fba3060bf1ae6e27c887..84535b8eb8a3fce7d701c155d13c19520d349129 100644
--- a/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt
+++ b/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt
@@ -2,25 +2,13 @@ gaudi_subdir(MatrixPandora v0r0)
 
 find_package(DD4hep COMPONENTS DDG4 REQUIRED)
 find_package(CLHEP REQUIRED)
-find_package(GSL REQUIRED )##don't use this,  use CEPC LCIO version one , due to the ClusterShape.cc file which is from LCIO
-message("GSL: ${GSL_LIBRARIES} ")
-set (gsl_include "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/include")
-set (gsl_lib1 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgsl.so")
-set (gsl_lib2 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgslcblas.so")
 find_package(LCIO REQUIRED ) 
 find_package(GEAR REQUIRED)
-#message("ENV GEAR: $ENV{GEAR}")
 find_package(EDM4HEP REQUIRED ) 
-#message("EDM4HEP_INCLUDE_DIRS: ${EDM4HEP_INCLUDE_DIR}")
-#message("EDM4HEP_LIB: ${EDM4HEP_LIBRARIES}")
 include_directories(${EDM4HEP_INCLUDE_DIR})
 
 find_package(PandoraSDK REQUIRED ) 
-#message("PandoraSDK_INCLUDE_DIRS: ${PandoraSDK_INCLUDE_DIRS}")
-#message("PandoraSDK_LIB:          ${PandoraSDK_LIBRARIES}")
 find_package(LCContent REQUIRED ) 
-#message("LCContent_INCLUDE_DIRS: ${LCContent_INCLUDE_DIRS}")
-#message("LCContent_LIB:          ${LCContent_LIBRARIES}")
 include_directories(${PandoraSDK_INCLUDE_DIRS})
 link_libraries(${PandoraSDK_LIBRARIES})
 include_directories(${LCContent_INCLUDE_DIRS})
@@ -30,13 +18,12 @@ link_libraries(${LCContent_LIBRARIES})
 list(APPEND CMAKE_MODULE_PATH "$ENV{ROOTSYS}/etc/cmake/")
 find_package(ROOT 5.26.00 REQUIRED COMPONENTS Eve Geom RGL EG)
 
-include_directories("../CED/CED/")
-include_directories("../MarlinUtil/01-08/source/")
 
 gaudi_depends_on_subdirs(
     Service/EventSeeder
     Service/GearSvc
     Detector/DetInterface
+    Utilities/DataHelper
 )
 
 set(dir_srcs
@@ -46,14 +33,12 @@ set(dir_srcs
     src/CaloHitCreator.cpp
     src/TrackCreator.cpp
     src/PfoCreator.cpp
-    ../CED/CED/*.cc
-    ../MarlinUtil/01-08/source/*.cc
 )
 set(dir_include include)
 # Modules
 gaudi_add_module(MatrixPandora ${dir_srcs}
-    INCLUDE_DIRS ${gsl_include} ${dir_include} GaudiKernel FWCore CLHEP  ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear DD4hep  
-    LINK_LIBRARIES ${gsl_lib1} ${gsl_lib2} GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec
+    INCLUDE_DIRS ${dir_include} GaudiKernel FWCore CLHEP  ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear DD4hep  
+    LINK_LIBRARIES GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec DataHelperLib
       -Wl,--no-as-needed 
       EDM4HEP::edm4hep EDM4HEP::edm4hepDict
       -Wl,--as-needed 
diff --git a/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h b/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h
index 83c6e14932bb00178cfc70453b478dced3a72f90..b9679a48933ff9aaf90550d1a9e6c170c1f0c91f 100644
--- a/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h
+++ b/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h
@@ -22,7 +22,7 @@
 #include "edm4hep/CalorimeterHitCollection.h"
 #include "edm4hep/CalorimeterHit.h"
 
-#include "ClusterShapes.h"
+#include "DataHelper/ClusterShapes.h"
 #include "Api/PandoraApi.h"
 
 class CollectionMaps;
diff --git a/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml b/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ab63905438a22a636fc7d58a6853acc4f858533e
--- /dev/null
+++ b/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml
@@ -0,0 +1,652 @@
+<NEnergyBins>9</NEnergyBins>
+<EnergyBinLowerEdges>0 0.2 0.5 1 1.5 2.5 5 10 20 </EnergyBinLowerEdges>
+<NSignalEvents>42213 22561 20497 14219 19767 26770 22039 14547 10186 </NSignalEvents>
+<NBackgroundEvents>109034 45109 13323 4171 3447 3033 2077 1206 1006 </NBackgroundEvents>
+<PhotonSigPeakRms_0>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0.000213204 0.00485632 0.0255372 0.0994717 0.15481 0.0870111 0.0978845 0.0800701 0.0638429 0.0593656 0.0497714 0.0426172 0.0375951 0.0313884 0.0267216 0.0234999 0.0200649 0.0174117 0.0140478 0.0110393 0.00916779 0.00864663 0.00575652 0.00547225 0.00381399 0.0035771 0.0028901 0.00232156 0.00198991 0.00172933 0.00127923 0.00116078 0.000947575 0.000639613 0.000331651 0.000473788 0.000426409 0.000355341 0.000331651 0.000260583 0.000260583 0.000260583 0.000118447 7.10682e-05 0.000331651 4.73788e-05 4.73788e-05 7.10682e-05 0 </BinContents>
+</PhotonSigPeakRms_0>
+<PhotonBkgPeakRms_0>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0.000183429 0.00168755 0.0126291 0.0673093 0.147431 0.0799659 0.109259 0.0951355 0.0711154 0.0654383 0.0544968 0.0471596 0.0394831 0.0327054 0.0263221 0.0227177 0.0189482 0.0167562 0.0134729 0.011446 0.00903388 0.00792413 0.00656676 0.0058147 0.00423721 0.00423721 0.00329255 0.00319167 0.00265972 0.00228369 0.0020544 0.00180678 0.00159583 0.00145826 0.00132986 0.00114643 0.00113726 0.000953831 0.000953831 0.000935488 0.000834602 0.000596144 0.000412715 0.000412715 0.000403544 0.000421887 0.000247629 0.000394372 0 </BinContents>
+</PhotonBkgPeakRms_0>
+<PhotonSigPeakRms_1>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0.000132973 0.00093081 0.00483135 0.0188378 0.0378086 0.0551837 0.0777448 0.1023 0.108949 0.1066 0.0948096 0.0789859 0.0641816 0.0491556 0.0402908 0.0274811 0.0224724 0.0156021 0.0133859 0.0121892 0.00979566 0.00771242 0.00611675 0.00540756 0.00483135 0.0047427 0.00367891 0.00305838 0.00257081 0.00248216 0.00164 0.00234919 0.00195027 0.00203892 0.00132973 0.00115243 0.00101946 0.00093081 0.0012854 0.000531891 0.000398918 0.000398918 0.000664864 0.000398918 0.000576216 0.000487567 0.00031027 0.000265946 0 </BinContents>
+</PhotonSigPeakRms_1>
+<PhotonBkgPeakRms_1>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 4.43371e-05 0.000665056 0.00181782 0.00589683 0.0195526 0.0389058 0.0514975 0.0672815 0.0762376 0.0795185 0.0771686 0.0732448 0.0666164 0.0605644 0.0513423 0.0425414 0.0407236 0.0338292 0.0288856 0.0250948 0.0215921 0.0178457 0.0153628 0.0141435 0.0114833 0.00935512 0.00791416 0.00773682 0.00649538 0.00476623 0.00418985 0.00474406 0.00399033 0.00336962 0.00272673 0.00270456 0.00266022 0.00195083 0.00192866 0.00172915 0.00157397 0.00175131 0.00164047 0.00168481 0.00104192 0.00113059 0.0011971 0.00115276 0.000709393 0 </BinContents>
+</PhotonBkgPeakRms_1>
+<PhotonSigPeakRms_2>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 4.87876e-05 0 0.000487876 0.00278089 0.00482998 0.0105869 0.0228814 0.0499097 0.0847929 0.110894 0.131678 0.136605 0.115627 0.0926477 0.0687906 0.0494707 0.0325901 0.021369 0.0157096 0.0120018 0.00785481 0.00658633 0.00390301 0.00336635 0.00219544 0.00195151 0.0015612 0.00160999 0.000926965 0.000926965 0.000390301 0.000878177 0.000634239 0.000390301 0.000487876 0.000439089 0.000243938 0.000292726 0.000243938 4.87876e-05 0.000243938 0.000292726 9.75753e-05 0.000146363 0.000146363 0.000146363 4.87876e-05 0.000243938 0 </BinContents>
+</PhotonSigPeakRms_2>
+<PhotonBkgPeakRms_2>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0.000225175 0.000600465 0.00150116 0.00360279 0.011559 0.0228177 0.02582 0.0390302 0.0531412 0.0672521 0.0832395 0.0880432 0.0803873 0.0737071 0.0711551 0.0585454 0.0469864 0.0385799 0.0316745 0.029648 0.0231179 0.0178638 0.0179389 0.0138107 0.0114088 0.0101329 0.00900698 0.0082564 0.00683029 0.00637994 0.00547925 0.00450349 0.00382797 0.00397808 0.00390302 0.00330256 0.00240186 0.00307738 0.00225174 0.0023268 0.00172634 0.00217669 0.00150116 0.00120093 0.00112587 0.00142611 0.00127599 0.00120093 0.00105081 0 </BinContents>
+</PhotonBkgPeakRms_2>
+<PhotonSigPeakRms_3>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 0.000562627 0.00105493 0.00281314 0.00464168 0.00829875 0.0132217 0.0302412 0.0673043 0.109923 0.138828 0.147338 0.131584 0.100992 0.0720866 0.0485969 0.0335467 0.0244743 0.0164569 0.0103383 0.00689219 0.0056966 0.00506365 0.00344609 0.00295379 0.00225051 0.00168788 0.0014769 0.00126591 0.00091427 0.00105493 0.000773613 0.000632956 0.000562627 0.000492299 0.000492299 0.000492299 0.000281314 0.000140657 7.03284e-05 0.000140657 7.03284e-05 0.000140657 0.000281314 0.000281314 7.03284e-05 7.03284e-05 0 </BinContents>
+</PhotonSigPeakRms_3>
+<PhotonBkgPeakRms_3>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0.000959003 0.000959003 0.00119875 0.00263726 0.00455526 0.0129465 0.0148645 0.0275713 0.0357228 0.0417166 0.0592184 0.0748022 0.0863102 0.0949413 0.0937425 0.0791177 0.0678494 0.0537042 0.0431551 0.0364421 0.0198993 0.0218173 0.0177415 0.012467 0.0136658 0.00982978 0.00671302 0.00767202 0.00479501 0.00599377 0.00551427 0.00407576 0.00287701 0.00359626 0.00311676 0.00287701 0.00383601 0.00263726 0.00191801 0.00167825 0.00287701 0.00119875 0.00167825 0.00167825 0.0014385 0.00167825 0.00119875 0.00119875 0.00191801 0 </BinContents>
+</PhotonBkgPeakRms_3>
+<PhotonSigPeakRms_4>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0.000202357 0.000151768 0.00126473 0.00222593 0.00338949 0.00419892 0.00607072 0.0122932 0.0264582 0.0617696 0.105934 0.1459 0.14676 0.137047 0.103455 0.0766429 0.0498305 0.0324278 0.0233217 0.0125968 0.0107249 0.00698133 0.00490717 0.00480599 0.00344008 0.00288359 0.00212475 0.00156827 0.00106238 0.00131532 0.00080943 0.00101179 0.000708251 0.000910609 0.00075884 0.000556483 0.000657662 0.000404715 0.000354126 0.000455304 0.000202357 0.000354126 0.000151768 0.000252947 0.000202357 0.000252947 0.000202357 0 </BinContents>
+</PhotonSigPeakRms_4>
+<PhotonBkgPeakRms_4>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0.000580215 0.000870322 0.00116043 0.00203075 0.00319118 0.00696258 0.0127647 0.018857 0.0208877 0.0345228 0.0368436 0.05396 0.0791993 0.0771685 0.100667 0.086452 0.0786191 0.0646939 0.0519292 0.0472875 0.0301712 0.0281404 0.0258196 0.0229185 0.0142153 0.00870322 0.00899333 0.0078329 0.00754279 0.00696258 0.00870322 0.00638236 0.00551204 0.00290107 0.00464172 0.00435161 0.00319118 0.00261097 0.00261097 0.00145054 0.00290107 0.00319118 0.00145054 0.00232086 0.00290107 0.00203075 0.000580215 0.00203075 0.000290107 0 </BinContents>
+</PhotonBkgPeakRms_4>
+<PhotonSigPeakRms_5>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 7.47105e-05 0.000747105 0.00194247 0.00265222 0.00414643 0.00489354 0.00638775 0.00762047 0.0194247 0.0411655 0.0872619 0.130855 0.147217 0.140082 0.115652 0.0861038 0.0577512 0.0395966 0.0255136 0.0187897 0.0132238 0.0100486 0.0075084 0.00649981 0.00377288 0.00373552 0.00272693 0.00212925 0.00164363 0.00164363 0.0014195 0.0010833 0.00100859 0.000971236 0.000560329 0.000933881 0.000635039 0.000373552 0.000448263 0.000485618 0.000410908 0.000298842 0.000112066 0.000261487 7.47105e-05 0.000112066 0 </BinContents>
+</PhotonSigPeakRms_5>
+<PhotonBkgPeakRms_5>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0.000329707 0.000329707 0.00131883 0.00098912 0.00395648 0.00758325 0.0102209 0.0181339 0.0214309 0.0276954 0.0412133 0.0626442 0.0791296 0.0919881 0.0900099 0.0824266 0.0787999 0.0646225 0.0586878 0.0412133 0.0306627 0.0253874 0.019123 0.0211012 0.0151665 0.0121991 0.00923178 0.00890208 0.00758325 0.00956149 0.00626442 0.00560501 0.0052753 0.00395648 0.0052753 0.00296736 0.00395648 0.00296736 0.00395648 0.00296736 0.00329707 0.00263765 0.00296736 0.00164853 0.00329707 0.000659413 0.000659413 0 </BinContents>
+</PhotonBkgPeakRms_5>
+<PhotonSigPeakRms_6>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 4.53741e-05 0.000453741 0.0012251 0.00235945 0.00349381 0.00725986 0.0077136 0.00830346 0.0107083 0.0142475 0.030809 0.0653387 0.105949 0.14125 0.141113 0.126412 0.0980988 0.0671537 0.045601 0.0323517 0.02305 0.0158356 0.0112528 0.00925632 0.0064885 0.00480966 0.00426517 0.00299469 0.00190571 0.00163347 0.00167884 0.00154272 0.00131585 0.000408367 0.00077136 0.000499115 0.000408367 0.000544489 0.000226871 0.000317619 0.000317619 0.000181496 0.000181496 9.07482e-05 9.07482e-05 4.53741e-05 0 </BinContents>
+</PhotonSigPeakRms_6>
+<PhotonBkgPeakRms_6>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 0 0.000481464 0.000962927 0.00385171 0.00674049 0.00818488 0.00770342 0.0129995 0.0187771 0.0187771 0.0438132 0.0370727 0.0597015 0.0746269 0.0702937 0.0794415 0.0871449 0.0645161 0.0654791 0.0452576 0.0409244 0.0365912 0.0284064 0.0327395 0.0202215 0.0231103 0.0216659 0.0144439 0.0129995 0.0110737 0.00914781 0.00433317 0.0052961 0.0052961 0.00481464 0.00337025 0.00288878 0.00337025 0.00144439 0.00192585 0.00337025 0.00337025 0 0.00144439 0.000962927 0.000962927 0 </BinContents>
+</PhotonBkgPeakRms_6>
+<PhotonSigPeakRms_7>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0.000481199 0.00288719 0.00481199 0.00749295 0.0103801 0.0105864 0.0139548 0.0204853 0.0338901 0.063587 0.10607 0.131986 0.147866 0.122225 0.0924589 0.0685365 0.0504571 0.0290094 0.021104 0.0145047 0.0129924 0.00866158 0.00680553 0.00501822 0.00281845 0.00247474 0.00213102 0.00130611 0.00116863 0.000962398 0.000824912 0.000618684 0.000343713 0.000206228 0.000274971 0.000206228 0.000137485 0.000137485 0 0 6.87427e-05 0 6.87427e-05 0 </BinContents>
+</PhotonSigPeakRms_7>
+<PhotonBkgPeakRms_7>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 0 0.000829187 0 0 0.00165837 0.00165837 0.00746269 0.00912106 0.0066335 0.0107794 0.0182421 0.0381426 0.0323383 0.0489221 0.0605307 0.0588723 0.0746269 0.0704809 0.0613599 0.0538972 0.0480929 0.0505804 0.0613599 0.053068 0.0414594 0.0290216 0.0273632 0.0298507 0.0215589 0.0182421 0.00829187 0.0107794 0.00912106 0.0107794 0.0066335 0.00165837 0.00497512 0.00248756 0.00414594 0.00248756 0.000829187 0 0 0.000829187 0 0.000829187 0 </BinContents>
+</PhotonBkgPeakRms_7>
+<PhotonSigPeakRms_8>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 9.8174e-05 0.000883566 0.00137444 0.00274887 0.00382878 0.00854114 0.0105046 0.0196348 0.0350481 0.0608679 0.0949342 0.118692 0.125663 0.126743 0.112704 0.0869821 0.060966 0.0416258 0.0243471 0.0175731 0.0121736 0.009032 0.00628313 0.00549774 0.00343609 0.00274887 0.00215983 0.00137444 0.000687218 0.000687218 0.000785392 0.000589044 0.000392696 0.000196348 9.8174e-05 0 0 9.8174e-05 0 0 0 0 0 </BinContents>
+</PhotonSigPeakRms_8>
+<PhotonBkgPeakRms_8>
+    <NBinsX>50</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>5</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 0 0 0.000994036 0.000994036 0.00198807 0.00298211 0.00695825 0.0109344 0.0119284 0.0228628 0.0298211 0.0407555 0.05666 0.0685885 0.0854871 0.0755467 0.0805169 0.0785288 0.0675944 0.0606362 0.0536779 0.0447316 0.0377734 0.0357853 0.028827 0.026839 0.0208747 0.0139165 0.00894632 0.00397614 0.00397614 0.00795229 0.00397614 0.00198807 0.000994036 0.000994036 0 0 0.000994036 0 0 0 0 </BinContents>
+</PhotonBkgPeakRms_8>
+<PhotonSigRmsRatio_0>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.122877 0.0934072 0.085874 0.0783408 0.0719447 0.0632743 0.0581811 0.0520219 0.045223 0.04103 0.0363632 0.0317438 0.0279772 0.0241158 0.021581 0.0195201 0.0181698 0.0155639 0.0136688 0.0120105 0.00952313 0.00933362 0.00840973 0.00774643 0.00696468 0.00559069 0.00570914 0.00495108 0.00483263 0.00405088 0 </BinContents>
+</PhotonSigRmsRatio_0>
+<PhotonBkgRmsRatio_0>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.128409 0.085056 0.0776363 0.0704001 0.0624851 0.0577893 0.052103 0.0482327 0.0486545 0.0454445 0.0397216 0.0338885 0.0294954 0.0266064 0.0231121 0.0213328 0.0191867 0.0162243 0.015087 0.0132986 0.0117761 0.0114185 0.0105105 0.00974925 0.00872205 0.00805253 0.00725462 0.0067135 0.00589724 0.00574133 0 </BinContents>
+</PhotonBkgRmsRatio_0>
+<PhotonSigRmsRatio_1>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.122512 0.112273 0.100483 0.0878064 0.0772129 0.0699437 0.0597048 0.0542529 0.0468064 0.0381189 0.0327556 0.0286335 0.0246886 0.0201675 0.019813 0.0155135 0.0132973 0.0117903 0.0107265 0.00899783 0.00802269 0.00589513 0.00567351 0.00465405 0.00429945 0.00421081 0.00367891 0.00279243 0.00314702 0.00212757 0 </BinContents>
+</PhotonSigRmsRatio_1>
+<PhotonBkgRmsRatio_1>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.11 0.0959232 0.0860139 0.0770135 0.0702077 0.0618724 0.0554657 0.0507438 0.0441154 0.0419428 0.0352923 0.0298832 0.0284644 0.024075 0.0227006 0.0205724 0.0195083 0.0161165 0.0146977 0.0127469 0.0120818 0.0100423 0.0101975 0.00966548 0.00804717 0.00755947 0.00720477 0.00620719 0.00607418 0.0055643 0 </BinContents>
+</PhotonBkgRmsRatio_1>
+<PhotonSigRmsRatio_2>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.157535 0.138313 0.121725 0.104893 0.0883056 0.0722545 0.0612773 0.0521052 0.0390301 0.0320535 0.0252232 0.0215153 0.0172708 0.013319 0.0115627 0.00756208 0.00751329 0.00648875 0.00502513 0.0035615 0.00224423 0.00224423 0.00180514 0.00200029 0.00126848 0.00107333 0.00112212 0.000926965 0.000390301 0.000390301 0 </BinContents>
+</PhotonSigRmsRatio_2>
+<PhotonBkgRmsRatio_2>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.124446 0.117316 0.0990768 0.0917961 0.0779104 0.0668768 0.0587705 0.0504391 0.0409818 0.0385799 0.030999 0.0288974 0.0220671 0.0210163 0.0153869 0.0156121 0.0135105 0.0128349 0.010358 0.0101329 0.0082564 0.00698041 0.00668018 0.006455 0.00495384 0.00517901 0.00457855 0.00292727 0.00367785 0.00330256 0 </BinContents>
+</PhotonBkgRmsRatio_2>
+<PhotonSigRmsRatio_3>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.181096 0.166327 0.131936 0.113369 0.0912863 0.0707504 0.0577396 0.0446586 0.0326324 0.0264435 0.0197623 0.0148393 0.0110416 0.00787678 0.00675153 0.00478233 0.00337576 0.00344609 0.00281314 0.00189887 0.00161755 0.00140657 0.000984598 0.000703284 0.000351642 0.000492299 0.000492299 0.000281314 0.000421971 0.000421971 0 </BinContents>
+</PhotonSigRmsRatio_3>
+<PhotonBkgRmsRatio_3>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.157996 0.135939 0.110285 0.107169 0.078878 0.0733637 0.0618557 0.0409974 0.0419564 0.0347638 0.0246943 0.0165428 0.0239751 0.0158235 0.011508 0.00982978 0.00863102 0.00551427 0.00839127 0.00455526 0.00503476 0.00287701 0.00407576 0.00263726 0.00335651 0.00191801 0.00311676 0.00191801 0.00119875 0.00119875 0 </BinContents>
+</PhotonBkgRmsRatio_3>
+<PhotonSigRmsRatio_4>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.203572 0.180199 0.155765 0.116659 0.090302 0.0672839 0.0489199 0.035969 0.0283806 0.0197804 0.0142662 0.00900491 0.00804371 0.00500835 0.0033389 0.00268124 0.00252947 0.00197299 0.00136591 0.00101179 0.000860019 0.000657662 0.000860019 0.000556483 0.000252947 0.000404715 5.05894e-05 0.000101179 5.05894e-05 0.000151768 0 </BinContents>
+</PhotonSigRmsRatio_4>
+<PhotonBkgRmsRatio_4>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.173194 0.158979 0.120104 0.111981 0.0844212 0.0690455 0.0586017 0.0420656 0.0348129 0.0249492 0.0203075 0.0182768 0.0124746 0.010734 0.010734 0.010734 0.00899333 0.00725268 0.0037714 0.0037714 0.00232086 0.00145054 0.00116043 0.00261097 0.00174064 0.00174064 0.000870322 0.000870322 0.000580215 0.00145054 0 </BinContents>
+</PhotonBkgRmsRatio_4>
+<PhotonSigRmsRatio_5>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.240605 0.202652 0.159357 0.118379 0.0868136 0.0602167 0.0386627 0.0288383 0.0196489 0.0131117 0.00833022 0.00620097 0.00437056 0.002839 0.00212925 0.00149421 0.00119537 0.00104595 0.000896526 0.000672394 0.000522973 0.000448263 0.000298842 0.000373552 0.000149421 7.47105e-05 0.000224131 0.000112066 0.000261487 7.47105e-05 0 </BinContents>
+</PhotonSigRmsRatio_5>
+<PhotonBkgRmsRatio_5>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.183976 0.16881 0.149027 0.107814 0.0877019 0.0652819 0.0530828 0.0375865 0.0323112 0.0240686 0.0154962 0.0161556 0.0128586 0.00923178 0.00791296 0.00428619 0.00329707 0.0052753 0.00131883 0.00197824 0.00329707 0.00131883 0.00164853 0.000329707 0.00131883 0.000659413 0.00098912 0.00131883 0.00098912 0.000659413 0 </BinContents>
+</PhotonBkgRmsRatio_5>
+<PhotonSigRmsRatio_6>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.269931 0.222242 0.163755 0.1182 0.0780435 0.0516357 0.0320795 0.0208267 0.0135215 0.00871183 0.00657925 0.00381143 0.00317619 0.00186034 0.00163347 0.000907482 0.000635238 0.000408367 0.000408367 0.000408367 0.000362993 0.000226871 9.07482e-05 9.07482e-05 0.000136122 9.07482e-05 4.53741e-05 4.53741e-05 4.53741e-05 9.07482e-05 0 </BinContents>
+</PhotonSigRmsRatio_6>
+<PhotonBkgRmsRatio_6>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.202215 0.189215 0.135773 0.129032 0.0832932 0.0683678 0.0476649 0.0389986 0.0250361 0.0202215 0.0178142 0.00962927 0.00818488 0.0052961 0.00433317 0.0052961 0.00337025 0.000481464 0.000962927 0.00144439 0.000962927 0 0.000962927 0.000962927 0.000481464 0 0 0 0 0 0 </BinContents>
+</PhotonBkgRmsRatio_6>
+<PhotonSigRmsRatio_7>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.291538 0.231044 0.16842 0.116244 0.0696364 0.0448202 0.0283907 0.0171169 0.0116863 0.00673678 0.00474325 0.00302468 0.00240599 0.000962398 0.000687427 0.000549942 0.000687427 0.000343713 0.000137485 0.000206228 0 6.87427e-05 6.87427e-05 6.87427e-05 0.000137485 6.87427e-05 6.87427e-05 0 6.87427e-05 6.87427e-05 0 </BinContents>
+</PhotonSigRmsRatio_7>
+<PhotonBkgRmsRatio_7>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.237977 0.217247 0.1534 0.108624 0.0713101 0.0704809 0.0422886 0.0315091 0.0190713 0.0157546 0.00829187 0.00580431 0.00497512 0.00165837 0.00165837 0.00331675 0 0.00248756 0.00165837 0.000829187 0 0 0.000829187 0 0 0.000829187 0 0 0 0 0 </BinContents>
+</PhotonBkgRmsRatio_7>
+<PhotonSigRmsRatio_8>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.311604 0.245042 0.174357 0.106421 0.0615551 0.0387787 0.0229727 0.0148243 0.00893383 0.00530139 0.00353426 0.002258 0.00147261 0.00098174 0.00049087 0.000196348 0.000294522 0.000392696 9.8174e-05 0.000294522 9.8174e-05 9.8174e-05 0 0 0 0 0 0 0 0 0 </BinContents>
+</PhotonSigRmsRatio_8>
+<PhotonBkgRmsRatio_8>
+    <NBinsX>30</NBinsX>
+    <XLow>1</XLow>
+    <XHigh>3</XHigh>
+    <BinContents>0 0.305169 0.223658 0.161034 0.122266 0.0596421 0.0407555 0.0347912 0.0198807 0.0119284 0.0119284 0.00298211 0.00298211 0.00298211 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents>
+</PhotonBkgRmsRatio_8>
+<PhotonSigLongProfileStart_0>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.0520456 0.137233 0.112927 0.123682 0.130979 0.128586 0.106057 0.0800227 0.0637244 0.0455784 0.0191647 0 </BinContents>
+</PhotonSigLongProfileStart_0>
+<PhotonBkgLongProfileStart_0>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.0566245 0.189996 0.130592 0.128079 0.133674 0.130455 0.0956491 0.0595869 0.0397307 0.0255241 0.0100886 0 </BinContents>
+</PhotonBkgLongProfileStart_0>
+<PhotonSigLongProfileStart_1>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.148797 0.282878 0.168565 0.116307 0.0837729 0.0670183 0.0447675 0.0332875 0.0282789 0.0185275 0.00780107 0 </BinContents>
+</PhotonSigLongProfileStart_1>
+<PhotonBkgLongProfileStart_1>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.0692545 0.182469 0.141901 0.13995 0.133122 0.119222 0.0809151 0.0543351 0.0391053 0.0279102 0.0118158 0 </BinContents>
+</PhotonBkgLongProfileStart_1>
+<PhotonSigLongProfileStart_2>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.234425 0.335122 0.19998 0.102356 0.0572279 0.033322 0.0170269 0.00961116 0.00561058 0.00424452 0.00107333 0 </BinContents>
+</PhotonSigLongProfileStart_2>
+<PhotonBkgLongProfileStart_2>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.104781 0.189597 0.156571 0.140359 0.123996 0.101554 0.0642498 0.0463859 0.0344517 0.0266456 0.0114088 0 </BinContents>
+</PhotonBkgLongProfileStart_2>
+<PhotonSigLongProfileStart_3>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.263169 0.352345 0.190027 0.0927632 0.0499332 0.0259512 0.0123778 0.0066812 0.00344609 0.00281314 0.000492299 0 </BinContents>
+</PhotonSigLongProfileStart_3>
+<PhotonBkgLongProfileStart_3>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.135459 0.198514 0.179094 0.132582 0.120834 0.083673 0.0510669 0.0371614 0.0278111 0.0249341 0.00887077 0 </BinContents>
+</PhotonBkgLongProfileStart_3>
+<PhotonSigLongProfileStart_4>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.287348 0.345374 0.187181 0.0916173 0.045581 0.0222087 0.0110791 0.00495776 0.00278242 0.00126473 0.000607072 0 </BinContents>
+</PhotonSigLongProfileStart_4>
+<PhotonBkgLongProfileStart_4>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.156078 0.225413 0.178416 0.125036 0.100087 0.0699159 0.0490281 0.0365535 0.0284305 0.0211778 0.00986365 0 </BinContents>
+</PhotonBkgLongProfileStart_4>
+<PhotonSigLongProfileStart_5>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.30777 0.33941 0.184535 0.0889055 0.0415764 0.0208069 0.00945088 0.00410908 0.00224131 0.000933881 0.000261487 0 </BinContents>
+</PhotonSigLongProfileStart_5>
+<PhotonBkgLongProfileStart_5>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.204748 0.23574 0.167491 0.102539 0.0748434 0.060666 0.0487966 0.0346192 0.0323112 0.0250577 0.0131883 0 </BinContents>
+</PhotonBkgLongProfileStart_5>
+<PhotonSigLongProfileStart_6>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.33114 0.330641 0.172512 0.0880258 0.0432869 0.0202369 0.00825809 0.00372068 0.00131585 0.000544489 0.000317619 0 </BinContents>
+</PhotonSigLongProfileStart_6>
+<PhotonBkgLongProfileStart_6>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.223881 0.217622 0.142995 0.102552 0.0741454 0.0635532 0.0539239 0.0418873 0.0370727 0.0317766 0.0105922 0 </BinContents>
+</PhotonBkgLongProfileStart_6>
+<PhotonSigLongProfileStart_7>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.349007 0.319379 0.178525 0.0798103 0.0387021 0.0201416 0.00783667 0.00426205 0.00137485 0.00075617 0.000206228 0 </BinContents>
+</PhotonSigLongProfileStart_7>
+<PhotonBkgLongProfileStart_7>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.212272 0.197347 0.126866 0.10199 0.0837479 0.0671642 0.0621891 0.0497512 0.0439469 0.039801 0.0149254 0 </BinContents>
+</PhotonBkgLongProfileStart_7>
+<PhotonSigLongProfileStart_8>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.417632 0.298645 0.151188 0.0719615 0.0337718 0.0147261 0.00736305 0.00323974 0.000785392 0.000392696 0.000294522 0 </BinContents>
+</PhotonSigLongProfileStart_8>
+<PhotonBkgLongProfileStart_8>
+    <NBinsX>11</NBinsX>
+    <XLow>-0.5</XLow>
+    <XHigh>10.5</XHigh>
+    <BinContents>0 0.237575 0.150099 0.102386 0.0805169 0.0785288 0.0904573 0.0854871 0.0536779 0.05666 0.0417495 0.0228628 0 </BinContents>
+</PhotonBkgLongProfileStart_8>
+<PhotonSigLongProfileDiscrepancy_0>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0.000307962 0.000165826 0.00040272 0.000734371 0.0011134 0.000829128 0.00127923 0.00187146 0.00220311 0.00296117 0.00376661 0.00506953 0.00637244 0.00881245 0.011821 0.0150901 0.0186435 0.0240921 0.0282851 0.034018 0.0397271 0.0449625 0.0488475 0.0502926 0.0543671 0.0521403 0.0523772 0.0525667 0.0540592 0.0496766 0.0479473 0.0442518 0.0426646 0.0386137 0.0341127 0.0313174 0.0297302 0.0244474 0.0221496 0.0179092 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_0>
+<PhotonBkgLongProfileDiscrepancy_0>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0.000201772 0.000311829 0.000348515 0.000577801 0.000715373 0.000843773 0.00117395 0.00164169 0.0017976 0.00317332 0.00505347 0.00732799 0.0106664 0.0144542 0.0197278 0.0257259 0.0322193 0.0408405 0.0457564 0.0520296 0.0555698 0.0588073 0.0567713 0.0561843 0.0550654 0.051672 0.0497643 0.0474623 0.0426197 0.0395932 0.0371719 0.032577 0.0303116 0.025891 0.0234331 0.019847 0.0166095 0.0146101 0.011877 0.00957499 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_0>
+<PhotonSigLongProfileDiscrepancy_1>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 4.43243e-05 8.86486e-05 4.43243e-05 8.86486e-05 0.000132973 0.000753513 0.00168432 0.00332432 0.00558486 0.00944107 0.0123665 0.0179513 0.0242897 0.0314259 0.0373654 0.0428616 0.0487567 0.0504854 0.0563362 0.0557599 0.0583307 0.055627 0.0563362 0.056868 0.0530118 0.0464962 0.0424183 0.0396702 0.0368778 0.0342183 0.0302292 0.0274367 0.0234919 0.0214529 0.0187492 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_1>
+<PhotonBkgLongProfileDiscrepancy_1>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0.000110843 0.00015518 0.000731561 0.00126361 0.00219468 0.00396817 0.00605201 0.00793633 0.0109734 0.0134341 0.0167816 0.0216365 0.0263362 0.0294841 0.0341617 0.0377973 0.0412556 0.043539 0.0481722 0.0508768 0.0528276 0.0525616 0.0509433 0.0503226 0.0500787 0.0478175 0.0451129 0.0442705 0.0415438 0.0403911 0.0369328 0.0321 0.0310138 0.027223 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_1>
+<PhotonSigLongProfileDiscrepancy_2>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 4.87876e-05 4.87876e-05 4.87876e-05 0.000243938 0.000878177 0.00307362 0.00585452 0.0108796 0.0147339 0.0226375 0.0328341 0.0448846 0.0508855 0.057667 0.0659609 0.069376 0.0702542 0.0671806 0.0664487 0.0584964 0.0569839 0.0494219 0.0436649 0.0370298 0.0342977 0.0274674 0.0243938 0.0201005 0.0169781 0.0133678 0.0112212 0.00931844 0.00780602 0.005513 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_2>
+<PhotonBkgLongProfileDiscrepancy_2>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 7.50582e-05 0.000225175 0.000150116 0.000600465 0.000750582 0.00187645 0.00255198 0.00442843 0.00818134 0.0106583 0.0127599 0.0179389 0.0230429 0.0286722 0.0322 0.0370037 0.0390302 0.0454102 0.0457104 0.0506643 0.0499137 0.0558433 0.0454102 0.0497636 0.0475869 0.0499137 0.0484876 0.0478121 0.042633 0.0445845 0.0433086 0.0411319 0.0390302 0.0326503 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_2>
+<PhotonSigLongProfileDiscrepancy_3>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 7.03284e-05 0.000140657 0.00126591 0.0019692 0.00555595 0.0115339 0.0174415 0.0301006 0.0395246 0.0504255 0.0635066 0.076236 0.0784162 0.0793305 0.0786975 0.0744075 0.0677263 0.0590056 0.0495815 0.0414938 0.0380477 0.0316478 0.0239117 0.0189887 0.0152613 0.0120262 0.00893171 0.00696251 0.00555595 0.00436036 0.00337576 0.00260215 0.00189887 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_3>
+<PhotonBkgLongProfileDiscrepancy_3>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 0 0.000239751 0.000479501 0.000479501 0.00263726 0.00671302 0.00743227 0.0112683 0.0210981 0.0227763 0.0345241 0.0388396 0.0445936 0.0465116 0.0484296 0.0501079 0.0515464 0.0407576 0.0469911 0.0469911 0.0383601 0.0462719 0.0409974 0.0393191 0.0383601 0.0393191 0.0326061 0.0357228 0.0414769 0.0299688 0.0309278 0.0342843 0.0299688 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_3>
+<PhotonSigLongProfileDiscrepancy_4>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 0.000303536 0.000455304 0.00212475 0.00440127 0.0130015 0.0211969 0.0348055 0.0498305 0.0649062 0.07897 0.0837254 0.0931856 0.0896949 0.0813477 0.0748217 0.0623767 0.0524612 0.0420904 0.0335913 0.0258512 0.020944 0.0177569 0.0131532 0.0102191 0.00753782 0.00581778 0.00424951 0.00288359 0.00288359 0.00217534 0.00146709 0.00131532 0.000455304 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_4>
+<PhotonBkgLongProfileDiscrepancy_4>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 0.000580215 0 0.00145054 0.00174064 0.00522193 0.0118944 0.0159559 0.0252393 0.0316217 0.0409051 0.0490281 0.0571511 0.05396 0.056861 0.0522193 0.0571511 0.0438062 0.0501886 0.0394546 0.0371337 0.0403249 0.0409051 0.0348129 0.0295909 0.0287206 0.0275602 0.0261097 0.0272701 0.0232086 0.0211778 0.0237888 0.0205976 0.024369 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_4>
+<PhotonSigLongProfileDiscrepancy_5>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 3.73552e-05 0.000112066 0.00078446 0.00321255 0.00847964 0.0212178 0.0367949 0.0561076 0.0758685 0.0914456 0.101233 0.0995144 0.0946956 0.083489 0.0738513 0.0589092 0.047217 0.0342921 0.0275682 0.0207695 0.0169966 0.0108704 0.00896526 0.00691072 0.00466941 0.00381024 0.00306313 0.00194247 0.00209189 0.00138214 0.00127008 0.000971236 0.000560329 0.000560329 0.000336197 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_5>
+<PhotonBkgLongProfileDiscrepancy_5>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0.000329707 0 0.00197824 0.00428619 0.0108803 0.0201121 0.0339598 0.0369271 0.0520936 0.0639631 0.0679196 0.0698978 0.0712166 0.0573689 0.060666 0.0544016 0.0418727 0.0333004 0.0356083 0.0342895 0.0257171 0.0253874 0.0194527 0.0201121 0.0201121 0.0171447 0.0220903 0.0131883 0.0141774 0.016815 0.0125288 0.0151665 0.0141774 0.0128586 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_5>
+<PhotonSigLongProfileDiscrepancy_6>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0.000226871 0.00099823 0.00431054 0.0137484 0.0335315 0.0600753 0.0868007 0.10858 0.119515 0.11103 0.0988702 0.0870729 0.0678343 0.0551295 0.038931 0.0282227 0.0226417 0.0156994 0.0103907 0.00889332 0.00644312 0.00462816 0.00299469 0.00326694 0.00217796 0.00222333 0.00113435 0.00145197 0.000725986 0.000499115 0.000680612 0.000317619 0.000136122 0.000499115 0.000317619 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_6>
+<PhotonBkgLongProfileDiscrepancy_6>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0 0.00144439 0.00625903 0.0125181 0.0250361 0.0544054 0.0669234 0.0813674 0.0751083 0.0702937 0.0688493 0.0548869 0.0597015 0.0481464 0.046702 0.0380356 0.033221 0.0240732 0.0327395 0.0207029 0.0221473 0.0192585 0.0221473 0.013481 0.0110737 0.0129995 0.0129995 0.0139624 0.0115551 0.0110737 0.00722195 0.00722195 0.00577756 0.00866635 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_6>
+<PhotonSigLongProfileDiscrepancy_7>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0.000137485 0.000962398 0.0065993 0.0227538 0.0514883 0.0906029 0.112257 0.123874 0.11645 0.106139 0.0908778 0.0655805 0.0540318 0.0393896 0.0274971 0.0208978 0.0158108 0.0129924 0.00824912 0.00790541 0.00543067 0.00426205 0.00254348 0.00295594 0.00213102 0.00158108 0.00171857 0.00123737 0.000824912 0.00075617 0.000206228 0.000618684 0.000481199 0.000481199 0.000137485 0.000137485 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_7>
+<PhotonBkgLongProfileDiscrepancy_7>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0.000829187 0.00414594 0.013267 0.0257048 0.0489221 0.0547264 0.0646766 0.0878939 0.0704809 0.0754561 0.0555556 0.0679934 0.0588723 0.0257048 0.0422886 0.0257048 0.0257048 0.0306799 0.0248756 0.0290216 0.0174129 0.0174129 0.0157546 0.0165837 0.0174129 0.0140962 0.00912106 0.00912106 0.00580431 0.0116086 0.0066335 0.0116086 0.00497512 0.00331675 0.0066335 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_7>
+<PhotonSigLongProfileDiscrepancy_8>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0.00049087 0.00628313 0.0170823 0.0405458 0.0650893 0.0862949 0.110151 0.11074 0.114078 0.098763 0.0793246 0.0642058 0.0460436 0.0341645 0.0269978 0.0233654 0.0172786 0.0139407 0.009032 0.0075594 0.00647948 0.00402513 0.00431965 0.00196348 0.00314157 0.00117809 0.000883566 0.000883566 0.000687218 0.000785392 0.00157078 0.000589044 0.000687218 0.000294522 0.000589044 0.000294522 0.000196348 0 0 </BinContents>
+</PhotonSigLongProfileDiscrepancy_8>
+<PhotonBkgLongProfileDiscrepancy_8>
+    <NBinsX>42</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>0.82</XHigh>
+    <BinContents>0 0 0 0 0 0 0.00397614 0.0109344 0.0218688 0.0457256 0.0576541 0.0685885 0.0755467 0.083499 0.0626243 0.0616302 0.0636183 0.0487077 0.0347912 0.0397614 0.0328032 0.027833 0.0318091 0.0208747 0.0168986 0.0218688 0.0248509 0.00795229 0.0139165 0.0139165 0.0228628 0.0149105 0.0129225 0.00695825 0.00894632 0.00795229 0.00695825 0.0109344 0.00695825 0.00497018 0.00298211 0.000994036 0 0 </BinContents>
+</PhotonBkgLongProfileDiscrepancy_8>
+<PhotonSigPeakEnergyFraction_0>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.0229787 0.0358183 0.0323834 0.0279772 0.0252529 0.0217942 0.0179566 0.0172696 0.0155402 0.0154929 0.0144742 0.0133845 0.0126028 0.0116552 0.0111103 0.0106365 0.00992585 0.0104707 0.00978372 0.00862294 0.00916779 0.00791225 0.00805439 0.00734371 0.00698837 0.00656196 0.00686992 0.0064672 0.00594604 0.00596973 0.0053538 0.00521166 0.00497477 0.00466681 0.00360079 0.00338758 0.00281904 0.00258214 0.00189515 0.00175301 0.00151612 0.000923886 0.000686992 0.000497477 4.73788e-05 4.73788e-05 0 0 2.36894e-05 0 0.5436 0 </BinContents>
+</PhotonSigPeakEnergyFraction_0>
+<PhotonBkgPeakEnergyFraction_0>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.0242585 0.0401343 0.0417943 0.0420694 0.0401618 0.0384376 0.0341912 0.0318616 0.0292661 0.0270008 0.0254966 0.0240384 0.0215621 0.0192692 0.0176 0.016582 0.0153163 0.0139865 0.0134453 0.0116936 0.0110608 0.0103637 0.00957499 0.00946494 0.00808922 0.00772236 0.00766733 0.00679605 0.00663096 0.00602564 0.00559459 0.00526441 0.00477833 0.00393455 0.00391621 0.00298072 0.00294404 0.00227452 0.00212778 0.00143075 0.00118312 0.000779573 0.000394372 0.000210943 7.33716e-05 1.83429e-05 9.17145e-06 9.17145e-06 0 0 0.350515 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_0>
+<PhotonSigPeakEnergyFraction_1>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.00726918 0.0163557 0.0164443 0.012987 0.0111697 0.0102832 0.0101946 0.00868756 0.00886486 0.00851026 0.00695891 0.00802269 0.00842161 0.00726918 0.0076681 0.00740215 0.00704756 0.00731351 0.00704756 0.00651567 0.00687026 0.00695891 0.00709188 0.00722486 0.00678161 0.00647134 0.00660432 0.00802269 0.0076681 0.00797837 0.00780107 0.0091308 0.00921945 0.00842161 0.0107265 0.0101946 0.0109924 0.0103719 0.0110367 0.0108594 0.0103719 0.00970702 0.00859891 0.00642702 0.00554053 0.00412216 0.00141838 0.00031027 0 0 0.598644 0 </BinContents>
+</PhotonSigPeakEnergyFraction_1>
+<PhotonBkgPeakEnergyFraction_1>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.00982066 0.0238977 0.0254938 0.0258485 0.0250504 0.0223237 0.0220133 0.0212818 0.0193975 0.0180895 0.0186881 0.0178457 0.0162052 0.0162495 0.0154958 0.0162717 0.015518 0.0145647 0.0143209 0.0140548 0.0138997 0.0146534 0.0141657 0.0127912 0.0129686 0.0123257 0.0115498 0.0117493 0.0118158 0.0106852 0.0115498 0.0112394 0.0105522 0.0100202 0.009998 0.00955463 0.00895608 0.00897825 0.00911126 0.00811368 0.00813585 0.00649538 0.0059855 0.00469973 0.00334745 0.00208384 0.00126361 0.00015518 2.21685e-05 0 0.370702 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_1>
+<PhotonSigPeakEnergyFraction_2>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.00209787 0.00439089 0.00575694 0.00517149 0.00400059 0.00400059 0.00502513 0.00312241 0.00414695 0.0035615 0.00331756 0.00370786 0.00302483 0.00361028 0.00321998 0.0039518 0.00429331 0.00307362 0.00346392 0.00312241 0.00390301 0.00341513 0.00351271 0.00351271 0.00326877 0.00307362 0.00287847 0.00419574 0.00414695 0.00390301 0.00385422 0.00517149 0.00536664 0.00580573 0.005513 0.00653754 0.0086842 0.0103918 0.0107333 0.0144411 0.0161975 0.0178563 0.0207835 0.0223447 0.0228814 0.0206372 0.0168317 0.00878177 0.00170757 4.87876e-05 0.663561 0 </BinContents>
+</PhotonSigPeakEnergyFraction_2>
+<PhotonBkgPeakEnergyFraction_2>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.00382797 0.0177888 0.0214666 0.023193 0.025745 0.02582 0.0240937 0.0228177 0.0237934 0.0225175 0.0209412 0.0187645 0.0192899 0.0183893 0.0159123 0.0176387 0.015537 0.0138858 0.0152368 0.0153869 0.0146363 0.0140359 0.0123846 0.0130601 0.0124597 0.0122345 0.0132102 0.0132853 0.0108084 0.0111086 0.0114839 0.0113338 0.0111086 0.0102079 0.010283 0.010358 0.0128349 0.0105081 0.0127599 0.0114088 0.010283 0.011634 0.00998274 0.0111837 0.0121594 0.0114088 0.00840651 0.00442843 0.00120093 0 0.297756 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_2>
+<PhotonSigPeakEnergyFraction_3>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.000773613 0.00274281 0.00478233 0.00386806 0.00323511 0.00295379 0.00414938 0.00253182 0.00210985 0.00302412 0.00302412 0.00358675 0.00309445 0.00218018 0.00302412 0.00260215 0.00288347 0.00281314 0.00239117 0.00218018 0.00330544 0.00267248 0.00168788 0.00218018 0.00239117 0.00302412 0.00232084 0.00365708 0.00281314 0.00330544 0.00337576 0.00337576 0.00379774 0.00492299 0.00414938 0.004712 0.00696251 0.00647022 0.00696251 0.00858007 0.0128701 0.0160349 0.0175118 0.024193 0.0317884 0.0353049 0.0373444 0.0300302 0.0111822 0.000281314 0.644841 0 </BinContents>
+</PhotonSigPeakEnergyFraction_3>
+<PhotonBkgPeakEnergyFraction_3>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.0014385 0.00982978 0.0191801 0.0196596 0.0246943 0.0230161 0.0184608 0.0246943 0.0227763 0.0249341 0.0220571 0.0179813 0.0206186 0.0191801 0.0206186 0.0198993 0.0201391 0.0179813 0.0165428 0.0170223 0.0177415 0.016303 0.0141453 0.0139055 0.0122273 0.0131863 0.0129465 0.013426 0.0103093 0.013426 0.0127068 0.0107888 0.0112683 0.0103093 0.010549 0.0131863 0.0112683 0.0119875 0.0122273 0.0119875 0.010549 0.00982978 0.0136658 0.0141453 0.014385 0.0177415 0.015344 0.013426 0.00575402 0 0.250539 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_3>
+<PhotonSigPeakEnergyFraction_4>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.000354126 0.00278242 0.00389538 0.00374361 0.00344008 0.00308595 0.00323772 0.00298477 0.00258006 0.00278242 0.00308595 0.002833 0.00217534 0.0023777 0.0019224 0.00298477 0.00258006 0.00182122 0.00263065 0.00303536 0.00268124 0.00217534 0.00197299 0.00273183 0.00202357 0.00263065 0.00298477 0.00273183 0.00268124 0.00288359 0.0033389 0.00349067 0.00344008 0.00323772 0.00409774 0.00394597 0.00627308 0.00490717 0.0061719 0.00748723 0.00860019 0.0109779 0.0134568 0.0185663 0.0262559 0.0361208 0.0457328 0.0574695 0.0339961 0.0023777 0.620226 0 </BinContents>
+</PhotonSigPeakEnergyFraction_4>
+<PhotonBkgPeakEnergyFraction_4>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.000580215 0.00899333 0.0130548 0.0171163 0.0159559 0.0174064 0.0205976 0.0185669 0.0205976 0.0174064 0.0165361 0.0191471 0.0145054 0.0153757 0.0232086 0.0174064 0.0165361 0.0159559 0.0191471 0.0147955 0.0145054 0.0176965 0.0150856 0.0168262 0.0150856 0.013635 0.0156658 0.0156658 0.0145054 0.0124746 0.0150856 0.0116043 0.0118944 0.0191471 0.0165361 0.0124746 0.0133449 0.0121845 0.0127647 0.010734 0.0142153 0.0139252 0.0116043 0.0153757 0.0153757 0.0185669 0.0226284 0.0252393 0.0127647 0.00116043 0.239339 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_4>
+<PhotonSigPeakEnergyFraction_5>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 0.00115801 0.00310049 0.00414643 0.00354875 0.00328726 0.0031752 0.0031752 0.00381024 0.00351139 0.0031752 0.00310049 0.00246545 0.00306313 0.00339933 0.00354875 0.00324991 0.00313784 0.00313784 0.00261487 0.00276429 0.00272693 0.00257751 0.00242809 0.00246545 0.0025028 0.00246545 0.00302578 0.002839 0.00324991 0.00332462 0.00298842 0.00339933 0.00354875 0.00351139 0.00377288 0.00496825 0.00429585 0.00545387 0.00612626 0.00668659 0.00870377 0.0112066 0.0146433 0.0182294 0.0270078 0.0429959 0.0679492 0.0812103 0.0189391 0.574188 0 </BinContents>
+</PhotonSigPeakEnergyFraction_5>
+<PhotonBkgPeakEnergyFraction_5>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0.000329707 0.00230795 0.00725354 0.0125288 0.0108803 0.0118694 0.013518 0.0161556 0.01121 0.0161556 0.0131883 0.0105506 0.0151665 0.0121991 0.0194527 0.0194527 0.016815 0.0118694 0.0161556 0.0145071 0.0181339 0.0158259 0.0187933 0.0187933 0.013518 0.0171447 0.0154962 0.0171447 0.0184636 0.019123 0.0184636 0.016815 0.0145071 0.0164853 0.0148368 0.0174744 0.0154962 0.0201121 0.0148368 0.0164853 0.0148368 0.0197824 0.0161556 0.0141774 0.0178042 0.0184636 0.0243983 0.0339598 0.0425321 0.00791296 0.200462 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_5>
+<PhotonSigPeakEnergyFraction_6>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 9.07482e-05 0.00099823 0.00249558 0.00390217 0.00417442 0.00521802 0.00571714 0.00598938 0.00626163 0.00671537 0.00417442 0.00562639 0.00535414 0.00521802 0.00544489 0.00517265 0.00435591 0.00499115 0.00412904 0.00362993 0.00462816 0.00435591 0.00376605 0.00362993 0.00362993 0.00317619 0.00390217 0.00390217 0.0040383 0.00362993 0.00358455 0.0036753 0.00372068 0.00390217 0.00444666 0.0040383 0.00539952 0.00467353 0.0052634 0.00780435 0.00644312 0.00907482 0.0111167 0.0127501 0.0186034 0.0286764 0.0484595 0.0945143 0.0617088 0.533826 0 </BinContents>
+</PhotonSigPeakEnergyFraction_6>
+<PhotonBkgPeakEnergyFraction_6>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 0 0.00337025 0.0052961 0.00481464 0.00962927 0.0101107 0.0120366 0.0125181 0.0144439 0.0154068 0.0139624 0.0125181 0.00914781 0.00770342 0.0120366 0.0221473 0.0178142 0.0173327 0.0163698 0.0173327 0.013481 0.0178142 0.0125181 0.0115551 0.0144439 0.0154068 0.0129995 0.0129995 0.0168512 0.0202215 0.0173327 0.0202215 0.0192585 0.0173327 0.01974 0.0226288 0.0178142 0.0216659 0.0211844 0.0149254 0.0250361 0.0250361 0.0235917 0.0178142 0.0235917 0.0240732 0.0385171 0.052961 0.0284064 0.166586 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_6>
+<PhotonSigPeakEnergyFraction_7>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 0 0 0.000343713 0.00123737 0.00206228 0.00364336 0.00371211 0.00543067 0.00577439 0.00653056 0.00714924 0.00845535 0.00941775 0.0080429 0.00983021 0.00879906 0.00996769 0.00859284 0.00866158 0.00824912 0.00859284 0.00955523 0.00818038 0.0075617 0.00687427 0.00818038 0.00687427 0.0075617 0.00632433 0.00666804 0.0061181 0.0061181 0.00701175 0.00577439 0.0061181 0.0056369 0.0056369 0.00584313 0.00604936 0.00673678 0.00879906 0.0061181 0.00859284 0.0120987 0.0136111 0.0181481 0.0317591 0.0653743 0.0873032 0.494879 0 </BinContents>
+</PhotonSigPeakEnergyFraction_7>
+<PhotonBkgPeakEnergyFraction_7>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 0 0 0 0.000829187 0.00414594 0.00414594 0.00829187 0.0116086 0.00746269 0.00912106 0.0116086 0.00995025 0.013267 0.00497512 0.00912106 0.0107794 0.00995025 0.013267 0.00912106 0.0157546 0.013267 0.0165837 0.0140962 0.0165837 0.0174129 0.0165837 0.00912106 0.013267 0.0165837 0.0190713 0.00995025 0.0149254 0.0257048 0.0174129 0.0165837 0.0232172 0.0232172 0.0257048 0.0257048 0.0331675 0.0298507 0.0323383 0.0323383 0.0447761 0.0339967 0.0339967 0.0348259 0.053068 0.0373134 0.145937 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_7>
+<PhotonSigPeakEnergyFraction_8>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0.000294522 0.00049087 0.000589044 0.000883566 0.00166896 0.00245435 0.00284704 0.00598861 0.00314157 0.00657766 0.00657766 0.006774 0.00775574 0.00795209 0.00824661 0.00834479 0.0105046 0.0120754 0.00932653 0.0100137 0.013548 0.0144316 0.0123699 0.0127626 0.0145297 0.0126644 0.015806 0.0151188 0.0138425 0.0130571 0.0149224 0.0138425 0.0154133 0.0170823 0.0141371 0.0122717 0.0139407 0.0139407 0.0151188 0.017475 0.0177695 0.0226782 0.0336737 0.0731396 0.453956 0 </BinContents>
+</PhotonSigPeakEnergyFraction_8>
+<PhotonBkgPeakEnergyFraction_8>
+    <NBinsX>52</NBinsX>
+    <XLow>-0.02</XLow>
+    <XHigh>1.02</XHigh>
+    <BinContents>0 0 0 0 0 0 0 0 0.000994036 0 0 0.000994036 0.00497018 0.00198807 0 0.00298211 0.00695825 0.00298211 0.00894632 0.00994036 0.0109344 0.00497018 0.0109344 0.00695825 0.00596421 0.0149105 0.0119284 0.0109344 0.0119284 0.0139165 0.00994036 0.0109344 0.0139165 0.0168986 0.0109344 0.0198807 0.0168986 0.0119284 0.026839 0.0208747 0.026839 0.0328032 0.0208747 0.027833 0.027833 0.028827 0.0337972 0.0497018 0.05666 0.0666004 0.0785288 0.0934394 0.153082 0 </BinContents>
+</PhotonBkgPeakEnergyFraction_8>
+<PhotonSigMinDistanceToTrack_0>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.00172933 0.00206098 0.00151612 0.00187146 0.00139767 0.00130292 0.00132661 0.00106602 0.00130292 0.00127923 0.00130292 0.00113709 0.00132661 0.00137398 0.00132661 0.00149243 0.0015635 0.00144505 0.00158719 0.00168195 0.00144505 0.00198991 0.00168195 0.00258214 0.00198991 0.00232156 0.00227418 0.00260583 0.00244001 0.00213204 0.0028901 0.00281904 0.00307962 0.00305593 0.00329282 0.00293748 0.931372 </BinContents>
+</PhotonSigMinDistanceToTrack_0>
+<PhotonBkgMinDistanceToTrack_0>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0364749 0.0241851 0.020434 0.017279 0.0143625 0.0117578 0.011125 0.00979511 0.00868536 0.00851111 0.00896968 0.00886879 0.00886879 0.00831851 0.00877708 0.00855696 0.00810756 0.00819928 0.00778656 0.00751142 0.00762148 0.00792413 0.00791496 0.0076123 0.00805253 0.00827265 0.00818093 0.00819011 0.00824513 0.00779573 0.00800668 0.0076765 0.00853862 0.00822679 0.00796999 0.00804336 0.625154 </BinContents>
+</PhotonBkgMinDistanceToTrack_0>
+<PhotonSigMinDistanceToTrack_1>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.00616107 0.00390054 0.00328 0.0027481 0.00217189 0.00252648 0.00190594 0.00203892 0.00141838 0.00150703 0.00141838 0.00132973 0.00164 0.00177297 0.00212757 0.00199459 0.00234919 0.0018173 0.00177297 0.00164 0.00208324 0.00212757 0.00208324 0.00190594 0.00203892 0.00168432 0.00212757 0.00243784 0.00208324 0.00203892 0.00226054 0.00265946 0.00270378 0.0027481 0.00248216 0.00239351 0.918621 </BinContents>
+</PhotonSigMinDistanceToTrack_1>
+<PhotonBkgMinDistanceToTrack_1>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.031834 0.0211044 0.0196413 0.0171806 0.0157618 0.0126361 0.011439 0.0111729 0.0107739 0.0106409 0.0105522 0.0115941 0.0124144 0.0119488 0.0123257 0.0106852 0.011439 0.0117272 0.0105522 0.0106631 0.0108182 0.0111508 0.0112173 0.0114168 0.0106631 0.0111286 0.0107074 0.0100645 0.0102197 0.00968765 0.0090891 0.00886741 0.00964331 0.00937729 0.0103305 0.00982066 0.559711 </BinContents>
+</PhotonBkgMinDistanceToTrack_1>
+<PhotonSigMinDistanceToTrack_2>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0035615 0.00175635 0.00136605 0.00131727 0.00107333 0.00082939 0.000780602 0.000487876 0.000634239 0.000683027 0.00126848 0.000780602 0.000731814 0.00151242 0.00131727 0.000731814 0.00180514 0.00151242 0.0011709 0.00131727 0.000878177 0.00190272 0.00141484 0.00234181 0.00239059 0.00219544 0.00209787 0.00190272 0.00180514 0.00165878 0.00146363 0.00180514 0.00185393 0.00224423 0.00200029 0.00239059 0.945016 </BinContents>
+</PhotonSigMinDistanceToTrack_2>
+<PhotonBkgMinDistanceToTrack_2>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0443594 0.0261202 0.0249944 0.0190648 0.0199655 0.014186 0.014186 0.0146363 0.0114088 0.0124597 0.0117091 0.0150867 0.0177888 0.0149366 0.0159874 0.0135105 0.0146363 0.0144862 0.0126098 0.0117841 0.0114839 0.0118592 0.0107333 0.011559 0.0127599 0.0119342 0.00960745 0.0096825 0.00990768 0.00893192 0.00983262 0.00863169 0.00960745 0.0091571 0.00840651 0.0073557 0.494633 </BinContents>
+</PhotonBkgMinDistanceToTrack_2>
+<PhotonSigMinDistanceToTrack_3>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.000984598 0.00119558 0.000773613 0.000351642 0.000703284 0.000562627 0.000632956 0.000773613 0.000843941 0.000492299 0.00091427 0.00091427 0.00133624 0.00140657 0.00119558 0.00105493 0.00189887 0.00182854 0.00161755 0.00232084 0.00182854 0.00182854 0.00253182 0.00203952 0.0019692 0.00218018 0.00239117 0.00274281 0.00302412 0.00253182 0.00154723 0.00182854 0.00302412 0.00210985 0.00232084 0.00302412 0.941276 </BinContents>
+</PhotonSigMinDistanceToTrack_3>
+<PhotonBkgMinDistanceToTrack_3>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0366818 0.0249341 0.0246943 0.0230161 0.017262 0.0165428 0.0151043 0.014385 0.012467 0.013426 0.0122273 0.0182211 0.0167825 0.0129465 0.0189403 0.0155838 0.011508 0.0139055 0.0103093 0.0129465 0.00935028 0.0141453 0.00911053 0.0107888 0.010549 0.0100695 0.0100695 0.0112683 0.00647327 0.00671302 0.00791177 0.00599377 0.00791177 0.00863102 0.00959003 0.00647327 0.513066 </BinContents>
+</PhotonBkgMinDistanceToTrack_3>
+<PhotonSigMinDistanceToTrack_4>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.00131532 0.000556483 0.000657662 0.000505894 0.000708251 0.000303536 0.000708251 0.000657662 0.000505894 0.00106238 0.00121414 0.00116356 0.00131532 0.00151768 0.00172004 0.00182122 0.00242829 0.00166945 0.00202357 0.00202357 0.00207416 0.002833 0.002833 0.00227652 0.00242829 0.00273183 0.00222593 0.00217534 0.00278242 0.00242829 0.00217534 0.002833 0.00258006 0.00318713 0.00303536 0.0033389 0.934183 </BinContents>
+</PhotonSigMinDistanceToTrack_4>
+<PhotonBkgMinDistanceToTrack_4>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0272701 0.0194372 0.0203075 0.016246 0.0156658 0.0139252 0.0171163 0.0124746 0.010734 0.0121845 0.0110241 0.0121845 0.016246 0.016246 0.0168262 0.0113142 0.0124746 0.00957354 0.00841311 0.00899333 0.00841311 0.0101538 0.0104439 0.008123 0.00928343 0.00696258 0.00841311 0.00725268 0.00841311 0.00638236 0.0078329 0.00754279 0.00522193 0.00551204 0.00667247 0.00435161 0.590368 </BinContents>
+</PhotonBkgMinDistanceToTrack_4>
+<PhotonSigMinDistanceToTrack_5>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.000933881 0.000522973 0.000747105 0.000672394 0.000410908 0.0010833 0.000859171 0.0010833 0.000933881 0.00134479 0.0014195 0.00235338 0.00201718 0.002839 0.00268958 0.00246545 0.00287635 0.00276429 0.00257751 0.0031752 0.00276429 0.00332462 0.00351139 0.00339933 0.00306313 0.00384759 0.0042585 0.00369817 0.0039223 0.00324991 0.00373552 0.00474412 0.0035861 0.00362346 0.0039223 0.00366081 0.907919 </BinContents>
+</PhotonSigMinDistanceToTrack_5>
+<PhotonBkgMinDistanceToTrack_5>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0171447 0.0145071 0.0201121 0.0148368 0.0148368 0.0171447 0.0121991 0.0121991 0.0105506 0.00923178 0.0118694 0.0158259 0.0121991 0.0131883 0.0105506 0.00857237 0.00824266 0.0108803 0.0115397 0.00560501 0.013518 0.0115397 0.0102209 0.00956149 0.00791296 0.00725354 0.0049456 0.00461589 0.00461589 0.00791296 0.00824266 0.0049456 0.00824266 0.00758325 0.00461589 0.00461589 0.628421 </BinContents>
+</PhotonBkgMinDistanceToTrack_5>
+<PhotonSigMinDistanceToTrack_6>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.000907482 0.00077136 0.000725986 0.0010436 0.0010436 0.00167884 0.00231408 0.00204183 0.00208721 0.00267707 0.00322156 0.00412904 0.00458279 0.00394755 0.00394755 0.00458279 0.00444666 0.00512727 0.00449204 0.00539952 0.00503653 0.00585326 0.00499115 0.00535414 0.00589863 0.00512727 0.00503653 0.00512727 0.00576251 0.00626163 0.00571714 0.006307 0.00558102 0.00567176 0.00589863 0.00512727 0.85208 </BinContents>
+</PhotonSigMinDistanceToTrack_6>
+<PhotonBkgMinDistanceToTrack_6>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0163698 0.0105922 0.0163698 0.0144439 0.0101107 0.0105922 0.0115551 0.0125181 0.00866635 0.00914781 0.0110737 0.0120366 0.0105922 0.0105922 0.0110737 0.00866635 0.00818488 0.00818488 0.00722195 0.0052961 0.00674049 0.0052961 0.00577756 0.0120366 0.00866635 0.00674049 0.00577756 0.00625903 0.0052961 0.00722195 0.00722195 0.00385171 0.00577756 0.00866635 0.00625903 0.00770342 0.677419 </BinContents>
+</PhotonBkgMinDistanceToTrack_6>
+<PhotonSigMinDistanceToTrack_7>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.00123737 0.00116863 0.00171857 0.00233725 0.00171857 0.00247474 0.00295594 0.00398708 0.00350588 0.00426205 0.00460576 0.00488073 0.00783667 0.00701175 0.00666804 0.00701175 0.00721798 0.00584313 0.00776792 0.00653056 0.00714924 0.00907404 0.00831787 0.00797415 0.00701175 0.00790541 0.0075617 0.00763044 0.00653056 0.0065993 0.0065993 0.00769918 0.00584313 0.00749295 0.00776792 0.0061181 0.791985 </BinContents>
+</PhotonSigMinDistanceToTrack_7>
+<PhotonBkgMinDistanceToTrack_7>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.0124378 0.00829187 0.0165837 0.00912106 0.00829187 0.00829187 0.00497512 0.00746269 0.00829187 0.00829187 0.00746269 0.00746269 0.00912106 0.0149254 0.00580431 0.00746269 0.0066335 0.0066335 0.00746269 0.0107794 0.00414594 0.00580431 0.00995025 0.00746269 0.00497512 0.00912106 0.000829187 0.00912106 0.013267 0.00497512 0.0066335 0.00746269 0.00331675 0.00331675 0.00829187 0.00331675 0.722222 </BinContents>
+</PhotonBkgMinDistanceToTrack_7>
+<PhotonSigMinDistanceToTrack_8>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.00196348 0.00284704 0.002258 0.00363244 0.00481052 0.00441783 0.00530139 0.00539957 0.00500687 0.00638131 0.00549774 0.00854114 0.01129 0.00962105 0.0113882 0.0106028 0.00952287 0.0107991 0.0103083 0.0094247 0.0113882 0.009032 0.0109955 0.0106028 0.0104064 0.0113882 0.0102101 0.00932653 0.0106028 0.009032 0.0108973 0.00873748 0.0098174 0.00863931 0.00795209 0.00932653 0.702631 </BinContents>
+</PhotonSigMinDistanceToTrack_8>
+<PhotonBkgMinDistanceToTrack_8>
+    <NBinsX>40</NBinsX>
+    <XLow>0</XLow>
+    <XHigh>20</XHigh>
+    <BinContents>0 0 0 0 0 0.00397614 0.00298211 0.0129225 0.00497018 0.00497018 0.00894632 0.00894632 0.00298211 0.00994036 0.00795229 0.00596421 0.00894632 0.0149105 0.00298211 0.0119284 0.00695825 0.0149105 0.00695825 0.00695825 0.00596421 0.0129225 0.00994036 0.0149105 0.0119284 0.00397614 0.00596421 0.0149105 0.00695825 0.00994036 0.00795229 0.00994036 0.00596421 0.0109344 0.00497018 0.00497018 0.00894632 0.699801 </BinContents>
+</PhotonBkgMinDistanceToTrack_8>
diff --git a/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml b/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml
index 8bf0e965b235f94400e68629ec565f5f9fd14db2..be26c3643a7017db4f3158da6d6ef338fd30a92e 100644
--- a/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml
+++ b/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml
@@ -69,7 +69,7 @@
         <ClusterListName>PhotonClusters</ClusterListName>
         <ReplaceCurrentClusterList>false</ReplaceCurrentClusterList>
         <ShouldMakePdfHistograms>false</ShouldMakePdfHistograms>
-        <HistogramFile>/junofs/users/wxfang/MyGit/MarlinPandora/scripts/PandoraLikelihoodData9EBin.xml</HistogramFile>
+        <HistogramFile>/junofs/users/wxfang/MyGit/tmp/fork_update_pandora/CEPCSW/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml</HistogramFile>
     </algorithm>
 
     <!-- Clustering parent algorithm runs a daughter clustering algorithm -->
diff --git a/Service/DedxSvc/CMakeLists.txt b/Service/DedxSvc/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0fce402f937a8b428db7e04bd3b82b83b963ac4b
--- /dev/null
+++ b/Service/DedxSvc/CMakeLists.txt
@@ -0,0 +1,13 @@
+gaudi_subdir(DedxSvc v0r0)
+
+set(DedxSvc_srcs
+    src/*.cpp
+)
+find_package(Geant4 REQUIRED ui_all vis_all)
+include(${Geant4_USE_FILE})
+gaudi_install_headers(DedxSvc)
+
+gaudi_add_module(DedxSvc ${DedxSvc_srcs}
+    INCLUDE_DIRS GaudiKernel
+    LINK_LIBRARIES GaudiKernel
+)
diff --git a/Service/DedxSvc/DedxSvc/IDedxSvc.h b/Service/DedxSvc/DedxSvc/IDedxSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..14b76620c9cd503bd72d724eb46acb8d9b9fc8bd
--- /dev/null
+++ b/Service/DedxSvc/DedxSvc/IDedxSvc.h
@@ -0,0 +1,18 @@
+#ifndef I_Dedx_SVC_H
+#define I_Dedx_SVC_H
+
+#include "GaudiKernel/IService.h"
+
+#include "G4Step.hh"
+
+class IDedxSvc: virtual public IService {
+public:
+    DeclareInterfaceID(IDedxSvc, 0, 1); // major/minor version
+    
+    virtual ~IDedxSvc() = default;
+    virtual float pred(const G4Step* aStep)=0 ;
+
+};
+
+
+#endif
diff --git a/Service/DedxSvc/src/DedxSvc.cpp b/Service/DedxSvc/src/DedxSvc.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9a62508dd0497e95fc7cfa5dc4cd3d4504354b8b
--- /dev/null
+++ b/Service/DedxSvc/src/DedxSvc.cpp
@@ -0,0 +1,45 @@
+#include "DedxSvc.h"
+
+//https://folk.uib.no/ruv004/
+DECLARE_COMPONENT(DedxSvc)
+
+DedxSvc::DedxSvc(const std::string& name, ISvcLocator* svc)
+    : base_class(name, svc)
+{
+}
+
+DedxSvc::~DedxSvc()
+{
+}
+
+float DedxSvc::pred(const G4Step* aStep)
+{
+    G4Track* gTrack = aStep->GetTrack() ;
+    G4int z = gTrack->GetDefinition()->GetPDGCharge();
+    if (z == 0) return 0;
+    G4double M = gTrack->GetDefinition()->GetPDGMass();//MeV
+    M = pow(10,6)*M; //to eV
+    G4double gammabeta=aStep->GetPreStepPoint()->GetBeta() * aStep->GetPreStepPoint()->GetGamma();
+    if(gammabeta<0.01)return 0;//too low momentum
+    float beta = gammabeta/sqrt(1.0+pow(gammabeta,2));
+    float gamma = gammabeta/beta;
+    float Tmax = 2*m_me*pow(gammabeta,2)/(1+(2*gamma*m_me/M)+pow(m_me/M,2));
+    float dedx = m_K*pow(z,2)*m_material_Z*(0.5*log(2*m_me*pow(gammabeta,2)*Tmax/pow(m_I,2))-pow(beta,2))/(m_material_A*pow(beta,2));    
+    dedx = dedx*m_scale;// the material density can be absorbed in scale 
+    dedx = dedx*(1+((*m_distribution)(m_generator)));
+    return dedx*m_material_density; // MeV / cm 
+}
+
+StatusCode DedxSvc::initialize()
+{
+    m_distribution = new std::normal_distribution<double>(0, m_resolution);
+    m_me = 0.511*pow(10,6);//0.511 MeV to eV
+    m_K = 0.307075;//const
+    m_I = m_material_Z*10;  // Approximate
+    return StatusCode::SUCCESS;
+}
+
+StatusCode DedxSvc::finalize()
+{
+    return StatusCode::SUCCESS;
+}
diff --git a/Service/DedxSvc/src/DedxSvc.h b/Service/DedxSvc/src/DedxSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f1f85eb53dbabf872cbbe56aee9a44e4656a639
--- /dev/null
+++ b/Service/DedxSvc/src/DedxSvc.h
@@ -0,0 +1,34 @@
+#ifndef Dedx_SVC_H
+#define Dedx_SVC_H
+
+#include "DedxSvc/IDedxSvc.h"
+#include <GaudiKernel/Service.h>
+#include "G4Step.hh"
+#include <random>
+
+class DedxSvc : public extends<Service, IDedxSvc>
+{
+    public:
+        DedxSvc(const std::string& name, ISvcLocator* svc);
+        ~DedxSvc();
+
+
+        StatusCode initialize() override;
+        StatusCode finalize() override;
+        float pred(const G4Step* aStep) override;
+
+    private:
+
+        Gaudi::Property<float> m_material_Z{this, "material_Z", 2};//Default is Helium
+        Gaudi::Property<float> m_material_A{this, "material_A", 4};
+        Gaudi::Property<float> m_material_density{this, "material_density", 0.000178};//g/cm^3
+        Gaudi::Property<float> m_scale{this, "scale", 1};
+        Gaudi::Property<float> m_resolution{this, "resolution", 0.01};
+        float m_me;// Here me is the electron rest mass
+        float m_K; // K was set as a constant.
+        float m_I; // Mean excitation energy
+        std::default_random_engine m_generator;
+        std::normal_distribution<double>* m_distribution;
+};
+
+#endif
diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
index 1efe317dacdd17cacbf796f7bd61241b7c9079b7..9ef16425454ad9a520659b07536d7ebf344018cc 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
@@ -56,6 +56,8 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
     auto ecalendcapringcol        = m_EcalEndcapRingCol.createAndPut();
     auto ecalendcapringcontribcol = m_EcalEndcapRingContributionCol.createAndPut();
 
+    auto driftchamberhitscol = m_DriftChamberHitsCol.createAndPut();
+
     // readout defined in DD4hep
     auto lcdd = &(dd4hep::Detector::getInstance());
     auto allReadouts = lcdd->readouts();
@@ -116,6 +118,8 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
         } else if (collect->GetName() == "EcalEndcapRingCollection") {
             calo_col_ptr = ecalendcapringcol;
             calo_contrib_col_ptr = ecalendcapringcontribcol;
+        } else if (collect->GetName() == "DriftChamberHitsCollection") {
+            tracker_col_ptr = driftchamberhitscol;
         } else {
             warning() << "Unknown collection name: " << collect->GetName()
                       << ". Please register in Edm4hepWriterAnaElemTool. " << endmsg;
diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
index 2e69d24e8f6d5858f1efa86a543c2816aefbf83d..17a9d5182fe80f0bcbfefca5385362df2aa738a7 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
@@ -81,6 +81,13 @@ private:
             "EcalEndcapRingContributionCollection", 
             Gaudi::DataHandle::Writer, this};
 
+    // Drift Chamber
+    // - DriftChamberHitsCollection
+    DataHandle<edm4hep::SimTrackerHitCollection> m_DriftChamberHitsCol{
+            "DriftChamberHitsCollection", 
+            Gaudi::DataHandle::Writer, this};
+
+
 private:
     // in order to associate the hit contribution with the primary track,
     // we have a bookkeeping of every track.
diff --git a/Utilities/DataHelper/CMakeLists.txt b/Utilities/DataHelper/CMakeLists.txt
index 7bdae2b719df8dbcd9c327fce6c299cd57196e44..a0b346f3580fbbf1567c01dda9710193118d43a0 100644
--- a/Utilities/DataHelper/CMakeLists.txt
+++ b/Utilities/DataHelper/CMakeLists.txt
@@ -1,6 +1,11 @@
 gaudi_subdir(DataHelper v0r0)
 
 find_package(EDM4HEP REQUIRED)
+find_package(GSL REQUIRED )
+message("GSL: ${GSL_LIBRARIES} ")
+message("GSL INCLUDE_DIRS: ${GSL_INCLUDE_DIRS} ")
+
+INCLUDE_DIRECTORIES(${GSL_INCLUDE_DIRS})
 
 gaudi_depends_on_subdirs()
 
@@ -10,5 +15,5 @@ set(DataHelperLib_srcs src/*.cc src/*.cpp)
 
 gaudi_add_library(DataHelperLib ${DataHelperLib_srcs}
     PUBLIC_HEADERS DataHelper
-    LINK_LIBRARIES EDM4HEP::edm4hep EDM4HEP::edm4hepDict
+    LINK_LIBRARIES EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${GSL_LIBRARIES}
 )
diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.h b/Utilities/DataHelper/DataHelper/ClusterShapes.h
similarity index 79%
rename from Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.h
rename to Utilities/DataHelper/DataHelper/ClusterShapes.h
index 2b97b685cf3c2604caaced1a9fb0f44dc17ff6af..3bcd5db00b82fdeefc21e70afe0843f376be2ec2 100644
--- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.h
+++ b/Utilities/DataHelper/DataHelper/ClusterShapes.h
@@ -24,7 +24,7 @@
  */
 class ClusterShapes {
 
- public:
+public:
 
   /**
    *    Constructor
@@ -48,20 +48,20 @@ class ClusterShapes {
   /**
    *    Defining errors for Helix Fit
    */
-   void setErrors(float *ex, float* ey, float *ez);
+  void setErrors(float *ex, float* ey, float *ez);
 
-   /**
-    *   Defining hit types for Helix Fit :
-    *   type 1 - cyllindrical detector
-    *   type 2 - Z disk detector
-    */
-   void setHitTypes(int *ityp);
+  /**
+   *   Defining hit types for Helix Fit :
+   *   type 1 - cyllindrical detector
+   *   type 2 - Z disk detector
+   */
+  void setHitTypes(int *ityp);
 
 
   /**
    * returns the number of elements of the cluster
    */
-   int getNumberOfHits();
+  int getNumberOfHits();
 
   /**
    * returns the accumulated amplitude for the whole cluster (just the sum of the 
@@ -75,15 +75,21 @@ class ClusterShapes {
    * of gravity is calculated with the energy of the entries of the cluster.
    */
   float* getCentreOfGravity();
+  // this is (for now) a pure dummy to allow MarlinPandora development!
+  float* getCentreOfGravityErrors();
 
   /** US spelling of getCentreOfGravity */
   inline float* getCenterOfGravity() { return getCentreOfGravity() ; }
+  // this is (for now) a pure dummy to allow MarlinPandora development!
+  inline float* getCenterOfGravityErrors() { return getCentreOfGravityErrors() ; }
   
   /**
    * array of the inertias of mass (i.\ e.\ energy) corresponding to the three main axes 
    * of inertia. The array is sorted in ascending order.
    */
   float* getEigenValInertia();
+  // this is (for now) a pure dummy to allow MarlinPandora development!
+  float* getEigenValInertiaErrors();
 
   /**
    * array of the three main axes of inertia (9 entries) starting
@@ -92,6 +98,8 @@ class ClusterShapes {
    * of 1.
    */
   float* getEigenVecInertia();
+  // this is (for now) a pure dummy to allow MarlinPandora development!
+  float* getEigenVecInertiaErrors();
 
   /**
    * 'mean' width of the cluster perpendicular to the main 
@@ -144,7 +152,7 @@ class ClusterShapes {
    *                       detector this is meant to be the 'mean' Moliere radius.
    */
   int fit3DProfile(float& chi2, float& a, float& b, float& c, float& d, float& xl0, 
-		   float * xStart, int& index_xStart, float X0, float Rm);
+		   float * xStart, int& index_xStart, float* X0, float* Rm);
 
   /**
    * returns the chi2 of the fit in the method Fit3DProfile (if simple
@@ -155,8 +163,8 @@ class ClusterShapes {
    * @param Rm           : Moliere radius of the the detector material. For a composite 
    *                       detector this is meant to be the 'mean' Moliere radius.
    */
-  float getChi2Fit3DProfileSimple(float a, float b, float c, float d, float X0, 
-				  float Rm);
+  float getChi2Fit3DProfileSimple(float a, float b, float c, float d, float* X0, 
+				  float* Rm);
 
   /**
    * returns the chi2 of the fit in the method Fit3DProfile (if advanced
@@ -168,7 +176,7 @@ class ClusterShapes {
    *                      detector this is meant to be the 'mean' Moliere radius.
    */
   float getChi2Fit3DProfileAdvanced(float E0, float a, float b, float d, float t0, 
-				    float X0, float Rm);
+				    float* X0, float* Rm);
 
   /**
    * performs a least square fit on a helix path in space, which
@@ -220,6 +228,21 @@ class ClusterShapes {
   int FitHelix(int max_iter, int status_out, int parametrisation,
 	       float* parameter, float* dparameter, float& chi2, float& distmax, int direction=1);
 
+  //here add my functions(variables estimated with detector base)
+  //maximum deposit energy of hits
+  float getEmax(float* xStart, int& index_xStart, float* X0, float* Rm);
+
+  //shower max of the hits from the shower start hit
+  float getsmax(float* xStart, int& index_xStart, float* X0, float* Rm);
+
+  //radius where 90% of the cluster energy exists
+  float getxt90(float* xStart, int& index_xStart, float* X0, float* Rm);
+
+  //length where less than 20% of the cluster energy exists
+  float getxl20(float* xStart, int& index_xStart, float* X0, float* Rm);
+
+  //for cluster study
+  void gethits(float* xStart, int& index_xStart, float* X0, float* Rm, float *okxl, float *okxt, float *oke);
   /**
    * distance to the centre of gravity measured from IP
    * (absolut value of the vector to the centre of gravity)
@@ -280,54 +303,58 @@ class ClusterShapes {
    */
   inline float getElipsoid_r_back() { return _r1_back; }
 
+  //Mean of the radius of the hits
+  float getRhitMean(float* xStart, int& index_xStart, float* X0, float* Rm);
 
+  //RMS of the radius of the hits
+  float getRhitRMS(float* xStart, int& index_xStart, float* X0, float* Rm);
 
 
 
- private:
+private:
 
   int _nHits;
 
-  float* _aHit;
-  float* _xHit;
-  float* _yHit;
-  float* _zHit;
-  float* _exHit;
-  float* _eyHit;
-  float* _ezHit;
-  int* _types;
-  float* _xl;
-  float* _xt;
-  float* _t;
-  float* _s;
-
-  int   _ifNotGravity;
-  float _totAmpl;
-  float _radius;
-  float _xgr;
-  float _ygr;
-  float _zgr;
-  float _analogGravity[3];
-
-  int   _ifNotWidth;
-  float _analogWidth;
-
-  int   _ifNotInertia;
+  std::vector<float> _aHit;
+  std::vector<float> _xHit;
+  std::vector<float> _yHit;
+  std::vector<float> _zHit;
+  std::vector<float> _exHit;
+  std::vector<float> _eyHit;
+  std::vector<float> _ezHit;
+  std::vector<float> _xl;
+  std::vector<float> _xt;
+  std::vector<float> _t;
+  std::vector<float> _s;
+  std::vector<int>   _types;
+
+  int   _ifNotGravity=1;
+  float _totAmpl=0.0;
+  float _radius=0.0;
+  float _xgr=0.0;
+  float _ygr=0.0;
+  float _zgr=0.0;
+  float _analogGravity[3]={0.0, 0.0,0.0};
+
+  int   _ifNotWidth=1;
+  float _analogWidth=0.0;
+
+  int   _ifNotInertia=1;
   float _ValAnalogInertia[3];
   float _VecAnalogInertia[9];
 
-  int _ifNotEigensystem;
+  int _ifNotEigensystem=1;
 
-  int   _ifNotElipsoid;
-  float _r1           ;  // Cluster spatial axis length -- the largest
-  float _r2           ;  // Cluster spatial axis length -- less
-  float _r3           ;  // Cluster spatial axis length -- less
-  float _vol          ;  // Cluster ellipsoid volume
-  float _r_ave        ;  // Cluster average radius  (qubic root)
-  float _density      ;  // Cluster density
-  float _eccentricity ;  // Cluster Eccentricity
-  float _r1_forw      ;
-  float _r1_back      ;
+  //int   _ifNotElipsoid=1;
+  float _r1           =0.0;  // Cluster spatial axis length -- the largest
+  float _r2           =0.0;  // Cluster spatial axis length -- less
+  float _r3           =0.0;  // Cluster spatial axis length -- less
+  float _vol          =0.0;  // Cluster ellipsoid volume
+  float _r_ave        =0.0;  // Cluster average radius  (qubic root)
+  float _density      =0.0;  // Cluster density
+  float _eccentricity =0.0;  // Cluster Eccentricity
+  float _r1_forw      =0.0;
+  float _r1_back      =0.0;
 
   void  findElipsoid();
   void  findGravity();
@@ -337,8 +364,8 @@ class ClusterShapes {
   float vecProduct(float * x1, float * x2);
   float vecProject(float * x, float * axis);
   double DistanceHelix(double x, double y, double z, double X0, double Y0, double R0, double bz,
-		      double phi0, double * distRPhiZ);
-  int transformToEigensystem(float* xStart, int& index_xStart, float X0, float Xm);
+		       double phi0, double * distRPhiZ);
+  int transformToEigensystem(float* xStart, int& index_xStart, float* X0, float* Xm);
   float calculateChi2Fit3DProfileSimple(float a, float b, float c, float d);
   float calculateChi2Fit3DProfileAdvanced(float E0, float a, float b, float d, float t0);
   int fit3DProfileSimple(float& chi2, float& a, float& b, float& c, float& d);
@@ -353,4 +380,5 @@ class ClusterShapes {
 
 };
 
+
 #endif
diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.cc b/Utilities/DataHelper/src/ClusterShapes.cc
similarity index 71%
rename from Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.cc
rename to Utilities/DataHelper/src/ClusterShapes.cc
index e7e8d4fca32578d72ccad1c451164b2d441f7687..a5fbba971fde00a57acd352bc325d9cd3f5d2d96 100644
--- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.cc
+++ b/Utilities/DataHelper/src/ClusterShapes.cc
@@ -1,6 +1,8 @@
+
+
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
-#include "ClusterShapes.h"
+#include "DataHelper/ClusterShapes.h"
 
 #include <gsl/gsl_vector.h>
 #include <gsl/gsl_matrix.h>
@@ -14,7 +16,6 @@
 //#include <gsl/gsl_sf_pow_int.h>
 
 
-
 // #################################################
 // #####                                       #####
 // #####  Additional Structures and Functions  #####
@@ -46,7 +47,7 @@ double G(double x) {
 // inverse Gammafunction
 double invG(double x) {
   
- return gsl_sf_gammainv(x);
+  return gsl_sf_gammainv(x);
     
 }
 
@@ -68,24 +69,23 @@ double DinvG(double x) {
   double rel_error = 1e-6;
   double result = 0.0;
   double error = 0.0;
-  int status = 0;
   
   gsl_integration_workspace* w  = gsl_integration_workspace_alloc(workspace_size);
   gsl_function F;
   F.function = &Integral_G;
   F.params = &x;
     
-  status = gsl_integration_qagiu(&F,0,abs_error,rel_error,workspace_size,w,
-      			   &result,&error); 
+  /*int status=*/gsl_integration_qagiu(&F,0,abs_error,rel_error,workspace_size,w,
+				 &result,&error); 
 
   // debug  
   /*  
-  printf ("Numeric Integration : \n");
-  printf ("parameter of integration = % .18f\n", x);
-  printf ("status of integration    = %d \n"   , status);
-  printf ("result                   = % .18f\n", result);
-  printf ("estimated error          = % .18f\n", error);
-  printf ("intervals                =  %d\n\n", w->size);
+      printf ("Numeric Integration : \n");
+      printf ("parameter of integration = % .18f\n", x);
+      printf ("status of integration    = %d \n"   , status);
+      printf ("result                   = % .18f\n", result);
+      printf ("estimated error          = % .18f\n", error);
+      printf ("intervals                =  %d\n\n", w->size);
   */
   
   double G2 = pow(gsl_sf_gamma(x),2); 
@@ -128,7 +128,7 @@ int ShapeFitFunct(const gsl_vector* par, void* d, gsl_vector* f) {
 
   for (int i(0); i < n; i++) {
     fi = /*E0 * */ B * invG(A) * pow(B*(t[i]-t0),A-1) * exp(-B*(t[i]-t0)) * exp(-D*s[i]) 
-         - a[i];
+      - a[i];
     gsl_vector_set(f,i,fi);
   }
 
@@ -155,30 +155,30 @@ int dShapeFitFunct(const gsl_vector* par, void* d, gsl_matrix* J) {
   for (int i(0); i < n; i++) {
 
     /*    
-    gsl_matrix_set(J,i,0,B * invG(A) * pow(B*(t[i]-t0),A-1) * exp(-B*(t[i]-t0)) 
-		                                            * exp(-D*s[i]) );
-    */
+	  gsl_matrix_set(J,i,0,B * invG(A) * pow(B*(t[i]-t0),A-1) * exp(-B*(t[i]-t0)) 
+	  * exp(-D*s[i]) );
+	  */
 
     gsl_matrix_set(J,i,0,( /* E0 * */ B * invG(A) * log(B*(t[i]-t0))*pow(B*(t[i]-t0),A-1) * 
 			   exp(-B*(t[i]-t0)) + DinvG(A) * /* E0 * */ B * pow(B*(t[i]-t0),A-1) *
-			                       exp(-B*(t[i]-t0))
-			 ) * exp(-D*s[i]));
+			   exp(-B*(t[i]-t0))
+			   ) * exp(-D*s[i]));
 		         
     gsl_matrix_set(J,i,1,( /* E0 * */ invG(A) * pow(B*(t[i]-t0),A-1) * exp(-B*(t[i]-t0)) +
 			   /* E0 * */ invG(A) * (A-1) * B * (t[i]-t0) * pow(B*(t[i]-t0),A-2) * 
-			                                exp(-B*(t[i]-t0)) -
+			   exp(-B*(t[i]-t0)) -
 			   /* E0 * */ B * invG(A) * (t[i]-t0) * pow(B*(t[i]-t0),A-1) * 
-			                                exp(-B*(t[i]-t0)) 
-			 ) * exp(-D*s[i]));
+			   exp(-B*(t[i]-t0)) 
+			   ) * exp(-D*s[i]));
                          
     gsl_matrix_set(J,i,2,-/* E0 * */ B * invG(A) * s[i] * pow(B*(t[i]-t0),A-1) *
-		         exp(-B*(t[i]-t0)) * exp(-D*s[i]));
+		   exp(-B*(t[i]-t0)) * exp(-D*s[i]));
        		         
     gsl_matrix_set(J,i,3,(-/* E0 * */ pow(B,2) * invG(A) * (A-1) * pow(B*(t[i]-t0),A-2) * 
-			                                     exp(-B*(t[i]-t0)) +
-			   /* E0 * */ pow(B,2) * invG(A) * pow(B*(t[i]-t0),A-1) * 
-			                             exp(-B*(t[i]-t0))
-			 ) * exp(-D*s[i]));
+			  exp(-B*(t[i]-t0)) +
+			  /* E0 * */ pow(B,2) * invG(A) * pow(B*(t[i]-t0),A-1) * 
+			  exp(-B*(t[i]-t0))
+			  ) * exp(-D*s[i]));
  		         
 
   }
@@ -229,9 +229,9 @@ int functParametrisation1(const gsl_vector* par, void* d, gsl_vector* f) {
   float* x = ((struct data*)d)->x;
   float* y = ((struct data*)d)->y;
   float* z = ((struct data*)d)->z;
-//float* ex = ((struct data*)d)->ex;
-//float* ey = ((struct data*)d)->ey;
-//float* ez = ((struct data*)d)->ez;
+  //float* ex = ((struct data*)d)->ex;
+  //float* ey = ((struct data*)d)->ey;
+  //float* ez = ((struct data*)d)->ez;
   float fi = 0.0;
 
   // first dimension
@@ -263,9 +263,9 @@ int dfunctParametrisation1(const gsl_vector* par, void* d, gsl_matrix* J) {
 
   int n    = ((struct data*)d)->n;
   float* z = ((struct data*)d)->z;
-//float* ex = ((struct data*)d)->ex;
-//float* ey = ((struct data*)d)->ey;
-//float* ez = ((struct data*)d)->ez;
+  //float* ex = ((struct data*)d)->ex;
+  //float* ey = ((struct data*)d)->ey;
+  //float* ez = ((struct data*)d)->ez;
 
 
   // calculate Jacobi's matrix J[i][j] = dfi/dparj
@@ -508,7 +508,7 @@ int dfunctParametrisation3(const gsl_vector* par, void* d, gsl_matrix* J) {
     gsl_matrix_set(J,i,0,0);
     gsl_matrix_set(J,i,1,((1/omega) - d0) * cos(Phi0) - (1/fabs(omega)) * sin(phii) );
     gsl_matrix_set(J,i,2,((-1.0)*sin(Phi0))/pow(omega,2) - ( (signum(omega))/(pow(fabs(omega),2)) ) * cos(phii) - 
-                   (1/fabs(omega)) * sin(phii) * ( ( ((-1.0)/sqrt(1+pow(tanL,2)))*si) + (M_PI)/(2*fabs(omega)) - (signum(omega)*omega*M_PI)/(2*pow(fabs(omega),2)) ) );
+		   (1/fabs(omega)) * sin(phii) * ( ( ((-1.0)/sqrt(1+pow(tanL,2)))*si) + (M_PI)/(2*fabs(omega)) - (signum(omega)*omega*M_PI)/(2*pow(fabs(omega),2)) ) );
     gsl_matrix_set(J,i,3,(-1.0)*sin(Phi0));
     gsl_matrix_set(J,i,4,((-1.0)/fabs(omega))*sin(phii) * ( (omega*tanL*si)/sqrt(pow(1+pow(tanL,2),3)) ) );
 
@@ -522,7 +522,7 @@ int dfunctParametrisation3(const gsl_vector* par, void* d, gsl_matrix* J) {
     gsl_matrix_set(J,i+n,0,0);
     gsl_matrix_set(J,i+n,1,((1/omega) - d0)*sin(Phi0) + (1/fabs(omega)) * cos(phii) );
     gsl_matrix_set(J,i+n,2,cos(Phi0)/pow(omega,2) + ( (signum(omega))/(pow(fabs(omega),2)) ) * sin(phii) + 
-                   (1/fabs(omega))*cos(phii) * ( ( ((-1.0)/sqrt(1+pow(tanL,2)))*si) + (M_PI)/(2*fabs(omega)) - (signum(omega)*omega*M_PI)/(2*pow(fabs(omega),2)) ) );
+		   (1/fabs(omega))*cos(phii) * ( ( ((-1.0)/sqrt(1+pow(tanL,2)))*si) + (M_PI)/(2*fabs(omega)) - (signum(omega)*omega*M_PI)/(2*pow(fabs(omega),2)) ) );
     gsl_matrix_set(J,i+n,3,cos(Phi0));
     gsl_matrix_set(J,i+n,4,(1/fabs(omega))*cos(phii) * ( (omega*tanL*si)/sqrt(pow(1+pow(tanL,2),3)) ) );
     
@@ -570,39 +570,35 @@ int fdfParametrisation3(const gsl_vector* par, void* d, gsl_vector* f, gsl_matri
 
 //=============================================================================
 
-ClusterShapes::ClusterShapes(int nhits, float* a, float* x, float* y, float* z){
-
-  _nHits = nhits;
-  _aHit = new float[_nHits];
-  _xHit = new float[_nHits];
-  _yHit = new float[_nHits];
-  _zHit = new float[_nHits];
-  _exHit = new float[_nHits];   
-  _eyHit = new float[_nHits];
-  _ezHit = new float[_nHits];         
-  _types = new int[_nHits];
-
-  _xl = new float[_nHits];
-  _xt = new float[_nHits];
-
-  _t = new float[_nHits];
-  _s = new float[_nHits]; 
+ClusterShapes::ClusterShapes(int nhits, float* a, float* x, float* y, float* z):
+
+  _nHits(nhits),
+  _aHit  (nhits, 0.0),
+  _xHit  (nhits, 0.0),
+  _yHit  (nhits, 0.0),
+  _zHit  (nhits, 0.0),
+  _exHit (nhits, 1.0),
+  _eyHit (nhits, 1.0),
+  _ezHit (nhits, 1.0),
+  _xl    (nhits, 0.0),
+  _xt    (nhits, 0.0),
+  _t     (nhits, 0.0),
+  _s     (nhits, 0.0),
+  _types(nhits, 1), // all hits are assumed to be "cylindrical"
+
+  _ifNotGravity    (1),
+  _ifNotWidth      (1),
+  _ifNotInertia    (1),
+  _ifNotEigensystem(1)
+{
 
   for (int i(0); i < nhits; ++i) {
     _aHit[i] = a[i];
     _xHit[i] = x[i];
     _yHit[i] = y[i];
     _zHit[i] = z[i];
-    _exHit[i] = 1.0;
-    _eyHit[i] = 1.0;
-    _ezHit[i] = 1.0;
-    _types[i] = 1; // all hits are assumed to be "cyllindrical"
   }
 
-  _ifNotGravity     = 1;
-  _ifNotWidth       = 1;
-  _ifNotInertia     = 1;
-  _ifNotEigensystem = 1;
 
 }
 
@@ -611,18 +607,6 @@ ClusterShapes::ClusterShapes(int nhits, float* a, float* x, float* y, float* z){
 
 ClusterShapes::~ClusterShapes() {
 
-  delete[] _aHit;
-  delete[] _xHit;
-  delete[] _yHit;
-  delete[] _zHit;
-  delete[] _exHit;
-  delete[] _eyHit;
-  delete[] _ezHit;
-  delete[] _types;
-  delete[] _xl;
-  delete[] _xt;
-  delete[] _t;
-  delete[] _s;
 }
 
 //=============================================================================
@@ -672,6 +656,11 @@ float* ClusterShapes::getCentreOfGravity() {
   if (_ifNotGravity == 1) findGravity() ;
   return &_analogGravity[0] ;
 }
+float* ClusterShapes::getCentreOfGravityErrors() {
+  // this is a pure dummy to allow MarlinPandora development!
+  if (_ifNotGravity == 1) findGravity() ;
+  return &_analogGravity[0] ;
+}
 
 //=============================================================================
 
@@ -679,6 +668,11 @@ float* ClusterShapes::getEigenValInertia() {
   if (_ifNotInertia == 1) findInertia();
   return &_ValAnalogInertia[0] ;
 }
+float* ClusterShapes::getEigenValInertiaErrors() {
+  // this is a pure dummy to allow MarlinPandora development!
+  if (_ifNotInertia == 1) findInertia();
+  return &_ValAnalogInertia[0] ;
+}
 
 //=============================================================================
 
@@ -686,6 +680,11 @@ float* ClusterShapes::getEigenVecInertia() {
   if (_ifNotInertia == 1) findInertia();
   return &_VecAnalogInertia[0] ;
 }
+float* ClusterShapes::getEigenVecInertiaErrors() {
+  // this is a pure dummy to allow MarlinPandora development!
+  if (_ifNotInertia == 1) findInertia();
+  return &_VecAnalogInertia[0] ;
+}
 
 //=============================================================================
 
@@ -703,8 +702,8 @@ int ClusterShapes::getEigenSytemCoordinates(float* xlong, float* xtrans) {
 
 
   // NOT SAVE, change to class variables !!!!!
-  float X0 = 7.0;
-  float Rm = 13.5;
+  float X0[2]={3.50,17.57};   //in mm. //this is the exact value of tungsten and iron
+  float Rm[2]={9.00,17.19};   //in mm. need to change to estimate correctly 
 
   if (_ifNotEigensystem == 1) transformToEigensystem(xStart,index_xStart,X0,Rm);
 
@@ -725,8 +724,8 @@ int ClusterShapes::getEigenSytemCoordinates(float* xlong, float* xtrans, float*
   int index_xStart;
 
   // NOT SAVE, change to class variables !!!!!
-  float X0 = 7.0;
-  float Rm = 13.5;
+  float X0[2]={3.50,17.57};   //in mm. //this is the exact value of tungsten and iron
+  float Rm[2]={9.00,17.19};   //in mm. need to change to estimate correctly 
 
   if (_ifNotEigensystem == 1) transformToEigensystem(xStart,index_xStart,X0,Rm);
 
@@ -744,15 +743,25 @@ int ClusterShapes::getEigenSytemCoordinates(float* xlong, float* xtrans, float*
 
 int ClusterShapes::fit3DProfile(float& chi2, float& E0, float& A, float& B, float& D,
 				float& xl0, float* xStart, int& index_xStart,
-				float X0, float Rm) {
+				float* X0, float* Rm) {
 
   const int npar = 4;
 
-
-  if (_ifNotEigensystem == 1) transformToEigensystem(xStart,index_xStart,X0,Rm);
-
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+  
   float* E = new float[_nHits];
 
+  //doesn't fit when _nHits==0
+  //std::cout << "_nhits " << _nHits << std::endl;
+  if(_nHits-1 < npar){  //can't fit because number of degrees of freedom is small
+    E0=0.0;
+
+    delete[] E;
+    int result = 0;  // no error handling at the moment
+    return result;
+  }
 
   double par_init[npar];
   for (int i = 0; i < npar; ++i) par_init[i] = 0.0; // initialise
@@ -760,16 +769,16 @@ int ClusterShapes::fit3DProfile(float& chi2, float& E0, float& A, float& B, floa
   float E0_init = 0.0;
   float A_init  = 0.0;
   float B_init  = 0.5; // empirically
-  float D_init  = 0.5; // empirically
-  float t0_init = -10.0/X0; // shift xl0_ini is assumed to be -10.0 without a reason ????
+  float D_init  = 0.06;    //0.5; //if Rm includes 90% of shower energy, absorption length has 63% of shower energy
+  float t0_init = -10.0/X0[0]; // shift xl0_ini is assumed to be -10.0 without a reason ????
   
   float E0_tmp = 0.0;
-  int i_max = 0;
-  float t_max = 0.0;
+  //  int i_max = 0;
+  //float t_max = 0.0;
   for (int i = 0; i < _nHits; ++i) {
     if (E0_tmp < _aHit[i]) {
       E0_tmp = _aHit[i]; 
-      i_max = i;
+      //i_max = i;
     }
     E0_init += _aHit[i];
   }
@@ -783,11 +792,9 @@ int ClusterShapes::fit3DProfile(float& chi2, float& E0, float& A, float& B, floa
   //A_init = t_max*B_init + 1.0;
 
   // third definition
-  float Ec = X0 * 0.021/Rm;
+  float Ec = X0[0] * 0.021/Rm[0];
   A_init =  B_init * log(E0_init/Ec) + 0.5 * B_init + 1.0; // (+0.5 for Photons initiated showers)
 
-
-
   // par_init[0] = E0_init;
   E0 = E0_init;
   for (int i = 0; i < _nHits; ++i) E[i] = _aHit[i]/E0_init;
@@ -795,28 +802,28 @@ int ClusterShapes::fit3DProfile(float& chi2, float& E0, float& A, float& B, floa
   par_init[1] = B_init;
   par_init[2] = D_init;
   par_init[3] = t0_init;
-
+ 
   // debug
 
-  std::cout << "E0_init : " <<  E0_init << "\t" << "A_init : " << A_init << "\t" 
-	    << "B_init : " <<  B_init << "\t" << "D_init : " << D_init << "\t" 
-	    << "xl0_init : "  << t0_init*X0 << "\t" << "X0 : " << X0 
-	    << "\t" << "t_max : " << t_max << std::endl << std::endl;
+  // std::cout << "E0_init : " <<  E0_init << "\t" << "A_init : " << A_init << "\t" 
+  //     << "B_init : " <<  B_init << "\t" << "D_init : " << D_init << "\t" 
+  //     << "xl0_init : "  << t0_init*X0 << "\t" << "X0 : " << X0 
+  //     << "\t" << "t_max : " << t_max << std::endl << std::endl;
 
 
-  double t0 = xl0/X0;
+  double t0 = xl0/X0[0];   //probably t0 is in ecal
   double par[npar];
   par[0] = A;
   par[1] = B;
   par[2] = D;
   par[3] = t0;
 
-  fit3DProfileAdvanced(chi2,par_init,par,npar,_t,_s,E,E0);
+  fit3DProfileAdvanced(chi2,par_init,par,npar,&_t[0],&_s[0],E,E0);
 
   A   = par[0];
   B   = par[1];
   D   = par[2];
-  xl0 = par[3] * X0;
+  xl0 = par[3] * X0[0];   //probably shower start is in ecal
 
   delete[] E;
 
@@ -827,7 +834,7 @@ int ClusterShapes::fit3DProfile(float& chi2, float& E0, float& A, float& B, floa
 //=============================================================================
 
 float ClusterShapes::getChi2Fit3DProfileSimple(float a, float b, float c, float d,
-					       float X0, float Rm) {
+					       float* X0, float* Rm) {
 
   float chi2 = 0.0;
 
@@ -845,7 +852,7 @@ float ClusterShapes::getChi2Fit3DProfileSimple(float a, float b, float c, float
 //=============================================================================
 
 float ClusterShapes::getChi2Fit3DProfileAdvanced(float E0, float a, float b, float d,
-						 float t0, float X0, float Rm) {
+						 float t0, float* X0, float* Rm) {
 
   float chi2 = 0.0;
 
@@ -897,18 +904,18 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
 
 int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
 			    double* parameter, double* dparameter, double& chi2, 
-                            double& distmax, int direction) {
+			    double& distmax, int direction) {
 
   // FIXME: version with double typed parameters needed 2006/06/10 OW
   
   if (_nHits < 3) {
-      std::cout << "ClusterShapes : helix fit impossible, two few points" ;
-      std::cout << std::endl;
-      for (int i = 0; i < 5; ++i) {
-	  parameter[i] = 0.0;
-	  dparameter[i] = 0.0;
-      }
-      return 1;
+    std::cout << "ClusterShapes : helix fit impossible, two few points" ;
+    std::cout << std::endl;
+    for (int i = 0; i < 5; ++i) {
+      parameter[i] = 0.0;
+      dparameter[i] = 0.0;
+    }
+    return 1;
   }
 
   // find initial parameters
@@ -919,14 +926,14 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
 
   // 1st loop  
   for (int i(0); i < _nHits; ++i) {
-      double Rz = sqrt(_xHit[i]*_xHit[i] + _yHit[i]*_yHit[i]);
-      if (Rz < Rmin) {
-        Rmin = Rz;
-        i1 = i;
-      }
-      if (Rz > Rmax) {
-        Rmax = Rz;
-      }
+    double Rz = sqrt(_xHit[i]*_xHit[i] + _yHit[i]*_yHit[i]);
+    if (Rz < Rmin) {
+      Rmin = Rz;
+      i1 = i;
+    }
+    if (Rz > Rmax) {
+      Rmax = Rz;
+    }
 
   }
 
@@ -934,8 +941,8 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
 
   // debug
   /*
-  for (int i(0); i < _nHits; ++i) std::cout << i << "  " << _xHit[i] << "  " << _yHit[i] << "  " << _zHit[i] << std::endl;
-  std::cout << std::endl << Rmin << "  " <<  Rmax << "  " << i1 << std::endl;
+    for (int i(0); i < _nHits; ++i) std::cout << i << "  " << _xHit[i] << "  " << _yHit[i] << "  " << _zHit[i] << std::endl;
+    std::cout << std::endl << Rmin << "  " <<  Rmax << "  " << i1 << std::endl;
   */
 
 
@@ -954,8 +961,8 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
     if ((Rz > Lower) && (Rz < Upper)) {
       double dZ = fabs(_zHit[i]-_zHit[i1]);
       if (dZ < dZmin) {
-        dZmin = dZ;
-        i3 = i;
+	dZmin = dZ;
+	i3 = i;
       }
     }
   }
@@ -977,35 +984,35 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
   // 3d loop
 
   for (int i(0); i < _nHits; ++i) {
-      if (_zHit[i] >= z1 && _zHit[i] <= z3) {
-        double Rz = sqrt(_xHit[i]*_xHit[i] + _yHit[i]*_yHit[i]);
-        double dRz = fabs(Rz - Rref);
-        if (dRz < dRmin) {
-          i2 = i;
-          dRmin = dRz;
-        }
+    if (_zHit[i] >= z1 && _zHit[i] <= z3) {
+      double Rz = sqrt(_xHit[i]*_xHit[i] + _yHit[i]*_yHit[i]);
+      double dRz = fabs(Rz - Rref);
+      if (dRz < dRmin) {
+	i2 = i;
+	dRmin = dRz;
       }
+    }
   }
 
-  int problematic = 0;
+  //int problematic = 0;
 
   if (i2 < 0 || i2 == i1 || i2 == i3) {
-    problematic = 1;
+    //problematic = 1;
     // std::cout << "here we are " << std::endl;
     for (int i(0); i < _nHits; ++i) {
       if (i != i1 && i != i3) {
-        i2 = i;
-        if (_zHit[i2] < z1) {
-          int itemp = i1;
-          i1 = i2;
-          i2 = itemp;
-        }
-        else if (_zHit[i2] > z3) {
-          int itemp = i3;
-          i3 = i2;
-          i2 = itemp;
-        }        
-        break;
+	i2 = i;
+	if (_zHit[i2] < z1) {
+	  int itemp = i1;
+	  i1 = i2;
+	  i2 = itemp;
+	}
+	else if (_zHit[i2] > z3) {
+	  int itemp = i3;
+	  i3 = i2;
+	  i2 = itemp;
+	}        
+	break;
       }
     }      
     // std::cout << i1 << " " << i2 << " " << i3 << std::endl;
@@ -1024,23 +1031,23 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
   double time;
 
   if (det == 0.) {
-      time = 500.;
+    time = 500.;
   }
   else {
-      gsl_matrix* A = gsl_matrix_alloc(2,2);
-      gsl_vector* B = gsl_vector_alloc(2);
-      gsl_vector* T = gsl_vector_alloc(2);     
-      gsl_matrix_set(A,0,0,ax);
-      gsl_matrix_set(A,0,1,-axp);
-      gsl_matrix_set(A,1,0,ay);
-      gsl_matrix_set(A,1,1,-ayp);
-      gsl_vector_set(B,0,x0p-x0);
-      gsl_vector_set(B,1,y0p-y0);
-      gsl_linalg_HH_solve(A,B,T);
-      time = gsl_vector_get(T,0); 
-      gsl_matrix_free(A);
-      gsl_vector_free(B);
-      gsl_vector_free(T);
+    gsl_matrix* A = gsl_matrix_alloc(2,2);
+    gsl_vector* B = gsl_vector_alloc(2);
+    gsl_vector* T = gsl_vector_alloc(2);     
+    gsl_matrix_set(A,0,0,ax);
+    gsl_matrix_set(A,0,1,-axp);
+    gsl_matrix_set(A,1,0,ay);
+    gsl_matrix_set(A,1,1,-ayp);
+    gsl_vector_set(B,0,x0p-x0);
+    gsl_vector_set(B,1,y0p-y0);
+    gsl_linalg_HH_solve(A,B,T);
+    time = gsl_vector_get(T,0); 
+    gsl_matrix_free(A);
+    gsl_vector_free(B);
+    gsl_vector_free(T);
   }
 
   double X0 = x0 + ax*time;
@@ -1052,44 +1059,44 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
   double R0 = sqrt(dX*dX + dY*dY);
 
   /*
-   if (problematic == 1) {
-     std::cout << i1 << " " << i2 << " " << i3 << std::endl;
-     std::cout << _xHit[i1] << " " << _yHit[i1] << " " << _zHit[i1] << std::endl;
-     std::cout << _xHit[i2] << " " << _yHit[i2] << " " << _zHit[i2] << std::endl;
-     std::cout << _xHit[i3] << " " << _yHit[i3] << " " << _zHit[i3] << std::endl;
-     std::cout << "R0 = " << R0 << std::endl;
-   }
+    if (problematic == 1) {
+    std::cout << i1 << " " << i2 << " " << i3 << std::endl;
+    std::cout << _xHit[i1] << " " << _yHit[i1] << " " << _zHit[i1] << std::endl;
+    std::cout << _xHit[i2] << " " << _yHit[i2] << " " << _zHit[i2] << std::endl;
+    std::cout << _xHit[i3] << " " << _yHit[i3] << " " << _zHit[i3] << std::endl;
+    std::cout << "R0 = " << R0 << std::endl;
+    }
   */
 
   double phi1 = (double)atan2(_yHit[i1]-Y0,_xHit[i1]-X0);
   double phi2 = (double)atan2(_yHit[i2]-Y0,_xHit[i2]-X0);
   double phi3 = (double)atan2(_yHit[i3]-Y0,_xHit[i3]-X0);
 
-// testing bz > 0 hypothesis
+  // testing bz > 0 hypothesis
 
   if ( phi1 > phi2 ) 
-      phi2 = phi2 + 2.0*M_PI;
+    phi2 = phi2 + 2.0*M_PI;
   if ( phi1 > phi3 )
-      phi3 = phi3 + 2.0*M_PI;
+    phi3 = phi3 + 2.0*M_PI;
   if ( phi2 > phi3 )
-      phi3 = phi3 + 2.0*M_PI;
+    phi3 = phi3 + 2.0*M_PI;
 
   double bz_plus = (phi3 - phi1) / (_zHit[i3]-_zHit[i1]);
   double phi0_plus = phi1 - bz_plus * _zHit[i1];
   double dphi_plus = fabs( bz_plus * _zHit[i2] + phi0_plus - phi2 );
 
-// testing bz < 0 hypothesis
+  // testing bz < 0 hypothesis
 
   phi1 = (double)atan2(_yHit[i1]-Y0,_xHit[i1]-X0);
   phi2 = (double)atan2(_yHit[i2]-Y0,_xHit[i2]-X0);
   phi3 = (double)atan2(_yHit[i3]-Y0,_xHit[i3]-X0);
 
   if ( phi1 < phi2 ) 
-      phi2 = phi2 - 2.0*M_PI;
+    phi2 = phi2 - 2.0*M_PI;
   if ( phi1 < phi3 )
-      phi3 = phi3 - 2.0*M_PI;
+    phi3 = phi3 - 2.0*M_PI;
   if ( phi2 < phi3 )
-      phi3 = phi3 - 2.0*M_PI;
+    phi3 = phi3 - 2.0*M_PI;
 
   double bz_minus = (phi3 - phi1) / (_zHit[i3]-_zHit[i1]);
   double phi0_minus = phi1 - bz_minus * _zHit[i1];
@@ -1099,12 +1106,12 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
   double phi0;
 
   if (dphi_plus < dphi_minus) {
-      bz = bz_plus;
-      phi0 = phi0_plus;
+    bz = bz_plus;
+    phi0 = phi0_plus;
   }
   else {
-      bz = bz_minus;
-      phi0 = phi0_minus;
+    bz = bz_minus;
+    phi0 = phi0_minus;
 
   }
 
@@ -1133,11 +1140,11 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
     
     // debug
     /*    
-    X0 = -1205.28;
-    Y0 = 175.317;
-    R0 = 1217.97;
-    bz = 0.00326074;
-    phi0 = -0.144444;
+	  X0 = -1205.28;
+	  Y0 = 175.317;
+	  R0 = 1217.97;
+	  bz = 0.00326074;
+	  phi0 = -0.144444;
     */ 
 
 
@@ -1176,17 +1183,17 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
 
     // debug
     /*
-    std::cout << std::setprecision(6) << "InitFitCalculated (d0,z0,phi0,omega,tanL) = " << "(" << d0 << "," << z0 << "," << Phi0 << "," << omega << "," << tanL << ")" 
-              << "  " << "sign(omega) = " << direction << std::endl;
+      std::cout << std::setprecision(6) << "InitFitCalculated (d0,z0,phi0,omega,tanL) = " << "(" << d0 << "," << z0 << "," << Phi0 << "," << omega << "," << tanL << ")" 
+      << "  " << "sign(omega) = " << direction << std::endl;
     */
 
     // debug        
     /*
-    d0    = 0.00016512;
-    z0    = 0.000853511;
-    Phi0  = 1.11974;
-    omega = -4.22171e-05;
-    tanL  = -0.33436;
+      d0    = 0.00016512;
+      z0    = 0.000853511;
+      Phi0  = 1.11974;
+      omega = -4.22171e-05;
+      tanL  = -0.33436;
     */
 
 
@@ -1223,7 +1230,7 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
   for (int ipoint(0); ipoint < _nHits; ipoint++) {
     double distRPZ[2];
     double Dist = DistanceHelix(_xHit[ipoint],_yHit[ipoint],_zHit[ipoint],
-			       X0,Y0,R0,bz,phi0,distRPZ);
+				X0,Y0,R0,bz,phi0,distRPZ);
     double chi2rphi = distRPZ[0]/_exHit[ipoint];
     chi2rphi = chi2rphi*chi2rphi;
     double chi2z = distRPZ[1]/_ezHit[ipoint];
@@ -1306,7 +1313,11 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
 
   } while ( status==GSL_CONTINUE && iter < max_iter);
 
-  gsl_multifit_covar (s->J, rel_error, covar);
+  //fg: jacobian has been dropped from gsl_multifit_fdfsolver in gsl 2:
+  gsl_matrix * J = gsl_matrix_alloc(s->fdf->n, s->fdf->p);
+  gsl_multifit_fdfsolver_jac( s, J);
+  gsl_multifit_covar( J, rel_error, covar );
+  //  gsl_multifit_covar (s->J, rel_error, covar);
 
 
 
@@ -1347,7 +1358,7 @@ int ClusterShapes::FitHelix(int max_iter, int status_out, int parametrisation,
   for (int ipoint(0); ipoint < _nHits; ipoint++) {
     double distRPZ[2];
     double Dist = DistanceHelix(_xHit[ipoint],_yHit[ipoint],_zHit[ipoint],
-			       X0,Y0,R0,bz,phi0,distRPZ);
+				X0,Y0,R0,bz,phi0,distRPZ);
     double chi2rphi = distRPZ[0]/_exHit[ipoint];
     chi2rphi = chi2rphi*chi2rphi;
     double chi2z = distRPZ[1]/_ezHit[ipoint];
@@ -1446,23 +1457,23 @@ void ClusterShapes::findElipsoid() {
 
 void ClusterShapes::findGravity() {
 
-    _totAmpl = 0. ;
-    for (int i(0); i < 3; ++i) {
-	_analogGravity[i] = 0.0 ;
-    }
-    for (int i(0); i < _nHits; ++i) {
-	_totAmpl+=_aHit[i] ;
-	_analogGravity[0]+=_aHit[i]*_xHit[i] ;
-	_analogGravity[1]+=_aHit[i]*_yHit[i] ;
-	_analogGravity[2]+=_aHit[i]*_zHit[i] ;
-    }
-    for (int i(0); i < 3; ++i) {
-	_analogGravity[i]/=_totAmpl ;
-    }
-    _xgr = _analogGravity[0];
-    _ygr = _analogGravity[1];
-    _zgr = _analogGravity[2];
-    _ifNotGravity = 0;
+  _totAmpl = 0. ;
+  for (int i(0); i < 3; ++i) {
+    _analogGravity[i] = 0.0 ;
+  }
+  for (int i(0); i < _nHits; ++i) {
+    _totAmpl+=_aHit[i] ;
+    _analogGravity[0]+=_aHit[i]*_xHit[i] ;
+    _analogGravity[1]+=_aHit[i]*_yHit[i] ;
+    _analogGravity[2]+=_aHit[i]*_zHit[i] ;
+  }
+  for (int i(0); i < 3; ++i) {
+    _analogGravity[i]/=_totAmpl ;
+  }
+  _xgr = _analogGravity[0];
+  _ygr = _analogGravity[1];
+  _zgr = _analogGravity[2];
+  _ifNotGravity = 0;
 }
 
 //=============================================================================
@@ -1476,27 +1487,27 @@ void ClusterShapes::findInertia() {
   findGravity();
 
   for (int i(0); i < 3; ++i) {
-      for (int j(0); j < 3; ++j) {
-	  aIne[i][j] = 0.0;
-      }
+    for (int j(0); j < 3; ++j) {
+      aIne[i][j] = 0.0;
+    }
   }
 
   for (int i(0); i < _nHits; ++i) {
-      float dX = _xHit[i] - _analogGravity[0];
-      float dY = _yHit[i] - _analogGravity[1];
-      float dZ = _zHit[i] - _analogGravity[2];
-      aIne[0][0] += _aHit[i]*(dY*dY+dZ*dZ);
-      aIne[1][1] += _aHit[i]*(dX*dX+dZ*dZ);
-      aIne[2][2] += _aHit[i]*(dX*dX+dY*dY);
-      aIne[0][1] -= _aHit[i]*dX*dY;
-      aIne[0][2] -= _aHit[i]*dX*dZ;
-      aIne[1][2] -= _aHit[i]*dY*dZ;
+    float dX = _xHit[i] - _analogGravity[0];
+    float dY = _yHit[i] - _analogGravity[1];
+    float dZ = _zHit[i] - _analogGravity[2];
+    aIne[0][0] += _aHit[i]*(dY*dY+dZ*dZ);
+    aIne[1][1] += _aHit[i]*(dX*dX+dZ*dZ);
+    aIne[2][2] += _aHit[i]*(dX*dX+dY*dY);
+    aIne[0][1] -= _aHit[i]*dX*dY;
+    aIne[0][2] -= _aHit[i]*dX*dZ;
+    aIne[1][2] -= _aHit[i]*dY*dZ;
   }
 
   for (int i(0); i < 2; ++i) {
-      for (int j = i+1; j < 3; ++j) {
-	  aIne[j][i] = aIne[i][j];
-      }
+    for (int j = i+1; j < 3; ++j) {
+      aIne[j][i] = aIne[i][j];
+    }
   }
   //****************************************
   // analog Inertia
@@ -1523,13 +1534,13 @@ void ClusterShapes::findInertia() {
   radius2 = 0.;
 
   for (int i(0); i < 3; ++i) {
-      _radius += _analogGravity[i]*_analogGravity[i];
-      radius2 += (_analogGravity[i]+_VecAnalogInertia[i])*(_analogGravity[i]+_VecAnalogInertia[i]);
+    _radius += _analogGravity[i]*_analogGravity[i];
+    radius2 += (_analogGravity[i]+_VecAnalogInertia[i])*(_analogGravity[i]+_VecAnalogInertia[i]);
   }
 
   if ( radius2 < _radius) {
-      for (int i(0); i < 3; ++i)
-	  _VecAnalogInertia[i] = - _VecAnalogInertia[i];
+    for (int i(0); i < 3; ++i)
+      _VecAnalogInertia[i] = - _VecAnalogInertia[i];
   }
 
   _radius = sqrt(_radius);
@@ -1563,99 +1574,99 @@ void ClusterShapes::findWidth() {
 
 float ClusterShapes::findDistance(int i) {
 
-    float cx = 0.0;
-    float cy = 0.0;
-    float cz = 0.0;
-    float dx = 0.0;
-    float dy = 0.0;
-    float dz = 0.0;
-    cx = _VecAnalogInertia[0] ;
-    cy = _VecAnalogInertia[1] ;
-    cz = _VecAnalogInertia[2] ;
-    dx = _analogGravity[0] - _xHit[i] ;
-    dy = _analogGravity[1] - _yHit[i] ;
-    dz = _analogGravity[2] - _zHit[i] ;
-    float tx = cy*dz - cz*dy ;
-    float ty = cz*dx - cx*dz ;
-    float tz = cx*dy - cy*dx ;
-    float tt = sqrt(tx*tx+ty*ty+tz*tz) ;
-    float ti = sqrt(cx*cx+cy*cy+cz*cz) ;
-    float f = tt / ti ;
-    return f ;
+  float cx = 0.0;
+  float cy = 0.0;
+  float cz = 0.0;
+  float dx = 0.0;
+  float dy = 0.0;
+  float dz = 0.0;
+  cx = _VecAnalogInertia[0] ;
+  cy = _VecAnalogInertia[1] ;
+  cz = _VecAnalogInertia[2] ;
+  dx = _analogGravity[0] - _xHit[i] ;
+  dy = _analogGravity[1] - _yHit[i] ;
+  dz = _analogGravity[2] - _zHit[i] ;
+  float tx = cy*dz - cz*dy ;
+  float ty = cz*dx - cx*dz ;
+  float tz = cx*dy - cy*dx ;
+  float tt = sqrt(tx*tx+ty*ty+tz*tz) ;
+  float ti = sqrt(cx*cx+cy*cy+cz*cz) ;
+  float f = tt / ti ;
+  return f ;
 }
 /**
-      Function sdist(xp,yp,zp,cx,cy,cz,xv,yv,zv)
-c----------------------------------------------------------------------
-c        Distance from line to point
-c       xp, yp, zp -- point is at the line
-c       xv, yv, zv -- point is out of line
-********************************************************************
-*     Last update     V.L.Morgunov     08-Apr-2002                 *
-********************************************************************
-      real xp,yp,zp,cx,cy,cz,xv,yv,zv,t1,t2,t3,tt,sdist
-
-      t1 = cy*(zp-zv)-cz*(yp-yv)
-      t2 = cz*(xp-xv)-cx*(zp-zv)
-      t3 = cx*(yp-yv)-cy*(xp-xv)
-      tt = sqrt(cx**2+cy**2+cz**2)
-      sdist = sqrt(t1**2+t2**2+t3**2)/tt
-
-      return
-      end
+   Function sdist(xp,yp,zp,cx,cy,cz,xv,yv,zv)
+   c----------------------------------------------------------------------
+   c        Distance from line to point
+   c       xp, yp, zp -- point is at the line
+   c       xv, yv, zv -- point is out of line
+   ********************************************************************
+   *     Last update     V.L.Morgunov     08-Apr-2002                 *
+   ********************************************************************
+   real xp,yp,zp,cx,cy,cz,xv,yv,zv,t1,t2,t3,tt,sdist
+
+   t1 = cy*(zp-zv)-cz*(yp-yv)
+   t2 = cz*(xp-xv)-cx*(zp-zv)
+   t3 = cx*(yp-yv)-cy*(xp-xv)
+   tt = sqrt(cx**2+cy**2+cz**2)
+   sdist = sqrt(t1**2+t2**2+t3**2)/tt
+
+   return
+   end
 */
 
 //=============================================================================
 
 float ClusterShapes::vecProduct(float * x1, float * x2) {
 
-    float x1abs(0.);
-    float x2abs(0.);
-    float prod(0.);
+  float x1abs(0.);
+  float x2abs(0.);
+  float prod(0.);
 
-    for (int i(0); i < 3; ++i) {
-	x1abs += x1[i]*x1[i];
-	x2abs += x2[i]*x2[i];
-	prod  += x1[i]*x2[i];
-    }
+  for (int i(0); i < 3; ++i) {
+    x1abs += x1[i]*x1[i];
+    x2abs += x2[i]*x2[i];
+    prod  += x1[i]*x2[i];
+  }
 
 
-    x1abs = sqrt(x1abs);
-    x2abs = sqrt(x2abs);
+  x1abs = sqrt(x1abs);
+  x2abs = sqrt(x2abs);
 
-    if (x1abs > 0.0 && x2abs > 0.0) {
-	prod = prod/(x1abs*x2abs);
-    }
-    else {
-	prod = 0.;
-    }
+  if (x1abs > 0.0 && x2abs > 0.0) {
+    prod = prod/(x1abs*x2abs);
+  }
+  else {
+    prod = 0.;
+  }
 
-    return prod;
+  return prod;
 
 }
 
 //=============================================================================
 
 float ClusterShapes::vecProject(float * x, float * axis) {
-    float axisabs(0.);
-    float prod(0.);
-    for (int i(0); i < 3; ++i) {
-	axisabs += axis[i]*axis[i];
-	prod  += x[i]*axis[i];
-    }
-    axisabs = sqrt(axisabs);
-    if (axisabs > 0.0 ) {
-	prod = prod/axisabs;
-    }
-    else {
-	prod = 0.;
-    }
-    return prod;
+  float axisabs(0.);
+  float prod(0.);
+  for (int i(0); i < 3; ++i) {
+    axisabs += axis[i]*axis[i];
+    prod  += x[i]*axis[i];
+  }
+  axisabs = sqrt(axisabs);
+  if (axisabs > 0.0 ) {
+    prod = prod/axisabs;
+  }
+  else {
+    prod = 0.;
+  }
+  return prod;
 }
 
 //=============================================================================
 
 double ClusterShapes::DistanceHelix(double x, double y, double z, double X0, double Y0,
-				   double R0, double bz, double phi0, double * distRPZ) {
+				    double R0, double bz, double phi0, double * distRPZ) {
 
   double phi  = atan2(y-Y0,x-X0);
   double R    = sqrt( (y-Y0)*(y-Y0) + (x-X0)*(x-X0) );
@@ -1695,9 +1706,8 @@ double ClusterShapes::DistanceHelix(double x, double y, double z, double X0, dou
 
 //=============================================================================
 
-int ClusterShapes::transformToEigensystem(float* xStart, int& index_xStart, float X0,
-					  float Rm) {
-
+int ClusterShapes::transformToEigensystem(float* xStart, int& index_xStart, float* X0, float* Rm) {
+  
   if (_ifNotInertia == 1) findInertia();
 
   float MainAxis[3];
@@ -1711,9 +1721,16 @@ int ClusterShapes::transformToEigensystem(float* xStart, int& index_xStart, floa
   MainCentre[1] = _analogGravity[1];
   MainCentre[2] = _analogGravity[2];
 
+  //analoginertia looks something wrong!
+  //change it to the direction of CoG
+  //float ll=sqrt(MainCentre[0]*MainCentre[0]+MainCentre[1]*MainCentre[1]+MainCentre[2]*MainCentre[2]);
+  //MainAxis[0]=MainCentre[0]/ll;
+  //MainAxis[1]=MainCentre[1]/ll;
+  //MainAxis[2]=MainCentre[2]/ll;
+
   int ifirst = 0;
   float xx[3];
-  float prodmin = 0.0;
+  float prodmin = 1.0e+100;
   int index = 0;
 
   for (int i(0); i < _nHits; ++i) {
@@ -1731,27 +1748,73 @@ int ClusterShapes::transformToEigensystem(float* xStart, int& index_xStart, floa
   xStart[1] = MainCentre[1] + prodmin*MainAxis[1];
   xStart[2] = MainCentre[2] + prodmin*MainAxis[2];
   index_xStart = index;
+  
+  float l=sqrt(MainAxis[0]*MainAxis[0]+MainAxis[1]*MainAxis[1]+MainAxis[2]*MainAxis[2]);
+  //float ll=sqrt(xStart[0]*xStart[0]+xStart[1]*xStart[1]+xStart[2]*xStart[2]);
+  //std::cout << "xstart: " << index_xStart << " " << prodmin << " " << xStart[0] << std::endl;
 
+  //calculate the surface of hcal
+  float ecalrad=2.058000000e+03;   //in mm 
+  float plugz=2.650000000e+03;   //in mm 
+  
+  float tmpcos=MainAxis[2]/l;
+  float tmpsin=sqrt(MainAxis[0]*MainAxis[0]+MainAxis[1]*MainAxis[1])/l;
+  float detend=0.0;
+  if(fabs(xStart[2])<2.450000000e+03){   //if in the barrel
+    detend=(ecalrad-sqrt(xStart[0]*xStart[0]+xStart[1]*xStart[1]))/tmpsin;
+  }else{  //if in plug
+    detend=(plugz-fabs(xStart[2]))/fabs(tmpcos);
+  }
+  if(detend<0.0) detend=0.0;
+
+  // std::cout << "check length: " << detend << " "
+  //           << xStart[0]/ll << " " << xStart[1]/ll << " " << xStart[2]/ll << " " 
+  //           << MainAxis[0]/l << " " << MainAxis[1]/l << " " << MainAxis[1]/l << std::endl;
+  
   for (int i(0); i < _nHits; ++i) {
     xx[0] = _xHit[i] - xStart[0];
     xx[1] = _yHit[i] - xStart[1];
     xx[2] = _zHit[i] - xStart[2];
     float xx2(0.);
     for (int j(0); j < 3; ++j) xx2 += xx[j]*xx[j];
-
+    
     _xl[i] = 0.001 + vecProject(xx,MainAxis);
-    _xt[i] = sqrt(std::max(0.0,xx2 + 0.1 - _xl[i]*_xl[i]));
+    _xt[i] = sqrt(std::max(0.0,xx2 + 0.01 - _xl[i]*_xl[i]));
     //    std::cout << i << " " << _xl[i] << " " << _xt[i] << " " << _aHit[i] << " "
     //              << std::endl;
   }
-
-  for (int i = 0; i < _nHits; ++i) {
-    _t[i] = _xl[i]/X0;
-    _s[i] = _xt[i]/Rm;
+  
+  //first, check ecal and solve wrong behaviour
+  //std::cout << "param: " << X0[0] << " " << X0[1] << " " << Rm[0] << " " << Rm[1] << std::endl;
+  for (int i = 0; i < _nHits; ++i) { 
+    //if(_types[i]==0 || _types[i]==3){   //if the hit is in Ecal
+    _t[i] = _xl[i]/X0[0];
+    _s[i] = _xt[i]/Rm[0];
+    if(detend<_xl[i]){
+      //std::cout << "something wrong!! " << detend << " " << _xl[i] << " " << _t[i] << std::endl;
+      //detend = _xl[i]; //to avoid wrong behaviour
+    }
+    //}
   }
-
+  
+  //second, check hcal
+  /*for (int i = 0; i < _nHits; ++i) { 
+    if(_types[i]==1 || _types[i]==4){   //if the hit is in Hcal
+    if(_xl[i]>detend){
+    _t[i] = detend/X0[0]+(_xl[i]-detend)/X0[1];
+    _s[i] = _xt[i]/Rm[1];
+    }else{
+    _t[i] = _xl[i]/X0[0];
+    _s[i] = _xt[i]/Rm[0];
+    }   
+    }
+    // std::cout << _types[i] << " " << _xl[i] << " "
+    //           << _xl[i]+sqrt(xStart[0]*xStart[0]+xStart[1]*xStart[1]+xStart[2]*xStart[2])  << " "
+    //           << _t[i] << " " << _s[i] << std::endl;
+    }*/
+  
   _ifNotEigensystem = 0;
-
+  
   return 0; // no error messages at the moment
 
 }
@@ -1764,7 +1827,7 @@ float ClusterShapes::calculateChi2Fit3DProfileSimple(float a, float b, float c,
   // ClusterShapes::transformToEigensystem needs to be executed before
 
   float chi2 = 0.0;
-  float Ampl = 0.0;
+  float Ampl = 0.0; 
 
   for (int i(0); i < _nHits; ++i) {
     // old definition of Ampl and chi2
@@ -1804,11 +1867,11 @@ float ClusterShapes::calculateChi2Fit3DProfileAdvanced(float E0, float a, float
 
     // debug 
     /*
-    std::cout << "OUT : " << Ampl << "  " << E0  << "  " << a  << "  " << b  << "  " 
-	      << d  << "  " << t0  << "  " << _t[i] << "  " << invG(a)  << "  "
-	      << pow(b*(_t[i]-t0),a-1)  << "  " << exp(-b*(_t[i]-t0))  << "  " 
-	      << exp(-d*_s[i]) 
-	      << std::endl;
+      std::cout << "OUT : " << Ampl << "  " << E0  << "  " << a  << "  " << b  << "  " 
+      << d  << "  " << t0  << "  " << _t[i] << "  " << invG(a)  << "  "
+      << pow(b*(_t[i]-t0),a-1)  << "  " << exp(-b*(_t[i]-t0))  << "  " 
+      << exp(-d*_s[i]) 
+      << std::endl;
     */
 
     chi2 += ((Ampl - _aHit[i])*(Ampl - _aHit[i]))/(_aHit[i]*_aHit[i]);
@@ -1932,6 +1995,8 @@ int ClusterShapes::fit3DProfileAdvanced(float& chi2, double* par_init, double* p
 
   const gsl_multifit_fdfsolver_type* T = gsl_multifit_fdfsolver_lmsder;
 
+  //std::cout << T << " " << _nHits << " " << npar << std::endl;
+
   gsl_multifit_fdfsolver* Solver = gsl_multifit_fdfsolver_alloc(T,_nHits,npar);
 
   gsl_matrix* covar = gsl_matrix_alloc(npar,npar);   // covariance matrix
@@ -1951,6 +2016,8 @@ int ClusterShapes::fit3DProfileAdvanced(float& chi2, double* par_init, double* p
   fitfunct.params = &DataSet;
 
   gsl_vector_view pinit = gsl_vector_view_array(par_init,npar);
+
+  //std::cout << Solver << " " << &fitfunct << " " << &pinit.vector << std::endl;
   gsl_multifit_fdfsolver_set(Solver,&fitfunct,&pinit.vector);
 
   gsl_set_error_handler_off();
@@ -1958,9 +2025,9 @@ int ClusterShapes::fit3DProfileAdvanced(float& chi2, double* par_init, double* p
   // perform fit
   do {
     iter++;
-    std::cout << "Multidimensional Fit Iteration started ... ... ";
+    //std::cout << "Multidimensional Fit Iteration started ... ... ";
     status = gsl_multifit_fdfsolver_iterate(Solver);
-    std::cout << "--- DONE ---" << std::endl;
+    //std::cout << "--- DONE ---" << std::endl;
 
     if (status) break;
     status = gsl_multifit_test_delta (Solver->dx,Solver->x,abs_error,rel_error);
@@ -1974,15 +2041,19 @@ int ClusterShapes::fit3DProfileAdvanced(float& chi2, double* par_init, double* p
     par[3] = (float)gsl_vector_get(Solver->x,3);
 
     std::cout << "Status of multidimensional fit : " << status << "  "
-	      << "Iterations : " << iter << std::endl;
+    << "Iterations : " << iter << std::endl;
     std::cout << "E0 : " <<  "FIXED" << "\t" << "A : " << par[0] << "\t" << "B : " 
-	      <<  par[1] << "\t" << "D : " << par[2] << "\t" << "t0 : "  << par[3] 
-	      << std::endl << std::endl;
+    <<  par[1] << "\t" << "D : " << par[2] << "\t" << "t0 : "  << par[3] 
+    << std::endl << std::endl;
     */
 
   } while ( status==GSL_CONTINUE && iter < max_iter);
 
-  gsl_multifit_covar (Solver->J,rel_error,covar);
+  //fg: jacobian has been dropped from gsl_multifit_fdfsolver in gsl 2:
+  gsl_matrix * J = gsl_matrix_alloc(Solver->fdf->n, Solver->fdf->p);
+  gsl_multifit_fdfsolver_jac(Solver, J);
+  gsl_multifit_covar( J, rel_error, covar );
+  //  gsl_multifit_covar (Solver->J,rel_error,covar);
 
   //  E0  = (float)gsl_vector_get(Solver->x,0);
   par[0] = (float)gsl_vector_get(Solver->x,0); // A
@@ -2003,3 +2074,222 @@ int ClusterShapes::fit3DProfileAdvanced(float& chi2, double* par_init, double* p
 
 //=============================================================================
 
+float ClusterShapes::getEmax(float* xStart, int& index_xStart, float* X0, float* Rm){
+
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+
+  float E_max=0.0;
+  //int i_max=0;
+  for (int i = 0; i < _nHits; ++i) {
+    if (E_max < _aHit[i]) {
+      E_max = _aHit[i]; 
+      //i_max = i;
+    }
+  }
+  
+  return E_max;
+}
+
+float ClusterShapes::getsmax(float* xStart, int& index_xStart, float* X0, float* Rm){
+
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+
+  float E_max=0.0,xl_max=0.0;
+  float xl_start=1.0e+50;
+  //int i_max=0;
+  for (int i = 0; i < _nHits; ++i) {
+    //check the position of maximum energy deposit
+    if (E_max < _aHit[i]) {
+      E_max = _aHit[i]; 
+      xl_max = _xl[i];
+      //i_max = i;
+    }
+    //check the position of shower start
+    if (xl_start > _xl[i]) {
+      xl_start = _xl[i];
+    }
+  }
+  
+  return fabs(xl_max-xl_start);
+}
+
+float ClusterShapes::getxl20(float* xStart, int& index_xStart, float* X0, float* Rm){
+  
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+  
+  float *xl_res = new float[_nHits];
+  float *E_res = new float[_nHits];
+  float E_tot=0.0;
+  for (int i = 0; i < _nHits; ++i) {
+    E_res[i]=_aHit[i];
+    xl_res[i]=_xl[i];
+
+    E_tot+=_aHit[i];
+  }
+  
+  //sort deposite energy to xs ascending order
+  float tmpe=0.0, tmpxl=0.0;
+  for (int i = 0; i < _nHits; ++i) {
+    for (int j = i + 1; j < _nHits; ++j) {
+      if(xl_res[i]>xl_res[j]){
+	tmpe=E_res[i];
+	E_res[i]=E_res[j];
+	E_res[j]=tmpe;
+
+	tmpxl=xl_res[i];
+	xl_res[i]=xl_res[j];
+	xl_res[j]=tmpxl;
+      }
+    }
+  }
+
+  // std::cout << "check xt: " << xt_res[0] << " " << xt_res[1] << " " << xt_res[2]
+  //           <<std::endl;
+  float E20=0.0,okxl=0.0;
+  int k=0;
+  while(E20/E_tot<0.2){
+    E20+=E_res[k];
+    k++;
+  }
+  
+  //final hit is located in outer radius
+  okxl=xl_res[k-2];
+
+  delete[] xl_res;
+  delete[] E_res;
+
+  return okxl;
+}
+
+float ClusterShapes::getxt90(float* xStart, int& index_xStart, float* X0, float* Rm){
+  
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+  
+  float *xt_res = new float[_nHits];
+  float *E_res = new float[_nHits];
+  float E_tot=0.0;
+  for (int i = 0; i < _nHits; ++i) {
+    E_res[i]=_aHit[i];
+    xt_res[i]=_xt[i];
+
+    E_tot+=_aHit[i];
+  }
+  
+  //sort deposite energy to xt ascending order
+  float tmpe=0.0, tmpxt=0.0;
+  for (int i = 0; i < _nHits; ++i) {
+    for (int j = i + 1; j < _nHits; ++j) {
+      if(xt_res[i]>xt_res[j]){
+	tmpe=E_res[i];
+	E_res[i]=E_res[j];
+	E_res[j]=tmpe;
+
+	tmpxt=xt_res[i];
+	xt_res[i]=xt_res[j];
+	xt_res[j]=tmpxt;
+      }
+    }
+  }
+
+  // std::cout << "check xt: " << xt_res[0] << " " << xt_res[1] << " " << xt_res[2]
+  //           <<std::endl;
+  float E90=0.0,okxt=0.0;
+  int k=0;
+  while(E90/E_tot<0.9){
+    E90+=E_res[k];
+    k++;
+  }
+  
+  //final hit is located in outer radius
+  okxt=xt_res[k-2];
+
+  delete[] xt_res;
+  delete[] E_res;
+
+  return okxt;
+}
+
+//for test
+void ClusterShapes::gethits(float* xStart, int& index_xStart, float* X0, float* Rm, float *okxl, float *okxt, float *oke){
+  
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+  
+  for (int i = 0; i < _nHits; ++i) {
+    okxl[i]=_xl[i];
+    okxt[i]=_xt[i];
+    oke[i]=_aHit[i];
+  }
+  
+  return;
+}
+
+
+float ClusterShapes::getRhitMean(float* xStart, int& index_xStart, float* X0, float* Rm){
+
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+
+  float MainCentre[3];
+
+  MainCentre[0] = _analogGravity[0];
+  MainCentre[1] = _analogGravity[1];
+  MainCentre[2] = _analogGravity[2];
+
+  // float Rhit[_nHits]={0};
+  float Rhit=0;
+
+  float Rhitsum=0;
+  float Rhitmean=0;
+
+  for (int i = 0; i < _nHits; ++i) {
+    Rhit = sqrt(pow((_xHit[i]-MainCentre[0]),2) + pow((_yHit[i]-MainCentre[1]),2));
+    Rhitsum += Rhit;
+  }
+  // cogx-- xx[0]  
+  
+  Rhitmean = Rhitsum/_nHits;
+
+  return Rhitmean;
+}
+
+float ClusterShapes::getRhitRMS(float* xStart, int& index_xStart, float* X0, float* Rm){
+
+  if (_ifNotEigensystem == 1){
+    transformToEigensystem(xStart,index_xStart,X0,Rm);
+  }
+
+  float MainCentre[3];
+
+  MainCentre[0] = _analogGravity[0];
+  MainCentre[1] = _analogGravity[1];
+  MainCentre[2] = _analogGravity[2];
+
+  // float Rhit[_nHits]={0};
+  float Rhit=0;
+
+  float Rhit2sum=0;
+  float Rhitrms=0;
+
+  for (int i = 0; i < _nHits; ++i) {
+    Rhit = sqrt(pow((_xHit[i]-MainCentre[0]),2) + pow((_yHit[i]-MainCentre[1]),2));
+    Rhit2sum += pow(Rhit,2);
+  }
+  // cogx-- xx[0]  
+  
+  Rhitrms = sqrt(Rhit2sum/_nHits);
+
+  return Rhitrms;
+}
+
+
diff --git a/Utilities/KalDet/CMakeLists.txt b/Utilities/KalDet/CMakeLists.txt
index 52b96cf23b79b6c6458ec56803353977aecb70ec..a5bac19db811db7bab268e73a23ff85817196483 100644
--- a/Utilities/KalDet/CMakeLists.txt
+++ b/Utilities/KalDet/CMakeLists.txt
@@ -31,7 +31,14 @@ FOREACH( lib_input_dir ${lib_input_dirs} )
     LIST( APPEND ROOT_DICT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${lib_input_dir} )
 ENDFOREACH()
 
-LIST( APPEND ROOT_DICT_INCLUDE_DIRS /workfs/bes/fucd/Key4hep/CEPCSW/Utilities/KalTest )
+# LIST( APPEND ROOT_DICT_INCLUDE_DIRS /workfs/bes/fucd/Key4hep/CEPCSW/Utilities/KalTest )
+# get the include directory of KalTest
+get_target_property(to_incl KalTestLib SOURCE_DIR)
+if (to_incl)
+   LIST( APPEND ROOT_DICT_INCLUDE_DIRS ${to_incl})
+else()
+  message(FATAL_ERROR "Failed to get the source dir for package KalTestLib")
+endif()
 
 #MESSAGE( STATUS "ROOT_DICT_INCLUDE_DIRS: ${ROOT_DICT_INCLUDE_DIRS}" )
 
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..d3f24f31ec7f4e03435b76854c8b5c0cc46812ef
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1 @@
+## CEPCSW
diff --git a/docs/_config.yml b/docs/_config.yml
new file mode 100644
index 0000000000000000000000000000000000000000..c7418817439b2f071c93a4a6cee831e996123c0b
--- /dev/null
+++ b/docs/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-slate
\ No newline at end of file