CMS 3D CMS Logo

TRawCrystal.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/1/2003
00004 #include <iostream>
00005 #include "IORawData/Ecal2004TBInputService/interface/TRawCrystal.h"
00006 
00007 using namespace std;
00008 
00009 ClassImp(TRawCrystal)
00010 //______________________________________________________________________________
00011 //
00012 //  Crystal raw data from sampling adc
00013 //
00014 //  fHeaders : To know version of ROSE modules used and other things
00015 //                 for DAQ experts
00016 //  fSamples : values of the sampling ADC
00017 //
00018 Int_t TRawCrystal::fgNSamplesCrystal = 10;
00019 
00020 TRawCrystal::TRawCrystal() {
00021 //Default constructor
00022   //printf( "TRawCrystal::TRawCrystal()\n" );
00023   Init();
00024 }
00025 TRawCrystal::TRawCrystal( Int_t h, Int_t s[] ){
00026 //Constructor arguments:
00027 //
00028 // (1) - h    : for fHeader
00029 // (2) - s    : values of the ns samplings
00030 //
00031   //printf( "TRawCrystal::TRawCrystal( Int_t h, Int_t s[] )\n" );
00032   SetCrystalRaw( h, s );
00033 }
00034 TRawCrystal::~TRawCrystal() {
00035   Clear();
00036 }
00037 void TRawCrystal::Clear(const char *opt) {
00038   if (fSamples) delete [] fSamples;
00039   Init();
00040 }
00041 void TRawCrystal::Init() {
00042 //Everything to 0
00043   fHeader  = 0;
00044   fNSample = 0;
00045   fSamples = 0;
00046 }
00047 void TRawCrystal::Print(const char *opt) const {
00048 //Prints the whole class
00049   Short_t j;
00050   cout << endl;
00051 
00052   cout << "TCrystal fHeader       : ";
00053   cout << fHeader << "  ";
00054   cout << endl;
00055   cout << "Nb. of Samples : " << fNSample << endl;
00056   cout << "TCrystal Samples: ";
00057   for (j=0;j<fgNSamplesCrystal;j++) {
00058     cout << "  ";
00059     cout.width(12);
00060     cout << fSamples[j];
00061     if (!((j+1)%6)) {
00062       cout << endl;
00063       cout << "TCrystal Samples: ";
00064     }
00065   }
00066   cout << endl;
00067   cout << endl;
00068 }
00069 void TRawCrystal::SetCrystalRaw( Int_t h, Int_t s[] ) {
00070 //Arguments:
00071 //
00072 // (1) - h    : for fHeaders
00073 // (2) - s    : values of the ns samplings
00074 //
00075   Short_t j;
00076   // Int_t ns = ( h & 0xff0 ) >> 4;
00077   Int_t ns = ( h & 0xff0 ) >> 8;
00078   if (ns>fgNSamplesCrystal) ns = fgNSamplesCrystal;
00079   fHeader = h;
00080   if ((ns<=0) && (fNSample != 0)) Clear();
00081   if ((ns >0) && (fNSample != ns)) {
00082     Clear();
00083     fNSample = ns;
00084     fSamples = new Int_t [fNSample];
00085   }
00086   for (j=0;j<ns;j++) fSamples[j] = s[j];
00087 }
00088 

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