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

WCSimVertexFinder Class Reference

#include "WCSimVertexFinder.hh"

List of all members.

Public Member Functions

void RunPrintParameters ()
void SetPointFitOnly (Bool_t yesno)
void UsingTrueVertex (Bool_t yesno)
void UsingTruePosition (Bool_t yesno)
void UsingTrueDirection (Bool_t yesno)
void SeedingWithTrueVertex (Bool_t yesno)
void SeedingWithSimpleVertex (Bool_t yesno)
void SeedingWithQuadruples (Bool_t yesno)
void SetNumSeeds (Int_t nseeds)
void SetFitTimeParams ()
void SetFixTimeParams (Double_t param0)
void SetFitConeParams ()
void SetFixConeParams (Double_t param0, Double_t param1, Double_t param2)
void SetFitWeights (Double_t tw, Double_t cw)
void SetVertexBias (Double_t bias)
WCSimRecoVertexRun (WCSimRecoEvent *event)
WCSimRecoVertexRunPointFit (WCSimRecoEvent *event)
WCSimRecoVertexRunExtendedFit (WCSimRecoEvent *event)
WCSimRecoVertexRunPointFitFromTruth (WCSimRecoEvent *event)
WCSimRecoVertexRunExtendedFitFromTruth (WCSimRecoEvent *event)
WCSimRecoVertexRunPointFit (WCSimRecoEvent *event, Double_t vx, Double_t vy, Double_t vz)
WCSimRecoVertexRunPointFit (WCSimRecoEvent *event, Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexRunExtendedFit (WCSimRecoEvent *event, Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexRun (WCSimRecoEvent *event, Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexGetSimplePosition ()
WCSimRecoVertexGetSimpleDirection ()
WCSimRecoVertexGetPointPosition ()
WCSimRecoVertexGetPointDirection ()
WCSimRecoVertexGetPointVertex ()
WCSimRecoVertexGetExtendedVertex ()
void PointPositionChi2 (Double_t vx, Double_t vy, Double_t vz, Double_t &vtime, Double_t &chi2)
void PointPositionChi2 (Double_t &vtime, Double_t &chi2)
void PointDirectionChi2 (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz, Double_t &vangle, Double_t &chi2)
void PointDirectionChi2 (Double_t &vangle, Double_t &chi2)
void PointVertexChi2 (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz, Double_t &vangle, Double_t &vtime, Double_t &chi2)
void PointVertexChi2 (Double_t &vangle, Double_t &vtime, Double_t &chi2)
void ExtendedVertexChi2 (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz, Double_t &vangle, Double_t &vtime, Double_t &chi2)
void ExtendedVertexChi2 (Double_t &vangle, Double_t &vtime, Double_t &chi2)
void PenaltyChi2 (Double_t vx, Double_t vy, Double_t vz, Double_t &chi2)
void FixPositionChi2 (Double_t vx, Double_t vy, Double_t vz, Double_t &chi2)
void FixDirectionChi2 (Double_t px, Double_t py, Double_t pz, Double_t &chi2)
void FitConePropertiesFoM (Double_t &vangle, Double_t &chi2)
void ConePropertiesFoM (Double_t &chi2)
void FitPointConePropertiesLnL (Double_t &vangle, Double_t &chi2)
void FitExtendedConePropertiesLnL (Double_t &vangle, Double_t &chi2)
void ConePropertiesLnL (Double_t vparam0, Double_t vparam1, Double_t vparam2, Double_t &vangle, Double_t &chi2)
void FindSimpleTimeProperties (Double_t &vtime)
void FitTimePropertiesFoM (Double_t &vtime, Double_t &chi2)
void TimePropertiesFoM (Double_t vtime, Double_t &chi2)
void FitPointTimePropertiesLnL (Double_t &vtime, Double_t &chi2)
void FitExtendedTimePropertiesLnL (Double_t &vtime, Double_t &chi2)
void TimePropertiesLnL (Double_t vtime, Double_t vparam, Double_t &chi2)
Int_t GetIterations ()
void time_fit_itr ()
void cone_fit_itr ()
void point_position_itr ()
void point_direction_itr ()
void point_vertex_itr ()
void extended_vertex_itr ()
void time_fit_reset_itr ()
void cone_fit_reset_itr ()
void point_position_reset_itr ()
void point_direction_reset_itr ()
void point_vertex_reset_itr ()
void extended_vertex_reset_itr ()
Int_t time_fit_iterations ()
Int_t cone_fit_iterations ()
Int_t point_position_iterations ()
Int_t point_direction_iterations ()
Int_t point_vertex_iterations ()
Int_t extended_vertex_iterations ()
void Reset ()

Static Public Member Functions

static WCSimVertexFinderInstance ()
static void PointFitOnly (Bool_t yesno=1)
static void UseTrueVertex (Bool_t yesno=1)
static void UseTruePosition (Bool_t yesno=1)
static void UseTrueDirection (Bool_t yesno=1)
static void SeedWithTrueVertex (Bool_t yesno=1)
static void SeedWithSimpleVertex (Bool_t yesno=1)
static void SeedWithQuadruples (Bool_t yesno=1)
static void NumSeeds (Int_t nseeds)
static void FitWeights (Double_t tw, Double_t cw)
static void FitTimeParams ()
static void FixTimeParams (Double_t param0)
static void FitConeParams ()
static void FixConeParams (Double_t param0, Double_t param1, Double_t param2)
static void FixVertexBias (Double_t bias)
static void PrintParameters ()

Public Attributes

Double_t fVtxX
Double_t fVtxY
Double_t fVtxZ
Double_t fVtxTime
Double_t fDirX
Double_t fDirY
Double_t fDirZ
Double_t fVtxFOM
Bool_t fFitTimeParams
Double_t fFixTimeParam0
Bool_t fFitConeParams
Double_t fFixConeParam0
Double_t fFixConeParam1
Double_t fFixConeParam2
Double_t fTimeParam0
Double_t fConeParam0
Double_t fConeParam1
Double_t fConeParam2

Private Member Functions

WCSimRecoVertexBuildTrueVertex ()
WCSimRecoVertexBuildDummyVertex ()
WCSimRecoVertexFindSimplePosition ()
WCSimRecoVertexFindSeedPosition ()
WCSimRecoVertexFindSimpleDirection (WCSimRecoVertex *vertex)
WCSimRecoVertexFindSeedDirection (WCSimRecoVertex *vertex)
WCSimRecoVertexFitPointPosition (WCSimRecoVertex *vertex)
WCSimRecoVertexFitPointDirection (WCSimRecoVertex *vertex)
WCSimRecoVertexFitPointVertex (WCSimRecoVertex *vertex)
WCSimRecoVertexFitExtendedVertex (WCSimRecoVertex *vertex)
WCSimRecoVertexCorrectExtendedVertex (WCSimRecoVertex *vertex)
WCSimRecoVertexFixSimplePosition (Double_t vx, Double_t vy, Double_t vz)
WCSimRecoVertexFixSimpleDirection (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexFixPointPosition (Double_t vx, Double_t vy, Double_t vz)
WCSimRecoVertexFixPointDirection (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexFixPointVertex (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexFixExtendedVertex (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
WCSimRecoVertexFitPointPositionWithMinuit (WCSimRecoVertex *vertex)
WCSimRecoVertexFitPointDirectionWithMinuit (WCSimRecoVertex *vertex)
WCSimRecoVertexFitPointVertexWithMinuit (WCSimRecoVertex *vertex)
WCSimRecoVertexFitExtendedVertexWithMinuit (WCSimRecoVertex *vertex)
void PointResiduals (Double_t vx, Double_t vy, Double_t vz)
void PointResiduals (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
void ExtendedResiduals (Double_t vx, Double_t vy, Double_t vz, Double_t px, Double_t py, Double_t pz)
 WCSimVertexFinder ()
 ~WCSimVertexFinder ()
void Clear ()

Private Attributes

Double_t fBaseFOM
Bool_t fPointFitOnly
Bool_t fUseTrueVertex
Bool_t fUseTruePosition
Bool_t fUseTrueDirection
Bool_t fSeedWithTrueVertex
Bool_t fSeedWithSimpleVertex
Bool_t fSeedWithQuadruples
Int_t fNumSeeds
Double_t fTimeFitWeight
Double_t fConeFitWeight
Bool_t fFixVertexBias
Double_t fVertexBias
Double_t fInputVtxX
Double_t fInputVtxY
Double_t fInputVtxZ
Double_t fInputVtxTime
Double_t fInputDirX
Double_t fInputDirY
Double_t fInputDirZ
Double_t fInputVtxFOM
WCSimRecoVertexfSimplePosition
WCSimRecoVertexfSimpleDirection
WCSimRecoVertexfPointPosition
WCSimRecoVertexfPointDirection
WCSimRecoVertexfPointVertex
WCSimRecoVertexfExtendedVertex
TMinuit * fMinuitPointPosition
TMinuit * fMinuitPointDirection
TMinuit * fMinuitPointVertex
TMinuit * fMinuitExtendedVertex
TMinuit * fMinuitTimeFit
TMinuit * fMinuitConeFit
Bool_t fPass
Int_t fItr
Int_t fTimeFitItr
Int_t fConeFitItr
Int_t fPointPosItr
Int_t fPointDirItr
Int_t fPointVtxItr
Int_t fExtendedVtxItr
Double_t fSconeA
Double_t fSconeB
Double_t fSmu
Double_t fSel
Bool_t fIntegralsDone
std::vector< WCSimRecoVertex * > vVertexList

Detailed Description

Definition at line 14 of file WCSimVertexFinder.hh.


Constructor & Destructor Documentation

WCSimVertexFinder::WCSimVertexFinder (  )  [private]

Definition at line 303 of file WCSimVertexFinder.cc.

References fBaseFOM, fConeFitItr, fConeFitWeight, fConeParam0, fConeParam1, fConeParam2, fDirX, fDirY, fDirZ, fExtendedVertex, fExtendedVtxItr, fFitConeParams, fFitTimeParams, fFixConeParam0, fFixConeParam1, fFixConeParam2, fFixTimeParam0, fFixVertexBias, fIntegralsDone, fItr, fMinuitConeFit, fMinuitExtendedVertex, fMinuitPointDirection, fMinuitPointPosition, fMinuitPointVertex, fMinuitTimeFit, fNumSeeds, fPass, fPointDirection, fPointDirItr, fPointFitOnly, fPointPosition, fPointPosItr, fPointVertex, fPointVtxItr, fSeedWithQuadruples, fSeedWithSimpleVertex, fSeedWithTrueVertex, fSimpleDirection, fSimplePosition, fTimeFitItr, fTimeFitWeight, fTimeParam0, fUseTrueDirection, fUseTruePosition, fUseTrueVertex, fVertexBias, fVtxFOM, fVtxX, fVtxY, and fVtxZ.

Referenced by Instance().

{
  // default configuration
  fBaseFOM = 100.0;
  fPointFitOnly = 0;
  fUseTrueVertex = 0; 
  fUseTruePosition = 0;
  fUseTrueDirection = 0;
  fSeedWithTrueVertex = 0;
  fSeedWithSimpleVertex = 0;
  fSeedWithQuadruples = 1;
  fNumSeeds = 200;

  fFitTimeParams = 0;     // don't fit by default
  fFixTimeParam0 = 0.20;  // scattering parameter

  fFitConeParams = 1;     // do fit by default  
  fFixConeParam0 = 0.25;  // track length parameter
  fFixConeParam1 = 0.50;  // track length parameter
  fFixConeParam2 = 0.75;  // particle ID:  0.0[electron]->1.0[muon]

  fTimeFitWeight = 0.50;  // nominal time weight
  fConeFitWeight = 0.50;  // nominal cone weight

  fFixVertexBias = 1;     // fix vertex bias
  fVertexBias = 25.0;     // size of vertex bias [cm]

  fIntegralsDone = 0;

  fVtxX = 0.0;
  fVtxY = 0.0;
  fVtxZ = 0.0;
  fDirX = 0.0;
  fDirY = 0.0;
  fDirZ = 0.0;
  fVtxFOM = 0.0;

  fSimplePosition = 0;
  fSimpleDirection = 0;
  fPointPosition = 0;
  fPointDirection = 0;
  fPointVertex = 0;
  fExtendedVertex = 0;

  fMinuitPointPosition = new TMinuit();
  fMinuitPointPosition->SetPrintLevel(-1);
  fMinuitPointPosition->SetMaxIterations(5000);

  fMinuitPointDirection = new TMinuit();
  fMinuitPointDirection->SetPrintLevel(-1);
  fMinuitPointDirection->SetMaxIterations(5000);

  fMinuitPointVertex = new TMinuit();
  fMinuitPointVertex->SetPrintLevel(-1);
  fMinuitPointVertex->SetMaxIterations(5000);

  fMinuitExtendedVertex = new TMinuit();
  fMinuitExtendedVertex->SetPrintLevel(-1);
  fMinuitExtendedVertex->SetMaxIterations(5000); 

  fMinuitTimeFit = new TMinuit();
  fMinuitTimeFit->SetPrintLevel(-1);
  fMinuitTimeFit->SetMaxIterations(5000);   

  fMinuitConeFit = new TMinuit();
  fMinuitConeFit->SetPrintLevel(-1);
  fMinuitConeFit->SetMaxIterations(5000);   

  fPass = 0;
  fItr = 0; 

  fTimeFitItr = 0;
  fConeFitItr = 0;
  fPointPosItr = 0;
  fPointDirItr = 0;
  fPointVtxItr = 0;
  fExtendedVtxItr = 0;  

  // --- debug ---
  fTimeParam0 = 0.0;
  fConeParam0 = 0.0;
  fConeParam1 = 0.0; 
  fConeParam2 = 0.0;
}

WCSimVertexFinder::~WCSimVertexFinder (  )  [private]

Definition at line 388 of file WCSimVertexFinder.cc.

References fMinuitConeFit, fMinuitExtendedVertex, fMinuitPointDirection, fMinuitPointPosition, fMinuitPointVertex, fMinuitTimeFit, and vVertexList.

{
  // delete fitter
  // =============
  delete fMinuitPointPosition;
  delete fMinuitPointDirection;
  delete fMinuitPointVertex;
  delete fMinuitExtendedVertex;

  delete fMinuitTimeFit;
  delete fMinuitConeFit;

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

  vVertexList.clear();
}


Member Function Documentation

WCSimRecoVertex * WCSimVertexFinder::BuildDummyVertex (  )  [private]

Definition at line 665 of file WCSimVertexFinder.cc.

References fExtendedVertex, fPointDirection, fPointPosition, fPointVertex, fSimpleDirection, fSimplePosition, and vVertexList.

Referenced by RunExtendedFitFromTruth(), and RunPointFitFromTruth().

{
  WCSimRecoVertex* newVertex = new WCSimRecoVertex();
  vVertexList.push_back(newVertex);

  fSimplePosition  = newVertex;
  fSimpleDirection = newVertex;
  fPointPosition   = newVertex;
  fPointDirection  = newVertex;
  fPointVertex     = newVertex;
  fExtendedVertex  = newVertex;

  std::cout << "  --- no true vertex, building dummy vertex --- " << std::endl;

  return newVertex;
}

WCSimRecoVertex * WCSimVertexFinder::BuildTrueVertex (  )  [private]

Definition at line 654 of file WCSimVertexFinder.cc.

References FixSimplePosition(), WCSimTrueEvent::GetVtxX(), WCSimTrueEvent::GetVtxY(), WCSimTrueEvent::GetVtxZ(), and WCSimInterface::TrueEvent().

Referenced by FindSimplePosition().

{
  WCSimTrueEvent* myTrueEvent = (WCSimTrueEvent*)(WCSimInterface::TrueEvent());

  Double_t vtxX = myTrueEvent->GetVtxX();
  Double_t vtxY = myTrueEvent->GetVtxY();
  Double_t vtxZ = myTrueEvent->GetVtxZ();  

  return (WCSimRecoVertex*)(this->FixSimplePosition(vtxX,vtxY,vtxZ));
}

void WCSimVertexFinder::Clear (  )  [private]

Definition at line 437 of file WCSimVertexFinder.cc.

References fExtendedVertex, fPointDirection, fPointPosition, fPointVertex, fSimpleDirection, fSimplePosition, and vVertexList.

Referenced by Reset(), and Run().

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

  vVertexList.clear();

  // clear vertices
  // ==============
  fSimplePosition = 0;
  fSimpleDirection = 0;
  fPointPosition = 0;
  fPointDirection = 0; 
  fPointVertex = 0;
  fExtendedVertex = 0;

  return;
}

Int_t WCSimVertexFinder::cone_fit_iterations (  )  [inline]

Definition at line 214 of file WCSimVertexFinder.hh.

References fConeFitItr.

{ return fConeFitItr; }

void WCSimVertexFinder::cone_fit_itr (  )  [inline]

Definition at line 200 of file WCSimVertexFinder.hh.

References fConeFitItr.

{ fConeFitItr++; }

void WCSimVertexFinder::cone_fit_reset_itr (  )  [inline]

Definition at line 207 of file WCSimVertexFinder.hh.

References fConeFitItr.

Referenced by FitExtendedConePropertiesLnL().

{ fConeFitItr = 0; }

void WCSimVertexFinder::ConePropertiesFoM ( Double_t &  chi2  ) 

Definition at line 2588 of file WCSimVertexFinder.cc.

References fBaseFOM, WCSimVertexGeometry::Instance(), Instance(), and WCSimVertexGeometry::IsFiltered().

Referenced by FitConePropertiesFoM().

{  
  // calculate figure of merit
  // =========================
  Double_t coneEdge = 42.0;     // nominal cone angle
  Double_t coneEdgeLow = 21.0;  // cone edge (low side)      
  Double_t coneEdgeHigh = 3.0;  // cone edge (high side)   [muons: 3.0, electrons: 7.0]

  Double_t deltaAngle = 0.0;
  Double_t digitCharge = 0.0;
 
  Double_t coneCharge = 0.0;
  Double_t allCharge = 0.0;

  Double_t fom = 0.0;

  for( Int_t idigit=0; idigit<WCSimVertexGeometry::Instance()->GetNDigits(); idigit++ ){

    if( WCSimVertexGeometry::Instance()->IsFiltered(idigit) ){
      deltaAngle = WCSimVertexGeometry::Instance()->GetAngle(idigit) - coneEdge;
      digitCharge = WCSimVertexGeometry::Instance()->GetDigitQ(idigit);

      if( deltaAngle<=0.0 ){ 
        coneCharge += digitCharge*( 0.75 + 0.25/( 1.0 + (deltaAngle*deltaAngle)/(coneEdgeLow*coneEdgeLow) ) );
      }
      else{ 
        coneCharge += digitCharge*( 0.00 + 1.00/( 1.0 + (deltaAngle*deltaAngle)/(coneEdgeHigh*coneEdgeHigh) ) );
      }

      allCharge += digitCharge;
    }
  }

  if( allCharge>0.0 ){
    fom = fBaseFOM*coneCharge/allCharge;
  }

  // return figure of merit
  // ======================
  coneFOM = fom;

  return;
}

void WCSimVertexFinder::ConePropertiesLnL ( Double_t  vparam0,
Double_t  vparam1,
Double_t  vparam2,
Double_t &  vangle,
Double_t &  chi2 
)

Definition at line 2328 of file WCSimVertexFinder.cc.

References fBaseFOM, fIntegralsDone, fSconeA, fSconeB, fSel, fSmu, WCSimVertexGeometry::Instance(), Instance(), and WCSimVertexGeometry::IsFiltered().

Referenced by FitExtendedConePropertiesLnL(), and FitPointConePropertiesLnL().

{  
  // nuisance parameters
  // ===================
  Double_t alpha  = coneParam0;
  Double_t alpha0 = coneParam1;
  Double_t beta   = coneParam2;

  // internal variables
  // ==================
  Double_t deltaAngle = 0.0;
  Double_t sigmaAngle = 7.0;
  Double_t deltaAngle0 = 42.0*alpha0;
  
  Double_t digitQ = 0.0;
  Double_t sigmaQmin = 1.0;
  Double_t sigmaQmax = 10.0;
  Double_t sigmaQ = 0.0;

  Double_t A = 0.0;
  
  Double_t PconeA = 0.0;
  Double_t PconeB = 0.0;
  Double_t Pmu = 0.0;
  Double_t Pel = 0.0;

  Double_t Pcharge = 0.0;
  Double_t Pangle = 0.0;
  Double_t P = 0.0;

  Double_t chi2 = 0.0;
  Double_t ndof = 0.0;

  Double_t angle = 46.0;
  Double_t fom = 0.0;

  // hard-coded parameters: 200 kton (100 kton)
  // ==========================================
  Double_t lambdaMuShort = 0.5; //  0.5;
  Double_t lambdaMuLong  = 5.0; // 15.0;
  Double_t alphaMu =       1.0; //  4.5;

  Double_t lambdaElShort = 1.0; //  2.5;
  Double_t lambdaElLong =  7.5; // 15.0;
  Double_t alphaEl =       6.0; //  3.5;

  // numerical integrals
  // ===================
  fSconeA = 21.9938;  
  fSconeB =  0.0000;

  // inside cone
  Int_t nbinsInside = 420;
  for( Int_t n=0; n<nbinsInside; n++ ){
    deltaAngle = -42.0 + (n+0.5)*(42.0/(double)nbinsInside);
    fSconeB += 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) )
                           *( 1.0/(1.0+(deltaAngle*deltaAngle)/(deltaAngle0*deltaAngle0)) )
                           *( 42.0/(double)nbinsInside );
  }

  // outside cone
  if( fIntegralsDone == 0 ){
    fSmu = 0.0;
    fSel = 0.0;

    Int_t nbinsOutside = 1380;
    for( Int_t n=0; n<nbinsOutside; n++ ){
      deltaAngle = 0.0 + (n+0.5)*(138.0/(double)nbinsOutside);

      fSmu += 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) )
                          *( 1.0/(1.0+alphaMu*(lambdaMuShort/lambdaMuLong)) )*( 1.0/(1.0+(deltaAngle*deltaAngle)/(lambdaMuShort*lambdaMuShort)) 
                                            + alphaMu*(lambdaMuShort/lambdaMuLong)/(1.0+(deltaAngle*deltaAngle)/(lambdaMuLong*lambdaMuLong)) )
                          *( 138.0/(double)nbinsOutside );

      fSel += 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) )
                          *( 1.0/(1.0+alphaEl*(lambdaElShort/lambdaElLong)) )*( 1.0/(1.0+(deltaAngle*deltaAngle)/(lambdaElShort*lambdaElShort)) 
                                          + alphaEl*(lambdaElShort/lambdaElLong)/(1.0+(deltaAngle*deltaAngle)/(lambdaElLong*lambdaElLong)) )
                          *( 138.0/(double)nbinsOutside );
    }

    std::cout << " --- calculating integrals: Smu=" << fSmu << " Sel=" << fSel << std::endl;

    fIntegralsDone = 1;
  }


  // loop over digits
  // ================
  for( Int_t idigit=0; idigit<WCSimVertexGeometry::Instance()->GetNDigits(); idigit++ ){

    if( WCSimVertexGeometry::Instance()->IsFiltered(idigit) ){
      digitQ = WCSimVertexGeometry::Instance()->GetDigitQ(idigit);
      deltaAngle = WCSimVertexGeometry::Instance()->GetAngle(idigit) - 42.0;

      // pulse height distribution
      // =========================
      if( deltaAngle<=0 ){
        sigmaQ = sigmaQmax;
      }
      else{
        sigmaQ = sigmaQmin + (sigmaQmax-sigmaQmin)/(1.0+(deltaAngle*deltaAngle)/(sigmaAngle*sigmaAngle));
      }

      A = 1.0/(log(2.0)+0.5*TMath::Pi()*sigmaQ);

      if( digitQ<1.0 ){
        Pcharge = 2.0*A*digitQ/(1.0+digitQ*digitQ);
      }
      else{
        Pcharge = A/(1.0+(digitQ-1.0)*(digitQ-1.0)/(sigmaQ*sigmaQ));
      }

      // angular distribution
      // ====================
      A = 1.0/( alpha*fSconeA + (1.0-alpha)*fSconeB 
               + beta*fSmu + (1.0-beta)*fSel ); // numerical integrals 

      if( deltaAngle<=0 ){

        // pdfs inside cone:
        PconeA = 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) );
        PconeB = 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) )
                          *( 1.0/(1.0+(deltaAngle*deltaAngle)/(deltaAngle0*deltaAngle0)) );

        Pangle = A*( alpha*PconeA+(1.0-alpha)*PconeB );
      }         
      else{

        // pdfs outside cone
        Pmu = 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) )
                       *( 1.0/(1.0+alphaMu*(lambdaMuShort/lambdaMuLong)) )*( 1.0/(1.0+(deltaAngle*deltaAngle)/(lambdaMuShort*lambdaMuShort)) 
                                          + alphaMu*(lambdaMuShort/lambdaMuLong)/(1.0+(deltaAngle*deltaAngle)/(lambdaMuLong*lambdaMuLong)) );

        Pel = 1.4944765*sin( (42.0+deltaAngle)*(TMath::Pi()/180.0) )
                       *( 1.0/(1.0+alphaEl*(lambdaElShort/lambdaElLong)) )*( 1.0/(1.0+(deltaAngle*deltaAngle)/(lambdaElShort*lambdaElShort)) 
                                          + alphaEl*(lambdaElShort/lambdaElLong)/(1.0+(deltaAngle*deltaAngle)/(lambdaElLong*lambdaElLong)) );

        Pangle = A*( beta*Pmu+(1.0-beta)*Pel );
      }

      // overall probability
      // ===================
      P = Pcharge*Pangle;
      
      chi2 += -2.0*log(P);
      ndof += 1.0;
    }
  }

  // calculate figure of merit
  // =========================   
  if( ndof>0.0 ){
    fom = fBaseFOM - 5.0*chi2/ndof;
    angle = beta*43.0 + (1.0-beta)*49.0;
  }

  // return figure of merit
  // ======================
  coneAngle = angle;
  coneFOM = fom;

  return;
}

