Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

WCSimVertexGeometry Class Reference

#include "WCSimVertexGeometry.hh"

List of all members.

Public Member Functions

void LoadEvent (WCSimRecoEvent *evt)
void CalcResiduals (WCSimRecoEvent *evt, WCSimRecoVertex *vtx)
void CalcResiduals (WCSimRecoVertex *vtx)
void CalcResiduals (Double_t vx, Double_t vy, Double_t vz, Double_t vtxTime, Double_t px, Double_t py, Double_t pz)
void CalcPointResiduals (Double_t vx, Double_t vy, Double_t vz, Double_t vtxTime, Double_t px, Double_t py, Double_t pz)
void CalcExtendedResiduals (Double_t vx, Double_t vy, Double_t vz, Double_t vtxTime, Double_t px, Double_t py, Double_t pz)
void CalcVertexSeeds (WCSimRecoEvent *evt, Int_t NSeeds=1)
void CalcVertexSeeds (Int_t NSeeds=1)
WCSimRecoVertexCalcSimpleVertex (WCSimRecoEvent *evt)
WCSimRecoVertexCalcSimpleVertex ()
WCSimRecoVertexCalcSimpleDirection (WCSimRecoEvent *evt, WCSimRecoVertex *vtx)
WCSimRecoVertexCalcSimpleDirection (WCSimRecoVertex *vtx)
Int_t GetNDigits ()
Int_t GetNFilterDigits ()
Bool_t IsFiltered (Int_t idigit)
Double_t GetDigitX (Int_t idigit)
Double_t GetDigitY (Int_t idigit)
Double_t GetDigitZ (Int_t idigit)
Double_t GetDigitT (Int_t idigit)
Double_t GetDigitQ (Int_t idigit)
Double_t GetConeAngle (Int_t idigit)
Double_t GetAngle (Int_t idigit)
Double_t GetZenith (Int_t idigit)
Double_t GetAzimuth (Int_t idigit)
Double_t GetSolidAngle (Int_t idigit)
Double_t GetDistPoint (Int_t idigit)
Double_t GetDistTrack (Int_t idigit)
Double_t GetDistPhoton (Int_t idigit)
Double_t GetDistScatter (Int_t idigit)
Double_t GetDeltaTime (Int_t idigit)
Double_t GetDeltaSigma (Int_t idigit)
Double_t GetDeltaAngle (Int_t idigit)
Double_t GetDeltaPoint (Int_t idigit)
Double_t GetDeltaTrack (Int_t idigit)
Double_t GetDeltaPhoton (Int_t idigit)
Double_t GetDeltaScatter (Int_t idigit)
Double_t GetPointPath (Int_t idigit)
Double_t GetExtendedPath (Int_t idigit)
Double_t GetPointResidual (Int_t idigit)
Double_t GetExtendedResidual (Int_t idigit)
Double_t GetDelta (Int_t idigit)
Double_t GetDeltaCorrection (Int_t idigit, Double_t length)
UInt_t GetNSeeds ()
Double_t GetSeedVtxX (UInt_t ivtx)
Double_t GetSeedVtxY (UInt_t ivtx)
Double_t GetSeedVtxZ (UInt_t ivtx)
Double_t GetSeedVtxTime (UInt_t ivtx)

Static Public Member Functions

static WCSimVertexGeometryInstance ()

Private Member Functions

 WCSimVertexGeometry ()
 ~WCSimVertexGeometry ()
void CalcSimpleVertex (Double_t &vtxX, Double_t &vtxY, Double_t &vtxZ, Double_t &vtxTime)
void ChooseNextQuadruple (Double_t &x0, Double_t &y0, Double_t &z0, Double_t &t0, Double_t &x1, Double_t &y1, Double_t &z1, Double_t &t1, Double_t &x2, Double_t &y2, Double_t &z2, Double_t &t2, Double_t &x3, Double_t &y3, Double_t &z3, Double_t &t3)
void ChooseNextDigit (Double_t &x, Double_t &y, Double_t &z, Double_t &t)

Private Attributes

Int_t fRunNum
Int_t fEventNum
Int_t fTriggerNum
Int_t fPMTs
Int_t fNDigits
Int_t fNFilterDigits
Int_t fThisDigit
Int_t fLastEntry
Int_t fCounter
Double_t fVtxX1
Double_t fVtxY1
Double_t fVtxZ1
Double_t fVtxTime1
Double_t fVtxX2
Double_t fVtxY2
Double_t fVtxZ2
Double_t fVtxTime2
Double_t fMeanQ
Double_t fTotalQ
Double_t fMeanFilteredQ
Double_t fTotalFilteredQ
Double_t fMinTime
Double_t fMaxTime
Bool_t * fIsFiltered
Double_t * fDigitX
Double_t * fDigitY
Double_t * fDigitZ
Double_t * fDigitT
Double_t * fDigitQ
Double_t * fZenith
Double_t * fAzimuth
Double_t * fSolidAngle
Double_t * fConeAngle
Double_t * fDistPoint
Double_t * fDistTrack
Double_t * fDistPhoton
Double_t * fDistScatter
Double_t * fDeltaTime
Double_t * fDeltaSigma
Double_t * fDeltaAngle
Double_t * fDeltaPoint
Double_t * fDeltaTrack
Double_t * fDeltaPhoton
Double_t * fDeltaScatter
Double_t * fPointPath
Double_t * fExtendedPath
Double_t * fPointResidual
Double_t * fExtendedResidual
Double_t * fDelta
std::vector< Double_t > vSeedVtxX
std::vector< Double_t > vSeedVtxY
std::vector< Double_t > vSeedVtxZ
std::vector< Double_t > vSeedVtxTime
std::vector< Int_t > vSeedDigitList
std::vector< WCSimRecoVertex * > vVertexList

Detailed Description

Definition at line 11 of file WCSimVertexGeometry.hh.


Constructor & Destructor Documentation

WCSimVertexGeometry::WCSimVertexGeometry (  )  [private]

Definition at line 40 of file WCSimVertexGeometry.cc.

References fAzimuth, fConeAngle, fCounter, fDelta, fDeltaAngle, fDeltaPhoton, fDeltaPoint, fDeltaScatter, fDeltaSigma, fDeltaTime, fDeltaTrack, fDigitQ, fDigitT, fDigitX, fDigitY, fDigitZ, fDistPhoton, fDistPoint, fDistScatter, fDistTrack, fEventNum, fExtendedPath, fExtendedResidual, fIsFiltered, fLastEntry, fMaxTime, fMeanFilteredQ, fMeanQ, fMinTime, fNDigits, fNFilterDigits, fPMTs, fPointPath, fPointResidual, fRunNum, fSolidAngle, fThisDigit, fTotalFilteredQ, fTotalQ, fTriggerNum, fVtxTime1, fVtxTime2, fVtxX1, fVtxX2, fVtxY1, fVtxY2, fVtxZ1, fVtxZ2, fZenith, Instance(), and WCSimGeometry::TouchGeometry().

