Skip to content

Commit

Permalink
Merge pull request #13087 from thomaslenzi/from-CMSSW_8_0_X_2016-01-2…
Browse files Browse the repository at this point in the history
…1-2300

Phase2 Outer Tracker Clusterizer integration in CMSSW 8
  • Loading branch information
davidlange6 committed Jan 31, 2016
2 parents 0d86cde + 8628a59 commit 873bfaf
Show file tree
Hide file tree
Showing 31 changed files with 1,735 additions and 0 deletions.
5 changes: 5 additions & 0 deletions DataFormats/Phase2TrackerCluster/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<use name="DataFormats/Common"/>
<use name="rootrflx"/>
<export>
<lib name="1"/>
</export>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef DATAFORMATS_PHASE2TRACKERCLUSTER_PHASE2TRACKERCLUSTER1D_H
#define DATAFORMATS_PHASE2TRACKERCLUSTER_PHASE2TRACKERCLUSTER1D_H

#include <cstdint>

#include "DataFormats/Common/interface/DetSetVectorNew.h"

#include "DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h"

class Phase2TrackerCluster1D {

public:

Phase2TrackerCluster1D() : data_(0) { }
Phase2TrackerCluster1D(unsigned int row, unsigned int col, unsigned int size) : firstDigi_(row, col), data_((size & 0x7fff)) { }
Phase2TrackerCluster1D(unsigned int row, unsigned int col, unsigned int size, unsigned int threshold) : firstDigi_(row, col), data_(((threshold & 0x1) << 15) | (size & 0x7fff)) { }
Phase2TrackerCluster1D(const Phase2TrackerDigi& firstDigi, unsigned int size) : firstDigi_(firstDigi), data_((size & 0x7fff)) { }
Phase2TrackerCluster1D(const Phase2TrackerDigi& firstDigi, unsigned int size, unsigned int threshold) : firstDigi_(firstDigi), data_(((threshold & 0x1) << 15) | (size & 0x7fff)) { }

const Phase2TrackerDigi& firstDigi() const { return firstDigi_; }
unsigned int firstStrip() const { return firstDigi_.strip(); }
unsigned int firstRow() const { return firstDigi_.row(); }
unsigned int edge() const { return firstDigi_.edge(); }
unsigned int column() const { return firstDigi_.column(); }
uint16_t size() const { return (data_ & 0x7fff); }
uint16_t threshold() const { return ((data_ >> 15) & 0x1); }
float center() const { return firstStrip() + (data_ & 0x7fff) / 2.; }
std::pair< float, float > barycenter() const { return std::make_pair(column(), center()); }

private:

Phase2TrackerDigi firstDigi_;
uint16_t data_;

};

inline bool operator< (const Phase2TrackerCluster1D& one, const Phase2TrackerCluster1D& other) {
return one.firstStrip() < other.firstStrip();
}

typedef edmNew::DetSetVector< Phase2TrackerCluster1D > Phase2TrackerCluster1DCollectionNew;

#endif
18 changes: 18 additions & 0 deletions DataFormats/Phase2TrackerCluster/src/classes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef DATAFORMATS_PHASE2TRACKERCLUSTER_CLASSES_H
#define DATAFORMATS_PHASE2TRACKERCLUSTER_CLASSES_H

#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DetSetNew.h"

namespace {
struct dictionary {
edm::Wrapper< Phase2TrackerCluster1D > cl0;
edm::Wrapper< std::vector< Phase2TrackerCluster1D > > cl1;
edm::Wrapper< edmNew::DetSet< Phase2TrackerCluster1D > > cl2;
edm::Wrapper< std::vector< edmNew::DetSet< Phase2TrackerCluster1D > > > cl3;
edm::Wrapper< Phase2TrackerCluster1DCollectionNew > cl4;
};
}

