|
//____________________________________________________________________ // // Performe matching between FfsTracks and TmrsF counter. // The TMrsF is a single slat counter. Multiple matching objects can be // made in case of two tracks or more pointing to the Slat. // // // //____________________________________________________________________ // // $Id: BrTMrsFMatchingModule.cxx,v 1.1 2002/06/07 16:23:58 videbaek Exp $ // $Author: videbaek $ // $Date: 2002/06/07 16:23:58 $ // $Copyright: (C) 2002 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #ifndef BRAT_BrTMrsFMatchingModule #include "BrTMrsFMatchingModule.h" #endif #ifndef ROOT_TDirectory #include "TDirectory.h" #endif #ifndef ROOT_TNtuple #include "TNtuple.h" #endif #ifndef ROOT_TH1 #include "TH1.h" #endif #ifndef ROOT_TH2 #include "TH2.h" #endif #include <BrIostream.h> #ifndef BRAT_BrTMrsFRdo #include "BrTMrsFRdo.h" #endif #ifndef BRAT_BrEventNode #include "BrEventNode.h" #endif #ifndef BRAT_BrEvent #include "BrEvent.h" #endif #ifndef BRAT_BrEventNode #include "BrEventNode.h" #endif #ifndef BRAT_BrDataTable #include "BrDataTable.h" #endif #ifndef BRAT_BrDetectorList #include "BrDetectorList.h" #endif #ifndef BRAT_BrPlane3D #include "BrPlane3D.h" #endif #ifndef BRAT_BrTrack #include "BrTrack.h" #endif #ifndef BRAT_BrRunInfoManager #include "BrRunInfoManager.h" #endif #ifndef BRAT_BrSpectrometerTracks #include "BrSpectrometerTracks.h" #endif #ifndef BRAT_BrGeometryDbManager #include "BrGeometryDbManager.h" #endif #ifndef BRAT_BrCoordinateSystem #include "BrCoordinateSystem.h" #endif #ifndef BRAT_BrMagnetVolume #include "BrMagnetVolume.h" #endif #ifndef BRAT_BrTMrsFTrackMatch #include "BrTMrsFTrackMatch.h" #endif #include <vector> //____________________________________________________________________ ClassImp(BrTMrsFMatchingModule); //____________________________________________________________________ BrTMrsFMatchingModule::BrTMrsFMatchingModule() { // Default constructor. DO NOT USE SetState(kSetup); } //____________________________________________________________________ BrTMrsFMatchingModule::BrTMrsFMatchingModule(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Named Constructor SetState(kSetup); fDx=2.5; fDy=2.5; fXoffset=0.0; fYoffset=0.0; } //____________________________________________________________________ void BrTMrsFMatchingModule::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(GetName()); histDir->cd(); // Make histograms here fhProjectedPosition = new TH2F("projPosition","Tracks projected to TMRSF",100, -25, 25, 20, -5, 5); fhXYDiff = new TH2F("xyDiff","Difference between tracks and slats",40, -20, 20, 40, -20, 20); fhXXDiff = new TH2F("xxDiff1","Difference between track vs slat y",100, -25, 25, 100, -25, 25); fhYDiff = new TH1F("yDiff","Difference between track vs slat y",80, -10, 10); fhXSlatDiff = new TH1F("xDiff","Difference between Track and Slatpos 1",100,-10,10); fhXSlat = new TH1F("Slat1","Track pos for Slat1 hit",100,-25,25); fhAcpXSlat = new TH1F("AcpSlat1","Track pos for Slat1 hit",100,-25, 25); gDirectory = saveDir; } //____________________________________________________________________ void BrTMrsFMatchingModule::Init() { // Job-level initialisation SetState(kInit); BrGeometryDbManager* geomDb = BrGeometryDbManager::Instance(); fTpm1Volume = (BrDetectorVolume*)geomDb-> GetDetectorVolume("BrDetectorVolume", "TPM1"); fTMrsFVolume = (BrDetectorVolume*)geomDb-> GetDetectorVolume("BrDetectorVolume", "TMrsF"); fTpm1System = const_cast<BrCoordinateSystem*> (fTpm1Volume->GetCoordinateSystem()); } //____________________________________________________________________ void BrTMrsFMatchingModule::Begin() { // Run-level initialisation SetState(kBegin); } //____________________________________________________________________ void BrTMrsFMatchingModule::Event(BrEventNode* inNode, BrEventNode* outNode) { // // Input: // TMrsFRdo datatables. // FFsTracks // Output: // // // NOTE: this module assumes that you have the data in the innode. // If this is not the case add the module to an AppendContainer rather than // the MainModule and you are in business. // // Method: // project tracks (swim back through D1) and looks for slat hit. There is a complication // not taken care of namely that the is a physical overlap between the slat 2 and 1 or 3 // by several mm so there are valid combinations of one track to two slats. // The cuts are deliberately loose at this point. // SetState(kEvent); BrTMrsFRdo* tmrsf = (BrTMrsFRdo*) inNode->GetObject("TMrsFRdo"); BrDataTable* tracks = inNode->GetDataTable("MrsTracks"); if(DebugLevel()>10) inNode->ListObjects(); if(!tracks) return; if(!tmrsf) return; // get midplane for projections. // This is in Global system. // BrPlane3D tMrsFPlane = fTMrsFVolume->GetMidPlane(); int nTracks = tracks->GetEntries(); vector<Int_t> PointedSlat(nTracks); vector<Float_t> AddLength(nTracks); for(int i=0;i<nTracks;i++) PointedSlat[i]=0; for(int ntr=0;ntr<nTracks;ntr++){ BrGlbTrack* d2Track = (BrGlbTrack*) tracks->At(ntr); BrMatchedTrack* matchTrack= (BrMatchedTrack*) d2Track->GetMatchedTrack(); // Fix me - have geometry in DB or files. // These coordinates are in the D1 local system (and approximate) // BrDetectorTrack* t1Trk = matchTrack->GetFrontTrack(); Double_t momentum = matchTrack->GetMomentum(); BrLine3D gTrkLine = fTpm1Volume->LocalToGlobal(t1Trk->GetTrackLine()); BrVector3D gtrackPosition = tMrsFPlane.GetIntersectionWithLine(gTrkLine); BrVector3D plen = gtrackPosition-gTrkLine.GetOrigin(); AddLength[ntr]=plen.Norm(); BrVector3D trackPosition; fTMrsFVolume->GlobalToLocal(gtrackPosition, trackPosition,0); // Found projected track to TMRSF plane // Now compare and see if a match is found in 'Slat pos' and 'Time i.e. y // if(HistOn()) fhProjectedPosition->Fill(trackPosition(0),trackPosition(1)); if(tmrsf->GetStatus()){ float x = trackPosition(0)- tmrsf->GetXpos(); float y = trackPosition(1)- tmrsf->GetYpos(); if(HistOn()){ fhXYDiff->Fill(x,y); fhXXDiff->Fill(trackPosition(0),tmrsf->GetXpos()); fhYDiff->Fill(tmrsf->GetYpos()); fhXSlatDiff->Fill(trackPosition(0)-tmrsf->GetXpos()); fhXSlat->Fill(trackPosition(0)); if(TMath::Abs(x-fXoffset)<fDx && TMath::Abs(y-fYoffset)<fDy) fhAcpXSlat->Fill(trackPosition(0)); } // // performe the matching check. // if(TMath::Abs(x-fXoffset)<fDx && TMath::Abs(y-fYoffset)<fDy){ PointedSlat[ntr]=1; continue; } } } // end track loop // // Insert Check for Double Hits either tracks and or from Possible loops for double Hits... // BrDataTable* tab = new BrDataTable("MrsFMatch","rdo"); Int_t nmatch=0; for(int ntr=0;ntr<nTracks;ntr++){ BrGlbTrack* d2Track = (BrGlbTrack*) tracks->At(ntr); if(PointedSlat[ntr]>0){ BrTMrsFTrackMatch * obj = new BrTMrsFTrackMatch(); obj->SetMatching(d2Track->GetTrackId(), tmrsf->GetTime(), AddLength[ntr]); tab->Add(obj); if(Verbose()>10) obj->Print(); nmatch++; } } if(tab->GetEntries()) outNode->AddDataTable(tab); else delete tab; } //____________________________________________________________________ void BrTMrsFMatchingModule::End() { // Run-level finalisation SetState(kEnd); } //____________________________________________________________________ void BrTMrsFMatchingModule::Finish() { // Job-level finalisation SetState(kFinish); } //____________________________________________________________________ void BrTMrsFMatchingModule::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: Flemming Videbaek" << endl << " Last Modifications: " << endl << " $Author: videbaek $" << endl << " $Date: 2002/06/07 16:23:58 $" << endl << " $Revision: 1.1 $ " << endl << endl << "-------------------------------------------------" << endl; } //____________________________________________________________________ // // $Log: BrTMrsFMatchingModule.cxx,v $ // Revision 1.1 2002/06/07 16:23:58 videbaek // Add TMrsfMatching module to repository. // This is used for matching of Mrs tarcks to the triggerslat hits // // // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|