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

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 47 of file AlgAltDeMuxBase.cxx.

References Initialize(), and MSG.

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

AlgAltDeMuxBase::AlgAltDeMuxBase const char *  name  ) 
 

Definition at line 57 of file AlgAltDeMuxBase.cxx.

References Initialize(), and MSG.

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

AlgAltDeMuxBase::~AlgAltDeMuxBase  )  [virtual]
 

Definition at line 291 of file AlgAltDeMuxBase.cxx.

00292 {
00293 
00294 }


Member Function Documentation

void AlgAltDeMuxBase::AddBackCrossTalk  )  [protected]
 

Definition at line 976 of file AlgAltDeMuxBase.cxx.

References fPlanesAltLists, and fXTalkPlanesAltLists.

Referenced by AlgAltDeMux::DeMuxTidyUp().

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

void AlgAltDeMuxBase::AddBackNoise  )  [protected]
 

Definition at line 1003 of file AlgAltDeMuxBase.cxx.

References fNoisePlanesAltLists, and fPlanesAltLists.

Referenced by AlgAltDeMux::DeMuxTidyUp().

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

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

Definition at line 3381 of file AlgAltDeMuxBase.cxx.

References PlaneValidity_t::centroid, 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().

03381                                                                        {
03382 
03383   if(fPlaneHit[iplane]!=0)return false;
03384 
03385   Int_t easthits = fDeMuxedPlanesAltLists[iplane][ALG_EAST].size()+
03386     fPlanesAltLists[iplane][ALG_EAST].size();
03387   Int_t westhits = fDeMuxedPlanesAltLists[iplane][ALG_WEST].size()+
03388     fPlanesAltLists[iplane][ALG_WEST].size();
03389 
03390   if(fDiagnosticPlots){
03391     if(amWriting)cout << "*****************************************************************  PLANE : " << iplane << endl;
03392     if(amWriting)cout << "ew : " << easthits << ":" << westhits << endl;
03393   }
03394 
03395   bool oneSided = false;
03396   if(easthits==0||westhits==0){
03397     if(easthits>0||westhits>0)oneSided = true;
03398   }
03399 
03400   if(oneSided && !doSingleSided)return false;
03401 
03402   bool returnFlag = false;
03403   bool found = false;
03404 
03405   PlaneValidity_t timeMaskResult;
03406   timeMaskResult.largestContigGroup = -1;
03407   timeMaskResult.stripSpan          = 0;
03408   timeMaskResult.centroid           = 0.;
03409   timeMaskResult.chi2DQ             = 99999.;
03410   timeMaskResult.fractionQE = 0.;
03411   timeMaskResult.fractionQW = 0.;
03412 
03413   Int_t bestMaskStrip=-1;
03414 
03415   for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
03416     if(fUVmask[iplane][iStrip]==true){
03417       vector<Int_t>pattern;
03418       if(amWriting)cout << "TIMING MASK : " << iStrip << endl;
03419       pattern.push_back(iStrip);
03420       PlaneValidity_t thisStripResult;
03421       if(!oneSided)thisStripResult = this->ValidatePlaneForPattern(iplane, pattern);
03422       if( oneSided)thisStripResult = this->ValidateOneSidedPlaneForPattern(iplane, pattern);
03423       if(thisStripResult.largestContigGroup>timeMaskResult.largestContigGroup){
03424         timeMaskResult = thisStripResult;
03425         bestMaskStrip = iStrip;
03426       }
03427       if(thisStripResult.largestContigGroup==timeMaskResult.largestContigGroup){
03428         if(oneSided){
03429           if(thisStripResult.stripSpan<=timeMaskResult.stripSpan){
03430             bestMaskStrip = iStrip;
03431             timeMaskResult = thisStripResult;
03432           }
03433         }else{
03434           if( (thisStripResult.fractionQE+thisStripResult.fractionQW)>
03435               (timeMaskResult.fractionQE+timeMaskResult.fractionQW) ){
03436             if(thisStripResult.chi2DQ<timeMaskResult.chi2DQ+10.){
03437               bestMaskStrip = iStrip;
03438               timeMaskResult = thisStripResult;
03439             }
03440           }
03441         }
03442       }
03443     }
03444   }
03445 
03446 
03447   if(timeMaskResult.largestContigGroup>0){
03448     vector<Int_t>pattern;
03449     pattern.push_back(bestMaskStrip);
03450     if(!oneSided)this->ReMuxPlane(iplane, pattern);
03451     if( oneSided){
03452       if(timeMaskResult.largestContigGroup>1){
03453         this->ReMuxSingleSidedPlane(iplane, pattern);
03454       }
03455     }
03456     return true;
03457   }
03458   
03459       
03460   for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
03461     vector<Int_t>pattern;
03462     pattern.push_back(iStrip);
03463     PlaneValidity_t thisStripResult;
03464     if(!oneSided)thisStripResult = this->ValidatePlaneForPattern(iplane, pattern);
03465     if( oneSided)thisStripResult = this->ValidateOneSidedPlaneForPattern(iplane, pattern);
03466     if(thisStripResult.largestContigGroup>timeMaskResult.largestContigGroup){
03467       timeMaskResult = thisStripResult;
03468       bestMaskStrip = iStrip;
03469     }
03470     if(thisStripResult.largestContigGroup==timeMaskResult.largestContigGroup){
03471       if(oneSided){
03472         if(thisStripResult.stripSpan<=timeMaskResult.stripSpan){
03473           bestMaskStrip = iStrip;
03474           timeMaskResult = thisStripResult;
03475         }
03476       }else{
03477         if( (thisStripResult.fractionQE+thisStripResult.fractionQW)>
03478             (timeMaskResult.fractionQE+timeMaskResult.fractionQW) ){
03479           if(thisStripResult.chi2DQ<timeMaskResult.chi2DQ+10.){
03480             bestMaskStrip = iStrip;
03481             timeMaskResult = thisStripResult;
03482           }
03483         }
03484       }
03485     }
03486   }
03487       
03488   returnFlag = found;
03489 
03490   if(timeMaskResult.largestContigGroup>0){
03491     vector<Int_t>pattern;
03492     pattern.push_back(bestMaskStrip);
03493     if(!oneSided)this->ReMuxPlane(iplane, pattern);
03494     if( oneSided){
03495       if(timeMaskResult.largestContigGroup>1){
03496         this->ReMuxSingleSidedPlane(iplane, pattern);
03497       }
03498     }
03499   }
03500   
03501   return returnFlag;
03502 }

bool AlgAltDeMuxBase::BestGuessForSingleSidedHits Int_t  iplane  )  [protected]
 

Definition at line 3509 of file AlgAltDeMuxBase.cxx.

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

Referenced by DeMuxWhatsLeft().

