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

AlgAltDeMuxBase Class Reference

#include <AlgAltDeMuxBase.h>

Inheritance diagram for AlgAltDeMuxBase:

AlgBase AlgAltDeMux List of all members.

Public Member Functions

 AlgAltDeMuxBase ()
 AlgAltDeMuxBase (const char *name)
virtual ~AlgAltDeMuxBase ()
virtual void Trace (const char *c) const
virtual void RunAlg (AlgConfig &acd, CandHandle &ch, CandContext &cx)
void Initialize (const char *name)

Protected Member Functions

void Setup ()
void SetConstants (const VldContext *vldc)
void StripNoise ()
void ClearArrays ()
void MakePixelMap (CandDigitListHandle &cdlh)
void DisplayPixelMap ()
void MakeAltListMap (CandDigitListHandle &cdlh)
void ReTagCrossTalk (CandDeMuxDigitListHandle &cdlh)
void FinalReTagCrossTalk (CandDeMuxDigitListHandle &cdlh)
void StripCrossTalk (CandDeMuxDigitListHandle &cdlh)
void StripCrossTalkSingles (CandDeMuxDigitListHandle &cdlh)
void TagCrossTalk (CandDeMuxDigitListHandle &cdlh)
void ReBuildXTalkMap ()
void GetFibreLengths ()
void ResetTimingMask ()
void MakeTimingMask (bool useMask)
void ReMakeTimingMask (bool useMask)
void ReMakeMask ()
bool RemoveSingle (Int_t iplane, PlexSEIdAltL *paltlist)
void DeMuxPass (Int_t ipass)
void DeMuxWhatsLeft ()
void MakeMaskGroups ()
void MakePlaneMap (Int_t iplane, bool useTargets=false)
void MakePlaneMap (DeMuxSearchTactic)
void GroupHits ()
bool SelectHits (Int_t iplane, bool makeGold, bool useGold=false)
bool SelectHits (Int_t iplane, DeMuxSearchTactic)
void GoldHits (Int_t iplane, Int_t istrip)
void DeMuxHits (Int_t iplane, Int_t ie, Int_t iw, Int_t is)
void DeMuxHits (Int_t iplane, PlexSEIdAltL *pAltE, PlexSEIdAltL *pAltW, Int_t is)
void DeMuxHitE (Int_t iplane, PlexSEIdAltL *pAlt, Int_t is)
void DeMuxHitW (Int_t iplane, PlexSEIdAltL *pAlt, Int_t is)
void VetoHitE (Int_t iplane, PlexSEIdAltL *pAlt)
void VetoHitW (Int_t iplane, PlexSEIdAltL *pAlt)
void DeMuxSingleHitE (Int_t iplane, PlexSEIdAltL *pAlt, Int_t is)
void DeMuxSingleHitW (Int_t iplane, PlexSEIdAltL *pAlt, Int_t is)
void DeMuxHitE (Int_t iplane, Int_t ie, Int_t is)
void DeMuxHitW (Int_t iplane, Int_t iw, Int_t is)
Int_t DeMuxBigGroup (Int_t iplane, Int_t ig, bool gold)
void DeMuxSingles (DeMuxSearchTactic tactic)
void ReMuxPlane (Int_t iplane)
void ReMuxPlane (Int_t iplane, std::vector< Int_t > stripPattern)
void ReMuxSingleSidedPlane (Int_t iplane, std::vector< Int_t > stripPattern)
void CleanMultiple ()
void CleanIsolatedHits ()
bool ValidatePlane (Int_t iplane, bool useTimeMask=false)
bool ValidateBeamPlane (Int_t iplane, bool useTimeMask=false)
bool ValidatePlaneAgainstTarget (Int_t iplane, Int_t targetStrip)
bool DumpValidateBeamPlane (Int_t iplane, bool useTimeMask=false)
bool ValidateMultipleMuonPlane (Int_t iplane)
bool BestGuessForPlane (Int_t iplane, bool doSingleSided=true)
bool BestGuessForSingleSidedHits (Int_t iplane)
bool BestGuessForView (PlaneView::PlaneView_t kView)
bool ValidateContainedCandidateEndPlanes ()
bool ValidateCCEndPlanes ()
bool ValidateContainedCandidateEndPlane (Int_t iplane)
PlaneValidity_t ValidatePlaneForPattern (Int_t iplane, std::vector< Int_t >stripPattern)
PlaneValidity_t ValidateOneSidedPlaneForPattern (Int_t iplane, std::vector< Int_t > stripPattern)
bool ValidityComp (PlaneValidity_t currentValidity, PlaneValidity_t newValidity, int ish, int ist, bool onesided)
DeMuxEventType_t EventID ()
Float_t DistanceToNearestInPlane (PlexSEIdAltL *paltlist)
void MakeSearchTactics ()
void MakeSearchTacticsX ()
void MakeSearchTacticsY ()
DeMuxSearchTactic MakeSearchTactics (Int_t iplane)
void NewTactic (DeMuxSearchTactic oldTactic)
void MakeMultipleTargets (Int_t iplane)
void AddBackCrossTalk ()
void AddBackNoise ()
void Hough ()
void FitAsCosmic (bool useSingles=false)
void SearchAndDestroy ()
DeMuxFitResult_t LinearFit (std::vector< DeMuxFitData_t > &data, Float_t refitDistance=-999.)
void CreateDiagnosticCanvas ()
void ClearDiagnosticHistos ()
void DrawDiagnosticPlots (Int_t ipass)
void PrintWhatRemains ()
void PrintXTalk ()
void PrintNoise ()
void MakeFitPolyLines (DeMuxFitResult_t result, TPolyLine *&pPolyLine1, TPolyLine *&pPolyLine2, Int_t color=4, Int_t style=1)
bool MaskExtrapolateForwards (int i, int imm, int im)
bool MaskExtrapolateBack (int i, int ip, int ipp)
bool MaskInterpolate (int i, int im, int ip)
void SetMask (int ip, int is)
void FillLowestHighest ()
void ResetMap (Int_t ne, Int_t nw)
void PrintMap (Int_t ne, Int_t nw)
Float_t XTalkCharge (PlexSEIdAltL *paltlist, Int_t istrip)
Float_t XTalkPixelMap (PlexSEIdAltL *paltlist)
Float_t PredictedSpotQ (PlexSEIdAltL *paltlist)
bool IsXTalk (PlexSEIdAltL *paltlist, bool useBest=false)
bool RemoveFromPlanesList (Int_t iplane, Int_t iew, PlexSEIdAltL *paltlist)
void TidyUp ()
void UpdateXTalkMap (PlexSEIdAltL *paltlist)

Protected Attributes

UgliGeomHandlepUgh
Int_t _pixelToVaChannel [16]
Float_t _pixelSpotXTalkMap [9][9]
PlaneView::PlaneView_t fUVMap [MAX_NUMBER_OF_PLANES]
Int_t _nDeMuxedPlanesU
Int_t _nDeMuxedPlanesV
Int_t _nHitPlanesU
Int_t _nHitPlanesV
bool fUseHoughSlope
bool fUseFitSlopeTime
bool fUseFitSlopeHits
bool fUseInterpolation
bool fUseSafeExtrapolationF
bool fUseSafeExtrapolationB
bool fUseExtrapolationF
bool fUseExtrapolationB
bool fUseSameStrip
bool fUseLevelStripF
bool fUseLevelStripB
Float_t fXTalkFraction
Float_t fXTalk1PEFraction
Float_t fXTalk2PEFraction
Float_t fXTalk5PEFraction
Float_t fNoiseTimeWindow
Int_t fTimingMaskWindow
Int_t fStripWindow
Float_t fSigmasForTimingWindow
Float_t fTrackingLowPECut
Float_t fCutRawPE
Float_t fCutCorPE
Float_t fCutSigmaQ
bool fCutUseTimingMask
bool fCutUseMultipleLines
bool fCutUseTargetStrips
bool fCutGuessing
bool fDiagnosticPlots
DeMuxEventType_t fEventType
bool fHoughStatus
bool fFitHStatus
bool fFitTStatus
Float_t fHoughSlopeU
Float_t fHoughSlopeV
DeMuxFitResult_t fFitTimeU
DeMuxFitResult_t fFitTimeV
DeMuxFitResult_t fFitHitU
DeMuxFitResult_t fFitHitV
DeMuxFitResult_t fFitQHitU
DeMuxFitResult_t fFitQHitV
bool fFitTStatusU
bool fFitTStatusV
bool fFitHStatusU
bool fFitHStatusV
Float_t fFitTSlopeU
Float_t fFitTSlopeV
Float_t fFitHSlopeU
Float_t fFitHSlopeV
Float_t fFitTIntU
Float_t fFitTIntV
Float_t fFitHIntU
Float_t fFitHIntV
Int_t fUniqueDeMuxedGroupID
std::vector< Float_t > multipleMuonInterceptsU
std::vector< Float_t > multipleMuonInterceptsV
bool amWriting
bool amShowing
bool amPSing
bool amHisting
bool amDrawing
Int_t fCCHighestPlane
Int_t fCCNearestPlane
Int_t fHighestPlane
Int_t fLowestPlane
Int_t fHighestDeMuxedPairPlane
Int_t fLowestDeMuxedPairPlane

Private Attributes

AltDeMuxPatternMasterpMaster
AltDeMuxCalcpCalculator
std::vector< PlexSEIdAltL * > fPlanesAltLists [MAX_NUMBER_OF_PLANES][2]
std::vector< PlexSEIdAltL * > fDeMuxedPlanesAltLists [MAX_NUMBER_OF_PLANES][2]
std::vector< PlexSEIdAltL * > fXTalkPlanesAltLists [MAX_NUMBER_OF_PLANES][2]
std::vector< PlexSEIdAltL * > fNoisePlanesAltLists [MAX_NUMBER_OF_PLANES][2]
std::vector< DeMuxedPairfDeMuxedPairs [MAX_NUMBER_OF_PLANES]
std::vector< DeMuxedSinglefDeMuxedSingles [MAX_NUMBER_OF_PLANES]
std::vector< DeMuxSearchTacticfSearchTactics
std::vector< DeMuxMaskGroupfMaskGroup [MAX_NUMBER_OF_PLANES]
std::vector< Int_t > fTargets
std::vector< Float_t > fTimeList
Float_t fPMTmap [MAX_NUMBER_OF_PMTS][16]
Float_t fXTalkmap [MAX_NUMBER_OF_PMTS][16]
Float_t fVAmap [MAX_NUMBER_OF_PMTS][22]
Float_t fPMTtot [MAX_NUMBER_OF_PMTS]
Double_t fAbsTime
bool _smask [MAX_NUMBER_OF_STRIPS]
bool fUVmask [MAX_NUMBER_OF_PLANES][MAX_NUMBER_OF_STRIPS]
Int_t fInMask [MAX_NUMBER_OF_PLANES]
bool fTimingMask [MAX_NUMBER_OF_PLANES][MAX_NUMBER_OF_STRIPS]
Int_t fNGroups
Int_t fNInGroupE [100]
Int_t fNInGroupW [100]
Int_t fEGroup [100][100]
Int_t fWGroup [100][100]
bool fEFound [100]
bool fWFound [100]
Int_t fWCount
Int_t fECount
std::vector< int > fTargetStrips
Int_t fGoldPlaneHit [MAX_NUMBER_OF_PLANES]
Int_t fGoldHitMap [MAX_NUMBER_OF_PLANES][100]
Int_t fPlaneHit [MAX_NUMBER_OF_PLANES]
Int_t fPlanePair [MAX_NUMBER_OF_PLANES]
int fHitMap [MAX_NUMBER_OF_PLANES][100]
float fQHitMapE [MAX_NUMBER_OF_PLANES][100]
float fQHitMapW [MAX_NUMBER_OF_PLANES][100]
bool fSearched [MAX_NUMBER_OF_PLANES]
string diagnosticCanvastitle
bool diagnosticCanvas
Int_t NdemuxedHitsU [MAX_NUMBER_OF_PLANES]
Float_t demuxedHitStripU [MAX_NUMBER_OF_PLANES][MAX_DISPLAYED_HITS]
Float_t demuxedHitQU [MAX_NUMBER_OF_PLANES][MAX_DISPLAYED_HITS]
Int_t NdemuxedHitsV [MAX_NUMBER_OF_PLANES]
Float_t demuxedHitStripV [MAX_NUMBER_OF_PLANES][MAX_DISPLAYED_HITS]
Float_t demuxedHitQV [MAX_NUMBER_OF_PLANES][MAX_DISPLAYED_HITS]
TList * fList
Float_t fQTotE [MAX_NUMBER_OF_PLANES]
Float_t fQTotW [MAX_NUMBER_OF_PLANES]
Float_t fQMaxE [MAX_NUMBER_OF_PLANES]
Float_t fQMaxW [MAX_NUMBER_OF_PLANES]
bool fAmap [MAX_HITS_PLANE][MAX_HITS_PLANE]
Int_t fSmap [MAX_HITS_PLANE][MAX_HITS_PLANE]
bool fBmap [MAX_HITS_PLANE][MAX_HITS_PLANE]
PlexSEIdAltLpPlaneAltMapE [MAX_HITS_PLANE]
PlexSEIdAltLpPlaneAltMapW [MAX_HITS_PLANE]
Float_t fClearFibreC
Float_t fWLSFibreC
Float_t fScintillatorC
Float_t fClearFibreN
Float_t fWLSFibreN
Float_t fScintillatorN
Float_t fClearFibreNMC
Float_t fWLSFibreNMC
Float_t fScintillatorNMC
Int_t fNumberOfStrips
Float_t fSigmaTData
Float_t fSigmaTMC
Float_t fSigmaT
Float_t fSigmaStripFromTiming
TCanvas * fCanvas
TPad * fUpad
TPad * fVpad
TH2F * fUview
TH2F * fVview
TH2F * fUTime
TH2F * fVTime
TH2F * fUMask
TH2F * fVMask
TH2F * fHoughU
TH2F * fHoughV
TH1F * fHoughProjU
TH1F * fHoughProjV
TH1F * fHoughSliceU
TH1F * fHoughSliceV
TPolyLine * fUZFitT
TPolyLine * fVZFitT
TPolyLine * fUZFitS
TPolyLine * fVZFitS
TPolyLine * fUZFitTSM1
TPolyLine * fVZFitTSM1
TPolyLine * fUZFitSSM1
TPolyLine * fVZFitSSM1
TPolyLine * fUZFitTSM2
TPolyLine * fVZFitTSM2
TPolyLine * fUZFitSSM2
TPolyLine * fVZFitSSM2
TPolyLine * fUZFitQSSM1
TPolyLine * fVZFitQSSM1
TPolyLine * fUZFitQSSM2
TPolyLine * fVZFitQSSM2

Constructor & Destructor Documentation

AlgAltDeMuxBase::AlgAltDeMuxBase  ) 
 

Definition at line 46 of file AlgAltDeMuxBase.cxx.

References MSG.

00047 {
00048   //default constructor
00049   MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase() Constructor" << endl;
00050 
00051   this->Initialize("");
00052   
00053   MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase Leaving Constructor" << endl;
00054 }

AlgAltDeMuxBase::AlgAltDeMuxBase const char *  name  ) 
 

Definition at line 56 of file AlgAltDeMuxBase.cxx.

References Initialize(), MSG, and name.

00057 {
00058   //default constructor
00059   MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase(name) Constructor" << endl;
00060 
00061   this->Initialize(name);
00062   
00063   MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase Leaving Constructor" << endl;
00064   
00065 }

AlgAltDeMuxBase::~AlgAltDeMuxBase  )  [virtual]
 

Definition at line 287 of file AlgAltDeMuxBase.cxx.

00288 {
00289 
00290 }


Member Function Documentation

void AlgAltDeMuxBase::AddBackCrossTalk  )  [protected]
 

Definition at line 972 of file AlgAltDeMuxBase.cxx.

References fPlanesAltLists, and fXTalkPlanesAltLists.

Referenced by AlgAltDeMux::DeMuxTidyUp().

00973 {
00974 
00975   vector <PlexSEIdAltL*>::iterator literA;
00976 
00977   for(int iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
00978     for(int iew = ALG_EAST; iew<=ALG_WEST; iew++){
00979       if(fXTalkPlanesAltLists[iplane][iew].size()>0){
00980         literA = fXTalkPlanesAltLists[iplane][iew].begin();
00981         while (literA != fXTalkPlanesAltLists[iplane][iew].end()){
00982           fPlanesAltLists[iplane][iew].push_back(*literA);
00983           literA++;
00984         }
00985         fXTalkPlanesAltLists[iplane][iew].erase(fXTalkPlanesAltLists[iplane][iew].begin(),fXTalkPlanesAltLists[iplane][iew].end());
00986       }
00987 
00988     }
00989   }
00990 
00991   return;
00992 
00993 }

void AlgAltDeMuxBase::AddBackNoise  )  [protected]
 

Definition at line 999 of file AlgAltDeMuxBase.cxx.

References fNoisePlanesAltLists, and fPlanesAltLists.

Referenced by AlgAltDeMux::DeMuxTidyUp().

01000 {
01001   vector <PlexSEIdAltL*>::iterator literA;
01002 
01003   for(int iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
01004     for(int iew = ALG_EAST; iew<=ALG_WEST; iew++){
01005       if(fNoisePlanesAltLists[iplane][iew].size()>0){
01006         literA = fNoisePlanesAltLists[iplane][iew].begin();
01007         while (literA != fNoisePlanesAltLists[iplane][iew].end()){
01008           fPlanesAltLists[iplane][iew].push_back(*literA);
01009           literA++;
01010         }
01011         fNoisePlanesAltLists[iplane][iew].erase(fNoisePlanesAltLists[iplane][iew].begin(),fNoisePlanesAltLists[iplane][iew].end());
01012       }
01013 
01014     }
01015   }
01016 
01017   return;
01018 
01019 }

bool AlgAltDeMuxBase::BestGuessForPlane Int_t  iplane,
bool  doSingleSided = true
[protected]
 

Definition at line 3359 of file AlgAltDeMuxBase.cxx.

References PlaneValidity_t::chi2DQ, fDeMuxedPlanesAltLists, fPlaneHit, fPlanesAltLists, PlaneValidity_t::fractionQE, PlaneValidity_t::fractionQW, fUVmask, PlaneValidity_t::largestContigGroup, ReMuxPlane(), ReMuxSingleSidedPlane(), PlaneValidity_t::stripSpan, ValidateOneSidedPlaneForPattern(), and ValidatePlaneForPattern().

Referenced by BestGuessForView().

03359                                                                        {
03360 
03361   if(fPlaneHit[iplane]!=0)return false;
03362 
03363   Int_t easthits = fDeMuxedPlanesAltLists[iplane][ALG_EAST].size()+
03364     fPlanesAltLists[iplane][ALG_EAST].size();
03365   Int_t westhits = fDeMuxedPlanesAltLists[iplane][ALG_WEST].size()+
03366     fPlanesAltLists[iplane][ALG_WEST].size();
03367 
03368   if(fDiagnosticPlots){
03369     if(amWriting)cout << "*****************************************************************  PLANE : " << iplane << endl;
03370     if(amWriting)cout << "ew : " << easthits << ":" << westhits << endl;
03371   }
03372 
03373   bool oneSided = false;
03374   if(easthits==0||westhits==0){
03375     if(easthits>0||westhits>0)oneSided = true;
03376   }
03377 
03378   if(oneSided && !doSingleSided)return false;
03379 
03380   bool returnFlag = false;
03381   bool found = false;
03382 
03383   PlaneValidity_t timeMaskResult;
03384 
03385   Int_t bestMaskStrip=-1;
03386   timeMaskResult.largestContigGroup = -1;
03387 
03388   for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
03389     if(fUVmask[iplane][iStrip]==true){
03390       vector<Int_t>pattern;
03391       if(amWriting)cout << "TIMING MASK : " << iStrip << endl;
03392       pattern.push_back(iStrip);
03393       PlaneValidity_t thisStripResult;
03394       if(!oneSided)thisStripResult = this->ValidatePlaneForPattern(iplane, pattern);
03395       if( oneSided)thisStripResult = this->ValidateOneSidedPlaneForPattern(iplane, pattern);
03396       if(thisStripResult.largestContigGroup>timeMaskResult.largestContigGroup){
03397         timeMaskResult = thisStripResult;
03398         bestMaskStrip = iStrip;
03399       }
03400       if(thisStripResult.largestContigGroup==timeMaskResult.largestContigGroup){
03401         if(oneSided){
03402           if(thisStripResult.stripSpan<=timeMaskResult.stripSpan){
03403             bestMaskStrip = iStrip;
03404             timeMaskResult = thisStripResult;
03405           }
03406         }else{
03407           if( (thisStripResult.fractionQE+thisStripResult.fractionQW)>
03408               (timeMaskResult.fractionQE+timeMaskResult.fractionQW) ){
03409             if(thisStripResult.chi2DQ<timeMaskResult.chi2DQ+10.){
03410               bestMaskStrip = iStrip;
03411               timeMaskResult = thisStripResult;
03412             }
03413           }
03414         }
03415       }
03416     }
03417   }
03418 
03419 
03420   if(timeMaskResult.largestContigGroup>0){
03421     vector<Int_t>pattern;
03422     pattern.push_back(bestMaskStrip);
03423     if(!oneSided)this->ReMuxPlane(iplane, pattern);
03424     if( oneSided){
03425       if(timeMaskResult.largestContigGroup>1){
03426         this->ReMuxSingleSidedPlane(iplane, pattern);
03427       }
03428     }
03429     return true;
03430   }
03431   
03432       
03433   for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
03434     vector<Int_t>pattern;
03435     pattern.push_back(iStrip);
03436     PlaneValidity_t thisStripResult;
03437     if(!oneSided)thisStripResult = this->ValidatePlaneForPattern(iplane, pattern);
03438     if( oneSided)thisStripResult = this->ValidateOneSidedPlaneForPattern(iplane, pattern);
03439     if(thisStripResult.largestContigGroup>timeMaskResult.largestContigGroup){
03440       timeMaskResult = thisStripResult;
03441       bestMaskStrip = iStrip;
03442     }
03443     if(thisStripResult.largestContigGroup==timeMaskResult.largestContigGroup){
03444       if(oneSided){
03445         if(thisStripResult.stripSpan<=timeMaskResult.stripSpan){
03446           bestMaskStrip = iStrip;
03447           timeMaskResult = thisStripResult;
03448         }
03449       }else{
03450         if( (thisStripResult.fractionQE+thisStripResult.fractionQW)>
03451             (timeMaskResult.fractionQE+timeMaskResult.fractionQW) ){
03452           if(thisStripResult.chi2DQ<timeMaskResult.chi2DQ+10.){
03453             bestMaskStrip = iStrip;
03454             timeMaskResult = thisStripResult;
03455           }
03456         }
03457       }
03458     }
03459   }
03460       
03461   returnFlag = found;
03462 
03463   if(timeMaskResult.largestContigGroup>0){
03464     vector<Int_t>pattern;
03465     pattern.push_back(bestMaskStrip);
03466     if(!oneSided)this->ReMuxPlane(iplane, pattern);
03467     if( oneSided){
03468       if(timeMaskResult.largestContigGroup>1){
03469         this->ReMuxSingleSidedPlane(iplane, pattern);
03470       }
03471     }
03472   }
03473   
03474   return returnFlag;
03475 }

bool AlgAltDeMuxBase::BestGuessForSingleSidedHits Int_t  iplane  )  [protected]
 

Definition at line 3482 of file AlgAltDeMuxBase.cxx.

References DeMuxSingleHitE(), DeMuxSingleHitW(), fDeMuxedPlanesAltLists, fPlanesAltLists, fTimingMask, MAX_NUMBER_OF_PLANES, and s().

Referenced by DeMuxWhatsLeft().

03482                                                              {
03483 
03484   vector <PlexSEIdAltL*>::iterator literA;
03485 
03486   //  if(fPlaneHit[iplane]!=0)return false;
03487   
03488   Int_t Nm =0;
03489   Int_t Np =0;
03490   Float_t wm = 0.0;
03491   Float_t wp = 0.0;
03492      
03493   for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
03494     if(iplane>1){
03495       if(fTimingMask[iplane-1][iStrip]){
03496         wm+= iStrip;
03497         Nm++;
03498       }
03499     }
03500     if(iplane<MAX_NUMBER_OF_PLANES-2){
03501       if(fTimingMask[iplane+1][iStrip]){
03502         wp+= iStrip;
03503         Np++;
03504       }
03505     }
03506   }
03507   
03508   Float_t target;
03509   if(Nm==0&&Np==0){
03510     for(Int_t jplane=iplane;jplane<500 && jplane<iplane+11;jplane+=2){
03511       Int_t easthits = fDeMuxedPlanesAltLists[jplane][ALG_EAST].size();
03512       Int_t westhits = fDeMuxedPlanesAltLists[jplane][ALG_WEST].size();
03513       for(Int_t iE=0;iE<easthits;iE++){
03514         wp += fDeMuxedPlanesAltLists[jplane][ALG_EAST][iE]->GetBestSEId().GetStrip();
03515         Np++;
03516       }
03517       for(Int_t iW=0;iW<westhits;iW++){
03518         wp += fDeMuxedPlanesAltLists[jplane][ALG_WEST][iW]->GetBestSEId().GetStrip();
03519         Np++;
03520       }
03521     }
03522 
03523     for(Int_t jplane=iplane-2;jplane>0 && jplane >iplane-11;jplane-=2){
03524       Int_t easthits = fDeMuxedPlanesAltLists[jplane][ALG_EAST].size();
03525       Int_t westhits = fDeMuxedPlanesAltLists[jplane][ALG_WEST].size();
03526       for(Int_t iE=0;iE<easthits;iE++){
03527         wm += fDeMuxedPlanesAltLists[jplane][ALG_EAST][iE]->GetBestSEId().GetStrip();
03528         Nm++;
03529       }
03530       for(Int_t iW=0;iW<westhits;iW++){
03531         wm += fDeMuxedPlanesAltLists[jplane][ALG_WEST][iW]->GetBestSEId().GetStrip();
03532         Nm++;
03533       }
03534     }
03535 
03536 
03537   }
03538   if(Nm==0&&Np==0)return false;
03539 
03540   if(Nm==0&&Np>0)target =  wp/static_cast<Float_t>(Np);
03541   if(Np==0&&Nm>0)target =  wm/static_cast<Float_t>(Nm);
03542   if(Np>0&&Nm>0)target =  (wm/static_cast<Float_t>(Nm) + wp/static_cast<Float_t>(Np))/2.0;
03543 
03544   for(Int_t iew=ALG_EAST;iew<=ALG_WEST;iew++){
03545     if(fPlanesAltLists[iplane][iew].size()>0){
03546       while (fPlanesAltLists[iplane][iew].size()>0){
03547         Int_t sbest =0;
03548         Float_t closeness = 999;
03549         literA = fPlanesAltLists[iplane][iew].begin();
03550         (*literA)->SetFirst();
03551         while( (*literA)->IsValid() ){
03552           Int_t s = (*literA)->GetCurrentSEId().GetStrip();
03553           if(fabs(target-s)<closeness){
03554             closeness = fabs(target-s);
03555             sbest = s;
03556           }                     
03557           (*literA)->Next();
03558         }
03559         if(closeness<999){
03560           if(iew==ALG_EAST)this->DeMuxSingleHitE(iplane,*literA, sbest);
03561           if(iew==ALG_WEST)this->DeMuxSingleHitW(iplane,*literA, sbest);
03562         }
03563       }
03564     }
03565   }
03566   
03567   return true;
03568 }

bool AlgAltDeMuxBase::BestGuessForView PlaneView::PlaneView_t  kView  )  [protected]
 

Definition at line 8254 of file AlgAltDeMuxBase.cxx.

References BestGuessForPlane(), fPlanesAltLists, and fUVMap.

Referenced by AlgAltDeMux::DeMuxGoldenHits().

08254                                                                 {
08255 
08256   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
08257     if(fUVMap[iplane]==kView){
08258       if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
08259         this->BestGuessForPlane(iplane, false);
08260       }
08261     }
08262   }
08263   return true;
08264 }

void AlgAltDeMuxBase::CleanIsolatedHits  )  [protected]
 

Definition at line 7444 of file AlgAltDeMuxBase.cxx.

References abs(), DeMuxHits(), DeMuxSingleHitE(), DeMuxSingleHitW(), fDeMuxedPairs, fDeMuxedPlanesAltLists, fDeMuxedSingles, PlexSEIdAltL::GetBestSEId(), PlexSEIdAltL::GetEnd(), PlexStripEndId::GetStrip(), RemoveSingle(), ReMuxPlane(), s(), and ValidatePlaneAgainstTarget().

Referenced by AlgAltDeMux::DeMuxTidyUp().

