CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends

EcalElectronicsMapper Class Reference

#include <EcalElectronicsMapper.h>

List of all members.

Public Types

enum  SMGeom_t {
  kModules = 4, kTriggerTowers = 68, kTowersInPhi = 4, kTowersInEta = 17,
  kCrystals = 1700, kPns = 10, kCrystalsInPhi = 20, kCrystalsInEta = 85,
  kCrystalsPerTower = 25, kCardsPerTower = 5, kChannelsPerCard = 5, TTMAPMASK = 100
}

Public Member Functions

void deletePointers ()
 EcalElectronicsMapper (unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples)
unsigned int getActiveDCC ()
unsigned int getActiveSM ()
unsigned int getDCCId (unsigned int aSMId) const
const std::map< unsigned int,unsigned
int > & 
getDCCMap () const
std::string getDCCMapFilePath () const
DetIdgetDetIdPointer (unsigned int feChannel, unsigned int strip, unsigned int xtal)
unsigned int getEBTCCBlockLength ()
unsigned int getEETCCBlockLength ()
unsigned int getNumChannelsInDcc (unsigned int aDCCId)
EcalPseudoStripInputDigigetPSInputDigiPointer (unsigned int tccId, unsigned int towerId, unsigned int psId)
EcalPseudoStripInputDigigetPSInputDigiPointer (unsigned int tccId, unsigned int psCounter)
EcalScDetIdgetSCDetIdPointer (unsigned int smId, unsigned int feChannel)
EcalElectronicsIdgetSCElectronicsPointer (unsigned int smId, unsigned int feChannel)
unsigned int getSMId (unsigned int aDCCId) const
std::vector< EcalSrFlag * > getSrFlagPointer (unsigned int feChannel)
unsigned int getSRPBlockLength ()
std::vector< unsigned int > * getTccs (unsigned int smId)
EcalTriggerPrimitiveDigigetTPPointer (unsigned int tccId, unsigned int tower)
EcalTrigTowerDetIdgetTTDetIdPointer (unsigned int tccId, unsigned int tower)
EcalElectronicsIdgetTTEleIdPointer (unsigned int tccId, unsigned int tower)
unsigned int getUnfilteredTowerBlockLength ()
bool isTCCExternal (unsigned int TCCId)
bool makeMapFromVectors (std::vector< int > &, std::vector< int > &)
const EcalElectronicsMappingmapping ()
unsigned int numbTriggerTSamples ()
unsigned int numbXtalTSamples ()
void resetPointers ()
bool setActiveDCC (unsigned int dccId)
bool setDCCMapFilePath (std::string)
void setEcalElectronicsMapping (const EcalElectronicsMapping *)
 ~EcalElectronicsMapper ()

Private Member Functions

unsigned int computeEBTCCBlockLength ()
unsigned int computeEETCCBlockLength ()
unsigned int computeUnfilteredFEBlockLength ()
void fillMaps ()

Private Attributes

unsigned int dccId_
unsigned int ebTccBlockLength_
unsigned int eeTccBlockLength_
const EcalElectronicsMappingmappingBuilder_
std::map< unsigned int,
std::vector< unsigned int > * > 
mapSmIdToTccIds_
std::map< unsigned int,
unsigned int > 
myDCCMap_
unsigned int numbTriggerTSamples_
unsigned int numbXtalTSamples_
std::string pathToMapFile_
EcalPseudoStripInputDigipsInput_ [NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP]
EcalScDetIdscDetIds_ [NUMB_SM][NUMB_FE]
EcalElectronicsIdscEleIds_ [NUMB_SM][NUMB_FE]
unsigned int smId_
std::vector< EcalSrFlag * > srFlags_ [NUMB_SM][NUMB_FE]
unsigned int srpBlockLength_
short tTandPs_ [NUMB_TCC][5 *EcalTrigTowerDetId::kEBTowersPerSM][2]
EcalTrigTowerDetIdttDetIds_ [NUMB_TCC][NUMB_FE]
EcalElectronicsIdttEleIds_ [NUMB_TCC][NUMB_FE]
EcalTriggerPrimitiveDigittTPIds_ [NUMB_TCC][NUMB_FE]
unsigned int unfilteredFEBlockLength_
DetIdxtalDetIds_ [NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL]

Static Private Attributes

static const unsigned int numChannelsInDcc_ [NUMB_SM]

Friends

std::ostream & operator<< (std::ostream &o, const EcalElectronicsMapper &aEcalElectronicsMapper)

Detailed Description

Definition at line 41 of file EcalElectronicsMapper.h.


Member Enumeration Documentation

Enumerator:
kModules 
kTriggerTowers 
kTowersInPhi 
kTowersInEta 
kCrystals 
kPns 
kCrystalsInPhi 
kCrystalsInEta 
kCrystalsPerTower 
kCardsPerTower 
kChannelsPerCard 
TTMAPMASK 

Definition at line 158 of file EcalElectronicsMapper.h.

                {
    kModules = 4,           // Number of modules per supermodule
    kTriggerTowers = 68,    // Number of trigger towers per supermodule
    kTowersInPhi = 4,       // Number of trigger towers in phi
    kTowersInEta = 17,      // Number of trigger towers in eta
    kCrystals = 1700,       // Number of crystals per supermodule
    kPns = 10,              // Number of PN laser monitoring diodes per supermodule
    kCrystalsInPhi = 20,    // Number of crystals in phi
    kCrystalsInEta = 85,    // Number of crystals in eta
    kCrystalsPerTower = 25, // Number of crystals per trigger tower
    kCardsPerTower = 5,     // Number of VFE cards per trigger tower
    kChannelsPerCard = 5,   // Number of channels per VFE card
    TTMAPMASK = 100
  };

