test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector > Class Template Reference

#include <PFEcalRecHitCreatorMaxSample.h>

Inheritance diagram for PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >:
PFRecHitCreatorBase

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)
 
 PFEcalRecHitCreatorMaxSample (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 

Protected Attributes

edm::EDGetTokenT
< EcalRecHitCollection
recHitToken_
 
- 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

template<typename Geometry, PFLayer::Layer Layer, int Detector>
class PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >

Definition at line 27 of file PFEcalRecHitCreatorMaxSample.h.

Constructor & Destructor Documentation

template<typename Geometry , PFLayer::Layer Layer, int Detector>
PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >::PFEcalRecHitCreatorMaxSample ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Member Function Documentation

template<typename Geometry , PFLayer::Layer Layer, int Detector>
void PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >::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 36 of file PFEcalRecHitCreatorMaxSample.h.

References assert(), PFRecHitCreatorBase::beginEvent(), align::Detector, DetId::Ecal, relval_parameters_module::energy, edm::EventSetup::get(), edm::Event::getByToken(), CaloCellGeometry::getCorners(), TruncatedPyramid::getPosition(), CaloCellGeometry::getPosition(), keep, point, position, PFRecHitCreatorBase::qualityTests_, DetId::rawId(), PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >::recHitToken_, x, y, and z.

36  {
37 
38  beginEvent(iEvent,iSetup);
39 
41 
43  iSetup.get<CaloGeometryRecord>().get(geoHandle);
44 
45  // get the ecal geometry
46  const CaloSubdetectorGeometry *gTmp =
47  geoHandle->getSubdetectorGeometry(DetId::Ecal, Detector);
48 
49  const Geometry *ecalGeo =dynamic_cast< const Geometry* > (gTmp);
50 
51  iEvent.getByToken(recHitToken_,recHitHandle);
52  for(const auto& erh : *recHitHandle ) {
53  const DetId& detid = erh.detid();
54  double energy = erh.energy();
55  double time = erh.time();
56 
58  math::XYZVector axis;
59 
60  const CaloCellGeometry *thisCell;
61  thisCell= ecalGeo->getGeometry(detid);
62 
63  // find rechit geometry
64  if(!thisCell) {
65  edm::LogError("PFEcalRecHitCreatorMaxSample")
66  <<"warning detid "<<detid.rawId()
67  <<" not found in geometry"<<std::endl;
68  continue;
69  }
70 
71 
72  auto const point = thisCell->getPosition();
73 
74  position.SetCoordinates (point.x(),
75  point.y(),
76  point.z() );
77 
78  // the axis vector is the difference
79  const TruncatedPyramid* pyr
80  = dynamic_cast< const TruncatedPyramid* > (thisCell);
81 
82  if( pyr ) {
83  auto const point1 = pyr->getPosition(1);
84  axis.SetCoordinates( point1.x(),
85  point1.y(),
86  point1.z() );
87 
88  auto const point0 = pyr->getPosition(0);
89 
90  math::XYZVector axis0( point0.x(),
91  point0.y(),
92  point0.z() );
93 
94  axis -= axis0;
95  }
96  else continue;
97 
98 
99  reco::PFRecHit rh( detid.rawId(),Layer,
100  energy,
101  position.x(), position.y(), position.z(),
102  axis.x(), axis.y(), axis.z() );
103 
104 
105  //ECAL has no segmentation so put 1
106 
107  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
108  assert( corners.size() == 8 );
109 
110  rh.setNECorner( corners[0].x(), corners[0].y(), corners[0].z() );
111  rh.setSECorner( corners[1].x(), corners[1].y(), corners[1].z() );
112  rh.setSWCorner( corners[2].x(), corners[2].y(), corners[2].z() );
113  rh.setNWCorner( corners[3].x(), corners[3].y(), corners[3].z() );
114 
115 
116  bool rcleaned = false;
117  bool keep=true;
118 
119  //Apply Q tests
120  for( const auto& qtest : qualityTests_ ) {
121  if (!qtest->test(rh,erh,rcleaned)) {
122  keep = false;
123  }
124  }
125 
126  if(keep) {
127  rh.setTime(time);
128  rh.setDepth(1);
129  out->push_back(rh);
130  }
131  else if (rcleaned)
132  cleaned->push_back(rh);
133  }
134  }
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
assert(m_qm.get())
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const int keep
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: DetId.h:18
const GlobalPoint getPosition(CCGFloat depth) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:56
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
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

template<typename Geometry , PFLayer::Layer Layer, int Detector>
edm::EDGetTokenT<EcalRecHitCollection> PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >::recHitToken_
protected