03509                                                              {
03510 
03511   vector <PlexSEIdAltL*>::iterator literA;
03512 
03513   //  if(fPlaneHit[iplane]!=0)return false;
03514   
03515   Int_t Nm =0;
03516   Int_t Np =0;
03517   Float_t wm = 0.0;
03518   Float_t wp = 0.0;
03519      
03520   for(Int_t iStrip=0; iStrip<=MAX_NUMBER_OF_STRIPS;iStrip++){
03521     if(iplane>1){
03522       if(fTimingMask[iplane-1][iStrip]){
03523         wm+= iStrip;
03524         Nm++;
03525       }
03526     }
03527     if(iplane<MAX_NUMBER_OF_PLANES-2){
03528       if(fTimingMask[iplane+1][iStrip]){
03529         wp+= iStrip;
03530         Np++;
03531       }
03532     }
03533   }
03534   
03535   Float_t target = 0.;
03536   if(Nm==0&&Np==0){
03537     for(Int_t jplane=iplane;jplane<500 && jplane<iplane+11;jplane+=2){
03538       Int_t easthits = fDeMuxedPlanesAltLists[jplane][ALG_EAST].size();
03539       Int_t westhits = fDeMuxedPlanesAltLists[jplane][ALG_WEST].size();
03540       for(Int_t iE=0;iE<easthits;iE++){
03541         wp += fDeMuxedPlanesAltLists[jplane][ALG_EAST][iE]->GetBestSEId().GetStrip();
03542         Np++;
03543       }
03544       for(Int_t iW=0;iW<westhits;iW++){
03545         wp += fDeMuxedPlanesAltLists[jplane][ALG_WEST][iW]->GetBestSEId().GetStrip();
03546         Np++;
03547       }
03548     }
03549 
03550     for(Int_t jplane=iplane-2;jplane>0 && jplane >iplane-11;jplane-=2){
03551       Int_t easthits = fDeMuxedPlanesAltLists[jplane][ALG_EAST].size();
03552       Int_t westhits = fDeMuxedPlanesAltLists[jplane][ALG_WEST].size();
03553       for(Int_t iE=0;iE<easthits;iE++){
03554         wm += fDeMuxedPlanesAltLists[jplane][ALG_EAST][iE]->GetBestSEId().GetStrip();
03555         Nm++;
03556       }
03557       for(Int_t iW=0;iW<westhits;iW++){
03558         wm += fDeMuxedPlanesAltLists[jplane][ALG_WEST][iW]->GetBestSEId().GetStrip();
03559         Nm++;
03560       }
03561     }
03562 
03563 
03564   }
03565   if(Nm==0&&Np==0)return false;
03566 
03567   if(Nm==0&&Np>0)target =  wp/static_cast<Float_t>(Np);
03568   if(Np==0&&Nm>0)target =  wm/static_cast<Float_t>(Nm);
03569   if(Np>0&&Nm>0)target =  (wm/static_cast<Float_t>(Nm) + wp/static_cast<Float_t>(Np))/2.0;
03570 
03571   for(Int_t iew=ALG_EAST;iew<=ALG_WEST;iew++){
03572     if(fPlanesAltLists[iplane][iew].size()>0){
03573       while (fPlanesAltLists[iplane][iew].size()>0){
03574         Int_t sbest =0;
03575         Float_t closeness = 999;
03576         literA = fPlanesAltLists[iplane][iew].begin();
03577         (*literA)->SetFirst();
03578         while( (*literA)->IsValid() ){
03579           Int_t s = (*literA)->GetCurrentSEId().GetStrip();
03580           if(fabs(target-s)<closeness){
03581             closeness = fabs(target-s);
03582             sbest = s;
03583           }                     
03584           (*literA)->Next();
03585         }
03586         if(closeness<999){
03587           if(iew==ALG_EAST)this->DeMuxSingleHitE(iplane,*literA, sbest);
03588           if(iew==ALG_WEST)this->DeMuxSingleHitW(iplane,*literA, sbest);
03589         }
03590       }
03591     }
03592   }
03593   
03594   return true;
03595 }

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

Definition at line 8297 of file AlgAltDeMuxBase.cxx.

References BestGuessForPlane(), fPlanesAltLists, and fUVMap.

Referenced by AlgAltDeMux::DeMuxGoldenHits().

08297                                                                 {
08298 
08299   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
08300     if(fUVMap[iplane]==kView){
08301       if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
08302         this->BestGuessForPlane(iplane, false);
08303       }
08304     }
08305   }
08306   return true;
08307 }

void AlgAltDeMuxBase::CleanIsolatedHits  )  [protected]
 

Definition at line 7482 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().

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

void AlgAltDeMuxBase::CleanMultiple  )  [protected]
 

Definition at line 7037 of file AlgAltDeMuxBase.cxx.

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

Referenced by AlgAltDeMux::DeMuxAsMultipleMuon().

07038 {
07039 
07040 
07041   if(fDiagnosticPlots)DrawDiagnosticPlots(5);
07042 
07043   if(fEventType!=MULTIPLE_MUON){
07044     return;
07045   }
07046 
07047   // Deal with the pairs
07048 
07049   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
07050     bool needReMux = false;
07051     for(UInt_t ipair=0;!needReMux&&ipair<fDeMuxedPairs[iplane].size();ipair++){
07052       PlaneView::PlaneView_t kView = fDeMuxedPairs[iplane][ipair].altListE->GetPlaneView();
07053       Int_t istrip = fDeMuxedPairs[iplane][ipair].altListE->GetBestSEId().GetStrip();
07054       Int_t jplane = iplane;
07055       if(jplane>249)jplane+=20;
07056       bool hitIsGood = false;
07057       if(kView==PlaneView::kU){
07058         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsU.size();iline++){
07059           Float_t delta = fabs(fHoughSlopeU*jplane + multipleMuonInterceptsU[iline] -istrip);
07060 
07061           if(delta<13)hitIsGood=true; 
07062         }
07063       }
07064       if(kView==PlaneView::kV){
07065         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsV.size();iline++){
07066           Float_t delta = fabs(fHoughSlopeV*jplane + multipleMuonInterceptsV[iline] -istrip);
07067           if(delta<13)hitIsGood=true; 
07068         }
07069       }
07070       if(!hitIsGood)needReMux=true;
07071     }
07072     for(UInt_t isingle=0;isingle<fDeMuxedSingles[iplane].size();isingle++){
07073       PlaneView::PlaneView_t kView = fDeMuxedSingles[iplane][isingle].altList->GetPlaneView();
07074       Int_t istrip = fDeMuxedSingles[iplane][isingle].altList->GetBestSEId().GetStrip();
07075       Int_t jplane = iplane;
07076       if(jplane>249)jplane+=20;
07077       bool hitIsGood = false;
07078       if(kView==PlaneView::kU){
07079         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsU.size();iline++){
07080           Float_t delta = fabs(fHoughSlopeU*jplane + multipleMuonInterceptsU[iline] -istrip);
07081 
07082           if(delta<13)hitIsGood=true; 
07083         }
07084       }
07085       if(kView==PlaneView::kV){
07086         for(UInt_t iline=0; !hitIsGood&&iline<multipleMuonInterceptsV.size();iline++){
07087           Float_t delta = fabs(fHoughSlopeV*jplane + multipleMuonInterceptsV[iline] -istrip);
07088           if(delta<13)hitIsGood=true; 
07089         }
07090       }
07091       if(!hitIsGood)needReMux=true;
07092     }
07093     if(needReMux)MSG("AltDeMux",Msg::kVerbose) << "AlgAltDeMuxBase::CleanMultiple Will ReMux Plane : " << iplane << endl;
07094     if(needReMux)ReMuxPlane(iplane);
07095   }
07096 
07097   if(fDiagnosticPlots)DrawDiagnosticPlots(5);
07098 }