Constructor & Destructor Documentation

EcalElectronicsMapper::EcalElectronicsMapper ( unsigned int  numbOfXtalTSamples,
unsigned int  numbOfTriggerTSamples 
)
EcalElectronicsMapper::~EcalElectronicsMapper ( )

Destructor

Definition at line 148 of file EcalElectronicsMapper.cc.

References deletePointers().


Member Function Documentation

unsigned int EcalElectronicsMapper::computeEBTCCBlockLength ( ) [private]

Definition at line 349 of file EcalElectronicsMapper.cc.

References nTT, numbTriggerTSamples_, and tests::test_DownloadDQM::tf.

Referenced by resetPointers().

                                                           {

  unsigned int nTT=68;
  unsigned int tf;
          
  //TCC block size: header (8 bytes) + 17 words with 4 trigger primitives (17*8bytes)
  if( (nTT*numbTriggerTSamples_)<4 || (nTT*numbTriggerTSamples_)%4 ) tf=1;  
  else tf=0;
    
  return 1 + ((nTT*numbTriggerTSamples_)/4) + tf ;

}
unsigned int EcalElectronicsMapper::computeEETCCBlockLength ( ) [private]

Definition at line 362 of file EcalElectronicsMapper.cc.

Referenced by resetPointers().

                                                           {
  //Todo : implement multiple tt samples for the endcap
  return 9;  

}
unsigned int EcalElectronicsMapper::computeUnfilteredFEBlockLength ( ) [private]

Definition at line 342 of file EcalElectronicsMapper.cc.

References numbXtalTSamples_.

Referenced by resetPointers().

                                                                  {

  return ((numbXtalTSamples_-2)/4+1)*25+1; 

}
void EcalElectronicsMapper::deletePointers ( )

Definition at line 152 of file EcalElectronicsMapper.cc.

References i, mapSmIdToTccIds_, NUMB_FE, NUMB_SM, NUMB_STRIP, NUMB_TCC, NUMB_XTAL, pathToMapFile_, psInput_, scEleIds_, srFlags_, strip(), TCC_EB_NUMBTTS, ttDetIds_, ttEleIds_, ttTPIds_, and xtalDetIds_.

Referenced by ~EcalElectronicsMapper().

                                          {

  //DETETE ARRAYS
  for(unsigned int sm=0; sm < NUMB_SM; sm++){
    for(unsigned int fe=0; fe< NUMB_FE; fe++){
      for(unsigned int strip=0; strip<NUMB_STRIP;strip++){
        for(unsigned int xtal=0; xtal<NUMB_XTAL;xtal++) delete xtalDetIds_[sm][fe][strip][xtal];         
      }

      // if(scDetIds_[sm][fe]){ 
      //  delete scDetIds_[sm][fe];
      //  delete scEleIds_[sm][fe];
      for(size_t i = 0; i< srFlags_[sm][fe].size(); ++i) delete srFlags_[sm][fe][i];
      srFlags_[sm][fe].clear();
 
      delete scEleIds_[sm][fe];
           
    }
 
  }

  // delete trigger electronics Id
  for (int tccid=0; tccid<NUMB_TCC; tccid++){
    for (int ttid=0; ttid<TCC_EB_NUMBTTS; ttid++){
      for (int ps=0; ps<NUMB_STRIP; ps++){
        delete psInput_[tccid][ttid][ps];
      }
    }
  }


  
  for( unsigned int tccid=0; tccid < NUMB_TCC; tccid++){
    for(unsigned int tpg =0; tpg<NUMB_FE;tpg++){
      if(ttDetIds_[tccid][tpg]){ 
        delete ttDetIds_[tccid][tpg];
        delete ttTPIds_[tccid][tpg];
        delete ttEleIds_[tccid][tpg];
      }
    }
  }


  pathToMapFile_.clear();
  
  
  std::map<unsigned int, std::vector<unsigned int> *>::iterator it;
  for(it = mapSmIdToTccIds_.begin(); it != mapSmIdToTccIds_.end(); it++ ){ delete (*it).second; }
  
  mapSmIdToTccIds_.clear();
 
}
void EcalElectronicsMapper::fillMaps ( ) [private]

Definition at line 410 of file EcalElectronicsMapper.cc.

References EcalElectronicsMapping::dccTowerConstituents(), EcalElectronicsMapping::getDetId(), EcalElectronicsMapping::getEcalScDetId(), EcalElectronicsMapping::getElectronicsId(), EcalElectronicsMapping::getTriggerElectronicsId(), EcalElectronicsMapping::getTrigTowerDetId(), i, EcalTrigTowerDetId::kEBTowersPerSM, mappingBuilder_, mapSmIdToTccIds_, MAX_CCUID_JUMP, EcalTriggerElectronicsId::MAX_TCCID, EcalTriggerElectronicsId::MAX_TCCID_EEM, EcalTriggerElectronicsId::MAX_TCCID_EEP, MIN_CCUID_JUMP, EcalTriggerElectronicsId::MIN_TCCID_EEM, EcalTriggerElectronicsId::MIN_TCCID_EEP, numbTriggerTSamples_, numChannelsInDcc_, psInput_, DetId::rawId(), scEleIds_, SECTOR_EEM_CCU_JUMP, SECTOR_EEP_CCU_JUMP, EcalPseudoStripInputDigi::setSample(), EcalTriggerPrimitiveDigi::setSample(), EcalPseudoStripInputDigi::setSize(), EcalTriggerPrimitiveDigi::setSize(), findQualityFiles::size, srFlags_, EcalElectronicsId::stripId(), EcalElectronicsMapping::tccConstituents(), TCCID_SMID_SHIFT_EB, tTandPs_, ttDetIds_, ttEleIds_, ttTPIds_, xtalDetIds_, and EcalElectronicsId::xtalId().

