CMS 3D CMS Logo

TRawTpgChannel.cc

Go to the documentation of this file.
00001 //----------Author's Name:Jean Bourotte, Igor Semeniouk, Patrick Jarry (Windows porting)
00002 //----------Copyright:Those valid for CMS sofware
00003 //----------Modified:31/1/2003
00004 //----------Modified; 8/11/2004 Patrick Jarry (tRawTpgChannel)
00005 
00006 #include <iostream>
00007 #include "IORawData/Ecal2004TBInputService/interface/TRawTpgChannel.h"
00008 
00009 using namespace std;
00010 
00011 ClassImp(TRawTpgChannel)
00012 //______________________________________________________________________________
00013 //
00014 //  tdc measurements for Tpg counters
00015 //
00016 TRawTpgChannel::TRawTpgChannel() {
00017 //Default constructor.
00018   Init();
00019 }
00020 TRawTpgChannel::TRawTpgChannel(Int_t n) {
00021 //Constructor with number of elements.
00022   Short_t j;
00023   fNValue = n;
00024   fValues = new Int_t [fNValue];
00025   for (j=0;j<fNValue;j++) fValues[j] = 0;
00026 }
00027 
00028 TRawTpgChannel::TRawTpgChannel(Int_t n,Int_t v[]) {
00029 //Constructor with values
00030   Init();
00031   SetValues(n,v);
00032 }
00033 
00034 TRawTpgChannel::~TRawTpgChannel() {
00035   Clear();
00036 }
00037 
00038 void TRawTpgChannel::Clear() {
00039   if (fValues) delete [] fValues;
00040   Init();
00041 }
00042 
00043 void TRawTpgChannel::Init() {
00044 //Everything to 0
00045   fNValue = 0;
00046   fValues = 0;
00047 }
00048 
00049 void TRawTpgChannel::Print() const {
00050 //Prints everything
00051   Short_t j;
00052   cout << endl;
00053   cout << "TRawTpgChannel nv : " << fNValue << endl;
00054   cout << "Values:   ";
00055   for (j=0;j<fNValue;j++) cout << "  " << fValues[j];
00056   cout << endl;
00057   cout << endl;
00058 }
00059 void TRawTpgChannel::SetValues(Int_t n,Int_t v[]) {
00060 //Fill class variables
00061   Short_t j;
00062   if ((n<=0) && (fNValue != 0)) Clear();
00063   if ((n >0) && (fNValue != n)) {
00064     Clear();
00065     fNValue = n;
00066     fValues = new Int_t [fNValue];
00067   }
00068   for (j=0;j<n;j++) fValues[j] = v[j];
00069 }
00070 void TRawTpgChannel::SetTpgChannel(Int_t ns,Int_t s[]) {
00071 //Defines the whole class
00072   Short_t j;
00073   if ((ns<=0) && (fNValue != 0)) Clear();
00074   if ((ns >0) && (fNValue != ns)) {
00075     Clear();
00076     fNValue = ns;
00077     fValues = new Int_t [fNValue];
00078   }
00079   for (j=0;j<ns;j++) fValues[j] = s[j];
00080 }
00081 
00082 

Generated on Tue Jun 9 17:39:24 2009 for CMSSW by  doxygen 1.5.4