BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
//
// A module to select events which fulfills good BB and ZDC vertex as
// well as good agreement between the two.  The conditions are similar
// to what was used in 2000 spectrometer analysis require both BB and
// ZDC vertex, and that the two values agree within a range (~2-3 )
// times the estimated BB-ZDC z resolution Sigma; The module assumes
// that the vertex calculated from BB and ZDC is calibrated i.e.
// aligned relative to the TPM1 tracks. It has no provisions for
// setting offsets only the sigma and range.  This is a filtermodule
// and will stop the path within a bratmain execution.
//
// Recent change: The class now inherits from BrVertexFilter, since it
// is basically that + some extra checking of the correlation.  The
// TPM1 part of BrVertexFilter is ignored. 
//

//
// $Id: BrCollisionFilter.cxx,v 1.5 2001/11/02 15:18:16 cholm Exp $
// $Author: cholm $
// $Date: 2001/11/02 15:18:16 $
// $Copyright: 2000 BRAHMS Collaboration 
//

#ifndef ROOT_TDirectory
#include "TDirectory.h"
#endif
#include "BrCollisionFilter.h"
#include "BrEvent.h"
#include "BrEventHeader.h"
#include "BrDetectorList.h"
#include "BrZdcRdo.h"
#include "BrBbRdo.h"
#include "BrBbVertex.h"
#include "BrVertex.h"
#include <BrIostream.h>
#include "TH2.h"
//____________________________________________________________________
ClassImp(BrCollisionFilter);


//____________________________________________________________________
 BrCollisionFilter::BrCollisionFilter() 
{
  // Default constructor 
  SetState(kSetup);
  fAllBbZdc          = 0;  
  fAccBbZdc          = 0;  
  fAccBbZdc2D        = 0;
  fNoTimesCalled     = 0;
  fNoAcceptedZDC     = 0;
  fNoAcceptedBB      = 0;
  fNoAcceptedBBZDC   = 0;
  SetMaxZdcVertexZ();
  SetMaxBbVertexZ();
  SetBBSigma();
  SetSigmaRange();
}


//____________________________________________________________________
 BrCollisionFilter::BrCollisionFilter(const Char_t* name, 
				     const Char_t* title) 
  : BrVertexFilter(name, title)
{
  // Default constructor 
  SetState(kSetup);
  fAllBbZdc          = 0;  
  fAccBbZdc          = 0;  
  fAccBbZdc2D        = 0;
  fNoTimesCalled     = 0;
  fNoAcceptedZDC     = 0;
  fNoAcceptedBB      = 0;
  fNoAcceptedBBZDC   = 0;
  SetMaxZdcVertexZ();
  SetMaxBbVertexZ();
  SetBBSigma();
  SetSigmaRange();
}

//_______________________________________________________
 void BrCollisionFilter::DefineHistograms()
{
  // Define histograms

  Float_t resZdc   = 5;    // estimated resolution of ZDC vertex
  Float_t resBb    = 2;    // estimated resolution of Beam-Beam vertex

  BrVertexFilter::DefineHistograms(); 

  // remember current directory
  TDirectory* savdir = gDirectory;   
  // Make directory for this module 
  if (!gDirectory->cd("vertex")) {
    Warning("DefineHistograms","could not cd to histogram subdirectory");
    return;
  }

  fAllBbZdc      = new TH1F("allBbZdcVert", 
			    "All Diff between BB and ZDC", 
			    100, -100, 100);
  if (fSigmaRange * fBbSigma > 0) {
    fAccBbZdc      = new TH1F("accBbZdcVert", 
			      "All Diff between BB and ZDC", 
			      100, 
			      -(fSigmaRange + 2) * fBbSigma, 
			      (fSigmaRange + 2) * fBbSigma);
    fAccBbZdc2D    = new TH2F("accBbZdc2D", 
			      "Acc Correlationbetween BB and ZDC",
			      Int_t(200 / resBb + 1), 
			      -fMaxZdcVertexZ, fMaxZdcVertexZ,
			      Int_t(200 / resZdc + 1), 
			      -fMaxBbVertexZ, fMaxBbVertexZ);
  }
  
  // Restore directory
  gDirectory = savdir;
}

