]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONEventRecoCombi.cxx
Updated list of MUON libraries
[u/mrichter/AliRoot.git] / MUON / AliMUONEventRecoCombi.cxx
index b6b0619fa781a1a2e0b4b41dda37f2d39c3a0b11..899d7b64e3508b562602a5fe35289190753e5dd2 100644 (file)
 
 #include "AliMUONEventRecoCombi.h"
 
-#include "AliMUONData.h"
+#include "AliMUONRecData.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>
-#include "AliLog.h"
-
-AliMUONEventRecoCombi* AliMUONEventRecoCombi::fgRecoCombi = 0; 
 
+/// \cond CLASSIMP
 ClassImp(AliMUONEventRecoCombi)
+/// \endcond
+
+AliMUONEventRecoCombi* AliMUONEventRecoCombi::fgRecoCombi = 0; 
 
 //_________________________________________________________________________
-  AliMUONEventRecoCombi::AliMUONEventRecoCombi() 
-    : TObject(),
-      fDetElems(0x0),
-      fZ(0x0),
-      fNZ(0),
-      fDEvsZ(0x0)
+AliMUONEventRecoCombi::AliMUONEventRecoCombi(AliMUONSegmentation* segmentation) 
+  : TObject(),
+    fSegmentation(segmentation),
+    fDetElems(0x0),
+    fZ(new TArrayD(20)),
+    fNZ(0),
+    fDEvsZ(0x0)
 {
-  // Ctor
+  /// Ctor
 
   fDetElems = new TClonesArray("AliMUONDetElement", 20);
-  fZ = new TArrayD(20);
 }
 
 //_________________________________________________________________________
-AliMUONEventRecoCombi* AliMUONEventRecoCombi::Instance()
+AliMUONEventRecoCombi* AliMUONEventRecoCombi::Instance(AliMUONSegmentation* segmentation)
 {
-// return pointer to the singleton instance
+/// Return pointer to the singleton instance
 
   if (fgRecoCombi == 0) {
-    fgRecoCombi = new AliMUONEventRecoCombi();
+    fgRecoCombi = new AliMUONEventRecoCombi(segmentation);
   }
-  //fDetElems = new TClonesArray("AliMUONDetElement", 20);
-  //fZ = new TArrayD(20);
-  //fNZ = 0;
   return fgRecoCombi;
 }
 
 //_________________________________________________________________________
 AliMUONEventRecoCombi::~AliMUONEventRecoCombi()
 {
-  // Destructor
+  /// Destructor
   delete fDetElems;
   delete fZ;
   delete [] fDEvsZ;
 }
 
 //_________________________________________________________________________
-void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ *recModel)
+void AliMUONEventRecoCombi::FillEvent(AliMUONRecData *data, AliMUONClusterFinderAZ *recModel)
 {
-  // Fill event information
+  /// Fill event information
 
   // Clear previous event
   fDetElems->Delete();
@@ -96,18 +95,27 @@ 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++) {
       AliMUONDigit *dig = (AliMUONDigit*) digs->UncheckedAt(i);
       if (dig->DetElemId() != idDE) {
        idDE = dig->DetElemId();
-       new ((*fDetElems)[nDetElem++]) AliMUONDetElement(idDE, dig, recModel);
+       new ((*fDetElems)[nDetElem++]) AliMUONDetElement(idDE, dig, recModel, fSegmentation);
       }
       else ((AliMUONDetElement*)fDetElems->UncheckedAt(nDetElem-1))->AddDigit(dig);
     }
   }
 
+  // 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;
@@ -121,13 +129,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]++;
@@ -157,22 +165,26 @@ 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) const
+void AliMUONEventRecoCombi::FillRecP(AliMUONRecData *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++) {
@@ -220,7 +232,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++) {