Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for BX number = 3564, descriptions of plugins, configuration updates and new histograms #9690

Merged
merged 8 commits into from
Jul 29, 2015
54 changes: 54 additions & 0 deletions DPGAnalysis/SiStripTools/bin/BSvsBPIX.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "DPGAnalysis/SiStripTools/bin/BSvsBPIX.h"
#include "TFile.h"
#include "TH1F.h"
#include "TProfile.h"
#include "TGraphErrors.h"
#include "TCanvas.h"
#include "TDirectory.h"
#include <iostream>

void BSvsBPIXPlot(TFile* ff, const char* bsmodule, const char* occumodule, const int run) {

TGraphErrors* bspos = new TGraphErrors();
TGraphErrors* bpixpos = new TGraphErrors();

if(ff) {

char bsfolder[200];
sprintf(bsfolder,"%s/run_%d",bsmodule,run);
if(ff->cd(bsfolder)) {
TH1F* bsx = (TH1F*)gDirectory->Get("bsxrun");
TH1F* bsy = (TH1F*)gDirectory->Get("bsyrun");
if(bsx && bsy) {
std::cout << "beam spot position ("
<< bsx->GetMean() << "+/-" << bsx->GetMeanError() << ","
<< bsy->GetMean() << "+/-" << bsy->GetMeanError() << ")" << std::endl;
bspos->SetPoint(0,bsx->GetMean(),bsy->GetMean());
bspos->SetPointError(0,bsx->GetMeanError(),bsy->GetMeanError());
}
}
char occufolder[200];
sprintf(occufolder,"%s/run_%d",occumodule,run);
if(ff->cd(occufolder)) {
TProfile* xmean = (TProfile*)gDirectory->Get("avex");
TProfile* ymean = (TProfile*)gDirectory->Get("avey");
if(xmean && ymean) {
for(int i=1;i<=xmean->GetNbinsX();++i) {
if(xmean->GetBinEntries(i) >0) {
std::cout << "ladder position " << i << " : ("
<< xmean->GetBinContent(i) << "+/-" << xmean->GetBinError(i) << ","
<< ymean->GetBinContent(i) << "+/-" << ymean->GetBinError(i) << ")" << std::endl;
int point = bpixpos->GetN();
bpixpos->SetPoint(point,xmean->GetBinContent(i),ymean->GetBinContent(i));
bpixpos->SetPointError(point,xmean->GetBinError(i),ymean->GetBinError(i));
}
}
}

}
}
new TCanvas("bsbpix","bsbpix",500,500);
bpixpos->Draw("ap");
bspos->Draw("p");

}
8 changes: 8 additions & 0 deletions DPGAnalysis/SiStripTools/bin/BSvsBPIX.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef DPGAnalysis_SiStripTools_BSvsBPIX_h
#define DPGAnalysis_SiStripTools_BSvsBPIX_h

class TFile;

void BSvsBPIXPlot(TFile* ff, const char* bsmodule, const char* occumodule, const int run);

#endif // DPGAnalysis_SiStripTools_BSvsBPIX_h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "TrackPlots.h"
#include "SeedMultiplicityPlots.h"
#include "OOTMultiplicityPlotMacros.h"
#include "BSvsBPIX.h"
#ifdef __CINT__
#pragma link off all functions;
#pragma link C++ function PlotOccupancyMap;
Expand Down Expand Up @@ -46,4 +47,5 @@
#pragma link C++ function ComputeOOTFractionvsFill;
#pragma link C++ class OOTResult;
#pragma link C++ class OOTSummary;
#pragma link C++ function BSvsBPIX;
#endif
8 changes: 4 additions & 4 deletions DPGAnalysis/SiStripTools/interface/DigiBXCorrHistogramMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ void DigiBXCorrHistogramMaker<T>::fill(const T& he, const std::map<int,int>& ndi
}
}

