CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
hcaltb::HcalTBQADCUnpacker Class Reference

#include <HcalTBQADCUnpacker.h>

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.

56 {}

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, mps_fire::i, cuy::ii, N_QADCS_ALLOWED, qdc_gain, qdc_ped, and findQualityFiles::size.

Referenced by HcalTBObjectUnpacker::HcalTBObjectUnpacker().

72  {
73 // The default pedestal and gain
74  for(int i=0;i<N_QADCS_ALLOWED*32;i++)
75  {
76  qdc_ped[i]=0.;qdc_gain[i]=1.;
77  }
78 // Pedestal and gains from configuration file.
79  for(unsigned int ii=0;ii<calibLines_.size();ii++)
80  {
81  if(calibLines_[ii][0]=="QDC")
82  {
83  if(calibLines_[ii].size()==4)
84  {
85  int channel=atoi(calibLines_[ii][1].c_str());
86  qdc_ped[channel]=atof(calibLines_[ii][2].c_str());
87  qdc_gain[channel]=atof(calibLines_[ii][3].c_str());
88  // printf("Got QDC %i ped %f , gain %f\n",channel, qdc_ped[channel],qdc_gain[channel]);
89  }
90  else
91  {
92  throw cms::Exception("Incomplete configuration") <<
93  "Wrong QADC configuration format: expected 3 parameters, got "<<calibLines_[ii].size()-1;
94  }
95  }
96  } // End of calibLines.
97  }
size
Write out results.
ii
Definition: cuy.py:588
static const int N_QADCS_ALLOWED
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, mps_fire::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().

100  {
101 
102  if (raw.size()<3*8) {
103  throw cms::Exception("Missing Data") << "No data in the QDC block";
104  }
105 
106 
107  if(is04){
108  const ClassicQADCDataFormat* qadc=(const ClassicQADCDataFormat*)raw.data();
109  double qdc_calib_hits[N_QADCS_ALLOWED*32];
110  // Applying mask, pedestal subtraction and gain.
111  for (unsigned int i=0;i<N_QADCS_ALLOWED*32;i++)
112  qdc_calib_hits[i]=((qadc->data[i]&0xFFF)-qdc_ped[i])/qdc_gain[i];
113 
114  // Ecal energy sum should go here.
115  double Ecal7x7=0.;
116  for(int i=0;i<49;i++)Ecal7x7+=qdc_calib_hits[i];
117 
118 
119  beamadc.setADCs04(qdc_calib_hits[aMuonV],qdc_calib_hits[aMuonV3],qdc_calib_hits[aMuonV6],
120  qdc_calib_hits[aMuonVH1],qdc_calib_hits[aMuonVH2],qdc_calib_hits[aMuonVH3],
121  qdc_calib_hits[aMuonVH4],qdc_calib_hits[aCerenkov2],qdc_calib_hits[aCerenkov3],
122  qdc_calib_hits[aSCI_VLE],qdc_calib_hits[aSCI_521],qdc_calib_hits[aSCI_528],
123  qdc_calib_hits[aScint1],qdc_calib_hits[aScint2],qdc_calib_hits[aScint3],
124  qdc_calib_hits[aScint4],Ecal7x7);
125  }
126  else{
127  const CombinedTDCQDCDataFormat* qdctdc=(const CombinedTDCQDCDataFormat*)raw.data();
128  double qdc_calib_hits[32];
129  for (unsigned int i=0;i<qdctdc->n_qdc_hits;i++)
130  qdc_calib_hits[i]=((qdctdc->qdc_values[i]&0xFFF)-qdc_ped[i])/qdc_gain[i];
131 
132  beamadc.setADCs06( qdc_calib_hits[bMuonVF], qdc_calib_hits[bMuonVB],
133  qdc_calib_hits[bMuonV1],qdc_calib_hits[bMuonV2],qdc_calib_hits[bMuonV3],
134  qdc_calib_hits[bMuonV4],qdc_calib_hits[bMuonV5],qdc_calib_hits[bMuonV6],
135  qdc_calib_hits[bMuonV7], qdc_calib_hits[bMuonV8],
136  qdc_calib_hits[bCerenkov1], qdc_calib_hits[bCerenkov2], qdc_calib_hits[bCerenkov3],
137  qdc_calib_hits[bScint1], qdc_calib_hits[bScint2],
138  qdc_calib_hits[bScint3], qdc_calib_hits[bScint4],
139  qdc_calib_hits[bTOF1S], qdc_calib_hits[bTOF1J],
140  qdc_calib_hits[bTOF2S], qdc_calib_hits[bTOF2J],
141  qdc_calib_hits[bSCI_521],qdc_calib_hits[bSCI_528],
142  qdc_calib_hits[bVH1],qdc_calib_hits[bVH2],
143  qdc_calib_hits[bVH3],qdc_calib_hits[bVH4]);
144 
145  }
146  }
static const int aSCI_521
static const int aScint4
static const int bMuonV1
static const int aMuonVH2
static const int bTOF1S
static const int aCerenkov2
static const int bVH2
static const int bTOF1J
static const int bCerenkov1
static const int bScint1
static const int bMuonV3
static const int bMuonV2
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static const int bSCI_528
static const int bTOF2J
static const int bVH1
static const int bCerenkov3
static const int aScint1
static const int aMuonV3
static const int bMuonV7
static const int bMuonVB
static const int bScint3
static const int bMuonV4
static const int aMuonVH1
static const int aMuonV6
static const int aCerenkov3
static const int aScint2
static const int bScint2
static const int aScint3
static const int bMuonV6
static const int bMuonV5
unsigned short qdc_values[4]
static const int bSCI_521
static const int bVH3
static const int bMuonV8
static const int bVH4
static const int bCerenkov2
static const int aMuonVH3
static const int aMuonV
void setADCs04(double VMadc, double V3adc, double V6adc, double VH1adc, double VH2adc, double VH3adc, double VH4adc, double CK2adc, double CK3adc, double SciVLEadc, double Sci521adc, double Sci528adc, double S1adc, double S2adc, double S3adc, double S4adc, double Ecal7x7)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
static const int aMuonVH4
static const int aSCI_528
void setADCs06(double VMFadc, double VMBadc, double VM1adc, double VM2adc, double VM3adc, double VM4adc, double VM5adc, double VM6adc, double VM7adc, double VM8adc, double CK1adc, double CK2adc, double CK3adc, double S1adc, double S2adc, double S3adc, double S4adc, double TOF1Sadc, double TOF1Jadc, double TOF2Sadc, double TOF2Jadc, double Sci521adc, double Sci528adc, double BH1adc, double BH2adc, double BH3adc, double BH4adc)
static const int aSCI_VLE
static const int bScint4
static const int bTOF2S
static const int N_QADCS_ALLOWED
static const int bMuonVF

Member Data Documentation

bool hcaltb::HcalTBQADCUnpacker::isTB04_
private

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().