void AlgAltDeMuxBase::ClearArrays  )  [protected]
 

Definition at line 459 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().

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

void AlgAltDeMuxBase::ClearDiagnosticHistos  )  [protected]
 

Definition at line 372 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().

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

void AlgAltDeMuxBase::CreateDiagnosticCanvas  )  [protected]
 

Definition at line 301 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().

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

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

Definition at line 5321 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().

05322 { 
05323   bool success = false;
05324 
05325   vector<BigGroup>theGroups;
05326 
05327   int strips[192];
05328   int estrips[192];
05329   int wstrips[192];
05330   for(int i=0;i<192;i++)strips[i]=0;
05331   for(int ie=1;ie<=fNInGroupE[ig];ie++){
05332     for(int iw=1;iw<=fNInGroupW[ig];iw++){
05333       if(fAmap[(fEGroup[ig][ie])][(fWGroup[ig][iw])]){
05334         int s = fSmap[(fEGroup[ig][ie])][(fWGroup[ig][iw])];
05335         strips[s]++;
05336         estrips[s] = ie;
05337         wstrips[s] = iw;
05338       }
05339     }
05340   }
05341   int istartStrip = 0;
05342   int iendStrip = 0;
05343   int ngroups = 0;
05344   int ilast=0;
05345 
05346   for(int i=0;i<=192;i++){
05347     _smask[i] = false;
05348   }
05349 
05350   int ming = fNInGroupE[ig];
05351   if(fNInGroupW[ig]<ming)ming = fNInGroupW[ig];
05352 
05353   int best = ming-3;
05354   if(ming<12)best = ming-2;
05355   if(ming<7)best = ming-1;
05356   best = ming -1;
05357 
05358   int icount;
05359   for(int is=0; is<192-ming; is++){
05360     if(strips[is]==1){
05361       icount = 1;
05362       int iend = is+ming+5;
05363       int ie;
05364       if(iend>191)iend=192;
05365       for(ie=is+1; ie<iend && icount != ming; ie++){
05366         if(strips[ie]>0){
05367           ilast = ie;
05368           icount++;
05369         }
05370       }
05371       
05372       if(icount>=best){
05373         BigGroup aBigGroup;
05374         aBigGroup.groupStart = is;
05375         aBigGroup.groupEnd = ilast;
05376         aBigGroup.groupCount = icount;
05377         theGroups.push_back(aBigGroup);
05378         best = icount;
05379         if(amWriting)cout << "Found a (small ?) group : " << is << ":" << ilast << " : " << icount << endl;
05380       }
05381       
05382 
05383       if(icount==ming){
05384         ngroups++;
05385         istartStrip = is;
05386         iendStrip   = ie-1;
05387         if(amWriting)cout << "Found a group : " << is << ":" << ie-1 << endl;
05388         for(int i=is;i<=ie;i++){
05389           _smask[i] = true;
05390         }
05391       }
05392     }
05393   }
05394   if(amWriting)cout << "Found " << ngroups << " groups " << endl;
05395 
05396 
05397   ngroups = 0;
05398   for(unsigned int igroup =0; igroup<theGroups.size();igroup++){
05399     if(theGroups[igroup].groupCount==best){
05400       ngroups++;
05401       istartStrip = theGroups[igroup].groupStart;
05402       iendStrip = theGroups[igroup].groupEnd;
05403       if(amWriting)cout << " A good group " << theGroups[igroup].groupStart << " " << theGroups[igroup].groupEnd << " "<< theGroups[igroup].groupCount << endl;
05404       for(int i=theGroups[igroup].groupStart;i<=theGroups[igroup].groupEnd;i++){
05405         _smask[i] = true;
05406       }   
05407     }
05408   }
05409 
05410   // if one and only one group is found then demux it
05411   if(ngroups==1){
05412     success = true;
05413     // fUniqueDeMuxedGroupID is an ugly cludge to tag each group of gold hits 
05414     fUniqueDeMuxedGroupID++;
05415     Int_t ie;
05416     Int_t iw;
05417     for(Int_t is=istartStrip; is<=iendStrip;is++){
05418       if(strips[is]==1){
05419         ie = estrips[is];
05420         iw = wstrips[is];
05421         if(amWriting)cout << " Strip : " << is << " ew " << ie << ":" << iw << endl;
05422         // if the flag gold is 
05423         if(gold)this->GoldHits(iplane,is);
05424         if(!gold)this->DeMuxHits(iplane,fEGroup[ig][ie],fWGroup[ig][iw],is);
05425       }     
05426     }
05427   } 
05428 
05429   if(ngroups>1){
05430     for(int ie=1;ie<=fNInGroupE[ig];ie++){
05431       PlexSEIdAltL* pAltL;
05432       pAltL = pPlaneAltMapE[(fEGroup[ig][ie])]; 
05433       pAltL->SetFirst();
05434       while(pAltL->IsValid()){
05435         int is = pAltL->GetCurrentSEId().GetStrip();
05436         if(!_smask[is])pAltL->SetCurrentWeight(-999.);
05437         pAltL->Next();
05438       }
05439     }
05440     for(int iw=1;iw<=fNInGroupW[ig];iw++){
05441       PlexSEIdAltL* pAltL;
05442       pAltL = pPlaneAltMapW[(fWGroup[ig][iw])]; 
05443       pAltL->SetFirst();
05444       while(pAltL->IsValid()){
05445         int is = pAltL->GetCurrentSEId().GetStrip();
05446         if(!_smask[is])pAltL->SetCurrentWeight(-999.);
05447         pAltL->Next();
05448       }
05449     }
05450   }
05451 
05452   return ngroups;
05453 }

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

Definition at line 5533 of file AlgAltDeMuxBase.cxx.

References DeMuxHitE(), and pPlaneAltMapE.

