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))
62 vector<int> listDefaults;
63 listDefaults.push_back(-1);
69 vector<string> defaultMaskedEBs;
70 defaultMaskedEBs.push_back(
"none");
75 string title1 =
"Jitter for all FEDs all events";
76 string name1 =
"JitterAllFEDsAllEvents";
80 if(maskedFEDs_[0]==-1)
86 for(vector<string>::const_iterator ebItr =
maskedEBs_.begin(); ebItr !=
maskedEBs_.end(); ++ebItr)
88 maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr));
93 for (
int i=0;
i<10;
i++)
131 headerItr != DCCHeaders->
end ();
137 int ievt = iEvent.
id().
event();
144 names =
new std::vector<string>();
149 histoCanvasNames_->Branch(
"histoCanvasNamesVector",
"vector<string>",&histoCanvasNamesVector);
169 bool hasEBdigis =
false;
170 bool hasEEdigis =
false;
197 if(hasEBdigis || hasEEdigis)
212 int FEDid = 600+elecId.
dccId();
214 if(FEDid < 610 || FEDid > 645)
219 float ampli = hit.
energy();
221 vector<int>::iterator
result;
234 bool cryIsInList =
false;
247 string title =
"Digis";
250 pair<map<string,int>::iterator,
bool> pair =
seedFrequencyMap_.insert(make_pair(seed,freq));
253 ++(pair.first->second);
257 TCanvas can(name.c_str(),title.c_str(),200,50,900,900);
275 names->push_back(name);
283 for (
int i=0;
i<10;
i++)
286 emptyGraph->SetTitle(
"NOT ECAL");
292 emptyGraph->SetTitle(
"NO DIGIS");
295 int FEDid = 600+elecId.
dccId();
297 if(FEDid < 610 || FEDid > 645)
300 int ic = isBarrel ? ((
EBDetId)thisDet).ic() : cryIndex;
338 if (gainId ==1) gainHuman =12;
339 else if (gainId ==2) gainHuman =6;
340 else if (gainId ==3) gainHuman =1;
345 emptyGraph->SetTitle(
"FIRST TWO SAMPLES NOT GAIN12");
354 for (
int i=0;
i < df.
size(); ++
i ) {
364 string gainString = (gainId==1) ?
"Free" :
intToString(gainHuman);
366 "_ic" +
intToString(ic) +
"_" + sliceName +
"_gain" + gainString;
369 map<int,float>::const_iterator itr;
374 energy = (
float) itr->second;
381 oneGraph->SetTitle(title.c_str());
382 oneGraph->SetName(name.c_str());
383 oneGraph->GetXaxis()->SetTitle(
"sample");
384 oneGraph->GetYaxis()->SetTitle(
"ADC");
390 int FEDid = 600+elecId.
dccId();
397 EBDetId digiId = digiItr->id();
398 int ieta = digiId.
ieta();
399 int iphi = digiId.
iphi();
413 DetId det = digiItr->id();
415 size_t FEDid = 600+elecId.
dccId();
419 EEDetId digiId = digiItr->id();
420 int ieta = digiId.
iy();
421 int iphi = digiId.
ix();
452 int FEDid = 600+elecId.
dccId();
455 if(FEDid < 610 || FEDid > 645)
461 int iphi = isBarrel ? ((
EBDetId)det).iphi() : ((
EEDetId)det).ix();
462 int ieta = isBarrel ? ((
EBDetId)det).ieta() : ((
EEDetId)det).iy();
463 float energy = hit.
energy();
581 if(timingHist==
nullptr)
588 timingHist->Fill(hit.
time());
614 string frequencies =
"";
620 frequencies+=itr->first;
621 frequencies+=
" Frequency: ";
626 LogWarning(
"EcalDisplaysByEvent") <<
"Found seeds with frequency > 1: " <<
"\n\n" << frequencies;
637 for(std::vector<int>::const_iterator itr =
maskedFEDs_.begin();
644 LogWarning(
"EcalDisplaysByEvent") <<
"Masked channels are: " << channels;
645 LogWarning(
"EcalDisplaysByEvent") <<
"Masked FEDs are: " << feds <<
" and that is all!";
651 ostringstream myStream;
652 myStream << num << flush;
653 return(myStream.str());
659 ostringstream myStream;
660 myStream << num << flush;
661 return(myStream.str());
669 string title1 =
"Jitter for ";
671 string name1 =
"JitterFED";
673 TH1F* timingHist =
fileService->
make<TH1F>(name1.c_str(),title1.c_str(),150,-7,7);
682 string canvasTitle =
"Timing_Event"+lastPart;
683 timingEB_ =
new TH1F(
"timeForAllFedsEB",
"timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
684 timingEEM_ =
new TH1F(
"timeForAllFedsEEM",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
685 timingEEP_ =
new TH1F(
"timeForAllFedsEEP",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
686 timingCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
701 string canvasTitle =
"Energy_Event"+lastPart;
702 energyCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
780 string canvasTitle =
"Timing_AllEvents";
781 timingEBAll_ =
new TH1F(
"timeForAllFedsEBAll",
"timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
782 timingEEMAll_ =
new TH1F(
"timeForAllFedsEEMAll",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
783 timingEEPAll_ =
new TH1F(
"timeForAllFedsEEPAll",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
784 timingCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
796 canvasTitle =
"Energy_AllEvents";
797 energyCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
838 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0, 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86 };
839 double modEtaBins[10]={-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
840 double ttPhiBins[73];
841 double modPhiBins[19];
842 double timingBins[79];
843 for (
int i = 0;
i < 79; ++
i)
845 timingBins[
i]= 6 - 7. + double(
i) * 14. / 78.;
851 modPhiBins[
i]=1+20*
i;
858 histName = histName +
"EB";
859 histTitle = histTitle +
" EB";
861 histName = histName +
"Coarse";
862 histTitle = histTitle +
" by Module Nominal value = 6;iphi;ieta ";
863 hist =
new TH3F(histName.c_str(),histTitle.c_str(),18,modPhiBins,9,modEtaBins,78,timingBins);
866 histTitle = histTitle +
" by TT Nominal value = 6;iphi;ieta";
867 hist =
new TH3F(histName.c_str(),histTitle.c_str(),360/5,ttPhiBins,35,ttEtaBins,78,timingBins);
873 for(
int i=0;
i!=21;++
i) {
874 ttXBins[
i] = 1 + 5*
i;
875 ttYBins[
i] = 1 + 5*
i;
878 histName = histName +
"EEM";
879 histTitle = histTitle +
" EEM";
882 histName = histName +
"EEP";
883 histTitle = histTitle +
" EEP";
886 histName = histName +
"Coarse";
887 histTitle = histTitle +
" by Module Nominal value = 6;ix;iy";
888 hist =
new TH3F(histName.c_str(),histTitle.c_str(),20,ttXBins,20,ttYBins,78,timingBins);
891 histTitle = histTitle +
" by TT Nominal value = 6;ix;iy";
892 hist =
new TH3F(histName.c_str(),histTitle.c_str(),20,ttXBins,20,ttYBins,78,timingBins);
906 histName = histName +
"EB";
907 histTitle = histTitle +
" EB";
909 histName = histName +
"Coarse";
910 histTitle = histTitle +
" Coarse;iphi;ieta";
911 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40,
912 -35, -30, -25, -20, -15, -10, -5, 0, 1, 6, 11, 16,
913 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86 };
914 hist =
new TH2F(histName.c_str(),histTitle.c_str(),360/5,1,361.,35,ttEtaBins);
917 histTitle = histTitle +
";iphi;ieta";
918 hist =
new TH2F(histName.c_str(),histTitle.c_str(),360,1,361.,172,-86,86);
923 histName = histName +
"EEM";
924 histTitle = histTitle +
" EEM";
927 histName = histName +
"EEP";
928 histTitle = histTitle +
" EEP";
931 histName = histName +
"Coarse";
932 histTitle = histTitle +
" Coarse;ix;iy";
933 hist =
new TH2F(histName.c_str(),histTitle.c_str(),20,1,101,20,1,101);
936 histTitle = histTitle +
";ix;iy";
937 hist =
new TH2F(histName.c_str(),histTitle.c_str(),100,1,101,100,1,101);
944 TCanvas*
canvas =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
978 canvas->cd(1)->Divide(2,1);
979 canvas->cd(1)->cd(1);
983 canvas->cd(1)->cd(2);
986 canvas->SetCanvasSize(500,500);
987 canvas->SetFixedAspectRatio(
true);
993 canvas->cd(1)->Divide(2,1);
995 canvas->cd(1)->cd(1);
1000 hist2->Draw(
"colz");
1001 hist2->GetXaxis()->SetNdivisions(-18);
1002 hist2->GetYaxis()->SetNdivisions(2);
1003 canvas->GetPad(2)->SetGridx(1);
1004 canvas->GetPad(2)->SetGridy(1);
1006 canvas->cd(1)->cd(2);
1007 hist3->Draw(
"colz");
1010 canvas->SetCanvasSize(500,500);
1011 canvas->SetFixedAspectRatio(
true);
1018 TProfile2D* profile2 = (TProfile2D*) hist2->Project3DProfile(
"yx");
1019 profile2->Draw(
"colz");
1023 canvas->Divide(1,2);
1024 canvas->cd(1)->Divide(2,1);
1026 canvas->cd(1)->cd(1);
1027 TProfile2D* profile1 = (TProfile2D*) hist1->Project3DProfile(
"yx");
1028 profile1->Draw(
"colz");
1032 TProfile2D* profile2 = (TProfile2D*) hist2->Project3DProfile(
"yx");
1033 profile2->Draw(
"colz");
1034 profile2->GetXaxis()->SetNdivisions(-18);
1035 profile2->GetYaxis()->SetNdivisions(2);
1036 canvas->GetPad(2)->SetGridx(1);
1037 canvas->GetPad(2)->SetGridy(1);
1039 canvas->cd(1)->cd(2);
1040 TProfile2D* profile3 = (TProfile2D*) hist3->Project3DProfile(
"yx");
1041 profile3->Draw(
"colz");
1045 canvas->SetCanvasSize(500,500);
1046 canvas->SetFixedAspectRatio(
true);
1051 int nxb = profile->GetNbinsX();
1052 int nyb = profile->GetNbinsY();
1054 for(
int i=0;
i!=nxb;++
i) {
1055 for(
int j=0;j!=nyb;++j) {
1059 double xcorr = profile->GetBinCenter(xb);
1060 double ycorr = profile->GetBinCenter(yb);
1061 sprintf(tempErr,
"%0.2f",profile->GetBinError(xb,yb));
1062 int nBin = profile->GetBin(xb,yb,0);
1063 int nBinEntries = (
int) profile->GetBinEntries(nBin);
1064 if(nBinEntries != 0) {
1065 TLatex*
tex =
new TLatex(xcorr,ycorr,tempErr);
1066 tex->SetTextAlign(23);
1067 tex->SetTextSize(42);
1068 tex->SetTextSize(0.025);
1069 tex->SetLineWidth(2);
1073 sprintf(tempErr,
"%i",nBinEntries);
1074 if(nBinEntries!=0) {
1075 TLatex*
tex =
new TLatex(xcorr,ycorr,tempErr);
1076 tex->SetTextAlign(21);
1077 tex->SetTextFont(42);
1078 tex->SetTextSize(0.025);
1079 tex->SetLineWidth(2);
1089 int ixSectorsEE[202] = {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, 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, 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, 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, 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, 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, 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, 30, 20, 20, 10, 10, 8, 0, 45, 45, 40, 40, 35, 35, 0, 55, 55, 60, 60, 65, 65};
1091 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, 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 50, 0, 50, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97,100,100, 97, 97, 95, 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, 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, 40, 50, 0, 45, 45, 40, 40, 35, 35, 30, 30, 25, 25, 0, 50, 50, 55, 55, 60, 60, 0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 61,100, 0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87, 0, 50, 50, 55, 55, 60, 60, 0, 45, 45, 40, 40, 35, 35, 30, 30, 25, 25, 0, 39, 30, 30, 15, 15, 5, 0, 39, 30, 30, 15, 15, 5};
1094 for (
int i=0;
i<202;
i++) {
1095 ixSectorsEE[
i] += 1;
1096 iySectorsEE[
i] += 1;
1102 for (
int i=0;
i<201;
i=
i+1) {
1103 if ( (ixSectorsEE[
i]!=1 || iySectorsEE[
i]!=1) &&
1104 (ixSectorsEE[
i+1]!=1 || iySectorsEE[
i+1]!=1) ) {
1105 l.DrawLine(ixSectorsEE[
i], iySectorsEE[i],
1106 ixSectorsEE[i+1], iySectorsEE[i+1]);
TH2F * recHitOccupancyEBcoarseAll_
std::map< int, TH1F * > FEDsAndTimingHists_
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 gainId(sample_type sample)
get the gainId (2 bits)
int stripId() const
get the tower id
TH2F * init2DEcalHist(std::string histTypeName, int subDet)
TH2F * recHitOccupancyEEMcoarseAll_
std::vector< int > maskedChannels_
TCanvas * energyMapCanvasAll_
std::map< int, float > crysAndAmplitudesMap_
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)
edm::InputTag headerProducer_
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
void analyze(edm::Event const &, edm::EventSetup const &) override
EcalMGPASample sample(int i) const
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_
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
TH2F * energyMapEEMcoarseAll_
TH2F * recHitOccupancyEBcoarse_
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
std::map< std::string, int > seedFrequencyMap_
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
void initEvtByEvtHists(int naiveEvtNum_, int ievt)
TCanvas * digiOccupancyCoarseCanvas_
bool makeOccupancyHistos_
std::vector< int > seedCrys_
TH2F * digiOccupancyEEPAll_
edm::InputTag EERecHitCollection_
std::string floatToString(float num)
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_
Detector det() const
get the detector field from this detid
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
void initAllEventHistos()
int adc() const
get the ADC sample (12 bits)
TH2F * digiOccupancyEEPcoarse_