Referenced by setEcalElectronicsMapping().

                                    {
 
  for( int smId=1 ; smId<= 54; smId++){

    
    // Fill EB arrays  
    if( smId > 9 && smId < 46 ){
         
      for(int feChannel =1; feChannel<=68; feChannel++){
                   
        unsigned int tccId = smId + TCCID_SMID_SHIFT_EB;
                  
        // Builds Ecal Trigger Tower Det Id 

        unsigned int rawid = (mappingBuilder_->getTrigTowerDetId(tccId, feChannel)).rawId();
        EcalTrigTowerDetId * ttDetId = new EcalTrigTowerDetId(rawid);
        ttDetIds_[tccId-1][feChannel-1] = ttDetId;
        EcalElectronicsId * ttEleId = new EcalElectronicsId(smId, feChannel, 1, 1);
        ttEleIds_[tccId-1][feChannel-1] = ttEleId;
        EcalTriggerPrimitiveDigi * tp     = new EcalTriggerPrimitiveDigi(*ttDetId);
        tp->setSize(numbTriggerTSamples_);
        for(unsigned int i=0;i<numbTriggerTSamples_;i++){
          tp->setSample( i, EcalTriggerPrimitiveSample(0) );
        }
        ttTPIds_[tccId-1][feChannel-1]  = tp;

        // build pseudostrip input data digi
        for(int ps=1; ps<=5; ps++){
            psInput_[tccId-1][feChannel-1][ps-1]= new EcalPseudoStripInputDigi( EcalTriggerElectronicsId(tccId, feChannel, ps, 1) );
            psInput_[tccId-1][feChannel-1][ps-1]->setSize(1);
            psInput_[tccId-1][feChannel-1][ps-1]->setSample( 0, EcalPseudoStripInputSample(0) );
        }

        // Buil SRP Flag
        srFlags_[smId-1][feChannel-1].push_back(new EBSrFlag(*ttDetId,0));

        //only one element for barrel: 1-to-1 correspondance between
        //DCC channels and EB trigger tower:
        assert(srFlags_[smId-1][feChannel-1].size()==1);
 
        for(unsigned int stripId =1; stripId<=5; stripId++){
                    
          for(unsigned int xtalId =1;xtalId<=5;xtalId++){
                   
              EcalElectronicsId eid(smId,feChannel,stripId,xtalId);
              EBDetId * detId = new EBDetId( (mappingBuilder_->getDetId(eid)).rawId());
              xtalDetIds_[smId-1][feChannel-1][stripId-1][xtalId-1] = detId;
                         
           } // close loop over xtals
        }// close loop over strips
                                  
      }// close loop over fechannels
                
    }//close loop over sm ids in the EB
    // Fill EE arrays (Todo : waiting SC correction)
    
    else{
         
        std::vector<unsigned int> * pTCCIds = mapSmIdToTccIds_[smId];
        std::vector<unsigned int>::iterator it;
                
        for(it= pTCCIds->begin(); it!= pTCCIds->end(); it++){
                        
          unsigned int tccId = *it;
          
          // creating arrays of pointers for trigger objects
          for(unsigned int towerInTCC =1; towerInTCC <= numChannelsInDcc_[smId-1]; towerInTCC++){
              
              // Builds Ecal Trigger Tower Det Id 
              EcalTrigTowerDetId ttDetId = mappingBuilder_->getTrigTowerDetId(tccId, towerInTCC);
              
              ttDetIds_[tccId-1][towerInTCC-1] = new EcalTrigTowerDetId(ttDetId.rawId());
              EcalTriggerPrimitiveDigi * tp   = new EcalTriggerPrimitiveDigi(ttDetId);
              tp->setSize(numbTriggerTSamples_);
              for(unsigned int i=0;i<numbTriggerTSamples_;i++){
                  tp->setSample( i, EcalTriggerPrimitiveSample(0) );
              }
              
              ttTPIds_[tccId-1][towerInTCC-1]  = tp;
              
              // build pseudostrip input data digi
               for(int ps=1; ps<=5; ps++){
                   psInput_[tccId-1][towerInTCC-1][ps-1]= new EcalPseudoStripInputDigi( EcalTriggerElectronicsId(tccId, towerInTCC, ps, 1) );
                   psInput_[tccId-1][towerInTCC-1][ps-1]->setSize(1);
                   psInput_[tccId-1][towerInTCC-1][ps-1]->setSample( 0, EcalPseudoStripInputSample(0) );
               }
              
          }
        }
        
        // creating arrays of pointers for digi objects
        for(unsigned int feChannel = 1; feChannel <= numChannelsInDcc_[smId-1]; feChannel++){
          
          // to avoid gap in CCU_id's
          if((smId==SECTOR_EEM_CCU_JUMP   || smId== SECTOR_EEP_CCU_JUMP) &&
             (MIN_CCUID_JUMP <= feChannel && feChannel <=MAX_CCUID_JUMP )
             ) continue;
          
          std::vector<EcalScDetId> scDetIds = mappingBuilder_->getEcalScDetId(smId,feChannel);
          // scDetIds_[smId-1][feChannel-1] = new EcalScDetId(scDetId.rawId());
          scEleIds_[smId-1][feChannel-1] = new EcalElectronicsId(smId,feChannel,1,1);

          for(size_t i = 0; i < scDetIds.size(); ++i){
            // std::cout << __FILE__ << ":" << __LINE__ << ": "
            //            << "(DCC,RU) = (" <<  smId << "," << feChannel
            //            << ") -> " << scDetIds[i] << "\n";
            
            srFlags_[smId-1][feChannel-1].push_back(new EESrFlag( EcalScDetId( scDetIds[i].rawId() ) , 0 ));
          }
          //usually only one element 1 DCC channel <-> 1 SC
          //in few case two or three elements: partial SCs grouped. 
          assert(srFlags_[smId-1][feChannel-1].size()<=3);
          
          std::vector<DetId> ecalDetIds = mappingBuilder_->dccTowerConstituents(smId,feChannel);
          std::vector<DetId>::iterator it;
                                  
          //EEDetIds        
          for(it = ecalDetIds.begin(); it!= ecalDetIds.end(); it++){
            
            EcalElectronicsId ids = mappingBuilder_->getElectronicsId((*it));
            
            int stripId    = ids.stripId();
            int xtalId     = ids.xtalId();
            
            EEDetId * detId = new EEDetId((*it).rawId());
            xtalDetIds_[smId-1][feChannel-1][stripId-1][xtalId-1] = detId;
          }// close loop over tower constituents
          
        }// close loop over  FE Channels                
        
    }// closing loop over sm ids in EE
        
  }


  // developing mapping for pseudostrip input data: (tccId,psNumber)->(tccId,towerId,psId)
  // initializing array for pseudostrip data
  short numStripInTT[EcalTriggerElectronicsId::MAX_TCCID][EcalTrigTowerDetId::kEBTowersPerSM];
  for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++){
      for (int tt=0; tt<EcalTrigTowerDetId::kEBTowersPerSM; tt++){
          numStripInTT[tccId][tt]=-2;} }

  
  // assumption: if ps_max is the largest pseudostripId within a trigger tower
  // all the pseudostrip 1 ...  ps_max are actually present
  std::vector<DetId>::iterator theTCCConstituent;
  for(int tccId = 0; tccId< EcalTriggerElectronicsId::MAX_TCCID ; tccId++)
  {
      
      // loop over all constituents of a TCC and collect
      // the largest pseudostripId within each trigger tower
      std::vector<DetId> tccConstituents = mappingBuilder_->tccConstituents(tccId+1);
      
      for (theTCCConstituent  = tccConstituents.begin();
           theTCCConstituent != tccConstituents.end();
           theTCCConstituent++)
      {

          int towerId = ( mappingBuilder_->getTriggerElectronicsId(*theTCCConstituent) ) .ttId();
          int ps    = ( mappingBuilder_->getTriggerElectronicsId(*theTCCConstituent) ) .pseudoStripId();
          if( ps > numStripInTT[tccId][towerId-1]) numStripInTT[tccId][towerId-1] = ps;

          //std::cout << "tccId: " << (tccId+1) << "    towerId: " << towerId
          // << "    ps: " << ps << "    numStripInTT: " << numStripInTT[tccId][towerId-1] << std::endl;
          
      }// loop on TCC constituents

  }// loop on TCC's

  
  int   psCounter;
  for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++)
  {
      // resetting pseudostrip counter at each new TCC
      psCounter=0;
      for (int towerId=0; towerId < EcalTrigTowerDetId::kEBTowersPerSM; towerId++)
      {
          // if there's not a given towerId, numStripInTT==-1
          for (int ps=0; ps<numStripInTT[tccId][towerId]; ps++)
          {
              tTandPs_[tccId][psCounter][0]=towerId+1;
              tTandPs_[tccId][psCounter][1]=ps+1;
              psCounter++;
          } // loop on TCC's
      } // loop on towers in TCC
  } // loop in ps in tower
  
  