{
  if( WCSimGeometry::TouchGeometry() ){
    fPMTs = WCSimGeometry::Instance()->GetNumPMTs();
  }
  else{
    fPMTs = 100000; // maximum number of digits
  }
  
  fRunNum = -1;
  fEventNum = -1;
  fTriggerNum = -1;
  
  fNDigits = 0;
  fNFilterDigits = 0;

  fThisDigit = 0;
  fLastEntry = 0; 
  fCounter = 0;

  fMeanQ = 0.0;
  fTotalQ = 0.0;
  fMeanFilteredQ = 0.0;
  fTotalFilteredQ = 0.0;

  fMinTime = 0.0;
  fMaxTime = 0.0;
  
  fVtxX1 = 0.0;
  fVtxY1 = 0.0;
  fVtxZ1 = 0.0;
  fVtxTime1 = 0.0;

  fVtxX2 = 0.0;
  fVtxY2 = 0.0;
  fVtxZ2 = 0.0;
  fVtxTime2 = 0.0;

  fIsFiltered = new Bool_t[fPMTs];

  fDigitX = new Double_t[fPMTs];
  fDigitY = new Double_t[fPMTs];
  fDigitZ = new Double_t[fPMTs];
  fDigitT = new Double_t[fPMTs];
  fDigitQ = new Double_t[fPMTs];

  fConeAngle = new Double_t[fPMTs];
  fZenith = new Double_t[fPMTs];
  fAzimuth = new Double_t[fPMTs];
  fSolidAngle = new Double_t[fPMTs];

  fDistPoint = new Double_t[fPMTs];
  fDistTrack = new Double_t[fPMTs];
  fDistPhoton = new Double_t[fPMTs];
  fDistScatter = new Double_t[fPMTs];

  fDeltaTime = new Double_t[fPMTs];
  fDeltaSigma = new Double_t[fPMTs];

  fDeltaAngle = new Double_t[fPMTs];
  fDeltaPoint = new Double_t[fPMTs];
  fDeltaTrack = new Double_t[fPMTs];
  fDeltaPhoton = new Double_t[fPMTs];
  fDeltaScatter = new Double_t[fPMTs];

  fPointPath = new Double_t[fPMTs];
  fExtendedPath = new Double_t[fPMTs];

  fPointResidual = new Double_t[fPMTs];
  fExtendedResidual = new Double_t[fPMTs];

  fDelta = new Double_t[fPMTs];

  for( Int_t n=0; n<fPMTs; n++ ){
    fIsFiltered[n] = 0.0;

    fDigitX[n] = 0.0;
    fDigitY[n] = 0.0;
    fDigitZ[n] = 0.0;
    fDigitT[n] = 0.0;
    fDigitQ[n] = 0.0;

    fConeAngle[n] = 0.0;
    fZenith[n] = 0.0;
    fAzimuth[n] = 0.0;
    fSolidAngle[n] = 0.0;

    fDistPoint[n] = 0.0;
    fDistTrack[n] = 0.0;
    fDistPhoton[n] = 0.0; 
    fDistScatter[n] = 0.0; 

    fDeltaTime[n] = 0.0;
    fDeltaSigma[n] = 0.0;

    fDeltaAngle[n] = 0.0;    
    fDeltaPoint[n] = 0.0;
    fDeltaTrack[n] = 0.0;
    fDeltaPhoton[n] = 0.0;
    fDeltaScatter[n] = 0.0;

    fPointPath[n] = 0.0;
    fExtendedPath[n] = 0.0;
    fPointResidual[n] = 0.0;
    fExtendedResidual[n] = 0.0;

    fDelta[n] = 0.0;
  }
}

WCSimVertexGeometry::~WCSimVertexGeometry (  )  [private]

Definition at line 150 of file WCSimVertexGeometry.cc.

References fAzimuth, fConeAngle, fDelta, fDeltaAngle, fDeltaPhoton, fDeltaPoint, fDeltaScatter, fDeltaSigma, fDeltaTime, fDeltaTrack, fDigitQ, fDigitT, fDigitX, fDigitY, fDigitZ, fDistPhoton, fDistPoint, fDistScatter, fDistTrack, fExtendedPath, fExtendedResidual, fIsFiltered, fPointPath, fPointResidual, fSolidAngle, and fZenith.

{
  if( fIsFiltered ) delete [] fIsFiltered;

  if( fDigitX ) delete [] fDigitX;
  if( fDigitY ) delete [] fDigitY;
  if( fDigitZ ) delete [] fDigitZ;
  if( fDigitT ) delete [] fDigitT;
  if( fDigitQ ) delete [] fDigitQ; 

  if( fConeAngle ) delete [] fConeAngle;
  if( fZenith ) delete [] fZenith;
  if( fAzimuth ) delete [] fAzimuth;
  if( fSolidAngle ) delete [] fSolidAngle;

  if( fDistPoint )  delete [] fDistPoint;
  if( fDistTrack )  delete [] fDistTrack;
  if( fDistPhoton ) delete [] fDistPhoton;   
  if( fDistScatter ) delete [] fDistScatter;

  if( fDeltaTime )   delete [] fDeltaTime;
  if( fDeltaSigma ) delete [] fDeltaSigma;

  if( fDeltaAngle )  delete [] fDeltaAngle;  
  if( fDeltaPoint )  delete [] fDeltaPoint;
  if( fDeltaTrack )  delete [] fDeltaTrack;
  if( fDeltaPhoton ) delete [] fDeltaPhoton;
  if( fDeltaScatter ) delete [] fDeltaScatter;

  if( fPointPath ) delete [] fPointPath;
  if( fExtendedPath ) delete [] fExtendedPath;
  if( fPointResidual )  delete [] fPointResidual;
  if( fExtendedResidual ) delete [] fExtendedResidual;

  if( fDelta ) delete [] fDelta;  
}


Member Function Documentation

void WCSimVertexGeometry::CalcExtendedResiduals ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  vtxTime,
Double_t  px,
Double_t  py,
Double_t  pz 
)

Definition at line 579 of file WCSimVertexGeometry.cc.

References CalcResiduals(), fDelta, fExtendedResidual, and fNDigits.

{
  this->CalcResiduals( vtxX, vtxY, vtxZ, vtxTime,
                       dirX, dirY, dirZ );

  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    fDelta[idigit] = fExtendedResidual[idigit];
  }

  return;
}

void WCSimVertexGeometry::CalcPointResiduals ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  vtxTime,
Double_t  px,
Double_t  py,
Double_t  pz 
)

Definition at line 567 of file WCSimVertexGeometry.cc.

References CalcResiduals(), fDelta, fNDigits, and fPointResidual.

{
  this->CalcResiduals( vtxX, vtxY, vtxZ, vtxTime,
                       dirX, dirY, dirZ );

  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    fDelta[idigit] = fPointResidual[idigit];
  }

  return;
}

void WCSimVertexGeometry::CalcResiduals ( WCSimRecoVertex vtx  ) 

Definition at line 544 of file WCSimVertexGeometry.cc.

References CalcResiduals(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), and WCSimRecoVertex::GetZ().