07444                                        {
07445  
07446   Int_t easthits;
07447   Int_t westhits;
07448   Int_t ilow;
07449   Int_t ihigh;
07450   Int_t nlow;
07451   Int_t nhigh;
07452   Int_t ilower;
07453   Int_t ihigher;
07454   Int_t nlower;
07455   Int_t nhigher;
07456   Int_t sl;
07457   Int_t sh;
07458   Int_t sll;
07459   Int_t shh;
07460 
07461   Int_t bestdm;
07462   vector<int> stripE;
07463   vector<int> stripW;
07464   PlexSEIdAltL* stripMapE[MAX_NUMBER_OF_STRIPS];
07465   PlexSEIdAltL* stripMapW[MAX_NUMBER_OF_STRIPS];
07466 
07467   int increment = 1;
07468   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES;iplane+=increment){
07469     bool found = false;
07470     for(uint i = 0;!found && i<fDeMuxedSingles[iplane].size();i++){
07471       for(uint j = i+1;!found && j<fDeMuxedSingles[iplane].size();j++){
07472         PlexSEIdAltL* paltListi = fDeMuxedSingles[iplane][i].altList;
07473         PlexSEIdAltL* paltListj = fDeMuxedSingles[iplane][j].altList;
07474         int si = paltListi->GetBestSEId().GetStrip();
07475         int sj = paltListj->GetBestSEId().GetStrip();
07476         if(si==sj){
07477           if(paltListi->GetEnd()==StripEnd::kEast&&
07478              paltListj->GetEnd()==StripEnd::kWest){
07479             found = true;
07480             this->RemoveSingle(iplane, paltListi);
07481             this->RemoveSingle(iplane, paltListj);
07482             this->DeMuxHits(iplane, paltListi, paltListj, si);
07483           }
07484           if(paltListi->GetEnd()==StripEnd::kWest&&
07485              paltListj->GetEnd()==StripEnd::kEast){
07486             found = true;
07487             this->RemoveSingle(iplane, paltListi);
07488             this->RemoveSingle(iplane, paltListj);
07489             this->DeMuxHits(iplane, paltListj, paltListi, si);
07490           }
07491         }
07492       }
07493     }
07494     // loop over plane again if hits removed
07495     increment = 1;
07496     if(found)increment=0;
07497   }
07498   
07499   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES;iplane++){
07500 
07501     easthits = fDeMuxedPlanesAltLists[iplane][ALG_EAST].size();
07502     //     +fPlanesAltLists[iplane][ALG_EAST].size();
07503     westhits = fDeMuxedPlanesAltLists[iplane][ALG_WEST].size();
07504     // +fPlanesAltLists[iplane][ALG_WEST].size();
07505 
07506     if(iplane==248||iplane==250)easthits=0;
07507     if(iplane==248||iplane==250)westhits=0;
07508 
07509 
07510     bool found;
07511     bool possibleDeMuxError=false;
07512     set<int>strips;
07513     Int_t s;
07514 
07515     if(easthits+westhits>0){
07516       stripE.clear();
07517       stripW.clear();
07518       ilow = iplane-2;
07519       ihigh = iplane+2;
07520       nlow = 0;
07521       if(ilow>=0)nlow = fDeMuxedPairs[ilow].size();
07522       if(ihigh<500)nhigh = fDeMuxedPairs[ihigh].size();
07523 
07524       int ntarget=0;
07525       float sumtarget=0;
07526       float sumsqtarget=0;
07527       for(int alg_ew=ALG_EAST;alg_ew<=ALG_WEST;alg_ew++){
07528         for(UInt_t iEW=0;iEW<fDeMuxedPlanesAltLists[iplane][alg_ew].size();iEW++){
07529           s = fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->GetBestSEId().GetStrip();
07530           Float_t diff = 999.;
07531           Float_t diffdm = 999.;
07532           found = false;
07533           if(nlow>0&&nhigh>0){
07534             for(Int_t ilpair=0;!found&&ilpair<nlow;ilpair++){
07535               sl = fDeMuxedPairs[ilow][ilpair].altListE->GetBestSEId().GetStrip();
07536               for(Int_t ihpair=0;!found&&ihpair<nhigh;ihpair++){
07537                 sh = fDeMuxedPairs[ihigh][ihpair].altListE->GetBestSEId().GetStrip();
07538                 Float_t target = (sl+sh)/2.0;
07539                 sumtarget+=target;
07540                 sumsqtarget+=target*target;
07541                 ntarget++;
07542                 Float_t delta = fabs(target-s);
07543                 if(delta<diff)diff=delta;
07544                 Float_t deltadm = fmod(delta+23.5,23.5);
07545                 if(deltadm>50)deltadm=0;
07546                 if(diff<5)found = true;
07547                 if(!found&&deltadm<diffdm){
07548                   fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->SetFirst();
07549                   Float_t del=999; 
07550                   while (fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->IsValid()){
07551                     Int_t sc = fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->GetCurrentSEId().GetStrip();
07552                     if(fabs(sc-target)<del){
07553                       if(abs(sc-sl)<5&&abs(sc-sh)<5){
07554                         diffdm = fabs(sc-target);
07555                         del    = diffdm;
07556                         bestdm = sc;
07557                       }
07558                     }
07559                     fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->Next();
07560                   }
07561                 }
07562               }
07563             }
07564           }
07565           if(nlow>0&&nhigh==0){
07566             ilower = iplane-4;
07567             nlower = 0;
07568             if(ilower>=0)nlower = fDeMuxedPairs[ilower].size();
07569             if(nlower>0){
07570               for(Int_t ilpair=0;!found&&ilpair<nlow;ilpair++){
07571                 sl = fDeMuxedPairs[ilow][ilpair].altListE->GetBestSEId().GetStrip();
07572                 for(Int_t illpair=0;!found&&illpair<nlower;illpair++){
07573                   sll = fDeMuxedPairs[ilower][illpair].altListE->GetBestSEId().GetStrip();
07574                   Float_t target = 2*sl-sll;
07575                   sumtarget+=target;
07576                   sumsqtarget+=target*target;
07577                   ntarget++;
07578                   Float_t delta = fabs(target-s);
07579                   if(delta<diff)diff=delta;
07580                   Float_t deltadm = fmod(delta+23.5,23.5);
07581                   if(deltadm>50)deltadm=0;
07582                   if(diff<5)found = true;
07583                   if(!found&&deltadm<diffdm){
07584                     fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->SetFirst();
07585                     Float_t del=999; 
07586                     while (fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->IsValid()){
07587                       Int_t sc = fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->GetCurrentSEId().GetStrip();
07588                       if(fabs(sc-target)<del){
07589                         if(abs(sc-sl)<4&&abs(sc-sll)<8){
07590                           diffdm = fabs(sc-target);
07591                           del    = diffdm;
07592                           bestdm = sc;
07593                         }
07594                       }
07595                       fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->Next();
07596                     }
07597                   }
07598                 }
07599               }
07600             }
07601           }
07602           if(nhigh>0&&nlow==0){
07603             ihigher = iplane+4;
07604             nhigher = 0;
07605             if(ihigher<=500)nhigher = fDeMuxedPairs[ihigher].size();
07606             if(nhigher>0){
07607               for(Int_t ihpair=0;!found&&ihpair<nhigh;ihpair++){
07608                 sh = fDeMuxedPairs[ihigh][ihpair].altListE->GetBestSEId().GetStrip();
07609                 for(Int_t ihhpair=0;!found&&ihhpair<nhigher;ihhpair++){
07610                   shh = fDeMuxedPairs[ihigher][ihhpair].altListE->GetBestSEId().GetStrip();
07611                   Float_t target = 2*sh-shh;
07612                   sumtarget+=target;
07613                   sumsqtarget+=target*target;
07614                   ntarget++;
07615                   Float_t delta = fabs(target-s);
07616                   if(delta<diff)diff=delta;
07617                   Float_t deltadm = fmod(delta+23.5,23.5);
07618                   if(deltadm>50)deltadm=0;
07619                   if(diff<5)found = true;
07620                   if(!found&&deltadm<diffdm){
07621                     fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->SetFirst();
07622                     Float_t del=999; 
07623                     while (fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->IsValid()){
07624                       Int_t sc = fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->GetCurrentSEId().GetStrip();
07625                       if(fabs(sc-target)<del){
07626                         if(abs(sc-shh)<8&&abs(sc-sh)<4){
07627                           diffdm = fabs(sc-target);
07628                           del    = diffdm;
07629                           bestdm = sc;
07630                         }
07631                       }
07632                       fDeMuxedPlanesAltLists[iplane][alg_ew][iEW]->Next();
07633                     }
07634                   }
07635                 }
07636               }
07637             }
07638           }
07639           if(!found&&diffdm<2.25){
07640             possibleDeMuxError  =true;
07641             if(alg_ew==ALG_EAST)stripE.push_back(bestdm);
07642             if(alg_ew==ALG_WEST)stripW.push_back(bestdm);
07643           }else{
07644             if(alg_ew==ALG_EAST)stripE.push_back(s);
07645             if(alg_ew==ALG_WEST)stripW.push_back(s);
07646           }
07647         }
07648       }
07649 
07650 
07651 
07652 
07653 
07654       if(possibleDeMuxError){
07655         for(int i=0;i<MAX_NUMBER_OF_STRIPS;i++){
07656           stripMapE[i]=NULL;
07657           stripMapW[i]=NULL;
07658         }
07659         for(int i=0;i<easthits;i++){
07660           stripMapE[stripE[i]] = fDeMuxedPlanesAltLists[iplane][ALG_EAST][i];
07661         }
07662         for(int i=0;i<westhits;i++){
07663           stripMapW[stripW[i]] = fDeMuxedPlanesAltLists[iplane][ALG_WEST][i];
07664         }
07665         this->ReMuxPlane(iplane);
07666         for(int i=0;i<MAX_NUMBER_OF_STRIPS;i++){
07667           
07668           if(stripMapW[i]!=NULL&&stripMapE[i]!=NULL){
07669             this->DeMuxHits(iplane, stripMapE[i], stripMapW[i], i);
07670           }else{
07671             if(stripMapE[i]!=NULL)this->DeMuxSingleHitE(iplane, stripMapE[i], i);
07672             if(stripMapW[i]!=NULL)this->DeMuxSingleHitW(iplane, stripMapW[i], i);
07673           }
07674         }
07675       }
07676       if(ntarget>0){
07677         float mean = sumtarget/ntarget;
07678         int istrip = static_cast<int>(mean+0.5);
07679         ValidatePlaneAgainstTarget(iplane,istrip);
07680         //      float rms = sumsqtarget/ntarget-mean*mean;
07681       }
07682     }
07683   }
07684 
07685   return;
07686 }

void AlgAltDeMuxBase::CleanMultiple  )  [protected]
 

Definition at line 6999 of file AlgAltDeMuxBase.cxx.

References DrawDiagnosticPlots(), fDeMuxedPairs, fDeMuxedSingles, fEventType, fHoughSlopeU, fHoughSlopeV, MSG, multipleMuonInterceptsU, multipleMuonInterceptsV, and ReMuxPlane().

Referenced by AlgAltDeMux::DeMuxAsMultipleMuon().

07000 {
07001 
07002 
07003   if(fDiagnosticPlots)DrawDiagnosticPlots(5);
07004 
07005   if(fEventType!=MULTIPLE_MUON){
07006     return;
07007   }
07008 
07009   // Deal with the pairs
07010 
07011   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
07012     bool needReMux = false;
07013     for(UInt_t ipair=0;!needReMux&&ipair<fDeMuxedPairs[iplane].size();ipair++){
07014       PlaneView::PlaneView_t kView = fDeMuxedPairs[iplane][ipair].altListE->GetPlaneView();
07015       Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
07016       Int_t jplane = iplane;
07017       if(jplane>249)jplane+=20;
07018       bool hitIsGood = false;
07019       if(kView==PlaneView::kU){
07020         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsU.size();iline++){
07021           Float_t delta = fabs(fHoughSlopeU*jplane + multipleMuonInterceptsU[iline] -istrip);
07022 
07023           if(delta<13)hitIsGood=true; 
07024         }
07025       }
07026       if(kView==PlaneView::kV){
07027         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsV.size();iline++){
07028           Float_t delta = fabs(fHoughSlopeV*jplane + multipleMuonInterceptsV[iline] -istrip);
07029           if(delta<13)hitIsGood=true; 
07030         }
07031       }
07032       if(!hitIsGood)needReMux=true;
07033     }
07034     for(UInt_t isingle=0;isingle<fDeMuxedSingles[iplane].size();isingle++){
07035       PlaneView::PlaneView_t kView = fDeMuxedSingles[iplane][isingle].altList->GetPlaneView();
07036       Int_t istrip = fDeMuxedSingles[iplane][isingle].altList->GetBestSEId().GetStrip();
07037       Int_t jplane = iplane;
07038       if(jplane>249)jplane+=20;
07039       bool hitIsGood = false;
07040       if(kView==PlaneView::kU){
07041         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsU.size();iline++){
07042           Float_t delta = fabs(fHoughSlopeU*jplane + multipleMuonInterceptsU[iline] -istrip);
07043 
07044           if(delta<13)hitIsGood=true; 
07045         }
07046       }
07047       if(kView==PlaneView::kV){
07048         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsV.size();iline++){
07049           Float_t delta = fabs(fHoughSlopeV*jplane + multipleMuonInterceptsV[iline] -istrip);
07050           if(delta<13)hitIsGood=true; 
07051         }
07052       }
07053       if(!hitIsGood)needReMux=true;
07054     }
07055     if(needReMux)MSG("AltDeMux",Msg::kVerbose) << "AlgAltDeMuxBase::CleanMultiple Will ReMux Plane : " << iplane << endl;
07056     if(needReMux)ReMuxPlane(iplane);
07057   }
07058 
07059   if(fDiagnosticPlots)DrawDiagnosticPlots(5);
07060 }

void AlgAltDeMuxBase::ClearArrays  )  [protected]
 

Definition at line 455 of file AlgAltDeMuxBase.cxx.

References _nDeMuxedPlanesU, _nDeMuxedPlanesV, _nHitPlanesU, _nHitPlanesV, fDeMuxedPairs, fDeMuxedPlanesAltLists, fDeMuxedSingles, fEventType, fGoldPlaneHit, fHighestDeMuxedPairPlane, fLowestDeMuxedPairPlane, fNoisePlanesAltLists, fPlaneHit, fPlanePair, fPlanesAltLists, fPMTmap, fPMTtot, fQMaxE, fQMaxW, fQTotE, fQTotW, fTimeList, fTimingMask, fUniqueDeMuxedGroupID, fUseExtrapolationB, fUseExtrapolationF, fUseFitSlopeHits, fUseFitSlopeTime, fUseHoughSlope, fUseInterpolation, fUseLevelStripB, fUseLevelStripF, fUseSafeExtrapolationB, fUseSafeExtrapolationF, fUseSameStrip, fUVMap, fVAmap, fXTalkmap, fXTalkPlanesAltLists, MAX_NUMBER_OF_PLANES, MSG, NdemuxedHitsU, NdemuxedHitsV, and ResetTimingMask().

Referenced by AlgAltDeMux::DeMuxPreparation().

00456 {
00457 
00458   // Zero internal arrays/vectors used to DeMux event
00459 
00460   fEventType = UNKNOWN;
00461 
00462   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::ClearArrays()" << endl;
00463 
00464   // Timelist will contain an ordered list of hit times.
00465   fTimeList.erase(fTimeList.begin(),fTimeList.end());
00466 
00467   // Reset the timing masks 
00468   ResetTimingMask();
00469 
00470   // Reset the DeMuxed group ID counter
00471   fUniqueDeMuxedGroupID=0;
00472 
00473   // Clear vector of DeMuxed strip end EW pairs
00474 
00475   // loop over planes/ends
00476   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES;iplane++){
00477     fUVMap[iplane]=PlaneView::kUnknown;
00478     for(Int_t istrip=0; istrip<MAX_NUMBER_OF_STRIPS;istrip++){
00479       fTimingMask[iplane][istrip] = false;
00480     }
00481     fDeMuxedPairs[iplane].erase(fDeMuxedPairs[iplane].begin(),fDeMuxedPairs[iplane].end());
00482     fDeMuxedSingles[iplane].erase(fDeMuxedSingles[iplane].begin(),fDeMuxedSingles[iplane].end());
00483     NdemuxedHitsU[iplane] = 0;
00484     NdemuxedHitsV[iplane] = 0;
00485     for(Int_t iew=0; iew<=1;iew++){
00486       // Clear the arrays of vectors of AltLists
00487       fPlanesAltLists[iplane][iew].erase(fPlanesAltLists[iplane][iew].begin(),fPlanesAltLists[iplane][iew].end());
00488       fDeMuxedPlanesAltLists[iplane][iew].erase(fDeMuxedPlanesAltLists[iplane][iew].begin(),fDeMuxedPlanesAltLists[iplane][iew].end());
00489       fNoisePlanesAltLists[iplane][iew].erase(fNoisePlanesAltLists[iplane][iew].begin(),fNoisePlanesAltLists[iplane][iew].end());
00490       fXTalkPlanesAltLists[iplane][iew].erase(fXTalkPlanesAltLists[iplane][iew].begin(),fXTalkPlanesAltLists[iplane][iew].end());
00491     }
00492     // zero counters
00493     fPlaneHit[iplane] = 0;
00494     fPlanePair[iplane] = 0;
00495     fGoldPlaneHit[iplane] = 0;
00496     fQTotE[iplane] = 0;
00497     fQTotW[iplane] = 0;
00498     fQMaxE[iplane] = 0;
00499     fQMaxW[iplane] = 0;
00500   }
00501   _nDeMuxedPlanesU=0;
00502   _nDeMuxedPlanesV=0;
00503   _nHitPlanesU=0;
00504   _nHitPlanesV=0;
00505 
00506 
00507   // Zero PMT maps (for previously PMT with hits from previous event)
00508   for(int i=0; i<MAX_NUMBER_OF_PMTS; i++){
00509     if(fPMTtot[i]>0){
00510       fPMTtot[i]=0.0;
00511       for(int j=0; j<16; j++){
00512         fPMTmap[i][j]=0.0;
00513         fXTalkmap[i][j]=0.0;
00514       }
00515       for(int j=0; j<22; j++){
00516         fVAmap[i][j]=0.0;
00517       }
00518     }
00519   }
00520 
00521   // reset range of planes to DeMux 
00522   fLowestDeMuxedPairPlane = MAX_NUMBER_OF_PLANES-1;
00523   fHighestDeMuxedPairPlane = 0;
00524 
00525   fUseHoughSlope         = false;      
00526   fUseFitSlopeTime       = false;   
00527   fUseFitSlopeHits       = false;   
00528   fUseInterpolation      = false;      
00529   fUseSafeExtrapolationF = false; 
00530   fUseSafeExtrapolationB = false; 
00531   fUseLevelStripF        = false;         
00532   fUseLevelStripB        = false;         
00533   //************************************
00534   fUseExtrapolationF     = true;     
00535   fUseExtrapolationB     = true;     
00536   fUseSameStrip          = true;          
00537   //************************************
00538 
00539   // say goodbye
00540   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::ClearArrays() DONE" << endl;
00541 }

void AlgAltDeMuxBase::ClearDiagnosticHistos  )  [protected]
 

Definition at line 368 of file AlgAltDeMuxBase.cxx.

References fHoughProjU, fHoughProjV, fHoughSliceU, fHoughSliceV, fHoughU, fHoughV, fUMask, fUpad, fUTime, fUview, fUZFitQSSM1, fUZFitQSSM2, fUZFitS, fUZFitSSM1, fUZFitSSM2, fUZFitT, fUZFitTSM1, fUZFitTSM2, fVMask, fVpad, fVTime, fVview, fVZFitQSSM1, fVZFitQSSM2, fVZFitS, fVZFitSSM1, fVZFitSSM2, fVZFitT, fVZFitTSM1, fVZFitTSM2, and MSG.

Referenced by AlgAltDeMux::DeMuxPreparation().

00369 {
00370 
00371   // Clear the diagnostic histograms - only called if fDiagnosticPlots==true
00372 
00373   if(!fDiagnosticPlots)return;
00374   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::ClearDiagnosticHistos()" << endl;
00375 
00376   if(fUpad)fUpad->Clear("");
00377   if(fVpad)fVpad->Clear("");
00378   
00379 // remove old histograms if they exists
00380   if ( fUview ) { delete fUview; fUview=0; }
00381   if ( fVview ) { delete fVview; fVview=0; }
00382   if ( fUTime ) { delete fUTime; fUTime=0; }
00383   if ( fVTime ) { delete fVTime; fVTime=0; }
00384   if ( fUMask ) { delete fUMask; fUMask=0; }
00385   if ( fVMask ) { delete fVMask; fVMask=0; }
00386   if ( fHoughU) { delete fHoughU; fHoughU=0; }
00387   if ( fHoughV) { delete fHoughV; fHoughV=0; }
00388   if ( fHoughProjU) { delete fHoughProjU; fHoughProjU=0; }
00389   if ( fHoughProjV) { delete fHoughProjV; fHoughProjV=0; }
00390   if ( fHoughSliceU) { delete fHoughSliceU; fHoughSliceU=0; }
00391   if ( fHoughSliceV) { delete fHoughSliceV; fHoughSliceV=0; }
00392   if(fUZFitS){delete fUZFitS; fUZFitS=0;}
00393   if(fVZFitS){delete fVZFitS; fVZFitS=0;}
00394   if(fUZFitT){delete fUZFitT; fUZFitT=0;}
00395   if(fVZFitT){delete fVZFitT; fVZFitT=0;}
00396   if(fUZFitSSM1){delete fUZFitSSM1; fUZFitSSM1=0;}
00397   if(fUZFitSSM2){delete fUZFitSSM2; fUZFitSSM2=0;}
00398   if(fUZFitQSSM1){delete fUZFitQSSM1; fUZFitQSSM1=0;}
00399   if(fUZFitQSSM2){delete fUZFitQSSM2; fUZFitQSSM2=0;}
00400   if(fVZFitQSSM1){delete fVZFitQSSM1; fVZFitQSSM1=0;}
00401   if(fVZFitQSSM2){delete fVZFitQSSM2; fVZFitQSSM2=0;}
00402   if(fUZFitTSM1){delete fUZFitTSM1; fUZFitTSM1=0;}
00403   if(fUZFitTSM2){delete fUZFitTSM2; fUZFitTSM2=0;}
00404   if(fVZFitSSM1){delete fVZFitSSM1; fVZFitSSM1=0;}
00405   if(fVZFitSSM2){delete fVZFitSSM2; fVZFitSSM2=0;}
00406   if(fVZFitTSM1){delete fVZFitTSM1; fVZFitTSM1=0;}
00407   if(fVZFitTSM2){delete fVZFitTSM2; fVZFitTSM2=0;}
00408 
00409   // create histograms that we'll use for World Coordinates
00410   // create histograms that we'll use for World Coordinates
00411   fUview = new TH2F("Uview","U view",501,-0.5,500.5,1,0.,193.);
00412   fVview = new TH2F("Vview","V view",501,-0.5,500.5,1,0.,193.);
00413   fUTime = new TH2F("UTime","U time view",501,-0.5,500.5,193,0.,193.);
00414   fVTime = new TH2F("VTime","V time view",501,-0.5,500.5,193,0.,193.);
00415   fUMask = new TH2F("UMask","U view mask",501,-0.5,500.5,193,0.,193.);
00416   fVMask = new TH2F("VMask","V view mask",501,-0.5,500.5,193,0.,193.);
00417   fHoughU = new TH2F("houghSpaceU", "U Hough Space", 400, -3., 1., 500, -250., 250.);
00418   fHoughV = new TH2F("houghSpaceV", "V Hough Space", 400, -3., 1., 500, -250., 250.);
00419 
00420   fHoughProjU = new TH1F("houghSpaceProjU", "U HoughX Space", 400, -3., 1.);
00421   fHoughProjV = new TH1F("houghSpaceProjV", "V HoughX Space", 400, -3., 1.);
00422 
00423   fHoughSliceU = new TH1F("houghSpaceSliceU", "U Hough c", 500, -250., 250.);
00424   fHoughSliceV = new TH1F("houghSpaceSliceV", "V Hough c", 500, -250., 250.);
00425 
00426     
00427   // don't draw the Stats box
00428   fUview->SetStats(kFALSE);
00429   fVview->SetStats(kFALSE);
00430   
00431   fUTime->SetStats(kFALSE);
00432   fVTime->SetStats(kFALSE);
00433   
00434   fUMask->SetStats(kFALSE);
00435   fVMask->SetStats(kFALSE);
00436 
00437   fHoughU->SetStats(kFALSE);
00438   fHoughV->SetStats(kFALSE);
00439 
00440   fHoughProjU->SetStats(kFALSE);
00441   fHoughProjV->SetStats(kFALSE);
00442 
00443   fHoughSliceU->SetStats(kFALSE);
00444   fHoughSliceV->SetStats(kFALSE);
00445     
00446   // take away any association with a "directory" for these histograms
00447   fUview->SetDirectory(0);
00448   fVview->SetDirectory(0);
00449 
00450   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::ClearDiagnosticHistos() DONE" << endl;
00451 
00452   return;
00453 }

void AlgAltDeMuxBase::CreateDiagnosticCanvas  )  [protected]
 

Definition at line 297 of file AlgAltDeMuxBase.cxx.

References diagnosticCanvas, fCanvas, fHoughProjU, fHoughProjV, fHoughSliceU, fHoughSliceV, fHoughU, fHoughV, fUMask, fUpad, fUTime, fUview, fUZFitQSSM1, fUZFitQSSM2, fUZFitS, fUZFitSSM1, fUZFitSSM2, fUZFitT, fUZFitTSM1, fUZFitTSM2, fVMask, fVpad, fVTime, fVview, fVZFitQSSM1, fVZFitQSSM2, fVZFitS, fVZFitSSM1, fVZFitSSM2, fVZFitT, fVZFitTSM1, and fVZFitTSM2.

Referenced by AlgAltDeMux::RunAlg().

00298 {
00299 
00300   // If requested AlgAltDeMuxBase has a built-in diagnositic/debugging canvas
00301   // which provides a visual display of the DeMuxing as the algorithm
00302   // progresses through its various steps.
00303 
00304   if(diagnosticCanvas)return;
00305 
00306   diagnosticCanvas = true;
00307   string title  = "AlgAltDeMuxBase(";
00308   title = title + diagnosticCanvastitle;
00309   title = title + ") Diagnostics screen";
00310 
00311   fCanvas = new TCanvas(title.c_str(),diagnosticCanvastitle.c_str(),600,600);
00312 
00313   fUview  = NULL;
00314   fVview  = NULL;
00315   fUTime  = NULL;
00316   fVTime  = NULL;
00317   fUMask  = NULL;
00318   fVMask  = NULL;
00319   fHoughU = NULL;
00320   fHoughV = NULL;
00321   fHoughProjU = NULL;
00322   fHoughProjV = NULL;
00323   fHoughSliceU = NULL;
00324   fHoughSliceV = NULL;
00325   fUZFitS = NULL;
00326   fVZFitS = NULL;
00327   fUZFitT = NULL;
00328   fVZFitT = NULL;
00329   fUZFitSSM1 = NULL;
00330   fUZFitSSM2 = NULL;
00331   fUZFitQSSM1 = NULL;
00332   fUZFitQSSM2 = NULL;
00333   fUZFitTSM1 = NULL;
00334   fUZFitTSM2 = NULL;
00335   fVZFitSSM1 = NULL;
00336   fVZFitSSM2 = NULL;
00337   fVZFitTSM1 = NULL;
00338   fVZFitTSM2 = NULL;
00339   fVZFitQSSM1 = NULL;
00340   fVZFitQSSM2 = NULL;
00341 
00342 
00343 
00344 // Create the pads;  Pad takes xlo, ylo, xhi, yhi in NC
00345   fUpad  = new TPad("upad","U pad",0.010,0.505,0.990,0.990);
00346   fVpad  = new TPad("vpad","V pad",0.010,0.010,0.990,0.495);
00347 
00348     // white background
00349   fUpad->SetFillColor(10);
00350   fVpad->SetFillColor(10);
00351     
00352     // tweak the margins to maximize histogram use of pads
00353   fUpad->SetLeftMargin(0.05);
00354   fUpad->SetRightMargin(0.0001);
00355   fUpad->SetTopMargin(0.0001);
00356   fUpad->SetBottomMargin(0.055);
00357   fVpad->SetLeftMargin(0.05);
00358   fVpad->SetRightMargin(0.0001);
00359   fVpad->SetTopMargin(0.0001);
00360   fVpad->SetBottomMargin(0.055);
00361   fUpad->Draw();
00362   fVpad->Draw();
00363     
00364   fCanvas->Draw();
00365 }

Int_t AlgAltDeMuxBase::DeMuxBigGroup Int_t  iplane,
Int_t  ig,
bool  gold
[protected]
 

Definition at line 5283 of file AlgAltDeMuxBase.cxx.

