|
//____________________________________________________________________ // // A module to select events with specific triggers // // // $Id: BrVertexFilter.cxx,v 1.9 2002/08/30 17:02:02 hagel Exp $ // $Author: hagel $ // $Date: 2002/08/30 17:02:02 $ // $Copytight: 2000 BRAHMS Collaboration // #ifndef ROOT_TDirectory #include "TDirectory.h" #endif #ifndef BRAT_BrBbVertex #include "BrBbVertex.h" #endif #include "BrVertexFilter.h" #include "BrEvent.h" #include "BrEventHeader.h" #include "BrDetectorList.h" #include "BrZdcRdo.h" #include "BrBbRdo.h" #include "BrInelVertex.h" #include "BrVertex.h" #include <BrIostream.h> //____________________________________________________________________ ClassImp(BrVertexFilter); //____________________________________________________________________ BrVertexFilter::BrVertexFilter() { // Default constructor fAllZdcHisto = 0; fAccZdcHisto = 0; fAllBbHisto = 0; fAccBbHisto = 0; fAllTpm1Histo = 0; fAccTpm1Histo = 0; fAllInelHisto = 0; fAccInelHisto = 0; fAllProjectionHisto = 0; fAccProjectionHisto = 0; fMaxZdcVertexZ = -1; fMaxBbVertexZ = -1; fMaxTpm1VertexZ = -1; fMaxInelVertexZ = -1; fMaxProjectionVertexZ = -1; fNoTimesCalled = 0; fNoAcceptedZDC = 0; fNoAcceptedBB = 0; fNoAcceptedTPM1 = 0; fNoAcceptedInel = 0; fNoAcceptedProjection = 0; SetState(kSetup); } //____________________________________________________________________ BrVertexFilter::BrVertexFilter(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Default constructor SetState(kSetup); fAllZdcHisto = 0; fAccZdcHisto = 0; fAllBbHisto = 0; fAccBbHisto = 0; fAllTpm1Histo = 0; fAccTpm1Histo = 0; fAllInelHisto = 0; fAccInelHisto = 0; fAllProjectionHisto = 0; fAccProjectionHisto = 0; fMaxZdcVertexZ = -1; fMaxBbVertexZ = -1; fMaxTpm1VertexZ = -1; fMaxInelVertexZ = -1; fMaxProjectionVertexZ = -1; fNoTimesCalled = 0; fNoAcceptedZDC = 0; fNoAcceptedBB = 0; fNoAcceptedTPM1 = 0; fNoAcceptedInel = 0; fNoAcceptedProjection = 0; kDemandZdcVertex = kFALSE; kDemandBbVertex = kFALSE; kDemandTpcVertex = kFALSE; kDemandInelVertex = kFALSE; kDemandProjectionVertex = kFALSE; } //_______________________________________________________ void BrVertexFilter::SetMaxZdcVertexZ(Float_t z) { // Set the vertex cut for the ZDC vertex. If 0 or less, the ZDC // vertex is ignored. if (GetState() >= kInit) Warning("SetMaxZdcVertexZ", "must be set before Init"); fMaxZdcVertexZ = z; } //_______________________________________________________ void BrVertexFilter::SetMaxBbVertexZ(Float_t z) { // Set the vertex cut for the Beam-Beam vertex. If 0 or less, the // Beam-Beam vertex is ignored. if (GetState() >= kInit) Warning("SetMaxBbVertexZ", "must be set before Init"); fMaxBbVertexZ = z; } //_______________________________________________________ void BrVertexFilter::SetMaxTpm1VertexZ(Float_t z) { // Set the vertex cut for the TPM1 vertex. If 0 or less, the // Beam-Beam vertex is ignored. if (GetState() >= kInit) Warning("SetMaxTpm1VertexZ", "must be set before Init"); fMaxTpm1VertexZ = z; } //_______________________________________________________ void BrVertexFilter::SetMaxInelVertexZ(Float_t z) { // Set the vertex cut for the Inel vertex. If 0 or less, the // Beam-Beam vertex is ignored. if (GetState() >= kInit) Warning("SetMaxInelVertexZ", "must be set before Init"); fMaxInelVertexZ = z; } //_______________________________________________________ void BrVertexFilter::SetMaxProjectionVertexZ(Float_t z) { // Set the vertex cut for the Inel vertex. If 0 or less, the // Beam-Beam vertex is ignored. if (GetState() >= kInit) Warning("SetMaxProjectionVertexZ", "must be set before Init"); fMaxProjectionVertexZ = z; } //_______________________________________________________ void BrVertexFilter::DefineHistograms() { // Define histograms // if (GetState() != kInit) { // Problem("Define Histograms", "must be called after Init"); // return; // } Float_t resZdc = 5; // estimated resolution of ZDC vertex Float_t resBb = 3; // estimated resolution of Beam-Beam vertex Float_t resTpm1 = 1.5; // estimated resolution of TPM1 vertex Float_t resInel = 3; // estimated resolution of Inel vertex kh 5-Jul-2002 // remember current directory TDirectory* savdir = gDirectory; // Make directory for this module TDirectory* hdir = savdir->mkdir("vertex"); if (!hdir) { Warning("DefineHistograms","could not create histogram subdirectory"); return; } // Change directory to histogram directory hdir->cd(); // Make histograms fAllZdcHisto = new TH1F("allZdcVertexZ", "All ZDC Vertices", Int_t(200 / resZdc + 1), -100, 100); fAllBbHisto = new TH1F("allBbVertexZ", "All Beam-Beam Vertices", Int_t(200 / resBb + 1), -100, 100); fAllTpm1Histo = new TH1F("allTpm1VertexZ", "All TPM1 Vertices", Int_t(200 / resTpm1 + 1), -100, 100); fAllInelHisto = new TH1F("allInelVertexZ", "All Inel Vertices", Int_t(200 / resInel + 1), -100, 100); fAllProjectionHisto = new TH1F("allProjectionVertexZ", "All Projection Vertices", Int_t(200 / resInel + 1), -100, 100); if (fMaxZdcVertexZ > 0) fAccZdcHisto = new TH1F("accZdcVertexZ", "Accepted ZDC Vertices", Int_t(2 * fMaxZdcVertexZ / resZdc + 1), -fMaxZdcVertexZ, fMaxZdcVertexZ); if (fMaxBbVertexZ > 0) fAccBbHisto = new TH1F("accBbVertexZ", "Accepted Beam-Beam Vertices", Int_t(2 * fMaxBbVertexZ / resBb + 1), -fMaxBbVertexZ, fMaxBbVertexZ); if (fMaxZdcVertexZ > 0) fAccTpm1Histo = new TH1F("accTpm1VertexZ", "Accepted TPM1 Vertices", Int_t(2 * fMaxTpm1VertexZ / resTpm1 + 1), -fMaxTpm1VertexZ, fMaxTpm1VertexZ); if (fMaxInelVertexZ > 0) fAccInelHisto = new TH1F("accInelVertexZ", "Accepted Inel Vertices", Int_t(2 * fMaxInelVertexZ / resInel + 1), -fMaxInelVertexZ, fMaxInelVertexZ); if (fMaxProjectionVertexZ > 0) fAccProjectionHisto = new TH1F("accProjectionVertexZ", "Accepted Projection Vertices", Int_t(2 * fMaxInelVertexZ / resInel + 1), -fMaxInelVertexZ, fMaxInelVertexZ); // Restore directory gDirectory = savdir; } //_______________________________________________________ void BrVertexFilter::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 so instructed if (!CheckZdcVertex(input)) { if(!CheckZdcVertex(output)) return; } // Inspect the Beam-beam vertex if so instructed if (!CheckBbVertex(input)) { if(!CheckBbVertex(output)) return; } // Inspect the TPM1 vertex if so instructed if (!CheckTpm1Vertex(input)) { if(!CheckTpm1Vertex(output)) return; } // Inspect the Inel vertex if so instructed if (!CheckInelVertex(input)) { if(!CheckInelVertex(output)) return; } // Inspect the Projection vertex if so instructed if (!CheckProjectionVertex(input)) { if(!CheckProjectionVertex(output)) return; } if (Verbose() > 20) cout << "<BrVertexFilter::Event>: Status is " << GetStatus() << endl; if (GetStatus() >= kStop) return; if (Verbose() > 10) cout << "<BrVertexFilter::Event>: event accepted" << endl; SetStatus(kOk); } //____________________________________________________________________ Bool_t BrVertexFilter::CheckZdcVertex(BrEventNode* node) { // Check if the ZDC vertex is within bounds fCurrentZdcVertexZ = 9999; if (fMaxZdcVertexZ <= 0) return kTRUE; TString tableName("Rdo"); tableName += BrDetectorList::GetDetectorName(kBrZDC); BrZdcRdo* rdoZdc = (BrZdcRdo*)node->GetObject(tableName.Data()); if (!rdoZdc) { if (kDemandZdcVertex) Stop("CheckZdcVertex", "could not find ZDC table '%s' in input event", tableName.Data()); if (Verbose() > kShowStop + 5) Warning("CheckZdcVertex", "could not find ZDC table '%s' in input event", tableName.Data()); return kFALSE; } fCurrentZdcVertexZ = rdoZdc->GetZ(); if (HistOn()) fAllZdcHisto->Fill(fCurrentZdcVertexZ); if (TMath::Abs(fCurrentZdcVertexZ) > fMaxZdcVertexZ) Stop("CheckZdcVertex", "ZDC vertex Z (%f) is outside cut (%f)", fCurrentZdcVertexZ, fMaxZdcVertexZ); else { if (HistOn()) fAccZdcHisto->Fill(fCurrentZdcVertexZ); fNoAcceptedZDC++; } if (Verbose() > 10) cout << "<BrVertexFilter::CheckZdcVertex>: Found ZDC vertex at " << fCurrentZdcVertexZ << endl; return kTRUE; } //____________________________________________________________________ Bool_t BrVertexFilter::CheckBbVertex(BrEventNode* node) { // Check if the BB vertex is within bounds fCurrentBbVertexZ = 9999; if (fMaxBbVertexZ <= 0) return kTRUE; TString tableName(""); tableName += BrDetectorList::GetDetectorName(kBrBB); BrBbVertex* vtxBb = (BrBbVertex*)node->GetObject("BB Vertex"); if (vtxBb) fCurrentBbVertexZ = vtxBb->GetZ0(); else { BrBbRdo* rdoBb = (BrBbRdo*)node->GetObject(tableName.Data()); if (!rdoBb) { if (kDemandBbVertex) Stop("CheckBbVertex", "could not find any Beam-Beam data in input event"); if (Verbose() > kShowStop + 5) Warning("CheckBbVertex", "could not find Beam-Beam table '%s' in input event", "BbRdo"); return kFALSE; } fCurrentBbVertexZ = rdoBb->GetZ0(); } if (HistOn()) fAllBbHisto->Fill(fCurrentBbVertexZ); if (TMath::Abs(fCurrentBbVertexZ) > fMaxBbVertexZ) Stop("CheckBbVertex", "Beam-beam vertex Z (%f) is outside cut (%f)", fCurrentBbVertexZ, fMaxBbVertexZ); else { if (HistOn()) fAccBbHisto->Fill(fCurrentBbVertexZ); fNoAcceptedBB++; } if (Verbose() > 10) cout << "<BrVertexFilter::CheckBbVertex>: Found Beam-Beam vertex at " << fCurrentBbVertexZ << endl; return kTRUE; } //____________________________________________________________________ Bool_t BrVertexFilter::CheckTpm1Vertex(BrEventNode* node) { // Check if the ZDC vertex is within bounds fCurrentTpm1VertexZ = 9999; if (fMaxTpm1VertexZ <= 0) return kTRUE; TString tableName(""); tableName += BrDetectorList::GetDetectorName(kBrTPM1); tableName += " Cluster VtxData"; BrVertex* vtxTpm1 = (BrVertex*)node->GetObject(tableName.Data()); if (!vtxTpm1) { if (kDemandTpcVertex) Stop("CheckTpm1Vertex", "could not find TPM1 table '%s' in input event", tableName.Data()); if (Verbose() > kShowStop + 5) Warning("CheckTpm1Vertex", "could not find TPM1 table '%s' in input event", tableName.Data()); return kFALSE; } fCurrentTpm1VertexZ = vtxTpm1->GetZ(); if (HistOn()) fAllTpm1Histo->Fill(fCurrentTpm1VertexZ); if (TMath::Abs(fCurrentTpm1VertexZ) > fMaxTpm1VertexZ) Stop("CheckTpm1Vertex", "TPM1 vertex Z (%f) is outside cut (%f)", fCurrentTpm1VertexZ, fMaxTpm1VertexZ); else { if (HistOn()) fAccTpm1Histo->Fill(fCurrentTpm1VertexZ); fNoAcceptedTPM1++; } if (Verbose() > 10) cout << "<BrVertexFilter::CheckTpm1Vertex>: Found Tpm1 vertex at " << fCurrentTpm1VertexZ << endl; return kTRUE; } //____________________________________________________________________ Bool_t BrVertexFilter::CheckInelVertex(BrEventNode* node) { // Check if the Inel vertex is within bounds fCurrentInelVertexZ = 9999; if (fMaxInelVertexZ <= 0) return kTRUE; BrInelVertex *inelVertex = (BrInelVertex*)node->GetObject("InelVertex"); if (!inelVertex) { if (kDemandInelVertex) Stop("CheckInelVertex","could not find InelVertex"); if (Verbose() > kShowStop + 5) Warning("CheckInelVertex", "could not find InelVertex"); return kFALSE; } fCurrentInelVertexZ = inelVertex->GetZ(); if (HistOn()) fAllInelHisto->Fill(fCurrentInelVertexZ); if (TMath::Abs(fCurrentInelVertexZ) > fMaxInelVertexZ) Stop("CheckInelVertex", "Inel vertex Z (%f) is outside cut (%f)", fCurrentInelVertexZ, fMaxInelVertexZ); else { if (HistOn()) fAccInelHisto->Fill(fCurrentInelVertexZ); fNoAcceptedInel++; } if (Verbose() > 10) cout << "<BrVertexFilter::CheckInelVertex>: Found Inel vertex at " << fCurrentInelVertexZ << endl; return kTRUE; } Bool_t BrVertexFilter::CheckProjectionVertex(BrEventNode* node) { // Check if the Projection vertex is within bounds fCurrentProjectionVertexZ = 9999; if (fMaxProjectionVertexZ <= 0) return kTRUE; BrVertex *projVertex = (BrVertex*)node->GetObject("Track Projection Vtx TPM1"); if (!projVertex) { if (kDemandProjectionVertex) Stop("CheckProjectionVertex","could not find Track Projection Vtx TPM1"); if (Verbose() > kShowStop + 5) Warning("CheckProjectionVertex", "could not find Track Projection Vtx TPM1"); return kFALSE; } fCurrentProjectionVertexZ = projVertex->GetZ(); if (HistOn()) fAllProjectionHisto->Fill(fCurrentProjectionVertexZ); if (TMath::Abs(fCurrentProjectionVertexZ) > fMaxProjectionVertexZ) Stop("CheckProjectionVertex", "Projection vertex Z (%f) is outside cut (%f)", fCurrentProjectionVertexZ, fMaxProjectionVertexZ); else { if (HistOn()) fAccProjectionHisto->Fill(fCurrentProjectionVertexZ); fNoAcceptedProjection++; } if (Verbose() > 10) cout << "<BrVertexFilter::CheckProjectionVertex>: Found Projection vertex at " << fCurrentProjectionVertexZ << endl; return kTRUE; } //____________________________________________________________________ void BrVertexFilter::Finish() { // Print statistics SetState(kFinish); Print("s"); } //____________________________________________________________________ void BrVertexFilter::Print(Option_t* option) const { // Print info on module BrModule::Print(option); TString opt(option); opt.ToLower(); if (opt.Contains("s")) cout << "BrVertexFilter Statistic Summary" << endl << " No Events checked : " << setw(8) << fNoTimesCalled << endl << " Events after ZDC : " << setw(8) << fNoAcceptedZDC << endl << " Events after BB : " << setw(8) << fNoAcceptedBB << endl << " Events after TPM1 : " << setw(8) << fNoAcceptedTPM1 << endl << " Events after Inel : " << setw(8) << fNoAcceptedInel << endl << " Events after Project: " << setw(8) << fNoAcceptedProjection << endl; if (opt.Contains("d")) { cout<< " Vertex cuts: " << endl << " ZDC: " << (fMaxZdcVertexZ <= 0 ? "none" : Form("%f", fMaxZdcVertexZ)) << endl << " Beam-Beam: " << (fMaxBbVertexZ <= 0 ? "none" : Form("%f", fMaxBbVertexZ)) << endl << " TPM1: " << (fMaxTpm1VertexZ <= 0 ? "none" : Form("%f", fMaxTpm1VertexZ)) << endl << " Inel: " << (fMaxInelVertexZ <= 0 ? "none" : Form("%f", fMaxInelVertexZ)) << endl << " Projection: " << (fMaxProjectionVertexZ <= 0 ? "none" : Form("%f", fMaxProjectionVertexZ)) << endl << endl << " Original author: Christian Holm Christensen" << endl << " $Author: hagel $" << endl << " $Date: 2002/08/30 17:02:02 $" << endl << " $Revision: 1.9 $ " << endl << endl << "*************************************************" << endl; } } // // $Log: BrVertexFilter.cxx,v $ // Revision 1.9 2002/08/30 17:02:02 hagel // Added support for track projection vertices // // Revision 1.8 2002/08/06 19:08:07 hagel // Add support for Inel vertex filtering // // Revision 1.7 2001/12/17 10:48:48 bjornhs // Changed the order of BB vertex checking - first BrBbVertex, then BbRdo // Added functionality for demanding the presence of a specific vertex // object, set to kFALSE by default. Syntax: // myVertexFilter->Demand[Bb/Zdc/Tpc]Vertex(); // // Revision 1.5 2001/11/02 15:19:04 cholm // Changed the BrCollisionFilter to derive from BrVertexFilter (updates // to both classes), since the collision filter is basically a vertex. // // Revision 1.4 2001/07/20 15:23:04 cholm // Better debug message // // Revision 1.3 2001/06/25 14:56:25 cholm // Moved printing of status to Print // // Revision 1.2 2001/06/22 17:50:47 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.6 2001/06/16 17:27:09 videbaek // Add statistcis to filter // // Revision 1.5 2001/05/31 01:36:57 cholm // Fix of some problems // // Revision 1.4 2001/05/23 12:20:44 cholm // Minor fixes // // Revision 1.3 2001/03/07 12:13:23 cholm // Changed Info to Print. // // Revision 1.2 2001/01/30 23:56:24 cholm // Corrected some bugs. // // Revision 1.1 2001/01/29 19:57:58 cholm // Added the class BrVertexFilter for selecting events with a limited vertex // range in Z. // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|