CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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::ProductRegistryHelper

Public Member Functions

 PFRecHitProducerHCAL (const edm::ParameterSet &)
 
 ~PFRecHitProducerHCAL ()
 
- Public Member Functions inherited from PFRecHitProducer
virtual void beginRun (edm::Run &run, const edm::EventSetup &es)
 
virtual void endRun ()
 
 PFRecHitProducer (const edm::ParameterSet &)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~PFRecHitProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 
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 More...
 
double weight_HFem_
 
double weight_HFhad_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Types inherited from PFRecHitProducer
typedef std::map< unsigned,
unsigned >::const_iterator 
IDH
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from PFRecHitProducer
const HcalPFCorrsmyPFCorr
 
const EcalChannelStatustheEcalChStatus
 
const HcalChannelQualitytheHcalChStatus
 
const CaloTowerConstituentsMaptheTowerConstituentsMap
 
double thresh_Barrel_
 rechits with E < threshold will not give rise to a PFRecHit More...
 
double thresh_Endcap_
 
bool verbose_
 verbose ? More...
 

Detailed Description

Producer for particle flow rechits (PFRecHit) in HCAL.

Author
Colin Bernet
Date
february 2008

Definition at line 33 of file PFRecHitProducerHCAL.h.

Constructor & Destructor Documentation

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

Definition at line 42 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_.

43  : PFRecHitProducer( iConfig )
44 {
45 
46 
47 
48  // access to the collections of rechits
49 
50 
52  iConfig.getParameter<InputTag>("hcalRecHitsHBHE");
53 
55  iConfig.getParameter<InputTag>("hcalRecHitsHF");
56 
57 
59  iConfig.getParameter<InputTag>("caloTowers");
60 
61  thresh_HF_ =
62  iConfig.getParameter<double>("thresh_HF");
64  iConfig.getParameter<bool>("navigation_HF");
65  weight_HFem_ =
66  iConfig.getParameter<double>("weight_HFem");
68  iConfig.getParameter<double>("weight_HFhad");
69 
70  HCAL_Calib_ =
71  iConfig.getParameter<bool>("HCAL_Calib");
72  HF_Calib_ =
73  iConfig.getParameter<bool>("HF_Calib");
74  HCAL_Calib_29 =
75  iConfig.getParameter<double>("HCAL_Calib_29");
76  HF_Calib_29 =
77  iConfig.getParameter<double>("HF_Calib_29");
78 
79  shortFibre_Cut = iConfig.getParameter<double>("ShortFibre_Cut");
80  longFibre_Fraction = iConfig.getParameter<double>("LongFibre_Fraction");
81 
82  longFibre_Cut = iConfig.getParameter<double>("LongFibre_Cut");
83  shortFibre_Fraction = iConfig.getParameter<double>("ShortFibre_Fraction");
84 
85  applyLongShortDPG_ = iConfig.getParameter<bool>("ApplyLongShortDPG");
86 
87  longShortFibre_Cut = iConfig.getParameter<double>("LongShortFibre_Cut");
88  minShortTiming_Cut = iConfig.getParameter<double>("MinShortTiming_Cut");
89  maxShortTiming_Cut = iConfig.getParameter<double>("MaxShortTiming_Cut");
90  minLongTiming_Cut = iConfig.getParameter<double>("MinLongTiming_Cut");
91  maxLongTiming_Cut = iConfig.getParameter<double>("MaxLongTiming_Cut");
92 
93  applyTimeDPG_ = iConfig.getParameter<bool>("ApplyTimeDPG");
94  applyPulseDPG_ = iConfig.getParameter<bool>("ApplyPulseDPG");
95  HcalMaxAllowedHFLongShortSev_ = iConfig.getParameter<int>("HcalMaxAllowedHFLongShortSev");
96  HcalMaxAllowedHFDigiTimeSev_ = iConfig.getParameter<int>("HcalMaxAllowedHFDigiTimeSev");
97  HcalMaxAllowedHFInTimeWindowSev_ = iConfig.getParameter<int>("HcalMaxAllowedHFInTimeWindowSev");
98  HcalMaxAllowedChannelStatusSev_ = iConfig.getParameter<int>("HcalMaxAllowedChannelStatusSev");
99 
100  ECAL_Compensate_ = iConfig.getParameter<bool>("ECAL_Compensate");
101  ECAL_Threshold_ = iConfig.getParameter<double>("ECAL_Threshold");
102  ECAL_Compensation_ = iConfig.getParameter<double>("ECAL_Compensation");
103  ECAL_Dead_Code_ = iConfig.getParameter<unsigned int>("ECAL_Dead_Code");
104 
105  EM_Depth_ = iConfig.getParameter<double>("EM_Depth");
106  HAD_Depth_ = iConfig.getParameter<double>("HAD_Depth");
107 
108  //Get integer values of individual HCAL HF flags
112 
113 
114  //--ab
115  produces<reco::PFRecHitCollection>("HFHAD").setBranchAlias("HFHADRecHits");
116  produces<reco::PFRecHitCollection>("HFEM").setBranchAlias("HFEMRecHits");
117  //--ab
118 }
T getParameter(std::string const &) const
PFRecHitProducer(const edm::ParameterSet &)
edm::InputTag inputTagCaloTowers_
edm::InputTag inputTagHcalRecHitsHF_
edm::InputTag inputTagHcalRecHitsHBHE_
double thresh_HF_
threshold for HF
PFRecHitProducerHCAL::~PFRecHitProducerHCAL ( )

Definition at line 122 of file PFRecHitProducerHCAL.cc.

