]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCMonitorMappingHandler.cxx
Updated flags for low flux case (A. Dainese)
[u/mrichter/AliRoot.git] / TPC / AliTPCMonitorMappingHandler.cxx
index c8de9064a0025b8afc92e0848173c392fe52a9de..eeaa993a2e506a8d6609eb589aed161162a83dd1 100755 (executable)
 
 /*
   $Log$
+  Revision 1.2  2007/10/12 13:36:27  cvetan
+  Coding convention fixes from Stefan
+
+  Revision 1.1  2007/09/17 10:23:31  cvetan
+  New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder.
+
 */ 
 
+////////////////////////////////////////////////////////////////////////
+////
+//// AliTPCMonitorMappingHandler class
+////
+//// Class for handling mapping information TPC  
+////  
+//// The mapping information for the TPC front end electornics (pads, front end cards) 
+//// are handled by this class.
+//// The information from the design mapping and from the hardware address can be 
+//// cross checked in the TPCMonitor.C. 
+//// Malfunctioning front end cards can be identified by looking at single channels 
+//// displayed with  the TPCMonitor.  
+////   
+//// 
+//// Authors: Roland Bramm, 
+////          Stefan Kniege, IKF, Frankfurt
+////       
+/////////////////////////////////////////////////////////////////////////
+
+
+#include <cstdlib>
 #include "AliTPCMonitorMappingHandler.h"
+#include "TH1.h"
+#include "TLegend.h"
+#include "AliLog.h"
+#include <Riostream.h>
+
 ClassImp(AliTPCMonitorMappingHandler)
 
 //_____________________________________________________________________________________________
