LCOV - code coverage report
Current view: top level - MUON/MUONevaluation - AliMUONTriggerGUIboard.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 202 0.5 %
Date: 2016-06-14 17:26:59 Functions: 1 17 5.9 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : //-----------------------------------------------------------------------------
      19             : /// \class AliMUONTriggerGUIboard
      20             : ///
      21             : /// Single trigger board object with geometry information, strips and digits
      22             : ///
      23             : /// \author Bogdan Vulpescu, LPC Clermont-Ferrand
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : #include <TClonesArray.h>
      27             : #include <TBox.h>
      28             : #include <TMath.h>
      29             : 
      30             : #include "AliMUONGeometryTransformer.h"
      31             : 
      32             : #include "AliMUONTriggerGUIboard.h"
      33             : 
      34             : /// \cond CLASSIMP
      35          16 : ClassImp(AliMUONTriggerGUIboard)
      36             : /// \endcond
      37             : 
      38             : //__________________________________________________________________________
      39             : AliMUONTriggerGUIboard::AliMUONTriggerGUIboard() 
      40           0 :   : TObject(),
      41           0 :     fName(0),
      42           0 :     fCrateName(0),
      43           0 :     fID(-1),
      44           0 :     fStatus(0),
      45           0 :     fPosition(0),
      46           0 :     fYOver(0),
      47           0 :     fXCenter(),
      48           0 :     fYCenter(),
      49           0 :     fZCenter(),
      50           0 :     fXWidth(),
      51           0 :     fYWidth(),
      52           0 :     fXSix(0),
      53           0 :     fXSiy1(0),
      54           0 :     fXSiy2(0),
      55           0 :     fYSix1(0),
      56           0 :     fYSix2(0),
      57           0 :     fYSiy(0),
      58           0 :     fDetElemId(0),
      59           0 :     fIdCircuit(-1),
      60           0 :     fIsOpen(0),
      61           0 :     fNPadsX(),
      62           0 :     fNPadsY(),
      63           0 :     fPadsX(),
      64           0 :     fPadsY()
      65           0 : {
      66             :   /// board main constructor
      67             : 
      68           0 :   fName = new TString("");
      69           0 :   fCrateName = new TString("");
      70             : 
      71           0 :   for (Int_t i = 0; i < kNMT; i++) {
      72           0 :     fXCenter[i] = 0.;
      73           0 :     fYCenter[i] = 0.;
      74           0 :     fZCenter[i] = 0.;
      75           0 :     fXWidth[i]  = 0.;
      76           0 :     fYWidth[i]  = 0.;
      77           0 :     for (Int_t is = 0; is < kNS; is++) {
      78           0 :       fXDig[i][is] = 0;
      79           0 :       fYDig[i][is] = 0;
      80           0 :       fXDigBox[i][is] = new TBox(0,0,0,0);
      81           0 :       fYDigBox[i][is] = new TBox(0,0,0,0);
      82           0 :       fXDigBox[i][is]->SetBit(kCannotPick);
      83           0 :       fYDigBox[i][is]->SetBit(kCannotPick);
      84           0 :       fXDigBox[i][is]->SetFillStyle(1001);
      85           0 :       fYDigBox[i][is]->SetFillStyle(1001);
      86           0 :       fXDigBox[i][is]->SetFillColor(4);
      87           0 :       fYDigBox[i][is]->SetFillColor(4);
      88             :     }
      89             :   }
      90             : 
      91           0 :   fXSix  = -1;
      92           0 :   fXSiy1 = -1;
      93           0 :   fXSiy2 = -1;
      94             : 
      95           0 :   fYSix1 = -1;
      96           0 :   fYSix2 = -1;
      97           0 :   fYSiy  = -1;
      98             : 
      99           0 :   fDetElemId = -1;
     100           0 :   fIdCircuit = -1;
     101             : 
     102           0 :   fIsOpen = kFALSE;
     103             : 
     104           0 :   fYOver    = 0;
     105           0 :   fPosition = 0;
     106             : 
     107           0 :   for (Int_t i = 0; i < kNMT; i++) {
     108           0 :     fPadsX[i] = new TClonesArray("AliMpPad",16); fNPadsX[i] = 0;
     109           0 :     fPadsY[i] = new TClonesArray("AliMpPad",16); fNPadsY[i] = 0;
     110             :   }
     111             : 
     112           0 : }
     113             : 
     114             : //__________________________________________________________________________
     115             : AliMUONTriggerGUIboard::AliMUONTriggerGUIboard(TRootIOCtor* /*ioCtor*/) 
     116           0 :   : TObject(),
     117           0 :     fName(0),
     118           0 :     fCrateName(0),
     119           0 :     fID(-1),
     120           0 :     fStatus(0),
     121           0 :     fPosition(0),
     122           0 :     fYOver(0),
     123           0 :     fXCenter(),
     124           0 :     fYCenter(),
     125           0 :     fZCenter(),
     126           0 :     fXWidth(),
     127           0 :     fYWidth(),
     128           0 :     fXSix(0),
     129           0 :     fXSiy1(0),
     130           0 :     fXSiy2(0),
     131           0 :     fYSix1(0),
     132           0 :     fYSix2(0),
     133           0 :     fYSiy(0),
     134           0 :     fDetElemId(0),
     135           0 :     fIdCircuit(-1),
     136           0 :     fIsOpen(0),
     137           0 :     fNPadsX(),
     138           0 :     fNPadsY(),
     139           0 :     fPadsX(),
     140           0 :     fPadsY()
     141           0 : {
     142             :   /// board standard constructor
     143             : 
     144           0 : }
     145             : 
     146             : //__________________________________________________________________________
     147             : AliMUONTriggerGUIboard::~AliMUONTriggerGUIboard() 
     148           0 : {
     149             :   /// board destructor
     150             : 
     151           0 :   delete fName;
     152             : 
     153           0 :   for (Int_t imt = 0; imt < kNMT; imt++) {
     154           0 :     for (Int_t is = 0; is < kNS; is++) {
     155           0 :       delete fXDigBox[imt][is];
     156           0 :       delete fYDigBox[imt][is];
     157             :     }
     158             :   }
     159             : 
     160           0 : }
     161             : 
     162             : //__________________________________________________________________________
     163             : void AliMUONTriggerGUIboard::SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
     164             : {
     165             :   /// set coordinates of "is" x-strip box in chamber "imt"
     166             : 
     167           0 :   fXDigBox[imt][is]->SetX1(x1);
     168           0 :   fXDigBox[imt][is]->SetY1(y1);
     169           0 :   fXDigBox[imt][is]->SetX2(x2);
     170           0 :   fXDigBox[imt][is]->SetY2(y2);
     171             : 
     172           0 : }
     173             : 
     174             : //__________________________________________________________________________
     175             : void AliMUONTriggerGUIboard::SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
     176             : {
     177             :   /// set coordinates of "is" y-strip box in chamber "imt"
     178             : 
     179           0 :   fYDigBox[imt][is]->SetX1(x1);
     180           0 :   fYDigBox[imt][is]->SetY1(y1);
     181           0 :   fYDigBox[imt][is]->SetX2(x2);
     182           0 :   fYDigBox[imt][is]->SetY2(y2);
     183             : 
     184           0 : }
     185             : 
     186             : //__________________________________________________________________________
     187             : void AliMUONTriggerGUIboard::ClearXDigits()
     188             : {
     189             :   /// delete the set x-digits
     190             : 
     191           0 :   for (Int_t imt = 0; imt < kNMT; imt++) {
     192           0 :     for (Int_t is = 0; is < kNS; is++) {
     193           0 :       fXDig[imt][is] = 0;
     194             :     }
     195             :   }
     196             : 
     197           0 : }
     198             : 
     199             : //__________________________________________________________________________
     200             : void AliMUONTriggerGUIboard::ClearYDigits()
     201             : {
     202             :   /// delete the set y-digits
     203             : 
     204           0 :   for (Int_t imt = 0; imt < kNMT; imt++) {
     205           0 :     for (Int_t is = 0; is < kNS; is++) {
     206           0 :       fYDig[imt][is] = 0;
     207             :     }
     208             :   }
     209             : 
     210           0 : }
     211             : 
     212             : //__________________________________________________________________________
     213             : void AliMUONTriggerGUIboard::MakeGeometry()
     214             : {
     215             :   /// create the display geometry from the mapping pads
     216             : 
     217             :   AliMpPad *pad;
     218             : 
     219             :   // circuit number and manu channel (from x-strips)
     220           0 :   for (Int_t ich = 0; ich < kNMT; ich++) {
     221           0 :     if (fNPadsX[ich]) {
     222           0 :       pad = (AliMpPad*)fPadsX[ich]->At(0);
     223           0 :       fIdCircuit = pad->GetLocalBoardId(0);
     224           0 :       break;
     225             :     }
     226             :   }
     227             : 
     228             :   // position index
     229           0 :   if (fName->Length()) {
     230           0 :     if (fName->Contains("12")) fPosition = 1;
     231           0 :     if (fName->Contains("34")) fPosition = 2;
     232           0 :     if (fName->Contains("56")) fPosition = 3;
     233           0 :     if (fName->Contains("78")) fPosition = 4;
     234             :   }
     235             : 
     236             :   // position index for common y-strip boards
     237           0 :   for (Int_t ich = 0; ich < kNMT; ich++) {
     238           0 :     if (fNPadsY[ich]) {
     239           0 :       pad = (AliMpPad*)fPadsY[ich]->At(0);
     240           0 :       fYOver = pad->GetNofLocations();
     241           0 :       break;
     242             :     }
     243             :   }
     244             : 
     245             :   // pad indices
     246             :   Int_t padxIx = -1, padxIy1 = +999, padxIy2 = -999;
     247             :   Int_t padyIy = -1, padyIx1 = +999, padyIx2 = -999;
     248           0 :   for (Int_t ip = 0; ip < fNPadsX[0]; ip++) {
     249           0 :     pad = (AliMpPad*)fPadsX[0]->At(ip);
     250           0 :     padxIx = pad->GetIx();
     251           0 :     padxIy1 = TMath::Min(padxIy1,pad->GetIy());
     252           0 :     padxIy2 = TMath::Max(padxIy2,pad->GetIy());
     253             :   }
     254           0 :   for (Int_t ip = 0; ip < fNPadsY[0]; ip++) {
     255           0 :     pad = (AliMpPad*)fPadsY[0]->At(ip);
     256           0 :     padyIy = pad->GetIy();
     257           0 :     padyIx1 = TMath::Min(padyIx1,pad->GetIx());
     258           0 :     padyIx2 = TMath::Max(padyIx2,pad->GetIx());
     259             :   }
     260           0 :   fXSix  = padxIx;
     261           0 :   fXSiy1 = padxIy1;
     262           0 :   fXSiy2 = padxIy2;
     263           0 :   fYSiy  = padyIy;
     264           0 :   fYSix1 = padyIx1;
     265           0 :   fYSix2 = padyIx2;
     266             : 
     267             :   // position and dimension
     268             : 
     269           0 :   AliMUONGeometryTransformer transformer;
     270           0 :   transformer.LoadGeometryData("transform.dat");
     271             : 
     272             :   Float_t minX, maxX, minY, maxY;
     273             :   Float_t dx, dy;
     274           0 :   Float_t xloc, yloc, xglo=0., yglo=0., zglo=0.;
     275           0 :   for (Int_t ich = 0; ich < kNMT; ich++) {
     276             :     minX = +9999; maxX = -9999;
     277             :     minY = +9999; maxY = -9999;
     278           0 :     for (Int_t ix = 0; ix < fNPadsX[ich]; ix++) {
     279           0 :       pad = (AliMpPad*)fPadsX[ich]->At(ix);
     280           0 :       xloc = pad->GetPositionX();
     281           0 :       yloc = pad->GetPositionY();
     282           0 :       dx = pad->GetDimensionX();
     283           0 :       dy = pad->GetDimensionY();
     284           0 :       transformer.Local2Global((11+ich)*100+GetDetElemId(), xloc, yloc, 0, xglo, yglo, zglo);
     285           0 :       minX = TMath::Min(minX,(xglo-dx));
     286           0 :       maxX = TMath::Max(maxX,(xglo+dx));
     287           0 :       minY = TMath::Min(minY,(yglo-dy));
     288           0 :       maxY = TMath::Max(maxY,(yglo+dy));
     289             :     }
     290           0 :     fXCenter[ich] = 0.5*(minX+maxX);
     291           0 :     fYCenter[ich] = 0.5*(minY+maxY);
     292           0 :     fZCenter[ich] = zglo;
     293           0 :     fXWidth[ich]  = maxX-minX;
     294           0 :     fYWidth[ich]  = maxY-minY;
     295             :     // truncate to same precision as in the old guimap files
     296           0 :     fXCenter[ich] = 0.01*TMath::Nint(fXCenter[ich]*100.0);
     297           0 :     fYCenter[ich] = 0.01*TMath::Nint(fYCenter[ich]*100.0);
     298           0 :     fXWidth[ich] = 0.01*TMath::Nint(fXWidth[ich]*100.0);
     299           0 :     fYWidth[ich] = 0.01*TMath::Nint(fYWidth[ich]*100.0);
     300             : 
     301             :   }
     302             : 
     303             :   // delete the pads arrays
     304           0 :   for (Int_t ich = 0; ich < kNMT; ich++) {
     305           0 :     delete fPadsX[ich]; fNPadsX[ich] = 0;
     306           0 :     delete fPadsY[ich]; fNPadsY[ich] = 0;
     307             :   }
     308             :   
     309           0 : }
     310             : 
     311             : //__________________________________________________________________________
     312             : Int_t AliMUONTriggerGUIboard::GetLine() const
     313             : {
     314             :   /// get detector side
     315           0 :   if (fName->Length() >= 5) {
     316           0 :     const Char_t *name = fName->Data();
     317           0 :     TString sline = TString(name[4]);
     318           0 :     return sline.Atoi();
     319           0 :   }
     320             : 
     321           0 :   return -1;
     322             : 
     323           0 : }
     324             : 
     325             : //__________________________________________________________________________
     326             : Int_t AliMUONTriggerGUIboard::GetCol() const
     327             : {
     328             :   /// get detector side
     329           0 :   if (fName->Length() >= 5) {
     330           0 :     const Char_t *name = fName->Data();
     331           0 :     TString scol = TString(name[2]);
     332           0 :     return scol.Atoi();
     333           0 :   }
     334             : 
     335           0 :   return -1;
     336             : 
     337           0 : }
     338             : 
     339             : //__________________________________________________________________________
     340             : Int_t AliMUONTriggerGUIboard::GetSide() const
     341             : {
     342             :   /// get detector side
     343           0 :   if (fName->Length() >= 5) {
     344           0 :     const Char_t *name = fName->Data();
     345           0 :     if (!strncmp(name,"L",1)) return 0;
     346           0 :     if (!strncmp(name,"R",1)) return 1;
     347           0 :   }
     348             : 
     349           0 :   return -1;
     350             : 
     351           0 : }
     352             : 
     353             : //__________________________________________________________________________
     354             : void AliMUONTriggerGUIboard::PrintBoard() const
     355             : {
     356             :   /// print information on this board
     357             : 
     358           0 :   printf("Name: %s Id %3d Circ %3d DetElemId %2d Pos %1d YOver %1d\n",GetBoardName(),GetNumber(),GetIdCircuit(),GetDetElemId(),GetPosition(),GetYOver());
     359           0 :   printf("NStrips: X %2d Y %2d \n",GetNStripX(),GetNStripY());
     360           0 :   printf("Pad indices: X: ix %3d iy1 %3d iy2 %3d \n",GetXSix(),GetXSiy1(),GetXSiy2());
     361           0 :   printf("Pad indices: Y: iy %3d ix1 %3d ix2 %3d \n",GetYSiy(),GetYSix1(),GetYSix2());
     362           0 :   printf("Position and dimension:\n");
     363           0 :   for (Int_t imt = 0; imt < 4; imt++) {
     364           0 :     printf("MT=%1d: X %9.4f Y %9.4f Z %10.4f \n",imt,GetXCenter(imt),GetYCenter(imt),GetZCenter(imt));
     365           0 :     printf("      DX %7.4f DY %7.4f \n",GetXWidth(imt),GetYWidth(imt));
     366             :   }
     367             : 
     368           0 : }
     369             : 

Generated by: LCOV version 1.11