122 {}

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 1061 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(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by createRecHits().

1065  {
1066 
1067  const CaloCellGeometry *thisCell = geom->getGeometry(detid);
1068  if(!thisCell) {
1069  edm::LogError("PFRecHitProducerHCAL")
1070  <<"warning detid "<<detid.rawId()<<" not found in layer "
1071  <<layer<<endl;
1072  return 0;
1073  }
1074 
1075  const GlobalPoint& position = thisCell->getPosition();
1076 
1077  double depth_correction = 0.;
1078  switch ( layer ) {
1079  case PFLayer::HF_EM:
1080  depth_correction = position.z() > 0. ? EM_Depth_ : -EM_Depth_;
1081  break;
1082  case PFLayer::HF_HAD:
1083  depth_correction = position.z() > 0. ? HAD_Depth_ : -HAD_Depth_;
1084  break;
1085  default:
1086  break;
1087  }
1088 
1089  unsigned id = detid;
1090  if(newDetId) id = newDetId;
1091  reco::PFRecHit *rh =
1092  new reco::PFRecHit( id, layer, energy,
1093  position.x(), position.y(), position.z()+depth_correction,
1094  0,0,0 );
1095 
1096 
1097 
1098 
1099  // set the corners
1100  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
1101 
1102  assert( corners.size() == 8 );
1103 
1104  rh->setNECorner( corners[0].x(), corners[0].y(), corners[0].z()+depth_correction );
1105  rh->setSECorner( corners[1].x(), corners[1].y(), corners[1].z()+depth_correction );
1106  rh->setSWCorner( corners[2].x(), corners[2].y(), corners[2].z()+depth_correction );
1107  rh->setNWCorner( corners[3].x(), corners[3].y(), corners[3].z()+depth_correction );
1108 
1109  return rh;
1110 }
void setSECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:226
void setNECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:231
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
double double double z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void setSWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:221
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
T z() const
Definition: PV3DBase.h:63
void setNWCorner(double posx, double posy, double posz)
search for pointers to neighbours, using neighbours&#39; DetId.
Definition: PFRecHit.cc:216
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:61
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
void PFRecHitProducerHCAL::createRecHits ( std::vector< reco::PFRecHit > &  rechits,
std::vector< reco::PFRecHit > &  rechitsCleaned,
edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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

if ( !theStatusValue )

if ( !theStatusValue )

if ( !theStatusValue )

if ( !theStatusValue )

Implements PFRecHitProducer.

Definition at line 126 of file PFRecHitProducerHCAL.cc.

References abs, applyLongShortDPG_, applyPulseDPG_, applyTimeDPG_, HiRecoJets_cff::caloTowers, CaloTower::constituents(), CaloTowerConstituentsMap::constituentsOf(), CaloTower::constituentsSize(), createHcalRecHit(), CaloRecHit::detid(), cond::rpcobgas::detid, alignCSCRings::e, DetId::Ecal, ECAL_Compensate_, ECAL_Compensation_, ECAL_Dead_Code_, ECAL_Threshold_, CaloTower::emEnergy(), EcalCondObjectContainer< T >::end(), CaloRecHit::energy(), relval_parameters_module::energy, edm::hlt::Exception, EcalCondObjectContainer< T >::find(), findRecHitNeighbours(), findRecHitNeighboursCT(), newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), CaloTower::hadEnergy(), patZpeak::handle, DetId::Hcal, PFLayer::HCAL_BARREL1, HCAL_Calib_, HCAL_Calib_29, PFLayer::HCAL_ENDCAP, HcalBarrel, HcalEndcap, HcalForward, hcalHFDigiTimeFlagValue_, hcalHFInTimeWindowFlagValue_, hcalHFLongShortFlagValue_, HcalMaxAllowedChannelStatusSev_, HcalMaxAllowedHFDigiTimeSev_, HcalMaxAllowedHFInTimeWindowSev_, HcalMaxAllowedHFLongShortSev_, HcalOuter, HF_Calib_, HF_Calib_29, PFLayer::HF_EM, PFLayer::HF_HAD, i, CaloTower::id(), HcalDetId::ieta(), inputTagCaloTowers_, inputTagHcalRecHitsHBHE_, inputTagHcalRecHitsHF_, HcalDetId::iphi(), edm::HandleBase::isValid(), j, longFibre_Cut, longFibre_Fraction, longShortFibre_Cut, max(), maxLongTiming_Cut, maxShortTiming_Cut, minLongTiming_Cut, minShortTiming_Cut, edm::ESHandle< class >::product(), edm::Event::put(), DetId::rawId(), reco::PFRecHit::setEnergyUp(), reco::PFRecHit::setRescale(), shortFibre_Cut, shortFibre_Fraction, HcalDetId::subdet(), PFRecHitProducer::theEcalChStatus, PFRecHitProducer::theHcalChStatus, PFRecHitProducer::theTowerConstituentsMap, PFRecHitProducer::thresh_Barrel_, PFRecHitProducer::thresh_Endcap_, thresh_HF_, weight_HFem_, and weight_HFhad_.

129  {
130 
131 
132  // this map is necessary to find the rechit neighbours efficiently
133  //C but I should think about using Florian's hashed index to do this.
134  //C in which case the map might not be necessary anymore
135  //C however the hashed index does not seem to be implemented for HCAL
136  //
137  // the key of this map is detId.
138  // the value is the index in the rechits vector
139  map<unsigned, unsigned > idSortedRecHits;
140  map<unsigned, unsigned > idSortedRecHitsHFEM;
141  map<unsigned, unsigned > idSortedRecHitsHFHAD;
142  typedef map<unsigned, unsigned >::iterator IDH;
143 
144 
145  edm::ESHandle<CaloGeometry> geoHandle;
146  iSetup.get<CaloGeometryRecord>().get(geoHandle);
147 
148  // get the hcalBarrel geometry
149  const CaloSubdetectorGeometry *hcalBarrelGeometry =
150  geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalBarrel);
151 
152  // get the endcap geometry
153  const CaloSubdetectorGeometry *hcalEndcapGeometry =
154  geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalEndcap);
155 
156  // Get Hcal Severity Level Computer, so that the severity of each rechit flag/status may be determined
157  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
158  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
159  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
160 
161  //--ab
162  auto_ptr< vector<reco::PFRecHit> > HFHADRecHits( new vector<reco::PFRecHit> );
163  auto_ptr< vector<reco::PFRecHit> > HFEMRecHits( new vector<reco::PFRecHit> );
164  //--ab
165 
166  // 2 possibilities to make HCAL clustering :
167  // - from the HCAL rechits
168  // - from the CaloTowers.
169  // ultimately, clustering will be done taking CaloTowers as an
170  // input. This possibility is currently under investigation, and
171  // was thus made optional.
172 
173  // in the first step, we will fill the map of PFRecHits hcalrechits
174  // either from CaloTowers or from HCAL rechits.
175 
176  // in the second step, we will perform clustering on this map.
177 
178  if( !(inputTagCaloTowers_ == InputTag()) ) {
179 
181  CaloTowerTopology caloTowerTopology;
182  const CaloSubdetectorGeometry *caloTowerGeometry = 0;
183  // = geometry_->getSubdetectorGeometry(id)
184 
185  // get calotowers
186  bool found = iEvent.getByLabel(inputTagCaloTowers_,
187  caloTowers);
188 
189  if(!found) {
190  ostringstream err;
191  err<<"could not find rechits "<<inputTagCaloTowers_;
192  LogError("PFRecHitProducerHCAL")<<err.str()<<endl;
193 
194  throw cms::Exception( "MissingProduct", err.str());
195  }
196  else {
197  assert( caloTowers.isValid() );
198 
199  // get HF rechits
201  found = iEvent.getByLabel(inputTagHcalRecHitsHF_,
202  hfHandle);
203 
204  if(!found) {
205  ostringstream err;
206  err<<"could not find HF rechits "<<inputTagHcalRecHitsHF_;
207  LogError("PFRecHitProducerHCAL")<<err.str()<<endl;
208 
209  throw cms::Exception( "MissingProduct", err.str());
210  }
211  else {
212  assert( hfHandle.isValid() );
213  }
214 
215  // get HBHE rechits
217  found = iEvent.getByLabel(inputTagHcalRecHitsHBHE_,
218  hbheHandle);
219 
220  if(!found) {
221  ostringstream err;
222  err<<"could not find HBHE rechits "<<inputTagHcalRecHitsHBHE_;
223  LogError("PFRecHitProducerHCAL")<<err.str()<<endl;
224 
225  throw cms::Exception( "MissingProduct", err.str());
226  }
227  else {
228  assert( hbheHandle.isValid() );
229  }
230 
231  // create rechits
233 
234  for(ICT ict=caloTowers->begin(); ict!=caloTowers->end();ict++) {
235 
236  const CaloTower& ct = (*ict);
237 
238  //C
239  if(!caloTowerGeometry)
240  caloTowerGeometry = geoHandle->getSubdetectorGeometry(ct.id());
241 
242 
243  // get the hadronic energy.
244 
245  // Mike: Just ask for the Hadronic part only now!
246  // Patrick : ARGH ! While this is ok for the HCAL, this is
247  // just wrong for the HF (in which em/had are artificially
248  // separated.
249  double energy = ct.hadEnergy();
250  //Auguste: Photons in HF have no hadEnergy in fastsim: -> all RecHit collections are empty with photons.
251  double energyEM = ct.emEnergy(); // For HF !
252  //so test the total energy to deal with the photons in HF:
253  if( (energy+energyEM) < 1e-9 ) continue;
254 
255  assert( ct.constituentsSize() );
256  //Mike: The DetId will be taken by the first Hadronic constituent
257  // of the tower. That is only what we need
258 
259 
260  //get the constituents of the tower
261  const std::vector<DetId>& hits = ct.constituents();
262  const std::vector<DetId>& allConstituents = theTowerConstituentsMap->constituentsOf(ct.id());
263 
264  /*
265  for(unsigned int i=0;i< hits.size();++i) {
266  if(hits[i].det()==DetId::Hcal) {
267  HcalDetId did = hits[i];
268  if ( did.subdet()==HcalEndcap || did.subdet()==HcalForward ) {
269  //double en = hits[i].energy();
270  int ieta = did.ieta();
271  const CaloCellGeometry *thisCell = hcalEndcapGeometry->getGeometry(did);
272  const GlobalPoint& position = thisCell->getPosition();
273  if ( abs(ieta) > 27 && abs(ieta) < 33 && energy > 10. ) {
274  std::cout << "HE/HF hit " << i << " at eta = " << ieta
275  << " with CT energy = " << energy
276  << " at eta, z (hit) = " << position.eta() << " " << position.z()
277  << " at eta, z (cte) = " << ct.emPosition().eta() << " " << ct.emPosition().z()
278  << " at eta, z (cth) = " << ct.hadPosition().eta() << " " << ct.hadPosition().z()
279  << " at eta, z (cto) = " << ct.eta() << " " << ct.vz()
280  << std::endl;
281  }
282  }
283  }
284  }
285  */
286 
287  //Reserve the DetId we are looking for:
288 
290  // EcalDetId edetid;
291  bool foundHCALConstituent = false;
292 
293 
294  //Loop on the calotower constituents and search for HCAL
295  double dead = 0.;
296  double alive = 0.;
297  for(unsigned int i=0;i< hits.size();++i) {
298  if(hits[i].det()==DetId::Hcal) {
299  foundHCALConstituent = true;
300  detid = hits[i];
301  // An HCAL tower was found: Look for dead ECAL channels in the same CaloTower.
302  if ( ECAL_Compensate_ && energy > ECAL_Threshold_ ) {
303  for(unsigned int j=0;j<allConstituents.size();++j) {
304  if ( allConstituents[j].det()==DetId::Ecal ) {
305  alive += 1.;
306  EcalChannelStatus::const_iterator chIt = theEcalChStatus->find(allConstituents[j]);
307  unsigned int dbStatus = chIt != theEcalChStatus->end() ? chIt->getStatusCode() : 0;
308  if ( dbStatus > ECAL_Dead_Code_ ) dead += 1.;
309  }
310  }
311  }
312  // Protection: tower 29 in HF is merged with tower 30.
313  // Just take the position of tower 30 in that case.
314  if ( detid.subdet() == HcalForward && abs(detid.ieta()) == 29 ) continue;
315  break;
316  }
317  }
318 
319  // In case of dead ECAL channel, rescale the HCAL energy...
320  double rescaleFactor = alive > 0. ? 1. + ECAL_Compensation_*dead/alive : 1.;
321 
322  reco::PFRecHit* pfrh = 0;
323  reco::PFRecHit* pfrhCleaned = 0;
324  //---ab: need 2 rechits for the HF:
325  reco::PFRecHit* pfrhHFEM = 0;
326  reco::PFRecHit* pfrhHFHAD = 0;
327  reco::PFRecHit* pfrhHFEMCleaned = 0;
328  reco::PFRecHit* pfrhHFHADCleaned = 0;
329  reco::PFRecHit* pfrhHFEMCleaned29 = 0;
330  reco::PFRecHit* pfrhHFHADCleaned29 = 0;
331 
332  if(foundHCALConstituent)
333  {
334  // std::cout << ", new Energy = " << energy << std::endl;
335  switch( detid.subdet() ) {
336  case HcalBarrel:
337  {
338  if(energy < thresh_Barrel_ ) continue;
339 
340  /*
341  // Check the timing
342  if ( energy > 5. ) {
343  for(unsigned int i=0;i< hits.size();++i) {
344  if( hits[i].det() != DetId::Hcal ) continue;
345  HcalDetId theDetId = hits[i];
346  typedef HBHERecHitCollection::const_iterator iHBHE;
347  iHBHE theHit = hbheHandle->find(theDetId);
348  if ( theHit != hbheHandle->end() )
349  std::cout << "HCAL hit : "
350  << theDetId.ieta() << " " << theDetId.iphi() << " "
351  << theHit->energy() << " " << theHit->time() << std::endl;
352  }
353  }
354  */
355 
356 
357  // if ( HCAL_Calib_ ) energy *= std::min(max_Calib_,myPFCorr->getValues(detid)->getValue());
358  //if ( rescaleFactor > 1. )
359  // std::cout << "Barrel HCAL energy rescaled from = " << energy << " to " << energy*rescaleFactor << std::endl;
360  if ( rescaleFactor > 1. ) {
361  pfrhCleaned = createHcalRecHit( detid,
362  energy,
364  hcalBarrelGeometry,
365  ct.id().rawId() );
366  pfrhCleaned->setRescale(rescaleFactor);
367  energy *= rescaleFactor;
368  }
369  pfrh = createHcalRecHit( detid,
370  energy,
372  hcalBarrelGeometry,
373  ct.id().rawId() );
374  pfrh->setRescale(rescaleFactor);
375  }
376  break;
377  case HcalEndcap:
378  {
379  if(energy < thresh_Endcap_ ) continue;
380 
381  /*
382  // Check the timing
383  if ( energy > 5. ) {
384  for(unsigned int i=0;i< hits.size();++i) {
385  if( hits[i].det() != DetId::Hcal ) continue;
386  HcalDetId theDetId = hits[i];
387  typedef HBHERecHitCollection::const_iterator iHBHE;
388  iHBHE theHit = hbheHandle->find(theDetId);
389  if ( theHit != hbheHandle->end() )
390  std::cout << "HCAL hit : "
391  << theDetId.ieta() << " " << theDetId.iphi() << " "
392  << theHit->energy() << " " << theHit->time() << std::endl;
393  }
394  }
395  */
396 
397  // Apply tower 29 calibration
398  if ( HCAL_Calib_ && abs(detid.ieta()) == 29 ) energy *= HCAL_Calib_29;
399  //if ( rescaleFactor > 1. )
400  // std::cout << "End-cap HCAL energy rescaled from = " << energy << " to " << energy*rescaleFactor << std::endl;
401  if ( rescaleFactor > 1. ) {
402  pfrhCleaned = createHcalRecHit( detid,
403  energy,
405  hcalEndcapGeometry,
406  ct.id().rawId() );
407  pfrhCleaned->setRescale(rescaleFactor);
408  energy *= rescaleFactor;
409  }
410  pfrh = createHcalRecHit( detid,
411  energy,
413  hcalEndcapGeometry,
414  ct.id().rawId() );
415  pfrh->setRescale(rescaleFactor);
416  }
417  break;
418  case HcalOuter:
419  {
420  }
421  break;
422  case HcalForward:
423  {
424  //---ab: 2 rechits for HF:
425  //double energyemHF = weight_HFem_*ct.emEnergy();
426  //double energyhadHF = weight_HFhad_*ct.hadEnergy();
427  double energyemHF = weight_HFem_ * energyEM;
428  double energyhadHF = weight_HFhad_ * energy;
429  // Some energy in the tower !
430  if((energyemHF+energyhadHF) < thresh_HF_ ) continue;
431 
432  // Some cleaning in the HF
433  double longFibre = energyemHF + energyhadHF/2.;
434  double shortFibre = energyhadHF/2.;
435  int ieta = detid.ieta();
436  int iphi = detid.iphi();
437  HcalDetId theLongDetId (HcalForward, ieta, iphi, 1);
438  HcalDetId theShortDetId (HcalForward, ieta, iphi, 2);
440  iHF theLongHit = hfHandle->find(theLongDetId);
441  iHF theShortHit = hfHandle->find(theShortDetId);
442  //
443  double theLongHitEnergy = 0.;
444  double theShortHitEnergy = 0.;
445  bool flagShortDPG = false;
446  bool flagLongDPG = false;
447  bool flagShortTimeDPG = false;
448  bool flagLongTimeDPG = false;
449  bool flagShortPulseDPG = false;
450  bool flagLongPulseDPG = false;
451  //
452  if ( theLongHit != hfHandle->end() ) {
453  int theLongFlag = theLongHit->flags();
454  theLongHitEnergy = theLongHit->energy();
455  flagLongDPG = applyLongShortDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theLongDetId, theLongFlag & hcalHFLongShortFlagValue_, 0)> HcalMaxAllowedHFLongShortSev_);
456  flagLongTimeDPG = applyTimeDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theLongDetId, theLongFlag & hcalHFInTimeWindowFlagValue_, 0)> HcalMaxAllowedHFInTimeWindowSev_);
457  flagLongPulseDPG = applyPulseDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theLongDetId, theLongFlag & hcalHFDigiTimeFlagValue_, 0)> HcalMaxAllowedHFDigiTimeSev_);
458 
459  //flagLongDPG = applyLongShortDPG_ && theLongHit->flagField(HcalCaloFlagLabels::HFLongShort)==1;
460  //flagLongTimeDPG = applyTimeDPG_ && theLongHit->flagField(HcalCaloFlagLabels::HFInTimeWindow)==1;
461  //flagLongPulseDPG = applyPulseDPG_ && theLongHit->flagField(HcalCaloFlagLabels::HFDigiTime)==1;
462  }
463  //
464  if ( theShortHit != hfHandle->end() ) {
465  int theShortFlag = theShortHit->flags();
466  theShortHitEnergy = theShortHit->energy();
467  flagShortDPG = applyLongShortDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theShortDetId, theShortFlag & hcalHFLongShortFlagValue_, 0)> HcalMaxAllowedHFLongShortSev_);
468  flagShortTimeDPG = applyTimeDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theShortDetId, theShortFlag & hcalHFInTimeWindowFlagValue_, 0)> HcalMaxAllowedHFInTimeWindowSev_);
469  flagShortPulseDPG = applyPulseDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theShortDetId, theShortFlag & hcalHFDigiTimeFlagValue_, 0)> HcalMaxAllowedHFDigiTimeSev_);
470  //flagShortDPG = applyLongShortDPG_ && theShortHit->flagField(HcalCaloFlagLabels::HFLongShort)==1;
471  //flagShortTimeDPG = applyTimeDPG_ && theShortHit->flagField(HcalCaloFlagLabels::HFInTimeWindow)==1;
472  //flagShortPulseDPG = applyPulseDPG_ && theShortHit->flagField(HcalCaloFlagLabels::HFDigiTime)==1;
473  }
474 
475  // Then check the timing in short and long fibres in all other towers.
476  if ( theShortHitEnergy > longShortFibre_Cut &&
477  ( theShortHit->time() < minShortTiming_Cut ||
478  theShortHit->time() > maxShortTiming_Cut ||
479  flagShortTimeDPG || flagShortPulseDPG ) ) {
480  // rescaleFactor = 0. ;
481  pfrhHFHADCleaned = createHcalRecHit( detid,
482  theShortHitEnergy,
484  hcalEndcapGeometry,
485  ct.id().rawId() );
486  pfrhHFHADCleaned->setRescale(theShortHit->time());
487  /*
488  std::cout << "ieta/iphi = " << ieta << " " << iphi
489  << ", Energy em/had/long/short = "
490  << energyemHF << " " << energyhadHF << " "
491  << theLongHitEnergy << " " << theShortHitEnergy << " "
492  << ". Time = " << theShortHit->time() << " "
493  << ". The short and long flags : "
494  << flagShortDPG << " " << flagLongDPG << " "
495  << flagShortTimeDPG << " " << flagLongTimeDPG << " "
496  << flagShortPulseDPG << " " << flagLongPulseDPG << " "
497  << ". Short fibres were cleaned." << std::endl;
498  */
499  shortFibre -= theShortHitEnergy;
500  theShortHitEnergy = 0.;
501  }
502 
503 
504  if ( theLongHitEnergy > longShortFibre_Cut &&
505  ( theLongHit->time() < minLongTiming_Cut ||
506  theLongHit->time() > maxLongTiming_Cut ||
507  flagLongTimeDPG || flagLongPulseDPG ) ) {
508  //rescaleFactor = 0. ;
509  pfrhHFEMCleaned = createHcalRecHit( detid,
510  theLongHitEnergy,
512  hcalEndcapGeometry,
513  ct.id().rawId() );
514  pfrhHFEMCleaned->setRescale(theLongHit->time());
515  /*
516  std::cout << "ieta/iphi = " << ieta << " " << iphi
517  << ", Energy em/had/long/short = "
518  << energyemHF << " " << energyhadHF << " "
519  << theLongHitEnergy << " " << theShortHitEnergy << " "
520  << ". Time = " << theLongHit->time() << " "
521  << ". The short and long flags : "
522  << flagShortDPG << " " << flagLongDPG << " "
523  << flagShortTimeDPG << " " << flagLongTimeDPG << " "
524  << flagShortPulseDPG << " " << flagLongPulseDPG << " "
525  << ". Long fibres were cleaned." << std::endl;
526  */
527  longFibre -= theLongHitEnergy;
528  theLongHitEnergy = 0.;
529  }
530 
531  // Some energy must be in the long fibres is there is some energy in the short fibres !
532  if ( theShortHitEnergy > shortFibre_Cut &&
533  ( theLongHitEnergy/theShortHitEnergy < longFibre_Fraction ||
534  flagShortDPG ) ) {
535  // Check if the long-fibre hit was not cleaned already (because hot)
536  // In this case don't apply the cleaning
537  const HcalChannelStatus* theStatus = theHcalChStatus->getValues(theLongDetId);
538  unsigned theStatusValue = theStatus->getValue();
539  int theSeverityLevel = hcalSevLvlComputer->getSeverityLevel(detid, 0, theStatusValue);
540  // The channel is killed
542  if (theSeverityLevel<=HcalMaxAllowedChannelStatusSev_) {
543  // rescaleFactor = 0. ;
544  pfrhHFHADCleaned = createHcalRecHit( detid,
545  theShortHitEnergy,
547  hcalEndcapGeometry,
548  ct.id().rawId() );
549  pfrhHFHADCleaned->setRescale(theShortHit->time());
550  /*
551  std::cout << "ieta/iphi = " << ieta << " " << iphi
552  << ", Energy em/had/long/short = "
553  << energyemHF << " " << energyhadHF << " "
554  << theLongHitEnergy << " " << theShortHitEnergy << " "
555  << ". Time = " << theShortHit->time() << " "
556  << ". The status value is " << theStatusValue
557  << ". The short and long flags : "
558  << flagShortDPG << " " << flagLongDPG << " "
559  << flagShortTimeDPG << " " << flagLongTimeDPG << " "
560  << flagShortPulseDPG << " " << flagLongPulseDPG << " "
561  << ". Short fibres were cleaned." << std::endl;
562  */
563  shortFibre -= theShortHitEnergy;
564  theShortHitEnergy = 0.;
565  }
566  }
567 
568  if ( theLongHitEnergy > longFibre_Cut &&
569  ( theShortHitEnergy/theLongHitEnergy < shortFibre_Fraction ||
570  flagLongDPG ) ) {
571  // Check if the long-fibre hit was not cleaned already (because hot)
572  // In this case don't apply the cleaning
573  const HcalChannelStatus* theStatus = theHcalChStatus->getValues(theShortDetId);
574  unsigned theStatusValue = theStatus->getValue();
575 
576  int theSeverityLevel = hcalSevLvlComputer->getSeverityLevel(detid, 0, theStatusValue);
577  // The channel is killed
579  if (theSeverityLevel<=HcalMaxAllowedChannelStatusSev_) {
580 
581  //rescaleFactor = 0. ;
582  pfrhHFEMCleaned = createHcalRecHit( detid,
583  theLongHitEnergy,
585  hcalEndcapGeometry,
586  ct.id().rawId() );
587  pfrhHFEMCleaned->setRescale(theLongHit->time());
588  /*
589  std::cout << "ieta/iphi = " << ieta << " " << iphi
590  << ", Energy em/had/long/short = "
591  << energyemHF << " " << energyhadHF << " "
592  << theLongHitEnergy << " " << theShortHitEnergy << " "
593  << ". The status value is " << theStatusValue
594  << ". Time = " << theLongHit->time() << " "
595  << ". The short and long flags : "
596  << flagShortDPG << " " << flagLongDPG << " "
597  << flagShortTimeDPG << " " << flagLongTimeDPG << " "
598  << flagShortPulseDPG << " " << flagLongPulseDPG << " "
599  << ". Long fibres were cleaned." << std::endl;
600  */
601  longFibre -= theLongHitEnergy;
602  theLongHitEnergy = 0.;
603  }
604  }
605 
606  // Special treatment for tower 29
607  // A tower with energy only at ieta = +/- 29 is not physical -> Clean
608  if ( abs(ieta) == 29 ) {
609  // rescaleFactor = 0. ;
610  // Clean long fibres
611  if ( theLongHitEnergy > shortFibre_Cut/2. ) {
612  pfrhHFEMCleaned29 = createHcalRecHit( detid,
613  theLongHitEnergy,
615  hcalEndcapGeometry,
616  ct.id().rawId() );
617  pfrhHFEMCleaned29->setRescale(theLongHit->time());
618  /*
619  std::cout << "ieta/iphi = " << ieta << " " << iphi
620  << ", Energy em/had/long/short = "
621  << energyemHF << " " << energyhadHF << " "
622  << theLongHitEnergy << " " << theShortHitEnergy << " "
623  << ". Long fibres were cleaned." << std::endl;
624  */
625  longFibre -= theLongHitEnergy;
626  theLongHitEnergy = 0.;
627  }
628  // Clean short fibres
629  if ( theShortHitEnergy > shortFibre_Cut/2. ) {
630  pfrhHFHADCleaned29 = createHcalRecHit( detid,
631  theShortHitEnergy,
633  hcalEndcapGeometry,
634  ct.id().rawId() );
635  pfrhHFHADCleaned29->setRescale(theShortHit->time());
636  /*
637  std::cout << "ieta/iphi = " << ieta << " " << iphi
638  << ", Energy em/had/long/short = "
639  << energyemHF << " " << energyhadHF << " "
640  << theLongHitEnergy << " " << theShortHitEnergy << " "
641  << ". Short fibres were cleaned." << std::endl;
642  */
643  shortFibre -= theShortHitEnergy;
644  theShortHitEnergy = 0.;
645  }
646  }
647  // Check the timing of the long and short fibre rechits
648 
649  // First, check the timing of long and short fibre in eta = 29 if tower 30.
650  else if ( abs(ieta) == 30 ) {
651  int ieta29 = ieta > 0 ? 29 : -29;
652  HcalDetId theLongDetId29 (HcalForward, ieta29, iphi, 1);
653  HcalDetId theShortDetId29 (HcalForward, ieta29, iphi, 2);
654  iHF theLongHit29 = hfHandle->find(theLongDetId29);
655  iHF theShortHit29 = hfHandle->find(theShortDetId29);
656  //
657  double theLongHitEnergy29 = 0.;
658  double theShortHitEnergy29 = 0.;
659  bool flagShortDPG29 = false;
660  bool flagLongDPG29 = false;
661  bool flagShortTimeDPG29 = false;
662  bool flagLongTimeDPG29 = false;
663  bool flagShortPulseDPG29 = false;
664  bool flagLongPulseDPG29 = false;
665  //
666  if ( theLongHit29 != hfHandle->end() ) {
667  int theLongFlag29 = theLongHit29->flags();
668  theLongHitEnergy29 = theLongHit29->energy() ;
669  flagLongDPG29 = applyLongShortDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theLongDetId29, theLongFlag29 & hcalHFLongShortFlagValue_, 0)> HcalMaxAllowedHFLongShortSev_);
670  flagLongTimeDPG29 = applyTimeDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theLongDetId29, theLongFlag29 & hcalHFInTimeWindowFlagValue_, 0)> HcalMaxAllowedHFInTimeWindowSev_);
671  flagLongPulseDPG29 = applyPulseDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theLongDetId29, theLongFlag29 & hcalHFDigiTimeFlagValue_, 0)> HcalMaxAllowedHFDigiTimeSev_);
672 
673  //flagLongDPG29 = applyLongShortDPG_ && theLongHit29->flagField(HcalCaloFlagLabels::HFLongShort)==1;
674  //flagLongTimeDPG29 = applyTimeDPG_ && theLongHit29->flagField(HcalCaloFlagLabels::HFInTimeWindow)==1;
675  //flagLongPulseDPG29 = applyPulseDPG_ && theLongHit29->flagField(HcalCaloFlagLabels::HFDigiTime)==1;
676  }
677  //
678  if ( theShortHit29 != hfHandle->end() ) {
679  int theShortFlag29 = theShortHit29->flags();
680  theShortHitEnergy29 = theShortHit29->energy();
681  flagShortDPG29 = applyLongShortDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theShortDetId29, theShortFlag29 & hcalHFLongShortFlagValue_, 0)> HcalMaxAllowedHFLongShortSev_);
682  flagShortTimeDPG29 = applyTimeDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theShortDetId29, theShortFlag29 & hcalHFInTimeWindowFlagValue_, 0)> HcalMaxAllowedHFInTimeWindowSev_);
683  flagLongPulseDPG29 = applyPulseDPG_ && ( hcalSevLvlComputer->getSeverityLevel(theShortDetId29, theShortFlag29 & hcalHFDigiTimeFlagValue_, 0)> HcalMaxAllowedHFDigiTimeSev_);
684 
685  //flagShortDPG29 = applyLongShortDPG_ && theShortHit29->flagField(HcalCaloFlagLabels::HFLongShort)==1;
686  //flagShortTimeDPG29 = applyTimeDPG_ && theShortHit29->flagField(HcalCaloFlagLabels::HFInTimeWindow)==1;
687  //flagShortPulseDPG29 = applyPulseDPG_ && theShortHit29->flagField(HcalCaloFlagLabels::HFDigiTime)==1;
688  }
689 
690  if ( theLongHitEnergy29 > longShortFibre_Cut &&
691  ( theLongHit29->time() < minLongTiming_Cut ||
692  theLongHit29->time() > maxLongTiming_Cut ||
693  flagLongTimeDPG29 || flagLongPulseDPG29 ) ) {
694  //rescaleFactor = 0. ;
695  pfrhHFEMCleaned29 = createHcalRecHit( detid,
696  theLongHitEnergy29,
698  hcalEndcapGeometry,
699  ct.id().rawId() );
700  pfrhHFEMCleaned29->setRescale(theLongHit29->time());
701  /*
702  std::cout << "ieta/iphi = " << ieta29 << " " << iphi
703  << ", Energy em/had/long/short = "
704  << energyemHF << " " << energyhadHF << " "
705  << theLongHitEnergy29 << " " << theShortHitEnergy29 << " "
706  << ". Time = " << theLongHit29->time() << " "
707  << ". The short and long flags : "
708  << flagShortDPG29 << " " << flagLongDPG29 << " "
709  << flagShortTimeDPG29 << " " << flagLongTimeDPG29 << " "
710  << flagShortPulseDPG29 << " " << flagLongPulseDPG29 << " "
711  << ". Long fibres were cleaned." << std::endl;
712  */
713  longFibre -= theLongHitEnergy29;
714  theLongHitEnergy29 = 0;
715  }
716 
717  if ( theShortHitEnergy29 > longShortFibre_Cut &&
718  ( theShortHit29->time() < minShortTiming_Cut ||
719  theShortHit29->time() > maxShortTiming_Cut ||
720  flagShortTimeDPG29 || flagShortPulseDPG29 ) ) {
721  //rescaleFactor = 0. ;
722  pfrhHFHADCleaned29 = createHcalRecHit( detid,
723  theShortHitEnergy29,
725  hcalEndcapGeometry,
726  ct.id().rawId() );
727  pfrhHFHADCleaned29->setRescale(theShortHit29->time());
728  /*
729  std::cout << "ieta/iphi = " << ieta29 << " " << iphi
730  << ", Energy em/had/long/short = "
731  << energyemHF << " " << energyhadHF << " "
732  << theLongHitEnergy29 << " " << theShortHitEnergy29 << " "
733  << ". Time = " << theShortHit29->time() << " "
734  << ". The short and long flags : "
735  << flagShortDPG29 << " " << flagLongDPG29 << " "
736  << flagShortTimeDPG29 << " " << flagLongTimeDPG29 << " "
737  << flagShortPulseDPG29 << " " << flagLongPulseDPG29 << " "
738  << ". Short fibres were cleaned." << std::endl;
739  */
740  shortFibre -= theShortHitEnergy29;
741  theShortHitEnergy29 = 0.;
742  }
743 
744  // Some energy must be in the long fibres is there is some energy in the short fibres !
745  if ( theShortHitEnergy29 > shortFibre_Cut &&
746  ( theLongHitEnergy29/theShortHitEnergy29 < 2.*longFibre_Fraction ||
747  flagShortDPG29 ) ) {
748  // Check if the long-fibre hit was not cleaned already (because hot)
749  // In this case don't apply the cleaning
750  const HcalChannelStatus* theStatus = theHcalChStatus->getValues(theLongDetId29);
751  unsigned theStatusValue = theStatus->getValue();
752 
753  int theSeverityLevel = hcalSevLvlComputer->getSeverityLevel(detid, 0, theStatusValue);
754  // The channel is killed
756  if (theSeverityLevel<=HcalMaxAllowedChannelStatusSev_) {
757  //rescaleFactor = 0. ;
758  pfrhHFHADCleaned29 = createHcalRecHit( detid,
759  theShortHitEnergy29,
761  hcalEndcapGeometry,
762  ct.id().rawId() );
763  pfrhHFHADCleaned29->setRescale(theShortHit29->time());
764  /*
765  std::cout << "ieta/iphi = " << ieta29 << " " << iphi
766  << ", Energy em/had/long/short = "
767  << energyemHF << " " << energyhadHF << " "
768  << theLongHitEnergy29 << " " << theShortHitEnergy29 << " "
769  << ". Time = " << theShortHit29->time() << " "
770  << ". The status value is " << theStatusValue
771  << ". The short and long flags : "
772  << flagShortDPG29 << " " << flagLongDPG29 << " "
773  << flagShortTimeDPG29 << " " << flagLongTimeDPG29 << " "
774  << flagShortPulseDPG29 << " " << flagLongPulseDPG29 << " "
775  << ". Short fibres were cleaned." << std::endl;
776  */
777  shortFibre -= theShortHitEnergy29;
778  theShortHitEnergy29 = 0.;
779  }
780  }
781 
782  // Some energy must be in the short fibres is there is some energy in the long fibres !
783  if ( theLongHitEnergy29 > longFibre_Cut &&
784  ( theShortHitEnergy29/theLongHitEnergy29 < shortFibre_Fraction ||
785  flagLongDPG29 ) ) {
786  // Check if the long-fibre hit was not cleaned already (because hot)
787  // In this case don't apply the cleaning
788  const HcalChannelStatus* theStatus = theHcalChStatus->getValues(theShortDetId29);
789  unsigned theStatusValue = theStatus->getValue();
790  int theSeverityLevel = hcalSevLvlComputer->getSeverityLevel(detid, 0, theStatusValue);
791  // The channel is killed
793  if (theSeverityLevel<=HcalMaxAllowedChannelStatusSev_) {
794 
795  //rescaleFactor = 0. ;
796  pfrhHFEMCleaned29 = createHcalRecHit( detid,
797  theLongHitEnergy29,
799  hcalEndcapGeometry,
800  ct.id().rawId() );
801  pfrhHFEMCleaned29->setRescale(theLongHit29->time());
802  /*
803  std::cout << "ieta/iphi = " << ieta29 << " " << iphi
804  << ", Energy em/had/long/short = "
805  << energyemHF << " " << energyhadHF << " "
806  << theLongHitEnergy29 << " " << theShortHitEnergy29 << " "
807  << ". The status value is " << theStatusValue
808  << ". Time = " << theLongHit29->time() << " "
809  << ". The short and long flags : "
810  << flagShortDPG29 << " " << flagLongDPG29 << " "
811  << flagShortTimeDPG29 << " " << flagLongTimeDPG29 << " "
812  << flagShortPulseDPG29 << " " << flagLongPulseDPG29 << " "
813  << ". Long fibres were cleaned." << std::endl;
814  */
815  longFibre -= theLongHitEnergy29;
816  theLongHitEnergy29 = 0.;
817  }
818  }
819 
820  // Check that the energy in tower 29 is smaller than in tower 30
821  // First in long fibres
822  if ( theLongHitEnergy29 > std::max(theLongHitEnergy,shortFibre_Cut/2) ) {
823  pfrhHFEMCleaned29 = createHcalRecHit( detid,
824  theLongHitEnergy29,
826  hcalEndcapGeometry,
827  ct.id().rawId() );
828  pfrhHFEMCleaned29->setRescale(theLongHit29->time());
829  /*
830  std::cout << "ieta/iphi = " << ieta29 << " " << iphi
831  << ", Energy L29/S29/L30/S30 = "
832  << theLongHitEnergy29 << " " << theShortHitEnergy29 << " "
833  << theLongHitEnergy << " " << theShortHitEnergy << " "
834  << ". Long fibres were cleaned." << std::endl;
835  */
836  longFibre -= theLongHitEnergy29;
837  theLongHitEnergy29 = 0.;
838  }
839  // Second in short fibres
840  if ( theShortHitEnergy29 > std::max(theShortHitEnergy,shortFibre_Cut/2.) ) {
841  pfrhHFHADCleaned29 = createHcalRecHit( detid,
842  theShortHitEnergy29,
844  hcalEndcapGeometry,
845  ct.id().rawId() );
846  pfrhHFHADCleaned29->setRescale(theShortHit29->time());
847  /*
848  std::cout << "ieta/iphi = " << ieta << " " << iphi
849  << ", Energy L29/S29/L30/S30 = "
850  << theLongHitEnergy29 << " " << theShortHitEnergy29 << " "
851  << theLongHitEnergy << " " << theShortHitEnergy << " "
852  << ". Short fibres were cleaned." << std::endl;
853  */
854  shortFibre -= theShortHitEnergy29;
855  theShortHitEnergy29 = 0.;
856  }
857  }
858 
859 
860  // Determine EM and HAD after cleaning of short and long fibres
861  energyhadHF = 2.*shortFibre;
862  energyemHF = longFibre - shortFibre;
863 
864  // The EM energy might be negative, as it amounts to Long - Short
865  // In that case, put the EM "energy" in the HAD energy
866  // Just to avoid systematic positive bias due to "Short" high fluctuations
867  if ( energyemHF < thresh_HF_ ) {
868  energyhadHF += energyemHF;
869  energyemHF = 0.;
870  }
871 
872  // Apply HCAL calibration factors flor towers close to 29, if requested
873  if ( HF_Calib_ && abs(detid.ieta()) <= 32 ) {
874  energyhadHF *= HF_Calib_29;
875  energyemHF *= HF_Calib_29;
876  }
877 
878  // Create an EM and a HAD rechit if above threshold.
879  if ( energyemHF > thresh_HF_ || energyhadHF > thresh_HF_ ) {
880  pfrhHFEM = createHcalRecHit( detid,
881  energyemHF,
883  hcalEndcapGeometry,
884  ct.id().rawId() );
885  pfrhHFHAD = createHcalRecHit( detid,
886  energyhadHF,
888  hcalEndcapGeometry,
889  ct.id().rawId() );
890  pfrhHFEM->setEnergyUp(energyhadHF);
891  pfrhHFHAD->setEnergyUp(energyemHF);
892  }
893 
894  }
895  break;
896  default:
897  LogError("PFRecHitProducerHCAL")
898  <<"CaloTower constituent: unknown layer : "
899  <<detid.subdet()<<endl;
900  }
901 
902  if(pfrh) {
903  rechits.push_back( *pfrh );
904  delete pfrh;
905  idSortedRecHits.insert( make_pair(ct.id().rawId(),
906  rechits.size()-1 ) );
907  }
908  if(pfrhCleaned) {
909  rechitsCleaned.push_back( *pfrhCleaned );
910  delete pfrhCleaned;
911  }
912  //---ab: 2 rechits for HF:
913  if(pfrhHFEM) {
914  HFEMRecHits->push_back( *pfrhHFEM );
915  delete pfrhHFEM;
916  idSortedRecHitsHFEM.insert( make_pair(ct.id().rawId(),
917  HFEMRecHits->size()-1 ) );
918  }
919  if(pfrhHFHAD) {
920  HFHADRecHits->push_back( *pfrhHFHAD );
921  delete pfrhHFHAD;
922  idSortedRecHitsHFHAD.insert( make_pair(ct.id().rawId(),
923  HFHADRecHits->size()-1 ) );
924  }
925  //---ab
926  if(pfrhHFEMCleaned) {
927  rechitsCleaned.push_back( *pfrhHFEMCleaned );
928  delete pfrhHFEMCleaned;
929  }
930  if(pfrhHFHADCleaned) {
931  rechitsCleaned.push_back( *pfrhHFHADCleaned );
932  delete pfrhHFHADCleaned;
933  }
934  if(pfrhHFEMCleaned29) {
935  rechitsCleaned.push_back( *pfrhHFEMCleaned29 );
936  delete pfrhHFEMCleaned29;
937  }
938  if(pfrhHFHADCleaned29) {
939  rechitsCleaned.push_back( *pfrhHFHADCleaned29 );
940  delete pfrhHFHADCleaned29;
941  }
942  }
943  }
944  // do navigation
945  for(unsigned i=0; i<rechits.size(); i++ ) {
947  idSortedRecHits,
948  caloTowerTopology);
949  }
950  for(unsigned i=0; i<HFEMRecHits->size(); i++ ) {
951  findRecHitNeighboursCT( (*HFEMRecHits)[i],
952  idSortedRecHitsHFEM,
953  caloTowerTopology);
954  }
955  for(unsigned i=0; i<HFHADRecHits->size(); i++ ) {
956  findRecHitNeighboursCT( (*HFHADRecHits)[i],
957  idSortedRecHitsHFHAD,
958  caloTowerTopology);
959  }
960  iEvent.put( HFHADRecHits,"HFHAD" );
961  iEvent.put( HFEMRecHits,"HFEM" );
962  }
963  }
964  else if( !(inputTagHcalRecHitsHBHE_ == InputTag()) ) {
965  // clustering is not done on CaloTowers but on HCAL rechits.
966 
967 
968  // get the hcal topology
969  HcalTopology hcalTopology;
970 
971  // HCAL rechits
972  // vector<edm::Handle<HBHERecHitCollection> > hcalHandles;
974 
975 
976  bool found = iEvent.getByLabel(inputTagHcalRecHitsHBHE_,
977  hcalHandle );
978 
979  if(!found) {
980  ostringstream err;
981  err<<"could not find rechits "<<inputTagHcalRecHitsHBHE_;
982  LogError("PFRecHitProducerHCAL")<<err.str()<<endl;
983 
984  throw cms::Exception( "MissingProduct", err.str());
985  }
986  else {
987  assert( hcalHandle.isValid() );
988 
989  const edm::Handle<HBHERecHitCollection>& handle = hcalHandle;
990  for(unsigned irechit=0; irechit<handle->size(); irechit++) {
991  const HBHERecHit& hit = (*handle)[irechit];
992 
993  double energy = hit.energy();
994 
995  reco::PFRecHit* pfrh = 0;
996 
997 
998  const HcalDetId& detid = hit.detid();
999  switch( detid.subdet() ) {
1000  case HcalBarrel:
1001  {
1002  if(energy < thresh_Barrel_ ) continue;
1003  pfrh = createHcalRecHit( detid,
1004  energy,
1006  hcalBarrelGeometry );
1007  }
1008  break;
1009  case HcalEndcap:
1010  {
1011  if(energy < thresh_Endcap_ ) continue;
1012  pfrh = createHcalRecHit( detid,
1013  energy,
1015  hcalEndcapGeometry );
1016  }
1017  break;
1018  case HcalForward:
1019  {
1020  if(energy < thresh_HF_ ) continue;
1021  pfrh = createHcalRecHit( detid,
1022  energy,
1023  PFLayer::HF_HAD,
1024  hcalEndcapGeometry );
1025  }
1026  break;
1027  default:
1028  LogError("PFRecHitProducerHCAL")
1029  <<"HCAL rechit: unknown layer : "<<detid.subdet()<<endl;
1030  continue;
1031  }
1032 
1033  if(pfrh) {
1034  rechits.push_back( *pfrh );
1035  delete pfrh;
1036  idSortedRecHits.insert( make_pair(detid.rawId(),
1037  rechits.size()-1 ) );
1038  }
1039  }
1040 
1041 
1042  // do navigation:
1043  for(unsigned i=0; i<rechits.size(); i++ ) {
1044 
1045  findRecHitNeighbours( rechits[i], idSortedRecHits,
1046  hcalTopology,
1047  *hcalBarrelGeometry,
1048  hcalTopology,
1049  *hcalEndcapGeometry);
1050  } // loop for navigation
1051  } // endif hcal rechits were found
1052  } // endif clustering on rechits in hcal
1053 }
int i
Definition: DBlmapReader.cc:9
size_t constituentsSize() const
Definition: CaloTower.h:74
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
const DetId & detid() const
Definition: CaloRecHit.h:22
std::vector< CaloTower >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
reco::PFRecHit * createHcalRecHit(const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom, unsigned newDetId=0)
const EcalChannelStatus * theEcalChStatus
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
edm::InputTag inputTagCaloTowers_
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
double emEnergy() const
Definition: CaloTower.h:79
const T & max(const T &a, const T &b)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
float energy() const
Definition: CaloRecHit.h:19
void setEnergyUp(double eUp)
Definition: PFRecHit.h:73
edm::InputTag inputTagHcalRecHitsHF_
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
tuple handle
Definition: patZpeak.py:22
int j
Definition: DBlmapReader.cc:9
const std::vector< DetId > & constituents() const
Definition: CaloTower.h:73
void setRescale(double factor)
Definition: PFRecHit.h:74
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag inputTagHcalRecHitsHBHE_
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)
double hadEnergy() const
Definition: CaloTower.h:80
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
CaloTowerDetId id() const
Definition: CaloTower.h:72
const HcalChannelQuality * theHcalChStatus
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
T const * product() const
Definition: ESHandle.h:62
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
const CaloTowerConstituentsMap * theTowerConstituentsMap
std::map< unsigned, unsigned >::const_iterator IDH
const_iterator find(uint32_t rawId) const
double thresh_Barrel_
rechits with E &lt; threshold will not give rise to a PFRecHit
const_iterator end() const
double thresh_HF_
threshold for HF
uint32_t getValue() const
const Item * getValues(DetId fId) const
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