-AliTPCMonitorMappingHandler::AliTPCMonitorMappingHandler(Char_t* name, Char_t* title): TNamed(name,title)
+AliTPCMonitorMappingHandler::AliTPCMonitorMappingHandler(Char_t* name, Char_t* title): 
+  TNamed(name,title),
+  fnumofChannels(0),
+  fmaxHWAdress(0),
+  fsizeofArray(0),
+  fmapping(new Short_t*[24000]),
+  fmappingChannelinRow(new Int_t*[160]),
+  fu2ftestmapping(new Short_t*[7000]),
+  fMapHwFECglobal(new Int_t*[24000]),
+  fecGainMap(new Float_t*[7000])
 {
   // Constructor : Initialize mapping arrays
  
-  fmapping = new Short_t*[24000];
-
-
-  fmappingChannelinRow = new Int_t*[160];
   for(Int_t in = 0; in<160; in++)
     {
       Int_t* hold = new Int_t[150]; 
@@ -36,16 +73,13 @@ AliTPCMonitorMappingHandler::AliTPCMonitorMappingHandler(Char_t* name, Char_t* t
       fmappingChannelinRow[in]= hold;
     }
   
-
-  fu2ftestmapping      = new Short_t*[7000];
   for(Int_t i = 0; i<7000; i++)
     {
       Short_t* hold = new Short_t[8]; 
       for(Int_t j = 0; j<8;j++)  hold[j]=0;
       fu2ftestmapping[i]= hold;
     }
-
-  fMapHwFECglobal = new Int_t*[24000];
+  
   for(Int_t i = 0; i<24000; i++)
     {
       Int_t* hold = new Int_t[2]; 
@@ -53,7 +87,7 @@ AliTPCMonitorMappingHandler::AliTPCMonitorMappingHandler(Char_t* name, Char_t* t
       fMapHwFECglobal[i]= hold;
     }
   
-  fecGainMap = new Float_t*[7000];
+  
   for(Int_t i = 0; i<7000; i++)
     {
       Float_t* hold = new Float_t[128]; 
@@ -62,6 +96,103 @@ AliTPCMonitorMappingHandler::AliTPCMonitorMappingHandler(Char_t* name, Char_t* t
     }
 }
 
+//____________________________________________________________________________
+AliTPCMonitorMappingHandler::AliTPCMonitorMappingHandler(const  AliTPCMonitorMappingHandler &maphand) :
+  TNamed(maphand.GetName(),maphand.GetTitle()),
+  fnumofChannels(maphand.fnumofChannels),
+  fmaxHWAdress(maphand.fmaxHWAdress),
+  fsizeofArray(maphand.fsizeofArray),
+  fmapping(new Short_t*[24000]),
+  fmappingChannelinRow(new Int_t*[160]),
+  fu2ftestmapping(new Short_t*[7000]),
+  fMapHwFECglobal(new Int_t*[24000]),
+  fecGainMap(new Float_t*[7000])
+{
+  // copy constructor
+  for(Int_t in = 0; in<160; in++)
+    {
+      Int_t* hold = new Int_t[150]; 
+      for(Int_t jn = 0; jn<150;jn++)  hold[jn]=maphand.fmappingChannelinRow[in][jn];
+      fmappingChannelinRow[in]= hold;
+    }
+  
+  for(Int_t i = 0; i<7000; i++)
+    {
+      Short_t* hold = new Short_t[8]; 
+      for(Int_t j = 0; j<8;j++)  hold[j]=maphand.fu2ftestmapping[i][j];
+      fu2ftestmapping[i]= hold;
+    }
+
+  for(Int_t i = 0; i<24000; i++)
+    {
+      Int_t* hold = new Int_t[2]; 
+      for(Int_t j = 0; j<2;j++)  hold[j]=maphand.fMapHwFECglobal[i][j];
+      fMapHwFECglobal[i]= hold;
+    }
+  
+  for(Int_t i = 0; i<7000; i++)
+    {
+      Float_t* hold = new Float_t[128]; 
+      for(Int_t j = 0; j<128;j++)  hold[j]=maphand.fecGainMap[i][j];
+      fecGainMap[i]= hold;
+    }
+
+}
+
+
+//____________________________________________________________________________
+AliTPCMonitorMappingHandler &AliTPCMonitorMappingHandler:: operator= (const AliTPCMonitorMappingHandler& maphand)
+{
+  // assignment operator
+  if(this!=&maphand)
+    {
+      fnumofChannels=maphand.fnumofChannels;
+      fmaxHWAdress=maphand.fmaxHWAdress;
+      fsizeofArray=maphand.fsizeofArray;
+
+      fmapping = new Short_t*[24000]; // empty
+  
+      
+      fmappingChannelinRow = new Int_t*[160];
+      for(Int_t in = 0; in<160; in++)
+       {
+         Int_t* hold = new Int_t[150]; 
+         for(Int_t jn = 0; jn<150;jn++)  hold[jn]=maphand.fmappingChannelinRow[in][jn];
+         fmappingChannelinRow[in]= hold;
+       }
+      
+      fu2ftestmapping      = new Short_t*[7000];
+      for(Int_t i = 0; i<7000; i++)
+       {
+         Short_t* hold = new Short_t[8]; 
+         for(Int_t j = 0; j<8;j++)  hold[j]=maphand.fu2ftestmapping[i][j];
+         fu2ftestmapping[i]= hold;
+       }
+      
+      fMapHwFECglobal = new Int_t*[24000];
+      for(Int_t i = 0; i<24000; i++)
+       {
+         Int_t* hold = new Int_t[2]; 
+         for(Int_t j = 0; j<2;j++)  hold[j]=maphand.fMapHwFECglobal[i][j];
+         fMapHwFECglobal[i]= hold;
+       }
+      
+      fecGainMap = new Float_t*[7000];
+      for(Int_t i = 0; i<7000; i++)
+       {
+         Float_t* hold = new Float_t[128]; 
+         for(Int_t j = 0; j<128;j++)  hold[j]=maphand.fecGainMap[i][j];
+         fecGainMap[i]= hold;
+       }
+      
+      
+    }
+  return *this;
+}
+
+
 //_____________________________________________________________________________________________
 AliTPCMonitorMappingHandler::~AliTPCMonitorMappingHandler() 
 {
@@ -135,7 +266,7 @@ void AliTPCMonitorMappingHandler::ReadMapping(char* mapfile)
   // can hence be found in fmapping[hwaddr]
 
 
+  Short_t*  mappingRow; 
   char readcarry[255];
   Int_t version = -1;
   Int_t actPos  = 0;
@@ -158,13 +289,13 @@ void AliTPCMonitorMappingHandler::ReadMapping(char* mapfile)
   }
   fmappingEmptyRow[1] = -1;
   for(Int_t i = 0; i < fnumofChannels ; i++) {
-    fmappingRow = new Short_t[11];
+    mappingRow = new Short_t[11];
     for(Int_t j = 0 ; j < 11 ; j++) {
       *in >> readcarry;
-      fmappingRow[j] = atoi(readcarry);
+      mappingRow[j] = atoi(readcarry);
     }
-    actPos = fmappingRow[0];
-    fmapping[actPos] = fmappingRow;
+    actPos = mappingRow[0];
+    fmapping[actPos] = mappingRow;
     if( (actPos - oldPos) > 1) {
       for(Int_t j = (oldPos+1); j < actPos; j++) {
        fmapping[j] = fmappingEmptyRow;
@@ -223,7 +354,7 @@ void AliTPCMonitorMappingHandler::ReadfecHwMap(Int_t sector)
   Int_t  fsector        = 0;
   Int_t  fec            = 0;
   Int_t  branch         = 0;
-  Int_t  rcu_patch      = 0;
+  Int_t  rcupatch      = 0;
   Int_t  altrchann      = 0;
   Int_t  altrchip       = 0;
   Int_t  nextHwAddress  = 0;
@@ -242,14 +373,14 @@ void AliTPCMonitorMappingHandler::ReadfecHwMap(Int_t sector)
          nfecs++;
          fec            = U2fGetFECinBranch(ind);
          branch         = U2fGetBranch(ind);
-         rcu_patch      = U2fGetRCU(ind);
+         rcupatch      = U2fGetRCU(ind);
                  
          for(Int_t ch = 0; ch<128; ch++)
            {
              altrchann      = ch%16;
              altrchip       = ch/16;
              
-             nextHwAddress  = (   ((branch&1)<<11) + (fec<<7) + (altrchip<<4) + (altrchann)  + ((rcu_patch-1)<<12) ); 
+             nextHwAddress  = (   ((branch&1)<<11) + (fec<<7) + (altrchip<<4) + (altrchann)  + ((rcupatch-1)<<12) ); 
              
              fMapHwFECglobal[nextHwAddress][0] = ind;
              fMapHwFECglobal[nextHwAddress][1] = ch ;
@@ -311,14 +442,14 @@ void  AliTPCMonitorMappingHandler::ReadRowMappingGlob(char* fpathtoMappingRowfil
 
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetNumOfChannels()
+Int_t AliTPCMonitorMappingHandler::GetNumOfChannels() const
 {
   // Return number of channels
   return fnumofChannels;
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetSizeofArray()
+Int_t AliTPCMonitorMappingHandler::GetSizeofArray() const
 {
   // Return sise of global mapping fmapping array.
   // Value orresponds to max value of hardware addresses
@@ -327,7 +458,7 @@ Int_t AliTPCMonitorMappingHandler::GetSizeofArray()
 
 
 //_____________________________________________________________________________________________
-Short_t* AliTPCMonitorMappingHandler::GetLine(Int_t hwaddr)
+Short_t* AliTPCMonitorMappingHandler::GetLine(Int_t hwaddr)const
 {
   // Return pointer to mapping array for the hardware address hwaddr 
   Short_t* retval;
@@ -339,7 +470,7 @@ Short_t* AliTPCMonitorMappingHandler::GetLine(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetIndex(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetIndex(Int_t hwaddr) const
 {
   // Return readout index for the hardware address hwaddr
   Int_t retval;
@@ -351,7 +482,7 @@ Int_t AliTPCMonitorMappingHandler::GetIndex(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetPadRow(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetPadRow(Int_t hwaddr) const
 {
   // Return global pad row  for the hardware address hwaddr 
   Int_t retval;
@@ -363,7 +494,7 @@ Int_t AliTPCMonitorMappingHandler::GetPadRow(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetPad(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetPad(Int_t hwaddr) const
 {
   // Return pad number in row for the hardware address hwaddr 
   Int_t retval;
@@ -375,7 +506,7 @@ Int_t AliTPCMonitorMappingHandler::GetPad(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetConnector(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetConnector(Int_t hwaddr) const
 {
   // Return connector for the hardware address hwaddr 
   Int_t retval;
@@ -387,7 +518,7 @@ Int_t AliTPCMonitorMappingHandler::GetConnector(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetPin(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetPin(Int_t hwaddr) const
 {
   // Return pin for the hardware address hwaddr 
   Int_t retval;
@@ -399,7 +530,7 @@ Int_t AliTPCMonitorMappingHandler::GetPin(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetFEC(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetFEC(Int_t hwaddr) const
 {
   // Return fec number in IROC/OROC  for the hardware address hwaddr 
   Int_t retval;
@@ -411,7 +542,7 @@ Int_t AliTPCMonitorMappingHandler::GetFEC(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetFECchannel(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetFECchannel(Int_t hwaddr) const
 {
   // Return FEC channel for the hardware address hwaddr 
   Int_t retval;
@@ -423,7 +554,7 @@ Int_t AliTPCMonitorMappingHandler::GetFECchannel(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetFECconnector(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetFECconnector(Int_t hwaddr) const
 {
   // Return FEC connector for the hardware address hwaddr 
   Int_t retval;
@@ -435,7 +566,7 @@ Int_t AliTPCMonitorMappingHandler::GetFECconnector(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetAltroChannel(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetAltroChannel(Int_t hwaddr)  const
 {
   // Return Altro channel for the hardware address hwaddr 
   Int_t retval;
@@ -447,7 +578,7 @@ Int_t AliTPCMonitorMappingHandler::GetAltroChannel(Int_t hwaddr)
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetAltro(Int_t hwaddr) 
+Int_t AliTPCMonitorMappingHandler::GetAltro(Int_t hwaddr)  const
 {
   // Return Altro chip number in FEC for the hardware address hwaddr 
   Int_t retval;
@@ -460,7 +591,7 @@ Int_t AliTPCMonitorMappingHandler::GetAltro(Int_t hwaddr)
 
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::GetNumofPads(Int_t row)
+Int_t AliTPCMonitorMappingHandler::GetNumofPads(Int_t row) 
 {
   // Return number of pads in row
   if(row<159)
@@ -486,49 +617,49 @@ Int_t AliTPCMonitorMappingHandler::GetPadAddInRow(Int_t row,Int_t pad )
 
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetFECnr(Int_t index)
+Int_t AliTPCMonitorMappingHandler::U2fGetFECnr(Int_t index) const
 {
   // Return FEC number for index  (FEC number should be equal to index)
   return  fu2ftestmapping[index][0];
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetSide(Int_t fecnr)
+Int_t AliTPCMonitorMappingHandler::U2fGetSide(Int_t fecnr) const
 {
   // Return side on which FEC is installed
   return  fu2ftestmapping[fecnr][1];
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetSector(Int_t fecnr)
+Int_t AliTPCMonitorMappingHandler::U2fGetSector(Int_t fecnr) const
 {
   // Return sector in which FEC is installed
   return  fu2ftestmapping[fecnr][2];
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetRCU(Int_t fecnr)
+Int_t AliTPCMonitorMappingHandler::U2fGetRCU(Int_t fecnr) const
 {
   // Rerurn rcu patch in which FEC is installed
   return  fu2ftestmapping[fecnr][3];
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetFECinRCU(Int_t fecnr)
+Int_t AliTPCMonitorMappingHandler::U2fGetFECinRCU(Int_t fecnr) const
 {
   // Return index of FEC in RCU (0-25)
   return  fu2ftestmapping[fecnr][4];
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetFECinBranch(Int_t fecnr)
+Int_t AliTPCMonitorMappingHandler::U2fGetFECinBranch(Int_t fecnr) const
 {
   // Return index of FEC in branch (0-12)
   return  fu2ftestmapping[fecnr][5];
 }
 
 //_____________________________________________________________________________________________
-Int_t AliTPCMonitorMappingHandler::U2fGetBranch(Int_t fecnr)
+Int_t AliTPCMonitorMappingHandler::U2fGetBranch(Int_t fecnr) const
 {
   // Return branch in which FEC is installed (0,1)
   return  fu2ftestmapping[fecnr][6];