References _smask, DeMuxHits(), fAmap, fEGroup, fNInGroupE, fNInGroupW, fSmap, fUniqueDeMuxedGroupID, fWGroup, PlexSEIdAltL::GetCurrentSEId(), PlexStripEndId::GetStrip(), GoldHits(), BigGroup::groupCount, BigGroup::groupEnd, BigGroup::groupStart, PlexSEIdAltL::IsValid(), PlexSEIdAltL::Next(), pPlaneAltMapE, pPlaneAltMapW, s(), PlexSEIdAltL::SetCurrentWeight(), and PlexSEIdAltL::SetFirst().

Referenced by SelectHits().

05284 { 
05285   bool success = false;
05286 
05287   vector<BigGroup>theGroups;
05288 
05289   int strips[192];
05290   int estrips[192];
05291   int wstrips[192];
05292   for(int i=0;i<192;i++)strips[i]=0;
05293   for(int ie=1;ie<=fNInGroupE[ig];ie++){
05294     for(int iw=1;iw<=fNInGroupW[ig];iw++){
05295       if(fAmap[(fEGroup[ig][ie])][(fWGroup[ig][iw])]){
05296         int s = fSmap[(fEGroup[ig][ie])][(fWGroup[ig][iw])];
05297         strips[s]++;
05298         estrips[s] = ie;
05299         wstrips[s] = iw;
05300       }
05301     }
05302   }
05303   int istartStrip;
05304   int iendStrip;
05305   int ngroups = 0;
05306   int ilast=0;
05307 
05308   for(int i=0;i<=192;i++){
05309     _smask[i] = false;
05310   }
05311 
05312   int ming = fNInGroupE[ig];
05313   if(fNInGroupW[ig]<ming)ming = fNInGroupW[ig];
05314 
05315   int best = ming-3;
05316   if(ming<12)best = ming-2;
05317   if(ming<7)best = ming-1;
05318   best = ming -1;
05319 
05320   int icount;
05321   for(int is=0; is<192-ming; is++){
05322     if(strips[is]==1){
05323       icount = 1;
05324       int iend = is+ming+5;
05325       int ie;
05326       if(iend>191)iend=192;
05327       for(ie=is+1; ie<iend && icount != ming; ie++){
05328         if(strips[ie]>0){
05329           ilast = ie;
05330           icount++;
05331         }
05332       }
05333       
05334       if(icount>=best){
05335         BigGroup aBigGroup;
05336         aBigGroup.groupStart = is;
05337         aBigGroup.groupEnd = ilast;
05338         aBigGroup.groupCount = icount;
05339         theGroups.push_back(aBigGroup);
05340         best = icount;
05341         if(amWriting)cout << "Found a (small ?) group : " << is << ":" << ilast << " : " << icount << endl;
05342       }
05343       
05344 
05345       if(icount==ming){
05346         ngroups++;
05347         istartStrip = is;
05348         iendStrip   = ie-1;
05349         if(amWriting)cout << "Found a group : " << is << ":" << ie-1 << endl;
05350         for(int i=is;i<=ie;i++){
05351           _smask[i] = true;
05352         }
05353       }
05354     }
05355   }
05356   if(amWriting)cout << "Found " << ngroups << " groups " << endl;
05357 
05358 
05359   ngroups = 0;
05360   for(unsigned int igroup =0; igroup<theGroups.size();igroup++){
05361     if(theGroups[igroup].groupCount==best){
05362       ngroups++;
05363       istartStrip = theGroups[igroup].groupStart;
05364       iendStrip = theGroups[igroup].groupEnd;
05365       if(amWriting)cout << " A good group " << theGroups[igroup].groupStart << " " << theGroups[igroup].groupEnd << " "<< theGroups[igroup].groupCount << endl;
05366       for(int i=theGroups[igroup].groupStart;i<=theGroups[igroup].groupEnd;i++){
05367         _smask[i] = true;
05368       }   
05369     }
05370   }
05371 
05372   // if one and only one group is found then demux it
05373   if(ngroups==1){
05374     success = true;
05375     // fUniqueDeMuxedGroupID is an ugly cludge to tag each group of gold hits 
05376     fUniqueDeMuxedGroupID++;
05377     Int_t ie;
05378     Int_t iw;
05379     for(Int_t is=istartStrip; is<=iendStrip;is++){
05380       if(strips[is]==1){
05381         ie = estrips[is];
05382         iw = wstrips[is];
05383         if(amWriting)cout << " Strip : " << is << " ew " << ie << ":" << iw << endl;
05384         // if the flag gold is 
05385         if(gold)this->GoldHits(iplane,is);
05386         if(!gold)this->DeMuxHits(iplane,fEGroup[ig][ie],fWGroup[ig][iw],is);
05387       }     
05388     }
05389   } 
05390 
05391   if(ngroups>1){
05392     for(int ie=1;ie<=fNInGroupE[ig];ie++){
05393       PlexSEIdAltL* pAltL;
05394       pAltL = pPlaneAltMapE[(fEGroup[ig][ie])]; 
05395       pAltL->SetFirst();
05396       while(pAltL->IsValid()){
05397         int is = pAltL->GetCurrentSEId().GetStrip();
05398         if(!_smask[is])pAltL->SetCurrentWeight(-999.);
05399         pAltL->Next();
05400       }
05401     }
05402     for(int iw=1;iw<=fNInGroupW[ig];iw++){
05403       PlexSEIdAltL* pAltL;
05404       pAltL = pPlaneAltMapW[(fWGroup[ig][iw])]; 
05405       pAltL->SetFirst();
05406       while(pAltL->IsValid()){
05407         int is = pAltL->GetCurrentSEId().GetStrip();
05408         if(!_smask[is])pAltL->SetCurrentWeight(-999.);
05409         pAltL->Next();
05410       }
05411     }
05412   }
05413 
05414   return ngroups;
05415 }

void AlgAltDeMuxBase::DeMuxHitE Int_t  iplane,
Int_t  ie,
Int_t  is
[protected]
 

Definition at line 5495 of file AlgAltDeMuxBase.cxx.

References DeMuxHitE(), and pPlaneAltMapE.

05495                                                                { 
05496 
05497   PlexSEIdAltL* pAltL;
05498 
05499   pAltL = pPlaneAltMapE[ie]; 
05500   this->DeMuxHitE(iplane,pAltL,is);
05501   return;
05502 }

void AlgAltDeMuxBase::DeMuxHitE Int_t  iplane,
PlexSEIdAltL pAlt,
Int_t  is
[protected]
 

Definition at line 5600 of file AlgAltDeMuxBase.cxx.

References fDeMuxedPlanesAltLists, fPlanesAltLists, PlexSEIdAltL::GetCurrentItem(), PlexSEIdAltL::GetCurrentSEId(), PlexSEIdAltLItem::GetPE(), PlexStripEndId::GetStrip(), PlexSEIdAltL::IsValid(), PlexSEIdAltL::Next(), PlexSEIdAltL::SetCurrentWeight(), PlexSEIdAltL::SetFirst(), and UpdateXTalkMap().

Referenced by DeMuxHitE(), DeMuxHits(), and DeMuxSingleHitE().

05600                                                                           { 
05601 
05602   vector <PlexSEIdAltL*>::iterator literA;
05603   bool notFound;
05604   float q;
05605 
05606   pAltL->SetFirst();
05607 
05608   q = pAltL->GetCurrentItem().GetPE();
05609   notFound = true;
05610   while(pAltL->IsValid()){
05611     if(pAltL->GetCurrentSEId().GetStrip()==is){
05612       pAltL->SetCurrentWeight(1.);
05613     }else{
05614       pAltL->SetCurrentWeight(0.);
05615     }
05616     pAltL->Next();
05617   }
05618 
05619   literA = fPlanesAltLists[iplane][ALG_EAST].begin();
05620   notFound = true;
05621   while (notFound && literA != fPlanesAltLists[iplane][ALG_EAST].end()){
05622     if(*literA==pAltL){
05623       fPlanesAltLists[iplane][ALG_EAST].erase(literA);
05624       notFound = false;
05625     }
05626     literA++;
05627   }
05628   fDeMuxedPlanesAltLists[iplane][ALG_EAST].push_back(pAltL);
05629 
05630   this->UpdateXTalkMap(pAltL);
05631 
05632   return;
05633 }

void AlgAltDeMuxBase::DeMuxHits Int_t  iplane,
PlexSEIdAltL pAltE,
PlexSEIdAltL pAltW,
Int_t  is
[protected]
 

Definition at line 5434 of file AlgAltDeMuxBase.cxx.

References _nDeMuxedPlanesU, _nDeMuxedPlanesV, DeMuxedPair::altListE, DeMuxedPair::altListW, AltDeMuxCalc::CalcBestEastWest(), demuxedHitQU, demuxedHitQV, demuxedHitStripU, demuxedHitStripV, DeMuxHitE(), DeMuxHitW(), fDeMuxedPairs, fHighestDeMuxedPairPlane, fHitMap, fLowestDeMuxedPairPlane, fPlaneHit, fPlanePair, fQHitMapE, fQHitMapW, PlexSEIdAltL::GetPlaneView(), NdemuxedHitsU, NdemuxedHitsV, DeMuxedPair::orthogonalStripFromTiming, AltDeMuxCalc::PairQCor(), DeMuxedPair::pairQCor, pCalculator, AltDeMuxCalc::QSigCorE(), AltDeMuxCalc::QSigCorW(), AltDeMuxCalc::SetEast(), AltDeMuxCalc::SetPlane(), AltDeMuxCalc::SetView(), AltDeMuxCalc::SetWest(), DeMuxedPair::status, AltDeMuxCalc::StripAim(), DeMuxedPair::uniqueGroupID, and DeMuxedPair::weightQ.

05435 { 
05436   
05437   this->DeMuxHitE(iplane,pAltE,istrip);
05438   this->DeMuxHitW(iplane,pAltW,istrip);
05439 
05440   if(amWriting)cout << "DEMUX THIS HIT ! " << iplane << ":" << istrip << endl;
05441 
05442   DeMuxedPair thisPair;
05443   thisPair.altListE = pAltE;
05444   thisPair.altListW = pAltW;
05445   thisPair.status   = true;
05446   if(iplane<fLowestDeMuxedPairPlane)fLowestDeMuxedPairPlane = iplane;
05447   if(iplane>fHighestDeMuxedPairPlane)fHighestDeMuxedPairPlane = iplane;
05448 
05449 
05450   PlaneView::PlaneView_t kView = pAltE->GetPlaneView();
05451   pCalculator->SetPlane(iplane);
05452   pCalculator->SetView(kView);
05453   pCalculator->SetEast(pAltE,istrip);
05454   pCalculator->SetWest(pAltW,istrip);
05455   pCalculator->CalcBestEastWest();
05456 
05457   thisPair.orthogonalStripFromTiming = pCalculator->StripAim();
05458   thisPair.uniqueGroupID = fUniqueDeMuxedGroupID;
05459   thisPair.weightQ = 1.0;
05460   thisPair.pairQCor = pCalculator->PairQCor();
05461 
05462   fDeMuxedPairs[iplane].push_back(thisPair);
05463 
05464   if(kView==PlaneView::kU){
05465     if(NdemuxedHitsU[iplane]<MAX_DISPLAYED_HITS){
05466       demuxedHitStripU[iplane][NdemuxedHitsU[iplane]] = istrip;
05467       demuxedHitQU[iplane][NdemuxedHitsU[iplane]]     = pCalculator->PairQCor();
05468       NdemuxedHitsU[iplane]++;
05469     }
05470   }
05471   if(kView==PlaneView::kV){
05472     if(NdemuxedHitsV[iplane]<MAX_DISPLAYED_HITS){
05473       demuxedHitStripV[iplane][NdemuxedHitsV[iplane]] = istrip;
05474       demuxedHitQV[iplane][NdemuxedHitsV[iplane]]     = pCalculator->PairQCor();
05475       NdemuxedHitsV[iplane]++;
05476     }
05477   }
05478 
05479   
05480   if(fPlaneHit[iplane]==0){
05481     if(kView==PlaneView::kU)_nDeMuxedPlanesU++;
05482     if(kView==PlaneView::kV)_nDeMuxedPlanesV++; 
05483   } 
05484   fPlaneHit[iplane]++;
05485   fPlanePair[iplane]++;
05486   fHitMap[iplane][fPlaneHit[iplane]]  = istrip;
05487   fQHitMapE[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorE();
05488   fQHitMapW[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorW();
05489 
05490   return;
05491 
05492 }

void AlgAltDeMuxBase::DeMuxHits Int_t  iplane,
Int_t  ie,
Int_t  iw,
Int_t  is
[protected]
 

Definition at line 5426 of file AlgAltDeMuxBase.cxx.

References pPlaneAltMapE, and pPlaneAltMapW.

Referenced by CleanIsolatedHits(), DeMuxBigGroup(), ReMuxPlane(), and SelectHits().

05426                                                                               { 
05427   this->DeMuxHits(iplane, pPlaneAltMapE[ie], pPlaneAltMapW[iw], istrip );
05428 
05429   if(amWriting)cout << "DEMUXED STRIPs : " << ie << ":" << iw << " -> " << istrip << endl;
05430   
05431   return;
05432 }

void AlgAltDeMuxBase::DeMuxHitW Int_t  iplane,
Int_t  iw,
Int_t  is
[protected]
 

Definition at line 5505 of file AlgAltDeMuxBase.cxx.

References DeMuxHitW(), and pPlaneAltMapW.

05505                                                                { 
05506 
05507   PlexSEIdAltL* pAltL;
05508   pAltL = pPlaneAltMapW[iw]; 
05509   this->DeMuxHitW(iplane,pAltL,is);  
05510 
05511   return;
05512 }

void AlgAltDeMuxBase::DeMuxHitW Int_t  iplane,
PlexSEIdAltL pAlt,
Int_t  is
[protected]
 

Definition at line 5673 of file AlgAltDeMuxBase.cxx.

References fDeMuxedPlanesAltLists, fPlanesAltLists, PlexSEIdAltL::GetCurrentItem(), PlexSEIdAltL::GetCurrentSEId(), PlexSEIdAltLItem::GetPE(), PlexStripEndId::GetStrip(), PlexSEIdAltL::IsValid(), PlexSEIdAltL::Next(), PlexSEIdAltL::SetCurrentWeight(), PlexSEIdAltL::SetFirst(), and UpdateXTalkMap().

Referenced by DeMuxHits(), DeMuxHitW(), and DeMuxSingleHitW().

05673                                                                           { 
05674 
05675 
05676   vector <PlexSEIdAltL*>::iterator literA;
05677   bool notFound;
05678   float q;
05679 
05680 
05681   pAltL->SetFirst();
05682 
05683   notFound = true;
05684   q = pAltL->GetCurrentItem().GetPE();
05685   while(pAltL->IsValid()){
05686     if(pAltL->GetCurrentSEId().GetStrip()==is){
05687       pAltL->SetCurrentWeight(1.);
05688     }else{
05689       pAltL->SetCurrentWeight(0.);
05690     }
05691     pAltL->Next();
05692   }
05693   
05694   literA = fPlanesAltLists[iplane][ALG_WEST].begin();
05695   notFound = true;
05696   while (notFound && literA != fPlanesAltLists[iplane][ALG_WEST].end()){
05697     if(*literA==pAltL){
05698       fPlanesAltLists[iplane][ALG_WEST].erase(literA);
05699       notFound = false;
05700     }
05701     literA++;
05702   }
05703 
05704   fDeMuxedPlanesAltLists[iplane][ALG_WEST].push_back(pAltL);
05705   this->UpdateXTalkMap(pAltL);
05706 
05707   return;
05708 }

void AlgAltDeMuxBase::DeMuxPass Int_t  ipass  )  [protected]
 

Definition at line 4709 of file AlgAltDeMuxBase.cxx.

References ALG_EAST, ALG_WEST, amShowing, DeMuxSingles(), DrawDiagnosticPlots(), fCutCorPE, fCutGuessing, fCutRawPE, fCutSigmaQ, fCutUseMultipleLines, fCutUseTargetStrips, fCutUseTimingMask, fPlanesAltLists, fSearchTactics, fStripWindow, fTrackingLowPECut, GroupHits(), MakeMultipleTargets(), MakePlaneMap(), MakeSearchTactics(), MakeSearchTacticsX(), MakeSearchTacticsY(), MSG, NdemuxedHitsU, NdemuxedHitsV, NewTactic(), ResetMap(), and SelectHits().

Referenced by AlgAltDeMux::DeMuxAsMultipleMuon(), AlgAltDeMux::DeMuxAsUnknownEventType(), AlgAltDeMux::DeMuxGoldenHits(), AlgAltDeMux::DeMuxTidyUp(), DeMuxWhatsLeft(), AlgAltDeMux::ValidateContainedCandidate(), and AlgAltDeMux::ValidateThroughGoingMuon().

04709                                           {
04710 
04711   vector <DeMuxSearchTactic>::iterator literS;
04712 
04713   amShowing = false;
04714   fCutUseMultipleLines = false;
04715 
04716   switch(ipass){
04717   case 0:
04718     fCutRawPE            = 0.0;
04719     fCutCorPE            = 1.0;
04720     fCutSigmaQ           = 3.5;
04721     fCutUseTimingMask    = true;
04722     fCutUseTargetStrips  = false;
04723     fCutGuessing         = false;
04724     fStripWindow         = 5;
04725 
04726     for(int iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
04727       if(fPlanesAltLists[iplane][ALG_EAST].size()&&fPlanesAltLists[iplane][ALG_WEST].size()){
04728 
04729         if(amWriting)MSG("AltDeMux", Msg::kInfo) << "DeMuxPass0 : " << iplane << " : " << fPlanesAltLists[iplane][ALG_EAST].size() << " : " << fPlanesAltLists[iplane][ALG_WEST].size() << endl;
04730         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04731         this->MakePlaneMap(iplane);
04732         //  this->PrintPlaneMap();
04733         this->GroupHits();
04734         this->SelectHits(iplane,true);
04735       }
04736     }
04737 
04738     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 0" << endl;
04739     break;
04740   case 1:
04741     fCutRawPE            = 0.5;
04742     fCutCorPE            = 2.0;
04743     fCutSigmaQ           = 3.0;
04744     fCutUseTimingMask    = true;
04745     fCutUseTargetStrips  = false;
04746     fCutGuessing         = false;
04747     fStripWindow         = 5;
04748     for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
04749       NdemuxedHitsU[iplane]=0;
04750       NdemuxedHitsV[iplane]=0;
04751       if(fPlanesAltLists[iplane][ALG_EAST].size()&&fPlanesAltLists[iplane][ALG_WEST].size()){
04752         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04753         this->MakePlaneMap(iplane);
04754         this->GroupHits();
04755         this->SelectHits(iplane,false,true);
04756       }
04757     }
04758     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 1" << endl;
04759     if(fDiagnosticPlots){
04760       this->DrawDiagnosticPlots(1);
04761     }
04762     break;
04763 
04764 
04765   case 12:
04766     fCutRawPE            = 0.0;
04767     fCutCorPE            = 0.0;
04768     fCutSigmaQ           = 5.0;
04769     fCutUseTimingMask    = false;
04770     fCutUseTargetStrips  = false;
04771     fCutGuessing         = false;
04772     fCutUseMultipleLines = false;
04773     fStripWindow         = 5;
04774     for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
04775       if(fPlanesAltLists[iplane][ALG_EAST].size()&&fPlanesAltLists[iplane][ALG_WEST].size()){
04776         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04777         this->MakeMultipleTargets(iplane);
04778         this->MakePlaneMap(iplane);
04779         this->GroupHits();
04780         this->SelectHits(iplane,false,true);
04781       }
04782     }
04783     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 1" << endl;
04784     if(fDiagnosticPlots){
04785       this->DrawDiagnosticPlots(1);
04786     }
04787     break;
04788 
04789 
04790   case 11:
04791     fCutRawPE            = 0.5;
04792     fCutCorPE            = 0.5;
04793     fCutSigmaQ           = 5.0;
04794     fCutUseTimingMask    = true;
04795     fCutUseTargetStrips  = true;
04796     fCutGuessing         = false;
04797     fCutUseMultipleLines = true;
04798     fStripWindow         = 12;
04799     for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
04800       if(fPlanesAltLists[iplane][ALG_EAST].size()&&fPlanesAltLists[iplane][ALG_WEST].size()){
04801         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04802         this->MakeMultipleTargets(iplane);
04803         this->MakePlaneMap(iplane);
04804         this->GroupHits();
04805         this->SelectHits(iplane,false,true);
04806       }
04807     }
04808     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 1" << endl;
04809     if(fDiagnosticPlots){
04810       this->DrawDiagnosticPlots(1);
04811     }
04812     break;
04813 
04814   case 22:
04815     fCutRawPE            = 0.0;
04816     fCutCorPE            = 0.5;
04817     fCutSigmaQ           = 4.0;
04818     fCutUseTimingMask    = true;
04819     fCutUseTargetStrips  = true;
04820     fCutGuessing         = false;
04821     fTrackingLowPECut    = 1.5;
04822     fStripWindow         = 5;
04823 
04824     this->MakeSearchTactics();
04825 
04826     for(unsigned int i=0; i<fSearchTactics.size(); i++){
04827       int iplane = fSearchTactics[i].iplane;
04828       if(fSearchTactics[i].goodTactic){
04829         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04830         this->MakePlaneMap(fSearchTactics[i]);
04831         this->GroupHits();
04832         if(this->SelectHits(iplane,false)){
04833           this->NewTactic(fSearchTactics[i]);
04834         }else{
04835           this->NewTactic(fSearchTactics[i]);
04836         }
04837       }else{
04838         this->NewTactic(fSearchTactics[i]);
04839       }
04840     }
04841     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 2" << endl;
04842     if(fDiagnosticPlots){
04843       this->DrawDiagnosticPlots(2);
04844     }
04845     break;
04846 
04847   case 2:
04848     fCutRawPE            = 0.0;
04849     fCutCorPE            = 1.5;
04850     fCutSigmaQ           = 3.0;
04851     fCutUseTimingMask    = false;
04852     fCutUseTargetStrips  = true;
04853     fCutGuessing         = false;
04854     fTrackingLowPECut    = 2.5;
04855     fStripWindow         = 100;
04856 
04857     this->MakeSearchTactics();
04858 
04859     for(unsigned int i=0; i<fSearchTactics.size(); i++){
04860       int iplane = fSearchTactics[i].iplane;
04861       if(fSearchTactics[i].goodTactic){
04862         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04863         this->MakePlaneMap(fSearchTactics[i]);
04864         this->GroupHits();
04865         if(this->SelectHits(iplane,false)){
04866           this->NewTactic(fSearchTactics[i]);
04867         }else{
04868           this->NewTactic(fSearchTactics[i]);
04869         }
04870       }else{
04871         this->NewTactic(fSearchTactics[i]);
04872       }
04873     }
04874     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 2" << endl;
04875     if(fDiagnosticPlots){
04876       this->DrawDiagnosticPlots(2);
04877     }
04878     break;
04879 
04880   case 3:
04881     fCutRawPE            = 0.0;
04882     fCutCorPE            = 0.0;
04883     fCutSigmaQ           = 4.0;
04884     fCutUseTimingMask    = false;
04885     fCutUseTargetStrips  = true;
04886     fCutGuessing         = false;
04887     fTrackingLowPECut    = 2.5;
04888     fStripWindow         = 100;
04889 
04890     this->MakeSearchTacticsX();
04891     if(fDiagnosticPlots)DrawDiagnosticPlots(3);
04892     for(unsigned int i=0; i<fSearchTactics.size(); i++){
04893       int iplane = fSearchTactics[i].iplane;
04894       if(fSearchTactics[i].goodTactic){
04895         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04896         this->MakePlaneMap(fSearchTactics[i]);
04897         this->GroupHits();
04898         if(this->SelectHits(iplane,false)){
04899           this->NewTactic(fSearchTactics[i]);
04900         }else{
04901           this->NewTactic(fSearchTactics[i]);
04902         }
04903       }else{
04904         this->NewTactic(fSearchTactics[i]);
04905       }
04906     }
04907     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 3" << endl;
04908     if(fDiagnosticPlots){
04909       this->DrawDiagnosticPlots(3);
04910     }
04911     break;
04912 
04913 
04914   case 33:
04915     fCutRawPE            = 0.0;
04916     fCutCorPE            = 0.0;
04917     fCutSigmaQ           = 5.0;
04918     fCutUseTimingMask    = true;
04919     fCutUseTargetStrips  = false;
04920     fCutGuessing         = false;
04921     fTrackingLowPECut    = 2.5;
04922     fStripWindow         = 5;
04923 
04924     this->MakeSearchTacticsX();
04925 
04926     for(Int_t iplane = 0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
04927       if(fPlanesAltLists[iplane][ALG_EAST].size()>0 && fPlanesAltLists[iplane][ALG_WEST].size()>0){
04928         this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04929         this->MakePlaneMap(iplane);
04930         this->GroupHits();
04931         this->SelectHits(iplane,false,true);
04932       }
04933     }
04934     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass 33" << endl;
04935     if(fDiagnosticPlots){
04936       this->DrawDiagnosticPlots(3);
04937     }
04938     break;
04939   case 4:
04940     //amShowing = true;
04941   case 5:
04942     fCutRawPE            = 0.0;
04943     fCutCorPE            = 0.0;
04944     fCutSigmaQ           = 0.0;
04945     fCutUseTimingMask    = false;
04946     fCutUseTargetStrips  = true;
04947     fCutGuessing         = false;
04948     fTrackingLowPECut    = 2.5;
04949     fStripWindow         = 100;
04950     this->MakeSearchTacticsY();
04951     literS = fSearchTactics.begin();
04952     while(literS!=fSearchTactics.end()){
04953       if((*literS).goodTactic){
04954         this->DeMuxSingles((*literS));
04955       }
04956       literS++;
04957     }
04958     MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::DeMuxPass Finished DeMuxPass " << ipass << endl;
04959     if(fDiagnosticPlots)this->DrawDiagnosticPlots(4);
04960     amShowing = false;
04961     break;
04962 
04963   default:
04964     MSG("AltDeMux", Msg::kError) << "AlgAltDeMuxBase::DeMuxPass - try to access undefined pass " << ipass << endl;
04965     break;
04966   }
04967   
04968   return;
04969   
04970 }

void AlgAltDeMuxBase::DeMuxSingleHitE Int_t  iplane,
PlexSEIdAltL pAlt,
Int_t  is
[protected]
 

Definition at line 5514 of file AlgAltDeMuxBase.cxx.

References DeMuxedSingle::altList, AltDeMuxCalc::CalcBestEast(), demuxedHitQU, demuxedHitQV, demuxedHitStripU, demuxedHitStripV, DeMuxHitE(), fDeMuxedSingles, fHitMap, fPlaneHit, fQHitMapE, PlexSEIdAltL::GetPlaneView(), NdemuxedHitsU, NdemuxedHitsV, pCalculator, DeMuxedSingle::Qcor, AltDeMuxCalc::QSigCorE(), AltDeMuxCalc::SetEast(), AltDeMuxCalc::SetPlane(), AltDeMuxCalc::SetView(), and DeMuxedSingle::status.

Referenced by BestGuessForSingleSidedHits(), CleanIsolatedHits(), DeMuxSingles(), ReMuxSingleSidedPlane(), and ValidatePlaneAgainstTarget().

