]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes to use new VDigitStore and VClusterStore (Laurent)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Jun 2007 20:45:47 +0000 (20:45 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Jun 2007 20:45:47 +0000 (20:45 +0000)
MUON/AliMUONClusterReconstructor.cxx
MUON/AliMUONClusterReconstructor.h

index 9decfd382d7e096d2d41aeaeab39cf2822822641..5640422e6a4144e4b2b38a050453aab7f2d1a0be 100644 (file)
 
 /* $Id$ */
 
-// -----------------------------------
-// Class AliMUONClusterReconstructor
-// ----------------------------------
-// MUON cluster reconstructor for MUON
-// Should implement a virtual class ClusterFinder to choose between VS and AZ method
+/// \class AliMUONClusterReconstructor
+///
+/// This class is just a steering class to loop over detection elements of tracking chambers,
+/// extract the relevant digits, and pass them to the actual clusterizer class,
+/// which operate on a single detection element at a time.
+///
+/// \author C. Finck and L. Aphecetche, Subatech
+///
 
-#include <Riostream.h>
 #include "AliMUONClusterReconstructor.h"
-#include "AliRunLoader.h"
-#include "AliLoader.h"
 
-#include "AliMUONDigit.h"
-#include "AliMUONConstants.h"
-#include "AliMUONRecData.h"
-#include "AliMUONClusterFinderVS.h"
-#include "AliMUONClusterInput.h"
+#include "AliLog.h"
+#include "AliMUONCluster.h"
+#include "AliMUONGeometryTransformer.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONVClusterFinder.h"
-#include "AliMUONCluster.h"
+#include "AliMUONVClusterStore.h"
+#include "AliMUONVDigit.h"
+#include "AliMUONVDigitStore.h"
+#include "AliMpDEIterator.h"
 #include "AliMpDEManager.h"
 #include "AliMpSegmentation.h"
-#include "AliMpCathodType.h"
-#include "AliMUONGeometryTransformer.h"
-#include "AliLog.h"
+#include <Riostream.h>
 
 /// \cond CLASSIMP
 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
 /// \endcond
  
 //__________________________________________________________________________
-AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONRecData* data,
-                                                         AliMUONVClusterFinder* clusterFinder,
+AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONVClusterFinder* clusterFinder,
                                                          const AliMUONGeometryTransformer* transformer)
 : TObject(),
   fClusterFinder(clusterFinder),
-  fMUONData(data),
-  fRecModel(new AliMUONClusterFinderVS()),
-  fDigitsCath0(new TClonesArray("AliMUONDigit",1000)),
-  fDigitsCath1(new TClonesArray("AliMUONDigit",1000)),
-  fTransformer(transformer)
+  fTransformer(transformer),
+  fClusterStore(0x0)
 {
-/// Standard Constructor
+    /// Standard Constructor
 
-  fDigitsCath0->SetOwner(kTRUE); 
-  fDigitsCath1->SetOwner(kTRUE);
   if (!transformer && clusterFinder)
   {
     AliFatal("I require a geometry transformer, otherwise I cannot compute "
              "global coordinates of the clusters !");    
   }
+  
+//  fRecModel->SetGhostChi2Cut(10);
 }
 
 //__________________________________________________________________________
 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
 {
-/// Destructor
-
-  delete fRecModel;
-  delete fDigitsCath0;
-  delete fDigitsCath1;
+  /// Destructor
 }
 
 //______________________________________________________________________________
 void
