CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PFRecHitProducerHCAL Class Reference

Producer for particle flow rechits (PFRecHit) in HCAL. More...

#include <PFRecHitProducerHCAL.h>

Inheritance diagram for PFRecHitProducerHCAL:
PFRecHitProducer edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PFRecHitProducerHCAL (const edm::ParameterSet &)
 ~PFRecHitProducerHCAL ()

Private Member Functions

reco::PFRecHitcreateHcalRecHit (const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom, unsigned newDetId=0)
void createRecHits (std::vector< reco::PFRecHit > &rechits, std::vector< reco::PFRecHit > &rechitsCleaned, edm::Event &, const edm::EventSetup &)
void findRecHitNeighbours (reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom, const CaloSubdetectorTopology &endcapTopo, const CaloSubdetectorGeometry &endcapGeom)
void findRecHitNeighboursCT (reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits, const CaloSubdetectorTopology &topology)
DetId getNorth (const DetId &id, const CaloSubdetectorTopology &topology)
DetId getSouth (const DetId &id, const CaloSubdetectorTopology &topology)

Private Attributes

bool applyLongShortDPG_
bool applyPulseDPG_
bool applyTimeDPG_
bool ECAL_Compensate_
double ECAL_Compensation_
unsigned int ECAL_Dead_Code_
double ECAL_Threshold_
double EM_Depth_
double HAD_Depth_
bool HCAL_Calib_
float HCAL_Calib_29
int hcalHFDigiTimeFlagValue_
int hcalHFInTimeWindowFlagValue_
int hcalHFLongShortFlagValue_
int HcalMaxAllowedChannelStatusSev_
int HcalMaxAllowedHFDigiTimeSev_
int HcalMaxAllowedHFInTimeWindowSev_
int HcalMaxAllowedHFLongShortSev_
bool HF_Calib_
float HF_Calib_29
edm::InputTag inputTagCaloTowers_
edm::InputTag inputTagHcalRecHitsHBHE_
edm::InputTag inputTagHcalRecHitsHF_
double longFibre_Cut
double longFibre_Fraction
double longShortFibre_Cut
int m_maxDepthHB
int m_maxDepthHE
HcalTopologyMode::Mode m_mode
double maxLongTiming_Cut
double maxShortTiming_Cut
double minLongTiming_Cut
double minShortTiming_Cut
bool navigation_HF_
double shortFibre_Cut
double shortFibre_Fraction
double thresh_HF_
 threshold for HF
double weight_HFem_
double weight_HFhad_

Detailed Description

Producer for particle flow rechits (PFRecHit) in HCAL.

Author:
Colin Bernet
Date:
february 2008

Definition at line 34 of file PFRecHitProducerHCAL.h.


Constructor & Destructor Documentation

PFRecHitProducerHCAL::PFRecHitProducerHCAL ( const edm::ParameterSet iConfig) [explicit]

Definition at line 41 of file PFRecHitProducerHCAL.cc.