05514                                                                                     { 
05515 
05516   PlaneView::PlaneView_t kView = pAltL->GetPlaneView();
05517   pCalculator->SetPlane(iplane);
05518   pCalculator->SetView(kView);
05519   pCalculator->SetEast(pAltL,istrip);
05520   pCalculator->CalcBestEast();
05521 
05522   DeMuxedSingle thisSingle;
05523   thisSingle.altList = pAltL;
05524   thisSingle.status  =  true;
05525   thisSingle.Qcor    = pCalculator->QSigCorE();
05526   fDeMuxedSingles[iplane].push_back(thisSingle);
05527 
05528   if(fDiagnosticPlots){
05529     if(kView==PlaneView::kU){
05530       if(NdemuxedHitsU[iplane]<MAX_DISPLAYED_HITS){
05531         demuxedHitStripU[iplane][NdemuxedHitsU[iplane]] = istrip;
05532         demuxedHitQU[iplane][NdemuxedHitsU[iplane]]     = pCalculator->QSigCorE();
05533         NdemuxedHitsU[iplane]++;
05534       }
05535     }
05536     if(kView==PlaneView::kV){
05537       if(NdemuxedHitsV[iplane]<MAX_DISPLAYED_HITS){
05538         demuxedHitStripV[iplane][NdemuxedHitsV[iplane]] = istrip;
05539         demuxedHitQV[iplane][NdemuxedHitsV[iplane]]     = pCalculator->QSigCorE();
05540         NdemuxedHitsV[iplane]++;
05541       }
05542     }
05543   }
05544   
05545   fPlaneHit[iplane]++;
05546   fHitMap[iplane][fPlaneHit[iplane]]  = istrip;
05547   fQHitMapE[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorE();
05548 
05549   //  cout << "DEMUXING SINGLE E : " << iplane << ":" << istrip  << " : " << pCalculator->QSigCorE() << ":" << this->XTalkCharge(pAltL,istrip) << endl;
05550 
05551   this->DeMuxHitE(iplane,pAltL,istrip);
05552 
05553   return;
05554 }

void AlgAltDeMuxBase::DeMuxSingleHitW Int_t  iplane,
PlexSEIdAltL pAlt,
Int_t  is
[protected]
 

Definition at line 5558 of file AlgAltDeMuxBase.cxx.

References DeMuxedSingle::altList, AltDeMuxCalc::CalcBestWest(), demuxedHitQU, demuxedHitQV, demuxedHitStripU, demuxedHitStripV, DeMuxHitW(), fDeMuxedSingles, fHitMap, fPlaneHit, fQHitMapW, PlexSEIdAltL::GetPlaneView(), NdemuxedHitsU, NdemuxedHitsV, pCalculator, DeMuxedSingle::Qcor, AltDeMuxCalc::QSigCorW(), AltDeMuxCalc::SetPlane(), AltDeMuxCalc::SetView(), AltDeMuxCalc::SetWest(), and DeMuxedSingle::status.

Referenced by BestGuessForSingleSidedHits(), CleanIsolatedHits(), DeMuxSingles(), ReMuxSingleSidedPlane(), and ValidatePlaneAgainstTarget().

05558                                                                                     { 
05559 
05560   PlaneView::PlaneView_t kView = pAltL->GetPlaneView();
05561   pCalculator->SetPlane(iplane);
05562   pCalculator->SetView(kView);
05563   pCalculator->SetWest(pAltL,istrip);
05564   pCalculator->CalcBestWest();
05565 
05566 
05567   DeMuxedSingle thisSingle;
05568   thisSingle.altList = pAltL;
05569   thisSingle.status  = true;
05570   thisSingle.Qcor    = pCalculator->QSigCorW();
05571   fDeMuxedSingles[iplane].push_back(thisSingle);
05572 
05573   if(fDiagnosticPlots){
05574     if(kView==PlaneView::kU){
05575       if(NdemuxedHitsU[iplane]<MAX_DISPLAYED_HITS){
05576         demuxedHitStripU[iplane][NdemuxedHitsU[iplane]] = istrip;
05577         demuxedHitQU[iplane][NdemuxedHitsU[iplane]]     = pCalculator->QSigCorW();
05578         NdemuxedHitsU[iplane]++;
05579       }
05580     }
05581     if(kView==PlaneView::kV){
05582       if(NdemuxedHitsV[iplane]<MAX_DISPLAYED_HITS){
05583         demuxedHitStripV[iplane][NdemuxedHitsV[iplane]] = istrip;
05584         demuxedHitQV[iplane][NdemuxedHitsV[iplane]]     = pCalculator->QSigCorW();
05585         NdemuxedHitsV[iplane]++;
05586       }
05587     }
05588   }
05589   
05590   fPlaneHit[iplane]++;
05591   fHitMap[iplane][fPlaneHit[iplane]]  = istrip;
05592   fQHitMapW[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorW();
05593   this->DeMuxHitW(iplane,pAltL,istrip);
05594 
05595   return;
05596 }

void AlgAltDeMuxBase::DeMuxSingles DeMuxSearchTactic  tactic  )  [protected]
 

Definition at line 6252 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a1, abs(), DeMuxSingleHitE(), DeMuxSingleHitW(), fCutUseTimingMask, fEventType, fFitHitU, fFitHitV, fFitQHitU, fFitQHitV, fFitTimeU, fHitMap, fHoughStatus, fPlaneHit, fPlanePair, fPlanesAltLists, fQHitMapE, fQHitMapW, fTargetStrips, fTrackingLowPECut, fUVMap, fUVmask, DeMuxSearchTactic::highplane, DeMuxSearchTactic::iplane, IsXTalk(), DeMuxSearchTactic::lowplane, MakeMultipleTargets(), MAX_NUMBER_OF_PLANES, s(), DeMuxFitResult_t::status, VetoHitE(), and VetoHitW().

Referenced by DeMuxPass().

06253 {
06254   vector <PlexSEIdAltL*>::iterator literA;
06255 
06256   int i = tactic.iplane;
06257   int j = tactic.lowplane;
06258   int k = tactic.highplane;
06259   Float_t target;
06260   int itarget;
06261   int it;
06262   int s;
06263   int sbest;
06264   int closeness; 
06265 
06266   int sbest1;
06267   int closeness1;
06268   int sbest2;
06269   int closeness2;
06270 
06271   fTargetStrips.erase(fTargetStrips.begin(),fTargetStrips.end());
06272   if(fEventType==MULTIPLE_MUON)MakeMultipleTargets(i);
06273   
06274   bool useHoughSlope         = fUseHoughSlope;
06275   bool useFitSlopeTime       = fUseFitSlopeTime;
06276   bool useFitSlopeHits       = fUseFitSlopeHits;
06277   bool useInterpolation      = false;
06278   // bool useSafeExtrapolationF = false;
06279   // bool useSafeExtrapolationB = false;
06280   bool useExtrapolationF     = false;
06281   bool useExtrapolationB     = false;
06282   bool useSameStrip          = fUseSameStrip;
06283   bool useLevelStripF        = false;
06284   bool useLevelStripB        = false;
06285   bool treatAsUNKNOWN        = false;
06286 
06287   if(fEventType==UNKNOWN)treatAsUNKNOWN = true;
06288   if(fEventType==SINGLE_MUON)useFitSlopeHits=true;
06289   if(fEventType==THROUGH_GOING_MUON)useFitSlopeHits=true;
06290   if(fEventType==STRAIGHT_THROUGH_GOING_MUON)useFitSlopeHits=true;
06291   if(fEventType==MULTIPLE_MUON){
06292     useSameStrip = false;
06293     if( (fHoughStatus==true)&&(j>0||k>0))useHoughSlope = true;
06294     if( (fHoughStatus==false)||(j==0&&k==0))treatAsUNKNOWN = true;
06295   }
06296 
06297   if(treatAsUNKNOWN){
06298     if(fPlaneHit[i]==0)useInterpolation  = fUseInterpolation;
06299     // if(fPlaneHit[i]==0)useExtrapolationF = fUseExtrapolationF;
06300     //if(fPlaneHit[i]==0)useExtrapolationB = fUseExtrapolationB;
06301     if(i>=247&&i<=251 ){
06302       useInterpolation   = false;
06303       if(i>249){
06304         useExtrapolationF = fUseExtrapolationF;
06305         useExtrapolationB = false;
06306       }else{
06307         useExtrapolationB = fUseExtrapolationB;
06308         useExtrapolationF = false;
06309       }
06310     }
06311     useSameStrip      = fUseSameStrip;
06312   }
06313 
06314 
06315 
06316   for(Int_t index = 0; index<3; index++){
06317     Float_t slopeU;
06318     Float_t slopeV;
06319     bool    useSlope = false;
06320     if(index==0){
06321       useSlope = useFitSlopeHits;
06322       if(!fFitQHitU.status)slopeU  = fFitHitU.a1;
06323       if(!fFitQHitV.status)slopeV  = fFitHitV.a1;
06324       if(fFitQHitU.status)slopeU  = fFitQHitU.a1;
06325       if(fFitQHitV.status)slopeV  = fFitQHitV.a1;
06326     }
06327     if(index==1){
06328       useSlope = useFitSlopeTime;
06329       slopeU  = fFitTimeU.a1;
06330       slopeV  = fFitTimeU.a1;
06331     }
06332     if(index==2){
06333       useSlope = useHoughSlope;
06334       slopeU  = fHoughSlopeU;
06335       slopeV  = fHoughSlopeV;
06336     }
06337 
06338     if(useSlope){
06339       if(j>0){
06340         for(int jj=1;jj<=fPlanePair[j];jj++){
06341           Int_t je = j;
06342           if(i>249&&j<249)je-=20;
06343           if(fUVMap[i]==PlaneView::kU)target = fHitMap[j][jj] + slopeU*(i-je);
06344           if(fUVMap[i]==PlaneView::kV)target = fHitMap[j][jj] + slopeV*(i-je);
06345           itarget = static_cast<int>(target);
06346           if(itarget>-24&&itarget<216)fTargetStrips.push_back(itarget);
06347           if(amWriting)cout << "Slope Target j : " << itarget << endl;
06348         }
06349       }
06350       if(k>0){
06351         for(int kk=1;kk<=fPlanePair[k];kk++){
06352           Int_t ke = k;
06353           if(i<249&&k>249)ke+=20;
06354           if(fUVMap[i]==PlaneView::kU)target = fHitMap[k][kk] + slopeU*(i-ke);
06355           if(fUVMap[i]==PlaneView::kV)target = fHitMap[k][kk] + slopeV*(i-ke);
06356           itarget = static_cast<int>(target);
06357           if(itarget>-24&&itarget<216)fTargetStrips.push_back(itarget);
06358           if(amWriting)cout << "Slope Target k : " << itarget << endl;
06359         }
06360       }
06361     }
06362   }
06363 
06364   if(useSameStrip&&fPlanePair[i]>0){
06365     for(int ii=1;ii<=fPlanePair[i];ii++){
06366       itarget = fHitMap[i][ii];
06367       fTargetStrips.push_back(itarget);
06368       if(amWriting)cout << "USE SAME STRIP : " << itarget << endl;
06369     }
06370   }
06371 
06372   if(useInterpolation && j>0 && k>0){
06373     for(int jj=1;jj<=fPlanePair[j];jj++){
06374       if(fQHitMapE[j][jj]>fTrackingLowPECut && fQHitMapW[j][jj]>fTrackingLowPECut){
06375         for(int kk=1;kk<=fPlaneHit[k];kk++){
06376           if(fQHitMapE[k][kk]>fTrackingLowPECut && fQHitMapW[k][kk]>fTrackingLowPECut){
06377             it =fHitMap[j][jj] + (fHitMap[k][kk]-fHitMap[j][jj])*(i-j)/(k-j);
06378             // Interpolate accross SM boundart 
06379             if(j<249 && i>249)it =fHitMap[j][jj] + (fHitMap[k][kk]-fHitMap[j][jj])*(i-j+15)/(k-j+20);
06380             if(i<249 && k>249)it =fHitMap[j][jj] + (fHitMap[k][kk]-fHitMap[j][jj])*(i-j)/(k+20-j);
06381             fTargetStrips.push_back(it);  
06382             if(amWriting)cout << "INTERPOLATE : " << it << endl;
06383           }
06384         }
06385       }
06386     }
06387   }
06388   
06389   if(useExtrapolationF){
06390     if(k>0 && k<MAX_NUMBER_OF_PLANES-2){
06391       int n = (k-i)/2;
06392       for(int kk=1;kk<=fPlanePair[k];kk++){
06393         int kp = k+2;
06394         if(k>249||kp<249){
06395           for (int kkp=1;kkp<=fPlanePair[kp];kkp++){
06396             itarget = (n+1)*fHitMap[k][kk] - n*fHitMap[kp][kkp];
06397             fTargetStrips.push_back(itarget);
06398             if(amWriting)cout << "EXTRAPOLATEF : " << itarget << endl;
06399           }
06400         }
06401       }
06402     }
06403   }
06404 
06405   if(useExtrapolationB){
06406     if(j>=2){
06407       int n = (i-j)/2;
06408       for(int jj=1;jj<=fPlanePair[j];jj++){
06409         int jm = j-2;
06410         if(jm>249||j<249){
06411           for(int jjm=1;jjm<=fPlanePair[jm];jjm++){
06412             itarget = (n+1)*fHitMap[j][jj] - n*fHitMap[jm][jjm];
06413             fTargetStrips.push_back(itarget);
06414             if(amWriting)cout << "EXTRAPOLATEB : " << itarget << endl;
06415           }
06416         }
06417       }
06418     }
06419   }
06420 
06421   useLevelStripF = false;
06422   useLevelStripB = false;
06423 
06424   if(fTargetStrips.size()==0)useLevelStripF = true;
06425   if(fTargetStrips.size()==0)useLevelStripB = true;
06426  
06427   if(j>0 && useLevelStripB){
06428     if(j!=247&&j!=248){
06429       for(int jj=1;jj<=fPlanePair[j];jj++){      
06430         itarget = fHitMap[j][jj];
06431         fTargetStrips.push_back(itarget);
06432         if(amWriting)cout << "LEVEL B       : " << itarget << endl;
06433       }
06434     }
06435   }
06436   if(k>0 && useLevelStripF){
06437     if(k!=247&&k!=248){
06438       for(int kk=1;kk<=fPlanePair[k];kk++){
06439         itarget = fHitMap[k][kk];
06440         fTargetStrips.push_back(itarget);
06441         if(amWriting)cout << "LEVEL F       : " << itarget << endl;
06442       }
06443     }
06444   }  
06445 
06446   
06447   if(fTargetStrips.size()<1)return;  
06448 
06449   Int_t currentPlane = i;  
06450   PlaneView::PlaneView_t kView;
06451 
06452   for(Int_t iew=ALG_EAST;iew<=ALG_WEST;iew++){
06453     if(fPlanesAltLists[i][iew].size()>0){
06454       while (fPlanesAltLists[i][iew].size()>0){
06455         sbest =0;
06456         closeness = 999;
06457         sbest1 =0;
06458         closeness1 = 999;
06459         sbest2 =0;
06460         closeness2 = 999;
06461         literA = fPlanesAltLists[i][iew].begin();
06462         (*literA)->SetFirst();
06463         kView = (*literA)->GetPlaneView();
06464         while( (*literA)->IsValid() ){
06465           s = (*literA)->GetCurrentSEId().GetStrip();
06466           bool found = false;
06467           if(fCutUseTimingMask==false || fUVmask[i][s]){  
06468             if((*literA)->GetCurrentWeight()>-1.){
06469               for(unsigned int t=0;t<fTargetStrips.size()&&found==false;t++){
06470                 if(abs(fTargetStrips[t]-s)<closeness){
06471                   closeness = abs(fTargetStrips[t]-s);
06472                   sbest = s;                    
06473                   if(closeness==0)found = true;
06474                 }
06475               }
06476             }else{
06477               for(unsigned int t=0;t<fTargetStrips.size()&&found==false;t++){
06478                 if(abs(fTargetStrips[t]-s)<closeness1){
06479                   closeness1 = abs(fTargetStrips[t]-s);
06480                   sbest1 = s;                   
06481                   if(closeness1==0)found = true;
06482                 }
06483               }
06484             }
06485           }else{
06486             for(unsigned int t=0;t<fTargetStrips.size()&&found==false;t++){
06487               if(abs(fTargetStrips[t]-s)<closeness2){
06488                 closeness2 = abs(fTargetStrips[t]-s);
06489                 sbest2 = s;                     
06490               }
06491             }
06492           }
06493           (*literA)->Next();
06494         }
06495         if(closeness>=999|| (closeness>5 && closeness1<closeness)  ){
06496           sbest=sbest1;
06497           closeness=closeness1;
06498         }
06499         if(closeness>=999&&closeness1>=999){
06500           sbest=sbest2;
06501           closeness=closeness2;
06502         }
06503         if(closeness<999){
06504           if(amShowing){
06505             bool foundit = false;
06506             for(int ix=1;ix<=fPlaneHit[currentPlane];ix++){
06507               if(abs(sbest-fHitMap[currentPlane][ix])<2.5)foundit=true;
06508             }
06509             if(foundit==false){
06510               (*literA)->SetFirst();
06511               IsXTalk(*literA);
06512             }
06513           }
06514           if(iew==ALG_EAST)this->DeMuxSingleHitE(currentPlane,*literA, sbest);
06515           if(iew==ALG_WEST)this->DeMuxSingleHitW(currentPlane,*literA, sbest);
06516         }else{
06517           if(iew==ALG_EAST)this->VetoHitE(currentPlane,*literA);
06518           if(iew==ALG_WEST)this->VetoHitW(currentPlane,*literA);                }
06519       }
06520     }
06521   }
06522   
06523   return;
06524 }

void AlgAltDeMuxBase::DeMuxWhatsLeft  )  [protected]
 

Definition at line 4975 of file AlgAltDeMuxBase.cxx.

References ALG_EAST, ALG_WEST, BestGuessForSingleSidedHits(), DeMuxPass(), fCutCorPE, fCutGuessing, fCutRawPE, fCutSigmaQ, fCutUseMultipleLines, fCutUseTargetStrips, fCutUseTimingMask, fPlanesAltLists, fStripWindow, GroupHits(), MakePlaneMap(), ResetMap(), and SelectHits().

Referenced by AlgAltDeMux::DeMuxTidyUp().

04975                                     {
04976 
04977   fCutRawPE            = 0.0;
04978   fCutCorPE            = 0.0;
04979   fCutSigmaQ           = 10.0;
04980   fCutUseTimingMask    = false;
04981   fCutUseTargetStrips  = false;
04982   fCutGuessing         = false;
04983   fCutUseMultipleLines = false;
04984   fStripWindow         = 5;
04985   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
04986     if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
04987       this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
04988       this->MakePlaneMap(iplane);
04989       this->GroupHits();
04990       this->SelectHits(iplane,false);
04991     }
04992   }
04993 
04994   
04995 
04996   // Next try demux groups which are golden with timing mask
04997 
04998   fCutRawPE            = 0.0;
04999   fCutCorPE            = 0.0;
05000   fCutSigmaQ           = 10.0;
05001   fCutUseTimingMask    = true;
05002   fCutUseTargetStrips  = false;
05003   fCutGuessing         = false;
05004   fCutUseMultipleLines = false;
05005   fStripWindow         = 5;
05006   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05007     if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
05008       //cout << "*********************************WHATS LEFT : PASS 1 like " << iplane << endl;
05009       this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
05010       this->MakePlaneMap(iplane);
05011       this->GroupHits();
05012       this->SelectHits(iplane,false);
05013     }
05014   }
05015   
05016 
05017   // Demux remaining pairs - using validate plane and the timing mask as a seed
05018   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05019     if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
05020       //      cout << "*********************************WHATS LEFT : VALIDATE PLANE " << iplane << fPlanesAltLists[iplane][ALG_EAST].size() << " : " << fPlanesAltLists[iplane][ALG_EAST].size() << endl;
05021       //BestGuessForPlane(iplane);
05022     }
05023   }
05024   
05025   // Should only have singles left now.....
05026   DeMuxPass(4);
05027   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05028     if(fPlanesAltLists[iplane][ALG_EAST].size()>0||fPlanesAltLists[iplane][ALG_WEST].size()>0){
05029       //  cout << "*********************************WHATS LEFT : SINGLES " << iplane << endl;
05030       this->BestGuessForSingleSidedHits(iplane);
05031     }
05032   }
05033 
05034   return;
05035   
05036 }

void AlgAltDeMuxBase::DisplayPixelMap  )  [protected]
 

Definition at line 2060 of file AlgAltDeMuxBase.cxx.

References fPMTmap, fPMTtot, and MSG.

02061 {
02062 
02063   MSG("AltDeMux", Msg::kVerbose) << "AlgAltDeMuxBase::DisplayPixelMap : " << endl;
02064   for(int i=0; i<MAX_NUMBER_OF_PMTS; i++){
02065     if(fPMTtot[i]>0){
02066       MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::DisplayPixelMap PMT : " << i << endl;
02067       MSG("AltDeMux", Msg::kDebug) << fPMTmap[i][0]  << ":" << fPMTmap[i][1]  << 
02068         ":" << fPMTmap[i][2]  << ":" << fPMTmap[i][3]  << endl;
02069       MSG("AltDeMux", Msg::kDebug) << fPMTmap[i][4]  << ":" << fPMTmap[i][5]  << 
02070         ":" << fPMTmap[i][6]  << ":" << fPMTmap[i][7]  << endl;
02071       MSG("AltDeMux", Msg::kDebug) << fPMTmap[i][8]  << ":" << fPMTmap[i][9]  << 
02072         ":" << fPMTmap[i][10] << ":" << fPMTmap[i][11] << endl;
02073       MSG("AltDeMux", Msg::kDebug) << fPMTmap[i][12] << ":" << fPMTmap[i][13] << 
02074         ":" << fPMTmap[i][14] << ":" << fPMTmap[i][15] << endl;
02075 
02076     }
02077   }
02078   
02079   return;
02080 
02081 }

Float_t AlgAltDeMuxBase::DistanceToNearestInPlane PlexSEIdAltL paltlist  )  [protected]
 

Definition at line 896 of file AlgAltDeMuxBase.cxx.

References abs(), fDeMuxedPlanesAltLists, PlexSEIdAltL::GetBestSEId(), PlexSEIdAltL::GetPlane(), and PlexStripEndId::GetStrip().

Referenced by FinalReTagCrossTalk().

00897 {
00898 
00899   Float_t dmin=999;
00900   PlexStripEndId  seid;
00901   PlexStripEndId dseid;
00902   
00903   int iplane = paltlist->GetPlane();
00904   seid = paltlist->GetBestSEId();
00905   int strip = seid.GetStrip();
00906 
00907   if(iplane>MAX_NUMBER_OF_PLANES)return dmin;
00908 
00909   for(int iew = ALG_EAST; iew<=ALG_WEST; iew++){
00910     for(uint i=0;i<fDeMuxedPlanesAltLists[iplane][iew].size();i++){
00911       if(fDeMuxedPlanesAltLists[iplane][iew][i]!=paltlist){
00912         dseid = fDeMuxedPlanesAltLists[iplane][iew][i]->GetBestSEId();
00913         int dstrip = dseid.GetStrip();
00914         int d = abs(dstrip-strip);
00915         if(d<dmin)dmin=d;
00916       }
00917     }
00918   }
00919 
00920   return dmin;
00921 }

void AlgAltDeMuxBase::DrawDiagnosticPlots Int_t  ipass  )  [protected]
 

Definition at line 2085 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a0, DeMuxFitResult_t::a1, demuxedHitQU, demuxedHitQV, demuxedHitStripU, demuxedHitStripV, fCanvas, fEventType, fHighestPlane, fList, fLowestPlane, fUMask, fUpad, fUTime, fUview, fUZFitQSSM1, fUZFitQSSM2, fUZFitS, fUZFitSSM1, fUZFitSSM2, fUZFitT, fUZFitTSM1, fUZFitTSM2, fVMask, fVpad, fVTime, fVview, fVZFitQSSM1, fVZFitQSSM2, fVZFitS, fVZFitSSM1, fVZFitSSM2, fVZFitT, fVZFitTSM1, fVZFitTSM2, MakeFitPolyLines(), multipleMuonInterceptsU, multipleMuonInterceptsV, NdemuxedHitsU, NdemuxedHitsV, and DeMuxFitResult_t::status.

Referenced by CleanMultiple(), AlgAltDeMux::DeMuxGoldenHits(), DeMuxPass(), FitAsCosmic(), MakeTimingMask(), ReMakeMask(), ReMakeTimingMask(), AlgAltDeMux::RunAlg(), and AlgAltDeMux::ValidateContainedCandidate().

