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

DmxShowerPlane.cxx

Go to the documentation of this file.
00001 
00002 //$Id: DmxShowerPlane.cxx,v 1.77 2007/11/11 07:36:22 rhatcher Exp $
00003 //
00004 //DmxShowerPlane.cxx
00005 //
00006 //DmxShowerPlane owns a container of DmxHypothesis objects.  It finds
00007 //the best hypothesis and second best hypothesis based on the 
00008 //DmxStatistic goodness of fit.
00009 //
00010 //Author:  B. Rebel 6/2000
00012 
00013 #include "DeMux/DmxShowerPlane.h"
00014 #include "DeMux/DmxHypothesis.h"
00015 #include "MessageService/MsgService.h"
00016 #include "Navigation/NavKey.h"
00017 #include "Navigation/NavSet.h"
00018 #include "MINF_Classes/MINFast.h"
00019 #include "Conventions/PlaneView.h"
00020 #include "UgliGeometry/UgliStripHandle.h"
00021 #include "UgliGeometry/UgliScintPlnHandle.h"
00022 #include "Plex/PlexStripEndId.h"
00023 #include "Algorithm/AlgConfig.h"
00024 #include "TMath.h"
00025 
00026 XXXITRIMP(TObject)
00027 
00028 //a NavKey to select only valid DmxHypothesis objects
00029 static NavKey KeyValidHypo( const DmxHypothesis *hypo){
00030   //return hypo->IsValid() == Bool_t::kTrue;
00031   return (Int_t)hypo->IsValid() == 1;
00032 }
00033 
00034 //a NavKey to sort DmxHypothesis objects
00035 static NavKey KeyStat( const DmxHypothesis *hypo){
00036   return hypo->GetStat();
00037 }
00038 
00039 ClassImp(DmxShowerPlane)
00040 
00041 //______________________________________________________________________
00042 CVSID("$Id: DmxShowerPlane.cxx,v 1.77 2007/11/11 07:36:22 rhatcher Exp $");
00043 
00044 //----------------------------------------------------------------------
00045 DmxShowerPlane::DmxShowerPlane() :
00046   fBestHypo(0),
00047   fHypothesisArray(0),
00048   fSecondBestHypo(0),
00049   fSetHypo(0),
00050   fThirdBestHypo(0),
00051   fUgh(0)
00052 {
00053 }
00054 
00055 //----------------------------------------------------------------------
00056 //this constructor uses the TObjectItr and a NavKey selection funciton to
00057 //loop over only the valid hypotheses
00058 DmxShowerPlane::DmxShowerPlane(AlgConfig &acd, CandDeMuxDigitHandleItr &cdhitr, 
00059                                                            Int_t planeNumber) :
00060   fBestCoG(0.),
00061   fBestHypo(0),
00062   fCoG(0.),
00063   fCompare(0),
00064   fHypothesisArray(new TObjArray(acd.GetInt("NumberOfHypotheses"), 0)),
00065   fIsValid(false), 
00066   fIsStray(false), 
00067   fIsGolden(false),
00068   fNumberOfHypotheses(acd.GetInt("NumberOfHypotheses")), 
00069   fNumberOfStrips(0),
00070   fPlaneCharge(0.),
00071   fPlaneNumber(planeNumber),
00072   fPlaneType(DmxPlaneTypes::kShower),
00073   fPlaneView(PlaneView::kUnknown),
00074   fSecondBestCoG(0.),
00075   fSecondBestHypo(0),
00076   fSetHypo(0),
00077   fThirdBestCoG(0.),
00078   fThirdBestHypo(0),
00079   fStripsSet(0),
00080   fUgh(0)
00081 {
00082           //use the AlgConfig object to find the number of hypotheses needed and build
00083           //the TObjArray to hold them
00084 
00085           Int_t hypothesisSize = acd.GetInt("HypothesisSize");
00086 
00087           //get the ugli geometry handle from a cand digit
00088           fUgh = new UgliGeomHandle(*cdhitr.Ptr()->GetVldContext());
00089 
00090           Int_t lowerStrip = 0;
00091           Int_t upperStrip = 0;
00092           for(Int_t i = 0; i < fNumberOfHypotheses; i++){
00093                   lowerStrip = i;
00094                   upperStrip = i + (hypothesisSize - 1);
00095                   fHypothesisArray->AddAt(new DmxHypothesis(acd, cdhitr, lowerStrip, upperStrip), lowerStrip);
00096           }
00097 
00098           //set the comparison flag using the AlgConfigDeMux file.  1  = compare for largest value
00099           //0 = compare for smallest value
00100 
00101           //create a DmxHypothesisItr over the hypotheses
00102           DmxHypothesisItr hypoItr(fHypothesisArray);
00103   
00104           fCompare = hypoItr.Ptr()->GetCompareFlag();
00105 
00106           //create a KeyFunc to sort hypotheses by lower bound
00107           DmxHypothesisKeyFunc *hypStatKF = hypoItr.CreateKeyFunc();
00108       
00109           //program the KeyFunc with the sort function
00110           hypStatKF->SetFun(KeyStat);
00111 
00112           //get the NavSet from the iterator and pass the KeyFunc to it
00113           hypoItr.GetSet()->AdoptSortKeyFunc(hypStatKF);
00114   
00115           //clear the KF pointer because we no longer own the KeyFunc
00116 
00117           hypStatKF = 0;
00118     
00119           //program a new KF to select the valid hypotheses
00120           DmxHypothesisKeyFunc *validKF = hypoItr.CreateKeyFunc();
00121    
00122           //program the KF
00123           validKF->SetFun(KeyValidHypo);
00124  
00125           //adopt it as a selection function
00126           hypoItr.GetSet()->AdoptSelectKeyFunc(validKF);
00127           validKF = 0;
00128   
00129           //set the iterator to the best statistic valid hypo
00130           hypoItr.ResetLast();
00131           fBestHypo = dynamic_cast<DmxHypothesis *>(hypoItr.Ptr());
00132           fSecondBestHypo = dynamic_cast<DmxHypothesis *>(hypoItr.Ptr());
00133           fThirdBestHypo = dynamic_cast<DmxHypothesis *>(hypoItr.Ptr());
00134  
00135           //loop over all valid hypotheses
00136 
00137           DmxHypothesis *hypo = 0;
00138 
00139           //MSG("Dmx", Msg::kDebug) << "Start Comparison for best Hypothesis" << endl;
00140           hypoItr.ResetFirst();
00141 
00142           if( hypoItr.SizeSelect() > 1 ){
00143 
00144                   fIsValid = true;
00145 
00146                   for(Int_t i = 1; i < 4; i++){
00147 
00148                           //loop over the valid hypotheses and set the 3 best
00149                           while( (hypo = hypoItr()) ){
00150       
00151                                   //get the hypotheses from the TObjArray of Hypothesis Objects
00152                                   //they all should be valid because we are using the selection key on 
00153                                   //IsValid()
00154         
00155                                   //figure out the most strips that can be used in this plane
00156                                   if(hypo->GetNumberOfStripsUsed()>fNumberOfStrips) 
00157                                           fNumberOfStrips = hypo->GetNumberOfStripsUsed();
00158                                                         
00159                                   if( i == 1 && CompareHypotheses(hypo, fBestHypo) == DmxCompareTypes::kBetter ){
00160                                           fBestHypo = hypo;
00161                                   }
00162                                   else if( i == 2 && CompareHypotheses(hypo, fBestHypo) == DmxCompareTypes::kWorse 
00163                                                    && CompareHypotheses(hypo, fSecondBestHypo) == DmxCompareTypes::kBetter){
00164                                           fSecondBestHypo = hypo;
00165                                   }
00166                                   else if( i == 3 && CompareHypotheses(hypo, fSecondBestHypo) == DmxCompareTypes::kWorse 
00167                                                    && CompareHypotheses(hypo, fThirdBestHypo) == DmxCompareTypes::kBetter){
00168                                           fThirdBestHypo = hypo;
00169                                   }
00170                 
00171                           }//end while iterator is valid
00172                           hypoItr.ResetFirst();
00173                   }//end loops to find best 3 hyps
00174           }//end if more than one valid hypothesis
00175           else if(hypoItr.SizeSelect() == 1){
00176     
00177                   //only 1 valid hypothesis, set the three best to it
00178                   fBestHypo = hypoItr.Ptr();
00179                   fSecondBestHypo = hypoItr.Ptr();
00180                   fThirdBestHypo = hypoItr.Ptr();
00181 
00182                   //check to see if this is a golden plane - since all of the best hypotheses are 
00183                   //the same, the best just has to have over 90% of its signal mated
00184                   if(fBestHypo->GetMatedSignalRatio()>=0.9){
00185                           fIsGolden = true;
00186                           SetStrips("best");
00187                   }
00188   
00189           } //end if only one valid hypothesis in the plane
00190  
00191           if(hypoItr.SizeSelect() == 2){
00192                   //only 2 valid hypotheses, set the third best to be the same as the second best
00193                   fThirdBestHypo = fSecondBestHypo;
00194   
00195                   //check to see if this is a golden plane
00196                   //there are two ways: 
00197                   //1) the best hypothesis has more than 90% of signal nated and the second best
00198                   //best has more than 10% less than the best. 
00199                   //2) the best hypothesis has more than 90% of signal mated and second best hypothesis 
00200                   //has less than 10% less than the best, but their cogs are less than 3 strips
00201                   //apart.
00202                   //Otherwise, it is not a golden plane - you dont know which one is correct.  
00203                   //because the third best is the second best, dont worry about it.
00204 
00205                   if(fBestHypo->GetMatedSignalRatio()>=0.9 
00206                          && fSecondBestHypo->GetMatedSignalRatio()<0.8){
00207                           fIsGolden = true;
00208                           SetStrips("best");
00209                   }
00210                   else if(fBestHypo->GetMatedSignalRatio()>=0.9 
00211                                   && TMath::Abs(fBestHypo->GetCoG()-fSecondBestHypo->GetCoG())<3.){
00212                           fIsGolden = true;
00213                           SetStrips("best");
00214                   }
00215         }//end if only 2 valid hypotheses
00216         else if(hypoItr.SizeSelect() >= 3){
00217 
00218                 //check to see if this is a golden plane
00219                 //there are two ways: 
00220                 //1) the best hypothesis has more than 90% of signal nated and the second best
00221                 //best and third best both have more than 10% less than the best. 
00222                 //2) the best hypothesis has more than 90% of signal mated and second and third best hypotheses 
00223                 //have less than 10% less than the best, but their cogs are less than 3 strips
00224                 //apart from the best.
00225                 //Otherwise, it is not a golden plane - you dont know which one is correct.  
00226                 //because the third best is the second best, dont worry about it.
00227 
00228                 if(fBestHypo->GetMatedSignalRatio()>=0.9 
00229                         && fSecondBestHypo->GetMatedSignalRatio()<0.8
00230                         && fThirdBestHypo->GetMatedSignalRatio()<0.8){
00231                         fIsGolden = true;
00232                         SetStrips("best");
00233                 }
00234                 else if(fBestHypo->GetMatedSignalRatio()>=0.9 
00235                                 && TMath::Abs(fBestHypo->GetCoG()-fSecondBestHypo->GetCoG())<3.
00236                                 && TMath::Abs(fBestHypo->GetCoG()-fThirdBestHypo->GetCoG())<3.){
00237                         fIsGolden = true;
00238                         SetStrips("best");
00239                 }
00240                 else if(fBestHypo->GetMatedSignalRatio()>=0.9 
00241                                 && fSecondBestHypo->GetMatedSignalRatio()>=0.8
00242                                 && TMath::Abs(fBestHypo->GetCoG()-fSecondBestHypo->GetCoG())<3.
00243                                 && fThirdBestHypo->GetMatedSignalRatio()<0.8){
00244                         fIsGolden = true;
00245                         SetStrips("best");
00246                 }
00247                 else if(fBestHypo->GetMatedSignalRatio()>=0.9 
00248                                 && fSecondBestHypo->GetMatedSignalRatio()<0.8
00249                                 && fThirdBestHypo->GetMatedSignalRatio()>=0.8
00250                                 && TMath::Abs(fBestHypo->GetCoG()-fThirdBestHypo->GetCoG())<3.){
00251                         fIsGolden = true;
00252                         SetStrips("best");
00253                 }
00254     
00255                 //check to see if two of the hypotheses are much better than the third.
00256                 //only have to look at the fThirdBestHypo because if the best hypo was 
00257                 //much better than the second and third best, this would be a golden plane
00258                 //if so, then set the third best hypo to the second best hypo
00259                 if(fBestHypo->GetMatedSignalRatio()-fThirdBestHypo->GetMatedSignalRatio()>0.2
00260                         &&fSecondBestHypo->GetMatedSignalRatio()-fThirdBestHypo->GetMatedSignalRatio()>0.2)
00261                         fThirdBestHypo = fSecondBestHypo;
00262 
00263         }//end if more than three hypotheses, test for golden plane status
00264 
00265         //clear the selection function
00266         hypoItr.GetSet()->AdoptSelectKeyFunc(0);
00267   
00268         //get the total charge in the plane
00269         cdhitr.Reset();  
00270         fPlaneView = cdhitr.Ptr()->GetPlexSEIdAltL().GetPlaneView();
00271         while(cdhitr.IsValid()){
00272                 if(cdhitr.Ptr()->GetDeMuxDigitFlagWord() == 0) fPlaneCharge += cdhitr.Ptr()->GetCharge();
00273                 MSG("DmxShower", Msg::kDebug) << "plane = " << cdhitr.Ptr()->GetPlexSEIdAltL().GetPlane()
00274                                                                          << " digit charge = " << cdhitr.Ptr()->GetCharge() << endl;
00275                 cdhitr.Next();
00276         }
00277   
00278         //set the cog to the best cog for now
00279         if(fBestHypo && !fIsGolden) SetStrips("best");
00280         //MSG("DmxShower", Msg::kDebug) << "plane " << fPlaneNumber << " is golden " << (Int_t)fIsGolden << endl;
00281         return;
00282 }
00283 
00284 //----------------------------------------------------------------------
00285 DmxShowerPlane::~DmxShowerPlane()
00286 {
00287   fHypothesisArray->Delete();
00288   delete fHypothesisArray;
00289   delete fUgh;
00290   //MSG("Dmx", Msg::kDebug) << "deleting Shower Plane for plane " 
00291   //              << fPlaneNumber << endl;
00292 }
00293 
00294 //----------------------------------------------------------------------
00295 Int_t DmxShowerPlane::GetNumberOfStrips() const
00296 {       
00297         return fNumberOfStrips;
00298 }
00299 //----------------------------------------------------------------------
00300 DmxHypothesis *DmxShowerPlane::GetBestHypothesis()
00301 {
00302     return fBestHypo;
00303 }
00304 
00305 //----------------------------------------------------------------------
00306 Float_t DmxShowerPlane::GetCoG() const
00307 {
00308   //get the strip end id for the center of gravity for this hypothesis
00309   PlexStripEndId seid(Detector::kFar,fPlaneNumber,TMath::Nint(fCoG));
00310   UgliStripHandle ush = fUgh->GetStripHandle(seid);
00311 
00312   return ush.GetTPos();
00313   //return fCoG;
00314 }
00315 
00316 //----------------------------------------------------------------------
00317 Float_t DmxShowerPlane::GetStripCoG() const
00318 {
00319   return fCoG;
00320 }
00321 
00322 //----------------------------------------------------------------------
00323 Float_t DmxShowerPlane::GetHypothesisCoG(Int_t hypoLowerBound)
00324 {
00325         Float_t hypCoG = dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypoLowerBound))->GetCoG();
00326         
00327         //get the strip end id for the center of gravity for this hypothesis
00328         PlexStripEndId seid(Detector::kFar,fPlaneNumber,TMath::Nint(hypCoG));
00329         UgliStripHandle ush = fUgh->GetStripHandle(seid);
00330         
00331         return ush.GetTPos();           
00332 }
00333 
00334 //----------------------------------------------------------------------
00335 DmxHypothesis *DmxShowerPlane::GetHypothesis(Int_t hypoLowerBound)
00336 {
00337     return dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypoLowerBound));
00338 }
00339 
00340 //----------------------------------------------------------------------
00341 DmxHypothesis *DmxShowerPlane::GetSecondBestHypothesis()
00342 {
00343   return fSecondBestHypo;
00344 }
00345 
00346 //----------------------------------------------------------------------
00347 DmxHypothesis *DmxShowerPlane::GetSetHypothesis()
00348 {
00349   return fSetHypo;
00350 }
00351 
00352 //----------------------------------------------------------------------
00353 DmxHypothesis *DmxShowerPlane::GetThirdBestHypothesis()
00354 {
00355   return fThirdBestHypo;
00356 }
00357 
00358 //----------------------------------------------------------------------
00359 Float_t DmxShowerPlane::GetBestCoG() const
00360 {
00361   //get the strip end id for the center of gravity for this hypothesis
00362   PlexStripEndId seid(Detector::kFar,fPlaneNumber,TMath::Nint(fBestHypo->GetCoG()));
00363   UgliStripHandle ush = fUgh->GetStripHandle(seid);
00364 
00365   return ush.GetTPos();
00366   //return fBestHypo->GetCoG();
00367 }
00368 
00369 //----------------------------------------------------------------------
00370 Float_t DmxShowerPlane::GetSecondBestCoG() const 
00371 {
00372   //get the strip end id for the center of gravity for this hypothesis
00373   PlexStripEndId seid(Detector::kFar,fPlaneNumber,TMath::Nint(fSecondBestHypo->GetCoG()));
00374   UgliStripHandle ush = fUgh->GetStripHandle(seid);
00375 
00376   return ush.GetTPos();
00377   //return fSecondBestHypo->GetCoG();
00378 }
00379 
00380 //----------------------------------------------------------------------
00381 Float_t DmxShowerPlane::GetThirdBestCoG() const 
00382 {
00383   //get the strip end id for the center of gravity for this hypothesis
00384   PlexStripEndId seid(Detector::kFar,fPlaneNumber,TMath::Nint(fThirdBestHypo->GetCoG()));
00385   UgliStripHandle ush = fUgh->GetStripHandle(seid);
00386 
00387   return ush.GetTPos();
00388   //return fThirdBestHypo->GetCoG();
00389 }
00390 
00391 //----------------------------------------------------------------------
00392 Bool_t DmxShowerPlane::GetStripsSetFlag() const
00393 {
00394   return fStripsSet == 1;
00395 }
00396 
00397 //----------------------------------------------------------------------
00398 Bool_t DmxShowerPlane::IsValid() const
00399 {
00400   return fIsValid;
00401 }
00402 
00403 //----------------------------------------------------------------------
00404 Bool_t DmxShowerPlane::IsStray() const
00405 {
00406   return fIsStray;
00407 }
00408 
00409 //----------------------------------------------------------------------
00410 Bool_t DmxShowerPlane::IsGolden() const
00411 {
00412   return fIsGolden;
00413 }
00414 
00415 //----------------------------------------------------------------------
00416 DmxCompareTypes::CompareType_t DmxShowerPlane::CompareHypotheses(DmxHypothesis *hypo1, DmxHypothesis *hypo2)
00417 {
00418   //when fCompare = 0, look for the lower value of the statistic
00419   //when fCompare = 1, look for the higher value of the statistic
00420   //Compare() returns a DmxCompareType
00421   
00422   DmxCompareTypes::CompareType_t stat = DmxCompareTypes::kWorse;
00423   
00424   //only compare the TieBreakers because you have already sorted the hypotheses by statistic value
00425   if(fCompare == 0){ 
00426     if(hypo1->GetStat() < hypo2->GetStat()) stat = DmxCompareTypes::kBetter;
00427     else if( hypo1->GetStat() == hypo2->GetStat() ){
00428       if( hypo1->GetTieBreakerStat() < hypo2->GetTieBreakerStat() )  stat = DmxCompareTypes::kBetter; 
00429       else if( hypo1->GetTieBreakerStat() == hypo2->GetTieBreakerStat() ) stat = DmxCompareTypes::kSame;
00430     }    
00431   }
00432   else if(fCompare == 1){ 
00433     if(hypo1->GetStat() > hypo2->GetStat()) stat = DmxCompareTypes::kBetter;
00434     else if( hypo1->GetStat() == hypo2->GetStat() ){
00435       if( hypo1->GetTieBreakerStat() > hypo2->GetTieBreakerStat() )  stat = DmxCompareTypes::kBetter; 
00436       else if( hypo1->GetTieBreakerStat() == hypo2->GetTieBreakerStat() ) stat = DmxCompareTypes::kSame;
00437     }
00438   }
00439   return stat;
00440 }
00441 
00442 //----------------------------------------------------------------------
00443 void DmxShowerPlane::SetStrips()
00444 {
00445   if(fBestHypo) SetStrips("best");
00446 //   else MSG("DMX", Msg::kWarning)<<"no best hypothesis, strips not set"<<endl;
00447   return;
00448 }
00449 
00450 //----------------------------------------------------------------------
00451 //the option determines which of the 3 best choice hypotheses to use. if
00452 //"best" use the best, "second" the second best, "third", the third best
00453 void DmxShowerPlane::SetStrips(const Char_t *option)
00454 {
00455   fStripsSet = 1;
00456   Int_t hypLowerBound = 0;
00457   Float_t fitCoG = 0.;
00458   //set the strips to the hypothesis centered about the CoG for whichever 
00459   //of the top three is chosen
00460   if(strcmp(option, "best") == 0 && fBestHypo) fitCoG = fBestHypo->GetCoG();
00461   else if(strcmp(option, "second") == 0 && fSecondBestHypo) fitCoG = fSecondBestHypo->GetCoG();
00462   else if(strcmp(option, "third") == 0 && fThirdBestHypo) fitCoG = fThirdBestHypo->GetCoG();
00463 
00464   if(fitCoG >= 11.5 && fitCoG <= 179.5){hypLowerBound = TMath::Nint(fitCoG-11.5);}
00465   else if(fitCoG < 11.5){hypLowerBound = 0;}
00466   else if(fitCoG > 179.5){hypLowerBound = 168;}
00467 
00468   if(hypLowerBound <= fNumberOfHypotheses){
00469     dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypLowerBound))->SetStrips(); 
00470     fCoG = dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypLowerBound))->GetCoG();
00471     fSetHypo = dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypLowerBound));
00472   }
00473   else{ 
00474 //     MSG("Dmx", Msg::kWarning) << "chosen hypothesis does not exist," 
00475 //                            << " attempt to set strips failed" << endl;
00476     fSetHypo = 0;
00477   }
00478   return;
00479 }
00480 
00481 //----------------------------------------------------------------------
00482 Int_t DmxShowerPlane::GetHypothesisLowerBound(Float_t tPos) const
00483 {
00484   //change the transverse position for the fit into a strip number
00485   PlexStripEndId seid(Detector::kFar, fPlaneNumber, 1);
00486   UgliScintPlnHandle usph = fUgh->GetScintPlnHandle(seid);
00487   UgliStripHandle ush = usph.GetClosestStrip(tPos);
00488   Float_t fitCoG = 1.*ush.GetSEId().GetStrip();
00489   
00490   Int_t hypLowerBound = 0;
00491   if(fitCoG >= 11.5 && fitCoG <= 179.5){hypLowerBound = TMath::Nint(fitCoG-11.5);}
00492   else if(fitCoG < 11.5){hypLowerBound = 0;}
00493   else if(fitCoG > 179.5){hypLowerBound = 168;}
00494   
00495   return hypLowerBound;
00496 }
00497 
00498 //----------------------------------------------------------------------
00499 void DmxShowerPlane::SetStrips(Float_t tPos)
00500 {
00501 
00502   //change the transverse position for the fit into a strip number
00503   PlexStripEndId seid(Detector::kFar, fPlaneNumber, 1);
00504   UgliScintPlnHandle usph = fUgh->GetScintPlnHandle(seid);
00505   UgliStripHandle ush = usph.GetClosestStrip(tPos);
00506   Float_t fitCoG = 1.*ush.GetSEId().GetStrip();
00507   
00508   //Float_t fitCoG = tPos;
00509   //MSG("DMXX", Msg::kDebug) << "\tfit in strip vs plane space " << fPlaneNumber << "\t" << fitCoG << endl; 
00510   //MSG("DMXX", Msg::kDebug) << "\tfit in tpos vs z space " << GetZPosition() << "\t" << tPos << endl; 
00511 
00512   Int_t hypLowerBound = 0;
00513   if(fitCoG >= 11.5 && fitCoG <= 179.5){hypLowerBound = TMath::Nint(fitCoG-11.5);}
00514   else if(fitCoG < 11.5){hypLowerBound = 0;}
00515   else if(fitCoG > 179.5){hypLowerBound = 168;}
00516   
00517   fStripsSet = 1;
00518   
00519   if(hypLowerBound <= fNumberOfHypotheses){
00520     dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypLowerBound))->SetStrips(); 
00521     fCoG = dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypLowerBound))->GetCoG();
00522     fSetHypo = dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypLowerBound));
00523   }
00524   else{ 
00525 //     MSG("Dmx", Msg::kWarning) << "chosen hypothesis does not exist," 
00526 //                            << " attempt to set strips failed" << endl;
00527     fSetHypo = 0;
00528   }
00529   return;
00530 }
00531 
00532 //----------------------------------------------------------------------
00533 Float_t DmxShowerPlane::GetPlaneCharge() const
00534 {
00535   return fPlaneCharge;
00536 }
00537 
00538 //----------------------------------------------------------------------
00539 Int_t DmxShowerPlane::GetPlaneNumber() const
00540 {
00541   return fPlaneNumber;
00542 }
00543 
00544 //----------------------------------------------------------------------
00545 Float_t DmxShowerPlane::GetTimingOffset()
00546 {
00547   if(fSetHypo){
00548     return fSetHypo->GetTimingOffset(fUgh);
00549   }
00550 //   else MSG("DmxShower", Msg::kWarning) << "no set hypothesis in plane " 
00551 //                                     << fPlaneNumber << endl;
00552   
00553   return -10.;
00554 }
00555 
00556 //----------------------------------------------------------------------
00557 Float_t DmxShowerPlane::GetZPosition() const
00558 {
00559   PlexStripEndId seid(Detector::kFar, fPlaneNumber, 1);
00560   UgliScintPlnHandle usph = fUgh->GetScintPlnHandle(seid);
00561   return usph.GetZ0();
00562   //return 1.*fPlaneNumber;
00563 }
00564 
00565 //----------------------------------------------------------------------
00566 DmxPlaneTypes::PlaneType_t DmxShowerPlane::GetPlaneType() const 
00567 {
00568   return fPlaneType;
00569 }
00570 
00571 //----------------------------------------------------------------------
00572 PlaneView::PlaneView_t DmxShowerPlane::GetPlaneView() const
00573 {
00574   return fPlaneView;
00575 }
00576 
00577 //-----------------------------------------------------------------------
00578 void DmxShowerPlane::PrintRecon()
00579 {
00580   MSG("Dmx", Msg::kInfo) << "Plane = " << fPlaneNumber 
00581                          << "\tIsValid = " << fIsValid << endl;
00582   fSetHypo->PrintRecon();
00583 }
00584 
00585 //-----------------------------------------------------------------------
00586 void DmxShowerPlane::PrintRecon(Int_t hypoLowerBound)
00587 {
00588   MSG("DMX", Msg::kInfo) << "Plane\t" << fPlaneNumber << endl;
00589   dynamic_cast<DmxHypothesis *>(fHypothesisArray->At(hypoLowerBound))->PrintRecon();
00590 }
00591 
00592 //----------------------------------------------------------------------
00593 //if the argument is 0, the set falg is unset, if it is 1, the flag is set
00594 void DmxShowerPlane::SetStripsSetFlag(Int_t flag)
00595 {
00596   if(flag == 0 || flag == 1){fStripsSet = flag;}
00597   else MSG("Dmx", Msg::kError) << "input flag value is not an option" << endl;
00598 }
00599 
00600 //----------------------------------------------------------------------
00601 void DmxShowerPlane::SetStray(bool stray)
00602 {
00603   fIsStray = stray;
00604   return;
00605 }
00606 
00607 //----------------------------------------------------------------------
00608 void DmxShowerPlane::SetGolden(bool golden)
00609 {
00610   fIsGolden = golden;
00611   return;
00612 }
00613 
00614 
00615 
00616 

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