1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // Calibration base class for a single ROC //
20 // Contains one float value per pad //
21 // mapping of the pads taken form AliTPCROC //
23 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliTPCCalROC.h"
30 ClassImp(AliTPCCalROC)
33 //_____________________________________________________________________________
34 AliTPCCalROC::AliTPCCalROC():TObject()
37 // Default constructor
45 //_____________________________________________________________________________
46 AliTPCCalROC::AliTPCCalROC(UInt_t sector):TObject()
49 // Constructor that initializes a given sector
52 fNChannels = AliTPCROC::Instance()->GetNChannels(fSector);
53 fNRows = AliTPCROC::Instance()->GetNRows(fSector);
54 fIndexes = AliTPCROC::Instance()->GetRowIndexes(fSector);
55 fData = new Float_t[fNChannels];
56 for (UInt_t idata = 0; idata< fNChannels; idata++) fData[idata] = 0.;
59 //_____________________________________________________________________________
60 AliTPCCalROC::AliTPCCalROC(const AliTPCCalROC &c):TObject(c)
63 // AliTPCCalROC copy constructor
66 fNChannels = AliTPCROC::Instance()->GetNChannels(fSector);
67 fNRows = AliTPCROC::Instance()->GetNRows(fSector);
68 fIndexes = AliTPCROC::Instance()->GetRowIndexes(fSector);
70 fData = new Float_t[fNChannels];
71 for (UInt_t idata = 0; idata< fNChannels; idata++) fData[idata] = c.fData[idata];
74 //_____________________________________________________________________________
75 AliTPCCalROC::~AliTPCCalROC()
78 // AliTPCCalROC destructor
88 void AliTPCCalROC::Streamer(TBuffer &R__b)
90 // Stream an object of class AliTPCCalROC.
91 if (R__b.IsReading()) {
92 AliTPCCalROC::Class()->ReadBuffer(R__b, this);
93 fIndexes = AliTPCROC::Instance()->GetRowIndexes(fSector);
95 AliTPCCalROC::Class()->WriteBuffer(R__b,this);
101 void AliTPCCalROC::Test(){
103 // example function to show functionality and tes AliTPCCalROC
105 AliTPCCalROC roc0(0);
106 for (UInt_t irow = 0; irow <roc0.GetNrows(); irow++){
107 for (UInt_t ipad = 0; ipad <roc0.GetNPads(irow); ipad++){
108 Float_t value = irow+ipad/1000.;
109 roc0.SetValue(irow,ipad,value);
113 AliTPCCalROC roc1(roc0);
114 for (UInt_t irow = 0; irow <roc1.GetNrows(); irow++){
115 for (UInt_t ipad = 0; ipad <roc1.GetNPads(irow); ipad++){
116 Float_t value = irow+ipad/1000.;
117 if (roc1.GetValue(irow,ipad)!=value){
118 printf("Read/Write error\trow=%d\tpad=%d\n",irow,ipad);
122 TFile f("calcTest.root","recreate");
124 AliTPCCalROC * roc2 = (AliTPCCalROC*)f.Get("Roc0");
127 for (UInt_t irow = 0; irow <roc0.GetNrows(); irow++){
128 if (roc0.GetNPads(irow)!=roc2->GetNPads(irow))
129 printf("NPads - Read/Write error\trow=%d\n",irow);
130 for (UInt_t ipad = 0; ipad <roc1.GetNPads(irow); ipad++){
131 Float_t value = irow+ipad/1000.;
132 if (roc2->GetValue(irow,ipad)!=value){
133 printf("Read/Write error\trow=%d\tpad=%d\n",irow,ipad);