CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Attributes
PFHFRecHitCreator Class Reference

#include <PFHFRecHitCreator.h>

Inheritance diagram for PFHFRecHitCreator:
PFRecHitCreatorBase

Classes

class  DetIDSorter
 

Public Member Functions

void importRecHits (std::auto_ptr< reco::PFRecHitCollection > &out, std::auto_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 PFHFRecHitCreator (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 

Protected Attributes

double EM_Depth_
 
double HAD_Depth_
 
double HFCalib_
 
double longFibre_Cut
 
double longFibre_Fraction
 
edm::EDGetTokenT
< edm::SortedCollection
< HFRecHit > > 
recHitToken_
 
double shortFibre_Cut
 
double shortFibre_Fraction
 
double thresh_HF_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr
< PFRecHitQTestBase > > 
qualityTests_
 

Additional Inherited Members

- Protected Member Functions inherited from PFRecHitCreatorBase
void beginEvent (const edm::Event &event, const edm::EventSetup &setup)
 

Detailed Description

Definition at line 20 of file PFHFRecHitCreator.h.

Constructor & Destructor Documentation

PFHFRecHitCreator::PFHFRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 23 of file PFHFRecHitCreator.h.

References edm::ConsumesCollector::consumes(), EM_Depth_, edm::ParameterSet::getParameter(), HAD_Depth_, HFCalib_, longFibre_Cut, longFibre_Fraction, recHitToken_, shortFibre_Cut, shortFibre_Fraction, and thresh_HF_.

23  :
24  PFRecHitCreatorBase(iConfig,iC)
25  {
27  EM_Depth_ = iConfig.getParameter<double>("EMDepthCorrection");
28  HAD_Depth_ = iConfig.getParameter<double>("HADDepthCorrection");
29  shortFibre_Cut = iConfig.getParameter<double>("ShortFibre_Cut");
30  longFibre_Fraction = iConfig.getParameter<double>("LongFibre_Fraction");
31  longFibre_Cut = iConfig.getParameter<double>("LongFibre_Cut");
32  shortFibre_Fraction = iConfig.getParameter<double>("ShortFibre_Fraction");
33  thresh_HF_ = iConfig.getParameter<double>("thresh_HF");
34  HFCalib_ = iConfig.getParameter<double>("HFCalib29");
35 
36  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::SortedCollection< HFRecHit > > recHitToken_

Member Function Documentation

void PFHFRecHitCreator::importRecHits ( std::auto_ptr< reco::PFRecHitCollection > &  out,
std::auto_ptr< reco::PFRecHitCollection > &  cleaned,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlinevirtual

Implements PFRecHitCreatorBase.

Definition at line 40 of file PFHFRecHitCreator.h.

References a, funct::abs(), assert(), b, PFRecHitCreatorBase::beginEvent(), HcalDetId::depth(), HLT_25ns14e33_v1_cff::depth, cond::rpcobgas::detid, EM_Depth_, relval_parameters_module::energy, edm::EventSetup::get(), edm::Event::getByToken(), CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), HAD_Depth_, DetId::Hcal, HcalForward, PFLayer::HF_EM, PFLayer::HF_HAD, HFCalib_, HcalDetId::ieta(), HcalDetId::iphi(), keep, longFibre_Cut, longFibre_Fraction, PFLayer::NONE, point, position, PFRecHitCreatorBase::qualityTests_, DetId::rawId(), recHitToken_, reco::PFRecHit::setEnergy(), reco::PFRecHit::setTime(), shortFibre_Cut, shortFibre_Fraction, EZArrayFL< T >::size(), python.multivaluedict::sort(), MCScenario_CRAFT1_22X::sorter(), groupFilesInBlocks::temp, thresh_HF_, cond::rpcobgas::time, x, y, and z.

40  {
41 
42 
44 
45  beginEvent(iEvent,iSetup);
46 
48 
50  iSetup.get<CaloGeometryRecord>().get(geoHandle);
51 
52  // get the ecal geometry
53  const CaloSubdetectorGeometry *hcalGeo =
54  geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalForward);
55 
56  iEvent.getByToken(recHitToken_,recHitHandle);
57  for( const auto& erh : *recHitHandle ) {
58  const HcalDetId& detid = (HcalDetId)erh.detid();
59  int depth = detid.depth();
60 
61  double energy = erh.energy();
62  double time = erh.time();
63 
65  math::XYZVector axis;
66 
67  const CaloCellGeometry *thisCell;
68  thisCell= hcalGeo->getGeometry(detid);
69 
70  // find rechit geometry
71  if(!thisCell) {
72  edm::LogError("PFHFRecHitCreator")
73  <<"warning detid "<<detid.rawId()
74  <<" not found in geometry"<<std::endl;
75  continue;
76  }
77 
78  auto const point = thisCell->getPosition();
79 
80 
81  PFLayer::Layer layer;
82  double depth_correction;
83  if (depth==1) {
84  layer = PFLayer::HF_EM;
85  depth_correction = point.z() > 0. ? EM_Depth_ : -EM_Depth_;
86  }
87  else {
88  layer = PFLayer::HF_HAD;
89  depth_correction = point.z() > 0. ? HAD_Depth_ : -HAD_Depth_;
90  }
91 
92 
93  position.SetCoordinates ( point.x(),
94  point.y(),
95  point.z()+depth_correction );
96 
97 
98  reco::PFRecHit rh( detid.rawId(),layer,
99  energy,
100  position.x(), position.y(), position.z(),
101  0,0,0);
102  rh.setTime(time);
103  rh.setDepth(depth);
104 
105  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
106  assert( corners.size() == 8 );
107 
108  rh.setNECorner( corners[0].x(), corners[0].y(), corners[0].z()+depth_correction);
109  rh.setSECorner( corners[1].x(), corners[1].y(), corners[1].z()+depth_correction);
110  rh.setSWCorner( corners[2].x(), corners[2].y(), corners[2].z()+depth_correction);
111  rh.setNWCorner( corners[3].x(), corners[3].y(), corners[3].z()+depth_correction);
112 
113 
114  bool rcleaned = false;
115  bool keep=true;
116 
117  //Apply Q tests
118  for( const auto& qtest : qualityTests_ ) {
119  if (!qtest->test(rh,erh,rcleaned)) {
120  keep = false;
121 
122  }
123  }
124 
125  if(keep) {
126  tmpOut.push_back(rh);
127  }
128  else if (rcleaned)
129  cleaned->push_back(rh);
130  }
131  //Sort by DetID the collection
132  DetIDSorter sorter;
133  if (tmpOut.size()>0)
134  std::sort(tmpOut.begin(),tmpOut.end(),sorter);
135 
136 
138 
139  double lONG=0.;
140  double sHORT=0.;
141 
142  for (auto& hit : tmpOut) {
143  lONG=0.0;
144  sHORT=0.0;
145 
146  reco::PFRecHit newHit = hit;
147  const HcalDetId& detid = (HcalDetId)hit.detId();
148  if (detid.depth()==1) {
149  lONG=hit.energy();
150  //find the short hit
151  HcalDetId shortID (HcalForward, detid.ieta(), detid.iphi(), 2);
152  const reco::PFRecHit temp(shortID,PFLayer::NONE,0.0,math::XYZPoint(0,0,0),math::XYZVector(0,0,0),std::vector<math::XYZPoint>());
153  auto found_hit = std::lower_bound(tmpOut.begin(),tmpOut.end(),
154  temp,
155  [](const reco::PFRecHit& a,
156  const reco::PFRecHit& b){
157  return a.detId() < b.detId();
158  });
159  if( found_hit != tmpOut.end() && found_hit->detId() == shortID.rawId() ) {
160  sHORT = found_hit->energy();
161  //Ask for fraction
162  double energy = lONG-sHORT;
163 
164  if (abs(detid.ieta())<=32)
165  energy*=HFCalib_;
166  newHit.setEnergy(energy);
167  if (!( lONG > longFibre_Cut &&
168  ( sHORT/lONG < shortFibre_Fraction)))
169  if (energy>thresh_HF_)
170  out->push_back(newHit);
171  }
172  else
173  {
174  //make only long hit
175  double energy = lONG;
176  if (abs(detid.ieta())<=32)
177  energy*=HFCalib_;
178  newHit.setEnergy(energy);
179 
180  if (energy>thresh_HF_)
181  out->push_back(newHit);
182 
183  }
184 
185  }
186  else {
187  sHORT=hit.energy();
188  HcalDetId longID (HcalForward, detid.ieta(), detid.iphi(), 1);
189  const reco::PFRecHit temp(longID,PFLayer::NONE,0.0,math::XYZPoint(0,0,0),math::XYZVector(0,0,0),std::vector<math::XYZPoint>());
190  auto found_hit = std::lower_bound(tmpOut.begin(),tmpOut.end(),
191  temp,
192  [](const reco::PFRecHit& a,
193  const reco::PFRecHit& b){
194  return a.detId() < b.detId();
195  });
196  double energy = 2*sHORT;
197  if( found_hit != tmpOut.end() && found_hit->detId() == longID.rawId() ) {
198  lONG = found_hit->energy();
199  //Ask for fraction
200 
201  //If in this case lONG-sHORT<0 add the energy to the sHORT
202  if ((lONG-sHORT)<thresh_HF_)
203  energy = lONG+sHORT;
204 
205  if (abs(detid.ieta())<=32)
206  energy*=HFCalib_;
207 
208  newHit.setEnergy(energy);
209  if (!( sHORT > shortFibre_Cut &&
210  ( lONG/sHORT < longFibre_Fraction)))
211  if (energy>thresh_HF_)
212  out->push_back(newHit);
213 
214  }
215  else {
216  //only short hit!
217  if (abs(detid.ieta())<=32)
218  energy*=HFCalib_;
219  newHit.setEnergy(energy);
220  if (energy>thresh_HF_)
221  out->push_back(newHit);
222  }
223  }
224 
225 
226  }
227 
228  }
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
assert(m_qm.get())
edm::EDGetTokenT< edm::SortedCollection< HFRecHit > > recHitToken_
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
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:43
void setEnergy(double energy)
Definition: PFRecHit.h:72
const int keep
int depth() const
get the tower depth
Definition: HcalDetId.h:55
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
int ieta() const
get the cell ieta
Definition: HcalDetId.h:51
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
void setTime(double time)
Definition: PFRecHit.h:78
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
int iphi() const
get the cell iphi
Definition: HcalDetId.h:53
size_type size() const
Definition: EZArrayFL.h:81
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const T & get() const
Definition: EventSetup.h:55
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
static int position[264][3]
Definition: ReadPGInfo.cc:509
const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

Member Data Documentation

double PFHFRecHitCreator::EM_Depth_
protected

Definition at line 234 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::HAD_Depth_
protected

Definition at line 235 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::HFCalib_
protected

Definition at line 244 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::longFibre_Cut
protected

Definition at line 241 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::longFibre_Fraction
protected

Definition at line 238 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

edm::EDGetTokenT<edm::SortedCollection<HFRecHit> > PFHFRecHitCreator::recHitToken_
protected

Definition at line 233 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::shortFibre_Cut
protected

Definition at line 237 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::shortFibre_Fraction
protected

Definition at line 242 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().

double PFHFRecHitCreator::thresh_HF_
protected

Definition at line 243 of file PFHFRecHitCreator.h.

Referenced by importRecHits(), and PFHFRecHitCreator().