66 #include "TObjString.h"
78 #include "TGraphAsymmErrors.h"
81 #include "TEfficiency.h"
100 virtual void algoBeginJob();
101 virtual void algoEndJob()
override;
105 void makeHotColdMaps();
107 void totalStatistics();
109 void makeSummaryVsBx();
110 TString GetLayerName(Long_t
k);
111 TString GetLayerSideName(Long_t k);
112 float calcPhi(
float x,
float y);
141 vector<hit> hits[23];
143 map< unsigned int, pair< unsigned int, unsigned int> > modCounter[23];
153 int goodlayertotal[35];
154 int goodlayerfound[35];
155 int alllayertotal[35];
156 int alllayerfound[35];
162 FileInPath_(
"CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")
184 if(_showRings) nTEClayers = 7;
213 ifstream badModules_file;
214 set<uint32_t> badModules_list;
217 uint32_t badmodule_detid;
218 int mods, fiber1, fiber2, fiber3;
219 if(badModules_file.is_open()) {
221 while ( getline (badModules_file,line) ) {
222 if(badModules_file.eof())
continue;
223 stringstream
ss(line);
224 ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
225 if(badmodule_detid!=0 && mods==1 && (fiber1==1 || fiber2==1 || fiber3==1) )
226 badModules_list.insert(badmodule_detid);
228 badModules_file.close();
231 if(badModules_list.size())
cout<<
"Remove additionnal bad modules from the analysis: "<<endl;
232 set<uint32_t>::iterator itBadMod;
233 for (itBadMod=badModules_list.begin(); itBadMod!=badModules_list.end(); ++itBadMod)
234 cout<<
" "<<*itBadMod<<endl;
240 TLeaf* BadLf =
CalibTree->GetLeaf(
"ModIsBad");
241 TLeaf* sistripLf =
CalibTree->GetLeaf(
"SiStripQualBad");
243 TLeaf* acceptLf =
CalibTree->GetLeaf(
"withinAcceptance");
244 TLeaf* layerLf =
CalibTree->GetLeaf(
"layer");
245 TLeaf* nHitsLf =
CalibTree->GetLeaf(
"nHits");
246 TLeaf* xLf =
CalibTree->GetLeaf(
"TrajGlbX");
247 TLeaf* yLf =
CalibTree->GetLeaf(
"TrajGlbY");
248 TLeaf* zLf =
CalibTree->GetLeaf(
"TrajGlbZ");
249 TLeaf* ResXSigLf =
CalibTree->GetLeaf(
"ResXSig");
250 TLeaf* TrajLocXLf =
CalibTree->GetLeaf(
"TrajLocX");
251 TLeaf* TrajLocYLf =
CalibTree->GetLeaf(
"TrajLocY");
252 TLeaf* ClusterLocXLf =
CalibTree->GetLeaf(
"ClusterLocX");
253 TLeaf* BunchLf =
CalibTree->GetLeaf(
"bunchx");
254 for(
int l=0;
l < 35;
l++) {
262 cout <<
"Successfully loaded analyze function with " << nevents <<
" events!\n";
263 cout <<
"A module is bad if efficiency < " <<
threshold <<
" and has at least " <<
nModsMin <<
" nModsMin." << endl;
265 TH1F* resolutionPlots[23];
266 for(Long_t ilayer = 0; ilayer <23; ilayer++) {
267 resolutionPlots[ilayer] =
fs->
make<TH1F>(Form(
"resol_layer_%i",(
int)(ilayer)),
GetLayerName(ilayer),125,-125,125);
268 resolutionPlots[ilayer]->GetXaxis()->SetTitle(
"trajX-clusX [strip unit]");
274 unsigned int isBad = (
unsigned int)BadLf->GetValue();
275 unsigned int quality = (
unsigned int)sistripLf->GetValue();
276 unsigned int id = (
unsigned int)idLf->GetValue();
277 unsigned int accept = (
unsigned int)acceptLf->GetValue();
278 unsigned int layer_wheel = (
unsigned int)layerLf->GetValue();
279 unsigned int layer = layer_wheel;
281 if(layer<14) layer = 10 + ((
id>>9)&0x3);
282 else layer = 13 + ((
id>>5)&0x7);
284 unsigned int nHits = (
unsigned int)nHitsLf->GetValue();
285 double x = xLf->GetValue();
286 double y = yLf->GetValue();
287 double z = zLf->GetValue();
288 double resxsig = ResXSigLf->GetValue();
289 double TrajLocX = TrajLocXLf->GetValue();
290 double TrajLocY = TrajLocYLf->GetValue();
291 double ClusterLocX = ClusterLocXLf->GetValue();
295 bool badquality =
false;
296 unsigned int bx = (
unsigned int)BunchLf->GetValue();
303 if(accept != 1 || nHits < 8)
continue;
304 if(quality == 1) badquality =
true;
307 if(!
_showTOB6TEC9 && (layer_wheel==10 || layer_wheel==22))
continue;
310 itBadMod = badModules_list.find(
id);
311 if(itBadMod!=badModules_list.end())
continue;
317 bool badflag =
false;
321 if(isBad == 1) badflag =
true;
324 if(isBad == 1 || resxsig >
_ResXSig) badflag =
true;
331 if (resxsig==1000.0) {
334 stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
335 stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
338 DetId ClusterDetId(
id);
343 stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
344 stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
353 const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
354 std::array<const float, 4>
const &
parameters = (*trapezoidalBounds).parameters();
355 hbedge = parameters[0];
356 htedge = parameters[1];
357 hapoth = parameters[3];
358 TrajLocXMid = TrajLocX / (1 + (htedge-hbedge)*TrajLocY/(htedge+hbedge)/hapoth) ;
359 stripTrajMid = TrajLocXMid/Pitch + nstrips/2.0 ;
364 if(!badquality && layer<23) {
365 if(resxsig!=1000.0) resolutionPlots[layer]->Fill(stripTrajMid-stripCluster);
366 else resolutionPlots[layer]->Fill(1000);
373 float stripInAPV = 64.;
377 if(resxsig == 1000.0) {
385 tapv = (int) stripTrajMid/128;
386 capv = (int) stripCluster/128;
387 stripInAPV = stripTrajMid-tapv*128;
389 if(stripInAPV<_stripsApvEdge || stripInAPV>128-
_stripsApvEdge)
continue;
390 if(tapv != capv) badflag =
true;
397 if(badflag && !badquality) {
403 hits[layer].push_back(temphit);
405 pair<unsigned int, unsigned int> newgoodpair (1,1);
406 pair<unsigned int, unsigned int> newbadpair (1,0);
408 map< unsigned int, pair< unsigned int, unsigned int> >::iterator it =
modCounter[layer].find(
id);
411 if(badflag)
modCounter[layer][id] = newbadpair;
415 ((*it).second.first)++;
416 if(!badflag) ((*it).second.second)++;
431 else if(layer > 10 && layer < 14) {
432 if( ((
id>>13)&0x3) == 1) {
436 else if( ((
id>>13)&0x3) == 2) {
441 else if(layer > 13 && layer <= 22) {
442 if( ((
id>>18)&0x3) == 1) {
446 else if( ((
id>>18)&0x3) == 2) {
457 else if(layer > 10 && layer < 14) {
458 if( ((
id>>13)&0x3) == 1) {
462 else if( ((
id>>13)&0x3) == 2) {
467 else if(layer > 13 && layer <= 22) {
468 if( ((
id>>18)&0x3) == 1) {
472 else if( ((
id>>18)&0x3) == 2) {
489 int NTkBadComponent[4];
490 int NBadComponent[4][19][4];
494 std::stringstream ssV[4][19];
496 for(
int i=0;
i<4;++
i){
497 NTkBadComponent[
i]=0;
498 for(
int j=0;
j<19;++
j){
501 NBadComponent[
i][
j][
k]=0;
508 for (
size_t i=0;
i<BC.size();++
i){
515 NTkBadComponent[0]++;
517 NTkBadComponent[1]+= ( (BC[
i].BadFibers>>2)&0x1 )+ ( (BC[
i].BadFibers>>1)&0x1 ) + ( (BC[
i].BadFibers)&0x1 );
519 NTkBadComponent[2]+= ( (BC[
i].BadApvs>>5)&0x1 )+ ( (BC[
i].BadApvs>>4)&0x1 ) + ( (BC[
i].BadApvs>>3)&0x1 ) +
520 ( (BC[
i].BadApvs>>2)&0x1 )+ ( (BC[
i].BadApvs>>1)&0x1 ) + ( (BC[
i].BadApvs)&0x1 );
572 unsigned int detid=rp->detid;
593 for(
int it=0;it<sqrange.second-sqrange.first;it++){
595 NTkBadComponent[3]+=range;
596 NBadComponent[subdet][0][3]+=range;
597 NBadComponent[subdet][component][3]+=range;
603 edm::LogError(
"SiStripQualityStatistics") <<
"PROBLEM detid " << detid <<
" value " << percentage<< std::endl;
609 cout <<
"\n-----------------\nNew IOV starting from run " << e.
id().
run() <<
" event " << e.
id().
event() <<
" lumiBlock " << e.
luminosityBlock() <<
" time " << e.
time().
value() <<
"\n-----------------\n";
610 cout <<
"\n-----------------\nGlobal Info\n-----------------";
611 cout <<
"\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
612 cout <<
"\nTracker:\t\t"<<NTkBadComponent[0]<<
"\t"<<NTkBadComponent[1]<<
"\t"<<NTkBadComponent[2]<<
"\t"<<NTkBadComponent[3];
614 cout <<
"\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<
"\t"<<NBadComponent[0][0][1]<<
"\t"<<NBadComponent[0][0][2]<<
"\t"<<NBadComponent[0][0][3];
615 cout <<
"\nTID:\t\t\t"<<NBadComponent[1][0][0]<<
"\t"<<NBadComponent[1][0][1]<<
"\t"<<NBadComponent[1][0][2]<<
"\t"<<NBadComponent[1][0][3];
616 cout <<
"\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<
"\t"<<NBadComponent[2][0][1]<<
"\t"<<NBadComponent[2][0][2]<<
"\t"<<NBadComponent[2][0][3];
617 cout <<
"\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<
"\t"<<NBadComponent[3][0][1]<<
"\t"<<NBadComponent[3][0][2]<<
"\t"<<NBadComponent[3][0][3];
620 for (
int i=1;
i<5;++
i)
621 cout <<
"\nTIB Layer " <<
i <<
" :\t\t"<<NBadComponent[0][
i][0]<<
"\t"<<NBadComponent[0][
i][1]<<
"\t"<<NBadComponent[0][
i][2]<<
"\t"<<NBadComponent[0][
i][3];
623 for (
int i=1;
i<4;++
i)
624 cout <<
"\nTID+ Disk " <<
i <<
" :\t\t"<<NBadComponent[1][
i][0]<<
"\t"<<NBadComponent[1][
i][1]<<
"\t"<<NBadComponent[1][
i][2]<<
"\t"<<NBadComponent[1][
i][3];
625 for (
int i=4;
i<7;++
i)
626 cout <<
"\nTID- Disk " <<
i-3 <<
" :\t\t"<<NBadComponent[1][
i][0]<<
"\t"<<NBadComponent[1][
i][1]<<
"\t"<<NBadComponent[1][
i][2]<<
"\t"<<NBadComponent[1][
i][3];
628 for (
int i=1;
i<7;++
i)
629 cout <<
"\nTOB Layer " <<
i <<
" :\t\t"<<NBadComponent[2][
i][0]<<
"\t"<<NBadComponent[2][
i][1]<<
"\t"<<NBadComponent[2][
i][2]<<
"\t"<<NBadComponent[2][
i][3];
631 for (
int i=1;
i<10;++
i)
632 cout <<
"\nTEC+ Disk " <<
i <<
" :\t\t"<<NBadComponent[3][
i][0]<<
"\t"<<NBadComponent[3][
i][1]<<
"\t"<<NBadComponent[3][
i][2]<<
"\t"<<NBadComponent[3][
i][3];
633 for (
int i=10;
i<19;++
i)
634 cout <<
"\nTEC- Disk " <<
i-9 <<
" :\t\t"<<NBadComponent[3][
i][0]<<
"\t"<<NBadComponent[3][
i][1]<<
"\t"<<NBadComponent[3][
i][2]<<
"\t"<<NBadComponent[3][
i][3];
637 cout <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
638 for (
int i=1;
i<5;++
i)
639 cout <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].str();
641 for (
int i=1;
i<4;++
i)
642 cout <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].str();
643 for (
int i=4;
i<7;++
i)
644 cout <<
"\nTID- Disk " <<
i-3 <<
" :" << ssV[1][
i].str();
646 for (
int i=1;
i<7;++
i)
647 cout <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].str();
649 for (
int i=1;
i<10;++
i)
650 cout <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].str();
651 for (
int i=10;
i<19;++
i)
652 cout <<
"\nTEC- Disk " <<
i-9 <<
" :" << ssV[3][
i].str();
656 badModules.open(
"BadModules.log");
657 badModules <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
658 for (
int i=1;
i<5;++
i)
659 badModules <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].str();
661 for (
int i=1;
i<4;++
i)
662 badModules <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].str();
663 for (
int i=4;
i<7;++
i)
664 badModules <<
"\nTID- Disk " <<
i-3 <<
" :" << ssV[1][
i].str();
666 for (
int i=1;
i<7;++
i)
667 badModules <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].str();
669 for (
int i=1;
i<10;++
i)
670 badModules <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].str();
671 for (
int i=10;
i<19;++
i)
672 badModules <<
"\nTEC- Disk " <<
i-9 <<
" :" << ssV[3][
i].str();
678 cout <<
"Entering hot cold map generation!\n";
679 TStyle* gStyle =
new TStyle(
"gStyle",
"myStyle");
681 gStyle->SetPalette(1);
682 gStyle->SetCanvasColor(kWhite);
683 gStyle->SetOptStat(0);
688 for(Long_t maplayer = 1; maplayer <=22; maplayer++) {
690 if(maplayer > 0 && maplayer <= 4) {
692 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TIB",(
int)(maplayer)),
"TIB",100,-1,361,100,-100,100);
693 temph2->GetXaxis()->SetTitle(
"Phi");
694 temph2->GetXaxis()->SetBinLabel(1,TString(
"360"));
695 temph2->GetXaxis()->SetBinLabel(50,TString(
"180"));
696 temph2->GetXaxis()->SetBinLabel(100,TString(
"0"));
697 temph2->GetYaxis()->SetTitle(
"Global Z");
698 temph2->SetOption(
"colz");
701 else if(maplayer > 4 && maplayer <= 10) {
703 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TOB",(
int)(maplayer-4)),
"TOB",100,-1,361,100,-120,120);
704 temph2->GetXaxis()->SetTitle(
"Phi");
705 temph2->GetXaxis()->SetBinLabel(1,TString(
"360"));
706 temph2->GetXaxis()->SetBinLabel(50,TString(
"180"));
707 temph2->GetXaxis()->SetBinLabel(100,TString(
"0"));
708 temph2->GetYaxis()->SetTitle(
"Global Z");
709 temph2->SetOption(
"colz");
712 else if(maplayer > 10 && maplayer <= 13) {
715 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID-",(
int)(maplayer-10)),
"TID-",100,-100,100,100,-100,100);
716 temph2->GetXaxis()->SetTitle(
"Global Y");
717 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
718 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
719 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
720 temph2->GetYaxis()->SetTitle(
"Global X");
721 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
722 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
723 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
724 temph2->SetOption(
"colz");
726 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID+",(
int)(maplayer-10)),
"TID+",100,-100,100,100,-100,100);
727 temph2->GetXaxis()->SetTitle(
"Global Y");
728 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
729 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
730 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
731 temph2->GetYaxis()->SetTitle(
"Global X");
732 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
733 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
734 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
735 temph2->SetOption(
"colz");
738 else if(maplayer > 13) {
741 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC-",(
int)(maplayer-13)),
"TEC-",100,-120,120,100,-120,120);
742 temph2->GetXaxis()->SetTitle(
"Global Y");
743 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
744 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
745 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
746 temph2->GetYaxis()->SetTitle(
"Global X");
747 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
748 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
749 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
750 temph2->SetOption(
"colz");
752 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC+",(
int)(maplayer-13)),
"TEC+",100,-120,120,100,-120,120);
753 temph2->GetXaxis()->SetTitle(
"Global Y");
754 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
755 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
756 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
757 temph2->GetYaxis()->SetTitle(
"Global X");
758 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
759 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
760 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
761 temph2->SetOption(
"colz");
765 for(Long_t mylayer = 1; mylayer <= 22; mylayer++) {
769 vector<hit>::const_iterator iter;
770 for(iter =
hits[mylayer].
begin(); iter !=
hits[mylayer].end(); iter++) {
774 if(mylayer > 0 && mylayer <= 4) {
777 HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
779 else if(mylayer > 4 && mylayer <= 10) {
782 HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
784 else if(mylayer > 10 && mylayer <= 13) {
787 int side = (((iter->id)>>13) & 0x3);
788 if(side == 1)
HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y,iter->x,1.);
789 else if(side == 2)
HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y,iter->x,1.);
793 else if(mylayer > 13) {
796 int side = (((iter->id)>>18) & 0x3);
797 if(side == 1)
HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y,iter->x,1.);
798 else if(side == 2)
HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y,iter->x,1.);
804 cout <<
"Finished HotCold Map Generation\n";
808 cout <<
"Entering TKMap generation!\n";
815 double myeff, mynum, myden;
817 for(Long_t
i = 1;
i <= 22;
i++) {
822 map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
826 mynum = (double)(((*ih).second).second);
827 myden = (double)(((*ih).second).first);
828 if(myden>0) myeff = mynum/myden;
834 cout <<
"Layer " <<
i <<
" module " << (*ih).first <<
" efficiency " << myeff <<
" " << (((*ih).second).
second) <<
"/" << (((*ih).second).
first) << endl;
841 cout <<
"Module " << (*ih).first <<
" layer " <<
i <<
" is under occupancy at " << (((*ih).second).
first) << endl;
851 tkmapnum->
fill((*ih).first,mynum);
858 tkmap->
save(
true, 0, 0,
"SiStripHitEffTKMap.png");
859 tkmapbad->
save(
true, 0, 0,
"SiStripHitEffTKMapBad.png");
861 tkmapnum->
save(
true, 0, 0,
"SiStripHitEffTKMapNum.png");
862 tkmapden->
save(
true, 0, 0,
"SiStripHitEffTKMapDen.png");
863 cout <<
"Finished TKMap Generation\n";
868 cout <<
"Entering SQLite file generation!\n";
869 std::vector<unsigned int> BadStripList;
870 unsigned short NStrips;
876 map< unsigned int, double >::const_iterator it;
881 cout <<
"Number of strips module " << (*it).first <<
" is " << NStrips << endl;
882 BadStripList.push_back(pQuality->
encode(0,NStrips,0));
884 id1=(
unsigned int)(*it).first;
885 cout <<
"ID1 shoudl match list of modules above " << id1 << endl;
889 BadStripList.clear();
903 for(Long_t
i=1;
i<5;
i++) {subdetfound[
i]=0; subdettotal[
i]=0;}
905 for(Long_t
i=1;
i<=22;
i++) {
917 cout <<
"The total efficiency is " << double(totalfound)/double(totaltotal) << endl;
918 cout <<
" TIB: " << double(subdetfound[1])/subdettotal[1] << endl;
919 cout <<
" TOB: " << double(subdetfound[2])/subdettotal[2] << endl;
920 cout <<
" TID: " << double(subdetfound[3])/subdettotal[3] << endl;
921 cout <<
" TEC: " << double(subdetfound[4])/subdettotal[4] << endl;
934 TH1F *
found =
fs->
make<TH1F>(
"found",
"found",nLayers+1,0,nLayers+1);
935 TH1F *
all =
fs->
make<TH1F>(
"all",
"all",nLayers+1,0,nLayers+1);
936 TH1F *found2 =
fs->
make<TH1F>(
"found2",
"found2",nLayers+1,0,nLayers+1);
937 TH1F *all2 =
fs->
make<TH1F>(
"all2",
"all2",nLayers+1,0,nLayers+1);
939 found->SetBinContent(0,-1);
940 all->SetBinContent(0,1);
943 for (Long_t
i=1;
i< nLayers+2; ++
i) {
944 found->SetBinContent(
i,1
e-6);
945 all->SetBinContent(
i,1);
946 found2->SetBinContent(
i,1
e-6);
947 all2->SetBinContent(
i,1);
950 TCanvas *c7 =
new TCanvas(
"c7",
" test ",10,10,800,600);
954 int nLayers_max=nLayers+1;
956 for (Long_t
i=1;
i< nLayers_max; ++
i) {
973 for (Long_t
i=11;
i< 14; ++
i) {
1005 TGraphAsymmErrors *gr =
new TGraphAsymmErrors(nLayers+1);
1006 gr->BayesDivide(found,all);
1008 TGraphAsymmErrors *gr2 =
new TGraphAsymmErrors(nLayers+1);
1009 gr2->BayesDivide(found2,all2);
1011 for(
int j = 0;
j<nLayers+1;
j++){
1012 gr->SetPointError(
j, 0., 0., gr->GetErrorYlow(
j),gr->GetErrorYhigh(
j) );
1013 gr2->SetPointError(
j, 0., 0., gr2->GetErrorYlow(
j),gr2->GetErrorYhigh(
j) );
1016 gr->GetXaxis()->SetLimits(0,nLayers);
1017 gr->SetMarkerColor(2);
1018 gr->SetMarkerSize(1.2);
1019 gr->SetLineColor(2);
1020 gr->SetLineWidth(4);
1021 gr->SetMarkerStyle(20);
1023 gr->SetMaximum(1.001);
1024 gr->GetYaxis()->SetTitle(
"Efficiency");
1025 gStyle->SetTitleFillColor(0);
1026 gStyle->SetTitleBorderSize(0);
1029 gr2->GetXaxis()->SetLimits(0,nLayers);
1030 gr2->SetMarkerColor(1);
1031 gr2->SetMarkerSize(1.2);
1032 gr2->SetLineColor(1);
1033 gr2->SetLineWidth(4);
1034 gr2->SetMarkerStyle(21);
1036 gr2->SetMaximum(1.001);
1037 gr2->GetYaxis()->SetTitle(
"Efficiency");
1040 for ( Long_t
k=1;
k<nLayers+1;
k++) {
1051 gr->GetXaxis()->SetBinLabel(((
k+1)*100+2)/(nLayers)-4,label);
1052 gr2->GetXaxis()->SetBinLabel(((
k+1)*100+2)/(nLayers)-4,label);
1055 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-6,label);
1056 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-6,label);
1061 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-4,label);
1062 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-4,label);
1065 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-7,label);
1066 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-7,label);
1072 gr->GetXaxis()->SetNdivisions(36);
1075 TPad *overlay =
new TPad(
"overlay",
"",0,0,1,1);
1076 overlay->SetFillStyle(4000);
1077 overlay->SetFillColor(0);
1078 overlay->SetFrameFillStyle(4000);
1079 overlay->Draw(
"same");
1083 TLegend *
leg =
new TLegend(0.70,0.27,0.88,0.40);
1084 leg->AddEntry(gr,
"Good Modules",
"p");
1085 leg->AddEntry(gr2,
"All Modules",
"p");
1086 leg->SetTextSize(0.020);
1087 leg->SetFillColor(0);
1090 c7->SaveAs(
"Summary.png");
1094 cout<<
"Computing efficiency vs bx"<<endl;
1096 unsigned int nLayers = 22;
1099 for(
unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1100 TH1F *hfound =
fs->
make<TH1F>(Form(
"foundVsBx_layer%i", ilayer),Form(
"layer %i", ilayer),3565,0,3565);
1101 TH1F *htotal =
fs->
make<TH1F>(Form(
"totalVsBx_layer%i", ilayer),Form(
"layer %i", ilayer),3565,0,3565);
1103 for(
unsigned int ibx=0; ibx<3566; ibx++){
1104 hfound->SetBinContent(ibx, 1
e-6);
1105 htotal->SetBinContent(ibx, 1);
1107 map<unsigned int, vector<int> >::iterator iterMapvsBx;
1109 hfound->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1111 if(iterMapvsBx->second[ilayer]>0) htotal->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1116 TGraphAsymmErrors *geff =
fs->
make<TGraphAsymmErrors>(3564);
1117 geff->SetName(Form(
"effVsBx_layer%i", ilayer));
1118 geff->SetTitle(
"Hit Efficiency vs bx - "+
GetLayerName(ilayer));
1119 geff->BayesDivide(hfound,htotal);
1122 TGraphAsymmErrors *geff_avg =
fs->
make<TGraphAsymmErrors>();
1123 geff_avg->SetName(Form(
"effVsBxAvg_layer%i", ilayer));
1124 geff_avg->SetTitle(
"Hit Efficiency vs bx - "+
GetLayerName(ilayer));
1125 geff_avg->SetMarkerStyle(20);
1127 int previous_bx=-80;
1137 ibx=iterMapvsBx->first;
1138 delta_bx=ibx-previous_bx;
1141 eff=found/(float)total;
1143 geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1144 low = TEfficiency::Bayesian(total, found, .683, 1, 1,
false);
1145 up = TEfficiency::Bayesian(total, found, .683, 1, 1,
true);
1146 geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1155 found+=hfound->GetBinContent(ibx);
1156 total+=htotal->GetBinContent(ibx);
1162 eff=found/(float)total;
1164 geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1165 low = TEfficiency::Bayesian(total, found, .683, 1, 1,
false);
1166 up = TEfficiency::Bayesian(total, found, .683, 1, 1,
true);
1167 geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1174 TString layername=
"";
1175 TString ringlabel=
"D";
1178 layername = TString(
"TIB L") +
k;
1179 }
else if (k>4 && k<11) {
1180 layername = TString(
"TOB L")+(k-4);
1181 }
else if (k>10 && k<14) {
1182 layername = TString(
"TID ")+ringlabel+(k-10);
1184 layername = TString(
"TEC ")+ringlabel+(k-13);
1192 TString layername=
"";
1193 TString ringlabel=
"D";
1196 layername = TString(
"TIB L") +
k;
1197 }
else if (k>4&&k<11) {
1198 layername = TString(
"TOB L")+(k-4);
1199 }
else if (k>10&&k<14) {
1200 layername = TString(
"TID- ")+ringlabel+(k-10);
1201 }
else if (k>13&&k<17) {
1202 layername = TString(
"TID+ ")+ringlabel+(k-13);
1204 layername = TString(
"TEC- ")+ringlabel+(k-16);
1206 layername = TString(
"TEC+ ")+ringlabel+(k-16-
nTEClayers);
1220 for(;rIter!=rIterEnd;++rIter){
1222 if ( ! obj->
put(rIter->detid,range) )
1223 edm::LogError(
"SiStripHitEffFromCalibTree")<<
"[SiStripHitEffFromCalibTree::getNewObject] detid already exists"<<std::endl;
1232 if((x>=0)&&(y>=0)) phi = atan(y/x);
1233 else if((x>=0)&&(y<=0)) phi = atan(y/x) + 2*
Pi;
1234 else if((x<=0)&&(y>=0)) phi = atan(y/x) +
Pi;
1235 else phi = atan(y/x) +
Pi;
1245 ssV[
i][component] <<
"\n\t\t "
1250 ssV[
i][component] <<
"x " <<( (BC.
BadFibers>>1)&0x1 );
1253 ssV[
i][component] << ( (BC.
BadFibers>>1)&0x1 ) <<
" "
1255 ssV[
i][component] <<
" \t "
1256 << ( (BC.
BadApvs)&0x1 ) <<
" "
1257 << ( (BC.
BadApvs>>1)&0x1 ) <<
" ";
1259 ssV[
i][component] <<
"x x " << ( (BC.
BadApvs>>2)&0x1 ) <<
" "
1262 ssV[
i][component] << ( (BC.
BadApvs>>2)&0x1 ) <<
" "
1263 << ( (BC.
BadApvs>>3)&0x1 ) <<
" "
1264 << ( (BC.
BadApvs>>4)&0x1 ) <<
" "
1265 << ( (BC.
BadApvs>>5)&0x1 ) <<
" ";
1270 NBadComponent[
i][component][2]+= ( (BC.
BadApvs>>5)&0x1 )+ ( (BC.
BadApvs>>4)&0x1 ) + ( (BC.
BadApvs>>3)&0x1 ) +
1278 NBadComponent[
i][0][0]++;
1279 NBadComponent[
i][component][0]++;
vector< TH2F * > HotColdMaps
T getParameter(std::string const &) const
EventNumber_t event() const
virtual int nstrips() const =0
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< BadComponent > & getBadComponentList() const
unsigned int tibLayer(const DetId &id) const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
TString GetLayerSideName(Long_t k)
#define DEFINE_FWK_MODULE(type)
edm::LuminosityBlockNumber_t luminosityBlock() const
const Bounds & bounds() const
unsigned int tidWheel(const DetId &id) const
T * make(const Args &...args) const
make new ROOT object
~SiStripHitEffFromCalibTree()
void SetBadComponents(int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
Registry::const_iterator RegistryIterator
SiStripDetInfoFileReader * reader
SiStripQuality * quality_
unsigned int _spaceBetweenTrains
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
U second(std::pair< T, U > const &p)
T x() const
Cartesian x coordinate.
unsigned int _clusterMatchingMethod
float calcPhi(float x, float y)
RegistryIterator getRegistryVectorEnd() const
edm::Service< TFileService > fs
map< unsigned int, vector< int > > layerfound_perBx
unsigned int tidSide(const DetId &id) const
virtual void algoBeginJob()
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(unsigned int &, std::vector< unsigned int > &)
edm::FileInPath FileInPath_
Abs< T >::type abs(const T &t)
SiStripBadStrip * getNewObject() override
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[23]
void fillc(int idmod, int RGBcode)
ContainerIterator getDataVectorBegin() const
tuple SiStripDetInfoFileReader
Detector identifier class for the strip tracker.
virtual void algoEndJob() override
T const * product() const
RegistryIterator getRegistryVectorBegin() const
map< unsigned int, vector< int > > layertotal_perBx
virtual void algoAnalyze(const edm::Event &e, const edm::EventSetup &c) override
TString GetLayerName(Long_t k)
std::pair< ContainerIterator, ContainerIterator > Range
vector< string > CalibTreeFilenames
map< unsigned int, double > BadModules
std::string fullPath() const
bool put(const uint32_t &detID, const InputVector &vect)
virtual float width() const =0
unsigned int tecWheel(const DetId &id) const
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
TimeValue_t value() const
SiStripHitEffFromCalibTree(const edm::ParameterSet &)
edm::Timestamp time() const
void fill(int layer, int ring, int nmod, float x)
data decode(const unsigned int &value) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const