References applyLongShortDPG_, applyPulseDPG_, applyTimeDPG_, ECAL_Compensate_, ECAL_Compensation_, ECAL_Dead_Code_, ECAL_Threshold_, EM_Depth_, edm::ParameterSet::getParameter(), HAD_Depth_, HCAL_Calib_, HCAL_Calib_29, hcalHFDigiTimeFlagValue_, hcalHFInTimeWindowFlagValue_, hcalHFLongShortFlagValue_, HcalMaxAllowedChannelStatusSev_, HcalMaxAllowedHFDigiTimeSev_, HcalMaxAllowedHFInTimeWindowSev_, HcalMaxAllowedHFLongShortSev_, HF_Calib_, HF_Calib_29, HcalCaloFlagLabels::HFDigiTime, HcalCaloFlagLabels::HFInTimeWindow, HcalCaloFlagLabels::HFLongShort, inputTagCaloTowers_, inputTagHcalRecHitsHBHE_, inputTagHcalRecHitsHF_, longFibre_Cut, longFibre_Fraction, longShortFibre_Cut, maxLongTiming_Cut, maxShortTiming_Cut, minLongTiming_Cut, minShortTiming_Cut, navigation_HF_, shortFibre_Cut, shortFibre_Fraction, thresh_HF_, weight_HFem_, and weight_HFhad_.

  : PFRecHitProducer( iConfig )
{
  // access to the collections of rechits 
  
  inputTagHcalRecHitsHBHE_ =
    iConfig.getParameter<InputTag>("hcalRecHitsHBHE");
    
  inputTagHcalRecHitsHF_ =
    iConfig.getParameter<InputTag>("hcalRecHitsHF");
    
 
  inputTagCaloTowers_ = 
    iConfig.getParameter<InputTag>("caloTowers");
   
  thresh_HF_ = 
    iConfig.getParameter<double>("thresh_HF");
  navigation_HF_ = 
    iConfig.getParameter<bool>("navigation_HF");
  weight_HFem_ =
    iConfig.getParameter<double>("weight_HFem");
  weight_HFhad_ =
    iConfig.getParameter<double>("weight_HFhad");

  HCAL_Calib_ =
    iConfig.getParameter<bool>("HCAL_Calib");
  HF_Calib_ =
    iConfig.getParameter<bool>("HF_Calib");
  HCAL_Calib_29 = 
    iConfig.getParameter<double>("HCAL_Calib_29");
  HF_Calib_29 = 
    iConfig.getParameter<double>("HF_Calib_29");

  shortFibre_Cut = iConfig.getParameter<double>("ShortFibre_Cut");
  longFibre_Fraction = iConfig.getParameter<double>("LongFibre_Fraction");

  longFibre_Cut = iConfig.getParameter<double>("LongFibre_Cut");
  shortFibre_Fraction = iConfig.getParameter<double>("ShortFibre_Fraction");

  applyLongShortDPG_ = iConfig.getParameter<bool>("ApplyLongShortDPG");

  longShortFibre_Cut = iConfig.getParameter<double>("LongShortFibre_Cut");
  minShortTiming_Cut = iConfig.getParameter<double>("MinShortTiming_Cut");
  maxShortTiming_Cut = iConfig.getParameter<double>("MaxShortTiming_Cut");
  minLongTiming_Cut = iConfig.getParameter<double>("MinLongTiming_Cut");
  maxLongTiming_Cut = iConfig.getParameter<double>("MaxLongTiming_Cut");

  applyTimeDPG_ = iConfig.getParameter<bool>("ApplyTimeDPG");
  applyPulseDPG_ = iConfig.getParameter<bool>("ApplyPulseDPG");
  HcalMaxAllowedHFLongShortSev_ = iConfig.getParameter<int>("HcalMaxAllowedHFLongShortSev");
  HcalMaxAllowedHFDigiTimeSev_ = iConfig.getParameter<int>("HcalMaxAllowedHFDigiTimeSev");
  HcalMaxAllowedHFInTimeWindowSev_ = iConfig.getParameter<int>("HcalMaxAllowedHFInTimeWindowSev");
  HcalMaxAllowedChannelStatusSev_ = iConfig.getParameter<int>("HcalMaxAllowedChannelStatusSev");

  ECAL_Compensate_ = iConfig.getParameter<bool>("ECAL_Compensate");
  ECAL_Threshold_ = iConfig.getParameter<double>("ECAL_Threshold");
  ECAL_Compensation_ = iConfig.getParameter<double>("ECAL_Compensation");
  ECAL_Dead_Code_ = iConfig.getParameter<unsigned int>("ECAL_Dead_Code");

  EM_Depth_ = iConfig.getParameter<double>("EM_Depth");
  HAD_Depth_ = iConfig.getParameter<double>("HAD_Depth");

  //Get integer values of individual HCAL HF flags
  hcalHFLongShortFlagValue_=1<<HcalCaloFlagLabels::HFLongShort;
  hcalHFDigiTimeFlagValue_=1<<HcalCaloFlagLabels::HFDigiTime;
  hcalHFInTimeWindowFlagValue_=1<<HcalCaloFlagLabels::HFInTimeWindow;


  //--ab
  produces<reco::PFRecHitCollection>("HFHAD").setBranchAlias("HFHADRecHits");
  produces<reco::PFRecHitCollection>("HFEM").setBranchAlias("HFEMRecHits");
  //--ab
}
PFRecHitProducerHCAL::~PFRecHitProducerHCAL ( )

