Skip to content

Commit

Permalink
adding ME0 for recolocal
Browse files Browse the repository at this point in the history
  • Loading branch information
archiesharma committed Apr 29, 2015
1 parent 724ea6c commit e1a5c83
Show file tree
Hide file tree
Showing 30 changed files with 1,873 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, gemId and digi time.
/// 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);


/// Constructor from a local position and error, gemId and bx.
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




85 changes: 85 additions & 0 deletions DataFormats/GEMRecHit/interface/ME0Segment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#ifndef GEMRecHit_ME0Segment_h
#define GEMRecHit_ME0Segment_h

/** \class ME0Segment derived by the CSC segment
* Describes a reconstructed track segment in the 6 layers of the ME0 system.
* This is 4-dimensional since it has an origin (x,y) and a direction (x,y)
* in the local coordinate system of the chamber.
*
* $Date: 2014/02/04 12:41:32 $
* \author Marcello Maggi
*/

#include <DataFormats/TrackingRecHit/interface/RecSegment.h>
#include <DataFormats/GEMRecHit/interface/ME0RecHitCollection.h>

#include <iosfwd>

class ME0DetId;

class ME0Segment GCC11_FINAL : public RecSegment {

public:

/// Default constructor
ME0Segment() : theChi2(0.){}

/// Constructor
ME0Segment(const std::vector<const ME0RecHit*>& proto_segment, LocalPoint origin,
LocalVector direction, AlgebraicSymMatrix errors, double chi2);

/// Destructor
virtual ~ME0Segment();

//--- Base class interface
ME0Segment* clone() const { return new ME0Segment(*this); }

LocalPoint localPosition() const { return theOrigin; }
LocalError localPositionError() const ;

LocalVector localDirection() const { return theLocalDirection; }
LocalError localDirectionError() const ;

/// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
AlgebraicVector parameters() const;

/// Covariance matrix of parameters()
AlgebraicSymMatrix parametersError() const { return theCovMatrix; }

/// The projection matrix relates the trajectory state parameters to the segment parameters().
virtual AlgebraicMatrix projectionMatrix() const;

virtual std::vector<const TrackingRecHit*> recHits() const;

virtual std::vector<TrackingRecHit*> recHits();

double chi2() const { return theChi2; };

virtual int dimension() const { return 4; }

virtual int degreesOfFreedom() const { return 2*nRecHits() - 4;}

//--- Extension of the interface

const std::vector<ME0RecHit>& specificRecHits() const { return theME0RecHits; }

int nRecHits() const { return theME0RecHits.size(); }

ME0DetId me0DetId() const { return geographicalId(); }

float time() const;

void print() const;

private:

std::vector<ME0RecHit> theME0RecHits;
LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system
LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system
AlgebraicSymMatrix theCovMatrix; // the covariance matrix
double theChi2;
};

std::ostream& operator<<(std::ostream& os, const ME0Segment& seg);

#endif
24 changes: 24 additions & 0 deletions DataFormats/GEMRecHit/interface/ME0SegmentCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef DataFormats_ME0SegmentCollection_H
#define DataFormats_ME0SegmentCollection_H

/** \class ME0SegmentCollection
*
* The collection of ME0Segment's. See \ref CSCSegmentCollection.h for details from which is derived.
*
* $Date: 2014/02/04 10:08:15 $
* \author Marcello Maggi
*/

#include <DataFormats/MuonDetId/interface/ME0DetId.h>
#include <DataFormats/GEMRecHit/interface/ME0Segment.h>

#include <DataFormats/Common/interface/RangeMap.h>
#include <DataFormats/Common/interface/ClonePolicy.h>
#include <DataFormats/Common/interface/OwnVector.h>

typedef edm::RangeMap <ME0DetId, edm::OwnVector<ME0Segment> > ME0SegmentCollection;

#include <DataFormats/Common/interface/Ref.h>
typedef edm::Ref<ME0SegmentCollection> ME0SegmentRef;

#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;
}
Loading

0 comments on commit e1a5c83

Please sign in to comment.