#endif
12 changes: 12 additions & 0 deletions DataFormats/Phase2TrackerCluster/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<lcgdict>
<class name="Phase2TrackerCluster1D" ClassVersion="2">
<version ClassVersion="2" checksum="1003486686"/>
</class>
<class name="std::vector< Phase2TrackerCluster1D >"/>
<class name="std::vector< edmNew::DetSet< Phase2TrackerCluster1D > >"/>
<class name="edmNew::DetSet< Phase2TrackerCluster1D >"/>
<class name="edmNew::DetSetVector< Phase2TrackerCluster1D >"/>
<class name="edm::Wrapper< edmNew::DetSet< Phase2TrackerCluster1D > >" splitLevel="0"/>
<class name="edm::Wrapper< std::vector< edmNew::DetSet< Phase2TrackerCluster1D > > >" splitLevel="0"/>
<class name="edm::Wrapper< edmNew::DetSetVector< Phase2TrackerCluster1D > >"/>
</lcgdict>
5 changes: 5 additions & 0 deletions DataFormats/Phase2TrackerRecHit/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<use name="DataFormats/Common"/>
<use name="rootrflx"/>
<export>
<lib name="1"/>
</export>
33 changes: 33 additions & 0 deletions DataFormats/Phase2TrackerRecHit/interface/Phase2TrackerRecHit1D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef DATAFORMATS_PHASE2TRACKERRECHIT_PHASE2TRACKERRECHIT1D_H
#define DATAFORMATS_PHASE2TRACKERRECHIT_PHASE2TRACKERRECHIT1D_H

#include "DataFormats/Common/interface/DetSetVectorNew.h"

#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"
#include "DataFormats/GeometrySurface/interface/LocalError.h"
#include "DataFormats/GeometryVector/interface/LocalPoint.h"

typedef edm::Ref< edmNew::DetSetVector< Phase2TrackerCluster1D >, Phase2TrackerCluster1D > Phase2ClusterReference;

class Phase2TrackerRecHit1D {

public:

Phase2TrackerRecHit1D() { }
Phase2TrackerRecHit1D(LocalPoint pos, LocalError err, Phase2ClusterReference cluster) : pos_(pos), err_(err), cluster_(cluster) { }

LocalPoint localPosition() const { return pos_; }
LocalError localPositionError() const { return err_; }
Phase2ClusterReference cluster() const { return cluster_; }

private:

LocalPoint pos_;
LocalError err_;
Phase2ClusterReference cluster_;

};

typedef edmNew::DetSetVector< Phase2TrackerRecHit1D > Phase2TrackerRecHit1DCollectionNew;

#endif
18 changes: 18 additions & 0 deletions DataFormats/Phase2TrackerRecHit/src/classes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef DATAFORMATS_PHASE2TRACKERRECHIT_CLASSES_H
#define DATAFORMATS_PHASE2TRACKERRECHIT_CLASSES_H

#include "DataFormats/Phase2TrackerRecHit/interface/Phase2TrackerRecHit1D.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DetSetNew.h"

namespace {
struct dictionary {
edm::Wrapper< Phase2TrackerRecHit1D > cl0;
edm::Wrapper< std::vector< Phase2TrackerRecHit1D > > cl1;
edm::Wrapper< edmNew::DetSet< Phase2TrackerRecHit1D > > cl2;
edm::Wrapper< std::vector< edmNew::DetSet< Phase2TrackerRecHit1D > > > cl3;
edm::Wrapper< Phase2TrackerRecHit1DCollectionNew > cl4;
};
}

#endif
12 changes: 12 additions & 0 deletions DataFormats/Phase2TrackerRecHit/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<lcgdict>
<class name="Phase2TrackerRecHit1D" ClassVersion="2">
<version ClassVersion="2" checksum="3085242308"/>
</class>
<class name="std::vector< Phase2TrackerRecHit1D >"/>
<class name="std::vector< edmNew::DetSet< Phase2TrackerRecHit1D > >"/>
<class name="edmNew::DetSet< Phase2TrackerRecHit1D >"/>
<class name="edmNew::DetSetVector< Phase2TrackerRecHit1D >"/>
<class name="edm::Wrapper< edmNew::DetSet< Phase2TrackerRecHit1D > >" splitLevel="0"/>
<class name="edm::Wrapper< std::vector< edmNew::DetSet< Phase2TrackerRecHit1D > > >" splitLevel="0"/>
<class name="edm::Wrapper< edmNew::DetSetVector< Phase2TrackerRecHit1D > >"/>
</lcgdict>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef RecoLocalTracker_Cluster_Parameter_Estimator_H
#define RecoLocalTracker_Cluster_Parameter_Estimator_H

#include "DataFormats/GeometrySurface/interface/LocalError.h"
#include "DataFormats/GeometryVector/interface/LocalPoint.h"

#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"

