]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONResponseTrigger.cxx
Remove the dollar-id-dollar in the responsible name which interfere with CDB_MD metad...
[u/mrichter/AliRoot.git] / MUON / AliMUONResponseTrigger.cxx
index 747ab12223384ebbdbb619d6023ddfede4baeff9..d1a8e1a45133c6551bacc9e318aa0d855f90af2c 100644 (file)
 /* $Id$ */
 
 
-#include "AliMUONResponseTrigger.h"
+//-----------------------------------------------------------------------------
+// Class AliMUONResponseTrigger
+// -------------------------------
+// Implementation 
+// of RPC response
+//-----------------------------------------------------------------------------
 
-#include "AliLog.h"
+
+#include "AliMUONResponseTrigger.h"
 #include "AliMUON.h"
 #include "AliMUONDigit.h"
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONHit.h"
-#include "AliMUONSegmentation.h"
+#include "AliMUONConstants.h"
+
 #include "AliMpPad.h"
+#include "AliMpCathodType.h"
 #include "AliMpPlaneType.h"
+#include "AliMpSegmentation.h"
 #include "AliMpVSegmentation.h"
+
 #include "AliRun.h"
+#include "AliLog.h"
 #include "TList.h"
-#include "AliMUONTriggerSegmentationV2.h"
 
+/// \cond CLASSIMP
 ClassImp(AliMUONResponseTrigger)
+/// \endcond
 
 namespace
 {
@@ -52,52 +64,33 @@ namespace
     const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
     transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
   }
-
-  AliMUONSegmentation* Segmentation()
-  {
-    static AliMUONSegmentation* segmentation = muon()->GetSegmentation();
-    return segmentation;
-  }
 }
 
-const Float_t 
-AliMUONResponseTrigger::fgkTofLimit = 75E-9;
-
 //------------------------------------------------------------------   
 AliMUONResponseTrigger::AliMUONResponseTrigger()
   : AliMUONResponse()
 {
-// Default constructor
+/// Default constructor
 }
 
 //------------------------------------------------------------------   
-Int_t AliMUONResponseTrigger::DigitResponse(Int_t digit, 
-                                           AliMUONTransientDigit* /*where*/) const
+AliMUONResponseTrigger::~AliMUONResponseTrigger()
 {
-//  only digital (0/1) information available
-
-  if (digit) 
-    return kTRUE; 
-  else 
-    return digit;
-
+/// Destructor
 }
 
-
 //_____________________________________________________________________________
 void 
-AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
+AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t /*timeDif*/)
 {
-  //
-  // Generate 2 digits (one on each cathode) from 1 hit, i.e. no cluster-size
-  // generation (simplest response case).
-  //
+  /// Generate 2 digits (one on each cathode) from 1 hit, i.e. no cluster-size
+  /// generation (simplest response case).
   
   digits.Clear();
   
   Float_t xhit = hit.X();
   Float_t yhit = hit.Y();
-  Float_t zhit = 0; // FIXME : should it be hit.Z() ?
+  Float_t zhit = hit.Z();
   Int_t detElemId = hit.DetElemId();  
   
   Double_t x,y,z;
@@ -105,18 +98,22 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
   
   Float_t tof = hit.Age();
   Int_t twentyNano(100);
-  if (tof<fgkTofLimit)
+  if (tof<AliMUONConstants::TriggerTofLimit())
   {
     twentyNano=1;
   }
   
-  for ( Int_t cath = 0; cath < 2; ++cath )
+  Int_t nboard=0;
+
+  for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
   {
-    const AliMpVSegmentation* seg = Segmentation()->GetMpSegmentation(detElemId,cath);
+    const AliMpVSegmentation* seg 
+      = AliMpSegmentation::Instance()
+        ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
     
-    AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE);
-    Int_t ix = pad.GetIndices().GetFirst();
-    Int_t iy = pad.GetIndices().GetSecond();
+    AliMpPad pad = seg->PadByPosition(x,y,kFALSE);
+    Int_t ix = pad.GetIx();
+    Int_t iy = pad.GetIy();
     
     AliDebug(1,Form("xhit,yhit=%e,%e lx,ly,lz=%e,%e,%e ix,iy=%d,%d",
                     xhit,yhit,x,y,z,ix,iy));
@@ -129,46 +126,18 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
                       xhit,yhit,x,y,z,ix,iy));
       continue;
     }
-    AliMUONDigit* d = new AliMUONDigit;
-    d->SetDetElemId(detElemId);
-/* pc 09/02/06 no need for that anymore : trigger is in local numbering
-
-    //FIXME: >> the following code to get the ixGlo and iyGlo is a bad hack 
-    // because trigger has not yet switched to local numbering of its indices !
-    // We should be able to use directly the (local) ix,iy from the pad !
-    const AliMUONTriggerSegmentationV2* old = 
-      dynamic_cast<const AliMUONTriggerSegmentationV2*>
-        (Segmentation()->GetDESegmentation(detElemId,cath));
-    if ( !old )
-    {
-      AliFatal("Got a wrong TriggerSegmentation object! Check that!");
-    }
-    Int_t ixGlo;
-    Int_t iyGlo;
-    old->ILoc2IGlo(ix,iy,ixGlo,iyGlo);
-    if ( xhit < 0 ) ixGlo = -ixGlo;
-    // << end of bad hack.
-    d->SetPadX(ixGlo);
-    d->SetPadY(iyGlo);
-*/
-    d->SetPadX(ix);
-    d->SetPadY(iy);
-
-    d->SetSignal(twentyNano);
-    d->AddPhysicsSignal(d->Signal());
-    d->SetCathode(cath);
-    digits.Add(d);   
- //   AliDebug(1,Form("Adding digit DE %d Cathode %d (%d,%d) signal %d",
-//                    detElemId,cath,ixGlo,iyGlo,twentyNano));
-  }
-  
-//  StdoutToAliDebug(1,digits.Print();); 
-//  AliDebug(1,Form("Number of digits for detelem %d track %d : %d",
-//                  hit.DetElemId(),hit.Track(),digits.GetSize()));
-//   
-}
-
-
+    
+    if ( cath == AliMp::kCath0 ) nboard = pad.GetLocalBoardId(0);
+        
+    AliMUONDigit* d = new AliMUONDigit(detElemId,nboard,
+                                       pad.GetLocalBoardChannel(0),cath);
+    d->SetPadXY(ix,iy);
 
+    //FIXME : a trigger digit can have several locations. 
+    //this is not currently supported by the digit class. Change that or not ?
+    d->SetCharge(twentyNano);
 
 
+    digits.Add(d);   
+  }
+}