Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

StopMuFinderFar.cxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include <list>
00009 #include <cmath>
00010 
00011 #include "UgliGeometry/UgliGeomHandle.h"
00012 #include "MessageService/MsgService.h"
00013 #include "MinosObjectMap/MomNavigator.h"
00014 #include "CandData/CandRecord.h"
00015 #include "CandData/CandHeader.h"
00016 #include "RecoBase/CandFitTrackListHandle.h"
00017 #include "RecoBase/CandFitTrackHandle.h"
00018 #include "DataUtil/GetCandidate.h"
00019 #include "DataUtil/GetCandHeader.h"
00020 #include "DataUtil/CDL2STL.h"
00021 
00022 #include "StopMuFinderFactory.h"
00023 #include "StopMuFinderFar.h"
00024 
00025 CVSID("$Id: StopMuFinderFar.cxx,v 1.3 2007/02/04 05:49:29 rhatcher Exp $");
00026 
00027 using std::list;
00028 using std::string;
00029 using DataUtil::GetCandidate;
00030 using DataUtil::GetCandHeader;
00031 using DataUtil::CDL2STLlist;
00032 
00034 static const string STOP_MU_FINDER_FAR = "StopMuFinderFar";
00035 
00039 namespace {
00040 
00042     StopMuFinder* CreateSMF() { return new StopMuFinderFar; }
00043 
00045     bool registered = StopMuFinderFactory::Instance().
00046             RegisterStopMuFinder(STOP_MU_FINDER_FAR, CreateSMF);
00047 
00048 } // namespace 
00049 
00050 
00052 StopMuFinderFar::StopMuFinderFar()
00053 {
00054     MSG("StopMuFilter",Msg::kDebug) 
00055         << "StopMuFinderFar::StopMuFinderFar()" 
00056         << endl;
00057 
00058     DefaultConfig();
00059 } // StopMuFinderFar::StopMuFinderFar() 
00060 
00061 
00062 
00064 void StopMuFinderFar::DefaultConfig(void)
00065 {
00066     MSG("StopMuFilter",Msg::kDebug)
00067         << "StopMuFinderFar::DefaultConfig()"
00068         << endl;
00069 
00070     fMinZDistance   =       0.5;
00071     fMinRadius      =       0.5;
00072     fMaxRadius      =       3.5;
00073     fMinNPlanes     =       10;
00074 }
00075 
00076 
00077 
00079 void StopMuFinderFar::Configure(const Registry & registry)
00080 {
00081     MSG("StopMuFilter",Msg::kDebug)
00082         << "StopMuFinderFar::Configure(const Registry &)"
00083         << endl;
00084 
00085     if ( registry.KeyExists("CandTrackList") ) {
00086         fCandTrackListName = std::string(registry.GetCharString("CandTrackList"));
00087     }
00088     if ( registry.KeyExists("MinZDistance") &&
00089             registry.GetType("MinZDistance") == typeid(Double_t) ) {
00090         fMinZDistance = registry.GetDouble("MinZDistance");
00091     }
00092     if ( registry.KeyExists("MinRadius") &&
00093             registry.GetType("MinRadius") == typeid(Double_t) ) {
00094         fMinRadius = registry.GetDouble("MinRadius");
00095     }
00096     if ( registry.KeyExists("MaxRadius") &&
00097             registry.GetType("MaxRadius") == typeid(Double_t) ) {
00098         fMaxRadius = registry.GetDouble("MaxRadius");
00099     }
00100     if ( registry.KeyExists("MinNPlanes") &&
00101             registry.GetType("MinNPlanes") == typeid(Int_t) ) {
00102         fMinNPlanes = registry.GetInt("MinNPlanes");
00103     }
00104 }
00105 
00106 
00107 
00109 Bool_t StopMuFinderFar::IsStopping(const MomNavigator* mom)
00110 {
00111     MSG("StopMuFilter",Msg::kDebug)
00112         << "StopMuFinderFar::IsStopping(const MomNavigator*)"
00113         << endl;
00114 
00115     // get CandFitTrackList
00116     const CandFitTrackListHandle* candFitTrackList =
00117         GetCandidate<CandFitTrackListHandle> (mom, fCandTrackListName.c_str());
00118 
00119     // no candidate list found
00120     if ( !candFitTrackList ) return kFALSE;
00121 
00122     // set Z extent
00123     // doing it every event makes filter slow, so
00124     // instead do it once and save in static variables
00125     static Bool_t   zExtentSet  = kFALSE;
00126     static Double_t zMinSM1     = 0.;
00127     static Double_t zMaxSM1     = 0.;
00128     static Double_t zMinSM2     = 0.;
00129     static Double_t zMaxSM2     = 0.;
00130 
00131     static const Int_t Sm1 = 0;    // due to some bizarro convention id of SM1 is "0"
00132     static const Int_t Sm2 = 1;    // and id of SM2 is "1"
00133 
00134     if ( ! zExtentSet ) {
00135         // Get CandRecord from mom
00136         const CandHeader* candHeader = GetCandHeader ( mom );
00137         if ( !candHeader ) {
00138             MSG("StopMuFinderFar",Msg::kDebug)
00139                 << "No CandHeader!!" << endl;
00140             return kFALSE;
00141         }
00142 
00143         const VldContext vldc = candHeader->GetVldContext();
00144 
00145         UgliGeomHandle ugh(vldc);
00146 
00147         ugh.GetZExtent(zMinSM1, zMaxSM1, Sm1);
00148         ugh.GetZExtent(zMinSM2, zMaxSM2, Sm2);
00149 
00150         zExtentSet = kTRUE;
00151     }
00152 
00153     typedef list<const CandFitTrackHandle*> FitTrackList;
00154     typedef list<const CandFitTrackHandle*>::const_iterator FitTrackListItor;
00155 
00156     // Convert daughter list to STL
00157     FitTrackList candFitTrackListSTL =
00158         CDL2STLlist<CandFitTrackHandle>(*candFitTrackList);
00159 
00160     // for now only look at events with only one track
00161     if ( candFitTrackListSTL.empty() ) return kFALSE;
00162 
00163     const CandFitTrackHandle* pcfth = *candFitTrackListSTL.begin();
00164 
00165     // check number of planes
00166     if ( pcfth->GetNPlane() < fMinNPlanes ) return kFALSE;
00167 
00168     // get track end coord's
00169     Double_t endu = pcfth->GetEndU();
00170     Double_t endv = pcfth->GetEndV();
00171     Double_t endz = pcfth->GetEndZ();
00172 
00173     // check endtrack position along Z axis
00174     if ( endz<(zMinSM1+fMinZDistance) ||
00175         ( endz>(zMaxSM1-fMinZDistance) && endz<(zMinSM2+fMinZDistance) ) ||
00176         endz>(zMaxSM2-fMinZDistance) ) return kFALSE;
00177 
00178     // check against radius
00179     Double_t radius = sqrt(endu*endu + endv*endv);
00180     if ( radius<fMinRadius || radius>fMaxRadius ) return kFALSE;
00181 
00182     return kTRUE;
00183 } // void StopMuFinderFar::IsStopping(const MomNavigator* mom)
00184 
00185 
00186 
00188 StopMuFinderFar::~StopMuFinderFar()
00189 {
00190     MSG("StopMuFilter",Msg::kDebug)
00191         << "StopMuFinderFar::~StopMuFinderFar()"
00192         << endl;
00193 } // StopMuFinderFar::~StopMuFinderFar()

Generated on Mon Feb 15 11:07:40 2010 for loon by  doxygen 1.3.9.1