Skip to content

Commit

Permalink
code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
tocheng committed Mar 26, 2018
1 parent fde9af0 commit 3722e7d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 38 deletions.
2 changes: 1 addition & 1 deletion CalibTracker/SiPixelQuality/plugins/BuildFile.xml
Expand Up @@ -7,9 +7,9 @@
<use name="DataFormats/SiPixelDetId"/>
<use name="DataFormats/FEDRawData"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/SiPixelObjects"/>
<use name="DQM/SiPixelPhase1Common"/>
<use name="CalibTracker/SiPixelQuality"/>
<use name="clhep"/>
<use name="boost"/>
<use name="root"/>

Expand Down
3 changes: 0 additions & 3 deletions CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h
Expand Up @@ -4,14 +4,11 @@
/** \class SiPixelStatusHarvester
* harvest per-lumi prduced SiPixelDetector status and make the payload for SiPixelQualityFromDB
*
* \author
*/
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DQM/SiPixelPhase1Common/interface/SiPixelCoordinates.h"

class SiPixelStatusHarvester : public edm::EDAnalyzer {
public:

Expand Down
53 changes: 28 additions & 25 deletions CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc
@@ -1,8 +1,6 @@
/**_________________________________________________________________
class: SiPixelStatusProducer.cc
package: CalibTracker/SiPixelQuality/SiPixelStatusProducer
author:
package: CalibTracker/SiPixelQuality
________________________________________________________________**/

Expand Down Expand Up @@ -43,7 +41,7 @@
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"

// Producer related dataformat
// EDProducer related dataformat
#include "DQM/SiPixelPhase1Common/interface/SiPixelCoordinates.h"
#include "CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h"

Expand All @@ -58,9 +56,9 @@ SiPixelStatusProducer::SiPixelStatusProducer(const edm::ParameterSet& iConfig){

// badPixelFEDChannelCollections
std::vector<edm::InputTag> badPixelFEDChannelCollectionLabels_ = iConfig.getParameter<edm::ParameterSet>("SiPixelStatusProducerParameters").getParameter<std::vector<edm::InputTag> >("badPixelFEDChannelCollections");
for (auto &t : badPixelFEDChannelCollectionLabels_)
for (auto &t : badPixelFEDChannelCollectionLabels_)
theBadPixelFEDChannelsTokens_.push_back(consumes<PixelFEDChannelCollection>(t));
// badPixelFEDChannelCollections = cms.VInputTag(cms.InputTag('siPixelDigis'))
// badPixelFEDChannelCollections = cms.VInputTag(cms.InputTag('siPixelDigis'))

fPixelClusterLabel_ = iConfig.getParameter<edm::ParameterSet>("SiPixelStatusProducerParameters").getUntrackedParameter<edm::InputTag>("pixelClusterLabel");
fSiPixelClusterToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(fPixelClusterLabel_);
Expand All @@ -81,7 +79,6 @@ SiPixelStatusProducer::~SiPixelStatusProducer(){

}


//--------------------------------------------------------------------------------------------------
void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup){

Expand Down Expand Up @@ -110,7 +107,7 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum

fFedIds = fCablingMap_->det2fedMap();

} // if conditionWatcher_.check(iSetup)
} // if conditionWatcher_.check(iSetup)

// init the SiPixelDetectorStatus fDet and sensor size fSensors in the begining (when countLumi is zero)
if(countLumi_ == 0){
Expand Down Expand Up @@ -147,20 +144,21 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum

int roc(-1), rocR(-1), rocC(-1);
onlineRocColRow(detId, dummyOfflineRow, dummeOfflineColumn, roc, rocR, rocC);

int value = roc;
rocIdMap[key] = value;
}

}
fRocIds[detid] = rocIdMap;

fRocIds[detid] = rocIdMap;

}

} // init when countLumi = 0

countLumi_++;

}

//--------------------------------------------------------------------------------------------------
Expand All @@ -174,7 +172,7 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even
// ----------------------------------------------------------------------
// -- Pixel cluster analysis
// ----------------------------------------------------------------------
//

edm::Handle<edmNew::DetSetVector<SiPixelCluster> > hClusterColl;
iEvent.getByToken(fSiPixelClusterToken_, hClusterColl);
//const edmNew::DetSetVector<SiPixelCluster> *clustColl(0);
Expand Down Expand Up @@ -202,7 +200,7 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even
const vector<SiPixelCluster::Pixel>& pixvector = clu.pixels();
for (unsigned int i = 0; i < pixvector.size(); ++i) {

int mr0 = pixvector[i].x; // constant column direction is along x-axis,
int mr0 = pixvector[i].x; // constant column direction is along x-axis,
int mc0 = pixvector[i].y; // constant row direction is along y-axis

if(monitorOnDoubleColumn_) onlineRocColRow(detId, mr0, mc0, roc, rocR, rocC);
Expand All @@ -220,7 +218,8 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even
// just use the "center" of the ROC as a dummy local row/column
rocR = rowsperroc/2-1;
rocC = colsperroc/2-1;
}

}

fDet.fillDIGI(detid, roc, rocC/2);