02086 {  
02087   if(!fDiagnosticPlots)return;
02088   TPolyMarker* pTPU1;
02089   TPolyMarker* pTPV1;
02090   TPolyMarker* pTPU2;
02091   TPolyMarker* pTPV2;
02092   TPolyMarker* pTPU3;
02093   TPolyMarker* pTPV3;
02094   TPolyMarker* pTPU4;
02095   TPolyMarker* pTPV4;
02096   TPolyMarker* pTPU5;
02097   TPolyMarker* pTPV5;
02098   float xU1[1000];
02099   float yU1[1000];
02100   float xU2[1000];
02101   float yU2[1000];
02102   float xU3[1000];
02103   float yU3[1000];
02104   float xU4[1000];
02105   float yU4[1000];
02106   float xU5[1000];
02107   float yU5[1000];
02108   int nU1=0;
02109   int nU2=0;
02110   int nU3=0;
02111   int nU4=0;
02112   int nU5=0;
02113   float xV1[1000];
02114   float yV1[1000];
02115   float xV2[1000];
02116   float yV2[1000];
02117   float xV3[1000];
02118   float yV3[1000];
02119   float xV4[1000];
02120   float yV4[1000];
02121   float xV5[1000];
02122   float yV5[1000];
02123   int nV1=0;
02124   int nV2=0;
02125   int nV3=0;
02126   int nV4=0;
02127   int nV5=0;
02128 
02129   Float_t markerSize = 1.0;
02130   if(fEventType==MULTIPLE_MUON)markerSize =0.75;
02131 
02132   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
02133     for(Int_t i=0;i<NdemuxedHitsU[iplane];i++){
02134       for(Int_t j=i+1;j<NdemuxedHitsU[iplane];j++){
02135         if(demuxedHitStripU[iplane][i]==demuxedHitStripU[iplane][j]){
02136           demuxedHitQU[iplane][i] +=demuxedHitQU[iplane][j];
02137           demuxedHitQU[iplane][j] = 0;
02138         }
02139       }
02140     }
02141 
02142     for(Int_t i=0;i<NdemuxedHitsU[iplane];i++){
02143       if(demuxedHitQU[iplane][i]>0 && demuxedHitQU[iplane][i]<=3){
02144         xU1[nU1] = iplane;
02145         yU1[nU1] = demuxedHitStripU[iplane][i];
02146         nU1++;
02147       }
02148       if(demuxedHitQU[iplane][i]>=3 && demuxedHitQU[iplane][i]<=10){
02149         xU2[nU2] = iplane;
02150         yU2[nU2] = demuxedHitStripU[iplane][i];
02151         nU2++;
02152       }
02153       if(demuxedHitQU[iplane][i]>=10 && demuxedHitQU[iplane][i]<=25){
02154         xU3[nU3] = iplane;
02155         yU3[nU3] = demuxedHitStripU[iplane][i];
02156         nU3++;
02157       }
02158       if(demuxedHitQU[iplane][i]>=25 && demuxedHitQU[iplane][i]<=100){
02159         xU4[nU4] = iplane;
02160         yU4[nU4] = demuxedHitStripU[iplane][i];
02161         nU4++;
02162       }
02163       if(demuxedHitQU[iplane][i]>=100){
02164         xU5[nU5] = iplane;
02165         yU5[nU5] = demuxedHitStripU[iplane][i];
02166         nU5++;
02167       }
02168     }
02169   }
02170 
02171 
02172   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
02173     for(Int_t i=0;i<NdemuxedHitsV[iplane];i++){
02174       for(Int_t j=i+1;j<NdemuxedHitsV[iplane];j++){
02175         if(demuxedHitStripV[iplane][i]==demuxedHitStripV[iplane][j]){
02176           demuxedHitQV[iplane][i] +=demuxedHitQV[iplane][j];
02177           demuxedHitQV[iplane][j] = 0;
02178         }
02179       }
02180     }
02181     
02182     for(int i=0;i<NdemuxedHitsV[iplane];i++){
02183       if(demuxedHitQV[iplane][i]>=0 && demuxedHitQV[iplane][i]<=3){
02184         xV1[nV1] = iplane;
02185         yV1[nV1] = demuxedHitStripV[iplane][i];
02186         nV1++;
02187       }
02188       if(demuxedHitQV[iplane][i]>=3 && demuxedHitQV[iplane][i]<=10){
02189         xV2[nV2] = iplane;
02190         yV2[nV2] = demuxedHitStripV[iplane][i];
02191         nV2++;
02192       }
02193       if(demuxedHitQV[iplane][i]>=10 && demuxedHitQV[iplane][i]<=25){
02194         xV3[nV3] = iplane;
02195         yV3[nV3] = demuxedHitStripV[iplane][i];
02196         nV3++;
02197       }
02198       if(demuxedHitQV[iplane][i]>=25 && demuxedHitQV[iplane][i]<=100){
02199         xV4[nV4] = iplane;
02200         yV4[nV4] = demuxedHitStripV[iplane][i];
02201         nV4++;
02202       }
02203       if(demuxedHitQV[iplane][i]>=100){
02204         xV5[nV5] = iplane;
02205         yV5[nV5] = demuxedHitStripV[iplane][i];
02206         nV5++;
02207       }
02208     }
02209   }
02210 
02211   pTPU1 = new TPolyMarker(nU1,xU1,yU1);
02212   pTPU1->SetMarkerStyle(20);
02213   pTPU1->SetMarkerColor(kYellow);
02214   pTPU1->SetMarkerSize(markerSize);
02215 
02216   pTPU2 = new TPolyMarker(nU2,xU2,yU2);
02217   pTPU2->SetMarkerStyle(20);
02218   pTPU2->SetMarkerColor(kCyan);
02219   pTPU2->SetMarkerSize(markerSize);
02220 
02221   pTPU3 = new TPolyMarker(nU3,xU3,yU3);
02222   pTPU3->SetMarkerStyle(20);
02223   pTPU3->SetMarkerColor(kBlue);
02224   pTPU3->SetMarkerSize(markerSize);
02225 
02226   pTPU4 = new TPolyMarker(nU4,xU4,yU4);
02227   pTPU4->SetMarkerStyle(20);
02228   pTPU4->SetMarkerColor(kBlack);
02229   pTPU4->SetMarkerSize(markerSize);
02230 
02231   pTPU5 = new TPolyMarker(nU5,xU5,yU5);
02232   pTPU5->SetMarkerStyle(20);
02233   pTPU5->SetMarkerColor(kRed);
02234   pTPU5->SetMarkerSize(markerSize);
02235 
02236   pTPV1 = new TPolyMarker(nV1,xV1,yV1);
02237   pTPV1->SetMarkerStyle(20);
02238   pTPV1->SetMarkerColor(kYellow);
02239   pTPV1->SetMarkerSize(markerSize);
02240 
02241   pTPV2 = new TPolyMarker(nV2,xV2,yV2);
02242   pTPV2->SetMarkerStyle(20);
02243   pTPV2->SetMarkerColor(kCyan);
02244   pTPV2->SetMarkerSize(markerSize);
02245 
02246   pTPV3 = new TPolyMarker(nV3,xV3,yV3);
02247   pTPV3->SetMarkerStyle(20);
02248   pTPV3->SetMarkerColor(kBlue);
02249   pTPV3->SetMarkerSize(markerSize);
02250 
02251   pTPV4 = new TPolyMarker(nV4,xV4,yV4);
02252   pTPV4->SetMarkerStyle(20);
02253   pTPV4->SetMarkerColor(kBlack);
02254   pTPV4->SetMarkerSize(markerSize);
02255 
02256   pTPV5 = new TPolyMarker(nV5,xV5,yV5);
02257   pTPV5->SetMarkerStyle(20);
02258   pTPV5->SetMarkerColor(kRed);
02259   pTPV5->SetMarkerSize(markerSize);
02260 
02261   // Keep track of the TPolyMarkers - delete them later
02262 
02263   fList->Add(pTPV1);
02264   fList->Add(pTPV2);
02265   fList->Add(pTPV3);
02266   fList->Add(pTPV4);
02267   fList->Add(pTPV5);
02268   fList->Add(pTPU1);
02269   fList->Add(pTPU2);
02270   fList->Add(pTPU3);
02271   fList->Add(pTPU4);
02272   fList->Add(pTPU5);
02273 
02274   fUpad->cd();
02275 
02276   if(ipass==-2&&fUTime){
02277     fUTime->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane); 
02278     fUTime->SetMaximum(0.1);
02279     fUTime->SetLineColor(kRed);
02280     fUTime->SetFillColor(kRed);
02281     fUTime->Draw("BOX");
02282   }
02283   if(ipass==-1&&fUMask){
02284     fUMask->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane); 
02285     if(fUTime)fUMask->Add(fUTime,1.);
02286     fUMask->SetLineColor(kGreen);
02287     fUMask->SetFillColor(kGreen);
02288     fUMask->SetMaximum(1.);
02289     if(fUMask)fUMask->Draw("BOX");
02290   }
02291 
02292   if(ipass>=0){
02293     if (fUview){
02294       fUview->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane);
02295       fUview->Draw(); 
02296     }
02297     if (fUTime){
02298       fUTime->SetMaximum(1.);
02299       fUTime->Draw();
02300     }
02301     if (fUMask){
02302       fUMask->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane);
02303       fUMask->Add(fUTime,1.);
02304       fUMask->SetLineColor(kGreen); 
02305       fUMask->SetFillColor(kGreen);
02306       fUMask->SetMaximum(1.);
02307       fUMask->Draw("BOX");
02308     }
02309     pTPU1->Draw();
02310     pTPU2->Draw();
02311     pTPU3->Draw();
02312     pTPU4->Draw();
02313     pTPU5->Draw();
02314   }
02315 
02316   if(fUZFitS)fUZFitS->Draw();
02317   if(fUZFitT)fUZFitT->Draw();
02318   if(fUZFitSSM1)fUZFitSSM1->Draw();
02319   if(fUZFitQSSM2)fUZFitQSSM2->Draw();
02320   if(fUZFitQSSM1)fUZFitQSSM1->Draw();
02321   if(fUZFitSSM2)fUZFitSSM2->Draw();
02322   if(fUZFitTSM1)fUZFitTSM1->Draw();
02323   if(fUZFitTSM2)fUZFitTSM2->Draw();
02324   if(fEventType==MULTIPLE_MUON){
02325     DeMuxFitResult_t resultU;
02326     resultU.a0 = fHoughSlopeU;
02327     resultU.status = true;
02328     for(UInt_t i = 0; i< multipleMuonInterceptsU.size();i++){
02329       resultU.a1 = fHoughSlopeU;
02330       resultU.a0 = multipleMuonInterceptsU[i];
02331       TPolyLine* tP1 = NULL;
02332       TPolyLine* tP2 = NULL;
02333       this->MakeFitPolyLines(resultU, tP1, tP2, 1, 1);
02334       tP1->Draw();
02335       tP2->Draw();
02336     }
02337   }
02338 
02339 
02340   fVpad->cd();
02341 
02342   if(ipass==-2&&fVTime){
02343     fVTime->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane); 
02344     fVTime->SetMaximum(0.1);
02345     fVTime->SetLineColor(kRed);
02346     fVTime->SetFillColor(kRed);
02347     if(fVTime)fVTime->Draw("BOX");
02348   }
02349   if(ipass==-1&&fVMask){
02350     fVMask->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane); 
02351     if(fVTime)fVMask->Add(fVTime,1.);
02352     fVMask->SetLineColor(kGreen);
02353     fVMask->SetFillColor(kGreen);
02354     fVMask->SetMaximum(1.);
02355     fVMask->Draw("BOX");
02356   }
02357 
02358   if(ipass>=0){
02359     if (fVview){
02360       fVview->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane);
02361       fVview->Draw();
02362     }
02363     if (fVTime){
02364       fVTime->SetMaximum(1.);
02365       fVTime->Draw();
02366     }
02367     if (fVMask){
02368       fVMask->GetXaxis()->SetRangeUser(fLowestPlane,fHighestPlane);
02369       fVMask->Add(fVTime,1.);
02370       fVMask->SetLineColor(kGreen);
02371       fVMask->SetFillColor(kGreen);
02372       fVMask->SetMaximum(1.);
02373       fVMask->Draw("BOX");
02374     }
02375     pTPV1->Draw();    
02376     pTPV2->Draw();
02377     pTPV3->Draw();
02378     pTPV4->Draw();
02379     pTPV5->Draw();
02380   }
02381 
02382   if(fVZFitT)fVZFitT->Draw();
02383   if(fVZFitS)fVZFitS->Draw();
02384   if(fVZFitSSM1)fVZFitSSM1->Draw();
02385   if(fVZFitSSM2)fVZFitSSM2->Draw();
02386   if(fVZFitQSSM1)fVZFitQSSM1->Draw();
02387   if(fVZFitQSSM2)fVZFitQSSM2->Draw();
02388   if(fVZFitTSM1)fVZFitTSM1->Draw();
02389   if(fVZFitTSM2)fVZFitTSM2->Draw();
02390 
02391   if(fEventType==MULTIPLE_MUON){
02392     DeMuxFitResult_t resultV;
02393     for(UInt_t i = 0; i< multipleMuonInterceptsV.size();i++){
02394       resultV.a1 = fHoughSlopeV;
02395       resultV.a0 = multipleMuonInterceptsV[i];
02396       resultV.status = true;
02397       TPolyLine* tP1 = NULL;
02398       TPolyLine* tP2 = NULL;
02399       this->MakeFitPolyLines(resultV, tP1, tP2, 1, 1);
02400       tP1->Draw();
02401       tP2->Draw();
02402     }
02403 
02404 
02405   }
02406 
02407 
02408   fCanvas->Update();
02409   return;
02410   
02411 }

bool AlgAltDeMuxBase::DumpValidateBeamPlane Int_t  iplane,
bool  useTimeMask = false
[protected]
 

Definition at line 2745 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a0, DeMuxFitResult_t::a1, amWriting, PlaneValidity_t::chi2DQ, fDeMuxedPairs, fDeMuxedPlanesAltLists, fEventType, fFitHitU, fFitHitV, fFitQHitU, fFitQHitV, fFitTimeU, fFitTimeV, fHitMap, fPlaneHit, fPlanesAltLists, PlaneValidity_t::fractionQE, PlaneValidity_t::fractionQW, fUVMap, fUVmask, PlaneValidity_t::largestContigGroup, MSG, ReMuxPlane(), DeMuxFitResult_t::status, PlaneValidity_t::strips, PlaneValidity_t::stripSpan, ValidateOneSidedPlaneForPattern(), ValidatePlaneForPattern(), and ValidityComp().

02745                                                                          {
02746 
02747   bool fitStatusT;
02748   bool fitStatusH;
02749 
02750 
02751   if(fPlaneHit[iplane]==0)return false;
02752 
02753   if(fEventType==MULTIPLE_MUON){
02754     MSG("AltDeMux", Msg::kWarning) << "AlgAltDeMuxBase::ValidateBeamPlane doesn't yet Multiple Muons " << endl; 
02755     return false;
02756   }
02757   amWriting = false;
02758 
02759 
02760   Int_t easthits = fDeMuxedPlanesAltLists[iplane][ALG_EAST].size()+
02761     fPlanesAltLists[iplane][ALG_EAST].size();
02762   Int_t westhits = fDeMuxedPlanesAltLists[iplane][ALG_WEST].size()+
02763     fPlanesAltLists[iplane][ALG_WEST].size();
02764 
02765   if(amWriting){
02766     if(amWriting)cout << "*****************************************************************  PLANE : " << iplane << endl;
02767     if(amWriting)cout << "ew : " << easthits << ":" << westhits << endl;
02768   }
02769 
02770   bool oneSided = false;
02771   if(easthits==0||westhits==0){
02772     if(easthits>0||westhits>0)oneSided = true;
02773   }
02774 
02775   Int_t istripH;
02776   Int_t istripT;
02777 
02778   Int_t jplane = iplane;
02779   if(jplane>249)jplane+=20;
02780   if( fUVMap[iplane]==PlaneView::kU){
02781     fitStatusH = fFitQHitU.status;
02782     istripH = static_cast<Int_t>(jplane*fFitQHitU.a1+fFitQHitU.a0);
02783     if(!fFitQHitU.status){
02784       istripH = static_cast<Int_t>(jplane*fFitHitU.a1+fFitHitU.a0);
02785       fitStatusH = fFitHitU.status;
02786     }
02787     fitStatusT = fFitTimeU.status;
02788     istripT = static_cast<Int_t>(jplane*fFitTimeU.a1+fFitTimeU.a0);
02789     if(amWriting){
02790       cout << " fit status : " << fitStatusH << " " << fitStatusT << endl;
02791       cout << "U HIT  STRIP AIM : " << istripH <<" "<< fFitQHitV.a0 << " : " << fFitQHitV.a1 << endl;
02792       cout << "U TIME STRIP AIM : " << istripT <<" "<< fFitTimeV.a0 << " : " << fFitTimeV.a1 << endl;
02793     }
02794   }
02795   if( fUVMap[iplane]==PlaneView::kV){
02796     fitStatusH = fFitQHitV.status;
02797     istripH = static_cast<Int_t>(jplane*fFitQHitV.a1+fFitQHitV.a0);
02798     if(!fitStatusH){
02799       fitStatusH = fFitHitV.status;
02800       istripH = static_cast<Int_t>(jplane*fFitHitV.a1+fFitHitV.a0);
02801     }
02802     fitStatusT = fFitTimeV.status;
02803     istripT = static_cast<Int_t>(jplane*fFitTimeV.a1+fFitTimeV.a0);
02804     if(amWriting){
02805       cout << "V HIT  STRIP AIM : " << istripH <<" "<< fFitQHitV.a0 << " : " << fFitQHitV.a1 << endl;
02806       cout << "V TIME STRIP AIM : " << istripT <<" "<< fFitTimeV.a0 << " : " << fFitTimeV.a1 << endl;
02807     }
02808   }
02809 
02810   if(istripH>=MAX_NUMBER_OF_STRIPS)istripH=MAX_NUMBER_OF_STRIPS; 
02811   if(istripT>=MAX_NUMBER_OF_STRIPS)istripT=MAX_NUMBER_OF_STRIPS; 
02812   if(istripH<0)istripH=0;
02813   if(istripT<0)istripT=0;
02814 
02815   
02816   bool returnFlag = false;
02817   bool found = false;
02818   bool useOldResult = false;
02819 
02820   PlaneValidity_t stripResult;
02821   PlaneValidity_t timeMaskResult;
02822   PlaneValidity_t oldResult;
02823   PlaneValidity_t hitResult;
02824   PlaneValidity_t timeResult;
02825 
02826 
02827   // Determine pattern for current result
02828   vector<Int_t>oldPattern;
02829   for(Int_t iHitStrip=1; iHitStrip<=fPlaneHit[iplane];iHitStrip++){
02830     oldPattern.push_back(fHitMap[iplane][iHitStrip]);
02831   }
02832   if(!oneSided)oldResult = this->ValidatePlaneForPattern(iplane, oldPattern);
02833   if( oneSided)oldResult = this->ValidateOneSidedPlaneForPattern(iplane, oldPattern);
02834 
02835   for(UInt_t i = 0; i<oldResult.strips.size(); i++){
02836     bool found = false;
02837     for(UInt_t ipair=0;ipair<fDeMuxedPairs[iplane].size();ipair++){
02838       Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
02839       if(oldResult.strips[i]==istrip)found=true;
02840     }
02841     if(found==false){
02842       useOldResult=true;
02843       //cout << "USE OLD RESULT IS SET !!!!!!" << endl;
02844       //getchar();
02845     }
02846   }
02847 
02848 
02849 
02850   // Look at patterns centred on the hit strips
02851   stripResult.largestContigGroup = -1;
02852   Int_t bestStrip;
02853   for(Int_t iHitStrip=1; iHitStrip<=fPlaneHit[iplane];iHitStrip++){
02854     vector<Int_t>pattern;
02855     pattern.push_back(fHitMap[iplane][iHitStrip]);
02856     PlaneValidity_t thisStripResult;
02857     if(!oneSided)thisStripResult = this->ValidatePlaneForPattern(iplane, pattern);
02858     if( oneSided)thisStripResult = this->ValidateOneSidedPlaneForPattern(iplane, pattern);
02859     if(this->ValidityComp(stripResult,thisStripResult,istripH,istripT,oneSided)){
02860       stripResult = thisStripResult;
02861       bestStrip = fHitMap[iplane][iHitStrip];
02862     }
02863   }
02864 
02865 
02866   hitResult.largestContigGroup = 0;
02867   vector<Int_t>patternH;
02868   if(fitStatusH){
02869     patternH.push_back(istripH);
02870     if(!oneSided)hitResult =  this->ValidatePlaneForPattern(iplane, patternH);
02871     if( oneSided)hitResult =  this->ValidateOneSidedPlaneForPattern(iplane, patternH);
02872   }
02873 
02874 
02875   Int_t bestMaskStrip=-1;
02876   timeMaskResult.largestContigGroup = -1;
02877   if(useTimeMask){
02878     for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
02879       if(fUVmask[iplane][iStrip]==true){
02880         vector<Int_t>pattern;
02881         pattern.push_back(iStrip);
02882         PlaneValidity_t thisStripResult;
02883         if(!oneSided)thisStripResult = this->ValidatePlaneForPattern(iplane, pattern);
02884         if( oneSided)thisStripResult = this->ValidateOneSidedPlaneForPattern(iplane, pattern);
02885         if(this->ValidityComp(timeMaskResult,thisStripResult,istripH,istripT,oneSided)){
02886           timeMaskResult = thisStripResult;
02887           bestMaskStrip = iStrip;
02888         }else{
02889           if(oneSided && thisStripResult.largestContigGroup==timeMaskResult.largestContigGroup){
02890             if(thisStripResult.stripSpan<=timeMaskResult.stripSpan){
02891               bestMaskStrip = iStrip;
02892               timeMaskResult = thisStripResult;
02893             }
02894           }     
02895         }
02896       }
02897     }
02898   }
02899       
02900   timeResult.largestContigGroup = 0;
02901   vector<Int_t>patternT;
02902   if(fitStatusT){
02903     patternT.push_back(istripT);
02904     if(!oneSided)timeResult =  this->ValidatePlaneForPattern(iplane, patternT);
02905     if( oneSided)timeResult =  this->ValidateOneSidedPlaneForPattern(iplane, patternT);
02906   }
02907 
02908   bool useTimeFit   = false;
02909   bool useHitFit    = false;
02910   bool useBestStrip = false;
02911   bool useTimeMaskHit  = false;
02912 
02913   if(useTimeMask){
02914     if(oneSided){
02915     }else{
02916       if(timeMaskResult.fractionQE>0.25 && timeMaskResult.fractionQW>0.25)useTimeMaskHit = true;
02917       if(timeMaskResult.chi2DQ>oldResult.chi2DQ+20.)useTimeMaskHit = false;
02918     }
02919   }
02920 
02921   if(fitStatusT){
02922     if(timeResult.largestContigGroup>oldResult.largestContigGroup){
02923       if(oldResult.fractionQE<0.25||oldResult.fractionQW<0.25||(timeResult.fractionQE>0.5&&timeResult.fractionQW>0.5))useTimeFit = true;
02924     } 
02925     if(timeResult.fractionQE<0.25||timeResult.fractionQW<0.25)useTimeFit = false;
02926     if(timeResult.chi2DQ>oldResult.chi2DQ+20.)useTimeFit = false;
02927   }
02928 
02929   if(fitStatusH){
02930     if(hitResult.largestContigGroup>oldResult.largestContigGroup){
02931       if(oldResult.fractionQE<0.25||oldResult.fractionQW<0.25||(hitResult.fractionQE>0.5&&hitResult.fractionQW>0.5))useHitFit = true;
02932     } 
02933     if(hitResult.largestContigGroup>=oldResult.largestContigGroup){
02934       if(hitResult.fractionQE>0.75&&hitResult.fractionQW>0.75&&(hitResult.chi2DQ+20.0<oldResult.chi2DQ))useHitFit = true;
02935     }
02936 
02937     if(hitResult.fractionQE<0.25||hitResult.fractionQW<0.25)useHitFit = false;
02938     if(hitResult.chi2DQ>oldResult.chi2DQ+20.)useHitFit = false;
02939     if(hitResult.largestContigGroup>oldResult.largestContigGroup){
02940       if(oldResult.fractionQE<0.25||oldResult.fractionQW<0.25&&(hitResult.fractionQE>0.5&&hitResult.fractionQW>0.5))useHitFit = true;
02941     } 
02942   }
02943 
02944   if(stripResult.largestContigGroup>oldResult.largestContigGroup){
02945     if(oldResult.fractionQE<0.25||oldResult.fractionQW<0.25||(stripResult.fractionQE>0.5&&stripResult.fractionQW>0.5))useBestStrip = true;
02946     if(stripResult.chi2DQ>oldResult.chi2DQ+20.)useBestStrip = false;
02947   } 
02948 
02949   if(oneSided){
02950     if(fitStatusT)useTimeFit = true;
02951     if(fitStatusH)useHitFit = true;
02952     useBestStrip= true;
02953   }
02954  
02955 
02956   if(useHitFit){
02957     //amWriting = true;
02958     //    if(!found)this->ValidatePlaneForPattern(iplane, oldPattern);
02959     found = true;
02960     if(amWriting)cout  << " ALERT **HITS** " << endl; 
02961     //this->ValidatePlaneForPattern(iplane, patternH);
02962     found = true;
02963     if(hitResult.largestContigGroup>=timeResult.largestContigGroup&&
02964        hitResult.largestContigGroup>=stripResult.largestContigGroup){
02965       //if(!oneSided)this->ReMuxPlane(iplane, patternH);
02966       //if( oneSided)this->ReMuxSingleSidedPlane(iplane, patternH);
02967     }
02968   }
02969 
02970   if(useBestStrip){
02971     found = true;
02972     if(amWriting)cout  << " ALERT **BEST** " << bestStrip << endl; 
02973     vector<Int_t>pattern;
02974     pattern.push_back(bestStrip);
02975     //this->ValidatePlaneForPattern(iplane, pattern);
02976     found = true;
02977     if(stripResult.largestContigGroup>=timeResult.largestContigGroup&&
02978        stripResult.largestContigGroup>hitResult.largestContigGroup){
02979       //if(!oneSided)this->ReMuxPlane(iplane, pattern);
02980       //if( oneSided)this->ReMuxSingleSidedPlane(iplane, pattern);
02981     }
02982   }
02983 
02984   if(useTimeFit){
02985     found = true;
02986     if(amWriting)cout  << " ALERT **TIME** " << endl; 
02987     found = true;
02988     if(timeResult.largestContigGroup>hitResult.largestContigGroup&&
02989        timeResult.largestContigGroup>stripResult.largestContigGroup){
02990       //if(!oneSided)this->ReMuxPlane(iplane, patternT);
02991       //if( oneSided)this->ReMuxSingleSidedPlane(iplane, patternT);
02992     }
02993   }
02994 
02995 
02996 
02997   if(useTimeMaskHit){
02998     if(amWriting)cout  << " ALERT ** TIME MASK !!!!!! ** " << bestMaskStrip << endl; 
02999     vector<Int_t>pattern;
03000     pattern.push_back(bestMaskStrip);
03001     found = true;
03002     if(amWriting)cout << "TM : " << timeMaskResult.largestContigGroup << "   H : " << hitResult.largestContigGroup << endl;
03003     if(timeMaskResult.largestContigGroup>hitResult.largestContigGroup){
03004       if(!oneSided)this->ReMuxPlane(iplane, pattern);
03005       if( oneSided){
03006         cout << "1 Sided Time Mask ReMux : " << timeMaskResult.largestContigGroup << endl;
03007         if(timeMaskResult.largestContigGroup>1){
03008           //  this->ReMuxSingleSidedPlane(iplane, pattern);
03009         }
03010       }
03011     }
03012     if(timeMaskResult.largestContigGroup==oldResult.largestContigGroup){
03013       if(!oneSided){
03014         //      if((timeMaskResult.fractionQE+timeMaskResult.fractionQW>oldResult.fractionQE+oldResult.fractionQW)  ||(timeMaskResult.chi2DQ+5.0<oldResult.chi2DQ))this->ReMuxPlane(iplane, pattern);
03015       }
03016       if(oneSided){
03017         if(timeMaskResult.largestContigGroup>1){
03018           //this->ReMuxSingleSidedPlane(iplane, pattern);
03019             if(amWriting)cout << "One Sided Time Mask ReMux : " << timeMaskResult.largestContigGroup << endl;
03020         }
03021       }
03022     }
03023   }  
03024 
03025   returnFlag = found;
03026 
03027   amWriting = false;
03028   return returnFlag;
03029 }

DeMuxEventType_t AlgAltDeMuxBase::EventID  )  [protected]
 

Definition at line 7971 of file AlgAltDeMuxBase.cxx.

References CONTAINED_EVENT, demuxedHitQU, demuxedHitQV, demuxedHitStripU, demuxedHitStripV, DeMuxEventType_t, fCCHighestPlane, fCCNearestPlane, fEventType, AltDeMuxCalc::FindNearestEdge(), MAX_NUMBER_OF_PLANES, NdemuxedHitsU, NdemuxedHitsV, pCalculator, and SINGLE_MUON.

Referenced by AlgAltDeMux::DeMuxTidyUp(), AlgAltDeMux::RunAlg(), and AlgAltDeMux::ValidateContainedCandidate().

07972 {  
07973   Float_t d;
07974   Int_t iedge;
07975   Float_t QFiducial[12];
07976   Float_t QPlane[MAX_NUMBER_OF_PLANES];
07977   Float_t QSPlane[MAX_NUMBER_OF_PLANES];
07978   Float_t U;
07979   Float_t V;
07980   Float_t x;
07981   Float_t y;
07982   Float_t Qhighest;
07983 
07984 
07985   for(Int_t i=0;i<12;i++)QFiducial[i]=0.0;
07986 
07987   for(Int_t i=0;i<MAX_NUMBER_OF_PLANES;i++){
07988     QPlane[i]=0.0;
07989     QSPlane[i]=0.0;
07990   }
07991 
07992   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
07993     for(Int_t i=0;i<NdemuxedHitsU[iplane];i++){
07994       QPlane[iplane] += demuxedHitQU[iplane][i];
07995       QSPlane[iplane] += demuxedHitQU[iplane][i]*demuxedHitStripU[iplane][i];
07996     }
07997     for(Int_t i=0;i<NdemuxedHitsV[iplane];i++){
07998       QPlane[iplane] += demuxedHitQV[iplane][i];
07999       QSPlane[iplane] += demuxedHitQV[iplane][i]*demuxedHitStripV[iplane][i];
08000     }
08001   }
08002 
08003   Float_t dmin = 999.0;
08004   Float_t ymax = -999.0;
08005   Int_t nearestPlane = -1;
08006   Int_t highestPlane = -1;
08007   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
08008     for(Int_t i=0;i<NdemuxedHitsU[iplane];i++){
08009       Int_t iU = iplane;
08010       U = demuxedHitStripU[iplane][i];
08011       bool ok =false;
08012       if(iU>0&&iU<MAX_NUMBER_OF_PLANES-1){
08013         if(QPlane[iU-1]>0 && QPlane[iU+1]>0){
08014           Float_t sm = QSPlane[iU-1]/QPlane[iU-1];
08015           Float_t sp = QSPlane[iU+1]/QPlane[iU+1];
08016           V = (sm+sp)/2.0;
08017           ok = true;
08018         }
08019       }
08020       if(!ok&&iU>3){
08021         if(QPlane[iU-3]>0 && QPlane[iU-1]>0){
08022           Float_t smm = QSPlane[iU-3]/QPlane[iU-3];
08023           Float_t sm  = QSPlane[iU-1]/QPlane[iU-1];
08024           V = (3*sm-smm)/2.0;
08025           ok = true;
08026         }
08027       }
08028       if(!ok&&iU<MAX_NUMBER_OF_PLANES-3){
08029         if(QPlane[iU+3]>0 && QPlane[iU+1]>0){
08030           Float_t spp = QSPlane[iU+3]/QPlane[iU+3];
08031           Float_t sp  = QSPlane[iU+1]/QPlane[iU+1];
08032           V = (3*sp-spp)/2.0;
08033           ok = true;
08034         }
08035       }
08036       if(ok){
08037         x = ((U-V)*0.0417)/1.4142;
08038         y = ((U+V)*0.0417-8.0)/1.4142;
08039         pCalculator->FindNearestEdge(x,y,iedge,d);
08040         if(iplane<4)iedge=0;
08041         if(iplane>244&&iplane<249)iedge=9;
08042         if(iplane>249&&iplane<254)iedge=10;
08043         if(iplane>481)iedge=11;
08044         if(d<0.5||iedge==0||iedge>=9)QFiducial[iedge]+=demuxedHitQU[iplane][i];
08045         if(d<dmin){
08046           dmin = d;
08047           nearestPlane = iplane;
08048         }
08049         if(y>ymax){
08050           ymax = y;
08051           highestPlane = iplane;
08052           Qhighest = 0.;
08053           if(d<0.5||iedge==0||iedge>=9)Qhighest = demuxedHitQU[iplane][i];
08054         }
08055       }
08056     }
08057     for(Int_t i=0;i<NdemuxedHitsV[iplane];i++){
08058       Int_t iV = iplane;
08059       V = demuxedHitStripV[iplane][i];
08060       bool ok =false;
08061       if(iV>0&&iV<MAX_NUMBER_OF_PLANES-1){
08062         if(QPlane[iV-1]>0 && QPlane[iV+1]>0){
08063           Float_t sm = QSPlane[iV-1]/QPlane[iV-1];
08064           Float_t sp = QSPlane[iV+1]/QPlane[iV+1];
08065           U = (sm+sp)/2.0;
08066           ok = true;
08067         }
08068       }
08069       if(!ok&&iV>3){
08070         if(QPlane[iV-3]>0 && QPlane[iV-1]>0){
08071           Float_t smm = QSPlane[iV-3]/QPlane[iV-3];
08072           Float_t sm  = QSPlane[iV-1]/QPlane[iV-1];
08073           U = (3*sm-smm)/2.0;
08074           ok = true;
08075         }
08076       }
08077       if(!ok&&iV<MAX_NUMBER_OF_PLANES-3){
08078         if(QPlane[iV+3]>0 && QPlane[iV+1]>0){
08079           Float_t spp = QSPlane[iV+3]/QPlane[iV+3];
08080           Float_t sp  = QSPlane[iV+1]/QPlane[iV+1];
08081           U = (3*sp-spp)/2.0;
08082           ok = true;
08083         }
08084       }
08085       if(ok){
08086         x = ((U-V)*0.0417)/1.4142;
08087         y = ((U+V)*0.0417-8.0)/1.4142;
08088         pCalculator->FindNearestEdge(x,y,iedge,d);
08089         if(iplane<4)iedge=0;
08090         if(iplane>244&&iplane<249)iedge=9;
08091         if(iplane>249&&iplane<254)iedge=10;
08092         if(iplane>481)iedge=11;
08093         if(d<0.5||iedge==0||iedge>=9)QFiducial[iedge]+=demuxedHitQV[iplane][i]; 
08094         if(d<dmin){
08095           dmin = d;
08096           nearestPlane = iplane;
08097         }
08098         if(y>ymax){
08099           ymax = y;
08100           highestPlane = iplane;
08101           Qhighest = 0.;
08102           if(d<0.5||iedge==0||iedge>=9)Qhighest = demuxedHitQV[iplane][i]; 
08103         }
08104       }
08105     }
08106   }
08107 
08108 
08109   Int_t icount=0;
08110   for(int i=0;i<12;i++){
08111     if(amWriting)cout << " Edge " << i << " : " << QFiducial[i] << endl; 
08112     if(QFiducial[i]>2.0)icount++;
08113   }
08114   DeMuxEventType_t eventType = fEventType;
08115   if(fEventType!=MULTIPLE_MUON){
08116     if(icount==0)eventType =  CONTAINED_EVENT;
08117     if(icount==1){
08118       eventType = STOPPING_MUON;
08119       if(Qhighest<0.01)eventType = PARTIALLY_CONTAINED_EVENT;
08120     }
08121     if(icount>=2){
08122       if(fEventType==SINGLE_MUON||fEventType==STRAIGHT_THROUGH_GOING_MUON){
08123         eventType = STRAIGHT_THROUGH_GOING_MUON;
08124       }else{
08125         eventType = THROUGH_GOING_MUON;
08126       }
08127     }
08128   }
08129 
08130   
08131   if(eventType==CONTAINED_EVENT || eventType==PARTIALLY_CONTAINED_EVENT){
08132     fCCNearestPlane=nearestPlane;
08133     fCCHighestPlane=highestPlane;
08134   }
08135 
08136   return eventType;
08137 }