05533                                                                { 
05534 
05535   PlexSEIdAltL* pAltL;
05536 
05537   pAltL = pPlaneAltMapE[ie]; 
05538   this->DeMuxHitE(iplane,pAltL,is);
05539   return;
05540 }

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

Definition at line 5638 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().

05638                                                                           { 
05639 
05640   vector <PlexSEIdAltL*>::iterator literA;
05641   bool notFound;
05642   float q;
05643 
05644   pAltL->SetFirst();
05645 
05646   q = pAltL->GetCurrentItem().GetPE();
05647   notFound = true;
05648   while(pAltL->IsValid()){
05649     if(pAltL->GetCurrentSEId().GetStrip()==is){
05650       pAltL->SetCurrentWeight(1.);
05651     }else{
05652       pAltL->SetCurrentWeight(0.);
05653     }
05654     pAltL->Next();
05655   }
05656 
05657   literA = fPlanesAltLists[iplane][ALG_EAST].begin();
05658   notFound = true;
05659   while (notFound && literA != fPlanesAltLists[iplane][ALG_EAST].end()){
05660     if(*literA==pAltL){
05661       fPlanesAltLists[iplane][ALG_EAST].erase(literA);
05662       notFound = false;
05663     }
05664     literA++;
05665   }
05666   fDeMuxedPlanesAltLists[iplane][ALG_EAST].push_back(pAltL);
05667 
05668   this->UpdateXTalkMap(pAltL);
05669 
05670   return;
05671 }

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

Definition at line 5472 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.

05473 { 
05474   
05475   this->DeMuxHitE(iplane,pAltE,istrip);
05476   this->DeMuxHitW(iplane,pAltW,istrip);
05477 
05478   if(amWriting)cout << "DEMUX THIS HIT ! " << iplane << ":" << istrip << endl;
05479 
05480   DeMuxedPair thisPair;
05481   thisPair.altListE = pAltE;
05482   thisPair.altListW = pAltW;
05483   thisPair.status   = true;
05484   if(iplane<fLowestDeMuxedPairPlane)fLowestDeMuxedPairPlane = iplane;
05485   if(iplane>fHighestDeMuxedPairPlane)fHighestDeMuxedPairPlane = iplane;
05486 
05487 
05488   PlaneView::PlaneView_t kView = pAltE->GetPlaneView();
05489   pCalculator->SetPlane(iplane);
05490   pCalculator->SetView(kView);
05491   pCalculator->SetEast(pAltE,istrip);
05492   pCalculator->SetWest(pAltW,istrip);
05493   pCalculator->CalcBestEastWest();
05494 
05495   thisPair.orthogonalStripFromTiming = pCalculator->StripAim();
05496   thisPair.uniqueGroupID = fUniqueDeMuxedGroupID;
05497   thisPair.weightQ = 1.0;
05498   thisPair.pairQCor = pCalculator->PairQCor();
05499 
05500   fDeMuxedPairs[iplane].push_back(thisPair);
05501 
05502   if(kView==PlaneView::kU){
05503     if(NdemuxedHitsU[iplane]<MAX_DISPLAYED_HITS){
05504       demuxedHitStripU[iplane][NdemuxedHitsU[iplane]] = istrip;
05505       demuxedHitQU[iplane][NdemuxedHitsU[iplane]]     = pCalculator->PairQCor();
05506       NdemuxedHitsU[iplane]++;
05507     }
05508   }
05509   if(kView==PlaneView::kV){
05510     if(NdemuxedHitsV[iplane]<MAX_DISPLAYED_HITS){
05511       demuxedHitStripV[iplane][NdemuxedHitsV[iplane]] = istrip;
05512       demuxedHitQV[iplane][NdemuxedHitsV[iplane]]     = pCalculator->PairQCor();
05513       NdemuxedHitsV[iplane]++;
05514     }
05515   }
05516 
05517   
05518   if(fPlaneHit[iplane]==0){
05519     if(kView==PlaneView::kU)_nDeMuxedPlanesU++;
05520     if(kView==PlaneView::kV)_nDeMuxedPlanesV++; 
05521   } 
05522   fPlaneHit[iplane]++;
05523   fPlanePair[iplane]++;
05524   fHitMap[iplane][fPlaneHit[iplane]]  = istrip;
05525   fQHitMapE[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorE();
05526   fQHitMapW[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorW();
05527 
05528   return;
05529 
05530 }

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

Definition at line 5464 of file AlgAltDeMuxBase.cxx.

References pPlaneAltMapE, and pPlaneAltMapW.

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

05464                                                                               { 
05465   this->DeMuxHits(iplane, pPlaneAltMapE[ie], pPlaneAltMapW[iw], istrip );
05466 
05467   if(amWriting)cout << "DEMUXED STRIPs : " << ie << ":" << iw << " -> " << istrip << endl;
05468   
05469   return;
05470 }

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

Definition at line 5543 of file AlgAltDeMuxBase.cxx.

References DeMuxHitW(), and pPlaneAltMapW.

05543                                                                { 
05544 
05545   PlexSEIdAltL* pAltL;
05546   pAltL = pPlaneAltMapW[iw]; 
05547   this->DeMuxHitW(iplane,pAltL,is);  
05548 
05549   return;
05550 }

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

Definition at line 5711 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().

05711                                                                           { 
05712 
05713 
05714   vector <PlexSEIdAltL*>::iterator literA;
05715   bool notFound;
05716   float q;
05717 
05718 
05719   pAltL->SetFirst();
05720 
05721   notFound = true;
05722   q = pAltL->GetCurrentItem().GetPE();
05723   while(pAltL->IsValid()){
05724     if(pAltL->GetCurrentSEId().GetStrip()==is){
05725       pAltL->SetCurrentWeight(1.);
05726     }else{
05727       pAltL->SetCurrentWeight(0.);
05728     }
05729     pAltL->Next();
05730   }
05731   
05732   literA = fPlanesAltLists[iplane][ALG_WEST].begin();
05733   notFound = true;
05734   while (notFound && literA != fPlanesAltLists[iplane][ALG_WEST].end()){
05735     if(*literA==pAltL){
05736       fPlanesAltLists[iplane][ALG_WEST].erase(literA);
05737       notFound = false;
05738     }
05739     literA++;
05740   }
05741 
05742   fDeMuxedPlanesAltLists[iplane][ALG_WEST].push_back(pAltL);
05743   this->UpdateXTalkMap(pAltL);
05744 
05745   return;
05746 }

void AlgAltDeMuxBase::DeMuxPass Int_t  ipass  )  [protected]
 

Definition at line 4747 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().

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

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

Definition at line 5552 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().

05552                                                                                     { 
05553 
05554   PlaneView::PlaneView_t kView = pAltL->GetPlaneView();
05555   pCalculator->SetPlane(iplane);
05556   pCalculator->SetView(kView);
05557   pCalculator->SetEast(pAltL,istrip);
05558   pCalculator->CalcBestEast();
05559 
05560   DeMuxedSingle thisSingle;
05561   thisSingle.altList = pAltL;
05562   thisSingle.status  =  true;
05563   thisSingle.Qcor    = pCalculator->QSigCorE();
05564   fDeMuxedSingles[iplane].push_back(thisSingle);
05565 
05566   if(fDiagnosticPlots){
05567     if(kView==PlaneView::kU){
05568       if(NdemuxedHitsU[iplane]<MAX_DISPLAYED_HITS){
05569         demuxedHitStripU[iplane][NdemuxedHitsU[iplane]] = istrip;
05570         demuxedHitQU[iplane][NdemuxedHitsU[iplane]]     = pCalculator->QSigCorE();
05571         NdemuxedHitsU[iplane]++;
05572       }
05573     }
05574     if(kView==PlaneView::kV){
05575       if(NdemuxedHitsV[iplane]<MAX_DISPLAYED_HITS){
05576         demuxedHitStripV[iplane][NdemuxedHitsV[iplane]] = istrip;
05577         demuxedHitQV[iplane][NdemuxedHitsV[iplane]]     = pCalculator->QSigCorE();
05578         NdemuxedHitsV[iplane]++;
05579       }
05580     }
05581   }
05582   
05583   fPlaneHit[iplane]++;
05584   fHitMap[iplane][fPlaneHit[iplane]]  = istrip;
05585   fQHitMapE[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorE();
05586 
05587   //  cout << "DEMUXING SINGLE E : " << iplane << ":" << istrip  << " : " << pCalculator->QSigCorE() << ":" << this->XTalkCharge(pAltL,istrip) << endl;
05588 
05589   this->DeMuxHitE(iplane,pAltL,istrip);
05590 
05591   return;
05592 }

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

Definition at line 5596 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().

05596                                                                                     { 
05597 
05598   PlaneView::PlaneView_t kView = pAltL->GetPlaneView();
05599   pCalculator->SetPlane(iplane);
05600   pCalculator->SetView(kView);
05601   pCalculator->SetWest(pAltL,istrip);
05602   pCalculator->CalcBestWest();
05603 
05604 
05605   DeMuxedSingle thisSingle;
05606   thisSingle.altList = pAltL;
05607   thisSingle.status  = true;
05608   thisSingle.Qcor    = pCalculator->QSigCorW();
05609   fDeMuxedSingles[iplane].push_back(thisSingle);
05610 
05611   if(fDiagnosticPlots){
05612     if(kView==PlaneView::kU){
05613       if(NdemuxedHitsU[iplane]<MAX_DISPLAYED_HITS){
05614         demuxedHitStripU[iplane][NdemuxedHitsU[iplane]] = istrip;
05615         demuxedHitQU[iplane][NdemuxedHitsU[iplane]]     = pCalculator->QSigCorW();
05616         NdemuxedHitsU[iplane]++;
05617       }
05618     }
05619     if(kView==PlaneView::kV){
05620       if(NdemuxedHitsV[iplane]<MAX_DISPLAYED_HITS){
05621         demuxedHitStripV[iplane][NdemuxedHitsV[iplane]] = istrip;
05622         demuxedHitQV[iplane][NdemuxedHitsV[iplane]]     = pCalculator->QSigCorW();
05623         NdemuxedHitsV[iplane]++;
05624       }
05625     }
05626   }
05627   
05628   fPlaneHit[iplane]++;
05629   fHitMap[iplane][fPlaneHit[iplane]]  = istrip;
05630   fQHitMapW[iplane][fPlaneHit[iplane]] = pCalculator->QSigCorW();
05631   this->DeMuxHitW(iplane,pAltL,istrip);
05632 
05633   return;
05634 }

void AlgAltDeMuxBase::DeMuxSingles DeMuxSearchTactic  tactic  )  [protected]
 

Definition at line 6290 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().

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

void AlgAltDeMuxBase::DeMuxWhatsLeft  )  [protected]
 

