|
//____________________________________________________________________ // // Filter to select events in a certein centrality region. One can set // the low and high limits. Events that fall outside of those limits // are rejected, else they are passed on to the rest of the module // pipeline. // // The low limit corresponds to the smallest value of the most central // events, and the high limit corresponds to the biggest value of the // most central events. For example to select events that are in the // region of the 5% to 10% most central of all events, one should set // low = 5 and high = 10 // // You can set cuts on centralities obtained from either of the two // modules: // // BrmultSdeCentModule // BrMultCentModule // // To ignore one particular detector, just set the lower limit to 0 // and the upper to 100 (accept all events). // // This module assumes that a BrMultCent, as created by // BrMultSdeCentModule with name CentMultTile, object is avaliable in the // input node. // This module assumes that a BrMultCent, as created by // BrMultSdeCentModule with name CentMultSi, object is avaliable in the // input node. // This module assumes that a BrMultCent, as created by // BrMultCentModule, object is avaliable in the input node. // //____________________________________________________________________ // $Id: BrCentFilter.cxx,v 1.4 2001/11/26 14:40:20 cholm Exp $ // $Author: cholm $ // $Date: 2001/11/26 14:40:20 $ // $Copyright: 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #ifndef BRAT_BrCentFilter #include "BrCentFilter.h" #endif #ifndef BRAT_BrTileCent #include "BrTileCent.h" #endif #ifndef BRAT_BrSiCent #include "BrSiCent.h" #endif #ifndef BRAT_BrMultCent #include "BrMultCent.h" #endif #ifndef BRAT_BrDetectorList #include "BrDetectorList.h" #endif #ifndef ROOT_TString #include "TString.h" #endif #ifndef ROOT_TDirectory #include "TDirectory.h" #endif #ifndef WIN32 #include <iostream> #include <iomanip> #else #include <iostream.h> #include <iomanip.h> #endif //____________________________________________________________________ ClassImp(BrCentFilter); //____________________________________________________________________ BrCentFilter::BrCentFilter() { // Default constructor. DO NOT USE SetState(kSetup); SetHighLimit(); SetLowLimit(); fNoTimesCalled = 0; fNoAcceptedTile = 0; fNoAcceptedSi = 0; fNoAcceptedMult = 0; } //____________________________________________________________________ BrCentFilter::BrCentFilter(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Named constructor SetState(kSetup); SetHighLimit(); SetLowLimit(); fNoTimesCalled = 0; fNoAcceptedTile = 0; fNoAcceptedSi = 0; fNoAcceptedMult = 0; } //____________________________________________________________________ void BrCentFilter::SetLowLimit(Float_t low) { // Set the low cut (from 0 to 100) on all detectors if (GetState() != kSetup) { Failure("SetLowLimit", "Message must be sent before init"); return; } if (low < 0 || low > 100) { Failure("SetLowLimit", "low cut must be in [0,100] (was %d)", Int_t(low)); return; } fTileLowLimit = fSiLowLimit = fMultLowLimit = low; } //____________________________________________________________________ void BrCentFilter::SetHighLimit(Float_t high) { // Set the high cut (from 0 to 100) on all detectors if (GetState() != kSetup) { Failure("SetHighLimit", "Message must be sent before init"); return; } if (high < 0 || high > 100) { Failure("SetHighLimit", "high cut must be in [0,100] (was %d)", Int_t(high)); return; } fTileHighLimit = fSiHighLimit = fMultHighLimit = high; } //____________________________________________________________________ void BrCentFilter::SetTileLowLimit(Float_t low) { // Set the low cut (from 0 to 100) for TMA data if (GetState() != kSetup) { Failure("SetTileLowLimit", "Message must be sent before init"); return; } if (low < 0 || low > 100) { Failure("SetTileLowLimit", "low cut must be in [0,100] (was %d)", Int_t(low)); return; } fTileLowLimit = low; } //____________________________________________________________________ void BrCentFilter::SetTileHighLimit(Float_t high) { // Set the high cut (from 0 to 100) for TMA data if (GetState() != kSetup) { Failure("SetTileHighLimit", "Message must be sent before init"); return; } if (high < 0 || high > 100) { Failure("SetTileHighLimit", "high cut must be in [0,100] (was %d)", Int_t(high)); return; } fTileHighLimit = high; } //____________________________________________________________________ void BrCentFilter::SetSiLowLimit(Float_t low) { // Set the low cut (from 0 to 100) for SMA data if (GetState() != kSetup) { Failure("SetSiLowLimit", "Message must be sent before init"); return; } if (low < 0 || low > 100) { Failure("SetSiLowLimit", "low cut must be in [0,100] (was %d)", Int_t(low)); return; } fSiLowLimit = low; } //____________________________________________________________________ void BrCentFilter::SetSiHighLimit(Float_t high) { // Set the high cut (from 0 to 100) for SMA data if (GetState() != kSetup) { Failure("SetSiHighLimit", "Message must be sent before init"); return; } if (high < 0 || high > 100) { Failure("SetSiHighLimit", "high cut must be in [0,100] (was %d)", Int_t(high)); return; } fSiHighLimit = high; } //____________________________________________________________________ void BrCentFilter::SetMultLowLimit(Float_t low) { // Set the low cut (from 0 to 100) for TMA + SMA data if (GetState() != kSetup) { Failure("SetMultLowLimit", "Message must be sent before init"); return; } if (low < 0 || low > 100) { Failure("SetMultLowLimit", "low cut must be in [0,100] (was %d)", Int_t(low)); return; } fMultLowLimit = low; } //____________________________________________________________________ void BrCentFilter::SetMultHighLimit(Float_t high) { // Set the high cut (from 0 to 100) for TMA + SMA data if (GetState() != kSetup) { Failure("SetMultHighLimit", "Message must be sent before init"); return; } if (high < 0 || high > 100) { Failure("SetMultHighLimit", "high cut must be in [0,100] (was %d)", Int_t(high)); return; } fMultHighLimit = high; } //____________________________________________________________________ void BrCentFilter::DefineHistograms() { // Define two histograms // remember current directory TDirectory* savdir = gDirectory; TDirectory* hdir = savdir->mkdir("centfilter"); if (!hdir) { Warning("DefineHistograms","could not create histogram subdirectory"); return; } hdir->cd(); // TMA fTileAccCentHisto = new TH1F("tileAccCent", "Accepted centralities from TMA", 101, 0, 101); fTileAccCentHisto->SetXTitle("Centrality [%]"); fTileAccCentHisto->SetYTitle("Events"); fTileAllCentHisto = new TH1F("tileAllCent", "All centralities from TMA", 101, 0, 101); fTileAllCentHisto->SetXTitle("Centrality [%]"); fTileAllCentHisto->SetYTitle("Events"); // SMA fSiAccCentHisto = new TH1F("siAccCent", "Accepted centralities from SMA", 101, 0, 101); fSiAccCentHisto->SetXTitle("Centrality [%]"); fSiAccCentHisto->SetYTitle("Events"); fSiAllCentHisto = new TH1F("siAllCent", "All centralities from SMA", 101, 0, 101); fSiAllCentHisto->SetXTitle("Centrality [%]"); fSiAllCentHisto->SetYTitle("Events"); // MULT (TMA + SMA) fMultAccCentHisto = new TH1F("multAccCent", "Accepted centralities from TMA+SMA", 101, 0, 101); fMultAccCentHisto->SetXTitle("Low cut"); fMultAccCentHisto->SetYTitle("High cut"); fMultAllCentHisto = new TH1F("multAllCent", "All centralities from TMA+SMA", 101, 0, 101); fMultAllCentHisto->SetXTitle("Low cut"); fMultAllCentHisto->SetYTitle("High cut"); // Restore directory gDirectory = savdir; } //____________________________________________________________________ void BrCentFilter::Init() { // Initialiser at job level SetState(kInit); if (fTileLowLimit >= fTileHighLimit) { Stop("Init", "Tile Low limit (%2d%%) is bigger then high limit (%2d%%)", Int_t(fTileLowLimit), Int_t(fTileHighLimit)); } if (fSiLowLimit >= fSiHighLimit) { Stop("Init", "Si Low limit (%2d%%) is bigger then high limit (%2d%%)", Int_t(fSiLowLimit), Int_t(fSiHighLimit)); } if (fMultLowLimit >= fMultHighLimit) { Stop("Init", "Mult Low limit (%2d%%) is bigger then high limit (%2d%%)", Int_t(fMultLowLimit), Int_t(fMultHighLimit)); } } //____________________________________________________________________ void BrCentFilter::Event(BrEventNode* inNode, BrEventNode* outNode) { // Main method. Process one event. SetState(kEvent); SetStatus(kOk); fNoTimesCalled++; Bool_t tileOk = CheckTile(inNode); Bool_t siOk = CheckSi(inNode); Bool_t multOk = CheckMult(inNode); if (tileOk && siOk && multOk) SetStatus(kOk); } //____________________________________________________________________ Bool_t BrCentFilter::CheckTile(BrEventNode* inNode) { // PRIVATE METHOD: // Check if the tile centrality is within the bounds. TString tableName = "Cent"; tableName += BrDetectorList::GetDetectorName(kBrTile); BrMultCent* centObj = (BrMultCent*)inNode->GetObject(tableName.Data()); if (!centObj) { // In case we don't care about this particular centrality if (fTileLowLimit <= 0 && fTileHighLimit >= 100) return kTRUE; Stop("Event", "couldn't get a BrMultCent object for TMA"); return kFALSE; } Float_t cent = centObj->GetCent(); if (HistOn()) fTileAllCentHisto->Fill(cent); if (cent < fTileLowLimit || cent > fTileHighLimit) { Stop("Event", "centrality %d%% is less than low cut %d%%, " "or greater than high cut %d%%", Int_t(cent), Int_t(fTileLowLimit), Int_t(fTileHighLimit)); return kFALSE; } if (HistOn()) fTileAccCentHisto->Fill(cent); fNoAcceptedTile++; return kTRUE; } //____________________________________________________________________ Bool_t BrCentFilter::CheckSi(BrEventNode* inNode) { // PRIVATE METHOD: // Check if the si centrality is within the bounds. TString tableName = "Cent"; tableName += BrDetectorList::GetDetectorName(kBrSi); BrMultCent* centObj = (BrMultCent*)inNode->GetObject(tableName.Data()); if (!centObj) { // In case we don't care about this particular centrality if (fSiLowLimit <= 0 && fSiHighLimit >= 100) return kTRUE; Stop("Event", "couldn't get a BrMultCent object for SMA"); return kFALSE; } Float_t cent = centObj->GetCent(); if (HistOn()) fSiAllCentHisto->Fill(cent); if (cent < fSiLowLimit || cent > fSiHighLimit) { Stop("Event", "centrality %d%% is less than low cut %d%%, " "or greater than high cut %d%%", Int_t(cent), Int_t(fSiLowLimit), Int_t(fSiHighLimit)); return kFALSE; } if (HistOn()) fSiAccCentHisto->Fill(cent); fNoAcceptedSi++; return kTRUE; } //____________________________________________________________________ Bool_t BrCentFilter::CheckMult(BrEventNode* inNode) { // PRIVATE METHOD: // Check if the mult centrality is within the bounds. TString tableName = "CentMult"; BrMultCent* centObj = (BrMultCent*)inNode->GetObject(tableName.Data()); if (!centObj) { // In case we don't care about this particular centrality if (fMultLowLimit <= 0 && fMultHighLimit >= 100) return kTRUE; Stop("Event", "couldn't get a BrMultCent object"); return kFALSE; } Float_t cent = centObj->GetCent(); if (HistOn()) fMultAllCentHisto->Fill(cent); if (cent < fMultLowLimit || cent > fMultHighLimit) { Stop("Event", "centrality %d%% is less than low cut %d%%, " "or greater than high cut %d%%", Int_t(cent), Int_t(fMultLowLimit), Int_t(fMultHighLimit)); return kFALSE; } if (HistOn()) fMultAccCentHisto->Fill(cent); fNoAcceptedMult++; return kTRUE; } //____________________________________________________________________ void BrCentFilter::Finish() { SetState(kFinish); if (Verbose() > 3) Print("s"); } //____________________________________________________________________ void BrCentFilter::Print(Option_t* option) const { // Information on this module // Options: // S Show statistics // BrModule::Print(option); TString opt(option); opt.ToLower(); if (opt.Contains("d")) cout << " TMA: " << setw(3) << Int_t(fTileLowLimit) << " - " << setw(3) << Int_t(fTileHighLimit) << endl << " SMA: " << setw(3) << Int_t(fSiLowLimit) << " - " << setw(3) << Int_t(fSiHighLimit) << endl << " TMA+SMA: " << setw(3) << Int_t(fMultLowLimit) << " - " << setw(3) << Int_t(fMultHighLimit) << endl << endl << " Original author: Christian Holm" << endl << " $Author: cholm $" << endl << " $Date: 2001/11/26 14:40:20 $" << endl << " $Revision: 1.4 $ " << endl << endl << "*************************************************" << endl; if (opt.Contains("s")) cout << "BrCentFilter Statistic Summary" << endl << " No Events checked : " << setw(8) << fNoTimesCalled << endl << " Events after TMA : " << setw(8) << fNoAcceptedTile << endl << " Events after SMA : " << setw(8) << fNoAcceptedSi << endl << " Events after TMA+SMA: " << setw(8) << fNoAcceptedMult << endl; } //____________________________________________________________________ // // $Log: BrCentFilter.cxx,v $ // Revision 1.4 2001/11/26 14:40:20 cholm // Some fixes to print outs // // Revision 1.3 2001/11/22 17:37:29 cholm // Updates to use new SDE Centrality methods // // Revision 1.2 2001/08/10 14:28:40 cholm // Changed a few things, so that centrality data not present can be // ignored, and also added a statistics output (conditional on verbosity // level ofcourse). // // Revision 1.1.1.1 2001/06/21 14:55:14 hagel // Initial revision of brat2 // // Revision 1.3 2001/04/19 15:46:39 cholm // Updated BrCentFilter for Si and Mult cent // // Revision 1.2 2001/03/07 12:13:21 cholm // Changed Info to Print. // // Revision 1.1 2001/02/13 09:37:32 cholm // Added the class BrCentFilter to ease making cuts in centrality. // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|