]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSimpleClusterServer.cxx
The cut on V0 pointing angle is now momentum dependent below 1.5 GeV/c. Above this...
[u/mrichter/AliRoot.git] / MUON / AliMUONSimpleClusterServer.cxx
index ea3aac336f7352b5186fb117a101f02b14b6dcb3..b0f37fe13d6e323b11e913e8730f2612ce8cadb1 100644 (file)
 #include "AliMpDEIterator.h"
 #include "AliMpDEManager.h"
 #include "AliMpExMap.h"
+#include "AliMpExMapIterator.h"
 #include "AliMpPad.h"
 #include "AliMpSegmentation.h"
 #include "AliMpVSegmentation.h"
 #include <Riostream.h>
-#include <TClonesArray.h>
+#include <TObjArray.h>
 #include <TString.h>
 #include <float.h>
 
@@ -57,10 +58,10 @@ namespace
   TString AsString(const AliMpArea& area)
   {
     return Form("(X,Y)=(%7.3f,%7.3f) (DX,DY)=(%7.3f,%7.3f)",
-                area.Position().X(),
-                area.Position().Y(),
-                area.Dimensions().Y(),
-                area.Dimensions().Y());
+                area.GetPositionX(),
+                area.GetPositionY(),
+                area.GetDimensionX(),  /// TBCL was Y !!!
+                area.GetDimensionY());
   }
 }
 
@@ -81,6 +82,8 @@ AliMUONSimpleClusterServer::AliMUONSimpleClusterServer(AliMUONVClusterFinder* cl
     fPads[0] = new AliMpExMap;
     fPads[1] = new AliMpExMap;
     
+    fPadsIterator[0] = fPads[0]->CreateIterator();
+    fPadsIterator[1] = fPads[1]->CreateIterator();
 }
 
 //_____________________________________________________________________________
@@ -90,6 +93,8 @@ AliMUONSimpleClusterServer::~AliMUONSimpleClusterServer()
   delete fClusterFinder;
   delete fPads[0];
   delete fPads[1];
+  delete fPadsIterator[0];
+  delete fPadsIterator[1];
   delete fBypass;
 }
 
