23 #include "TProfile2D.h" 44 : EBRecHitCollection_(iConfig.getParameter<
edm::
InputTag>(
"EcalRecHitCollectionEB")),
45 EERecHitCollection_(iConfig.getParameter<
edm::
InputTag>(
"EcalRecHitCollectionEE")),
46 EBDigis_(iConfig.getParameter<
edm::
InputTag>(
"EBDigiCollection")),
47 EEDigis_(iConfig.getParameter<
edm::
InputTag>(
"EEDigiCollection")),
48 headerProducer_(iConfig.getParameter<
edm::
InputTag>(
"headerProducer")),
50 side_(iConfig.getUntrackedParameter<
int>(
"side", 3)),
51 threshold_(iConfig.getUntrackedParameter<double>(
"amplitudeThreshold", 0.5)),
52 minTimingAmp_(iConfig.getUntrackedParameter<double>(
"minimumTimingAmplitude", 0.100)),
53 makeDigiGraphs_(iConfig.getUntrackedParameter<
bool>(
"makeDigiGraphs",
false)),
54 makeTimingHistos_(iConfig.getUntrackedParameter<
bool>(
"makeTimingHistos",
true)),
55 makeEnergyHistos_(iConfig.getUntrackedParameter<
bool>(
"makeEnergyHistos",
true)),
56 makeOccupancyHistos_(iConfig.getUntrackedParameter<
bool>(
"makeOccupancyHistos",
true)),
57 histRangeMin_(iConfig.getUntrackedParameter<double>(
"histogramMinRange", 0.0)),
58 histRangeMax_(iConfig.getUntrackedParameter<double>(
"histogramMaxRange", 1.8)),
59 minTimingEnergyEB_(iConfig.getUntrackedParameter<double>(
"minTimingEnergyEB", 0.0)),
60 minTimingEnergyEE_(iConfig.getUntrackedParameter<double>(
"minTimingEnergyEE", 0.0)) {
61 vector<int> listDefaults;
62 listDefaults.push_back(-1);
68 vector<string> defaultMaskedEBs;
69 defaultMaskedEBs.push_back(
"none");
74 string title1 =
"Jitter for all FEDs all events";
75 string name1 =
"JitterAllFEDsAllEvents";
79 if (maskedFEDs_[0] == -1) {
83 for (vector<string>::const_iterator ebItr =
maskedEBs_.begin(); ebItr !=
maskedEBs_.end(); ++ebItr) {
84 maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr));
89 for (
int i = 0;
i < 10;
i++)
122 int ievt = iEvent.
id().
event();
128 names =
new std::vector<string>();
129 canvasNames_->Branch(
"names",
"vector<string>", &names);
133 histoCanvasNames_->Branch(
"histoCanvasNamesVector",
"vector<string>", &histoCanvasNamesVector);
153 bool hasEBdigis =
false;
154 bool hasEEdigis =
false;
178 if (hasEBdigis || hasEEdigis)
189 int FEDid = 600 + elecId.
dccId();
191 if (FEDid < 610 || FEDid > 645)
196 float ampli = hit.
energy();
198 vector<int>::iterator
result;
209 bool cryIsInList =
false;
220 string title =
"Digis";
223 pair<map<string, int>::iterator,
bool> pair =
seedFrequencyMap_.insert(make_pair(seed, freq));
225 ++(pair.first->second);
229 TCanvas can(name.c_str(), title.c_str(), 200, 50, 900, 900);
235 for (
int j =
side_ / 2; j >= -
side_ / 2; --j) {
245 names->push_back(name);
252 for (
int i = 0;
i < 10;
i++)
255 emptyGraph->SetTitle(
"NOT ECAL");
261 emptyGraph->SetTitle(
"NO DIGIS");
264 int FEDid = 600 + elecId.
dccId();
266 if (FEDid < 610 || FEDid > 645)
269 int ic = isBarrel ? ((
EBDetId)thisDet).ic() : cryIndex;
301 else if (gainId == 2)
303 else if (gainId == 3)
310 emptyGraph->SetTitle(
"FIRST TWO SAMPLES NOT GAIN12");
319 for (
int i = 0;
i < df.
size(); ++
i) {
328 string gainString = (gainId == 1) ?
"Free" :
intToString(gainHuman);
330 sliceName +
"_gain" + gainString;
333 map<int, float>::const_iterator itr;
337 energy = (
float)itr->second;
344 oneGraph->SetTitle(title.c_str());
345 oneGraph->SetName(name.c_str());
346 oneGraph->GetXaxis()->SetTitle(
"sample");
347 oneGraph->GetYaxis()->SetTitle(
"ADC");
352 int FEDid = 600 + elecId.
dccId();
359 EBDetId digiId = digiItr->id();
360 int ieta = digiId.
ieta();
361 int iphi = digiId.
iphi();
374 DetId det = digiItr->id();
376 size_t FEDid = 600 + elecId.
dccId();
380 EEDetId digiId = digiItr->id();
381 int ieta = digiId.
iy();
382 int iphi = digiId.
ix();
406 int FEDid = 600 + elecId.
dccId();
409 if (FEDid < 610 || FEDid > 645) {
414 int iphi = isBarrel ? ((
EBDetId)det).iphi() : ((
EEDetId)det).ix();
415 int ieta = isBarrel ? ((
EBDetId)det).ieta() : ((
EEDetId)det).iy();
416 float energy = hit.
energy();
509 if (timingHist ==
nullptr) {
514 timingHist->Fill(hit.
time());
542 string frequencies =
"";
545 if (itr->second > 1) {
546 frequencies += itr->first;
547 frequencies +=
" Frequency: ";
552 LogWarning(
"EcalDisplaysByEvent") <<
"Found seeds with frequency > 1: " 568 LogWarning(
"EcalDisplaysByEvent") <<
"Masked channels are: " << channels;
569 LogWarning(
"EcalDisplaysByEvent") <<
"Masked FEDs are: " << feds <<
" and that is all!";
574 ostringstream myStream;
575 myStream << num << flush;
576 return (myStream.str());
581 ostringstream myStream;
582 myStream << num << flush;
583 return (myStream.str());
590 string title1 =
"Jitter for ";
592 string name1 =
"JitterFED";
594 TH1F* timingHist =
fileService->
make<TH1F>(name1.c_str(), title1.c_str(), 150, -7, 7);
601 string canvasTitle =
"Timing_Event" + lastPart;
602 timingEB_ =
new TH1F(
"timeForAllFedsEB",
"timeForAllFeds;Relative Time (1 clock = 25ns)", 78, -7, 7);
603 timingEEM_ =
new TH1F(
"timeForAllFedsEEM",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
604 timingEEP_ =
new TH1F(
"timeForAllFedsEEP",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
605 timingCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
619 string canvasTitle =
"Energy_Event" + lastPart;
620 energyCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
695 string canvasTitle =
"Timing_AllEvents";
696 timingEBAll_ =
new TH1F(
"timeForAllFedsEBAll",
"timeForAllFeds;Relative Time (1 clock = 25ns)", 78, -7, 7);
697 timingEEMAll_ =
new TH1F(
"timeForAllFedsEEMAll",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
698 timingEEPAll_ =
new TH1F(
"timeForAllFedsEEPAll",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
699 timingCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
711 canvasTitle =
"Energy_AllEvents";
712 energyCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
751 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0,
752 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86};
753 double modEtaBins[10] = {-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
754 double ttPhiBins[73];
755 double modPhiBins[19];
756 double timingBins[79];
757 for (
int i = 0;
i < 79; ++
i) {
758 timingBins[
i] = 6 - 7. + double(
i) * 14. / 78.;
760 ttPhiBins[
i] = 1 + 5 *
i;
762 modPhiBins[
i] = 1 + 20 *
i;
768 histName = histName +
"EB";
769 histTitle = histTitle +
" EB";
771 histName = histName +
"Coarse";
772 histTitle = histTitle +
" by Module Nominal value = 6;iphi;ieta ";
773 hist =
new TH3F(histName.c_str(), histTitle.c_str(), 18, modPhiBins, 9, modEtaBins, 78, timingBins);
775 histTitle = histTitle +
" by TT Nominal value = 6;iphi;ieta";
776 hist =
new TH3F(histName.c_str(), histTitle.c_str(), 360 / 5, ttPhiBins, 35, ttEtaBins, 78, timingBins);
781 for (
int i = 0;
i != 21; ++
i) {
782 ttXBins[
i] = 1 + 5 *
i;
783 ttYBins[
i] = 1 + 5 *
i;
786 histName = histName +
"EEM";
787 histTitle = histTitle +
" EEM";
789 histName = histName +
"EEP";
790 histTitle = histTitle +
" EEP";
793 histName = histName +
"Coarse";
794 histTitle = histTitle +
" by Module Nominal value = 6;ix;iy";
795 hist =
new TH3F(histName.c_str(), histTitle.c_str(), 20, ttXBins, 20, ttYBins, 78, timingBins);
797 histTitle = histTitle +
" by TT Nominal value = 6;ix;iy";
798 hist =
new TH3F(histName.c_str(), histTitle.c_str(), 20, ttXBins, 20, ttYBins, 78, timingBins);
812 histName = histName +
"EB";
813 histTitle = histTitle +
" EB";
815 histName = histName +
"Coarse";
816 histTitle = histTitle +
" Coarse;iphi;ieta";
817 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0,
818 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86};
819 hist =
new TH2F(histName.c_str(), histTitle.c_str(), 360 / 5, 1, 361., 35, ttEtaBins);
821 histTitle = histTitle +
";iphi;ieta";
822 hist =
new TH2F(histName.c_str(), histTitle.c_str(), 360, 1, 361., 172, -86, 86);
826 histName = histName +
"EEM";
827 histTitle = histTitle +
" EEM";
829 histName = histName +
"EEP";
830 histTitle = histTitle +
" EEP";
833 histName = histName +
"Coarse";
834 histTitle = histTitle +
" Coarse;ix;iy";
835 hist =
new TH2F(histName.c_str(), histTitle.c_str(), 20, 1, 101, 20, 1, 101);
837 histTitle = histTitle +
";ix;iy";
838 hist =
new TH2F(histName.c_str(), histTitle.c_str(), 100, 1, 101, 100, 1, 101);
845 TCanvas*
canvas =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(), 300, 60, 500, 200);
875 canvas->Divide(1, 2);
876 canvas->cd(1)->Divide(2, 1);
877 canvas->cd(1)->cd(1);
881 canvas->cd(1)->cd(2);
884 canvas->SetCanvasSize(500, 500);
885 canvas->SetFixedAspectRatio(
true);
890 canvas->Divide(1, 2);
891 canvas->cd(1)->Divide(2, 1);
893 canvas->cd(1)->cd(1);
899 hist2->GetXaxis()->SetNdivisions(-18);
900 hist2->GetYaxis()->SetNdivisions(2);
901 canvas->GetPad(2)->SetGridx(1);
902 canvas->GetPad(2)->SetGridy(1);
904 canvas->cd(1)->cd(2);
908 canvas->SetCanvasSize(500, 500);
909 canvas->SetFixedAspectRatio(
true);
916 TProfile2D* profile2 = (TProfile2D*)hist2->Project3DProfile(
"yx");
917 profile2->Draw(
"colz");
920 canvas->Divide(1, 2);
921 canvas->cd(1)->Divide(2, 1);
923 canvas->cd(1)->cd(1);
924 TProfile2D* profile1 = (TProfile2D*)hist1->Project3DProfile(
"yx");
925 profile1->Draw(
"colz");
929 TProfile2D* profile2 = (TProfile2D*)hist2->Project3DProfile(
"yx");
930 profile2->Draw(
"colz");
931 profile2->GetXaxis()->SetNdivisions(-18);
932 profile2->GetYaxis()->SetNdivisions(2);
933 canvas->GetPad(2)->SetGridx(1);
934 canvas->GetPad(2)->SetGridy(1);
936 canvas->cd(1)->cd(2);
937 TProfile2D* profile3 = (TProfile2D*)hist3->Project3DProfile(
"yx");
938 profile3->Draw(
"colz");
942 canvas->SetCanvasSize(500, 500);
943 canvas->SetFixedAspectRatio(
true);
948 int nxb = profile->GetNbinsX();
949 int nyb = profile->GetNbinsY();
951 for (
int i = 0;
i != nxb; ++
i) {
952 for (
int j = 0; j != nyb; ++j) {
956 double xcorr = profile->GetBinCenter(xb);
957 double ycorr = profile->GetBinCenter(yb);
958 sprintf(tempErr,
"%0.2f", profile->GetBinError(xb, yb));
959 int nBin = profile->GetBin(xb, yb, 0);
960 int nBinEntries = (
int)profile->GetBinEntries(nBin);
961 if (nBinEntries != 0) {
962 TLatex*
tex =
new TLatex(xcorr, ycorr, tempErr);
963 tex->SetTextAlign(23);
964 tex->SetTextSize(42);
965 tex->SetTextSize(0.025);
966 tex->SetLineWidth(2);
970 sprintf(tempErr,
"%i", nBinEntries);
971 if (nBinEntries != 0) {
972 TLatex*
tex =
new TLatex(xcorr, ycorr, tempErr);
973 tex->SetTextAlign(21);
974 tex->SetTextFont(42);
975 tex->SetTextSize(0.025);
976 tex->SetLineWidth(2);
985 int ixSectorsEE[202] = {
986 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,
987 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,
988 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,
989 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,
990 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,
991 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,
992 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,
993 30, 20, 20, 10, 10, 8, 0, 45, 45, 40, 40, 35, 35, 0, 55, 55, 60, 60, 65, 65};
995 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,
996 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 50,
997 0, 50, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97, 100, 100, 97,
998 97, 95, 95, 92, 92, 87, 87, 85, 85, 80, 80, 75, 75, 65, 65, 60, 60, 40, 40, 35, 35, 25, 25,
999 20, 20, 15, 15, 13, 13, 8, 8, 5, 5, 3, 3, 0, 0, 3, 3, 5, 5, 8, 8, 13, 13, 15,
1000 15, 20, 20, 25, 25, 35, 35, 40, 40, 50, 0, 45, 45, 40, 40, 35, 35, 30, 30, 25, 25, 0, 50,
1001 50, 55, 55, 60, 60, 0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 61, 100, 0, 60, 60,
1002 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 50, 50, 55, 55, 60, 60, 0, 45, 45, 40, 40, 35, 35,
1003 30, 30, 25, 25, 0, 39, 30, 30, 15, 15, 5, 0, 39, 30, 30, 15, 15, 5};
1005 for (
int i = 0;
i < 202;
i++) {
1006 ixSectorsEE[
i] += 1;
1007 iySectorsEE[
i] += 1;
1013 for (
int i = 0;
i < 201;
i =
i + 1) {
1014 if ((ixSectorsEE[
i] != 1 || iySectorsEE[
i] != 1) && (ixSectorsEE[
i + 1] != 1 || iySectorsEE[
i + 1] != 1)) {
1015 l.DrawLine(ixSectorsEE[
i], iySectorsEE[i], ixSectorsEE[i + 1], iySectorsEE[i + 1]);
TH2F * recHitOccupancyEBcoarseAll_
std::vector< std::string > maskedEBs_
EventNumber_t event() const
TH2F * energyMapEBcoarse_
T getUntrackedParameter(std::string const &, T const &) const
std::set< EBDetId > listEBChannels
TCanvas * timingMapCoarseCanvas_
edm::Handle< EEDigiCollection > EEdigisHandle
TCanvas * energyMapCoarseCanvas_
int xtalId() const
get the channel id
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
TH2F * recHitOccupancyEEPcoarseAll_
int stripId() const
get the tower id
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 [...
TH2F * recHitOccupancyEEP_
std::vector< std::string > * names
const EcalElectronicsMapping * ecalElectronicsMap_
int getEEIndex(EcalElectronicsId elecId)
bool isBarrel(GeomDetEnumerators::SubDetector m)
edm::InputTag headerProducer_
std::vector< T >::const_iterator const_iterator
void analyze(edm::Event const &, edm::EventSetup const &) override
EcalMGPASample sample(int i) const
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
void drawTimingErrors(TProfile2D *profile)
int towerId() const
get the tower id
T * make(const Args &...args) const
make new ROOT object
TH3F * timingMapEEMCoarseAll_
TH2F * recHitOccupancyEEPcoarse_
const_iterator begin() const
TCanvas * digiOccupancyCoarseCanvasAll_
TH2F * recHitOccupancyEEMcoarse_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int gainId() const
get the gainId (2 bits)
TCanvas * timingMapCanvas_
TH2F * digiOccupancyEEMcoarse_
TCanvas * recHitOccupancyCanvas_
std::set< EEDetId > listEEChannels
void drawCanvas(TCanvas *canvas, TH1F *hist1, TH1F *hist2, TH1F *hist3)
std::string getSliceFromFed(int)
std::vector< std::string > * histoCanvasNamesVector
TCanvas * timingMapCanvasAll_
int iphi() const
get the crystal iphi
TCanvas * digiOccupancyCanvasAll_
TH2F * energyMapEEPcoarseAll_
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
TH2F * recHitOccupancyEEM_
T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
TH2F * digiOccupancyEEMAll_
double minTimingEnergyEB_
std::vector< int > maskedFEDs_
TCanvas * energyMapCanvas_
TH2F * recHitOccupancyEEMAll_
TCanvas * digiOccupancyCanvas_
TH3F * timingMapEBCoarseAll_
TCanvas * recHitOccupancyCoarseCanvasAll_
TH2F * energyMapEEMcoarseAll_
TH2F * recHitOccupancyEBcoarse_
std::map< int, TH1F * > FEDsAndTimingHists_
int ieta() const
get the crystal ieta
static edm::Service< TFileService > fileService
TH3F * timingMapEEMCoarse_
TCanvas * energyCanvasAll_
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const_iterator end() const
std::string intToString(int num)
void home() const
move the navigator back to the starting point
static float gainRatio[3]
TH3F * timingMapEEPCoarse_
TH2F * recHitOccupancyEEPAll_
void makeHistos(edm::Handle< EBDigiCollection > ebDigis)
TH2F * digiOccupancyEBcoarseAll_
void selectHits(edm::Handle< EcalRecHitCollection > hits, int ievt, edm::ESHandle< CaloTopology > caloTopo)
edm::Handle< EBDigiCollection > EBdigisHandle
DetId id() const
get the id
T const * product() const
TCanvas * recHitOccupancyCanvasAll_
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
TH2F * recHitOccupancyEBAll_
TCanvas * timingCanvasAll_
TTree * histoCanvasNames_
~EcalDisplaysByEvent() override
const_iterator end() const
std::map< std::string, int > seedFrequencyMap_
void initEvtByEvtHists(int naiveEvtNum_, int ievt)
TCanvas * digiOccupancyCoarseCanvas_
bool makeOccupancyHistos_
std::vector< int > seedCrys_
TH2F * digiOccupancyEEPAll_
edm::InputTag EERecHitCollection_
std::string floatToString(float num)
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
TCanvas * energyMapCoarseCanvasAll_
TH1F * allFedsTimingHist_
TH2F * digiOccupancyEBAll_
TH2F * digiOccupancyEEPcoarseAll_
edm::InputTag EBRecHitCollection_
TH3F * timingMapEEPCoarseAll_
void deleteEvtByEvtHists()
TH2F * recHitOccupancyEB_
TGraph * selectDigi(DetId det, int ievt)
TH3F * init3DEcalHist(std::string histTypeName, int dubDet)
TH2F * energyMapEEMcoarse_
TH2F * digiOccupancyEBcoarse_
TCanvas * init2DEcalCanvas(std::string canvasName)
double minTimingEnergyEE_
TH2F * energyMapEBcoarseAll_
void beginRun(edm::Run const &, edm::EventSetup const &) override
TCanvas * recHitOccupancyCoarseCanvas_
T const * product() const
EcalDisplaysByEvent(const edm::ParameterSet &)
TH2F * energyMapEEPcoarse_
TH2F * digiOccupancyEEMcoarseAll_
const_iterator begin() const
std::map< int, float > crysAndAmplitudesMap_
void initAllEventHistos()
int adc() const
get the ADC sample (12 bits)
constexpr Detector det() const
get the detector field from this detid
TH2F * digiOccupancyEEPcoarse_