65 #include "TObjString.h" 76 #include "TGraphAsymmErrors.h" 79 #include "TEfficiency.h" 98 virtual void algoBeginJob();
99 void algoEndJob()
override;
103 void makeHotColdMaps();
105 void totalStatistics();
107 void makeSummaryVsBx();
108 void ComputeEff(vector< TH1F* > &vhfound, vector< TH1F* > &vhtotal,
string name);
109 void makeSummaryVsLumi();
110 void makeSummaryVsCM();
111 TString GetLayerName(Long_t
k);
112 TString GetLayerSideName(Long_t k);
113 float calcPhi(
float x,
float y);
146 map< unsigned int, pair< unsigned int, unsigned int> > modCounter[23];
162 int goodlayertotal[35];
163 int goodlayerfound[35];
164 int alllayertotal[35];
165 int alllayerfound[35];
171 FileInPath_(
"CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")
195 if(_showRings) nTEClayers = 7;
224 ifstream badModules_file;
225 set<uint32_t> badModules_list;
228 uint32_t badmodule_detid;
229 int mods, fiber1, fiber2, fiber3;
230 if(badModules_file.is_open()) {
232 while ( getline (badModules_file,line) ) {
233 if(badModules_file.eof())
continue;
234 stringstream ss(line);
235 ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
236 if(badmodule_detid!=0 && mods==1 && (fiber1==1 || fiber2==1 || fiber3==1) )
237 badModules_list.insert(badmodule_detid);
239 badModules_file.close();
242 if(!badModules_list.empty())
cout<<
"Remove additionnal bad modules from the analysis: "<<endl;
243 set<uint32_t>::iterator itBadMod;
244 for (itBadMod=badModules_list.begin(); itBadMod!=badModules_list.end(); ++itBadMod)
245 cout<<
" "<<*itBadMod<<endl;
249 for(
int l=0;
l < 35;
l++) {
256 TH1F* resolutionPlots[23];
257 for(Long_t ilayer = 0; ilayer <23; ilayer++) {
258 resolutionPlots[ilayer] =
fs->
make<TH1F>(Form(
"resol_layer_%i",(
int)(ilayer)),
GetLayerName(ilayer),125,-125,125);
259 resolutionPlots[ilayer]->GetXaxis()->SetTitle(
"trajX-clusX [strip unit]");
272 cout <<
"A module is bad if efficiency < " <<
threshold <<
" and has at least " <<
nModsMin <<
" nModsMin." << endl;
280 CalibTreeFile->cd(
"anEff");
281 CalibTree = (TTree*)(gDirectory->Get(
"traj"));
283 TLeaf* BadLf =
CalibTree->GetLeaf(
"ModIsBad");
284 TLeaf* sistripLf =
CalibTree->GetLeaf(
"SiStripQualBad");
286 TLeaf* acceptLf =
CalibTree->GetLeaf(
"withinAcceptance");
287 TLeaf* layerLf =
CalibTree->GetLeaf(
"layer");
288 TLeaf* nHitsLf =
CalibTree->GetLeaf(
"nHits");
289 TLeaf* xLf =
CalibTree->GetLeaf(
"TrajGlbX");
290 TLeaf* yLf =
CalibTree->GetLeaf(
"TrajGlbY");
291 TLeaf* zLf =
CalibTree->GetLeaf(
"TrajGlbZ");
292 TLeaf* ResXSigLf =
CalibTree->GetLeaf(
"ResXSig");
293 TLeaf* TrajLocXLf =
CalibTree->GetLeaf(
"TrajLocX");
294 TLeaf* TrajLocYLf =
CalibTree->GetLeaf(
"TrajLocY");
295 TLeaf* ClusterLocXLf =
CalibTree->GetLeaf(
"ClusterLocX");
296 TLeaf* BunchLf =
CalibTree->GetLeaf(
"bunchx");
297 TLeaf* InstLumiLf =
CalibTree->GetLeaf(
"instLumi");
299 TLeaf* CMLf =
nullptr;
303 cout <<
"Successfully loaded analyze function with " << nevents <<
" events!\n";
307 for(
int j =0; j < nevents; j++) {
309 unsigned int isBad = (
unsigned int)BadLf->GetValue();
310 unsigned int quality = (
unsigned int)sistripLf->GetValue();
311 unsigned int id = (
unsigned int)idLf->GetValue();
312 unsigned int accept = (
unsigned int)acceptLf->GetValue();
313 unsigned int layer_wheel = (
unsigned int)layerLf->GetValue();
314 unsigned int layer = layer_wheel;
316 if(layer<14) layer = 10 + ((
id>>9)&0x3);
317 else layer = 13 + ((
id>>5)&0x7);
319 unsigned int nHits = (
unsigned int)nHitsLf->GetValue();
320 double x = xLf->GetValue();
321 double y = yLf->GetValue();
322 double z = zLf->GetValue();
323 double resxsig = ResXSigLf->GetValue();
324 double TrajLocX = TrajLocXLf->GetValue();
325 double TrajLocY = TrajLocYLf->GetValue();
326 double ClusterLocX = ClusterLocXLf->GetValue();
330 bool badquality =
false;
331 unsigned int bx = (
unsigned int)BunchLf->GetValue();
334 if(InstLumiLf!=
nullptr) instLumi = InstLumiLf->GetValue();
336 if(PULf!=
nullptr) PU = PULf->GetValue();
338 if(
_useCM) CM = CMLf->GetValue();
344 if(accept != 1 || nHits < 8)
continue;
345 if(quality == 1) badquality =
true;
348 if(!
_showTOB6TEC9 && (layer_wheel==10 || layer_wheel==22))
continue;
351 itBadMod = badModules_list.find(
id);
352 if(itBadMod!=badModules_list.end())
continue;
358 bool badflag =
false;
362 if(isBad == 1) badflag =
true;
365 if(isBad == 1 || resxsig >
_ResXSig) badflag =
true;
372 if (resxsig==1000.0) {
375 stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
376 stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
379 DetId ClusterDetId(
id);
384 stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
385 stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
394 const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
396 hbedge = parameters[0];
397 htedge = parameters[1];
398 hapoth = parameters[3];
399 TrajLocXMid = TrajLocX / (1 + (htedge-hbedge)*TrajLocY/(htedge+hbedge)/hapoth) ;
400 stripTrajMid = TrajLocXMid/Pitch + nstrips/2.0 ;
405 if(!badquality && layer<23) {
406 if(resxsig!=1000.0) resolutionPlots[layer]->Fill(stripTrajMid-stripCluster);
407 else resolutionPlots[layer]->Fill(1000);
414 float stripInAPV = 64.;
418 if(resxsig == 1000.0) {
426 tapv = (
int) stripTrajMid/128;
427 capv = (
int) stripCluster/128;
428 stripInAPV = stripTrajMid-tapv*128;
430 if(stripInAPV<_stripsApvEdge || stripInAPV>128-
_stripsApvEdge)
continue;
431 if(tapv != capv) badflag =
true;
438 if(badflag && !badquality) {
444 hits[layer].push_back(temphit);
446 pair<unsigned int, unsigned int> newgoodpair (1,1);
447 pair<unsigned int, unsigned int> newbadpair (1,0);
449 map< unsigned int, pair< unsigned int, unsigned int> >::iterator it =
modCounter[layer].find(
id);
456 ((*it).second.first)++;
457 if(!badflag) ((*it).second.second)++;
482 else if(layer > 10 && layer < 14) {
483 if( ((
id>>13)&0x3) == 1) {
487 else if( ((
id>>13)&0x3) == 2) {
492 else if(layer > 13 && layer <= 22) {
493 if( ((
id>>18)&0x3) == 1) {
497 else if( ((
id>>18)&0x3) == 2) {
508 else if(layer > 10 && layer < 14) {
509 if( ((
id>>13)&0x3) == 1) {
513 else if( ((
id>>13)&0x3) == 2) {
518 else if(layer > 13 && layer <= 22) {
519 if( ((
id>>18)&0x3) == 1) {
523 else if( ((
id>>18)&0x3) == 2) {
544 int NTkBadComponent[4];
545 int NBadComponent[4][19][4];
549 std::stringstream ssV[4][19];
551 for(
int i=0;
i<4;++
i){
552 NTkBadComponent[
i]=0;
553 for(
int j=0;j<19;++j){
556 NBadComponent[
i][j][
k]=0;
563 for (
size_t i=0;
i<BC.size();++
i){
570 NTkBadComponent[0]++;
572 NTkBadComponent[1]+= ( (BC[
i].BadFibers>>2)&0
x1 )+ ( (BC[
i].BadFibers>>1)&0
x1 ) + ( (BC[
i].BadFibers)&0
x1 );
574 NTkBadComponent[2]+= ( (BC[
i].BadApvs>>5)&0
x1 )+ ( (BC[
i].BadApvs>>4)&0
x1 ) + ( (BC[
i].BadApvs>>3)&0
x1 ) +
575 ( (BC[
i].BadApvs>>2)&0
x1 )+ ( (BC[
i].BadApvs>>1)&0
x1 ) + ( (BC[
i].BadApvs)&0
x1 );
627 unsigned int detid=rp->detid;
648 for(
int it=0;it<sqrange.second-sqrange.first;it++){
650 NTkBadComponent[3]+=range;
651 NBadComponent[subdet][0][3]+=range;
652 NBadComponent[subdet][component][3]+=range;
658 edm::LogError(
"SiStripQualityStatistics") <<
"PROBLEM detid " << detid <<
" value " << percentage<< std::endl;
664 cout <<
"\n-----------------\nNew IOV starting from run " << e.
id().
run() <<
" event " << e.
id().
event() <<
" lumiBlock " << e.
luminosityBlock() <<
" time " << e.
time().
value() <<
"\n-----------------\n";
665 cout <<
"\n-----------------\nGlobal Info\n-----------------";
666 cout <<
"\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
667 cout <<
"\nTracker:\t\t"<<NTkBadComponent[0]<<
"\t"<<NTkBadComponent[1]<<
"\t"<<NTkBadComponent[2]<<
"\t"<<NTkBadComponent[3];
669 cout <<
"\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<
"\t"<<NBadComponent[0][0][1]<<
"\t"<<NBadComponent[0][0][2]<<
"\t"<<NBadComponent[0][0][3];
670 cout <<
"\nTID:\t\t\t"<<NBadComponent[1][0][0]<<
"\t"<<NBadComponent[1][0][1]<<
"\t"<<NBadComponent[1][0][2]<<
"\t"<<NBadComponent[1][0][3];
671 cout <<
"\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<
"\t"<<NBadComponent[2][0][1]<<
"\t"<<NBadComponent[2][0][2]<<
"\t"<<NBadComponent[2][0][3];
672 cout <<
"\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<
"\t"<<NBadComponent[3][0][1]<<
"\t"<<NBadComponent[3][0][2]<<
"\t"<<NBadComponent[3][0][3];
675 for (
int i=1;
i<5;++
i)
676 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];
678 for (
int i=1;
i<4;++
i)
679 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];
680 for (
int i=4;
i<7;++
i)
681 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];
683 for (
int i=1;
i<7;++
i)
684 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];
686 for (
int i=1;
i<10;++
i)
687 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];
688 for (
int i=10;
i<19;++
i)
689 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];
692 cout <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
693 for (
int i=1;
i<5;++
i)
694 cout <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
696 for (
int i=1;
i<4;++
i)
697 cout <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
698 for (
int i=4;
i<7;++
i)
699 cout <<
"\nTID- Disk " <<
i-3 <<
" :" << ssV[1][
i].
str();
701 for (
int i=1;
i<7;++
i)
702 cout <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
704 for (
int i=1;
i<10;++
i)
705 cout <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
706 for (
int i=10;
i<19;++
i)
707 cout <<
"\nTEC- Disk " <<
i-9 <<
" :" << ssV[3][
i].
str();
711 badModules.open(
"BadModules.log");
712 badModules <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
713 for (
int i=1;
i<5;++
i)
714 badModules <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
716 for (
int i=1;
i<4;++
i)
717 badModules <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
718 for (
int i=4;
i<7;++
i)
719 badModules <<
"\nTID- Disk " <<
i-3 <<
" :" << ssV[1][
i].
str();
721 for (
int i=1;
i<7;++
i)
722 badModules <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
724 for (
int i=1;
i<10;++
i)
725 badModules <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
726 for (
int i=10;
i<19;++
i)
727 badModules <<
"\nTEC- Disk " <<
i-9 <<
" :" << ssV[3][
i].
str();
733 cout <<
"Entering hot cold map generation!\n";
734 TStyle* gStyle =
new TStyle(
"gStyle",
"myStyle");
736 gStyle->SetPalette(1);
737 gStyle->SetCanvasColor(kWhite);
738 gStyle->SetOptStat(0);
743 for(Long_t maplayer = 1; maplayer <=22; maplayer++) {
745 if(maplayer > 0 && maplayer <= 4) {
747 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TIB",(
int)(maplayer)),
"TIB",100,-1,361,100,-100,100);
748 temph2->GetXaxis()->SetTitle(
"Phi");
749 temph2->GetXaxis()->SetBinLabel(1,TString(
"360"));
750 temph2->GetXaxis()->SetBinLabel(50,TString(
"180"));
751 temph2->GetXaxis()->SetBinLabel(100,TString(
"0"));
752 temph2->GetYaxis()->SetTitle(
"Global Z");
753 temph2->SetOption(
"colz");
756 else if(maplayer > 4 && maplayer <= 10) {
758 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TOB",(
int)(maplayer-4)),
"TOB",100,-1,361,100,-120,120);
759 temph2->GetXaxis()->SetTitle(
"Phi");
760 temph2->GetXaxis()->SetBinLabel(1,TString(
"360"));
761 temph2->GetXaxis()->SetBinLabel(50,TString(
"180"));
762 temph2->GetXaxis()->SetBinLabel(100,TString(
"0"));
763 temph2->GetYaxis()->SetTitle(
"Global Z");
764 temph2->SetOption(
"colz");
767 else if(maplayer > 10 && maplayer <= 13) {
770 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID-",(
int)(maplayer-10)),
"TID-",100,-100,100,100,-100,100);
771 temph2->GetXaxis()->SetTitle(
"Global Y");
772 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
773 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
774 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
775 temph2->GetYaxis()->SetTitle(
"Global X");
776 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
777 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
778 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
779 temph2->SetOption(
"colz");
781 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID+",(
int)(maplayer-10)),
"TID+",100,-100,100,100,-100,100);
782 temph2->GetXaxis()->SetTitle(
"Global Y");
783 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
784 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
785 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
786 temph2->GetYaxis()->SetTitle(
"Global X");
787 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
788 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
789 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
790 temph2->SetOption(
"colz");
793 else if(maplayer > 13) {
796 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC-",(
int)(maplayer-13)),
"TEC-",100,-120,120,100,-120,120);
797 temph2->GetXaxis()->SetTitle(
"Global Y");
798 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
799 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
800 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
801 temph2->GetYaxis()->SetTitle(
"Global X");
802 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
803 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
804 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
805 temph2->SetOption(
"colz");
807 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC+",(
int)(maplayer-13)),
"TEC+",100,-120,120,100,-120,120);
808 temph2->GetXaxis()->SetTitle(
"Global Y");
809 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
810 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
811 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
812 temph2->GetYaxis()->SetTitle(
"Global X");
813 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
814 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
815 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
816 temph2->SetOption(
"colz");
820 for(Long_t mylayer = 1; mylayer <= 22; mylayer++) {
824 vector<hit>::const_iterator iter;
825 for(iter =
hits[mylayer].
begin(); iter !=
hits[mylayer].end(); iter++) {
829 if(mylayer > 0 && mylayer <= 4) {
832 HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
834 else if(mylayer > 4 && mylayer <= 10) {
837 HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
839 else if(mylayer > 10 && mylayer <= 13) {
842 int side = (((iter->id)>>13) & 0x3);
843 if(side == 1)
HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y,iter->x,1.);
844 else if(side == 2)
HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y,iter->x,1.);
848 else if(mylayer > 13) {
851 int side = (((iter->id)>>18) & 0x3);
852 if(side == 1)
HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y,iter->x,1.);
853 else if(side == 2)
HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y,iter->x,1.);
859 cout <<
"Finished HotCold Map Generation\n";
863 cout <<
"Entering TKMap generation!\n";
870 double myeff, mynum, myden;
872 for(Long_t
i = 1;
i <= 22;
i++) {
877 map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
881 mynum = (double)(((*ih).second).second);
882 myden = (double)(((*ih).second).first);
883 if(myden>0) myeff = mynum/myden;
889 cout <<
"Layer " <<
i <<
" module " << (*ih).first <<
" efficiency " << myeff <<
" " << (((*ih).second).
second) <<
"/" << (((*ih).second).
first) << endl;
896 cout <<
"Module " << (*ih).first <<
" layer " <<
i <<
" is under occupancy at " << (((*ih).second).
first) << endl;
906 tkmapnum->
fill((*ih).first,mynum);
913 tkmap->
save(
true, 0, 0,
"SiStripHitEffTKMap.png");
914 tkmapbad->
save(
true, 0, 0,
"SiStripHitEffTKMapBad.png");
916 tkmapnum->
save(
true, 0, 0,
"SiStripHitEffTKMapNum.png");
917 tkmapden->
save(
true, 0, 0,
"SiStripHitEffTKMapDen.png");
918 cout <<
"Finished TKMap Generation\n";
923 cout <<
"Entering SQLite file generation!\n";
924 std::vector<unsigned int> BadStripList;
925 unsigned short NStrips;
931 map< unsigned int, double >::const_iterator it;
936 cout <<
"Number of strips module " << (*it).first <<
" is " << NStrips << endl;
937 BadStripList.push_back(pQuality->
encode(0,NStrips,0));
939 id1=(
unsigned int)(*it).first;
940 cout <<
"ID1 shoudl match list of modules above " << id1 << endl;
944 BadStripList.clear();
958 for(Long_t
i=1;
i<5;
i++) {subdetfound[
i]=0; subdettotal[
i]=0;}
960 for(Long_t
i=1;
i<=22;
i++) {
972 cout <<
"The total efficiency is " << double(totalfound)/double(totaltotal) << endl;
973 cout <<
" TIB: " << double(subdetfound[1])/subdettotal[1] << endl;
974 cout <<
" TOB: " << double(subdetfound[2])/subdettotal[2] << endl;
975 cout <<
" TID: " << double(subdetfound[3])/subdettotal[3] << endl;
976 cout <<
" TEC: " << double(subdetfound[4])/subdettotal[4] << endl;
989 TH1F *
found =
fs->
make<TH1F>(
"found",
"found",nLayers+1,0,nLayers+1);
990 TH1F *
all =
fs->
make<TH1F>(
"all",
"all",nLayers+1,0,nLayers+1);
991 TH1F *found2 =
fs->
make<TH1F>(
"found2",
"found2",nLayers+1,0,nLayers+1);
992 TH1F *all2 =
fs->
make<TH1F>(
"all2",
"all2",nLayers+1,0,nLayers+1);
994 found->SetBinContent(0,-1);
995 all->SetBinContent(0,1);
998 for (Long_t
i=1;
i< nLayers+2; ++
i) {
999 found->SetBinContent(
i,1
e-6);
1000 all->SetBinContent(
i,1);
1001 found2->SetBinContent(
i,1
e-6);
1002 all2->SetBinContent(
i,1);
1005 TCanvas *c7 =
new TCanvas(
"c7",
" test ",10,10,800,600);
1006 c7->SetFillColor(0);
1009 int nLayers_max=nLayers+1;
1011 for (Long_t
i=1;
i< nLayers_max; ++
i) {
1028 for (Long_t
i=11;
i< 14; ++
i) {
1060 TGraphAsymmErrors *gr =
fs->
make<TGraphAsymmErrors>(nLayers+1);
1061 gr->SetName(
"eff_good");
1062 gr->BayesDivide(found,all);
1064 TGraphAsymmErrors *gr2 =
fs->
make<TGraphAsymmErrors>(nLayers+1);
1065 gr2->SetName(
"eff_all");
1066 gr2->BayesDivide(found2,all2);
1068 for(
int j = 0; j<nLayers+1; j++){
1069 gr->SetPointError(j, 0., 0., gr->GetErrorYlow(j),gr->GetErrorYhigh(j) );
1070 gr2->SetPointError(j, 0., 0., gr2->GetErrorYlow(j),gr2->GetErrorYhigh(j) );
1073 gr->GetXaxis()->SetLimits(0,nLayers);
1074 gr->SetMarkerColor(2);
1075 gr->SetMarkerSize(1.2);
1076 gr->SetLineColor(2);
1077 gr->SetLineWidth(4);
1078 gr->SetMarkerStyle(20);
1080 gr->SetMaximum(1.001);
1081 gr->GetYaxis()->SetTitle(
"Efficiency");
1082 gStyle->SetTitleFillColor(0);
1083 gStyle->SetTitleBorderSize(0);
1086 gr2->GetXaxis()->SetLimits(0,nLayers);
1087 gr2->SetMarkerColor(1);
1088 gr2->SetMarkerSize(1.2);
1089 gr2->SetLineColor(1);
1090 gr2->SetLineWidth(4);
1091 gr2->SetMarkerStyle(21);
1093 gr2->SetMaximum(1.001);
1094 gr2->GetYaxis()->SetTitle(
"Efficiency");
1097 for ( Long_t
k=1;
k<nLayers+1;
k++) {
1108 gr->GetXaxis()->SetBinLabel(((
k+1)*100+2)/(nLayers)-4,label);
1109 gr2->GetXaxis()->SetBinLabel(((
k+1)*100+2)/(nLayers)-4,label);
1112 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-6,label);
1113 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-6,label);
1118 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-4,label);
1119 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-4,label);
1122 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-7,label);
1123 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-7,label);
1129 gr->GetXaxis()->SetNdivisions(36);
1132 TPad *
overlay =
new TPad(
"overlay",
"",0,0,1,1);
1133 overlay->SetFillStyle(4000);
1134 overlay->SetFillColor(0);
1135 overlay->SetFrameFillStyle(4000);
1136 overlay->Draw(
"same");
1140 TLegend *
leg =
new TLegend(0.70,0.27,0.88,0.40);
1141 leg->AddEntry(gr,
"Good Modules",
"p");
1143 leg->SetTextSize(0.020);
1144 leg->SetFillColor(0);
1147 c7->SaveAs(
"Summary.png");
1152 cout<<
"Computing efficiency vs bx"<<endl;
1157 for(
unsigned int ilayer=1; ilayer<
nLayers; ilayer++) {
1158 TH1F *hfound =
fs->
make<TH1F>(Form(
"foundVsBx_layer%i", ilayer),Form(
"layer %i", ilayer),3565,0,3565);
1159 TH1F *htotal =
fs->
make<TH1F>(Form(
"totalVsBx_layer%i", ilayer),Form(
"layer %i", ilayer),3565,0,3565);
1161 for(
unsigned int ibx=0; ibx<3566; ibx++){
1162 hfound->SetBinContent(ibx, 1
e-6);
1163 htotal->SetBinContent(ibx, 1);
1165 map<unsigned int, vector<int> >::iterator iterMapvsBx;
1167 hfound->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1169 if(iterMapvsBx->second[ilayer]>0) htotal->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1174 TGraphAsymmErrors *geff =
fs->
make<TGraphAsymmErrors>(3564);
1175 geff->SetName(Form(
"effVsBx_layer%i", ilayer));
1176 geff->SetTitle(
"Hit Efficiency vs bx - "+
GetLayerName(ilayer));
1177 geff->BayesDivide(hfound,htotal);
1180 TGraphAsymmErrors *geff_avg =
fs->
make<TGraphAsymmErrors>();
1181 geff_avg->SetName(Form(
"effVsBxAvg_layer%i", ilayer));
1182 geff_avg->SetTitle(
"Hit Efficiency vs bx - "+
GetLayerName(ilayer));
1183 geff_avg->SetMarkerStyle(20);
1185 int previous_bx=-80;
1195 ibx=iterMapvsBx->first;
1196 delta_bx=ibx-previous_bx;
1199 eff=found/(
float)total;
1201 geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1202 low = TEfficiency::Bayesian(total, found, .683, 1, 1,
false);
1203 up = TEfficiency::Bayesian(total, found, .683, 1, 1,
true);
1204 geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1213 found+=hfound->GetBinContent(ibx);
1214 total+=htotal->GetBinContent(ibx);
1220 eff=found/(
float)total;
1222 geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1223 low = TEfficiency::Bayesian(total, found, .683, 1, 1,
false);
1224 up = TEfficiency::Bayesian(total, found, .683, 1, 1,
true);
1225 geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1232 TString layername=
"";
1233 TString ringlabel=
"D";
1236 layername = TString(
"TIB L") +
k;
1237 }
else if (k>4 && k<11) {
1238 layername = TString(
"TOB L")+(k-4);
1239 }
else if (k>10 && k<14) {
1240 layername = TString(
"TID ")+ringlabel+(k-10);
1242 layername = TString(
"TEC ")+ringlabel+(k-13);
1256 for(
unsigned int ilayer=1; ilayer<
nLayers; ilayer++) {
1258 hfound = vhfound[ilayer];
1259 htotal = vhtotal[ilayer];
1265 for (Long_t
i=0;
i< hfound->GetNbinsX()+1; ++
i) {
1266 if( hfound->GetBinContent(
i)==0) hfound->SetBinContent(
i,1
e-6);
1267 if( htotal->GetBinContent(
i)==0) htotal->SetBinContent(
i,1);
1270 TGraphAsymmErrors *geff =
fs->
make<TGraphAsymmErrors>(hfound->GetNbinsX());
1271 geff->SetName(Form(
"%s_layer%i", name.c_str(), ilayer));
1272 geff->BayesDivide(hfound, htotal);
1273 if(name==
"effVsLumi") geff->SetTitle(
"Hit Efficiency vs inst. lumi. - "+
GetLayerName(ilayer));
1274 if(name==
"effVsPU") geff->SetTitle(
"Hit Efficiency vs pileup - "+
GetLayerName(ilayer));
1275 if(name==
"effVsCM") geff->SetTitle(
"Hit Efficiency vs common Mode - "+
GetLayerName(ilayer));
1276 geff->SetMarkerStyle(20);
1283 cout<<
"Computing efficiency vs lumi"<<endl;
1287 unsigned int nLayersForAvg = 0;
1288 float layerLumi = 0;
1293 cout<<
"Lumi summary: (avg over trajectory measurements)"<<endl;
1294 for(
unsigned int ilayer=1; ilayer<
nLayers; ilayer++) {
1298 if(layerLumi!=0 && layerPU!=0) {
1304 avgLumi/=nLayersForAvg;
1305 avgPU/=nLayersForAvg;
1306 cout<<
"Avg conditions: lumi :"<<avgLumi<<
" pu: "<<avgPU<<endl;
1314 cout<<
"Computing efficiency vs CM"<<endl;
1320 TString layername=
"";
1321 TString ringlabel=
"D";
1324 layername = TString(
"TIB L") +
k;
1325 }
else if (k>4&&k<11) {
1326 layername = TString(
"TOB L")+(k-4);
1327 }
else if (k>10&&k<14) {
1328 layername = TString(
"TID- ")+ringlabel+(k-10);
1329 }
else if (k>13&&k<17) {
1330 layername = TString(
"TID+ ")+ringlabel+(k-13);
1332 layername = TString(
"TEC- ")+ringlabel+(k-16);
1334 layername = TString(
"TEC+ ")+ringlabel+(k-16-
nTEClayers);
1348 for(;rIter!=rIterEnd;++rIter){
1350 if ( ! obj->
put(rIter->detid,range) )
1351 edm::LogError(
"SiStripHitEffFromCalibTree")<<
"[SiStripHitEffFromCalibTree::getNewObject] detid already exists"<<std::endl;
1360 if((x>=0)&&(y>=0)) phi = atan(y/x);
1361 else if((x>=0)&&(y<=0)) phi = atan(y/x) + 2*
Pi;
1362 else if((x<=0)&&(y>=0)) phi = atan(y/x) +
Pi;
1363 else phi = atan(y/x) +
Pi;
1373 ssV[
i][component] <<
"\n\t\t " 1383 ssV[
i][component] <<
" \t " 1387 ssV[
i][component] <<
"x x " << ( (BC.
BadApvs>>2)&0
x1 ) <<
" " 1390 ssV[
i][component] << ( (BC.
BadApvs>>2)&0
x1 ) <<
" " 1393 << ( (BC.
BadApvs>>5)&0x1 ) <<
" ";
1398 NBadComponent[
i][component][2]+= ( (BC.
BadApvs>>5)&0x1 )+ ( (BC.
BadApvs>>4)&0x1 ) + ( (BC.
BadApvs>>3)&0x1 ) +
1406 NBadComponent[
i][0][0]++;
1407 NBadComponent[
i][component][0]++;
vector< TH2F * > HotColdMaps
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
vector< TH1F * > layerfound_vsPU
const std::vector< BadComponent > & getBadComponentList() const
unsigned int tibLayer(const DetId &id) const
vector< TH1F * > layertotal_vsPU
virtual const std::array< const float, 4 > parameters() const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
TString GetLayerSideName(Long_t k)
#define DEFINE_FWK_MODULE(type)
vector< TH1F * > layertotal_vsCM
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
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)
virtual float width() const =0
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
def overlay(hists, ytitle, header, addon)
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 ComputeEff(vector< TH1F * > &vhfound, vector< TH1F * > &vhtotal, string name)
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]
~SiStripHitEffFromCalibTree() override
void fillc(int idmod, int RGBcode)
ContainerIterator getDataVectorBegin() const
Detector identifier class for the strip tracker.
bool _showOnlyGoodModules
virtual int nstrips() const =0
void algoEndJob() override
vector< TH1F * > layertotal_vsLumi
vector< TH1F * > layerfound_vsCM
RegistryIterator getRegistryVectorBegin() const
map< unsigned int, vector< int > > layertotal_perBx
void algoAnalyze(const edm::Event &e, const edm::EventSetup &c) override
TString GetLayerName(Long_t k)
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
vector< string > CalibTreeFilenames
map< unsigned int, double > BadModules
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int tecWheel(const DetId &id) const
T const * product() 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
vector< TH1F * > layerfound_vsLumi
unsigned int tecSide(const DetId &id) const