LCOV - code coverage report
Current view: top level - TPC/TPCcalib - AliTPCCalPadRegion.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 52 1.9 %
Date: 2016-06-14 17:26:59 Functions: 1 11 9.1 %

          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             : ////////////////////////////////////////////////////////////////////////////
      17             : //                                                                        
      18             : //       === Class for properties specific to pad regions ===
      19             : //
      20             : //    Each segment of the TPC (i.e. IROC and corresponding OROC) consists
      21             : //    of three different pad sizes (short, medium, long). This class
      22             : //    is useful for scenarios, where it is appropriate to describe
      23             : //    some behaviour per pad size region. It provides an easy interface
      24             : //    for getting and setting arbitrary objects for each pad size region.
      25             : //    There is no need that this object is of the same type for each
      26             : //    pad size region (though it probably will be in most of the cases),
      27             : //    nor that it is set at all (e.g. when no data for this region
      28             : //    exists and such an object is not needed).
      29             : //
      30             : //    An example that makes usage of this class is the AliTPCFitPad class
      31             : //    which stores TLinearFitter objects for each pad region.
      32             : //
      33             : ////////////////////////////////////////////////////////////////////////////
      34             : 
      35             : #include "AliTPCCalPadRegion.h"
      36             : #include "AliTPCROC.h"
      37             : 
      38           6 : ClassImp(AliTPCCalPadRegion)
      39             : 
      40             : AliTPCCalPadRegion::AliTPCCalPadRegion():
      41           0 :    TNamed(),
      42           0 :    fObjects(0)
      43           0 : {
      44             :    //
      45             :    // Default constructor.
      46             :    //
      47           0 : }
      48             : 
      49             : AliTPCCalPadRegion::AliTPCCalPadRegion(const char *name, const char *title) :
      50           0 :    TNamed(name, title),
      51           0 :    fObjects(0)
      52           0 : {
      53             :    //
      54             :    // Constructor.
      55             :    //
      56             : 
      57           0 :    fObjects = new TObjArray(fgkNSegments * fgkNPadTypes);
      58           0 :    fObjects->SetOwner(kTRUE);
      59           0 : }
      60             : 
      61             : AliTPCCalPadRegion::AliTPCCalPadRegion(const AliTPCCalPadRegion& obj) :
      62           0 :   TNamed(obj),
      63           0 :   fObjects(0)
      64           0 : {
      65             :    //
      66             :    // Copy constructor.
      67             :    //
      68             : 
      69           0 :    fObjects = new TObjArray(*(obj.fObjects));
      70           0 :    fObjects->SetOwner(kTRUE);
      71           0 : }
      72             : 
      73             : AliTPCCalPadRegion& AliTPCCalPadRegion::operator=(const AliTPCCalPadRegion& rhs) {
      74             :    //
      75             :    // Assignment operator.
      76             :    //
      77             : 
      78           0 :    if (this != &rhs) {
      79           0 :       TNamed::operator=(rhs);
      80           0 :       fObjects = new TObjArray(*(rhs.fObjects));
      81           0 :    }
      82           0 :    return *this;
      83           0 : }
      84             : 
      85             : 
      86             : void       AliTPCCalPadRegion::SetObject(TObject* obj, UInt_t segment, UInt_t padType)
      87             : {
      88             :   //
      89             :   // Set the object for given segment
      90             :   //
      91           0 :   if (!fObjects) {
      92           0 :     fObjects = new TObjArray(fgkNSegments * fgkNPadTypes);
      93           0 :     fObjects->SetOwner(kTRUE);
      94           0 :   }
      95           0 :   if (fObjects->GetEntriesFast()<Int_t(fgkNSegments * fgkNPadTypes)){
      96           0 :     fObjects->Expand(fgkNSegments * fgkNPadTypes);
      97           0 :   }
      98           0 :   if (BoundsOk("SetObject", segment, padType)){ 
      99           0 :     if (segment+fgkNSegments*padType>static_cast<UInt_t>(fObjects->GetEntriesFast())) fObjects->Expand(fgkNSegments * fgkNPadTypes);
     100           0 :     fObjects->AddAt(obj, segment+fgkNSegments*padType); 
     101           0 :   }
     102           0 : }
     103             : 
     104             : TObject*   AliTPCCalPadRegion::GetObject(UInt_t segment, UInt_t padType){  
     105             :   //
     106             :   //
     107             :   //
     108           0 :   if (fObjects->GetEntriesFast()<Int_t(fgkNSegments * fgkNPadTypes)){
     109           0 :     fObjects->Expand(fgkNSegments * fgkNPadTypes);
     110           0 :   }
     111           0 :   return fObjects->At(segment+fgkNSegments*padType); 
     112             : }
     113             : 
     114             : 
     115             : 
     116             : void AliTPCCalPadRegion::GetPadRegionCenterLocal(UInt_t padType, Double_t* xy) {
     117             :    //
     118             :    // Return the center of the pad size region in local
     119             :    // coordinates as an Double_t array xy of length 2.
     120             :    //
     121             :    
     122           0 :    Float_t centerPad[3] = {0};
     123           0 :    AliTPCROC* tpcROC = AliTPCROC::Instance();
     124             : 
     125           0 :    Int_t IOROC = (padType == 0) ? 0 : tpcROC->GetNInnerSector();
     126             :    //tpcROC->GetPositionLocal(IOROC, tpcROC->GetNRows(IOROC)/2, tpcROC->GetNPads(IOROC, tpcROC->GetNRows(IOROC)/2)/2, centerPad);  // use this instead of the switch statement if you want to calculate the center of the ROC and not the center of the regions with the same pad size
     127           0 :    switch (padType) {
     128             :       case 0:  // short pads
     129           0 :          tpcROC->GetPositionLocal(IOROC, tpcROC->GetNRows(IOROC)/2, tpcROC->GetNPads(IOROC, tpcROC->GetNRows(IOROC)/2)/2, centerPad);
     130           0 :          break;
     131             :       case 1:  // medium pads
     132           0 :          tpcROC->GetPositionLocal(IOROC, 64/2, tpcROC->GetNPads(IOROC, 64/2)/2, centerPad);
     133           0 :          break;
     134             :       case 2:  // long pads
     135           0 :          tpcROC->GetPositionLocal(IOROC, 64+32/2, tpcROC->GetNPads(IOROC, 64+32/2)/2, centerPad);
     136           0 :          break;
     137             :    }
     138             : 
     139           0 :    xy[0] = centerPad[0];
     140           0 :    xy[1] = centerPad[1];
     141           0 : }
     142             : 
     143             : /*UInt_t AliTPCCalPadRegion::GetStartRow(UInt_t padType) {
     144             :    //
     145             :    // Returns the index of the 
     146             :    //
     147             : }
     148             : 
     149             : UInt_t AliTPCCalPadRegion::GetEndRow(UInt_t padType) {
     150             : 
     151             : }*/

Generated by: LCOV version 1.11