64 #include "TEfficiency.h" 68 #include "TGraphAsymmErrors.h" 74 #include "TObjString.h" 82 #define LOGPRINT edm::LogPrint("SiStripHitEffFromCalibTree") 102 void algoEndJob()
override;
107 std::stringstream ssV[4][19],
108 int NBadComponent[4][19][4]);
109 void makeTKMap(
bool autoTagging);
110 void makeHotColdMaps();
112 void totalStatistics();
114 void makeSummaryVsBx();
115 void computeEff(vector<TH1F*>& vhfound, vector<TH1F*>& vhtotal,
string name);
116 void makeSummaryVsLumi();
117 void makeSummaryVsCM();
118 TString getLayerSideName(Long_t
k);
121 static constexpr
int SiStripLayers = 22;
127 std::unique_ptr<SiStripBadStrip> getNewObject()
override;
162 map<pair<unsigned int, unsigned int>, array<double, 3> >
eventInfos;
166 map<unsigned int, pair<unsigned int, unsigned int> > modCounter[23];
182 int goodlayertotal[35];
183 int goodlayerfound[35];
184 int alllayertotal[35];
185 int alllayerfound[35];
233 ifstream badModules_file;
234 set<uint32_t> badModules_list;
237 uint32_t badmodule_detid;
238 int mods, fiber1, fiber2, fiber3;
239 if (badModules_file.is_open()) {
241 while (getline(badModules_file,
line)) {
242 if (badModules_file.eof())
245 ss >> badmodule_detid >>
mods >> fiber1 >> fiber2 >> fiber3;
246 if (badmodule_detid != 0 &&
mods == 1 && (fiber1 == 1 || fiber2 == 1 || fiber3 == 1))
247 badModules_list.insert(badmodule_detid);
249 badModules_file.close();
252 if (!badModules_list.empty())
253 LOGPRINT <<
"Remove additionnal bad modules from the analysis: ";
254 set<uint32_t>::iterator itBadMod;
255 for (itBadMod = badModules_list.begin(); itBadMod != badModules_list.end(); ++itBadMod)
264 for (
int l = 0;
l < 35;
l++) {
271 TH1F* resolutionPlots[23];
272 for (Long_t ilayer = 0; ilayer < 23; ilayer++) {
275 resolutionPlots[ilayer] =
fs->
make<TH1F>(Form(
"resol_layer_%i", (
int)(ilayer)), lyrName.c_str(), 125, -125, 125);
276 resolutionPlots[ilayer]->GetXaxis()->SetTitle(
"trajX-clusX [strip unit]");
279 fs->
make<TH1F>(Form(
"layerfound_vsLumi_layer_%i", (
int)(ilayer)), lyrName.c_str(), 100, 0, 25000));
281 fs->
make<TH1F>(Form(
"layertotal_vsLumi_layer_%i", (
int)(ilayer)), lyrName.c_str(), 100, 0, 25000));
283 fs->
make<TH1F>(Form(
"layerfound_vsPU_layer_%i", (
int)(ilayer)), lyrName.c_str(), 45, 0, 90));
285 fs->
make<TH1F>(Form(
"layertotal_vsPU_layer_%i", (
int)(ilayer)), lyrName.c_str(), 45, 0, 90));
289 fs->
make<TH1F>(Form(
"layerfound_vsCM_layer_%i", (
int)(ilayer)), lyrName.c_str(), 20, 0, 400));
291 fs->
make<TH1F>(Form(
"layertotal_vsCM_layer_%i", (
int)(ilayer)), lyrName.c_str(), 20, 0, 400));
300 LOGPRINT <<
"A module is bad if the upper limit on the efficiency is < to the avg in the layer - " <<
threshold 301 <<
" and has at least " <<
nModsMin <<
" nModsMin.";
303 unsigned int run, evt,
bx{0};
312 bool foundEventInfos =
false;
314 CalibTreeFile->cd(
"eventInfo");
318 TTree* EventTree = (TTree*)(gDirectory->Get(
"tree"));
326 LOGPRINT <<
"Found event infos tree";
328 runLf = EventTree->GetLeaf(
"run");
329 evtLf = EventTree->GetLeaf(
"event");
331 BunchLf = EventTree->GetLeaf(
"bx");
332 InstLumiLf = EventTree->GetLeaf(
"instLumi");
333 PULf = EventTree->GetLeaf(
"PU");
335 int nevt = EventTree->GetEntries();
337 foundEventInfos =
true;
339 for (
int j = 0;
j <
nevt;
j++) {
340 EventTree->GetEntry(
j);
341 run = runLf->GetValue();
342 evt = evtLf->GetValue();
343 bx = BunchLf->GetValue();
345 PU = PULf->GetValue();
356 CalibTreeFile->cd(
"anEff");
357 CalibTree = (TTree*)(gDirectory->Get(
"traj"));
361 TLeaf* BadLf =
CalibTree->GetLeaf(
"ModIsBad");
362 TLeaf* sistripLf =
CalibTree->GetLeaf(
"SiStripQualBad");
364 TLeaf* acceptLf =
CalibTree->GetLeaf(
"withinAcceptance");
365 TLeaf* layerLf =
CalibTree->GetLeaf(
"layer");
367 TLeaf* highPurityLf =
CalibTree->GetLeaf(
"highPurity");
368 TLeaf* xLf =
CalibTree->GetLeaf(
"TrajGlbX");
369 TLeaf* yLf =
CalibTree->GetLeaf(
"TrajGlbY");
370 TLeaf* zLf =
CalibTree->GetLeaf(
"TrajGlbZ");
371 TLeaf* ResXSigLf =
CalibTree->GetLeaf(
"ResXSig");
372 TLeaf* TrajLocXLf =
CalibTree->GetLeaf(
"TrajLocX");
373 TLeaf* TrajLocYLf =
CalibTree->GetLeaf(
"TrajLocY");
374 TLeaf* ClusterLocXLf =
CalibTree->GetLeaf(
"ClusterLocX");
376 InstLumiLf =
CalibTree->GetLeaf(
"instLumi");
378 TLeaf* CMLf =
nullptr;
383 LOGPRINT <<
"Successfully loaded analyze function with " <<
nevents <<
" events!\n";
385 map<pair<unsigned int, unsigned int>, array<double, 3> >::iterator itEventInfos;
390 run = (
unsigned int)runLf->GetValue();
391 evt = (
unsigned int)evtLf->GetValue();
392 unsigned int isBad = (
unsigned int)BadLf->GetValue();
393 unsigned int quality = (
unsigned int)sistripLf->GetValue();
394 unsigned int id = (
unsigned int)idLf->GetValue();
395 unsigned int accept = (
unsigned int)acceptLf->GetValue();
396 unsigned int layer_wheel = (
unsigned int)layerLf->GetValue();
397 unsigned int layer = layer_wheel;
400 layer = 10 + ((
id >> 9) & 0x3);
402 layer = 13 + ((
id >> 5) & 0x7);
406 double x = xLf->GetValue();
407 double y = yLf->GetValue();
408 double z = zLf->GetValue();
409 double resxsig = ResXSigLf->GetValue();
410 double TrajLocX = TrajLocXLf->GetValue();
411 double TrajLocY = TrajLocYLf->GetValue();
412 double ClusterLocX = ClusterLocXLf->GetValue();
416 bool badquality =
false;
422 if (!foundEventInfos) {
423 bx = (
unsigned int)BunchLf->GetValue();
424 if (InstLumiLf !=
nullptr)
427 PU = PULf->GetValue();
431 CM = CMLf->GetValue();
434 if (foundEventInfos) {
437 bx = itEventInfos->second[0];
439 PU = itEventInfos->second[2];
462 itBadMod = badModules_list.find(
id);
463 if (itBadMod != badModules_list.end())
469 bool badflag =
false;
476 if (isBad == 1 || resxsig >
_ResXSig)
484 if (resxsig == 1000.0) {
487 stripTrajMid = TrajLocX / Pitch + nstrips / 2.0;
490 DetId ClusterDetId(
id);
495 stripTrajMid = TrajLocX / Pitch + nstrips / 2.0;
506 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
507 std::array<const float, 4>
const&
parameters = (*trapezoidalBounds).parameters();
511 TrajLocXMid = TrajLocX / (1 + (htedge - hbedge) * TrajLocY / (htedge + hbedge) /
513 stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
517 if (!badquality &&
layer < 23) {
518 if (resxsig != 1000.0)
521 resolutionPlots[
layer]->Fill(1000);
527 float stripInAPV = 64.;
531 if (resxsig == 1000.0) {
542 tapv = (
int)stripTrajMid / 128;
544 stripInAPV = stripTrajMid - tapv * 128;
546 if (stripInAPV < _stripsApvEdge || stripInAPV > 128 -
_stripsApvEdge)
554 if (badflag && !badquality) {
562 pair<unsigned int, unsigned int> newgoodpair(1, 1);
563 pair<unsigned int, unsigned int> newbadpair(1, 0);
565 map<unsigned int, pair<unsigned int, unsigned int> >::iterator it =
modCounter[
layer].find(
id);
573 ((*it).second.first)++;
575 ((*it).second.second)++;
605 if (((
id >> 13) & 0x3) == 1) {
609 }
else if (((
id >> 13) & 0x3) == 2) {
615 if (((
id >> 18) & 0x3) == 1) {
619 }
else if (((
id >> 18) & 0x3) == 2) {
632 if (((
id >> 13) & 0x3) == 1) {
636 }
else if (((
id >> 13) & 0x3) == 2) {
642 if (((
id >> 18) & 0x3) == 1) {
646 }
else if (((
id >> 18) & 0x3) == 2) {
669 int NTkBadComponent[4];
670 int NBadComponent[4][19][4];
674 std::stringstream ssV[4][19];
676 for (
int i = 0;
i < 4; ++
i) {
677 NTkBadComponent[
i] = 0;
678 for (
int j = 0;
j < 19; ++
j) {
680 for (
int k = 0;
k < 4; ++
k)
681 NBadComponent[
i][
j][
k] = 0;
687 for (
size_t i = 0;
i < BC.size(); ++
i) {
693 NTkBadComponent[0]++;
695 NTkBadComponent[1] += ((BC[
i].BadFibers >> 2) & 0
x1) + ((BC[
i].BadFibers >> 1) & 0
x1) + ((BC[
i].BadFibers) & 0
x1);
697 NTkBadComponent[2] += ((BC[
i].BadApvs >> 5) & 0
x1) + ((BC[
i].BadApvs >> 4) & 0
x1) + ((BC[
i].BadApvs >> 3) & 0
x1) +
698 ((BC[
i].BadApvs >> 2) & 0
x1) + ((BC[
i].BadApvs >> 1) & 0
x1) + ((BC[
i].BadApvs) & 0
x1);
719 component = tTopo.tidSide(BC[
i].detid) == 2 ? tTopo.tidWheel(BC[
i].detid) : tTopo.tidWheel(BC[
i].detid) + 3;
735 component = tTopo.tecSide(BC[
i].detid) == 2 ? tTopo.tecWheel(BC[
i].detid) : tTopo.tecWheel(BC[
i].detid) + 9;
743 float percentage = 0;
749 unsigned int detid = rp->detid;
754 if (
a.subdetId() == 3) {
757 }
else if (
a.subdetId() == 4) {
759 component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3;
760 }
else if (
a.subdetId() == 5) {
763 }
else if (
a.subdetId() == 6) {
765 component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9;
772 for (
int it = 0; it < sqrange.second - sqrange.first; it++) {
774 NTkBadComponent[3] +=
range;
775 NBadComponent[subdet][0][3] +=
range;
782 edm::LogError(
"SiStripQualityStatistics") <<
"PROBLEM detid " << detid <<
" value " << percentage << std::endl;
787 std::ostringstream
ss;
789 ss <<
"\n-----------------\nNew IOV starting from run " <<
e.id().run() <<
" event " <<
e.id().event()
790 <<
" lumiBlock " <<
e.luminosityBlock() <<
" time " <<
e.time().value() <<
"\n-----------------\n";
791 ss <<
"\n-----------------\nGlobal Info\n-----------------";
792 ss <<
"\nBadComponent \t Modules \tFibers " 793 "\tApvs\tStrips\n----------------------------------------------------------------";
794 ss <<
"\nTracker:\t\t" << NTkBadComponent[0] <<
"\t" << NTkBadComponent[1] <<
"\t" << NTkBadComponent[2] <<
"\t" 795 << NTkBadComponent[3];
796 ss <<
"\nTIB:\t\t\t" << NBadComponent[0][0][0] <<
"\t" << NBadComponent[0][0][1] <<
"\t" << NBadComponent[0][0][2]
797 <<
"\t" << NBadComponent[0][0][3];
798 ss <<
"\nTID:\t\t\t" << NBadComponent[1][0][0] <<
"\t" << NBadComponent[1][0][1] <<
"\t" << NBadComponent[1][0][2]
799 <<
"\t" << NBadComponent[1][0][3];
800 ss <<
"\nTOB:\t\t\t" << NBadComponent[2][0][0] <<
"\t" << NBadComponent[2][0][1] <<
"\t" << NBadComponent[2][0][2]
801 <<
"\t" << NBadComponent[2][0][3];
802 ss <<
"\nTEC:\t\t\t" << NBadComponent[3][0][0] <<
"\t" << NBadComponent[3][0][1] <<
"\t" << NBadComponent[3][0][2]
803 <<
"\t" << NBadComponent[3][0][3];
806 for (
int i = 1;
i < 5; ++
i)
807 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << NBadComponent[0][
i][0] <<
"\t" << NBadComponent[0][
i][1] <<
"\t" 808 << NBadComponent[0][
i][2] <<
"\t" << NBadComponent[0][
i][3];
810 for (
int i = 1;
i < 4; ++
i)
811 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 812 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
813 for (
int i = 4;
i < 7; ++
i)
814 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 815 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
817 for (
int i = 1;
i < 7; ++
i)
818 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << NBadComponent[2][
i][0] <<
"\t" << NBadComponent[2][
i][1] <<
"\t" 819 << NBadComponent[2][
i][2] <<
"\t" << NBadComponent[2][
i][3];
821 for (
int i = 1;
i < 10; ++
i)
822 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 823 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
824 for (
int i = 10;
i < 19; ++
i)
825 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 826 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
829 ss <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers " 830 "Apvs\n----------------------------------------------------------------";
831 for (
int i = 1;
i < 5; ++
i)
832 ss <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
834 for (
int i = 1;
i < 4; ++
i)
835 ss <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
836 for (
int i = 4;
i < 7; ++
i)
837 ss <<
"\nTID- Disk " <<
i - 3 <<
" :" << ssV[1][
i].
str();
839 for (
int i = 1;
i < 7; ++
i)
840 ss <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
842 for (
int i = 1;
i < 10; ++
i)
843 ss <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
844 for (
int i = 10;
i < 19; ++
i)
845 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :" << ssV[3][
i].
str();
851 badModules.open(
"BadModules.log");
852 badModules <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers " 853 "Apvs\n----------------------------------------------------------------";
854 for (
int i = 1;
i < 5; ++
i)
855 badModules <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
857 for (
int i = 1;
i < 4; ++
i)
858 badModules <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
859 for (
int i = 4;
i < 7; ++
i)
860 badModules <<
"\nTID- Disk " <<
i - 3 <<
" :" << ssV[1][
i].
str();
862 for (
int i = 1;
i < 7; ++
i)
863 badModules <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
865 for (
int i = 1;
i < 10; ++
i)
866 badModules <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
867 for (
int i = 10;
i < 19; ++
i)
868 badModules <<
"\nTEC- Disk " <<
i - 9 <<
" :" << ssV[3][
i].
str();
873 LOGPRINT <<
"Entering hot cold map generation!\n";
874 TStyle* gStyle =
new TStyle(
"gStyle",
"myStyle");
876 gStyle->SetPalette(1);
877 gStyle->SetCanvasColor(kWhite);
878 gStyle->SetOptStat(0);
883 for (Long_t maplayer = 1; maplayer <=
SiStripLayers; maplayer++) {
885 if (maplayer > 0 && maplayer <= 4) {
887 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TIB", (
int)(maplayer)),
"TIB", 100, -1, 361, 100, -100, 100);
888 temph2->GetXaxis()->SetTitle(
"Phi");
889 temph2->GetXaxis()->SetBinLabel(1, TString(
"360"));
890 temph2->GetXaxis()->SetBinLabel(50, TString(
"180"));
891 temph2->GetXaxis()->SetBinLabel(100, TString(
"0"));
892 temph2->GetYaxis()->SetTitle(
"Global Z");
893 temph2->SetOption(
"colz");
895 }
else if (maplayer > 4 && maplayer <= 10) {
897 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TOB", (
int)(maplayer - 4)),
"TOB", 100, -1, 361, 100, -120, 120);
898 temph2->GetXaxis()->SetTitle(
"Phi");
899 temph2->GetXaxis()->SetBinLabel(1, TString(
"360"));
900 temph2->GetXaxis()->SetBinLabel(50, TString(
"180"));
901 temph2->GetXaxis()->SetBinLabel(100, TString(
"0"));
902 temph2->GetYaxis()->SetTitle(
"Global Z");
903 temph2->SetOption(
"colz");
905 }
else if (maplayer > 10 && maplayer <= 13) {
908 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID-", (
int)(maplayer - 10)),
"TID-", 100, -100, 100, 100, -100, 100);
909 temph2->GetXaxis()->SetTitle(
"Global Y");
910 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
911 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
912 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
913 temph2->GetYaxis()->SetTitle(
"Global X");
914 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
915 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
916 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
917 temph2->SetOption(
"colz");
919 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID+", (
int)(maplayer - 10)),
"TID+", 100, -100, 100, 100, -100, 100);
920 temph2->GetXaxis()->SetTitle(
"Global Y");
921 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
922 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
923 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
924 temph2->GetYaxis()->SetTitle(
"Global X");
925 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
926 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
927 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
928 temph2->SetOption(
"colz");
930 }
else if (maplayer > 13) {
933 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC-", (
int)(maplayer - 13)),
"TEC-", 100, -120, 120, 100, -120, 120);
934 temph2->GetXaxis()->SetTitle(
"Global Y");
935 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
936 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
937 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
938 temph2->GetYaxis()->SetTitle(
"Global X");
939 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
940 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
941 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
942 temph2->SetOption(
"colz");
944 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC+", (
int)(maplayer - 13)),
"TEC+", 100, -120, 120, 100, -120, 120);
945 temph2->GetXaxis()->SetTitle(
"Global Y");
946 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
947 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
948 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
949 temph2->GetYaxis()->SetTitle(
"Global X");
950 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
951 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
952 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
953 temph2->SetOption(
"colz");
957 for (Long_t mylayer = 1; mylayer <=
SiStripLayers; mylayer++) {
961 vector<hit>::const_iterator iter;
962 for (iter =
hits[mylayer].begin(); iter !=
hits[mylayer].end(); iter++) {
966 if (mylayer > 0 && mylayer <= 4) {
968 float phi = ::calcPhi(iter->x, iter->y);
970 }
else if (mylayer > 4 && mylayer <= 10) {
972 float phi = ::calcPhi(iter->x, iter->y);
974 }
else if (mylayer > 10 && mylayer <= 13) {
977 int side = (((iter->id) >> 13) & 0x3);
979 HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y, iter->x, 1.);
981 HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y, iter->x, 1.);
984 }
else if (mylayer > 13) {
987 int side = (((iter->id) >> 18) & 0x3);
989 HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y, iter->x, 1.);
991 HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y, iter->x, 1.);
997 LOGPRINT <<
"Finished HotCold Map Generation\n";
1001 LOGPRINT <<
"Entering TKMap generation!\n";
1008 double myeff, mynum, myden, myeff_up;
1009 double layer_min_eff = 0;
1017 fs->
make<TH1F>(Form(
"eff_layer%i",
int(
i)), Form(
"Module efficiency in layer %i",
int(
i)), 201, 0, 1.005);
1019 map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
1023 mynum = (double)(((*ih).second).second);
1024 myden = (double)(((*ih).second).first);
1026 myeff = mynum / myden;
1029 hEffInLayer->Fill(myeff);
1037 <<
" efficiency: " << myeff <<
" , " << mynum <<
"/" << myden;
1044 <<
" efficiency: " << myeff <<
" , " << mynum <<
"/" << myden;
1047 <<
" is under occupancy at " << myden;
1064 hEffInLayer->GetXaxis()->SetRange(3, hEffInLayer->GetNbinsX() + 1);
1066 hEffInLayer->GetMean() - 2.5 * hEffInLayer->GetRMS();
1067 if (
threshold > 2.5 * hEffInLayer->GetRMS())
1068 layer_min_eff = hEffInLayer->GetMean() -
threshold;
1069 LOGPRINT <<
"Layer " <<
i <<
" threshold for bad modules: <" << layer_min_eff
1070 <<
" (layer mean: " << hEffInLayer->GetMean() <<
" rms: " << hEffInLayer->GetRMS() <<
")";
1072 hEffInLayer->GetXaxis()->SetRange(1, hEffInLayer->GetNbinsX() + 1);
1076 mynum = (double)(((*ih).second).second);
1077 myden = (double)(((*ih).second).first);
1079 myeff = mynum / myden;
1083 myeff_up = TEfficiency::Bayesian(myden, mynum, .99, 1, 1,
true);
1084 if ((myden >=
nModsMin) && (myeff_up < layer_min_eff)) {
1092 if (myeff_up < layer_min_eff + 0.08)
1094 <<
" efficiency: " << myeff <<
" , " << mynum <<
"/" << myden <<
" , upper limit: " << myeff_up;
1097 <<
" layer " <<
i <<
" is under occupancy at " << myden;
1102 tkmap->
save(
true, 0, 0,
"SiStripHitEffTKMap.png");
1103 tkmapbad->
save(
true, 0, 0,
"SiStripHitEffTKMapBad.png");
1105 tkmapnum->
save(
true, 0, 0,
"SiStripHitEffTKMapNum.png");
1106 tkmapden->
save(
true, 0, 0,
"SiStripHitEffTKMapDen.png");
1107 LOGPRINT <<
"Finished TKMap Generation\n";
1112 LOGPRINT <<
"Entering SQLite file generation!\n";
1113 std::vector<unsigned int> BadStripList;
1114 unsigned short NStrips;
1116 std::unique_ptr<SiStripQuality> pQuality = std::make_unique<SiStripQuality>(
_detInfo);
1120 map<unsigned int, double>::const_iterator it;
1125 LOGPRINT <<
"Number of strips module " << (*it).first <<
" is " << NStrips;
1126 BadStripList.push_back(pQuality->encode(0, NStrips, 0));
1128 id1 = (
unsigned int)(*it).first;
1129 LOGPRINT <<
"ID1 shoudl match list of modules above " <<
id1;
1133 BadStripList.clear();
1147 for (Long_t
i = 1;
i < 5;
i++) {
1162 if (
i >= 5 &&
i < 11) {
1166 if (
i >= 11 &&
i < 14) {
1176 LOGPRINT <<
"The total efficiency is " << double(totalfound) / double(totaltotal);
1177 LOGPRINT <<
" TIB: " << double(subdetfound[1]) / subdettotal[1] <<
" " << subdetfound[1] <<
"/" 1179 LOGPRINT <<
" TOB: " << double(subdetfound[2]) / subdettotal[2] <<
" " << subdetfound[2] <<
"/" 1181 LOGPRINT <<
" TID: " << double(subdetfound[3]) / subdettotal[3] <<
" " << subdetfound[3] <<
"/" 1183 LOGPRINT <<
" TEC: " << double(subdetfound[4]) / subdettotal[4] <<
" " << subdetfound[4] <<
"/" 1205 found->SetBinContent(0, -1);
1206 all->SetBinContent(0, 1);
1210 found->SetBinContent(
i, 1
e-6);
1211 all->SetBinContent(
i, 1);
1212 found2->SetBinContent(
i, 1
e-6);
1213 all2->SetBinContent(
i, 1);
1216 TCanvas* c7 =
new TCanvas(
"c7",
" test ", 10, 10, 800, 600);
1217 c7->SetFillColor(0);
1220 int nLayers_max =
nLayers + 1;
1223 for (Long_t
i = 1;
i < nLayers_max; ++
i) {
1240 for (Long_t
i = 11;
i < 14; ++
i) {
1255 LOGPRINT <<
"Fill only good modules layer " <<
i - 3
1277 TGraphAsymmErrors* gr =
fs->
make<TGraphAsymmErrors>(
nLayers + 1);
1278 gr->SetName(
"eff_good");
1281 TGraphAsymmErrors* gr2 =
fs->
make<TGraphAsymmErrors>(
nLayers + 1);
1282 gr2->SetName(
"eff_all");
1283 gr2->BayesDivide(found2, all2);
1286 gr->SetPointError(
j, 0., 0., gr->GetErrorYlow(
j), gr->GetErrorYhigh(
j));
1287 gr2->SetPointError(
j, 0., 0., gr2->GetErrorYlow(
j), gr2->GetErrorYhigh(
j));
1290 gr->GetXaxis()->SetLimits(0,
nLayers);
1291 gr->SetMarkerColor(2);
1292 gr->SetMarkerSize(1.2);
1293 gr->SetLineColor(2);
1294 gr->SetLineWidth(4);
1295 gr->SetMarkerStyle(20);
1297 gr->SetMaximum(1.001);
1298 gr->GetYaxis()->SetTitle(
"Efficiency");
1299 gStyle->SetTitleFillColor(0);
1300 gStyle->SetTitleBorderSize(0);
1303 gr2->GetXaxis()->SetLimits(0,
nLayers);
1304 gr2->SetMarkerColor(1);
1305 gr2->SetMarkerSize(1.2);
1306 gr2->SetLineColor(1);
1307 gr2->SetLineWidth(4);
1308 gr2->SetMarkerStyle(21);
1310 gr2->SetMaximum(1.001);
1311 gr2->GetYaxis()->SetTitle(
"Efficiency");
1330 gr->GetXaxis()->SetBinLabel(((
k + 1) * 100 + 2) / (
nLayers)-4,
label);
1331 gr2->GetXaxis()->SetBinLabel(((
k + 1) * 100 + 2) / (
nLayers)-4,
label);
1333 gr->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-6,
label);
1334 gr2->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-6,
label);
1338 gr->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-4,
label);
1339 gr2->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-4,
label);
1341 gr->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-7,
label);
1342 gr2->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-7,
label);
1348 gr->GetXaxis()->SetNdivisions(36);
1351 TPad*
overlay =
new TPad(
"overlay",
"", 0, 0, 1, 1);
1354 overlay->SetFrameFillStyle(4000);
1360 TLegend* leg =
new TLegend(0.70, 0.27, 0.88, 0.40);
1361 leg->AddEntry(gr,
"Good Modules",
"p");
1363 leg->AddEntry(gr2,
"All Modules",
"p");
1364 leg->SetTextSize(0.020);
1365 leg->SetFillColor(0);
1368 c7->SaveAs(
"Summary.png");
1372 LOGPRINT <<
"Computing efficiency vs bx";
1378 for (
unsigned int ilayer = 1; ilayer <
nLayers; ilayer++) {
1379 TH1F* hfound =
fs->
make<TH1F>(Form(
"foundVsBx_layer%i", ilayer), Form(
"layer %i", ilayer), 3565, 0, 3565);
1380 TH1F* htotal =
fs->
make<TH1F>(Form(
"totalVsBx_layer%i", ilayer), Form(
"layer %i", ilayer), 3565, 0, 3565);
1382 for (
unsigned int ibx = 0; ibx < 3566; ibx++) {
1383 hfound->SetBinContent(ibx, 1
e-6);
1384 htotal->SetBinContent(ibx, 1);
1386 map<unsigned int, vector<int> >::iterator iterMapvsBx;
1388 hfound->SetBinContent(iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1390 if (iterMapvsBx->second[ilayer] > 0)
1391 htotal->SetBinContent(iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1396 TGraphAsymmErrors* geff =
fs->
make<TGraphAsymmErrors>(3564);
1397 geff->SetName(Form(
"effVsBx_layer%i", ilayer));
1399 geff->BayesDivide(hfound, htotal);
1402 TGraphAsymmErrors* geff_avg =
fs->
make<TGraphAsymmErrors>();
1403 geff_avg->SetName(Form(
"effVsBxAvg_layer%i", ilayer));
1405 geff_avg->SetMarkerStyle(20);
1407 int previous_bx = -80;
1417 ibx = iterMapvsBx->first;
1418 delta_bx = ibx - previous_bx;
1423 geff_avg->SetPoint(ipt, sum_bx / nbx, eff);
1424 low = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
false);
1425 up = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
true);
1426 geff_avg->SetPointError(ipt, sum_bx / nbx - firstbx, previous_bx - sum_bx / nbx, eff -
low,
up - eff);
1435 found += hfound->GetBinContent(ibx);
1436 total += htotal->GetBinContent(ibx);
1444 geff_avg->SetPoint(ipt, sum_bx / nbx, eff);
1445 low = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
false);
1446 up = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
true);
1447 geff_avg->SetPointError(ipt, sum_bx / nbx - firstbx, previous_bx - sum_bx / nbx, eff -
low,
up - eff);
1459 for (
unsigned int ilayer = 1; ilayer <
nLayers; ilayer++) {
1460 hfound = vhfound[ilayer];
1461 htotal = vhtotal[ilayer];
1467 for (Long_t
i = 0;
i < hfound->GetNbinsX() + 1; ++
i) {
1468 if (hfound->GetBinContent(
i) == 0)
1469 hfound->SetBinContent(
i, 1
e-6);
1470 if (htotal->GetBinContent(
i) == 0)
1471 htotal->SetBinContent(
i, 1);
1474 TGraphAsymmErrors* geff =
fs->
make<TGraphAsymmErrors>(hfound->GetNbinsX());
1475 geff->SetName(Form(
"%s_layer%i",
name.c_str(), ilayer));
1476 geff->BayesDivide(hfound, htotal);
1477 if (
name ==
"effVsLumi")
1480 if (
name ==
"effVsPU")
1482 if (
name ==
"effVsCM")
1485 geff->SetMarkerStyle(20);
1490 LOGPRINT <<
"Computing efficiency vs lumi";
1501 unsigned int nLayersForAvg = 0;
1502 float layerLumi = 0;
1507 LOGPRINT <<
"Lumi summary: (avg over trajectory measurements)";
1508 for (
unsigned int ilayer = 1; ilayer <
nLayers; ilayer++) {
1512 if (layerLumi != 0 && layerPU != 0) {
1513 avgLumi += layerLumi;
1518 avgLumi /= nLayersForAvg;
1519 avgPU /= nLayersForAvg;
1520 LOGPRINT <<
"Avg conditions: lumi :" << avgLumi <<
" pu: " << avgPU;
1528 LOGPRINT <<
"Computing efficiency vs CM";
1533 TString layername =
"";
1534 TString ringlabel =
"D";
1537 if (
k > 0 &&
k < 5) {
1538 layername = TString(
"TIB L") +
k;
1539 }
else if (
k > 4 &&
k < 11) {
1540 layername = TString(
"TOB L") + (
k - 4);
1541 }
else if (
k > 10 &&
k < 14) {
1542 layername = TString(
"TID- ") + ringlabel + (
k - 10);
1543 }
else if (
k > 13 &&
k < 17) {
1544 layername = TString(
"TID+ ") + ringlabel + (
k - 13);
1546 layername = TString(
"TEC- ") + ringlabel + (
k - 16);
1548 layername = TString(
"TEC+ ") + ringlabel + (
k - 16 -
nTEClayers);
1557 auto obj = std::make_unique<SiStripBadStrip>();
1562 for (; rIter != rIterEnd; ++rIter) {
1565 if (!
obj->put(rIter->detid,
range))
1567 <<
"[SiStripHitEffFromCalibTree::getNewObject] detid already exists" << std::endl;
1603 NBadComponent[
i][0][0]++;
map< unsigned int, double > BadModules
vector< TH2F * > HotColdMaps
static const std::string kSharedResource
map< unsigned int, vector< int > > layertotal_perBx
virtual int nstrips() const =0
void setBadComponents(int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
ContainerIterator getDataVectorBegin() const
T getParameter(std::string const &) const
std::unique_ptr< SiStripBadStrip > getNewObject() override
vector< TH1F * > layerfound_vsCM
static constexpr int SiStripLayers
constexpr char const * layerName[numberOfLayers]
std::string fullPath() const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > _tTopoToken
vector< TH1F * > layerfound_vsLumi
map< unsigned int, vector< int > > layerfound_perBx
static constexpr auto TID
#define DEFINE_FWK_MODULE(type)
Registry::const_iterator RegistryIterator
map< pair< unsigned int, unsigned int >, array< double, 3 > > eventInfos
Log< level::Error, false > LogError
SiStripQuality * quality_
unsigned int _spaceBetweenTrains
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
const std::vector< BadComponent > & getBadComponentList() const
constexpr std::array< uint8_t, layerIndexSize > layer
T getUntrackedParameter(std::string const &, T const &) const
def overlay(hists, ytitle, header, addon)
unsigned int _clusterMatchingMethod
edm::Service< TFileService > fs
void algoBeginJob(const edm::EventSetup &) override
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
void compact(uint32_t detid, std::vector< unsigned int > &)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
edm::FileInPath FileInPath_
Abs< T >::type abs(const T &t)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > _tkGeomToken
vector< TH1F * > layerfound_vsPU
RegistryIterator getRegistryVectorEnd() const
void makeTKMap(bool autoTagging)
SiStripDetInfo read(std::string filePath)
static constexpr auto TOB
bool _autoIneffModTagging
void computeEff(vector< TH1F *> &vhfound, vector< TH1F *> &vhtotal, string name)
void fillc(int idmod, int RGBcode)
Detector identifier class for the strip tracker.
bool _showOnlyGoodModules
void setBadComponents(int i, int component, const SiStripQuality::BadComponent &BC, int NBadComponent[4][19][4])
const Plane & surface() const
The nominal surface of the GeomDet.
bool _useOnlyHighPurityTracks
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void algoEndJob() override
static constexpr auto TIB
vector< TH1F * > layertotal_vsCM
void algoAnalyze(const edm::Event &e, const edm::EventSetup &c) override
std::pair< ContainerIterator, ContainerIterator > Range
vector< TH1F * > layertotal_vsPU
data decode(const unsigned int &value) const
T * make(const Args &...args) const
make new ROOT object
static constexpr char const *const kDefaultFile
vector< string > CalibTreeFilenames
bool put(const uint32_t &detID, const InputVector &vect)
virtual float width() const =0
RegistryIterator getRegistryVectorBegin() const
SiStripHitEffFromCalibTree(const edm::ParameterSet &)
void fill(int layer, int ring, int nmod, float x)
static constexpr auto TEC
TString getLayerSideName(Long_t k)
vector< TH1F * > layertotal_vsLumi
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[23]
const Bounds & bounds() const