00001 //----------Author's Name:Jean Bourotte, Igor Semeniouk, Patrick Jarry (Windows porting) 00002 //----------Copyright:Those valid for CMS sofware 00003 //----------Modified:31/3/2003 00004 #include <iostream> 00005 #include "IORawData/Ecal2004TBInputService/interface/TRawPattern.h" 00006 using namespace std; 00007 00008 ClassImp(TRawPattern) 00009 //______________________________________________________________________________ 00010 // 00011 // Content of the 3 pattern units used in the test beam 00012 // 00013 TRawPattern::TRawPattern() { 00014 //Default constructor 00015 Init(); 00016 } 00017 00018 TRawPattern::TRawPattern(Int_t n, Int_t v[]) { 00019 //Constructor with values 00020 Init(); 00021 SetValues(n,v); 00022 } 00023 00024 TRawPattern::~TRawPattern() { 00025 Clear(); 00026 } 00027 00028 void TRawPattern::Init() { 00029 //Everything to 0 00030 fNValue = 0; 00031 fValues = 0; 00032 } 00033 00034 void TRawPattern::Clear(const char *opt) { 00035 if (fValues) delete [] fValues; 00036 Init(); 00037 } 00038 00039 00040 void TRawPattern::Print(const char *opt) const { 00041 Short_t j; 00042 cout << endl; 00043 00044 for (j=0;j<fNValue;j++) cout << " " << fValues[j]; 00045 cout << endl; 00046 cout << endl; 00047 } 00048 00049 void TRawPattern::SetValues( Int_t n, Int_t v[]) { 00050 Short_t j; 00051 if ((n<=0) && (fNValue != 0)) Clear(); 00052 if ((n >0) && (fNValue != n)) { 00053 Clear(); 00054 fNValue = n; 00055 fValues = new Int_t [fNValue]; 00056 } 00057 for (j=0;j<n;j++) fValues[j] = v[j]; 00058 }