CMS 3D CMS Logo

Public Member Functions | Private Attributes

hcaltb::HcalTBQADCUnpacker Class Reference

#include <HcalTBQADCUnpacker.h>

List of all members.

Public Member Functions

 HcalTBQADCUnpacker ()
void setCalib (const std::vector< std::vector< std::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 7 of file HcalTBQADCUnpacker.h.


Constructor & Destructor Documentation

hcaltb::HcalTBQADCUnpacker::HcalTBQADCUnpacker ( )

Definition at line 56 of file HcalTBQADCUnpacker.cc.

{}

Member Function Documentation

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

Definition at line 72 of file HcalTBQADCUnpacker.cc.

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

Referenced by HcalTBObjectUnpacker::HcalTBObjectUnpacker().

                                                                                     {
// The default pedestal and gain
        for(int i=0;i<N_QADCS_ALLOWED*32;i++)
         {
          qdc_ped[i]=0.;qdc_gain[i]=1.;
         }
// Pedestal and gains from configuration file.
        for(unsigned int ii=0;ii<calibLines_.size();ii++)
         {
          if(calibLines_[ii][0]=="QDC")
                {
                if(calibLines_[ii].size()==4)
                  {
                  int channel=atoi(calibLines_[ii][1].c_str());
                  qdc_ped[channel]=atof(calibLines_[ii][2].c_str());
                  qdc_gain[channel]=atof(calibLines_[ii][3].c_str());
        //        printf("Got QDC %i ped %f , gain %f\n",channel, qdc_ped[channel],qdc_gain[channel]);
                  }
                 else
                  {
                  throw cms::Exception("Incomplete configuration") << 
                  "Wrong QADC configuration format: expected 3 parameters, got "<<calibLines_[ii].size()-1;
                  }
                }
         } // End of calibLines.
        }
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().

                                                                             {

  if (raw.size()<3*8) {
    throw cms::Exception("Missing Data") << "No data in the QDC block";
  }


  if(is04){ 
    const ClassicQADCDataFormat* qadc=(const ClassicQADCDataFormat*)raw.data();
    double qdc_calib_hits[N_QADCS_ALLOWED*32];
    // Applying mask, pedestal subtraction and gain.
        for (unsigned int i=0;i<N_QADCS_ALLOWED*32;i++)
          qdc_calib_hits[i]=((qadc->data[i]&0xFFF)-qdc_ped[i])/qdc_gain[i];

    // Ecal energy sum should go here.
        double Ecal7x7=0.;
        for(int i=0;i<49;i++)Ecal7x7+=qdc_calib_hits[i];


    beamadc.setADCs04(qdc_calib_hits[aMuonV],qdc_calib_hits[aMuonV3],qdc_calib_hits[aMuonV6],
                    qdc_calib_hits[aMuonVH1],qdc_calib_hits[aMuonVH2],qdc_calib_hits[aMuonVH3],
                    qdc_calib_hits[aMuonVH4],qdc_calib_hits[aCerenkov2],qdc_calib_hits[aCerenkov3],
                    qdc_calib_hits[aSCI_VLE],qdc_calib_hits[aSCI_521],qdc_calib_hits[aSCI_528],
                    qdc_calib_hits[aScint1],qdc_calib_hits[aScint2],qdc_calib_hits[aScint3],
                    qdc_calib_hits[aScint4],Ecal7x7);
       }
  else{ 
    const CombinedTDCQDCDataFormat* qdctdc=(const CombinedTDCQDCDataFormat*)raw.data();
    double qdc_calib_hits[32];
        for (unsigned int i=0;i<qdctdc->n_qdc_hits;i++)
          qdc_calib_hits[i]=((qdctdc->qdc_values[i]&0xFFF)-qdc_ped[i])/qdc_gain[i];

    beamadc.setADCs06( qdc_calib_hits[bMuonVF], qdc_calib_hits[bMuonVB],
                    qdc_calib_hits[bMuonV1],qdc_calib_hits[bMuonV2],qdc_calib_hits[bMuonV3], 
                    qdc_calib_hits[bMuonV4],qdc_calib_hits[bMuonV5],qdc_calib_hits[bMuonV6], 
                    qdc_calib_hits[bMuonV7], qdc_calib_hits[bMuonV8],
                    qdc_calib_hits[bCerenkov1], qdc_calib_hits[bCerenkov2], qdc_calib_hits[bCerenkov3],
                    qdc_calib_hits[bScint1], qdc_calib_hits[bScint2], 
                    qdc_calib_hits[bScint3], qdc_calib_hits[bScint4],
                    qdc_calib_hits[bTOF1S], qdc_calib_hits[bTOF1J],
                    qdc_calib_hits[bTOF2S], qdc_calib_hits[bTOF2J],
                    qdc_calib_hits[bSCI_521],qdc_calib_hits[bSCI_528],
                    qdc_calib_hits[bVH1],qdc_calib_hits[bVH2],
                    qdc_calib_hits[bVH3],qdc_calib_hits[bVH4]);

       }
 }

Member Data Documentation

Definition at line 14 of file HcalTBQADCUnpacker.h.

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

Definition at line 16 of file HcalTBQADCUnpacker.h.

Referenced by setCalib(), and unpack().

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

Definition at line 15 of file HcalTBQADCUnpacker.h.

Referenced by setCalib(), and unpack().