ROOT logo
#ifndef HPARTICLEANGLECOR_H
#define HPARTICLEANGLECOR_H

#include "hades.h"
#include "hevent.h"
#include "hparticlecand.h"
#include "heventheader.h"
#include "hgeomvector.h"
#include "hparticledef.h"

#include "TObject.h"
#include "TMath.h"
#include "TString.h"


#include <queue>

using namespace std;

class HParticleAngleCor : public TObject {
protected:
    Float_t meanZTarget;   // typical shift of target centroid in lab coordinates (in mm)
    Float_t zRichCenter;   // typical shift of rich as compared to design value. Determined via meanZTarget (in mm)
    Float_t zMirror;       // center of Rich mirror in lab coordinates. Depends on zRichCenter and RICH geometry.
    Float_t rMirror;       // effective radius for dominant multiple scattering source (in between mirror and shell radius).
    Float_t drShield;      // additional distance from target center to effective multiple scattering point due to delta electron shield
    Float_t maxRhoShield;  // end of delta electron shield (perpendicular to beam axis projected onto mirror/shell sphere)
    Bool_t  useMeanXY;
    Bool_t  useShield;     // delta electron shield provides significant contribution to multiple scattering
    Int_t   vertexType;    // switch cluster,segment,particle global vertex (see Particle:VertexXXX)
    Bool_t  bDoWarn;
    Double_t sumXVertex;
    Double_t sumYVertex;
    UInt_t  maxAverage;
    HGeomVector globalVertex; // if useMeanXY=true x,y values are mean values averaged over maxAverage events
    queue<Float_t> qxVertex;
    queue<Float_t> qyVertex;
    UInt_t evtSeqNo;

public:
    HParticleAngleCor(void);
    ~HParticleAngleCor(void) {};
    void        initParam(void);
    void        resetMeanVertex();
    Bool_t      recalcEmission(const Double_t z, const Double_t rho, const Double_t theta, const Double_t phi,
			       Double_t & zCor, Double_t & rhoCor, Double_t & thetaCor, Double_t & phiCor);
    Bool_t      recalcEmission(const HParticleCand * pCand,
			       Double_t & zCor, Double_t & rhoCor, Double_t & thetaCor,Double_t & phiCor);
    Bool_t      recalcAngles     (const HParticleCand * pCand, Double_t & thetaCor, Double_t & phiCor);
    Bool_t      recalcSetAngles  (HParticleCand* pCand);
    Bool_t      recalcSetEmission(HParticleCand* pCand);
    static Bool_t alignRichRing(const Double_t theta, const Double_t phi, Double_t & thetaCor, Double_t & phiCor);
    static Bool_t alignRichRing(HParticleCand* pCand);
    static Bool_t realignRichRing(const HParticleCand* pCand, Double_t & thetaCor, Double_t & phiCor);
    static Bool_t realignRichRing(HParticleCand* pCand);
    static Float_t matchRingTrack(HParticleCand* cand);
    void        calcSegVector(const Double_t z, const Double_t rho, const Double_t phi, const Double_t theta,
			      HGeomVector &base, HGeomVector &dir);
    void        setMeanZTarget(const Float_t zValue);
    void        setShield(const Bool_t shieldFlag);
    Bool_t      setDefaults(const TString beamtime);
    void        setMaxAverage(UInt_t n) { if (n > 1 ) maxAverage = n; }
    void        setUseMeanXYVertex(void);
    void        setUseEventXYVertex(void);
    void        setDoWarning(Bool_t warn) { bDoWarn = warn; }
    Bool_t      getMeanXYVertex(Float_t & xValue, Float_t & yValue);
    Float_t     getMeanZTarget(void) {return meanZTarget;}; // center of segmented target
    void        setVertexType(Int_t v=Particle::kVertexSegment) { vertexType = v ;}
    Int_t       getVertexType(){ return vertexType ;}
    HGeomVector getGlobalVertex(Int_t v=Particle::kVertexParticle,Bool_t warn=kFALSE);
    Bool_t      setGlobalVertex(void); // will be called once per event if not done explicitely
    ClassDef(HParticleAngleCor,0) //Correct emission angles by assuming a multiple scattering kick at the Rich mirror/housing
};
#endif //HPARTICLEANGLECOR_H
 hparticleanglecor.h:1
 hparticleanglecor.h:2
 hparticleanglecor.h:3
 hparticleanglecor.h:4
 hparticleanglecor.h:5
 hparticleanglecor.h:6
 hparticleanglecor.h:7
 hparticleanglecor.h:8
 hparticleanglecor.h:9
 hparticleanglecor.h:10
 hparticleanglecor.h:11
 hparticleanglecor.h:12
 hparticleanglecor.h:13
 hparticleanglecor.h:14
 hparticleanglecor.h:15
 hparticleanglecor.h:16
 hparticleanglecor.h:17
 hparticleanglecor.h:18
 hparticleanglecor.h:19
 hparticleanglecor.h:20
 hparticleanglecor.h:21
 hparticleanglecor.h:22
 hparticleanglecor.h:23
 hparticleanglecor.h:24
 hparticleanglecor.h:25
 hparticleanglecor.h:26
 hparticleanglecor.h:27
 hparticleanglecor.h:28
 hparticleanglecor.h:29
 hparticleanglecor.h:30
 hparticleanglecor.h:31
 hparticleanglecor.h:32
 hparticleanglecor.h:33
 hparticleanglecor.h:34
 hparticleanglecor.h:35
 hparticleanglecor.h:36
 hparticleanglecor.h:37
 hparticleanglecor.h:38
 hparticleanglecor.h:39
 hparticleanglecor.h:40
 hparticleanglecor.h:41
 hparticleanglecor.h:42
 hparticleanglecor.h:43
 hparticleanglecor.h:44
 hparticleanglecor.h:45
 hparticleanglecor.h:46
 hparticleanglecor.h:47
 hparticleanglecor.h:48
 hparticleanglecor.h:49
 hparticleanglecor.h:50
 hparticleanglecor.h:51
 hparticleanglecor.h:52
 hparticleanglecor.h:53
 hparticleanglecor.h:54
 hparticleanglecor.h:55
 hparticleanglecor.h:56
 hparticleanglecor.h:57
 hparticleanglecor.h:58
 hparticleanglecor.h:59
 hparticleanglecor.h:60
 hparticleanglecor.h:61
 hparticleanglecor.h:62
 hparticleanglecor.h:63
 hparticleanglecor.h:64
 hparticleanglecor.h:65
 hparticleanglecor.h:66
 hparticleanglecor.h:67
 hparticleanglecor.h:68
 hparticleanglecor.h:69
 hparticleanglecor.h:70
 hparticleanglecor.h:71
 hparticleanglecor.h:72
 hparticleanglecor.h:73
 hparticleanglecor.h:74