LCOV - code coverage report
Current view: top level - MUON/MUONgraphics - AliMUONManuPainter.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 100 1.0 %
Date: 2016-06-14 17:26:59 Functions: 1 22 4.5 %

          Line data    Source code
       1             : 
       2             : /**************************************************************************
       3             : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       4             : *                                                                        *
       5             : * Author: The ALICE Off-line Project.                                    *
       6             : * Contributors are mentioned in the code where appropriate.              *
       7             : *                                                                        *
       8             : * Permission to use, copy, modify and distribute this software and its   *
       9             : * documentation strictly for non-commercial purposes is hereby granted   *
      10             : * without fee, provided that the above copyright notice appears in all   *
      11             : * copies and that both the copyright notice and this permission notice   *
      12             : * appear in the supporting documentation. The authors make no claims     *
      13             : * about the suitability of this software for any purpose. It is          *
      14             : * provided "as is" without express or implied warranty.                  *
      15             : **************************************************************************/
      16             : 
      17             : // $Id$
      18             : 
      19             : #include "AliMUONManuPainter.h"
      20             : 
      21             : #include "AliMpDCSNamer.h"
      22             : #include "AliLog.h"
      23             : #include "AliMUONContour.h"
      24             : #include "AliMUONManuContourMaker.h"
      25             : #include "AliMUONManuPadPainter.h"
      26             : #include "AliMUONPainterHelper.h"
      27             : #include "AliMUONVCalibParam.h"
      28             : #include "AliMUONVDigit.h"
      29             : #include "AliMUONVTrackerData.h"
      30             : #include "AliMpDEManager.h"
      31             : #include "AliMpManuUID.h"
      32             : #include "AliMpMotifPosition.h"
      33             : #include "AliMpMotifType.h"
      34             : #include "AliMpSlat.h"
      35             : #include "AliMpStationType.h"
      36             : #include "AliMpVMotif.h"
      37             : #include "AliMpVPadIterator.h"
      38             : #include <TArrayI.h>
      39             : #include <float.h>
      40             : 
      41             : ///\class AliMUONManuPainter
      42             : ///
      43             : /// Implementation of AliMUONVPainter for one manu (not the pads, only the manu
      44             : /// itself).
      45             : ///
      46             : ///\author Laurent Aphecetche, Subatech
      47             : 
      48             : ///\cond CLASSIMP
      49          12 : ClassImp(AliMUONManuPainter)
      50             : ///\endcond
      51             : 
      52             : //_____________________________________________________________________________
      53             : AliMUONManuPainter::AliMUONManuPainter(TRootIOCtor* ioCtor)
      54           0 : : AliMUONVPainter(ioCtor),
      55           0 : fDetElemId(-1),
      56           0 : fManuId(-1)
      57           0 : {
      58             :   /// ctor
      59           0 : }
      60             : 
      61             : //_____________________________________________________________________________
      62             : AliMUONManuPainter::AliMUONManuPainter()
      63           0 : : AliMUONVPainter(),
      64           0 : fDetElemId(-1),
      65           0 : fManuId(-1)
      66           0 : {
      67             :   /// ctor
      68           0 : }
      69             : 
      70             : //_____________________________________________________________________________
      71             : AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att,
      72             :                                        Int_t detElemId,
      73             :                                        Int_t manuId)
      74           0 : : AliMUONVPainter("MANU"),
      75           0 :   fDetElemId(detElemId),
      76           0 :   fManuId(manuId)
      77           0 : {
      78             :     /// ctor
      79             :     
      80           0 :   SetAttributes(att);
      81             :     
      82           0 :   AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
      83             :     
      84           0 :   SetID(detElemId,manuId);
      85           0 :   SetName(h->ManuName(manuId));
      86           0 :   SetPathName(h->ManuPathName(detElemId,manuId));
      87             :   
      88             :   
      89           0 :   AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
      90             :   
      91           0 :   if ( stationType == AliMp::kStationTrigger ) 
      92             :   {
      93           0 :     AliError("Hu ho. Not supposed to be used for trigger !");
      94           0 :     Invalidate();
      95           0 :     return;    
      96             :   }
      97             :     
      98           0 :   TString name = AliMUONManuContourMaker::ManuPathName(detElemId, manuId);
      99             : 
     100           0 :   AliMUONContour* contour = h->GetContour(name.Data());
     101             :   
     102           0 :   if (!contour)
     103             :   {
     104           0 :     AliError(Form("Could not get manuId %04d from DE %04d (name=%s)",manuId,detElemId,name.Data()));
     105             :   }
     106             :   
     107           0 :   SetContour(contour);
     108             :   
     109           0 :   Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId));
     110           0 : }
     111             : 
     112             : //_____________________________________________________________________________
     113             : AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs)
     114           0 : : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1)
     115           0 : {
     116             :   /// copy ctor
     117           0 :   rhs.Copy(*this);
     118           0 : }
     119             : 
     120             : //_____________________________________________________________________________
     121             : AliMUONManuPainter&
     122             : AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs)
     123             : {
     124             :   /// assignment operator
     125           0 :   if ( this != &rhs ) 
     126             :   {
     127           0 :     rhs.Copy(*this);
     128           0 :   }
     129           0 :   return *this;
     130             : }
     131             : 
     132             : //_____________________________________________________________________________
     133           0 : AliMUONManuPainter::~AliMUONManuPainter()
     134           0 : {
     135             :   /// dtor
     136           0 : }
     137             : 
     138             : //_____________________________________________________________________________
     139             : void 
     140             : AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex, 
     141             :                                      Double_t& dataMin, Double_t& dataMax) const
     142             : {
     143             :   /// Compute data range spanned by this manu
     144           0 :   dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex);
     145           0 : }
     146             : 
     147             : 
     148             : //_____________________________________________________________________________
     149             : void
     150             : AliMUONManuPainter::Copy(TObject& object) const
     151             : {
     152             :   /// copyy this to object
     153           0 :   AliMUONVPainter::Copy((AliMUONVPainter&)(object));
     154           0 :   ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId;
     155           0 :   ((AliMUONManuPainter&)(object)).fManuId = fManuId;
     156           0 : }
     157             : 
     158             : //_____________________________________________________________________________
     159             : TString
     160             : AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
     161             :                              Double_t, Double_t)
     162             : {
     163             :   /// Describe data at this manu
     164             :   
     165           0 :   if (!data.HasManu(fDetElemId,fManuId)) return "";
     166             :   
     167           0 :   Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
     168             :   
     169           0 :   TString rv = AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
     170             :   
     171           0 :   if ( TString(data.GetName()).Contains("HV") )
     172             :   {
     173           0 :     rv += "\n";
     174             :     
     175           0 :     AliMpDCSNamer hvNamer("TRACKER");
     176             :     
     177           0 :     if ( AliMpDEManager::GetStationType(fDetElemId) == AliMp::kStation12 )
     178             :     {
     179           0 :       Int_t sector = hvNamer.ManuId2Sector(fDetElemId,fManuId);
     180             : 
     181           0 :       rv += hvNamer.DCSNameFromAlias(hvNamer.DCSAliasName(fDetElemId,sector));
     182           0 :     }
     183             :     else
     184             :     {
     185           0 :         rv += hvNamer.DCSNameFromAlias(hvNamer.DCSAliasName(fDetElemId));
     186             :     }
     187           0 :   }
     188             :   
     189           0 :   return rv;
     190           0 : }
     191             : 
     192             : //_____________________________________________________________________________
     193             : void
     194             : AliMUONManuPainter::FillManuList(TObjArray& manuList) const
     195             : {
     196             :   /// Append our manu to the list
     197           0 :   manuList.Add(new AliMpManuUID(fDetElemId,fManuId));
     198           0 : }
     199             : 
     200             : //_____________________________________________________________________________
     201             : Bool_t
     202             : AliMUONManuPainter::IsIncluded() const
     203             : {
     204             :   /// whether this manu is included in the readout or not
     205           0 :   return ( InteractiveReadOutConfig()->Manu(fDetElemId,fManuId) > 0 );
     206             : }
     207             : 
     208             : //_____________________________________________________________________________
     209             : void
     210             : AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
     211             :                               Double_t min, Double_t max)
     212             : {
     213             :   /// Paint area of this manu according to data
     214             :   
     215           0 :   if (!data.HasManu(fDetElemId,fManuId)) return;
     216             : 
     217           0 :   Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
     218             :   
     219           0 :   if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
     220             :   
     221           0 :   Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
     222             :   
     223           0 :   PaintArea(color);
     224           0 : }
     225             : 
     226             : //_____________________________________________________________________________
     227             : AliMUONAttPainter
     228             : AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const
     229             : {
     230             :   /// Normalize the attributes
     231             :   
     232             :   /// check that cathode and plane are up-to-date, and that they are legal
     233             :   
     234           0 :   AliMUONAttPainter norm(attributes);
     235             : 
     236           0 :   norm.SetValid(kFALSE);
     237             :   
     238           0 :   if ( norm.IsCathodeDefined() ) 
     239             :   {
     240           0 :     if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm;
     241             :   }
     242             :   
     243           0 :   if ( norm.IsPlaneDefined() ) 
     244             :   {
     245           0 :     if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm;
     246             :   }
     247             :   
     248           0 :   norm.SetValid(kTRUE);
     249             :   
     250           0 :   if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() ) 
     251             :   {
     252             :     // derive plane from cathode
     253             :     
     254           0 :     AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
     255             : 
     256           0 :     AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
     257             :     
     258           0 :     Bool_t bending = ( planeType == AliMp::kBendingPlane );
     259             :     
     260           0 :     norm.SetPlane(bending,!bending);    
     261           0 :   }
     262           0 :   else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() )
     263             :   {
     264             :     // derive cathode from plane
     265             : 
     266           0 :     AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
     267             : 
     268           0 :     AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType);
     269             :           
     270           0 :     Bool_t cath0 = ( cathode == AliMp::kCath0 );
     271             :     
     272           0 :     norm.SetCathode(cath0,!cath0);    
     273           0 :   }
     274           0 :   else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() ) 
     275             :   {
     276             :     // check that cathode and plane matches
     277             :     
     278           0 :     AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
     279             : 
     280           0 :     AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
     281             :     
     282           0 :     Bool_t bending = ( planeType == AliMp::kBendingPlane );
     283             :     
     284           0 :     if ( bending != norm.IsBendingPlane() ) 
     285             :     {
     286           0 :       norm.SetValid(kFALSE);
     287             :     }
     288           0 :   }
     289             :   
     290           0 :   return norm;
     291           0 : }
     292             : 
     293             : 

Generated by: LCOV version 1.11