{
  // sanity check
  // ============
  if( myVertex==0 ) return;

  // get vertex information
  // ======================
  Double_t vtxX = myVertex->GetX();
  Double_t vtxY = myVertex->GetY();
  Double_t vtxZ = myVertex->GetZ();
  Double_t vtxTime = myVertex->GetTime();

  Double_t dirX = myVertex->GetDirX();
  Double_t dirY = myVertex->GetDirY();
  Double_t dirZ = myVertex->GetDirZ();

  // calculate residuals
  // ===================
  return this->CalcResiduals( vtxX, vtxY, vtxZ, vtxTime,
                              dirX, dirY, dirZ );
}

void WCSimVertexGeometry::CalcResiduals ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  vtxTime,
Double_t  px,
Double_t  py,
Double_t  pz 
)

Definition at line 591 of file WCSimVertexGeometry.cc.

References WCSimParameters::CherenkovAngle(), fAzimuth, fConeAngle, fDelta, fDeltaAngle, fDeltaPhoton, fDeltaPoint, fDeltaScatter, fDeltaSigma, fDeltaTime, fDeltaTrack, fDigitQ, fDigitT, fDigitX, fDigitY, fDigitZ, fDistPhoton, fDistPoint, fDistScatter, fDistTrack, fExtendedPath, fExtendedResidual, fNDigits, fPointPath, fPointResidual, fSolidAngle, fZenith, WCSimParameters::RefractiveIndex(), WCSimParameters::SpeedOfLight(), and WCSimParameters::TimeResolution().

{
  // reset arrays
  // ============
  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    fConeAngle[idigit] = 0.0;
    fZenith[idigit] = 0.0;
    fAzimuth[idigit] = 0.0;
    fSolidAngle[idigit] = 0.0;
    fDistPoint[idigit] = 0.0;
    fDistTrack[idigit] = 0.0;
    fDistPhoton[idigit] = 0.0;  
    fDistScatter[idigit] = 0.0; 
    fDeltaTime[idigit] = 0.0; 
    fDeltaSigma[idigit] = 0.0;
    fDeltaAngle[idigit] = 0.0;
    fDeltaPoint[idigit] = 0.0;
    fDeltaTrack[idigit] = 0.0;
    fDeltaPhoton[idigit] = 0.0;
    fDeltaScatter[idigit] = 0.0;
    fPointPath[idigit] = 0.0;
    fExtendedPath[idigit] = 0.0;
    fPointResidual[idigit] = 0.0;
    fExtendedResidual[idigit] = 0.0;
    fDelta[idigit] = 0.0;
  }

  // cone angle
  // ==========
  Double_t thetadeg = WCSimParameters::CherenkovAngle(); // degrees
  Double_t theta = thetadeg*(TMath::Pi()/180.0); // degrees->radians

  // loop over digits
  // ================
  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    Double_t dx = fDigitX[idigit]-vtxX;
    Double_t dy = fDigitY[idigit]-vtxY;
    Double_t dz = fDigitZ[idigit]-vtxZ;
    Double_t ds = sqrt(dx*dx+dy*dy+dz*dz);

    Double_t px = dx/ds;
    Double_t py = dy/ds;
    Double_t pz = dz/ds;

    Double_t cosphi = 1.0;
    Double_t sinphi = 1.0;
    Double_t phi = 0.0; 
    Double_t phideg = 0.0;

    Double_t ax = 0.0;
    Double_t ay = 0.0;
    Double_t az = 0.0;
    Double_t azideg = 0.0;

    // calculate angles if direction is known
    if( dirX*dirX + dirY*dirY + dirZ*dirZ>0.0 ){

      // zenith angle
      cosphi = px*dirX+py*dirY+pz*dirZ;
      phi = acos(cosphi); // radians
      phideg = phi/(TMath::Pi()/180.0); // radians->degrees
      sinphi = sqrt(1.0-cosphi*cosphi);
      sinphi += 0.24*exp(-sinphi/0.24);
      sinphi /= 0.684;  // sin(phideg)/sin(thetadeg)

      // azimuthal angle
      if( dirX*dirX+dirY*dirY>0.0 ){
        ax = (px*dirZ-pz*dirX) - (py*dirX-px*dirY)*(1.0-dirZ)*dirY/sqrt(dirX*dirX+dirY*dirY);
        ay = (py*dirZ-pz*dirY) - (px*dirY-py*dirX)*(1.0-dirZ)*dirX/sqrt(dirX*dirX+dirY*dirY);
        az = pz*dirZ + py*dirY + px*dirX;
      }
      else{
        ax = px;
        ay = py;
        az = pz;
      }

      azideg = atan2(ay,ax)/(TMath::Pi()/180.0); // radians->degrees
    }

    Double_t Lpoint = ds;
    Double_t Ltrack = 0.0;
    Double_t Lphoton = 0.0;
    Double_t Lscatter = 0.0;
 
    if( phi<theta ){
      Ltrack = Lpoint*sin(theta-phi)/sin(theta);
      Lphoton = Lpoint*sin(phi)/sin(theta);
      Lscatter = 0.0;
    }
    else{
      Ltrack = 0.0;
      Lphoton = Lpoint;
      Lscatter = Lpoint*(phi-theta);
    }

    Double_t fC = WCSimParameters::SpeedOfLight();
    Double_t fN = WCSimParameters::RefractiveIndex(Lphoton);

    Double_t dt = fDigitT[idigit] - vtxTime;
    Double_t qpes = fDigitQ[idigit];
    Double_t res = WCSimParameters::TimeResolution(qpes);

    fConeAngle[idigit] = thetadeg; // degrees
    fZenith[idigit] = phideg;      // degrees
    fAzimuth[idigit] = azideg;     // degrees
    fSolidAngle[idigit] = sinphi;

    fDistPoint[idigit] = Lpoint;       
    fDistTrack[idigit] = Ltrack;
    fDistPhoton[idigit] = Lphoton;
    fDistScatter[idigit] = Lscatter;

    fDeltaTime[idigit] = dt;
    fDeltaSigma[idigit] = res;   
    
    fDeltaAngle[idigit] = phideg-thetadeg; // degrees
    fDeltaPoint[idigit] = Lpoint/(fC/fN);
    fDeltaTrack[idigit] = Ltrack/fC;
    fDeltaPhoton[idigit] = Lphoton/(fC/fN);
    fDeltaScatter[idigit] = Lscatter/(fC/fN);
 
    fPointPath[idigit] = fN*Lpoint;
    fExtendedPath[idigit] = Ltrack + fN*Lphoton;

    fPointResidual[idigit] = dt - Lpoint/(fC/fN);
    fExtendedResidual[idigit] = dt - Ltrack/fC - Lphoton/(fC/fN);

    fDelta[idigit] = fExtendedResidual[idigit]; // default
  }

  return;
}   

void WCSimVertexGeometry::CalcResiduals ( WCSimRecoEvent evt,
WCSimRecoVertex vtx 
)

Definition at line 533 of file WCSimVertexGeometry.cc.

References LoadEvent().

Referenced by CalcExtendedResiduals(), CalcPointResiduals(), CalcResiduals(), WCSimVertexViewer::DrawNewRecoEvent(), and WCSimVertexNtuple::WriteVariables().