Definition at line 5013 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().

05013                                     {
05014 
05015   fCutRawPE            = 0.0;
05016   fCutCorPE            = 0.0;
05017   fCutSigmaQ           = 10.0;
05018   fCutUseTimingMask    = false;
05019   fCutUseTargetStrips  = false;
05020   fCutGuessing         = false;
05021   fCutUseMultipleLines = false;
05022   fStripWindow         = 5;
05023   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05024     if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
05025       this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
05026       this->MakePlaneMap(iplane);
05027       this->GroupHits();
05028       this->SelectHits(iplane,false);
05029     }
05030   }
05031 
05032   
05033 
05034   // Next try demux groups which are golden with timing mask
05035 
05036   fCutRawPE            = 0.0;
05037   fCutCorPE            = 0.0;
05038   fCutSigmaQ           = 10.0;
05039   fCutUseTimingMask    = true;
05040   fCutUseTargetStrips  = false;
05041   fCutGuessing         = false;
05042   fCutUseMultipleLines = false;
05043   fStripWindow         = 5;
05044   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05045     if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
05046       //cout << "*********************************WHATS LEFT : PASS 1 like " << iplane << endl;
05047       this->ResetMap(fPlanesAltLists[iplane][ALG_EAST].size(),fPlanesAltLists[iplane][ALG_WEST].size());
05048       this->MakePlaneMap(iplane);
05049       this->GroupHits();
05050       this->SelectHits(iplane,false);
05051     }
05052   }
05053   
05054 
05055   // Demux remaining pairs - using validate plane and the timing mask as a seed
05056   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05057     if(fPlanesAltLists[iplane][ALG_EAST].size()>0&&fPlanesAltLists[iplane][ALG_WEST].size()>0){
05058       //      cout << "*********************************WHATS LEFT : VALIDATE PLANE " << iplane << fPlanesAltLists[iplane][ALG_EAST].size() << " : " << fPlanesAltLists[iplane][ALG_EAST].size() << endl;
05059       //BestGuessForPlane(iplane);
05060     }
05061   }
05062   
05063   // Should only have singles left now.....
05064   DeMuxPass(4);
05065   for(Int_t iplane=0; iplane<MAX_NUMBER_OF_PLANES; iplane++){
05066     if(fPlanesAltLists[iplane][ALG_EAST].size()>0||fPlanesAltLists[iplane][ALG_WEST].size()>0){
05067       //  cout << "*********************************WHATS LEFT : SINGLES " << iplane << endl;
05068       this->BestGuessForSingleSidedHits(iplane);
05069     }
05070   }
05071 
05072   return;
05073   
05074 }

void AlgAltDeMuxBase::DisplayPixelMap  )  [protected]
 

Definition at line 2062 of file AlgAltDeMuxBase.cxx.

References fPMTmap, fPMTtot, and MSG.

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