void AlgAltDeMuxBase::FillLowestHighest  )  [protected]
 

Definition at line 1024 of file AlgAltDeMuxBase.cxx.

References fHighestPlane, fLowestPlane, fPlanesAltLists, and MAX_NUMBER_OF_PLANES.

Referenced by AlgAltDeMux::DeMuxPreparation().

01025 {
01026 
01027   bool first=true;
01028   bool last =true;
01029   fLowestPlane = 0;
01030   fHighestPlane = MAX_NUMBER_OF_PLANES-1;
01031 
01032   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
01033     if(fPlanesAltLists[iplane][ALG_EAST].size()>0||fPlanesAltLists[iplane][ALG_WEST].size()>0){
01034       if(first){
01035         Int_t nextPlane=999;
01036         bool carryOn = true;
01037         for(Int_t j = iplane+1; carryOn && j < MAX_NUMBER_OF_PLANES; j++){
01038           if(fPlanesAltLists[j][ALG_EAST].size()>0||
01039              fPlanesAltLists[j][ALG_WEST].size()>0){
01040             nextPlane = j;
01041             carryOn = false;
01042           }
01043         }
01044         if((nextPlane-iplane)<10){
01045           first = false;
01046           fLowestPlane = iplane;
01047         }
01048       }
01049     }
01050   }
01051 
01052 
01053   for(Int_t iplane=MAX_NUMBER_OF_PLANES-1; iplane>0; iplane--){
01054     if(fPlanesAltLists[iplane][ALG_EAST].size()>0||fPlanesAltLists[iplane][ALG_WEST].size()>0){
01055       if(last){
01056         Int_t nextPlane=-999;
01057         bool carryOn = true;
01058 
01059         for(Int_t j = iplane-1; carryOn && j >= 0; j--){
01060           if(fPlanesAltLists[j][ALG_EAST].size()>0||
01061              fPlanesAltLists[j][ALG_WEST].size()>0){
01062             nextPlane = j;
01063             carryOn = false;
01064           }
01065         }
01066         if((iplane-nextPlane)<10){
01067           last = false;
01068           fHighestPlane = iplane;
01069         }
01070       }
01071     }
01072   }
01073 
01074   return;
01075 
01076 }

void AlgAltDeMuxBase::FinalReTagCrossTalk CandDeMuxDigitListHandle cdlh  )  [protected]
 

Definition at line 839 of file AlgAltDeMuxBase.cxx.

References amShowing, DistanceToNearestInPlane(), PlexSEIdAltL::GetBestItem(), CandHandle::GetDaughterIterator(), CandDeMuxDigitHandle::GetDeMuxDigitFlagWord(), CandDigitHandle::GetPlexSEIdAltLWritable(), PlexSEIdAltLItem::GetSigCorr(), PlexSEIdAltL::GetSize(), PlexSEIdAltL::IsValid(), IsXTalk(), PredictedSpotQ(), CandDeMuxDigitHandle::SetDeMuxDigitFlagBit(), PlexSEIdAltL::SetFirst(), and CandDeMuxDigitHandle::UnSetDeMuxDigitFlagBit().

Referenced by AlgAltDeMux::DeMuxTidyUp().

00840 {
00841 
00842   CandDeMuxDigitHandleItr cdhItr(cdlh.GetDaughterIterator());
00843   
00844   while ( CandDeMuxDigitHandle *digit = cdhItr() ) {
00845     // for each digit
00846     PlexSEIdAltL* paltlist = &(digit->GetPlexSEIdAltLWritable());
00847     if(paltlist->GetSize()==0){
00848       // pixel spot does not correspond to valid strip - tag as xtalk 
00849       digit->SetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);  
00850       return;
00851     }
00852     amShowing = false;
00853     paltlist->GetBestItem();
00854     if(!paltlist->IsValid())paltlist->SetFirst();
00855     if(paltlist->IsValid()){
00856       Int_t dmxXTalk = digit->GetDeMuxDigitFlagWord();
00857       if(dmxXTalk==0){
00858         if(IsXTalk(paltlist)){
00859           digit->SetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);  
00860         }else{
00861           digit->UnSetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);
00862         }
00863       }
00864       float Q     = paltlist->GetBestItem().GetSigCorr()/60.; 
00865       float qspot = PredictedSpotQ(paltlist);
00866       float dist = DistanceToNearestInPlane(paltlist);
00867       if(dmxXTalk!=0){
00868         if(dist==0){
00869           digit->UnSetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);
00870           //      cout << "****************************UNSET XTALK FLAG !!!! " << Q << endl; 
00871         }
00872         if(dist==1){
00873           if(Q>3)digit->UnSetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);
00874           //cout << "****************************UNSET XTALK FLAG !!!! " << Q << endl; 
00875         }
00876         if(dist==2){
00877           if(Q>5)digit->UnSetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);
00878           //cout << "****************************UNSET XTALK FLAG !!!! " << Q << endl; 
00879         }
00880       }else{
00881         if(dist>8){
00882           if(qspot/Q>0.001&&Q<4)digit->SetDeMuxDigitFlagBit(CandDeMuxDigit::kXTalk);
00883         }
00884       }
00885     }else{
00886       //cout << "INVALID ALTLIST ! " << endl;
00887     }
00888     amShowing = false;
00889   }
00890 
00891   return;
00892 
00893 }

void AlgAltDeMuxBase::FitAsCosmic bool  useSingles = false  )  [protected]
 

Definition at line 6761 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a0, DeMuxFitResult_t::a1, DeMuxFitResult_t::chi2, DeMuxFitResult_t::chi2pdf, DrawDiagnosticPlots(), fDeMuxedPairs, fDeMuxedSingles, fEventType, fFitHitU, fFitHitV, fFitQHitU, fFitQHitV, fFitTimeU, fFitTimeV, fUVMap, fUZFitQSSM1, fUZFitQSSM2, fUZFitSSM1, fUZFitSSM2, fUZFitTSM1, fUZFitTSM2, fVZFitQSSM1, fVZFitQSSM2, fVZFitSSM1, fVZFitSSM2, fVZFitTSM1, fVZFitTSM2, LinearFit(), MakeFitPolyLines(), MSG, DeMuxFitResult_t::nUsed, ReMuxPlane(), SINGLE_MUON, DeMuxFitData_t::status, THROUGH_GOING_MUON, DeMuxFitData_t::x, and DeMuxFitData_t::y.

Referenced by AlgAltDeMux::DeMuxAsUnknownEventType(), AlgAltDeMux::RunAlg(), and AlgAltDeMux::ValidateThroughGoingMuon().

06762 {
06763   Float_t weightedStrip[MAX_NUMBER_OF_PLANES];
06764   Float_t Qtotal[MAX_NUMBER_OF_PLANES];
06765 
06766   vector<DeMuxFitData_t>HitsU;
06767   vector<DeMuxFitData_t>HitsV;
06768   vector<DeMuxFitData_t>QHitsU;
06769   vector<DeMuxFitData_t>QHitsV;
06770   vector<DeMuxFitData_t>TimesU;
06771   vector<DeMuxFitData_t>TimesV;
06772  
06773   Int_t lowestUplane=999;
06774   Int_t lowestVplane=999;
06775   Int_t highestUplane=-999;
06776   Int_t highestVplane=-999;
06777 
06778   if(fEventType==MULTIPLE_MUON)return;
06779 
06780   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
06781     Qtotal[iplane] = 0.0;
06782     Float_t Qw = 0.0;
06783     Float_t Q  = 0.0;
06784     for(UInt_t ipair=0;ipair<fDeMuxedPairs[iplane].size();ipair++){
06785       Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
06786       Q += fDeMuxedPairs[iplane][ipair].pairQCor;      
06787       Qw+= istrip*fDeMuxedPairs[iplane][ipair].pairQCor;
06788       PlaneView::PlaneView_t kView = fDeMuxedPairs[iplane][ipair].altListE->GetPlaneView();
06789       if(kView==PlaneView::kU){
06790         if(iplane<lowestUplane)lowestUplane=iplane;
06791         if(iplane>highestUplane)highestUplane=iplane;
06792       }
06793       if(kView==PlaneView::kV){
06794         if(iplane<lowestVplane)lowestVplane=iplane;
06795         if(iplane>highestVplane)highestVplane=iplane;
06796       }
06797     }
06798     if(useSingles){
06799       for(UInt_t isingle=0;isingle<fDeMuxedSingles[iplane].size();isingle++){
06800         Int_t istrip = fDeMuxedSingles[iplane][isingle].altList->GetBestSEId().GetStrip();
06801         Q  += fDeMuxedSingles[iplane][isingle].Qcor;      
06802         Qw += istrip*fDeMuxedSingles[iplane][isingle].Qcor;
06803         PlaneView::PlaneView_t kView = fDeMuxedSingles[iplane][isingle].altList->GetPlaneView();
06804         if(kView==PlaneView::kU){
06805           if(iplane<lowestUplane)lowestUplane=iplane;
06806           if(iplane>highestUplane)highestUplane=iplane;
06807         }
06808         if(kView==PlaneView::kV){
06809           if(iplane<lowestVplane)lowestVplane=iplane;
06810           if(iplane>highestVplane)highestVplane=iplane;
06811         }
06812       }
06813     }
06814     if(Q>0)weightedStrip[iplane] = Qw/Q;
06815     if(Q>0)Qtotal[iplane] = Q;
06816     //if(Q>0)cout << " Weighted : " << iplane << ":" << Qw/Q << " using : " << Q << endl;
06817   }
06818   // Decide on appropriate level of Q cut for weighted plane fit
06819 
06820   Float_t Ntotal;
06821   Float_t Nabove1=0;
06822   Float_t Nabove2=0;
06823   Float_t Nabove3=0;
06824   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
06825     if(Qtotal[iplane]>0){
06826       Ntotal++;
06827       if(Qtotal[iplane]>3)Nabove1++;
06828       if(Qtotal[iplane]>5)Nabove2++;
06829       if(Qtotal[iplane]>10)Nabove3++;
06830     }
06831   }
06832   Float_t Qcut = 3.0;
06833   if(Ntotal>0.0){
06834     if(amWriting){
06835       cout << "fraction above 3 pe  " << Nabove1/Ntotal << endl;
06836       cout << "fraction above 5 pe  " << Nabove2/Ntotal << endl;
06837       cout << "fraction above 10 pe " << Nabove3/Ntotal << endl;
06838     }
06839     if(Nabove2/Ntotal > 0.8)Qcut= 5.0;
06840     if(Nabove3/Ntotal > 0.8)Qcut=10.0;
06841   }
06842 
06843 
06844 
06845   // Deal with the pairs
06846 
06847   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
06848     for(UInt_t ipair=0;ipair<fDeMuxedPairs[iplane].size();ipair++){
06849       PlaneView::PlaneView_t kView = fDeMuxedPairs[iplane][ipair].altListE->GetPlaneView();
06850       Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
06851       Int_t isaim  = fDeMuxedPairs[iplane][ipair].orthogonalStripFromTiming;
06852       Int_t jplane = iplane;
06853       if(jplane>249)jplane+=20;
06854       DeMuxFitData_t hit;
06855       DeMuxFitData_t time;
06856       hit.x = jplane;
06857       hit.y = istrip;
06858       hit.status = true;
06859       time.x = jplane;
06860       time.y = isaim;
06861       time.status = true;
06862       if(kView==PlaneView::kV){
06863         if(iplane>=lowestUplane-1&&iplane<=highestUplane+1){
06864           HitsV.push_back(hit);
06865           TimesU.push_back(time);
06866         }
06867       }
06868       if(kView==PlaneView::kU){
06869         if(iplane>=lowestVplane-1&&iplane<=highestVplane+1){
06870           HitsU.push_back(hit);
06871           TimesV.push_back(time);
06872         }
06873       }
06874     }
06875   }
06876 
06877 
06878   if(useSingles){
06879     for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
06880       for(UInt_t isingle=0;isingle<fDeMuxedSingles[iplane].size();isingle++){
06881         PlaneView::PlaneView_t kView = fDeMuxedSingles[iplane][isingle].altList->GetPlaneView();
06882         Int_t istrip = fDeMuxedSingles[iplane][isingle].altList->GetBestSEId().GetStrip();
06883         Int_t jplane = iplane;
06884         if(jplane>249)jplane+=20;
06885         DeMuxFitData_t hit;
06886         hit.x = jplane;
06887         hit.y = istrip;
06888         hit.status = true;
06889         if(kView==PlaneView::kV){
06890           if(iplane>=lowestUplane-1&&iplane<=highestUplane+1)HitsV.push_back(hit);
06891         }
06892         if(kView==PlaneView::kU){
06893           if(iplane>=lowestVplane-1&&iplane<=highestVplane+1)HitsU.push_back(hit);
06894         }
06895       }
06896     }
06897   }
06898 
06899   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
06900     Int_t usedHits = fDeMuxedPairs[iplane].size();
06901     if(useSingles)usedHits+=fDeMuxedSingles[iplane].size();
06902     if(usedHits>0 && Qtotal[iplane]>Qcut){
06903       PlaneView::PlaneView_t kView = fUVMap[iplane];
06904       Int_t jplane = iplane;
06905       if(jplane>249)jplane+=20;
06906       DeMuxFitData_t hit;
06907       hit.x = jplane;
06908       hit.y = weightedStrip[iplane];
06909       hit.status = true;
06910       if(kView==PlaneView::kV){
06911         if(iplane>=lowestUplane-1&&iplane<=highestUplane+1)QHitsV.push_back(hit);
06912       }
06913       if(kView==PlaneView::kU){
06914         if(iplane>=lowestVplane-1&&iplane<=highestVplane+1)QHitsU.push_back(hit);
06915       }
06916     }
06917   }
06918 
06919   fFitHitU  = LinearFit(HitsU, 15.0);
06920   fFitHitV  = LinearFit(HitsV, 15.0);
06921   fFitQHitU = LinearFit(QHitsU, 15.0);
06922   fFitQHitV = LinearFit(QHitsV, 15.0);
06923   fFitTimeU = LinearFit(TimesU);
06924   fFitTimeV = LinearFit(TimesV);
06925 
06926   if(fDiagnosticPlots){
06927     MakeFitPolyLines(fFitQHitU,fUZFitQSSM1,fUZFitQSSM2,2,1);
06928     MakeFitPolyLines(fFitQHitV,fVZFitQSSM1,fVZFitQSSM2,2,1);
06929     MakeFitPolyLines(fFitHitU,fUZFitSSM1,fUZFitSSM2);
06930     MakeFitPolyLines(fFitHitV,fVZFitSSM1,fVZFitSSM2);
06931     MakeFitPolyLines(fFitTimeU,fUZFitTSM1,fUZFitTSM2,4,2);
06932     MakeFitPolyLines(fFitTimeV,fVZFitTSM1,fVZFitTSM2,4,2);
06933   }
06934 
06935 
06936   if(fDiagnosticPlots)this->DrawDiagnosticPlots(5);
06937 
06938   MSG("AltDeMux", Msg::kInfo) << "AlgDeMuxBase::FitAsCosmic() chi2 U HitsQ" << fFitQHitU.chi2 << " ndof = " << fFitQHitU.nUsed-2 << endl;
06939   MSG("AltDeMux", Msg::kInfo) << "AlgDeMuxBase::FitAsCosmic() chi2 V HitsQ" << fFitQHitV.chi2 << " ndof = " << fFitQHitV.nUsed-2 << endl;
06940   MSG("AltDeMux", Msg::kInfo) << "AlgDeMuxBase::FitAsCosmic() chi2 U Hits " << fFitHitU.chi2 << " ndof = " << fFitHitU.nUsed-2 << endl;
06941   MSG("AltDeMux", Msg::kInfo) << "AlgDeMuxBase::FitAsCosmic() chi2 V Hits" << fFitHitV.chi2 << " ndof = " << fFitHitV.nUsed-2 << endl;
06942   MSG("AltDeMux", Msg::kInfo) << "AlgDeMuxBase::FitAsCosmic() c2U  U Time " << fFitTimeU.chi2<< " ndof = " << fFitTimeU.nUsed-2 << endl;
06943   MSG("AltDeMux", Msg::kInfo) << "AlgDeMuxBase::FitAsComsic() c2V  V Time " << fFitTimeV.chi2<< " ndof = " << fFitTimeV.nUsed-2 << endl;
06944 
06945   
06946   bool doReMux = false;
06947   if(fFitQHitU.nUsed>4&&fFitQHitV.nUsed>4){
06948     if(fFitQHitU.chi2pdf<5.0&&fFitQHitV.chi2pdf<5.0){
06949       if(fEventType==UNKNOWN){
06950         MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::FitAsCosmic - Event Identified as Single Muon : " << fFitQHitV.nUsed << "," << fFitQHitU.nUsed << ":" << fFitQHitU.chi2 << "," << fFitQHitV.chi2 <<endl; 
06951         fEventType = SINGLE_MUON;
06952       }
06953       if(fEventType==SINGLE_MUON||fEventType==THROUGH_GOING_MUON||fEventType==STRAIGHT_THROUGH_GOING_MUON)doReMux = true;
06954     }
06955   }
06956   if(fDiagnosticPlots)this->DrawDiagnosticPlots(5);
06957 
06958   if(doReMux){
06959     for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
06960       bool carryOn =true;
06961       for(UInt_t ipair=0; carryOn && ipair<fDeMuxedPairs[iplane].size(); ipair++){
06962         PlaneView::PlaneView_t kView = fDeMuxedPairs[iplane][0].altListE->GetPlaneView();
06963         Int_t jplane = iplane;
06964         if(jplane>249)jplane+=20;
06965         Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
06966         Double_t yFromFit;
06967         if(kView==PlaneView::kU)yFromFit = fFitQHitU.a0 + fFitQHitU.a1*jplane;
06968         if(kView==PlaneView::kV)yFromFit = fFitQHitV.a0 + fFitQHitV.a1*jplane;
06969         Double_t delta = fabs(istrip-yFromFit);
06970         if(delta>12){
06971           this->ReMuxPlane(iplane);
06972           carryOn = false;
06973         }
06974       }
06975       if(carryOn&&useSingles){
06976         for(UInt_t isingle=0; carryOn && isingle<fDeMuxedSingles[iplane].size(); isingle++){
06977           PlaneView::PlaneView_t kView = fDeMuxedSingles[iplane][isingle].altList->GetPlaneView();
06978           Int_t jplane = iplane;
06979           if(jplane>249)jplane+=20;
06980           Int_t istrip = fDeMuxedSingles[iplane][isingle].altList->GetBestSEId().GetStrip();
06981           Double_t yFromFit;
06982           if(kView==PlaneView::kU)yFromFit = fFitQHitU.a0 + fFitQHitU.a1*jplane;
06983           if(kView==PlaneView::kV)yFromFit = fFitQHitV.a0 + fFitQHitV.a1*jplane;
06984           Double_t delta = fabs(istrip-yFromFit);
06985           if(delta>12){
06986             this->ReMuxPlane(iplane);
06987             carryOn = false;
06988           }
06989         }
06990       }
06991     }
06992     if(fDiagnosticPlots)this->DrawDiagnosticPlots(5);
06993   }
06994 }

void AlgAltDeMuxBase::GetFibreLengths  )  [protected]
 

Definition at line 1093 of file AlgAltDeMuxBase.cxx.

References fPlanesAltLists, UgliGeomHandle::GetStripHandle(), UgliStripHandle::IsValid(), MSG, pCalculator, pUgh, AltDeMuxCalc::SetFibreLengthE(), and AltDeMuxCalc::SetFibreLengthW().

Referenced by AlgAltDeMux::DeMuxPreparation().

01094 {
01095   // Store the fibre lengths for strips in this event.  
01096 
01097   UgliStripHandle ush;
01098   vector <PlexSEIdAltL*>::iterator literA;
01099 
01100   MSG("AltDeMux", Msg::kVerbose) << "AlgAltDeMuxBase::GetFibreLengths " << endl;
01101  
01102   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
01103     for(Int_t iew = ALG_EAST; iew <= ALG_WEST; iew++){
01104       if(fPlanesAltLists[iplane][iew].size()>0){
01105         literA = fPlanesAltLists[iplane][iew].begin();
01106         while (literA != fPlanesAltLists[iplane][iew].end()){
01107           (*literA)->SetFirst();
01108           while( (*literA)->IsValid() ){
01109             ush = pUgh->GetStripHandle((*literA)->GetCurrentSEId());
01110             if(!ush.IsValid())MSG("AltDeMux", Msg::kFatal) << "AlgAltDeMuxBase::GetFibreLengths => UgliStripHandle NOT VALID : plane " << iplane << " (Carry on regardless)" <<  endl;
01111             if(iew==ALG_EAST)pCalculator->SetFibreLengthE(iplane,*literA);
01112             if(iew==ALG_WEST)pCalculator->SetFibreLengthW(iplane,*literA);
01113             (*literA)->Next();
01114           }
01115           *literA++;
01116         }
01117       }
01118     }
01119   }
01120   return;
01121 
01122 }

void AlgAltDeMuxBase::GoldHits Int_t  iplane,
Int_t  istrip
[protected]
 

Definition at line 5417 of file AlgAltDeMuxBase.cxx.

References fGoldHitMap, and fGoldPlaneHit.

Referenced by DeMuxBigGroup(), and SelectHits().

05417                                                         { 
05418 
05419   fGoldPlaneHit[iplane] += 1;
05420   fGoldHitMap[iplane][fGoldPlaneHit[iplane]] = istrip;
05421 
05422   return;
05423 
05424 }

void AlgAltDeMuxBase::GroupHits  )  [protected]
 

Definition at line 5129 of file AlgAltDeMuxBase.cxx.

References fAmap, fBmap, fEFound, fEGroup, fNGroups, fNInGroupE, fNInGroupW, fWFound, and fWGroup.

Referenced by DeMuxPass(), and DeMuxWhatsLeft().

05129                                {
05130 
05131   for(Int_t iw=0;iw<=fWCount; iw++){
05132     for(Int_t iwp=0;iwp<=fWCount; iwp++){
05133       fBmap[iw][iwp] = false;
05134     }
05135   }
05136 
05137   for(Int_t ie =0; ie<=fECount; ie++){
05138     for(Int_t iw=0; iw<=fWCount; iw++){
05139       if(fAmap[ie][iw]){
05140         for(Int_t iwp =0;iwp<=fWCount; iwp++){
05141           if(fAmap[ie][iwp]){
05142             fBmap[iw][iwp] = true;
05143             fBmap[iwp][iw] = true;
05144           }
05145         }
05146       }
05147     }
05148   }
05149 
05150   for(Int_t iw=0;iw<=fWCount; iw++){
05151     fBmap[iw][iw] = true;
05152     for(Int_t iwp=0;iwp<=fWCount; iwp++){
05153       if(fBmap[iw][iwp]==false){
05154         for(Int_t k=0;k<=fWCount; k++)fBmap[iw][iwp] |= fBmap[iw][k] && fBmap[k][iwp];
05155       }
05156     }
05157   }
05158 
05159 
05160   fNGroups = 0;
05161   for(Int_t iw=0;iw<=fWCount; iw++){fWFound[iw]=false;}
05162   for(Int_t ie=0;ie<=fECount; ie++){fEFound[ie]=false;}
05163 
05164   for(Int_t iw=0;iw<=fWCount; iw++){
05165     if(fWFound[iw]==false){
05166       fNGroups++;
05167       fNInGroupW[fNGroups]=0;
05168       for(int iwp=0;iwp<=fWCount; iwp++){
05169         if(fBmap[iw][iwp]){
05170           fNInGroupW[fNGroups]++;
05171           fWGroup[fNGroups][fNInGroupW[fNGroups]]=iwp;
05172           fWFound[iwp]=true;
05173         }
05174       }
05175     }
05176   }
05177       
05178   if(fNGroups>0){
05179     for(int ig=1;ig<=fNGroups;ig++){
05180       fNInGroupE[ig]=0;
05181       for(int iw=1;iw<=fNInGroupW[ig];iw++){
05182         for(int ie=0;ie<=fECount;ie++){
05183           if(fEFound[ie]==false && fAmap[ie][(fWGroup[ig][iw])]){
05184             fNInGroupE[ig]++;
05185             fEGroup[ig][fNInGroupE[ig]]=ie;
05186             fEFound[ie] = true;
05187           }
05188         }
05189       }
05190     }
05191   }
05192 
05193   return;
05194 }

void AlgAltDeMuxBase::Hough  )  [protected]
 

Definition at line 7064 of file AlgAltDeMuxBase.cxx.

References fCanvas, fDeMuxedPairs, fEventType, fHighestDeMuxedPairPlane, fHoughProjU, fHoughProjV, fHoughSliceU, fHoughSliceV, fHoughSlopeU, fHoughSlopeV, fHoughStatus, fHoughU, fHoughV, fUpad, fVpad, MSG, multipleMuonInterceptsU, and multipleMuonInterceptsV.

Referenced by AlgAltDeMux::DeMuxAsMultipleMuon(), and AlgAltDeMux::RunAlg().

