BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
// 
// As Christian wrote it :
// BrCleanupNodesModule will remove any node from the input node
// that the user gave as argument : 
//
//  BrCleanupNodesModule* victor(1) = 
//    BrCleanupNodesModule("victor", "The Cleaner"); 
//  victor->AddTable("Tracks - T1"); 
//  victor->AddTable("Clusters - T1"); 
//  victor->AddTable("MultRdoTile"); 
//  victor->AddTable("MultRdoTile"); 
// 
//    ...
//
//  and so on 
//
//  (1): A reference to Jean Reno's character in Luc Besson's "Nikita"
//       Victor - the cleaner! 
// 

//____________________________________________________________________
//
// $Id: BrCleanupNodesModule.cxx,v 1.2 2002/06/07 16:03:12 videbaek Exp $
// $Author: videbaek $
// $Date: 2002/06/07 16:03:12 $
// $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>
//
#ifndef BRAT_BrCleanupNodesModule
#include "BrCleanupNodesModule.h"
#endif

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TIterator
#include "TIterator.h"
#endif
#ifndef BRAT_BrDataTable
#include "BrDataTable.h"
#endif

#ifndef WIN32
#include <iostream>
#else
#include <iostream.h>
#endif

//____________________________________________________________________

ClassImp(BrCleanupNodesModule);

//____________________________________________________________________
 BrCleanupNodesModule::BrCleanupNodesModule()
{
  // Default constructor. DO NOT USE
  SetState(kSetup);
  fNameList = 0;
}

//____________________________________________________________________
 BrCleanupNodesModule::BrCleanupNodesModule(const Char_t* name, const Char_t* title)
: BrModule(name, title)
{
  // Named Constructor
  SetState(kSetup);
  fNameList = new TList();
}

//____________________________________________________________________
 BrCleanupNodesModule::~BrCleanupNodesModule()
{
  // Default constructor. DO NOT USE
  if(fNameList)
    delete fNameList;
}

//____________________________________________________________________
 void BrCleanupNodesModule::AddTable(const Char_t *tableName) 
{
  // Creates a new TNamed object with name and title the same
  // as tableName and adds it to the list
  TNamed *listEntry = new TNamed(tableName, tableName);
  fNameList->Add(listEntry);
}
  
//____________________________________________________________________
 void BrCleanupNodesModule::Event(BrEventNode* inNode, BrEventNode* outNode)
{
  // Per event method
  // Removes the data tables from the inNode that matches the names
  // in the list
  SetState(kEvent);

  TIter next(fNameList);                           
  while (TNamed *obj = (TNamed*)next()) {
    if(DebugLevel()>1)
      cout << "Remove " << obj->GetName() << endl;
    BrDataTable *table = inNode->GetDataTable(obj->GetName());
    if(table) {
      
      inNode->RemoveDataObject(table);
      delete table;
      table = 0;
    }
  }

}

//____________________________________________________________________
 void BrCleanupNodesModule::Print(Option_t* option) const
{
  // Print module information
  // See BrModule::Print for options.
  // In addition this module defines the Option:
  // <fill in here>

  BrModule::Print(option);

  TString opt(option);
  opt.ToLower(); 
  
  if (opt.Contains("d")) 
   cout << endl 
         << "  Original author: Peter H Christiansen" << endl
         << "  Last Modifications: " << endl 
         << "    $Author: videbaek $" << endl  
         << "    $Date: 2002/06/07 16:03:12 $"   << endl 
         << "    $Revision: 1.2 $ " << endl  
         << endl 
         << "-------------------------------------------------" << endl;

  Int_t nTables = 0;
  TIter next(fNameList);                           
  while (TNamed *obj = (TNamed*)next()) {
    obj->Print();
    nTables++;
  }

  cout << endl << "Number of tables : " << nTables << " - RATING : ";
  if(nTables ==0)
    cout << "Pacifist" << endl;
  else if(nTables <=5)
    cout << "Novice" << endl;
  else if(nTables <=10)
    cout << "Veteran" << endl;
  else if(nTables <=15)
    cout << "Killer" << endl;
  else 
    cout << "Terminator" << endl;
  
}

//____________________________________________________________________
//
// $Log: BrCleanupNodesModule.cxx,v $
// Revision 1.2  2002/06/07 16:03:12  videbaek
// Add debug print
//
// Revision 1.1  2001/08/14 19:31:22  pchristi
// Added new module BrCleanupNodesModule that can remove datatables
// from the inputNode. Used in BrTpcHitPackage and BrTpcTrackPackage.
//
//

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