//   for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++) {
//       for (int psCounter=0; psCounter<EcalTrigTowerDetId::kEBTowersPerSM*5; psCounter++) {
//           std::cout << "tccId: " << (tccId+1) << "    counter: " << (psCounter+1)
//                     << " tt: " << tTandPs_[tccId][psCounter][0]
//                     << " ps: " << tTandPs_[tccId][psCounter][1]
//                     << std::endl;
//       } } 
  
  
  
  // Note:
  // for TCC 48 in EE, pseudostrip data in the interval:
  // + 1-30 is good pseudostrip data
  // + 31-42 is a duplication of the last 12 ps of the previous block, and needs be ignored
  // + 43-60 is further good pseudostrip data
  
  for (int tcc=EcalTriggerElectronicsId::MIN_TCCID_EEM; tcc<=EcalTriggerElectronicsId::MAX_TCCID_EEM; tcc++)
  {
      int tccId=tcc-1;
      short tTandPs_tmp[18][2];

      // store entries _after_ the pseudostrip data which gets duplicated
      for (int psCounter=30; psCounter<48; psCounter++) {
          tTandPs_tmp[psCounter-30][0] = tTandPs_[tccId][psCounter][0];
          tTandPs_tmp[psCounter-30][1] = tTandPs_[tccId][psCounter][1]; }
      
      // duplication
      for (int psCounter=18; psCounter<30; psCounter++) {
          tTandPs_[tccId][psCounter+12][0] = tTandPs_[tccId][psCounter][0];
          tTandPs_[tccId][psCounter+12][1] = tTandPs_[tccId][psCounter][1]; }
      
      // append stoed
      for (int psCounter=42; psCounter<60; psCounter++) {
          tTandPs_[tccId][psCounter][0] = tTandPs_tmp[psCounter-42][0];
          tTandPs_[tccId][psCounter][1] = tTandPs_tmp[psCounter-42][1]; }
      
  }// loop on EEM TCC's

  
  for (int tcc=EcalTriggerElectronicsId::MIN_TCCID_EEP; tcc<=EcalTriggerElectronicsId::MAX_TCCID_EEP; tcc++)
  {
      int tccId=tcc-1;
      short tTandPs_tmp[18][2];
      
      // store entries _after_ the pseudostrip data which gets duplicated
      for (int psCounter=30; psCounter<48; psCounter++) {
          tTandPs_tmp[psCounter-30][0] = tTandPs_[tccId][psCounter][0];
          tTandPs_tmp[psCounter-30][1] = tTandPs_[tccId][psCounter][1]; }
      
      // duplication
      for (int psCounter=18; psCounter<30; psCounter++) {
          tTandPs_[tccId][psCounter+12][0] = tTandPs_[tccId][psCounter][0];
          tTandPs_[tccId][psCounter+12][1] = tTandPs_[tccId][psCounter][1]; }
      
      // append stoed
      for (int psCounter=42; psCounter<60; psCounter++) {
          tTandPs_[tccId][psCounter][0] = tTandPs_tmp[psCounter-42][0];
          tTandPs_[tccId][psCounter][1] = tTandPs_tmp[psCounter-42][1]; }
      
  }// loop on EEP TCC's

  
  //for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++) {
  //for (int psCounter=0; psCounter<EcalTrigTowerDetId::kEBTowersPerSM*5; psCounter++) {
  //std::cout << "AF tccId: " << (tccId+1) << "    counter: " << (psCounter+1)
  //<< " tt: " << tTandPs_[tccId][psCounter][0]
  //<< " ps: " << tTandPs_[tccId][psCounter][1]
  //<< std::endl;