Definition at line 1117 of file PFRecHitProducerHCAL.cc.

References reco::PFRecHit::add4Neighbour(), reco::PFRecHit::add8Neighbour(), cond::rpcobgas::detid, reco::PFRecHit::detId(), east, CaloNavigator< T >::east(), PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, geometry, PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, PFLayer::HF_EM, PFLayer::HF_HAD, CaloNavigator< T >::home(), i, reco::PFRecHit::layer(), north, CaloNavigator< T >::north(), PFLayer::PS1, PFLayer::PS2, DetId::rawId(), south, CaloNavigator< T >::south(), west, and CaloNavigator< T >::west().

Referenced by createRecHits().

1122  {
1123 
1124  //cout<<"------PFRecHitProducerHcaL:findRecHitNeighbours navigation value "<<navigation_HF_<<endl;
1125  if(navigation_HF_ == false){
1126  if( rh.layer() == PFLayer::HF_HAD )
1127  return;
1128  if( rh.layer() == PFLayer::HF_EM )
1129  return;
1130  }
1131  DetId detid( rh.detId() );
1132 
1133  const CaloSubdetectorTopology* topology = 0;
1134  const CaloSubdetectorGeometry* geometry = 0;
1135 
1136  switch( rh.layer() ) {
1137  case PFLayer::ECAL_ENDCAP:
1138  topology = &endcapTopology;
1139  geometry = &endcapGeometry;
1140  break;
1141  case PFLayer::ECAL_BARREL:
1142  topology = &barrelTopology;
1143  geometry = &barrelGeometry;
1144  break;
1145  case PFLayer::HCAL_ENDCAP:
1146  topology = &endcapTopology;
1147  geometry = &endcapGeometry;
1148  break;
1149  case PFLayer::HCAL_BARREL1:
1150  topology = &barrelTopology;
1151  geometry = &barrelGeometry;
1152  break;
1153  case PFLayer::PS1:
1154  case PFLayer::PS2:
1155  topology = &barrelTopology;
1156  geometry = &barrelGeometry;
1157  break;
1158  default:
1159  assert(0);
1160  }
1161 
1162  assert( topology && geometry );
1163 
1164  CaloNavigator<DetId> navigator(detid, topology);
1165 
1166  DetId north = navigator.north();
1167 
1168  DetId northeast(0);
1169  if( north != DetId(0) ) {
1170  northeast = navigator.east();
1171  }
1172  navigator.home();
1173 
1174 
1175  DetId south = navigator.south();
1176 
1177 
1178 
1179  DetId southwest(0);
1180  if( south != DetId(0) ) {
1181  southwest = navigator.west();
1182  }
1183  navigator.home();
1184 
1185 
1186  DetId east = navigator.east();
1187  DetId southeast;
1188  if( east != DetId(0) ) {
1189  southeast = navigator.south();
1190  }
1191  navigator.home();
1192  DetId west = navigator.west();
1193  DetId northwest;
1194  if( west != DetId(0) ) {
1195  northwest = navigator.north();
1196  }
1197  navigator.home();
1198 
1199  IDH i = sortedHits.find( north.rawId() );
1200  if(i != sortedHits.end() )
1201  rh.add4Neighbour( i->second );
1202 
1203  i = sortedHits.find( northeast.rawId() );
1204  if(i != sortedHits.end() )
1205  rh.add8Neighbour( i->second );
1206 
1207  i = sortedHits.find( south.rawId() );
1208  if(i != sortedHits.end() )
1209  rh.add4Neighbour( i->second );
1210 
1211  i = sortedHits.find( southwest.rawId() );
1212  if(i != sortedHits.end() )
1213  rh.add8Neighbour( i->second );
1214 
1215  i = sortedHits.find( east.rawId() );
1216  if(i != sortedHits.end() )
1217  rh.add4Neighbour( i->second );
1218 
1219  i = sortedHits.find( southeast.rawId() );
1220  if(i != sortedHits.end() )
1221  rh.add8Neighbour( i->second );
1222 
1223  i = sortedHits.find( west.rawId() );
1224  if(i != sortedHits.end() )
1225  rh.add4Neighbour( i->second );
1226 
1227  i = sortedHits.find( northwest.rawId() );
1228  if(i != sortedHits.end() )
1229  rh.add8Neighbour( i->second );
1230 
1231 
1232 }
void add4Neighbour(unsigned index)
Definition: PFRecHit.cc:176
int i
Definition: DBlmapReader.cc:9
void add8Neighbour(unsigned index)
Definition: PFRecHit.cc:181
unsigned detId() const
rechit detId
Definition: PFRecHit.h:99
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:102
Definition: DetId.h:20
ESHandle< TrackerGeometry > geometry
std::map< unsigned, unsigned >::const_iterator IDH
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 1237 of file PFRecHitProducerHCAL.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(), west, and CaloSubdetectorTopology::west().

