Index: /MEMPHYS/devToV8/MEMPHYS/Analysis.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/Analysis.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/Analysis.hh	(revision 370)
@@ -0,0 +1,37 @@
+#ifndef MEMPHYS_Analysis_h
+#define MEMPHYS_Analysis_h
+
+// Inheritance :
+#include <MEMPHYS/IAppManager.hh>
+
+#include <string>
+
+namespace AIDA {
+ class IAnalysisFactory;
+ class ITree;
+}
+
+//JEC 10/1/06 introduction
+namespace MEMPHYS {
+
+class Analysis  : public virtual IAppManager {
+  public: //IAppManager
+    virtual void closeTree();         
+    virtual bool initialize() {return true;}
+  public:        
+    Analysis(AIDA::IAnalysisFactory*,
+             const std::string& format = "",
+             bool aBatch = true);
+    virtual ~Analysis();
+
+    //Get tree pointer
+    AIDA::ITree* tree() const {return fTree;}
+
+  private:
+    AIDA::IAnalysisFactory* fAIDA;
+    bool fBatch;
+    AIDA::ITree* fTree;
+};
+
+}
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/Cast.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/Cast.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/Cast.hh	(revision 370)
@@ -0,0 +1,7 @@
+#ifndef MEMPHYS_Cast_h
+#define MEMPHYS_Cast_h
+
+#define CAST(aObject,aClass) (aClass*)(aObject)->cast(#aClass)
+
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/DetectorConstruction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/DetectorConstruction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/DetectorConstruction.hh	(revision 370)
@@ -0,0 +1,247 @@
+#ifndef MEMPHYSDetectorConstruction_H
+#define MEMPHYSDetectorConstruction_H 1
+
+//Geant4
+#include "G4Transform3D.hh"
+#include "G4VUserDetectorConstruction.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4OpticalSurface.hh"
+#include "globals.hh"
+
+//std
+#include <fstream>
+#include <map>
+#include <string>
+
+class G4Box;
+class G4Tubs;
+class G4Material;
+class G4LogicalVolume;
+class G4AssemblyVolume;
+class G4VPhysicalVolume;
+
+
+
+
+namespace AIDA {
+  class ITuple;
+}
+
+namespace MEMPHYS {
+
+class Analysis; 
+class DetectorMessenger;
+class WCSD;
+class Analysis; 
+
+
+enum cyl_location {endcap1,wall,endcap2}; //geographical position of the PMTs
+
+
+class DetectorConstruction : public G4VUserDetectorConstruction {
+ public:
+
+  DetectorConstruction(Analysis&);
+  virtual ~DetectorConstruction();
+  
+  G4VPhysicalVolume* Construct();
+
+  // Related to the WC geometry
+  void Set20inchPMTGeometry(); //JEC is obsolete according to M.F but code is still valid(?)
+  void Set8inchPMTGeometry();
+  void Set12inchPMTGeometry(); //JEC 26/1/06 
+  void SetRockGeometry();
+  void UpdateGeometry();
+
+  G4double GetWaterTubeLength()   {return WCLength;}
+  G4double GetWaterTubePosition() {return WCPosition;}
+  G4double GetPMTSize()           {return WCPMTRadius;}
+  G4double GetRockThickness()     {return RockThickness;}
+  //JEC FIXME not used G4int    GetMyConfiguration()   {return myConfiguration;}
+
+  // Related to the WC tube IDs
+  //JEC 25/1/06 no more static functions + const char*
+  G4int GetTubeID(std::string tubeTag);
+  G4Transform3D GetTubeTransform(int tubeNo){return tubeIDMap[tubeNo];}
+
+private:
+
+  // The Construction routines
+  G4LogicalVolume*   ConstructWC();
+  void               ConstructRock(G4LogicalVolume* logicExpHall, G4bool RockIsVisible);
+  void               ConstructMaterials();
+
+  // Code for traversing the geometry and assigning tubeIDs.
+  // First make a typedef for the pointer to the member fcn.  The
+  // syntax is too wacked out to be using all over.
+
+  typedef void (DetectorConstruction::*DescriptionFcnPtr) (G4VPhysicalVolume*, 
+							   int, int, const G4Transform3D&);
+
+  // Now Funcs for traversing the geometry
+  void TraverseReplicas(G4VPhysicalVolume*, int, const G4Transform3D&, DescriptionFcnPtr);
+
+  void DescribeAndDescendGeometry(G4VPhysicalVolume*, int, int, const G4Transform3D&, DescriptionFcnPtr);
+
+  // Functions that the traversal routines call or we use to manipulate the
+  // data we accumulate.
+  void DumpGeometryTableToFile(); //JEC FIXME deprecated use FillGeometryTuple
+  void FillGeometryTuple();
+
+  void PrintGeometryTree(G4VPhysicalVolume*, int, int, const G4Transform3D&);
+  void DescribeAndRegisterPMT(G4VPhysicalVolume*, int, int, const G4Transform3D&);
+  void GetWCGeom(G4VPhysicalVolume*, int, int, const G4Transform3D&);
+
+
+  //JEC FIXME is it necessary to maintain fAnalysis?
+  Analysis&  fAnalysis;            //the Analysis JEC 18/11/05
+  AIDA::ITuple*     geomTuple;            //the Geometry tuple
+
+  // Sensitive Detectors. We declare the pointers here because we need
+  // to check their state if we change the geometry.
+  WCSD*  aWCPMT;
+
+  //Water, Blacksheet surface
+  G4OpticalSurface * OpWaterBSSurface;
+
+  //Glass, Cathode surface in PMTs
+  G4OpticalSurface * OpGlassCathodeSurface;
+
+
+  // The messenger we use to change the geometry.
+  DetectorMessenger* messenger;
+
+
+  //---Volume lengths
+
+  // These are shared between the different member functions 
+  // constructWC
+
+  G4int RockChoice;
+
+  G4double WCLength;
+  G4double RockLength;
+
+  G4double WCPosition;
+  G4double RockPosition;
+
+  // WC geometry parameters
+
+  G4double WCPMTRadius;
+  G4double WCDiameter;
+  G4double WCRadius;
+  G4double WCBarrelPMTBlackSheetDist;
+  G4double WCCapPMTBlackSheetDist;
+  G4double WCCapLength;
+  G4double WCBackODLength;
+  G4double WCFrontODLength;
+  G4double WCBarrelLength;
+  G4double WCBarrelRingRadius;
+  G4double WCBarrelPMTRadius;
+  G4int    WCBarrelRingNPhi;
+  G4double WCBarrelRingdPhi;
+  G4int    WCBarrelNRings;
+  G4double WCBarrelCellLength;
+  G4int    WCCapNCell;
+  G4double WCCapCellSize;
+  G4double WCCapSquareSide;
+  G4double WCCapSquareDiag;
+  G4double WCCapEdgeWidth;
+  G4double WCCapEdgeLimit;
+  G4double WCPMTGlassThickness;
+  G4double WCBlackSheetThickness;
+
+  // Variables related to the geometry
+
+  //  std::ofstream geoFile;   // File for text output
+  G4int totalNumPMTs;      // The number of PMTs for this configuration     
+  G4double WCCylInfo[2];    // Info for the geometry tree: radius & length
+  G4double WCPMTSize;       // Info for the geometry tree: pmt size
+  G4ThreeVector WCOffset;   // Info for the geometry tree: WC center offset
+
+  // Tube map information
+  //JEC 25/1/06 no more static variables
+  std::map<int, G4Transform3D> tubeIDMap;
+  std::map<int, cyl_location> tubeCylLocation;
+  std::map<std::string, int>  tubeLocationMap; //JEC 25/1/06 use a map standard
+
+  // Variable related to the rock
+  G4double RockThickness;
+  G4double RockUpstreamLength_z;
+  G4double RockDownstreamLength_z;
+ 
+  G4double RockMotherVolLength_x;
+  G4double RockMotherVolLength_y;
+  G4double RockMotherVolLength_z;
+
+  G4double RockUpstreamHallRadius;
+
+  G4double RockCentralHallLength_x;
+  G4double RockCentralHallLength_y;
+  G4double RockCentralHallLength_z;
+
+  G4double RockUpHallouterRadiusTube;
+  G4double RockUpHallinnerRadiusTube;
+  G4double RockUpHallhightTube;
+  G4double RockUpHallstartAngleTube;
+  G4double RockUpHallspanningAngleTube;
+ 
+  G4double RockDownHallLength_x;
+  G4double RockDownHallLength_y;
+  G4double RockDownHallLength_z;
+
+  G4double RockUpHallTubePosition_y;
+  G4double RockUpHallTubePosition_z;
+
+  G4double RockTmpBox1Length_x;
+  G4double RockTmpBox1Length_y;
+  G4double RockTmpBox1Length_z;
+
+  G4double RockCeilingLength_x;
+  G4double RockCeilingLength_y;
+  G4double RockCeilingLength_z;
+
+
+  G4ThreeVector RockMotherPosition;
+  G4ThreeVector RockCentralHallPosition;
+  G4ThreeVector RockDownHallPosition;
+  G4ThreeVector RockCenterHallrelativeMomPosition;
+  G4ThreeVector RockCeilingPosition;
+
+  G4double RockCentralHallPosition_y;
+  G4double RockCentralHallPosition_z;
+  G4double RockMotherPosition_y;
+  G4double RockMotherPosition_z;
+  G4double RockDownHallPosition_y;
+  G4double RockDownHallPosition_z;
+
+  G4ThreeVector RockUpHallTubePosition;
+  G4ThreeVector RockTmpBox1relativeUpHallTubePosition;
+  G4ThreeVector RockUpHallTuberelativeCentralHallPosition;
+  G4ThreeVector RockDownHallrelativeCentralHallPosition;
+  G4ThreeVector RockDownrelativeMomPosition;
+  G4ThreeVector RockUpHallrelativeCeilingPosition;
+
+  G4double RockUpHallShift;
+
+
+  G4double GapRockUpstreamlAr;                 //JEC FIXME 
+  G4double GapRockDownstreamMRDScint;          //JEC FIXME
+  G4double lArDLength;                         //JEC FIXME
+
+  // Variables related to configuration
+
+  //JEC FIXME not used G4int myConfiguration;   // Detector Config Parameter
+ 
+  // Rock related variable
+  G4double RockUpstreamPosition; // RockUpstream z-position from WC center
+  G4double RockDownstreamPosition; // RockDownstream z-position from WC center
+  
+};
+
+}
+
+
+#endif
+
Index: /MEMPHYS/devToV8/MEMPHYS/DetectorMessenger.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/DetectorMessenger.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/DetectorMessenger.hh	(revision 370)
@@ -0,0 +1,42 @@
+#ifndef MEMPHYSDetectorMessenger_h
+#define MEMPHYSDetectorMessenger_h 1
+
+
+#include "G4UImessenger.hh"
+#include "globals.hh"
+#include "G4ios.hh"
+#include "G4UImessenger.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithADouble.hh"
+
+
+class G4UIdirectory;
+class G4UIcmdWithAString;
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class DetectorConstruction;
+
+
+class DetectorMessenger: public G4UImessenger {
+ public:
+  DetectorMessenger(DetectorConstruction* mpga);
+  virtual ~DetectorMessenger();
+  
+ public:
+  void         SetNewValue(G4UIcommand* command, G4String newValues);
+ 
+ private:
+  DetectorConstruction* MEMPHYSDetector;
+
+ private: //commands
+  
+  G4UIdirectory*      MEMPHYSDir;
+  G4UIcmdWithAString* PMTConfig;
+};
+
+}
+#endif
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/DigitsCollectionAccessor.h
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/DigitsCollectionAccessor.h	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/DigitsCollectionAccessor.h	(revision 370)
@@ -0,0 +1,128 @@
+#ifndef MEMPHYS_DigitsCollectionAccessor_h
+#define MEMPHYS_DigitsCollectionAccessor_h
+
+// Inheritance :
+#include <G4Lab/Version.h>
+#if (G4LAB_MAJOR_VERSION<=8) && (G4LAB_MINOR_VERSION<=0)
+// GB : 2/June/2007.
+// There is a problem with the constructor of 
+// the template G4Lab::DigitsCollectionAccessor 
+// coming with the osc_g4/v16r0 distrib. 
+// It lacks the G4RunManager* in second argument.
+// To bypass this problem we use a corrected
+// local copy of G4Lab/DigitsCollectionAccessor.h.
+// It should be fixed with osc_g4/v16r1.
+#include <MEMPHYS/G4Lab_DigitsCollectionAccessor.h>
+#else
+#include <G4Lab/DigitsCollectionAccessor.h>
+#endif
+
+namespace MEMPHYS {
+
+template <class T> 
+class DigitsCollectionAccessor : public G4Lab::DigitsCollectionAccessor<T> {
+public: //Slash::Data::IVisualizer
+  virtual void visualize(Slash::Data::IAccessor::Data,void*);
+public:
+  DigitsCollectionAccessor(Slash::Core::ISession& aSession,
+                           G4RunManager* aRunManager,
+                           const std::string& aName = "")
+  :G4Lab::DigitsCollectionAccessor<T>(aSession,aRunManager,aName){}
+  virtual ~DigitsCollectionAccessor(){}
+};
+
+}
+
+// Inventor :
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoTransform.h>
+#include <Inventor/nodes/SoLightModel.h>
+#include <Inventor/nodes/SoDrawStyle.h>
+#include <Inventor/nodes/SoCube.h> //FIXME
+
+// HEPVis :
+#include <HEPVis/misc/SoStyleCache.h>
+#include <HEPVis/nodes/SoHighlightMaterial.h>
+
+// Geant4 :
+#include <G4LogicalVolume.hh>
+#include <G4Transform3D.hh>
+#include <G4VDigi.hh>
+
+// G4Lab :
+#include <G4Lab/Transform3D.h>
+
+namespace MEMPHYS {
+
+//////////////////////////////////////////////////////////////////////////////
+template <class T> 
+void DigitsCollectionAccessor<T>::visualize(
+ Slash::Data::IAccessor::Data aData
+,void*
+) 
+//////////////////////////////////////////////////////////////////////////////
+// The digi must have the "LV" and "TSF" AttDef.
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  G4VDigi* obj = (G4VDigi*)aData;  
+  G4LogicalVolume* lv = 
+    G4Lab::DigitsCollectionBaseAccessor::digiLogicalVolume(*obj);
+  if(!lv) return;
+  G4Transform3D* tsf = 
+    G4Lab::DigitsCollectionBaseAccessor::digiTransform3D(*obj);
+  if(!tsf) return;
+  G4VSolid* solid = lv->GetSolid();
+  if(!solid) return;
+  //G4Material* material = lv->GetMaterial();
+
+  SoSeparator* separator = new SoSeparator;
+  separator->setName("sceneGraph");
+      
+ {G4Colour color;
+  SoGC& f_SoGC = this->soGC();
+  if(G4Lab::DigitsCollectionBaseAccessor::digiColor(*obj,color)) {
+    SbColor sbColor((float)color.GetRed(),
+                    (float)color.GetGreen(),
+                    (float)color.GetBlue());
+    float transp = 1.0F - (float)color.GetAlpha();
+    SoStyleCache* styleCache = f_SoGC.getStyleCache();
+    separator->addChild(
+      styleCache->getHighlightMaterial
+      (sbColor,f_SoGC.getHighlightColor(),transp));
+  } else {
+    separator->addChild(f_SoGC.getHighlightMaterial());
+  }
+  separator->addChild(f_SoGC.getDrawStyle());
+  separator->addChild(f_SoGC.getLightModel());}
+
+ {SoTransform* transform = new SoTransform;
+  G4Lab::Transform3D* t = new G4Lab::Transform3D(*tsf);
+  SbMatrix* matrix = t->getMatrix();
+  transform->setMatrix(*matrix);
+  delete matrix;
+  delete t;
+  separator->addChild(transform);}
+          
+  // Build name (for picking) :
+  std::string s;
+  Lib::smanip::printf(s,128,"%s/0x%lx",
+		      this->DCName().c_str(),(unsigned long)obj);
+  SbName name(s.c_str());
+        
+  double WCPMTRadius           = 0.10*m;  // 20-cm PMTs (8-inch)
+
+  SoCube* soCube = new SoCube;
+  soCube->width.setValue(WCPMTRadius);
+  soCube->height.setValue(WCPMTRadius);
+  soCube->depth.setValue(WCPMTRadius);
+  soCube->setName(name);
+        
+  separator->addChild(soCube);
+          
+  this->soRegion()->doIt(SbAddNode(separator,"dynamicScene"));
+}
+
+}
+
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/EventAction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/EventAction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/EventAction.hh	(revision 370)
@@ -0,0 +1,64 @@
+#ifndef MEMPHYSEventAction_h
+#define MEMPHYSEventAction_h 1
+
+//Geant4
+#include "G4UserEventAction.hh"
+#include "G4ThreeVector.hh"
+#include "G4Types.hh"
+#include "G4ios.hh"
+
+//MEMPHYS
+#include "MEMPHYS/DetectorConstruction.hh"
+#include "MEMPHYS/WCHit.hh"
+#include "MEMPHYS/WCDigi.hh"
+
+
+class G4Event;
+
+//JEC 10/11/05 introduce AIDA
+namespace AIDA {
+  class ITuple;
+}
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class Analysis; 
+class RunAction;
+class PrimaryGeneratorAction;
+
+class EventAction : public G4UserEventAction {
+  
+ public:
+  EventAction(Analysis&,
+	      RunAction*, 
+	      DetectorConstruction*,
+	      PrimaryGeneratorAction*);
+  virtual ~EventAction();
+  
+ public:
+  void BeginOfEventAction(const G4Event*);
+  void EndOfEventAction(const G4Event*);
+  
+  RunAction* GetRunAction(){return runAction;}
+  
+ private:
+  G4int EventFindStartingVolume(G4ThreeVector vtx);
+  G4int EventFindStoppingVolume(G4String stopVolumeName);
+  
+ private:
+  //JEC FIXME is it necessary to maintain fAnalysis?
+  Analysis&               fAnalysis;            //the Analysis
+  RunAction*              runAction;            //the Run
+  PrimaryGeneratorAction* generatorAction;      //the Generator 
+  DetectorConstruction*   detectorConstructor;  //the Detector
+
+  AIDA::ITuple*           eventTuple;           //the Event tuple
+  AIDA::ITuple*           hitTimeTuple;         //the Hit Time tuple JEC 5/4/06
+
+};
+
+}
+
+#endif
+
+    
Index: /MEMPHYS/devToV8/MEMPHYS/G4Lab_DigitsCollectionAccessor.h
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/G4Lab_DigitsCollectionAccessor.h	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/G4Lab_DigitsCollectionAccessor.h	(revision 370)
@@ -0,0 +1,112 @@
+// GB : 2/June/2007.
+// There is a problem with the constructor of 
+// the template G4Lab::DigitsCollectionAccessor 
+// coming with the osc_g4/v16r0 distrib
+// and used in MEMPHYS::DigitsCollectionAccessor.
+// It lacks the G4RunManager* in second argument.
+// To bypass this problem we use a corrected
+// local copy of G4Lab/DigitsCollectionAccessor.h.
+// It should be fixed with osc_g4/v16r1.
+
+#ifndef G4Lab_DigitsCollectionAccessor_h
+#define G4Lab_DigitsCollectionAccessor_h
+
+// Inheritance :
+#include <OnX/Inventor/InventorAccessor.h>
+
+#include <G4Transform3D.hh>
+
+class G4VDigiCollection;
+class G4VDigi;
+class G4LogicalVolume;
+class G4Colour;
+class G4RunManager;
+
+namespace Slash {namespace Core {class ISession;}}
+namespace Slash {namespace Core {class IWriter;}}
+
+#include <map>
+#include <G4AttDef.hh>
+#include <G4String.hh>
+
+namespace G4Lab {
+
+class DigitsCollectionBaseAccessor : public OnX::InventorAccessor {
+public: //Slash::Data::IAccessor
+  virtual std::string name() const;
+  virtual Slash::Core::IValue* findValue(Slash::Data::IAccessor::Data,const std::string&,void*);
+public: //Slash::Data::IVisualizer
+  virtual void beginVisualize();
+  virtual void visualize(Slash::Data::IAccessor::Data,void*);
+public:
+  DigitsCollectionBaseAccessor(Slash::Core::ISession&,G4RunManager*,
+                               const std::string& = "");
+  virtual ~DigitsCollectionBaseAccessor();
+  const std::string& DCName() const;
+protected:
+  static G4LogicalVolume* digiLogicalVolume(const G4VDigi&); 
+  static G4Transform3D* digiTransform3D(const G4VDigi&); 
+  static bool digiColor(const G4VDigi&,G4Colour&); 
+  void setProperties(G4VDigi&); 
+protected:
+  G4VDigiCollection* getCollection(Slash::Core::IWriter&,const std::string&);
+protected:
+  std::string fType;
+  G4RunManager* fRunManager;
+  std::map<G4String,G4AttDef>* fAttDefs;
+  std::string fDC;
+};
+
+}
+
+#include <G4VDigi.hh>
+#include <G4TDigiCollection.hh>
+#include <Slash/Data/IIterator.h>
+
+namespace G4Lab {
+
+template <class T> 
+class DigitsCollectionAccessor : public DigitsCollectionBaseAccessor {
+public: //Slash::Data::IAccessor
+  virtual Slash::Data::IIterator* iterator() {
+    const std::vector<std::string>& args = iteratorArguments();
+    if(args.size()) fDC = args[0];
+    clearProperties();
+    fAttDefs = 0;
+    G4VDigiCollection* vdc = getCollection(printer(),fDC);
+    if(!vdc) return 0;
+    typedef G4TDigiCollection<T> Collection;
+    Collection* dc = dynamic_cast<Collection*>(vdc);
+    if(!dc) return 0;
+    if(dc->entries()) {
+      G4VDigi* digi = (*dc)[0];
+      if(digi) setProperties(*digi);
+    }
+    class Iterator : public virtual Slash::Data::IIterator {
+    public: //Slash::Data::IIterator
+      virtual Slash::Data::IAccessor::Data object() {
+        if(fCurrent>=fVector.entries()) return 0;
+        G4VDigi* digi = fVector[fCurrent];
+        return digi;
+      }
+      virtual void next() { fCurrent++;}
+      virtual void* tag() { return 0;}
+    public:
+      Iterator(Collection& aVector):fVector(aVector),fCurrent(0) {}
+      virtual ~Iterator() {}
+    private:
+      Collection& fVector;
+      int fCurrent;
+    };
+    return new Iterator(*dc);
+  }
+public:
+  DigitsCollectionAccessor(Slash::Core::ISession& aSession,G4RunManager* aRunManager,const std::string& aName = "")
+  :DigitsCollectionBaseAccessor(aSession,aRunManager,aName){}
+  virtual ~DigitsCollectionAccessor(){}
+};
+
+
+}
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/HitsCollectionAccessor.h
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/HitsCollectionAccessor.h	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/HitsCollectionAccessor.h	(revision 370)
@@ -0,0 +1,23 @@
+#ifndef MEMPHYS_HitsCollectionAccessor_h
+#define MEMPHYS_HitsCollectionAccessor_h
+
+// Inheritance :
+#include <G4Lab/HitsCollectionAccessor.h>
+
+class G4RunManager;
+
+namespace MEMPHYS {
+
+class HitsCollectionAccessor : public G4Lab::HitsCollectionAccessor {
+public: //Slash::Data::IVisualizer
+  virtual void visualize(Slash::Data::IAccessor::Data,void*);
+public:
+  HitsCollectionAccessor(Slash::Core::ISession&,
+                         G4RunManager*,
+                         const std::string& = "");
+  virtual ~HitsCollectionAccessor();
+};
+
+}
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/IAppManager.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/IAppManager.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/IAppManager.hh	(revision 370)
@@ -0,0 +1,16 @@
+#ifndef MEMPHYS_IAppManager_hh
+#define MEMPHYS_IAppManager_hh
+
+namespace MEMPHYS {
+
+class IAppManager  {
+public:        
+  virtual ~IAppManager() {}
+public:        
+  virtual void closeTree() = 0;
+  virtual bool initialize() = 0;
+};
+
+}
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/PhysicsList.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/PhysicsList.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/PhysicsList.hh	(revision 370)
@@ -0,0 +1,65 @@
+#ifndef MEMPHYSPhysicsList_h
+#define MEMPHYSPhysicsList_h 1
+
+//Geant4
+#include "G4VUserPhysicsList.hh"
+#include "globals.hh"
+
+//MEMPHYS
+#include "MEMPHYS/PhysicsMessenger.hh"
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+
+class PhysicsList: public G4VUserPhysicsList {
+  public:
+    PhysicsList();
+    virtual ~PhysicsList();
+
+  //=================================
+  // Added by JLR 2005-07-05
+  //=================================
+  // This method sets the model for 
+  // hadronic secondary interactions
+  void SetSecondaryHad(G4String hadval);
+
+  private:
+    PhysicsMessenger* physicsMessenger;
+
+    G4String SecondaryHadModel;
+
+    G4bool gheishahad;
+    G4bool bertinihad;
+    G4bool binaryhad;
+
+  protected:
+    // Construct particle and physics process
+    void ConstructParticle();
+    void ConstructProcess();
+    void SetCuts();
+
+  protected:
+    // these methods Construct particles 
+    void ConstructBosons();
+    void ConstructLeptons();
+    void ConstructMesons();
+    void ConstructBaryons();
+
+  protected:
+    // these methods Construct physics processes and register them
+    void ConstructGeneral();
+    void ConstructEM();
+    void ConstructOp();
+    void ConstructHad();
+};
+
+}
+#endif
+
+
+
+
+
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/PhysicsMessenger.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/PhysicsMessenger.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/PhysicsMessenger.hh	(revision 370)
@@ -0,0 +1,32 @@
+#ifndef MEMPHYSPhysicsMessenger_h
+#define MEMPHYSPhysicsMessenger_h 1
+
+#include "globals.hh"
+#include "G4UImessenger.hh"
+
+class G4UIdirectory;
+class G4UIcommand;
+class G4UIcmdWithAString;
+
+namespace MEMPHYS {
+
+class PhysicsList;
+
+class PhysicsMessenger: public G4UImessenger
+{
+public:
+  PhysicsMessenger(PhysicsList*);
+  virtual ~PhysicsMessenger();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+private:
+  PhysicsList* MEMPHYSPhysics;
+
+  G4UIdirectory*      MEMPHYSDir;
+  G4UIcmdWithAString* hadmodelCmd;
+
+};
+
+}
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/PrimaryGeneratorAction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/PrimaryGeneratorAction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/PrimaryGeneratorAction.hh	(revision 370)
@@ -0,0 +1,126 @@
+#ifndef MEMPHYSPrimaryGeneratorAction_h
+#define MEMPHYSPrimaryGeneratorAction_h
+
+//Geant4
+#include "G4VUserPrimaryGeneratorAction.hh"
+#include "G4ThreeVector.hh"
+#include "globals.hh"
+
+//std
+#include <fstream>
+
+class G4ParticleGun;
+class G4Event;
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class DetectorConstruction;
+class PrimaryGeneratorMessenger;
+
+class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
+ public:
+  PrimaryGeneratorAction(DetectorConstruction*);
+  virtual ~PrimaryGeneratorAction();
+  
+public:
+  void GeneratePrimaries(G4Event* anEvent);
+
+  // Normal gun setting calls these functions to fill jhfNtuple and Root tree
+  void SetVtx(G4ThreeVector i)     { vtx = i; };
+  void SetBeamEnergy(G4double i)   { beamenergy = i; };
+  void SetBeamDir(G4ThreeVector i) { beamdir = i; };
+  void SetBeamPDG(G4int i)         { beampdg = i; };
+
+  // These go with jhfNtuple
+  G4int GetVecRecNumber(){return vecRecNumber;}
+  G4int GetMode() {return mode;};
+  G4int GetVtxVol() {return vtxvol;};
+  G4ThreeVector GetVtx() {return vtx;}
+  G4int GetNpar() {return npar;};
+  G4int GetBeamPDG() {return beampdg;};
+  G4double GetBeamEnergy() {return beamenergy;};
+  G4ThreeVector GetBeamDir() {return beamdir;};
+  G4int GetTargetPDG() {return targetpdg;};
+  G4double GetTargetEnergy() {return targetenergy;};
+  G4ThreeVector GetTargetDir() {return targetdir;};
+
+  // older ...
+  G4double GetNuEnergy() {return nuEnergy;};
+  G4double GetEnergy() {return energy;};
+  G4double GetXPos() {return xPos;};
+  G4double GetYPos() {return yPos;};
+  G4double GetZPos() {return zPos;};
+  G4double GetXDir() {return xDir;};
+  G4double GetYDir() {return yDir;};
+  G4double GetZDir() {return zDir;};
+
+private:
+  DetectorConstruction*      myDetector;
+  G4ParticleGun*                   particleGun;
+  PrimaryGeneratorMessenger* messenger;
+
+  // Variables set by the messenger
+  G4bool   useMulineEvt;
+  G4bool   useNormalEvt;
+  G4bool   usePDKNuancev2;    //JEC 1/06/07
+  G4bool   useNuBeamNuancev2; //JEC 1/06/07
+  std::fstream inputFile;
+  G4String vectorFileName;
+  G4bool   GenerateVertexInRock;
+
+  // These go with jhfNtuple
+  G4int mode;
+  G4int vtxvol;
+  G4ThreeVector vtx;
+  G4int npar;
+  G4int beampdg, targetpdg;
+  G4ThreeVector beamdir, targetdir;
+  G4double beamenergy, targetenergy;
+  G4int vecRecNumber;
+
+  G4double nuEnergy;
+  G4double energy;
+  G4double xPos, yPos, zPos;
+  G4double xDir, yDir, zDir;
+
+  G4int    _counterRock; 
+  G4int    _counterCublic; 
+public:
+  
+  void SetMulineEvtGenerator(G4bool choice) { useMulineEvt = choice; }
+  G4bool IsUsingMulineEvtGenerator() { return useMulineEvt; }
+  
+  void SetNormalEvtGenerator(G4bool choice) { useNormalEvt = choice; }
+  G4bool IsUsingNormalEvtGenerator()  { return useNormalEvt; }
+  
+  //JEC 01/06/07
+  void SetPDKNuancev2(G4bool choice) { usePDKNuancev2 = choice; }
+  G4bool IsUsingPDKNuancev2() { return usePDKNuancev2; } 
+  
+  //JEC 01/06/07
+  void SetNuBeamNuancev2(G4bool choice) { useNuBeamNuancev2 = choice; }
+  G4bool IsUsingNuBeamNuancev2() { return useNuBeamNuancev2; } 
+
+
+  void OpenVectorFile(G4String fileName) {
+    if ( inputFile.is_open() ) inputFile.close();
+    //    vectorFileName = fileName;
+    //inputFile.open(vectorFileName, std::fstream::in);
+    inputFile.open(fileName, std::fstream::in);
+    if ( !inputFile.is_open() ) {
+      G4cout << "PrimaryGeneratorAction::OpenVectorFile: FATAL: " << fileName << " not found"
+	     << G4endl;
+      exit(0);
+    }
+  }
+  G4bool IsGeneratingVertexInRock() { return GenerateVertexInRock; }
+  void SetGenerateVertexInRock(G4bool choice) { GenerateVertexInRock = choice;}
+};
+
+
+}
+
+#endif
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/PrimaryGeneratorMessenger.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/PrimaryGeneratorMessenger.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/PrimaryGeneratorMessenger.hh	(revision 370)
@@ -0,0 +1,41 @@
+#ifndef MEMPHYSPrimaryGeneratorMessenger_h
+#define MEMPHYSPrimaryGeneratorMessenger_h 1
+
+//Geant4
+#include "G4UImessenger.hh"
+#include "globals.hh"
+
+class G4UIdirectory;
+class G4UIcmdWithABool;
+class G4UIcmdWithAString;
+
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class PrimaryGeneratorAction;
+
+
+class PrimaryGeneratorMessenger: public G4UImessenger {
+ public:
+  PrimaryGeneratorMessenger(PrimaryGeneratorAction* mpga);
+  virtual ~PrimaryGeneratorMessenger();
+  
+ public:
+  void     SetNewValue(G4UIcommand* command, G4String newValues);
+  G4String GetCurrentValue(G4UIcommand* command);
+  
+ private:
+  PrimaryGeneratorAction* myAction;
+  
+ private: //commands
+  G4UIdirectory*      mydetDirectory;
+  G4UIcmdWithAString* genCmd;
+  G4UIcmdWithAString* fileNameCmd;
+  G4UIcmdWithABool*   pdkNuanceCmd;
+  G4UIcmdWithABool*  beamNuanceCmd;
+};
+}
+#endif
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/RunAction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/RunAction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/RunAction.hh	(revision 370)
@@ -0,0 +1,41 @@
+#ifndef MEMPHYSRunAction_h
+#define MEMPHYSRunAction_h 1
+
+//Geant4
+#include "G4UserRunAction.hh"
+#include "globals.hh"
+#include "G4String.hh"
+
+class G4Run;
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class RunActionMessenger;
+
+class RunAction : public G4UserRunAction {
+public:
+  RunAction();
+  virtual ~RunAction();
+
+public:
+  void BeginOfRunAction(const G4Run*);
+  void EndOfRunAction(const G4Run*);
+
+  int  GetNumberOfEventsGenerated() { return numberOfEventsGenerated;}
+  void incrementEventsGenerated() { numberOfEventsGenerated++;}
+  void incrementWaterTubeHits()   { numberOfTimesWaterTubeHit++;}  
+  void incrementCatcherHits()     { numberOfTimesCatcherHit++;}
+  void incrementRockHits()        { numberOfTimesRockHit++;}
+
+private:
+
+  int numberOfEventsGenerated;
+  int numberOfTimesWaterTubeHit;
+  int numberOfTimesCatcherHit;
+  int numberOfTimesRockHit;
+
+  RunActionMessenger* messenger;
+};
+}
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/RunActionMessenger.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/RunActionMessenger.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/RunActionMessenger.hh	(revision 370)
@@ -0,0 +1,34 @@
+#ifndef MEMPHYSRunActionMessenger_h
+#define MEMPHYSRunActionMessenger_h 1
+
+//Geant4
+#include "G4UImessenger.hh"
+#include "globals.hh"
+
+class G4UIdirectory;
+class G4UIcmdWithAString;
+
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class RunAction;
+
+class RunActionMessenger: public G4UImessenger {
+ public:
+  RunActionMessenger(RunAction* mpga);
+  virtual ~RunActionMessenger();
+  
+ public:
+  void     SetNewValue(G4UIcommand* command, G4String newValues);
+  
+ private:
+  RunAction* MEMPHYSRun;
+  
+ private: //commands
+  G4UIdirectory*      MEMPHYSIODir;
+};
+}
+#endif
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/StackingAction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/StackingAction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/StackingAction.hh	(revision 370)
@@ -0,0 +1,26 @@
+#ifndef MEMPHYSStackingAction_H
+#define MEMPHYSStackingAction_H 1
+
+//Geant4
+#include "globals.hh"
+#include "G4UserStackingAction.hh"
+
+class G4Track;
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class StackingAction : public G4UserStackingAction {
+
+  public:
+    StackingAction();
+    virtual ~StackingAction();
+
+  public:
+    virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
+    virtual void NewStage();
+    virtual void PrepareNewEvent();
+};
+}
+#endif
+
Index: /MEMPHYS/devToV8/MEMPHYS/SteppingAction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/SteppingAction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/SteppingAction.hh	(revision 370)
@@ -0,0 +1,26 @@
+#ifndef MEMPHYSSteppingAction_H
+#define MEMPHYSSteppingACtion_H 1
+
+//Geant 4
+#include "globals.hh"
+#include "G4UserSteppingAction.hh"
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class SteppingAction : public G4UserSteppingAction
+{
+public:
+  SteppingAction();
+  virtual ~SteppingAction();
+  virtual void UserSteppingAction(const G4Step*);
+
+  //  void SetOneStepPrimaries(G4bool b){oneStepPrimaries=b;}
+  // G4bool GetOneStepPrimaries(){return oneStepPrimaries;}
+  
+private:
+
+  // G4bool oneStepPrimaries;
+};
+}
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/TrackInformation.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/TrackInformation.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/TrackInformation.hh	(revision 370)
@@ -0,0 +1,87 @@
+#ifndef MEMPHYSTrackInformation_h
+#define MEMPHYSTrackInformation_h 1
+
+
+#include "globals.hh"
+#include "G4Track.hh"
+#include "G4Allocator.hh"
+#include "G4VUserTrackInformation.hh"
+
+//JEC 14/12/05: use code from G4 extended optical LXe example
+//for Track Status
+
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+enum TrackStatus { active=1, hitPMT=2, absorbed=4, boundaryAbsorbed=8,
+		    inactive=14};
+
+/*TrackStatus:
+  active: still being tracked
+  hitPMT: stopped by being detected in a PMT
+  absorbed: stopped by being absorbed with G4OpAbsorbtion
+  boundaryAbsorbed: stopped by being aborbed with G4OpAbsorbtion
+  hitSphere: track hit the sphere at some point
+  inactive: track is stopped for some reason
+   -This is the sum of all stopped flags so can be used to remove stopped flags
+  
+ */
+
+class TrackInformation : public G4VUserTrackInformation {
+
+public:
+  TrackInformation(): saveit(false), drawit(false), status(active) {}
+  //  TrackInformation(const TrackInformation* aninfo) 
+  // { saveit = aninfo->saveit;}
+  TrackInformation(const G4Track*);
+  virtual ~TrackInformation() {}
+  
+  inline void *operator new(size_t);
+  inline void operator delete(void *aTrackInfo);
+  inline int operator ==(const TrackInformation& right) const
+  {return (this==&right);}
+
+  
+  //Sets the track status to s (does not check validity of flags)
+  void SetTrackStatusFlags(G4int s){status=s;}
+  //Does a smart add of track status flags (disabling old flags that conflict)
+  //If s conflicts with itself it will not be detected
+  void AddTrackStatusFlag(G4int s);
+  int GetTrackStatus()  {return status;}
+
+  void SetDrawOption(G4bool b) {drawit = b;}
+  G4bool GetDrawOption() {return drawit;}
+
+  void SetSaveOption(G4bool b) {saveit = b;}
+  G4bool GetSaveOption() {return saveit;}
+
+
+  void Print() const;
+
+
+private:
+  G4bool saveit; 
+  G4bool drawit;
+  G4int  status; 
+
+};
+}
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+  extern G4Allocator<TrackInformation> aTrackInfoAllocator;
+}
+
+inline void* MEMPHYS::TrackInformation::operator new(size_t) { 
+  void* aTrackInfo;
+  aTrackInfo = (void*)MEMPHYS::aTrackInfoAllocator.MallocSingle();
+  return aTrackInfo;
+}
+
+inline void MEMPHYS::TrackInformation::operator delete(void *aTrackInfo){ 
+  MEMPHYS::aTrackInfoAllocator.FreeSingle((MEMPHYS::TrackInformation*)aTrackInfo);
+}
+
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/TrackingAction.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/TrackingAction.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/TrackingAction.hh	(revision 370)
@@ -0,0 +1,45 @@
+#ifndef MEMPHYSTrackingAction_h
+#define MEMPHYSTrackingAction_h
+
+//Geant4
+#include "G4UserTrackingAction.hh"
+#include "globals.hh"
+
+//std
+#include <set>
+
+
+class G4Track;
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class TrackingActionMessenger; //JEC 24/1/06 to add a switch for optical photon display 
+
+class TrackingAction : public G4UserTrackingAction {
+ public:
+  TrackingAction();
+  virtual ~TrackingAction();
+
+  void PreUserTrackingAction (const G4Track* aTrack);
+  void PostUserTrackingAction(const G4Track* aTrack);
+
+  //JEC 24/1/06
+  void SetDrawOpticalPhoton(bool value) {drawOpticalPhoton = value;}
+
+private:
+  std::set<G4String> ProcessList;
+  std::set<G4int> ParticleList;
+
+
+  
+  //JEC 24/1/06 
+  TrackingActionMessenger* messenger; 
+  G4bool drawOpticalPhoton;
+  
+};
+}
+
+#endif
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/TrackingActionMessenger.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/TrackingActionMessenger.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/TrackingActionMessenger.hh	(revision 370)
@@ -0,0 +1,33 @@
+#ifndef MEMPHYSTrackingActionMessenger_h
+#define MEMPHYSTrackingActionMessenger_h 1
+
+#include "globals.hh"
+#include "G4UImessenger.hh"
+
+class G4UIdirectory;
+class G4UIcommand;
+class G4UIcmdWithABool;
+
+namespace MEMPHYS {
+
+class TrackingAction;
+
+class TrackingActionMessenger:  public G4UImessenger {
+ public:
+  TrackingActionMessenger(TrackingAction*);
+  virtual ~TrackingActionMessenger();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+private:
+  TrackingAction* MEMPHYSTrackingAction;
+
+  G4UIdirectory*      MEMPHYSDir;
+  G4UIcmdWithABool*   drawOpticalPhotonCmd;
+
+};
+}
+
+
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/Trajectory.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/Trajectory.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/Trajectory.hh	(revision 370)
@@ -0,0 +1,126 @@
+//JEC FIXME: what a forward declaration like that!!!   class MEMPHYSTrajectory;
+#ifndef MEMPHYSTrajectory_h
+#define MEMPHYSTrajectory_h 1
+
+//Geant4 
+#include "G4VTrajectory.hh"
+#include "G4Allocator.hh"
+#include "G4ios.hh"
+#include "globals.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4TrajectoryPoint.hh"
+#include "G4Track.hh"
+#include "G4Step.hh"
+
+//std
+#include <stdlib.h>
+#include <vector>
+
+
+class G4Polyline;
+
+typedef std::vector<G4VTrajectoryPoint*>  TrajectoryPointContainer;
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+
+class Trajectory : public G4VTrajectory {
+
+ public:
+
+  
+  // Constructor/Destrcutor
+   Trajectory();
+   Trajectory(const G4Track* aTrack);
+   Trajectory(Trajectory &);
+
+   virtual ~Trajectory();
+
+  // Operators
+  inline void* operator new(size_t);
+  inline void  operator delete(void*);
+  inline int operator == (const Trajectory& right) const
+  {return (this==&right);} 
+
+  //inherited methods 
+  virtual G4int GetTrackID() const { return fTrackID; }
+  virtual G4int GetParentID() const { return fParentID; }
+  virtual G4String GetParticleName() const { return ParticleName; }
+  virtual G4double GetCharge() const { return PDGCharge; }
+  virtual G4int GetPDGEncoding() const { return PDGEncoding; }
+  virtual G4ThreeVector GetInitialMomentum() const { return initialMomentum; }
+  virtual int GetPointEntries() const { return positionRecord->size(); }
+  virtual G4VTrajectoryPoint* GetPoint(G4int i) const 
+  { return (*positionRecord)[i]; }
+  //JEC FIXME what to do with these Show/Draw routines...
+  virtual void ShowTrajectory(std::ostream& os=G4cout) const;
+  virtual void DrawTrajectory(G4int i_mode=0) const;
+
+  //Used by G.Barrand (not yet 6/4/06)
+  virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
+  virtual std::vector<G4AttValue>* CreateAttValues() const;
+
+
+  //Other Get/Set
+  G4ParticleDefinition* GetParticleDefinition();
+
+  inline G4String GetCreatorProcessName() const { return creatorProcess; }
+  inline G4double GetGlobalTime() const { return globalTime; }
+
+  inline G4bool GetSaveFlag() const { return SaveIt; }
+  inline void SetSaveFlag(G4bool value) { SaveIt = value; }
+
+  inline G4ThreeVector GetStoppingPoint() const { return stoppingPoint; }
+  inline void SetStoppingPoint(G4ThreeVector& currentPosition) 
+  { stoppingPoint = currentPosition;}
+
+  inline G4VPhysicalVolume* GetStoppingVolume() const { return stoppingVolume;}
+  inline void SetStoppingVolume(G4VPhysicalVolume* currentVolume)
+  { stoppingVolume = currentVolume;}
+
+
+  // Other member functions
+  virtual void AppendStep(const G4Step* aStep);
+  virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
+
+
+
+ private:
+
+  TrajectoryPointContainer* positionRecord;
+  G4int                     fTrackID;
+  G4int                     fParentID;
+  G4int                     PDGEncoding;
+  G4double                  PDGCharge;
+  G4String                  ParticleName;
+  G4ThreeVector             initialMomentum;
+
+  G4ThreeVector             stoppingPoint;
+  G4VPhysicalVolume         *stoppingVolume;
+
+  G4bool                    SaveIt;
+  G4String                  creatorProcess;
+  G4double                  globalTime;
+};
+}
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+  extern G4Allocator<Trajectory> myTrajectoryAllocator;
+}
+
+inline void* MEMPHYS::Trajectory::operator new(size_t)
+{
+  void* aTrajectory;
+  aTrajectory = (void*)MEMPHYS::myTrajectoryAllocator.MallocSingle();
+  return aTrajectory;
+}
+
+inline void MEMPHYS::Trajectory::operator delete(void* aTrajectory)
+{
+  MEMPHYS::myTrajectoryAllocator.FreeSingle((MEMPHYS::Trajectory*)aTrajectory);
+}
+
+#endif
+
Index: /MEMPHYS/devToV8/MEMPHYS/WCDigi.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/WCDigi.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/WCDigi.hh	(revision 370)
@@ -0,0 +1,98 @@
+#ifndef MEMPHYSWCDigi_h
+#define MEMPHYSWCDigi_h 1
+
+#include "G4VDigi.hh"
+#include "G4TDigiCollection.hh"
+#include "G4Allocator.hh"
+#include "G4ThreeVector.hh"
+#include "G4Colour.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Transform3D.hh"
+
+//std
+#include <vector>
+
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class WCDigi : public G4VDigi {
+
+public:
+  
+  WCDigi();
+  virtual ~WCDigi();
+  int operator==(const WCDigi&) const;
+  
+  inline void* operator new(size_t);
+  inline void  operator delete(void*);
+  
+  void Draw(); //JEC FIXME what do we do with this?
+  void Print();
+  //JEC 1/12/05 implement same mechanism as Trajectory
+  virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
+  virtual std::vector<G4AttValue>* CreateAttValues() const;
+
+private:
+
+  //JEC make Ctor and assignation private
+  WCDigi(const WCDigi&);
+  const WCDigi& operator=(const WCDigi&);
+  
+  G4int   tubeID;
+  G4float pe;   
+  G4float time; 
+
+  //JEC for vizu
+  G4Colour         colour;
+  G4Transform3D    transform;
+  G4LogicalVolume* pLogV;
+ 
+public:
+  
+  inline void SetTubeID(G4int tube) {tubeID = tube;}
+  inline void SetPe(G4float Q)      {pe     = Q;}
+  inline void SetTime(G4float T)    {time   = T;}
+
+  //JEC 1/12/05 for vizu
+  void SetColour(G4Colour aColour) { colour = aColour; }
+  void UpdateColour() {/* not yet implemented */}
+  inline void SetTransform(G4Transform3D aTrans) { transform = aTrans; }
+  inline void SetLogicalVolume(G4LogicalVolume* logV) {pLogV = logV;}
+
+
+  inline G4int   GetTubeID() {return tubeID;}
+  inline G4float GetPe()     {return pe;}
+  inline G4float GetTime()   {return time;}
+  
+};
+}
+//-----------------------------------------------------------------------
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+  typedef G4TDigiCollection<WCDigi> WCDigitsCollection;
+  extern G4Allocator<WCDigi> WCDigiAllocator;
+}
+
+inline void* MEMPHYS::WCDigi::operator new(size_t) {
+  void* aDigi;
+  aDigi = (void*) MEMPHYS::WCDigiAllocator.MallocSingle();
+  return aDigi;
+}
+
+inline void MEMPHYS::WCDigi::operator delete(void* aDigi) {
+  MEMPHYS::WCDigiAllocator.FreeSingle((MEMPHYS::WCDigi*) aDigi);
+}
+
+#endif
+
+
+
+
+
+
+
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/WCDigitizer.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/WCDigitizer.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/WCDigitizer.hh	(revision 370)
@@ -0,0 +1,83 @@
+#ifndef MEMPHYSWCDigitizer_h
+#define MEMPHYSWCDigitizer_h 1
+
+//Geant4
+#include "G4VDigitizerModule.hh"
+#include "globals.hh"
+#include "Randomize.hh"
+
+//MEMPHYS
+#include "MEMPHYS/WCDigi.hh"
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class WCDigitizer : public G4VDigitizerModule {
+public:
+  
+  WCDigitizer(G4String name);
+  virtual ~WCDigitizer();
+  
+  void SetPMTSize(G4float inputSize) {PMTSize = inputSize;}
+  void Digitize();
+  
+private:
+  static void Threshold(double& pe,int& iflag){
+    double x = pe+0.1; iflag=0;
+    double thr; double RDUMMY,err;
+    if ( x<1.1) {
+      thr = std::min(1.0,
+	     -0.06374+x*(
+	        3.748+x*(
+	       -63.23+x*(
+		452.0+x*(
+	      -1449.0+x*(
+	       2513.0+x*(
+	       -2529.+x*(
+               1472.0+x*(
+               -452.2+x*(
+                51.34+x*2.370))))))))));
+    } else {
+      thr = 1.0;
+    }
+    RDUMMY = G4UniformRand();
+    if (thr < RDUMMY) {
+      pe = 0.0;
+      iflag = 1;
+    } else {
+      err = G4RandGauss::shoot(0.0,0.03);
+      pe = pe+err;
+    }
+  }//Threshold
+
+  //JEC 21/4/06 transfert the static variable here, but FIXME: should be put in a data file
+  static const G4double offset; // hit time offset ns
+  static const G4double pmtgate; // time window to accept hit for a PMT
+  static const G4double eventgateup; //time window for the event
+  static const G4double LongTime;   //arbitrary long time
+  static const G4int    GlobalThreshold; //# of hits to trigger t0 determination
+  
+  static const G4int    TimeHistoMaxBin = 20000; // 20,000*5ns = 100ms: JEC 20/4/06 new var.
+                                                 // maximum number of bins of the trigger histo to determine the t0
+  G4int triggerhisto[TimeHistoMaxBin]; // trigger histo for finding t0
+  static const G4int    TimeHistoStepBin; // time window to count the hits
+  static const G4float  TimeHistoStep; // time bin width of the trigger histo
+
+  G4float RealOffset;  // t0 = offset corrected for trigger start
+  //JEC not used  G4float MinTime;  // very first hit time
+
+  WCDigitsCollection*  DigitsCollection;
+  
+  G4float PMTSize; //not yet used but may be in the future when OD + ID...
+};
+
+}
+#endif
+
+
+
+
+
+
+
+
Index: /MEMPHYS/devToV8/MEMPHYS/WCHit.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/WCHit.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/WCHit.hh	(revision 370)
@@ -0,0 +1,117 @@
+#ifndef MEMPHYSWCHit_h
+#define MEMPHYSWCHit_h 1
+
+//Geant4
+#include "G4VHit.hh"
+#include "G4THitsCollection.hh"
+#include "G4Allocator.hh"
+#include "G4Transform3D.hh"
+#include "G4ThreeVector.hh"
+#include "G4LogicalVolume.hh"
+#include "G4ios.hh"
+#include "G4Colour.hh"
+
+
+//std
+#include <algorithm> // for sort, find, count_if
+#include <functional> //for less_equal, bind2nd,...
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+
+class WCHit : public G4VHit {
+ public:
+  
+  WCHit();
+  virtual ~WCHit();
+  G4int operator==(const WCHit&) const;
+  
+  inline void* operator new(size_t);
+  inline void  operator delete(void*);
+  
+  void Draw(); //JEC FIXME what do we do with this?
+  void Print();
+  //JEC 1/12/05 implement same mechanism as Trajectory
+  virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
+  virtual std::vector<G4AttValue>* CreateAttValues() const;
+
+
+  
+ public:
+  
+  void SetTubeID       (G4int tube)                 { tubeID = tube; }
+  //JEC 6/4/06  void SetTrackID      (G4int track)                { trackID = track; }
+  //JEC 6/4/06  void SetEdep         (G4double de)                { edep = de; }
+  void SetTransform (G4Transform3D aTrans) { transform = aTrans; }
+  void SetLogicalVolume(G4LogicalVolume* logV)      { pLogV = logV;}
+  void SetColour(G4Colour aColour) { colour = aColour; }
+  void UpdateColour(); //modify color at the end of the event
+
+  // This is temporarily used for the drawing scale
+  void SetMaxPe(G4int number = 0)  {maxPe   = number;}
+
+  void AddPe(G4float hitTime);
+  void AddTrk(G4int trackID);                //JEC 6/4/06
+  void AddEdep(G4double energyDeposition);   //JEC 6/4/06 
+
+  G4int         GetTubeID()     { return tubeID; }
+  //obsolete G4int         GetTrackID()    { return trackID; }
+  G4int         GetTotalPe()    { return totalPe;}
+  G4float       GetTime(G4int i)  { return time[i]; }
+  G4int         GetTrack(G4int i) {return trkId[i];}
+  
+  G4Transform3D GetTransform()  { return transform; }
+  G4LogicalVolume* GetLogicalVolume() { return pLogV; }
+  G4Colour GetColour() { return colour; }
+  
+  
+  void SortHitTimes() {   sort(time.begin(),time.end()); }
+  G4int GetPeInGate(double pmtgate,double evgate);
+
+
+ private:
+  WCHit(const WCHit&);
+  const WCHit& operator=(const WCHit&);
+  
+  G4int            tubeID;
+  //JEC 6/4/06 G4int            trackID;
+  //JEC 6/4/06 G4double         edep;
+
+  //JEC to GB
+  G4Colour         colour;
+  G4Transform3D    transform;
+  G4LogicalVolume* pLogV;
+  G4int                 totalPe;
+  std::vector<G4float>    time;
+  std::vector<G4int>    trkId;   //JEC 6/4/06
+  std::vector<G4double> edep; //JEC 6/4/06
+  
+  //for digitization
+  G4int                 totalPeInGate;
+
+  // This is temporarily used for the drawing scale
+  // Since its static *every* WChit sees the same value for this.
+  static G4int     maxPe;
+
+};
+}
+
+//----------------------------------------------------------------
+
+//JEC 10/1/06 introduce MEMPHYS
+namespace MEMPHYS {
+  typedef G4THitsCollection<WCHit> WCHitsCollection;
+  extern G4Allocator<WCHit> WCHitAllocator;
+}
+
+inline void* MEMPHYS::WCHit::operator new(size_t) {
+  void *aHit;
+  aHit = (void *) MEMPHYS::WCHitAllocator.MallocSingle();
+  return aHit;
+}
+
+inline void MEMPHYS::WCHit::operator delete(void *aHit) {
+  MEMPHYS::WCHitAllocator.FreeSingle((MEMPHYS::WCHit*) aHit);
+}
+
+#endif
Index: /MEMPHYS/devToV8/MEMPHYS/WCSD.hh
===================================================================
--- /MEMPHYS/devToV8/MEMPHYS/WCSD.hh	(revision 370)
+++ /MEMPHYS/devToV8/MEMPHYS/WCSD.hh	(revision 370)
@@ -0,0 +1,41 @@
+#ifndef MEMPHYSWCSD_h
+#define MEMPHYSWCSD_h 1
+
+//Geant4
+#include "G4VSensitiveDetector.hh"
+
+//MEMPHYS
+#include "MEMPHYS/WCHit.hh"
+
+class G4Step;
+class G4HCofThisEvent;
+
+namespace MEMPHYS {
+
+class DetectorConstruction; //JEC 25/1/06
+
+
+class WCSD : public G4VSensitiveDetector {
+ public:
+  WCSD(G4String, DetectorConstruction*); //JEC 25/1/06
+  virtual ~WCSD();
+  
+  void   Initialize(G4HCofThisEvent*);
+  G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+  G4bool ProcessHits_constStep(const G4Step*, G4TouchableHistory*);
+  void   EndOfEvent(G4HCofThisEvent*);
+  
+ private:
+
+  WCHitsCollection* hitsCollection;
+  std::map<int,int> PMTHitMap;   // Whether a PMT was hit already
+  G4int HCID;
+
+  
+  DetectorConstruction* MEMPHYSDetConstruction; //JEC 25/1/06
+
+};
+
+}
+#endif
+
Index: /MEMPHYS/devToV8/applications/HitsCollectionAccessor.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/HitsCollectionAccessor.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/HitsCollectionAccessor.cxx	(revision 370)
@@ -0,0 +1,139 @@
+// this :
+#include <MEMPHYS/HitsCollectionAccessor.h>
+
+// Inventor :
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoTransform.h>
+#include <Inventor/nodes/SoLightModel.h>
+#include <Inventor/nodes/SoDrawStyle.h>
+#include <Inventor/nodes/SoCube.h>
+
+// HEPVis :
+#include <HEPVis/SbPolyhedron.h>
+#include <HEPVis/misc/SoStyleCache.h>
+//#include <HEPVis/misc/SoTools.h>
+#include <HEPVis/nodes/SoHighlightMaterial.h>
+
+#ifdef WIN32
+#undef pascal // Clash between windef.h and Geant4/SystemOfUnits.hh
+#endif
+
+// Geant4 :
+#include <G4LogicalVolume.hh>
+#include <G4Colour.hh>
+
+// Lib :
+#include <Lib/smanip.h>
+
+// G4Lab :
+#include <G4Lab/Transform3D.h>
+
+//////////////////////////////////////////////////////////////////////////////
+MEMPHYS::HitsCollectionAccessor::HitsCollectionAccessor(
+ Slash::Core::ISession& aSession
+,G4RunManager* aRunManager
+,const std::string& aHC
+)
+:G4Lab::HitsCollectionAccessor(aSession,aRunManager,aHC)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+MEMPHYS::HitsCollectionAccessor::~HitsCollectionAccessor(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+void MEMPHYS::HitsCollectionAccessor::visualize(
+ Slash::Data::IAccessor::Data aData
+,void*
+) 
+//////////////////////////////////////////////////////////////////////////////
+// The hit must have the "LV" and "TSF" AttDef.
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  G4VHit* obj = (G4VHit*)aData;  
+  G4LogicalVolume* lv = hitLogicalVolume(*obj);
+  if(!lv) return;
+  G4Transform3D* tsf = hitTransform3D(*obj);
+  if(!tsf) return;
+  G4VSolid* solid = lv->GetSolid();
+  if(!solid) return;
+  //G4Material* material = lv->GetMaterial();
+
+  SoSeparator* separator = new SoSeparator;
+  separator->setName("sceneGraph");
+      
+ {SoStyleCache* styleCache = fSoGC.getStyleCache();
+  G4Colour color;
+  if(hitColor(*obj,color)) {
+    SbColor sbColor((float)color.GetRed(),
+                    (float)color.GetGreen(),
+                    (float)color.GetBlue());
+    float transp = 1.0F - (float)color.GetAlpha();
+
+    //SbColor sbColor(1,0,0);
+    //float transp = 0;
+
+    separator->addChild(
+      styleCache->getHighlightMaterial
+        (sbColor,fSoGC.getHighlightColor(),transp));
+  } else {
+    separator->addChild(fSoGC.getHighlightMaterial());
+  }
+  separator->addChild(fSoGC.getDrawStyle());
+  //separator->addChild(fSoGC.getLightModel());
+  // Enforce base color (then suppress light effects) :
+  separator->addChild(styleCache->getLightModelBaseColor());
+  }
+
+ {SoTransform* transform = new SoTransform;
+  G4Lab::Transform3D* t = new G4Lab::Transform3D(*tsf);
+  SbMatrix* matrix = t->getMatrix();
+  transform->setMatrix(*matrix);
+  delete matrix;
+  delete t;
+  separator->addChild(transform);}
+          
+  // Build name (for picking) :
+  std::string s;
+  Lib::smanip::printf(s,128,"%s/0x%lx",HCName().c_str(),(unsigned long)obj);
+  SbName name(s.c_str());
+
+  // Representation :
+
+  //FIXME
+
+  //FIXME : PM base size :
+  //double WCPMTRadius           = 0.10*m;  // 20-cm PMTs (8-inch)
+  //JEC 27/1/06 double WCPMTRadius           = 0.10*m;  // 20-cm PMTs (8-inch)
+  float WCPMTRadius = 0.15F*m;  // PMTs (12-inch)
+
+  // half size :
+  float h = WCPMTRadius;
+
+/*
+  SbVec3f normal(0,0,1);
+  SbVec3f line[5];
+  line[0].setValue(+h,-h,0);
+  line[1].setValue(+h,+h,0);
+  line[2].setValue(-h,+h,0);
+  line[3].setValue(-h,-h,0);
+  line[4].setValue(+h,-h,0);
+  SoTools::addPolygonToNode(separator,4,line,normal,"");
+*/
+
+  // Have a SoCube to hide the PM visualized at the
+  // same place with "All PMs".
+  SoCube* soCube = new SoCube;
+  soCube->width.setValue(2*h);
+  soCube->height.setValue(2*h);
+  //Some tiny depth to include and hide the PM :
+  soCube->depth.setValue(0.01F*h);
+  separator->addChild(soCube);
+
+  fSoRegion->doIt(SbAddNode(separator,"dynamicScene"));
+}
Index: /MEMPHYS/devToV8/applications/MEMPHYS_analysis.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_analysis.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_analysis.cxx	(revision 370)
@@ -0,0 +1,517 @@
+// AIDA analysis program over MEMPHYS.root file.
+
+// AIDA :
+#include <AIDA/AIDA.h>
+#include <AIDA/ITupleEntry.h>
+
+// std :
+#include <iostream>
+
+// Lib :
+#include <Lib/smanip.h>
+
+//////////////////////////////////////////////////////////////////////////////
+AIDA::ITuple* cast_Tuple(
+ AIDA::ITupleEntry* aEntry
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  //FIXME : CINT can't handle dynamic_cast :
+  //return (AIDA::ITuple*)aEntry->cast("AIDA::ITuple");
+
+  return dynamic_cast<AIDA::ITuple*>(aEntry);
+}
+//////////////////////////////////////////////////////////////////////////////
+bool get_XYZ(
+ AIDA::ITuple& aParent
+,int aColumn
+,double& aX
+,double& aY
+,double& aZ
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(aColumn);
+  if(!entry) return false;
+
+  AIDA::ITuple* tuple = cast_Tuple(entry);
+  if(!tuple) return false;
+
+  tuple->start();
+  if(!tuple->next()) return false;
+
+  aX = tuple->getDouble(0);
+  aY = tuple->getDouble(1);
+  aZ = tuple->getDouble(2);
+
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+bool dump_tracks(
+ AIDA::ITuple& aParent
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(8);
+  if(!entry) return false;
+
+  AIDA::ITuple* tuple = cast_Tuple(entry);
+  if(!tuple) return false;
+
+  //if(nPart!=tracks->rows()) {
+  //  std::cout << "read: nPart / tracks mismatch " 
+  //              << nPart << " " << tracks->rows() << std::endl;
+  //  return false;
+  //}
+
+  tuple->start();
+  int irow = 0;
+  while(tuple->next()) {
+
+    int pId = tuple->getInt(0);
+    int parent = tuple->getInt(1);
+    float timeStart = tuple->getFloat(2);
+
+    double dx,dy,dz;
+    if(!get_XYZ(*tuple,3,dx,dy,dz)) return false;
+
+    double mass = tuple->getDouble(4);
+    double pTot = tuple->getDouble(5);
+    double ETot = tuple->getDouble(6);
+
+    double px,py,pz;
+    if(!get_XYZ(*tuple,7,px,py,pz)) return false;
+
+    double start_x,start_y,start_z;
+    if(!get_XYZ(*tuple,8,start_x,start_y,start_z)) return false;
+
+    double stop_x,stop_y,stop_z;
+    if(!get_XYZ(*tuple,9,stop_x,stop_y,stop_z)) return false;
+
+    int startVol = tuple->getInt(10);
+    int stopVol = tuple->getInt(11);
+
+    std::cout << "----> Tk{"<<irow<<"}: " 
+              << " pId " << pId
+              << " parent " << parent
+              << " creation time " << timeStart 
+              << " Volumes " << startVol << " " << stopVol << "\n"
+              << " Start Pos (" << start_x 
+              << "," << start_y << "," << start_z << ")\n"
+              << " Stop Pos (" << stop_x 
+              << "," << stop_y << "," << stop_z << ")\n"
+              << " dx,dy,dz " << dx << " " << dy << " " << dz << "\n"
+              << " m " << mass
+              << " ETot " << ETot
+              << " pTot " << pTot
+              << " px,py,pz " << px << " " << py << " " << pz << "\n"
+              << std::endl;
+
+    irow++;
+  }
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+bool process_hits_times(
+ AIDA::ITuple& aParent
+,AIDA::IHistogram1D& aHisto
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(2);
+  if(!entry) return false;
+
+  AIDA::ITuple* tuple = cast_Tuple(entry);
+  if(!tuple) return false;
+
+  tuple->start();
+  while(tuple->next()) {
+
+    float time = tuple->getFloat(0);
+
+    aHisto.fill(time);
+  }
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+bool process_hits(
+ AIDA::ITuple& aParent
+,AIDA::IHistogram1D& aHisto
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(10);
+  if(!entry) return false;
+
+  AIDA::ITuple* tuple = cast_Tuple(entry);
+  if(!tuple) return false;
+
+  tuple->start();
+  while(tuple->next()) {
+
+    //int tubeId = tuple->getInt(0);
+    //int totalPE = tuple->getInt(1);
+
+    if(!process_hits_times(*tuple,aHisto)) return false;
+  }
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+bool process_digits(
+ AIDA::ITuple& aParent
+,AIDA::IHistogram2D& aHisto
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(13);
+  if(!entry) return false;
+
+  AIDA::ITuple* tuple = cast_Tuple(entry);
+  if(!tuple) return false;
+
+  tuple->start();
+  while(tuple->next()) {
+
+    //int tubeId = tuple->getInt(0);
+    double pe = tuple->getDouble(1);
+    double time = tuple->getDouble(2);
+    //printf("debug : ++++ : %g %g\n",time,pe);
+
+    aHisto.fill(time,pe);
+  }
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+void set_region_style(
+ AIDA::IPlotterRegion& aRegion
+) 
+//////////////////////////////////////////////////////////////////////////////
+// Taken from G4SPL_analysis.cxx.
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  //FIXME : have to do the below with AIDA styles.
+
+  // ROOT is in NDC, then we take a plotter with width = height = 1
+
+  // PAW :
+  //float XSIZ = 20.0F;
+  //float XLAB = 1.4F;
+  //float YSIZ = 20.0F;
+  //float YLAB = 1.4F;
+
+  float XLAB = 1.4F/20.0F; //0.07 //x distance of y title to data frame.
+  float YLAB = 0.8F/20.0F; //0.04 //y distance of x title to data frame.
+  YLAB = 0.05F; //FIXME : cooking.
+
+  // To have a good matching with ROOT for text size :
+  //double majic = 0.014/0.027;
+  double majic = 0.6;
+  std::string s = Lib::smanip::tostring(majic);
+  //FIXME : have methods for the below :
+  aRegion.style().setParameter("textScale",s);
+  aRegion.style().xAxisStyle().setParameter("magStyle.scale",s);
+  aRegion.style().yAxisStyle().setParameter("magStyle.scale",s);
+  aRegion.style().xAxisStyle().tickLabelStyle().setParameter("scale",s);
+  aRegion.style().xAxisStyle().labelStyle().setParameter("scale",s);
+  aRegion.style().yAxisStyle().tickLabelStyle().setParameter("scale",s);
+  aRegion.style().yAxisStyle().labelStyle().setParameter("scale",s);
+
+  // ROOT def margins 0.1. SoPlotter def 0.1.
+  aRegion.layout().setParameter("rightMargin",0.1);
+  aRegion.layout().setParameter("topMargin",0.1);
+  //gStyle->SetPadBottomMargin(0.15);
+  aRegion.layout().setParameter("leftMargin",0.15);
+  //gStyle->SetPadLeftMargin(0.15);
+  aRegion.layout().setParameter("bottomMargin",0.15);
+
+  aRegion.style().setParameter("superposeBins","TRUE");
+  aRegion.setParameter("plotter.wallStyle.visible","FALSE");
+  aRegion.setParameter("plotter.gridStyle.visible","FALSE");
+
+  //std::string font = "Hershey"; //PAW font.
+  //std::string font = "TTF/arialbd"; //Default ROOT font 62.
+  //std::string font = "TTF/couri";
+  std::string font = "TTF/times"; //= ROOT 132 ?
+  //std::string smoothing = "FALSE";
+  std::string smoothing = "TRUE";
+
+  // X axis :
+  aRegion.style().xAxisStyle().tickLabelStyle().setFont(font);
+  aRegion.style().xAxisStyle().tickLabelStyle().setParameter("smoothing",smoothing);
+  aRegion.style().xAxisStyle().labelStyle().setFont(font);
+  aRegion.style().xAxisStyle().labelStyle().setParameter("smoothing",smoothing);
+  aRegion.setParameter("plotter.xAxis.magStyle.fontName",font);
+  aRegion.setParameter("plotter.xAxis.magStyle.smoothing",smoothing);
+  aRegion.style().xAxisStyle().lineStyle().setThickness(2);
+  aRegion.setParameter("plotter.xAxis.ticksStyle.width","2");
+  aRegion.style().setParameter("topAxisVisible","TRUE");
+  // Set hplot tick modeling :
+  aRegion.style().xAxisStyle().setParameter("modeling","hplot");
+  aRegion.style().xAxisStyle().setParameter("divisions","505");
+
+  // Y axis :
+  //aRegion.style().setParameter("yAxisLogScale","TRUE");
+  aRegion.style().yAxisStyle().tickLabelStyle().setFont(font);
+  aRegion.style().yAxisStyle().tickLabelStyle().setParameter("smoothing",smoothing);
+  aRegion.style().yAxisStyle().labelStyle().setFont(font);
+  aRegion.style().yAxisStyle().labelStyle().setParameter("smoothing",smoothing);
+  aRegion.setParameter("plotter.yAxis.magStyle.fontName",font);
+  aRegion.setParameter("plotter.yAxis.magStyle.smoothing",smoothing);
+  aRegion.style().yAxisStyle().lineStyle().setThickness(2);
+  aRegion.setParameter("plotter.yAxis.ticksStyle.width","2");
+
+  //gStyle->SetTitleSize(0.06,"XYZ"); //ROOT def 0.04. SoPlotter : 0.014
+  aRegion.setParameter("plotter.xAxis.titleHeight","0.06");
+  aRegion.setParameter("plotter.yAxis.titleHeight","0.06");
+  //gStyle->SetLabelOffset(0.01,"Y"); //ROOT def 0.005. SoPlotter def 0.02
+  aRegion.setParameter("plotter.yAxis.labelToAxis","0.01");
+  //gStyle->SetTitleOffset(1.1,"Y");
+  aRegion.setParameter("plotter.yAxis.titleToAxis",
+   Lib::smanip::tostring(1.1*XLAB));
+  aRegion.setParameter("plotter.xAxis.titleToAxis",
+   Lib::smanip::tostring(1.1*YLAB));
+  //gStyle->SetLabelSize(0.05,"XYZ"); //ROOT def 0.04. SoPlotter def 0.014.
+  aRegion.setParameter("plotter.yAxis.labelHeight","0.05");
+  aRegion.setParameter("plotter.xAxis.labelHeight","0.05");
+
+  aRegion.style().setParameter("rightAxisVisible","TRUE");
+  // Set hplot tick modeling :
+  aRegion.style().yAxisStyle().setParameter("modeling","hplot");
+  aRegion.style().yAxisStyle().setParameter("divisions","505");
+
+  // title :
+  aRegion.style().setParameter("titleHeight","0.04");
+  aRegion.style().setParameter("titleToAxis","0.02");
+  aRegion.style().titleStyle().textStyle().setFont(font);
+  aRegion.style().titleStyle().textStyle().setParameter("smoothing",smoothing);
+  aRegion.style().titleStyle().textStyle().setColor("0 0 1");
+
+  // legend box :
+  aRegion.setParameter("legendRegionVisible","TRUE");
+  aRegion.setParameter("legendRegion.viewportRegion.backgroundColor","1 1 0");
+  aRegion.setParameter("legendRegionSize","0.15 0.16");
+  aRegion.setParameter("legendRegionOrigin","0.1 0.1");
+  aRegion.setParameter("legendRegion.horizontalMargin","2");
+  aRegion.setParameter("legendRegion.verticalMargin","2");
+
+  // Frame :
+  aRegion.setParameter("plotter.innerFrameStyle.lineWidth","2");
+}
+//////////////////////////////////////////////////////////////////////////////
+bool plot(
+ AIDA::IAnalysisFactory& aAIDA
+,AIDA::IHistogram1D& aHisto1D
+,AIDA::IHistogram2D& aHisto2D
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  std::string header = "MEMPHYS_analysis : ";
+
+  AIDA::IPlotterFactory* plotterFactory = 
+    aAIDA.createPlotterFactory(0,0);
+  if(!plotterFactory) {
+    std::cout << header << "can't get a PlotterFactory." << std::endl;
+    return false;
+  }
+    
+  AIDA::IPlotter* plotter = plotterFactory->create();
+  if(!plotter) {
+    std::cout << header << "can't get a plotter." << std::endl;
+    return false;
+  }
+    
+  plotter->clearRegions();
+  plotter->createRegions(1,2,0);
+
+ {plotter->setCurrentRegionNumber(0);
+  AIDA::IPlotterRegion& region = plotter->currentRegion();
+  set_region_style(region);
+  region.style().xAxisStyle().setLabel("time");
+  region.style().yAxisStyle().setLabel("Entries");
+  region.plot(aHisto1D);}
+
+ {plotter->setCurrentRegionNumber(1);
+  AIDA::IPlotterRegion& region = plotter->currentRegion();
+  set_region_style(region);
+  region.style().xAxisStyle().setLabel("time");
+  region.style().yAxisStyle().setLabel("PE");
+  region.plot(aHisto2D);}
+
+  plotter->show();
+
+  /* FIXME : try to have multiple plotters in the tab stack :
+ {AIDA::IPlotter* plotter = plotterFactory->create("Viewer_2");
+  if(!plotter) {
+    std::cout << header << "can't get a plotter." << std::endl;
+    return false;
+  }
+  plotter->clearRegions();
+  plotter->createRegions(1,1,0);}
+  */
+
+  plotter->interact();
+
+  delete plotter;
+  delete plotterFactory;
+
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+int main(int aArgc,char** aArgv) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  std::string program = "MEMPHYS_analysis";
+  std::string header = program + " : ";
+
+  AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
+  if(!aida) {
+    std::cout << header << "AIDA not found." << std::endl;
+    return 1;
+  }
+
+  AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
+  if(!treeFactory) {
+    std::cout << header << "can't get a TreeFactory." << std::endl;
+    return 1;
+  }
+
+  ////////////////////////////////////////////////////////
+  // Create histograms in memory tree ////////////////////
+  ////////////////////////////////////////////////////////
+  AIDA::ITree* memory = treeFactory->create();
+  if(!memory) {
+    std::cout << header << "can't get memory tree." << std::endl;
+    return 1;
+  }
+  AIDA::IHistogramFactory* histogramFactory = 
+    aida->createHistogramFactory(*memory);
+  if(!histogramFactory) {
+    std::cout << header << "can't get an histogram factory." << std::endl;
+    return 1;
+  }
+  
+  AIDA::IHistogram1D* hits_times = 
+    histogramFactory->createHistogram1D("hits_times","Hits times",100,0,3000);
+  if(!hits_times) {
+    std::cout << header 
+              << "can't create histogram : time." 
+              << std::endl;
+    return 1;
+  }
+
+  AIDA::IHistogram2D* digits_time_pe = 
+    histogramFactory->createHistogram2D("digits_pe_time","Digits PE time",
+					100,0,3000,100,0,10);
+  if(!digits_time_pe) {
+    std::cout << header 
+              << "can't create histogram : digits_time_pe." 
+              << std::endl;
+    return 1;
+  }
+
+  delete histogramFactory;
+
+  ////////////////////////////////////////////////////////
+  /// Read data //////////////////////////////////////////
+  ////////////////////////////////////////////////////////
+
+  std::string fmt = (aArgc>=2?aArgv[1]:"root"); //file extension
+
+  AIDA::ITree* tree = treeFactory->create("MEMPHYS."+fmt,fmt,true,false);
+  if(!tree) {
+    std::cout << header << "can't open data file." << std::endl;
+    return 1;
+  }
+
+  AIDA::IManagedObject* object = tree->find("Event");
+  if(!object) {
+    std::cout << header 
+              << "object Event not found in tree." 
+              << std::endl;
+    return 1;
+  }
+  //FIXME : CINT can't handle dynamic_cast :
+  //AIDA::ITuple* tuple = (AIDA::ITuple*)object->cast("AIDA::ITuple");
+  AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(object);
+  if(!tuple) {
+    std::cout << header << "object not an AIDA::ITuple." << std::endl;
+    return 1;
+  }
+
+  int coln = tuple->columns();
+  for(int index=0;index<coln;index++) {
+    std::cout << header 
+              << " icol = " << index
+              << ", label = " << tuple->columnName(index) 
+              << ", type = " << tuple->columnType(index) 
+              << std::endl;
+  }
+
+  std::cout << header << "rows = " << tuple->rows() << std::endl;
+
+  int nentries = tuple->rows();
+  //nentries = 100000;
+  //nentries = 40;
+  std::cout << header 
+            << "traitements de " << nentries << " entrees" 
+            << std::endl;
+
+  int irow = 0;
+  tuple->start();
+  while(tuple->next() && (irow<nentries)) {
+
+    /*
+    int eventId = tuple->getInt(0);
+    //int inputEvtId = tuple->getInt(1);
+    //int interMode = tuple->getInt(2);
+    //int vtxVol = tuple->getInt(3);
+
+    int nPart = tuple->getInt(5);
+    //int leptonIndex = tuple->getInt(6);
+    //int protonIndex = tuple->getInt(7);
+
+    int nHits = tuple->getInt(9);
+    int nDigits = tuple->getInt(11);
+    double sumPE = tuple->getDouble(12);
+
+    std::cout << ">>>>>>>>>>>>> Event{" << irow << "}: "
+    	      << " evt Id " << eventId 
+    //	      << " evt Input Id " << inputEvtId
+    //	      << "\n interaction mode " << interMode
+    //	      << " start in volume " << vtxVol << "\n"
+    	      <<" #tracks: " << nPart
+    	      <<" #hits: " << nHits
+              <<" #digits: " << nDigits
+              <<" sumPE " << sumPE
+    	      << std::endl;
+    */
+
+    //if(!dump_tracks(*tuple)) return 1;
+
+    if(!process_hits(*tuple,*hits_times)) return 1;
+    if(!process_digits(*tuple,*digits_time_pe)) return 1;
+
+    irow++;
+  }
+
+  delete tree;
+  delete treeFactory;
+
+  plot(*aida,*hits_times,*digits_time_pe);
+
+  delete aida;
+
+  return 0;
+}
Index: /MEMPHYS/devToV8/applications/MEMPHYS_analysis_ROOT.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_analysis_ROOT.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_analysis_ROOT.cxx	(revision 370)
@@ -0,0 +1,33 @@
+//
+// Compiled version of the interpreted
+//   ../scripts/ROOT/analysis.C
+//
+
+// To read data :
+#include <TFile.h>
+#include <TTree.h>
+
+// To have histos :
+#include <TH1D.h>
+#include <TH2D.h>
+
+// To plot histos :
+#include <TCanvas.h>
+#include <TSystem.h>
+#include <TApplication.h>
+
+#include <iostream>
+
+#include "../scripts/ROOT/analysis.C"
+
+int main(int aArgc,char* aArgv[]) {
+  ROOT::GetROOT();
+  
+  new TApplication("MEMPHYS_analysis_ROOT",&aArgc,aArgv);
+
+  analysis();
+
+  gSystem->Run();
+
+  return 1;
+}
Index: /MEMPHYS/devToV8/applications/MEMPHYS_analysis_aida_ROOT.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_analysis_aida_ROOT.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_analysis_aida_ROOT.cxx	(revision 370)
@@ -0,0 +1,39 @@
+//
+// Compiled version of the interpreted
+//   ../scripts/ROOT/aida_ROOT.C
+// which uses OpenScienitst/AIDA to read a MEMPHYS.root
+// file and the TH* for the histogramming and plotting.
+//
+
+#include <AIDA/IAnalysisFactory.h>
+#include <AIDA/ITreeFactory.h>
+#include <AIDA/ITree.h>
+#include <AIDA/IManagedObject.h>
+#include <AIDA/ITupleEntry.h>
+#include <AIDA/ITuple.h>
+
+#include <TH1D.h>
+#include <TH2D.h>
+#include <TCanvas.h>
+#include <TSystem.h>
+#include <TApplication.h>
+
+#include <TStyle.h>
+
+#include <iostream>
+
+#include "../scripts/ROOT/rootlogon.C" 
+#include "../scripts/ROOT/aida_ROOT.C"
+
+int main(int aArgc,char* aArgv[]) {
+  ROOT::GetROOT();
+  
+  new TApplication("MEMPHYS_analysis_aida_ROOT",&aArgc,aArgv);
+
+  rootlogon();
+  aida_ROOT();
+
+  gSystem->Run();
+
+  return 1;
+}
Index: /MEMPHYS/devToV8/applications/MEMPHYS_batch.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_batch.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_batch.cxx	(revision 370)
@@ -0,0 +1,113 @@
+// Geant4:
+#include "G4ios.hh"
+#include "G4RunManager.hh"
+#include "G4UImanager.hh"
+
+//MEMPHYS:
+#include "MEMPHYS/Analysis.hh"
+#include "MEMPHYS/DetectorConstruction.hh"
+#include "MEMPHYS/PhysicsList.hh"
+#include "MEMPHYS/PhysicsMessenger.hh"
+#include "MEMPHYS/PrimaryGeneratorAction.hh"
+#include "MEMPHYS/EventAction.hh"
+#include "MEMPHYS/RunAction.hh"
+#include "MEMPHYS/StackingAction.hh"
+#include "MEMPHYS/TrackingAction.hh"
+#include "MEMPHYS/SteppingAction.hh"
+
+
+//JEC AIDA :
+#include <AIDA/IAnalysisFactory.h>
+
+// std::
+#include <iostream>
+
+//JEC Lib :
+#include <Lib/System.h>
+
+//////////////////////////////////////////////////////////////////////////////
+int main(
+ int aArgc 
+,char** aArgv
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  std::string arg1 = (aArgc>=2?aArgv[1]:"");
+
+  //AIDA Analysis factory
+  AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
+  if(!aida) {
+    std::cout << "MEMPHYS_batch :"
+              << " AIDA not found." << std::endl;
+  }
+  //Book all the histo, tuple 
+  MEMPHYS::Analysis* analysis = new MEMPHYS::Analysis(aida,arg1);
+
+  // Construct the default run manager
+  G4RunManager* runManager = new G4RunManager;
+  
+
+  runManager->SetGeometryToBeOptimized(false); //JEC 21/4/06 test to speed up the closing phase
+                                               //note that G.B suspect memory leak with valgrind
+
+
+  // UserInitialization classes (mandatory)
+
+
+
+  //JEC 18/11/05 give the "analysis" to fill geometry ITuple
+  MEMPHYS::DetectorConstruction* MEMPHYSdetector = 
+    new MEMPHYS::DetectorConstruction(*analysis); 
+
+  runManager->SetUserInitialization(MEMPHYSdetector);
+
+  runManager->SetUserInitialization(new MEMPHYS::PhysicsList);
+
+  G4UImanager* UI = G4UImanager::GetUIpointer();
+  if (UI) {
+    std::string file = 
+      Lib::System::getenv("MEMPHYSROOT")+"/scripts/Geant4/jobOptions.mac"; //JEC FIXME this comes from JHF
+    UI->ApplyCommand("/control/execute "+file);  
+  }
+
+
+
+  // Set user action classes
+  MEMPHYS::PrimaryGeneratorAction* myGeneratorAction = new MEMPHYS::PrimaryGeneratorAction(MEMPHYSdetector);
+  runManager->SetUserAction(myGeneratorAction);
+
+  MEMPHYS::RunAction* myRunAction = new MEMPHYS::RunAction();
+
+  runManager->SetUserAction(myRunAction);
+
+
+  runManager->SetUserAction(new MEMPHYS::EventAction(*analysis,
+						   myRunAction, 
+						   MEMPHYSdetector,
+						   myGeneratorAction));
+  runManager->SetUserAction(new MEMPHYS::TrackingAction);
+
+  runManager->SetUserAction(new MEMPHYS::StackingAction);
+  runManager->SetUserAction(new MEMPHYS::SteppingAction); //JEC 15/12/05 Add user SteppingAction
+
+  // Initialize G4 kernel
+  runManager->Initialize();
+
+  if (UI) {
+    std::string file = 
+      Lib::System::getenv("MEMPHYSROOT")+"/scripts/Geant4/init.g4m"; //JEC FIXME this comes from JHF
+    UI->ApplyCommand("/control/execute "+file);  
+  }
+
+  runManager->BeamOn(1000);
+
+  //JEC interactive session  delete visManager;
+
+  delete runManager;
+  delete analysis;
+  delete aida;
+  return 0;
+}
+
+
Index: /MEMPHYS/devToV8/applications/MEMPHYS_geom.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_geom.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_geom.cxx	(revision 370)
@@ -0,0 +1,137 @@
+// AIDA analysis program over MEMPHYS_geom.root file.
+
+// AIDA :
+#include <AIDA/AIDA.h>
+#include <AIDA/ITupleEntry.h>
+
+// std :
+#include <iostream>
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+bool process_pmtInfos(
+ AIDA::ITuple& aParent
+,FILE* aFile
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(7);
+  if(!entry) return false;
+
+  AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(entry);
+  if(!tuple) return false;
+
+  int irow = 0;
+
+  tuple->start();
+  while(tuple->next()) {
+
+    //int pmtId = tuple->getInt(0);
+    //int pmtLocation = tuple->getInt(1);
+
+    double dx = tuple->getDouble(2);
+    double dy = tuple->getDouble(3);
+    double dz = tuple->getDouble(4);
+    double x = tuple->getDouble(5);
+    double y = tuple->getDouble(6);
+    double z = tuple->getDouble(7);
+
+    std::cout << "----> PM{"<<irow<<"}: " 
+              << " x,y,z " << x << " " << y << " " << z
+              << " dx,dy,dz " << dx << " " << dy << " " << dz
+              << std::endl;
+
+    fprintf(aFile,"%g %g %g %g %g %g\n",x,y,z,dx,dy,dz);
+    
+    irow++;
+    
+  }
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+int main(int aArgc,char** aArgv) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  std::string program = "MEMPHYS_geom";
+  std::string header = program + " : ";
+
+  AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
+  if(!aida) {
+    std::cout << header << "AIDA not found." << std::endl;
+    return 1;
+  }
+
+  AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
+  if(!treeFactory) {
+    std::cout << header << "can't get a TreeFactory." << std::endl;
+    return 1;
+  }
+
+  ////////////////////////////////////////////////////////
+  /// Read data //////////////////////////////////////////
+  ////////////////////////////////////////////////////////
+
+  std::string fmt = (aArgc>=2?aArgv[1]:"root"); //file extension
+
+  AIDA::ITree* tree = treeFactory->create("MEMPHYS_geom."+fmt,fmt,true,false);
+  if(!tree) {
+    std::cout << header << "can't open data file." << std::endl;
+    return 1;
+  }
+
+  AIDA::IManagedObject* object = tree->find("Geometry");
+  if(!object) {
+    std::cout << header 
+              << "object Geometry not found in tree." 
+              << std::endl;
+    return 1;
+  }
+  AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(object);
+  if(!tuple) {
+    std::cout << header << "object not an AIDA::ITuple." << std::endl;
+    return 1;
+  }
+
+  int coln = tuple->columns();
+  for(int index=0;index<coln;index++) {
+    std::cout << header 
+              << " icol = " << index
+              << ", label = " << tuple->columnName(index) 
+              << ", type = " << tuple->columnType(index) 
+              << std::endl;
+  }
+
+  std::cout << header << "rows = " << tuple->rows() << std::endl;
+
+  int nentries = tuple->rows();
+  //nentries = 100000;
+  //nentries = 40;
+  std::cout << header 
+            << "traitements de " << nentries << " entrees" 
+            << std::endl;
+
+  FILE* file = fopen("MEMPHYS_geom.ascii","wb");
+
+  int irow = 0;
+  tuple->start();
+  while(tuple->next() && (irow<nentries)) {
+
+    if(!process_pmtInfos(*tuple,file)) return 1;
+
+    irow++;
+  }
+
+  ::fclose(file);
+
+  delete tree;
+  delete treeFactory;
+
+  delete aida;
+
+  return 0;
+}
Index: /MEMPHYS/devToV8/applications/MEMPHYS_geom_ROOT.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_geom_ROOT.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_geom_ROOT.cxx	(revision 370)
@@ -0,0 +1,33 @@
+//
+// Compiled version of the interpreted
+//   ../scripts/ROOT/analysis.C
+//
+
+// To read data :
+#include <TFile.h>
+#include <TTree.h>
+
+// To have histos :
+#include <TH1D.h>
+#include <TH2D.h>
+
+// To plot histos :
+#include <TCanvas.h>
+#include <TSystem.h>
+#include <TApplication.h>
+
+#include <iostream>
+
+#include "../scripts/ROOT/geom.C"
+
+int main(int aArgc,char* aArgv[]) {
+  ROOT::GetROOT();
+  
+  new TApplication("MEMPHYS_geom",&aArgc,aArgv);
+
+  MEMPHYS_geom();
+
+  //gSystem->Run();
+
+  return 1;
+}
Index: /MEMPHYS/devToV8/applications/MEMPHYS_session.cxx
===================================================================
--- /MEMPHYS/devToV8/applications/MEMPHYS_session.cxx	(revision 370)
+++ /MEMPHYS/devToV8/applications/MEMPHYS_session.cxx	(revision 370)
@@ -0,0 +1,231 @@
+
+// Geant4:
+#include <G4ios.hh>
+#include <G4RunManager.hh>
+#include <G4UImanager.hh>
+#include <G4SDManager.hh>
+
+//AIDA :
+#include <AIDA/IAnalysisFactory.h>
+
+// std::
+#include <iostream>
+
+// Slash :
+#include <Slash/Core/IManager.h>
+#include <Slash/Core/ISession.h>
+#include <Slash/Data/IProcessor.h>
+
+// Lib :
+#include <Lib/Manager.h>
+#include <Lib/System.h>
+#include <Lib/Out.h>
+#include <Lib/Cast.h>
+#include <Lib/Arguments.h>
+
+// G4Lab :
+#include <G4Lab/UIOnX.h>
+#include <G4Lab/TrackingAction.h>
+#include <G4Lab/Interfaces/IGeant4Manager.h>
+//#include <G4Lab/DigitsCollectionAccessor.h>
+
+//MEMPHYS:
+#include "MEMPHYS/Analysis.hh"
+#include "MEMPHYS/DetectorConstruction.hh"
+#include "MEMPHYS/PhysicsList.hh"
+#include "MEMPHYS/PhysicsMessenger.hh"
+#include "MEMPHYS/PrimaryGeneratorAction.hh"
+#include "MEMPHYS/EventAction.hh"
+#include "MEMPHYS/RunAction.hh"
+#include "MEMPHYS/StackingAction.hh"
+#include "MEMPHYS/TrackingAction.hh"
+#include "MEMPHYS/SteppingAction.hh"
+#include "MEMPHYS/WCDigi.hh"
+#include <MEMPHYS/HitsCollectionAccessor.h>
+#include <MEMPHYS/DigitsCollectionAccessor.h>
+
+// Create a manager to access the MEMPHYSAnalysis from the callbacks :
+
+//JEC 10/1/06 introduce MEMPHYS namespace
+namespace MEMPHYS {
+
+class AppManager 
+  :public virtual Slash::Core::IManager
+  ,public Analysis  {
+ public: //Slash::Core::IManager
+  virtual std::string name() const { return fName;}
+  virtual void* cast(const std::string& aClass) const {
+    if_Lib_SCast(MEMPHYS::AppManager)
+    else if_Lib_SCast(MEMPHYS::IAppManager)
+    else if_Lib_SCast(MEMPHYS::Analysis)
+    else if_Lib_SCast(Slash::Core::IManager)
+    else return 0;
+  }
+ public://IAppManager
+  virtual bool initialize() {
+    //GB :
+    // Used in the MEMPHYS_Initialize callback.
+    // Do all the below here because of platforms having 
+    // not Geant4 shared libs.
+    IGeant4Manager* g4Manager = 
+      Lib_findManager(fSession,"Geant4Manager",IGeant4Manager);
+    if(!g4Manager) {
+      Lib::Out out(fSession.printer());
+      out << "MEMPHYS_Initialize :"
+          << " Geant4Manager not found."
+          << Lib::endl;
+      return false;
+    }
+
+    // To initialize G4Lab Types (PV, Trajectory, HitsCollection, etc.. types).
+    // To initialize G4Lab SoNodes.
+    g4Manager->initialize();
+
+    // Overload the HitsCollectionAccessor of G4Lab :
+    Slash::Data::IProcessor* accessorManager = 
+      Lib_findManager(fSession,"AccessorManager",Slash::Data::IProcessor);
+    if(accessorManager) {
+      G4SDManager* sdManager = g4Manager->sdManager();
+      if(sdManager) {
+        G4HCtable* hcTable  = sdManager->GetHCtable();
+        if(hcTable) {
+          int number = hcTable->entries();
+          for(int index=0;index<number;index++) {
+            G4String hcName = hcTable->GetHCname(index);
+            accessorManager->removeAccessor(hcName);
+            accessorManager->addAccessor
+              (new MEMPHYS::HitsCollectionAccessor
+                (fSession,g4Manager->runManager(),hcName));
+          }
+        }
+      }
+
+      /*
+      accessorManager->addAccessor
+        (new G4Lab::DigitsCollectionAccessor<MEMPHYS::WCDigi>
+          (fSession,"WCDigitizedCollection"));
+      */
+      accessorManager->addAccessor
+        (new MEMPHYS::DigitsCollectionAccessor<MEMPHYS::WCDigi>
+          (fSession,g4Manager->runManager(),"WCDigitizedCollection"));
+    }
+    return true;
+  }
+ public:
+  AppManager(Slash::Core::ISession& aSession,
+             AIDA::IAnalysisFactory* aAIDA,bool aBatch)
+    :Analysis(aAIDA,"",aBatch)
+    ,fSession(aSession)
+    ,fName("MEMPHYS::AppManager") {}
+  virtual ~AppManager(){}
+ private:
+  Slash::Core::ISession& fSession;
+  std::string fName;
+};
+}
+
+//////////////////////////////////////////////////////////////////////////////
+int main(
+ int aArgc
+,char** aArgv
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  //Lib::Debug::checkByClass(true);
+
+  Lib::Arguments args(aArgc,aArgv);
+
+  G4RunManager* runManager = new G4RunManager;
+
+  //JEC 27/1/06 test to speed up the closing phase
+  // GB : in the below :
+  // - if passing false, it induces a memory leak on Replicas 
+  //   at exit (seen with valgrind and MacOSX).
+  // - if passing true (default), it takes a lot of time 
+  //   to "close the geometry".
+  // !!!!
+  runManager->SetGeometryToBeOptimized(false);
+
+  std::string gui;
+  if(args.isAnArgument("-SDL")||args.isAnArgument("-sdl")) {
+    gui = "$MEMPHYSROOT/scripts/OnX/SDL.onx";
+  } else {
+    gui = "$MEMPHYSROOT/scripts/OnX/MEMPHYS_session.onx";
+  }
+ 
+  // Need to pass the G4RunManager at UIOnX creation
+  G4Lab::UIOnX* session = new G4Lab::UIOnX(*runManager,gui,aArgc,aArgv);
+  if(!session->isValid()) {
+    std::cout << "MEMPHYS_session : problem starting OnX." << std::endl;
+    return EXIT_FAILURE;
+  }
+
+  MEMPHYS::AppManager* appManager = 0;
+
+  AIDA::IAnalysisFactory* aida = session->findAIDA();
+  if(!aida) {
+    std::cout << "MEMPHYS_session : AIDA not found." << std::endl;
+  } 
+
+  appManager = new MEMPHYS::AppManager(*session->session(),aida,false);
+  session->addManager(appManager);
+
+  //JEC 18/11/05 give the appManager to fill geometry ITuple
+  MEMPHYS::DetectorConstruction* MEMPHYSdetector = 
+    new MEMPHYS::DetectorConstruction(*appManager); 
+
+  runManager->SetUserInitialization(MEMPHYSdetector);
+
+  runManager->SetUserInitialization(new MEMPHYS::PhysicsList);
+
+  G4UImanager* UI = G4UImanager::GetUIpointer();
+  if (UI) {
+    std::string file = 
+      Lib::System::getenv("MEMPHYSROOT")+"/scripts/Geant4/jobOptions.mac";
+    UI->ApplyCommand("/control/execute "+file);  
+  }
+
+  
+  // Set user action classes
+  MEMPHYS::PrimaryGeneratorAction* myGeneratorAction = 
+    new MEMPHYS::PrimaryGeneratorAction(MEMPHYSdetector);
+  runManager->SetUserAction(myGeneratorAction);
+
+  MEMPHYS::RunAction* myRunAction = new MEMPHYS::RunAction();
+
+  runManager->SetUserAction(myRunAction);
+
+
+  runManager->SetUserAction(new MEMPHYS::EventAction(*appManager,
+						   myRunAction, 
+						   MEMPHYSdetector,
+						   myGeneratorAction));
+  runManager->SetUserAction(new MEMPHYS::TrackingAction);
+
+  runManager->SetUserAction(new MEMPHYS::StackingAction);
+
+  runManager->SetUserAction(new MEMPHYS::SteppingAction); //JEC 15/12/05 Add user SteppingAction
+
+  // Initialize G4 kernel
+  runManager->Initialize();
+
+  if (UI) {
+    std::string file = 
+      Lib::System::getenv("MEMPHYSROOT")+"/scripts/Geant4/init.g4m";
+    UI->ApplyCommand("/control/execute "+file);  
+  }
+
+
+  // Main UI loop :
+  // GUI is really constructed here. 
+  // Create callbacks are executed here too.
+  session->SessionStart();
+
+  delete session; //It will delete the appManager.
+
+  delete runManager;
+
+  return EXIT_SUCCESS;
+}
+
Index: /MEMPHYS/devToV8/cmt/README
===================================================================
--- /MEMPHYS/devToV8/cmt/README	(revision 370)
+++ /MEMPHYS/devToV8/cmt/README	(revision 370)
@@ -0,0 +1,13 @@
+
+  To build :
+ - have a look and edit if needed the meta_setup.csh.
+   In it you have to say where is the OpenScientist binary installation.
+ - source the meta_setup. 
+ - build with "cmt config" and "gmake". 
+
+  To run source the meta_setup and the setup and launch an application.
+
+  Note that the "meta setup" informations are something that can be put 
+ in login scripts.
+
+    G.Barrand 
Index: /MEMPHYS/devToV8/cmt/cmt_make_shlib_common.sh
===================================================================
--- /MEMPHYS/devToV8/cmt/cmt_make_shlib_common.sh	(revision 370)
+++ /MEMPHYS/devToV8/cmt/cmt_make_shlib_common.sh	(revision 370)
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+#set -x
+
+#------------------------------------------------------
+#
+#  Syntax :
+#
+#  cmt_make_shlib_common.sh extract-arg package extra-args
+#
+#   with :
+#
+#      extract-arg  : either "extract" or "no_extract"
+#      package      : the current package name
+#      extra-args   : extra link options
+#
+#------------------------------------------------------
+
+extract=$1
+shift
+
+tag=$1
+shift
+
+lib=$1
+shift
+
+extra=$*
+
+here=`/bin/pwd`
+
+# kind is shlib or dll. OpenScientist specific.
+kind=`${CMTROOT}/mgr/cmt show macro_value ${lib}_kind -tag=${tag}`
+
+build_shlib=yes
+build_dll=no
+if [ `uname` = Darwin ] ; then
+  if [ "${kind}" = dll ] ; then
+    build_shlib=no
+    build_dll=yes
+  fi
+fi
+
+ld=`${CMTROOT}/mgr/cmt show macro_value shlibbuilder -tag=${tag}`
+ldflags=`${CMTROOT}/mgr/cmt show macro_value shlibflags -tag=${tag}`
+suffix=`${CMTROOT}/mgr/cmt show macro_value shlibsuffix -tag=${tag}`
+libprefix=`${CMTROOT}/mgr/cmt show macro_value library_prefix -tag=${tag}`
+libsuffix=`${CMTROOT}/mgr/cmt show macro_value library_suffix -tag=${tag}`
+
+if test "${ld}" = "" ; then
+  exit 1
+fi
+
+libname=${libprefix}${lib}${libsuffix}
+/bin/rm -f ${libname}.${suffix}
+
+result=0
+
+temp_shlib=${lib}temp_shlib
+
+if test ${extract} = "extract"; then
+  trap 'cd ${here}; /bin/rm -rf ${temp_shlib}; exit ${result}' 0 1 2 15
+
+  mkdir -p ${temp_shlib}
+  /bin/rm -f ${temp_shlib}/*
+
+  (cd ${temp_shlib}; ar x ../${libname}.a)
+
+  #
+  # Build a protected list of modules just extracted from
+  # the static library
+  #  Files containing space characters are accepted
+  #
+  modules=`ls -1 ${temp_shlib} | \
+           grep '[.]o$' | \
+           sed -e 's#^#'${temp_shlib}'/#' \
+               -e 's#^#"#g' \
+               -e 's#$#"#'`
+
+  if [ "${build_shlib}" = "yes" ] ; then
+    if test "${QUIET}" = ""; then set -v; fi
+    eval ${ld} ${ldflags} -o ${libname}.${suffix} ${modules} ${extra}
+    result=$?
+  fi
+
+  if [ "${build_dll}" = "yes" ] ; then
+    /bin/rm -f ${lib}.bundle
+    opts=" -Wl,-headerpad_max_install_names -Wl,-headerpad,800"
+    eval ${ld} -bundle -twolevel_namespace ${opts} -o ${lib}.bundle ${modules} ${extra}
+    result=$?
+  fi
+
+  if test "${QUIET}" = ""; then set +v; fi
+
+  /bin/rm -rf ${temp_shlib}
+
+else
+
+  if test "${QUIET}" = ""; then set -v; fi
+
+  eval ${ld} ${ldflags} -all ${libname}.a -o ${libname}.${suffix} ${extra} -rpath `/bin/pwd`
+  result=$?
+
+  if test "${QUIET}" = ""; then set +v; fi
+
+fi
+
+
+
+
Index: /MEMPHYS/devToV8/cmt/meta_setup.csh
===================================================================
--- /MEMPHYS/devToV8/cmt/meta_setup.csh	(revision 370)
+++ /MEMPHYS/devToV8/cmt/meta_setup.csh	(revision 370)
@@ -0,0 +1,7 @@
+
+source /lal/CMT/v1r18p20050501/mgr/setup.csh
+
+setenv CMTPATH "/exp/opera/barrand"
+
+setenv CMTCONFIG slc3_gcc323
+
Index: /MEMPHYS/devToV8/cmt/meta_setup.sh
===================================================================
--- /MEMPHYS/devToV8/cmt/meta_setup.sh	(revision 370)
+++ /MEMPHYS/devToV8/cmt/meta_setup.sh	(revision 370)
@@ -0,0 +1,9 @@
+
+. /afs/in2p3.fr/home/throng/lalorsay/CMT/v1r18p20050501/mgr/setup.sh
+
+CMTPATH="/afs/in2p3.fr/home/throng/lalorsay/contrib"
+export CMTPATH
+
+CMTCONFIG=slc3_gcc323
+export CMTCONFIG
+
Index: /MEMPHYS/devToV8/cmt/requirements
===================================================================
--- /MEMPHYS/devToV8/cmt/requirements	(revision 370)
+++ /MEMPHYS/devToV8/cmt/requirements	(revision 370)
@@ -0,0 +1,157 @@
+package MEMPHYS
+version v7r0
+
+#//////////////////////////////////////////////////
+#/// Uses needed to build this package ////////////
+#//////////////////////////////////////////////////
+
+use OpenScientist v16r0 Interfaces
+
+#use Geant4 v2r* Interfaces
+
+set G4RADIOACTIVEDATA "${OSC_G4RADIOACTIVEDATA}"
+set G4LEVELGAMMADATA "${OSC_G4LEVELGAMMADATA}"
+set G4LEDATA "${OSC_G4LEDATA}"
+set NeutronHPCrossSections "${OSC_NeutronHPCrossSections}"
+
+#////////////////////////////////////////////////////////////
+#/// From Interfaces/Platform ///////////////////////////////
+#////////////////////////////////////////////////////////////
+
+macro Platform_bin "${CMTCONFIG}"
+#set PLATFORMBIN "${Platform_bin}"
+
+pattern Platform_paths \
+  path_remove LD_LIBRARY_PATH "$(<PACKAGE>ROOT)/$(Platform_bin)" WIN32 "" Darwin "" ;\
+  path_append LD_LIBRARY_PATH "$(<PACKAGE>ROOT)/$(Platform_bin)" WIN32 "" Darwin "" ;\
+  path_remove DYLD_LIBRARY_PATH "" Darwin "$(<PACKAGE>ROOT)/$(Platform_bin)" ;\
+  path_append DYLD_LIBRARY_PATH "" Darwin "$(<PACKAGE>ROOT)/$(Platform_bin)" ;\
+  path_remove PATH "$(<PACKAGE>ROOT)/$(Platform_bin)" WIN32 "$(<PACKAGE>ROOT)\$(Platform_bin)" ;\
+  path_append PATH "$(<PACKAGE>ROOT)/$(Platform_bin)" WIN32 "$(<PACKAGE>ROOT)\$(Platform_bin)"
+
+# Darwin : to build dlls properly :
+macro make_shlib "$(make_shlib)" Darwin "$(MEMPHYSROOT)/cmt/cmt_make_shlib_common.sh extract"
+
+#//////////////////////////////////////////////////
+#//////////////////////////////////////////////////
+#//////////////////////////////////////////////////
+
+branches run
+
+build_strategy no_prototypes
+include_path none
+
+include_dirs $(MEMPHYSROOT)
+
+# With Geant4 global libs :
+macro MEMPHYS_Geant4_incs "${OSC_Geant4_incs}"
+macro MEMPHYS_Geant4_linkopts "-L${OSC_Geant4_lib} -lG4physicslists -lG4readout -lG4run -lG4event -lG4tracking -lG4processes -lG4digits_hits -lG4track -lG4particles -lG4geometry -lG4graphics_reps -lG4materials -lG4intercoms -lG4global -lCLHEP-2.0.3.1"
+
+# Waiting Geant4 DLL on Windows...
+# Darwin : problem too with dylibs.
+macro MEMPHYS_libopts "" WIN32 " -no_share" Darwin " -no_share"
+#macro MEMPHYS_libopts "" WIN32 ""
+
+#//////////////////////////////////////////////////
+#/// Over Geant4 kernel and AIDA interfaces only //
+#//////////////////////////////////////////////////
+
+# Over Geant4 and AIDA only :
+library MEMPHYSCore ${MEMPHYS_libopts} -s=../source *.cxx
+
+#JEC 17/11/05 add the G4readout_incs to manage G4DigiManager
+macro MEMPHYSCore_cppflags "${OSC_AIDA_incs} ${MEMPHYS_Geant4_incs}"
+#macro MEMPHYSCore_shlibflags "${MEMPHYS_Geant4_linkopts}"
+macro MEMPHYSCore_linkopts "-L${MEMPHYSROOT}/$(Platform_bin) -lMEMPHYSCore" WIN32 "${MEMPHYSROOT}\$(Platform_bin)\MEMPHYSCore.lib"
+
+#//////////////////////////////////////////////////
+#/// DLD callbacks ////////////////////////////////
+#//////////////////////////////////////////////////
+
+# Must not use Geant4 singletons if having not Geant4 shared libs.
+macro MEMPHYS_kind "dll"
+library MEMPHYS -s=../source/Callbacks \
+  Callbacks.cxx \
+  InventorCallbacks.cxx \
+  SDL.cxx \
+  PMs.cxx
+#macro MEMPHYS_cppflags "${MEMPHYS_Geant4_incs} ${OSC_OnX_incs}"
+# OSC_Geant4_incs to have G4SystemOfUnits.h.
+macro MEMPHYS_cppflags "${OSC_Geant4_incs} ${OSC_G4Lab_incs} ${OSC_AIDA_incs} ${OSC_OnX_incs} ${OSC_Inventor_incs}"
+macro MEMPHYS_shlibflags "${OSC_Inventor_linkopts} ${OSC_OnX_linkopts}"
+
+#//////////////////////////////////////////////////
+#/// Application "a la Geant4 examples" ///////////
+#//////////////////////////////////////////////////
+
+# Over Geant4 and AIDA only :
+application MEMPHYS_batch ../applications/MEMPHYS_batch.cxx use_linkopts='"${MEMPHYSCore_linkopts} ${MEMPHYS_Geant4_linkopts} ${OSC_AIDA_linkopts}"'
+#macro MEMPHYS_batch_cppflags "${MEMPHYSCore_cppflags} "
+macro MEMPHYS_batch_cppflags "${MEMPHYSCore_cppflags}"
+
+# Over AIDA only :
+application MEMPHYS_analysis ../applications/MEMPHYS_analysis.cxx use_linkopts='"$(OSC_AIDA_linkopts)"'
+
+# Over AIDA only :
+application MEMPHYS_geom ../applications/MEMPHYS_geom.cxx use_linkopts='"$(OSC_AIDA_linkopts)"'
+
+# Over G4Lab :
+application MEMPHYS_session ../applications/MEMPHYS_session.cxx ../applications/HitsCollectionAccessor.cxx use_linkopts='"${MEMPHYSCore_linkopts} ${OSC_G4Lab_linkopts} ${MEMPHYS_Geant4_linkopts} ${OSC_Inventor_linkopts} ${OSC_OnX_linkopts}"' 
+macro MEMPHYS_session_cppflags "${MEMPHYS_Geant4_incs} ${MEMPHYS_batch_cppflags}"
+macro MEMPHYS_sessionlinkopts "" Darwin "-bind_at_load -multiply_defined suppress"
+
+application test -group=debug -s=../source test.cxx
+
+#//////////////////////////////////////////////////
+#/// Things using ROOT ////////////////////////////
+#//////////////////////////////////////////////////
+use ROOT v1r* Interfaces
+
+# Example of ROOT program to work on a MEMPHYS.root file :
+application MEMPHYS_analysis_ROOT -group=ROOT ../applications/MEMPHYS_analysis_ROOT.cxx use_linkopts='"${ROOT_Gpad_linkopts} ${ROOT_freetype_linkopts} ${ROOT_Graf_linkopts} ${ROOT_Tree_linkopts} ${ROOT_Hist_linkopts} ${ROOT_Matrix_linkopts} ${ROOT_Core_linkopts} ${ROOT_Cint_linkopts}"'
+
+application MEMPHYS_geom_ROOT -group=ROOT ../applications/MEMPHYS_geom_ROOT.cxx use_linkopts='"${ROOT_Gpad_linkopts} ${ROOT_freetype_linkopts} ${ROOT_Graf_linkopts} ${ROOT_Tree_linkopts} ${ROOT_Hist_linkopts} ${ROOT_Matrix_linkopts} ${ROOT_Core_linkopts} ${ROOT_Cint_linkopts}"'
+
+# Compiled version of scripts/ROOT/aida.C
+application MEMPHYS_analysis_aida_ROOT -group=ROOT ../applications/MEMPHYS_analysis_aida_ROOT.cxx use_linkopts='"${OSC_AIDA_linkopts} ${ROOT_Gpad_linkopts} ${ROOT_freetype_linkopts} ${ROOT_Graf_linkopts} ${ROOT_Hist_linkopts} ${ROOT_Matrix_linkopts} ${ROOT_Core_linkopts} ${ROOT_Cint_linkopts}"'
+macro MEMPHYS_analysis_aida_ROOT_cppflags "${OSC_AIDA_incs}"
+
+# Declare AIDA to rootcint.
+# See scripts/ROOT/aida.C for a usage example.
+
+macro MEMPHYS_cint_cintflags "${OSC_AIDA_incs}"
+macro MEMPHYS_cint_LinkDef_h "../source/ROOT/LinkDef.h"
+document rootcint MEMPHYS_rootcint_AIDA -group=ROOT ${MEMPHYSROOT}/source/ROOT/MEMPHYS_cint.h
+
+library MEMPHYSAIDADict -group=ROOT -import=ROOT ${dict}/MEMPHYS_cintDict.cpp
+macro MEMPHYSAIDADict_shlibflags "$(OSC_AIDA_linkopts) ${ROOT_Core_linkopts} ${ROOT_Cint_linkopts}"
+
+#//////////////////////////////////////////////////
+#//////////////////////////////////////////////////
+#//////////////////////////////////////////////////
+
+private
+macro build_library_links "true" WIN32 ""
+macro remove_library_links "true" WIN32 ""
+
+# WIN32 : /GR to enable RTTI and dynamic cast.
+# WIN32 : /GX to enable exception handling (for STL).
+macro_append cppflags "" WIN32 " /GX /GR" 
+
+# DEBUG :
+#macro_append cflags  " -g" WIN32 " /ZI /Od"
+#macro_append cppflags  " -g" WIN32 " /ZI /Od"
+#macro_append cpplinkflags  " -g" WIN32 " /DEBUG"
+
+# OPTIMIZE :
+macro_append cflags  " -O" WIN32 " /O2"
+macro_append cppflags  " -O" WIN32 " /O2"
+macro_append cpplinkflags  " -O" WIN32 ""
+public
+
+#//////////////////////////////////////////////////
+#// Run time //////////////////////////////////////
+#//////////////////////////////////////////////////
+
+apply_pattern Platform_paths
+
Index: /MEMPHYS/devToV8/data/inputEventfile
===================================================================
--- /MEMPHYS/devToV8/data/inputEventfile	(revision 370)
+++ /MEMPHYS/devToV8/data/inputEventfile	(revision 370)
@@ -0,0 +1,144 @@
+ $ begin
+ $ nuance     1
+ $ vertex     -166.0    -279.2    -436.6  2.28845E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2112        915.4158   -0.24057    0.90826    0.34234 -1
+ $ info 2  949000  0.0000E+00
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451 -2
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811 -2
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451  0
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811  0
+ $ end
+ $ begin
+ $ nuance     2
+ $ vertex      154.7    -303.6    -169.2  4.50011E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2212        919.3251   -0.29333   -0.75748   -0.58325 -1
+ $ info 2  949000  0.0000E+00
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538 -2
+ $ track     2212        968.7910    0.65022    0.23643    0.72202 -2
+ $ track       22          6.3200    0.98348    0.12859   -0.12742 -2
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538  0
+ $ track     2212        948.7717    0.92826    0.03540   -0.37024  0
+ $ track       22          6.3200    0.98348    0.12859   -0.12742  0
+ $ end
+ $ begin
+ $ nuance     1
+ $ vertex     -166.0    -279.2    -436.6  2.28845E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2112        915.4158   -0.24057    0.90826    0.34234 -1
+ $ info 2  949000  0.0000E+00
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451 -2
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811 -2
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451  0
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811  0
+ $ end
+ $ begin
+ $ nuance     2
+ $ vertex      154.7    -303.6    -169.2  4.50011E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2212        919.3251   -0.29333   -0.75748   -0.58325 -1
+ $ info 2  949000  0.0000E+00
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538 -2
+ $ track     2212        968.7910    0.65022    0.23643    0.72202 -2
+ $ track       22          6.3200    0.98348    0.12859   -0.12742 -2
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538  0
+ $ track     2212        948.7717    0.92826    0.03540   -0.37024  0
+ $ track       22          6.3200    0.98348    0.12859   -0.12742  0
+ $ end
+ $ begin
+ $ nuance     1
+ $ vertex     -166.0    -279.2    -436.6  2.28845E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2112        915.4158   -0.24057    0.90826    0.34234 -1
+ $ info 2  949000  0.0000E+00
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451 -2
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811 -2
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451  0
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811  0
+ $ end
+ $ begin
+ $ nuance     2
+ $ vertex      154.7    -303.6    -169.2  4.50011E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2212        919.3251   -0.29333   -0.75748   -0.58325 -1
+ $ info 2  949000  0.0000E+00
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538 -2
+ $ track     2212        968.7910    0.65022    0.23643    0.72202 -2
+ $ track       22          6.3200    0.98348    0.12859   -0.12742 -2
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538  0
+ $ track     2212        948.7717    0.92826    0.03540   -0.37024  0
+ $ track       22          6.3200    0.98348    0.12859   -0.12742  0
+ $ end
+ $ begin
+ $ nuance     1
+ $ vertex     -166.0    -279.2    -436.6  2.28845E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2112        915.4158   -0.24057    0.90826    0.34234 -1
+ $ info 2  949000  0.0000E+00
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451 -2
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811 -2
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451  0
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811  0
+ $ end
+ $ begin
+ $ nuance     2
+ $ vertex      154.7    -303.6    -169.2  4.50011E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2212        919.3251   -0.29333   -0.75748   -0.58325 -1
+ $ info 2  949000  0.0000E+00
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538 -2
+ $ track     2212        968.7910    0.65022    0.23643    0.72202 -2
+ $ track       22          6.3200    0.98348    0.12859   -0.12742 -2
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538  0
+ $ track     2212        948.7717    0.92826    0.03540   -0.37024  0
+ $ track       22          6.3200    0.98348    0.12859   -0.12742  0
+ $ end
+ $ begin
+ $ nuance     1
+ $ vertex     -166.0    -279.2    -436.6  2.28845E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2112        915.4158   -0.24057    0.90826    0.34234 -1
+ $ info 2  949000  0.0000E+00
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451 -2
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811 -2
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451  0
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811  0
+ $ end
+ $ begin
+ $ nuance     2
+ $ vertex      154.7    -303.6    -169.2  4.50011E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2212        919.3251   -0.29333   -0.75748   -0.58325 -1
+ $ info 2  949000  0.0000E+00
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538 -2
+ $ track     2212        968.7910    0.65022    0.23643    0.72202 -2
+ $ track       22          6.3200    0.98348    0.12859   -0.12742 -2
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538  0
+ $ track     2212        948.7717    0.92826    0.03540   -0.37024  0
+ $ track       22          6.3200    0.98348    0.12859   -0.12742  0
+ $ end
+ $ begin
+ $ nuance     1
+ $ vertex     -166.0    -279.2    -436.6  2.28845E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2112        915.4158   -0.24057    0.90826    0.34234 -1
+ $ info 2  949000  0.0000E+00
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451 -2
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811 -2
+ $ track       13        200.5344   -0.81100    0.53150   -0.24451  0
+ $ track     2212       1014.8815    0.31180   -0.06222    0.94811  0
+ $ end
+ $ begin
+ $ nuance     2
+ $ vertex      154.7    -303.6    -169.2  4.50011E+06
+ $ track       14        300.0000    0.00000    0.00000    1.00000 -1
+ $ track     2212        919.3251   -0.29333   -0.75748   -0.58325 -1
+ $ info 2  949000  0.0000E+00
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538 -2
+ $ track     2212        968.7910    0.65022    0.23643    0.72202 -2
+ $ track       22          6.3200    0.98348    0.12859   -0.12742 -2
+ $ track       14        250.5341   -0.77036   -0.60013    0.21538  0
+ $ track     2212        948.7717    0.92826    0.03540   -0.37024  0
+ $ track       22          6.3200    0.98348    0.12859   -0.12742  0
+ $ end
Index: /MEMPHYS/devToV8/doc/History
===================================================================
--- /MEMPHYS/devToV8/doc/History	(revision 370)
+++ /MEMPHYS/devToV8/doc/History	(revision 370)
@@ -0,0 +1,17 @@
+
+08 July 2006 : G.Barrand
+- Analysis.cxx : book tuples only if in batch.
+  Else, if working with MEMPHYS_session, we book in memory the tuples 
+  and especially the geometry one that consumes memory.
+- DetectorConstruction.cxx, EventAction.cxx : be able to run without 
+  having booked tuples ; for example if running with MEMPHYS_session. 
+
+23 June 2006 : G.Barrand
+- Analyis, MEMPHYS_batch, MEMPHYS_session, MEMPHYS_analyis : 
+  handle first command arg to be able to AIDA chanage file format
+  (to test HDF5 over MEMPHYS).
+- Analysis, DetectorConstruction, EventActiona, 
+  MEMPHYS_batch, MEMPHYS_session : 
+  arrange to be able to run MEMPHYS_batch over a dummy AIDA implementation.
+  For example with OpenScientist/Falsetto. This may be usefull to 
+  see the overhead of the AIDA IO.
Index: /MEMPHYS/devToV8/doc/MEMPHYS.html
===================================================================
--- /MEMPHYS/devToV8/doc/MEMPHYS.html	(revision 370)
+++ /MEMPHYS/devToV8/doc/MEMPHYS.html	(revision 370)
@@ -0,0 +1,2653 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="fr-fr"><head>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  <title>MEMPHYS Software</title><meta content="J-E Campagne " name="author"></head>
+
+<body>
+
+
+
+
+
+<h1 style="text-align: center; color: rgb(0, 0, 153);"><a class="mozTocH1" name="mozTocId909942"></a>Install and run MEMPHYS software&nbsp;</h1>
+
+
+
+
+
+<h1 style="text-align: center; color: rgb(0, 0, 153);">and the associate toolkits</h1>
+
+
+
+
+
+<hr style="width: 100%; height: 2px;">
+<h2 style="color: rgb(51, 102, 255);"><a class="mozTocH2" name="mozTocId102030"></a><span style="color: rgb(51, 51, 255);">Table of Contents</span></h2>
+
+
+
+
+
+<ul id="mozToc">
+
+
+
+
+<!--mozToc h2 2 h3 3 h4 4 h5 5 h6 6--><li><a href="#mozTocId102030">Table of Contents</a>
+    
+    
+    
+    
+    <ul>
+
+
+
+
+      <li><a href="#mozTocId791206">What the user have to know?</a></li>
+
+
+
+
+      <li><a href="#mozTocId474404">Installation of the Plug-ins and the MEMPHYS package&nbsp;</a>
+        
+        
+        
+        
+        <ul>
+
+
+
+
+          <li><a href="#mozTocId129835">The OpenScientist toolkit</a></li>
+
+
+
+
+          <li><a href="#mozTocId109209">The MEMPHYS package</a></li>
+
+
+
+
+        
+        
+        
+        
+        </ul>
+
+
+
+
+      </li>
+
+
+
+
+      <li><a href="#mozTocId3450">Simple runs</a>
+        
+        
+        
+        
+        <ul>
+
+
+
+
+          <li><a href="#mozTocId327975">Interactive session</a></li>
+
+
+
+
+          <li><a href="#mozTocId967005">Batch mode</a></li>
+
+
+
+
+        
+        
+        
+        
+        </ul>
+
+
+
+
+      </li>
+
+
+
+
+    
+    
+    
+    
+    </ul>
+
+
+
+
+  </li>
+
+
+
+
+</ul>
+
+
+
+
+
+<h2 style="color: rgb(51, 51, 255);"><a class="mozTocH2" name="mozTocId791206"></a>What the user have to know?</h2>
+
+
+
+
+
+The user is supposed to know how to practice more or less: <br>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>the Linux OS or the MacOSX<span style="color: rgb(51, 204, 0);"></span></li>
+
+
+
+
+
+  <li>the <a href="http://www.cmtsite.org/">CMT</a> code management tool,</li>
+
+
+
+
+
+  <li>the <a href="http://svnbook.red-bean.com/en/1.0/index.html">SVN</a> the code version repository management tool (this is an alternative to the more usual CVS tool),</li>
+
+
+
+
+
+  <li>the <a href="http://www.cs.uregina.ca/Dept/manuals/Manuals/7Language/7_18C++/c++.htm">C++</a> language,</li>
+
+
+
+
+
+  <li>the <a href="http://geant4.web.cern.ch/geant4/">Geant 4</a> simulation tool,&nbsp;</li>
+
+
+
+
+
+  <li>the&nbsp;<a href="http://openscientist.lal.in2p3.fr/">OpenScientist</a> toolkit especially have a look at the <a href="http://aida.freehep.org">AIDA</a>
+abstract interface for the tuple creation and, also some practice of
+the OpenScientist visualisation to run the MEMPHYS_session executable</li>
+
+
+
+
+
+  <li>the <a href="http://root.cern.ch/">ROOT</a> toolkit if one wants to make analysis/ploting using this package.</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<h2 style="color: rgb(51, 51, 255);"><a class="mozTocH2" name="mozTocId474404"></a>Installation of the Plug-ins and the MEMPHYS package&nbsp;</h2>
+
+
+
+
+
+<div style="text-align: justify;">It is supposed that the SVN, CMT (at
+least version v1r18), ROOT (at least version 4) tools are available
+under the plateform used hereafter. For definitiveness it is
+explicitely shown the commands to be executed under the UNIX/csh shell.
+Usually the toolkits are also providing UNIX/sh shell command file. The
+Mac XXX will be documented later. </div>
+
+
+
+
+
+<h3><a class="mozTocH3" name="mozTocId129835"></a>The OpenScientist toolkit</h3>
+
+
+
+
+
+If the user is running under Linux SL3 with the compiler gcc- 3.2.3, the&nbsp;&nbsp;<a href="http://openscientist.lal.in2p3.fr/">OpenScientist</a> v16r0 toolkit binariies may directly downlaoded <a href="http://openscientist.lal.in2p3.fr/download/v16r0/">here</a>. The <a href="http://proj-clhep.web.cern.ch/proj-clhep/">CLHEP</a> 2.0.3.1 and&nbsp;<a href="http://geant4.web.cern.ch/geant4/">Geant 4</a>
+8.2 version are part of the toolkit and includes all the include files,
+the libraries and the binnaries necessary for the development of the
+MEMPHYS code or similar codes.<br>
+
+
+
+
+
+<br>
+
+
+
+
+
+<a name="OpenScientistInstall"></a>So, the user proceeds as followed (UNIX):<br>
+
+
+
+
+
+<ol>
+
+
+
+
+
+  <li>download the zip file</li>
+
+
+
+
+
+  <li>unzip on a <span style="font-style: italic;">kits</span> area (see the <a href="#CMTIandKits">Kits &amp; CMT hierarchy</a>) that may be different of his/her <span style="font-style: italic;">work</span> area</li>
+
+
+
+
+
+  <li>cd OpenScientist/v16r0</li>
+
+
+
+
+
+  <li>chmod &nbsp;a+x install</li>
+
+
+
+
+
+  <li>./install</li>
+
+
+
+
+
+</ol>
+
+
+
+
+
+To use the toolkit in stand alone mode or to see if the installation
+was fine, first of all setup the environment by sourcing:
+&nbsp;&nbsp;&nbsp; <br>
+
+
+
+
+
+&nbsp;csh&gt; source &lt;path&gt;/OpenScientist/v16r0/aida-setup.csh<br>
+
+
+
+
+
+(&nbsp; sh&gt; . &lt;path&gt;/OpenScientist/v16r0/aida-setup.sh )<br>
+
+
+
+
+
+&nbsp;Then, for instance one may experience the&nbsp; ploting capability :
+<ul>
+
+
+
+
+
+  <li>UNIX&gt;&nbsp; aida-config</li>
+
+
+
+
+
+  <li>UNIX&gt; onxlab</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+The user may see the famous gaussian distribution and the associate fit....<br>
+
+
+
+
+
+<div style="text-align: center;"><img style="width: 858px; height: 734px;" alt="Image" src="Images/onxlab.jpg">
+
+
+
+
+</div>
+
+
+
+
+
+<br>
+
+
+
+
+
+Also, the user may play with&nbsp;Geant4 interactively and show the
+event display. Have a look at the novice examples or a simpler example
+as followed: <br>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>&nbsp;UNIX&gt; G4Simple_session</li>
+
+
+
+
+
+  <li>In the Geant 4 menu, starts with "Init" and then "Run", some tracks will appear when the number of events are validated</li>
+
+
+
+
+
+  <li>To show the geometry: follow the "Physical Volumes" in the "Tree
+actions" and clik on the different directories and leaves. One may see
+the following figure:</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<div style="text-align: center;"><img style="width: 858px; height: 734px;" alt="Image" src="Images/G4Simple.jpg">
+
+
+
+
+</div>
+
+
+
+
+
+<h3><a class="mozTocH3" name="mozTocId109209"></a>The MEMPHYS package</h3>
+
+
+
+
+
+To install the MEMPHYS package, one may adopt a directory hierarchy as followed (UNIX):<br>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>define at the&nbsp;login phase the <a name="CMTPROJECTPATH"></a>CMTPROJECTPATH environment variable:&nbsp;</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">setenv CMTPROJECTPATH "&lt;common-area-path&gt;/kits:&lt;personal-area&gt;"</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li><a name="CMTIandKits"></a>create if not already done the <span style="color: rgb(255, 0, 0);">&lt;common-area-path&gt;/kits</span> area for the OpenScientist toolkit as described <a href="#OpenScientistInstall">above</a>, but also the ROOT toolkit, CMT tool ...</li>
+
+
+
+
+
+  <li>create the <span style="color: rgb(255, 0, 0);">&lt;common-area-path&gt;/CMTI/ <span style="color: rgb(0, 0, 0);">area</span></span>:&nbsp;
+    <ul>
+
+
+
+
+
+    <li>create a <span style="color: rgb(255, 0, 0);"><a name="cmtproject.cmt-1"></a>/cmt/project.cmt</span> file with the simple ligne</li>
+
+
+
+
+
+  
+  
+  
+  
+  
+    </ul>
+  </li>
+
+
+
+
+
+  
+  
+  
+  
+  
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="background-color: rgb(192, 192, 192); width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>project CMTI</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    <li><a name="to_install_the_OpenScientist-CMT_"></a>to install the OpenScientist-CMT&nbsp; Interfaces for OpenScientist toolkit and the ROOT toolkit</li>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      <li>download the Interfaces here (<span style="color: rgb(255, 0, 0); font-weight: bold;">TBD</span>)&nbsp;</li>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      <li>edit the <span style="color: rgb(255, 0, 0);">OpenScientist/v16r0/cmt/requirement</span> file and change the OSC_home macro according to the local implementation as example</li>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(192, 192, 192);">#macro OSC_home "/usr/local/OpenScientist/v16r0"<br>
+
+
+
+
+
+macro OSC_home "/home/campagne/kits/OpenScientist/v16r0/"</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      <li>edit in the same spirit, edit the <span style="color: rgb(255, 0, 0);">ROOT/&lt;version&gt;/cmt/requiement</span> file to change the ROOT_native_version and the ROOT_home macros, as for instance</li>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(192, 192, 192);">#macro ROOT_native_version "v5-13-04b"<br>
+
+
+
+
+
+macro ROOT_native_version "4.03.02"<br>
+
+
+
+
+
+      <br>
+
+
+
+
+
+macro ROOT_home "/home/campagne/kits/root-${ROOT_native_version}" </td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>create a <span style="color: rgb(255, 0, 0);">&lt;personal-area&gt;/OSArea</span> area :
+    <ul>
+
+
+
+
+
+    <li>create a <a name="cmtproject.cmt-2"></a><span style="color: rgb(255, 0, 0);">/cmt/project.cmt</span> file with the simple code making the bridge between the MEMPHYS-like package and the common kits used to develop and use them:</li>
+
+
+
+
+
+  
+  
+  
+  
+  
+    </ul>
+  </li>
+
+
+
+
+
+  
+  
+  
+  
+  
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(192, 192, 192);">project OSArea<br>
+
+
+
+
+
+      <br>
+
+
+
+
+
+use OpenScientist v16r0<br>
+
+
+
+
+
+use CMTI</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    <li>download the MEMPHYS package using&nbsp;
+      <ul>
+
+
+
+
+
+      <li>either a tarball at the following link: <span style="font-weight: bold; color: rgb(255, 0, 0);">TBD if possible</span></li>
+
+
+
+
+
+      <li>either the SVN software:
+          <ul>
+
+
+
+
+
+        <li>define the environment variable:</li>
+
+
+
+
+
+      
+      
+      
+      
+      
+          </ul>
+        </li>
+
+
+
+
+
+      
+      
+      
+      
+      
+
+
+
+
+    
+    
+    
+    
+    
+      </ul>
+    </li>
+
+
+
+
+
+    
+    
+    
+    
+    
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(192, 192, 192);">setenv SVNURL "https://svn.lal.in2p3.fr/Opera/Glob"</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      
+      
+      
+      
+      
+      <ul>
+
+
+
+
+
+        <li>&nbsp;Check Out the HEAD version of the MEMPHYS package if
+you want to be a developer (ie. make later some "svn commit"
+order):&nbsp;</li>
+
+
+
+
+
+      
+      
+      
+      
+      
+      </ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">svn co ${SVNURL}/MEMPHYS/HEAD MEMPHYS/&lt;new-version&gt;</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<br>
+
+
+
+
+
+<div style="text-align: justify;">Look at the repository SVNURL with
+your Web browser and see in the MEMPHYS/tags directory the latest
+tagged version to choose the new-version tag. In general new-version is
+composed with a &lt;major&gt; and a &lt;minor&gt; number (eg.
+v&lt;major&gt;r&lt;minor&gt;) and the usage is that &lt;major&gt;
+indicates non backward compatibility (notice that it might be that
+&lt;minor&gt; release are non backward compatible). 
+
+
+
+
+</div>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      
+      
+      
+      
+      
+      <ul>
+
+
+
+
+
+        <li>execute the CMT setup:</li>
+
+
+
+
+
+      
+      
+      
+      
+      
+      </ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">source &lt;common-area-path&gt;/kits/CMT/&lt;version&gt;/mgr/setup.csh</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      
+      
+      
+      
+      
+      <ul>
+
+
+
+
+
+        <li>&nbsp;Then, one needs to reconfigure the MEMPHYS environment using the CMT ad hoc command</li>
+
+
+
+
+
+      
+      
+      
+      
+      
+      </ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">UNIX&gt; cd MEMPHYS/&lt;version&gt;/cmt<br>
+
+
+
+
+
+UNIX&gt; cmt config<br>
+
+
+
+
+
+UNIX&gt; source setup.csh</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<br>
+
+
+
+
+
+At this stage one may wander if the environment is correct and if CMT
+will find all the packages to proceed to a successful compilation and
+linkage. One can use the following cross-checks:<br>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">UNIX&gt; cd MEMPHYS/&lt;version&gt;/cmt&gt;<br>
+
+
+
+
+
+UNIX&gt; cmt show path<br>
+
+
+
+
+
+# Add path /home/campagne/projets/OSArea from initialization<br>
+
+
+
+
+
+# Add path /home/campagne/kits/OpenScientist/v16r0 from ProjectPath<br>
+
+
+
+
+
+# Add path /home/campagne/CMTI from ProjectPath<br>
+
+
+
+
+
+# Add path /home/campagne/CMTI from ProjectPath</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+Here it is shown that the <a href="#CMTPROJECTPATH">CMTPROJECTPATH</a> is well defined and that the different <a href="#cmtproject.cmt-1">project.cmt files</a> are correctly configurated. Then uses,<br>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">UNIX&gt; cmt show uses<br>
+
+
+
+
+
+# use OpenScientist v16r0 Interfaces<br>
+
+
+
+
+
+# use ROOT v1r* Interfaces (native_version=4.03.02)<br>
+
+
+
+
+
+#<br>
+
+
+
+
+
+# Selection :<br>
+
+
+
+
+
+use CMT v1r18p20051108 (/home/campagne/kits)<br>
+
+
+
+
+
+use ROOT v1r51000p0 Interfaces (/home/campagne/CMTI/)<br>
+
+
+
+
+
+use OpenScientist v16r0 Interfaces (/home/campagne/CMTI/)</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+to see if the<a href="#to_install_the_OpenScientist-CMT_"> OpenScientist and ROOT Interface packages</a> are found (this does not mean yet that the Interfaces are correctly tuned...)<br>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  <ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    <ul>
+
+
+
+
+
+      
+      
+      
+      
+      
+      <ul>
+
+
+
+
+
+        <li>If the above cross-checks are successfuly passed, then one can proceed to the compilation and the link: &nbsp;</li>
+
+
+
+
+
+      
+      
+      
+      
+      
+      </ul>
+
+
+
+
+
+    
+    
+    
+    
+    
+    </ul>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </ul>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">UNIX&gt; cd MEMPHYS/&lt;verson&gt;/cmt<br>
+
+
+
+
+
+UNIX&gt; gmake</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<br>
+
+
+
+
+
+If the all the process of compilationand link is ok, then one should see the following lines:<br>
+
+
+
+
+
+<br>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">[...]<br>
+
+
+
+
+
+------&gt; MEMPHYS_session ok<br>
+
+
+
+
+
+------&gt; (constituents.make) MEMPHYS_session done<br>
+
+
+
+
+
+&nbsp;all ok.</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<br>
+
+
+
+
+
+At the stage, one has build sucessfully MEMPHYS_session (the
+interactive version mostly for visualisation) and the MEMPHYS_batch
+(the batch version mostly for tuple production on large statistics).<br>
+
+
+
+
+
+<h2 style="color: rgb(51, 51, 255);"><a class="mozTocH2" name="mozTocId3450"></a>Simple runs</h2>
+
+
+
+
+
+Usually the user starts an UNIX session and want to run MEMPHYS. The two things to do are:<br>
+
+
+
+
+
+<br>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">1) be sure to define the <a href="#CMTPROJECTPATH">CMTPROJECTPATH</a> variable (at login or by sourcing a meta-setup)<br>
+
+
+
+
+
+2) execute the MEMPHYS setup (no more necessary to run "cmt config"):<br>
+
+
+
+
+
+UNIX&gt; cd &lt;personal-area&gt;/OSArea/MEMPHYS/&lt;versioin&gt;/cmt<br>
+
+
+
+
+
+UNIX&gt; source setup.csh</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<br>
+
+
+
+
+
+The directory hierarchy of the MEMPHYS package is the following:<br>
+
+
+
+
+
+<br>
+
+
+
+
+
+<table style="text-align: left; background-color: rgb(255, 255, 102); width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>source</td>
+
+
+
+
+
+      <td>source Core directory</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>application</td>
+
+
+
+
+
+      <td>source files where the <span style="font-style: italic;">main</span> steering routine is defined</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>MEMPHYS</td>
+
+
+
+
+
+      <td>include files of the Core</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>cmt</td>
+
+
+
+
+
+      <td>directory where the CMT management files are located (requirements, setup/cleanup)</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>data</td>
+
+
+
+
+
+      <td>event file directory. NUANCE style is used to code the primary vertex particles</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>run</td>
+
+
+
+
+
+      <td>executable are run from this directory, the inputEventfile
+symbolic link to an existing event file should be set before run. There
+are also a collection of ROOT macros to decode the output event
+sturcture stored into the tuple.</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td>scripts</td>
+
+
+
+
+
+      <td>Geant4 and OpenScientist scripts</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+<br>
+
+
+
+
+
+<h3><a class="mozTocH3" name="mozTocId327975"></a>Interactive session</h3>
+
+
+
+
+
+In an interactive session the tuple generation is desable and one starts as followed:<br>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(192, 192, 192);">UNIX&gt; cd $MEMPHYSROOT/run<br>
+
+
+
+
+
+UNIX&gt; ../$CMTCONFIG/MEMPHYS_session.exe</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+&nbsp;<br>
+
+
+
+
+
+After more or less 15'' the geometry is loaded, and 15'' more is needed to see the OnX screen session. Then in the <span style="font-style: italic;">Geant </span>menu, one should validate the number of event to process via the <span style="font-style: italic;">Run</span>
+sub-menu. The first event is processed and the track of the optical
+volume are dispayed. By clicking on the eye then it is possible to
+rotate the event, zoom and so on. One may see the following screen:<br>
+
+
+
+
+
+<img style="width: 858px; height: 734px;" alt="image" src="Images/numuEvent.jpg"> <br>
+
+
+<br>
+
+
+One can visualize the "Hits" using the MEMPHYS menu, although it is
+then useful to use the zoom by using CTRL-Shift + drag the mouse in the
+("Hand mode" see right icons).<br>
+
+
+<br>
+
+
+<img style="width: 858px; height: 734px;" alt="Image" src="Images/numuEventHit.jpg"><br>
+
+
+
+
+
+<br>
+
+
+
+
+
+Using "Arrow Mode" (right icons) the user enter in picking mode to get
+some ascii information on the object (or collection of objects selected
+by CTRL-Shift + drag mouse).<br>
+
+
+
+
+
+<h3><a class="mozTocH3" name="mozTocId967005"></a>Batch mode</h3>
+
+
+
+
+
+In the batch mode, the user produces an event tuple (<span style="font-style: italic; color: rgb(255, 0, 0);">run/MEMPHYS.root</span>)
+created via the AIDA abstract interfaces implementation by
+OpenScientist. The I/O is performed in ROOT-I/O repackaged format that
+can be analysed<br>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>&nbsp;either using &nbsp;compilated AIDA code (<span style="font-style: italic; color: rgb(255, 0, 0);">MEMPHYS_analysis_aida_ROOT.exe</span>, <span style="font-style: italic; color: rgb(255, 0, 0);">MEMPHYS_analysis_ROOT.exe</span>) generated by compiling as:&nbsp;</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(204, 204, 204);">UNIX&gt; you are in the <span style="font-style: italic;">run</span> directory<br>
+
+
+
+
+
+UNIX&gt; (cd ../cmt ; gmake ROOT)</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+&nbsp;&nbsp; <br>
+
+
+
+
+
+&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; The difference between the two applications are XXX &nbsp;&nbsp;&nbsp; <br>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>either using interactive OnX session ()</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+<ul>
+
+
+
+
+
+  <li>or&nbsp;using the ROOT toolkit using the <span style="font-style: italic; color: rgb(255, 0, 0);">MEMPHYS_xxx.C</span> macros</li>
+
+
+
+
+
+</ul>
+
+
+
+
+
+The structure of the tuple for the moment is the following:<br>
+
+
+
+
+
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+
+
+
+
+
+  <tbody>
+
+
+
+
+
+    <tr>
+
+
+
+
+
+      <td style="background-color: rgb(102, 255, 153);">&nbsp; std::string column = "int eventId, inputEvtId, interMode, vtxVol, "; <br>
+
+
+
+
+
+&nbsp; column += "ITuple vtxPos = { double x, y, z }, ";<br>
+
+
+
+
+
+&nbsp; column += "int nPart, leptonIndex, protonIndex, ";<br>
+
+
+
+
+
+&nbsp; column += "ITuple track = { int pId, parent, float timeStart, ";<br>
+
+
+
+
+
+&nbsp; column
++=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"ITuple direction = { double dx, dy, dz }, ";<br>
+
+
+
+
+
+&nbsp; column
++=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"double mass, pTot, ETot, ";<br>
+
+
+
+
+
+&nbsp; column
++=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"ITuple momentum&nbsp; = { double px, py, pz }, ";<br>
+
+
+
+
+
+&nbsp; column
++=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"ITuple startPos&nbsp; = { double&nbsp; x,&nbsp; y,&nbsp; z }, ";<br>
+
+
+
+
+
+&nbsp; column
++=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"ITuple stopPos&nbsp;&nbsp; = { double&nbsp; x,&nbsp; y,&nbsp; z }, ";<br>
+
+
+
+
+
+&nbsp; column
++=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"int startVol, stopVol ";<br>
+
+
+
+
+
+&nbsp; column +=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "}, ";<br>
+
+
+
+
+
+&nbsp; column += "int nHits, ITuple hit = { int tubeId, int totalPE, ITuple pe = { float time} }, ";<br>
+
+
+
+
+
+&nbsp; column += "int nDigits, double sumPE, ";<br>
+
+
+
+
+
+&nbsp; column += "ITuple digit = { int tubeId, double pe, time }";</td>
+
+
+
+
+
+    </tr>
+
+
+
+
+
+  
+  
+  
+  
+  
+  </tbody>
+</table>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</body></html>
Index: /MEMPHYS/devToV8/run/MEMPHYS_digit.C
===================================================================
--- /MEMPHYS/devToV8/run/MEMPHYS_digit.C	(revision 370)
+++ /MEMPHYS/devToV8/run/MEMPHYS_digit.C	(revision 370)
@@ -0,0 +1,70 @@
+void MEMPHYS_digit() {
+
+  TCanvas* c1 = new TCanvas("c1","MEMPHYS Digit",100,100,600,600);
+  c1->SetGridx();
+  c1->SetGridy();
+ 
+  TH1F* htime = new TH1F("htile","Time distribution",100,900.,1100.);
+
+
+
+  TFile* f = new TFile("MEMPHYS.root");
+  TTree* tEvent = (TTree*)f->Get("Event");
+
+  //declare Non subTuple part
+  Int_t eventId,inputEvtId, interMode, vtxVol;
+  tEvent->SetBranchAddress("eventId",&eventId);
+  tEvent->SetBranchAddress("inputEvtId",&inputEvtId);
+
+  Int_t nDigits;
+  Double_t sumPE;
+  tEvent->SetBranchAddress("nDigits",&nDigits);
+  tEvent->SetBranchAddress("sumPE",&sumPE);
+
+
+  //The Digit Event:subTuple   
+  TTree* Event_digit = new TTree();
+  tEvent->SetBranchAddress("digit",&Event_digit);
+  Int_t tubeId;
+  Double_t digit_pe, digit_time;
+
+  Int_t nEvent = tEvent->GetEntries();
+
+  for (Int_t i=0; i<nEvent; ++i){
+    tEvent->GetEntry(i);
+//     std::cout << ">>>>>>>>>>>>> Event{" << i << "}: "
+// 	      << " evt Id " << eventId 
+// 	      <<" #digits: " << nDigits
+// 	      << std::endl;
+
+    Int_t nTubeDigits = Event_digit->GetEntries();
+//     std::cout << " nTube Digits = " << nTubeDigits
+// 	      << std::endl;
+
+    
+    // Have a brand new overwritten digit TTree ; we have
+    // to rebind its user variables :
+    Event_digit->SetBranchAddress("tubeId",&tubeId);
+    Event_digit->SetBranchAddress("pe",&digit_pe);
+    Event_digit->SetBranchAddress("time",&digit_time);
+
+
+    //--------
+    // The Digits
+    //--------
+    for (Int_t l=0; l<nTubeDigits; ++l) {
+      Event_digit->GetEntry(l);
+      
+       std::cout << "----> Digit{"<<l<<"}: " 
+ 		<< "tube[" << tubeId << "] = " 
+ 		<< " pe: " << digit_pe
+ 		<< " time: " << digit_time
+ 		<< std::endl;
+      htime->Fill(digit_time);
+      
+    }//Loop on Digits
+  }//loop on event
+
+  htime->Draw();
+
+}//read_event
Index: /MEMPHYS/devToV8/run/MEMPHYS_geom.C
===================================================================
--- /MEMPHYS/devToV8/run/MEMPHYS_geom.C	(revision 370)
+++ /MEMPHYS/devToV8/run/MEMPHYS_geom.C	(revision 370)
@@ -0,0 +1,109 @@
+void MEMPHYS_geom() {
+
+  //see Analysis AIDA Tuple definition
+
+  TFile* f = new TFile("MEMPHYS.root");
+  TTree* tGeom = (TTree*)f->Get("Geometry");
+  
+  //declare Non sibTuple part
+  Double_t wcRadius, wcLenght;
+  tGeom->SetBranchAddress("wcRadius",&wcRadius);
+  tGeom->SetBranchAddress("wcLenght",&wcLenght);
+  Double_t pmtRadius;
+  tGeom->SetBranchAddress("pmtRadius",&pmtRadius);
+  Int_t nPMTs;
+  tGeom->SetBranchAddress("nPMTs",&nPMTs);
+  
+  //The wcOffset subTuple
+  TTree* tGeom_wcOffset = new TTree();
+  tGeom->SetBranchAddress("wcOffset",&tGeom_wcOffset);
+  Double_t xWC,yWC,zWC;
+
+  //The pmtInfos subTuple
+  TTree* tGeom_pmtInfos = new TTree();
+  tGeom->SetBranchAddress("pmtInfos",&tGeom_pmtInfos);
+  Int_t pmtId, pmtLocation;
+
+  //The pmtOrient(ation) subsubTuple
+  TTree* tGeom_pmtInfos_pmtOrient = new TTree();
+  Double_t dx, dy, dz;
+
+  //The pmtPosition subsubTuple
+  TTree* tGeom_pmtInfos_pmtPosition = new TTree();
+  Double_t xPMT, yPMT, zPMT;
+  
+  //--------------------------------
+  //Start to extract the tuple values
+  //--------------------------------
+  Int_t nEntries = tGeom->GetEntries(); //should be 1
+  if ( nEntries !=1 ) {
+    std::cout << "Very suspect, #entries in Geom Tuple = " << nEntries 
+	      << std::endl;
+  }
+  tGeom->GetEntry(0); //suppose that there is only 1 entry
+  
+  std::cout << "WC Radius " << wcRadius << " Length " <<wcLenght << std::endl;  
+
+  
+  nEntries = tGeom_wcOffset->GetEntries(); //should be 1 
+  if ( nEntries !=1 ) {
+    std::cout << "Very suspect, #entries in wcOffset Tuple = " << nEntries 
+	      << std::endl;
+  }
+  
+  // Have a brand new overwritten hit TTree ; we have
+  // to rebind its user variables :
+  tGeom_wcOffset->SetBranchAddress("x",&xWC);
+  tGeom_wcOffset->SetBranchAddress("y",&yWC);
+  tGeom_wcOffset->SetBranchAddress("z",&zWC);
+  tGeom_wcOffset->GetEntry(0);
+
+  std::cout << "WC center: (" 
+	    << xWC << " , "
+	    << yWC << " , "
+	    << zWC << ")" << std::endl;
+
+  std::cout << "#PMTs " << nPMTs 
+	    << " of radius " << pmtRadius
+	    << std::endl;
+
+  Int_t nPMTInfos = tGeom_pmtInfos->GetEntries();
+  if ( nPMTInfos != nPMTs ) {
+    std::cout << "Very suspect, #entries in pmtInfos Tuple = " <<  nPMTInfos
+	      << " <> #PMts = " << nPMTs
+	      << std::endl;
+  }
+  // Have a brand new overwritten hit TTree ; we have
+  // to rebind its user variables :
+  tGeom_pmtInfos->SetBranchAddress("pmtId",&pmtId);
+  tGeom_pmtInfos->SetBranchAddress("pmtLocation",&pmtLocation);
+  tGeom_pmtInfos->SetBranchAddress("pmtOrient",&tGeom_pmtInfos_pmtOrient);
+  tGeom_pmtInfos->SetBranchAddress("pmtPosition",&tGeom_pmtInfos_pmtPosition);
+
+  for (Int_t i=0; i<nPMTInfos; ++i) {
+    tGeom_pmtInfos->GetEntry(i);
+    
+    tGeom_pmtInfos_pmtOrient->SetBranchAddress("dx",&dx);
+    tGeom_pmtInfos_pmtOrient->SetBranchAddress("dy",&dy);
+    tGeom_pmtInfos_pmtOrient->SetBranchAddress("dz",&dz);
+    tGeom_pmtInfos_pmtOrient->GetEntry(0);
+
+
+    tGeom_pmtInfos_pmtPosition->SetBranchAddress("x",&xPMT);
+    tGeom_pmtInfos_pmtPosition->SetBranchAddress("y",&yPMT);
+    tGeom_pmtInfos_pmtPosition->SetBranchAddress("z",&zPMT);
+    tGeom_pmtInfos_pmtPosition->GetEntry(0);
+    
+
+    std::cout << "PMT [" << pmtId <<"]: loc. " <<  pmtLocation
+	      << " pos. (" 
+	      << xPMT << " , "
+	      << yPMT << " , "
+	      << zPMT << ")"
+	      << " dir. (" 
+	      << dx << " , "
+	      << dy << " , "
+	      << dz << ")"
+	      << std::endl;
+  }//Loop on PMTs
+}
Index: /MEMPHYS/devToV8/run/MEMPHYS_hit.C
===================================================================
--- /MEMPHYS/devToV8/run/MEMPHYS_hit.C	(revision 370)
+++ /MEMPHYS/devToV8/run/MEMPHYS_hit.C	(revision 370)
@@ -0,0 +1,76 @@
+void MEMPHYS_hit() {
+
+  TFile* f = new TFile("MEMPHYS.root");
+  TTree* tEvent = (TTree*)f->Get("Event");
+
+  //declare Non subTuple part
+  Int_t eventId,inputEvtId, interMode, vtxVol;
+  tEvent->SetBranchAddress("eventId",&eventId);
+  tEvent->SetBranchAddress("inputEvtId",&inputEvtId);
+
+  Int_t nHits; 
+  tEvent->SetBranchAddress("nHits",&nHits);
+
+
+  //The Hit Event:subTuple
+  TTree* Event_hit = new TTree();
+  tEvent->SetBranchAddress("hit",&Event_hit);
+  Int_t tubeId_hit; //JEC 16/1/06
+  Int_t totalPE;
+  
+  //The Pe Hit::subTuple
+  TTree* Hit_pe = new TTree();
+  Float_t hit_time;
+
+
+  Int_t nEvent = tEvent->GetEntries();
+
+  
+  //  TList* aListOfH = new TList();
+  TNtuple* newTuple = new TNtuple("ntuple","MEMPHYS hit","i:tubeId:totalPE:time");
+
+  for (Int_t i=0; i<nEvent; ++i){
+    tEvent->GetEntry(i);
+
+    std::cout << ">>>>>>>>>>>>> Event{" << i << "}: "
+	      << " evt Id " << eventId 
+	      << " evt Input Id " << inputEvtId
+	      <<" #hits: " << nHits
+	      << std::endl;
+
+    Int_t nTubeHits = Event_hit->GetEntries();
+    std::cout << " Hits = " << nTubeHits
+	      << std::endl;
+
+
+    // Have a brand new overwritten hit TTree ; we have
+    // to rebind its user variables :
+    Event_hit->SetBranchAddress("tubeId",&tubeId_hit); //JEC 16/1/06   
+    Event_hit->SetBranchAddress("totalPE",&totalPE);
+    Event_hit->SetBranchAddress("pe",&Hit_pe);
+    
+
+    //--------
+    // The Hits
+    //--------
+
+    for (Int_t k=0; k<nTubeHits; ++k) {
+      
+      Event_hit->GetEntry(k);
+
+      Hit_pe->SetBranchAddress("time",&hit_time);
+      //JEC 16/1/06 add the tubeId_hit info
+      //std::cout << "----> Hit{"<<k<<"}: tube[" << tubeId_hit << "] total #PE " << totalPE << std::endl;
+      for (Int_t ki=0; ki<Hit_pe->GetEntries(); ++ki) {
+	Hit_pe->GetEntry(ki);
+	//std::cout << "<" << hit_time << ">";
+
+	ntuple->Fill(i,tubeId_hit,totalPE,hit_time);
+      }
+      //      std::cout << std::endl;
+    }//Loop on Hits
+
+  }//loop on event
+
+
+}//MEMPHYS_hit
Index: /MEMPHYS/devToV8/run/MEMPHYS_read_event.C
===================================================================
--- /MEMPHYS/devToV8/run/MEMPHYS_read_event.C	(revision 370)
+++ /MEMPHYS/devToV8/run/MEMPHYS_read_event.C	(revision 370)
@@ -0,0 +1,191 @@
+void MEMPHYS_read_event() {
+
+  TFile* f = new TFile("MEMPHYS.root");
+  TTree* tEvent = (TTree*)f->Get("Event");
+
+  //declare Non subTuple part
+  Int_t eventId,inputEvtId, interMode, vtxVol;
+  tEvent->SetBranchAddress("eventId",&eventId);
+  tEvent->SetBranchAddress("inputEvtId",&inputEvtId);
+  tEvent->SetBranchAddress("interMode",&interMode);
+  tEvent->SetBranchAddress("vtxVol",&vtxVol);
+
+  Int_t nPart,leptonIndex, protonIndex;
+  tEvent->SetBranchAddress("nPart",&nPart);
+  tEvent->SetBranchAddress("leptonIndex",&leptonIndex);
+  tEvent->SetBranchAddress("protonIndex",&protonIndex);
+
+  Int_t nHits; 
+  tEvent->SetBranchAddress("nHits",&nHits);
+
+  Int_t nDigits;
+  Double_t sumPE;
+  tEvent->SetBranchAddress("nDigits",&nDigits);
+  tEvent->SetBranchAddress("sumPE",&sumPE);
+
+
+  //The Track Event:subTuple  part
+  TTree* Event_track = new TTree();
+  tEvent->SetBranchAddress("track",&Event_track);
+  Int_t pId,parent;
+  Float_t timeStart;
+  Double_t mass, pTot, ETot;
+  Int_t startVol, stopVol;
+
+  //The Direction Track:subTuple
+  TTree* Track_direction = new TTree();
+  Double_t dx,dy,dz;
+
+  //The Momentum Track:subTuple
+  TTree* Track_momentum = new TTree();
+  Double_t px,py,pz;
+  
+  //The StartPos Track:subTuple
+  TTree* Track_startPos = new TTree();
+  Double_t start_x,start_y,start_z;
+
+  //The StopPos Track:subTuple
+  TTree* Track_stopPos = new TTree();
+  Double_t stop_x,stop_y,stop_z;
+
+  //The Hit Event:subTuple
+  TTree* Event_hit = new TTree();
+  tEvent->SetBranchAddress("hit",&Event_hit);
+  Int_t tubeId_hit; //JEC 16/1/06
+  Int_t totalPE;
+  
+  //The Pe Hit::subTuple
+  TTree* Hit_pe = new TTree();
+  Float_t hit_time;
+
+  //The Digit Event:subTuple   
+  TTree* Event_digit = new TTree();
+  tEvent->SetBranchAddress("digit",&Event_digit);
+  Int_t tubeId;
+  Double_t digit_pe, digit_time;
+
+  Int_t nEvent = tEvent->GetEntries();
+
+  for (Int_t i=0; i<nEvent; ++i){
+    tEvent->GetEntry(i);
+    std::cout << ">>>>>>>>>>>>> Event{" << i << "}: "
+	      << " evt Id " << eventId 
+	      << " evt Input Id " << inputEvtId
+	      << "\n interaction mode " << interMode
+	      << " start in volume " << vtxVol << "\n"
+	      <<" #tracks: " << nPart
+	      <<" #hits: " << nHits
+	      <<" #digits: " << nDigits
+	      << std::endl;
+
+    Int_t nTracks = Event_track->GetEntries();
+    Int_t nTubeHits = Event_hit->GetEntries();
+    Int_t nTubeDigits = Event_digit->GetEntries();
+    std::cout << "Verif: nTracks = " << nTracks 
+	      << " nTube Hits = " << nTubeHits
+	      << " nTube Digits = " << nTubeDigits
+	      << std::endl;
+
+    // Have a brand new overwritten track TTree ; we have
+    // to rebind its user variables :
+    Event_track->SetBranchAddress("pId",&pId);
+    Event_track->SetBranchAddress("parent",&parent);
+    Event_track->SetBranchAddress("timeStart",&timeStart);
+
+    Event_track->SetBranchAddress("mass",&mass);
+    Event_track->SetBranchAddress("pTot",&pTot);
+    Event_track->SetBranchAddress("ETot",&ETot);
+
+    Event_track->SetBranchAddress("startVol",&startVol);
+    Event_track->SetBranchAddress("stopVol",&stopVol);
+
+    Event_track->SetBranchAddress("direction",&Track_direction);
+    Event_track->SetBranchAddress("momentum",&Track_momentum);
+    Event_track->SetBranchAddress("startPos",&Track_startPos);
+    Event_track->SetBranchAddress("stopPos",&Track_stopPos);
+
+    // Have a brand new overwritten hit TTree ; we have
+    // to rebind its user variables :
+    Event_hit->SetBranchAddress("tubeId",&tubeId_hit); //JEC 16/1/06   
+    Event_hit->SetBranchAddress("totalPE",&totalPE);
+    Event_hit->SetBranchAddress("pe",&Hit_pe);
+    
+    // Have a brand new overwritten digit TTree ; we have
+    // to rebind its user variables :
+    Event_digit->SetBranchAddress("tubeId",&tubeId);
+    Event_digit->SetBranchAddress("pe",&digit_pe);
+    Event_digit->SetBranchAddress("time",&digit_time);
+
+
+    for (Int_t j=0; j<nTracks; ++j) {
+
+      Event_track->GetEntry(j);
+
+      Track_direction->SetBranchAddress("dx",&dx);
+      Track_direction->SetBranchAddress("dy",&dy);
+      Track_direction->SetBranchAddress("dz",&dz);
+      Track_direction->GetEntry(0);
+
+      Track_momentum->SetBranchAddress("px",&px);
+      Track_momentum->SetBranchAddress("py",&py);
+      Track_momentum->SetBranchAddress("pz",&pz);
+      Track_momentum->GetEntry(0);
+
+      Track_startPos->SetBranchAddress("x",&start_x);
+      Track_startPos->SetBranchAddress("y",&start_y);
+      Track_startPos->SetBranchAddress("z",&start_z);
+      Track_startPos->GetEntry(0);
+
+      Track_stopPos->SetBranchAddress("x",&stop_x);
+      Track_stopPos->SetBranchAddress("y",&stop_y);
+      Track_stopPos->SetBranchAddress("z",&stop_z);
+      Track_stopPos->GetEntry(0);
+   
+      std::cout << "----> Tk{"<<j<<"}: " 
+		<< " pId " << pId
+		<< " parent " << parent
+		<< " creation time " << timeStart 
+		<< " Volumes " << startVol << " " << stopVol << "\n"
+		<< " Start Pos (" << start_x << "," << start_y << "," << start_z << ")\n"
+		<< " Stop Pos (" << stop_x << "," << stop_y << "," << stop_z << ")\n"
+		<< " dx,dy,dz " << dx << " " << dy << " " << dz << "\n"
+		<< " m " << mass
+		<< " ETot " << ETot
+		<< " pTot " << pTot
+		<< " px,py,pz " << px << " " << py << " " << pz << "\n"
+                << std::endl;
+    }//loop on Tracks
+
+    //--------
+    // The Hits
+    //--------
+
+    for (Int_t k=0; k<nTubeHits; ++k) {
+      
+      Event_hit->GetEntry(k);
+
+      Hit_pe->SetBranchAddress("time",&hit_time);
+      //JEC 16/1/06 add the tubeId_hit info
+      std::cout << "----> Hit{"<<k<<"}: tube[" << tubeId_hit << "] total #PE " << totalPE << std::endl;
+      for (Int_t ki=0; ki<Hit_pe->GetEntries(); ++ki) {
+	Hit_pe->GetEntry(ki);
+	std::cout << "<" << hit_time << ">";
+      }
+      std::cout << std::endl;
+    }//Loop on Hits
+
+    //--------
+    // The Digits
+    //--------
+    for (Int_t l=0; l<nTubeDigits; ++l) {
+      Event_digit->GetEntry(l);
+      
+      std::cout << "----> Digit{"<<l<<"}: " 
+		<< "tube[" << tubeId << "] = " 
+		<< " pe: " << digit_pe
+		<< " time: " << digit_time
+		<< std::endl;
+      
+    }//Loop on Digits
+  }//loop on event
+}//read_event
