CMS 3D CMS Logo

DCCEETCCBlock.cc

Go to the documentation of this file.
00001 #include "EventFilter/EcalRawToDigiDev/interface/DCCEETCCBlock.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "EventFilter/EcalRawToDigiDev/interface/EcalElectronicsMapper.h"
00004 #include "EventFilter/EcalRawToDigiDev/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_ = mapper_->getEETCCBlockLength();
00011 }
00012 
00013 void DCCEETCCBlock::updateCollectors(){
00014   tps_ = unpacker_->ecalTpsCollection();
00015 }
00016 
00017 
00018 
00019 
00020 void DCCEETCCBlock::addTriggerPrimitivesToCollection(){
00021 
00022   //point to trigger data
00023   data_++;
00024 
00025   uint16_t * tccP_= reinterpret_cast< uint16_t * >(data_);
00026   
00027   for( uint i = 1; i <= expNumbTTs_; i++){
00028 
00029     pTP_ = mapper_->getTPPointer(tccId_,i);
00030 
00031   if(pTP_){
00032 
00033     pTP_ =  mapper_->getTPPointer(tccId_,i);
00034 
00035     for(uint ns = 0; ns<nTSamples_;ns++,tccP_++){
00036       pTP_->setSample(ns, *tccP_ );
00037       (*tps_)->push_back(*pTP_);
00038      }
00039     }else{ break; } //if invalid we dont have more tts
00040          
00041   }
00042 
00043 }
00044 
00045 
00046 bool DCCEETCCBlock::checkTccIdAndNumbTTs(){
00047         
00048         
00049   bool tccFound(false);
00050   int  activeDCC =  mapper_->getActiveSM();
00051   std::vector<uint> * m = mapper_->getTccs(activeDCC);
00052   std::vector<uint>::iterator it;
00053   for(it= m->begin();it!=m->end();it++){
00054     if((*it) == tccId_){ 
00055       tccFound=true;
00056       expNumbTTs_= 28; //separate from inner and outer tcc 
00057         
00058         /*
00059           For inner TCCs you expect 28 TTs (4 in phi, 7 in eta).
00060           For outer TCCs you expect 16 TTs (4 in phi, 4 in eta).
00061         */
00062  
00063         
00064         /*
00065          to implement : map tccid-> number of tts
00066          if( nTTs_ != xxx ){
00067         ostringstream output;
00068         output<<"EcalRawToDigi@SUB=DCCTCCBlock::unpack"
00069           <<"\n Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
00070           <<"\n Number of TTs "<<nTTs_<<" while "<<xxx<<" are expected";
00071         //Note : add to error collection ?               
00072          throw ECALUnpackerException(output.str());
00073        }
00074          */  
00075        break;
00076      }
00077         
00078    }
00079         
00080   if(!tccFound){
00081 
00082     if( ! DCCDataUnpacker::silentMode_ ){
00083       edm::LogWarning("EcalRawToDigiDevTCC") 
00084         <<"\n Error on event "<<event_->l1A()<<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
00085         <<"\n TCC id "<<tccId_<<" is not valid for this dcc "
00086         <<"\n => Skipping to next fed block...";
00087        //todo : add to error collection   
00088      }
00089   }
00090 
00091  return tccFound;
00092 
00093 }
00094 
00095 

Generated on Tue Jun 9 17:34:37 2009 for CMSSW by  doxygen 1.5.4