Skip to content

Commit

Permalink
Merge pull request #7797 from nickmccoll/my-cmssw/CalibFormats_SiStri…
Browse files Browse the repository at this point in the history
…pObjects_toTrackerTopology

Removal of depreciated SiStripDetId classes from CalibFormats/SiStripObjects
  • Loading branch information
davidlange6 committed Mar 10, 2015
2 parents b22d99b + 2453259 commit ac373de
Show file tree
Hide file tree
Showing 20 changed files with 177 additions and 114 deletions.
2 changes: 1 addition & 1 deletion CalibFormats/SiStripObjects/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="DataFormats/SiStripCommon"/>
<use name="DataFormats/SiStripDetId"/>
<use name="CondFormats/SiStripObjects"/>
<use name="CalibTracker/SiStripCommon"/>
<use name="DataFormats/TrackerCommon"/>
<use name="boost"/>
<export>
<lib name="1"/>
Expand Down
8 changes: 5 additions & 3 deletions CalibFormats/SiStripObjects/interface/SiStripDetCabling.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#include <vector>
#include <string>
#include <map>

class TrackerTopology;
class SiStripDetCabling
{
public:
SiStripDetCabling();
SiStripDetCabling(const TrackerTopology* const topology);
virtual ~SiStripDetCabling();
SiStripDetCabling(const SiStripFedCabling &);
SiStripDetCabling(const SiStripFedCabling &,const TrackerTopology* const topology);
void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector<const FedChannelConnection *> >&);
void addDevices(const FedChannelConnection &); // special case of above addDevices
// getters
Expand Down Expand Up @@ -59,6 +59,7 @@ class SiStripDetCabling
uint32_t detectedNumber(const std::string & subDet, const uint16_t layer) const { return detNumber(subDet, layer, 1); }
uint32_t undetectedNumber(const std::string & subDet, const uint16_t layer) const { return detNumber(subDet, layer, 2); }
inline const SiStripFedCabling * fedCabling() const {return fedCabling_;}
inline const TrackerTopology* const trackerTopology() const {return tTopo;}

std::map< uint32_t, std::vector<int> > const & connected() const { return connected_;}

Expand All @@ -84,5 +85,6 @@ class SiStripDetCabling
// 2 = undetected
std::map< int16_t, uint32_t > connectionCount[3];
const SiStripFedCabling * fedCabling_;
const TrackerTopology* const tTopo;
};
#endif
3 changes: 2 additions & 1 deletion CalibFormats/SiStripObjects/interface/SiStripQuality.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

class SiStripDetCabling;
class SiStripDetInfoFileReader;
class TrackerTopology;

