Go to the documentation of this file.00001 #include "EventFilter/EcalRawToDigi/interface/DCCEETCCBlock.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h"
00004 #include "EventFilter/EcalRawToDigi/interface/DCCDataUnpacker.h"
00005
00006
00007 DCCEETCCBlock::DCCEETCCBlock ( DCCDataUnpacker * u,EcalElectronicsMapper * m, DCCEventBlock * e, bool unpack) :
00008 DCCTCCBlock(u,m,e,unpack)
00009 {
00010 blockLength_ = 0;
00011
00012 }
00013
00014 void DCCEETCCBlock::updateCollectors(){
00015 tps_ = unpacker_->ecalTpsCollection();
00016 pss_ = unpacker_->ecalPSsCollection();
00017 }
00018
00019 void DCCEETCCBlock::addTriggerPrimitivesToCollection(){
00020
00021
00022 data_++;
00023
00024 bool processTPG2(true) ;
00025 unsigned int psInputCounter(0);
00026
00027 uint16_t * tccP_= reinterpret_cast< uint16_t * >(data_);
00028
00029
00030 int dccFOV = event_->fov();
00031 if (! (dccFOV==dcc_FOV_0 || dccFOV==dcc_FOV_1 || dccFOV==dcc_FOV_2) ){
00032 if( ! DCCDataUnpacker::silentMode_ ){
00033 edm::LogWarning("IncorrectEvent")
00034 <<"\n FOV value in data is: " << dccFOV <<
00035 "At event: " <<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
00036 <<"\n TCC id "<<tccId_<<" FOV "<< dccFOV << " which is not a foreseen value. Setting it to: " << dcc_FOV_2;
00037 }
00038 dccFOV=dcc_FOV_2;
00039 }
00040
00041
00043
00044
00045 if (dccFOV == dcc_FOV_0)
00046 {
00047
00048
00049 if(ps_){
00050 for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
00051 pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
00052 if(!pPS_) continue;
00053 pPS_->setSampleValue(0, *tccP_ );
00054 (*pss_)->push_back(*pPS_);
00055 }
00056 }
00057
00058
00059
00060 for(unsigned int i = 1; i<= NUMB_TTS_TPG1; i++, tccP_++){
00061
00062 if( i<= nTTs_){
00063 pTP_ = mapper_->getTPPointer(tccId_,i);
00064 if(pTP_) pTP_->setSample(0, *tccP_ );
00065 }else {
00066 processTPG2 = false;
00067 break;
00068 }
00069
00070 (*tps_)->push_back(*pTP_);
00071 }
00072
00073
00074 if(processTPG2){
00075
00076
00077 if(ps_){
00078 for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
00079 if (i<=NUMB_TTS_TPG2_DUPL) continue;
00080
00081 pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
00082 if(!pPS_) continue;
00083 pPS_->setSampleValue(0, *tccP_ );
00084 (*pss_)->push_back(*pPS_);
00085 }
00086 }
00087
00088
00089
00090 for(unsigned int i = 1; i<= NUMB_TTS_TPG2; i++, tccP_++){
00091 unsigned int tt = i+NUMB_TTS_TPG1;
00092
00093 if( tt <= nTTs_){
00094 pTP_ = mapper_->getTPPointer(tccId_,tt);
00095 if(pTP_) pTP_->setSample(0, *tccP_ );
00096 }
00097 else break;
00098
00099 (*tps_)->push_back(*pTP_);
00100 }
00101
00102 }
00103
00104 }
00105
00107
00108 else if (dccFOV == dcc_FOV_1 || dccFOV == dcc_FOV_2)
00109 {
00110
00111
00112 if(ps_){
00113 for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
00114 pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
00115 if(!pPS_) continue;
00116 pPS_->setSampleValue(0, *tccP_ );
00117 (*pss_)->push_back(*pPS_);
00118 }
00119 }
00120
00121 int offset(0);
00122
00123
00124 for(unsigned int i = 1; i<= NUMB_TTS_TPG1; i++, tccP_++){
00125
00126 if( i<= nTTs_){
00127 if(mapper_->isTCCExternal(tccId_)){
00128 if(i>8 && i<=16 ) continue;
00129 if(i>8 ) offset=8;
00130 if(i>24 ) continue;
00131 }
00132
00133 pTP_ = mapper_->getTPPointer(tccId_,i-offset);
00134 if(pTP_) pTP_->setSample(0, *tccP_ );
00135
00136 }else {
00137 processTPG2 = false;
00138 break;
00139 }
00140
00141 (*tps_)->push_back(*pTP_);
00142 }
00143
00144 if(processTPG2){
00145
00146
00147 if(ps_){
00148 for(unsigned int i = 1; i<= NUMB_PSEUDOSTRIPS; i++, tccP_++, psInputCounter++){
00149 if (i<=NUMB_TTS_TPG2_DUPL) continue;
00150
00151 pPS_= mapper_->getPSInputDigiPointer(tccId_,psInputCounter);
00152 if(!pPS_) continue;
00153 pPS_->setSampleValue(0, *tccP_ );
00154 (*pss_)->push_back(*pPS_);
00155 }
00156 }
00157
00158
00159
00160 for(unsigned int i = 1; i<= NUMB_TTS_TPG2; i++, tccP_++){
00161 unsigned int tt = i+NUMB_TTS_TPG1;
00162
00163 if( i<= nTTs_){
00164 if(mapper_->isTCCExternal(tccId_)){
00165 if(tt>8 && tt<=16 ) continue;
00166 if(tt>8 ) offset=8;
00167 if(tt>24 ) continue;
00168 }
00169
00170 pTP_ = mapper_->getTPPointer(tccId_,tt-offset);
00171 if(pTP_) pTP_->setSample(0, *tccP_ );
00172 }
00173 else break;
00174
00175 (*tps_)->push_back(*pTP_);
00176 }
00177 }
00178 }
00179 }
00180
00181
00182 bool DCCEETCCBlock::checkTccIdAndNumbTTs(){
00183
00184
00185 bool tccFound(false);
00186 bool errorOnNumbOfTTs(false);
00187 const int activeDCC = mapper_->getActiveSM();
00188 std::vector<unsigned int> * m = mapper_->getTccs(activeDCC);
00189 std::vector<unsigned int>::iterator it;
00190 for(it= m->begin();it!=m->end();it++){
00191 if((*it) == tccId_){
00192 tccFound=true;
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 if( nTTs_ != 28 && nTTs_ !=16 ){
00208 if( ! DCCDataUnpacker::silentMode_ ){
00209 edm::LogWarning("IncorrectBlock")
00210 <<"Error on event "<<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
00211 <<"\n TCC id "<<tccId_<<" has "<<nTTs_<<" Trigger Towers (only 28 or 16 are the expected values in EE)"
00212 <<"\n => Skipping to next fed block...";
00213 errorOnNumbOfTTs = true;
00214
00215 }
00216 }
00217 }
00218 }
00219
00220 if(!tccFound){
00221
00222 if( ! DCCDataUnpacker::silentMode_ ){
00223 edm::LogWarning("IncorrectBlock")
00224 <<"Error on event "<<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
00225 <<"\n TCC id "<<tccId_<<" is not valid for this dcc "
00226 <<"\n => Skipping to next fed block...";
00227
00228 }
00229 }
00230
00231
00232 return (tccFound || errorOnNumbOfTTs);
00233
00234 }
00235
00236
00237 unsigned int DCCEETCCBlock::getLength(){
00238
00239 uint64_t * temp = data_;
00240 temp++;
00241
00242 ps_ = ( *temp>>TCC_PS_B ) & B_MASK;
00243
00244 unsigned int numbTps = (NUMB_TTS_TPG1 + NUMB_TTS_TPG2);
00245 if(ps_){ numbTps += 2*NUMB_PSEUDOSTRIPS;}
00246
00247 unsigned int length = numbTps/4 + 2;
00248 if(numbTps%4) length++ ;
00249
00250
00251 return length;
00252
00253 }
00254
00255