|
//____________________________________________________________________ // //This is a module to take tracks, project them to the beam pipe, and //infer a vertex. It is a poor mans way of doing what BrTPMTrackVertexModule //does (poor meaning use for pp where there are rarely more than one track) //The module can be used for TPM1 or T1 although the accuracy will depend //which detector is used and which angle it is at. // //____________________________________________________________________ // // $Id: BrTrackProjectionVertexModule.cxx,v 1.1 2002/08/30 17:07:48 hagel Exp $ // $Author: hagel $ // $Date: 2002/08/30 17:07:48 $ // $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #include "BrTrackProjectionVertexModule.h" #include "TDirectory.h" #include "TH1.h" //#include "TH2.h" //#include <fstream.h> #include "BrIostream.h" #include "BrDetectorTrack.h" #include "BrGeometryDbManager.h" #include "BrVertex.h" //____________________________________________________________________ ClassImp(BrTrackProjectionVertexModule); //____________________________________________________________________ BrTrackProjectionVertexModule::BrTrackProjectionVertexModule() { // Default constructor. DO NOT USE SetState(kSetup); } //____________________________________________________________________ BrTrackProjectionVertexModule::BrTrackProjectionVertexModule(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Named Constructor SetState(kSetup); SetDefaultParameters(); } //____________________________________________________________________ void BrTrackProjectionVertexModule::SetDefaultParameters() { // set default parameters } //____________________________________________________________________ BrTrackProjectionVertexModule::~BrTrackProjectionVertexModule() { } //____________________________________________________________________ void BrTrackProjectionVertexModule::DefineHistograms() { // Define histograms. They are: // <fill in here> if (GetState() != kInit) { Stop("DefineHistograms", "Must be called after Init"); return; } TDirectory* saveDir = gDirectory; TDirectory *histDir = gDirectory->mkdir(Form("%s_TrackProjectionVertex",GetName())); histDir->cd(); // Make histograms here hVertexX = new TH1F("hVertexX","hVertexX",300,-20,20); hVertexY = new TH1F("hVertexY","hVertexY",300,-20,20); hVertexZ = new TH1F("hVertexZ","hVertexZ",300,-600,600); //Restore original directory gDirectory = saveDir; } //____________________________________________________________________ void BrTrackProjectionVertexModule::Init() { // Job-level initialisation SetState(kInit); // // Called once per session // Get detectorParameters. Inform the parameterElementManeger about // database tables to be used (i.e. filled). if(DebugLevel() > 2) cout << "Entering BrTrackProjectionVertexModule::Init() for " << GetName() << endl; // initializing base class // get TPM1 volume BrGeometryDbManager* geo = BrGeometryDbManager::Instance(); fTpm1Volume = (BrDetectorVolume*)geo-> GetDetectorVolume("BrDetectorVolume", GetName()); if(!fTpm1Volume){ cout << "No TPM1 volume" << endl; Abort("Init","No TPM1 detector"); } } //____________________________________________________________________ void BrTrackProjectionVertexModule::Begin() { // Run-level initialisation SetState(kBegin); // check if histos are booked if (!HistBooked()) { Abort("Begin", "MUST book histograms in this module!!!"); return; } } //____________________________________________________________________ void BrTrackProjectionVertexModule::Event(BrEventNode* inNode, BrEventNode* outNode) { // Per event method SetState(kEvent); // ------------------------------------------------------------------- // Get TPM1 tracks and Inel vertex // project tracks to longitudinal plane (X = 0 plane) // fill histos with Z0 vs track proj Z and difference between those // quantities. // ------------------------------------------------------------------- if(DebugLevel() > 1) cout << "Entering Event() in BrTrackProjectionVertexModule for " << GetName() << endl; // Get TPM1 tracks BrDataTable* trks = inNode->GetDataTable(Form("DetectorTrack %s",GetName())); if (!trks) { Info(2,"Event", "No %s tracks for this event",GetName()); return; } TObjArray projList; BrPlane3D plane(0,0,0, 0,1,0, 0,0,1); Int_t numTracks = trks->GetEntries(); for (Int_t t = 0; t < numTracks; t++) { BrDetectorTrack* trk = (BrDetectorTrack*)trks->At(t); BrLine3D trkLine = fTpm1Volume->LocalToGlobal(trk->GetTrackLine()); BrVector3D proj = plane.GetIntersectionWithLine(trkLine); projList.Add(new BrVector3D(proj)); Info(50,"Event","tpm1 vertex z = %fn",proj(2)); if(HistOn()) { hVertexX->Fill(proj(0)); hVertexY->Fill(proj(1)); hVertexZ->Fill(proj(2)); } } //Here we analyze the projections to eliminate spurious tracks //from consideration in calculating the vertex. if(numTracks > 0) { Float_t xsum = 0; Float_t ysum = 0; Float_t zsum = 0; TIter nextProj(&projList); BrVector3D *vtxProj; while((vtxProj=(BrVector3D*)nextProj())) { //For the moment, we just average. Usually only 1 for pp anyway xsum += vtxProj->GetX(); ysum += vtxProj->GetY(); zsum += vtxProj->GetZ(); } Float_t x = xsum / Float_t(numTracks); Float_t y = ysum / Float_t(numTracks); Float_t z = zsum / Float_t(numTracks); BrVertex* vtxdata = new BrVertex(Form("Track Projection Vtx %s",GetName()), "Track Projection Vertex"); outNode->AddObject(vtxdata); // Fill vertex object vtxdata->SetX(x); vtxdata->SetY(y); vtxdata->SetZ(z); //vtxdata->SetVertexChisq(Vertex_chisq); //vtxdata->SetVertexFound(fVertex_found); vtxdata->SetVertexMethodUsed(5); } projList.Delete(); //Delete all projections in the list. } //____________________________________________________________________ void BrTrackProjectionVertexModule::Finish() { // Job-level finalisation. SetState(kFinish); } //____________________________________________________________________ void BrTrackProjectionVertexModule::Print(Option_t* option) const { // Print module information // See BrModule::Print for options. // In addition this module defines the Option: // <fill in here> TString opt(option); opt.ToLower(); BrModule::Print(option); if (opt.Contains("d")) cout << endl << " Original author: K. Hagel" << endl << " Last Modifications: " << endl << " $Author: hagel $" << endl << " $Date: 2002/08/30 17:07:48 $" << endl << " $Revision: 1.1 $ " << endl << endl << "-------------------------------------------------" << endl; } //____________________________________________________________________ // // $Log: BrTrackProjectionVertexModule.cxx,v $ // Revision 1.1 2002/08/30 17:07:48 hagel // Initial revision // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|