template <class T>
class ClusterParameterEstimator {

public:
typedef std::pair<LocalPoint,LocalError> LocalValues;
typedef std::vector<LocalValues> VLocalValues;
virtual LocalValues localParameters( const T&,const GeomDetUnit&) const = 0;
virtual LocalValues localParameters( const T& cluster, const GeomDetUnit& gd, const LocalTrajectoryParameters&) const {
return localParameters(cluster,gd);
}
virtual LocalValues localParameters( const T& cluster, const GeomDetUnit& gd, const TrajectoryStateOnSurface& tsos) const {
return localParameters(cluster,gd,tsos.localParameters());
}
virtual VLocalValues localParametersV( const T& cluster, const GeomDetUnit& gd) const {
VLocalValues vlp;
vlp.push_back(localParameters(cluster,gd));
return vlp;
}
virtual VLocalValues localParametersV( const T& cluster, const GeomDetUnit& gd, const TrajectoryStateOnSurface& tsos) const {
VLocalValues vlp;
vlp.push_back(localParameters(cluster,gd,tsos.localParameters()));
return vlp;
}

virtual ~ClusterParameterEstimator(){}

//methods needed by FastSim
virtual void enterLocalParameters(unsigned int id, std::pair<int,int>
&row_col, LocalValues pos_err_info) const {}
virtual void enterLocalParameters(uint32_t id, uint16_t firstStrip,
LocalValues pos_err_info) const {}
virtual void clearParameters() const {}

};

#endif
8 changes: 8 additions & 0 deletions RecoLocalTracker/Phase2TrackerRecHits/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="RecoLocalTracker/ClusterParameterEstimator"/>
<use name="DataFormats/Phase2TrackerCluster"/>
<use name="DataFormats/Phase2TrackerRecHit"/>
<export>
<lib name="1"/>
</export>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef RecoLocalTracker_Phase2TrackerRecHits_Phase2StripCPETrivial_H
#define RecoLocalTracker_Phase2TrackerRecHits_Phase2StripCPETrivial_H

#include "RecoLocalTracker/ClusterParameterEstimator/interface/ClusterParameterEstimator.h"
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"


class Phase2StripCPETrivial : public ClusterParameterEstimator<Phase2TrackerCluster1D> {

public:

LocalValues localParameters(const Phase2TrackerCluster1D & cluster, const GeomDetUnit & det) const;

};


#endif
7 changes: 7 additions & 0 deletions RecoLocalTracker/Phase2TrackerRecHits/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="RecoLocalTracker/Records"/>
<use name="RecoLocalTracker/ClusterParameterEstimator"/>
<use name="RecoLocalTracker/Phase2TrackerRecHits"/>
<library file="*.cc" name="RecoLocalTrackerPhase2TrackerRecHitsPlugins">
<flags EDM_PLUGIN="1"/>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ModuleFactory.h"

#include "RecoLocalTracker/Records/interface/TkStripCPERecord.h"
#include "RecoLocalTracker/ClusterParameterEstimator/interface/ClusterParameterEstimator.h"
#include "RecoLocalTracker/Phase2TrackerRecHits/interface/Phase2StripCPETrivial.h"

#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"

#include <boost/shared_ptr.hpp>

#include <memory>
#include <map>

class Phase2StripCPEESProducer: public edm::ESProducer {

public:

Phase2StripCPEESProducer(const edm::ParameterSet&);
boost::shared_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > produce(const TkStripCPERecord & iRecord);

private:

enum CPE_t { TRIVIAL };
std::map<std::string, CPE_t> enumMap_;

CPE_t cpeNum_;
edm::ParameterSet pset_;
boost::shared_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > cpe_;

};

Phase2StripCPEESProducer::Phase2StripCPEESProducer(const edm::ParameterSet & p) {
std::string name = p.getParameter<std::string>("ComponentType");

enumMap_[std::string("Phase2StripCPETrivial")] = TRIVIAL;
if (enumMap_.find(name) == enumMap_.end())
throw cms::Exception("Unknown StripCPE type") << name;

cpeNum_ = enumMap_[name];
pset_ = p;
setWhatProduced(this, name);
}

boost::shared_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > Phase2StripCPEESProducer::produce(const TkStripCPERecord & iRecord) {

switch(cpeNum_) {

case TRIVIAL:
cpe_ = boost::shared_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> >(new Phase2StripCPETrivial());
break;

}

return cpe_;
}


#include "FWCore/Framework/interface/ModuleFactory.h"
DEFINE_FWK_EVENTSETUP_MODULE(Phase2StripCPEESProducer);
Loading

0 comments on commit 873bfaf

Please sign in to comment.