CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

EcalTrigTowerConstituentsMap Class Reference

#include <EcalTrigTowerConstituentsMap.h>

List of all members.

Classes

struct  MapItem

Public Member Functions

void assign (const DetId &cell, const EcalTrigTowerDetId &tower)
 set the association between a DetId and a tower
std::vector< DetIdconstituentsOf (const EcalTrigTowerDetId &id) const
 Get the constituent detids for this tower id.
 EcalTrigTowerConstituentsMap ()
EcalTrigTowerDetId towerOf (const DetId &id) const
 Get the tower id for this det id (or null if not known)

Private Types

typedef
boost::multi_index_container
< MapItem,
boost::multi_index::indexed_by
< boost::multi_index::ordered_unique
< boost::multi_index::member
< MapItem, DetId,&MapItem::cell >
>, boost::multi_index::ordered_non_unique
< boost::multi_index::member
< MapItem, EcalTrigTowerDetId,&MapItem::tower > > > > 
EcalTowerMap
typedef
EcalTowerMap::nth_index
< 0 >::type 
EcalTowerMap_by_DetId
typedef
EcalTowerMap::nth_index
< 1 >::type 
EcalTowerMap_by_towerDetId

Private Member Functions

DetId changeEEDetIdQuadrantAndZ (const DetId &fromid, const int &toQuadrant, const int &tozside) const
int changeTowerQuadrant (int phiTower, int fromQuadrant, int toQuadrant) const
DetId wrapEcalTrigTowerDetId (const DetId &id) const
 Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)
DetId wrapEEDetId (const DetId &id) const
 Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)

Private Attributes

EcalTowerMap m_items

Detailed Description

Id:
EcalTrigTowerConstituentsMap.h,v 1.2 2010/03/26 19:40:54 sunanda Exp
Author:
P.Meridiani

Definition at line 20 of file EcalTrigTowerConstituentsMap.h.


Member Typedef Documentation

typedef boost::multi_index_container< MapItem, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,DetId,&MapItem::cell > >, boost::multi_index::ordered_non_unique< boost::multi_index::member < MapItem,EcalTrigTowerDetId,&MapItem::tower> > > > EcalTrigTowerConstituentsMap::EcalTowerMap [private]

Definition at line 58 of file EcalTrigTowerConstituentsMap.h.

typedef EcalTowerMap::nth_index<0>::type EcalTrigTowerConstituentsMap::EcalTowerMap_by_DetId [private]

Definition at line 60 of file EcalTrigTowerConstituentsMap.h.

typedef EcalTowerMap::nth_index<1>::type EcalTrigTowerConstituentsMap::EcalTowerMap_by_towerDetId [private]

Definition at line 61 of file EcalTrigTowerConstituentsMap.h.


Constructor & Destructor Documentation

EcalTrigTowerConstituentsMap::EcalTrigTowerConstituentsMap ( )

Definition at line 9 of file EcalTrigTowerConstituentsMap.cc.

{
}

Member Function Documentation

void EcalTrigTowerConstituentsMap::assign ( const DetId cell,
const EcalTrigTowerDetId tower 
)

set the association between a DetId and a tower

Definition at line 159 of file EcalTrigTowerConstituentsMap.cc.

References Exception, m_items, and DetId::rawId().

Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().

                                                                                            {
  if (m_items.find(cell)!=m_items.end()) {
    throw cms::Exception("EcalTrigTowers") << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a EcalTrigTower " << m_items.find(cell)->tower << std::endl;
  }
  
  m_items.insert(MapItem(cell,tower));
}
DetId EcalTrigTowerConstituentsMap::changeEEDetIdQuadrantAndZ ( const DetId fromid,
const int &  toQuadrant,
const int &  tozside 
) const [private]

Definition at line 102 of file EcalTrigTowerConstituentsMap.cc.

References DetId::det(), DetId::Ecal, EcalEndcap, EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), DetId::subdetId(), and EEDetId::XYMODE.

