Index: trunk/Mars/melectronics/ElectronicsLinkDef.h
===================================================================
--- trunk/Mars/melectronics/ElectronicsLinkDef.h	(revision 17199)
+++ trunk/Mars/melectronics/ElectronicsLinkDef.h	(revision 17200)
@@ -6,4 +6,5 @@
 
 #pragma link C++ class APD+;
+#pragma link C++ class Afterpulse;
 #pragma link C++ class MAnalogSignal+;
 #pragma link C++ class MDigitalSignal+;
Index: trunk/Mars/melectronics/MAvalanchePhotoDiode.cc
===================================================================
--- trunk/Mars/melectronics/MAvalanchePhotoDiode.cc	(revision 17199)
+++ trunk/Mars/melectronics/MAvalanchePhotoDiode.cc	(revision 17200)
@@ -71,5 +71,5 @@
 //        apd.IncreaseTime(dtend);
 //
-//        // Now you can excess the afterpulses by
+//        // Now you can access the afterpulses by
 //        TIter Next(&a->GetListOfAfterpulses());
 //        Afterpulse *ap = 0;
@@ -94,4 +94,5 @@
 #include "MLog.h"
 #include "MLogManip.h"
+#include "Afterpulse.h"
 
 ClassImp(APD);
Index: trunk/Mars/melectronics/MAvalanchePhotoDiode.h
===================================================================
--- trunk/Mars/melectronics/MAvalanchePhotoDiode.h	(revision 17199)
+++ trunk/Mars/melectronics/MAvalanchePhotoDiode.h	(revision 17200)
@@ -122,44 +122,3 @@
 };
 
-class Afterpulse : public TObject
-{
-private:
-    UInt_t  fCellIndex;  // Index of G-APD cell the afterpulse belongs to
-
-    Float_t fTime;       // Time at which the afterpulse avalanch broke through
-    Float_t fAmplitude;  // Amplitude (crosstalk!) the pulse produced
-
-    Int_t Compare(const TObject *obj) const
-    {
-        return static_cast<const Afterpulse*>(obj)->fTime>fTime ? -1 : 1;
-    }
-
-    Bool_t IsSortable() const { return kTRUE; }
-
-public:
-    Afterpulse(UInt_t idx, Float_t t) : fCellIndex(idx), fTime(t), fAmplitude(0) { }
-
-    UInt_t GetCellIndex() const { return fCellIndex; }
-
-    Float_t GetTime() const { return fTime; }
-    Float_t GetAmplitude() const { return fAmplitude; }
-
-    Float_t Process(APD &apd)
-    {
-        // Do not process afterpulses twice (e.g. HitRelative + IncreaseTime)
-        // This should not happen anyway
-        //        if (fAmplitude>0)
-        //            return fAmplitude;
-
-        const UInt_t nx  = apd.GetNumCellsX()+2;
-
-        const UInt_t x = fCellIndex%nx;
-        const UInt_t y = fCellIndex/nx;
-
-        fAmplitude = apd.HitCellImp(x, y, fTime);
-
-        return fAmplitude;
-    }
-};
-
 #endif
Index: trunk/Mars/melectronics/Makefile
===================================================================
--- trunk/Mars/melectronics/Makefile	(revision 17199)
+++ trunk/Mars/melectronics/Makefile	(revision 17200)
@@ -22,4 +22,5 @@
 
 SRCFILES = MAvalanchePhotoDiode.cc \
+           Afterpulse.cc \
            MAnalogSignal.cc \
            MAnalogChannels.cc \
Index: trunk/Mars/msimcamera/MSimAPD.cc
===================================================================
--- trunk/Mars/msimcamera/MSimAPD.cc	(revision 17199)
+++ trunk/Mars/msimcamera/MSimAPD.cc	(revision 17200)
@@ -69,4 +69,5 @@
 
 #include "MAvalanchePhotoDiode.h"
+#include "Afterpulse.h"
 
 ClassImp(MSimAPD);