-AliMUONClusterReconstructor::ClusterizeOneDEV2(Int_t detElemId)
+AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId,
+                                             const AliMUONVDigitStore& digitStore)
 {
-/// Clusterize one detection element, and let fMUONData know about
-/// the results.
-
-  AliDebug(1,Form("DE %d",detElemId));
+  /// Clusterize one detection element, which digits are in digitStore
+  
+  if ( digitStore.IsEmpty() ) return;
+  
   const AliMpVSegmentation* seg[2] = 
   { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
     AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
   };
-  
-  
-  TClonesArray* digits[2] = { fDigitsCath0, fDigitsCath1 };
-  
-  Bool_t ok = fClusterFinder->Prepare(seg,digits);
+    
+  Bool_t ok = fClusterFinder->Prepare(seg,digitStore);
   if ( !ok )
   {
     AliWarning(Form("No hit pad for DE %d ?",detElemId));
   }
   
   AliMUONCluster* cluster;
-  
-  Int_t chamber = detElemId/100 - 1;
-  
+    
   while ( ( cluster = fClusterFinder->NextCluster() ) )
   {
-//    StdoutToAliDebug(1,cout << "From AliMUONClusterReconstructor::ClusterizeOneDEV2 : cluster->Print():" << endl;
-//                     cluster->Print(););
-    
     // Converts cluster objects into ones suitable for output
     //
     AliMUONRawCluster rawCluster;
@@ -135,131 +119,43 @@ AliMUONClusterReconstructor::ClusterizeOneDEV2(Int_t detElemId)
       rawCluster.SetY(cathode,yg);
       rawCluster.SetZ(cathode,zg);      
     }
-    fMUONData->AddRawCluster(chamber,rawCluster);
-  }
-}
-
-//______________________________________________________________________________
-void
-AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId)
-{
-/// Clusterize one detection element, and let fMUONData know about
-/// the results.
-  
-  if ( fDigitsCath0->GetEntriesFast() || fDigitsCath1->GetEntriesFast() )
-  {
-    if ( fClusterFinder )
-    {
-      ClusterizeOneDEV2(detElemId);
-    }
-    else
-    {
-      Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
-      AliMUONClusterInput::Instance()->SetDigits(iChamber, detElemId,
-                                                 fDigitsCath0,fDigitsCath1);
-      AliDebug(3,Form("ClusterizeOneDE iChamber=%d DE=%d",iChamber,detElemId));
-//      StdoutToAliDebug(3,cout << "DigitsCath0=" << endl;
-//                       fDigitsCath0->Print();
-//                       cout << "DigitsCath1=" << endl;
-//                       fDigitsCath1->Print(););
-      fRecModel->FindRawClusters();
-      
-      // copy results into the output container
-      TClonesArray* tmp = fRecModel->GetRawClusters();
-      for (Int_t id = 0; id < tmp->GetEntriesFast(); ++id) 
-      {
-        AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
-        fMUONData->AddRawCluster(iChamber, *pClus);
-      }        
-    }
-    // Reset the arrays
-    fDigitsCath0->Clear("C");
-    fDigitsCath1->Clear("C");
+    fClusterStore->Add(rawCluster);
   }
 }
 
 //____________________________________________________________________
-void AliMUONClusterReconstructor::Digits2Clusters(Int_t chBeg)
+void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore,
+                                                  AliMUONVClusterStore& clusterStore)
 {
-/// Clusterize all the tracking chamber digits.
-///
-/// For each chamber, we loop *once* on that chamber digits, and store them
-/// in 2 temporary arrays (one pair of arrays per detection element, 
-/// one array per cathode). Once a pair of arrays is full (i.e. all the digits
-/// of that detection element have been stored), we clusterize this DE, and
-/// move to the next one.
+  /// Clusterize the digitStore to produce a clusterStore
   
-  if (!fRecModel && !fClusterFinder)
-  {
-    AliWarning("No reco model defined. Nothing to do...");
-    return;
-  }
+  fClusterStore = &clusterStore;
+  fClusterStore->Clear();
   
-  Int_t iChamber(-1);
-  Int_t currentDE(-1);
+  AliMpDEIterator deIt;
   
-  // Loop on chambers 
-  for ( iChamber = chBeg; iChamber < AliMUONConstants::NTrackingCh(); ++iChamber ) 
+  deIt.First();
+  
+  while (!deIt.IsDone())
   {
-    TClonesArray* muonDigits = fMUONData->Digits(iChamber); 
-    
-    Int_t ndig = muonDigits->GetEntriesFast();
-    if (!ndig) continue;
+    AliMUONVDigitStore* deDigits = digitStore.Create();
     
-    muonDigits->Sort(); // the sort *must* be per DE (at least), otherwise
-                        // the following logic with currentDE will fail.
-    
-    currentDE = -1; // initialize the DE counter (that is used to track 
-                    // when we change of DE in the following loop over
-                    // all digits) to an invalid value.
-
-    for ( Int_t k = 0; k < ndig; ++k ) 
+    Int_t currentDE = deIt.CurrentDEId();
+    AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE);
+    if (stationType!=AliMp::kStationTrigger) 
     {
-      AliMUONDigit* digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
-      if ( ! digit->Signal() > 0 ) continue; // skip void digits.
-      
-      if ( digit->DetElemId() != currentDE )
-      {
-        AliDebug(3,Form("Switching DE from %d to %d",currentDE,digit->DetElemId()));
-        // we get to a new DE, so clusterize the previous one before
-        // moving on.
-        ClusterizeOneDE(currentDE);
-        currentDE = digit->DetElemId();
-      }
-      
-      // Add the digit to the array with the right cathode number.
-      if (digit->Cathode() == 0)
-      {
-        new((*fDigitsCath0)[fDigitsCath0->GetLast()+1]) AliMUONDigit(*digit);
-      }
-      else 
+      TIter next(digitStore.CreateIterator(currentDE,currentDE));
+      AliMUONVDigit* digit;
+
+      while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )
       {
-        new((*fDigitsCath1)[fDigitsCath1->GetLast()+1]) AliMUONDigit(*digit);
-      }
-    } // end of loop on chamber digits
+        if ( ! digit->Charge() > 0 ) continue; // skip void digits.
     
