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 #include <iostream> 00005 #include "IORawData/Ecal2004TBInputService/interface/TRawTdcTriggers.h" 00006 using namespace std; 00007 00008 ClassImp(TRawTdcTriggers) 00009 //______________________________________________________________________________ 00010 // 00011 // tdc measurements for trigger counters 00012 // 00013 TRawTdcTriggers::TRawTdcTriggers() { 00014 //Default constructor. 00015 Init(); 00016 } 00017 TRawTdcTriggers::TRawTdcTriggers(Int_t n) { 00018 //Constructor with number of elements. 00019 Short_t j; 00020 fNValue = n; 00021 fValues = new Int_t [fNValue]; 00022 for (j=0;j<fNValue;j++) fValues[j] = 0; 00023 } 00024 00025 TRawTdcTriggers::TRawTdcTriggers(Int_t n,Int_t v[]) { 00026 //Constructor with values 00027 Init(); 00028 SetValues(n,v); 00029 } 00030 00031 TRawTdcTriggers::~TRawTdcTriggers() { 00032 Clear(); 00033 } 00034 00035 void TRawTdcTriggers::Clear(const char *opt) { 00036 if (fValues) delete [] fValues; 00037 Init(); 00038 } 00039 00040 void TRawTdcTriggers::Init() { 00041 //Everything to 0 00042 fNValue = 0; 00043 fValues = 0; 00044 } 00045 00046 void TRawTdcTriggers::Print(const char *opt) const { 00047 //Prints everything 00048 Short_t j; 00049 cout << endl; 00050 cout << "TRawTdcTriggers nv : " << fNValue << endl; 00051 cout << "Values: "; 00052 for (j=0;j<fNValue;j++) cout << " " << fValues[j]; 00053 cout << endl; 00054 cout << endl; 00055 } 00056 void TRawTdcTriggers::SetValues(Int_t n,Int_t v[]) { 00057 //Fill class variables 00058 Short_t j; 00059 if ((n<=0) && (fNValue != 0)) Clear(); 00060 if ((n >0) && (fNValue != n)) { 00061 Clear(); 00062 fNValue = n; 00063 fValues = new Int_t [fNValue]; 00064 } 00065 for (j=0;j<n;j++) fValues[j] = v[j]; 00066 }