CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFHcalRecHitCreator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFHcalRecHitCreator_h
2 #define RecoParticleFlow_PFClusterProducer_PFHcalRecHitCreator_h
3 
5 
11 
17 
19 
20 template <typename Digi, typename Geometry,PFLayer::Layer Layer,int Detector>
22 
23  public:
25  PFRecHitCreatorBase(iConfig,iC)
26  {
28  }
29 
30  void importRecHits(std::auto_ptr<reco::PFRecHitCollection>&out,std::auto_ptr<reco::PFRecHitCollection>& cleaned ,const edm::Event& iEvent,const edm::EventSetup& iSetup) {
31 
32  for (unsigned int i=0;i<qualityTests_.size();++i) {
33  qualityTests_.at(i)->beginEvent(iEvent,iSetup);
34  }
35 
37 
39  iSetup.get<CaloGeometryRecord>().get(geoHandle);
40 
41  // get the ecal geometry
42  const CaloSubdetectorGeometry *gTmp =
43  geoHandle->getSubdetectorGeometry(DetId::Hcal, Detector);
44 
45  const Geometry *hcalGeo =dynamic_cast< const Geometry* > (gTmp);
46 
47  iEvent.getByToken(recHitToken_,recHitHandle);
48  for( const auto& erh : *recHitHandle ) {
49  const HcalDetId& detid = (HcalDetId)erh.detid();
51 
52  //since hbhe are together kill other detector
53  if (esd !=Detector && Detector != HcalOther )
54  continue;
55 
56 
57  double energy = erh.energy();
58  double time = erh.time();
59 
60 
62  math::XYZVector axis;
63 
64  const CaloCellGeometry *thisCell;
65  thisCell= hcalGeo->getGeometry(detid);
66 
67  // find rechit geometry
68  if(!thisCell) {
69  edm::LogError("PFHcalRecHitCreator")
70  <<"warning detid "<<detid.rawId()
71  <<" not found in geometry"<<std::endl;
72  continue;
73  }
74 
75  position.SetCoordinates ( thisCell->getPosition().x(),
76  thisCell->getPosition().y(),
77  thisCell->getPosition().z() );
78 
79 
80 
81 
82  reco::PFRecHit rh( detid.rawId(),Layer,
83  energy,
84  position.x(), position.y(), position.z(),
85  0,0,0);
86  rh.setTime(time); //Mike: This we will use later
87 
88  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
89  assert( corners.size() == 8 );
90 
91  rh.setNECorner( corners[0].x(), corners[0].y(), corners[0].z());
92  rh.setSECorner( corners[1].x(), corners[1].y(), corners[1].z());
93  rh.setSWCorner( corners[2].x(), corners[2].y(), corners[2].z());
94  rh.setNWCorner( corners[3].x(), corners[3].y(), corners[3].z());
95 
96 
97  bool rcleaned = false;
98  bool keep=true;
99 
100  //Apply Q tests
101  for( const auto& qtest : qualityTests_ ) {
102  if (!qtest->test(rh,erh,rcleaned)) {
103  keep = false;
104 
105  }
106  }
107 
108  if(keep) {
109  out->push_back(rh);
110  }
111  else if (rcleaned)
112  cleaned->push_back(rh);
113  }
114  }
115 
116 
117 
118  protected:
120 
121 
122 };
123 
129 
130 
131 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
PFHcalRecHitCreator< HORecHit, CaloSubdetectorGeometry, PFLayer::HCAL_BARREL2, HcalOuter > PFHORecHitCreator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
void importRecHits(std::auto_ptr< reco::PFRecHitCollection > &out, std::auto_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup)
T y() const
Definition: PV3DBase.h:63
PFHcalRecHitCreator< HBHERecHit, CaloSubdetectorGeometry, PFLayer::HCAL_BARREL1, HcalBarrel > PFHBRecHitCreator
float float float z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const int keep
int iEvent
Definition: GenABIO.cc:230
PFHcalRecHitCreator< HBHERecHit, CaloSubdetectorGeometry, PFLayer::HCAL_ENDCAP, HcalEndcap > PFHERecHitCreator
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
T z() const
Definition: PV3DBase.h:64
HcalSubdetector
Definition: HcalAssistant.h:31
edm::EDGetTokenT< edm::SortedCollection< Digi > > recHitToken_
void setTime(double time)
Definition: PFRecHit.h:74
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
tuple out
Definition: dbtoconf.py:99
size_type size() const
Definition: EZArrayFL.h:81
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:55
PFHcalRecHitCreator< HFRecHit, CaloSubdetectorGeometry, PFLayer::HF_EM, HcalForward > PFHFEMRecHitCreator
PFHcalRecHitCreator< HFRecHit, CaloSubdetectorGeometry, PFLayer::HF_HAD, HcalForward > PFHFHADRecHitCreator
Definition: DDAxes.h:10
PFHcalRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
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.
T x() const
Definition: PV3DBase.h:62