07065 {
07066   
07067   const Int_t MAX_NUMBER_OF_GROUPS=10000; 
07068 
07069   Float_t groupQ[MAX_NUMBER_OF_GROUPS];
07070   Float_t NU=0;
07071   Float_t NV=0;
07072   Float_t xU=0;
07073   Float_t xV=0;
07074   Float_t yU=0;
07075   Float_t yV=0;
07076   Float_t yUT=0;
07077   Float_t yVT=0;
07078   Int_t   icMinU=499;
07079   Int_t   icMaxU=0;
07080   Int_t   icMinV=499;
07081   Int_t   icMaxV=0;
07082   Float_t HU[400];
07083   Float_t HV[400];
07084   Float_t HSU[400][MAX_NUMBER_OF_PLANES];
07085   Float_t HSV[400][MAX_NUMBER_OF_PLANES];
07086   for(Int_t i=0; i<MAX_NUMBER_OF_GROUPS;i++)groupQ[i]=0;
07087 
07088   for(Int_t i=0; i<400;i++){
07089     HU[i] = 0;
07090     HV[i] = 0;
07091     for(Int_t j=0; j<MAX_NUMBER_OF_PLANES;j++){
07092       HSU[i][j] = 0;
07093       HSV[i][j] = 0;
07094     }
07095   }
07096 
07097   MSG("AltDeMux",Msg::kInfo) << "AlgAltDeMuxBase::Hough  performing new Hough transform" << endl;
07098   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
07099     for(UInt_t ipair=0;ipair<fDeMuxedPairs[iplane].size();ipair++){
07100       if(fDeMuxedPairs[iplane][ipair].uniqueGroupID>=MAX_NUMBER_OF_GROUPS)MSG("AltDeMux",Msg::kFatal) << "AlgAltDeMuxBase::Hough  uniqueGroupID too large" << endl;
07101       groupQ[fDeMuxedPairs[iplane][ipair].uniqueGroupID] += fDeMuxedPairs[iplane][ipair].pairQCor;
07102     }
07103   }
07104   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
07105     for(UInt_t ipair=0;ipair<fDeMuxedPairs[iplane].size();ipair++){
07106       fDeMuxedPairs[iplane][ipair].weightQ =  fDeMuxedPairs[iplane][ipair].pairQCor/groupQ[fDeMuxedPairs[iplane][ipair].uniqueGroupID];
07107     }
07108   }
07109 
07110   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
07111     for(UInt_t ipair=0;ipair<fDeMuxedPairs[iplane].size();ipair++){
07112       PlaneView::PlaneView_t kView = fDeMuxedPairs[iplane][ipair].altListE->GetPlaneView();
07113       Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
07114       if(kView==PlaneView::kU){
07115         NU  += 1.;
07116         xU  = iplane-(fHighestDeMuxedPairPlane+fLowestDeMuxedPairPlane)/2.;
07117         if(iplane>249)xU=xU+20.;
07118         yU  = istrip-96.;
07119         yUT = fDeMuxedPairs[iplane][ipair].orthogonalStripFromTiming;
07120         for(Int_t im=0;im<200;im++){
07121           Float_t m = (im/100.)-0.995;
07122           Float_t c = yU-m*xU;
07123           Int_t ic = 250+static_cast<Int_t>(c); 
07124           if(fDiagnosticPlots)fHoughU->Fill(m,c,fDeMuxedPairs[iplane][ipair].weightQ);
07125           if(ic>0&&ic<MAX_NUMBER_OF_PLANES){
07126             HSU[im+200][ic]+=fDeMuxedPairs[iplane][ipair].weightQ;
07127           }
07128           c = xU-m*yU;
07129           ic = 250+static_cast<Int_t>(c); 
07130           m = -2.-m;
07131           if(fDiagnosticPlots)fHoughU->Fill(m,c,fDeMuxedPairs[iplane][ipair].weightQ);
07132           if(ic>0&&ic<MAX_NUMBER_OF_PLANES){
07133             HSU[199-im][ic]+=fDeMuxedPairs[iplane][ipair].weightQ;
07134             if(ic>icMaxU)icMaxU=ic;
07135             if(ic<icMinU)icMinU=ic;
07136           }
07137         }
07138       }
07139       
07140       
07141 
07142       if(kView==PlaneView::kV){
07143         NV  += 1.;
07144         xV  = iplane-(fHighestDeMuxedPairPlane+fLowestDeMuxedPairPlane)/2.;
07145         if(iplane>249)xV=xV+20.;
07146         yV  = istrip-96.;
07147         yVT = fDeMuxedPairs[iplane][ipair].orthogonalStripFromTiming;
07148         for(Int_t im=0;im<200;im++){
07149           Float_t m = (im/100.)-0.995;
07150           Float_t c = yV-m*xV;
07151           Int_t ic = 250+static_cast<Int_t>(c); 
07152           if(fDiagnosticPlots)fHoughV->Fill(m,c,fDeMuxedPairs[iplane][ipair].weightQ);
07153           if(ic>0&&ic<MAX_NUMBER_OF_PLANES){
07154             HSV[im+200][ic]+=fDeMuxedPairs[iplane][ipair].weightQ;
07155           }
07156           c = xV-m*yV;
07157           ic = 250+static_cast<Int_t>(c); 
07158           m = -2.-m;
07159           if(fDiagnosticPlots)fHoughV->Fill(m,c,fDeMuxedPairs[iplane][ipair].weightQ);
07160           if(ic>0&&ic<MAX_NUMBER_OF_PLANES){
07161           HSV[199-im][ic]+=fDeMuxedPairs[iplane][ipair].weightQ;
07162           if(ic>icMaxV)icMaxV=ic;
07163           if(ic<icMinV)icMinV=ic;
07164           }
07165         }
07166       }
07167     }
07168   }  
07169   // 10 ms/event upto here.
07170   // 11 ms/event with icMaxV...
07171   if(fDiagnosticPlots){
07172     fUpad->cd();
07173     fHoughU->Draw();
07174     fVpad->cd();
07175     fHoughV->Draw();
07176     fCanvas->Update();
07177   }
07178 
07179 
07180   Int_t   imU;
07181   Int_t   imV;
07182   Float_t umax=-999.;
07183   Float_t vmax=-999.;
07184 
07185   for(Int_t i=0; i<400;i++){
07186     Float_t m = (static_cast<Float_t>(i))/100.0-2.995;
07187     for(Int_t j=icMinU; j<icMaxU;j++){
07188       if(HSU[i][j]>0)HU[i] += HSU[i][j]*HSU[i][j];
07189     }
07190     for(Int_t j=icMinV; j<icMaxV;j++){
07191       if(HSV[i][j]>0)HV[i] += HSV[i][j]*HSV[i][j];
07192     }
07193     if(fDiagnosticPlots){
07194       fHoughProjU->Fill(m,HU[i]);
07195       fHoughProjV->Fill(m,HV[i]);
07196     }
07197     if(HU[i]>umax){
07198       umax=HU[i];
07199       imU = i;
07200     }
07201     if(HV[i]>vmax){
07202       vmax=HV[i];
07203       imV = i;
07204     }
07205   }
07206   // 20 ms/event upto here.
07207   // 15 ms/event with icMax
07208 
07209   // Look at width of peaks in Hough space
07210   Int_t   imUm=999;
07211   Int_t   imVm=999;
07212   Int_t   imUp=0;
07213   Int_t   imVp=0;
07214 
07215   bool foundU = false;
07216   bool foundV = false;
07217   for(Int_t i=0; i<400;i++){
07218     if(!foundU && HU[i]>umax/2.0){
07219       imUm = i;
07220       foundU = true;
07221     }
07222     if(!foundV && HV[i]>vmax/2.0){
07223       imVm = i;
07224       foundV = true;
07225     }
07226   }
07227 
07228   foundU = false;
07229   foundV = false;
07230   for(Int_t i=400; i>0;i--){
07231     if(!foundU && HU[i]>umax/2.0){
07232       imUp = i;
07233       foundU = true;
07234     }
07235     if(!foundV && HV[i]>vmax/2.0){
07236       imVp = i;
07237       foundV = true;
07238     }
07239   }
07240 
07241   Float_t houghUwidth = static_cast<Float_t>(imUp-imUm);
07242   Float_t houghVwidth = static_cast<Float_t>(imVp-imVm);
07243 
07244   fHoughSlopeU = (static_cast<Float_t>(imU))/100.0-2.995;
07245   if(fHoughSlopeU<-1.)fHoughSlopeU = 1.0/(-2.0-fHoughSlopeU);
07246   fHoughSlopeV = (static_cast<Float_t>(imV))/100.0-2.995;
07247   if(fHoughSlopeV<-1.)fHoughSlopeV = 1.0/(-2.0-fHoughSlopeV);
07248 
07249   Int_t nUTracks = 0;
07250   Int_t nVTracks = 0;
07251 
07252 
07253   MSG("AltDeMux",Msg::kInfo) << "AlgAltDeMuxBase::Hough Gradient from U Hough Space : " << fHoughSlopeU << endl;
07254   MSG("AltDeMux",Msg::kInfo) << "AlgAltDeMuxBase::Hough Gradient from V Hough Space : " << fHoughSlopeV << endl;
07255 
07256   if(fDiagnosticPlots){
07257     fUpad->cd();
07258     fHoughProjU->Draw();
07259     fVpad->cd();
07260     fHoughProjV->Draw();
07261     fCanvas->Update();
07262     for(Int_t i=0; i<MAX_NUMBER_OF_PLANES;i++){
07263       Float_t c = static_cast<Float_t>(i)-250.;
07264       fHoughSliceU->Fill(c,HSU[imU][i]);
07265       fHoughSliceV->Fill(c,HSV[imV][i]);
07266     }
07267     fUpad->cd();
07268     fHoughSliceU->Draw();
07269     fVpad->cd();
07270     fHoughSliceV->Draw();
07271     fCanvas->Update();
07272   }
07273 
07274   Float_t fTrackCut = 2.5;
07275   Float_t fHCTrackCut = 6.0;
07276   Float_t fTrackCutS = 2.5;
07277   if(houghUwidth>20||houghVwidth>20)fTrackCutS = 3.5;
07278   if(houghUwidth>20&&houghVwidth>20)fTrackCutS = 4.5;
07279   if(fEventType==MULTIPLE_MUON)fTrackCut = 1.5;
07280 
07281 
07282   multipleMuonInterceptsU.erase(multipleMuonInterceptsU.begin(),multipleMuonInterceptsU.end());
07283   multipleMuonInterceptsV.erase(multipleMuonInterceptsV.begin(),multipleMuonInterceptsV.end());
07284 
07285   Int_t NUTR = 0;
07286   Int_t NVTR = 0;
07287 
07288   Int_t NHighConfidenceUTR = 0;
07289   Int_t NHighConfidenceVTR = 0;
07290 
07291   
07292   for(Int_t i=1; i<499;i++){
07293     if( (HSU[imU][i]>HSU[imU][i-1])&&(HSU[imU][i]>=HSU[imU][i+1])){
07294       if(HSU[imU][i]>fTrackCut){
07295         // found local maximum - but is it the best in the group
07296         Float_t maxInGroup = 0.;
07297         bool found = false; 
07298         for(Int_t j=i; !found && j<499;j++){
07299           if(HSU[imU][j]>maxInGroup)maxInGroup=HSU[imU][j];
07300           if(HSU[imU][j]<0.25)found=true;
07301         }
07302         found = false;
07303         for(Int_t j=i; !found && j>1;j--){
07304           if(HSU[imU][j]>maxInGroup)maxInGroup=HSU[imU][j];
07305           if(HSU[imU][j]<0.25)found=true;
07306         }
07307         if(HSU[imU][i]>maxInGroup/2.0 && HSU[imU][i]>fTrackCutS){
07308           NUTR++;
07309           if(HSU[imU][i]>fHCTrackCut && houghUwidth<10)NHighConfidenceUTR++;
07310         }
07311         nUTracks++;
07312         if(imU>=200){
07313           Float_t c = 96.0 - 250.0 + i - fHoughSlopeU*(fHighestDeMuxedPairPlane+fLowestDeMuxedPairPlane)/2.;
07314           if(amWriting)cout << " shallow U intercept : " << i << " -> " << c << endl;
07315           multipleMuonInterceptsU.push_back(c);
07316         }
07317         if(imU<200 ){
07318           Float_t c = 96. - ((fHighestDeMuxedPairPlane+fLowestDeMuxedPairPlane)/2. +i-250)*fHoughSlopeU;
07319           if(amWriting)cout << " steep   U intercept : " << i << " -> " << c << endl;
07320           multipleMuonInterceptsU.push_back(c);
07321         }
07322       }
07323     }
07324   }
07325 
07326   for(Int_t i=1; i<499;i++){
07327     if((HSV[imV][i]>HSV[imV][i-1])&&(HSV[imV][i]>=HSV[imV][i+1])){
07328       if(HSV[imV][i]>fTrackCut){
07329 
07330         Float_t maxInGroup = 0.;
07331         bool found = false; 
07332         for(Int_t j=i; !found && j<499;j++){
07333           if(HSV[imV][j]>maxInGroup)maxInGroup=HSV[imV][j];
07334           if(HSV[imV][j]<0.25)found=true;
07335         }
07336         found = false;
07337         for(Int_t j=i; !found && j>1;j--){
07338           if(HSV[imV][j]>maxInGroup)maxInGroup=HSV[imV][j];
07339           if(HSV[imV][j]<0.25)found=true;
07340         }
07341 
07342 
07343         if(HSV[imV][i]>maxInGroup/2.0 && HSV[imV][i]>fTrackCutS){
07344           NVTR++;
07345           if(HSV[imV][i]>fHCTrackCut && houghVwidth<10)NHighConfidenceVTR++;
07346         }
07347         nVTracks++;
07348         if(imV>=200){
07349           Float_t c = 96.0 - 250.0 + i-fHoughSlopeV*(fHighestDeMuxedPairPlane+fLowestDeMuxedPairPlane)/2.;
07350           if(amWriting)cout << " shallow V intercept : " << i << " -> " << c << endl;
07351           multipleMuonInterceptsV.push_back(c);
07352         }
07353         if(imV<200 ){
07354           Float_t c = 96 - ( (fHighestDeMuxedPairPlane+fLowestDeMuxedPairPlane)/2. +i-250)*fHoughSlopeV;
07355           if(amWriting)cout << " steep   V intercept : " << i << " -> " << c << endl;
07356           multipleMuonInterceptsV.push_back(c);
07357         }
07358       }
07359     }
07360   }
07361 
07362   MSG("AltDeMux",Msg::kInfo) << "AlgAltDeMuxBase::Hough Hough multiplicity : " << nUTracks << "," << NUTR << endl; 
07363   MSG("AltDeMux",Msg::kInfo) << "AlgAltDeMuxBase::Hough Hough multiplicity : " << nUTracks << "," << NVTR << endl; 
07364   // 15ms/event
07365   fHoughStatus = true;
07366   if(fabs(fHoughSlopeU)>50.||fabs(fHoughSlopeV)>50.){
07367     MSG("AltDeMux", Msg::kWarning) << "AlgAltDeMuxBase::Hough - Gradient too steep  : " << fHoughSlopeU << "," << fHoughSlopeV << endl;
07368     fHoughStatus = false;
07369   }
07370 
07371   if(fHoughStatus==true){
07372     if(nUTracks>=2&&nVTracks>=2 && NUTR>=2&&NVTR>=2){
07373       // looks like a multiple muon
07374       // but check to see if it is coming from FNAL
07375       // before tagging it as such
07376       float cosfnal=0.;
07377       float mx = 0.4914*(fHoughSlopeU-fHoughSlopeV);
07378       float my = 0.4914*(fHoughSlopeU+fHoughSlopeV);
07379       float mz = 1.0;
07380       float norm = sqrt(1.0+mx*mx+my*my);
07381       cosfnal = 0.058*my/norm+0.9983*mz/norm;
07382 
07383       MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::Hough - Event Identified as Multiple Muon, multiplicity : " << nUTracks << "," << nVTracks << endl; 
07384       MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::Hough - Event Identified as Multiple Muon, multiplicity : " << NUTR << "," << NVTR << endl; 
07385       
07386       if(amWriting){
07387         cout << " h widths  " << houghUwidth << "," <<  houghVwidth << endl;
07388         cout << " HC counts " << NHighConfidenceUTR << "," << NHighConfidenceVTR << endl;    
07389         cout << " cosfnal : " << cosfnal << endl;
07390       }
07391       if(cosfnal>0.85){
07392         MSG("AltDeMux", Msg::kInfo) << "AlgAltDeMuxBase::Hough() - Event Identified as Multiple Muon, BUT coming from FNAL" << endl;
07393         cout << " MULTIPLE FROM FNAL " << endl;
07394         //getchar();
07395       }else{
07396         MSG("AltDeMux", Msg::kWarning) << "AlgAltDeMuxBase::Hough - Event Identified as Multiple Muon, multiplicity : " << nUTracks << "," << nVTracks << endl; 
07397         MSG("AltDeMux", Msg::kWarning) << "AlgAltDeMuxBase::Hough - Event Identified as Multiple Muon, multiplicity : " << NUTR << "," << NVTR << endl; 
07398         fEventType = MULTIPLE_MUON;
07399         if(amWriting){
07400           cout << " **** U ---> " << houghUwidth << endl;
07401           cout << " **** V ---> " << houghVwidth << endl;
07402         }
07403         if(fDiagnosticPlots){
07404           fUpad->cd();
07405           fHoughProjU->Draw();
07406           fVpad->cd();
07407           fHoughProjV->Draw();
07408           fCanvas->Update();
07409         }
07410       }
07411     }
07412   }
07413   
07414   return;
07415 
07416 }

void AlgAltDeMuxBase::Initialize const char *  name  ) 
 

Definition at line 67 of file AlgAltDeMuxBase.cxx.

References _pixelSpotXTalkMap, _pixelToVaChannel, amShowing, diagnosticCanvas, diagnosticCanvastitle, fClearFibreN, fClearFibreNMC, fDiagnosticPlots, fEventType, fList, fNoiseTimeWindow, fNumberOfStrips, fPMTmap, fPMTtot, fScintillatorN, fScintillatorNMC, fSigmasForTimingWindow, fSigmaTData, fSigmaTMC, fVAmap, fWLSFibreN, fWLSFibreNMC, fXTalk1PEFraction, fXTalk2PEFraction, fXTalk5PEFraction, fXTalkFraction, fXTalkmap, pCalculator, and Setup().

Referenced by AlgAltDeMuxBase().

00068 {
00069   
00070   fList = new TList();
00071   fXTalkFraction        = 0.05;
00072   fXTalk1PEFraction     = 0.25;
00073   fXTalk2PEFraction     = 0.15;
00074   fXTalk5PEFraction     = 0.10;
00075   fNoiseTimeWindow      = 100.;
00076   fSigmasForTimingWindow = 2.5;
00077 
00078   // Far Detector Monte Calro
00079 
00080   fScintillatorNMC = 1.75;  
00081   fWLSFibreNMC     = 1.75; 
00082   fClearFibreNMC   = 1.75;  
00083   fSigmaTMC        = 2.5; //(ns)
00084 
00085   // Far Detector DATA
00086 
00087   fScintillatorN = 1.77;  
00088   fWLSFibreN     = 1.77; 
00089   fClearFibreN   = 1.77;  
00090   fSigmaTData    = 2.5; //(ns)
00091                            
00092   fNumberOfStrips = 192;
00093   fEventType = UNKNOWN;
00094   fDiagnosticPlots = false;
00095   //  amWriting = false;
00096   amShowing = false;
00097   pCalculator = new AltDeMuxCalc();
00098   this->Setup();
00099   
00100   diagnosticCanvastitle = name;
00101   diagnosticCanvas = false;
00102 
00103   _pixelToVaChannel[0]  = 3;
00104   _pixelToVaChannel[1]  = 5;
00105   _pixelToVaChannel[2]  = 14;
00106   _pixelToVaChannel[3]  = 16;
00107   _pixelToVaChannel[4]  = 7;
00108   _pixelToVaChannel[5]  = 9;
00109   _pixelToVaChannel[6]  = 10;
00110   _pixelToVaChannel[7]  = 12;
00111   _pixelToVaChannel[8]  = 11;
00112   _pixelToVaChannel[9]  = 13;
00113   _pixelToVaChannel[10] = 6;
00114   _pixelToVaChannel[11] = 8;
00115   _pixelToVaChannel[12] = 17;
00116   _pixelToVaChannel[13] = 15;
00117   _pixelToVaChannel[14] = 2;
00118   _pixelToVaChannel[15] = 4;
00119 
00120   for(int i = 0; i<8; i++){
00121     for(int j = 0; j<9; j++){
00122       _pixelSpotXTalkMap[i][j]=0.0;
00123     }
00124   }
00125   
00126   // spot 0
00127 
00128   _pixelSpotXTalkMap[3][0] = 0.007; 
00129   _pixelSpotXTalkMap[3][1] = 0.025;
00130   _pixelSpotXTalkMap[3][2] = 0.002;
00131   _pixelSpotXTalkMap[3][3] = 0.025;
00132   _pixelSpotXTalkMap[3][5] = 0.003;
00133   _pixelSpotXTalkMap[3][6] = 0.001;
00134   _pixelSpotXTalkMap[3][7] = 0.003;
00135   _pixelSpotXTalkMap[3][8] = 0.002;
00136   
00137   // spot 1
00138 
00139   _pixelSpotXTalkMap[2][0] = 0.003; 
00140   _pixelSpotXTalkMap[2][1] = 0.025;
00141   _pixelSpotXTalkMap[2][2] = 0.003;
00142   _pixelSpotXTalkMap[2][3] = 0.006;
00143   _pixelSpotXTalkMap[2][5] = 0.006;
00144   _pixelSpotXTalkMap[2][6] = 0.001;
00145   _pixelSpotXTalkMap[2][7] = 0.004;
00146   _pixelSpotXTalkMap[2][8] = 0.001;
00147   
00148 
00149   // spot 2
00150 
00151   _pixelSpotXTalkMap[1][0] = 0.002; 
00152   _pixelSpotXTalkMap[1][1] = 0.025;
00153   _pixelSpotXTalkMap[1][2] = 0.007;
00154   _pixelSpotXTalkMap[1][3] = 0.003;
00155   _pixelSpotXTalkMap[1][5] = 0.025;
00156   _pixelSpotXTalkMap[1][6] = 0.001;
00157   _pixelSpotXTalkMap[1][7] = 0.003;
00158   _pixelSpotXTalkMap[1][8] = 0.002;
00159   
00160   // spot 3
00161 
00162   _pixelSpotXTalkMap[5][0] = 0.002; 
00163   _pixelSpotXTalkMap[5][1] = 0.008;
00164   _pixelSpotXTalkMap[5][2] = 0.001;
00165   _pixelSpotXTalkMap[5][3] = 0.011;
00166   _pixelSpotXTalkMap[5][5] = 0.004;
00167   _pixelSpotXTalkMap[5][6] = 0.002;
00168   _pixelSpotXTalkMap[5][7] = 0.008;
00169   _pixelSpotXTalkMap[5][8] = 0.001;
00170   
00171 
00172   // spot 4
00173 
00174   _pixelSpotXTalkMap[4][0] = 0.001; 
00175   _pixelSpotXTalkMap[4][1] = 0.008;
00176   _pixelSpotXTalkMap[4][2] = 0.002;
00177   _pixelSpotXTalkMap[4][3] = 0.004;
00178   _pixelSpotXTalkMap[4][5] = 0.011;
00179   _pixelSpotXTalkMap[4][6] = 0.001;
00180   _pixelSpotXTalkMap[4][7] = 0.008;
00181   _pixelSpotXTalkMap[4][8] = 0.002;
00182   
00183 
00184   // spot 5
00185 
00186   _pixelSpotXTalkMap[8][0] = 0.002; 
00187   _pixelSpotXTalkMap[8][1] = 0.003;
00188   _pixelSpotXTalkMap[8][2] = 0.001;
00189   _pixelSpotXTalkMap[8][3] = 0.025;
00190   _pixelSpotXTalkMap[8][5] = 0.003;
00191   _pixelSpotXTalkMap[8][6] = 0.007;
00192   _pixelSpotXTalkMap[8][7] = 0.025;
00193   _pixelSpotXTalkMap[8][8] = 0.002;
00194   
00195 
00196   // spot 6
00197 
00198   _pixelSpotXTalkMap[7][0] = 0.001; 
00199   _pixelSpotXTalkMap[7][1] = 0.004;
00200   _pixelSpotXTalkMap[7][2] = 0.001;
00201   _pixelSpotXTalkMap[7][3] = 0.006;
00202   _pixelSpotXTalkMap[7][5] = 0.006;
00203   _pixelSpotXTalkMap[7][6] = 0.003;
00204   _pixelSpotXTalkMap[7][7] = 0.025;
00205   _pixelSpotXTalkMap[7][8] = 0.003;
00206   
00207 
00208   // spot 7
00209 
00210   _pixelSpotXTalkMap[6][0] = 0.001; 
00211   _pixelSpotXTalkMap[6][1] = 0.003;
00212   _pixelSpotXTalkMap[6][2] = 0.002;
00213   _pixelSpotXTalkMap[6][3] = 0.003;
00214   _pixelSpotXTalkMap[6][5] = 0.025;
00215   _pixelSpotXTalkMap[6][6] = 0.002;
00216   _pixelSpotXTalkMap[6][7] = 0.025;
00217   _pixelSpotXTalkMap[6][8] = 0.007;
00218 
00219   for(Int_t i=0; i<MAX_NUMBER_OF_PMTS; i++){
00220     fPMTtot[i]=0.0;
00221     for(int j=0; j<16; j++){
00222       fPMTmap[i][j]=0.0;
00223       fXTalkmap[i][j]=0.0;
00224     }
00225     for(int j=0; j<22; j++){
00226       fVAmap[i][j]=0.0;
00227     }
00228   }
00229   return;
00230 }

bool AlgAltDeMuxBase::IsXTalk PlexSEIdAltL paltlist,
bool  useBest = false
[protected]
 

Definition at line 1532 of file AlgAltDeMuxBase.cxx.

References _pixelToVaChannel, fPlaneHit, fPMTmap, fPMTtot, fVAmap, fXTalkmap, AltDeMuxCalc::GetAbsTime(), PlexSEIdAltL::GetBestItem(), PlexSEIdAltL::GetCurrentItem(), PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetInRack(), PlexSEIdAltLItem::GetPE(), PlexPixelSpotId::GetPixel(), PlexSEIdAltL::GetPlane(), PlexMuxBoxId::GetRackBay(), PlexMuxBoxId::GetRackLevel(), PlexSEIdAltLItem::GetSigCorr(), PlexSEIdAltLItem::GetTime(), PlexPixelSpotId::GetTube(), MSG, and pCalculator.

Referenced by DeMuxSingles(), FinalReTagCrossTalk(), ReTagCrossTalk(), StripCrossTalk(), and StripCrossTalkSingles().