Referenced by createRecHits().

1239  {
1240  //cout<<"------PFRecHitProducerHcaL:findRecHitNeighboursCT navigation value "<<navigation_HF_<<endl;
1241  // cout<<"----------- rechit print out"<<endl;
1242  // if(( rh.layer() == PFLayer::HF_HAD )||(rh.layer() == PFLayer::HF_EM)) {
1243 
1244  // cout<<rh<<endl;
1245  // }
1246  if(navigation_HF_ == false){
1247  if( rh.layer() == PFLayer::HF_HAD )
1248  return;
1249  if( rh.layer() == PFLayer::HF_EM )
1250  return;
1251  }
1252  CaloTowerDetId ctDetId( rh.detId() );
1253 
1254 
1255  vector<DetId> northids = topology.north(ctDetId);
1256  vector<DetId> westids = topology.west(ctDetId);
1257  vector<DetId> southids = topology.south(ctDetId);
1258  vector<DetId> eastids = topology.east(ctDetId);
1259 
1260 
1261  CaloTowerDetId badId;
1262 
1263  // all the following detids will be CaloTowerDetId
1265  CaloTowerDetId northwest;
1266  CaloTowerDetId northwest2;
1268  CaloTowerDetId west2;
1269  CaloTowerDetId southwest;
1270  CaloTowerDetId southwest2;
1272  CaloTowerDetId southeast;
1273  CaloTowerDetId southeast2;
1275  CaloTowerDetId east2;
1276  CaloTowerDetId northeast;
1277  CaloTowerDetId northeast2;
1278 
1279  // for north and south, there is no ambiguity : 1 or 0 neighbours
1280 
1281  switch( northids.size() ) {
1282  case 0:
1283  break;
1284  case 1:
1285  north = northids[0];
1286  break;
1287  default:
1288  stringstream err("PFRecHitProducerHCAL::findRecHitNeighboursCT : incorrect number of neighbours north: ");
1289  err<<northids.size();
1290  throw( err.str() );
1291  }
1292 
1293  switch( southids.size() ) {
1294  case 0:
1295  break;
1296  case 1:
1297  south = southids[0];
1298  break;
1299  default:
1300  stringstream err("PFRecHitProducerHCAL::findRecHitNeighboursCT : incorrect number of neighbours south: ");
1301  err<<southids.size();
1302  throw( err.str() );
1303  }
1304 
1305  // for east and west, one must take care
1306  // of the pitch change in HCAL endcap.
1307 
1308  switch( eastids.size() ) {
1309  case 0:
1310  break;
1311  case 1:
1312  east = eastids[0];
1313  northeast = getNorth(east, topology);
1314  southeast = getSouth(east, topology);
1315  break;
1316  case 2:
1317  // in this case, 0 is more on the north than 1
1318  east = eastids[0];
1319  east2 = eastids[1];
1320  northeast = getNorth(east, topology );
1321  southeast = getSouth(east2, topology);
1322  northeast2 = getNorth(northeast, topology );
1323  southeast2 = getSouth(southeast, topology);
1324  break;
1325  default:
1326  stringstream err("PFRecHitProducerHCAL::findRecHitNeighboursCT : incorrect number of neighbours eastids: ");
1327  err<<eastids.size();
1328  throw( err.str() );
1329  }
1330 
1331 
1332  switch( westids.size() ) {
1333  case 0:
1334  break;
1335  case 1:
1336  west = westids[0];
1337  northwest = getNorth(west, topology);
1338  southwest = getSouth(west, topology);
1339  break;
1340  case 2:
1341  // in this case, 0 is more on the north than 1
1342  west = westids[0];
1343  west2 = westids[1];
1344  northwest = getNorth(west, topology );
1345  southwest = getSouth(west2, topology );
1346  northwest2 = getNorth(northwest, topology );
1347  southwest2 = getSouth(southwest, topology );
1348  break;
1349  default:
1350  stringstream err("PFRecHitProducerHCAL::findRecHitNeighboursCT : incorrect number of neighbours westids: ");
1351  err<< westids.size();
1352  throw( err.str() );
1353  }
1354 
1355 
1356 
1357 
1358  // find and set neighbours
1359 
1360  IDH i = sortedHits.find( north.rawId() );
1361  if(i != sortedHits.end() )
1362  rh.add4Neighbour( i->second );
1363 
1364  i = sortedHits.find( northeast.rawId() );
1365  if(i != sortedHits.end() )
1366  rh.add8Neighbour( i->second );
1367 
1368  i = sortedHits.find( northeast2.rawId() );
1369  if(i != sortedHits.end() )
1370  rh.add8Neighbour( i->second );
1371 
1372  i = sortedHits.find( south.rawId() );
1373  if(i != sortedHits.end() )
1374  rh.add4Neighbour( i->second );
1375 
1376  i = sortedHits.find( southwest.rawId() );
1377  if(i != sortedHits.end() )
1378  rh.add8Neighbour( i->second );
1379 
1380  i = sortedHits.find( southwest2.rawId() );
1381  if(i != sortedHits.end() )
1382  rh.add8Neighbour( i->second );
1383 
1384  i = sortedHits.find( east.rawId() );
1385  if(i != sortedHits.end() )
1386  rh.add4Neighbour( i->second );
1387 
1388  i = sortedHits.find( east2.rawId() );
1389  if(i != sortedHits.end() )
1390  rh.add4Neighbour( i->second );
1391 
1392  i = sortedHits.find( southeast.rawId() );
1393  if(i != sortedHits.end() )
1394  rh.add8Neighbour( i->second );
1395 
1396  i = sortedHits.find( southeast2.rawId() );
1397  if(i != sortedHits.end() )
1398  rh.add8Neighbour( i->second );
1399 
1400  i = sortedHits.find( west.rawId() );
1401  if(i != sortedHits.end() )
1402  rh.add4Neighbour( i->second );
1403 
1404  i = sortedHits.find( west2.rawId() );
1405  if(i != sortedHits.end() )
1406  rh.add4Neighbour( i->second );
1407 
1408  i = sortedHits.find( northwest.rawId() );
1409  if(i != sortedHits.end() )
1410  rh.add8Neighbour( i->second );
1411 
1412  i = sortedHits.find( northwest2.rawId() );
1413  if(i != sortedHits.end() )
1414  rh.add8Neighbour( i->second );
1415 
1416  // cout<<"----------- rechit print out"<<endl;
1417  // if(( rh.layer() == PFLayer::HF_HAD )||(rh.layer() == PFLayer::HF_EM)) {
1418 
1419  // cout<<rh<<endl;
1420  // }
1421 }
void add4Neighbour(unsigned index)
Definition: PFRecHit.cc:176
int i
Definition: DBlmapReader.cc:9
void add8Neighbour(unsigned index)
Definition: PFRecHit.cc:181
unsigned detId() const
rechit detId
Definition: PFRecHit.h:99
virtual std::vector< DetId > west(const DetId &id) const =0
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:102
DetId getSouth(const DetId &id, const CaloSubdetectorTopology &topology)
virtual std::vector< DetId > north(const DetId &id) const =0
std::map< unsigned, unsigned >::const_iterator IDH
virtual std::vector< DetId > south(const DetId &id) const =0
DetId getNorth(const DetId &id, const CaloSubdetectorTopology &topology)
virtual std::vector< DetId > east(const DetId &id) const =0
DetId PFRecHitProducerHCAL::getNorth ( const DetId id,
const CaloSubdetectorTopology topology 
)
private

