BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
//
// Utility class for various multiplicity modules.  To enable multiple
// inheritance for these classes, this class _does_not_ inherit
// directly or indirectly from TObject.  This means that the derived
// classes has a declaration like for example: 
//
//   class BrMultRdoModule : public BrModule, public BrMultUtil
//
// Hence the methods of this class is avaliable to the derived
// classes, but without ending up in the inheritance ambiguity as
// outlined in the ANSI/ISO C++ Standard chapter 10.  This is the same
// technique that is utilised in the ROOT classes TAttLine, TAttFill,
// and so on, and thier derived classes TH1, TLine, and so on. 
// 

//____________________________________________________________________
// $Id: BrMultUtil.cxx,v 1.7 2002/06/19 19:17:37 sanders Exp $
// $Author: sanders $
// $Date: 2002/06/19 19:17:37 $
// $Copyright: 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>
//
#ifndef BRAT_BrMultUtil
#include "BrMultUtil.h"
#endif
#ifndef BRAT_BrBbVertex
#include "BrBbVertex.h"
#endif
#ifndef BRAT_BrVertex
#include "BrVertex.h"
#endif
#ifndef BRAT_BrDetectorList
#include "BrDetectorList.h"
#endif
#ifndef BRAT_BrBbRdo
#include "BrBbRdo.h"
#endif
#ifndef BRAT_BrZdcRdo
#include "BrZdcRdo.h"
#endif
#ifndef ROOT_TMath
#include "TMath.h"
#endif
#include <limits.h>
#include <float.h>

//____________________________________________________________________
ClassImp(BrMultUtil);

//____________________________________________________________________
 BrMultUtil::BrMultUtil()
{
  // Default constructor. DO NOT USE
  fName = "";
  SetVertexAccLimit();
  SetSingleVertexLimit();
}

//____________________________________________________________________
 BrMultUtil::BrMultUtil(const TString& name)
  : fName(name)
{
  // Named constructor.  The name should be the name of the detector
  // e.g., MultTile 
  SetVertexAccLimit();
  SetSingleVertexLimit();
}

//____________________________________________________________________
 Double_t BrMultUtil::FindVertex(BrEventNode* inNode, 
				BrEventNode* outNode) 
{ 
  // Try to find the current primary vertexs Z-coordinate in the
  // inNode first, and failing that try to find it the output
  // node. The method return FLT_MAX in case the coordinate could not
  // be found. 

  // Try to get a vertex. 
  Double_t vtx = TryFindVertex(inNode);
  if (vtx != FLT_MAX) 
    return vtx;
  vtx = TryFindVertex(outNode);
  if (vtx != FLT_MAX)
    return vtx;
  return FLT_MAX;
}