//} }

}
unsigned int EcalElectronicsMapper::getActiveDCC ( ) [inline]
unsigned int EcalElectronicsMapper::getActiveSM ( ) [inline]
unsigned int EcalElectronicsMapper::getDCCId ( unsigned int  aSMId) const

Definition at line 376 of file EcalElectronicsMapper.cc.

References myDCCMap_, and DCCDataUnpacker::silentMode_.

Referenced by printStatusRecords().

                                                                     {
  //get iterator for SM id
  std::map<unsigned int ,unsigned int>::const_iterator it = myDCCMap_.find(aSMId_);

  //check if SMid exists and return DCC id
  if(it!= myDCCMap_.end()) return it->second;
 
  //error return
  if( ! DCCDataUnpacker::silentMode_ ){
    edm::LogError("IncorrectMapping") << "DCC requested for SM id: " << aSMId_ << " not found";
  }
  return 0;
}
const std::map<unsigned int ,unsigned int>& EcalElectronicsMapper::getDCCMap ( ) const [inline]

Get methods for DCCId/SMId and map

Definition at line 97 of file EcalElectronicsMapper.h.

References myDCCMap_.

{ return myDCCMap_; }
std::string EcalElectronicsMapper::getDCCMapFilePath ( ) const [inline]

Retrieves current path do the map file

Definition at line 78 of file EcalElectronicsMapper.h.

References pathToMapFile_.

{ return pathToMapFile_; }
DetId* EcalElectronicsMapper::getDetIdPointer ( unsigned int  feChannel,
unsigned int  strip,
unsigned int  xtal 
) [inline]

Definition at line 99 of file EcalElectronicsMapper.h.

References smId_, and xtalDetIds_.

Referenced by DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().

{  return  xtalDetIds_[smId_-1][feChannel-1][strip-1][xtal-1];}
unsigned int EcalElectronicsMapper::getEBTCCBlockLength ( ) [inline]

Definition at line 135 of file EcalElectronicsMapper.h.

References ebTccBlockLength_.

Referenced by DCCEBTCCBlock::DCCEBTCCBlock().

{ return ebTccBlockLength_;           }
unsigned int EcalElectronicsMapper::getEETCCBlockLength ( ) [inline]

Definition at line 137 of file EcalElectronicsMapper.h.

References eeTccBlockLength_.

{ return eeTccBlockLength_;           }
unsigned int EcalElectronicsMapper::getNumChannelsInDcc ( unsigned int  aDCCId) [inline]

Definition at line 145 of file EcalElectronicsMapper.h.

References numChannelsInDcc_.

Referenced by DCCFEBlock::unpack().

{return numChannelsInDcc_[aDCCId-1];}
EcalPseudoStripInputDigi* EcalElectronicsMapper::getPSInputDigiPointer ( unsigned int  tccId,
unsigned int  psCounter 
) [inline]

Definition at line 113 of file EcalElectronicsMapper.h.

References getPSInputDigiPointer(), and tTandPs_.

                                                                                               {
      return getPSInputDigiPointer(tccId, tTandPs_[tccId-1][psCounter-1][0],tTandPs_[tccId-1][psCounter-1][1]);}
EcalPseudoStripInputDigi* EcalElectronicsMapper::getPSInputDigiPointer ( unsigned int  tccId,
unsigned int  towerId,
unsigned int  psId 
) [inline]

Definition at line 111 of file EcalElectronicsMapper.h.

References psInput_.

Referenced by DCCEETCCBlock::addTriggerPrimitivesToCollection(), and getPSInputDigiPointer().

{ return psInput_[tccId-1][towerId-1][psId-1];}
EcalScDetId* EcalElectronicsMapper::getSCDetIdPointer ( unsigned int  smId,
unsigned int  feChannel 
) [inline]

Definition at line 107 of file EcalElectronicsMapper.h.

References scDetIds_.

{ return  scDetIds_[smId-1][feChannel-1];}
EcalElectronicsId* EcalElectronicsMapper::getSCElectronicsPointer ( unsigned int  smId,
unsigned int  feChannel 
) [inline]

Definition at line 109 of file EcalElectronicsMapper.h.

References scEleIds_.

Referenced by DCCSCBlock::fillEcalElectronicsError().