WCSimRecoVertex * WCSimVertexFinder::CorrectExtendedVertex ( WCSimRecoVertex vertex  )  [private]

Definition at line 1035 of file WCSimVertexFinder.cc.

References fExtendedVertex, fFixVertexBias, fVertexBias, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetPass(), WCSimRecoVertex::GetStatus(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetTrackLength(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimParameters::SpeedOfLight(), and vVertexList.

Referenced by RunExtendedFit().

{
  // get vertex and direction
  // ========================
  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();

  // get other vertex parameters
  // ===========================
  Double_t angle = myVertex->GetConeAngle();
  Double_t length = myVertex->GetTrackLength();

  Double_t fom = myVertex->GetFOM();
  Int_t nsteps = myVertex->GetIterations();
  Bool_t pass = myVertex->GetPass();
  Int_t status = myVertex->GetStatus();

  // fix vertex bias
  // ===============
  if( fFixVertexBias ){
    vtxX -= fVertexBias*dirX;
    vtxY -= fVertexBias*dirY;
    vtxZ -= fVertexBias*dirZ;
    vtxTime -= fVertexBias/WCSimParameters::SpeedOfLight();
  }

  // create new vertex
  // =================
  WCSimRecoVertex* newVertex = new WCSimRecoVertex(vtxX,vtxY,vtxZ,vtxTime,
                                                   dirX,dirY,dirZ,
                                                   angle,length,
                                                   fom,nsteps,pass,status);
  vVertexList.push_back(newVertex);
  fExtendedVertex = newVertex;

  // print vertex
  // ============
  if( fFixVertexBias ){
    std::cout << "  corrected extended vertex: " << std::endl
              << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
              << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
              << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;
  }

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

Int_t WCSimVertexFinder::extended_vertex_iterations (  )  [inline]

Definition at line 218 of file WCSimVertexFinder.hh.

References fExtendedVtxItr.

Referenced by FitExtendedVertexWithMinuit().

{ return fExtendedVtxItr; }

void WCSimVertexFinder::extended_vertex_itr (  )  [inline]

Definition at line 204 of file WCSimVertexFinder.hh.

References fExtendedVtxItr.

void WCSimVertexFinder::extended_vertex_reset_itr (  )  [inline]

Definition at line 211 of file WCSimVertexFinder.hh.

References fExtendedVtxItr.

Referenced by FitExtendedVertexWithMinuit().

{ fExtendedVtxItr = 0; }

void WCSimVertexFinder::ExtendedResiduals ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
) [private]

Definition at line 1888 of file WCSimVertexFinder.cc.

References Instance().

Referenced by ExtendedVertexChi2().

{
  return WCSimVertexGeometry::Instance()->CalcExtendedResiduals(vtxX,vtxY,vtxZ,0.0,
                                                                 dirX,dirY,dirZ);
}

void WCSimVertexFinder::ExtendedVertexChi2 ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t &  vangle,
Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1784 of file WCSimVertexFinder.cc.

References ExtendedResiduals(), fBaseFOM, FixDirectionChi2(), FixPositionChi2(), fUseTrueDirection, fUseTruePosition, and PenaltyChi2().

Referenced by FitExtendedVertexWithMinuit(), and FixExtendedVertex().

{  
  // figure of merit
  // ===============
  Double_t vtxFOM = 0.0;
  Double_t penaltyFOM = 0.0;
  Double_t fixPositionFOM = 0.0;
  Double_t fixDirectionFOM = 0.0;

  // calculate residuals
  // ===================
  this->ExtendedResiduals(vtxX,vtxY,vtxZ,
                          dirX,dirY,dirZ);

  // calculate figure of merit
  // =========================
  this->ExtendedVertexChi2(vtxAngle,vtxTime,vtxFOM);

  // calculate penalty
  // =================
  this->PenaltyChi2(vtxX,vtxY,vtxZ,penaltyFOM);

  // fix true position
  // =================
  if( fUseTruePosition ){
    this->FixPositionChi2(vtxX,vtxY,vtxZ,fixPositionFOM);
  }

  // fix true direction
  // ==================
  if( fUseTrueDirection ){
    this->FixDirectionChi2(dirX,dirY,dirZ,fixDirectionFOM);
  }

  // calculate overall figure of merit
  // =================================
  fom = vtxFOM + penaltyFOM + fixPositionFOM + fixDirectionFOM;

  // truncate
  if( fom<-999.999*fBaseFOM ) fom = -999.999*fBaseFOM;

  return;
}

void WCSimVertexFinder::ExtendedVertexChi2 ( Double_t &  vangle,
Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1861 of file WCSimVertexFinder.cc.

References fConeFitWeight, FitExtendedConePropertiesLnL(), FitExtendedTimePropertiesLnL(), and fTimeFitWeight.

{
  // calculate figure of merit
  // =========================
  Double_t timeFOM = 0.0;
  Double_t coneFOM = 0.0;

  this->FitExtendedConePropertiesLnL(vtxAngle,coneFOM);
  this->FitExtendedTimePropertiesLnL(vtxTime,timeFOM);
  
  fom = (fTimeFitWeight*timeFOM+fConeFitWeight*coneFOM)/(fTimeFitWeight+fConeFitWeight);

  return;
}

WCSimRecoVertex * WCSimVertexFinder::FindSeedDirection ( WCSimRecoVertex vertex  )  [private]

Definition at line 762 of file WCSimVertexFinder.cc.

References WCSimVertexGeometry::CalcSimpleDirection(), FixSimpleDirection(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), and WCSimVertexGeometry::Instance().

Referenced by FindSimpleDirection().

{
  WCSimRecoVertex* seedVertex = (WCSimRecoVertex*)(WCSimVertexGeometry::Instance()->CalcSimpleDirection(myVertex));  

  Double_t vtxX = seedVertex->GetX();
  Double_t vtxY = seedVertex->GetY();
  Double_t vtxZ = seedVertex->GetZ();

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

  WCSimRecoVertex* newVertex = (WCSimRecoVertex*)(this->FixSimpleDirection(vtxX,vtxY,vtxZ,
                                                                           dirX,dirY,dirZ));
  return newVertex;
}

WCSimRecoVertex * WCSimVertexFinder::FindSeedPosition (  )  [private]

Definition at line 722 of file WCSimVertexFinder.cc.

References fBaseFOM, FixSimplePosition(), fNumSeeds, Instance(), PointPositionChi2(), and WCSimRecoVertex::SetFOM().

Referenced by FindSimplePosition().

{
  Double_t vtxX = 0.0;
  Double_t vtxY = 0.0;
  Double_t vtxZ = 0.0;
  Double_t vtxTime = 950.0;
  Double_t vtxFOM = 0.0;

  Int_t bestSeed = -1;
  Double_t bestFOM = -1.0;

  WCSimVertexGeometry::Instance()->CalcVertexSeeds(fNumSeeds);
  UInt_t nlast = WCSimVertexGeometry::Instance()->GetNSeeds();

  for( UInt_t n=0; n<nlast; n++ ){
    vtxX = WCSimVertexGeometry::Instance()->GetSeedVtxX(n);
    vtxY = WCSimVertexGeometry::Instance()->GetSeedVtxY(n);
    vtxZ = WCSimVertexGeometry::Instance()->GetSeedVtxZ(n);

    this->PointPositionChi2(vtxX,vtxY,vtxZ,
                            vtxTime,vtxFOM);

    if( vtxFOM>bestFOM ){
      bestSeed = n; 
      bestFOM = vtxFOM;
    }
  }
  
  if( bestSeed>=0 ){
    vtxX = WCSimVertexGeometry::Instance()->GetSeedVtxX(bestSeed);
    vtxY = WCSimVertexGeometry::Instance()->GetSeedVtxY(bestSeed);
    vtxZ = WCSimVertexGeometry::Instance()->GetSeedVtxZ(bestSeed);
  }

  WCSimRecoVertex* newVertex = (WCSimRecoVertex*)(this->FixSimplePosition(vtxX,vtxY,vtxZ));
  newVertex->SetFOM(fBaseFOM,nlast,1); 

  return newVertex;
}

WCSimRecoVertex * WCSimVertexFinder::FindSimpleDirection ( WCSimRecoVertex vertex  )  [private]

Definition at line 708 of file WCSimVertexFinder.cc.

References FindSeedDirection(), fSimpleDirection, WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetPass(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), and WCSimRecoVertex::GetZ().

Referenced by RunPointFit().

{
  fSimpleDirection = (WCSimRecoVertex*)(this->FindSeedDirection(myVertex));

  std::cout << "  simple direction: " << std::endl
            << "    (vx,vy,vz)=(" << fSimpleDirection->GetX() << "," << fSimpleDirection->GetY() << "," << fSimpleDirection->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << fSimpleDirection->GetDirX() << "," << fSimpleDirection->GetDirY() << "," << fSimpleDirection->GetDirZ() << ") " << std::endl
            << "      vtime=" << fSimpleDirection->GetTime() << " itr=" << fSimpleDirection->GetIterations() << " fom=" << fSimpleDirection->GetFOM() << std::endl;

  if( fSimpleDirection->GetPass()==0 ) std::cout << "   <warning> simple direction calculation failed! " << std::endl;

  return fSimpleDirection;
}

WCSimRecoVertex * WCSimVertexFinder::FindSimplePosition (  )  [private]

Definition at line 682 of file WCSimVertexFinder.cc.

References BuildTrueVertex(), WCSimVertexGeometry::CalcSimpleVertex(), FindSeedPosition(), fSeedWithQuadruples, fSeedWithSimpleVertex, fSeedWithTrueVertex, fSimplePosition, WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetPass(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), and WCSimVertexGeometry::Instance().

Referenced by RunPointFit().

{
  if( fSeedWithTrueVertex ){
    std::cout << "  --- seed vertex with truth --- " << std::endl;
    return (WCSimRecoVertex*)(this->BuildTrueVertex());
  }

  if( fSeedWithSimpleVertex ){
    fSimplePosition = (WCSimRecoVertex*)(WCSimVertexGeometry::Instance()->CalcSimpleVertex()); 
  }
  else if( fSeedWithQuadruples ){
    fSimplePosition = (WCSimRecoVertex*)(this->FindSeedPosition());
  }
  else{
    fSimplePosition = (WCSimRecoVertex*)(WCSimVertexGeometry::Instance()->CalcSimpleVertex());  
  }

  std::cout << "  simple vertex: " << std::endl
            << "    (vx,vy,vz)=(" << fSimplePosition->GetX() << "," << fSimplePosition->GetY() << "," << fSimplePosition->GetZ() << ") " << std::endl
            << "      vtime=" << fSimplePosition->GetTime() << " itr=" << fSimplePosition->GetIterations() << " fom=" << fSimplePosition->GetFOM() << std::endl;

  if( fSimplePosition->GetPass()==0 ) std::cout << "   <warning> simple vertex calculation failed! " << std::endl;

  return fSimplePosition;
}

void WCSimVertexFinder::FindSimpleTimeProperties ( Double_t &  vtime  ) 

Definition at line 2186 of file WCSimVertexFinder.cc.

References WCSimVertexGeometry::Instance(), Instance(), and WCSimVertexGeometry::IsFiltered().

Referenced by FitExtendedTimePropertiesLnL(), FitPointTimePropertiesLnL(), and FitTimePropertiesFoM().

{
  // reset mean and rms
  // ================== 
  Double_t meanTime = 950.0;

  // calculate mean and rms of hits inside cone
  // ==========================================
  Double_t Swx = 0.0;
  Double_t Sw = 0.0;

  Double_t delta = 0.0;
  Double_t sigma = 0.0;
  Double_t weight = 0.0;
  Double_t deweight = 0.0;
  Double_t deltaAngle = 0.0;

  Double_t myConeEdge = 42.0;      // [degrees]
  Double_t myConeEdgeSigma = 7.0;  // [degrees]

  for( Int_t idigit=0; idigit<WCSimVertexGeometry::Instance()->GetNDigits(); idigit++ ){

    if( WCSimVertexGeometry::Instance()->IsFiltered(idigit) ){
      delta = WCSimVertexGeometry::Instance()->GetDelta(idigit);
      sigma = WCSimVertexGeometry::Instance()->GetDeltaSigma(idigit);
      weight = 1.0/(sigma*sigma);

      // profile in angle
      deltaAngle = WCSimVertexGeometry::Instance()->GetAngle(idigit) - myConeEdge;
     
      // deweight hits outside cone
      if( deltaAngle<=0.0 ){
        deweight = 1.0;
      }
      else{
        deweight = 1.0/(1.0+(deltaAngle*deltaAngle)/(myConeEdgeSigma*myConeEdgeSigma));
      }

      // add to running total
      Swx += deweight*weight*delta;
      Sw  += deweight*weight;
    }
  }

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

  // return mean and rms
  // ===================
  vtxTime = meanTime;

  return;
}

void WCSimVertexFinder::FitConeParams (  )  [static]
void WCSimVertexFinder::FitConePropertiesFoM ( Double_t &  vangle,
Double_t &  chi2 
)

Definition at line 2085 of file WCSimVertexFinder.cc.

References ConePropertiesFoM().

{
  coneAngle = 42.0; // nominal cone angle

  this->ConePropertiesFoM(coneFOM);

  return;
}

void WCSimVertexFinder::FitExtendedConePropertiesLnL ( Double_t &  vangle,
Double_t &  chi2 
)

Definition at line 2109 of file WCSimVertexFinder.cc.

References cone_fit_reset_itr(), ConePropertiesLnL(), fBaseFOM, fConeParam0, fConeParam1, fConeParam2, fFitConeParams, fFixConeParam0, fFixConeParam1, fFixConeParam2, FitPointConePropertiesLnL(), and fMinuitConeFit.

Referenced by ExtendedVertexChi2().

{  
  // return result from point fit
  // ============================
  if( fFitConeParams==0 ){
    return this->FitPointConePropertiesLnL(coneAngle,coneFOM);
  }

  // reset counter
  // =============
  cone_fit_reset_itr();

  // run Minuit
  // ==========  
  // one-parameter fit to angular distribution

  Int_t err = 0;
  Int_t flag = 0;

  Double_t seedParam0 = fFixConeParam0;
  Double_t seedParam1 = fFixConeParam1;
  Double_t seedParam2 = fFixConeParam2;

  Double_t fitParam0 = seedParam0;
  Double_t fitParam1 = seedParam1;
  Double_t fitParam2 = seedParam2;

  Double_t fitParam0Err = 0.0;
  Double_t fitParam1Err = 0.0; 
  Double_t fitParam2Err = 0.0;

  Double_t fitAngle  = 42.0;
  
  Double_t* arglist = new Double_t[10];
  arglist[0]=1;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitConeFit->mncler();
  fMinuitConeFit->SetFCN(vertex_cone_lnl);
  fMinuitConeFit->mnexcm("SET STR",arglist,1,err);
  fMinuitConeFit->mnparm(0,"vtxParam0",seedParam0,0.25,0.0,1.0,err);
  fMinuitConeFit->mnparm(1,"vtxParam1",seedParam1,0.25,0.0,1.0,err);
  fMinuitConeFit->mnparm(2,"vtxParam2",seedParam2,0.25,0.0,1.0,err);

  flag = fMinuitConeFit->Migrad();
  fMinuitConeFit->GetParameter(0,fitParam0,fitParam0Err);
  fMinuitConeFit->GetParameter(1,fitParam1,fitParam1Err);
  fMinuitConeFit->GetParameter(2,fitParam2,fitParam2Err);
  
  delete [] arglist;


  // calculate figure of merit
  // =========================
  Double_t fom = -999.999*fBaseFOM;
  
  this->ConePropertiesLnL(fitParam0,fitParam1,fitParam2,
                          fitAngle,fom);  

  //
  // std::cout << "   ConeFit: itr=" << cone_fit_iterations() << " fitParam0=" << fitParam0 << " fitParam1=" << fitParam1 << " fitParam2=" << fitParam2 << " fom=" << fom << std::endl;
  // 

  // --- debug ---
  fConeParam0 = fitParam0;
  fConeParam1 = fitParam1;
  fConeParam2 = fitParam2;

  // return figure of merit
  // ======================
  coneAngle = fitAngle;
  coneFOM = fom;

  return;
}

void WCSimVertexFinder::FitExtendedTimePropertiesLnL ( Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 2012 of file WCSimVertexFinder.cc.

References fBaseFOM, fFitTimeParams, fFixTimeParam0, FindSimpleTimeProperties(), FitPointTimePropertiesLnL(), fMinuitTimeFit, fTimeParam0, time_fit_reset_itr(), and TimePropertiesLnL().

Referenced by ExtendedVertexChi2().

{   
  // return result from point fit
  // ============================
  if( fFitTimeParams==0 ){
    return this->FitPointTimePropertiesLnL(vtxTime,vtxFOM);
  }

  // calculate mean and rms
  // ====================== 
  Double_t meanTime = 950.0;

  this->FindSimpleTimeProperties(meanTime); 

  // reset counter
  // =============
  time_fit_reset_itr();

  // run Minuit
  // ==========  
  // two-parameter fit to time profile

  Int_t err = 0;
  Int_t flag = 0;

  Double_t seedTime = meanTime;
  Double_t seedParam = fFixTimeParam0;

  Double_t fitTime = seedTime;
  Double_t fitTimeErr = 0.0;  

  Double_t fitParam = seedParam;
  Double_t fitParamErr = 0.0;
  
  Double_t* arglist = new Double_t[10];
  arglist[0]=1;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitTimeFit->mncler();
  fMinuitTimeFit->SetFCN(vertex_time_lnl);
  fMinuitTimeFit->mnexcm("SET STR",arglist,1,err);
  fMinuitTimeFit->mnparm(0,"vtxTime",seedTime,50.0,0.0,2000.0,err);
  fMinuitTimeFit->mnparm(1,"vtxParam",seedParam,0.05,0.0,1.0,err);
  
  flag = fMinuitTimeFit->Migrad();
  fMinuitTimeFit->GetParameter(0,fitTime,fitTimeErr);
  fMinuitTimeFit->GetParameter(1,fitParam,fitParamErr);
  
  delete [] arglist;


  // calculate figure of merit
  // =========================
  Double_t fom = -999.999*fBaseFOM;

  this->TimePropertiesLnL(fitTime,fitParam,fom);  

  //
  // std::cout << "   TimeFit: itr=" << time_fit_iterations() << " seedTime=" << seedTime << " fitTime=" << fitTime << " fitParam=" << fitParam << " fom=" << fom << std::endl;
  //

  // --- debug ---
  fTimeParam0 = fitParam;

  // return figure of merit
  // ======================
  vtxTime = fitTime;
  vtxFOM = fom;

  return;
}

WCSimRecoVertex * WCSimVertexFinder::FitExtendedVertex ( WCSimRecoVertex vertex  )  [private]

Definition at line 794 of file WCSimVertexFinder.cc.

References FitExtendedVertexWithMinuit().

Referenced by RunExtendedFit().

{
  return (WCSimRecoVertex*)(this->FitExtendedVertexWithMinuit(myVertex));
}

WCSimRecoVertex * WCSimVertexFinder::FitExtendedVertexWithMinuit ( WCSimRecoVertex vertex  )  [private]

Definition at line 1509 of file WCSimVertexFinder.cc.

References extended_vertex_iterations(), extended_vertex_reset_itr(), ExtendedVertexChi2(), fExtendedVertex, fItr, fMinuitExtendedVertex, WCSimRecoVertex::FoundDirection(), WCSimRecoVertex::FoundVertex(), fPass, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetStatus(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::SetConeAngle(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by FitExtendedVertex().

{
  // initialization
  // ==============
  Double_t vtxX = 0.0;
  Double_t vtxY = 0.0;
  Double_t vtxZ = 0.0;
  Double_t vtxTime = 950.0;

  Double_t dirX = 0.0;
  Double_t dirY = 0.0;
  Double_t dirZ = 0.0;
  
  Double_t vtxAngle = 42.0;

  Double_t vtxFOM = 0.0;

  // seed vertex
  // ===========  
  Bool_t foundSeed = ( myVertex->FoundVertex() 
                    && myVertex->FoundDirection() );

  Double_t seedX = myVertex->GetX();
  Double_t seedY = myVertex->GetY();
  Double_t seedZ = myVertex->GetZ();

  Double_t seedDirX = myVertex->GetDirX();
  Double_t seedDirY = myVertex->GetDirY();
  Double_t seedDirZ = myVertex->GetDirZ();

  Double_t seedTheta = acos(seedDirZ);
  Double_t seedPhi = 0.0;

  if( seedDirX!=0.0 ){
    seedPhi = atan(seedDirY/seedDirX);
  }
  if( seedDirX<=0.0 ){
    if( seedDirY>0.0 ) seedPhi += TMath::Pi();
    if( seedDirY<0.0 ) seedPhi -= TMath::Pi();
  }  

  // current status
  // ==============
  Int_t status = myVertex->GetStatus();

  // reset counter
  // =============
  extended_vertex_reset_itr();

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

  // abort if necessary
  // ==================
  if( foundSeed==0 ){
    std::cout << "   <warning> extended vertex fit failed to find input vertex " << std::endl;   
    status |= WCSimRecoVertex::kFailExtendedVertex;
    newVertex->SetStatus(status);
    return newVertex;
  }

  // run Minuit
  // ==========  
  // five-parameter fit to vertex and direction

  Int_t err = 0;
  Int_t flag = 0;

  Double_t fitXpos = 0.0;
  Double_t fitYpos = 0.0;
  Double_t fitZpos = 0.0;
  Double_t fitTheta = 0.0;
  Double_t fitPhi = 0.0;

  Double_t fitXposErr = 0.0;
  Double_t fitYposErr = 0.0;
  Double_t fitZposErr = 0.0;
  Double_t fitThetaErr = 0.0;
  Double_t fitPhiErr = 0.0;

  Double_t* arglist = new Double_t[10];
  arglist[0]=2;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitExtendedVertex->mncler();
  fMinuitExtendedVertex->SetFCN(extended_vertex_chi2);
  fMinuitExtendedVertex->mnexcm("SET STR",arglist,1,err);
  fMinuitExtendedVertex->mnparm(0,"x",seedX,250.0,-5000.0,+5000.0,err);
  fMinuitExtendedVertex->mnparm(1,"y",seedY,250.0,-5000.0,+5000.0,err);
  fMinuitExtendedVertex->mnparm(2,"z",seedZ,250.0,-5000.0,+5000.0,err);
  fMinuitExtendedVertex->mnparm(3,"theta",seedTheta,0.125*TMath::Pi(),0.0,TMath::Pi(),err);
  fMinuitExtendedVertex->mnparm(4,"phi",seedPhi,0.25*TMath::Pi(),-1.0*TMath::Pi(),+3.0*TMath::Pi(),err);
  
  flag = fMinuitExtendedVertex->Migrad();
  fMinuitExtendedVertex->GetParameter(0,fitXpos,fitXposErr);
  fMinuitExtendedVertex->GetParameter(1,fitYpos,fitYposErr);
  fMinuitExtendedVertex->GetParameter(2,fitZpos,fitZposErr);
  fMinuitExtendedVertex->GetParameter(3,fitTheta,fitThetaErr);
  fMinuitExtendedVertex->GetParameter(4,fitPhi,fitPhiErr);

  delete [] arglist;

  // sort results
  // ============
  vtxX = fitXpos; 
  vtxY = fitYpos;
  vtxZ = fitZpos;
  vtxTime = 950.0;

  dirX = sin(fitTheta)*cos(fitPhi);
  dirY = sin(fitTheta)*sin(fitPhi);
  dirZ = cos(fitTheta);  

  vtxFOM = 0.0;
  
  fPass = 0;               // flag = 0: normal termination
  if( flag==0 ) fPass = 1; // anything else: abnormal termination 

  fItr = extended_vertex_iterations();

  // calculate vertex
  // ================
  this->ExtendedVertexChi2(vtxX,vtxY,vtxZ,
                           dirX,dirY,dirZ, 
                           vtxAngle,vtxTime,vtxFOM);

  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetConeAngle(vtxAngle);
  newVertex->SetFOM(vtxFOM,fItr,fPass);

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

  // print vertex
  // ============
  std::cout << "  fitted extended vertex: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

  if( !fPass ) std::cout << "   <warning> extended vertex fit failed to converge! Error code: " << flag << std::endl;

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

void WCSimVertexFinder::FitPointConePropertiesLnL ( Double_t &  vangle,
Double_t &  chi2 
)
WCSimRecoVertex * WCSimVertexFinder::FitPointDirection ( WCSimRecoVertex vertex  )  [private]

Definition at line 784 of file WCSimVertexFinder.cc.

References FitPointDirectionWithMinuit().

Referenced by RunPointFit().

{  
  return (WCSimRecoVertex*)(this->FitPointDirectionWithMinuit(myVertex));
}

WCSimRecoVertex * WCSimVertexFinder::FitPointDirectionWithMinuit ( WCSimRecoVertex vertex  )  [private]

Definition at line 1212 of file WCSimVertexFinder.cc.

References fItr, fMinuitPointDirection, WCSimRecoVertex::FoundDirection(), WCSimRecoVertex::FoundVertex(), fPass, fPointDirection, fVtxX, fVtxY, fVtxZ, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetStatus(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), point_direction_iterations(), point_direction_reset_itr(), PointDirectionChi2(), WCSimRecoVertex::SetConeAngle(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by FitPointDirection().

{
  // initialization
  // ==============
  Bool_t foundSeed = ( myVertex->FoundVertex() 
                    && myVertex->FoundDirection() );
  
  Double_t vtxX = myVertex->GetX();
  Double_t vtxY = myVertex->GetY();
  Double_t vtxZ = myVertex->GetZ();
  Double_t vtxTime = myVertex->GetTime();

  Double_t dirX = 0.0;
  Double_t dirY = 0.0;
  Double_t dirZ = 0.0;  

  Double_t vtxAngle = 42.0;

  Double_t vtxFOM = 0.0;

  // seed direction
  // ==============
  Double_t seedDirX = myVertex->GetDirX();
  Double_t seedDirY = myVertex->GetDirY();
  Double_t seedDirZ = myVertex->GetDirZ();
  
  Double_t seedTheta = acos(seedDirZ);
  Double_t seedPhi = 0.0;

  if( seedDirX!=0.0 ){
    seedPhi = atan(seedDirY/seedDirX);
  }
  if( seedDirX<=0.0 ){
    if( seedDirY>0.0 ) seedPhi += TMath::Pi();
    if( seedDirY<0.0 ) seedPhi -= TMath::Pi();
  }  

  // current status
  // ==============
  Int_t status = myVertex->GetStatus();

  // set global vertex
  // =================
  fVtxX = vtxX;
  fVtxY = vtxY;
  fVtxZ = vtxZ;

  // reset counter
  // =============
  point_direction_reset_itr();

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

  // abort if necessary
  // ==================
  if( foundSeed==0 ){
    std::cout << "   <warning> point direction fit failed to find input vertex " << std::endl;
    status |= WCSimRecoVertex::kFailPointDirection;
    newVertex->SetStatus(status);
    return newVertex;
  }

  // run Minuit
  // ==========  
  // two-parameter fit to direction coordinates
  
  Int_t err = 0;
  Int_t flag = 0;

  Double_t dirTheta;
  Double_t dirPhi;

  Double_t dirThetaErr;
  Double_t dirPhiErr;

  Double_t* arglist = new Double_t[10];
  arglist[0]=1;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitPointDirection->mncler();
  fMinuitPointDirection->SetFCN(point_direction_chi2);
  fMinuitPointDirection->mnexcm("SET STR",arglist,1,err);
  fMinuitPointDirection->mnparm(0,"theta",seedTheta,0.125*TMath::Pi(),0.0,TMath::Pi(),err);
  fMinuitPointDirection->mnparm(1,"phi",seedPhi,0.25*TMath::Pi(),-1.0*TMath::Pi(),+3.0*TMath::Pi(),err);

  flag = fMinuitPointDirection->Migrad();
  fMinuitPointDirection->GetParameter(0,dirTheta,dirThetaErr);
  fMinuitPointDirection->GetParameter(1,dirPhi,dirPhiErr);

  delete [] arglist;

  // sort results
  // ============
  dirX = sin(dirTheta)*cos(dirPhi);
  dirY = sin(dirTheta)*sin(dirPhi);
  dirZ = cos(dirTheta);

  vtxFOM = 0.0;
  
  fPass = 0;               // flag = 0: normal termination
  if( flag==0 ) fPass = 1; // anything else: abnormal termination 
                           
  fItr = point_direction_iterations();

  // calculate vertex
  // ================
  this->PointDirectionChi2(vtxX,vtxY,vtxZ,
                           dirX,dirY,dirZ,
                           vtxAngle,vtxFOM);

  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetConeAngle(vtxAngle);
  newVertex->SetFOM(vtxFOM,fItr,fPass);

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

  // print vertex
  // ============
  std::cout << "  fitted point direction: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

  if( !fPass ) std::cout << "   <warning> point direction fit failed to converge! Error code: " << flag << std::endl;

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

WCSimRecoVertex * WCSimVertexFinder::FitPointPosition ( WCSimRecoVertex vertex  )  [private]

Definition at line 779 of file WCSimVertexFinder.cc.

References FitPointPositionWithMinuit().

Referenced by RunPointFit().

{  
  return (WCSimRecoVertex*)(this->FitPointPositionWithMinuit(myVertex));
}

WCSimRecoVertex * WCSimVertexFinder::FitPointPositionWithMinuit ( WCSimRecoVertex vertex  )  [private]

Definition at line 1090 of file WCSimVertexFinder.cc.

References fItr, fMinuitPointPosition, WCSimRecoVertex::FoundVertex(), fPass, fPointPosition, WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetStatus(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), point_position_iterations(), point_position_reset_itr(), PointPositionChi2(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by FitPointPosition().

{  
  // initialization
  // ==============
  Double_t vtxX = 0.0;
  Double_t vtxY = 0.0;
  Double_t vtxZ = 0.0;
  Double_t vtxTime = 950.0;

  Double_t dirX = 0.0;
  Double_t dirY = 0.0;
  Double_t dirZ = 0.0;

  Double_t vtxFOM = 0.0;

  // seed vertex
  // ===========
  Bool_t foundSeed = myVertex->FoundVertex();
  Double_t seedX = myVertex->GetX();
  Double_t seedY = myVertex->GetY();
  Double_t seedZ = myVertex->GetZ();

  // current status
  // ==============
  Int_t status = myVertex->GetStatus();

  // reset counter
  // =============
  point_position_reset_itr();

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

  // abort if necessary
  // ==================
  if( foundSeed==0 ){
    std::cout << "   <warning> point position fit failed to find input vertex " << std::endl;    
    status |= WCSimRecoVertex::kFailPointPosition;
    newVertex->SetStatus(status);
    return newVertex;
  }

  // run Minuit
  // ==========  
  // three-parameter fit to vertex coordinates

  Int_t err = 0;
  Int_t flag = 0;

  Double_t fitXpos = 0.0;
  Double_t fitYpos = 0.0;
  Double_t fitZpos = 0.0;

  Double_t fitXposErr = 0.0;
  Double_t fitYposErr = 0.0;
  Double_t fitZposErr = 0.0;

  Double_t* arglist = new Double_t[10];
  arglist[0]=1;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitPointPosition->mncler();
  fMinuitPointPosition->SetFCN(point_position_chi2);
  fMinuitPointPosition->mnexcm("SET STR",arglist,1,err);
  fMinuitPointPosition->mnparm(0,"x",seedX,250.0,-5000.0,+5000.0,err);
  fMinuitPointPosition->mnparm(1,"y",seedY,250.0,-5000.0,+5000.0,err);
  fMinuitPointPosition->mnparm(2,"z",seedZ,250.0,-5000.0,+5000.0,err);

  flag = fMinuitPointPosition->Migrad();
  fMinuitPointPosition->GetParameter(0,fitXpos,fitXposErr);
  fMinuitPointPosition->GetParameter(1,fitYpos,fitYposErr);
  fMinuitPointPosition->GetParameter(2,fitZpos,fitZposErr);

  delete [] arglist;

  // sort results
  // ============
  vtxX = fitXpos; 
  vtxY = fitYpos;
  vtxZ = fitZpos;
  vtxTime = 950.0;

  vtxFOM = 0.0;
  
  fPass = 0;               // flag = 0: normal termination
  if( flag==0 ) fPass = 1; // anything else: abnormal termination 

  fItr = point_position_iterations();

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

  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetFOM(vtxFOM,fItr,fPass);

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

  // print vertex
  // ============
  std::cout << "  fitted point position: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "      vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

  if( !fPass ) std::cout << "   <warning> point position fit failed to converge! Error code: " << flag << std::endl;

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

void WCSimVertexFinder::FitPointTimePropertiesLnL ( Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1949 of file WCSimVertexFinder.cc.

References fBaseFOM, fFixTimeParam0, FindSimpleTimeProperties(), fMinuitTimeFit, fTimeParam0, time_fit_reset_itr(), and TimePropertiesLnL().

Referenced by FitExtendedTimePropertiesLnL(), PointPositionChi2(), and PointVertexChi2().

{ 
  // calculate mean and rms
  // ====================== 
  Double_t meanTime = 950.0;

  this->FindSimpleTimeProperties(meanTime); 

  // reset counter
  // =============
  time_fit_reset_itr();

  // run Minuit
  // ==========  
  // one-parameter fit to time profile

  Int_t err = 0;
  Int_t flag = 0;

  Double_t seedTime = meanTime;

  Double_t fitParam = fFixTimeParam0;

  Double_t fitTime = 0.0;
  Double_t fitTimeErr = 0.0;  
  
  Double_t* arglist = new Double_t[10];
  arglist[0]=1;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitTimeFit->mncler();
  fMinuitTimeFit->SetFCN(vertex_time_lnl);
  fMinuitTimeFit->mnexcm("SET STR",arglist,1,err);
  fMinuitTimeFit->mnparm(0,"vtxTime",seedTime,50.0,0.0,2000.0,err);
  
  flag = fMinuitTimeFit->Migrad();
  fMinuitTimeFit->GetParameter(0,fitTime,fitTimeErr);
   
  delete [] arglist;


  // calculate figure of merit
  // =========================
  Double_t fom = -999.999*fBaseFOM;

  this->TimePropertiesLnL(fitTime,fitParam,fom);  

  //
  // std::cout << "   TimeFit: itr=" << time_fit_iterations() << " seedTime=" << seedTime << " fitTime=" << fitTime << " fitParam=" << fitParam << " fom=" << fom << std::endl;
  //

  // --- debug ---
  fTimeParam0 = fitParam;

  // return figure of merit
  // ======================
  vtxTime = fitTime;
  vtxFOM = fom;

  return;
}

WCSimRecoVertex * WCSimVertexFinder::FitPointVertex ( WCSimRecoVertex vertex  )  [private]

Definition at line 789 of file WCSimVertexFinder.cc.

References FitPointVertexWithMinuit().

Referenced by RunPointFit().

{      
  return (WCSimRecoVertex*)(this->FitPointVertexWithMinuit(myVertex));
}

WCSimRecoVertex * WCSimVertexFinder::FitPointVertexWithMinuit ( WCSimRecoVertex vertex  )  [private]

Definition at line 1353 of file WCSimVertexFinder.cc.

References fItr, fMinuitPointVertex, WCSimRecoVertex::FoundDirection(), WCSimRecoVertex::FoundVertex(), fPass, fPointVertex, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetStatus(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), point_vertex_iterations(), point_vertex_reset_itr(), PointVertexChi2(), WCSimRecoVertex::SetConeAngle(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by FitPointVertex().

{
  // initialization
  // ==============
  Double_t vtxX = 0.0;
  Double_t vtxY = 0.0;
  Double_t vtxZ = 0.0;
  Double_t vtxTime = 950.0;

  Double_t dirX = 0.0;
  Double_t dirY = 0.0;
  Double_t dirZ = 0.0;
    
  Double_t vtxAngle = 42.0;

  Double_t vtxFOM = 0.0;

  // seed vertex
  // ===========  
  Bool_t foundSeed = ( myVertex->FoundVertex() 
                    && myVertex->FoundDirection() );

  Double_t seedX = myVertex->GetX();
  Double_t seedY = myVertex->GetY();
  Double_t seedZ = myVertex->GetZ();

  Double_t seedDirX = myVertex->GetDirX();
  Double_t seedDirY = myVertex->GetDirY();
  Double_t seedDirZ = myVertex->GetDirZ();

  Double_t seedTheta = acos(seedDirZ);
  Double_t seedPhi = 0.0;

  if( seedDirX!=0.0 ){
    seedPhi = atan(seedDirY/seedDirX);
  }
  if( seedDirX<=0.0 ){
    if( seedDirY>0.0 ) seedPhi += TMath::Pi();
    if( seedDirY<0.0 ) seedPhi -= TMath::Pi();
  }  

  // current status
  // ==============
  Int_t status = myVertex->GetStatus();

  // reset counter
  // =============
  point_vertex_reset_itr();

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

  // abort if necessary
  // ==================
  if( foundSeed==0 ){
    std::cout << "   <warning> point vertex fit failed to find input vertex " << std::endl;   
    status |= WCSimRecoVertex::kFailPointVertex;
    newVertex->SetStatus(status);
    return newVertex;
  }

  // run Minuit
  // ==========  
  // five-parameter fit to vertex and direction

  Int_t err = 0;
  Int_t flag = 0;

  Double_t fitXpos = 0.0;
  Double_t fitYpos = 0.0;
  Double_t fitZpos = 0.0;
  Double_t fitTheta = 0.0;
  Double_t fitPhi = 0.0;

  Double_t fitXposErr = 0.0;
  Double_t fitYposErr = 0.0;
  Double_t fitZposErr = 0.0;
  Double_t fitThetaErr = 0.0;
  Double_t fitPhiErr = 0.0;

  Double_t* arglist = new Double_t[10];
  arglist[0]=2;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitPointVertex->mncler();
  fMinuitPointVertex->SetFCN(point_vertex_chi2);
  fMinuitPointVertex->mnexcm("SET STR",arglist,1,err);
  fMinuitPointVertex->mnparm(0,"x",seedX,250.0,-5000.0,+5000.0,err);
  fMinuitPointVertex->mnparm(1,"y",seedY,250.0,-5000.0,+5000.0,err);
  fMinuitPointVertex->mnparm(2,"z",seedZ,250.0,-5000.0,+5000.0,err);
  fMinuitPointVertex->mnparm(3,"theta",seedTheta,0.125*TMath::Pi(),0.0,TMath::Pi(),err);
  fMinuitPointVertex->mnparm(4,"phi",seedPhi,0.25*TMath::Pi(),-1.0*TMath::Pi(),+3.0*TMath::Pi(),err);
  
  flag = fMinuitPointVertex->Migrad();
  fMinuitPointVertex->GetParameter(0,fitXpos,fitXposErr);
  fMinuitPointVertex->GetParameter(1,fitYpos,fitYposErr);
  fMinuitPointVertex->GetParameter(2,fitZpos,fitZposErr);
  fMinuitPointVertex->GetParameter(3,fitTheta,fitThetaErr);
  fMinuitPointVertex->GetParameter(4,fitPhi,fitPhiErr);

  delete [] arglist;

  // sort results
  // ============
  vtxX = fitXpos; 
  vtxY = fitYpos;
  vtxZ = fitZpos;
  vtxTime = 950.0;

  dirX = sin(fitTheta)*cos(fitPhi);
  dirY = sin(fitTheta)*sin(fitPhi);
  dirZ = cos(fitTheta);  

  vtxFOM = 0.0;
  
  fPass = 0;               // flag = 0: normal termination
  if( flag==0 ) fPass = 1; // anything else: abnormal termination 

  fItr = point_vertex_iterations();

  // calculate vertex
  // ================
  this->PointVertexChi2(vtxX,vtxY,vtxZ,
                        dirX,dirY,dirZ, 
                        vtxAngle,vtxTime,vtxFOM);

  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetConeAngle(vtxAngle);
  newVertex->SetFOM(vtxFOM,fItr,fPass);

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

  // print vertex
  // ============
  std::cout << "  fitted point vertex: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

  if( !fPass ) std::cout << "   <warning> point vertex fit failed to converge! Error code: " << flag << std::endl;

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

void WCSimVertexFinder::FitTimeParams (  )  [static]
void WCSimVertexFinder::FitTimePropertiesFoM ( Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1894 of file WCSimVertexFinder.cc.

References fBaseFOM, FindSimpleTimeProperties(), fMinuitTimeFit, time_fit_reset_itr(), and TimePropertiesFoM().

{ 
  // calculate mean and rms
  // ====================== 
  Double_t meanTime = 950.0;

  this->FindSimpleTimeProperties(meanTime); 

  // reset counter
  // =============
  time_fit_reset_itr();

  // run Minuit
  // ==========  
  // one-parameter fit to vertex time

  Int_t err = 0;
  Int_t flag = 0;

  Double_t seedTime = meanTime;

  Double_t fitTime = 0.0;
  Double_t fitTimeErr = 0.0;
  
  Double_t* arglist = new Double_t[10];
  arglist[0]=1;  // 1: standard minimization
                 // 2: try to improve minimum

  // re-initialize everything...
  fMinuitTimeFit->mncler();
  fMinuitTimeFit->SetFCN(vertex_time_fom);
  fMinuitTimeFit->mnexcm("SET STR",arglist,1,err);
  fMinuitTimeFit->mnparm(0,"vtxTime",seedTime,50.0,0.0,2000.0,err);
  
  flag = fMinuitTimeFit->Migrad();
  fMinuitTimeFit->GetParameter(0,fitTime,fitTimeErr);
  
  delete [] arglist;


  // calculate figure of merit
  // =========================
  Double_t fom = -999.999*fBaseFOM;

  this->TimePropertiesFoM(fitTime,fom);  


  // return figure of merit
  // ======================
  vtxTime = fitTime;
  vtxFOM = fom;

  return;
}

void WCSimVertexFinder::FitWeights ( Double_t  tw,
Double_t  cw 
) [static]

Definition at line 268 of file WCSimVertexFinder.cc.

References Instance(), and SetFitWeights().

void WCSimVertexFinder::FixConeParams ( Double_t  param0,
Double_t  param1,
Double_t  param2 
) [static]

Definition at line 283 of file WCSimVertexFinder.cc.

References Instance(), and SetFixConeParams().

{
  WCSimVertexFinder::Instance()->SetFixConeParams(param0,param1,param2);
}

void WCSimVertexFinder::FixDirectionChi2 ( Double_t  px,
Double_t  py,
Double_t  pz,
Double_t &  chi2 
)

Definition at line 2686 of file WCSimVertexFinder.cc.

References fBaseFOM, WCSimTrueEvent::GetDirX(), WCSimTrueEvent::GetDirY(), WCSimTrueEvent::GetDirZ(), WCSimTrueEvent::GetNTracks(), and WCSimInterface::TrueEvent().

Referenced by ExtendedVertexChi2(), PointDirectionChi2(), and PointVertexChi2().

{
  // default penalty
  // ===============
  Double_t deltaChi2 = 0;

  // get true event
  // ==============
  WCSimTrueEvent* myTrueEvent = (WCSimTrueEvent*)(WCSimInterface::TrueEvent());

  if( myTrueEvent->GetNTracks()>0 ){
    Double_t trueDirX = myTrueEvent->GetDirX();
    Double_t trueDirY = myTrueEvent->GetDirY();
    Double_t trueDirZ = myTrueEvent->GetDirZ();
  
    Double_t deltaTheta = (180.0/TMath::Pi())*(TMath::ACos(px*trueDirX+py*trueDirY+pz*trueDirZ));
    Double_t deltaThetaBase = 0.5; // [degrees]

    deltaChi2 += -10.0*fBaseFOM*(1.0-1.0/(1.0+(deltaTheta/deltaThetaBase)*(deltaTheta/deltaThetaBase)));
  }

  // return penalty
  // ==============
  chi2 = deltaChi2;

  return;
}

WCSimRecoVertex * WCSimVertexFinder::FixExtendedVertex ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
) [private]

Definition at line 991 of file WCSimVertexFinder.cc.

References ExtendedVertexChi2(), fExtendedVertex, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::kOK, WCSimRecoVertex::SetConeAngle(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by RunExtendedFit().

{
  // initialization
  // ==============
  Double_t vtxTime = 950.0;
  Double_t vtxAngle = 42.0;
  Double_t vtxFOM = 0.0;

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

  // figure of merit
  // ===============
  this->ExtendedVertexChi2(vtxX,vtxY,vtxZ,
                           dirX,dirY,dirZ,
                           vtxAngle,vtxTime,vtxFOM); 


  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetConeAngle(vtxAngle);
  newVertex->SetFOM(vtxFOM,1,1);

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

  // print vertex
  // ============
  std::cout << "  set extended vertex: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;
  
  // return vertex
  // =============
  return newVertex;
}

WCSimRecoVertex * WCSimVertexFinder::FixPointDirection ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
) [private]

Definition at line 901 of file WCSimVertexFinder.cc.

References fPointDirection, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::kOK, PointDirectionChi2(), PointPositionChi2(), WCSimRecoVertex::SetConeAngle(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by RunPointFit().

{
  // initialization
  // ==============
  Double_t vtxTime = 950.0;
  Double_t vtxAngle = 42.0;
  Double_t vtxFOM = 0.0;
  Double_t dirFOM = 0.0;

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

  // figure of merit
  // ===============
  this->PointPositionChi2(vtxX,vtxY,vtxZ,
                          vtxTime,vtxFOM);

  this->PointDirectionChi2(vtxX,vtxY,vtxZ,
                           dirX,dirY,dirZ,
                           vtxAngle,dirFOM);

  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetConeAngle(vtxAngle);
  newVertex->SetFOM(dirFOM,1,1);

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

  // print vertex
  // ============
  std::cout << "  set point direction: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

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

WCSimRecoVertex * WCSimVertexFinder::FixPointPosition ( Double_t  vx,
Double_t  vy,
Double_t  vz 
) [private]

Definition at line 828 of file WCSimVertexFinder.cc.

References fPointPosition, WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::kOK, PointPositionChi2(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by RunPointFit().

{  
  // initialization
  // ==============
  Double_t vtxTime = 950.0;
  Double_t vtxFOM = 0.0;

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

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

  // set vertex
  // ==========
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetFOM(vtxFOM,1,1);

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

  // print vertex
  // ============
  std::cout << "  set point position: " << std::endl
            <<"     (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "      vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

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

WCSimRecoVertex * WCSimVertexFinder::FixPointVertex ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
) [private]

Definition at line 948 of file WCSimVertexFinder.cc.

References fPointVertex, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::kOK, PointVertexChi2(), WCSimRecoVertex::SetConeAngle(), WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by RunPointFit().

{
  // initialization
  // ==============
  Double_t vtxTime = 950.0;
  Double_t vtxAngle = 42.0;
  Double_t vtxFOM = 0.0;

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

  // figure of merit
  // ===============
  this->PointVertexChi2(vtxX,vtxY,vtxZ,
                        dirX,dirY,dirZ,
                        vtxAngle,vtxTime,vtxFOM);

  // set vertex and direction
  // ========================
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);
  newVertex->SetConeAngle(vtxAngle);
  newVertex->SetFOM(vtxFOM,1,1);

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

  // print vertex
  // ============
  std::cout << "  set point vertex: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      angle=" << newVertex->GetConeAngle() << " vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;
  
  // return vertex
  // =============
  return newVertex;
}

void WCSimVertexFinder::FixPositionChi2 ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t &  chi2 
)

Definition at line 2656 of file WCSimVertexFinder.cc.

References fBaseFOM, WCSimTrueEvent::GetNTracks(), WCSimTrueEvent::GetVtxX(), WCSimTrueEvent::GetVtxY(), WCSimTrueEvent::GetVtxZ(), and WCSimInterface::TrueEvent().

Referenced by ExtendedVertexChi2(), PointDirectionChi2(), PointPositionChi2(), and PointVertexChi2().

{
  // default penalty
  // ===============
  Double_t deltaChi2 = 0;

  // get true event
  // ==============
  WCSimTrueEvent* myTrueEvent = (WCSimTrueEvent*)(WCSimInterface::TrueEvent());

  if( myTrueEvent->GetNTracks()>0 ){
    Double_t trueVtxX = myTrueEvent->GetVtxX();
    Double_t trueVtxY = myTrueEvent->GetVtxY();
    Double_t trueVtxZ = myTrueEvent->GetVtxZ();
  
    Double_t deltaRsq = (vx-trueVtxX)*(vx-trueVtxX)
                       +(vy-trueVtxY)*(vy-trueVtxY)
                       +(vz-trueVtxZ)*(vz-trueVtxZ);
    Double_t deltaRsqBase = 0.25*0.25; // [cm]

    deltaChi2 += -10.0*fBaseFOM*(1.0-1.0/(1.0+(deltaRsq/deltaRsqBase)));
  }

  // return penalty
  // ==============
  chi2 = deltaChi2;

  return;
}

WCSimRecoVertex * WCSimVertexFinder::FixSimpleDirection ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
) [private]

Definition at line 866 of file WCSimVertexFinder.cc.

References fBaseFOM, fSimpleDirection, WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::kOK, WCSimRecoVertex::SetDirection(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetStatus(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by FindSeedDirection(), and RunPointFit().

{
  // initialization
  // ==============
  Double_t vtxTime = 950.0;
  Double_t dirFOM = fBaseFOM;

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

  // set vertex
  // ==========
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetDirection(dirX,dirY,dirZ);  
  newVertex->SetFOM(dirFOM,1,1);

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

  // print vertex
  // ============
  std::cout << "  set simple direction: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "    (px,py,pz)=(" << newVertex->GetDirX() << "," << newVertex->GetDirY() << "," << newVertex->GetDirZ() << ") " << std::endl
            << "      vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

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

WCSimRecoVertex * WCSimVertexFinder::FixSimplePosition ( Double_t  vx,
Double_t  vy,
Double_t  vz 
) [private]

Definition at line 799 of file WCSimVertexFinder.cc.

References fBaseFOM, fSimplePosition, WCSimRecoVertex::GetFOM(), WCSimRecoVertex::GetIterations(), WCSimRecoVertex::GetTime(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoVertex::SetFOM(), WCSimRecoVertex::SetVertex(), and vVertexList.

Referenced by BuildTrueVertex(), FindSeedPosition(), and RunPointFit().

{  
  // initialization
  // ==============
  Double_t vtxTime = 950.0;
  Double_t vtxFOM = fBaseFOM;

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

  // set vertex
  // ==========
  newVertex->SetVertex(vtxX,vtxY,vtxZ,vtxTime);
  newVertex->SetFOM(vtxFOM,1,1); 
 
  // print vertex
  // ============
  std::cout << "  set simple position: " << std::endl
            << "    (vx,vy,vz)=(" << newVertex->GetX() << "," << newVertex->GetY() << "," << newVertex->GetZ() << ") " << std::endl
            << "      vtime=" << newVertex->GetTime() << " itr=" << newVertex->GetIterations() << " fom=" << newVertex->GetFOM() << std::endl;

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

void WCSimVertexFinder::FixTimeParams ( Double_t  param0  )  [static]

Definition at line 273 of file WCSimVertexFinder.cc.

References Instance(), and SetFixTimeParams().

void WCSimVertexFinder::FixVertexBias ( Double_t  bias  )  [static]

Definition at line 293 of file WCSimVertexFinder.cc.

References Instance(), and SetVertexBias().

WCSimRecoVertex* WCSimVertexFinder::GetExtendedVertex (  )  [inline]

Definition at line 98 of file WCSimVertexFinder.hh.

References fExtendedVertex.

Referenced by WCSimRecoNtuple::WriteVariables().

{ return fExtendedVertex; }

Int_t WCSimVertexFinder::GetIterations (  )  [inline]

Definition at line 197 of file WCSimVertexFinder.hh.

References fItr.

{ return fItr; }

WCSimRecoVertex* WCSimVertexFinder::GetPointDirection (  )  [inline]

Definition at line 96 of file WCSimVertexFinder.hh.

References fPointDirection.

Referenced by WCSimRecoNtuple::WriteVariables().

{ return fPointDirection; }

WCSimRecoVertex* WCSimVertexFinder::GetPointPosition (  )  [inline]

Definition at line 95 of file WCSimVertexFinder.hh.

References fPointPosition.

Referenced by WCSimRecoNtuple::WriteVariables().

{ return fPointPosition; }

WCSimRecoVertex* WCSimVertexFinder::GetPointVertex (  )  [inline]

Definition at line 97 of file WCSimVertexFinder.hh.

References fPointVertex.

Referenced by WCSimRecoNtuple::WriteVariables().

{ return fPointVertex; }

WCSimRecoVertex* WCSimVertexFinder::GetSimpleDirection (  )  [inline]

Definition at line 94 of file WCSimVertexFinder.hh.

References fSimpleDirection.

Referenced by WCSimRecoNtuple::WriteVariables().

{ return fSimpleDirection; }

WCSimRecoVertex* WCSimVertexFinder::GetSimplePosition (  )  [inline]

Definition at line 93 of file WCSimVertexFinder.hh.

References fSimplePosition.

Referenced by WCSimRecoNtuple::WriteVariables().

{ return fSimplePosition; }

WCSimVertexFinder * WCSimVertexFinder::Instance (  )  [static]
void WCSimVertexFinder::NumSeeds ( Int_t  nseeds  )  [static]

Definition at line 263 of file WCSimVertexFinder.cc.

References Instance(), and SetNumSeeds().

void WCSimVertexFinder::PenaltyChi2 ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t &  chi2 
)

Definition at line 2632 of file WCSimVertexFinder.cc.

References fBaseFOM, and Instance().

Referenced by ExtendedVertexChi2(), PointPositionChi2(), and PointVertexChi2().

{  
  // default penalty
  // ===============
  Double_t deltaChi2 = 0;

  // check vertex position
  // =====================
  Bool_t inDetector = WCSimGeometry::Instance()->InsideDetector(vtxX,vtxY,vtxZ);
  if( inDetector==0 ){
    
    Double_t deltaR = WCSimGeometry::Instance()->DistanceToEdge(vtxX,vtxY,vtxZ);  // [cm]
    Double_t deltaRbase = 500.0; // [cm]
 
    deltaChi2 += -fBaseFOM*(deltaR/deltaRbase)*(deltaR/deltaRbase);
  }

  // return penalty
  // ==============
  chi2 = deltaChi2;

  return;
}

Int_t WCSimVertexFinder::point_direction_iterations (  )  [inline]

Definition at line 216 of file WCSimVertexFinder.hh.

References fPointDirItr.

Referenced by FitPointDirectionWithMinuit().

{ return fPointDirItr; }

void WCSimVertexFinder::point_direction_itr (  )  [inline]

Definition at line 202 of file WCSimVertexFinder.hh.

References fPointDirItr.

{ fPointDirItr++; }

void WCSimVertexFinder::point_direction_reset_itr (  )  [inline]

Definition at line 209 of file WCSimVertexFinder.hh.

References fPointDirItr.

Referenced by FitPointDirectionWithMinuit().

{ fPointDirItr = 0; }

Int_t WCSimVertexFinder::point_position_iterations (  )  [inline]

Definition at line 215 of file WCSimVertexFinder.hh.

References fPointPosItr.

Referenced by FitPointPositionWithMinuit().

{ return fPointPosItr; }

void WCSimVertexFinder::point_position_itr (  )  [inline]

Definition at line 201 of file WCSimVertexFinder.hh.

References fPointPosItr.

{ fPointPosItr++; }

void WCSimVertexFinder::point_position_reset_itr (  )  [inline]

Definition at line 208 of file WCSimVertexFinder.hh.

References fPointPosItr.

Referenced by FitPointPositionWithMinuit().

{ fPointPosItr = 0; }

Int_t WCSimVertexFinder::point_vertex_iterations (  )  [inline]

Definition at line 217 of file WCSimVertexFinder.hh.

References fPointVtxItr.

Referenced by FitPointVertexWithMinuit().

{ return fPointVtxItr; }

void WCSimVertexFinder::point_vertex_itr (  )  [inline]

Definition at line 203 of file WCSimVertexFinder.hh.

References fPointVtxItr.

{ fPointVtxItr++; }

void WCSimVertexFinder::point_vertex_reset_itr (  )  [inline]

Definition at line 210 of file WCSimVertexFinder.hh.

References fPointVtxItr.

Referenced by FitPointVertexWithMinuit().

{ fPointVtxItr = 0; }

void WCSimVertexFinder::PointDirectionChi2 ( Double_t &  vangle,
Double_t &  chi2 
)

Definition at line 1837 of file WCSimVertexFinder.cc.

References FitPointConePropertiesLnL().

{
  // calculate figure of merit
  // =========================  
  this->FitPointConePropertiesLnL(vtxAngle,fom);

  return;
}

void WCSimVertexFinder::PointDirectionChi2 ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t &  vangle,
Double_t &  chi2 
)

Definition at line 1701 of file WCSimVertexFinder.cc.

References fBaseFOM, FixDirectionChi2(), FixPositionChi2(), fUseTrueDirection, fUseTruePosition, and PointResiduals().

Referenced by FitPointDirectionWithMinuit(), and FixPointDirection().

{  
  // figure of merit
  // ===============
  Double_t vtxFOM = 0.0;
  Double_t fixPositionFOM = 0.0;
  Double_t fixDirectionFOM = 0.0;
  
  // calculate residuals
  // ===================
  this->PointResiduals(vtxX,vtxY,vtxZ,
                       dirX,dirY,dirZ);

  // calculate figure of merit
  // =========================
  this->PointDirectionChi2(vtxAngle,vtxFOM);

  // fix true position
  // =================
  if( fUseTruePosition ){
    this->FixPositionChi2(vtxX,vtxY,vtxZ,fixPositionFOM);
  }

  // fix true direction
  // ==================
  if( fUseTrueDirection ){
    this->FixDirectionChi2(dirX,dirY,dirZ,fixDirectionFOM);
  }

  // calculate overall figure of merit
  // =================================
  fom = vtxFOM + fixDirectionFOM;

  // truncate
  if( fom<-999.999*fBaseFOM ) fom = -999.999*fBaseFOM;

  return;
}

void WCSimVertexFinder::PointFitOnly ( Bool_t  yesno = 1  )  [static]

Definition at line 228 of file WCSimVertexFinder.cc.

References Instance(), and SetPointFitOnly().

void WCSimVertexFinder::PointPositionChi2 ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1665 of file WCSimVertexFinder.cc.

References fBaseFOM, FixPositionChi2(), fUseTruePosition, PenaltyChi2(), and PointResiduals().

Referenced by FindSeedPosition(), FitPointPositionWithMinuit(), FixPointDirection(), and FixPointPosition().

{  
  // figure of merit
  // ===============
  Double_t vtxFOM = 0.0;
  Double_t penaltyFOM = 0.0;
  Double_t fixPositionFOM = 0.0;

  // calculate residuals
  // ===================
  this->PointResiduals(vtxX,vtxY,vtxZ);

  // calculate figure of merit
  // =========================
  this->PointPositionChi2(vtxTime,vtxFOM);

  // calculate penalty
  // =================
  this->PenaltyChi2(vtxX,vtxY,vtxZ,penaltyFOM);

  // fix true position
  // =================
  if( fUseTruePosition ){
    this->FixPositionChi2(vtxX,vtxY,vtxZ,fixPositionFOM);
  }

  // calculate overall figure of merit
  // =================================
  fom = vtxFOM + penaltyFOM + fixPositionFOM;

  // truncate
  if( fom<-999.999*fBaseFOM ) fom = -999.999*fBaseFOM;

  return;
}

void WCSimVertexFinder::PointPositionChi2 ( Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1828 of file WCSimVertexFinder.cc.

References FitPointTimePropertiesLnL().

{
  // calculate figure of merit
  // =========================
  this->FitPointTimePropertiesLnL(vtxTime,fom);

  return;
}

void WCSimVertexFinder::PointResiduals ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
) [private]

Definition at line 1882 of file WCSimVertexFinder.cc.

References Instance().

{  
  return WCSimVertexGeometry::Instance()->CalcPointResiduals(vtxX,vtxY,vtxZ,0.0,
                                                              dirX,dirY,dirZ);
}

void WCSimVertexFinder::PointResiduals ( Double_t  vx,
Double_t  vy,
Double_t  vz 
) [private]

Definition at line 1876 of file WCSimVertexFinder.cc.

References Instance().

Referenced by PointDirectionChi2(), PointPositionChi2(), and PointVertexChi2().

{
  return WCSimVertexGeometry::Instance()->CalcPointResiduals(vtxX,vtxY,vtxZ,0.0, 
                                                              0.0, 0.0, 0.0);
}

void WCSimVertexFinder::PointVertexChi2 ( Double_t &  vangle,
Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1846 of file WCSimVertexFinder.cc.

References fConeFitWeight, FitPointConePropertiesLnL(), FitPointTimePropertiesLnL(), and fTimeFitWeight.

{
  // calculate figure of merit
  // =========================
  Double_t timeFOM = 0.0;
  Double_t coneFOM = 0.0;

  this->FitPointConePropertiesLnL(vtxAngle,coneFOM);
  this->FitPointTimePropertiesLnL(vtxTime,timeFOM);
  
  fom = (fTimeFitWeight*timeFOM+fConeFitWeight*coneFOM)/(fTimeFitWeight+fConeFitWeight);

  return;
}

void WCSimVertexFinder::PointVertexChi2 ( Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t &  vangle,
Double_t &  vtime,
Double_t &  chi2 
)

Definition at line 1740 of file WCSimVertexFinder.cc.

References fBaseFOM, FixDirectionChi2(), FixPositionChi2(), fUseTrueDirection, fUseTruePosition, PenaltyChi2(), and PointResiduals().

Referenced by FitPointVertexWithMinuit(), and FixPointVertex().

{  
  // figure of merit
  // ===============
  Double_t vtxFOM = 0.0;
  Double_t penaltyFOM = 0.0;
  Double_t fixPositionFOM = 0.0;
  Double_t fixDirectionFOM = 0.0;

  // calculate residuals
  // ===================
  this->PointResiduals(vtxX,vtxY,vtxZ,
                       dirX,dirY,dirZ);

  // calculate figure of merit
  // =========================
  this->PointVertexChi2(vtxAngle,vtxTime,vtxFOM);

  // calculate penalty
  // =================
  this->PenaltyChi2(vtxX,vtxY,vtxZ,penaltyFOM);

  // fix true position
  // =================
  if( fUseTruePosition ){
    this->FixPositionChi2(vtxX,vtxY,vtxZ,fixPositionFOM);
  }

  // fix true direction
  // ==================
  if( fUseTrueDirection ){
    this->FixDirectionChi2(dirX,dirY,dirZ,fixDirectionFOM);
  }

  // calculate overall figure of merit
  // =================================
  fom = vtxFOM + penaltyFOM + fixPositionFOM + fixDirectionFOM;

  // truncate
  if( fom<-999.999*fBaseFOM ) fom = -999.999*fBaseFOM;

  return;
}

void WCSimVertexFinder::PrintParameters (  )  [static]

Definition at line 298 of file WCSimVertexFinder.cc.

References Instance(), and RunPrintParameters().

Referenced by main().

void WCSimVertexFinder::Reset (  ) 

Definition at line 432 of file WCSimVertexFinder.cc.

References Clear().

{
  return this->Clear();
}

WCSimRecoVertex * WCSimVertexFinder::Run ( WCSimRecoEvent event,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
)

Definition at line 580 of file WCSimVertexFinder.cc.

References Clear(), fPointFitOnly, RunExtendedFit(), and RunPointFit().

{
  this->Clear();

  if( fPointFitOnly ){
    return (WCSimRecoVertex*)(this->RunPointFit(myEvent, 
                                                 vtxX,vtxY,vtxZ, 
                                                  dirX,dirY,dirZ));
  }
  else{
    return (WCSimRecoVertex*)(this->RunExtendedFit(myEvent, 
                                                    vtxX,vtxY,vtxZ, 
                                                     dirX,dirY,dirZ));
  }
}

WCSimRecoVertex * WCSimVertexFinder::Run ( WCSimRecoEvent event  ) 

Definition at line 460 of file WCSimVertexFinder.cc.

References Clear(), fPointFitOnly, RunExtendedFit(), and RunPointFit().

Referenced by WCSimRecoAB::RunRecoVertex().

{
  this->Clear();

  if( fPointFitOnly ){
    return (WCSimRecoVertex*)(this->RunPointFit(myEvent));
  }
  else{
    return (WCSimRecoVertex*)(this->RunExtendedFit(myEvent));
  }
}

WCSimRecoVertex * WCSimVertexFinder::RunExtendedFit ( WCSimRecoEvent event,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
)

Definition at line 636 of file WCSimVertexFinder.cc.

References FixExtendedVertex(), and RunPointFit().

{     
  // fix point direction
  // ===================
  WCSimRecoVertex* pointVtx = (WCSimRecoVertex*)(this->RunPointFit(myEvent,
                                                                    vtxX,vtxY,vtxZ,
                                                                     dirX,dirY,dirZ));

  // fix extended vertex
  // ===================
  WCSimRecoVertex* extendedVtx = (WCSimRecoVertex*)(this->FixExtendedVertex(vtxX,vtxY,vtxZ,
                                                                             dirX,dirY,dirZ));

  // return vertex
  // =============
  return extendedVtx;
}

WCSimRecoVertex * WCSimVertexFinder::RunExtendedFit ( WCSimRecoEvent event  ) 

Definition at line 505 of file WCSimVertexFinder.cc.

References CorrectExtendedVertex(), FitExtendedVertex(), fUseTrueVertex, RunExtendedFitFromTruth(), and RunPointFit().

Referenced by Run(), and RunExtendedFitFromTruth().

{    
  // return true vertex
  // ==================
  if( fUseTrueVertex ){  
    return this->RunExtendedFitFromTruth(myEvent);
  }

  // point fit
  // =========
  WCSimRecoVertex* pointVtx = (WCSimRecoVertex*)(this->RunPointFit(myEvent));

  std::cout << " *** WCSimVertexFinder::RunExtendedFit(...) *** " << std::endl;

  // extended fit to vertex and direction
  // ====================================
  WCSimRecoVertex* extendedVtx = (WCSimRecoVertex*)(this->FitExtendedVertex(pointVtx));

  // correct bias in vertex and direction
  // ====================================
  WCSimRecoVertex* extendedVtxCorrected = (WCSimRecoVertex*)(this->CorrectExtendedVertex(extendedVtx));

  // return vertex
  // =============
  return extendedVtxCorrected;
}

WCSimRecoVertex * WCSimVertexFinder::RunExtendedFitFromTruth ( WCSimRecoEvent event  ) 

Definition at line 556 of file WCSimVertexFinder.cc.

References BuildDummyVertex(), WCSimTrueEvent::GetDirX(), WCSimTrueEvent::GetDirY(), WCSimTrueEvent::GetDirZ(), WCSimTrueEvent::GetNTracks(), WCSimTrueEvent::GetVtxX(), WCSimTrueEvent::GetVtxY(), WCSimTrueEvent::GetVtxZ(), RunExtendedFit(), and WCSimInterface::TrueEvent().

Referenced by RunExtendedFit().

{
  std::cout << " *** WCSimVertexFinder::RunExtendedFit(...) *** " << std::endl;
  std::cout << "  --- reconstruct vertex from truth --- " << std::endl;
  
  WCSimTrueEvent* myTrueEvent = (WCSimTrueEvent*)(WCSimInterface::TrueEvent());

  if( myTrueEvent->GetNTracks()>0 ){
    Double_t vtxX = myTrueEvent->GetVtxX();
    Double_t vtxY = myTrueEvent->GetVtxY();
    Double_t vtxZ = myTrueEvent->GetVtxZ();
    Double_t dirX = myTrueEvent->GetDirX();
    Double_t dirY = myTrueEvent->GetDirY();
    Double_t dirZ = myTrueEvent->GetDirZ();

    return (WCSimRecoVertex*)(this->RunExtendedFit(myEvent, 
                                                    vtxX,vtxY,vtxZ, 
                                                     dirX,dirY,dirZ));
  }
  else{
    return (WCSimRecoVertex*)(this->BuildDummyVertex());
  }
}

WCSimRecoVertex * WCSimVertexFinder::RunPointFit ( WCSimRecoEvent event  ) 

Definition at line 472 of file WCSimVertexFinder.cc.

References FindSimpleDirection(), FindSimplePosition(), FitPointDirection(), FitPointPosition(), FitPointVertex(), fUseTrueVertex, Instance(), and RunPointFitFromTruth().

Referenced by Run(), RunExtendedFit(), RunPointFit(), and RunPointFitFromTruth().

{
  // return true vertex
  // ==================
  if( fUseTrueVertex ){
    return this->RunPointFitFromTruth(myEvent);
  }

  // load event
  // ==========
  WCSimVertexGeometry::Instance()->LoadEvent(myEvent);

  std::cout << " *** WCSimVertexFinder::RunPointFit(...) *** " << std::endl;

  // point positiobn fit
  // ===================
  WCSimRecoVertex* simplePos = (WCSimRecoVertex*)(this->FindSimplePosition());
  WCSimRecoVertex* pointPos  = (WCSimRecoVertex*)(this->FitPointPosition(simplePos));

  // point direction fit
  // ===================
  WCSimRecoVertex* simpleDir = (WCSimRecoVertex*)(this->FindSimpleDirection(pointPos));
  WCSimRecoVertex* pointDir  = (WCSimRecoVertex*)(this->FitPointDirection(simpleDir));  

  // point vertex fit
  // ================
  WCSimRecoVertex* pointVtx  = (WCSimRecoVertex*)(this->FitPointVertex(pointDir)); 

  // return vertex
  // =============
  return pointVtx;
}

WCSimRecoVertex * WCSimVertexFinder::RunPointFit ( WCSimRecoEvent event,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  px,
Double_t  py,
Double_t  pz 
)

Definition at line 612 of file WCSimVertexFinder.cc.

References FixPointDirection(), FixPointVertex(), FixSimpleDirection(), and RunPointFit().

{   
  // fix point vertex
  // ================
  WCSimRecoVertex* pointPos = (WCSimRecoVertex*)(this->RunPointFit(myEvent,
                                                                    vtxX,vtxY,vtxZ));

  // fix point direction
  // ===================
  WCSimRecoVertex* simpleDir = (WCSimRecoVertex*)(this->FixSimpleDirection(vtxX,vtxY,vtxZ,
                                                                            dirX,dirY,dirZ));
  WCSimRecoVertex* pointDir = (WCSimRecoVertex*)(this->FixPointDirection(vtxX,vtxY,vtxZ,
                                                                          dirX,dirY,dirZ));

  // fix point vertex
  // ================
  WCSimRecoVertex* pointVtx = (WCSimRecoVertex*)(this->FixPointVertex(vtxX,vtxY,vtxZ,
                                                                       dirX,dirY,dirZ));

  // return vertex
  // =============
  return pointVtx;
}

WCSimRecoVertex * WCSimVertexFinder::RunPointFit ( WCSimRecoEvent event,
Double_t  vx,
Double_t  vy,
Double_t  vz 
)

Definition at line 596 of file WCSimVertexFinder.cc.

References FixPointPosition(), FixSimplePosition(), and Instance().

{   
  // load event
  // ==========
  WCSimVertexGeometry::Instance()->LoadEvent(myEvent);
 
  // fix point vertex
  // ================
  WCSimRecoVertex* simpleVtx = (WCSimRecoVertex*)(this->FixSimplePosition(vtxX,vtxY,vtxZ));
  WCSimRecoVertex* pointPos = (WCSimRecoVertex*)(this->FixPointPosition(vtxX,vtxY,vtxZ));

  // return vertex
  // =============
  return pointPos;
}

WCSimRecoVertex * WCSimVertexFinder::RunPointFitFromTruth ( WCSimRecoEvent event  ) 

Definition at line 532 of file WCSimVertexFinder.cc.

References BuildDummyVertex(), WCSimTrueEvent::GetDirX(), WCSimTrueEvent::GetDirY(), WCSimTrueEvent::GetDirZ(), WCSimTrueEvent::GetNTracks(), WCSimTrueEvent::GetVtxX(), WCSimTrueEvent::GetVtxY(), WCSimTrueEvent::GetVtxZ(), RunPointFit(), and WCSimInterface::TrueEvent().

Referenced by RunPointFit().

{
  std::cout << " *** WCSimVertexFinder::RunPointFit(...) *** " << std::endl;
  std::cout << "  --- reconstruct vertex from truth --- " << std::endl;
  
  WCSimTrueEvent* myTrueEvent = (WCSimTrueEvent*)(WCSimInterface::TrueEvent());

  if( myTrueEvent->GetNTracks()>0 ){
    Double_t vtxX = myTrueEvent->GetVtxX();
    Double_t vtxY = myTrueEvent->GetVtxY();
    Double_t vtxZ = myTrueEvent->GetVtxZ();
    Double_t dirX = myTrueEvent->GetDirX();
    Double_t dirY = myTrueEvent->GetDirY();
    Double_t dirZ = myTrueEvent->GetDirZ();

    return (WCSimRecoVertex*)(this->RunPointFit(myEvent, 
                                                 vtxX,vtxY,vtxZ, 
                                                  dirX,dirY,dirZ));
  }
  else{
    return (WCSimRecoVertex*)(this->BuildDummyVertex());
  }
}

void WCSimVertexFinder::RunPrintParameters (  ) 

Definition at line 409 of file WCSimVertexFinder.cc.

References fBaseFOM, fConeFitWeight, fFitConeParams, fFitTimeParams, fFixConeParam0, fFixConeParam1, fFixConeParam2, fFixTimeParam0, fFixVertexBias, fNumSeeds, fPointFitOnly, fSeedWithQuadruples, fSeedWithSimpleVertex, fSeedWithTrueVertex, fTimeFitWeight, fUseTrueDirection, fUseTruePosition, fUseTrueVertex, and fVertexBias.

Referenced by PrintParameters().

{
  std::cout << " *** WCSimVertexFinder::PrintParameters() *** " << std::endl;

  std::cout << "  Vertex Finding Parameters: " << std::endl
            << "   PointFitOnly = " << fPointFitOnly << std::endl
            << "   UseTrueVertex = " << fUseTrueVertex << std::endl
            << "   UseTruePosition = " << fUseTruePosition << std::endl
            << "   UseTrueDirection = " << fUseTrueDirection << std::endl
            << "   SeedWithTrueVertex = " << fSeedWithTrueVertex << std::endl
            << "   SeedWithSimpleVertex = " << fSeedWithSimpleVertex << std::endl
            << "   SeedWithQuadruples = " << fSeedWithQuadruples << std::endl
            << "   NumSeeds = " << fNumSeeds << std::endl
            << "  Vertex Fitting Parameters: " << std::endl
            << "   BaseFOM = " << fBaseFOM << std::endl
            << "   FitTimeParams = " << fFitTimeParams << " (" << fFixTimeParam0 << ") " << std::endl
            << "   FitConeParams = " << fFitConeParams << " (" << fFixConeParam0 << "," << fFixConeParam1 << "," << fFixConeParam2 << ") " << std::endl
            << "   Weights = (" << fTimeFitWeight << "," << fConeFitWeight << ") " << std::endl
            << "   FixVertexBias = " << fFixVertexBias << " (" << fVertexBias << ") " << std::endl;

  return;
}

void WCSimVertexFinder::SeedingWithQuadruples ( Bool_t  yesno  )  [inline]

Definition at line 48 of file WCSimVertexFinder.hh.

References fSeedWithQuadruples.

Referenced by SeedWithQuadruples().

{ fSeedWithQuadruples = yesno; }

void WCSimVertexFinder::SeedingWithSimpleVertex ( Bool_t  yesno  )  [inline]

Definition at line 47 of file WCSimVertexFinder.hh.

References fSeedWithSimpleVertex.

Referenced by SeedWithSimpleVertex().

{ fSeedWithSimpleVertex = yesno; }

void WCSimVertexFinder::SeedingWithTrueVertex ( Bool_t  yesno  )  [inline]

Definition at line 46 of file WCSimVertexFinder.hh.

References fSeedWithTrueVertex.

Referenced by SeedWithTrueVertex().

{ fSeedWithTrueVertex = yesno; }

void WCSimVertexFinder::SeedWithQuadruples ( Bool_t  yesno = 1  )  [static]
void WCSimVertexFinder::SeedWithSimpleVertex ( Bool_t  yesno = 1  )  [static]
void WCSimVertexFinder::SeedWithTrueVertex ( Bool_t  yesno = 1  )  [static]
void WCSimVertexFinder::SetFitConeParams (  )  [inline]

Definition at line 56 of file WCSimVertexFinder.hh.

References fFitConeParams.

Referenced by FitConeParams().

{ fFitConeParams = 1; }

void WCSimVertexFinder::SetFitTimeParams (  )  [inline]

Definition at line 51 of file WCSimVertexFinder.hh.

References fFitTimeParams.

Referenced by FitTimeParams().

{ fFitTimeParams = 1; }

void WCSimVertexFinder::SetFitWeights ( Double_t  tw,
Double_t  cw 
) [inline]

Definition at line 61 of file WCSimVertexFinder.hh.

References fConeFitWeight, and fTimeFitWeight.

Referenced by FitWeights().

                                              { 
    fTimeFitWeight = tw; fConeFitWeight = cw; 
  }

void WCSimVertexFinder::SetFixConeParams ( Double_t  param0,
Double_t  param1,
Double_t  param2 
) [inline]

Definition at line 57 of file WCSimVertexFinder.hh.

References fFitConeParams, fFixConeParam0, fFixConeParam1, and fFixConeParam2.

Referenced by FixConeParams().

                                                                           { 
    fFitConeParams = 0; fFixConeParam0 = param0; fFixConeParam1 = param1; fFixConeParam2 = param2; 
  }

void WCSimVertexFinder::SetFixTimeParams ( Double_t  param0  )  [inline]

Definition at line 52 of file WCSimVertexFinder.hh.

References fFitTimeParams, and fFixTimeParam0.

Referenced by FixTimeParams().

                                         { 
    fFitTimeParams = 0; fFixTimeParam0 = param0; 
  }

void WCSimVertexFinder::SetNumSeeds ( Int_t  nseeds  )  [inline]

Definition at line 49 of file WCSimVertexFinder.hh.

References fNumSeeds.

Referenced by NumSeeds().

{ if(nseeds>0) fNumSeeds = nseeds; }

void WCSimVertexFinder::SetPointFitOnly ( Bool_t  yesno  )  [inline]

Definition at line 42 of file WCSimVertexFinder.hh.

References fPointFitOnly.

Referenced by PointFitOnly().

{ fPointFitOnly = yesno; }

void WCSimVertexFinder::SetVertexBias ( Double_t  bias  )  [inline]

Definition at line 65 of file WCSimVertexFinder.hh.

References fFixVertexBias, and fVertexBias.

Referenced by FixVertexBias().

                                    { 
    if( bias>0.0 ){ fFixVertexBias = 1; fVertexBias = bias; } 
    else { fFixVertexBias = 0; fVertexBias = bias; }
  }

Int_t WCSimVertexFinder::time_fit_iterations (  )  [inline]

Definition at line 213 of file WCSimVertexFinder.hh.

References fTimeFitItr.

{ return fTimeFitItr; }

void WCSimVertexFinder::time_fit_itr (  )  [inline]

Definition at line 199 of file WCSimVertexFinder.hh.

References fTimeFitItr.

{ fTimeFitItr++; }

void WCSimVertexFinder::time_fit_reset_itr (  )  [inline]
void WCSimVertexFinder::TimePropertiesFoM ( Double_t  vtime,
Double_t &  chi2 
)

Definition at line 2492 of file WCSimVertexFinder.cc.

References fBaseFOM, WCSimVertexGeometry::Instance(), Instance(), and WCSimVertexGeometry::IsFiltered().

Referenced by FitTimePropertiesFoM().

{ 
  // calculate figure of merit
  // =========================   
  Double_t Swx = 0.0;
  Double_t Sw = 0.0; 

  Double_t delta = 0.0;
  Double_t sigma = 0.0;

  Double_t weight = 0.0;
  Double_t deweight = 0.0;
  Double_t inweight = 0.0;
  Double_t outweight = 0.0;
  Double_t timeweight = 0.0;

  Double_t deltaAngle = 0.0;
  Double_t deltaEdge = 0;

  Double_t alpha = 0.0;
  Double_t penalty = 0.011; 
 
  // [ Weight = exp(-(delta*delta)/(2.0*sigma*sigma)) - Penalty,
  //   This drops below zero at Penalty = sqrt( 2.0*log(Weight) )
  //   To drop below zero at 2 sigma,   set Penalty = exp(-4/2)    = 0.135
  //   To drop below zero at 2.5 sigma, set Penalty = exp(-6.25/2) = 0.044
  //   To drop below zero at 3 sigma,   set Penalty = exp(-9/2)    = 0.011 ]
 
  Double_t sigmaRes = 2.0;         // time resolution
  Double_t sigmaLow = 2.0;         // time resolution inside cone
  Double_t sigmaHigh = 2.0;        // time resolution outside cone

                                                          // muons electrons
  Double_t myConeAngle = 42.0;     // cherenkov cone      // 42.0    42.0
  Double_t myConeAngleSigma = 2.0; //   [degrees]         //  2.0     2.0
                                                          
  Double_t myConeEdge = 42.0;      // overall window      // 42.0    48.0
  Double_t myConeEdgeSigma = 2.0;  //   [degrees]         //  2.0     8.0

  Double_t fom = 0.0;

  for( Int_t idigit=0; idigit<WCSimVertexGeometry::Instance()->GetNDigits(); idigit++ ){

    if( WCSimVertexGeometry::Instance()->IsFiltered(idigit) ){
      delta = WCSimVertexGeometry::Instance()->GetDelta(idigit) - vtxTime;
      sigma = WCSimVertexGeometry::Instance()->GetDeltaSigma(idigit);
      weight = 1.0/(sigma*sigma);

      deltaAngle = WCSimVertexGeometry::Instance()->GetAngle(idigit) - myConeAngle;
      deltaEdge  = WCSimVertexGeometry::Instance()->GetAngle(idigit) - myConeEdge;

      // time weights inside and outside cone
      inweight  = exp(-(delta*delta)/(2.0*sigmaRes*sigmaRes))-penalty;

      if( delta<=0 ){ 
        outweight = (2.0*sigmaRes/(sigmaLow+sigmaHigh))*(exp(-(delta*delta)/(2.0*sigmaLow*sigmaLow))-penalty);
      }
      else{
        outweight = (2.0*sigmaRes/(sigmaLow+sigmaHigh))*(exp(-(delta*delta)/(2.0*sigmaHigh*sigmaHigh))-penalty);
      }
      
      if( deltaAngle<=0 ){
        alpha = 1.0;
      }
      else{
        alpha = 1.0/(1.0+(deltaAngle*deltaAngle)/(myConeAngleSigma*myConeAngleSigma));
      }

      // deweight hits outside cone
      if( deltaEdge<=0.0 ){ 
        deweight = 1.0;
      } 
      else{
        deweight = 1.0/(1.0+(deltaEdge*deltaEdge)/(myConeEdgeSigma*myConeEdgeSigma));
      }

      // overall time weight
      timeweight = inweight*alpha + outweight*(1.0-alpha);

      // add to running total
      Swx += deweight*weight*timeweight;
      Sw  += deweight*weight;
    }
  }

  if( Sw>0.0 ){
    fom = fBaseFOM*Swx/Sw;
  }

  // return figure of merit
  // ======================
  vtxFOM = fom;

  return;
}

void WCSimVertexFinder::TimePropertiesLnL ( Double_t  vtime,
Double_t  vparam,
Double_t &  chi2 
)

Definition at line 2241 of file WCSimVertexFinder.cc.

References fBaseFOM, WCSimVertexGeometry::Instance(), Instance(), and WCSimVertexGeometry::IsFiltered().

Referenced by FitExtendedTimePropertiesLnL(), and FitPointTimePropertiesLnL().

{ 
  // nuisance parameters
  // ===================
  Double_t scatter = vtxParam; 

  // internal variables
  // ==================
  Double_t delta = 0.0;       // time residual of each hit
  Double_t sigma = 0.0;       // time resolution of each hit

  Double_t sigmaEarly = 1.5;  // width of early light
  Double_t sigmaLate  = 3.5;  // width of late light
  Double_t deltaShort = 5.0;  // decay time for scattered light [short]
  Double_t deltaLong  = 10.0; // decay time for scattered light [long]

  Double_t alpha = scatter;   // size of scattering (Gaussian+Exponential)
  Double_t beta  = 0.15;      // size of late light (second Gaussian)
  Double_t gamma = 0.66;      // coefficeient for double-exponential

  Double_t A = 0.0;           // normalisation of first Gaussian
  Double_t Ascat = 0.0;       // normalisation of second Gaussian
  Double_t Bshort = 0.0;      // normalisation of scattering (Gaussian+Exponential)
  Double_t Blong = 0.0;       // normalisation of scattering (Gaussian+Exponential)

  Double_t Preal = 0.0;       // probability of real hit
  Double_t P = 0.0;           // probability of hit

  Double_t chi2 = 0.0;        // log-likelihood: chi2 = -2.0*log(L)
  Double_t ndof = 0.0;        // total number of hits
  Double_t fom = 0.0;         // figure of merit

  // tuning parameters
  // =================
  Double_t fTimeFitNoiseRate = 0.10;  // hits/ns [0.40 for electrons, 0.02 for muons]
  
  // add noise to model
  // ==================
  Double_t nFilterDigits = WCSimVertexGeometry::Instance()->GetNFilterDigits();
  Double_t Pnoise = fTimeFitNoiseRate/nFilterDigits;

  // loop over digits
  // ================
  for( Int_t idigit=0; idigit<WCSimVertexGeometry::Instance()->GetNDigits(); idigit++ ){

    if( WCSimVertexGeometry::Instance()->IsFiltered(idigit) ){
      delta = WCSimVertexGeometry::Instance()->GetDelta(idigit) - vtxTime;
      sigma = WCSimVertexGeometry::Instance()->GetDeltaSigma(idigit);

      A      = 1.0 / ( 2.0*sigma*sqrt(0.5*TMath::Pi()) );
      Ascat  = 1.0 / ( (sigmaEarly+sigmaLate)*sqrt(0.5*TMath::Pi()) );
      Bshort = 1.0 / ( sigmaEarly*sqrt(0.5*TMath::Pi()) + (9.0/8.0)*deltaShort );
      Blong  = 1.0 / ( sigmaEarly*sqrt(0.5*TMath::Pi()) + (9.0/8.0)*deltaLong );
      
      if( delta<=0 ){
        Preal = (1.0-beta)*(1.0-alpha)*A*exp(-(delta*delta)/(2.0*sigma*sigma))
                + beta*(1.0-alpha)*Ascat*exp(-(delta*delta)/(2.0*sigmaEarly*sigmaEarly))
                    + alpha*gamma*Bshort*exp(-(delta*delta)/(2.0*sigmaEarly*sigmaEarly))
               + alpha*(1.0-gamma)*Blong*exp(-(delta*delta)/(2.0*sigmaEarly*sigmaEarly));
        P = (1.0-Pnoise)*Preal + Pnoise;
      }
      else{
        Preal = (1.0-beta)*(1.0-alpha)*A*exp(-(delta*delta)/(2.0*sigma*sigma)) 
                + beta*(1.0-alpha)*Ascat*exp(-(delta*delta)/(2.0*sigmaLate*sigmaLate)) 
                + alpha*gamma*Bshort*( (delta/deltaShort)/pow((1.0+4.0*(delta/deltaShort)*(delta/deltaShort)),2.0) + exp(-delta/deltaShort) ) 
             + alpha*(1.0-gamma)*Blong*( (delta/deltaLong)/pow((1.0+4.0*(delta/deltaLong)*(delta/deltaLong)),2.0) + exp(-delta/deltaLong) );
        P = (1.0-Pnoise)*Preal + Pnoise;
      }

      chi2 += -2.0*log(P);
      ndof += 1.0;
    }
  }

  // calculate figure of merit
  // =========================   
  if( ndof>0.0 ){
    fom = fBaseFOM - 5.0*chi2/ndof;
  }

  // return figure of merit
  // ======================
  vtxFOM = fom;

  return;
}

void WCSimVertexFinder::UseTrueDirection ( Bool_t  yesno = 1  )  [static]

Definition at line 243 of file WCSimVertexFinder.cc.

References Instance(), and UsingTrueDirection().

void WCSimVertexFinder::UseTruePosition ( Bool_t  yesno = 1  )  [static]

Definition at line 238 of file WCSimVertexFinder.cc.

References Instance(), and UsingTruePosition().

void WCSimVertexFinder::UseTrueVertex ( Bool_t  yesno = 1  )  [static]

Definition at line 233 of file WCSimVertexFinder.cc.

References Instance(), and UsingTrueVertex().

void WCSimVertexFinder::UsingTrueDirection ( Bool_t  yesno  )  [inline]

Definition at line 45 of file WCSimVertexFinder.hh.

References fUseTrueDirection.

Referenced by UseTrueDirection().

{ fUseTrueDirection = yesno; }

void WCSimVertexFinder::UsingTruePosition ( Bool_t  yesno  )  [inline]

Definition at line 44 of file WCSimVertexFinder.hh.

References fUseTruePosition.

Referenced by UseTruePosition().

{ fUseTruePosition = yesno; }

void WCSimVertexFinder::UsingTrueVertex ( Bool_t  yesno  )  [inline]

Definition at line 43 of file WCSimVertexFinder.hh.

References fUseTrueVertex.

Referenced by UseTrueVertex().

{ fUseTrueVertex = yesno; }


Member Data Documentation

Double_t WCSimVertexFinder::fBaseFOM [private]

Definition at line 297 of file WCSimVertexFinder.hh.

Referenced by WCSimVertexFinder().

Definition at line 298 of file WCSimVertexFinder.hh.

Referenced by WCSimVertexFinder().

Definition at line 299 of file WCSimVertexFinder.hh.

Referenced by WCSimVertexFinder().

Double_t WCSimVertexFinder::fInputDirX [private]

Definition at line 251 of file WCSimVertexFinder.hh.

Double_t WCSimVertexFinder::fInputDirY [private]

Definition at line 252 of file WCSimVertexFinder.hh.

Double_t WCSimVertexFinder::fInputDirZ [private]

Definition at line 253 of file WCSimVertexFinder.hh.

Double_t WCSimVertexFinder::fInputVtxFOM [private]

Definition at line 255 of file WCSimVertexFinder.hh.

Definition at line 249 of file WCSimVertexFinder.hh.

Double_t WCSimVertexFinder::fInputVtxX [private]

Definition at line 246 of file WCSimVertexFinder.hh.

Double_t WCSimVertexFinder::fInputVtxY [private]

Definition at line 247 of file WCSimVertexFinder.hh.

Double_t WCSimVertexFinder::fInputVtxZ [private]

Definition at line 248 of file WCSimVertexFinder.hh.

Definition at line 286 of file WCSimVertexFinder.hh.

Referenced by ConePropertiesLnL(), and WCSimVertexFinder().

Int_t WCSimVertexFinder::fItr [private]
Bool_t WCSimVertexFinder::fPass [private]

Definition at line 231 of file WCSimVertexFinder.hh.

Referenced by Run(), RunPrintParameters(), SetPointFitOnly(), and WCSimVertexFinder().

Double_t WCSimVertexFinder::fSconeA [private]

Definition at line 282 of file WCSimVertexFinder.hh.

Referenced by ConePropertiesLnL().

Double_t WCSimVertexFinder::fSconeB [private]

Definition at line 283 of file WCSimVertexFinder.hh.

Referenced by ConePropertiesLnL().

Double_t WCSimVertexFinder::fSel [private]

Definition at line 285 of file WCSimVertexFinder.hh.

Referenced by ConePropertiesLnL().

Double_t WCSimVertexFinder::fSmu [private]

Definition at line 284 of file WCSimVertexFinder.hh.

Referenced by ConePropertiesLnL().

Double_t WCSimVertexFinder::fVertexBias [private]

Definition at line 301 of file WCSimVertexFinder.hh.

Referenced by WCSimVertexFinder().

Definition at line 295 of file WCSimVertexFinder.hh.

Definition at line 292 of file WCSimVertexFinder.hh.

Referenced by FitPointDirectionWithMinuit(), and WCSimVertexFinder().

Definition at line 293 of file WCSimVertexFinder.hh.

Referenced by FitPointDirectionWithMinuit(), and WCSimVertexFinder().

Definition at line 294 of file WCSimVertexFinder.hh.

Referenced by FitPointDirectionWithMinuit(), and WCSimVertexFinder().


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