//
//
// Logs:
//
//  $Log: LDisorder.h,v $
//  Revision 1.6  2004/07/13 09:57:57  cvs
//  found bug in tof normalization. solution is to multiply histogram with  tof->Scale(data->fvt->GetEntries()/(Double_t)data->fN/(header->rpmax-header->rpmin)/header->fresolution); and then the tof is normalized! This bug was corrected and commited to cvs.
//
//  Revision 1.5  2003/06/26 11:24:25  cvs
//  modified particle moving with LMiki and faster LDisorder operations
//
//  Revision 1.4  2003/06/26 09:27:11  cvs
//  added log fields...
//
#ifndef _LDISORDER___
#define _LDISORDER___

#include "Config.h"
#include "Util.h"
#include "LMiki.h"

class LDisorder: public LMiki  {
private:
  int idxexclude;//!temp.for calculcation
  float* fprob;//!temp.array for storing probability
  int fNprob;//!size of fprob-1
  LSpace* fspace; //!space
  LParticle* fe; //!electron in a space from LSpace

  int fWa,fWb,fWc;//working space size (odd number!)
  int fWa2,fWb2,fWc2;//!working space size half
  int fWa2c,fWb2c,fWc2c;//!working space size center
  float boltzkTeV;//to speed up is here! 


  float fgamma;//gamma parameter
  float ftemperature;//temperature parameter

  float* fktrack;//!track of the particle position  
  float* fetrack;//!track of the particle energy  
  float ftime;//!recording time resolution (Delta t)
  float ft;//!recording time (real time)
  long fmax;//max number of events in track (default 10000)
  long fN;//current position in recording (time index only)

private:
  int Where(const float a) const;
  long initseed() const;
  void SaveProperties(const int save);
  void SaveProperties(const float position,const float energy);
  int Step();
  int StepFast();
  void Init();
  float Probability(const float r,const float e1,const float e2) const;
  
public:
  LDisorder();
  LDisorder(LSpace* space);
  virtual ~LDisorder();

  void Walk();
  void WalkFast();
  void Test(int testmode=0);

  void SetTemperature(const float temperature){ftemperature=temperature;};
  void SetGamma(const float gamma){fgamma=gamma;};
  void SetMax(const long max);
  void SetWSpace(const int a,const int b,const int c);
  void SetTimeResolution(const float delta);

  float* GetKTrack()const{return fktrack;}
  float* GetETrack()const{return fetrack;}
  float GetTTime()const{return (fN<fmax)?ft:-1.0;}
  long GetN()const{return fN;}
  long GetMax()const{return fmax;}

  ClassDef(LDisorder,0)  //Disorder hopping simulation
};

#endif //_LDISORDER___