{
  if (! (fromid.det() == DetId::Ecal && fromid.subdetId() == EcalEndcap) )
    return EEDetId(0);
  
  EEDetId myId(fromid);
  int dQuadrant = toQuadrant-myId.iquadrant(); 
  switch(dQuadrant%4){
  case 0:
    return DetId(EEDetId(myId.ix(),myId.iy(),tozside,EEDetId::XYMODE));
    break;
  case 1:
    /* adjacent tower: they are symetric*/
    return DetId(EEDetId(101-myId.ix(),myId.iy(),tozside,EEDetId::XYMODE));
    break;
  case 2:
    /* opposite quadrant: they are identical*/
    return DetId(EEDetId(101-myId.ix(),101-myId.iy(),tozside,EEDetId::XYMODE));   
    break;
  case 3:
    /* adjacent tower: they are symetric*/
    return DetId(EEDetId(myId.ix(),101-myId.iy(),tozside,EEDetId::XYMODE));   
    break;
  default:
    /*should never be reached*/
    edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";    
  }
  return EEDetId(0);
}
int EcalTrigTowerConstituentsMap::changeTowerQuadrant ( int  phiTower,
int  fromQuadrant,
int  toQuadrant 
) const [private]

Definition at line 132 of file EcalTrigTowerConstituentsMap.cc.

References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.

                                                                                                         {
  int newPhiTower = phiTower;
  int dQuadrant = toQuadrant-fromQuadrant; 
  
  switch(dQuadrant%4){
  case 0:
    newPhiTower = phiTower;
    break;
  case 1:
    /* adjacent tower: they are symetric*/
    newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - phiTower + 1;
    break;
  case 2:
    /* opposite quadrant: they are identical*/
    newPhiTower = phiTower + EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2;
    break;
  case 3:
    /* adjacent tower: they are symetric*/
    newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - phiTower + 1;
    break;
  default:
    /*should never be reached*/
    edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";    
  }
  return newPhiTower;
}
std::vector< DetId > EcalTrigTowerConstituentsMap::constituentsOf ( const EcalTrigTowerDetId id) const

Get the constituent detids for this tower id.

Definition at line 167 of file EcalTrigTowerConstituentsMap.cc.

References alignCSCRings::e, DetId::Ecal, EcalBarrel, EcalEndcap, EcalTriggerTower, EBDetId::ETAPHIMODE, m_items, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by EcalRecHitsValidation::analyze(), ecaldqm::TrigPrimTask::runOnEmulTPs(), and ecaldqm::TrigPrimTask::runOnRealTPs().

                                                                                                {
  std::vector<DetId> items;
  
  if ( id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalBarrel ) 
    {
      //--------------------
      // Ecal Barrel
      //--------------------
      // trigger towers are 5x5 crystals in the barrel
      int etaxtalMin=(id.ietaAbs()-1)*5+1;
      int phixtalMin=((id.iphi()-1)*5+11)%360;
      if(phixtalMin<=0)phixtalMin+=360;
      int etaxtalMax=id.ietaAbs()*5;
      int phixtalMax=((id.iphi())*5+10)%360;
      if(phixtalMax<=0) phixtalMax+=360;
      for(int e=etaxtalMin;e<=etaxtalMax;e++) 
        for(int p=phixtalMin;p<=phixtalMax;p++) 
          items.push_back(DetId(EBDetId(id.zside()*e,p,EBDetId::ETAPHIMODE)));
    }
  else if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalEndcap) 
    {
      //--------------------
      // Ecal Endcap
      //--------------------
      //DetId myId=wrapEcalTrigTowerDetId(id);  
      EcalTowerMap_by_towerDetId::const_iterator lb,ub;
      //boost::tuples::tie(lb,ub)=get<1>(m_items).equal_range(myId);
      boost::tuples::tie(lb,ub)=boost::get<1>(m_items).equal_range(id);
      while (lb!=ub)
        {
          //EEDetId mappedId((*lb).cell);
          //items.push_back(changeEEDetIdQuadrantAndZ(mappedId,id.iquadrant(),id.zside()));
          items.push_back((*lb).cell);
          ++lb;
        }
    }
  
  return items;
}
EcalTrigTowerDetId EcalTrigTowerConstituentsMap::towerOf ( const DetId id) const

Get the tower id for this det id (or null if not known)

Definition at line 13 of file EcalTrigTowerConstituentsMap.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, i, m_items, EBDetId::tower(), and EEDetId::zside().