-    // As the above logic is based on detecting a change in DE number,
-    // the last DE of each chamber has not been clusterized, so we do 
-    // it here.
-    ClusterizeOneDE(currentDE);
-  } // end of loop over chambers
-}
-
-//_______________________________________________________________________
-void 
-AliMUONClusterReconstructor::SetRecoModel(AliMUONClusterFinderVS* rec)
-{ 
-/// Set reconstruction model
-
-  delete fRecModel; 
-  fRecModel = rec;
-} 
-
-//_______________________________________________________________________
-void AliMUONClusterReconstructor::Trigger2Trigger() 
-{
-/// Copy trigger from TreeD to TreeR
-
-  fMUONData->SetTreeAddress("GLT");
-  fMUONData->GetTriggerD();
+        deDigits->Add(*digit,AliMUONVDigitStore::kIgnore);
+      }      
+      ClusterizeOneDE(currentDE,*deDigits);
+    }
+    delete deDigits;
+    deIt.Next();
+  }
 }
index 5f9670dcd12b4f47c18f156f8eb6c27a6ef53157..4f8c01d65db49c2c105659699737c9d30ae21ccc 100644 (file)
@@ -8,55 +8,45 @@
 
 /// \ingroup rec
 /// \class AliMUONClusterReconstructor
-/// \brief MUON cluster reconstructor in ALICE
+/// \brief Steering class for clusterizing MUON tracking chambers
 
 #include <TObject.h>
 
-class AliMUONClusterFinderVS;
-class AliMUONRecData;
-class TClonesArray;
 class AliMUONVClusterFinder;
 class AliMUONGeometryTransformer;
+class AliMUONVClusterStore;
+class AliMUONVDigitStore;
+class AliMUONRawCluster;
 
 class AliMUONClusterReconstructor : public TObject 
 {
  public:
-  AliMUONClusterReconstructor(AliMUONRecData* data = 0x0,
-                              AliMUONVClusterFinder* finder = 0x0,
+  AliMUONClusterReconstructor(AliMUONVClusterFinder* finder = 0x0,
                               const AliMUONGeometryTransformer* transformer = 0x0
                               ); 
+
   virtual ~AliMUONClusterReconstructor(void); // Destructor
 
  
-  // Cluster Finding & Trigger
-  virtual void   Digits2Clusters(Int_t chBeg = 0);
-  virtual void   Trigger2Trigger() ;
-
-  /// Return cluster recontruction model
-  AliMUONClusterFinderVS* GetRecoModel() {return fRecModel;}
-
-  void SetRecoModel(AliMUONClusterFinderVS* rec);
-
+  // Cluster Finding 
+  virtual void Digits2Clusters(const AliMUONVDigitStore& digitStore, AliMUONVClusterStore& clusterStore);
+  
  protected:
   /// Not implemented
   AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs); // copy constructor
   /// Not implemented
   AliMUONClusterReconstructor& operator=(const AliMUONClusterReconstructor& rhs); // assignment operator
 
-  void ClusterizeOneDE(Int_t detElemId);
-  void ClusterizeOneDEV2(Int_t detElemId);
-  
+  void ClusterizeOneDE(Int_t detElemId, const AliMUONVDigitStore& digitStore);
+
 private:
-  AliMUONVClusterFinder* fClusterFinder; //!< the object doing the real job (not owner)  
-  AliMUONRecData*         fMUONData;           //!< Data container for MUON subsystem 
-  AliMUONClusterFinderVS* fRecModel;           //!< cluster recontruction model
+  AliMUONVClusterFinder* fClusterFinder; //!< the object doing the real clustering job (not owner)  
 
-  TClonesArray* fDigitsCath0; //!< digits for cathode 0 of the current DE
-  TClonesArray* fDigitsCath1; //!< digits for cathode 1 of the current DE
-  
   const AliMUONGeometryTransformer* fTransformer; //!< to go from local to global (not owner)
-    
-  ClassDef(AliMUONClusterReconstructor,0) // MUON cluster reconstructor in ALICE
+  
+  AliMUONVClusterStore* fClusterStore; //!< not owner
+  
+  ClassDef(AliMUONClusterReconstructor,0) // Clustering steering
 };
        
 #endif