24 #include "TProfile2D.h"
45 EBRecHitCollection_ (iConfig.getParameter<edm::
InputTag>(
"EcalRecHitCollectionEB")),
46 EERecHitCollection_ (iConfig.getParameter<edm::
InputTag>(
"EcalRecHitCollectionEE")),
47 EBDigis_ (iConfig.getParameter<edm::
InputTag>(
"EBDigiCollection")),
48 EEDigis_ (iConfig.getParameter<edm::
InputTag>(
"EEDigiCollection")),
49 headerProducer_ (iConfig.getParameter<edm::
InputTag> (
"headerProducer")),
51 side_ (iConfig.getUntrackedParameter<int>(
"side", 3)),
52 threshold_ (iConfig.getUntrackedParameter<double>(
"amplitudeThreshold", 0.5)),
53 minTimingAmp_ (iConfig.getUntrackedParameter<double>(
"minimumTimingAmplitude", 0.100)),
54 makeDigiGraphs_ (iConfig.getUntrackedParameter<bool>(
"makeDigiGraphs",
false)),
55 makeTimingHistos_ (iConfig.getUntrackedParameter<bool>(
"makeTimingHistos",
true)),
56 makeEnergyHistos_ (iConfig.getUntrackedParameter<bool>(
"makeEnergyHistos",
true)),
57 makeOccupancyHistos_ (iConfig.getUntrackedParameter<bool>(
"makeOccupancyHistos",
true)),
58 histRangeMin_ (iConfig.getUntrackedParameter<double>(
"histogramMinRange",0.0)),
59 histRangeMax_ (iConfig.getUntrackedParameter<double>(
"histogramMaxRange",1.8)),
60 minTimingEnergyEB_ (iConfig.getUntrackedParameter<double>(
"minTimingEnergyEB",0.0)),
61 minTimingEnergyEE_ (iConfig.getUntrackedParameter<double>(
"minTimingEnergyEE",0.0))
63 vector<int> listDefaults;
64 listDefaults.push_back(-1);
70 vector<string> defaultMaskedEBs;
71 defaultMaskedEBs.push_back(
"none");
76 string title1 =
"Jitter for all FEDs all events";
77 string name1 =
"JitterAllFEDsAllEvents";
81 if(maskedFEDs_[0]==-1)
87 for(vector<string>::const_iterator ebItr =
maskedEBs_.begin(); ebItr !=
maskedEBs_.end(); ++ebItr)
89 maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr));
94 for (
int i=0;
i<10;
i++)
132 headerItr != DCCHeaders->end ();
138 int ievt = iEvent.
id().
event();
145 names =
new std::vector<string>();
150 histoCanvasNames_->Branch(
"histoCanvasNamesVector",
"vector<string>",&histoCanvasNamesVector);
170 bool hasEBdigis =
false;
171 bool hasEEdigis =
false;
198 if(hasEBdigis || hasEEdigis)
214 bool isBarrel =
true;
215 if(FEDid < 610 || FEDid > 645)
220 float ampli = hit.
energy();
222 vector<int>::iterator
result;
235 bool cryIsInList =
false;
248 string title =
"Digis";
251 pair<map<string,int>::iterator,
bool> pair =
seedFrequencyMap_.insert(make_pair(seed,freq));
254 ++(pair.first->second);
258 TCanvas can(name.c_str(),title.c_str(),200,50,900,900);
276 names->push_back(name);
284 for (
int i=0;
i<10;
i++)
287 emptyGraph->SetTitle(
"NOT ECAL");
293 emptyGraph->SetTitle(
"NO DIGIS");
297 bool isBarrel =
true;
298 if(FEDid < 610 || FEDid > 645)
301 int ic = isBarrel ? ((
EBDetId)thisDet).ic() : cryIndex;
339 if (gainId ==1) gainHuman =12;
340 else if (gainId ==2) gainHuman =6;
341 else if (gainId ==3) gainHuman =1;
344 double pedestal = 200;
346 emptyGraph->SetTitle(
"FIRST TWO SAMPLES NOT GAIN12");
355 for (
int i=0;
i < df.
size(); ++
i ) {
365 string gainString = (gainId==1) ?
"Free" :
intToString(gainHuman);
367 "_ic" +
intToString(ic) +
"_" + sliceName +
"_gain" + gainString;
370 map<int,float>::const_iterator itr;
375 energy = (float) itr->second;
382 oneGraph->SetTitle(title.c_str());
383 oneGraph->SetName(name.c_str());
384 oneGraph->GetXaxis()->SetTitle(
"sample");
385 oneGraph->GetYaxis()->SetTitle(
"ADC");
398 EBDetId digiId = digiItr->id();
399 int ieta = digiId.
ieta();
400 int iphi = digiId.
iphi();
414 DetId det = digiItr->id();
418 if(FEDid < 610 || FEDid > 645)
423 EEDetId digiId = digiItr->id();
424 int ieta = digiId.
iy();
425 int iphi = digiId.
ix();
457 bool isBarrel =
true;
459 if(FEDid < 610 || FEDid > 645)
465 int iphi = isBarrel ? ((
EBDetId)det).iphi() : ((
EEDetId)det).ix();
466 int ieta = isBarrel ? ((
EBDetId)det).ieta() : ((
EEDetId)det).iy();
592 timingHist->Fill(hit.
time());
618 string frequencies =
"";
624 frequencies+=itr->first;
625 frequencies+=
" Frequency: ";
630 LogWarning(
"EcalDisplaysByEvent") <<
"Found seeds with frequency > 1: " <<
"\n\n" << frequencies;
632 std::string channels;
641 for(std::vector<int>::const_iterator itr =
maskedFEDs_.begin();
648 LogWarning(
"EcalDisplaysByEvent") <<
"Masked channels are: " << channels;
649 LogWarning(
"EcalDisplaysByEvent") <<
"Masked FEDs are: " << feds <<
" and that is all!";
655 ostringstream myStream;
656 myStream << num << flush;
657 return(myStream.str());
663 ostringstream myStream;
664 myStream << num << flush;
665 return(myStream.str());
673 string title1 =
"Jitter for ";
675 string name1 =
"JitterFED";
677 TH1F* timingHist =
fileService->
make<TH1F>(name1.c_str(),title1.c_str(),150,-7,7);
686 string canvasTitle =
"Timing_Event"+lastPart;
687 timingEB_ =
new TH1F(
"timeForAllFedsEB",
"timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
688 timingEEM_ =
new TH1F(
"timeForAllFedsEEM",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
689 timingEEP_ =
new TH1F(
"timeForAllFedsEEP",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
690 timingCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
705 string canvasTitle =
"Energy_Event"+lastPart;
706 energyCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
784 string canvasTitle =
"Timing_AllEvents";
785 timingEBAll_ =
new TH1F(
"timeForAllFedsEBAll",
"timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
786 timingEEMAll_ =
new TH1F(
"timeForAllFedsEEMAll",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
787 timingEEPAll_ =
new TH1F(
"timeForAllFedsEEPAll",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
788 timingCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
800 canvasTitle =
"Energy_AllEvents";
801 energyCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
840 std::string histName = histTypeName;
841 std::string histTitle = histTypeName;
842 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 };
843 double modEtaBins[10]={-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
844 double ttPhiBins[73];
845 double modPhiBins[19];
846 double timingBins[79];
847 double highEBins[11];
848 for (
int i = 0;
i < 79; ++
i)
850 timingBins[
i]= 6 - 7. + double(
i) * 14. / 78.;
856 modPhiBins[
i]=1+20*
i;
859 highEBins[
i]=10.+double(
i)*20.;
867 histName = histName +
"EB";
868 histTitle = histTitle +
" EB";
870 histName = histName +
"Coarse";
871 histTitle = histTitle +
" by Module Nominal value = 6;iphi;ieta ";
872 hist =
new TH3F(histName.c_str(),histTitle.c_str(),18,modPhiBins,9,modEtaBins,78,timingBins);
875 histTitle = histTitle +
" by TT Nominal value = 6;iphi;ieta";
876 hist =
new TH3F(histName.c_str(),histTitle.c_str(),360/5,ttPhiBins,35,ttEtaBins,78,timingBins);
882 for(
int i=0;
i!=21;++
i) {
883 ttXBins[
i] = 1 + 5*
i;
884 ttYBins[
i] = 1 + 5*
i;
887 histName = histName +
"EEM";
888 histTitle = histTitle +
" EEM";
891 histName = histName +
"EEP";
892 histTitle = histTitle +
" EEP";
895 histName = histName +
"Coarse";
896 histTitle = histTitle +
" by Module Nominal value = 6;ix;iy";
897 hist =
new TH3F(histName.c_str(),histTitle.c_str(),20,ttXBins,20,ttYBins,78,timingBins);
900 histTitle = histTitle +
" by TT Nominal value = 6;ix;iy";
901 hist =
new TH3F(histName.c_str(),histTitle.c_str(),20,ttXBins,20,ttYBins,78,timingBins);
912 std::string histName = histTypeName;
913 std::string histTitle = histTypeName;
915 histName = histName +
"EB";
916 histTitle = histTitle +
" EB";
918 histName = histName +
"Coarse";
919 histTitle = histTitle +
" Coarse;iphi;ieta";
920 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40,
921 -35, -30, -25, -20, -15, -10, -5, 0, 1, 6, 11, 16,
922 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86 };
923 hist =
new TH2F(histName.c_str(),histTitle.c_str(),360/5,1,361.,35,ttEtaBins);
926 histTitle = histTitle +
";iphi;ieta";
927 hist =
new TH2F(histName.c_str(),histTitle.c_str(),360,1,361.,172,-86,86);
932 histName = histName +
"EEM";
933 histTitle = histTitle +
" EEM";
936 histName = histName +
"EEP";
937 histTitle = histTitle +
" EEP";
940 histName = histName +
"Coarse";
941 histTitle = histTitle +
" Coarse;ix;iy";
942 hist =
new TH2F(histName.c_str(),histTitle.c_str(),20,1,101,20,1,101);
945 histTitle = histTitle +
";ix;iy";
946 hist =
new TH2F(histName.c_str(),histTitle.c_str(),100,1,101,100,1,101);
953 TCanvas*
canvas =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
987 canvas->cd(1)->Divide(2,1);
988 canvas->cd(1)->cd(1);
992 canvas->cd(1)->cd(2);
995 canvas->SetCanvasSize(500,500);
996 canvas->SetFixedAspectRatio(
true);
1001 canvas->Divide(1,2);
1002 canvas->cd(1)->Divide(2,1);
1004 canvas->cd(1)->cd(1);
1005 hist1->Draw(
"colz");
1009 hist2->Draw(
"colz");
1010 hist2->GetXaxis()->SetNdivisions(-18);
1011 hist2->GetYaxis()->SetNdivisions(2);
1012 canvas->GetPad(2)->SetGridx(1);
1013 canvas->GetPad(2)->SetGridy(1);
1015 canvas->cd(1)->cd(2);
1016 hist3->Draw(
"colz");
1019 canvas->SetCanvasSize(500,500);
1020 canvas->SetFixedAspectRatio(
true);
1027 TProfile2D* profile2 = (TProfile2D*) hist2->Project3DProfile(
"yx");
1028 profile2->Draw(
"colz");
1032 canvas->Divide(1,2);
1033 canvas->cd(1)->Divide(2,1);
1035 canvas->cd(1)->cd(1);
1036 TProfile2D* profile1 = (TProfile2D*) hist1->Project3DProfile(
"yx");
1037 profile1->Draw(
"colz");
1041 TProfile2D* profile2 = (TProfile2D*) hist2->Project3DProfile(
"yx");
1042 profile2->Draw(
"colz");
1043 profile2->GetXaxis()->SetNdivisions(-18);
1044 profile2->GetYaxis()->SetNdivisions(2);
1045 canvas->GetPad(2)->SetGridx(1);
1046 canvas->GetPad(2)->SetGridy(1);
1048 canvas->cd(1)->cd(2);
1049 TProfile2D* profile3 = (TProfile2D*) hist3->Project3DProfile(
"yx");
1050 profile3->Draw(
"colz");
1054 canvas->SetCanvasSize(500,500);
1055 canvas->SetFixedAspectRatio(
true);
1060 int nxb = profile->GetNbinsX();
1061 int nyb = profile->GetNbinsY();
1063 for(
int i=0;
i!=nxb;++
i) {
1064 for(
int j=0;
j!=nyb;++
j) {
1068 double xcorr = profile->GetBinCenter(xb);
1069 double ycorr = profile->GetBinCenter(yb);
1070 sprintf(tempErr,
"%0.2f",profile->GetBinError(xb,yb));
1071 int nBin = profile->GetBin(xb,yb,0);
1072 int nBinEntries = (int) profile->GetBinEntries(nBin);
1073 if(nBinEntries != 0) {
1074 TLatex* tex =
new TLatex(xcorr,ycorr,tempErr);
1075 tex->SetTextAlign(23);
1076 tex->SetTextSize(42);
1077 tex->SetTextSize(0.025);
1078 tex->SetLineWidth(2);
1082 sprintf(tempErr,
"%i",nBinEntries);
1083 if(nBinEntries!=0) {
1084 TLatex* tex =
new TLatex(xcorr,ycorr,tempErr);
1085 tex->SetTextAlign(21);
1086 tex->SetTextFont(42);
1087 tex->SetTextSize(0.025);
1088 tex->SetLineWidth(2);
1098 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};
1100 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};
1103 for (
int i=0;
i<202;
i++) {
1104 ixSectorsEE[
i] += 1;
1105 iySectorsEE[
i] += 1;
1111 for (
int i=0;
i<201;
i=
i+1) {
1112 if ( (ixSectorsEE[
i]!=1 || iySectorsEE[
i]!=1) &&
1113 (ixSectorsEE[
i+1]!=1 || iySectorsEE[
i+1]!=1) ) {
1114 l.DrawLine(ixSectorsEE[
i], iySectorsEE[i],
1115 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_
void home() const
move the navigator back to the starting point
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< T >::const_iterator const_iterator
EcalMGPASample sample(int i) const
void drawTimingErrors(TProfile2D *profile)
int towerId() const
get the tower id
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_
TH2F * digiOccupancyEEMAll_
double minTimingEnergyEB_
std::vector< int > maskedFEDs_
TCanvas * energyMapCanvas_
TH2F * recHitOccupancyEEMAll_
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
TCanvas * digiOccupancyCanvas_
TH3F * timingMapEBCoarseAll_
TCanvas * recHitOccupancyCoarseCanvasAll_
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
TH2F * energyMapEEMcoarseAll_
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
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
std::string intToString(int num)
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
TCanvas * recHitOccupancyCanvasAll_
T const * product() const
TH2F * recHitOccupancyEBAll_
T const * product() const
TCanvas * timingCanvasAll_
TTree * histoCanvasNames_
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_
T * make() const
make new ROOT object
edm::InputTag EBRecHitCollection_
TH3F * timingMapEEPCoarseAll_
void deleteEvtByEvtHists()
TH2F * recHitOccupancyEB_
TGraph * selectDigi(DetId det, int ievt)
TH3F * init3DEcalHist(std::string histTypeName, int dubDet)
virtual void analyze(edm::Event const &, edm::EventSetup const &)
TH2F * energyMapEEMcoarse_
TH2F * digiOccupancyEBcoarse_
TCanvas * init2DEcalCanvas(std::string canvasName)
double minTimingEnergyEE_
TH2F * energyMapEBcoarseAll_
Detector det() const
get the detector field from this detid
TCanvas * recHitOccupancyCoarseCanvas_
EcalDisplaysByEvent(const edm::ParameterSet &)
TH2F * energyMapEEPcoarse_
TH2F * digiOccupancyEEMcoarseAll_
void initAllEventHistos()
int adc() const
get the ADC sample (12 bits)
TH2F * digiOccupancyEEPcoarse_