]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterInput.cxx
Adding debug messages
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterInput.cxx
index e3e990de1e3463d824d3a57292d46f37b7df61f1..558f6510931422baa2c6f78435d6e40d3971b73d 100644 (file)
 
 /* $Id$ */
 
+// ----------------------------
+// Class AliMUONClusterInput
+// ----------------------------
+// Global data service for hit reconstruction
+// Author: to be added
+
 #include "AliMUONClusterInput.h"
 
-#include "AliMUON.h"
+#include "AliMUONGeometryTransformer.h"
+#include "AliMUONGeometrySegmentation.h"
+#include "AliMUONSegFactory.h"
 #include "AliMUONSegmentation.h"
 #include "AliMUONConstants.h"
 #include "AliMUONMathieson.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONDigit.h"
 
-#include "AliRun.h"
 #include "AliLog.h"
 
 #include <TClonesArray.h>
 #include <TMinuit.h>
+#include <TGeoManager.h>
 
-AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0; 
-TMinuit* AliMUONClusterInput::fgMinuit = 0; 
-AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0; 
+AliMUONClusterInput*        AliMUONClusterInput::fgClusterInput = 0; 
+TMinuit*                    AliMUONClusterInput::fgMinuit = 0; 
+AliMUONMathieson*           AliMUONClusterInput::fgMathieson = 0; 
+AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0; 
+AliMUONSegmentation*        AliMUONClusterInput::fgSegmentation = 0; 
 
 ClassImp(AliMUONClusterInput)
 
 AliMUONClusterInput::AliMUONClusterInput()
   : TObject(),
+    fNseg(0),
+    fChamber(0),
     fCluster(0),
+    fZ(0.),
     fChargeCorrel(1.),
     fDetElemId(0)
   
 {
+// Default constructor
+
   fDigits[0]=0;
   fDigits[1]=0;
   fSegmentation2[0]=0;
@@ -55,6 +70,16 @@ AliMUONClusterInput* AliMUONClusterInput::Instance()
     if (fgClusterInput == 0) {
        fgClusterInput = new AliMUONClusterInput();
        fgMinuit = new TMinuit(8);
+       
+       // Create segmentation with activated Root geometry  
+       if ( ! gGeoManager ) {
+         AliFatalClass("Geometry not loaded.");
+         return fgClusterInput;
+       }  
+        fgTransformer = new AliMUONGeometryTransformer(true);
+        fgTransformer->ReadGeometryData("volpath.dat", gGeoManager);
+        AliMUONSegFactory factory(fgTransformer);
+       fgSegmentation = factory.CreateSegmentation(); 
     }
     
     return fgClusterInput;
@@ -65,13 +90,10 @@ AliMUONClusterInput::~AliMUONClusterInput()
 // Destructor
     delete fgMinuit;
     delete fgMathieson;
-}
-
-AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
-{
-// Protected copy constructor
-
-  AliFatal("Not implemented.");
+    delete fgTransformer;
+    delete fgSegmentation;
+    fgMinuit = 0;
+    fgMathieson = 0;
 }
 
 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
@@ -84,15 +106,11 @@ void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig
     fNDigits[0] = dig1->GetEntriesFast();
     fNDigits[1] = dig2->GetEntriesFast();
     
+    delete fgMathieson;
     fgMathieson = new AliMUONMathieson();
 
-    AliMUON *pMUON;
-    AliMUONSegmentation* pSegmentation;
-
-    pMUON = (AliMUON*) gAlice->GetModule("MUON");
-    pSegmentation = pMUON->GetSegmentation();
-    fSegmentation2[0]= pSegmentation->GetModuleSegmentation(chamber, 0);
-    fSegmentation2[1]= pSegmentation->GetModuleSegmentation(chamber, 1);
+    fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
+    fSegmentation2[1]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 1);
 
     fNseg = 2;
     if (chamber < AliMUONConstants::NTrackingCh()) {
@@ -118,13 +136,7 @@ void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig
     fDetElemId = idDE;
     fDigits[0] = dig;
 
-    AliMUON *pMUON;
-    AliMUONSegmentation* pSegmentation;
-
-    pMUON = (AliMUON*) gAlice->GetModule("MUON");
-    pSegmentation = pMUON->GetSegmentation();
-    fSegmentation2[0]= pSegmentation->GetModuleSegmentation(chamber, 0);
-
+    fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
     fNseg=1;
 }
 
@@ -180,11 +192,11 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cat
 // par[0]    x-position of cluster
 // par[1]    y-position of cluster
 
-    Float_t q1;
-    fSegmentation2[cath]->SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
-    //  First Cluster
-    fSegmentation2[cath]->SetHit(fDetElemId, par[0],par[1],fZ);
-    q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
+   Float_t q1;
+   fSegmentation2[cath]-> SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
+   //  First Cluster
+   fSegmentation2[cath]-> SetHit(fDetElemId, par[0],par[1],fZ);
+   q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
        
    Float_t value = fQtot[cath]*q1;
    return value;