//__________________________________________________________________
 Double_t BrMultUtil::TryFindVertex(BrEventNode* node) 
{
  // PRIVATE METHOD:
  // Try to get a vertex from the input node. 
  // The best vertex is assumed to be that obtained from TPM1.  However,
  // as per instructions given by the tpm1 analysis crew, several
  // conditions are required before this vertex can be used: 
  // 
  //   1:  The z variance must be less than 1
  //   2:  The z sigma must be less than 2 (sigma!=variance???)
  //   3:  The TPM1 vertex should be within 10 cm of the BB vertex
  // 
  // If one or more of these conditions is not met, the BB vertex is
  // assumed to be the next best, assuming it is within 150 cm of the
  // nominal array center.  
  // Otherwise, the ZDC vertex is used if it falls within 100 cm of
  // the array center. 
  // To allow for minium bias analysis, where the BB data may not be
  // avaliable, a fianl option, in the face that everything else fails
  // and the the ZDC vertex is indeed found, the ZDC vertex is used. 
  // 
  // All this should really be incorporated into a vertex analyser
  // that will extract the best possible vertex from the avaliable
  // information - it could be called BrBestVertexModule.  
  // 
  fVtxTPM1cluster    = 1000;
  fVtxTPM1track      = 1000;
  fVtxBB      = 1000;
  fVtxZDC     = 1000;
  Double_t vtx        = FLT_MAX;

  TString tableName("");

  // Look for the TPM1 cluster vertex. 
  tableName = BrDetectorList::GetDetectorName(kBrTPM1);
  tableName += " Cluster VtxData";
  BrVertex* vtxTpm1c = (BrVertex*)node->GetObject(tableName.Data());

  // If the TPM1 cluster vertex doesn't exist, or its z coordinate is
  // outside of +/-200 cm from nominal IP, then skip it. 
  if (vtxTpm1c && TMath::Abs(vtxTpm1c->GetZ()) < fVertexAccLimit) {
    // If the variance of the vertex is less than 1, and the "sigma"
    // of the vertex is less than 2, then accept the vertex. 
    if(vtxTpm1c->GetVarianceZ() < 1 && vtxTpm1c->GetVertexZSigma() < 2) 
      fVtxTPM1cluster = vtxTpm1c->GetZ();
  }

  // Look for the TPM1 cluster vertex. 
  tableName = BrDetectorList::GetDetectorName(kBrTPM1);
  tableName += " Track VtxData";
  BrVertex* vtxTpm1t = (BrVertex*)node->GetObject(tableName.Data());

  // If the TPM1 track vertex doesn't exist, or if it's outside the
  // cut defined by fVertexAccLimit. 
  if (vtxTpm1t && TMath::Abs(vtxTpm1t->GetZ()) < fVertexAccLimit) {
    // If the reduced ChiSquare is less than 2, we accept it. 
    if(vtxTpm1t->GetVertexChisq() < 2.0 ) 
      fVtxTPM1track = vtxTpm1t->GetZ();
  }

  // Look for the BB vertex. We look for the BrBbVertex first, since
  // we believe that to be better than the RDO stuff.
  tableName = BrDetectorList::GetDetectorName(kBrBB);
  tableName += " Vertex";
  BrBbVertex* vtxBb = (BrBbVertex*)node->GetObject(tableName.Data());
  // If found and inside +/- 200cm, we unconditionally accept it.
  if (vtxBb && TMath::Abs(vtxBb->GetZ0()) < fVertexAccLimit) {
    fVtxBB = vtxBb->GetZ0();
  }
  else {
    tableName = BrDetectorList::GetDetectorName(kBrBB);
    BrBbRdo* rdoBb = (BrBbRdo*)node->GetObject(tableName.Data());
    // If found and inside +/- 200cm, we unconditionally accept it.
    if (rdoBb && TMath::Abs(rdoBb->GetZ0()) < fVertexAccLimit) 
      fVtxBB = rdoBb->GetZ0();
  }
  
  // Look for the ZDC vertex.
  tableName = "Rdo";
  tableName += BrDetectorList::GetDetectorName(kBrZDC);
  BrZdcRdo* rdoZdc = (BrZdcRdo*)node->GetObject(tableName.Data());

  // If found and inside +/- 200cm, we unconditionally accept it. 
  //Notice use of CFD vertex.  Although the resolution of this
  //vertex is not as good as the "regular" one, at the moment
  //it is preferred because of the absence of strong slewing effects.
  //  if (rdoZdc && TMath::Abs(rdoZdc->GetZCfd()) < fVertexAccLimit) 
  //  fVtxZDC = rdoZdc->GetZCfd();
  // Use slewing corrected vertex
  if (rdoZdc && TMath::Abs(rdoZdc->GetZ()) < fVertexAccLimit) 
    fVtxZDC = rdoZdc->GetZ();

  // If the difference between the TPM1 vertex and the BB
  // vertex is less 10cm and the TPM1 vertex is less then
  // 100cm, then we choose the TPM1 vertex. 
  //We like the TPM1 track vertex better, for the moment:
  if(fVtxTPM1track  < fSingleVertexLimit && 
     TMath::Abs(fVtxTPM1track - fVtxBB) < 10) 
    vtx = fVtxTPM1track;

  else  if(fVtxTPM1cluster  < fSingleVertexLimit && 
     TMath::Abs(fVtxTPM1cluster - fVtxBB) < 10) 
    vtx = fVtxTPM1cluster;

  // If the BB vertex is inside +/- 100cm we choose that
  else if (TMath::Abs(fVtxBB) < fSingleVertexLimit)
    vtx = fVtxBB;
  
  // Finally, if all the above failed, and we found a ZDC vertex, we
  // choose that.  This is to do minimum bias analysis. 
  else if (fVtxZDC != 1000) 
    vtx = fVtxZDC;
  
  // Return the result, possibly FLT_MAX 
  return vtx;
}

 Double_t BrMultUtil::FindVertexAll( BrEventNode* inNode, BrEventNode* outNode,
				    Double_t& vtxTPM1cluster, Double_t& vtxTPM1track,
				    Double_t& vtxBB, Double_t& vtxZDC)
{
  //It sometimes becomes neccessary to check the individual vertex calculations
  //   for consistency.  This method returns the individual vertex values 
  //   for TPM1cluster, TPM1track, BB, and ZDC as well as the selected vertex
  //

  Double_t vtx =  FindVertex(inNode, outNode);
  vtxTPM1cluster = fVtxTPM1cluster;
  vtxTPM1track = fVtxTPM1track;
  vtxBB = fVtxBB;
  vtxZDC = fVtxZDC;
  return vtx;
}

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS