CMS 3D CMS Logo

TRawPn.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:8/3/2003
00004 #include <iostream>
00005 #include "IORawData/Ecal2004TBInputService/interface/TRawPn.h"
00006 
00007 using namespace std;
00008 
00009 ClassImp(TRawPn)
00010 //______________________________________________________________________________
00011 //
00012 // This class has to be used instead of the class TRawAdc2249 when the PN diodes of
00013 //the monitoring are read by sampling ADCs instead of normal 2249 ADCs.
00014 //
00015 Int_t TRawPn::fgNPns = 10;
00016 
00017 TRawPn::TRawPn() {
00018 //Default constructor
00019   Init();
00020 }
00021 TRawPn::TRawPn(Int_t n) {
00022 //Constructor with Pn numb
00023   Init();
00024   fN = n;
00025 }
00026 TRawPn::TRawPn(Int_t n,Int_t ns,Int_t s[])
00027 // Constructor with setting of everything
00028 {
00029   fN = n;
00030   SetPn(ns,s);
00031   fVInj = 0;
00032 }
00033 TRawPn::~TRawPn() {
00034   if (fSamples) delete [] fSamples;
00035 }
00036 void TRawPn::Remove() {
00037   if (fSamples) delete [] fSamples;
00038   Init();
00039 }
00040 Int_t* TRawPn::GetSamples(Int_t &n) {
00041 //Give access to coefficients of polynom and their number
00042   n = fNSample;
00043   return fSamples;
00044 }
00045 void TRawPn::Init() {
00046 //Initialization
00047   fN         = -1;
00048   fNSample = 0;
00049   fSamples = 0;
00050 }
00051 void TRawPn::Print(const char *opt) const {
00052 //Prints everything
00053   Int_t j;
00054   cout << endl;
00055   cout << "Pn number     : " << fN << endl;
00056   cout << "Nb. of Samples: " << fNSample << endl;
00057   cout << "Samples: ";
00058   for (j=0;j<fNSample;j++) {
00059     cout << "  " << fSamples[j];
00060     if (!(j%8)) {
00061       cout << endl;
00062       cout << "Samples: ";
00063     }
00064   }
00065   cout << endl;
00066   cout << endl;
00067 }
00068 void TRawPn::SetPn(Int_t ns,Int_t s[]) {
00069 //Defines the whole class
00070   Short_t j;
00071   if ((ns<=0) && (fNSample != 0)) Remove();
00072   if ((ns >0) && (fNSample != ns)) {
00073     Remove();
00074     fNSample = ns;
00075     fSamples = new Int_t [fNSample];
00076   }
00077   for (j=0;j<ns;j++) fSamples[j] = s[j];
00078 }
00079 
00080 

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