Expand All @@ -247,7 +246,7 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even
for (const auto& disabledChannels: *pixelFEDChannelCollectionHandle) {
//loop over different PixelFED in a PixelFED vector (module)
for(const auto& ch: disabledChannels) {

DetId detId = disabledChannels.detId();
int detid = detId.rawId();
fDet.fillStuckTBM(detid,ch,ftmptime);
Expand All @@ -258,12 +257,16 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even

} // look over different resouces of takens

// no per-event collection put into iEvent
// If use produce() function and no collection is put into iEvent, produce() will not run in unScheduled mode
// Now since CMSSW_10_1_X, the accumulate() function will run whatsoever in the unScheduled mode
// But accumulate() is NOT available and will NOT be available for releases before CMSSW_10_1_X

}


//--------------------------------------------------------------------------------------------------
void SiPixelStatusProducer::endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup){

}

//--------------------------------------------------------------------------------------------------
Expand All @@ -275,9 +278,9 @@ void SiPixelStatusProducer::endLuminosityBlockProduce(edm::LuminosityBlock& lumi
const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
const std::time_t fendtime = fendtimestamp >> 32;
refTime_[1] = fendtime;

endLumi_ = lumiSeg.luminosityBlock();
endRun_ = lumiSeg.run();
endRun_ = lumiSeg.run();

// check if countLumi_ is large enough to read out/save data and reset for the next round
if ( resetNLumi_ == -1 ) return;
Expand Down Expand Up @@ -327,29 +330,29 @@ void SiPixelStatusProducer::onlineRocColRow(const DetId &detId, int offlineRow,
sipixelobjects::LocalPixel locpixel(loc);
col = locpixel.rocCol();
row = locpixel.rocRow();

//sipixelobjects::CablingPathToDetUnit path = {(unsigned int) fedId, (unsigned int)cabling.link, (unsigned int)cabling.roc};
//const sipixelobjects::PixelROC *theRoc = fCablingMap->findItem(path);
const sipixelobjects::PixelROC *theRoc = converter.toRoc(cabling.link, cabling.roc);
roc = theRoc->idInDetUnit();

// has to be BPIX; has to be minus side; has to be half module
// for phase-I, there is no half module
if (detId.subdetId() == PixelSubdetector::PixelBarrel && coord_.side(detId)==1 && coord_.half(detId))
if (detId.subdetId() == PixelSubdetector::PixelBarrel && coord_.side(detId)==1 && coord_.half(detId))
{
roc += 8;
}

}


//--------------------------------------------------------------------------------------------------
int SiPixelStatusProducer::indexROC(int irow, int icol, int nROCcolumns){

return int(icol+irow*nROCcolumns);

// generate the folling roc index that is going to map with ROC id
// generate the folling roc index that is going to map with ROC id as
// 8 9 10 11 12 13 14 15
// 0 1 2 3 4 5 6 7
// 0 1 2 3 4 5 6 7

}

DEFINE_FWK_MODULE(SiPixelStatusProducer);
8 changes: 4 additions & 4 deletions CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.h
Expand Up @@ -4,7 +4,7 @@
/**_________________________________________________________________
class: SiPixelStatusProducer.h
package: CalibTracker/SiPixelQuality
________________________________________________________________**/


Expand All @@ -28,7 +28,7 @@ class SiPixelStatusProducer : public edm::one::EDProducer<edm::EndLuminosityBloc
void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) final;
void accumulate (edm::Event const&, const edm::EventSetup& iSetup) final;

virtual void onlineRocColRow(const DetId &detId, int offlineRow, int offlineCol, int &roc, int &row, int &col);
virtual void onlineRocColRow(const DetId &detId, int offlineRow, int offlineCol, int &roc, int &row, int &col) final;

virtual int indexROC(int irow, int icol, int nROCcolumns) final;

Expand All @@ -48,12 +48,12 @@ class SiPixelStatusProducer : public edm::one::EDProducer<edm::EndLuminosityBloc
// CablingMaps
edm::ESWatcher<SiPixelFedCablingMapRcd> siPixelFedCablingMapWatcher_;
edm::ESHandle<SiPixelFedCablingMap> fCablingMap;
const SiPixelFedCablingMap* fCablingMap_;
const SiPixelFedCablingMap* fCablingMap_;

// TrackerDIGIGeo
edm::ESWatcher<TrackerDigiGeometryRecord> trackerDIGIGeoWatcher_;
edm::ESHandle<TrackerGeometry> fTG;
// TrackerTopology
// TrackerTopology
edm::ESWatcher<TrackerTopologyRcd> trackerTopoWatcher_;

// SiPixel offline<->online conversion
Expand Down
5 changes: 0 additions & 5 deletions CalibTracker/SiPixelQuality/test/step4_ALCAHARVEST.py
Expand Up @@ -54,11 +54,6 @@
tag = cms.string('SiPixelQualityFromDbRcd_prompt'),
timetype = cms.untracked.string('lumiid')
),
cms.PSet(
record = cms.string('SiPixelQualityFromDbRcd_permanentBad'),
tag = cms.string('SiPixelQualityFromDbRcd_permanentBad'),
timetype = cms.untracked.string('runnumber')
),
cms.PSet(
record = cms.string('SiPixelQualityFromDbRcd_stuckTBM'),
tag = cms.string('SiPixelQualityFromDbRcd_stuckTBM'),
Expand Down

0 comments on commit 3722e7d

Please sign in to comment.