Definition at line 117 of file PFRecHitProducerHCAL.cc.

{}

Member Function Documentation

reco::PFRecHit * PFRecHitProducerHCAL::createHcalRecHit ( const DetId detid,
double  energy,
PFLayer::Layer  layer,
const CaloSubdetectorGeometry geom,
unsigned  newDetId = 0 
) [private]

Definition at line 1057 of file PFRecHitProducerHCAL.cc.

References cond::rpcobgas::detid, EM_Depth_, CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), HAD_Depth_, PFLayer::HF_EM, PFLayer::HF_HAD, position, DetId::rawId(), reco::PFRecHit::setNECorner(), reco::PFRecHit::setNWCorner(), reco::PFRecHit::setSECorner(), reco::PFRecHit::setSWCorner(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.

                                                            {
  
  const CaloCellGeometry *thisCell = geom->getGeometry(detid);
  if(!thisCell) {
    edm::LogError("PFRecHitProducerHCAL")
      <<"warning detid "<<detid.rawId()<<" not found in layer "
      <<layer<<endl;
    return 0;
  }
  
  const GlobalPoint& position = thisCell->getPosition();
  
  double depth_correction = 0.;
  switch ( layer ) { 
  case PFLayer::HF_EM:
    depth_correction = position.z() > 0. ? EM_Depth_ : -EM_Depth_;
    break;
  case PFLayer::HF_HAD:
    depth_correction = position.z() > 0. ? HAD_Depth_ : -HAD_Depth_;
    break;
  default:
    break;
  }

  unsigned id = detid;
  if(newDetId) id = newDetId;
  reco::PFRecHit *rh = 
    new reco::PFRecHit( id,  layer, energy, 
                        position.x(), position.y(), position.z()+depth_correction, 
                        0,0,0 );
 
  
  
  
  // set the corners
  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();

  assert( corners.size() == 8 );

  rh->setNECorner( corners[0].x(), corners[0].y(),  corners[0].z()+depth_correction );
  rh->setSECorner( corners[1].x(), corners[1].y(),  corners[1].z()+depth_correction );
  rh->setSWCorner( corners[2].x(), corners[2].y(),  corners[2].z()+depth_correction );
  rh->setNWCorner( corners[3].x(), corners[3].y(),  corners[3].z()+depth_correction );
 
  return rh;
}
void PFRecHitProducerHCAL::createRecHits ( std::vector< reco::PFRecHit > &  rechits,
std::vector< reco::PFRecHit > &  rechitsCleaned,
edm::Event ,
const edm::EventSetup  
) [private, virtual]

gets hcal barrel and endcap rechits, translate them to PFRecHits, which are stored in the rechits vector

Implements PFRecHitProducer.

void PFRecHitProducerHCAL::findRecHitNeighbours ( reco::PFRecHit rh,
const std::map< unsigned, unsigned > &  sortedHits,
const CaloSubdetectorTopology barrelTopo,
const CaloSubdetectorGeometry barrelGeom,
const CaloSubdetectorTopology endcapTopo,
const CaloSubdetectorGeometry endcapGeom 
) [private]

find and set the neighbours to a given rechit this works for ecal, hcal, ps

void PFRecHitProducerHCAL::findRecHitNeighboursCT ( reco::PFRecHit rh,
const std::map< unsigned, unsigned > &  sortedHits,
const CaloSubdetectorTopology topology 
) [private]

find and set the neighbours to a given rechit this works for hcal CaloTowers. Should be possible to have a single function for all detectors

Definition at line 1305 of file PFHCALDualTimeRecHitProducer.cc.

References reco::PFRecHit::add4Neighbour(), reco::PFRecHit::add8Neighbour(), reco::PFRecHit::detId(), east, CaloSubdetectorTopology::east(), PFLayer::HF_EM, PFLayer::HF_HAD, i, reco::PFRecHit::layer(), north, CaloSubdetectorTopology::north(), DetId::rawId(), south, CaloSubdetectorTopology::south(), CaloSubdetectorTopology::west(), and west.

                                            {
  //cout<<"------PFRecHitProducerHcaL:findRecHitNeighboursCT navigation value "<<navigation_HF_<<endl;
  //  cout<<"----------- rechit print out"<<endl;
  // if(( rh.layer() == PFLayer::HF_HAD )||(rh.layer() == PFLayer::HF_EM)) {  
    
  //    cout<<rh<<endl;
    //  }
  if(navigation_HF_ == false){
    if( rh.layer() == PFLayer::HF_HAD )
      return;
    if( rh.layer() == PFLayer::HF_EM )
      return;
  }
  CaloTowerDetId ctDetId( rh.detId() );
    

  vector<DetId> northids = topology.north(ctDetId);
  vector<DetId> westids = topology.west(ctDetId);
  vector<DetId> southids = topology.south(ctDetId);
  vector<DetId> eastids = topology.east(ctDetId);


  CaloTowerDetId badId;

  // all the following detids will be CaloTowerDetId
  CaloTowerDetId north;
  CaloTowerDetId northwest;
  CaloTowerDetId northwest2;
  CaloTowerDetId west;
  CaloTowerDetId west2;
  CaloTowerDetId southwest;
  CaloTowerDetId southwest2;
  CaloTowerDetId south;
  CaloTowerDetId southeast;
  CaloTowerDetId southeast2;
  CaloTowerDetId east;
  CaloTowerDetId east2;
  CaloTowerDetId northeast;
  CaloTowerDetId northeast2;
  
  // for north and south, there is no ambiguity : 1 or 0 neighbours
  
  switch( northids.size() ) {
  case 0: 
    break;
  case 1: 
    north = northids[0];
    break;
  default:
  stringstream err("PFHCALDualTimeRecHitProducer::findRecHitNeighboursCT : incorrect number of neighbours north: "); 
    err<<northids.size();
    throw( err.str() ); 
  }

  switch( southids.size() ) {
  case 0: 
    break;
  case 1: 
    south = southids[0];
    break;
  default:
  stringstream err("PFHCALDualTimeRecHitProducer::findRecHitNeighboursCT : incorrect number of neighbours south: "); 
    err<<southids.size();
    throw( err.str() ); 
  }
  
  // for east and west, one must take care 
  // of the pitch change in HCAL endcap.

  switch( eastids.size() ) {
  case 0: 
    break;
  case 1: 
    east = eastids[0];
    northeast = getNorth(east, topology);
    southeast = getSouth(east, topology);
    break;
  case 2:  
    // in this case, 0 is more on the north than 1
    east = eastids[0];
    east2 = eastids[1];
    northeast = getNorth(east, topology );
    southeast = getSouth(east2, topology);    
    northeast2 = getNorth(northeast, topology );
    southeast2 = getSouth(southeast, topology);    
    break;
  default:
  stringstream err("PFHCALDualTimeRecHitProducer::findRecHitNeighboursCT : incorrect number of neighbours eastids: "); 
    err<<eastids.size();
    throw( err.str() ); 
  }
  
  
  switch( westids.size() ) {
  case 0: 
    break;
  case 1: 
    west = westids[0];
    northwest = getNorth(west, topology);
    southwest = getSouth(west, topology);
    break;
  case 2:  
    // in this case, 0 is more on the north than 1
    west = westids[0];
    west2 = westids[1];
    northwest = getNorth(west, topology );
    southwest = getSouth(west2, topology );    
    northwest2 = getNorth(northwest, topology );
    southwest2 = getSouth(southwest, topology );    
    break;
  default:
  stringstream err("PFHCALDualTimeRecHitProducer::findRecHitNeighboursCT : incorrect number of neighbours westids: "); 
    err<< westids.size();
    throw( err.str() ); 
  }




  // find and set neighbours
    
  IDH i = sortedHits.find( north.rawId() );
  if(i != sortedHits.end() ) 
    rh.add4Neighbour( i->second );
  
  i = sortedHits.find( northeast.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );
  
  i = sortedHits.find( northeast2.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );
  
  i = sortedHits.find( south.rawId() );
  if(i != sortedHits.end() ) 
    rh.add4Neighbour( i->second );
    
  i = sortedHits.find( southwest.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );
    
  i = sortedHits.find( southwest2.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );
    
  i = sortedHits.find( east.rawId() );
  if(i != sortedHits.end() ) 
    rh.add4Neighbour( i->second );
    
  i = sortedHits.find( east2.rawId() );
  if(i != sortedHits.end() ) 
    rh.add4Neighbour( i->second );
    
  i = sortedHits.find( southeast.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );
    
  i = sortedHits.find( southeast2.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );
    
  i = sortedHits.find( west.rawId() );
  if(i != sortedHits.end() ) 
     rh.add4Neighbour( i->second );
   
  i = sortedHits.find( west2.rawId() );
  if(i != sortedHits.end() ) 
     rh.add4Neighbour( i->second );
   
  i = sortedHits.find( northwest.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );

  i = sortedHits.find( northwest2.rawId() );
  if(i != sortedHits.end() ) 
    rh.add8Neighbour( i->second );

  //  cout<<"----------- rechit print out"<<endl;
  // if(( rh.layer() == PFLayer::HF_HAD )||(rh.layer() == PFLayer::HF_EM)) {  
    
  //   cout<<rh<<endl;
    //  }
}
DetId PFRecHitProducerHCAL::getNorth ( const DetId id,
const CaloSubdetectorTopology topology 
) [private]

Definition at line 1436 of file PFRecHitProducerHCAL.cc.

References north, and CaloSubdetectorTopology::north().

                                                                        {

  DetId north;
  vector<DetId> nids = topology.north(id);
  if(nids.size() == 1)
    north = nids[0];
  
  return north;
} 
DetId PFRecHitProducerHCAL::getSouth ( const DetId id,
const CaloSubdetectorTopology topology 
) [private]

Definition at line 1422 of file PFRecHitProducerHCAL.cc.

References south, and CaloSubdetectorTopology::south().

                                                                        {

  DetId south;
  vector<DetId> sids = topology.south(id);
  if(sids.size() == 1)
    south = sids[0];
  
  return south;
} 

Member Data Documentation

Definition at line 111 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 121 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 120 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 132 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 134 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

unsigned int PFRecHitProducerHCAL::ECAL_Dead_Code_ [private]

Definition at line 135 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 133 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 138 of file PFRecHitProducerHCAL.h.

Referenced by createHcalRecHit(), and PFRecHitProducerHCAL().

Definition at line 139 of file PFRecHitProducerHCAL.h.

Referenced by createHcalRecHit(), and PFRecHitProducerHCAL().

Definition at line 97 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 99 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 128 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 129 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 127 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 125 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 123 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 124 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 122 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 98 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 100 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 87 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 85 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 86 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 107 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 104 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 114 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 142 of file PFRecHitProducerHCAL.h.

Definition at line 143 of file PFRecHitProducerHCAL.h.

Definition at line 141 of file PFRecHitProducerHCAL.h.

Definition at line 118 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 116 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 117 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 115 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 92 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 103 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 108 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

threshold for HF

Definition at line 90 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 93 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

Definition at line 94 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().