{ return  scEleIds_[smId-1][feChannel-1];}
unsigned int EcalElectronicsMapper::getSMId ( unsigned int  aDCCId) const

Definition at line 391 of file EcalElectronicsMapper.cc.

References myDCCMap_, and DCCDataUnpacker::silentMode_.

Referenced by DCCDataUnpacker::getCCUValue(), DCCDataUnpacker::getChannelValue(), and setActiveDCC().

                                                                      {
  //get iterator map
  std::map<unsigned int ,unsigned int>::const_iterator it;

  //try to find SM id for given DCC id
  for(it = myDCCMap_.begin(); it != myDCCMap_.end(); it++)
    if(it->second == aDCCId_) 
      return it->first;

  //error return
  if( ! DCCDataUnpacker::silentMode_ ){
    edm::LogError("IncorrectMapping") << "SM requested DCC id: " << aDCCId_ << " not found";
  }
  return 0;
}
std::vector<EcalSrFlag*> EcalElectronicsMapper::getSrFlagPointer ( unsigned int  feChannel) [inline]

Definition at line 121 of file EcalElectronicsMapper.h.

References smId_, and srFlags_.

Referenced by DCCEESRPBlock::addSRFlagToCollection(), and DCCEBSRPBlock::addSRFlagToCollection().

{ return srFlags_[smId_-1][feChannel-1]; }
unsigned int EcalElectronicsMapper::getSRPBlockLength ( ) [inline]

Definition at line 139 of file EcalElectronicsMapper.h.

References srpBlockLength_.

{ return srpBlockLength_;             }
std::vector<unsigned int>* EcalElectronicsMapper::getTccs ( unsigned int  smId) [inline]

Definition at line 123 of file EcalElectronicsMapper.h.

References mapSmIdToTccIds_.

Referenced by DCCEETCCBlock::checkTccIdAndNumbTTs().

{ return mapSmIdToTccIds_[smId];}
EcalTriggerPrimitiveDigi* EcalElectronicsMapper::getTPPointer ( unsigned int  tccId,
unsigned int  tower 
) [inline]

Definition at line 105 of file EcalElectronicsMapper.h.

References ttTPIds_.

Referenced by DCCEETCCBlock::addTriggerPrimitivesToCollection(), and DCCEBTCCBlock::addTriggerPrimitivesToCollection().

{ return ttTPIds_[tccId-1][tower-1];}
EcalTrigTowerDetId* EcalElectronicsMapper::getTTDetIdPointer ( unsigned int  tccId,
unsigned int  tower 
) [inline]

Definition at line 101 of file EcalElectronicsMapper.h.

References ttDetIds_.

{ return ttDetIds_[tccId-1][tower-1];}
EcalElectronicsId* EcalElectronicsMapper::getTTEleIdPointer ( unsigned int  tccId,
unsigned int  tower 
) [inline]

Definition at line 103 of file EcalElectronicsMapper.h.

References ttEleIds_.

Referenced by DCCTowerBlock::fillEcalElectronicsError().

{ return ttEleIds_[tccId-1][tower-1];}
unsigned int EcalElectronicsMapper::getUnfilteredTowerBlockLength ( ) [inline]
bool EcalElectronicsMapper::isTCCExternal ( unsigned int  TCCId)
bool EcalElectronicsMapper::makeMapFromVectors ( std::vector< int > &  orderedFedUnpackList,
std::vector< int > &  orderedDCCIdList 
)

Read map file (returns false if an error ocurred) deprecated by HLT environment HLT friendly: load default mapping or, for non standatd mapping, use 2 vectors from cfg

Definition at line 278 of file EcalElectronicsMapper.cc.

References myDCCMap_, tmp, and v.

Referenced by EcalUnpackerWorker::EcalUnpackerWorker().

{

  // in case as non standard set of DCCId:FedId pairs was provided
  if ( orderedFedUnpackList.size() == orderedDCCIdList.size() &&
       orderedFedUnpackList.size() > 0)
    {
      edm::LogInfo("EcalElectronicsMapper") << "DCCIdList/FedUnpackList lists given. Being loaded.";
      
      std::string correspondence("list of pairs DCCId:FedId :  ");
      char           onePair[50];
      for (int v=0;  v< ((int)orderedFedUnpackList.size());  v++)        {
        myDCCMap_[ orderedDCCIdList[v]  ] = orderedFedUnpackList[v] ;
        
        sprintf( onePair, "  %d:%d",  orderedDCCIdList[v], orderedFedUnpackList[v]);
        std::string                 tmp(onePair);
        correspondence += tmp;
      }
      edm::LogInfo("EcalElectronicsMapper") << correspondence;
      
    }
  else    
    {  // default set of DCCId:FedId for ECAL

      edm::LogInfo("EcalElectronicsMapper") << "No input DCCIdList/FedUnpackList lists given for ECAL unpacker"
                                            << "(or given with different number of elements). "
                                            << " Loading default association DCCIdList:FedUnpackList,"
                                            << "i.e.  1:601 ... 53:653,  54:654.";
      
      for (unsigned int v=1; v<=54; v++)        {
        myDCCMap_[ v ] = (v+600) ;   }
    }

  return true;
}
const EcalElectronicsMapping* EcalElectronicsMapper::mapping ( ) [inline]
unsigned int EcalElectronicsMapper::numbTriggerTSamples ( ) [inline]

Definition at line 131 of file EcalElectronicsMapper.h.

References numbTriggerTSamples_.

unsigned int EcalElectronicsMapper::numbXtalTSamples ( ) [inline]

Definition at line 129 of file EcalElectronicsMapper.h.

References numbXtalTSamples_.

Referenced by DCCFEBlock::DCCFEBlock(), and DCCMemBlock::DCCMemBlock().

