23 #include "TProfile2D.h" 42 : EBRecHitCollection_(iConfig.getParameter<
edm::
InputTag>(
"EcalRecHitCollectionEB")),
43 EERecHitCollection_(iConfig.getParameter<
edm::
InputTag>(
"EcalRecHitCollectionEE")),
44 EBDigis_(iConfig.getParameter<
edm::
InputTag>(
"EBDigiCollection")),
45 EEDigis_(iConfig.getParameter<
edm::
InputTag>(
"EEDigiCollection")),
46 headerProducer_(iConfig.getParameter<
edm::
InputTag>(
"headerProducer")),
55 side_(iConfig.getUntrackedParameter<
int>(
"side", 3)),
56 threshold_(iConfig.getUntrackedParameter<double>(
"amplitudeThreshold", 0.5)),
57 minTimingAmp_(iConfig.getUntrackedParameter<double>(
"minimumTimingAmplitude", 0.100)),
58 makeDigiGraphs_(iConfig.getUntrackedParameter<
bool>(
"makeDigiGraphs",
false)),
59 makeTimingHistos_(iConfig.getUntrackedParameter<
bool>(
"makeTimingHistos",
true)),
60 makeEnergyHistos_(iConfig.getUntrackedParameter<
bool>(
"makeEnergyHistos",
true)),
61 makeOccupancyHistos_(iConfig.getUntrackedParameter<
bool>(
"makeOccupancyHistos",
true)),
62 histRangeMin_(iConfig.getUntrackedParameter<double>(
"histogramMinRange", 0.0)),
63 histRangeMax_(iConfig.getUntrackedParameter<double>(
"histogramMaxRange", 1.8)),
64 minTimingEnergyEB_(iConfig.getUntrackedParameter<double>(
"minTimingEnergyEB", 0.0)),
65 minTimingEnergyEE_(iConfig.getUntrackedParameter<double>(
"minTimingEnergyEE", 0.0)) {
66 vector<int> listDefaults;
67 listDefaults.push_back(-1);
73 vector<string> defaultMaskedEBs;
74 defaultMaskedEBs.push_back(
"none");
79 string title1 =
"Jitter for all FEDs all events";
80 string name1 =
"JitterAllFEDsAllEvents";
88 for (vector<string>::const_iterator ebItr =
maskedEBs_.begin(); ebItr !=
maskedEBs_.end(); ++ebItr) {
94 for (
int i = 0;
i < 10;
i++)
127 int ievt =
iEvent.id().event();
133 names =
new std::vector<string>();
158 bool hasEBdigis =
false;
159 bool hasEEdigis =
false;
183 if (hasEBdigis || hasEEdigis)
194 int FEDid = 600 + elecId.
dccId();
196 if (FEDid < 610 || FEDid > 645)
201 float ampli =
hit.energy();
203 vector<int>::iterator
result;
214 bool cryIsInList =
false;
225 string title =
"Digis";
230 ++(pair.first->second);
234 TCanvas
can(
name.c_str(),
title.c_str(), 200, 50, 900, 900);
257 for (
int i = 0;
i < 10;
i++)
260 emptyGraph->SetTitle(
"NOT ECAL");
266 emptyGraph->SetTitle(
"NO DIGIS");
269 int FEDid = 600 + elecId.
dccId();
271 if (FEDid < 610 || FEDid > 645)
315 emptyGraph->SetTitle(
"FIRST TWO SAMPLES NOT GAIN12");
316 if (
df.sample(0).gainId() != 1 ||
df.sample(1).gainId() != 1)
324 for (
int i = 0;
i <
df.size(); ++
i) {
325 if (
df.sample(
i).gainId() != 0)
335 sliceName +
"_gain" + gainString;
338 map<int, float>::const_iterator itr;
349 oneGraph->SetTitle(
title.c_str());
350 oneGraph->SetName(
name.c_str());
351 oneGraph->GetXaxis()->SetTitle(
"sample");
352 oneGraph->GetYaxis()->SetTitle(
"ADC");
357 int FEDid = 600 + elecId.
dccId();
364 EBDetId digiId = digiItr->id();
379 DetId det = digiItr->id();
381 size_t FEDid = 600 + elecId.
dccId();
385 EEDetId digiId = digiItr->id();
411 int FEDid = 600 + elecId.
dccId();
414 if (FEDid < 610 || FEDid > 645) {
514 if (timingHist ==
nullptr) {
519 timingHist->Fill(
hit.time());
547 string frequencies =
"";
550 if (itr->second > 1) {
551 frequencies += itr->first;
552 frequencies +=
" Frequency: ";
557 LogWarning(
"EcalDisplaysByEvent") <<
"Found seeds with frequency > 1: " 574 LogWarning(
"EcalDisplaysByEvent") <<
"Masked FEDs are: " <<
feds <<
" and that is all!";
579 ostringstream myStream;
580 myStream <<
num << flush;
581 return (myStream.str());
586 ostringstream myStream;
587 myStream <<
num << flush;
588 return (myStream.str());
595 string title1 =
"Jitter for ";
597 string name1 =
"JitterFED";
599 TH1F* timingHist =
fileService->
make<TH1F>(name1.c_str(), title1.c_str(), 150, -7, 7);
606 string canvasTitle =
"Timing_Event" + lastPart;
607 timingEB_ =
new TH1F(
"timeForAllFedsEB",
"timeForAllFeds;Relative Time (1 clock = 25ns)", 78, -7, 7);
608 timingEEM_ =
new TH1F(
"timeForAllFedsEEM",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
609 timingEEP_ =
new TH1F(
"timeForAllFedsEEP",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
610 timingCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
624 string canvasTitle =
"Energy_Event" + lastPart;
625 energyCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
700 string canvasTitle =
"Timing_AllEvents";
701 timingEBAll_ =
new TH1F(
"timeForAllFedsEBAll",
"timeForAllFeds;Relative Time (1 clock = 25ns)", 78, -7, 7);
702 timingEEMAll_ =
new TH1F(
"timeForAllFedsEEMAll",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
703 timingEEPAll_ =
new TH1F(
"timeForAllFedsEEPAll",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
704 timingCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
716 canvasTitle =
"Energy_AllEvents";
717 energyCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
756 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0,
757 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86};
758 double modEtaBins[10] = {-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
759 double ttPhiBins[73];
760 double modPhiBins[19];
761 double timingBins[79];
762 for (
int i = 0;
i < 79; ++
i) {
763 timingBins[
i] = 6 - 7. + double(
i) * 14. / 78.;
765 ttPhiBins[
i] = 1 + 5 *
i;
767 modPhiBins[
i] = 1 + 20 *
i;
773 histName = histName +
"EB";
776 histName = histName +
"Coarse";
778 hist =
new TH3F(histName.c_str(),
histTitle.c_str(), 18, modPhiBins, 9, modEtaBins, 78, timingBins);
781 hist =
new TH3F(histName.c_str(),
histTitle.c_str(), 360 / 5, ttPhiBins, 35, ttEtaBins, 78, timingBins);
786 for (
int i = 0;
i != 21; ++
i) {
787 ttXBins[
i] = 1 + 5 *
i;
788 ttYBins[
i] = 1 + 5 *
i;
791 histName = histName +
"EEM";
794 histName = histName +
"EEP";
798 histName = histName +
"Coarse";
800 hist =
new TH3F(histName.c_str(),
histTitle.c_str(), 20, ttXBins, 20, ttYBins, 78, timingBins);
803 hist =
new TH3F(histName.c_str(),
histTitle.c_str(), 20, ttXBins, 20, ttYBins, 78, timingBins);
817 histName = histName +
"EB";
820 histName = histName +
"Coarse";
822 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0,
823 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86};
824 hist =
new TH2F(histName.c_str(),
histTitle.c_str(), 360 / 5, 1, 361., 35, ttEtaBins);
827 hist =
new TH2F(histName.c_str(),
histTitle.c_str(), 360, 1, 361., 172, -86, 86);
831 histName = histName +
"EEM";
834 histName = histName +
"EEP";
838 histName = histName +
"Coarse";
840 hist =
new TH2F(histName.c_str(),
histTitle.c_str(), 20, 1, 101, 20, 1, 101);
843 hist =
new TH2F(histName.c_str(),
histTitle.c_str(), 100, 1, 101, 100, 1, 101);
850 TCanvas*
canvas =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
881 canvas->cd(1)->Divide(2, 1);
889 canvas->SetCanvasSize(500, 500);
890 canvas->SetFixedAspectRatio(
true);
896 canvas->cd(1)->Divide(2, 1);
904 hist2->GetXaxis()->SetNdivisions(-18);
905 hist2->GetYaxis()->SetNdivisions(2);
906 canvas->GetPad(2)->SetGridx(1);
907 canvas->GetPad(2)->SetGridy(1);
913 canvas->SetCanvasSize(500, 500);
914 canvas->SetFixedAspectRatio(
true);
921 TProfile2D* profile2 = (TProfile2D*)hist2->Project3DProfile(
"yx");
922 profile2->Draw(
"colz");
926 canvas->cd(1)->Divide(2, 1);
929 TProfile2D* profile1 = (TProfile2D*)hist1->Project3DProfile(
"yx");
930 profile1->Draw(
"colz");
934 TProfile2D* profile2 = (TProfile2D*)hist2->Project3DProfile(
"yx");
935 profile2->Draw(
"colz");
936 profile2->GetXaxis()->SetNdivisions(-18);
937 profile2->GetYaxis()->SetNdivisions(2);
938 canvas->GetPad(2)->SetGridx(1);
939 canvas->GetPad(2)->SetGridy(1);
942 TProfile2D* profile3 = (TProfile2D*)hist3->Project3DProfile(
"yx");
943 profile3->Draw(
"colz");
947 canvas->SetCanvasSize(500, 500);
948 canvas->SetFixedAspectRatio(
true);
953 int nxb =
profile->GetNbinsX();
954 int nyb =
profile->GetNbinsY();
956 for (
int i = 0;
i != nxb; ++
i) {
957 for (
int j = 0;
j != nyb; ++
j) {
961 double xcorr =
profile->GetBinCenter(xb);
962 double ycorr =
profile->GetBinCenter(yb);
963 sprintf(tempErr,
"%0.2f",
profile->GetBinError(xb, yb));
966 if (nBinEntries != 0) {
967 TLatex*
tex =
new TLatex(xcorr, ycorr, tempErr);
968 tex->SetTextAlign(23);
969 tex->SetTextSize(42);
970 tex->SetTextSize(0.025);
971 tex->SetLineWidth(2);
975 sprintf(tempErr,
"%i", nBinEntries);
976 if (nBinEntries != 0) {
977 TLatex*
tex =
new TLatex(xcorr, ycorr, tempErr);
978 tex->SetTextAlign(21);
979 tex->SetTextFont(42);
980 tex->SetTextSize(0.025);
981 tex->SetLineWidth(2);
990 int ixSectorsEE[202] = {
991 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 55, 55, 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40,
992 41, 41, 42, 42, 43, 43, 45, 45, 55, 55, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 0, 100, 100, 97, 97, 95,
993 95, 92, 92, 87, 87, 85, 85, 80, 80, 75, 75, 65, 65, 60, 60, 40, 40, 35, 35, 25, 25, 20, 20, 15, 15, 13,
994 13, 8, 8, 5, 5, 3, 3, 0, 0, 3, 3, 5, 5, 8, 8, 13, 13, 15, 15, 20, 20, 25, 25, 35, 35, 40,
995 40, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97, 100, 100, 0, 61, 65, 65, 70,
996 70, 80, 80, 90, 90, 92, 0, 61, 65, 65, 90, 90, 97, 0, 57, 60, 60, 65, 65, 70, 70, 75, 75, 80, 80, 0,
997 50, 50, 0, 43, 40, 40, 35, 35, 30, 30, 25, 25, 20, 20, 0, 39, 35, 35, 10, 10, 3, 0, 39, 35, 35, 30,
998 30, 20, 20, 10, 10, 8, 0, 45, 45, 40, 40, 35, 35, 0, 55, 55, 60, 60, 65, 65};
1000 int iySectorsEE[202] = {50, 55, 55, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 55, 55,
1001 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 50,
1002 0, 50, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97, 100, 100, 97,
1003 97, 95, 95, 92, 92, 87, 87, 85, 85, 80, 80, 75, 75, 65, 65, 60, 60, 40, 40, 35, 35, 25, 25,
1004 20, 20, 15, 15, 13, 13, 8, 8, 5, 5, 3, 3, 0, 0, 3, 3, 5, 5, 8, 8, 13, 13, 15,
1005 15, 20, 20, 25, 25, 35, 35, 40, 40, 50, 0, 45, 45, 40, 40, 35, 35, 30, 30, 25, 25, 0, 50,
1006 50, 55, 55, 60, 60, 0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 61, 100, 0, 60, 60,
1007 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 50, 50, 55, 55, 60, 60, 0, 45, 45, 40, 40, 35, 35,
1008 30, 30, 25, 25, 0, 39, 30, 30, 15, 15, 5, 0, 39, 30, 30, 15, 15, 5};
1010 for (
int i = 0;
i < 202;
i++) {
1011 ixSectorsEE[
i] += 1;
1012 iySectorsEE[
i] += 1;
1018 for (
int i = 0;
i < 201;
i =
i + 1) {
1019 if ((ixSectorsEE[
i] != 1 || iySectorsEE[
i] != 1) && (ixSectorsEE[
i + 1] != 1 || iySectorsEE[
i + 1] != 1)) {
1020 l.DrawLine(ixSectorsEE[
i], iySectorsEE[
i], ixSectorsEE[
i + 1], iySectorsEE[
i + 1]);
TH2F * recHitOccupancyEBcoarseAll_
std::vector< std::string > maskedEBs_
TH2F * energyMapEBcoarse_
std::set< EBDetId > listEBChannels
TCanvas * timingMapCoarseCanvas_
edm::Handle< EEDigiCollection > EEdigisHandle
void endRun(edm::Run const &, edm::EventSetup const &) override
void home() const
move the navigator back to the starting point
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
TCanvas * energyMapCoarseCanvas_
TH2F * recHitOccupancyEEPcoarseAll_
TH2F * init2DEcalHist(std::string histTypeName, int subDet)
TH2F * recHitOccupancyEEMcoarseAll_
std::vector< int > maskedChannels_
TCanvas * energyMapCanvasAll_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int iphi() const
get the crystal iphi
TH2F * recHitOccupancyEEP_
std::vector< std::string > * names
const EcalElectronicsMapping * ecalElectronicsMap_
int getEEIndex(EcalElectronicsId elecId)
const double minTimingAmp_
int getFedFromSlice(std::string)
T const * product() const
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
std::vector< T >::const_iterator const_iterator
const bool makeEnergyHistos_
const double minTimingEnergyEB_
void analyze(edm::Event const &, edm::EventSetup const &) override
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
void drawTimingErrors(TProfile2D *profile)
TH3F * timingMapEEMCoarseAll_
TH2F * recHitOccupancyEEPcoarse_
TCanvas * digiOccupancyCoarseCanvasAll_
TH2F * recHitOccupancyEEMcoarse_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
TCanvas * timingMapCanvas_
TH2F * digiOccupancyEEMcoarse_
constexpr Detector det() const
get the detector field from this detid
TCanvas * recHitOccupancyCanvas_
std::set< EEDetId > listEEChannels
void drawCanvas(TCanvas *canvas, TH1F *hist1, TH1F *hist2, TH1F *hist3)
std::string getSliceFromFed(int)
int ieta() const
get the crystal ieta
std::vector< std::string > * histoCanvasNamesVector
TCanvas * timingMapCanvasAll_
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHitToken_
TCanvas * digiOccupancyCanvasAll_
TH2F * energyMapEEPcoarseAll_
TH2F * recHitOccupancyEEM_
TH2F * digiOccupancyEEMAll_
std::vector< int > maskedFEDs_
TCanvas * energyMapCanvas_
const edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
TH2F * recHitOccupancyEEMAll_
int towerId() const
get the tower id
TCanvas * digiOccupancyCanvas_
const bool makeDigiGraphs_
void selectHits(edm::Handle< EcalRecHitCollection > hits, int ievt)
TH3F * timingMapEBCoarseAll_
TCanvas * recHitOccupancyCoarseCanvasAll_
TH2F * energyMapEEMcoarseAll_
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
TH2F * recHitOccupancyEBcoarse_
std::map< int, TH1F * > FEDsAndTimingHists_
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHitToken_
bool getData(T &iHolder) const
const_iterator begin() const
static edm::Service< TFileService > fileService
const bool makeOccupancyHistos_
TH3F * timingMapEEMCoarse_
TCanvas * energyCanvasAll_
const CaloTopology * caloTopo_
const double histRangeMax_
const bool makeTimingHistos_
const_iterator end() const
const_iterator end() const
std::string intToString(int num)
static float gainRatio[3]
TH3F * timingMapEEPCoarse_
TH2F * recHitOccupancyEEPAll_
void makeHistos(edm::Handle< EBDigiCollection > ebDigis)
TH2F * digiOccupancyEBcoarseAll_
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
edm::Handle< EBDigiCollection > EBdigisHandle
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
TCanvas * recHitOccupancyCanvasAll_
const_iterator begin() const
The iterator returned can not safely be used across threads.
const double minTimingEnergyEE_
T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
int stripId() const
get the tower id
TH2F * recHitOccupancyEBAll_
TCanvas * timingCanvasAll_
TTree * histoCanvasNames_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
~EcalDisplaysByEvent() override
std::map< std::string, int > seedFrequencyMap_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
void initEvtByEvtHists(int naiveEvtNum_, int ievt)
TCanvas * digiOccupancyCoarseCanvas_
std::vector< int > seedCrys_
int xtalId() const
get the channel id
TH2F * digiOccupancyEEPAll_
std::string floatToString(float num)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
TCanvas * energyMapCoarseCanvasAll_
TH1F * allFedsTimingHist_
TH2F * digiOccupancyEBAll_
TH2F * digiOccupancyEEPcoarseAll_
TH3F * timingMapEEPCoarseAll_
void deleteEvtByEvtHists()
T * make(const Args &...args) const
make new ROOT object
const double histRangeMin_
TH2F * recHitOccupancyEB_
TGraph * selectDigi(DetId det, int ievt)
TH3F * init3DEcalHist(std::string histTypeName, int dubDet)
TH2F * energyMapEEMcoarse_
TH2F * digiOccupancyEBcoarse_
TCanvas * init2DEcalCanvas(std::string canvasName)
Log< level::Warning, false > LogWarning
TH2F * energyMapEBcoarseAll_
void beginRun(edm::Run const &, edm::EventSetup const &) override
TCanvas * recHitOccupancyCoarseCanvas_
EcalDisplaysByEvent(const edm::ParameterSet &)
const edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
TH2F * energyMapEEPcoarse_
TH2F * digiOccupancyEEMcoarseAll_
std::map< int, float > crysAndAmplitudesMap_
void initAllEventHistos()
TH2F * digiOccupancyEEPcoarse_