Float_t AlgAltDeMuxBase::DistanceToNearestInPlane PlexSEIdAltL paltlist  )  [protected]
 

Definition at line 900 of file AlgAltDeMuxBase.cxx.

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

Referenced by FinalReTagCrossTalk().

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

void AlgAltDeMuxBase::DrawDiagnosticPlots Int_t  ipass  )  [protected]
 

Definition at line 2087 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, 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, DeMuxFitResult_t::nData, NdemuxedHitsU, NdemuxedHitsV, DeMuxFitResult_t::nUsed, and DeMuxFitResult_t::status.

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

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

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

Definition at line 2767 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().

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

DeMuxEventType_t AlgAltDeMuxBase::EventID  )  [protected]
 

Definition at line 8009 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().

08010 {  
08011   Float_t d;
08012   Int_t iedge;
08013   Float_t QFiducial[12];
08014   Float_t QPlane[MAX_NUMBER_OF_PLANES];
08015   Float_t QSPlane[MAX_NUMBER_OF_PLANES];
08016   Float_t U;
08017   Float_t V;
08018   Float_t x;
08019   Float_t y;
08020   Float_t Qhighest = 0.;
08021 
08022 
08023   for(Int_t i=0;i<12;i++)QFiducial[i]=0.0;
08024 
08025   for(Int_t i=0;i<MAX_NUMBER_OF_PLANES;i++){
08026     QPlane[i]=0.0;
08027     QSPlane[i]=0.0;
08028   }
08029 
08030   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
08031     for(Int_t i=0;i<NdemuxedHitsU[iplane];i++){
08032       QPlane[iplane] += demuxedHitQU[iplane][i];
08033       QSPlane[iplane] += demuxedHitQU[iplane][i]*demuxedHitStripU[iplane][i];
08034     }
08035     for(Int_t i=0;i<NdemuxedHitsV[iplane];i++){
08036       QPlane[iplane] += demuxedHitQV[iplane][i];
08037       QSPlane[iplane] += demuxedHitQV[iplane][i]*demuxedHitStripV[iplane][i];
08038     }
08039   }
08040 
08041   Float_t dmin = 999.0;
08042   Float_t ymax = -999.0;
08043   Int_t nearestPlane = -1;
08044   Int_t highestPlane = -1;
08045   for(Int_t iplane=0;iplane<MAX_NUMBER_OF_PLANES;iplane++){
08046     for(Int_t i=0;i<NdemuxedHitsU[iplane];i++){
08047       Int_t iU = iplane;
08048       U = demuxedHitStripU[iplane][i];
08049       bool ok =false;
08050       if(iU>0&&iU<MAX_NUMBER_OF_PLANES-1){
08051         if(QPlane[iU-1]>0 && QPlane[iU+1]>0){
08052           Float_t sm = QSPlane[iU-1]/QPlane[iU-1];
08053           Float_t sp = QSPlane[iU+1]/QPlane[iU+1];
08054           V = (sm+sp)/2.0;
08055           ok = true;
08056         }
08057       }
08058       if(!ok&&iU>3){
08059         if(QPlane[iU-3]>0 && QPlane[iU-1]>0){
08060           Float_t smm = QSPlane[iU-3]/QPlane[iU-3];
08061           Float_t sm  = QSPlane[iU-1]/QPlane[iU-1];
08062           V = (3*sm-smm)/2.0;
08063           ok = true;
08064         }
08065       }
08066       if(!ok&&iU<MAX_NUMBER_OF_PLANES-3){
08067         if(QPlane[iU+3]>0 && QPlane[iU+1]>0){
08068           Float_t spp = QSPlane[iU+3]/QPlane[iU+3];
08069           Float_t sp  = QSPlane[iU+1]/QPlane[iU+1];
08070           V = (3*sp-spp)/2.0;
08071           ok = true;
08072         }
08073       }
08074       if(ok){
08075         x = ((U-V)*0.0417)/1.4142;
08076         y = ((U+V)*0.0417-8.0)/1.4142;
08077         pCalculator->FindNearestEdge(x,y,iedge,d);
08078         if(iplane<4)iedge=0;
08079         if(iplane>244&&iplane<249)iedge=9;
08080         if(iplane>249&&iplane<254)iedge=10;
08081         if(iplane>481)iedge=11;
08082         if(d<0.5||iedge==0||iedge>=9)QFiducial[iedge]+=demuxedHitQU[iplane][i];
08083         if(d<dmin){
08084           dmin = d;
08085           nearestPlane = iplane;
08086         }
08087         if(y>ymax){
08088           ymax = y;
08089           highestPlane = iplane;
08090           Qhighest = 0.;
08091           if(d<0.5||iedge==0||iedge>=9)Qhighest = demuxedHitQU[iplane][i];
08092         }
08093       }
08094     }
08095     for(Int_t i=0;i<NdemuxedHitsV[iplane];i++){
08096       Int_t iV = iplane;
08097       V = demuxedHitStripV[iplane][i];
08098       bool ok =false;
08099       if(iV>0&&iV<MAX_NUMBER_OF_PLANES-1){
08100         if(QPlane[iV-1]>0 && QPlane[iV+1]>0){
08101           Float_t sm = QSPlane[iV-1]/QPlane[iV-1];
08102           Float_t sp = QSPlane[iV+1]/QPlane[iV+1];
08103           U = (sm+sp)/2.0;
08104           ok = true;
08105         }
08106       }
08107       if(!ok&&iV>3){
08108         if(QPlane[iV-3]>0 && QPlane[iV-1]>0){
08109           Float_t smm = QSPlane[iV-3]/QPlane[iV-3];
08110           Float_t sm  = QSPlane[iV-1]/QPlane[iV-1];
08111           U = (3*sm-smm)/2.0;
08112           ok = true;
08113         }
08114       }
08115       if(!ok&&iV<MAX_NUMBER_OF_PLANES-3){
08116         if(QPlane[iV+3]>0 && QPlane[iV+1]>0){
08117           Float_t spp = QSPlane[iV+3]/QPlane[iV+3];
08118           Float_t sp  = QSPlane[iV+1]/QPlane[iV+1];
08119           U = (3*sp-spp)/2.0;
08120           ok = true;
08121         }
08122       }
08123       if(ok){
08124         x = ((U-V)*0.0417)/1.4142;
08125         y = ((U+V)*0.0417-8.0)/1.4142;
08126         pCalculator->FindNearestEdge(x,y,iedge,d);
08127         if(iplane<4)iedge=0;
08128         if(iplane>244&&iplane<249)iedge=9;
08129         if(iplane>249&&iplane<254)iedge=10;
08130         if(iplane>481)iedge=11;
08131         if(d<0.5||iedge==0||iedge>=9)QFiducial[iedge]+=demuxedHitQV[iplane][i]; 
08132         if(d<dmin){
08133           dmin = d;
08134           nearestPlane = iplane;
08135         }
08136         if(y>ymax){
08137           ymax = y;
08138           highestPlane = iplane;
08139           Qhighest = 0.;
08140           if(d<0.5||iedge==0||iedge>=9)Qhighest = demuxedHitQV[iplane][i]; 
08141         }
08142       }
08143     }
08144   }
08145 
08146   Int_t icount=0;
08147   for(int i=0;i<12;i++){
08148     if(amWriting)cout << " Edge " << i << " : " << QFiducial[i] << endl; 
08149     if(QFiducial[i]>2.0)icount++;
08150   }
08151   DeMuxEventType_t eventType = fEventType;
08152 
08153   if(fEventType!=MULTIPLE_MUON){
08154     if(icount==0)eventType =  CONTAINED_EVENT;
08155     if(icount==1){
08156       eventType = STOPPING_MUON;
08157       if(Qhighest<0.01)eventType = PARTIALLY_CONTAINED_EVENT;
08158     }
08159     if(icount>=2){
08160       if(fEventType==SINGLE_MUON||fEventType==STRAIGHT_THROUGH_GOING_MUON){
08161         eventType = STRAIGHT_THROUGH_GOING_MUON;
08162       }else{
08163         eventType = THROUGH_GOING_MUON;
08164       }
08165     }
08166   }
08167 
08168   if (eventType==CONTAINED_EVENT || eventType==PARTIALLY_CONTAINED_EVENT) {
08169 
08170     if (highestPlane < 0) { // Must be a valid array index > -1
08171       eventType = UNKNOWN;
08172       return eventType;
08173     }
08174 
08175     fCCNearestPlane=nearestPlane;
08176     fCCHighestPlane=highestPlane;
08177   }
08178 
08179   return eventType;
08180 }

