]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONResponseTrigger.cxx
Updated list of classes
[u/mrichter/AliRoot.git] / MUON / AliMUONResponseTrigger.cxx
index f48217a47530c27a758e665cf22916372b7fdbcc..c00811074e7692d06944f816fb65502849a83e13 100644 (file)
 
 /* $Id$ */
 
-// -------------------------------
+
+//-----------------------------------------------------------------------------
 // Class AliMUONResponseTrigger
 // -------------------------------
 // Implementation 
 // of RPC response
+//-----------------------------------------------------------------------------
 
 
 #include "AliMUONResponseTrigger.h"
 #include "AliMUONDigit.h"
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONHit.h"
-#include "AliMUONSegmentation.h"
-#include "AliMUONTriggerSegmentation.h"
 #include "AliMUONConstants.h"
+#include "AliMUONTriggerEfficiencyCells.h"
 
 #include "AliMpPad.h"
+#include "AliMpCathodType.h"
 #include "AliMpPlaneType.h"
 #include "AliMpSegmentation.h"
 #include "AliMpVSegmentation.h"
@@ -63,17 +65,12 @@ namespace
     const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
     transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
   }
-
-  AliMUONSegmentation* Segmentation()
-  {
-    static AliMUONSegmentation* segmentation = muon()->GetSegmentation();
-    return segmentation;
-  }
 }
 
 //------------------------------------------------------------------   
 AliMUONResponseTrigger::AliMUONResponseTrigger()
-  : AliMUONResponse()
+  : AliMUONResponse(),
+    fTriggerEfficiency(0x0)
 {
 /// Default constructor
 }
@@ -107,15 +104,18 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
   {
     twentyNano=1;
   }
-  
-  for ( Int_t cath = 0; cath < 2; ++cath )
+
+  Bool_t isTrig[2]={kTRUE,kTRUE};
+
+  for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
   {
     const AliMpVSegmentation* seg 
-      = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cath);
+      = 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));
@@ -128,46 +128,43 @@ 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!");
+    AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocalBoardId(0),
+                                       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);
+
+    if(fTriggerEfficiency){
+      if(cath==0){
+       Int_t nboard = pad.GetLocalBoardId(0);
+       fTriggerEfficiency->IsTriggered(detElemId, nboard, 
+                                       isTrig[0], isTrig[1]);
+      }
+      if(!isTrig[cath]) continue;
     }
-    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()));
-//   
 }
 
 
+//_____________________________________________________________________________
+void
+AliMUONResponseTrigger::InitTriggerEfficiency(AliMUONTriggerEfficiencyCells *triggerEfficiency)
+{
+/// Initialize trigger chamber efficiency (on demand)
 
-
-
+  fTriggerEfficiency = triggerEfficiency;
+  if ( fTriggerEfficiency )
+  {
+    AliDebug(1, "Will apply trigger efficiency");
+  }
+  else
+  {
+    AliFatal("I was requested to apply trigger efficiency, but I could "
+            "not get it !");
+  }
+}