64 #include "TEfficiency.h" 68 #include "TGraphAsymmErrors.h" 74 #include "TObjString.h" 82 #define LOGPRINT edm::LogPrint("SiStripHitEffFromCalibTree") 103 std::unique_ptr<SiStripBadStrip> getNewObject()
override;
109 std::stringstream ssV[4][19],
110 int NBadComponent[4][19][4]);
111 void makeTKMap(
bool autoTagging);
112 void makeHotColdMaps();
114 void totalStatistics();
116 void makeSummaryVsBx();
117 void computeEff(vector<TH1F*>& vhfound, vector<TH1F*>& vhtotal,
string name);
118 void makeSummaryVsLumi();
119 void makeSummaryVsCM();
120 TString getLayerSideName(Long_t
k);
123 static constexpr
int siStripLayers_ = 22;
124 static constexpr
double nBxInAnOrbit_ = 3565;
163 map<pair<unsigned int, unsigned int>, array<double, 3> >
eventInfos;
167 map<unsigned int, pair<unsigned int, unsigned int> > modCounter[23];
185 int goodlayertotal[35];
186 int goodlayerfound[35];
187 int alllayertotal[35];
188 int alllayerfound[35];
232 ifstream badModules_file;
233 set<uint32_t> badModules_list;
236 uint32_t badmodule_detid;
237 int mods, fiber1, fiber2, fiber3;
238 if (badModules_file.is_open()) {
240 while (getline(badModules_file,
line)) {
241 if (badModules_file.eof())
244 ss >> badmodule_detid >>
mods >> fiber1 >> fiber2 >> fiber3;
245 if (badmodule_detid != 0 &&
mods == 1 && (fiber1 == 1 || fiber2 == 1 || fiber3 == 1))
246 badModules_list.insert(badmodule_detid);
248 badModules_file.close();
251 if (!badModules_list.empty())
252 LOGPRINT <<
"Remove additionnal bad modules from the analysis: ";
253 set<uint32_t>::iterator itBadMod;
254 for (
const auto& badMod : badModules_list) {
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));
294 fs->
make<TH1F>(Form(
"layerfound_vsCM_layer_%i", (
int)(ilayer)), lyrName.c_str(), 20, 0, 400));
296 fs->
make<TH1F>(Form(
"layertotal_vsCM_layer_%i", (
int)(ilayer)), lyrName.c_str(), 20, 0, 400));
305 LOGPRINT <<
"A module is bad if the upper limit on the efficiency is < to the avg in the layer - " <<
threshold_ 306 <<
" and has at least " <<
nModsMin_ <<
" nModsMin.";
308 unsigned int run, evt,
bx{0};
313 LOGPRINT <<
"Loading file: " << calibTreeFileName;
314 TFile* CalibTreeFile = TFile::Open(calibTreeFileName.c_str(),
"READ");
317 bool foundEventInfos =
false;
319 CalibTreeFile->cd(
"eventInfo");
323 TTree* EventTree = (TTree*)(gDirectory->Get(
"tree"));
331 LOGPRINT <<
"Found event infos tree";
333 runLf = EventTree->GetLeaf(
"run");
334 evtLf = EventTree->GetLeaf(
"event");
336 BunchLf = EventTree->GetLeaf(
"bx");
337 InstLumiLf = EventTree->GetLeaf(
"instLumi");
338 PULf = EventTree->GetLeaf(
"PU");
340 int nevt = EventTree->GetEntries();
342 foundEventInfos =
true;
344 for (
int j = 0;
j <
nevt;
j++) {
345 EventTree->GetEntry(
j);
346 run = runLf->GetValue();
347 evt = evtLf->GetValue();
348 bx = BunchLf->GetValue();
350 PU = PULf->GetValue();
361 CalibTreeFile->cd(
"anEff");
362 calibTree_ = (TTree*)(gDirectory->Get(
"traj"));
366 TLeaf* BadLf =
calibTree_->GetLeaf(
"ModIsBad");
367 TLeaf* sistripLf =
calibTree_->GetLeaf(
"SiStripQualBad");
369 TLeaf* acceptLf =
calibTree_->GetLeaf(
"withinAcceptance");
370 TLeaf* layerLf =
calibTree_->GetLeaf(
"layer");
372 TLeaf* highPurityLf =
calibTree_->GetLeaf(
"highPurity");
376 TLeaf* ResXSigLf =
calibTree_->GetLeaf(
"ResXSig");
377 TLeaf* TrajLocXLf =
calibTree_->GetLeaf(
"TrajLocX");
378 TLeaf* TrajLocYLf =
calibTree_->GetLeaf(
"TrajLocY");
379 TLeaf* ClusterLocXLf =
calibTree_->GetLeaf(
"ClusterLocX");
383 TLeaf* CMLf =
nullptr;
388 LOGPRINT <<
"Successfully loaded analyze function with " <<
nevents <<
" events!\n";
390 map<pair<unsigned int, unsigned int>, array<double, 3> >::iterator itEventInfos;
395 run = (
unsigned int)runLf->GetValue();
396 evt = (
unsigned int)evtLf->GetValue();
397 unsigned int isBad = (
unsigned int)BadLf->GetValue();
398 unsigned int quality = (
unsigned int)sistripLf->GetValue();
399 unsigned int id = (
unsigned int)idLf->GetValue();
400 unsigned int accept = (
unsigned int)acceptLf->GetValue();
401 unsigned int layer_wheel = (
unsigned int)layerLf->GetValue();
402 unsigned int layer = layer_wheel;
405 layer = 10 + ((
id >> 9) & 0x3);
407 layer = 13 + ((
id >> 5) & 0x7);
411 double x = xLf->GetValue();
412 double y = yLf->GetValue();
413 double z = zLf->GetValue();
414 double resxsig = ResXSigLf->GetValue();
415 double TrajLocX = TrajLocXLf->GetValue();
416 double TrajLocY = TrajLocYLf->GetValue();
417 double ClusterLocX = ClusterLocXLf->GetValue();
421 bool badquality =
false;
427 if (!foundEventInfos) {
428 bx = (
unsigned int)BunchLf->GetValue();
429 if (InstLumiLf !=
nullptr)
432 PU = PULf->GetValue();
436 CM = CMLf->GetValue();
439 if (foundEventInfos) {
442 bx = itEventInfos->second[0];
444 PU = itEventInfos->second[2];
467 itBadMod = badModules_list.find(
id);
468 if (itBadMod != badModules_list.end())
474 bool badflag =
false;
481 if (isBad == 1 || resxsig >
resXSig_)
489 if (resxsig == 1000.0) {
492 stripTrajMid = TrajLocX / Pitch + nstrips / 2.0;
495 DetId ClusterDetId(
id);
500 stripTrajMid = TrajLocX / Pitch + nstrips / 2.0;
511 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
512 std::array<const float, 4>
const&
parameters = (*trapezoidalBounds).parameters();
516 TrajLocXMid = TrajLocX / (1 + (htedge - hbedge) * TrajLocY / (htedge + hbedge) /
518 stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
522 if (!badquality &&
layer < 23) {
523 if (resxsig != 1000.0)
526 resolutionPlots[
layer]->Fill(1000);
532 float stripInAPV = 64.;
536 if (resxsig == 1000.0) {
547 tapv = (
int)stripTrajMid / 128;
549 stripInAPV = stripTrajMid - tapv * 128;
551 if (stripInAPV < stripsApvEdge_ || stripInAPV > 128 -
stripsApvEdge_)
559 if (badflag && !badquality) {
567 pair<unsigned int, unsigned int> newgoodpair(1, 1);
568 pair<unsigned int, unsigned int> newbadpair(1, 0);
570 map<unsigned int, pair<unsigned int, unsigned int> >::iterator it =
modCounter[
layer].find(
id);
578 ((*it).second.first)++;
580 ((*it).second.second)++;
610 if (((
id >> 13) & 0x3) == 1) {
614 }
else if (((
id >> 13) & 0x3) == 2) {
620 if (((
id >> 18) & 0x3) == 1) {
624 }
else if (((
id >> 18) & 0x3) == 2) {
637 if (((
id >> 13) & 0x3) == 1) {
641 }
else if (((
id >> 13) & 0x3) == 2) {
647 if (((
id >> 18) & 0x3) == 1) {
651 }
else if (((
id >> 18) & 0x3) == 2) {
674 int NTkBadComponent[4];
675 int NBadComponent[4][19][4];
679 std::stringstream ssV[4][19];
681 for (
int i = 0;
i < 4; ++
i) {
682 NTkBadComponent[
i] = 0;
683 for (
int j = 0;
j < 19; ++
j) {
685 for (
int k = 0;
k < 4; ++
k)
686 NBadComponent[
i][
j][
k] = 0;
692 for (
size_t i = 0;
i < BC.size(); ++
i) {
698 NTkBadComponent[0]++;
700 NTkBadComponent[1] += ((BC[
i].BadFibers >> 2) & 0
x1) + ((BC[
i].BadFibers >> 1) & 0
x1) + ((BC[
i].BadFibers) & 0
x1);
702 NTkBadComponent[2] += ((BC[
i].BadApvs >> 5) & 0
x1) + ((BC[
i].BadApvs >> 4) & 0
x1) + ((BC[
i].BadApvs >> 3) & 0
x1) +
703 ((BC[
i].BadApvs >> 2) & 0
x1) + ((BC[
i].BadApvs >> 1) & 0
x1) + ((BC[
i].BadApvs) & 0
x1);
724 component = tTopo.tidSide(BC[
i].detid) == 2 ? tTopo.tidWheel(BC[
i].detid) : tTopo.tidWheel(BC[
i].detid) + 3;
740 component = tTopo.tecSide(BC[
i].detid) == 2 ? tTopo.tecWheel(BC[
i].detid) : tTopo.tecWheel(BC[
i].detid) + 9;
748 float percentage = 0;
754 unsigned int detid = rp->detid;
759 if (
a.subdetId() == 3) {
762 }
else if (
a.subdetId() == 4) {
764 component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3;
765 }
else if (
a.subdetId() == 5) {
768 }
else if (
a.subdetId() == 6) {
770 component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9;
777 for (
int it = 0; it < sqrange.second - sqrange.first; it++) {
779 NTkBadComponent[3] +=
range;
780 NBadComponent[subdet][0][3] +=
range;
787 edm::LogError(
"SiStripQualityStatistics") <<
"PROBLEM detid " << detid <<
" value " << percentage << std::endl;
792 std::ostringstream
ss;
794 ss <<
"\n-----------------\nNew IOV starting from run " <<
e.id().run() <<
" event " <<
e.id().event()
795 <<
" lumiBlock " <<
e.luminosityBlock() <<
" time " <<
e.time().value() <<
"\n-----------------\n";
796 ss <<
"\n-----------------\nGlobal Info\n-----------------";
797 ss <<
"\nBadComponent \t Modules \tFibers " 798 "\tApvs\tStrips\n----------------------------------------------------------------";
799 ss <<
"\nTracker:\t\t" << NTkBadComponent[0] <<
"\t" << NTkBadComponent[1] <<
"\t" << NTkBadComponent[2] <<
"\t" 800 << NTkBadComponent[3];
801 ss <<
"\nTIB:\t\t\t" << NBadComponent[0][0][0] <<
"\t" << NBadComponent[0][0][1] <<
"\t" << NBadComponent[0][0][2]
802 <<
"\t" << NBadComponent[0][0][3];
803 ss <<
"\nTID:\t\t\t" << NBadComponent[1][0][0] <<
"\t" << NBadComponent[1][0][1] <<
"\t" << NBadComponent[1][0][2]
804 <<
"\t" << NBadComponent[1][0][3];
805 ss <<
"\nTOB:\t\t\t" << NBadComponent[2][0][0] <<
"\t" << NBadComponent[2][0][1] <<
"\t" << NBadComponent[2][0][2]
806 <<
"\t" << NBadComponent[2][0][3];
807 ss <<
"\nTEC:\t\t\t" << NBadComponent[3][0][0] <<
"\t" << NBadComponent[3][0][1] <<
"\t" << NBadComponent[3][0][2]
808 <<
"\t" << NBadComponent[3][0][3];
811 for (
int i = 1;
i < 5; ++
i)
812 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << NBadComponent[0][
i][0] <<
"\t" << NBadComponent[0][
i][1] <<
"\t" 813 << NBadComponent[0][
i][2] <<
"\t" << NBadComponent[0][
i][3];
815 for (
int i = 1;
i < 4; ++
i)
816 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 817 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
818 for (
int i = 4;
i < 7; ++
i)
819 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 820 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
822 for (
int i = 1;
i < 7; ++
i)
823 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << NBadComponent[2][
i][0] <<
"\t" << NBadComponent[2][
i][1] <<
"\t" 824 << NBadComponent[2][
i][2] <<
"\t" << NBadComponent[2][
i][3];
826 for (
int i = 1;
i < 10; ++
i)
827 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 828 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
829 for (
int i = 10;
i < 19; ++
i)
830 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 831 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
834 ss <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers " 835 "Apvs\n----------------------------------------------------------------";
836 for (
int i = 1;
i < 5; ++
i)
837 ss <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
839 for (
int i = 1;
i < 4; ++
i)
840 ss <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
841 for (
int i = 4;
i < 7; ++
i)
842 ss <<
"\nTID- Disk " <<
i - 3 <<
" :" << ssV[1][
i].
str();
844 for (
int i = 1;
i < 7; ++
i)
845 ss <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
847 for (
int i = 1;
i < 10; ++
i)
848 ss <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
849 for (
int i = 10;
i < 19; ++
i)
850 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :" << ssV[3][
i].
str();
856 badModules.open(
"BadModules.log");
857 badModules <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers " 858 "Apvs\n----------------------------------------------------------------";
859 for (
int i = 1;
i < 5; ++
i)
860 badModules <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
862 for (
int i = 1;
i < 4; ++
i)
863 badModules <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
864 for (
int i = 4;
i < 7; ++
i)
865 badModules <<
"\nTID- Disk " <<
i - 3 <<
" :" << ssV[1][
i].
str();
867 for (
int i = 1;
i < 7; ++
i)
868 badModules <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
870 for (
int i = 1;
i < 10; ++
i)
871 badModules <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
872 for (
int i = 10;
i < 19; ++
i)
873 badModules <<
"\nTEC- Disk " <<
i - 9 <<
" :" << ssV[3][
i].
str();
878 LOGPRINT <<
"Entering hot cold map generation!\n";
879 TStyle* gStyle =
new TStyle(
"gStyle",
"myStyle");
881 gStyle->SetPalette(1);
882 gStyle->SetCanvasColor(kWhite);
883 gStyle->SetOptStat(0);
888 for (Long_t maplayer = 1; maplayer <=
siStripLayers_; maplayer++) {
890 if (maplayer > 0 && maplayer <= 4) {
892 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TIB", (
int)(maplayer)),
"TIB", 100, -1, 361, 100, -100, 100);
893 temph2->GetXaxis()->SetTitle(
"Phi");
894 temph2->GetXaxis()->SetBinLabel(1, TString(
"360"));
895 temph2->GetXaxis()->SetBinLabel(50, TString(
"180"));
896 temph2->GetXaxis()->SetBinLabel(100, TString(
"0"));
897 temph2->GetYaxis()->SetTitle(
"Global Z");
898 temph2->SetOption(
"colz");
900 }
else if (maplayer > 4 && maplayer <= 10) {
902 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TOB", (
int)(maplayer - 4)),
"TOB", 100, -1, 361, 100, -120, 120);
903 temph2->GetXaxis()->SetTitle(
"Phi");
904 temph2->GetXaxis()->SetBinLabel(1, TString(
"360"));
905 temph2->GetXaxis()->SetBinLabel(50, TString(
"180"));
906 temph2->GetXaxis()->SetBinLabel(100, TString(
"0"));
907 temph2->GetYaxis()->SetTitle(
"Global Z");
908 temph2->SetOption(
"colz");
910 }
else if (maplayer > 10 && maplayer <= 13) {
913 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID-", (
int)(maplayer - 10)),
"TID-", 100, -100, 100, 100, -100, 100);
914 temph2->GetXaxis()->SetTitle(
"Global Y");
915 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
916 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
917 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
918 temph2->GetYaxis()->SetTitle(
"Global X");
919 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
920 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
921 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
922 temph2->SetOption(
"colz");
924 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID+", (
int)(maplayer - 10)),
"TID+", 100, -100, 100, 100, -100, 100);
925 temph2->GetXaxis()->SetTitle(
"Global Y");
926 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
927 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
928 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
929 temph2->GetYaxis()->SetTitle(
"Global X");
930 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
931 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
932 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
933 temph2->SetOption(
"colz");
935 }
else if (maplayer > 13) {
938 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC-", (
int)(maplayer - 13)),
"TEC-", 100, -120, 120, 100, -120, 120);
939 temph2->GetXaxis()->SetTitle(
"Global Y");
940 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
941 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
942 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
943 temph2->GetYaxis()->SetTitle(
"Global X");
944 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
945 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
946 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
947 temph2->SetOption(
"colz");
949 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC+", (
int)(maplayer - 13)),
"TEC+", 100, -120, 120, 100, -120, 120);
950 temph2->GetXaxis()->SetTitle(
"Global Y");
951 temph2->GetXaxis()->SetBinLabel(1, TString(
"+Y"));
952 temph2->GetXaxis()->SetBinLabel(50, TString(
"0"));
953 temph2->GetXaxis()->SetBinLabel(100, TString(
"-Y"));
954 temph2->GetYaxis()->SetTitle(
"Global X");
955 temph2->GetYaxis()->SetBinLabel(1, TString(
"-X"));
956 temph2->GetYaxis()->SetBinLabel(50, TString(
"0"));
957 temph2->GetYaxis()->SetBinLabel(100, TString(
"+X"));
958 temph2->SetOption(
"colz");
966 vector<hit>::const_iterator iter;
967 for (iter =
hits[mylayer].begin(); iter !=
hits[mylayer].end(); iter++) {
971 if (mylayer > 0 && mylayer <= 4) {
973 float phi = ::calcPhi(iter->x, iter->y);
975 }
else if (mylayer > 4 && mylayer <= 10) {
977 float phi = ::calcPhi(iter->x, iter->y);
979 }
else if (mylayer > 10 && mylayer <= 13) {
982 int side = (((iter->id) >> 13) & 0x3);
984 HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y, iter->x, 1.);
986 HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y, iter->x, 1.);
989 }
else if (mylayer > 13) {
992 int side = (((iter->id) >> 18) & 0x3);
994 HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y, iter->x, 1.);
996 HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y, iter->x, 1.);
1002 LOGPRINT <<
"Finished HotCold Map Generation\n";
1006 LOGPRINT <<
"Entering TKMap generation!\n";
1013 double myeff, mynum, myden, myeff_up;
1014 double layer_min_eff = 0;
1022 fs->
make<TH1F>(Form(
"eff_layer%i",
int(
i)), Form(
"Module efficiency in layer %i",
int(
i)), 201, 0, 1.005);
1027 mynum = (double)((ih.second).second);
1028 myden = (double)((ih.second).first);
1030 myeff = mynum / myden;
1033 hEffInLayer->Fill(myeff);
1041 <<
" efficiency: " << myeff <<
" , " << mynum <<
"/" << myden;
1048 <<
" efficiency: " << myeff <<
" , " << mynum <<
"/" << myden;
1051 <<
" is under occupancy at " << myden;
1068 hEffInLayer->GetXaxis()->SetRange(3, hEffInLayer->GetNbinsX() + 1);
1070 hEffInLayer->GetMean() - 2.5 * hEffInLayer->GetRMS();
1071 if (
threshold_ > 2.5 * hEffInLayer->GetRMS())
1072 layer_min_eff = hEffInLayer->GetMean() -
threshold_;
1073 LOGPRINT <<
"Layer " <<
i <<
" threshold for bad modules: <" << layer_min_eff
1074 <<
" (layer mean: " << hEffInLayer->GetMean() <<
" rms: " << hEffInLayer->GetRMS() <<
")";
1076 hEffInLayer->GetXaxis()->SetRange(1, hEffInLayer->GetNbinsX() + 1);
1080 mynum = (double)((ih.second).second);
1081 myden = (double)((ih.second).first);
1083 myeff = mynum / myden;
1087 myeff_up = TEfficiency::Bayesian(myden, mynum, .99, 1, 1,
true);
1088 if ((myden >=
nModsMin_) && (myeff_up < layer_min_eff)) {
1096 if (myeff_up < layer_min_eff + 0.08)
1098 <<
" efficiency: " << myeff <<
" , " << mynum <<
"/" << myden <<
" , upper limit: " << myeff_up;
1101 <<
" layer " <<
i <<
" is under occupancy at " << myden;
1106 tkmap->
save(
true, 0, 0,
"SiStripHitEffTKMap.png");
1107 tkmapbad->
save(
true, 0, 0,
"SiStripHitEffTKMapBad.png");
1109 tkmapnum->
save(
true, 0, 0,
"SiStripHitEffTKMapNum.png");
1110 tkmapden->
save(
true, 0, 0,
"SiStripHitEffTKMapDen.png");
1111 LOGPRINT <<
"Finished TKMap Generation\n";
1116 LOGPRINT <<
"Entering SQLite file generation!\n";
1117 std::vector<unsigned int> BadStripList;
1118 unsigned short NStrips;
1120 std::unique_ptr<SiStripQuality> pQuality = std::make_unique<SiStripQuality>(
detInfo_);
1128 LOGPRINT <<
"Number of strips module " << it.first <<
" is " << NStrips;
1129 BadStripList.push_back(pQuality->encode(0, NStrips, 0));
1131 id1 = (
unsigned int)it.first;
1132 LOGPRINT <<
"ID1 shoudl match list of modules above " <<
id1;
1136 BadStripList.clear();
1150 for (Long_t
i = 1;
i < 5;
i++) {
1165 if (
i >= 5 &&
i < 11) {
1169 if (
i >= 11 &&
i < 14) {
1179 LOGPRINT <<
"The total efficiency is " << double(totalfound) / double(totaltotal);
1180 LOGPRINT <<
" TIB: " << double(subdetfound[1]) / subdettotal[1] <<
" " << subdetfound[1] <<
"/" 1182 LOGPRINT <<
" TOB: " << double(subdetfound[2]) / subdettotal[2] <<
" " << subdetfound[2] <<
"/" 1184 LOGPRINT <<
" TID: " << double(subdetfound[3]) / subdettotal[3] <<
" " << subdetfound[3] <<
"/" 1186 LOGPRINT <<
" TEC: " << double(subdetfound[4]) / subdettotal[4] <<
" " << subdetfound[4] <<
"/" 1208 found->SetBinContent(0, -1);
1209 all->SetBinContent(0, 1);
1213 found->SetBinContent(
i, 1
e-6);
1214 all->SetBinContent(
i, 1);
1215 found2->SetBinContent(
i, 1
e-6);
1216 all2->SetBinContent(
i, 1);
1219 TCanvas* c7 =
new TCanvas(
"c7",
" test ", 10, 10, 800, 600);
1220 c7->SetFillColor(0);
1223 int nLayers_max =
nLayers + 1;
1226 for (Long_t
i = 1;
i < nLayers_max; ++
i) {
1243 for (Long_t
i = 11;
i < 14; ++
i) {
1258 LOGPRINT <<
"Fill only good modules layer " <<
i - 3
1280 TGraphAsymmErrors* gr =
fs->
make<TGraphAsymmErrors>(
nLayers + 1);
1281 gr->SetName(
"eff_good");
1284 TGraphAsymmErrors* gr2 =
fs->
make<TGraphAsymmErrors>(
nLayers + 1);
1285 gr2->SetName(
"eff_all");
1286 gr2->BayesDivide(found2, all2);
1289 gr->SetPointError(
j, 0., 0., gr->GetErrorYlow(
j), gr->GetErrorYhigh(
j));
1290 gr2->SetPointError(
j, 0., 0., gr2->GetErrorYlow(
j), gr2->GetErrorYhigh(
j));
1293 gr->GetXaxis()->SetLimits(0,
nLayers);
1294 gr->SetMarkerColor(2);
1295 gr->SetMarkerSize(1.2);
1296 gr->SetLineColor(2);
1297 gr->SetLineWidth(4);
1298 gr->SetMarkerStyle(20);
1300 gr->SetMaximum(1.001);
1301 gr->GetYaxis()->SetTitle(
"Efficiency");
1302 gStyle->SetTitleFillColor(0);
1303 gStyle->SetTitleBorderSize(0);
1306 gr2->GetXaxis()->SetLimits(0,
nLayers);
1307 gr2->SetMarkerColor(1);
1308 gr2->SetMarkerSize(1.2);
1309 gr2->SetLineColor(1);
1310 gr2->SetLineWidth(4);
1311 gr2->SetMarkerStyle(21);
1313 gr2->SetMaximum(1.001);
1314 gr2->GetYaxis()->SetTitle(
"Efficiency");
1333 gr->GetXaxis()->SetBinLabel(((
k + 1) * 100 + 2) / (
nLayers)-4,
label);
1334 gr2->GetXaxis()->SetBinLabel(((
k + 1) * 100 + 2) / (
nLayers)-4,
label);
1336 gr->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-6,
label);
1337 gr2->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-6,
label);
1341 gr->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-4,
label);
1342 gr2->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-4,
label);
1344 gr->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-7,
label);
1345 gr2->GetXaxis()->SetBinLabel((
k + 1) * 100 / (
nLayers)-7,
label);
1351 gr->GetXaxis()->SetNdivisions(36);
1354 TPad*
overlay =
new TPad(
"overlay",
"", 0, 0, 1, 1);
1357 overlay->SetFrameFillStyle(4000);
1363 TLegend* leg =
new TLegend(0.70, 0.27, 0.88, 0.40);
1364 leg->AddEntry(gr,
"Good Modules",
"p");
1366 leg->AddEntry(gr2,
"All Modules",
"p");
1367 leg->SetTextSize(0.020);
1368 leg->SetFillColor(0);
1371 c7->SaveAs(
"Summary.png");
1375 LOGPRINT <<
"Computing efficiency vs bx";
1381 for (
unsigned int ilayer = 1; ilayer <
nLayers; ilayer++) {
1388 layerfound_vsBX[ilayer]->SetBinContent(iterMapvsBx.first, iterMapvsBx.second[ilayer]);
1391 if (iterMapvsBx.second[ilayer] > 0) {
1392 layertotal_vsBX[ilayer]->SetBinContent(iterMapvsBx.first, iterMapvsBx.second[ilayer]);
1400 geff->SetName(Form(
"effVsBx_layer%i", ilayer));
1406 TGraphAsymmErrors* geff_avg =
fs->
make<TGraphAsymmErrors>();
1407 geff_avg->SetName(Form(
"effVsBxAvg_layer%i", ilayer));
1409 geff_avg->SetMarkerStyle(20);
1411 int previous_bx = -80;
1421 ibx = iterMapvsBx.first;
1422 delta_bx = ibx - previous_bx;
1427 geff_avg->SetPoint(ipt, sum_bx / nbx, eff);
1428 low = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
false);
1429 up = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
true);
1430 geff_avg->SetPointError(ipt, sum_bx / nbx - firstbx, previous_bx - sum_bx / nbx, eff -
low,
up - eff);
1448 geff_avg->SetPoint(ipt, sum_bx / nbx, eff);
1449 low = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
false);
1450 up = TEfficiency::Bayesian(
total,
found, .683, 1, 1,
true);
1451 geff_avg->SetPointError(ipt, sum_bx / nbx - firstbx, previous_bx - sum_bx / nbx, eff -
low,
up - eff);
1463 for (
unsigned int ilayer = 1; ilayer <
nLayers; ilayer++) {
1464 hfound = vhfound[ilayer];
1465 htotal = vhtotal[ilayer];
1471 for (Long_t
i = 0;
i < hfound->GetNbinsX() + 1; ++
i) {
1472 if (hfound->GetBinContent(
i) == 0)
1473 hfound->SetBinContent(
i, 1
e-6);
1474 if (htotal->GetBinContent(
i) == 0)
1475 htotal->SetBinContent(
i, 1);
1478 TGraphAsymmErrors* geff =
fs->
make<TGraphAsymmErrors>(hfound->GetNbinsX());
1479 geff->SetName(Form(
"%s_layer%i",
name.c_str(), ilayer));
1480 geff->BayesDivide(hfound, htotal);
1481 if (
name ==
"effVsLumi")
1484 if (
name ==
"effVsPU")
1486 if (
name ==
"effVsCM")
1489 geff->SetMarkerStyle(20);
1494 LOGPRINT <<
"Computing efficiency vs lumi";
1505 unsigned int nLayersForAvg = 0;
1506 float layerLumi = 0;
1511 LOGPRINT <<
"Lumi summary: (avg over trajectory measurements)";
1512 for (
unsigned int ilayer = 1; ilayer <
nLayers; ilayer++) {
1516 if (layerLumi != 0 && layerPU != 0) {
1517 avgLumi += layerLumi;
1522 avgLumi /= nLayersForAvg;
1523 avgPU /= nLayersForAvg;
1524 LOGPRINT <<
"Avg conditions: lumi :" << avgLumi <<
" pu: " << avgPU;
1532 LOGPRINT <<
"Computing efficiency vs CM";
1537 TString layername =
"";
1538 TString ringlabel =
"D";
1541 if (
k > 0 &&
k < 5) {
1542 layername = TString(
"TIB L") +
k;
1543 }
else if (
k > 4 &&
k < 11) {
1544 layername = TString(
"TOB L") + (
k - 4);
1545 }
else if (
k > 10 &&
k < 14) {
1546 layername = TString(
"TID- ") + ringlabel + (
k - 10);
1547 }
else if (
k > 13 &&
k < 17) {
1548 layername = TString(
"TID+ ") + ringlabel + (
k - 13);
1550 layername = TString(
"TEC- ") + ringlabel + (
k - 16);
1552 layername = TString(
"TEC+ ") + ringlabel + (
k - 16 -
nTEClayers);
1561 auto obj = std::make_unique<SiStripBadStrip>();
1566 for (; rIter != rIterEnd; ++rIter) {
1569 if (!
obj->put(rIter->detid,
range))
1571 <<
"[SiStripHitEffFromCalibTree::getNewObject] detid already exists" << std::endl;
1607 NBadComponent[
i][0][0]++;
map< unsigned int, double > BadModules
vector< TH2F * > HotColdMaps
static const std::string kSharedResource
bool showOnlyGoodModules_
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
std::string fullPath() const
edm::FileInPath fileInPath_
vector< TH1F * > layerfound_vsLumi
map< unsigned int, vector< int > > layerfound_perBx
static constexpr auto TID
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Registry::const_iterator RegistryIterator
map< pair< unsigned int, unsigned int >, array< double, 3 > > eventInfos
Log< level::Error, false > LogError
SiStripQuality * quality_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
static constexpr int siStripLayers_
const std::vector< BadComponent > & getBadComponentList() const
vector< TH1F * > layertotal_vsBX
bool autoIneffModTagging_
T getUntrackedParameter(std::string const &, T const &) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
def overlay(hists, ytitle, header, addon)
edm::Service< TFileService > fs
unsigned int clusterMatchingMethod_
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.
Abs< T >::type abs(const T &t)
vector< TH1F * > layerfound_vsPU
RegistryIterator getRegistryVectorEnd() const
#define DEFINE_FWK_MODULE(type)
void makeTKMap(bool autoTagging)
SiStripDetInfo read(std::string filePath)
static constexpr double nBxInAnOrbit_
vector< TH1F * > layerfound_vsBX
static constexpr auto TOB
void computeEff(vector< TH1F *> &vhfound, vector< TH1F *> &vhtotal, string name)
void fillc(int idmod, int RGBcode)
Detector identifier class for the strip tracker.
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
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.
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
unsigned int spaceBetweenTrains_
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
vector< string > calibTreeFileNames_
data decode(const unsigned int &value) const
T * make(const Args &...args) const
make new ROOT object
static constexpr char const *const kDefaultFile
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]
bool useOnlyHighPurityTracks_
const Bounds & bounds() const