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();
420 EEDetId digiId = digiItr->id();
421 int ieta = digiId.
iy();
422 int iphi = digiId.
ix();
454 bool isBarrel =
true;
456 if(FEDid < 610 || FEDid > 645)
462 int iphi = isBarrel ? ((
EBDetId)det).iphi() : ((
EEDetId)det).ix();
463 int ieta = isBarrel ? ((
EBDetId)det).ieta() : ((
EEDetId)det).iy();
589 timingHist->Fill(hit.
time());
615 string frequencies =
"";
621 frequencies+=itr->first;
622 frequencies+=
" Frequency: ";
627 LogWarning(
"EcalDisplaysByEvent") <<
"Found seeds with frequency > 1: " <<
"\n\n" << frequencies;
629 std::string channels;
638 for(std::vector<int>::const_iterator itr =
maskedFEDs_.begin();
645 LogWarning(
"EcalDisplaysByEvent") <<
"Masked channels are: " << channels;
646 LogWarning(
"EcalDisplaysByEvent") <<
"Masked FEDs are: " << feds <<
" and that is all!";
652 ostringstream myStream;
653 myStream << num << flush;
654 return(myStream.str());
660 ostringstream myStream;
661 myStream << num << flush;
662 return(myStream.str());
670 string title1 =
"Jitter for ";
672 string name1 =
"JitterFED";
674 TH1F* timingHist =
fileService->
make<TH1F>(name1.c_str(),title1.c_str(),150,-7,7);
683 string canvasTitle =
"Timing_Event"+lastPart;
684 timingEB_ =
new TH1F(
"timeForAllFedsEB",
"timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
685 timingEEM_ =
new TH1F(
"timeForAllFedsEEM",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
686 timingEEP_ =
new TH1F(
"timeForAllFedsEEP",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
687 timingCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
702 string canvasTitle =
"Energy_Event"+lastPart;
703 energyCanvas_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
781 string canvasTitle =
"Timing_AllEvents";
782 timingEBAll_ =
new TH1F(
"timeForAllFedsEBAll",
"timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
783 timingEEMAll_ =
new TH1F(
"timeForAllFedsEEMAll",
"timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
784 timingEEPAll_ =
new TH1F(
"timeForAllFedsEEPAll",
"timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
785 timingCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
797 canvasTitle =
"Energy_AllEvents";
798 energyCanvasAll_ =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
837 std::string histName = histTypeName;
838 std::string histTitle = histTypeName;
839 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 };
840 double modEtaBins[10]={-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
841 double ttPhiBins[73];
842 double modPhiBins[19];
843 double timingBins[79];
844 for (
int i = 0;
i < 79; ++
i)
846 timingBins[
i]= 6 - 7. + double(
i) * 14. / 78.;
852 modPhiBins[
i]=1+20*
i;
859 histName = histName +
"EB";
860 histTitle = histTitle +
" EB";
862 histName = histName +
"Coarse";
863 histTitle = histTitle +
" by Module Nominal value = 6;iphi;ieta ";
864 hist =
new TH3F(histName.c_str(),histTitle.c_str(),18,modPhiBins,9,modEtaBins,78,timingBins);
867 histTitle = histTitle +
" by TT Nominal value = 6;iphi;ieta";
868 hist =
new TH3F(histName.c_str(),histTitle.c_str(),360/5,ttPhiBins,35,ttEtaBins,78,timingBins);
874 for(
int i=0;
i!=21;++
i) {
875 ttXBins[
i] = 1 + 5*
i;
876 ttYBins[
i] = 1 + 5*
i;
879 histName = histName +
"EEM";
880 histTitle = histTitle +
" EEM";
883 histName = histName +
"EEP";
884 histTitle = histTitle +
" EEP";
887 histName = histName +
"Coarse";
888 histTitle = histTitle +
" by Module Nominal value = 6;ix;iy";
889 hist =
new TH3F(histName.c_str(),histTitle.c_str(),20,ttXBins,20,ttYBins,78,timingBins);
892 histTitle = histTitle +
" by TT Nominal value = 6;ix;iy";
893 hist =
new TH3F(histName.c_str(),histTitle.c_str(),20,ttXBins,20,ttYBins,78,timingBins);
904 std::string histName = histTypeName;
905 std::string histTitle = histTypeName;
907 histName = histName +
"EB";
908 histTitle = histTitle +
" EB";
910 histName = histName +
"Coarse";
911 histTitle = histTitle +
" Coarse;iphi;ieta";
912 double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40,
913 -35, -30, -25, -20, -15, -10, -5, 0, 1, 6, 11, 16,
914 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86 };
915 hist =
new TH2F(histName.c_str(),histTitle.c_str(),360/5,1,361.,35,ttEtaBins);
918 histTitle = histTitle +
";iphi;ieta";
919 hist =
new TH2F(histName.c_str(),histTitle.c_str(),360,1,361.,172,-86,86);
924 histName = histName +
"EEM";
925 histTitle = histTitle +
" EEM";
928 histName = histName +
"EEP";
929 histTitle = histTitle +
" EEP";
932 histName = histName +
"Coarse";
933 histTitle = histTitle +
" Coarse;ix;iy";
934 hist =
new TH2F(histName.c_str(),histTitle.c_str(),20,1,101,20,1,101);
937 histTitle = histTitle +
";ix;iy";
938 hist =
new TH2F(histName.c_str(),histTitle.c_str(),100,1,101,100,1,101);
945 TCanvas*
canvas =
new TCanvas(canvasTitle.c_str(), canvasTitle.c_str(),300,60,500,200);
979 canvas->cd(1)->Divide(2,1);
980 canvas->cd(1)->cd(1);
984 canvas->cd(1)->cd(2);
987 canvas->SetCanvasSize(500,500);
988 canvas->SetFixedAspectRatio(
true);
994 canvas->cd(1)->Divide(2,1);
996 canvas->cd(1)->cd(1);
1001 hist2->Draw(
"colz");
1002 hist2->GetXaxis()->SetNdivisions(-18);
1003 hist2->GetYaxis()->SetNdivisions(2);
1004 canvas->GetPad(2)->SetGridx(1);
1005 canvas->GetPad(2)->SetGridy(1);
1007 canvas->cd(1)->cd(2);
1008 hist3->Draw(
"colz");
1011 canvas->SetCanvasSize(500,500);
1012 canvas->SetFixedAspectRatio(
true);
1019 TProfile2D* profile2 = (TProfile2D*) hist2->Project3DProfile(
"yx");
1020 profile2->Draw(
"colz");
1024 canvas->Divide(1,2);
1025 canvas->cd(1)->Divide(2,1);
1027 canvas->cd(1)->cd(1);
1028 TProfile2D* profile1 = (TProfile2D*) hist1->Project3DProfile(
"yx");
1029 profile1->Draw(
"colz");
1033 TProfile2D* profile2 = (TProfile2D*) hist2->Project3DProfile(
"yx");
1034 profile2->Draw(
"colz");
1035 profile2->GetXaxis()->SetNdivisions(-18);
1036 profile2->GetYaxis()->SetNdivisions(2);
1037 canvas->GetPad(2)->SetGridx(1);
1038 canvas->GetPad(2)->SetGridy(1);
1040 canvas->cd(1)->cd(2);
1041 TProfile2D* profile3 = (TProfile2D*) hist3->Project3DProfile(
"yx");
1042 profile3->Draw(
"colz");
1046 canvas->SetCanvasSize(500,500);
1047 canvas->SetFixedAspectRatio(
true);
1052 int nxb = profile->GetNbinsX();
1053 int nyb = profile->GetNbinsY();
1055 for(
int i=0;
i!=nxb;++
i) {
1056 for(
int j=0;
j!=nyb;++
j) {
1060 double xcorr = profile->GetBinCenter(xb);
1061 double ycorr = profile->GetBinCenter(yb);
1062 sprintf(tempErr,
"%0.2f",profile->GetBinError(xb,yb));
1063 int nBin = profile->GetBin(xb,yb,0);
1064 int nBinEntries = (int) profile->GetBinEntries(nBin);
1065 if(nBinEntries != 0) {
1066 TLatex* tex =
new TLatex(xcorr,ycorr,tempErr);
1067 tex->SetTextAlign(23);
1068 tex->SetTextSize(42);
1069 tex->SetTextSize(0.025);
1070 tex->SetLineWidth(2);
1074 sprintf(tempErr,
"%i",nBinEntries);
1075 if(nBinEntries!=0) {
1076 TLatex* tex =
new TLatex(xcorr,ycorr,tempErr);
1077 tex->SetTextAlign(21);
1078 tex->SetTextFont(42);
1079 tex->SetTextSize(0.025);
1080 tex->SetLineWidth(2);
1090 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};
1092 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};
1095 for (
int i=0;
i<202;
i++) {
1096 ixSectorsEE[
i] += 1;
1097 iySectorsEE[
i] += 1;
1103 for (
int i=0;
i<201;
i=
i+1) {
1104 if ( (ixSectorsEE[
i]!=1 || iySectorsEE[
i]!=1) &&
1105 (ixSectorsEE[
i+1]!=1 || iySectorsEE[
i+1]!=1) ) {
1106 l.DrawLine(ixSectorsEE[
i], iySectorsEE[i],
1107 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_