m_ndigivsbx[i]->Fill(he.bx(),digi->second);
if(m_ndigivsbx2D.find(i)!=m_ndigivsbx2D.end()) m_ndigivsbx2D[i]->Fill(he.bx(),digi->second);
if(m_ndigivsbx2Dzoom.find(i)!=m_ndigivsbx2Dzoom.end()) m_ndigivsbx2Dzoom[i]->Fill(he.bx(),digi->second);
if(m_ndigivsbx2Dzoom2.find(i)!=m_ndigivsbx2Dzoom2.end()) m_ndigivsbx2Dzoom2[i]->Fill(he.bx(),digi->second);
m_ndigivsbx[i]->Fill(he.bx()%3564,digi->second);
if(m_ndigivsbx2D.find(i)!=m_ndigivsbx2D.end()) m_ndigivsbx2D[i]->Fill(he.bx()%3564,digi->second);
if(m_ndigivsbx2Dzoom.find(i)!=m_ndigivsbx2Dzoom.end()) m_ndigivsbx2Dzoom[i]->Fill(he.bx()%3564,digi->second);
if(m_ndigivsbx2Dzoom2.find(i)!=m_ndigivsbx2Dzoom2.end()) m_ndigivsbx2Dzoom2[i]->Fill(he.bx()%3564,digi->second);


if(he.depth()>0) {
Expand Down
6 changes: 3 additions & 3 deletions DPGAnalysis/SiStripTools/plugins/EventTimeDistribution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ EventTimeDistribution::analyze(const edm::Event& iEvent, const edm::EventSetup&
(*(*dbxhist))->Fill(he->deltaBX(indices->first,indices->second));
}

(*_bx)->Fill(iEvent.bunchCrossing());
(*_bx)->Fill(iEvent.bunchCrossing()%3564);
(*_orbit)->Fill(iEvent.orbitNumber());
if(_dbxvsbx && *_dbxvsbx) (*_dbxvsbx)->Fill(iEvent.bunchCrossing(),he->deltaBX());
if(_dbxvsbx && *_dbxvsbx) (*_dbxvsbx)->Fill(iEvent.bunchCrossing()%3564,he->deltaBX());
if(m_ewhdepth && *m_ewhdepth) (*m_ewhdepth)->Fill(he->depth());

edm::Handle<APVCyclePhaseCollection> apvphase;
Expand All @@ -205,7 +205,7 @@ EventTimeDistribution::analyze(const edm::Event& iEvent, const edm::EventSetup&
tbx -= thephase;
(*_bxincycle)->Fill(tbx%70);
if(_dbxvsbxincycle && *_dbxvsbxincycle) (*_dbxvsbxincycle)->Fill(tbx%70,he->deltaBX());
if(_bxincyclevsbx && *_bxincyclevsbx) (*_bxincyclevsbx)->Fill(iEvent.bunchCrossing(),tbx%70);
if(_bxincyclevsbx && *_bxincyclevsbx) (*_bxincyclevsbx)->Fill(iEvent.bunchCrossing()%3564,tbx%70);
if(_orbitvsbxincycle && *_orbitvsbxincycle) (*_orbitvsbxincycle)->Fill(tbx%70,iEvent.orbitNumber());

}
Expand Down
72 changes: 63 additions & 9 deletions DPGAnalysis/SiStripTools/plugins/L1ABCDebugger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
#include <memory>

// user include files
#include "TH1F.h"
#include "TH2F.h"
#include "TProfile.h"
#include "DPGAnalysis/SiStripTools/interface/RunHistogramManager.h"

#include <vector>
#include <string>

Expand All @@ -49,14 +51,25 @@ class L1ABCDebugger : public edm::EDAnalyzer {
~L1ABCDebugger();


private:
virtual void beginJob() override ;
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
virtual void endJob() override ;
private:
virtual void beginJob() override ;
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
virtual void beginRun(const edm::Run&, const edm::EventSetup&) override;
virtual void endJob() override ;

// ----------member data ---------------------------

edm::EDGetTokenT<L1AcceptBunchCrossingCollection> _l1abccollectionToken;
edm::EDGetTokenT<L1AcceptBunchCrossingCollection> m_l1abccollectionToken;
const unsigned int m_maxLS;
const unsigned int m_LSfrac;

RunHistogramManager m_rhm;

TH2F** m_hoffsets;
TProfile** m_horboffvsorb;
TProfile** m_hbxoffvsorb;


};

//
Expand All @@ -71,10 +84,17 @@ class L1ABCDebugger : public edm::EDAnalyzer {
// constructors and destructor
//
L1ABCDebugger::L1ABCDebugger(const edm::ParameterSet& iConfig):
_l1abccollectionToken(consumes<L1AcceptBunchCrossingCollection>(iConfig.getParameter<edm::InputTag>("l1ABCCollection")))
m_l1abccollectionToken(consumes<L1AcceptBunchCrossingCollection>(iConfig.getParameter<edm::InputTag>("l1ABCCollection"))),
m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",250)),
m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",16)),
m_rhm(consumesCollector())
{
//now do what ever initialization is needed

m_hoffsets = m_rhm.makeTH2F("offsets","Orbit vs BX offsets between SCAL and Event",2*3564+1,-3564.5,3564.5,201,-100.5,100.5);
m_horboffvsorb = m_rhm.makeTProfile("orboffvsorb","SCAL Orbit offset vs orbit number",m_LSfrac*m_maxLS,0,m_maxLS*262144);
m_hbxoffvsorb = m_rhm.makeTProfile("bxoffvsorb","SCAL BX offset vs orbit number",m_LSfrac*m_maxLS,0,m_maxLS*262144);

}


Expand All @@ -98,18 +118,52 @@ L1ABCDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
using namespace edm;

Handle<L1AcceptBunchCrossingCollection > pIn;
iEvent.getByToken(_l1abccollectionToken,pIn);
iEvent.getByToken(m_l1abccollectionToken,pIn);

// offset computation
for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
if(l1abc->l1AcceptOffset()==0) {
if(m_hoffsets && *m_hoffsets)
(*m_hoffsets)->Fill((int)l1abc->bunchCrossing()-(int)iEvent.bunchCrossing(),
(long long)l1abc->orbitNumber()-(long long)iEvent.orbitNumber());
if(m_horboffvsorb && *m_horboffvsorb)
(*m_horboffvsorb)->Fill(iEvent.orbitNumber(),(long long)l1abc->orbitNumber()-(long long)iEvent.orbitNumber());
if(m_hbxoffvsorb && *m_hbxoffvsorb)
(*m_hbxoffvsorb)->Fill(iEvent.orbitNumber(),(int)l1abc->bunchCrossing()-(int)iEvent.bunchCrossing());
}
}


edm::LogInfo("L1ABCDebug") << "Dump of L1AcceptBunchCrossing Collection";
// dump of L1ABC collection

edm::LogInfo("L1ABCDebug") << "Dump of L1AcceptBunchCrossing Collection for event in orbit "
<< iEvent.orbitNumber() << " and BX " << iEvent.bunchCrossing();

for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
edm::LogVerbatim("L1ABCDebug") << *l1abc;
}

}