Referenced by EcalTBReadout::findTTlist(), EcalSelectiveReadout::getCrystalInterest(), EcalEndcapRecHitsMaker::init(), EcalBarrelRecHitsMaker::init(), Numbers::iTCC(), Numbers::iTT(), EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalBarrelRecHitsMaker::loadPCaloHits(), Numbers::nTTs(), EcalBarrelRecHitsMaker::randomNoisifier(), EcalTBReadout::readOut(), EcalSelectiveReadoutValidation::readOutUnitOf(), ecaldqm::TrigPrimTask::runOnDigis(), EcalSelectiveReadout::runSelectiveReadout0(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().

                                                                              {
  if (id.det() == DetId::Ecal && id.subdetId() == EcalBarrel)
    {
      //--------------------
      // Ecal Barrel
      //--------------------
      EBDetId myId(id);
      return myId.tower();
    }
  else if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap)
    {
      //--------------------
      // Ecal Endcap
      //--------------------
      EEDetId originalId(id);
      // DetId wrappedId=wrapEEDetId(id);
      DetId wrappedId(originalId);
      EcalTowerMap::const_iterator i=m_items.find(wrappedId);
      if (i!=m_items.end()) 
        {
          int etaTower=i->tower.ietaAbs();
          int phiTower=i->tower.iphi();
          //trigger tower <-> crystal maping read 
          //..........from file and done only for 1 quadrant
          //move from quadrant 1 to the actual one:
          // phiTower = changeTowerQuadrant(phiTower, 1, originalId.iquadrant());
          // std::cout << originalId.zside() <<  " " << etaTower << " " << phiTower << std::endl;
          return EcalTrigTowerDetId(originalId.zside(),EcalEndcap,etaTower,phiTower);
        }
    }
  return EcalTrigTowerDetId(0);
}
DetId EcalTrigTowerConstituentsMap::wrapEcalTrigTowerDetId ( const DetId id) const [private]

Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)

Definition at line 74 of file EcalTrigTowerConstituentsMap.cc.

References DetId::det(), DetId::Ecal, EcalEndcap, EcalTriggerTower, EcalTrigTowerDetId::ietaAbs(), EcalTrigTowerDetId::iphi(), EcalTrigTowerDetId::iquadrant(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant, EcalTrigTowerDetId::subDet(), and DetId::subdetId().

{
  EcalTrigTowerDetId etid(id);

  if (! (etid.det() == DetId::Ecal && etid.subdetId() == EcalTriggerTower && etid.subDet() == EcalEndcap) )
    return EcalTrigTowerDetId(0);
  
  switch((etid.iquadrant()-1)%4)
    {
    case 0:
      return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),etid.iphi()));
      break;
    case 1:
      return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - etid.iphi() + 1));
      break;
    case 2:
      return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),etid.iphi() - EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 ));
      break;
    case 3:
      return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - etid.iphi() + 1));
      break;
    default:
      /*should never be reached*/
      edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";    
    }
  return EcalTrigTowerDetId(0);
}
DetId EcalTrigTowerConstituentsMap::wrapEEDetId ( const DetId id) const [private]

Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)

Definition at line 46 of file EcalTrigTowerConstituentsMap.cc.

References DetId::det(), DetId::Ecal, EcalEndcap, EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), DetId::subdetId(), and EEDetId::XYMODE.

{
  if (! (eeid.det() == DetId::Ecal && eeid.subdetId() == EcalEndcap) )
    return EEDetId(0);
  
  EEDetId myId(eeid);
  switch((myId.iquadrant()-1)%4)
    {
    case 0:
      return DetId(EEDetId(myId.ix(),myId.iy(),1,EEDetId::XYMODE));
      break;
    case 1:
      return DetId(EEDetId(101-myId.ix(),myId.iy(),1,EEDetId::XYMODE));
      break;
    case 2:
      return DetId(EEDetId(101-myId.ix(),101-myId.iy(),1,EEDetId::XYMODE));   
      break;
    case 3:
      return DetId(EEDetId(myId.ix(),101-myId.iy(),1,EEDetId::XYMODE));   
      break;
    default:
      /*should never be reached*/
      edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";    
    }
  return EEDetId(0);
}

Member Data Documentation

Definition at line 63 of file EcalTrigTowerConstituentsMap.h.

Referenced by assign(), constituentsOf(), and towerOf().