STAR   Computing   Documentation  
DcaService
Offline Software using ROOT in STAR Maintained by G. Van Buren
Last modified Tue Aug 8 15:30:19 2002
StStrangeMuDstMaker


DcaService is a tool for recalculating DCAs of various particles to the primary vertex in the micro-DST. One can obtain either signed or unsigned DCAs, where the sign is negative if the primary vertex is outside the circular projection of the track helix in the bend plane. All member functions of the class are static, and can be called from anywhere.

One way to use the service is to simply request a DCA value and use it as you like. The functions available for doing this are:

  // Functions which return recalculated DCAs
  static double dcaXiToPrimVertex(StXiMuDst* xi);
  //   For daughter tracks:
  //     Note that the track is assumed to pass
  //     through the decay vertex, so the calc may
  //     be different from the global track calc
  static double dcaBachelorToPrimVertex(StXiMuDst* xi);
  static double dcaPosToPrimVertex(StV0MuDst* v0);
  static double dcaNegToPrimVertex(StV0MuDst* v0);

  // Functions which return signed DCAs
  static double signedDcaXiToPrimVertex(StXiMuDst* xi);
  static double signedDcaBachelorToPrimVertex(StXiMuDst* xi);
  static double signedDcaPosToPrimVertex(StV0MuDst* v0);
  static double signedDcaNegToPrimVertex(StV0MuDst* v0);
Before calling any of these functions, the DcaService class needs to be told about the magnetic field and the location of the primary vertex. This can be achieved with a call to either of:
  static   void initEvent(StStrangeEvMuDst* ev);
  static   void initEvent(StStrangeMuDstMaker* mk);
An event loop which would utilize these might look something like:
  for( Int_t i=0; i<Nevents; i++ ) {
    if( chain.Make() ) break;
    DcaService::initEvent(&strangeDst);
    for( Int_t j=0; j<strangeDst.GetNXi(); j++ ) {
      newDca = DcaService::dcaXiToPrimVertex(strangeDst.GetXi(j));
      ...do something with newDca...
    }
    if( i != Nevents) chain.Clear();
  }

Additionally, DcaService can replace the stored data members of the DCAs in the data classes, allowing the user to write out a new version of a micro-DST with recalculated DCAs. Here are the relavant functions:

  // Functions which replace the data members with the correct DCAs
  static   void fixDcaXiToPrimVertex(StXiMuDst* xi);
  static   void fixSignedDcaXiToPrimVertex(StXiMuDst* xi);
  static   void fixSignedDcaBachelorToPrimVertex(StXiMuDst* xi);
  static   void fixSignedDcaPosToPrimVertex(StV0MuDst* v0);
  static   void fixSignedDcaNegToPrimVertex(StV0MuDst* v0);
Functions are also provided which can loop over the vertices automatically while fixing their DCAs:
  // Functions which call the event initialization,
  // then loop over the event and fix the DCAs
  static   void fixDcaXiToPrimVertex(StStrangeMuDstMaker* mk);
  static   void fixSignedDcaXiToPrimVertex(StStrangeMuDstMaker* mk);
  static   void fixSignedDcaBachelorToPrimVertex(StStrangeMuDstMaker* mk);
  static   void fixSignedDcaPosToPrimVertex(StStrangeMuDstMaker* mk);
  static   void fixSignedDcaNegToPrimVertex(StStrangeMuDstMaker* mk);
  //   Multiple fixes simultaneously
  static   void fixSignedDcasXis(StStrangeMuDstMaker* mk);
  static   void fixSignedDcasV0s(StStrangeMuDstMaker* mk);
  static   void fixSignedDcas(StStrangeMuDstMaker* mk);
An event loop which demonstrates re-writing a micro-DST with altered DCAs is shown here:
  for( Int_t i=0; i<Nevents; i++ ) {
    if( chain.Make() ) break;
    DcaService::fixSignedDcas(&strangeOldDst);
    strangeNewDst.SelectEvent();
    if( i != Nevents) chain.Clear();
  }