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

DmxStatus.cxx

Go to the documentation of this file.
00001 
00002 //$Id: DmxStatus.cxx,v 1.51 2004/11/01 20:12:03 brebel Exp $
00003 //
00004 //DmxStatus.cxx
00005 //
00006 //DmxStatus is the class that sorts digits into plane objects and 
00007 //keeps track of all the info about an event you want to stick
00008 //around - ie TObjArray of planes, vertex and end planes, etc
00009 //
00010 //Author:  B. Rebel 10/2001
00012 
00013 #include "DeMux/DmxStatus.h"
00014 #include "MessageService/MsgService.h"
00015 #include "Navigation/NavKey.h"
00016 #include "Navigation/NavSet.h"
00017 #include "DeMux/DmxShowerPlane.h"
00018 #include "DeMux/DmxMuonPlane.h"
00019 #include "TMath.h"
00020 #include "Conventions/Munits.h"
00021 #include "Conventions/PlaneView.h"
00022 #include "Conventions/StripEnd.h"
00023 
00024 ClassImp(DmxStatus)
00025 //______________________________________________________________________
00026 CVSID("$Id: DmxStatus.cxx,v 1.51 2004/11/01 20:12:03 brebel Exp $");
00027 
00028 //---------------------------------------------------------------------
00029 DmxStatus::DmxStatus() :
00030   fAverageTimingOffset(-5.),
00031   fEndPlaneNumber(500),
00032   fEventDeMuxed(true),
00033   fEventDirection(1),
00034   fEventNumber(-1000),
00035   fFigureOfMeritFailure(false),
00036   fMultiple(false),
00037   fNonPhysicalFailure(false),
00038   fNumberOfPlanes(0),
00039   fUChiSq(0.),
00040   fUIntercept(0.),
00041   fUSlope(0.),
00042   fUSlopeRMS(0.),
00043   fUStrayPlanes(0),
00044   fUOverlappingMultiple(false),
00045   fUValidPlanes(0),
00046   fVChiSq(0.),
00047   fVIntercept(0.),
00048   fVSlope(0.),
00049   fVSlopeRMS(0.),
00050   fVStrayPlanes(0),
00051   fVOverlappingMultiple(false),
00052   fVValidPlanes(0),
00053   fValidPlanesFailure(false),
00054   fVertexPlaneFailure(false),
00055   fPlaneArray(0)
00056 {
00057 
00058 }
00059 
00060 //-----------------------------------------------------------------------
00061 DmxStatus::~DmxStatus()
00062 {
00063   if (fPlaneArray) {
00064     fPlaneArray->Delete();
00065     delete fPlaneArray;
00066     fPlaneArray = 0;
00067   }
00068   MSG("Dmx", Msg::kDebug) << "deleting DmxStatus object " << endl;
00069 }
00070 
00071 //-----------------------------------------------------------------------
00072 Float_t DmxStatus::GetAverageTimingOffset() const
00073 {
00074   return fAverageTimingOffset;
00075 }
00076 
00077 //-----------------------------------------------------------------------
00078 Int_t DmxStatus::GetEndPlaneNumber() const
00079 {
00080   return fEndPlaneNumber;
00081 }
00082 
00083 //-----------------------------------------------------------------------
00084 Bool_t DmxStatus::GetEventDeMuxed() const
00085 {
00086   return fEventDeMuxed;
00087 }
00088 
00089 //-----------------------------------------------------------------------
00090 Int_t DmxStatus::GetEventDirection() const
00091 {
00092   return fEventDirection;
00093 }
00094 
00095 //-----------------------------------------------------------------------
00096 Int_t DmxStatus::GetEventNumber() const
00097 {
00098   return fEventNumber;
00099 }
00100 
00101 //-----------------------------------------------------------------------
00102 Bool_t DmxStatus::GetMultipleMuon() const
00103 {
00104   return fMultiple;
00105 }
00106 
00107 //-----------------------------------------------------------------------
00108 Float_t DmxStatus::GetUMuonMatedFraction() const
00109 {
00110         return fUMuonMatedFraction;
00111 }
00112 
00113 //-----------------------------------------------------------------------
00114 Float_t DmxStatus::GetVMuonMatedFraction() const
00115 {
00116         return fVMuonMatedFraction;
00117 }
00118 
00119 //-----------------------------------------------------------------------
00120 Int_t DmxStatus::GetMuonStartPlaneNumber() const
00121 {
00122         return fMuonStartPlaneNumber;
00123 }
00124 
00125 //-----------------------------------------------------------------------
00126 Int_t DmxStatus::GetNumberOfPlanes() const
00127 {
00128   return fNumberOfPlanes;
00129 }
00130 
00131 //-----------------------------------------------------------------------
00132 const TObjArray  *DmxStatus::GetPlaneArray() const
00133 {
00134   return fPlaneArray;
00135 }
00136 
00137 //-----------------------------------------------------------------------
00138 Float_t DmxStatus::GetUShowerMatedFraction() const
00139 {
00140         return fUShowerMatedFraction;
00141 }
00142 
00143 //-----------------------------------------------------------------------
00144 Float_t DmxStatus::GetVShowerMatedFraction() const
00145 {
00146         return fVShowerMatedFraction;
00147 }
00148 
00149 //-----------------------------------------------------------------------
00150 Int_t DmxStatus::GetVertexPlaneNumber() const
00151 {
00152   return fVertexPlaneNumber;
00153 }
00154 
00155 //-----------------------------------------------------------------------
00156 Float_t DmxStatus::GetVertexZPosition() const
00157 {
00158   return fVertexZPosition;
00159 }
00160 
00161 //-----------------------------------------------------------------------
00162 Bool_t DmxStatus::GetNonPhysicalFailure() const
00163 {
00164   return fNonPhysicalFailure;
00165 }
00166 
00167 //-----------------------------------------------------------------------
00168 Bool_t DmxStatus::GetValidPlanesFailure() const
00169 {
00170   return fValidPlanesFailure;
00171 }
00172 
00173 //-----------------------------------------------------------------------
00174 Bool_t DmxStatus::GetVertexPlaneFailure() const
00175 {
00176   return fVertexPlaneFailure;
00177 }
00178 
00179 //-----------------------------------------------------------------------
00180 Bool_t DmxStatus::GetFigureOfMeritFailure() const
00181 {
00182   return fFigureOfMeritFailure;
00183 }
00184 
00185 //-----------------------------------------------------------------------
00186 Double_t DmxStatus::GetUTrackChiSq() const
00187 {
00188   return fUChiSq;
00189 }
00190 
00191 //-----------------------------------------------------------------------
00192 Double_t DmxStatus::GetVTrackChiSq() const
00193 {
00194   return fVChiSq;
00195 }
00196 
00197 //-----------------------------------------------------------------------
00198 Int_t DmxStatus::GetUValidPlanes() const
00199 {
00200   return fUValidPlanes;
00201 }
00202 
00203 //-----------------------------------------------------------------------
00204 Int_t DmxStatus::GetUStrayPlanes() const
00205 {
00206   return fUStrayPlanes;
00207 }
00208 
00209 //-----------------------------------------------------------------------
00210 Bool_t DmxStatus::GetUOverlappingMultiple() const
00211 {
00212   return fUOverlappingMultiple;
00213 }
00214 
00215 //-----------------------------------------------------------------------
00216 Int_t DmxStatus::GetVValidPlanes() const
00217 {
00218   return fVValidPlanes;
00219 }
00220 
00221 //-----------------------------------------------------------------------
00222 Int_t DmxStatus::GetVStrayPlanes() const
00223 {
00224   return fVStrayPlanes;
00225 }
00226 
00227 //-----------------------------------------------------------------------
00228 Bool_t DmxStatus::GetVOverlappingMultiple() const
00229 {
00230   return fVOverlappingMultiple;
00231 }
00232 
00233 //-----------------------------------------------------------------------
00234 Double_t DmxStatus::GetUSlopeRMS() const
00235 {
00236   return fUSlopeRMS;
00237 }
00238 
00239 //-----------------------------------------------------------------------
00240 Double_t DmxStatus::GetVSlopeRMS() const
00241 {
00242   return fVSlopeRMS;
00243 }
00244 
00245 //-----------------------------------------------------------------------
00246 Double_t DmxStatus::GetUTrackSlope() const
00247 {
00248   return fUSlope;
00249 }
00250 
00251 //-----------------------------------------------------------------------
00252 Double_t DmxStatus::GetVTrackSlope() const
00253 {
00254   return fVSlope;
00255 }
00256 
00257 //-----------------------------------------------------------------------
00258 Double_t DmxStatus::GetUTrackIntercept() const
00259 {
00260   return fUIntercept;
00261 }
00262 
00263 //-----------------------------------------------------------------------
00264 Double_t DmxStatus::GetVTrackIntercept() const
00265 {
00266   return fVIntercept;
00267 }
00268 
00269 //-----------------------------------------------------------------------
00270 Float_t DmxStatus::GetUTrackStrip(Int_t planeNumber) const
00271 {
00272   //MSG("Dmx", Msg::kInfo)<< planeNumber << "\t" 
00273   //            << fUIntercept << "\t" << fUSlope << "\t";
00274   return (fUIntercept + (fUSlope * planeNumber));
00275 }
00276 
00277 //-----------------------------------------------------------------------
00278 Float_t DmxStatus::GetVTrackStrip(Int_t planeNumber) const
00279 {
00280   return (fVIntercept + (fVSlope * planeNumber));
00281 }
00282  
00283 //-----------------------------------------------------------------------
00284 void DmxStatus::ClearPlaneArray()
00285 {
00286   if(fPlaneArray){
00287     if(fPlaneArray->GetEntries()>0)fPlaneArray->Delete();
00288     delete fPlaneArray;
00289     fPlaneArray = 0;
00290     //fPlaneArray = new TObjArray();
00291   }
00292   return;
00293 }
00294 
00295 //---------------------------------------------------------------------
00296 void DmxStatus::SetAverageTimingOffset(Float_t offset)
00297 {
00298   fAverageTimingOffset = offset;
00299   return;
00300 }
00301 
00302 //---------------------------------------------------------------------
00303 void DmxStatus::SetPlaneArray(TObjArray *array)
00304 {
00305   if(array) fPlaneArray = array;
00306   else 
00307     MSG("DmxStatus", Msg::kWarning) << "tried to set plane array with zeroed pointer" << endl;
00308   return;
00309 }
00310 
00311 //----------------------------------------------------------------------
00312 void DmxStatus::SetUMuonMatedFraction(Float_t fraction)
00313 {
00314         fUMuonMatedFraction = fraction;
00315         return;
00316 }
00317 
00318 //----------------------------------------------------------------------
00319 void DmxStatus::SetVMuonMatedFraction(Float_t fraction)
00320 {
00321         fVMuonMatedFraction = fraction;
00322         return;
00323 }
00324 
00325 //----------------------------------------------------------------------
00326 void DmxStatus::SetUShowerMatedFraction(Float_t fraction)
00327 {
00328         fUShowerMatedFraction = fraction;
00329         return;
00330 }
00331 
00332 //----------------------------------------------------------------------
00333 void DmxStatus::SetVShowerMatedFraction(Float_t fraction)
00334 {
00335         fVShowerMatedFraction = fraction;
00336         return;
00337 }
00338 
00339 //----------------------------------------------------------------------
00340 void DmxStatus::SetMultipleMuon(bool multiple)
00341 {
00342   fMultiple = multiple;
00343   return;
00344 }
00345 
00346 //-----------------------------------------------------------------------
00347 void DmxStatus::SetUTrackVariables(Double_t a, Double_t b, Double_t chiSq)
00348 {
00349   fUSlope = b;
00350   fUIntercept = a;
00351   fUChiSq = chiSq;
00352   //MSG("Dmx", Msg::kInfo)<< "U View\t" << fUIntercept << "\t" << fUSlope << endl;
00353   return;
00354 }
00355 
00356 //-----------------------------------------------------------------------
00357 void DmxStatus::SetVTrackVariables(Double_t a, Double_t b, Double_t chiSq)
00358 {
00359   fVSlope = b;
00360   fVIntercept = a;
00361   fVChiSq = chiSq;
00362   //MSG("Dmx", Msg::kInfo)<< "V View\t" << fVIntercept << "\t" << fVSlope << endl;
00363   return;
00364 }
00365 
00366 //-----------------------------------------------------------------------
00367 void DmxStatus::SetEventDeMuxed(Bool_t demux)
00368 {
00369   fEventDeMuxed = demux;
00370   if( demux ){
00371     fNonPhysicalFailure = false;
00372     fValidPlanesFailure = false;
00373     fVertexPlaneFailure = false;
00374     fFigureOfMeritFailure = false;
00375   }
00376   return;
00377 }
00378 
00379 //-----------------------------------------------------------------------
00380 void DmxStatus::ResetStatus()
00381 {
00382   SetEventDeMuxed(true);
00383   SetVOverlappingMultiple(false);
00384   SetUOverlappingMultiple(false);
00385   SetMultipleMuon(false);
00386   ClearPlaneArray();
00387 }
00388 
00389 //-----------------------------------------------------------------------
00390 void DmxStatus::SetEventDirection(Int_t direction)
00391 {
00392   if(direction == 1 || direction == -1)fEventDirection = direction;
00393   return;
00394 }
00395 
00396 //-----------------------------------------------------------------------
00397 void DmxStatus::SetEventNumber(Int_t num)
00398 {
00399   fEventNumber = num;
00400   return;
00401 }
00402 
00403 //-----------------------------------------------------------------------
00404 void DmxStatus::SetNumberOfPlanes(Int_t num)
00405 {
00406   fNumberOfPlanes = num;
00407   return;
00408 }
00409 
00410 //-----------------------------------------------------------------------
00411 void DmxStatus::SetVertexPlaneNumber(Int_t vertex)
00412 {
00413   fVertexPlaneNumber = vertex;
00414   return;
00415 }
00416 
00417 //-----------------------------------------------------------------------
00418 void DmxStatus::SetVertexPlaneZPosition(Float_t vertexZ)
00419 {
00420   fVertexZPosition = vertexZ;
00421   return;
00422 }
00423 
00424 //-----------------------------------------------------------------------
00425 void DmxStatus::SetEndPlaneNumber(Int_t endPlane)
00426 {
00427   fEndPlaneNumber = endPlane;
00428   return;
00429 }
00430 
00431 //-----------------------------------------------------------------------
00432 void DmxStatus::SetMuonStartPlaneNumber(Int_t muonPlane)
00433 {
00434   fMuonStartPlaneNumber = muonPlane;
00435   return;
00436 }
00437 
00438 //-----------------------------------------------------------------------
00439 void DmxStatus::SetUValidPlanes(Int_t planes)
00440 {
00441   fUValidPlanes = planes;
00442   return;
00443 }
00444 
00445 //-----------------------------------------------------------------------
00446 void DmxStatus::SetUStrayPlanes(Int_t planes)
00447 {
00448   fUStrayPlanes = planes;
00449   return;
00450 }
00451 
00452 //-----------------------------------------------------------------------
00453 void DmxStatus::SetUOverlappingMultiple(Bool_t overlap)
00454 {
00455   fUOverlappingMultiple = overlap;
00456   return;
00457 }
00458 
00459 //-----------------------------------------------------------------------
00460 void DmxStatus::SetUSlopeRMS(Double_t rms)
00461 {
00462   fUSlopeRMS = rms;
00463   return;
00464 }
00465 
00466 //-----------------------------------------------------------------------
00467 void DmxStatus::SetVValidPlanes(Int_t planes)
00468 {
00469   fVValidPlanes = planes;
00470   return;
00471 }
00472 
00473 //-----------------------------------------------------------------------
00474 void DmxStatus::SetVStrayPlanes(Int_t planes)
00475 {
00476   fVStrayPlanes = planes;
00477   return;
00478 }
00479 
00480 //-----------------------------------------------------------------------
00481 void DmxStatus::SetVOverlappingMultiple(Bool_t overlap)
00482 {
00483   fVOverlappingMultiple = overlap;
00484   return;
00485 }
00486 
00487 //-----------------------------------------------------------------------
00488 void DmxStatus::SetVSlopeRMS(Double_t rms)
00489 {
00490   fVSlopeRMS = rms;
00491   return;
00492 }
00493 
00494 //----------------------------------------------------------------------
00495 //this method checks to see if the event fails because it has too many
00496 //planes reconstructed to places other than one of the 3 best hypotheses
00497 //it uses a hough transform to test whether the event is a multiple that
00498 //has the muons going through the same part of the detector in z
00499 void  DmxStatus::SetFigureOfMerit(Int_t validPlanes, Int_t strayPlanes)
00500 { 
00501   Float_t strayFrac = 0.;
00502 
00503   //only set it if the previoius view didnt already - ie it is false
00504   if( !fFigureOfMeritFailure ){
00505     if(validPlanes>0) strayFrac = (1.*strayPlanes)/(1.*validPlanes);
00506     
00507     //the commented lines are a less restrictive figure of merit
00508     
00509 //     if(strayFrac>=0.45){
00510 //       fFigureOfMeritFailure = true;
00511 //     }
00512 //     else if( strayFrac>=0.3333 && validPlanes>=10){
00513 //       fFigureOfMeritFailure = true;
00514 //     }
00515 //     else if( strayFrac>=0.25 && validPlanes>=20){
00516 //       fFigureOfMeritFailure = true;
00517 //     }
00518 //     else if( strayFrac>=0.2 && validPlanes>=30){
00519 //       fFigureOfMeritFailure = true;
00520 //     }
00521 //     else if( strayFrac>=0.15 && validPlanes>=40){
00522 //       fFigureOfMeritFailure = true;
00523 //     }
00524 //     else if( strayFrac>=0.1 && validPlanes>=50){
00525 //       fFigureOfMeritFailure = true;
00526 //     }
00527 
00528     //the following is a more restrictive figure of merit test
00529     if(strayFrac>=0.45){
00530       fFigureOfMeritFailure = true;
00531     }
00532     else if( strayPlanes>=3 && validPlanes<20){
00533       fFigureOfMeritFailure = true;
00534     }
00535     else if( strayPlanes>=4 && validPlanes>=20 && validPlanes<40){
00536       fFigureOfMeritFailure = true;
00537     }
00538     else if( strayFrac>=0.1 && validPlanes>=40){
00539       fFigureOfMeritFailure = true;
00540     }
00541      
00542   }//end if fom already set
00543   return;
00544 }
00545 
00546 //-----------------------------------------------------------------------
00547 void DmxStatus::SetNonPhysicalFailure(Bool_t demux)
00548 {
00549   if( demux ){fEventDeMuxed = false;}
00550   else if(!demux && !fValidPlanesFailure && !fVertexPlaneFailure){ fEventDeMuxed = true; }
00551   fNonPhysicalFailure = demux;
00552   return;
00553 }
00554 
00555 //-----------------------------------------------------------------------
00556 void DmxStatus::SetValidPlanesFailure(Bool_t demux)
00557 {
00558   if( demux ){fEventDeMuxed = false;}
00559   else if(!demux && !fNonPhysicalFailure && !fVertexPlaneFailure){ fEventDeMuxed = true; }
00560   fValidPlanesFailure = demux;
00561   return;
00562 }
00563 
00564 //-----------------------------------------------------------------------
00565 void DmxStatus::SetNoVertexFailure(Bool_t demux)
00566 {
00567   if( demux ){fEventDeMuxed = false;}
00568   else if(!demux && !fNonPhysicalFailure && !fValidPlanesFailure){ fEventDeMuxed = true; }
00569   fVertexPlaneFailure = demux;
00570   return;
00571 }
00572 
00573 
00574 

Generated on Mon Feb 15 11:06:38 2010 for loon by  doxygen 1.3.9.1