#include <EventFilter/EcalRawToDigiDev/interface/DCCTowerBlock.h>
Public Member Functions | |
DCCTowerBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack) | |
void | updateCollectors () |
Protected Member Functions | |
void | fillEcalElectronicsError (std::auto_ptr< EcalElectronicsIdCollection > *) |
int | unpackXtalData (uint stripID, uint xtalID) |
Protected Attributes | |
std::auto_ptr< EBDigiCollection > * | digis_ |
std::auto_ptr < EBDetIdCollection > * | invalidChIds_ |
std::auto_ptr < EBDetIdCollection > * | invalidGains_ |
std::auto_ptr < EBDetIdCollection > * | invalidGainsSwitch_ |
EBDetId * | pDetId_ |
Definition at line 22 of file DCCTowerBlock.h.
DCCTowerBlock::DCCTowerBlock | ( | DCCDataUnpacker * | u, | |
EcalElectronicsMapper * | m, | |||
DCCEventBlock * | e, | |||
bool | unpack | |||
) |
void DCCTowerBlock::fillEcalElectronicsError | ( | std::auto_ptr< EcalElectronicsIdCollection > * | errorColection | ) | [protected, virtual] |
Reimplemented from DCCFEBlock.
Definition at line 221 of file DCCTowerBlock.cc.
References DCCDataBlockPrototype::event_, DCCFEBlock::expTowerID_, EcalElectronicsMapper::getActiveSM(), EcalElectronicsMapper::getTTEleIdPointer(), DCCEventBlock::l1A(), DCCDataBlockPrototype::mapper_, NUMB_SM_EB_MIN_MIN, NUMB_SM_EB_PLU_MAX, DCCDataUnpacker::silentMode_, and TCCID_SMID_SHIFT_EB.
00221 { 00222 00223 int activeDCC = mapper_->getActiveSM(); 00224 00225 if(NUMB_SM_EB_MIN_MIN<=activeDCC && activeDCC<=NUMB_SM_EB_PLU_MAX){ 00226 EcalElectronicsId * eleTp = mapper_->getTTEleIdPointer(activeDCC+TCCID_SMID_SHIFT_EB,expTowerID_); 00227 (*errorColection)->push_back(*eleTp); 00228 }else{ 00229 if( ! DCCDataUnpacker::silentMode_ ){ 00230 edm::LogWarning("EcalRawToDigiDevChId") 00231 <<"\n For event "<<event_->l1A()<<" there's fed: "<< activeDCC 00232 <<" activeDcc: "<<mapper_->getActiveSM() 00233 <<" but that activeDcc is not valid in EB."; 00234 } 00235 00236 } 00237 00238 }
int DCCTowerBlock::unpackXtalData | ( | uint | stripID, | |
uint | xtalID | |||
) | [protected, virtual] |
Reimplemented from DCCFEBlock.
Definition at line 28 of file DCCTowerBlock.cc.
References BLOCK_UNPACKED, data, DCCDataBlockPrototype::data_, DCCDataBlockPrototype::event_, EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getDetIdPointer(), i, DCCEventBlock::l1A(), DCCFEBlock::lastStripId_, DCCFEBlock::lastXtalId_, DCCDataBlockPrototype::mapper_, DCCFEBlock::nTSamples_, NUMB_STRIP, NUMB_XTAL, DCCFEBlock::numbDWInXtalBlock_, pDetId_, DCCDataUnpacker::silentMode_, SKIP_BLOCK_UNPACKING, st, TOWER_DIGI_MASK, TOWER_STRIPID_MASK, TOWER_XTALID_B, TOWER_XTALID_MASK, DCCFEBlock::towerId_, DCCFEBlock::xtalGains_, and DCCFEBlock::zs_.
00028 { 00029 00030 bool errorOnXtal(false); 00031 00032 uint16_t * xData_= reinterpret_cast<uint16_t *>(data_); 00033 00034 // Get xtal data ids 00035 uint stripId = (*xData_) & TOWER_STRIPID_MASK; 00036 uint xtalId = ((*xData_)>>TOWER_XTALID_B ) & TOWER_XTALID_MASK; 00037 00038 // check id in case data are not 0suppressed 00039 if( !zs_ && (expStripID != stripId || expXtalID != xtalId)){ 00040 if(! DCCDataUnpacker::silentMode_){ 00041 edm::LogWarning("EcalRawToDigiDevChId") 00042 <<"\n For event L1A: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ 00043 <<"\n The expected strip is "<<expStripID<<" and "<<stripId<<" was found" 00044 <<"\n The expected xtal is "<<expXtalID <<" and "<<xtalId<<" was found"; 00045 } 00046 // using expected cry_di to raise warning about xtal_id problem 00047 pDetId_ = (EBDetId*) mapper_->getDetIdPointer(towerId_,expStripID,expXtalID); 00048 (*invalidChIds_)->push_back(*pDetId_); 00049 00050 stripId = expStripID; 00051 xtalId = expXtalID; 00052 errorOnXtal= true; 00053 00054 // return here, so to skip all following checks 00055 lastXtalId_++; 00056 if (lastXtalId_ > NUMB_XTAL) {lastXtalId_=1; lastStripId_++;} 00057 data_ += numbDWInXtalBlock_; 00058 return BLOCK_UNPACKED; 00059 } 00060 00061 00062 // check id in case of 0suppressed data 00063 00064 else if(zs_){ 00065 00066 // Check for valid Ids 1) values out of range 00067 00068 if(stripId == 0 || stripId > 5 || xtalId == 0 || xtalId > 5){ 00069 if( ! DCCDataUnpacker::silentMode_ ){ 00070 edm::LogWarning("EcalRawToDigiDevChId") 00071 <<"\n For event L1A: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ 00072 <<"\n Invalid strip : "<<stripId<<" or xtal : "<<xtalId 00073 <<" ids ( last strip was: " << lastStripId_ << " last ch was: " << lastXtalId_ << ")"; 00074 } 00075 00076 int st = lastStripId_; 00077 int ch = lastXtalId_; 00078 ch++; 00079 if (ch > NUMB_XTAL) {ch=1; st++;} 00080 if (st > NUMB_STRIP) {ch=1; st=1;} 00081 00082 // adding channel following the last valid 00083 pDetId_ = (EBDetId*) mapper_->getDetIdPointer(towerId_,st,ch); 00084 (*invalidChIds_)->push_back(*pDetId_); 00085 00086 errorOnXtal = true; 00087 00088 lastStripId_ = st; 00089 lastXtalId_ = ch; 00090 00091 // return here, so to skip all following checks 00092 return SKIP_BLOCK_UNPACKING; 00093 00094 }else{ 00095 00096 // Check for zs valid Ids 2) if channel-in-strip has increased wrt previous xtal 00097 00098 00099 // Check for zs valid Ids 2) if channel-in-strip has increased wrt previous xtal 00100 // 3) if strip has increased wrt previous xtal 00101 if( ( stripId == lastStripId_ && xtalId <= lastXtalId_ ) || 00102 (stripId < lastStripId_)) 00103 { 00104 if( ! DCCDataUnpacker::silentMode_ ){ 00105 edm::LogWarning("EcalRawToDigiDevChId") 00106 <<"\n For event L1A: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ 00107 <<"\n Xtal id was expected to increase but it didn't. " 00108 <<"\n Last valid unpacked xtal was "<<lastXtalId_<<" while current xtal is "<<xtalId<<"."; 00109 } 00110 00111 int st = lastStripId_; 00112 int ch = lastXtalId_; 00113 ch++; 00114 if (ch > NUMB_XTAL) {ch=1; st++;} 00115 if (st > NUMB_STRIP) {ch=1; st=1;} 00116 00117 // adding channel following the last valid 00118 pDetId_ = (EBDetId*) mapper_->getDetIdPointer(towerId_,st,ch); 00119 (*invalidChIds_)->push_back(*pDetId_); 00120 00121 errorOnXtal = true; 00122 lastStripId_ = st; 00123 lastXtalId_ = ch; 00124 00125 // return here, so to skip all following checks 00126 return SKIP_BLOCK_UNPACKING; 00127 00128 } 00129 00130 // if channel id not proven wrong, update lastStripId_ and lastXtalId_ 00131 lastStripId_ = stripId; 00132 lastXtalId_ = xtalId; 00133 }//end else 00134 }// end if (zs_) 00135 00136 00137 bool frameAdded=false; 00138 00139 // if there is an error on xtal id ignore next error checks 00140 // otherwise, assume channel_id is valid and proceed with making and checking the data frame 00141 if(errorOnXtal) return SKIP_BLOCK_UNPACKING; 00142 00143 pDetId_ = (EBDetId*) mapper_->getDetIdPointer(towerId_,stripId,xtalId); 00144 (*digis_)->push_back(*pDetId_); 00145 EBDataFrame df( (*digis_)->back() ); 00146 frameAdded=true; 00147 bool wrongGain(false); 00148 00149 //set samples in the frame 00150 for(uint i =0; i< nTSamples_ ;i++){ 00151 xData_++; 00152 uint data = (*xData_) & TOWER_DIGI_MASK; 00153 uint gain = data>>12; 00154 xtalGains_[i]=gain; 00155 if(gain == 0){ 00156 wrongGain = true; 00157 // continue here to skip part of the loop 00158 // as well as add the error to the collection and write the message 00159 break; 00160 } 00161 00162 df.setSample(i,data); 00163 } 00164 00165 00166 if(wrongGain){ 00167 if( ! DCCDataUnpacker::silentMode_ ){ 00168 edm::LogWarning("EcalRawToDigiDevGainZero") 00169 <<"\n For event L1A: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ 00170 <<"\n Gain zero was found in strip "<<stripId<<" and xtal "<<xtalId; 00171 } 00172 00173 (*invalidGains_)->push_back(*pDetId_); 00174 errorOnXtal = true; 00175 00176 //return here, so to skip all the rest 00177 //make special collection for gain0 data frames when due to saturation 00178 //Point to begin of next xtal Block 00179 data_ += numbDWInXtalBlock_; 00180 00181 return BLOCK_UNPACKED; 00182 00183 } 00184 00185 short firstGainWrong=-1; 00186 short numGainWrong=0; 00187 00188 for (uint i=1; i<nTSamples_; i++ ) { 00189 if (i>0 && xtalGains_[i-1]>xtalGains_[i]) { 00190 numGainWrong++; 00191 if (firstGainWrong == -1) { firstGainWrong=i;} 00192 } 00193 } 00194 00195 00196 if (numGainWrong>0) { 00197 if( ! DCCDataUnpacker::silentMode_ ){ 00198 edm::LogWarning("EcalRawToDigiDevGainSwitch") 00199 <<"\n For event L1A: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ 00200 <<"\n A wrong gain transition switch was found in strip "<<stripId<<" and xtal "<<xtalId; 00201 } 00202 00203 (*invalidGainsSwitch_)->push_back(*pDetId_); 00204 00205 errorOnXtal = true; 00206 } 00207 00208 //Add frame to collection only if all data format and gain rules are respected 00209 if(errorOnXtal&&frameAdded) { 00210 (*digis_)->pop_back(); 00211 } 00212 00213 //Point to begin of next xtal Block 00214 data_ += numbDWInXtalBlock_; 00215 00216 return BLOCK_UNPACKED; 00217 }
void DCCTowerBlock::updateCollectors | ( | ) | [virtual] |
Reimplemented from DCCFEBlock.
Definition at line 13 of file DCCTowerBlock.cc.
References digis_, DCCDataUnpacker::ebDigisCollection(), invalidChIds_, DCCDataUnpacker::invalidChIdsCollection(), invalidGains_, DCCDataUnpacker::invalidGainsCollection(), invalidGainsSwitch_, DCCDataUnpacker::invalidGainsSwitchCollection(), DCCDataBlockPrototype::unpacker_, and DCCFEBlock::updateCollectors().
00013 { 00014 00015 DCCFEBlock::updateCollectors(); 00016 00017 // needs to be update for eb/ee 00018 digis_ = unpacker_->ebDigisCollection(); 00019 00020 invalidGains_ = unpacker_->invalidGainsCollection(); 00021 invalidGainsSwitch_ = unpacker_->invalidGainsSwitchCollection(); 00022 invalidChIds_ = unpacker_->invalidChIdsCollection(); 00023 00024 }
std::auto_ptr<EBDigiCollection>* DCCTowerBlock::digis_ [protected] |
std::auto_ptr<EBDetIdCollection>* DCCTowerBlock::invalidChIds_ [protected] |
std::auto_ptr<EBDetIdCollection>* DCCTowerBlock::invalidGains_ [protected] |
std::auto_ptr<EBDetIdCollection>* DCCTowerBlock::invalidGainsSwitch_ [protected] |
EBDetId* DCCTowerBlock::pDetId_ [protected] |