CMS 3D CMS Logo

hcaltb::HcalTBQADCUnpacker Class Reference

#include <RecoTBCalo/HcalTBObjectUnpacker/interface/HcalTBQADCUnpacker.h>

List of all members.

Public Member Functions

 HcalTBQADCUnpacker ()
void setCalib (const vector< vector< string > > &calibLines_)
void unpack (const FEDRawData &raw, HcalTBBeamCounters &beamadc, bool is04_=true) const

Private Attributes

bool isTB04_
double qdc_gain [192]
double qdc_ped [192]


Detailed Description

Definition at line 8 of file HcalTBQADCUnpacker.h.


Constructor & Destructor Documentation

hcaltb::HcalTBQADCUnpacker::HcalTBQADCUnpacker (  ) 

Definition at line 56 of file HcalTBQADCUnpacker.cc.

00056 {}


Member Function Documentation

void hcaltb::HcalTBQADCUnpacker::setCalib ( const vector< vector< string > > &  calibLines_  ) 

Definition at line 72 of file HcalTBQADCUnpacker.cc.

References Exception, i, N_QADCS_ALLOWED, qdc_gain, qdc_ped, and size.

Referenced by HcalTBObjectUnpacker::HcalTBObjectUnpacker().

00072                                                                             {
00073 // The default pedestal and gain
00074         for(int i=0;i<N_QADCS_ALLOWED*32;i++)
00075          {
00076           qdc_ped[i]=0.;qdc_gain[i]=1.;
00077          }
00078 // Pedestal and gains from configuration file.
00079         for(unsigned int ii=0;ii<calibLines_.size();ii++)
00080          {
00081           if(calibLines_[ii][0]=="QDC")
00082                 {
00083                 if(calibLines_[ii].size()==4)
00084                   {
00085                   int channel=atoi(calibLines_[ii][1].c_str());
00086                   qdc_ped[channel]=atof(calibLines_[ii][2].c_str());
00087                   qdc_gain[channel]=atof(calibLines_[ii][3].c_str());
00088         //        printf("Got QDC %i ped %f , gain %f\n",channel, qdc_ped[channel],qdc_gain[channel]);
00089                   }
00090                  else
00091                   {
00092                   throw cms::Exception("Incomplete configuration") << 
00093                   "Wrong QADC configuration format: expected 3 parameters, got "<<calibLines_[ii].size()-1;
00094                   }
00095                 }
00096          } // End of calibLines.
00097         }

void hcaltb::HcalTBQADCUnpacker::unpack ( const FEDRawData raw,
HcalTBBeamCounters beamadc,
bool  is04_ = true 
) const

this is TB04

this is TB06

Definition at line 99 of file HcalTBQADCUnpacker.cc.

References aCerenkov2, aCerenkov3, aMuonV, aMuonV3, aMuonV6, aMuonVH1, aMuonVH2, aMuonVH3, aMuonVH4, aSCI_521, aSCI_528, aSCI_VLE, aScint1, aScint2, aScint3, aScint4, bCerenkov1, bCerenkov2, bCerenkov3, bMuonV1, bMuonV2, bMuonV3, bMuonV4, bMuonV5, bMuonV6, bMuonV7, bMuonV8, bMuonVB, bMuonVF, bSCI_521, bSCI_528, bScint1, bScint2, bScint3, bScint4, bTOF1J, bTOF1S, bTOF2J, bTOF2S, bVH1, bVH2, bVH3, bVH4, FEDRawData::data(), hcaltb::ClassicQADCDataFormat::data, Exception, i, N_QADCS_ALLOWED, hcaltb::CombinedTDCQDCDataFormat::n_qdc_hits, qdc_gain, qdc_ped, hcaltb::CombinedTDCQDCDataFormat::qdc_values, HcalTBBeamCounters::setADCs04(), HcalTBBeamCounters::setADCs06(), and FEDRawData::size().

Referenced by HcalTBObjectUnpacker::produce().

