]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONEventRecoCombi.cxx
Adding CreateIterator(void) and GetNeighbours() pure virtual methods,
[u/mrichter/AliRoot.git] / MUON / AliMUONEventRecoCombi.cxx
index f7dab52b5e401c4007544f6b3890e09dc04eb221..a9fa44863a33112b1b7125e691b423cc00814f99 100644 (file)
 
 /* $Id$ */
 
-#include <Riostream.h>
-#include <TClonesArray.h>
-#include <TArrayS.h>
-#include <TArrayD.h>
+// -------------------------------------
+// Class AliMUONEventRecoCombi
+// -------------------------------------
+// Steering class for the combined cluster / track reconstructor
+// Author: Alexander Zinchenko, JINR Dubna
+
 #include "AliMUONEventRecoCombi.h"
+
 #include "AliMUONData.h"
 #include "AliMUONDetElement.h"
 #include "AliMUONDigit.h"
 #include "AliMUONHitForRec.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONTrackK.h"
-#include "AliMUONTrackReconstructor.h"
+#include "AliMUONTrackReconstructorK.h"
 #include "AliMUONConstants.h"
+
 #include "AliLoader.h"
+#include "AliLog.h"
 
+#include <Riostream.h>
+#include <TClonesArray.h>
+#include <TArrayS.h>
+#include <TArrayD.h>
+
+/// \cond CLASSIMP
 ClassImp(AliMUONEventRecoCombi)
+/// \endcond
 
 AliMUONEventRecoCombi* AliMUONEventRecoCombi::fgRecoCombi = 0; 
 
 //_________________________________________________________________________
