Skip to content

Commit

Permalink
Merge pull request #8912 from archiesharma/CodeforME0
Browse files Browse the repository at this point in the history
adding ME0 for recolocal
  • Loading branch information
cmsbuild committed May 20, 2015
2 parents 02b4527 + d9d77f0 commit 8beb70a
Show file tree
Hide file tree
Showing 17 changed files with 634 additions and 10 deletions.
2 changes: 2 additions & 0 deletions DataFormats/GEMRecHit/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<use name="DataFormats/Common"/>
<use name="DataFormats/GeometryVector"/>
<use name="DataFormats/MuonDetId"/>
<use name="DataFormats/TrackingRecHit"/>
<use name="rootrflx"/>

<export>
<lib name="1"/>
Expand Down
113 changes: 113 additions & 0 deletions DataFormats/GEMRecHit/interface/ME0RecHit.h
Original file line number Diff line number Diff line change
@@ -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<const TrackingRecHit*> recHits() const;


/// Non-const access to component RecHits.
/// No components rechits: it returns a null vector
virtual std::vector<TrackingRecHit*> 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);
29 changes: 29 additions & 0 deletions DataFormats/GEMRecHit/interface/ME0RecHitCollection.h
Original file line number Diff line number Diff line change
@@ -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 <functional>

typedef edm::RangeMap <ME0DetId,
edm::OwnVector<ME0RecHit,edm::ClonePolicy<ME0RecHit> >,
edm::ClonePolicy<ME0RecHit> > ME0RecHitCollection;


#endif




78 changes: 78 additions & 0 deletions DataFormats/GEMRecHit/src/ME0RecHit.cc
Original file line number Diff line number Diff line change
@@ -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<const TrackingRecHit*> ME0RecHit::recHits() const {
std::vector<const TrackingRecHit*> nullvector;
return nullvector;
}
// Non-const access to component RecHits.
// No components rechits: it returns a null vector
std::vector<TrackingRecHit*> ME0RecHit::recHits() {
std::vector<TrackingRecHit*> 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;
}
12 changes: 11 additions & 1 deletion DataFormats/GEMRecHit/src/classes.h
Original file line number Diff line number Diff line change
@@ -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<unsigned int, unsigned int> dummyrpc1;
std::pair<unsigned long, unsigned long> dummyrpc2;
std::map<GEMDetId, std::pair<unsigned int, unsigned int> > dummyrpcdetid1;
std::map<GEMDetId, std::pair<unsigned long, unsigned long> > dummyrpcdetid2;
std::map<ME0DetId, std::pair<unsigned int, unsigned int> > dummyme0detid1;
std::map<ME0DetId, std::pair<unsigned long, unsigned long> > dummyme0detid2;

GEMRecHit rrh;
std::vector<GEMRecHit> vrh;
GEMRecHitCollection c;
edm::Wrapper<GEMRecHitCollection> w;

ME0RecHit mrh;
std::vector<ME0RecHit> vmrh;
ME0RecHitCollection mc;
edm::Wrapper<ME0RecHitCollection> mw;

};
}

25 changes: 23 additions & 2 deletions DataFormats/GEMRecHit/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<lcgdict>
<selection>
<class name="GEMRecHit" splitLevel="0" ClassVersion="11">
<version ClassVersion="11" checksum="3146992425"/>
<version ClassVersion="10" checksum="3680872192"/>
<version ClassVersion="11" checksum="3146992425"/>
<version ClassVersion="10" checksum="3680872192"/>
</class>
<class name="std::vector<GEMRecHit>" splitLevel="0"/>
<class name="std::vector<GEMRecHit*>" splitLevel="0"/>
Expand All @@ -11,10 +11,31 @@
<class name="edm::OwnVector<GEMRecHit, edm::ClonePolicy<GEMRecHit> >" splitLevel="0"/>
<class name="edm::RangeMap<GEMDetId, edm::OwnVector<GEMRecHit, edm::ClonePolicy<GEMRecHit> >, edm::ClonePolicy<GEMRecHit> >" splitLevel="0"/>
<class name="edm::Wrapper<edm::RangeMap<GEMDetId, edm::OwnVector<GEMRecHit, edm::ClonePolicy<GEMRecHit> >, edm::ClonePolicy<GEMRecHit> > >" splitLevel="0"/>

<class name="ME0RecHit" splitLevel="0" ClassVersion="11">
<version ClassVersion="11" checksum="3948270793"/>
<version ClassVersion="10" checksum="2817146898"/>
</class>
<class name="std::vector<ME0RecHit>" splitLevel="0"/>
<class name="std::vector<ME0RecHit*>" splitLevel="0"/>
<class name="std::map<ME0DetId, std::pair<unsigned int, unsigned int> >" splitLevel="0"/>
<class name="std::map<ME0DetId, std::pair<unsigned long, unsigned long> >" splitLevel="0"/>
<class name="edm::OwnVector<ME0RecHit, edm::ClonePolicy<ME0RecHit> >" splitLevel="0"/>
<class name="edm::RangeMap<ME0DetId, edm::OwnVector<ME0RecHit, edm::ClonePolicy<ME0RecHit> >, edm::ClonePolicy<ME0RecHit> >" splitLevel="0"/>
<class name="edm::Wrapper<edm::RangeMap<ME0DetId, edm::OwnVector<ME0RecHit, edm::ClonePolicy<ME0RecHit> >, edm::ClonePolicy<ME0RecHit> > >" splitLevel="0"/>

</selection>


<exclusion>
<class name="edm::OwnVector<GEMRecHit, edm::ClonePolicy<GEMRecHit> >">
<method name="sort" splitLevel="0"/>
</class>

<class name="edm::OwnVector<ME0RecHit, edm::ClonePolicy<ME0RecHit> >">
<method name="sort" splitLevel="0"/>
</class>


</exclusion>
</lcgdict>
17 changes: 17 additions & 0 deletions RecoLocalMuon/GEMRecHit/interface/ME0RecHitAlgoFactory.h
Original file line number Diff line number Diff line change
@@ -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<ME0RecHitBaseAlgo *(const edm::ParameterSet &)> ME0RecHitAlgoFactory;
#endif

53 changes: 53 additions & 0 deletions RecoLocalMuon/GEMRecHit/interface/ME0RecHitBaseAlgo.h
Original file line number Diff line number Diff line change
@@ -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<ME0RecHit> 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

6 changes: 6 additions & 0 deletions RecoLocalMuon/GEMRecHit/python/me0LocalReco_cff.py
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions RecoLocalMuon/GEMRecHit/python/me0RecHits_cfi.py
Original file line number Diff line number Diff line change
@@ -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"),
)
Loading

0 comments on commit 8beb70a

Please sign in to comment.