diff --git a/DataFormats/GEMRecHit/BuildFile.xml b/DataFormats/GEMRecHit/BuildFile.xml
index 0b431e98854d6..be517a1f490cb 100644
--- a/DataFormats/GEMRecHit/BuildFile.xml
+++ b/DataFormats/GEMRecHit/BuildFile.xml
@@ -1,6 +1,8 @@
+
+
diff --git a/DataFormats/GEMRecHit/interface/ME0RecHit.h b/DataFormats/GEMRecHit/interface/ME0RecHit.h
new file mode 100644
index 0000000000000..12e8f491d23eb
--- /dev/null
+++ b/DataFormats/GEMRecHit/interface/ME0RecHit.h
@@ -0,0 +1,113 @@
+#ifndef DataFormats_ME0RecHit_H
+#define DataFormats_ME0RecHit_H
+
+/** \class ME0RecHit
+*
+* RecHit for ME0
+*
+* $Date: 2014/02/03 16:54:23 $
+* $Revision: 1.1 $
+* \author M. Maggi -- INFN Bari
+*/
+
+#include "DataFormats/TrackingRecHit/interface/RecHit2DLocalPos.h"
+#include "DataFormats/MuonDetId/interface/ME0DetId.h"
+
+
+class ME0RecHit : public RecHit2DLocalPos {
+ public:
+
+ ME0RecHit(const ME0DetId& me0Id,
+float tof);
+
+ /// Default constructor
+ ME0RecHit();
+
+ /// Constructor from a local position, ME0Id and digi time.
+ ME0RecHit(const ME0DetId& me0Id,
+float tof,
+const LocalPoint& pos);
+
+
+ /// Constructor from a local position and error, ME0Id and tof.
+ /// The 3-dimensional local error is defined as
+ /// resolution (the cell resolution) for the coordinate being measured
+ /// and 0 for the two other coordinates
+ ME0RecHit(const ME0DetId& me0Id,
+float tof,
+const LocalPoint& pos,
+const LocalError& err);
+
+
+ /// Destructor
+ virtual ~ME0RecHit();
+
+
+ /// Return the 3-dimensional local position
+ virtual LocalPoint localPosition() const {
+ return theLocalPosition;
+ }
+
+
+ /// Return the 3-dimensional error on the local position
+ virtual LocalError localPositionError() const {
+ return theLocalError;
+ }
+
+
+ virtual ME0RecHit* clone() const;
+
+
+ /// Access to component RecHits.
+ /// No components rechits: it returns a null vector
+ virtual std::vector recHits() const;
+
+
+ /// Non-const access to component RecHits.
+ /// No components rechits: it returns a null vector
+ virtual std::vector recHits();
+
+
+ /// Set local position
+ void setPosition(LocalPoint pos) {
+ theLocalPosition = pos;
+ }
+
+
+ /// Set local position error
+ void setError(LocalError err) {
+ theLocalError = err;
+ }
+
+
+ /// Set the local position and its error
+ void setPositionAndError(LocalPoint pos, LocalError err) {
+ theLocalPosition = pos;
+ theLocalError = err;
+ }
+
+
+ /// Return the gemId
+ ME0DetId me0Id() const {
+ return theME0Id;
+ }
+
+ float tof() const {
+ return theTOF;
+ }
+
+ /// Comparison operator, based on the gemId and the digi time
+ bool operator==(const ME0RecHit& hit) const;
+
+ private:
+ ME0DetId theME0Id;
+ float theTOF;
+ // Position and error in the Local Ref. Frame of the ME0Layer
+ LocalPoint theLocalPosition;
+ LocalError theLocalError;
+
+};
+#endif
+
+/// The ostream operator
+std::ostream& operator<<(std::ostream& os, const ME0RecHit& hit);
diff --git a/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h b/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h
new file mode 100644
index 0000000000000..3b65df23d177e
--- /dev/null
+++ b/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h
@@ -0,0 +1,29 @@
+#ifndef DataFormats_ME0RecHitCollection_H
+#define DataFormats_ME0RecHitCollection_H
+
+/** \class ME0RecHitCollection
+ * Collection of ME0RecHit for storage in the event
+ *
+ * $Date: 2013/04/24 16:54:23 $
+ * $Revision: 1.1 $
+ * \author M. Maggi - INFN Bari
+ */
+
+
+#include "DataFormats/MuonDetId/interface/ME0DetId.h"
+#include "DataFormats/GEMRecHit/interface/ME0RecHit.h"
+#include "DataFormats/Common/interface/RangeMap.h"
+#include "DataFormats/Common/interface/ClonePolicy.h"
+#include "DataFormats/Common/interface/OwnVector.h"
+#include
+
+typedef edm::RangeMap >,
+ edm::ClonePolicy > ME0RecHitCollection;
+
+
+#endif
+
+
+
+
diff --git a/DataFormats/GEMRecHit/src/ME0RecHit.cc b/DataFormats/GEMRecHit/src/ME0RecHit.cc
new file mode 100644
index 0000000000000..53d181aebc9e7
--- /dev/null
+++ b/DataFormats/GEMRecHit/src/ME0RecHit.cc
@@ -0,0 +1,78 @@
+/*
+ * See header file for a description of this class.
+ *
+ * $Date: 2013/04/24 16:54:24 $
+ * $Revision: 1.1 $
+ * \author M. Maggi -- INFN Bari
+ */
+
+
+#include "DataFormats/GEMRecHit/interface/ME0RecHit.h"
+
+
+ME0RecHit::ME0RecHit(const ME0DetId& me0Id, float tof) : RecHit2DLocalPos(me0Id),
+ theME0Id(me0Id), theTOF(tof), theLocalPosition(), theLocalError()
+{
+}
+
+ME0RecHit::ME0RecHit() : RecHit2DLocalPos(),
+ theME0Id(), theTOF(0.), theLocalPosition(), theLocalError()
+{
+}
+
+
+ME0RecHit::ME0RecHit(const ME0DetId& me0Id, float tof, const LocalPoint& pos) : RecHit2DLocalPos(me0Id),
+ theME0Id(me0Id), theTOF(tof), theLocalPosition(pos), theLocalError()
+{
+}
+
+
+
+// Constructor from a local position and error, wireId and digi time.
+ME0RecHit::ME0RecHit(const ME0DetId& me0Id,
+ float tof,
+ const LocalPoint& pos,
+ const LocalError& err) : RecHit2DLocalPos(me0Id),
+ theME0Id(me0Id), theTOF(tof), theLocalPosition(pos), theLocalError(err)
+{
+}
+
+// Destructor
+ME0RecHit::~ME0RecHit()
+{
+}
+
+
+
+ME0RecHit * ME0RecHit::clone() const {
+ return new ME0RecHit(*this);
+}
+
+
+// Access to component RecHits.
+// No components rechits: it returns a null vector
+std::vector ME0RecHit::recHits() const {
+ std::vector nullvector;
+ return nullvector;
+}
+// Non-const access to component RecHits.
+// No components rechits: it returns a null vector
+std::vector ME0RecHit::recHits() {
+ std::vector nullvector;
+ return nullvector;
+}
+
+// Comparison operator, based on the wireId and the digi time
+bool ME0RecHit::operator==(const ME0RecHit& hit) const {
+ return this->geographicalId() == hit.geographicalId();
+}
+
+
+// The ostream operator
+std::ostream& operator<<(std::ostream& os, const ME0RecHit& hit) {
+ os << "pos: x = " << hit.localPosition().x() ;
+ os << " +/- " << sqrt(hit.localPositionError().xx())<<" cm";
+ os<< " y = " << hit.localPosition().y() ;
+ os << " +/- " << sqrt(hit.localPositionError().yy())<<" cm";
+ return os;
+}
diff --git a/DataFormats/GEMRecHit/src/classes.h b/DataFormats/GEMRecHit/src/classes.h
index 906f536c1b2b9..1fe9124ee5860 100644
--- a/DataFormats/GEMRecHit/src/classes.h
+++ b/DataFormats/GEMRecHit/src/classes.h
@@ -1,18 +1,28 @@
#include "DataFormats/GEMRecHit/interface/GEMRecHit.h"
#include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h"
+#include "DataFormats/GEMRecHit/interface/ME0RecHit.h"
+#include "DataFormats/GEMRecHit/interface/ME0RecHitCollection.h"
#include "DataFormats/Common/interface/Wrapper.h"
-namespace DataFormats_GEMRecHit {
+namespace {
struct dictionary {
std::pair dummyrpc1;
std::pair dummyrpc2;
std::map > dummyrpcdetid1;
std::map > dummyrpcdetid2;
+ std::map > dummyme0detid1;
+ std::map > dummyme0detid2;
GEMRecHit rrh;
std::vector vrh;
GEMRecHitCollection c;
edm::Wrapper w;
+
+ ME0RecHit mrh;
+ std::vector vmrh;
+ ME0RecHitCollection mc;
+ edm::Wrapper mw;
+
};
}
diff --git a/DataFormats/GEMRecHit/src/classes_def.xml b/DataFormats/GEMRecHit/src/classes_def.xml
index 64c85963465fa..a9786ec7c747c 100644
--- a/DataFormats/GEMRecHit/src/classes_def.xml
+++ b/DataFormats/GEMRecHit/src/classes_def.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -11,10 +11,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/RecoLocalMuon/GEMRecHit/interface/ME0RecHitAlgoFactory.h b/RecoLocalMuon/GEMRecHit/interface/ME0RecHitAlgoFactory.h
new file mode 100644
index 0000000000000..69c0e558294a8
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/interface/ME0RecHitAlgoFactory.h
@@ -0,0 +1,17 @@
+#ifndef RecoLocalMuon_ME0RecHitAlgoFactory_H
+#define RecoLocalMuon_ME0RecHitAlgoFactory_H
+
+/** \class ME0RecHitAlgoFactory
+ * Factory of seal plugins for 1D RecHit reconstruction algorithms.
+ * The plugins are concrete implementations of ME0RecHitBaseAlgo base class.
+ *
+ * $Date: 2014/02/04 10:16:32 $
+ * $Revision: 1.1 $
+ * \author M. Maggi - INFN Torino
+ */
+#include "FWCore/PluginManager/interface/PluginFactory.h"
+#include "RecoLocalMuon/GEMRecHit/interface/ME0RecHitBaseAlgo.h"
+
+typedef edmplugin::PluginFactory ME0RecHitAlgoFactory;
+#endif
+
diff --git a/RecoLocalMuon/GEMRecHit/interface/ME0RecHitBaseAlgo.h b/RecoLocalMuon/GEMRecHit/interface/ME0RecHitBaseAlgo.h
new file mode 100644
index 0000000000000..daa05df30a02a
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/interface/ME0RecHitBaseAlgo.h
@@ -0,0 +1,53 @@
+#ifndef RecoLocalMuon_ME0RecHitBaseAlgo_H
+#define RecoLocalMuon_ME0RecHitBaseAlgo_H
+
+/** \class ME0RecHitBaseAlgo
+ * Abstract algorithmic class to compute Rec Hit
+ * form a ME0 digi
+ *
+ * $Date: 2014/02/04 10:16:32 $
+ * $Revision: 1.1 $
+ * \author M. Maggi -- INFN Bari
+ */
+
+
+#include "DataFormats/GeometryVector/interface/LocalPoint.h"
+#include "DataFormats/GeometrySurface/interface/LocalError.h"
+#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
+#include "DataFormats/GEMDigi/interface/ME0DigiPreRecoCollection.h"
+#include "DataFormats/GEMRecHit/interface/ME0RecHit.h"
+#include "DataFormats/Common/interface/OwnVector.h"
+
+class ME0DetId;
+
+namespace edm {
+ class ParameterSet;
+ class EventSetup;
+}
+
+
+class ME0RecHitBaseAlgo {
+
+ public:
+
+ /// Constructor
+ ME0RecHitBaseAlgo(const edm::ParameterSet& config);
+
+ /// Destructor
+ virtual ~ME0RecHitBaseAlgo();
+
+ /// Pass the Event Setup to the algo at each event
+ virtual void setES(const edm::EventSetup& setup) = 0;
+
+ /// Build all hits in the range associated to the me0Id, at the 1st step.
+ virtual edm::OwnVector reconstruct(const ME0DetId& me0Id,
+ const ME0DigiPreRecoCollection::Range& digiRange);
+
+ /// standard local recHit computation
+ virtual bool compute(const ME0DigiPreReco& digi,
+ LocalPoint& Point,
+ LocalError& error) const = 0;
+
+};
+#endif
+
diff --git a/RecoLocalMuon/GEMRecHit/python/me0LocalReco_cff.py b/RecoLocalMuon/GEMRecHit/python/me0LocalReco_cff.py
new file mode 100644
index 0000000000000..0d5fb51fb5d45
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/python/me0LocalReco_cff.py
@@ -0,0 +1,6 @@
+import FWCore.ParameterSet.Config as cms
+
+from RecoLocalMuon.GEMRecHit.me0RecHits_cfi import *
+from RecoLocalMuon.GEMRecHit.me0Segments_cfi import *
+
+me0LocalReco = cms.Sequence(me0RecHits*me0Segments)
diff --git a/RecoLocalMuon/GEMRecHit/python/me0RecHits_cfi.py b/RecoLocalMuon/GEMRecHit/python/me0RecHits_cfi.py
new file mode 100644
index 0000000000000..f9088d0a2c1cc
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/python/me0RecHits_cfi.py
@@ -0,0 +1,7 @@
+import FWCore.ParameterSet.Config as cms
+
+me0RecHits = cms.EDProducer("ME0RecHitProducer",
+ recAlgoConfig = cms.PSet(),
+ recAlgo = cms.string('ME0RecHitStandardAlgo'),
+ me0DigiLabel = cms.InputTag("simMuonME0Digis"),
+)
diff --git a/RecoLocalMuon/GEMRecHit/src/ME0RecHitAlgoFactory.cc b/RecoLocalMuon/GEMRecHit/src/ME0RecHitAlgoFactory.cc
new file mode 100644
index 0000000000000..fda6b8af9c6a9
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/src/ME0RecHitAlgoFactory.cc
@@ -0,0 +1,14 @@
+/*
+ * See header file for a description of this class.
+ *
+ * $Date: 2014/02/04 10:16:35 $
+ * $Revision: 1.1 $
+ * \author M. Maggi -- INFN Bari
+ */
+
+#include "RecoLocalMuon/GEMRecHit/interface/ME0RecHitAlgoFactory.h"
+
+#include "FWCore/PluginManager/interface/PluginFactory.h"
+
+EDM_REGISTER_PLUGINFACTORY(ME0RecHitAlgoFactory,"ME0RecHitAlgoFactory");
+
diff --git a/RecoLocalMuon/GEMRecHit/src/ME0RecHitBaseAlgo.cc b/RecoLocalMuon/GEMRecHit/src/ME0RecHitBaseAlgo.cc
new file mode 100644
index 0000000000000..d064e810c2040
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/src/ME0RecHitBaseAlgo.cc
@@ -0,0 +1,44 @@
+/*
+* See header file for a description of this class.
+*
+* $Date: 2014/02/04 10:16:35 $
+* $Revision: 1.1 $
+* \author M. Maggi -- INFN Bari
+*/
+
+
+
+#include "RecoLocalMuon/GEMRecHit/interface/ME0RecHitBaseAlgo.h"
+#include "Geometry/GEMGeometry/interface/ME0EtaPartition.h"
+#include "DataFormats/GEMDigi/interface/ME0DigiPreRecoCollection.h"
+#include "FWCore/ParameterSet/interface/ParameterSet.h"
+
+
+ME0RecHitBaseAlgo::ME0RecHitBaseAlgo(const edm::ParameterSet& config) {
+}
+
+ME0RecHitBaseAlgo::~ME0RecHitBaseAlgo(){}
+
+
+// Build all hits in the range associated to the layerId, at the 1st step.
+edm::OwnVector ME0RecHitBaseAlgo::reconstruct(const ME0DetId& me0Id,
+const ME0DigiPreRecoCollection::Range& digiRange){
+ edm::OwnVector result;
+
+ for (ME0DigiPreRecoCollection::const_iterator digi = digiRange.first;
+ digi != digiRange.second;digi++) {
+
+ LocalError tmpErr;
+ LocalPoint point;
+ // Call the compute method
+ bool OK = this->compute(*digi, point, tmpErr);
+ if (!OK) continue;
+
+ if (std::abs(digi->pdgid()) == 13) {
+ ME0RecHit* recHit = new ME0RecHit(me0Id,digi->tof(),point,tmpErr);
+ result.push_back(recHit);
+ }
+
+ }
+ return result;
+}
diff --git a/RecoLocalMuon/GEMRecHit/src/ME0RecHitProducer.cc b/RecoLocalMuon/GEMRecHit/src/ME0RecHitProducer.cc
new file mode 100644
index 0000000000000..a792d4c6a80db
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/src/ME0RecHitProducer.cc
@@ -0,0 +1,81 @@
+/** \file
+ *
+ * $Date: 2013/04/24 17:16:35 $
+ * $Revision: 1.1 $
+ * \author M. Maggi -- INFN Bari
+*/
+
+#include "ME0RecHitProducer.h"
+
+
+ME0RecHitProducer::ME0RecHitProducer(const edm::ParameterSet& config){
+
+ produces();
+
+ m_token = consumes( config.getParameter("me0DigiLabel") );
+
+
+ // Get the concrete reconstruction algo from the factory
+
+ std::string theAlgoName = config.getParameter("recAlgo");
+ theAlgo = ME0RecHitAlgoFactory::get()->create(theAlgoName,
+ config.getParameter("recAlgoConfig"));
+}
+
+
+ME0RecHitProducer::~ME0RecHitProducer(){
+ delete theAlgo;
+}
+
+
+
+void ME0RecHitProducer::beginRun(const edm::Run& r, const edm::EventSetup& setup){
+}
+
+
+
+void ME0RecHitProducer::produce(edm::Event& event, const edm::EventSetup& setup) {
+
+ // Get the ME0 Geometry
+ edm::ESHandle me0Geom;
+ setup.get().get(me0Geom);
+
+ // Get the digis from the event
+
+ edm::Handle digis;
+ event.getByToken(m_token,digis);
+
+ // Pass the EventSetup to the algo
+
+ theAlgo->setES(setup);
+
+ // Create the pointer to the collection which will store the rechits
+
+ std::auto_ptr recHitCollection(new ME0RecHitCollection());
+
+ // Iterate through all digi collections ordered by LayerId
+
+ ME0DigiPreRecoCollection::DigiRangeIterator me0dgIt;
+ for (me0dgIt = digis->begin(); me0dgIt != digis->end();
+ ++me0dgIt){
+
+ // The layerId
+ const ME0DetId& me0Id = (*me0dgIt).first;
+
+
+ // Get the iterators over the digis associated with this LayerId
+ const ME0DigiPreRecoCollection::Range& range = (*me0dgIt).second;
+
+ // Call the reconstruction algorithm
+
+ edm::OwnVector recHits =
+ theAlgo->reconstruct(me0Id, range);
+
+ if(recHits.size() > 0)
+ recHitCollection->put(me0Id, recHits.begin(), recHits.end());
+ }
+
+ event.put(recHitCollection);
+
+}
+
diff --git a/RecoLocalMuon/GEMRecHit/src/ME0RecHitProducer.h b/RecoLocalMuon/GEMRecHit/src/ME0RecHitProducer.h
new file mode 100644
index 0000000000000..5204905369d0b
--- /dev/null
+++ b/RecoLocalMuon/GEMRecHit/src/ME0RecHitProducer.h
@@ -0,0 +1,71 @@
+#ifndef RecoLocalMuon_ME0RecHitProducer_h
+#define RecoLocalMuon_ME0RecHitProducer_h
+
+/** \class ME0RecHitProducer
+ * Module for ME0RecHit production.
+ *
+ * $Date: 2014/02/04 10:53:23 $
+ * $Revision: 1.1 $
+ * \author M. Maggim -- INFN Bari
+ */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include