void AlgAltDeMuxBase::FillLowestHighest  )  [protected]
 

Definition at line 1028 of file AlgAltDeMuxBase.cxx.

References fHighestPlane, fLowestPlane, fPlanesAltLists, and MAX_NUMBER_OF_PLANES.

Referenced by AlgAltDeMux::DeMuxPreparation().

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

void AlgAltDeMuxBase::FinalReTagCrossTalk CandDeMuxDigitListHandle cdlh  )  [protected]
 

Definition at line 843 of file AlgAltDeMuxBase.cxx.

References amShowing, digit(), 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().

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

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

Definition at line 6799 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().

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

void AlgAltDeMuxBase::GetFibreLengths  )  [protected]
 

Definition at line 1097 of file AlgAltDeMuxBase.cxx.

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

Referenced by AlgAltDeMux::DeMuxPreparation().

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

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

Definition at line 5455 of file AlgAltDeMuxBase.cxx.

References fGoldHitMap, and fGoldPlaneHit.

Referenced by DeMuxBigGroup(), and SelectHits().

05455                                                         { 
05456 
05457   fGoldPlaneHit[iplane] += 1;
05458   fGoldHitMap[iplane][fGoldPlaneHit[iplane]] = istrip;
05459 
05460   return;
05461 
05462 }

void AlgAltDeMuxBase::GroupHits  )  [protected]
 

Definition at line 5167 of file AlgAltDeMuxBase.cxx.

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

Referenced by DeMuxPass(), and DeMuxWhatsLeft().

05167                                {
05168 
05169   for(Int_t iw=0;iw<=fWCount; iw++){
05170     for(Int_t iwp=0;iwp<=fWCount; iwp++){
05171       fBmap[iw][iwp] = false;
05172     }
05173   }
05174 
05175   for(Int_t ie =0; ie<=fECount; ie++){
05176     for(Int_t iw=0; iw<=fWCount; iw++){
05177       if(fAmap[ie][iw]){
05178         for(Int_t iwp =0;iwp<=fWCount; iwp++){
05179           if(fAmap[ie][iwp]){
05180             fBmap[iw][iwp] = true;
05181             fBmap[iwp][iw] = true;
05182           }
05183         }
05184       }
05185     }
05186   }
05187 
05188   for(Int_t iw=0;iw<=fWCount; iw++){
05189     fBmap[iw][iw] = true;
05190     for(Int_t iwp=0;iwp<=fWCount; iwp++){
05191       if(fBmap[iw][iwp]==false){
05192         for(Int_t k=0;k<=fWCount; k++)fBmap[iw][iwp] |= fBmap[iw][k] && fBmap[k][iwp];
05193       }
05194     }
05195   }
05196 
05197 
05198   fNGroups = 0;
05199   for(Int_t iw=0;iw<=fWCount; iw++){fWFound[iw]=false;}
05200   for(Int_t ie=0;ie<=fECount; ie++){fEFound[ie]=false;}
05201 
05202   for(Int_t iw=0;iw<=fWCount; iw++){
05203     if(fWFound[iw]==false){
05204       fNGroups++;
05205       fNInGroupW[fNGroups]=0;
05206       for(int iwp=0;iwp<=fWCount; iwp++){
05207         if(fBmap[iw][iwp]){
05208           fNInGroupW[fNGroups]++;
05209           fWGroup[fNGroups][fNInGroupW[fNGroups]]=iwp;
05210           fWFound[iwp]=true;
05211         }
05212       }
05213     }
05214   }
05215       
05216   if(fNGroups>0){
05217     for(int ig=1;ig<=fNGroups;ig++){
05218       fNInGroupE[ig]=0;
05219       for(int iw=1;iw<=fNInGroupW[ig];iw++){
05220         for(int ie=0;ie<=fECount;ie++){
05221           if(fEFound[ie]==false && fAmap[ie][(fWGroup[ig][iw])]){
05222             fNInGroupE[ig]++;
05223             fEGroup[ig][fNInGroupE[ig]]=ie;
05224             fEFound[ie] = true;
05225           }
05226         }
05227       }
05228     }
05229   }
05230 
05231   return;
05232 }

void AlgAltDeMuxBase::Hough  )  [protected]
 

Definition at line 7102 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().

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

void AlgAltDeMuxBase::Initialize const char *  name  ) 
 

Definition at line 68 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().

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

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

Definition at line 1534 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().

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

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

Definition at line 8184 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, det, DeMuxFitResult_t::nData, DeMuxFitResult_t::nUsed, and DeMuxFitResult_t::status.

Referenced by FitAsCosmic().