{ return numbXtalTSamples_;           }
void EcalElectronicsMapper::resetPointers ( )

Definition at line 17 of file EcalElectronicsMapper.cc.

References computeEBTCCBlockLength(), computeEETCCBlockLength(), computeUnfilteredFEBlockLength(), ebTccBlockLength_, eeTccBlockLength_, EcalTrigTowerDetId::kEBTowersPerSM, mapSmIdToTccIds_, EcalTriggerElectronicsId::MAX_TCCID, NUMB_FE, NUMB_SM, NUMB_STRIP, NUMB_TCC, NUMB_XTAL, psInput_, scEleIds_, strip(), TCC_EB_NUMBTTS, tTandPs_, ttDetIds_, ttEleIds_, ttTPIds_, unfilteredFEBlockLength_, and xtalDetIds_.

Referenced by EcalElectronicsMapper().

                                         {
  
  // Reset Arrays
  for(unsigned int sm=0; sm < NUMB_SM; sm++){
    for(unsigned int fe=0; fe< NUMB_FE; fe++){
          
      for(unsigned int strip=0; strip<NUMB_STRIP;strip++){
        for(unsigned int xtal=0; xtal<NUMB_XTAL;xtal++){
                    
             //Reset DFrames and xtalDetIds
          xtalDetIds_[sm][fe][strip][xtal]=0;
        }
      }

      //Reset SC Det Ids
      //scDetIds_[sm][fe]=0;
      scEleIds_[sm][fe]=0;
      //srFlags_[sm][fe]=0;
    }
  }
  
  
  //Reset TT det Ids
  for( unsigned int tccid=0; tccid < NUMB_TCC; tccid++){
    for(unsigned int tpg =0; tpg<NUMB_FE;tpg++){
      ttDetIds_[tccid][tpg]=0;
      ttTPIds_[tccid][tpg]=0;
      ttEleIds_[tccid][tpg]=0;
    }
  }

  // reset trigger electronics Id
  for (int tccid=0; tccid<NUMB_TCC; tccid++){
      for (int ttid=0; ttid<TCC_EB_NUMBTTS; ttid++){
          for (int ps=0; ps<NUMB_STRIP; ps++){
              psInput_[tccid][ttid][ps]=0;
          }}}
  
  // initialize TCC maps
  for (int tccId=0; tccId<EcalTriggerElectronicsId::MAX_TCCID; tccId++) {
      for (int psCounter=0; psCounter<EcalTrigTowerDetId::kEBTowersPerSM*5; psCounter++) {
          for (int u=0; u<2; u++){
              tTandPs_[tccId][psCounter][u]=-1;
          } } }
  
  

  //Fill map sm id to tcc ids
  std::vector<unsigned int> * ids;
  ids = new std::vector<unsigned int>;
  ids->push_back(1); ids->push_back(18);ids->push_back(19);ids->push_back(36);
  mapSmIdToTccIds_[1]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(2); ids->push_back(3);ids->push_back(20);ids->push_back(21);
  mapSmIdToTccIds_[2]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(4); ids->push_back(5);ids->push_back(22);ids->push_back(23);
  mapSmIdToTccIds_[3]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(6); ids->push_back(7);ids->push_back(24);ids->push_back(25);
  mapSmIdToTccIds_[4]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(8); ids->push_back(9);ids->push_back(26);ids->push_back(27);
  mapSmIdToTccIds_[5]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(10); ids->push_back(11);ids->push_back(28);ids->push_back(29);
  mapSmIdToTccIds_[6]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(12); ids->push_back(13);ids->push_back(30);ids->push_back(31);
  mapSmIdToTccIds_[7]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(14); ids->push_back(15);ids->push_back(32);ids->push_back(33);
  mapSmIdToTccIds_[8]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(16); ids->push_back(17);ids->push_back(34);ids->push_back(35);
  mapSmIdToTccIds_[9]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(73); ids->push_back(90);ids->push_back(91);ids->push_back(108);
  mapSmIdToTccIds_[46]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(74); ids->push_back(75);ids->push_back(92);ids->push_back(93);
  mapSmIdToTccIds_[47]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(76); ids->push_back(77);ids->push_back(94);ids->push_back(95);
  mapSmIdToTccIds_[48]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(78); ids->push_back(79);ids->push_back(96);ids->push_back(97);
  mapSmIdToTccIds_[49]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(80); ids->push_back(81);ids->push_back(98);ids->push_back(99);  
  mapSmIdToTccIds_[50]= ids;
                 
  ids = new std::vector<unsigned int>;
  ids->push_back(82); ids->push_back(83);ids->push_back(100);ids->push_back(101);
  mapSmIdToTccIds_[51]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(84); ids->push_back(85);ids->push_back(102);ids->push_back(103);
  mapSmIdToTccIds_[52]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(86); ids->push_back(87);ids->push_back(104);ids->push_back(105);
  mapSmIdToTccIds_[53]= ids;
                
  ids = new std::vector<unsigned int>;
  ids->push_back(88); ids->push_back(89);ids->push_back(106);ids->push_back(107);
  mapSmIdToTccIds_[54]= ids;
        
  
  //Compute data block sizes
  unfilteredFEBlockLength_= computeUnfilteredFEBlockLength();  
  ebTccBlockLength_       = computeEBTCCBlockLength();
  eeTccBlockLength_       = computeEETCCBlockLength();
    

}
bool EcalElectronicsMapper::setActiveDCC ( unsigned int  dccId)

Set DCC id that is going to be unpacked for the event

Definition at line 210 of file EcalElectronicsMapper.cc.

References dccId_, getSMId(), runTheMatrix::ret, and smId_.