class SiStripQuality GCC11_FINAL : public SiStripBadStrip {

Expand Down Expand Up @@ -141,7 +142,7 @@ class SiStripQuality GCC11_FINAL : public SiStripBadStrip {
void turnOffFeds(const std::vector<int> & fedsList, const bool turnOffStrips, const bool printDebug);

/// Prints debug output for a given detId
void printDetInfo(const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss);
void printDetInfo(const TrackerTopology* const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss);
/// Prints debug output for the active feds comparing the list in RunInfo and FedCabling
void printActiveFedsInfo( const std::vector<uint16_t> & activeFedsFromCabling,
const std::vector<int> & activeFedsFromRunInfo,
Expand Down
15 changes: 4 additions & 11 deletions CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <boost/cstdint.hpp>
#include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
#include "DataFormats/Common/interface/RefGetter.h"
#include "DataFormats/Common/interface/Handle.h"
#include <sstream>
Expand All @@ -27,8 +26,8 @@ class SiStripRegionCabling {
public:

/** enums */
enum SubDet {TIB = 0, TOB = 1, TID = 2, TEC = 3, ALLSUBDETS = 4};
enum Layer {TIBLAYERS = 4, TOBLAYERS = 6, TIDLAYERS = 3, TECLAYERS = 9, ALLLAYERS = 10};
enum SubDet {TIB = 0, TOB = 1, TID = 2, TEC = 3, ALLSUBDETS = 4};
enum Layer {TIBLAYERS = 4, TOBLAYERS = 6, TIDLAYERS = 3, TECLAYERS = 9, ALLLAYERS = 10};

/** Cabling typedefs */
typedef std::pair< uint32_t, std::vector<FedChannelConnection> > Element;
Expand Down Expand Up @@ -96,16 +95,10 @@ class SiStripRegionCabling {

inline static const uint32_t region(const ElementIndex);

/** Methods for extracting det-id information */

// /** Methods for extracting det-id information */
//
static const SubDet subdetFromDetId(const uint32_t detid);

static const uint32_t layerFromDetId(const uint32_t detid);

static const uint32_t physicalLayerFromDetId(const uint32_t detid);

static const uint32_t physicalLayer(const SubDet, const uint32_t layer);

/** Methods for updating a SiStripRefGetter<T> container with elements
of interest */

Expand Down
31 changes: 13 additions & 18 deletions CalibFormats/SiStripObjects/src/SiStripDetCabling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/SiStripDetId/interface/SiStripSubStructure.h"
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
#include "DataFormats/SiStripDetId/interface/TECDetId.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"

#include <iostream>

//---- default constructor / destructor
SiStripDetCabling::SiStripDetCabling() : fedCabling_(0) {}
SiStripDetCabling::SiStripDetCabling(const TrackerTopology* const topology) : fedCabling_(0), tTopo(topology) {}
SiStripDetCabling::~SiStripDetCabling() {}

//---- construct detector view (DetCabling) out of readout view (FedCabling)
SiStripDetCabling::SiStripDetCabling(const SiStripFedCabling& fedcabling) : fullcabling_(), connected_(), detected_(), undetected_(), fedCabling_(&fedcabling)
SiStripDetCabling::SiStripDetCabling(const SiStripFedCabling& fedcabling,const TrackerTopology* const topology) : fullcabling_(), connected_(), detected_(), undetected_(), fedCabling_(&fedcabling), tTopo(topology)
{
// --- CONNECTED = have fedid and i2cAddr
// create fullcabling_, loop over vector of FedChannelConnection, either make new element of map, or add to appropriate vector of existing map element
Expand Down Expand Up @@ -259,20 +256,18 @@ void SiStripDetCabling::addFromSpecificConnection( std::map<uint32_t, std::vecto

int16_t SiStripDetCabling::layerSearch( const uint32_t detId ) const
{
if(SiStripDetId(detId).subDetector()==SiStripDetId::TIB){
TIBDetId D(detId);
return D.layerNumber();
} else if (SiStripDetId(detId).subDetector()==SiStripDetId::TID){
TIDDetId D(detId);
const DetId detectorId=DetId(detId);
const int subdet = detectorId.subdetId();
if(subdet==StripSubdetector::TIB){
return tTopo->layer(detId);
} else if (subdet==StripSubdetector::TID){
// side: 1 = negative, 2 = positive
return 10+(D.side() -1)*3 + D.wheel();
} else if (SiStripDetId(detId).subDetector()==SiStripDetId::TOB){
TOBDetId D(detId);
return 100+D.layerNumber();
} else if (SiStripDetId(detId).subDetector()==SiStripDetId::TEC){
TECDetId D(detId);
return 10+(tTopo->side(detId) -1)*3 + tTopo->layer(detId);
} else if (subdet==StripSubdetector::TOB){
return 100+tTopo->layer(detId);
} else if (subdet==StripSubdetector::TEC){
// side: 1 = negative, 2 = positive
return 1000+(D.side() -1)*9 + D.wheel();
return 1000+(tTopo->side(detId) -1)*9 +tTopo->layer(detId);
}
return 0;
}
Expand Down
14 changes: 7 additions & 7 deletions CalibFormats/SiStripObjects/src/SiStripHashedDetId.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "CalibFormats/SiStripObjects/interface/SiStripHashedDetId.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
#include <iomanip>
Expand Down Expand Up @@ -82,14 +82,14 @@ void SiStripHashedDetId::init( const std::vector<uint32_t>& raw_ids ) {
detIds_.reserve(16000);
const_iterator iter = raw_ids.begin();
for ( ; iter != raw_ids.end(); ++iter ) {
SiStripDetId detid(*iter);
DetId detectorId=DetId(*iter);
if ( *iter != sistrip::invalid32_ &&
*iter != sistrip::invalid_ &&
detid.det() == DetId::Tracker &&
( detid.subDetector() == SiStripDetId::TID ||
detid.subDetector() == SiStripDetId::TIB ||
detid.subDetector() == SiStripDetId::TOB ||
detid.subDetector() == SiStripDetId::TEC ) ) {
detectorId.det() == DetId::Tracker &&
( detectorId.subdetId() == StripSubdetector::TID ||
detectorId.subdetId() == StripSubdetector::TIB ||
detectorId.subdetId() == StripSubdetector::TOB ||
detectorId.subdetId() == StripSubdetector::TEC ) ) {
detIds_.push_back(*iter);
} else {
edm::LogWarning(mlCabling_)
Expand Down
32 changes: 10 additions & 22 deletions CalibFormats/SiStripObjects/src/SiStripQuality.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
#include "DataFormats/FEDRawData/interface/FEDNumbering.h"
#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"


// Needed only for output
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
#include "DataFormats/SiStripDetId/interface/TECDetId.h"
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
#include "DataFormats/DetId/interface/DetId.h"

#include <boost/bind.hpp>
Expand Down Expand Up @@ -688,44 +686,34 @@ short SiStripQuality::getBadFibers(const uint32_t& detid) const
return 0;
}

void SiStripQuality::printDetInfo(const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
void SiStripQuality::printDetInfo(const TrackerTopology* const tTopo, const uint32_t &detId, const uint32_t &apvPairNumber, std::stringstream &ss)
{
int layer = 0;
int stereo = 0;
std::string subDetName;
DetId detid(detId);
int layer = tTopo->layer(detid);
int stereo = 0;
switch (detid.subdetId()) {
case StripSubdetector::TIB:
{
TIBDetId theTIBDetId(detid.rawId());
layer = theTIBDetId.layer();
stereo = theTIBDetId.stereo();
stereo = tTopo->tibIsStereo(detid);
subDetName = "TIB";
break;
}
case StripSubdetector::TOB:
{
TOBDetId theTOBDetId(detid.rawId());
layer = theTOBDetId.layer();
stereo = theTOBDetId.stereo();
stereo = tTopo->tobIsStereo(detid);
subDetName = "TOB";
break;
}
case StripSubdetector::TEC:
{
TECDetId theTECDetId(detid.rawId());
// is this module in TEC+ or TEC-?
layer = theTECDetId.wheel();
stereo = theTECDetId.stereo();
stereo = tTopo->tecIsStereo(detid);
subDetName = "TEC";
break;
}
case StripSubdetector::TID:
{
TECDetId theTIDDetId(detid.rawId());
// is this module in TID+ or TID-?
layer = theTIDDetId.wheel();
stereo = theTIDDetId.stereo();
stereo = tTopo->tidIsStereo(detid);
subDetName = "TID";
break;
}
Expand Down Expand Up @@ -776,7 +764,7 @@ void SiStripQuality::turnOffFeds(const std::vector<int> & fedsList, const bool t
uint16_t apvPairNumber = fedChIt->apvPairNumber();

if( printDebug ) {
printDetInfo(detId, apvPairNumber, ss);
printDetInfo(SiStripDetCabling_->trackerTopology(),detId, apvPairNumber, ss);
}

if( turnOffStrips ) {
Expand Down
39 changes: 6 additions & 33 deletions CalibFormats/SiStripObjects/src/SiStripRegionCabling.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h"
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
#include "FWCore/Utilities/interface/typelookup.h"
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
#include "DataFormats/SiStripDetId/interface/TECDetId.h"
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"

using namespace sistrip;

Expand Down Expand Up @@ -41,38 +38,14 @@ SiStripRegionCabling::PositionIndex SiStripRegionCabling::increment(const Positi
}

const SiStripRegionCabling::SubDet SiStripRegionCabling::subdetFromDetId(const uint32_t detid) {

SiStripDetId::SubDetector subdet = SiStripDetId(detid).subDetector();
if (subdet == 3) return TIB;
else if (subdet == 4) return TID;
else if (subdet == 5) return TOB;
else if (subdet == 6) return TEC;
DetId detectorId=DetId(detid);
if (detectorId.subdetId() == StripSubdetector::TIB) return TIB;
else if (detectorId.subdetId() == StripSubdetector::TID) return TID;
else if (detectorId.subdetId() == StripSubdetector::TOB) return TOB;
else if (detectorId.subdetId() == StripSubdetector::TEC) return TEC;
else return ALLSUBDETS;
}

const uint32_t SiStripRegionCabling::layerFromDetId(const uint32_t detid) {

SiStripRegionCabling::SubDet subdet = subdetFromDetId(detid);
if (subdet == TIB) return TIBDetId(detid).layer();
else if (subdet == TID) return TIDDetId(detid).wheel();
else if (subdet == TOB) return TOBDetId(detid).layer();
else if (subdet == TEC) return TECDetId(detid).wheel();
else return ALLLAYERS;
}

const uint32_t SiStripRegionCabling::physicalLayerFromDetId(const uint32_t detid) {
return physicalLayer(subdetFromDetId(detid),layerFromDetId(detid));
}

const uint32_t SiStripRegionCabling::physicalLayer(const SubDet subdet, const uint32_t layer) {

if (subdet == TIB) return layer;
else if (subdet == TOB) return TIBLAYERS + layer;
else if (subdet == TID) return layer;
else if (subdet == TEC) return TIDLAYERS + layer;
else return ALLLAYERS;
}

// -----------------------------------------------------------------------------
//
void SiStripRegionCabling::print( std::stringstream& ss ) const {
Expand Down
5 changes: 3 additions & 2 deletions CalibTracker/Records/interface/SiStripDependentRecords.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"

class SiStripFecCablingRcd : public edm::eventsetup::DependentRecordImplementation<SiStripFecCablingRcd,
boost::mpl::vector<SiStripFedCablingRcd> > {};

class SiStripDetCablingRcd : public edm::eventsetup::DependentRecordImplementation<SiStripDetCablingRcd,
boost::mpl::vector<SiStripFedCablingRcd> > {};
boost::mpl::vector<SiStripFedCablingRcd,IdealGeometryRecord> > {};

class SiStripRegionCablingRcd : public edm::eventsetup::DependentRecordImplementation<SiStripRegionCablingRcd,
boost::mpl::vector<SiStripDetCablingRcd,TrackerDigiGeometryRecord> > {};
boost::mpl::vector<SiStripDetCablingRcd,TrackerDigiGeometryRecord,IdealGeometryRecord> > {};

// class SiStripGainRcd : public edm::eventsetup::DependentRecordImplementation<SiStripGainRcd, boost::mpl::vector<SiStripApvGainRcd> > {};
class SiStripGainRcd : public edm::eventsetup::DependentRecordImplementation<SiStripGainRcd, boost::mpl::vector<SiStripApvGainRcd, SiStripApvGain2Rcd, SiStripApvGain3Rcd> > {};
Expand Down
1 change: 1 addition & 0 deletions CalibTracker/SiStripESProducers/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<library file="geom/*.cc" name="CalibTrackerSiStripGeomESProducersPlugins">
<use name="CalibTracker/SiStripESProducers"/>
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="DataFormats/TrackerCommon"/>
<flags EDM_PLUGIN="1"/>
</library>
<library file="DBWriter/*.cc" name="CalibTrackerSiStripESProducersDBWriterPlugins">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ std::auto_ptr<SiStripFecCabling> SiStripConnectivity::produceFecCabling( const S
std::auto_ptr<SiStripDetCabling> SiStripConnectivity::produceDetCabling( const SiStripDetCablingRcd& iRecord ){
edm::ESHandle<SiStripFedCabling> pDD;
iRecord.getRecord<SiStripFedCablingRcd>().get(pDD );
edm::ESHandle<TrackerTopology> tTopoHandle;
iRecord.getRecord<IdealGeometryRecord>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();
//here build an object of type SiStripDetCabling using **ONLY** the information from class SiStripFedCabling,
SiStripDetCabling * DetConnections = new SiStripDetCabling( *(pDD.product()));
SiStripDetCabling * DetConnections = new SiStripDetCabling( *(pDD.product()),tTopo);
return std::auto_ptr<SiStripDetCabling>( DetConnections );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ std::auto_ptr<SiStripRegionCabling> SiStripRegionConnectivity::produceRegionCabl
edm::ESHandle<TrackerGeometry> tkgeom;
iRecord.getRecord<TrackerDigiGeometryRecord>().get( tkgeom );

edm::ESHandle<TrackerTopology> tTopoHandle;
iRecord.getRecord<IdealGeometryRecord>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();

//here build an object of type SiStripRegionCabling using the information from class SiStripDetCabling **PLUS** the geometry.

//Construct region cabling object
Expand Down Expand Up @@ -56,7 +60,7 @@ std::auto_ptr<SiStripRegionCabling> SiStripRegionConnectivity::produceRegionCabl
uint32_t subdet = static_cast<uint32_t>(SiStripRegionCabling::subdetFromDetId(idet->first));

//Find layer from det-id
uint32_t layer = SiStripRegionCabling::layerFromDetId(idet->first);
uint32_t layer = tTopo->layer(idet->first);

//@@ BELOW IS TEMP FIX TO HANDLE BUG IN DET CABLING
std::vector<const FedChannelConnection *> conns = idet->second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ void HITSiStripRawToClustersRoI::produce(edm::Event& event, const edm::EventSetu
}

bool HITSiStripRawToClustersRoI::physicalLayer(SubDet& subdet, uint32_t& layer) const {
int signedlayer = static_cast<int>(SiStripRegionCabling::physicalLayer(subdet,layer));
return (nlayers_ == -1 || signedlayer < nlayers_) ? true : false;
uint32_t signedlayer = 0;
if (subdet == SiStripRegionCabling::TIB || subdet == SiStripRegionCabling::TID) signedlayer = layer;
else if (subdet == SiStripRegionCabling::TOB) signedlayer = SiStripRegionCabling::TIBLAYERS + layer;
else if (subdet == SiStripRegionCabling::TEC) signedlayer = SiStripRegionCabling::TIDLAYERS + layer;
else signedlayer = SiStripRegionCabling::ALLLAYERS;

return (nlayers_ == -1 || int(signedlayer) < nlayers_) ? true : false;
}

void HITSiStripRawToClustersRoI::random(RefGetter& refgetter, edm::Handle<LazyGetter>& lazygetter) const {
Expand Down

0 comments on commit ac373de

Please sign in to comment.