08184                                                                                               {
08185 
08186   Double_t N=0.0;
08187   Double_t sumX=0.0;
08188   Double_t sumY=0.0;
08189   Double_t sumXY=0.0;
08190   Double_t sumXX=0.0;
08191   Double_t sumYY=0.0;
08192   Double_t det;
08193   DeMuxFitResult_t result;
08194   result.status = false;
08195   result.a0 = 0.;
08196   result.a1 = 0.;
08197   result.a2 = 0.;
08198   result.a3 = 0.;
08199   result.a4 = 0.;
08200   result.chi2    = 999999.;
08201   result.chi2pdf = 999999.;
08202   result.nUsed = 0;
08203   result.nData = 0;
08204 
08205   for(UInt_t i=0; i<data.size(); i++){
08206     N += 1.; 
08207     sumX += data[i].x;
08208     sumY += data[i].y;
08209     sumXX += data[i].x*data[i].x;
08210     sumXY += data[i].x*data[i].y;
08211     sumYY += data[i].y*data[i].y;
08212   }
08213   
08214   det = sumXX*N-sumX*sumX;
08215   if(det>0){
08216     result.status = true;
08217     result.a0     = (-sumX*sumXY + sumXX*sumY)/det;
08218     result.a1     = (N*sumXY - sumX*sumY)/det;
08219     if(refitDistance>0){
08220       for(UInt_t i=0; i<data.size(); i++){
08221         Double_t yFromFit = result.a0 + result.a1*data[i].x;
08222         Double_t delta = fabs(data[i].y-yFromFit);
08223         if(delta>refitDistance){
08224           data[i].status = false;
08225           N -= 1.; 
08226           sumX  -= data[i].x;
08227           sumY  -= data[i].y;
08228           sumXX -= data[i].x*data[i].x;
08229           sumXY -= data[i].x*data[i].y;
08230           sumYY -= data[i].y*data[i].y;
08231         }
08232       }
08233     } 
08234   }
08235 
08236   Double_t chi2=0.;
08237   det = sumXX*N-sumX*sumX;
08238   result.status = false;
08239   result.a0     = 0.;
08240   result.a1     = 0.;
08241   
08242   if(det>0){
08243     result.status = true;
08244     result.a0     = (-sumX*sumXY + sumXX*sumY)/det;
08245     result.a1     = (N*sumXY - sumX*sumY)/det;
08246     for(UInt_t i=0; i<data.size(); i++){
08247       if(data[i].status){
08248         Double_t yFromFit = result.a0 + result.a1*data[i].x;
08249         Double_t delta = (data[i].y-yFromFit);
08250         chi2+=delta*delta;
08251       }
08252     }
08253     result.nUsed = static_cast<Int_t>(N);
08254     result.nData = data.size();
08255     result.chi2  = chi2;
08256     if(result.nUsed>2)result.chi2pdf  = chi2/(result.nUsed-2);
08257   }
08258 
08259   return result;
08260 }

void AlgAltDeMuxBase::MakeAltListMap CandDigitListHandle cdlh  )  [protected]
 

Definition at line 548 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().

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

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

Definition at line 7975 of file AlgAltDeMuxBase.cxx.

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

Referenced by DrawDiagnosticPlots(), and FitAsCosmic().

07976                                                  {
07977   
07978   Float_t xp[2];
07979   Float_t yp[2];
07980 
07981   if(result.status){
07982     xp[0] = 0;
07983     xp[1] = 249.;
07984     yp[0] = result.a0;
07985     yp[1] = result.a1*249.+result.a0;
07986     if(pPolyLine1)delete pPolyLine1;
07987     pPolyLine1 = new TPolyLine(2,xp,yp);
07988     pPolyLine1->SetLineColor(color);
07989     pPolyLine1->SetLineStyle(style);
07990     pPolyLine1->SetLineWidth(2);
07991     xp[0] = 249;
07992     xp[1] = 500.;
07993     yp[0] = result.a1*269.+result.a0;
07994     yp[1] = result.a1*520.+result.a0;
07995     if(pPolyLine2)delete pPolyLine2;
07996     pPolyLine2 = new TPolyLine(2,xp,yp);
07997     pPolyLine2->SetLineColor(color);
07998     pPolyLine2->SetLineStyle(style);
07999     pPolyLine2->SetLineWidth(2);
08000   }
08001 
08002   return;
08003 
08004 }

void AlgAltDeMuxBase::MakeMaskGroups  )  [protected]
 

Definition at line 1458 of file AlgAltDeMuxBase.cxx.

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

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

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

void AlgAltDeMuxBase::MakeMultipleTargets Int_t  iplane  )  [protected]
 

Definition at line 3958 of file AlgAltDeMuxBase.cxx.

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

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

03958                                                      {
03959 
03960   fTargetStrips.erase(fTargetStrips.begin(),fTargetStrips.end());
03961 
03962   Int_t jplane = iplane;
03963   if(iplane>248)jplane+=20;
03964   if(fUVMap[iplane]==PlaneView::kU){
03965     for(UInt_t iline=0; iline<multipleMuonInterceptsU.size();iline++){
03966       Float_t rtarget = fHoughSlopeU*jplane + multipleMuonInterceptsU[iline];
03967       Int_t itarget = static_cast<Int_t>(rtarget);
03968       if(itarget<198&&itarget>-10){
03969         if(itarget>190)itarget=191;
03970         if(itarget<0)itarget=0;
03971         fTargetStrips.push_back(itarget);
03972       }
03973     }
03974   }
03975   if(fUVMap[iplane]==PlaneView::kV){
03976     for(UInt_t iline=0; iline<multipleMuonInterceptsV.size();iline++){
03977       Float_t rtarget = fHoughSlopeV*jplane + multipleMuonInterceptsV[iline];
03978       Int_t itarget = static_cast<Int_t>(rtarget);
03979       if(itarget<198&&itarget>-10){
03980         if(itarget>190)itarget=191;
03981         if(itarget<0)itarget=0;
03982         fTargetStrips.push_back(itarget);
03983       }
03984     }
03985   }
03986 
03987   return;
03988 }

void AlgAltDeMuxBase::MakePixelMap CandDigitListHandle cdlh  )  [protected]
 

Definition at line 591 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().

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

void AlgAltDeMuxBase::MakePlaneMap DeMuxSearchTactic   )  [protected]
 

Definition at line 5908 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.

05909 {
05910 
05911   Int_t i = tactic.iplane;
05912   Int_t j = tactic.lowplane;
05913   Int_t k = tactic.highplane;
05914 
05915   Float_t target = 0;
05916   Int_t itarget;
05917   Int_t it;
05918 
05919 
05920   if(j<0&&j>-100)MSG("AltDeMux", Msg::kFatal) << "AlgAltDeMuxBase::MakePlaneMap lowplane out of range : " << j << endl;
05921   if(k>=MAX_NUMBER_OF_PLANES)MSG("AltDeMux", Msg::kFatal) << "AlgAltDeMuxBase::MakePlaneMap highplane out of range : " << k << endl;
05922 
05923   fTargetStrips.erase(fTargetStrips.begin(),fTargetStrips.end());
05924   if(fEventType==MULTIPLE_MUON)MakeMultipleTargets(i);
05925 
05926   bool useHoughSlope