01533 { 
01534 
01535   Float_t crossTalk=0.0;
01536   Float_t diagCrossTalk=0.0;
01537   bool result = false;
01538 
01539   PlexPixelSpotId pixelID;
01540   if(!useBest)pixelID = (paltlist->GetCurrentItem()).GetPixelSpotId(); 
01541   if(useBest)pixelID = (paltlist->GetBestItem()).GetPixelSpotId(); 
01542   Int_t pixel  = pixelID.GetPixel();
01543   Int_t PMTmuxID = pixelID.GetTube();
01544   PMTmuxID      += 3*pixelID.GetInRack();
01545   PMTmuxID      += 24*pixelID.GetRackBay();
01546   Char_t level = pixelID.GetRackLevel(); 
01547   Char_t ew = pixelID.GetEastWest(); 
01548   if(level=='U')PMTmuxID += 450;
01549   if(ew =='E')PMTmuxID += 900;
01550 
01551   if(PMTmuxID>=MAX_NUMBER_OF_PMTS){
01552     MSG("AltDeMux", Msg::kError) << "AlgAltDeMuxBase::IsXTalk => PMT out of array bounds : " <<    PMTmuxID << " would give array overflow!" << endl;
01553     return false;
01554   }
01555 
01556   Float_t q  = paltlist->GetCurrentItem().GetPE();
01557   Float_t qc = paltlist->GetCurrentItem().GetSigCorr()/60.;
01558   
01559   if(qc/q<0.1 || qc/q > 10.0){
01560     //cout << " BUGGERED " << qc << ":" << q << endl;
01561     qc=q;
01562   }
01563 
01564 
01565   switch(pixel){
01566   case 0:
01567     crossTalk = fPMTmap[PMTmuxID][1] + 
01568       fPMTmap[PMTmuxID][4];
01569     diagCrossTalk = fPMTmap[PMTmuxID][5];
01570     break;
01571   case 1:
01572     crossTalk = fPMTmap[PMTmuxID][0] + 
01573       fPMTmap[PMTmuxID][2] +
01574       fPMTmap[PMTmuxID][5];
01575     diagCrossTalk = fPMTmap[PMTmuxID][4]+
01576       fPMTmap[PMTmuxID][6];
01577     break;
01578   case 2:
01579     crossTalk = fPMTmap[PMTmuxID][1] + 
01580       fPMTmap[PMTmuxID][3] +
01581       fPMTmap[PMTmuxID][6];
01582     diagCrossTalk = fPMTmap[PMTmuxID][5]+
01583       fPMTmap[PMTmuxID][7];
01584     break;
01585   case 3:
01586     crossTalk = fPMTmap[PMTmuxID][2] + 
01587       fPMTmap[PMTmuxID][7];
01588     diagCrossTalk = fPMTmap[PMTmuxID][6];
01589     break;
01590   case 4:
01591     crossTalk = fPMTmap[PMTmuxID][0] + 
01592       fPMTmap[PMTmuxID][5] +
01593       fPMTmap[PMTmuxID][8];
01594     diagCrossTalk = fPMTmap[PMTmuxID][1]+
01595       fPMTmap[PMTmuxID][9];
01596     break;
01597   case 5:
01598     crossTalk = fPMTmap[PMTmuxID][1] + 
01599       fPMTmap[PMTmuxID][4] +
01600       fPMTmap[PMTmuxID][6] +
01601       fPMTmap[PMTmuxID][9];
01602     diagCrossTalk = fPMTmap[PMTmuxID][0]+
01603       fPMTmap[PMTmuxID][2] +
01604       fPMTmap[PMTmuxID][8] +
01605       fPMTmap[PMTmuxID][10];
01606     break;
01607   case 6:
01608     crossTalk = fPMTmap[PMTmuxID][2] + 
01609       fPMTmap[PMTmuxID][5] +
01610       fPMTmap[PMTmuxID][7] +
01611       fPMTmap[PMTmuxID][10];
01612     diagCrossTalk = fPMTmap[PMTmuxID][1]+
01613       fPMTmap[PMTmuxID][3] +
01614       fPMTmap[PMTmuxID][9] +
01615       fPMTmap[PMTmuxID][11];
01616     break;
01617   case 7:
01618     crossTalk = fPMTmap[PMTmuxID][3] + 
01619       fPMTmap[PMTmuxID][6] +
01620       fPMTmap[PMTmuxID][11];
01621     diagCrossTalk = fPMTmap[PMTmuxID][2]+
01622       fPMTmap[PMTmuxID][10];
01623     break;
01624   case 8:
01625     crossTalk = fPMTmap[PMTmuxID][4] + 
01626       fPMTmap[PMTmuxID][9] +
01627       fPMTmap[PMTmuxID][12];
01628     diagCrossTalk = fPMTmap[PMTmuxID][5]+
01629       fPMTmap[PMTmuxID][13];
01630     break;
01631   case 9:
01632     crossTalk = fPMTmap[PMTmuxID][5] + 
01633       fPMTmap[PMTmuxID][8] +
01634       fPMTmap[PMTmuxID][10] +
01635       fPMTmap[PMTmuxID][13];
01636     diagCrossTalk = fPMTmap[PMTmuxID][4]+
01637       fPMTmap[PMTmuxID][6] +
01638       fPMTmap[PMTmuxID][12] +
01639       fPMTmap[PMTmuxID][14];
01640     break;
01641   case 10:
01642     crossTalk = fPMTmap[PMTmuxID][6] + 
01643       fPMTmap[PMTmuxID][9] +
01644       fPMTmap[PMTmuxID][11] +
01645       fPMTmap[PMTmuxID][14];
01646     diagCrossTalk = fPMTmap[PMTmuxID][5]+
01647       fPMTmap[PMTmuxID][7] +
01648       fPMTmap[PMTmuxID][13] +
01649       fPMTmap[PMTmuxID][15];
01650     break;
01651   case 11:
01652     crossTalk = fPMTmap[PMTmuxID][7] + 
01653       fPMTmap[PMTmuxID][10] +
01654       fPMTmap[PMTmuxID][15];
01655     diagCrossTalk = fPMTmap[PMTmuxID][6]+
01656       fPMTmap[PMTmuxID][14];
01657     break;
01658   case 12:
01659     crossTalk = fPMTmap[PMTmuxID][8] + 
01660       fPMTmap[PMTmuxID][13];
01661     diagCrossTalk = fPMTmap[PMTmuxID][9];
01662     break;
01663   case 13:
01664     crossTalk = fPMTmap[PMTmuxID][9] + 
01665       fPMTmap[PMTmuxID][12]+
01666       fPMTmap[PMTmuxID][14];
01667     diagCrossTalk = fPMTmap[PMTmuxID][8]+
01668       fPMTmap[PMTmuxID][10];
01669     break;
01670   case 14:
01671     crossTalk = fPMTmap[PMTmuxID][10] + 
01672       fPMTmap[PMTmuxID][13]+
01673       fPMTmap[PMTmuxID][15];
01674     diagCrossTalk = fPMTmap[PMTmuxID][9]+
01675       fPMTmap[PMTmuxID][11];
01676     break;
01677   case 15:
01678     crossTalk = fPMTmap[PMTmuxID][11]+ 
01679       fPMTmap[PMTmuxID][14];
01680     diagCrossTalk = fPMTmap[PMTmuxID][10];
01681     break;
01682   default:
01683     crossTalk = 0;
01684     diagCrossTalk = 0;
01685     break;
01686   }
01687 
01688   if(amShowing){
01689     int i = PMTmuxID;
01690     cout << " IsXTalk " << paltlist->GetPlane() << " : " << pixel << " q " << q << " qc " << qc << " t " << paltlist->GetCurrentItem().GetTime()*1.0E9-pCalculator->GetAbsTime() << endl;
01691     cout << "PLANE HITS " << fPlaneHit[paltlist->GetPlane()] << endl;
01692 
01693     cout  << fPMTmap[i][0]  << ":" << fPMTmap[i][1]  << 
01694       ":" << fPMTmap[i][2]  << ":" << fPMTmap[i][3]  << endl;
01695     cout  << fPMTmap[i][4]  << ":" << fPMTmap[i][5]  << 
01696       ":" << fPMTmap[i][6]  << ":" << fPMTmap[i][7]  << endl;
01697     cout  << fPMTmap[i][8]  << ":" << fPMTmap[i][9]  << 
01698       ":" << fPMTmap[i][10] << ":" << fPMTmap[i][11] << endl;
01699     cout  << fPMTmap[i][12] << ":" << fPMTmap[i][13] << 
01700       ":" << fPMTmap[i][14] << ":" << fPMTmap[i][15] << endl;
01701 
01702     cout << "----------------" << i << endl;
01703 
01704     cout  << fXTalkmap[i][0]  << ":" << fXTalkmap[i][1]  << 
01705       ":" << fXTalkmap[i][2]  << ":" << fXTalkmap[i][3]  << endl;
01706     cout  << fXTalkmap[i][4]  << ":" << fXTalkmap[i][5]  << 
01707       ":" << fXTalkmap[i][6]  << ":" << fXTalkmap[i][7]  << endl;
01708     cout  << fXTalkmap[i][8]  << ":" << fXTalkmap[i][9]  << 
01709       ":" << fXTalkmap[i][10] << ":" << fXTalkmap[i][11] << endl;
01710     cout  << fXTalkmap[i][12] << ":" << fXTalkmap[i][13] << 
01711       ":" << fXTalkmap[i][14] << ":" << fXTalkmap[i][15] << endl;
01712 
01713     cout << "----------------" << endl;
01714 
01715     cout << fVAmap[i][2] << endl;
01716     cout << fVAmap[i][3] << endl;
01717     cout << fVAmap[i][4] << endl;
01718     cout << fVAmap[i][5] << endl;
01719     cout << fVAmap[i][6] << endl;
01720     cout << fVAmap[i][7] << endl;
01721     cout << fVAmap[i][8] << endl;
01722     cout << fVAmap[i][9] << endl;
01723     cout << fVAmap[i][10] << endl;
01724     cout << fVAmap[i][11] << endl;
01725     cout << fVAmap[i][12] << endl;
01726     cout << fVAmap[i][13] << endl;
01727     cout << fVAmap[i][14] << endl;
01728     cout << fVAmap[i][15] << endl;
01729     cout << fVAmap[i][16] << endl;
01730     cout << fVAmap[i][17] << endl;
01731   }
01732 
01733   if(useBest)q=qc;
01734   Float_t XTalkFraction=1.0;
01735   crossTalk+= 0.5*diagCrossTalk;
01736   if(crossTalk>0)XTalkFraction = q/crossTalk;
01737   if(XTalkFraction<fXTalkFraction)result=true;
01738   if(q<1.5&&XTalkFraction<fXTalk1PEFraction)result=true;
01739   if(q<2.5&&XTalkFraction<fXTalk2PEFraction)result=true;
01740   if(q<5.0&&XTalkFraction<fXTalk5PEFraction)result=true;
01741 
01742   if(q<1.5 && q<0.05*fPMTtot[PMTmuxID])result=true;
01743   
01744   if(amShowing)cout << "NORMAL : " << q << ":" <<  XTalkFraction << ":" << result << endl;
01745 
01746   if(result){
01747     MSG("AltDeMux", Msg::kVerbose) << "AlgAltDeMuxBase::IsXTalk (tagged by Standard Algorithm) PMT " << PMTmuxID << " pixel : " << pixel << " charge : " << qc << endl;
01748     return result; 
01749   }
01750 
01751   if(fXTalkmap[PMTmuxID][pixel]>0.0001){
01752     XTalkFraction = q/fXTalkmap[PMTmuxID][pixel];
01753     if(q<1.0&&XTalkFraction<100.)result=true;
01754     if(q<2.0&&XTalkFraction<50.)result=true;
01755     if(q<3.0&&XTalkFraction<30.)result=true;
01756     if(q<5.0&&XTalkFraction<20.)result=true;
01757     if(amShowing)cout << "SPOT   : " << q << ":" <<  XTalkFraction << ":" << result << endl;
01758 
01759     if(result){
01760       MSG("AltDeMux", Msg::kVerbose) << "AlgAltDeMuxBase::IsXTalk (Tagged by Spot Algorithm) : PMT " << PMTmuxID << " pixel : " << pixel << " charge : " << qc << " pixel map " << fXTalkmap[PMTmuxID][pixel] << endl;
01761       return result; 
01762     }
01763   }
01764 
01765   Int_t vaChannel = _pixelToVaChannel[pixel];
01766 
01767   if((fVAmap[PMTmuxID][vaChannel+1]+fVAmap[PMTmuxID][vaChannel-1])>0){
01768     XTalkFraction = q/(fVAmap[PMTmuxID][vaChannel+1]+fVAmap[PMTmuxID][vaChannel-1]);
01769     if(q<1.5&&XTalkFraction<0.1)result=true;
01770     if(amShowing)cout << "VA     : " << q << ":" <<  XTalkFraction << ":" << result << endl;
01771 
01772     if(result){
01773       MSG("AltDeMux", Msg::kVerbose) << "AlgAltDeMuxBase::IsXTalk (VA Algorithm) : PMT " << PMTmuxID << " pixel : " << pixel << " charge : " << qc << "VA map  : " << fVAmap[PMTmuxID][vaChannel-1] << "," << fVAmap[PMTmuxID][vaChannel-1] << endl;
01774       return result; 
01775     }
01776   }
01777 
01778   return result;
01779 } 

DeMuxFitResult_t AlgAltDeMuxBase::LinearFit std::vector< DeMuxFitData_t > &  data,
Float_t  refitDistance = -999.
[protected]
 

Definition at line 8141 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a0, DeMuxFitResult_t::a1, DeMuxFitResult_t::a2, DeMuxFitResult_t::a3, DeMuxFitResult_t::a4, DeMuxFitResult_t::chi2, DeMuxFitResult_t::chi2pdf, DeMuxFitResult_t::nData, DeMuxFitResult_t::nUsed, and DeMuxFitResult_t::status.

Referenced by FitAsCosmic().

08141                                                                                               {
08142 
08143   Double_t N=0.0;
08144   Double_t sumX=0.0;
08145   Double_t sumY=0.0;
08146   Double_t sumXY=0.0;
08147   Double_t sumXX=0.0;
08148   Double_t sumYY=0.0;
08149   Double_t det;
08150   DeMuxFitResult_t result;
08151   result.status = false;
08152   result.a0 = 0.;
08153   result.a1 = 0.;
08154   result.a2 = 0.;
08155   result.a3 = 0.;
08156   result.a4 = 0.;
08157   result.chi2    = 999999.;
08158   result.chi2pdf = 999999.;
08159   result.nUsed = 0;
08160   result.nData = 0;
08161 
08162   for(UInt_t i=0; i<data.size(); i++){
08163     N += 1.; 
08164     sumX += data[i].x;
08165     sumY += data[i].y;
08166     sumXX += data[i].x*data[i].x;
08167     sumXY += data[i].x*data[i].y;
08168     sumYY += data[i].y*data[i].y;
08169   }
08170   
08171   det = sumXX*N-sumX*sumX;
08172   if(det>0){
08173     result.status = true;
08174     result.a0     = (-sumX*sumXY + sumXX*sumY)/det;
08175     result.a1     = (N*sumXY - sumX*sumY)/det;
08176     if(refitDistance>0){
08177       for(UInt_t i=0; i<data.size(); i++){
08178         Double_t yFromFit = result.a0 + result.a1*data[i].x;
08179         Double_t delta = fabs(data[i].y-yFromFit);
08180         if(delta>refitDistance){
08181           data[i].status = false;
08182           N -= 1.; 
08183           sumX  -= data[i].x;
08184           sumY  -= data[i].y;
08185           sumXX -= data[i].x*data[i].x;
08186           sumXY -= data[i].x*data[i].y;
08187           sumYY -= data[i].y*data[i].y;
08188         }
08189       }
08190     } 
08191   }
08192 
08193   Double_t chi2=0.;
08194   det = sumXX*N-sumX*sumX;
08195   result.status = false;
08196   result.a0     = 0.;
08197   result.a1     = 0.;
08198   
08199   if(det>0){
08200     result.status = true;
08201     result.a0     = (-sumX*sumXY + sumXX*sumY)/det;
08202     result.a1     = (N*sumXY - sumX*sumY)/det;
08203     for(UInt_t i=0; i<data.size(); i++){
08204       if(data[i].status){
08205         Double_t yFromFit = result.a0 + result.a1*data[i].x;
08206         Double_t delta = (data[i].y-yFromFit);
08207         chi2+=delta*delta;
08208       }
08209     }
08210     result.nUsed = static_cast<Int_t>(N);
08211     result.nData = data.size();
08212     result.chi2  = chi2;
08213     if(result.nUsed>2)result.chi2pdf  = chi2/(result.nUsed-2);
08214   }
08215 
08216   return result;
08217 }

void AlgAltDeMuxBase::MakeAltListMap CandDigitListHandle cdlh  )  [protected]
 

Definition at line 544 of file AlgAltDeMuxBase.cxx.

References fAbsTime, fPlanesAltLists, fTimeList, fUVMap, CandDigitListHandle::GetAbsTime(), PlexSEIdAltL::GetCurrentItem(), CandHandle::GetDaughterIterator(), PlexSEIdAltL::GetEnd(), PlexSEIdAltL::GetPlane(), PlexSEIdAltL::GetPlaneView(), CandDigitHandle::GetPlexSEIdAltLWritable(), PlexSEIdAltLItem::GetTime(), PlexSEIdAltL::IsVetoShield(), MSG, pCalculator, and AltDeMuxCalc::SetAbsTime().

Referenced by AlgAltDeMux::DeMuxPreparation().

00545 {
00546   
00547   // Fill the arrays of {vectors of AltLists} which are to navigate through
00548   // the UNDEMUXed hits. Could have used Navigator instead but familiarity
00549   // won out. Arrays of vectors also provide a fast efficient method of
00550   // iterating over the data
00551 
00552   PlexSEIdAltL* paltlist;
00553 
00554   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::MakeAltListMap" << endl;
00555   
00556   int ndigits = 0;
00557   fAbsTime = cdlh.GetAbsTime()*1.0E9;
00558   pCalculator->SetAbsTime(fAbsTime);
00559 
00560   CandDigitHandleItr cdhItr(cdlh.GetDaughterIterator());
00561   
00562   while ( CandDigitHandle *cdh = cdhItr() ) {
00563     // for each digit
00564     paltlist = &(cdh->GetPlexSEIdAltLWritable());
00565     int iplane = paltlist->GetPlane();
00566     if(!paltlist->IsVetoShield()){
00567       if(iplane>0&&iplane<MAX_NUMBER_OF_PLANES){
00568         if(paltlist->GetEnd()==StripEnd::kEast){
00569           fPlanesAltLists[iplane][ALG_EAST].push_back(paltlist);
00570         }else{
00571           fPlanesAltLists[iplane][ALG_WEST].push_back(paltlist);
00572         }
00573         fTimeList.push_back(paltlist->GetCurrentItem().GetTime()*1.0E9);
00574         fUVMap[iplane] = paltlist->GetPlaneView(); 
00575         ndigits++;
00576       }else{
00577         MSG("AltDeMux", Msg::kWarning) << "AlgAltDeMuxBase::MakeAltListMap => Plane out of array bounds : " << iplane << " - would give overflow (ignoring it)!" << endl;
00578       }
00579     }else{
00580       // MSG("AltDeMux", Msg::kVerbose) << "AlgAltDeMuxBase::MakeAltListMap => Veto Shield Plane : " << iplane << " - IGNORE IT !" << endl;
00581     }
00582   }
00583 
00584   return;
00585 }

void AlgAltDeMuxBase::MakeFitPolyLines DeMuxFitResult_t  result,
TPolyLine *&  pPolyLine1,
TPolyLine *&  pPolyLine2,
Int_t  color = 4,
Int_t  style = 1
[protected]
 

Definition at line 7937 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a0, DeMuxFitResult_t::a1, and DeMuxFitResult_t::status.

Referenced by DrawDiagnosticPlots(), and FitAsCosmic().

07938                                                  {
07939   
07940   Float_t xp[2];
07941   Float_t yp[2];
07942 
07943   if(result.status){
07944     xp[0] = 0;
07945     xp[1] = 249.;
07946     yp[0] = result.a0;
07947     yp[1] = result.a1*249.+result.a0;
07948     if(pPolyLine1)delete pPolyLine1;
07949     pPolyLine1 = new TPolyLine(2,xp,yp);
07950     pPolyLine1->SetLineColor(color);
07951     pPolyLine1->SetLineStyle(style);
07952     pPolyLine1->SetLineWidth(2);
07953     xp[0] = 249;
07954     xp[1] = 500.;
07955     yp[0] = result.a1*269.+result.a0;
07956     yp[1] = result.a1*520.+result.a0;
07957     if(pPolyLine2)delete pPolyLine2;
07958     pPolyLine2 = new TPolyLine(2,xp,yp);
07959     pPolyLine2->SetLineColor(color);
07960     pPolyLine2->SetLineStyle(style);
07961     pPolyLine2->SetLineWidth(2);
07962   }
07963 
07964   return;
07965 
07966 }

void AlgAltDeMuxBase::MakeMaskGroups  )  [protected]
 

Definition at line 1456 of file AlgAltDeMuxBase.cxx.

References fInMask, fMaskGroup, fTimingMask, fTimingMaskWindow, DeMuxMaskGroup::groupEnd, DeMuxMaskGroup::groupStart, and ResetTimingMask().

Referenced by MakeTimingMask(), ReMakeMask(), and ReMakeTimingMask().

01457 {
01458    
01459   ResetTimingMask();
01460   fTimingMaskWindow = static_cast<Int_t>(2.5*fSigmaStripFromTiming);
01461 
01462   for(int i=0;i<MAX_NUMBER_OF_PLANES;i++){
01463     if(fInMask[i]>0){
01464       DeMuxMaskGroup gm;
01465       bool inGroup = false;
01466       int groupS = -999;
01467       int groupE   = +999;
01468       for(int j=0;j<fNumberOfStrips;j++){
01469         if(inGroup){
01470           if(j>groupE+fTimingMaskWindow){
01471             inGroup = false;
01472             gm.groupStart = groupS;
01473             gm.groupEnd = groupE;
01474             fMaskGroup[i].push_back(gm);
01475           }
01476         }
01477         if(fTimingMask[i][j]){
01478           if(inGroup){
01479             groupE = j + fTimingMaskWindow;
01480             if(groupE>=fNumberOfStrips)groupE=fNumberOfStrips-1;
01481           }else{
01482             inGroup = true;
01483             groupS = j - fTimingMaskWindow;
01484             groupE = j + fTimingMaskWindow;
01485             if(groupS<0)groupS=0;
01486             if(groupE>=fNumberOfStrips)groupE=fNumberOfStrips-1;
01487           }
01488         }
01489       }
01490       if(inGroup){
01491         groupE = fNumberOfStrips-1;
01492         gm.groupStart = groupS;
01493         gm.groupEnd = groupE;
01494         fMaskGroup[i].push_back(gm);
01495       }
01496     }
01497   }
01498   return;
01499 }

void AlgAltDeMuxBase::MakeMultipleTargets Int_t  iplane  )  [protected]
 

Definition at line 3925 of file AlgAltDeMuxBase.cxx.

References fHoughSlopeU, fHoughSlopeV, fTargetStrips, fUVMap, multipleMuonInterceptsU, and multipleMuonInterceptsV.

Referenced by DeMuxPass(), DeMuxSingles(), and MakePlaneMap().

03925                                                      {
03926 
03927   fTargetStrips.erase(fTargetStrips.begin(),fTargetStrips.end());
03928 
03929   Int_t jplane = iplane;
03930   if(iplane>248)jplane+=20;
03931   if(fUVMap[iplane]==PlaneView::kU){
03932     for(UInt_t iline=0; iline<multipleMuonInterceptsU.size();iline++){
03933       Float_t rtarget = fHoughSlopeU*jplane + multipleMuonInterceptsU[iline];
03934       Int_t itarget = static_cast<Int_t>(rtarget);
03935       if(itarget<198&&itarget>-10){
03936         if(itarget>190)itarget=191;
03937         if(itarget<0)itarget=0;
03938         fTargetStrips.push_back(itarget);
03939       }
03940     }
03941   }
03942   if(fUVMap[iplane]==PlaneView::kV){
03943     for(UInt_t iline=0; iline<multipleMuonInterceptsV.size();iline++){
03944       Float_t rtarget = fHoughSlopeV*jplane + multipleMuonInterceptsV[iline];
03945       Int_t itarget = static_cast<Int_t>(rtarget);
03946       if(itarget<198&&itarget>-10){
03947         if(itarget>190)itarget=191;
03948         if(itarget<0)itarget=0;
03949         fTargetStrips.push_back(itarget);
03950       }
03951     }
03952   }
03953 
03954   return;
03955 }

void AlgAltDeMuxBase::MakePixelMap CandDigitListHandle cdlh  )  [protected]
 

Definition at line 587 of file AlgAltDeMuxBase.cxx.

References _pixelToVaChannel, fPMTmap, fPMTtot, fVAmap, PlexSEIdAltL::GetCurrentItem(), CandHandle::GetDaughterIterator(), PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetInRack(), PlexSEIdAltLItem::GetPE(), PlexPixelSpotId::GetPixel(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltLWritable(), PlexMuxBoxId::GetRackBay(), PlexMuxBoxId::GetRackLevel(), PlexSEIdAltLItem::GetSigCorr(), PlexPixelSpotId::GetTube(), PlexSEIdAltL::IsVetoShield(), MSG, and PlexSEIdAltL::SetFirst().

Referenced by AlgAltDeMux::DeMuxPreparation().

00588 {
00589   
00590   // Build up a map of charge deposits for each PMT pixel - for use in
00591   // crosstalk rejection. NOTE PMTmuxID is an internal number scheme
00592   // for FarDet PMTs
00593 
00594   PlexSEIdAltL* paltlist;
00595   
00596   CandDigitHandleItr cdhItr(cdlh.GetDaughterIterator());
00597   
00598   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::MakePixelMap" << endl;
00599 
00600   while ( CandDigitHandle *cdh = cdhItr() ) {
00601     // for each digit
00602     paltlist = &(cdh->GetPlexSEIdAltLWritable());
00603     int iplane = paltlist->GetPlane();
00604     paltlist->SetFirst();
00605     
00606     if(!paltlist->IsVetoShield()){
00607       if(iplane>0&&iplane<MAX_NUMBER_OF_PLANES){
00608 
00609         PlexPixelSpotId pixelID = (paltlist->GetCurrentItem()).GetPixelSpotId(); 
00610         Int_t pixel  = pixelID.GetPixel();
00611         Int_t vaChannel = _pixelToVaChannel[pixel];
00612         Int_t PMTmuxID = pixelID.GetTube();
00613         PMTmuxID      += 3*pixelID.GetInRack();
00614         PMTmuxID      += 24*pixelID.GetRackBay();
00615         Char_t level = pixelID.GetRackLevel(); 
00616         Char_t ew = pixelID.GetEastWest(); 
00617         if(level=='U'){
00618           PMTmuxID += 450;
00619         }
00620         if(ew =='E'){
00621           PMTmuxID += 900;
00622         }
00623         //      Int_t uid = pixelID.GetUniquePmtEncodedValue();    
00624 
00625         if(PMTmuxID<MAX_NUMBER_OF_PMTS){
00626           Float_t q  = paltlist->GetCurrentItem().GetPE();
00627           Float_t qc = paltlist->GetCurrentItem().GetSigCorr()/60.;
00628           if(qc/q<0.1 || qc/q > 10.0){
00629             MSG("AltDeMux", Msg::kWarning) << "AlgAltDeMuxBase::MakePixelMap Large/small SigCor/SigPE ratio : " <<qc/q << " for Plane : " << iplane << endl;
00630             qc=q;
00631           }
00632           fPMTmap[PMTmuxID][pixel] += qc; 
00633           fVAmap[PMTmuxID][vaChannel] += qc; 
00634           fPMTtot[PMTmuxID]        += qc; 
00635         }else{
00636           MSG("AltDeMux", Msg::kError) << "AlgAltDeMuxBase::MakePixelMap => PMT out of array bounds : " << PMTmuxID << " ignoring it !" << endl;
00637         }
00638       }
00639     }
00640   }
00641 
00642   MSG("AltDeMux", Msg::kDebug) << "AlgAltDeMuxBase::MakePixelMap DONE" << endl;
00643 
00644   return;
00645 }

void AlgAltDeMuxBase::MakePlaneMap DeMuxSearchTactic   )  [protected]
 

Definition at line 5870 of file AlgAltDeMuxBase.cxx.

References DeMuxFitResult_t::a1, fEventType, fFitHitU, fFitHitV, fFitQHitU, fFitQHitV, fFitTimeU, fHitMap, fHoughStatus, fPlaneHit, fPlanePair, fQHitMapE, fQHitMapW, fTargetStrips, fTrackingLowPECut, fUVMap, DeMuxSearchTactic::highplane, DeMuxSearchTactic::iplane, DeMuxSearchTactic::lowplane, MakeMultipleTargets(), MakePlaneMap(), MAX_NUMBER_OF_PLANES, MSG, SEARCH_BACKWARDS, SEARCH_FORWARDS, DeMuxSearchTactic::searchType, and DeMuxFitResult_t::status.

05871 {
05872 
05873   Int_t i = tactic.iplane;
05874   Int_t j = tactic.lowplane;
05875   Int_t k = tactic.highplane;
05876 
05877   Float_t target;
05878   Int_t itarget;
05879   Int_t it;
05880 
05881 
05882   if(j<0&&j>-100)MSG("AltDeMux", Msg::kFatal) << "AlgAltDeMuxBase::MakePlaneMap lowplane out of range : " << j << endl;
05883   if(k>=MAX_NUMBER_OF_PLANES)MSG("AltDeMux", Msg::kFatal) << "AlgAltDeMuxBase::MakePlaneMap highplane out of range : " << k << endl;
05884 
05885   fTargetStrips.erase(fTargetStrips.begin(),fTargetStrips.end());
05886   if(fEventType==MULTIPLE_MUON)MakeMultipleTargets(i);
05887 
05888   bool useHoughSlope         = fUseHoughSlope;
05889   bool useFitSlopeTime       = fUseFitSlopeTime;
05890   bool useFitSlopeHits       = fUseFitSlopeHits;
05891   bool useInterpolation      = false;
05892   // bool useSafeExtrapolationF = false;
05893   // bool useSafeExtrapolationB = false;
05894   bool useExtrapolationF     = false;
05895   bool useExtrapolationB     = false;
05896   bool useSameStrip          = false;
05897   bool useLevelStripF        = false;
05898   bool useLevelStripB        = false;
05899 
05900 
05901   bool treatAsUNKNOWN        = false;
05902   if(fEventType==UNKNOWN)treatAsUNKNOWN = true;
05903   if(fEventType==SINGLE_MUON)useFitSlopeHits = true;
05904   if(fEventType==THROUGH_GOING_MUON)useFitSlopeHits = true;
05905   if(fEventType==STRAIGHT_THROUGH_GOING_MUON)useFitSlopeHits = true;
05906 
05907   if(fEventType==MULTIPLE_MUON){
05908     if( (fHoughStatus==true)&&(j>0||k>0))useHoughSlope = true;
05909     if( (fHoughStatus==false)||(j==0&&k==0))treatAsUNKNOWN = true;
05910   }
05911 
05912   if(treatAsUNKNOWN){
05913     useInterpolation  = true;
05914     if(tactic.searchType != SEARCH_FORWARDS && 
05915        tactic.searchType != SEARCH_GAP_F)useLevelStripB = fUseLevelStripB;
05916     if(tactic.searchType != SEARCH_BACKWARDS && 
05917        tactic.searchType != SEARCH_GAP_B)useLevelStripF = fUseLevelStripF;
05918     useExtrapolationF = fUseExtrapolationF;
05919     useExtrapolationB = fUseExtrapolationB;
05920     useSameStrip      = fUseSameStrip;
05921   }
05922 
05923   for(Int_t index = 0; index<3; index++){
05924     Float_t slopeU;
05925     Float_t slopeV;
05926     bool    useSlope = false;
05927     if(index==0){
05928       useSlope = useFitSlopeHits;
05929       if(!fFitQHitU.status)slopeU  = fFitHitU.a1;
05930       if(!fFitQHitV.status)slopeV  =