-AliMUONEventRecoCombi::AliMUONEventRecoCombi() : TObject()
+AliMUONEventRecoCombi::AliMUONEventRecoCombi() 
+  : TObject(),
+    fDetElems(0x0),
+    fZ(new TArrayD(20)),
+    fNZ(0),
+    fDEvsZ(0x0)
 {
-  // Ctor
+  /// Ctor
 
   fDetElems = new TClonesArray("AliMUONDetElement", 20);
-  fZ = new TArrayD(20);
-  fNZ = 0;
-  fDEvsZ = NULL;
 }
 
 //_________________________________________________________________________
 AliMUONEventRecoCombi* AliMUONEventRecoCombi::Instance()
 {
-// return pointer to the singleton instance
+/// Return pointer to the singleton instance
 
   if (fgRecoCombi == 0) {
     fgRecoCombi = new AliMUONEventRecoCombi();
   }
-  //fDetElems = new TClonesArray("AliMUONDetElement", 20);
-  //fZ = new TArrayD(20);
-  //fNZ = 0;
   return fgRecoCombi;
 }
 
 //_________________________________________________________________________
 AliMUONEventRecoCombi::~AliMUONEventRecoCombi()
 {
-  // Destructor
+  /// Destructor
   delete fDetElems;
   delete fZ;
   delete [] fDEvsZ;
@@ -71,7 +82,7 @@ AliMUONEventRecoCombi::~AliMUONEventRecoCombi()
 //_________________________________________________________________________
 void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ *recModel)
 {
-  // Fill event information
+  /// Fill event information
 
   // Clear previous event
   fDetElems->Delete();
@@ -83,6 +94,7 @@ void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ
   for (Int_t ich = 0; ich < 6; ich++) {
     // loop over chambers 0-5
     TClonesArray *digs = data->Digits(ich);
+    digs->Sort(); //AZ
     //cout << ich << " " << digs << " " << digs->GetEntriesFast() << endl;
     Int_t idDE = -1;
     for (Int_t i = 0; i < digs->GetEntriesFast(); i++) {
@@ -95,6 +107,14 @@ void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ
     }
   }
 
+  // Compute average Z-position
+  for (Int_t i = 0; i < nDetElem; i++) {
+    AliMUONDetElement *detElem = (AliMUONDetElement*) fDetElems->UncheckedAt(i);
+    Int_t nDigs = detElem->Digits(0)->GetEntriesFast() + 
+                  detElem->Digits(1)->GetEntriesFast();
+    detElem->SetZ(detElem->Z() / nDigs);
+  }
+  
   // Sort according to Z
   fDetElems->Sort();
   //cout << nDetElem << endl;
@@ -108,13 +128,13 @@ void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ
   for (Int_t i = 0; i < nDetElem; i++) {
     AliMUONDetElement *detElem = (AliMUONDetElement*) fDetElems->UncheckedAt(i);
     detElem->Fill(data);
-    //cout << i << " " << detElem->Z() << endl;
-    if (detElem->Z() - z0 < 0.5) { 
+    //cout << i << " " << detElem->IdDE() << " " << detElem->Z() << endl;
+    if (detElem->Z() - z0 < 0.05) { 
       // the same Z
       (*nPerZ)[fNZ]++;
     } else {
-      if (fZ->GetSize() <= fNZ) fZ->Set(fZ->GetSize()+10);
-      if (nPerZ->GetSize() <= fNZ) nPerZ->Set(nPerZ->GetSize()+10);
+      if (fZ->GetSize() <= fNZ+1) fZ->Set(fZ->GetSize()+10);
+      if (nPerZ->GetSize() <= fNZ+1) nPerZ->Set(nPerZ->GetSize()+10);
       (*fZ)[++fNZ] = detElem->Z();
       z0 = detElem->Z();
       (*nPerZ)[fNZ]++;
@@ -144,27 +164,31 @@ void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ
   // Fill rec. point container for stations 4 and 5
   //cout << data->TreeR() << endl;
   //data->MakeBranch("RC");
+  /*
   data->SetTreeAddress("RCC");
   for (Int_t ch = 6; ch < 10; ch++) {
     TClonesArray *raw = data->RawClusters(ch);
-    //cout << raw->GetEntriesFast() << " " << data->RawClusters(ch) << endl;
-    for (Int_t i = 0; i < raw->GetEntriesFast(); i++) {
+    cout << ch << " " << raw->GetEntriesFast() << " " << data->RawClusters(ch) << endl;
+    //for (Int_t i = 0; i < raw->GetEntriesFast(); i++) {
+    for (Int_t i = 0; i < TMath::Min(raw->GetEntriesFast(),1000); i++) {
       AliMUONRawCluster *clus = (AliMUONRawCluster*) raw->UncheckedAt(i);
       data->AddRawCluster(ch, *clus);
+      cout << i << " " << raw->GetEntriesFast() << endl;
     }
   }
+  */
   //data->SetTreeAddress("RC");
 }
 
 //_________________________________________________________________________
-void AliMUONEventRecoCombi::FillRecP(AliMUONData *dataCluster, AliMUONTrackReconstructor *recoTrack)
+void AliMUONEventRecoCombi::FillRecP(AliMUONData *dataCluster, AliMUONTrackReconstructorK *recoTrack) const
 {
-  // Fill rec. points used for tracking from det. elems
+  /// Fill rec. points used for tracking from det. elems
 
   TClonesArray *tracks = recoTrack->GetRecTracksPtr();
   for (Int_t i = 0; i < recoTrack->GetNRecTracks(); i++) {
     AliMUONTrackK *track = (AliMUONTrackK*) tracks->UncheckedAt(i);
-    TObjArray *hits = track->GetHitOnTrack();
+    TObjArray *hits = track->GetTrackHits();
     for (Int_t j = 0; j < track->GetNTrackHits(); j++) {
       AliMUONHitForRec *hit = (AliMUONHitForRec*) hits->UncheckedAt(j);
       if (hit->GetHitNumber() >= 0) continue;
@@ -207,7 +231,7 @@ void AliMUONEventRecoCombi::FillRecP(AliMUONData *dataCluster, AliMUONTrackRecon
 //_________________________________________________________________________
 Int_t AliMUONEventRecoCombi::IZfromHit(AliMUONHitForRec *hit) const
 {
-  // Get Iz of det. elem. from the hit
+  /// Get Iz of det. elem. from the hit
 
   Int_t index = -hit->GetHitNumber() / 100000 - 1, iz0 = -1;
   for (Int_t iz = 0; iz < fNZ; iz++) {