00001 //----------Author's Name:Jean Bourotte, Igor Semeniouk, Patrick Jarry (Windows porting) 00002 //----------Copyright:Those valid for CMS sofware 00003 //----------Modified:8/3/2003 00004 #include <iostream> 00005 #include "IORawData/Ecal2004TBInputService/interface/TRawLaserPulse.h" 00006 using namespace std; 00007 00008 ClassImp(TRawLaserPulse) 00009 //______________________________________________________________________________ 00010 // 00011 // This class has to be used instead of the class TRawAdc2249 when the PN diodes of 00012 //the monitoring are read by sampling ADCs instead of normal 2249 ADCs. 00013 // 00014 TRawLaserPulse::TRawLaserPulse() { 00015 //Default constructor 00016 Init(); 00017 } 00018 00019 TRawLaserPulse::TRawLaserPulse(Int_t ns,Int_t s[]) 00020 // Constructor with setting of everything 00021 { 00022 SetLaserPulse(ns,s); 00023 } 00024 00025 TRawLaserPulse::~TRawLaserPulse() { 00026 if (fSamples) delete [] fSamples; 00027 } 00028 00029 void TRawLaserPulse::Remove() { 00030 if (fSamples) delete [] fSamples; 00031 Init(); 00032 } 00033 00034 Int_t* TRawLaserPulse::GetSamples() { 00035 return fSamples; 00036 } 00037 00038 void TRawLaserPulse::Init() { 00039 //Initialization 00040 fNSample = 0; 00041 fSamples = 0; 00042 } 00043 00044 void TRawLaserPulse::Print() const { 00045 //Prints everything 00046 Int_t j; 00047 cout << endl; 00048 cout << "Nb. of Samples: " << fNSample << endl; 00049 cout << "Samples: "; 00050 for (j=0;j<fNSample;j++) { 00051 cout << " " << fSamples[j]; 00052 if (!(j%8)) { 00053 cout << endl; 00054 cout << "Samples: "; 00055 } 00056 } 00057 cout << endl; 00058 cout << endl; 00059 } 00060 00061 void TRawLaserPulse::SetLaserPulse(Int_t ns,Int_t s[]) { 00062 //Defines the whole class 00063 Short_t j; 00064 if ((ns<=0) && (fNSample != 0)) Remove(); 00065 if ((ns >0) && (fNSample != ns)) { 00066 Remove(); 00067 fNSample = ns; 00068 fSamples = new Int_t [fNSample]; 00069 } 00070 for (j=0;j<ns;j++) fSamples[j] = s[j]; 00071 } 00072 00073