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/TRawTdcInfo.h" 00006 using namespace std; 00007 00008 ClassImp(TRawTdcInfo) 00009 //______________________________________________________________________________ 00010 // 00011 // TDC measurements for clock-trig 00012 // In case of laser pulses, TRawTdcInfo gives the time of the maximum of the pulse. In 00013 //the software, 2 types of histograms are provided: 00014 // - The ones labelled "experimental" use the information in TRawTdcInfo to establish 00015 // the timing of the laser relative to the clock of the FADC. 00016 // - The ones labelled "reconstructed" establish this timing by software, by mean 00017 // of fits on the pulses. 00018 // 00019 TRawTdcInfo::TRawTdcInfo() { 00020 // Default constructor. 00021 Init(); 00022 } 00023 TRawTdcInfo::TRawTdcInfo(Int_t n) { 00024 //Constructor with number of elements 00025 Short_t j; 00026 fNValue = n; 00027 fValues = new Int_t [fNValue]; 00028 printf( "TRawTdcInfo allocating %d int in Ctor(int)\n", fNValue ); 00029 for (j=0;j<fNValue;j++) fValues[j] = 0; 00030 } 00031 TRawTdcInfo::TRawTdcInfo(Int_t n,Int_t v[]) { 00032 //Constructor giving values 00033 Init(); 00034 SetValues(n,v); 00035 } 00036 TRawTdcInfo::~TRawTdcInfo() { 00037 //Destructor 00038 Clear(); 00039 } 00040 void TRawTdcInfo::Clear(const char *opt) { 00041 if (fValues) { 00042 printf( "deleting %d int in Clear\n", fNValue ); 00043 delete [] fValues; 00044 } 00045 Init(); 00046 } 00047 void TRawTdcInfo::Init() { 00048 //Everything to 0 00049 fNValue = 0; 00050 fValues = 0; 00051 // printf( "end TRawTdcInfo::Init()\n" ); 00052 } 00053 void TRawTdcInfo::Print(const char *opt) const { 00054 Short_t j; 00055 cout << endl; 00056 cout << "TRawTdcInfo nb val : " << fNValue << endl; 00057 cout << "Values: "; 00058 for (j=0;j<fNValue;j++) cout << " " << fValues[j]; 00059 cout << endl; 00060 cout << endl; 00061 } 00062 void TRawTdcInfo::SetValues(Int_t n,Int_t v[]) { 00063 //Set values to all variables of the class 00064 Short_t j; 00065 if ((n<=0) && (fNValue != 0)) Clear(); 00066 if ((n >0) && (fNValue != n)) { 00067 Clear(); 00068 fNValue = n; 00069 printf( "allocating %d int in SetValues(int)\n", fNValue ); 00070 fValues = new Int_t [fNValue]; 00071 } 00072 for (j=0;j<n;j++) fValues[j] = v[j]; 00073 }