CMS 3D CMS Logo

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

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