Referenced by EcalRawToDigi::produce(), and EcalUnpackerWorker::work().

                                                          {
   
  bool ret(true);
        
  //Update active dcc and associated smId
  dccId_ = dccId;
   
  smId_  = getSMId(dccId_);
        
  if(!smId_) ret = false;
        
  return ret;
        
 } 
bool EcalElectronicsMapper::setDCCMapFilePath ( std::string  aPath_)

Receives a string with a path and checks if file is accessible

Definition at line 226 of file EcalElectronicsMapper.cc.

References pathToMapFile_.

                                                             {

  
  //try to open a dccMapFile in the given path
  std::ifstream dccMapFile_(aPath_.c_str());

  //if not successful return false
  if(!dccMapFile_.is_open()) return false;

  //else close file and accept given path
  dccMapFile_.close();
  pathToMapFile_ = aPath_;

  return true;
}
void EcalElectronicsMapper::setEcalElectronicsMapping ( const EcalElectronicsMapping m)

Definition at line 205 of file EcalElectronicsMapper.cc.

References fillMaps(), m, and mappingBuilder_.

Referenced by EcalUnpackerWorker::setHandles().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const EcalElectronicsMapper aEcalElectronicsMapper 
) [friend]

Print current map

Definition at line 316 of file EcalElectronicsMapper.cc.

                                                                              {
  //print class information
  o << "---------------------------------------------------------";

  if(aMapper_.pathToMapFile_.size() < 1){
    o << "No correct input for DCC map has been given yet...";
  }
  else{
    o << "DCC Map (Map file: " << aMapper_.pathToMapFile_ << " )" << "SM id\t\tDCCid ";

    //get DCC map and iterator
    std::map<unsigned int ,unsigned int > aMap;
    aMap=aMapper_.myDCCMap_;
    std::map<unsigned int ,unsigned int >::iterator iter;

    //print info contained in map
    for(iter = aMap.begin(); iter != aMap.end(); iter++)
      o << iter->first << "\t\t" << iter->second;
  }

  o << "---------------------------------------------------------";
  return o;
}

Member Data Documentation

unsigned int EcalElectronicsMapper::dccId_ [private]

Definition at line 191 of file EcalElectronicsMapper.h.

Referenced by getActiveDCC(), and setActiveDCC().

Definition at line 199 of file EcalElectronicsMapper.h.

Referenced by getEBTCCBlockLength(), and resetPointers().

Definition at line 199 of file EcalElectronicsMapper.h.

Referenced by getEETCCBlockLength(), and resetPointers().

Definition at line 216 of file EcalElectronicsMapper.h.

Referenced by fillMaps(), mapping(), and setEcalElectronicsMapping().

std::map< unsigned int, std::vector<unsigned int> * > EcalElectronicsMapper::mapSmIdToTccIds_ [private]

Definition at line 189 of file EcalElectronicsMapper.h.

Referenced by deletePointers(), fillMaps(), getTccs(), and resetPointers().

std::map<unsigned int,unsigned int> EcalElectronicsMapper::myDCCMap_ [private]

Definition at line 187 of file EcalElectronicsMapper.h.

Referenced by getDCCId(), getDCCMap(), getSMId(), makeMapFromVectors(), and operator<<().

Definition at line 185 of file EcalElectronicsMapper.h.

Referenced by computeEBTCCBlockLength(), fillMaps(), and numbTriggerTSamples().

Definition at line 183 of file EcalElectronicsMapper.h.

Referenced by computeUnfilteredFEBlockLength(), and numbXtalTSamples().

const unsigned int EcalElectronicsMapper::numChannelsInDcc_ [static, private]
Initial value:
 {34,32,33,33,32,34,33,41,33,    
                                                                          68,68,68,68,68,68,68,68,68,68, 
                                                                          68,68,68,68,68,68,68,68,
                                                                          68,68,68,68,68,68,68,68,68,68, 
                                                                          68,68,68,68,68,68,68,68,
                                                                          34,32,33,33,32,34,33,41,33}

Definition at line 201 of file EcalElectronicsMapper.h.

Referenced by fillMaps(), and getNumChannelsInDcc().

EcalPseudoStripInputDigi* EcalElectronicsMapper::psInput_[NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP] [private]
EcalScDetId* EcalElectronicsMapper::scDetIds_[NUMB_SM][NUMB_FE] [private]

Definition at line 206 of file EcalElectronicsMapper.h.

Referenced by getSCDetIdPointer().

unsigned int EcalElectronicsMapper::smId_ [private]
std::vector<EcalSrFlag*> EcalElectronicsMapper::srFlags_[NUMB_SM][NUMB_FE] [private]

Definition at line 211 of file EcalElectronicsMapper.h.

Referenced by deletePointers(), fillMaps(), and getSrFlagPointer().

Definition at line 197 of file EcalElectronicsMapper.h.

Referenced by getSRPBlockLength().

Definition at line 214 of file EcalElectronicsMapper.h.

Referenced by fillMaps(), getPSInputDigiPointer(), and resetPointers().

EcalElectronicsId* EcalElectronicsMapper::ttEleIds_[NUMB_TCC][NUMB_FE] [private]

Definition at line 210 of file EcalElectronicsMapper.h.

Referenced by deletePointers(), fillMaps(), getTPPointer(), and resetPointers().

Definition at line 195 of file EcalElectronicsMapper.h.

Referenced by getUnfilteredTowerBlockLength(), and resetPointers().

DetId* EcalElectronicsMapper::xtalDetIds_[NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL] [private]

Definition at line 205 of file EcalElectronicsMapper.h.

Referenced by deletePointers(), fillMaps(), getDetIdPointer(), and resetPointers().