]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONChamberTrigger.cxx
Inserting TMath.h where required by the new version of ROOT
[u/mrichter/AliRoot.git] / MUON / AliMUONChamberTrigger.cxx
index 289ea24508cc25fcb1f4f22a9ef94a716f262d26..b3e3692b12aa5408c277846ed81eea0bc3e8ef32 100644 (file)
 
 /* $Id$ */
 
+#include <TMath.h>
+
 #include "AliMUONChamberTrigger.h"
 #include "AliMUONResponseTrigger.h"
-
+#include "AliMUONHit.h"
+#include "AliMUON.h"
+#include "AliMUONSegmentation.h"
+#include "AliMUONGeometrySegmentation.h"
+#include "AliMUONGeometryTransformer.h"
+#include "AliLog.h"
+
+///
+/// \class AliMUONChamberTrigger
+///
+/// Implementation of AliMUONChamber for the trigger
+///
+/// This class is to be deprecated.
+///
+
+/// \cond CLASSIMP
 ClassImp(AliMUONChamberTrigger)
+/// \endcond
 
 //-------------------------------------------
 
 AliMUONChamberTrigger::AliMUONChamberTrigger()
-  : AliMUONChamber()
+  : AliMUONChamber(),
+    fkGeomTransformer(0)
+{
+/// Default constructor
+}
+
+//-------------------------------------------
+
+AliMUONChamberTrigger:: ~AliMUONChamberTrigger()
 {
-// Default constructor
+/// Destructor
 }
 
+//-------------------------------------------
 
-AliMUONChamberTrigger::AliMUONChamberTrigger(Int_t id) 
-  : AliMUONChamber(id)
+AliMUONChamberTrigger::AliMUONChamberTrigger(Int_t id,
+                              const AliMUONGeometryTransformer* kGeometryTransformer) 
+  : AliMUONChamber(id),
+    fkGeomTransformer(kGeometryTransformer)
 {
-// Constructor using chamber id
+/// Constructor using chamber id
 }
 
 //-------------------------------------------
