Skip to content

Commit

Permalink
Merge pull request #13758 from gouskos/roc-barrel-80x
Browse files Browse the repository at this point in the history
barrel vs ladder in roc level in 80x
  • Loading branch information
cmsbuild committed May 31, 2016
2 parents a14cc8b + ccf9e63 commit c48d2d0
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
Expand Up @@ -44,6 +44,7 @@

#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"

#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"

class SiPixelTrackResidualSource : public DQMEDAnalyzer {
public:
Expand All @@ -53,6 +54,7 @@ class SiPixelTrackResidualSource : public DQMEDAnalyzer {
virtual void dqmBeginRun(const edm::Run& r, edm::EventSetup const& iSetup);
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
virtual void analyze(const edm::Event&, const edm::EventSetup&);
void getrococcupancy(DetId detId,const edm::DetSetVector<PixelDigi> diginp,const TrackerTopology* const tTopo,std::vector<MonitorElement*> meinput);
void triplets(double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3,
double ptsig, double & dc,double & dz, double kap);

Expand All @@ -72,6 +74,8 @@ class SiPixelTrackResidualSource : public DQMEDAnalyzer {
edm::EDGetTokenT<TrajTrackAssociationCollection> trackAssociationToken_;
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > clustersrcToken_;
std::string vtxsrc_;
edm::InputTag digisrc_;
edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > digisrcToken_;

bool debug_;
bool modOn;
Expand Down Expand Up @@ -169,6 +173,9 @@ class SiPixelTrackResidualSource : public DQMEDAnalyzer {
std::vector<MonitorElement*> meClPosDisksmzOnTrack;
std::vector<MonitorElement*> meClPosDiskspzNotOnTrack;
std::vector<MonitorElement*> meClPosDisksmzNotOnTrack;

std::vector<MonitorElement*> meZeroRocLadvsModOnTrackBarrel;
std::vector<MonitorElement*> meZeroRocLadvsModOffTrackBarrel;

MonitorElement* meHitProbability;

Expand Down
Expand Up @@ -23,6 +23,7 @@
bladeOn = cms.untracked.bool(True),
diskOn = cms.untracked.bool(True),
PtMinRes = cms.untracked.double(4.0),
digisrc = cms.InputTag("siPixelDigis"),

# (SK) keep rstracks commented out in case of resurrection
# trajectoryInput = cms.InputTag('rsWithMaterialTracksP5')
Expand Down
3 changes: 2 additions & 1 deletion DQM/SiPixelMonitorTrack/python/SiPixelMonitorTrack_cfi.py
Expand Up @@ -28,7 +28,8 @@
PtMinRes = cms.untracked.double(4.0),
vtxsrc= cms.untracked.string("offlinePrimaryVertices"),

trajectoryInput = cms.InputTag('generalTracks')
trajectoryInput = cms.InputTag('generalTracks'),
digisrc = cms.InputTag("siPixelDigis")
)

# Modify for if the phase 1 pixel detector is active
Expand Down
89 changes: 89 additions & 0 deletions DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualSource.cc
Expand Up @@ -91,6 +91,8 @@ SiPixelTrackResidualSource::SiPixelTrackResidualSource(const edm::ParameterSet&
trackToken_ = consumes<std::vector<reco::Track> >(pSet_.getParameter<edm::InputTag>("trajectoryInput"));
trackAssociationToken_ = consumes<TrajTrackAssociationCollection>(pSet_.getParameter<edm::InputTag>("trajectoryInput"));
clustersrcToken_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(pSet_.getParameter<edm::InputTag>("clustersrc"));
digisrc_ = pSet_.getParameter<edm::InputTag>("digisrc");
digisrcToken_ = consumes<edm::DetSetVector<PixelDigi> >(pSet_.getParameter<edm::InputTag>("digisrc"));

LogInfo("PixelDQM") << "SiPixelTrackResidualSource constructor" << endl;
LogInfo ("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/"
Expand Down Expand Up @@ -401,6 +403,19 @@ void SiPixelTrackResidualSource::bookHistograms(DQMStore::IBooker & iBooker, edm
meClSizeNotOnTrack_layers.push_back(iBooker.book1D(ss1.str(),ss2.str(),500,0.,500.));
meClSizeNotOnTrack_layers.at(i-1)->setAxisTitle("Cluster size (in pixels)",1);
}

for (int i = 1; i <= noOfLayers; i++) {
int ybins = -1; float ymin = 0.; float ymax = 0.;
if (i==1) { ybins = 42; ymin = -10.5; ymax = 10.5; }
if (i==2) { ybins = 66; ymin = -16.5; ymax = 16.5; }
if (i==3) { ybins = 90; ymin = -22.5; ymax = 22.5; }
ss1.str(std::string()); ss1 << "pix_bar Occ_roc_offtrack" + digisrc_. label() + "_layer_" << i;
ss2.str(std::string()); ss2 << "Pixel Barrel Occupancy, ROC level (Off Track): Layer " << i;
meZeroRocLadvsModOffTrackBarrel.push_back(iBooker.book2D(ss1.str(),ss2.str(),72,-4.5,4.5,ybins,ymin,ymax));
meZeroRocLadvsModOffTrackBarrel.at(i-1)->setAxisTitle("ROC / Module",1);
meZeroRocLadvsModOffTrackBarrel.at(i-1)->setAxisTitle("ROC / Ladder",2);
}

for (int i = 1; i <= noOfDisks; i++)
{
ss1.str(std::string()); ss1 << "size_" + clustersrc_.label() + "_Disk_p" << i;
Expand Down Expand Up @@ -491,8 +506,20 @@ void SiPixelTrackResidualSource::bookHistograms(DQMStore::IBooker & iBooker, edm
meClPosLayersLadVsModOnTrack.push_back(iBooker.book2D(ss1.str(),ss2.str(),11,-5.5,5.5,ybins,ymin,ymax));
meClPosLayersLadVsModOnTrack.at(i-1)->setAxisTitle("z-module",1);
meClPosLayersLadVsModOnTrack.at(i-1)->setAxisTitle("Ladder",2);
}

for (int i = 1; i <= noOfLayers; i++) {
int ybins = -1; float ymin = 0.; float ymax = 0.;
if (i==1) { ybins = 42; ymin = -10.5; ymax = 10.5; }
if (i==2) { ybins = 66; ymin = -16.5; ymax = 16.5; }
if (i==3) { ybins = 90; ymin = -22.5; ymax = 22.5; }
ss1.str(std::string()); ss1 << "pix_bar Occ_roc_ontrack" + digisrc_. label() + "_layer_" << i;
ss2.str(std::string()); ss2 << "Pixel Barrel Occupancy, ROC level (On Track): Layer " << i;
meZeroRocLadvsModOnTrackBarrel.push_back(iBooker.book2D(ss1.str(),ss2.str(),72,-4.5,4.5,ybins,ymin,ymax));
meZeroRocLadvsModOnTrackBarrel.at(i-1)->setAxisTitle("ROC / Module",1);
meZeroRocLadvsModOnTrackBarrel.at(i-1)->setAxisTitle("ROC / Ladder",2);
}

//fpix
for (int i = 1; i <= noOfDisks; i++)
{
Expand Down Expand Up @@ -894,6 +921,11 @@ void SiPixelTrackResidualSource::analyze(const edm::Event& iEvent, const edm::Ev
//iEvent.getByLabel( clustersrc_, clusterColl );
iEvent.getByToken( clustersrcToken_, clusterColl );
auto const & clustColl = *(clusterColl.product());

// get digis
edm::Handle< edm::DetSetVector<PixelDigi> > digiinput;
iEvent.getByToken( digisrcToken_, digiinput );
const edm::DetSetVector<PixelDigi> diginp = *(digiinput.product());


if(debug_){
Expand Down Expand Up @@ -1040,6 +1072,10 @@ void SiPixelTrackResidualSource::analyze(const edm::Event& iEvent, const edm::Ev
bool endcap = DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
if(barrel) {
barreltrackclusters++;

DetId detId = (*hit).geographicalId();
if(detId>=302055684 && detId<=352477708) { getrococcupancy(detId,diginp,tTopo,meZeroRocLadvsModOnTrackBarrel); }

//CORR CHARGE
meClChargeOnTrack_bpix->Fill(corrCharge);
meClSizeOnTrack_bpix->Fill((*clust).size());
Expand Down Expand Up @@ -1152,6 +1188,9 @@ void SiPixelTrackResidualSource::analyze(const edm::Event& iEvent, const edm::Ev
nofclOffTrack++;
//fill histograms for clusters off tracks
//correct SiPixelTrackResidualModule
bool barrel = DetId(detId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
if (barrel) { getrococcupancy(detId,diginp,tTopo,meZeroRocLadvsModOffTrackBarrel); }

std::map<uint32_t, SiPixelTrackResidualModule*>::iterator pxd = theSiPixelStructure.find((*it)->geographicalId().rawId());

if (pxd!=theSiPixelStructure.end()) (*pxd).second->fill((*di), false, -1., reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
Expand Down Expand Up @@ -1328,6 +1367,56 @@ void SiPixelTrackResidualSource::analyze(const edm::Event& iEvent, const edm::Ev
if(bpixtracks>0)(meNofTracks_)->Fill(2,bpixtracks);
if(fpixtracks>0)(meNofTracks_)->Fill(3,fpixtracks);
}

void SiPixelTrackResidualSource::getrococcupancy(DetId detId,const edm::DetSetVector<PixelDigi> diginp,const TrackerTopology* const tTopo,std::vector<MonitorElement*> meinput) {

edm::DetSetVector<PixelDigi>::const_iterator ipxsearch = diginp.find(detId);
if( ipxsearch != diginp.end() ) {

// Look at digis now
edm::DetSet<PixelDigi>::const_iterator pxdi;
for (pxdi = ipxsearch->begin(); pxdi != ipxsearch->end(); pxdi++) {

bool isHalfModule = PixelBarrelName(DetId(detId),tTopo,isUpgrade).isHalfModule();
int DBlayer = PixelBarrelName(DetId(detId),tTopo,isUpgrade).layerName();
int DBmodule = PixelBarrelName(DetId(detId),tTopo,isUpgrade).moduleName();
int DBladder = PixelBarrelName(DetId(detId),tTopo,isUpgrade).ladderName();
int DBshell = PixelBarrelName(DetId(detId),tTopo,isUpgrade).shell();

// add sign to the modules
if (DBshell==1 || DBshell==2) { DBmodule = -DBmodule; }
if (DBshell==1 || DBshell==3) { DBladder = -DBladder; }

int col = pxdi->column();
int row = pxdi->row();

float modsign = (float)DBmodule/(abs((float)DBmodule));
float ladsign = (float)DBladder/(abs((float)DBladder));
float rocx = ((float)col/(52.*8.))*modsign + ((float)DBmodule-(modsign)*0.5);
float rocy = ((float)row/(80.*2.))*ladsign + ((float)DBladder-(ladsign)*0.5);

// do the flip where need
bool flip = false;
if ( (DBladder%2==0) && (!isHalfModule) ) { flip = true; }
if ((flip) && (DBladder>0)) {
if ( ( ((float)DBladder-(ladsign)*0.5)<=rocy) && (rocy<(float)DBladder)) { rocy = rocy + ladsign*0.5; }
else if ( ( ((float)DBladder)<=rocy) && (rocy<((float)DBladder+(ladsign)*0.5)) ) { rocy = rocy - ladsign*0.5; }
}

// tweak border effect for negative modules/ladders
if (modsign<0) { rocx = rocx -0.0001; }
if (ladsign<0) { rocy = rocy -0.0001; } else { rocy = rocy +0.0001; }
if (abs(DBladder)==1) { rocy = rocy + ladsign*0.5; } //take care of the half module

if (DBlayer==1) { meinput.at(0)->Fill(rocx,rocy); }
if (DBlayer==2) { meinput.at(1)->Fill(rocx,rocy); }
if (DBlayer==3) { meinput.at(2)->Fill(rocx,rocy); }
} // end of looping over pxdi
}
}



void SiPixelTrackResidualSource::triplets(double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3,
double ptsig, double & dca2,double & dz2, double kap) {

Expand Down

0 comments on commit c48d2d0

Please sign in to comment.