Definition at line 1440 of file PFRecHitProducerHCAL.cc.

References north, and CaloSubdetectorTopology::north().

1441  {
1442 
1443  DetId north;
1444  vector<DetId> nids = topology.north(id);
1445  if(nids.size() == 1)
1446  north = nids[0];
1447 
1448  return north;
1449 }
virtual std::vector< DetId > north(const DetId &id) const =0
Definition: DetId.h:20
DetId PFRecHitProducerHCAL::getSouth ( const DetId id,
const CaloSubdetectorTopology topology 
)
private

Definition at line 1426 of file PFRecHitProducerHCAL.cc.

References south, and CaloSubdetectorTopology::south().

1427  {
1428 
1429  DetId south;
1430  vector<DetId> sids = topology.south(id);
1431  if(sids.size() == 1)
1432  south = sids[0];
1433 
1434  return south;
1435 }
Definition: DetId.h:20
virtual std::vector< DetId > south(const DetId &id) const =0

Member Data Documentation

bool PFRecHitProducerHCAL::applyLongShortDPG_
private

Definition at line 110 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

bool PFRecHitProducerHCAL::applyPulseDPG_
private

Definition at line 120 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

bool PFRecHitProducerHCAL::applyTimeDPG_
private

Definition at line 119 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

bool PFRecHitProducerHCAL::ECAL_Compensate_
private