00100                                                                              {
00101 
00102   if (raw.size()<3*8) {
00103     throw cms::Exception("Missing Data") << "No data in the QDC block";
00104   }
00105 
00106 
00107   if(is04){ 
00108     const ClassicQADCDataFormat* qadc=(const ClassicQADCDataFormat*)raw.data();
00109     double qdc_calib_hits[N_QADCS_ALLOWED*32];
00110     // Applying mask, pedestal subtraction and gain.
00111         for (unsigned int i=0;i<N_QADCS_ALLOWED*32;i++)
00112           qdc_calib_hits[i]=((qadc->data[i]&0xFFF)-qdc_ped[i])/qdc_gain[i];
00113 
00114     // Ecal energy sum should go here.
00115         double Ecal7x7=0.;
00116         for(int i=0;i<49;i++)Ecal7x7+=qdc_calib_hits[i];
00117 
00118 
00119     beamadc.setADCs04(qdc_calib_hits[aMuonV],qdc_calib_hits[aMuonV3],qdc_calib_hits[aMuonV6],
00120                     qdc_calib_hits[aMuonVH1],qdc_calib_hits[aMuonVH2],qdc_calib_hits[aMuonVH3],
00121                     qdc_calib_hits[aMuonVH4],qdc_calib_hits[aCerenkov2],qdc_calib_hits[aCerenkov3],
00122                     qdc_calib_hits[aSCI_VLE],qdc_calib_hits[aSCI_521],qdc_calib_hits[aSCI_528],
00123                     qdc_calib_hits[aScint1],qdc_calib_hits[aScint2],qdc_calib_hits[aScint3],
00124                     qdc_calib_hits[aScint4],Ecal7x7);
00125        }
00126   else{ 
00127     const CombinedTDCQDCDataFormat* qdctdc=(const CombinedTDCQDCDataFormat*)raw.data();
00128     double qdc_calib_hits[32];
00129         for (unsigned int i=0;i<qdctdc->n_qdc_hits;i++)
00130           qdc_calib_hits[i]=((qdctdc->qdc_values[i]&0xFFF)-qdc_ped[i])/qdc_gain[i];
00131 
00132     beamadc.setADCs06( qdc_calib_hits[bMuonVF], qdc_calib_hits[bMuonVB],
00133                     qdc_calib_hits[bMuonV1],qdc_calib_hits[bMuonV2],qdc_calib_hits[bMuonV3], 
00134                     qdc_calib_hits[bMuonV4],qdc_calib_hits[bMuonV5],qdc_calib_hits[bMuonV6], 
00135                     qdc_calib_hits[bMuonV7], qdc_calib_hits[bMuonV8],
00136                     qdc_calib_hits[bCerenkov1], qdc_calib_hits[bCerenkov2], qdc_calib_hits[bCerenkov3],
00137                     qdc_calib_hits[bScint1], qdc_calib_hits[bScint2], 
00138                     qdc_calib_hits[bScint3], qdc_calib_hits[bScint4],
00139                     qdc_calib_hits[bTOF1S], qdc_calib_hits[bTOF1J],
00140                     qdc_calib_hits[bTOF2S], qdc_calib_hits[bTOF2J],
00141                     qdc_calib_hits[bSCI_521],qdc_calib_hits[bSCI_528],
00142                     qdc_calib_hits[bVH1],qdc_calib_hits[bVH2],
00143                     qdc_calib_hits[bVH3],qdc_calib_hits[bVH4]);
00144 
00145        }
00146  }


Member Data Documentation

bool hcaltb::HcalTBQADCUnpacker::isTB04_ [private]

Definition at line 15 of file HcalTBQADCUnpacker.h.

double hcaltb::HcalTBQADCUnpacker::qdc_gain[192] [private]

Definition at line 17 of file HcalTBQADCUnpacker.h.

Referenced by setCalib(), and unpack().

double hcaltb::HcalTBQADCUnpacker::qdc_ped[192] [private]

Definition at line 16 of file HcalTBQADCUnpacker.h.

Referenced by setCalib(), and unpack().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:47:25 2009 for CMSSW by  doxygen 1.5.4