-void AliMUONChamberTrigger::DisIntegration(Float_t /*eloss*/, Float_t tof, 
-                                          Float_t xhit, Float_t yhit, Float_t zhit, 
+void AliMUONChamberTrigger::DisIntegration(AliMUONHit* hit,
                                           Int_t& nnew,
                                           Float_t newclust[6][500]) 
 {
-//    
-//  Generates pad hits (simulated cluster) 
-//  using the segmentation and the response model
+///  Generates pad hits (simulated cluster) 
+///  using the segmentation and the response model
+
+
+  Float_t   tof = hit->Age();
+  Float_t  xhit = hit->X();
+  Float_t  yhit = hit->Y();
+  Float_t  zhit = hit->Z();
+  Int_t      id = hit->DetElemId();
 
   Int_t twentyNano;
   if (tof<75*TMath::Power(10,-9)) {
@@ -54,21 +88,32 @@ void AliMUONChamberTrigger::DisIntegration(Float_t /*eloss*/, Float_t tof,
 
   Float_t qp;
   nnew=0;
-  for (Int_t i=1; i<=fnsec; i++) {
-    AliSegmentation * segmentation=
-      (AliSegmentation*) (*fSegmentation)[i-1];
+  for (Int_t i = 1; i <= 2; i++) {
+
+    AliMUONGeometrySegmentation* segmentation=
+      fMUON->GetSegmentation()->GetModuleSegmentationByDEId(id, i-1); 
+
     
 // Find the module & strip Id. which has fired
-    Int_t ix,iy;
-    
-    segmentation->GetPadI(xhit,yhit,0,ix,iy);
-    segmentation->SetPad(ix,iy);
-
+    Int_t ix(-1);
+    Int_t iy(-1);
+    segmentation->GetPadI(id,xhit,yhit,0,ix,iy);
 // treatment of GEANT hits w/o corresponding strip (due to the fact that
-// the 2 geometries are computed in a very slightly different way) 
-    if (ix==0&&iy==0) {
-      printf("AliMUONChamberTrigger hit w/o strip %f %f \n",xhit,yhit);
-    } else {          
+// geometry & segmentation are computed in a very slightly different way) 
+    if ( ix<0 || iy<0 ) 
+    {
+      Float_t lx,ly,lz;
+      fkGeomTransformer->Global2Local(id,xhit,yhit,0,lx,ly,lz);
+      AliWarning(Form("AliMUONChamberTrigger hit w/o strip %i-%d %e %e "
+                      "local %e %e %e ix,iy=%d,%d\n",id,i-1,xhit,yhit,lx,ly,lz,ix,iy));
+    } else 
+    {          
+      segmentation->SetPad(id,ix,iy);
+      if (xhit<0) ix = -ix;
+      //    printf(" fId id fnsec xhit yhit zhit ix iy %i %i %i %f %f %f %i %i \n",fId,i,id,xhit,yhit,zhit,ix,iy);
+      //     if (ix < 0 || ix > 10000) return;
+      //     if (iy < 0 || iy > 10000) return;
+      
       // --- store signal information for this strip
       newclust[0][nnew]=1.;                       // total charge
       newclust[1][nnew]=ix;                       // ix-position of pad
@@ -77,43 +122,43 @@ void AliMUONChamberTrigger::DisIntegration(Float_t /*eloss*/, Float_t tof,
       newclust[4][nnew]=segmentation->ISector();  // sector id
       newclust[5][nnew]=(Float_t) i;              // counter
       nnew++;
-
-// cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
+      
+      // cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
       if (((AliMUONResponseTrigger*) fResponse)->SetGenerCluster()) {
-  
-       // set hits
-       segmentation->SetHit(xhit,yhit,zhit);
-       // get the list of nearest neighbours
-       Int_t nList, xList[10], yList[10];
-       segmentation->Neighbours(ix,iy,&nList,xList,yList);
-       
-       qp = 0;
-       for (Int_t j=0; j<nList; j++){       // loop over neighbours      
-         if (xList[j]!=0) {                 // existing neighbour          
-           if (j==0||j==5||qp!=0) {         // built-up cluster-size
-             
-             // neighbour real coordinates (just for checks here)
-             Float_t x,y,z;
-             segmentation->GetPadC(xList[j],yList[j],x,y,z);
-             // set pad (fx fy & fix fiy are the current pad coord. & Id.)
-             segmentation->SetPad(xList[j],yList[j]);    
-             // get the chamber (i.e. current strip) response
-             qp=fResponse->IntXY(segmentation);          
-             
-             if (qp > 0.5) {           
-               // --- store signal information for neighbours 
-               newclust[0][nnew]=qp;                      // total charge
-               newclust[1][nnew]=segmentation->Ix();      // ix-pos. of pad
-               newclust[2][nnew]=segmentation->Iy();      // iy-pos. of pad
-               newclust[3][nnew]=twentyNano;              // time of flight
-               newclust[4][nnew]=segmentation->ISector(); // sector id
-               newclust[5][nnew]=(Float_t) i;             // counter
-               nnew++;
-             } // qp > 0.5 
-           } // built-up cluster-size
-         } // existing neighbour
-       } // loop over neighbours
-      } // endif hit w/o strip
+           
+           // set hits
+           segmentation->SetHit(id,xhit,yhit,zhit);
+           // get the list of nearest neighbours
+           Int_t nList, xList[10], yList[10];
+           segmentation->Neighbours(id,ix,iy,&nList,xList,yList);
+           
+           qp = 0;
+           for (Int_t j=0; j<nList; j++){       // loop over neighbours          
+               if (xList[j]!=0) {                 // existing neighbour            
+                   if (j==0||j==5||qp!=0) {         // built-up cluster-size
+                       
+                       // neighbour real coordinates (just for checks here)
+                       Float_t x,y,z;
+                       segmentation->GetPadC(id,xList[j],yList[j],x,y,z);
+                       // set pad (fx fy & fix fiy are the current pad coord. & Id.)
+                       segmentation->SetPad(id,xList[j],yList[j]);       
+                       // get the chamber (i.e. current strip) response
+                       qp=fResponse->IntXY(id,segmentation);     
+                       
+                       if (qp > 0.5) {         
+                           // --- store signal information for neighbours 
+                           newclust[0][nnew]=qp;                      // total charge
+                           newclust[1][nnew]=segmentation->Ix();      // ix-pos. of pad
+                           newclust[2][nnew]=segmentation->Iy();      // iy-pos. of pad
+                           newclust[3][nnew]=twentyNano;              // time of flight
+                           newclust[4][nnew]=segmentation->ISector(); // sector id
+                           newclust[5][nnew]=(Float_t) i;             // counter
+                           nnew++;
+                       } // qp > 0.5 
+                   } // built-up cluster-size
+               } // existing neighbour
+           } // loop over neighbours
+       } // endif hit w/o strip
     } // loop over planes
   } // if AliMUONResponseTriggerV1
 }
@@ -123,7 +168,3 @@ void AliMUONChamberTrigger::DisIntegration(Float_t /*eloss*/, Float_t tof,
 
 
 
-
-
-
-