{
  // load event
  // ==========
  this->LoadEvent(myEvent);

  // calculate residuals
  // ===================
  return this->CalcResiduals(myVertex);
}

WCSimRecoVertex * WCSimVertexGeometry::CalcSimpleDirection ( WCSimRecoEvent evt,
WCSimRecoVertex vtx 
)

Definition at line 434 of file WCSimVertexGeometry.cc.

References LoadEvent().

Referenced by WCSimVertexFinder::FindSeedDirection().

{
  // load event
  // ==========
  this->LoadEvent(myEvent);

  // calculate simple direction
  // ==========================
  return this->CalcSimpleDirection(myVertex);
}

WCSimRecoVertex * WCSimVertexGeometry::CalcSimpleDirection ( WCSimRecoVertex vtx  ) 

Definition at line 445 of file WCSimVertexGeometry.cc.

References fDigitQ, fDigitX, fDigitY, fDigitZ, fIsFiltered, fNDigits, WCSimRecoVertex::GetStatus(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

{
  // load vertex
  // ===========
  Double_t vtxX = myVertex->GetX();
  Double_t vtxY = myVertex->GetY();
  Double_t vtxZ = myVertex->GetZ();
  Double_t vtxTime = myVertex->GetTime();
    
  // current status
  // ==============
  Int_t status = myVertex->GetStatus();

  // create new vertex
  // =================
  WCSimRecoVertex* newVertex = new WCSimRecoVertex();
  vVertexList.push_back(newVertex);

  // loop over digits
  // ================
  Double_t Swx = 0.0;
  Double_t Swy = 0.0;
  Double_t Swz = 0.0;
  Double_t Sw = 0.0;

  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    if( fIsFiltered[idigit] ){
      Double_t q = fDigitQ[idigit];

      Double_t dx = fDigitX[idigit] - vtxX;
      Double_t dy = fDigitY[idigit] - vtxY;
      Double_t dz = fDigitZ[idigit] - vtxZ;
      Double_t ds = sqrt(dx*dx+dy*dy+dz*dz);

      Double_t px = dx/ds;
      Double_t py = dy/ds;
      Double_t pz = dz/ds;

      Swx += q*px;
      Swy += q*py;
      Swz += q*pz;
      Sw  += q;
    }
  }

  // average direction
  // =================
  Double_t dirX = 0.0;
  Double_t dirY = 0.0;
  Double_t dirZ = 0.0;
  
  Int_t itr = 0;
  Bool_t pass = 0; 
  Double_t fom = 0.0;

  if( Sw>0.0 ){
    Double_t qx = Swx/Sw;
    Double_t qy = Swy/Sw;
    Double_t qz = Swz/Sw;
    Double_t qs = sqrt(qx*qx+qy*qy+qz*qz);

    dirX = qx/qs;
    dirY = qy/qs;
    dirZ = qz/qs;

    fom = 1.0;
    itr = 1;
    pass = 1; 
  }

  // set vertex and direction
  // ========================
  if( pass ){
    newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
    newVertex->SetDirection(dirX,dirY,dirZ);
    newVertex->SetFOM(fom,itr,pass);
  }

  // set status
  // ==========
  if( !pass ) status |= WCSimRecoVertex::kFailSimpleDirection;
  newVertex->SetStatus(status);

  // return vertex
  // =============
  return newVertex;
}

WCSimRecoVertex * WCSimVertexGeometry::CalcSimpleVertex ( WCSimRecoEvent evt  ) 

Definition at line 344 of file WCSimVertexGeometry.cc.

References CalcSimpleVertex(), and LoadEvent().

Referenced by WCSimVertexFinder::FindSimplePosition().

{
  // load event
  // ==========
  this->LoadEvent(myEvent);

  // calculate simple vertex
  // =======================
  return this->CalcSimpleVertex(myEvent);
}

WCSimRecoVertex * WCSimVertexGeometry::CalcSimpleVertex (  ) 

Definition at line 355 of file WCSimVertexGeometry.cc.

References WCSimRecoVertex::kOK, WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by CalcSimpleVertex(), and CalcVertexSeeds().

{
  // simple vertex
  // =============
  Double_t vtxX = 0.0;
  Double_t vtxY = 0.0;
  Double_t vtxZ = 0.0;
  Double_t vtxTime = 0.0;

  Int_t itr = 1;
  Bool_t pass = 1; 
  Double_t fom = 1.0;

  // create new vertex
  // =================
  WCSimRecoVertex* newVertex = new WCSimRecoVertex();
  vVertexList.push_back(newVertex);

  // calculate vertex
  // ================
  this->CalcSimpleVertex(vtxX,vtxY,vtxZ,vtxTime);

  // set vertex
  // ==========
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetFOM(fom,itr,pass);  

  // set status
  // ==========
  newVertex->SetStatus(WCSimRecoVertex::kOK);
    
  // return vertex
  // =============
  return newVertex;
}

void WCSimVertexGeometry::CalcSimpleVertex ( Double_t &  vtxX,
Double_t &  vtxY,
Double_t &  vtxZ,
Double_t &  vtxTime 
) [private]

Definition at line 391 of file WCSimVertexGeometry.cc.

References fDigitQ, fDigitT, fDigitX, fDigitY, fDigitZ, fIsFiltered, and fNDigits.

{
  // simple vertex
  // =============
  // just calculate average position of digits

  // default vertex
  // ==============
  vtxX = 0.0;
  vtxY = 0.0;
  vtxZ = 0.0;
  vtxTime = 0.0;  

  // loop over digits
  // ================
  Double_t Swx = 0.0;
  Double_t Swy = 0.0;
  Double_t Swz = 0.0;
  Double_t Swt = 0.0;
  Double_t Sw = 0.0;

  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    if( fIsFiltered[idigit] ){
      Swx += fDigitQ[idigit]*fDigitX[idigit];
      Swy += fDigitQ[idigit]*fDigitY[idigit];
      Swz += fDigitQ[idigit]*fDigitZ[idigit];
      Swt += fDigitQ[idigit]*fDigitT[idigit];
      Sw  += fDigitQ[idigit];
    }
  }

  // average position
  // ================
  if( Sw>0.0 ){
    vtxX = Swx/Sw;
    vtxY = Swy/Sw;
    vtxZ = Swz/Sw;
    vtxTime = Swt/Sw;
  }   

  return;
}

void WCSimVertexGeometry::CalcVertexSeeds ( WCSimRecoEvent evt,
Int_t  NSeeds = 1 
)

Definition at line 757 of file WCSimVertexGeometry.cc.

References LoadEvent().

Referenced by WCSimVertexSeedNtuple::WriteVariables().

{
  // load event
  // ==========
  this->LoadEvent(myEvent);

  // calculate vertex seeds
  // ======================
  return this->CalcVertexSeeds(NSeeds);
}

void WCSimVertexGeometry::CalcVertexSeeds ( Int_t  NSeeds = 1  ) 

Definition at line 768 of file WCSimVertexGeometry.cc.

