]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterInput.cxx
Updated constants & method
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterInput.cxx
index 40668c7be9541b4bcf7a835487c9f5914fca27c6..6fb69987e432b4936a557fe7574b3f39a327097a 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.6  2000/10/06 09:04:50  morsch
-
-- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate
-        to make code work with slat chambers.
-
-Revision 1.5  2000/10/02 16:58:29  egangler
-Cleaning of the code :
--> coding conventions
--> void Streamers
--> some useless includes removed or replaced by "class" statement
-
-Revision 1.4  2000/07/03 11:54:57  morsch
-AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
-The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
-
-Revision 1.3  2000/06/28 15:16:35  morsch
-(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
-to allow development of slat-muon chamber simulation and reconstruction code in the MUON
-framework. The changes should have no side effects (mostly dummy arguments).
-(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
-of chambers with overlapping modules (MakePadHits, Disintegration).
-
-Revision 1.2  2000/06/28 12:19:18  morsch
-More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
-cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
-AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
-It requires two cathode planes. Small modifications in the code will make it usable for
-one cathode plane and, hence, more general (for test beam data).
-AliMUONClusterFinder is now obsolete.
-
-Revision 1.1  2000/06/28 08:06:10  morsch
-Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
-algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
-It also naturally takes care of the TMinuit instance.
-
-*/
+/* $Id$ */
+
+#include <TClonesArray.h>
+#include <TMinuit.h>
+
 #include "AliRun.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
+#include "AliMUONConstants.h"
 #include "AliMUONClusterInput.h"
-#include "AliSegmentation.h"
-#include "AliMUONResponse.h"
+#include "AliMUONMathieson.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONDigit.h"
-
-#include <TClonesArray.h>
-#include <TMinuit.h>
+#include "AliLog.h"
 
 ClassImp(AliMUONClusterInput)
 
 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0; 
 TMinuit* AliMUONClusterInput::fgMinuit = 0; 
+AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0; 
+
+AliMUONClusterInput::AliMUONClusterInput()
+  : TObject(),
+    fCluster(0),
+    fChargeCorrel(1.) // in case not defined
+
+{
+  fDigits[0]=0;
+  fDigits[1]=0;
+  fSegmentation[0]=0;
+  fSegmentation[1]=0;
+}
 
 AliMUONClusterInput* AliMUONClusterInput::Instance()
 {
@@ -79,6 +57,20 @@ AliMUONClusterInput* AliMUONClusterInput::Instance()
     return fgClusterInput;
 }
 
+AliMUONClusterInput::~AliMUONClusterInput()
+{
+// Destructor
+    delete fgMinuit;
+    delete fgMathieson;
+}
+
+AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
+{
+// Protected copy constructor
+
+  AliFatal("Not implemented.");
+}
+
 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
 {
 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
@@ -94,10 +86,23 @@ void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesAr
     pMUON = (AliMUON*) gAlice->GetModule("MUON");
     iChamber =  &(pMUON->Chamber(chamber));
 
+    fgMathieson = new AliMUONMathieson();
     fSegmentation[0]=iChamber->SegmentationModel(1);
     fSegmentation[1]=iChamber->SegmentationModel(2);
-    fResponse=iChamber->ResponseModel();
     fNseg = 2;
+    if (chamber < AliMUONConstants::NTrackingCh()) {
+      if (chamber > 1 ) {
+       fgMathieson->SetPitch(AliMUONConstants::Pitch());
+       fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
+       fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
+       fChargeCorrel = AliMUONConstants::ChargeCorrel();
+      } else {
+       fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
+       fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
+       fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
+       fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
+      }
+    }
 }
 
 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
@@ -111,33 +116,32 @@ void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
     iChamber =  &(pMUON->Chamber(chamber));
 
     fSegmentation[0]=iChamber->SegmentationModel(1);
-    fResponse=iChamber->ResponseModel();
     fNseg=1;
 }
 
 void  AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
 {
 // Set the current cluster
-    printf("\n %p \n", cluster);
+    //PH printf("\n %p \n", cluster);
     fCluster=cluster;
     Float_t qtot;
     Int_t   i, cath, ix, iy;
     AliMUONDigit* digit;
-    fNmul[0]=cluster->fMultiplicity[0];
-    fNmul[1]=cluster->fMultiplicity[1];
-    printf("\n %p %p ", fDigits[0], fDigits[1]);
+    fNmul[0]=cluster->GetMultiplicity(0);
+    fNmul[1]=cluster->GetMultiplicity(1);
+    //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
     
     for (cath=0; cath<2; cath++) {
        qtot=0;
        for (i=0; i<fNmul[cath]; i++) {
            // pointer to digit
            digit =(AliMUONDigit*)
-               (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
+               (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
            // pad coordinates
-           ix = digit->fPadX;
-           iy = digit->fPadY;
+           ix = digit->PadX();
+           iy = digit->PadY();
            // pad charge
-           fCharge[i][cath] = digit->fSignal;
+           fCharge[i][cath] = digit->Signal();
            // pad centre coordinates
 //         fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
             // globals kUsed in fitting functions
@@ -158,16 +162,8 @@ void  AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
 
 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par) 
 {
-// par[0]    x-position of cluster
-// par[1]    y-position of cluster
-
-   fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
-//  First Cluster
-   fSegmentation[0]->SetHit(par[0],par[1],fZ);
-   Float_t q1=fResponse->IntXY(fSegmentation[0]);
-    
-   Float_t value = fQtot[0]*q1;
-   return value;
+// Compute the charge on first cathod only.
+return DiscrChargeCombiS1(i,par,0);
 }
 
 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath) 
@@ -178,7 +174,7 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cat
    fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
 //  First Cluster
    fSegmentation[cath]->SetHit(par[0],par[1],fZ);
-   Float_t q1=fResponse->IntXY(fSegmentation[cath]);
+   Float_t q1=fgMathieson->IntXY(fSegmentation[cath]);
     
    Float_t value = fQtot[cath]*q1;
    return value;
@@ -197,11 +193,11 @@ Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
    fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
 //  First Cluster
    fSegmentation[0]->SetHit(par[0],par[1],fZ);
-   Float_t q1=fResponse->IntXY(fSegmentation[0]);
+   Float_t q1=fgMathieson->IntXY(fSegmentation[0]);
     
 //  Second Cluster
    fSegmentation[0]->SetHit(par[2],par[3],fZ);
-   Float_t q2=fResponse->IntXY(fSegmentation[0]);
+   Float_t q2=fgMathieson->IntXY(fSegmentation[0]);
     
    Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
    return value;
@@ -213,17 +209,18 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cat
 // par[1]    y-position of first  cluster
 // par[2]    x-position of second cluster
 // par[3]    y-position of second cluster
-// par[4]    charge fraction of first  cluster
-// 1-par[4]  charge fraction of second cluster
+// par[4]    charge fraction of first  cluster - first cathode
+// 1-par[4]  charge fraction of second cluster 
+// par[5]    charge fraction of first  cluster - second cathode
 
    fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
 //  First Cluster
    fSegmentation[cath]->SetHit(par[0],par[1],fZ);
-   Float_t q1=fResponse->IntXY(fSegmentation[cath]);
+   Float_t q1=fgMathieson->IntXY(fSegmentation[cath]);
     
 //  Second Cluster
    fSegmentation[cath]->SetHit(par[2],par[3],fZ);
-   Float_t q2=fResponse->IntXY(fSegmentation[cath]);
+   Float_t q2=fgMathieson->IntXY(fSegmentation[cath]);
    Float_t value;
    if (cath==0) {
        value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
@@ -236,8 +233,11 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cat
 AliMUONClusterInput& AliMUONClusterInput
 ::operator = (const AliMUONClusterInput& rhs)
 {
-// Dummy assignment operator
-    return *this;
-}
+// Protected assignement operator
 
+  if (this == &rhs) return *this;
 
+  AliFatal("Not implemented.");
+    
+  return *this;  
+}