void
L1ABCDebugger::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {

m_rhm.beginRun(iRun);

if(m_hoffsets && *m_hoffsets) {
(*m_hoffsets)->GetXaxis()->SetTitle("#Delta BX (SCAL-Event)"); (*m_hoffsets)->GetYaxis()->SetTitle("#Delta orbit (SCAL-Event)");
}
if(m_horboffvsorb && *m_horboffvsorb) {
(*m_horboffvsorb)->GetXaxis()->SetTitle("Orbit"); (*m_horboffvsorb)->GetYaxis()->SetTitle("#Delta orbit (SCAL-Event)");
(*m_horboffvsorb)->SetCanExtend(TH1::kXaxis);
}
if(m_hbxoffvsorb && *m_hbxoffvsorb) {
(*m_hbxoffvsorb)->GetXaxis()->SetTitle("Orbit"); (*m_hbxoffvsorb)->GetYaxis()->SetTitle("#Delta BX (SCAL-Event)");
(*m_hbxoffvsorb)->SetCanExtend(TH1::kXaxis);
}


}
// ------------ method called once each job just before starting event loop ------------
void
L1ABCDebugger::beginJob()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
cms.PSet(
ParameterName = cms.string("defaultPhases"),
ParameterType = cms.string("vint32"),
ParameterValue = cms.vint32(63,63,63,63),
ParameterValue = cms.vint32(66,66,66,66),
),
cms.PSet(
ParameterName = cms.string("useEC0"),
Expand All @@ -26,7 +26,7 @@
cms.PSet(
ParameterName = cms.string("magicOffset"),
ParameterType = cms.string("int"),
ParameterValue = cms.int32(8),
ParameterValue = cms.int32(9),
),
)

Expand Down
Loading