References CalcSimpleVertex(), ChooseNextQuadruple(), fDigitQ, fDigitT, WCSimGeometry::FindVertex(), fIsFiltered, fMinTime, fNDigits, fThisDigit, fVtxTime1, fVtxTime2, fVtxX1, fVtxX2, fVtxY1, fVtxY2, fVtxZ1, fVtxZ2, GetNSeeds(), WCSimGeometry::Instance(), vSeedDigitList, vSeedVtxTime, vSeedVtxX, vSeedVtxY, and vSeedVtxZ.

{
  // reset list of seeds
  // ===================
  vSeedVtxX.clear();
  vSeedVtxY.clear();
  vSeedVtxZ.clear();
  vSeedVtxTime.clear();

  // always calculate the simple vertex
  // ==================================
  this->CalcSimpleVertex(fVtxX1,fVtxY1,fVtxZ1,fVtxTime1);

  // add this vertex
  vSeedVtxX.push_back(fVtxX1); 
  vSeedVtxY.push_back(fVtxY1);
  vSeedVtxZ.push_back(fVtxZ1);
  vSeedVtxTime.push_back(fVtxTime1);

  // check limit
  if( NSeeds<=1 ) return;


  // form list of golden digits
  // ==========================
  vSeedDigitList.clear();
  
  for( fThisDigit=0; fThisDigit<fNDigits; fThisDigit++ ){
    if( fIsFiltered[fThisDigit] ){
      if( fDigitT[fThisDigit] - fMinTime>=0
       && fDigitT[fThisDigit] - fMinTime<300
       && fDigitQ[fThisDigit]>=5.0 ){
        vSeedDigitList.push_back(fThisDigit);
      }
    }
  }

  // check for enough digits
  if( vSeedDigitList.size()<=4 ) return;


  // generate new list of seeds
  // ==========================
 
  Double_t x0 = 0.0;
  Double_t y0 = 0.0;
  Double_t z0 = 0.0;
  Double_t t0 = 0.0;

  Double_t x1 = 0.0;
  Double_t y1 = 0.0;
  Double_t z1 = 0.0;
  Double_t t1 = 0.0; 

  Double_t x2 = 0.0;
  Double_t y2 = 0.0;
  Double_t z2 = 0.0;
  Double_t t2 = 0.0;

  Double_t x3 = 0.0;
  Double_t y3 = 0.0;
  Double_t z3 = 0.0;
  Double_t t3 = 0.0;

  UInt_t counter = 0;
  UInt_t NSeedsTarget = NSeeds;

  while( GetNSeeds()<NSeedsTarget && counter<100*NSeedsTarget ){
    counter++;

    // choose next four digits
    this->ChooseNextQuadruple(x0,y0,z0,t0,
                              x1,y1,z1,t1,
                              x2,y2,z2,t2,
                              x3,y3,z3,t3);
       
    //
    //std::cout << "   digit0: (x,y,z,t)=(" << x0 << "," << y0 << "," << z0 << "," << t0 << ") " << std::endl;
    //std::cout << "   digit1: (x,y,z,t)=(" << x1 << "," << y1 << "," << z1 << "," << t1 << ") " << std::endl;
    //std::cout << "   digit2: (x,y,z,t)=(" << x2 << "," << y2 << "," << z2 << "," << t2 << ") " << std::endl;
    //std::cout << "   digit3: (x,y,z,t)=(" << x3 << "," << y3 << "," << z3 << "," << t3 << ") " << std::endl;
    //

    // find common vertex
    WCSimGeometry::FindVertex(x0,y0,z0,t0,
                              x1,y1,z1,t1,
                              x2,y2,z2,t2,
                              x3,y3,z3,t3,
                              fVtxX1,fVtxY1,fVtxZ1,fVtxTime1,
                              fVtxX2,fVtxY2,fVtxZ2,fVtxTime2);

    //
    // std::cout << "   result: (x,y,z,t)=(" << fVtxX1 << "," << fVtxY1 << "," << fVtxZ1 << "," << fVtxTime1 << ") " << std::endl
    //           << "   result: (x,y,z,t)=(" << fVtxX2 << "," << fVtxY2 << "," << fVtxZ2 << "," << fVtxTime2 << ") " << std::endl;
    //

    // add first digit
    if( WCSimGeometry::Instance()->InsideDetector(fVtxX1,fVtxY1,fVtxZ1) ){
      vSeedVtxX.push_back(fVtxX1); 
      vSeedVtxY.push_back(fVtxY1);
      vSeedVtxZ.push_back(fVtxZ1);
      vSeedVtxTime.push_back(fVtxTime1);
    }

    // add second digit
    if( WCSimGeometry::Instance()->InsideDetector(fVtxX2,fVtxY2,fVtxZ2) ){
      vSeedVtxX.push_back(fVtxX2); 
      vSeedVtxY.push_back(fVtxY2);
      vSeedVtxZ.push_back(fVtxZ2);
      vSeedVtxTime.push_back(fVtxTime2);
    }

  }

  return;
}

void WCSimVertexGeometry::ChooseNextDigit ( Double_t &  x,
Double_t &  y,
Double_t &  z,
Double_t &  t 
) [private]

Definition at line 895 of file WCSimVertexGeometry.cc.

References fCounter, fDigitQ, fDigitT, fDigitX, fDigitY, fDigitZ, fLastEntry, fMinTime, fNDigits, fThisDigit, and vSeedDigitList.

Referenced by ChooseNextQuadruple().

{
  // default
  xpos=0; ypos=0; zpos=0; time=0;

  // ROOT random number generator
  // Double_t r = gRandom->Rndm();

  // pseudo-random number generator
  Int_t numEntries = vSeedDigitList.size();

  fCounter++;
  if( fCounter>=fNDigits ) fCounter = 0;
  fThisDigit = vSeedDigitList.at(fLastEntry);

  Double_t t0 = 0.5 + fDigitT[fCounter] - fMinTime;
  Double_t q0 = 0.5 + fDigitQ[fCounter];

  Double_t t1 = 0.5 + fDigitT[fThisDigit] - fMinTime;
  Double_t q1 = 0.5 + fDigitQ[fThisDigit];

  Double_t tq = 100.0*(t0*q0+t1*q1);
  Double_t r = tq - TMath::Floor(tq);

  fLastEntry = (Int_t)(r*numEntries);

  // return the new digit
  fThisDigit = vSeedDigitList.at(fLastEntry);
  xpos = fDigitX[fThisDigit];
  ypos = fDigitY[fThisDigit];
  zpos = fDigitZ[fThisDigit];
  time = fDigitT[fThisDigit];

  return;
}

void WCSimVertexGeometry::ChooseNextQuadruple ( Double_t &  x0,
Double_t &  y0,
Double_t &  z0,
Double_t &  t0,
Double_t &  x1,
Double_t &  y1,
Double_t &  z1,
Double_t &  t1,
Double_t &  x2,
Double_t &  y2,
Double_t &  z2,
Double_t &  t2,
Double_t &  x3,
Double_t &  y3,
Double_t &  z3,
Double_t &  t3 
) [private]