@@ -106,7 +111,7 @@ AliMUONSimpleClusterServer::Clusterize(Int_t chamberId,
   /// We first find out the list of DE that have a non-zero overlap with area,
   /// and then use the clusterfinder to find clusters in those areas (and DE).
   
-  AliCodeTimerAuto(Form("Chamber %d",chamberId));
+  AliCodeTimerAuto(Form("Chamber %d",chamberId),0);
   
   if ( fTriggerTrackStore && chamberId >= 6 ) 
   {
@@ -132,10 +137,10 @@ AliMUONSimpleClusterServer::Clusterize(Int_t chamberId,
   {
     Int_t detElemId = it.CurrentDEId();
     
-    TClonesArray* pads[2] = 
+    TObjArray* pads[2] = 
     { 
-      static_cast<TClonesArray*>(fPads[0]->GetValue(detElemId)),
-      static_cast<TClonesArray*>(fPads[1]->GetValue(detElemId)) 
+      static_cast<TObjArray*>(fPads[0]->GetValue(detElemId)),
+      static_cast<TObjArray*>(fPads[1]->GetValue(detElemId)) 
     };
     
     if ( ( pads[0] && pads[0]->GetLast()>=0 ) || 
@@ -155,6 +160,10 @@ AliMUONSimpleClusterServer::Clusterize(Int_t chamberId,
         { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
           AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
         };
+        
+        fClusterFinder->SetChargeHints(recoParam->LowestPadCharge(),
+                                       recoParam->LowestClusterCharge());
+        
         if ( fClusterFinder->NeedSegmentation() )
         {
           fClusterFinder->Prepare(detElemId,pads,deArea,seg);
@@ -204,9 +213,12 @@ AliMUONSimpleClusterServer::Clusterize(Int_t chamberId,
           rawCluster->SetXYZ(xg, yg, zg);
           rawCluster->SetErrXY(recoParam->GetDefaultNonBendingReso(chamberId),recoParam->GetDefaultBendingReso(chamberId));
           
-         // Set MC label
-         if (fDigitStore) rawCluster->SetMCLabel(FindMCLabel(*cluster, detElemId, seg));
-         
+          // Set MC label
+          if (fDigitStore && fDigitStore->HasMCInformation()) 
+          {
+            rawCluster->SetMCLabel(FindMCLabel(*cluster, detElemId, seg));
+          }
+          
           AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e) label %d",
                           detElemId,rawCluster->GetNDigits(),rawCluster->GetCharge(),
                           cluster->Position().X(),cluster->Position().Y(),0.0,
@@ -218,7 +230,7 @@ AliMUONSimpleClusterServer::Clusterize(Int_t chamberId,
   }
   
   AliDebug(1,Form("chamberId = %2d NofClusters after = %d",chamberId,fNCluster));
-
+  
   return nofAddedClusters;
 }
 
@@ -232,13 +244,18 @@ AliMUONSimpleClusterServer::Global2Local(Int_t detElemId, const AliMpArea& globa
   
   Double_t xl,yl,zl;
   
-  Double_t zg = AliMUONConstants::DefaultChamberZ(AliMpDEManager::GetChamberId(detElemId));
+  Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
+  if ( chamberId < 0 ) {
+    AliErrorStream() << "Cannot get chamberId from detElemId=" << detElemId << endl;
+    return;
+  }  
+  Double_t zg = AliMUONConstants::DefaultChamberZ(chamberId);
   
   fkTransformer.Global2Local(detElemId,
-                             globalArea.Position().X(),globalArea.Position().Y(),zg,
+                             globalArea.GetPositionX(),globalArea.GetPositionY(),zg,
                              xl,yl,zl);
   
-  localArea = AliMpArea(TVector2(xl,yl), globalArea.Dimensions());
+  localArea = AliMpArea(xl,yl, globalArea.GetDimensionX(), globalArea.GetDimensionY());
 }
 
 //_____________________________________________________________________________
@@ -282,12 +299,12 @@ AliMUONSimpleClusterServer::Overlap(Int_t detElemId,
 }
 
 //_____________________________________________________________________________
-TClonesArray* 
+TObjArray* 
 AliMUONSimpleClusterServer::PadArray(Int_t detElemId, Int_t cathode) const
 {
   /// Return array for given cathode of given DE
   
-  return static_cast<TClonesArray*>(fPads[cathode]->GetValue(detElemId));
+  return static_cast<TObjArray*>(fPads[cathode]->GetValue(detElemId));
 }
 
 //_____________________________________________________________________________
@@ -309,35 +326,44 @@ AliMUONSimpleClusterServer::UseDigits(TIter& next, AliMUONVDigitStore* digitStor
   
   fDigitStore = digitStore;
   
-  fPads[0]->Clear();
-  fPads[1]->Clear();
-  
+  // Clear pads arrays in the maps
+  for ( Int_t i=0; i<2; i++ ) {
+    fPadsIterator[i]->Reset();
+    Int_t key; TObject* obj;
+    while ( ( obj = fPadsIterator[i]->Next(key) ) ) {
+      //cout << "clearing array for detElemId " << key <<  "  ";
+      obj->Clear();
+    }  
+  }   
+
   AliMUONVDigit* d;
   while ( ( d = static_cast<AliMUONVDigit*>(next()) ) )
   {
     if ( ! d->Charge() > 0 ) continue; // skip void digits.
+    if ( ! d->IsTracker() ) continue; // skip trigger digits
     Int_t ix = d->PadX();
     Int_t iy = d->PadY();
     Int_t cathode = d->Cathode();
     Int_t detElemId = d->DetElemId();
     const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->
       GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode));
-    AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy));
+    AliMpPad pad = seg->PadByIndices(ix,iy);
     
-    TClonesArray* padArray = PadArray(detElemId,cathode);
+    TObjArray* padArray = PadArray(detElemId,cathode);
     if (!padArray)
     {
-      padArray = new TClonesArray("AliMUONPad",100);
+      padArray = new TObjArray(100);
+      padArray->SetOwner(kTRUE);
       fPads[cathode]->Add(detElemId,padArray);
     }
     
-    AliMUONPad mpad(detElemId,cathode,
-                    ix,iy,pad.Position().X(),pad.Position().Y(),
-                    pad.Dimensions().X(),pad.Dimensions().Y(),
+    AliMUONPad* mpad = new AliMUONPad(detElemId,cathode,
+                    ix,iy,pad.GetPositionX(),pad.GetPositionY(),
+                    pad.GetDimensionX(),pad.GetDimensionY(),
                     d->Charge());
-    if ( d->IsSaturated() ) mpad.SetSaturated(kTRUE);
-    mpad.SetUniqueID(d->GetUniqueID());
-    new ((*padArray)[padArray->GetLast()+1]) AliMUONPad(mpad);      
+    if ( d->IsSaturated() ) mpad->SetSaturated(kTRUE);
+    mpad->SetUniqueID(d->GetUniqueID());
+    padArray->Add(mpad);      
   }
 }
 
@@ -352,9 +378,10 @@ AliMUONSimpleClusterServer::FindMCLabel(const AliMUONCluster& cluster, Int_t det
   Int_t nTracks[2] = {0, 0};
   AliMUONVDigit* digit[2] = {0x0, 0x0};
   for (Int_t iCath = 0; iCath < 2; iCath++) {
-    AliMpPad pad = seg[AliMp::GetCathodType(iCath)]->PadByPosition(cluster.Position(), kFALSE);
+    AliMpPad pad 
+      = seg[AliMp::GetCathodType(iCath)]->PadByPosition(cluster.Position().X(), cluster.Position().Y(),kFALSE);
     if (pad.IsValid()) {
-      digit[iCath] = fDigitStore->FindObject(detElemId, pad.GetLocation().GetFirst(), pad.GetLocation().GetSecond(), iCath);
+      digit[iCath] = fDigitStore->FindObject(detElemId, pad.GetManuId(), pad.GetManuChannel(), iCath);
       if (digit[iCath]) nTracks[iCath] = digit[iCath]->Ntracks();
     }
   }
@@ -435,7 +462,7 @@ AliMUONSimpleClusterServer::Print(Option_t*) const
       {
         cout << Form("  -- Cathode %1d",cathode) << endl;
         
-        TClonesArray* padArray = PadArray(detElemId,cathode);
+        TObjArray* padArray = PadArray(detElemId,cathode);
         
         if (!padArray)
         {