//_______________________________________________________
 void BrCollisionFilter::Event(BrEventNode* input, BrEventNode* output)
{
  // Return with status set to kDisaster if the input was note a
  // BrEvent object, or the trigger mask doesn't fit with the selected
  // triggers. 
  SetState(kEvent);
  SetStatus(kOk);

  fNoTimesCalled++;

  // Inspect the ZDC vertex 
  if (!CheckZdcVertex(input)) {
    if(!CheckZdcVertex(output))
      return;
  }


  // Inspect the Beam-beam vertex 
  if (!CheckBbVertex(input)) {
    if(!CheckBbVertex(output))
      return;
  }

  // Compare the found values.
  if (GetStatus() < kStop) {
    if (!CheckBbZdcVertex(input)) {
      if(!CheckBbZdcVertex(output))
	return;
    }
  }
  
  if (Verbose() > 20) 
    cout << "Status is " << GetStatus() << endl;
  if (GetStatus() >= kStop) 
    return;
  if (Verbose() > 10) 
    cout << "event accepted" << endl;
  SetStatus(kOk);
}
 
//____________________________________________________________________
 Bool_t BrCollisionFilter::CheckBbZdcVertex(BrEventNode* node)
{
// Check if the ZDC vertex is within bounds 
  // Private method.
  if (fMaxZdcVertexZ <= 0 || fMaxBbVertexZ <= 0 || 
      fSigmaRange <= 0 || fBbSigma <= 0) 
    return kTRUE;
  
  if (fCurrentBbVertexZ == 9999 || fCurrentZdcVertexZ == 9999) {
    if (Verbose() > kShowStop + 5)
      Warning("CheckBbZdcVertex", 
	      "could not find ZDC or BB vertex");
    return kFALSE;
  }
  
  Float_t diff = fCurrentBbVertexZ-fCurrentZdcVertexZ;
  if (HistOn())
    fAllBbZdc->Fill(diff);
  if(TMath::Abs(diff) >= fSigmaRange * fBbSigma) {
    if (HistOn()) {
      fAccBbZdc->Fill(diff);
      fAccBbZdc2D->Fill(fCurrentZdcVertexZ, 
			 fCurrentBbVertexZ);
    }
    fNoAcceptedBBZDC++;
  }  
  else
    Stop("Collision Filter", "Difference between Beam-beam vertex Z "
	 "(%f) and Zdc (%f) outside cut",  
	 fCurrentZdcVertexZ, fCurrentBbVertexZ);
  
  return kTRUE;
}

//____________________________________________________________________
 void BrCollisionFilter::Print(Option_t* option) const
{
  // Print info on module
  BrModule::Print(option);
  TString opt(option);
  opt.ToLower();
  
  if (opt.Contains("s")) {
    BrVertexFilter::Print("s");    
    cout << "BrCollisionFilter Statistic Summary" << endl
	 << " Events after BB-ZDC : " << setw(8)
	 << fNoAcceptedBBZDC  << endl; 
  }
  if (opt.Contains("d")) {
    BrVertexFilter::Print("d");
    cout << "   BB Sigma:    " << fBbSigma << endl
	 << "   Sigma range: " << fSigmaRange << endl
	 << endl
	 << "  Original author: Flemming Videbaek" << endl
	 << "    $Author: cholm $" << endl
	 << "    $Date: 2001/11/02 15:18:16 $"   << endl
	 << "    $Revision: 1.5 $ " << endl
	 << endl
	 << "*************************************************" << endl;
  }
  
  
}

//
// $Log: BrCollisionFilter.cxx,v $
// Revision 1.5  2001/11/02 15:18:16  cholm
// Changed the BrCollisionFilter to derive from BrVertexFilter (updates
// to both classes), since the collision filter is basically a vertex.
//
// Revision 1.4  2001/10/25 14:31:30  videbaek
// Update to be able to deal with both new and old Bb Rdo data
//
// Revision 1.3  2001/06/26 20:57:43  videbaek
// Added some descriptive comments
//
// Revision 1.2  2001/06/22 17:50:32  cholm
// Changes to to data class renaming.
//
// Revision 1.1.1.1  2001/06/21 14:55:14  hagel
// Initial revision of brat2
//
// Revision 1.2  2001/06/19 15:16:17  brahmlib
// Declared SetDefaultParameters void
//
// Revision 1.1  2001/06/05 20:15:44  videbaek
// Add collision selection filter
//

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