]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONAlignment.cxx
In AliMUONRecoCheck:
[u/mrichter/AliRoot.git] / MUON / AliMUONAlignment.cxx
index 782d2197e0e1b35af2509821d8c11fb897b4fe40..595d470149ef7f10de3dfed3045551e1e474682d 100644 (file)
@@ -83,7 +83,7 @@ AliMUONAlignment::AliMUONAlignment()
     fTrackRecord(),
     fTransform(0)
 {
-
+  /// Default constructor      
   fSigma[0] = 1.5e-1;
   fSigma[1] = 1.0e-2;
 
@@ -103,6 +103,58 @@ AliMUONAlignment::AliMUONAlignment()
 
 }
 
+//_____________________________________________________________________
+AliMUONAlignment::AliMUONAlignment(TRootIOCtor* /*dummy*/)
+: TObject(),
+fBFieldOn(kFALSE),
+fStartFac(0.),
+fResCutInitial(0.),
+fResCut(0.),
+fMillepede(0),
+fTrack(0),
+fCluster(0),
+fTrackParam(0),
+fNGlobal(0),
+fNLocal(0),
+fNStdDev(0),
+fDetElemId(0),
+fDetElemNumber(0),
+fPhi(0.),
+fCosPhi(0.),
+fSinPhi(0.),
+fTrackRecord(),
+fTransform(0)
+{
+  /// Root IO constructor
+  ResetConstraints();
+  for (Int_t iCh=0; iCh<10; iCh++) { 
+    fChOnOff[iCh] = kFALSE; 
+  }
+  fSpecLROnOff[0] = kFALSE; fSpecLROnOff[1] = kFALSE;
+  for (Int_t iDoF=0; iDoF<4; iDoF++) {
+    fDoF[iDoF] = kFALSE;
+    fAllowVar[iDoF] = kFALSE;
+  }
+  for (Int_t i=0; i<3; i++) {
+    fClustPos[i] = 0;
+    fClustPosLoc[i] = 0;
+    fTrackPos0[i] = 0;  
+    fTrackPos[i] = 0;   
+    fTrackPosLoc[i] = 0;
+       fDetElemPos[i] = 0;
+  }
+  fTrackSlope0[0]=0;   fTrackSlope0[1]=0;
+  fTrackSlope[0]=0;    fTrackSlope[1]=0;
+  fMeas[0]=0;  fMeas[1]=0;
+  fSigma[0]=0; fSigma[1]=0;
+  for (Int_t iLPar=0; iLPar<4; iLPar++) {
+    fLocalDerivatives[iLPar]=0;        
+  }
+  for (Int_t iGPar=0; iGPar<624; iGPar++) {
+    fGlobalDerivatives[iGPar]=0;       
+  }
+}
+
 //_____________________________________________________________________
 AliMUONAlignment::~AliMUONAlignment()
 {}
@@ -496,14 +548,19 @@ void AliMUONAlignment::AddConstraints(const Bool_t *lChOnOff, const Bool_t *lVar
       }
     }
   }
-  lMeanY /= lNDetElem;
-  lSigmaY /= lNDetElem;
-  lSigmaY = TMath::Sqrt(lSigmaY-lMeanY*lMeanY);
-  lMeanZ /= lNDetElem;
-  lSigmaZ /= lNDetElem;
-  lSigmaZ = TMath::Sqrt(lSigmaZ-lMeanZ*lMeanZ);
-  AliInfo(Form("Used %i DetElem, MeanZ= %f , SigmaZ= %f", lNDetElem,lMeanZ,lSigmaZ));
-
+  if (lNDetElem) {
+    lMeanY /= lNDetElem;
+    lSigmaY /= lNDetElem;
+    lSigmaY = TMath::Sqrt(lSigmaY-lMeanY*lMeanY);
+    lMeanZ /= lNDetElem;
+    lSigmaZ /= lNDetElem;
+    lSigmaZ = TMath::Sqrt(lSigmaZ-lMeanZ*lMeanZ);
+     AliInfo(Form("Used %i DetElem, MeanZ= %f , SigmaZ= %f", lNDetElem,lMeanZ,lSigmaZ));
+  } else {
+    AliError("No detection elements to constrain!!!");
+    return;    
+  }
+               
   for (Int_t i = 0; i < fgNDetElem; i++){
     Int_t iCh=0;
     for (iCh=1; iCh<=fgNCh; iCh++){
@@ -717,7 +774,14 @@ void AliMUONAlignment::ConstrainR(Int_t lDetElem, Int_t lCh, Double_t *lConstrai
 void AliMUONAlignment::ResetConstraints(){
   /// Reset all constraint equations
   for (Int_t i = 0; i < fgNDetElem; i++){
-    fConstraintX[i*fgNParCh+0]=0.0;
+       fConstraintX3[i*fgNParCh+0]=0.0; 
+       fConstraintY3[i*fgNParCh+0]=0.0; 
+       fConstraintX4[i*fgNParCh+0]=0.0; 
+       fConstraintY4[i*fgNParCh+0]=0.0; 
+       fConstraintP4[i*fgNParCh+0]=0.0; 
+       fConstraintX5[i*fgNParCh+0]=0.0; 
+       fConstraintY5[i*fgNParCh+0]=0.0; 
+       fConstraintX[i*fgNParCh+0]=0.0;
     fConstraintX[i*fgNParCh+1]=0.0;
     fConstraintX[i*fgNParCh+2]=0.0;
     fConstraintY[i*fgNParCh+0]=0.0;
@@ -1090,7 +1154,7 @@ void AliMUONAlignment::FillDetElemData()
 //_____________________________________________________
 AliMUONAlignmentTrackRecord* AliMUONAlignment::ProcessTrack( AliMUONTrack* track, Bool_t doAlignment )
 {
-
+  /// Process track and set Local Equations
   // store current track in running member.
   fTrack = track;
 
@@ -1107,8 +1171,9 @@ AliMUONAlignmentTrackRecord* AliMUONAlignment::ProcessTrack( AliMUONTrack* track
 
     // and get new pointers
     fTrackParam = (AliMUONTrackParam *) fTrack->GetTrackParamAtCluster()->At(iCluster);
+    if ( ! fTrackParam ) continue;
     fCluster = fTrackParam->GetClusterPtr();
-    if (!fCluster || !fTrackParam) continue;
+    if ( ! fCluster ) continue;
     // if (fDetElemId<500) continue;
 
     // fill local variables for this position --> one measurement
@@ -1170,7 +1235,7 @@ AliMUONAlignmentTrackRecord* AliMUONAlignment::ProcessTrack( AliMUONTrack* track
 //______________________________________________________________________________
 void AliMUONAlignment::ProcessTrack( AliMUONAlignmentTrackRecord* track, Bool_t doAlignment )
 {
-
+  /// Process track (from record) and set Local Equations
   if( !( track && doAlignment ) ) return;
 
   // loop over clusters