Definition at line 131 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::ECAL_Compensation_
private

Definition at line 133 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

unsigned int PFRecHitProducerHCAL::ECAL_Dead_Code_
private

Definition at line 134 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::ECAL_Threshold_
private

Definition at line 132 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::EM_Depth_
private

Definition at line 137 of file PFRecHitProducerHCAL.h.

Referenced by createHcalRecHit(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::HAD_Depth_
private

Definition at line 138 of file PFRecHitProducerHCAL.h.

Referenced by createHcalRecHit(), and PFRecHitProducerHCAL().

bool PFRecHitProducerHCAL::HCAL_Calib_
private

Definition at line 96 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

float PFRecHitProducerHCAL::HCAL_Calib_29
private

Definition at line 98 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::hcalHFDigiTimeFlagValue_
private

Definition at line 127 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::hcalHFInTimeWindowFlagValue_
private

Definition at line 128 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::hcalHFLongShortFlagValue_
private

Definition at line 126 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::HcalMaxAllowedChannelStatusSev_
private

Definition at line 124 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::HcalMaxAllowedHFDigiTimeSev_
private

Definition at line 122 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::HcalMaxAllowedHFInTimeWindowSev_
private

Definition at line 123 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

int PFRecHitProducerHCAL::HcalMaxAllowedHFLongShortSev_
private

Definition at line 121 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

bool PFRecHitProducerHCAL::HF_Calib_
private

Definition at line 97 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

float PFRecHitProducerHCAL::HF_Calib_29
private

Definition at line 99 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

edm::InputTag PFRecHitProducerHCAL::inputTagCaloTowers_
private

Definition at line 86 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

edm::InputTag PFRecHitProducerHCAL::inputTagHcalRecHitsHBHE_
private

Definition at line 84 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

edm::InputTag PFRecHitProducerHCAL::inputTagHcalRecHitsHF_
private

Definition at line 85 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::longFibre_Cut
private

Definition at line 106 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::longFibre_Fraction
private

Definition at line 103 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::longShortFibre_Cut
private

Definition at line 113 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::maxLongTiming_Cut
private

Definition at line 117 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::maxShortTiming_Cut
private

Definition at line 115 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::minLongTiming_Cut
private

Definition at line 116 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::minShortTiming_Cut
private

Definition at line 114 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

bool PFRecHitProducerHCAL::navigation_HF_
private

Definition at line 91 of file PFRecHitProducerHCAL.h.

Referenced by PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::shortFibre_Cut
private

Definition at line 102 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::shortFibre_Fraction
private

Definition at line 107 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::thresh_HF_
private

threshold for HF

Definition at line 89 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::weight_HFem_
private

Definition at line 92 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().

double PFRecHitProducerHCAL::weight_HFhad_
private

Definition at line 93 of file PFRecHitProducerHCAL.h.

Referenced by createRecHits(), and PFRecHitProducerHCAL().