Definition at line 885 of file WCSimVertexGeometry.cc.

References ChooseNextDigit().

Referenced by CalcVertexSeeds().

{
  this->ChooseNextDigit(x0,y0,z0,t0);
  this->ChooseNextDigit(x1,y1,z1,t1);
  this->ChooseNextDigit(x2,y2,z2,t2);
  this->ChooseNextDigit(x3,y3,z3,t3);

  return;
}

Double_t WCSimVertexGeometry::GetAngle ( Int_t  idigit  )  [inline]
Double_t WCSimVertexGeometry::GetAzimuth ( Int_t  idigit  )  [inline]

Definition at line 100 of file WCSimVertexGeometry.hh.

References fAzimuth, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                    { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fAzimuth[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetConeAngle ( Int_t  idigit  )  [inline]

Definition at line 82 of file WCSimVertexGeometry.hh.

References fConeAngle, and fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), GetDeltaCorrection(), and WCSimVertexNtuple::WriteVariables().

                                      { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fConeAngle[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDelta ( Int_t  idigit  )  [inline]

Definition at line 219 of file WCSimVertexGeometry.hh.

References fDelta, and fNDigits.

                                  { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDelta[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDeltaAngle ( Int_t  idigit  )  [inline]

Definition at line 156 of file WCSimVertexGeometry.hh.

References fDeltaAngle, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                       { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaAngle[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDeltaCorrection ( Int_t  idigit,
Double_t  length 
)

Definition at line 725 of file WCSimVertexGeometry.cc.

References GetAngle(), GetConeAngle(), GetDistPhoton(), GetDistPoint(), GetDistTrack(), WCSimParameters::RefractiveIndex(), and WCSimParameters::SpeedOfLight().

Referenced by WCSimVertexNtuple::WriteVariables().

{
  if( Length<=0.0
   || GetDistTrack(idigit)<Length ){
    return 0.0;
  }

  else{
    Double_t Lpoint = GetDistPoint(idigit);
    Double_t Ltrack = GetDistTrack(idigit);
    Double_t Lphoton = GetDistPhoton(idigit);
    Double_t AngleRad = (TMath::Pi()/180.0)*GetAngle(idigit);    
    Double_t ConeAngleRad = (TMath::Pi()/180.0)*GetConeAngle(idigit);  

    Double_t LtrackNew = Length;
    Double_t LphotonNew = sqrt( Lpoint*Lpoint + Length*Length
                                -2.0*Lpoint*Length*cos(AngleRad) );

    Double_t theta = ConeAngleRad;
    Double_t sinphi = (Lpoint/LphotonNew)*sin(AngleRad);
    Double_t phi = asin(sinphi);
    Double_t alpha = theta-phi;
    Double_t LphotonNewCorrected = LphotonNew*alpha/sin(alpha);

    Double_t fC = WCSimParameters::SpeedOfLight();
    Double_t fN = WCSimParameters::RefractiveIndex(Lpoint);

    return ( Ltrack/fC + Lphoton/(fC/fN) )
         - ( LtrackNew/fC + LphotonNewCorrected/(fC/fN) );
  }
}

Double_t WCSimVertexGeometry::GetDeltaPhoton ( Int_t  idigit  )  [inline]

Definition at line 177 of file WCSimVertexGeometry.hh.

References fDeltaPhoton, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                        { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaPhoton[idigit]; 
    }
    else return 0.0;
  }  

Double_t WCSimVertexGeometry::GetDeltaPoint ( Int_t  idigit  )  [inline]

Definition at line 163 of file WCSimVertexGeometry.hh.

References fDeltaPoint, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                       { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaPoint[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDeltaScatter ( Int_t  idigit  )  [inline]

Definition at line 184 of file WCSimVertexGeometry.hh.

References fDeltaScatter, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                         { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaScatter[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDeltaSigma ( Int_t  idigit  )  [inline]

Definition at line 149 of file WCSimVertexGeometry.hh.

References fDeltaSigma, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                       { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaSigma[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDeltaTime ( Int_t  idigit  )  [inline]

Definition at line 142 of file WCSimVertexGeometry.hh.

References fDeltaTime, and fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), and WCSimVertexNtuple::WriteVariables().

                                      { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaTime[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDeltaTrack ( Int_t  idigit  )  [inline]

Definition at line 170 of file WCSimVertexGeometry.hh.

References fDeltaTrack, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                       { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDeltaTrack[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDigitQ ( Int_t  idigit  )  [inline]

Definition at line 75 of file WCSimVertexGeometry.hh.

References fDigitQ, and fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), and WCSimVertexNtuple::WriteVariables().

                                   { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDigitQ[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDigitT ( Int_t  idigit  )  [inline]

Definition at line 68 of file WCSimVertexGeometry.hh.

References fDigitT, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                   { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDigitT[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDigitX ( Int_t  idigit  )  [inline]

Definition at line 47 of file WCSimVertexGeometry.hh.

References fDigitX, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                   { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDigitX[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDigitY ( Int_t  idigit  )  [inline]

Definition at line 54 of file WCSimVertexGeometry.hh.

References fDigitY, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                   { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDigitY[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDigitZ ( Int_t  idigit  )  [inline]

Definition at line 61 of file WCSimVertexGeometry.hh.

References fDigitZ, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                   { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDigitZ[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDistPhoton ( Int_t  idigit  )  [inline]

Definition at line 128 of file WCSimVertexGeometry.hh.

References fDistPhoton, and fNDigits.

Referenced by GetDeltaCorrection(), and WCSimVertexNtuple::WriteVariables().

                                       { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDistPhoton[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDistPoint ( Int_t  idigit  )  [inline]

Definition at line 114 of file WCSimVertexGeometry.hh.

References fDistPoint, and fNDigits.

Referenced by GetDeltaCorrection(), and WCSimVertexNtuple::WriteVariables().

                                      { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDistPoint[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDistScatter ( Int_t  idigit  )  [inline]

Definition at line 135 of file WCSimVertexGeometry.hh.

References fDistScatter, and fNDigits.

Referenced by WCSimVertexNtuple::WriteVariables().

                                        { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDistScatter[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetDistTrack ( Int_t  idigit  )  [inline]

Definition at line 121 of file WCSimVertexGeometry.hh.

References fDistTrack, and fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), GetDeltaCorrection(), and WCSimVertexNtuple::WriteVariables().

                                      { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fDistTrack[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetExtendedPath ( Int_t  idigit  )  [inline]

Definition at line 198 of file WCSimVertexGeometry.hh.

References fExtendedPath, and fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), and WCSimVertexNtuple::WriteVariables().

                                         { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fExtendedPath[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetExtendedResidual ( Int_t  idigit  )  [inline]

Definition at line 212 of file WCSimVertexGeometry.hh.

References fExtendedResidual, and fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), and WCSimVertexNtuple::WriteVariables().

                                             { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fExtendedResidual[idigit]; 
    }
    else return 0.0;
  }

Int_t WCSimVertexGeometry::GetNDigits (  )  [inline]

Definition at line 37 of file WCSimVertexGeometry.hh.

References fNDigits.

Referenced by WCSimVertexViewer::DrawNewRecoEvent(), and WCSimVertexNtuple::WriteVariables().

{ return fNDigits; }

Int_t WCSimVertexGeometry::GetNFilterDigits (  )  [inline]

Definition at line 38 of file WCSimVertexGeometry.hh.

References fNFilterDigits.

{ return fNFilterDigits; }

UInt_t WCSimVertexGeometry::GetNSeeds (  )  [inline]
Double_t WCSimVertexGeometry::GetPointPath ( Int_t  idigit  )  [inline]

Definition at line 191 of file WCSimVertexGeometry.hh.

References fNDigits, and fPointPath.

Referenced by WCSimVertexNtuple::WriteVariables().

                                      { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fPointPath[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetPointResidual ( Int_t  idigit  )  [inline]

Definition at line 205 of file WCSimVertexGeometry.hh.

References fNDigits, and fPointResidual.

Referenced by WCSimVertexNtuple::WriteVariables().

                                          { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fPointResidual[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetSeedVtxTime ( UInt_t  ivtx  )  [inline]

Definition at line 253 of file WCSimVertexGeometry.hh.

References GetNSeeds(), and vSeedVtxTime.

Referenced by WCSimVertexSeedNtuple::WriteVariables().

                                       {
    if( ivtx>=0 && ivtx<GetNSeeds() ){
      return vSeedVtxTime.at(ivtx);
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetSeedVtxX ( UInt_t  ivtx  )  [inline]

Definition at line 232 of file WCSimVertexGeometry.hh.

References GetNSeeds(), and vSeedVtxX.

Referenced by WCSimVertexSeedNtuple::WriteVariables().

                                    {
    if( ivtx>=0 && ivtx<GetNSeeds() ){
      return vSeedVtxX.at(ivtx);
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetSeedVtxY ( UInt_t  ivtx  )  [inline]

Definition at line 239 of file WCSimVertexGeometry.hh.

References GetNSeeds(), and vSeedVtxY.

Referenced by WCSimVertexSeedNtuple::WriteVariables().

                                    {
    if( ivtx>=0 && ivtx<GetNSeeds() ){
      return vSeedVtxY.at(ivtx);
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetSeedVtxZ ( UInt_t  ivtx  )  [inline]

Definition at line 246 of file WCSimVertexGeometry.hh.

References GetNSeeds(), and vSeedVtxZ.

Referenced by WCSimVertexSeedNtuple::WriteVariables().

                                    {
    if( ivtx>=0 && ivtx<GetNSeeds() ){
      return vSeedVtxZ.at(ivtx);
    }
    else return 0.0;
  } 

Double_t WCSimVertexGeometry::GetSolidAngle ( Int_t  idigit  )  [inline]

Definition at line 107 of file WCSimVertexGeometry.hh.

References fNDigits, and fSolidAngle.

Referenced by WCSimVertexNtuple::WriteVariables().

                                       { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fSolidAngle[idigit]; 
    }
    else return 0.0;
  }

Double_t WCSimVertexGeometry::GetZenith ( Int_t  idigit  )  [inline]

Definition at line 93 of file WCSimVertexGeometry.hh.

References fNDigits, and fZenith.

Referenced by GetAngle(), and WCSimVertexNtuple::WriteVariables().

                                   { 
    if( idigit>=0 && idigit<fNDigits ) {
      return fZenith[idigit]; 
    }
    else return 0.0;
  }

WCSimVertexGeometry * WCSimVertexGeometry::Instance (  )  [static]
Bool_t WCSimVertexGeometry::IsFiltered ( Int_t  idigit  )  [inline]
void WCSimVertexGeometry::LoadEvent ( WCSimRecoEvent evt  ) 

Definition at line 187 of file WCSimVertexGeometry.cc.

References fAzimuth, fConeAngle, fCounter, fDelta, fDeltaAngle, fDeltaPhoton, fDeltaPoint, fDeltaScatter, fDeltaSigma, fDeltaTime, fDeltaTrack, fDigitQ, fDigitT, fDigitX, fDigitY, fDigitZ, fDistPhoton, fDistPoint, fDistScatter, fDistTrack, fEventNum, fExtendedPath, fExtendedResidual, fIsFiltered, fLastEntry, fMaxTime, fMeanFilteredQ, fMeanQ, fMinTime, fNDigits, fNFilterDigits, fPMTs, fPointPath, fPointResidual, fRunNum, fSolidAngle, fThisDigit, fTotalFilteredQ, fTotalQ, fTriggerNum, fZenith, WCSimRecoEvent::GetDigitList(), WCSimRecoEvent::GetEvent(), WCSimRecoEvent::GetFilterDigitList(), WCSimRecoDigit::GetQPEs(), WCSimRecoEvent::GetRun(), WCSimRecoDigit::GetTime(), WCSimRecoEvent::GetTrigger(), WCSimRecoDigit::GetX(), WCSimRecoDigit::GetY(), WCSimRecoDigit::GetZ(), WCSimRecoDigit::IsFiltered(), vSeedDigitList, vSeedVtxTime, vSeedVtxX, vSeedVtxY, vSeedVtxZ, and vVertexList.

Referenced by CalcResiduals(), CalcSimpleDirection(), CalcSimpleVertex(), and CalcVertexSeeds().

{
  // resetting arrays
  // ================
  if( myEvent==0 ) return;

  Int_t thisRunNum = myEvent->GetRun();
  Int_t thisEventNum = myEvent->GetEvent();
  Int_t thisTriggerNum = myEvent->GetTrigger();

  if( fRunNum==thisRunNum
   && fEventNum==thisEventNum
   && fTriggerNum==thisTriggerNum ){
    return;
  }

  fRunNum = thisRunNum;
  fEventNum = thisEventNum;
  fTriggerNum = thisTriggerNum;

  fNDigits = 0;
  fNFilterDigits = 0;
  
  fThisDigit = 0;
  fLastEntry = 0;
  fCounter = 0;

  // clear vertices
  // ==============
  for(UInt_t i=0; i<vVertexList.size(); i++ ){
    delete (WCSimRecoVertex*)(vVertexList.at(i));
  }
  vVertexList.clear();

  // clear seed vertices
  // ===================
  vSeedVtxX.clear();
  vSeedVtxY.clear();
  vSeedVtxZ.clear();
  vSeedVtxTime.clear();
  vSeedDigitList.clear();

  // get lists of digits
  // ==================
  std::vector<WCSimRecoDigit*>* myDigitList = (std::vector<WCSimRecoDigit*>*)(myEvent->GetDigitList());
  fNDigits = myDigitList->size();

  std::vector<WCSimRecoDigit*>* myFilterDigitList = (std::vector<WCSimRecoDigit*>*)(myEvent->GetFilterDigitList());
  fNFilterDigits = myFilterDigitList->size();

  // sanity checks
  // =============
  if( fNDigits<=0 ){
    std::cout << " *** WCSimVertexGeometry::LoadEvent(...) *** " << std::endl;
    std::cout << "   <warning> event has no digits! " << std::endl;
    return;
  }

  if( fNDigits>fPMTs ){
    std::cout << " *** WCSimVertexGeometry::LoadEvent(...) *** " << std::endl;
    std::cout << "   <warning> event will be truncated! " << std::endl;
    fNDigits = fPMTs;
  }

  if( fNFilterDigits>fNDigits ){
    fNFilterDigits = fNDigits;
  }

  // load digits
  // ===========
  fTotalQ = 0.0;
  fMeanQ = 0.0;

  fTotalFilteredQ = 0.0;
  fMeanFilteredQ = 0.0;

  fMinTime = -999999.9;
  fMaxTime = -999999.9;

  Double_t Swx = 0.0;
  Double_t Sw = 0.0;

  Double_t SFwx = 0.0;
  Double_t SFw = 0.0;
  
  for( Int_t idigit=0; idigit<fNDigits; idigit++ ){
    WCSimRecoDigit* recoDigit = (WCSimRecoDigit*)(myDigitList->at(idigit));    

    fDigitX[idigit] = recoDigit->GetX();
    fDigitY[idigit] = recoDigit->GetY();
    fDigitZ[idigit] = recoDigit->GetZ();
    fDigitT[idigit] = recoDigit->GetTime();
    fDigitQ[idigit] = recoDigit->GetQPEs();

    fIsFiltered[idigit] = recoDigit->IsFiltered();

    fConeAngle[idigit] = 0.0;
    fZenith[idigit] = 0.0;
    fAzimuth[idigit] = 0.0;
    fSolidAngle[idigit] = 0.0;

    fDistPoint[idigit] = 0.0;
    fDistTrack[idigit] = 0.0;
    fDistPhoton[idigit] = 0.0;
    fDistScatter[idigit] = 0.0;

    fDeltaTime[idigit] = 0.0;
    fDeltaSigma[idigit] = 0.0;
    
    fDeltaAngle[idigit] = 0.0;
    fDeltaPoint[idigit] = 0.0;
    fDeltaTrack[idigit] = 0.0;
    fDeltaPhoton[idigit] = 0.0;
    fDeltaScatter[idigit] = 0.0;

    fPointPath[idigit] = 0.0;
    fExtendedPath[idigit] = 0.0;
    fPointResidual[idigit] = 0.0;
    fExtendedResidual[idigit] = 0.0;

    fDelta[idigit] = 0.0;

    Swx += recoDigit->GetQPEs();
    Sw += 1.0;

    if( fMinTime<0 
     || recoDigit->GetTime()<fMinTime ){
      fMinTime = recoDigit->GetTime();
    }

    if( fMaxTime<0 
     || recoDigit->GetTime()>fMaxTime ){
      fMaxTime = recoDigit->GetTime();
    }

    if( recoDigit->IsFiltered() ){
      SFwx += recoDigit->GetQPEs();
      SFw += 1.0;
    }
  }

  if( Sw>0.0 ){
    fTotalQ = Swx;
    fMeanQ = Swx/Sw;
  }

  if( SFw>0.0 ){
    fTotalFilteredQ = SFwx;
    fMeanFilteredQ = SFwx/SFw;
  }

  if( fMinTime<0 ) fMinTime = 0.0;
  if( fMaxTime<0 ) fMaxTime = 0.0;

  return;
}


Member Data Documentation

Double_t* WCSimVertexGeometry::fAzimuth [private]
Double_t* WCSimVertexGeometry::fConeAngle [private]

Definition at line 284 of file WCSimVertexGeometry.hh.

Referenced by ChooseNextDigit(), LoadEvent(), and WCSimVertexGeometry().

Double_t* WCSimVertexGeometry::fDelta [private]
Double_t* WCSimVertexGeometry::fDeltaAngle [private]
Double_t* WCSimVertexGeometry::fDeltaPhoton [private]
Double_t* WCSimVertexGeometry::fDeltaPoint [private]
Double_t* WCSimVertexGeometry::fDeltaSigma [private]
Double_t* WCSimVertexGeometry::fDeltaTime [private]
Double_t* WCSimVertexGeometry::fDeltaTrack [private]
Double_t* WCSimVertexGeometry::fDigitQ [private]
Double_t* WCSimVertexGeometry::fDigitT [private]
Double_t* WCSimVertexGeometry::fDigitX [private]
Double_t* WCSimVertexGeometry::fDigitY [private]
Double_t* WCSimVertexGeometry::fDigitZ [private]
Double_t* WCSimVertexGeometry::fDistPhoton [private]
Double_t* WCSimVertexGeometry::fDistPoint [private]
Double_t* WCSimVertexGeometry::fDistScatter [private]
Double_t* WCSimVertexGeometry::fDistTrack [private]

Definition at line 275 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Definition at line 283 of file WCSimVertexGeometry.hh.

Referenced by ChooseNextDigit(), LoadEvent(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fMaxTime [private]

Definition at line 303 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Definition at line 299 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fMeanQ [private]

Definition at line 296 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fMinTime [private]

Definition at line 280 of file WCSimVertexGeometry.hh.

Referenced by GetNFilterDigits(), LoadEvent(), and WCSimVertexGeometry().

Int_t WCSimVertexGeometry::fPMTs [private]

Definition at line 278 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Double_t* WCSimVertexGeometry::fPointPath [private]

Definition at line 274 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Double_t* WCSimVertexGeometry::fSolidAngle [private]

Definition at line 300 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fTotalQ [private]

Definition at line 297 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Definition at line 276 of file WCSimVertexGeometry.hh.

Referenced by LoadEvent(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxTime1 [private]

Definition at line 289 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxTime2 [private]

Definition at line 294 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxX1 [private]

Definition at line 286 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxX2 [private]

Definition at line 291 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxY1 [private]

Definition at line 287 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxY2 [private]

Definition at line 292 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxZ1 [private]

Definition at line 288 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t WCSimVertexGeometry::fVtxZ2 [private]

Definition at line 293 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), and WCSimVertexGeometry().

Double_t* WCSimVertexGeometry::fZenith [private]
std::vector<Int_t> WCSimVertexGeometry::vSeedDigitList [private]

Definition at line 344 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), ChooseNextDigit(), and LoadEvent().

std::vector<Double_t> WCSimVertexGeometry::vSeedVtxTime [private]

Definition at line 343 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), GetSeedVtxTime(), and LoadEvent().

std::vector<Double_t> WCSimVertexGeometry::vSeedVtxX [private]

Definition at line 340 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), GetNSeeds(), GetSeedVtxX(), and LoadEvent().

std::vector<Double_t> WCSimVertexGeometry::vSeedVtxY [private]

Definition at line 341 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), GetSeedVtxY(), and LoadEvent().

std::vector<Double_t> WCSimVertexGeometry::vSeedVtxZ [private]

Definition at line 342 of file WCSimVertexGeometry.hh.

Referenced by CalcVertexSeeds(), GetSeedVtxZ(), and LoadEvent().

Definition at line 346 of file WCSimVertexGeometry.hh.

Referenced by CalcSimpleDirection(), CalcSimpleVertex(), and LoadEvent().


The documentation for this class was generated from the following files: