]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerCircuit.cxx
Formatting changes.
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerCircuit.cxx
index 1dd652efadcc85d16d1d6932c6c3b9c0aa3099b1..15cd8ef44493c5b20abe339aa088ea4198b7da3f 100644 (file)
 
 /* $Id$ */
 
+// ------------------
+// Class AliMUONTriggerCircuit
+// ------------------
+// description of the global position of the trigger boards strip positions
+// based on the "old" segmentation (to be replaced soon)
+
+
 #include <TMath.h>
 
 #include "AliMUONTriggerCircuit.h"
@@ -22,7 +29,7 @@
 #include "AliMUON.h"
 #include "AliMUONTriggerConstants.h"
 #include "AliMUONGeometrySegmentation.h"
-#include "AliMUONChamber.h"
+#include "AliMUONSegmentation.h"
 #include "AliMUONConstants.h"
 #include "AliLog.h"
 
@@ -34,7 +41,6 @@ AliMUONTriggerCircuit::AliMUONTriggerCircuit()
     fIdCircuit(0),
     fX2m(0),
     fX2ud(0)
-    //    fSegmentationType(1)
 {
 // Constructor
 
@@ -77,15 +83,11 @@ AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& rhs)
 void AliMUONTriggerCircuit::Init(Int_t iCircuit) {
 // initialize circuit characteristics
   fIdCircuit=AliMUONTriggerConstants::CircuitId(iCircuit);
-  AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
 
   LoadX2();
   LoadXCode();
   LoadYCode();
 
-  if (pMUON->WhichSegmentation() == 1) 
-      AliFatal("Old Segmentation no more supported.");
-
   LoadXPos2();
   LoadYPos2();
   
@@ -321,14 +323,13 @@ void AliMUONTriggerCircuit::LoadYPos2(){
   Int_t istrip, idDE;
 
   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
-  AliMUONChamber*  iChamber;
   AliMUONGeometrySegmentation* segmentation;    
   
 // first plane (11)
   chamber=11;
   cathode=1;
-  iChamber = &(pMUON->Chamber(chamber-1));
-  segmentation=iChamber->SegmentationModel2(cathode);
+  segmentation
+    = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
   
   if (!segmentation) {
     AliWarning("Segmentation not defined.");
@@ -351,8 +352,8 @@ void AliMUONTriggerCircuit::LoadYPos2(){
 // second plane (21)
   chamber=13;
   cathode=1;
-  iChamber = &(pMUON->Chamber(chamber-1));
-  segmentation=iChamber->SegmentationModel2(cathode);
+  segmentation
+    = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
   
   for (istrip=0; istrip<32; istrip++) {
     code=fXcode[2][istrip];    // decode current strip
@@ -386,11 +387,10 @@ void AliMUONTriggerCircuit::LoadXPos2(){
   Int_t chamber=11;
   Int_t cathode=2;
   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
-  AliMUONChamber*  iChamber;
   AliMUONGeometrySegmentation*  segmentation; 
-  iChamber = &(pMUON->Chamber(chamber-1));
-  segmentation=iChamber->SegmentationModel2(cathode);
-  
+  segmentation
+    = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
+
   if (!segmentation) {
     AliWarning("Segmentation not defined.");
     return;
@@ -399,14 +399,17 @@ void AliMUONTriggerCircuit::LoadXPos2(){
   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.  
 // number of Y strips
   idDE = DetElemId(chamber, idModule);
+
   Int_t nStrY=AliMUONTriggerConstants::NstripY(ModuleNumber(idModule)); 
   Int_t idSector=segmentation->Sector(idDE, idModule,0); // corresp. sector
   Float_t width=segmentation->Dpx(idDE, idSector);      // corresponding strip width
-  
+
 // first case : up middle and down parts have all 8 or 16 strip 
   if ((nStrY==16)||(nStrY==8&&fX2m==0&&fX2ud==0)) { 
     for (istrip=0; istrip<nStrY; istrip++) {
       segmentation->GetPadC(idDE, idModule,istrip,x,y,z); 
+      AliDebug(1,Form("idDE %d idModule %d istrip %d x,y,z=%e,%e,%e\n",
+                      idDE,idModule,istrip,x,y,z));
       fXpos11[istrip]=x;
     }
 // second case : mixing 8 and 16 strips within same circuit      
@@ -524,13 +527,128 @@ Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t istrip) const {
 //--- end of methods which return member data related info
 //----------------------------------------------------------------------
 
+void dump(const char* what, const Float_t* array, Int_t size)
+{
+  cout << what << " " << endl;
+  for ( Int_t i = 0; i < size; ++i )
+  {
+    cout << array[i] << " , ";
+  }
+  cout << endl;
+}
+
+void dump(const char* what, const Int_t* array, Int_t size)
+{
+  cout << what << " " << endl;
+  for ( Int_t i = 0; i < size; ++i )
+  {
+    cout << array[i] << " , ";
+  }
+  cout << endl;
+}
+
+//_____________________________________________________________________________
+void
+AliMUONTriggerCircuit::Print(Option_t* ) const
+{
+// prints-out data member
+  cout << "IdCircuit " << fIdCircuit << " X2m,X2ud=" << fX2m << ","
+  << fX2ud;
+  for ( Int_t i = 0; i < 2; ++i )
+  {
+    cout << " OrMud[" << i << "]=" << fOrMud[i];
+  }
+  cout << endl;
+  dump("Xpos11",fXpos11,16);
+  dump("Ypos11",fYpos11,31);
+  dump("Ypos21",fYpos21,63);
+  for ( Int_t i = 0; i < 4; ++i )
+  {
+    char s[80];
+    sprintf(s,"Xcode[%d]",i);
+    dump(s,fXcode[i],32);
+    sprintf(s,"Ycode[%d]",i);
+    dump(s,fYcode[i],32);
+  }
+ // Int_t fIdCircuit;            // circuit Id number
+//  Int_t fX2m;                  // internal info needed by TriggerDecision
+//  Int_t fX2ud;                 // internal info needed by TriggerDecision
+//  Int_t fOrMud[2];             // internal info needed by TriggerDecision
+//  Int_t fXcode[4][32];         // code of X strips
+//  Int_t fYcode[4][32];         // code of Y strips 
+//  Float_t fXpos11[16];         // X position of Y strips in MC11
+//  Float_t fYpos11[31];         // Y position of X strips in MC11
+//  Float_t fYpos21[63];         // Y position of X strips in MC21
+  
+}
 
 Int_t AliMUONTriggerCircuit::DetElemId(Int_t ichamber, Int_t idModule)
 {
+// adpated to official numbering (09/20/05)
 // returns the detection element Id for given chamber and module
-// ichamber (from 11 to 14), idModule (from 11 to 97)
-    Int_t itmp = (idModule > 0) ? 0 : 50; // right=0, left=50   
-    return (ichamber*100)+itmp+(9-Int_t(TMath::Abs(idModule)/10));
+// ichamber (from 11 to 14), idModule (from -97 to 97)
+//    
+    Int_t itmp=0;    
+    Int_t linenumber=Int_t(idModule/10);    
+    switch (linenumber) // (from 1 to 9, from top to bottom)
+    {
+    case 1:
+       itmp = 4;
+       break;  
+    case 2:
+       itmp = 3;
+       break;          
+    case 3:
+       itmp = 2;
+       break;
+    case 4:
+       itmp = 1;
+       break;      
+    case 5:
+       itmp = 0;
+       break;          
+    case 6:
+       itmp = 17;
+       break;          
+    case 7:
+       itmp = 16;
+       break;          
+    case 8:
+       itmp = 15;
+       break;          
+    case 9:
+       itmp = 14;
+       break;          
+// left
+    case -1:
+       itmp = 5;
+       break;          
+    case -2:
+       itmp = 6;
+       break;          
+    case -3:
+       itmp = 7;
+       break;          
+    case -4:
+       itmp = 8;
+       break;          
+    case -5:
+       itmp = 9;
+       break;          
+    case -6:
+       itmp = 10;
+       break;          
+    case -7:
+       itmp = 11;
+       break;          
+    case -8:
+       itmp = 12;
+       break;
+    case -9:
+       itmp = 13;
+       break;          
+    }
+    return (ichamber*100)+itmp;    
 }