#ifndef TElectronCloud_h #define TElectronCloud_h #include #include "TVector3.h" #include "TLorentzVector.h" #include namespace COMET { class IElectronCloud; }; /// \brief A cloud of TPC drift electrons /// \author Christian Hansen, hansen@ific.uv.es /// /// IElectronCloud /// /// This class stores variables for a cloud of TPC drift electrons. /// One cloud containing only one electron can be used as a single /// drift electron. /// A cloud can be drifted to the readout board. That means letting /// the cloud step through the drift volume, controlled by the B and /// E fields, until the global x position is at the readout board. /// A cloud can be drifted during a certain time period. That means /// letting the cloud step through the drift volume, controlled by the /// B and E fields, until the time is up. /// After a cloud was drifted it can give the transversal diffusion /// and longitudinal diffusion of its electron(s) by giving gaussian /// spread z-y-positions and arrival times respectevily. class COMET::IElectronCloud { public: IElectronCloud(int nE, // number of electrons in cloud TVector3 pos, // start position TVector3 vel, // start velocity double t, // start time int q = -1); // charge, default -1 for electrons ~IElectronCloud(); /// Current Number Electrons int GetNumberElectrons(); void SetNumberElectrons(int nE); /// Charge (-1 for electrons) int GetCharge(); /// Current Center Position of the cloud TVector3 GetPosition(); void SetPosition(TVector3 pos); /// Current Velocity of the cloud TVector3 GetVelocity(); void SetVelocity(TVector3 vel); /// Mean Velocity of the cloud double GetMeanDriftXVelocity(); void SetMeanDriftXVelocity(double meanDriftXVelocity); /// Current Time of the cloud double GetTime(); void SetTime(double time); /// Start Position of the cloud TVector3 GetStartPosition(); /// Is it drifted or not ? bool IsDrifted(); void SetIsDrifted(bool ok); /// Number of steps in the drift int NumberDriftSteps(); void SetNumberDriftSteps(int steps); /// Returns the drift length along the drift directon (x in global coordinates) double GetXDriftLength(); /// Returns the total drift length (straight line approximation). double GetTotDriftLength(); /// Put back the cloud to the start position void UnDrift(); /// By the default the electrons in one electron cloud are assumed to origin from one perfect /// point. But if the initial spread (before drift) of the electrons in the cloud is known this /// can be added with these functions. It will then simply be added to the standard deviation /// when calculating random arrival position and time after drift. void AddInitialYStandardDeviation(double yInitialSigma) {fYInitialSigma = yInitialSigma;}; void AddInitialZStandardDeviation(double zInitialSigma) {fZInitialSigma = zInitialSigma;}; void AddInitialXStandardDeviation(double xInitialSigma) {fXInitialSigma = xInitialSigma;}; /// By the default the electrons in one electron cloud are assumed to origin from one perfect /// point. But if the electrons in this cloud is known to come from for example a flat disk /// (e.g. aluminum dot) or from a parallelogram (e.g. part of an aluminum strip) this can be added here. void SetOriginDiskRadius(double rDisk) {fRDisk = rDisk;}; double GetOriginDiskRadius() {return fRDisk;}; void SetOriginParallelogramCorners(std::vector corners) {fCorners = corners; fCornersAreSet = true;}; bool GetParallelogramIsSet() {return fCornersAreSet;}; // /// If the cloud has been drifted this gives a gaussian random arrival position around the arrival // /// position of the cloud + original offset (if any), otherwice it gives (-1.,-1.,-1.). Standard deviation is // /// tranDiffCoef*sqrt( xDriftLength ) + initial y or z sigma // TVector3 GetRandomArrivalPosition(double tranDiffCoef); /// If the cloud has been drifted this gives a gaussian random arrival time around the arrival /// time of the cloud, otherwice it gives -1. Standard deviation is /// longDiffCoef*sqrt( xDriftLength ) + initial time sigma double GetRandomArrivalTime(double longDiffCoef); /// This gives a gaussian random arrival position around the current position of the /// electron cloud. If the cloud is drifted x is on pad plane for all electrons. TVector3 GetAnElectronsPosition(double tranDiffCoef = 0, double longDiffCoef = 0,bool calibtarget = 0); private: int fNbrEs; int fCharge; TVector3 fPos; TVector3 fStartPos; TVector3 fVel; double fMeanDriftXVelocity; int fNbrSteps; double fYInitialSigma; double fZInitialSigma; double fXInitialSigma; double fRDisk; std::vector fCorners; bool fCornersAreSet; double fT; double fStartT; bool fDrifted; void Initialize(); TVector2 GetRandomPositionOnDisk(); TVector2 GetRandomPositionOnParallelogram(); }; #endif // #ifdef TElectronCloud_hxx