1 #ifndef HcalObjRepresent_h
2 #define HcalObjRepresent_h
26 namespace HcalObjRepresent{
29 unsigned int mask = 1<<31;
30 for (
unsigned short int i = 0;
i < 32; ++
i){
45 unsigned int statadd = 0x1<<(bitnumber);
46 return (status&statadd)?(
true):(
false);
52 for (
unsigned int i = 0;
i < 9; ++
i){
54 ss <<
"[" <<bitMap[
i]<<
"]" << statusBitArray[bitMap[
i]] <<
"; ";
66 for (
unsigned int i=0;
i<depth.size();++
i)
68 depth[
i].SetXTitle(
"i#eta");
69 depth[
i].SetYTitle(
"i#phi");
72 std::stringstream
label;
75 for (
int i=-41;
i<=-29;
i=
i+2)
78 depth[0].GetXaxis()->SetBinLabel(i+42,label.str().c_str());
79 depth[1].GetXaxis()->SetBinLabel(i+42,label.str().c_str());
82 depth[0].GetXaxis()->SetBinLabel(14,
"-29HE");
83 depth[1].GetXaxis()->SetBinLabel(14,
"-29HE");
86 for (
int i=-27;
i<=27;
i=
i+2)
89 depth[0].GetXaxis()->SetBinLabel(i+43,label.str().c_str());
92 depth[0].GetXaxis()->SetBinLabel(72,
"29HE");
93 for (
int i=29;
i<=41;
i=
i+2)
96 depth[0].GetXaxis()->SetBinLabel(i+44,label.str().c_str());
99 for (
int i=16;
i<=28;
i=
i+2)
102 depth[1].GetXaxis()->SetBinLabel(i,label.str().c_str());
105 depth[1].GetXaxis()->SetBinLabel(29,
"NULL");
106 for (
int i=15;
i<=27;
i=
i+2)
109 depth[1].GetXaxis()->SetBinLabel(i+15,label.str().c_str());
113 depth[1].GetXaxis()->SetBinLabel(44,
"29HE");
114 for (
int i=29;
i<=41;
i=
i+2)
117 depth[1].GetXaxis()->SetBinLabel(i+16,label.str().c_str());
122 depth[2].GetXaxis()->SetBinLabel(1,
"-28");
123 depth[2].GetXaxis()->SetBinLabel(2,
"-27");
124 depth[2].GetXaxis()->SetBinLabel(3,
"Null");
125 depth[2].GetXaxis()->SetBinLabel(4,
"-16");
126 depth[2].GetXaxis()->SetBinLabel(5,
"Null");
127 depth[2].GetXaxis()->SetBinLabel(6,
"16");
128 depth[2].GetXaxis()->SetBinLabel(7,
"Null");
129 depth[2].GetXaxis()->SetBinLabel(8,
"27");
130 depth[2].GetXaxis()->SetBinLabel(9,
"28");
135 const int binmapd2[]={-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,-32,-31,-30,
136 -29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
137 -16,-15,-9999, 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
138 30,31,32,33,34,35,36,37,38,39,40,41,42};
142 const int binmapd3[]={-28,-27,-9999,-16,-9999,16,-9999,27,28};
162 ieta < 0 ? etabin-- : etabin++;
189 if (ieta==-28) etabin=0;
190 else if (ieta==-27) etabin=1;
191 else if (ieta==-16) etabin=3;
192 else if (ieta==16) etabin=5;
193 else if (ieta==27) etabin=7;
194 else if (ieta==28) etabin=8;
214 if (ieta==0)
return -9999;
220 if (ieta==0)
return -9999;
221 if (ieta==17 || ieta == -17)
234 else if (eta>71) ieta--;
241 if (ieta<=-30) ieta++;
242 else if (ieta>=30) ieta--;
256 if (
abs(ieta)>29 ||
abs(ieta)<18)
return -9999;
257 if (ieta==0)
return -9999;
262 if (eta<0 || eta>8)
return -9999;
265 if (ieta==0)
return -9999;
277 if (
abs(ieta)>15)
return -9999;
278 if (ieta==0)
return -9999;
282 if (ieta==0)
return -9999;
294 if (eta<0)
return ieta;
299 else if (eta>71) ieta--;
300 if (ieta==0) ieta=-9999;
305 if (eta>57)
return -9999;
309 if (ieta==-9999)
return ieta;
310 if (ieta==0)
return -9999;
311 if (ieta==17 || ieta == -17)
return -9999;
312 else if (ieta<=-30) ieta++;
313 else if (ieta>=30) ieta--;
319 if (eta>8)
return -9999;
322 if (ieta==0)
return -9999;
328 if (
abs(ieta)>15)
return -9999;
329 if (ieta==0)
return -9999;
340 std::vector<std::string>
name;
341 name.push_back(
"HB HE HF Depth 1 ");
342 name.push_back(
"HB HE HF Depth 2 ");
343 name.push_back(
"HE Depth 3 ");
344 name.push_back(
"HO Depth 4 ");
351 if (depth>2)
return false;
352 else if (depth<1)
return false;
356 if (ieta==-9999)
return false;
359 if (
abs(ieta)<=16 )
return true;
364 if (
abs(ieta)==15 ||
abs(ieta)==16)
return true;
373 if (depth>3)
return false;
374 else if (depth<1)
return false;
378 if (ieta==-9999)
return false;
381 if (
abs(ieta)>=17 &&
abs(ieta)<=28 )
return true;
382 if (ieta==-29 && etabin==13)
return true;
383 if (ieta==29 && etabin == 71)
return true;
387 if (
abs(ieta)>=17 &&
abs(ieta)<=28 )
return true;
388 if (ieta==-29 && etabin==13)
return true;
389 if (ieta==29 && etabin == 43)
return true;
399 if (depth>2)
return false;
400 else if (depth<1)
return false;
404 if (ieta==-9999)
return false;
407 if (ieta==-29 && etabin==13)
return false;
408 else if (ieta==29 && etabin == 71)
return false;
409 else if (
abs(ieta)>=29 )
return true;
413 if (ieta==-29 && etabin==13)
return false;
414 else if (ieta==29 && etabin==43)
return false;
415 else if (
abs(ieta)>=29 )
return true;
423 if (depth!=4)
return false;
425 if (ieta!=-9999)
return true;
433 if (depth!=4)
return false;
435 if (ieta>=5 && ieta <=10 && iphi>=47 && iphi<=58)
return true;
437 if (ieta>=11 && ieta<=15 && iphi>=59 && iphi<=70)
return true;
449 const int ie (
abs( ies ) ) ;
451 return ( ( ip >= 1 ) &&
458 ( ( ( ie == 15 ) || ( ie == 16 ) ) &&
478 ( ip%2 == 1 ) ) ) ) ||
489 ( ip%4 == 3 ) ) ) ) ) ) ;
500 std::stringstream
label;
501 for (
int i=-41;
i<=-29;
i=
i+2)
504 h.GetXaxis()->SetBinLabel(i+42,label.str().c_str());
507 h.GetXaxis()->SetBinLabel(14,
"-29HE");
510 for (
int i=-27;
i<=27;
i=
i+2)
513 h.GetXaxis()->SetBinLabel(i+43,label.str().c_str());
516 h.GetXaxis()->SetBinLabel(72,
"29HE");
517 for (
int i=29;
i<=41;
i=
i+2)
520 h.GetXaxis()->SetBinLabel(i+44,label.str().c_str());
533 for (
unsigned int d=0;
d<3;++
d)
541 if (ieta==-9999 ||
abs(ieta)<21)
continue;
545 if (iphi%2==1 &&
abs(ieta)<40 && iphi<73)
547 hh[
d].SetBinContent(
eta+1,iphi+1,hh[
d].GetBinContent(
eta+1,iphi));
551 else if (
abs(ieta)>39 && iphi%4==3 && iphi<73)
554 hh[
d].SetBinContent(
eta+1,(iphi)%72+1, hh[
d].GetBinContent(
eta+1,iphi));
555 hh[
d].SetBinContent(
eta+1,(iphi+1)%72+1, hh[
d].GetBinContent(
eta+1,iphi));
556 hh[
d].SetBinContent(
eta+1,(iphi+2)%72+1, hh[
d].GetBinContent(
eta+1,iphi));
577 int etabins = hh.GetNbinsX();
578 int phibins = hh.GetNbinsY();
583 if (ieta==-9999 ||
abs(ieta)<21)
continue;
588 if (iphi%2==1 &&
abs(ieta)<40 && iphi<73)
590 binval=hh.GetBinContent(
eta+1,iphi);
591 hh.SetBinContent(
eta+1,iphi+1,binval);
593 else if (
abs(ieta)>39 && iphi%4==3 && iphi<73)
597 hh.SetBinContent(
eta+1, (iphi)%72+1, hh.GetBinContent(
eta+1,iphi));
598 hh.SetBinContent(
eta+1, (iphi+1)%72+1, hh.GetBinContent(
eta+1,iphi));
599 hh.SetBinContent(
eta+1, (iphi+2)%72+1, hh.GetBinContent(
eta+1,iphi));
615 depth[
id.depth()-1].Fill(
id.ieta()<0 ?
id.ieta()-1 :
id.ieta()+1,
id.iphi(), val);
617 depth[
id.depth()-1].Fill(
id.ieta(),
id.iphi(),val);
622 for (
unsigned int d=0;
d<depth.size();
d++)
633 unittitle =
"No Units";
637 unitname =
" " +
units;
644 depth.push_back(TH2F((
"HB HE HF Depth 1 "+name+unitname).c_str(),
645 (name+
" Depth 1 -- HB HE HF ("+unittitle+
")").c_str(),
651 for (
int i=0;
i<=72;
i++) ybins[
i]=(
float)(
i+0.5);
652 float xbinsd2[]={-42.5,-41.5,-40.5,-39.5,-38.5,-37.5,-36.5,-35.5,-34.5,-33.5,-32.5,-31.5,-30.5,-29.5,
653 -28.5,-27.5,-26.5,-25.5,-24.5,-23.5,-22.5,-21.5,-20.5,-19.5,-18.5,-17.5,-16.5,
656 16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,
657 31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5};
660 depth.push_back(TH2F((
"HB HE HF Depth 2 "+name+unitname).c_str(),
661 (name+
" Depth 2 -- HB HE HF ("+unittitle+
")").c_str(),
662 57, xbinsd2, 72, ybins));
665 float xbins[]={-28.5,-27.5,-26.5,-16.5,-15.5,
666 15.5,16.5,26.5,27.5,28.5};
668 depth.push_back(TH2F((
"HE Depth 3 "+name+unitname).c_str(),
669 (name+
" Depth 3 -- HE ("+unittitle+
")").c_str(),
671 9, xbins, 72, ybins));
674 depth.push_back(TH2F((
"HO Depth 4 "+name+unitname).c_str(),
675 (name+
" Depth 4 -- HO ("+unittitle+
")").c_str(),
679 for (
unsigned int i=0;
i<depth.size();++
i)
680 depth[
i].Draw(
"colz");
686 setup(graphData, name);
690 for (
unsigned int d=0;
d < graphData.size();++
d){
691 graphData[
d].Reset();
692 x <<
"Gain "<<
id <<
" for HCAL depth " <<
d+1;
696 graphData[
d].SetTitle(x.str().c_str());
701 int ieta,
depth, iphi;
708 HcalGains::tAllContWithNames::const_iterator
iter;
709 std::vector<HcalGain>::const_iterator contIter;
716 for (iter = allContainers.begin(); iter != allContainers.end(); ++
iter){
718 for (contIter = (*iter).second.begin(); contIter != (*iter).second.end(); ++contIter){
719 hcal_id =
HcalDetId((uint32_t)(*contIter).rawId());
721 depth = hcal_id.
depth();
722 if (depth<1 || depth>4)
729 ieta>0 ? ++ieta : --ieta;
732 gain = (*contIter).getValue(i);
736 graphData[depth-1].Fill(ieta,iphi, gain);
757 std::stringstream
ss(
"");
760 ss <<
rootname.str() <<
" for HCAL depth ";
762 ss <<
rootname.str() <<
nr <<
" for HCAL depth ";
764 setup(graphData, ss.str());
767 for (
unsigned int d=0;
d < graphData.size();++
d){
768 graphData[
d].Reset();
772 ss <<
plotname.str() <<
" for HCAL depth " <<
d+1;
774 ss <<
plotname.str() <<
nr <<
" for HCAL depth " <<
d+1;
779 graphData[
d].SetTitle(ss.str().c_str());
792 draw(graphData, ss.str());
803 virtual void doFillIn(std::vector<TH2F> &graphData) = 0;
810 gStyle->SetPalette(1);
811 const Int_t NCont = 999;
812 gStyle->SetNumberContours(NCont);
813 TCanvas
canvas(
"CC map",
"CC map",840,369*4);
815 TPad pad1(
"pad1",
"pad1", 0.0, 0.75, 1.0, 1.0);
817 TPad pad2(
"pad2",
"pad2", 0.0, 0.5, 1.0, 0.75);
819 TPad pad3(
"pad3",
"pad3", 0.0, 0.25, 1.0, 0.5);
821 TPad pad4(
"pad4",
"pad4", 0.0, 0.0, 1.0, 0.25);
826 graphData[0].SetStats(0);
827 graphData[0].Draw(
"colz");
830 graphData[1].SetStats(0);
831 graphData[1].Draw(
"colz");
834 graphData[2].SetStats(0);
835 graphData[2].Draw(
"colz");
838 graphData[3].SetStats(0);
839 graphData[3].Draw(
"colz");
841 canvas.SaveAs(filename.c_str());
849 unittitle =
"No Units";
853 unitname =
" " +
units;
860 depth.push_back(TH2F((
"HB HE HF Depth 1 "+name+unitname).c_str(),
861 (name+
" Depth 1 -- HB HE HF ("+unittitle+
")").c_str(),
867 for (
int i=0;
i<=72;
i++) ybins[
i]=(
float)(
i+0.5);
868 float xbinsd2[]={-42.5,-41.5,-40.5,-39.5,-38.5,-37.5,-36.5,-35.5,-34.5,-33.5,-32.5,-31.5,-30.5,-29.5,
869 -28.5,-27.5,-26.5,-25.5,-24.5,-23.5,-22.5,-21.5,-20.5,-19.5,-18.5,-17.5,-16.5,
872 16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,
873 31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5};
876 depth.push_back(TH2F((
"HB HE HF Depth 2 "+name+unitname).c_str(),
877 (name+
" Depth 2 -- HB HE HF ("+unittitle+
")").c_str(),
878 57, xbinsd2, 72, ybins));
881 float xbins[]={-28.5,-27.5,-26.5,-16.5,-15.5,
882 15.5,16.5,26.5,27.5,28.5};
884 depth.push_back(TH2F((
"HE Depth 3 "+name+unitname).c_str(),
885 (name+
" Depth 3 -- HE ("+unittitle+
")").c_str(),
887 9, xbins, 72, ybins));
890 depth.push_back(TH2F((
"HO Depth 4 "+name+unitname).c_str(),
891 (name+
" Depth 4 -- HO ("+unittitle+
")").c_str(),
895 for (
unsigned int i=0;
i<depth.size();++
i)
896 depth[
i].Draw(
"colz");
905 for (
unsigned int i=0;
i<depth.size();++
i)
907 depth[
i].SetXTitle(
"i#eta");
908 depth[
i].SetYTitle(
"i#phi");
911 std::stringstream
label;
914 for (
int i=-41;
i<=-29;
i=
i+2)
917 depth[0].GetXaxis()->SetBinLabel(i+42,label.str().c_str());
918 depth[1].GetXaxis()->SetBinLabel(i+42,label.str().c_str());
921 depth[0].GetXaxis()->SetBinLabel(14,
"-29HE");
922 depth[1].GetXaxis()->SetBinLabel(14,
"-29HE");
925 for (
int i=-27;
i<=27;
i=
i+2)
928 depth[0].GetXaxis()->SetBinLabel(i+43,label.str().c_str());
931 depth[0].GetXaxis()->SetBinLabel(72,
"29HE");
932 for (
int i=29;
i<=41;
i=
i+2)
935 depth[0].GetXaxis()->SetBinLabel(i+44,label.str().c_str());
938 for (
int i=16;
i<=28;
i=
i+2)
941 depth[1].GetXaxis()->SetBinLabel(i,label.str().c_str());
944 depth[1].GetXaxis()->SetBinLabel(29,
"NULL");
945 for (
int i=15;
i<=27;
i=
i+2)
948 depth[1].GetXaxis()->SetBinLabel(i+15,label.str().c_str());
952 depth[1].GetXaxis()->SetBinLabel(44,
"29HE");
953 for (
int i=29;
i<=41;
i=
i+2)
956 depth[1].GetXaxis()->SetBinLabel(i+16,label.str().c_str());
961 depth[2].GetXaxis()->SetBinLabel(1,
"-28");
962 depth[2].GetXaxis()->SetBinLabel(2,
"-27");
963 depth[2].GetXaxis()->SetBinLabel(3,
"Null");
964 depth[2].GetXaxis()->SetBinLabel(4,
"-16");
965 depth[2].GetXaxis()->SetBinLabel(5,
"Null");
966 depth[2].GetXaxis()->SetBinLabel(6,
"16");
967 depth[2].GetXaxis()->SetBinLabel(7,
"Null");
968 depth[2].GetXaxis()->SetBinLabel(8,
"27");
969 depth[2].GetXaxis()->SetBinLabel(9,
"28");
std::vector< std::string > HcalEtaPhiHistNames()
void SetEtaPhiLabels(TH2F &h)
HcalSubdetector subdet() const
get the subdetector
std::stringstream rootname
std::string getBitsSummary(uint32_t bits, std::string statusBitArray[], short unsigned int bitMap[])
bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
void setBinLabels(std::vector< TH2F > &depth)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
ADataRepr(unsigned int d)
bool isHE(int etabin, int depth)
std::string IntToBinary(unsigned int number)
bool isHB(int etabin, int depth)
int depth() const
get the tower depth
int CalcIeta(int subdet, int eta, int depth)
bool isSiPM(int ieta, int iphi, int depth)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual void doFillIn(std::vector< TH2F > &graphData)=0
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
int ieta() const
get the cell ieta
std::stringstream plotname
const bool isBitSet(unsigned int bitnumber, unsigned int status)
Abs< T >::type abs(const T &t)
void draw(std::vector< TH2F > &graphData, std::string filename)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void fillOneGain(std::vector< TH2F > &graphData, std::string units="")
int CalcEtaBin(int subdet, int ieta, int depth)
void fillOneGain(std::vector< TH2F > &graphData, HcalGains::tAllContWithNames &allContainers, std::string name, int id, std::string units="")
int iphi() const
get the cell iphi
bool isHF(int etabin, int depth)
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
std::stringstream filename
TString units(TString variable, Char_t axis)
bool isHO(int etabin, int depth)
void Reset(std::vector< TH2F > &depth)
void setBinLabels(std::vector< TH2F > &depth)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
std::vector< tHcalCont > tAllContWithNames