66 #include "TObjString.h" 77 #include "TGraphAsymmErrors.h" 80 #include "TEfficiency.h" 99 virtual void algoBeginJob();
100 virtual void algoEndJob()
override;
104 void makeHotColdMaps();
106 void totalStatistics();
108 void makeSummaryVsBx();
109 void ComputeEff(vector< TH1F* > &vhfound, vector< TH1F* > &vhtotal,
string name);
110 void makeSummaryVsLumi();
111 void makeSummaryVsCM();
112 TString GetLayerName(Long_t
k);
113 TString GetLayerSideName(Long_t k);
114 float calcPhi(
float x,
float y);
147 map< unsigned int, pair< unsigned int, unsigned int> > modCounter[23];
163 int goodlayertotal[35];
164 int goodlayerfound[35];
165 int alllayertotal[35];
166 int alllayerfound[35];
172 FileInPath_(
"CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")
196 if(_showRings) nTEClayers = 7;
225 ifstream badModules_file;
226 set<uint32_t> badModules_list;
229 uint32_t badmodule_detid;
230 int mods, fiber1, fiber2, fiber3;
231 if(badModules_file.is_open()) {
233 while ( getline (badModules_file,line) ) {
234 if(badModules_file.eof())
continue;
235 stringstream ss(line);
236 ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
237 if(badmodule_detid!=0 && mods==1 && (fiber1==1 || fiber2==1 || fiber3==1) )
238 badModules_list.insert(badmodule_detid);
240 badModules_file.close();
243 if(badModules_list.size())
cout<<
"Remove additionnal bad modules from the analysis: "<<endl;
244 set<uint32_t>::iterator itBadMod;
245 for (itBadMod=badModules_list.begin(); itBadMod!=badModules_list.end(); ++itBadMod)
246 cout<<
" "<<*itBadMod<<endl;
250 for(
int l=0;
l < 35;
l++) {
257 TH1F* resolutionPlots[23];
258 for(Long_t ilayer = 0; ilayer <23; ilayer++) {
259 resolutionPlots[ilayer] =
fs->
make<TH1F>(Form(
"resol_layer_%i",(
int)(ilayer)),
GetLayerName(ilayer),125,-125,125);
260 resolutionPlots[ilayer]->GetXaxis()->SetTitle(
"trajX-clusX [strip unit]");
273 cout <<
"A module is bad if efficiency < " <<
threshold <<
" and has at least " <<
nModsMin <<
" nModsMin." << endl;
281 CalibTreeFile->cd(
"anEff");
282 CalibTree = (TTree*)(gDirectory->Get(
"traj"));
284 TLeaf* BadLf =
CalibTree->GetLeaf(
"ModIsBad");
285 TLeaf* sistripLf =
CalibTree->GetLeaf(
"SiStripQualBad");
287 TLeaf* acceptLf =
CalibTree->GetLeaf(
"withinAcceptance");
288 TLeaf* layerLf =
CalibTree->GetLeaf(
"layer");
289 TLeaf* nHitsLf =
CalibTree->GetLeaf(
"nHits");
290 TLeaf* xLf =
CalibTree->GetLeaf(
"TrajGlbX");
291 TLeaf* yLf =
CalibTree->GetLeaf(
"TrajGlbY");
292 TLeaf* zLf =
CalibTree->GetLeaf(
"TrajGlbZ");
293 TLeaf* ResXSigLf =
CalibTree->GetLeaf(
"ResXSig");
294 TLeaf* TrajLocXLf =
CalibTree->GetLeaf(
"TrajLocX");
295 TLeaf* TrajLocYLf =
CalibTree->GetLeaf(
"TrajLocY");
296 TLeaf* ClusterLocXLf =
CalibTree->GetLeaf(
"ClusterLocX");
297 TLeaf* BunchLf =
CalibTree->GetLeaf(
"bunchx");
298 TLeaf* InstLumiLf =
CalibTree->GetLeaf(
"instLumi");
304 cout <<
"Successfully loaded analyze function with " << nevents <<
" events!\n";
308 for(
int j =0; j < nevents; j++) {
310 unsigned int isBad = (
unsigned int)BadLf->GetValue();
311 unsigned int quality = (
unsigned int)sistripLf->GetValue();
312 unsigned int id = (
unsigned int)idLf->GetValue();
313 unsigned int accept = (
unsigned int)acceptLf->GetValue();
314 unsigned int layer_wheel = (
unsigned int)layerLf->GetValue();
315 unsigned int layer = layer_wheel;
317 if(layer<14) layer = 10 + ((
id>>9)&0x3);
318 else layer = 13 + ((
id>>5)&0x7);
320 unsigned int nHits = (
unsigned int)nHitsLf->GetValue();
321 double x = xLf->GetValue();
322 double y = yLf->GetValue();
323 double z = zLf->GetValue();
324 double resxsig = ResXSigLf->GetValue();
325 double TrajLocX = TrajLocXLf->GetValue();
326 double TrajLocY = TrajLocYLf->GetValue();
327 double ClusterLocX = ClusterLocXLf->GetValue();
331 bool badquality =
false;
332 unsigned int bx = (
unsigned int)BunchLf->GetValue();
335 if(InstLumiLf!=0) instLumi = InstLumiLf->GetValue();
337 if(PULf!=0) PU = PULf->GetValue();
339 if(
_useCM) CM = CMLf->GetValue();
345 if(accept != 1 || nHits < 8)
continue;
346 if(quality == 1) badquality =
true;
349 if(!
_showTOB6TEC9 && (layer_wheel==10 || layer_wheel==22))
continue;
352 itBadMod = badModules_list.find(
id);
353 if(itBadMod!=badModules_list.end())
continue;
359 bool badflag =
false;
363 if(isBad == 1) badflag =
true;
366 if(isBad == 1 || resxsig >
_ResXSig) badflag =
true;
373 if (resxsig==1000.0) {
376 stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
377 stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
380 DetId ClusterDetId(
id);
385 stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
386 stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
395 const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
396 std::array<const float, 4>
const &
parameters = (*trapezoidalBounds).parameters();
397 hbedge = parameters[0];
398 htedge = parameters[1];
399 hapoth = parameters[3];
400 TrajLocXMid = TrajLocX / (1 + (htedge-hbedge)*TrajLocY/(htedge+hbedge)/hapoth) ;
401 stripTrajMid = TrajLocXMid/Pitch + nstrips/2.0 ;
406 if(!badquality && layer<23) {
407 if(resxsig!=1000.0) resolutionPlots[layer]->Fill(stripTrajMid-stripCluster);
408 else resolutionPlots[layer]->Fill(1000);
415 float stripInAPV = 64.;
419 if(resxsig == 1000.0) {
427 tapv = (
int) stripTrajMid/128;
428 capv = (
int) stripCluster/128;
429 stripInAPV = stripTrajMid-tapv*128;
431 if(stripInAPV<_stripsApvEdge || stripInAPV>128-
_stripsApvEdge)
continue;
432 if(tapv != capv) badflag =
true;
439 if(badflag && !badquality) {
445 hits[layer].push_back(temphit);
447 pair<unsigned int, unsigned int> newgoodpair (1,1);
448 pair<unsigned int, unsigned int> newbadpair (1,0);
450 map< unsigned int, pair< unsigned int, unsigned int> >::iterator it =
modCounter[layer].find(
id);
457 ((*it).second.first)++;
458 if(!badflag) ((*it).second.second)++;
483 else if(layer > 10 && layer < 14) {
484 if( ((
id>>13)&0x3) == 1) {
488 else if( ((
id>>13)&0x3) == 2) {
493 else if(layer > 13 && layer <= 22) {
494 if( ((
id>>18)&0x3) == 1) {
498 else if( ((
id>>18)&0x3) == 2) {
509 else if(layer > 10 && layer < 14) {
510 if( ((
id>>13)&0x3) == 1) {
514 else if( ((
id>>13)&0x3) == 2) {
519 else if(layer > 13 && layer <= 22) {
520 if( ((
id>>18)&0x3) == 1) {
524 else if( ((
id>>18)&0x3) == 2) {
545 int NTkBadComponent[4];
546 int NBadComponent[4][19][4];
550 std::stringstream ssV[4][19];
552 for(
int i=0;
i<4;++
i){
553 NTkBadComponent[
i]=0;
554 for(
int j=0;j<19;++j){
557 NBadComponent[
i][j][
k]=0;
564 for (
size_t i=0;
i<BC.size();++
i){
571 NTkBadComponent[0]++;
573 NTkBadComponent[1]+= ( (BC[
i].BadFibers>>2)&0x1 )+ ( (BC[
i].BadFibers>>1)&0x1 ) + ( (BC[
i].BadFibers)&0x1 );
575 NTkBadComponent[2]+= ( (BC[
i].BadApvs>>5)&0x1 )+ ( (BC[
i].BadApvs>>4)&0x1 ) + ( (BC[
i].BadApvs>>3)&0x1 ) +
576 ( (BC[
i].BadApvs>>2)&0x1 )+ ( (BC[
i].BadApvs>>1)&0x1 ) + ( (BC[
i].BadApvs)&0x1 );
628 unsigned int detid=rp->detid;
649 for(
int it=0;it<sqrange.second-sqrange.first;it++){
651 NTkBadComponent[3]+=range;
652 NBadComponent[subdet][0][3]+=range;
653 NBadComponent[subdet][component][3]+=range;
659 edm::LogError(
"SiStripQualityStatistics") <<
"PROBLEM detid " << detid <<
" value " << percentage<< std::endl;
665 cout <<
"\n-----------------\nNew IOV starting from run " << e.
id().
run() <<
" event " << e.
id().
event() <<
" lumiBlock " << e.
luminosityBlock() <<
" time " << e.
time().
value() <<
"\n-----------------\n";
666 cout <<
"\n-----------------\nGlobal Info\n-----------------";
667 cout <<
"\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
668 cout <<
"\nTracker:\t\t"<<NTkBadComponent[0]<<
"\t"<<NTkBadComponent[1]<<
"\t"<<NTkBadComponent[2]<<
"\t"<<NTkBadComponent[3];
670 cout <<
"\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<
"\t"<<NBadComponent[0][0][1]<<
"\t"<<NBadComponent[0][0][2]<<
"\t"<<NBadComponent[0][0][3];
671 cout <<
"\nTID:\t\t\t"<<NBadComponent[1][0][0]<<
"\t"<<NBadComponent[1][0][1]<<
"\t"<<NBadComponent[1][0][2]<<
"\t"<<NBadComponent[1][0][3];
672 cout <<
"\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<
"\t"<<NBadComponent[2][0][1]<<
"\t"<<NBadComponent[2][0][2]<<
"\t"<<NBadComponent[2][0][3];
673 cout <<
"\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<
"\t"<<NBadComponent[3][0][1]<<
"\t"<<NBadComponent[3][0][2]<<
"\t"<<NBadComponent[3][0][3];
676 for (
int i=1;
i<5;++
i)
677 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];
679 for (
int i=1;
i<4;++
i)
680 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];
681 for (
int i=4;
i<7;++
i)
682 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];
684 for (
int i=1;
i<7;++
i)
685 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];
687 for (
int i=1;
i<10;++
i)
688 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];
689 for (
int i=10;
i<19;++
i)
690 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];
693 cout <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
694 for (
int i=1;
i<5;++
i)
695 cout <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
697 for (
int i=1;
i<4;++
i)
698 cout <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
699 for (
int i=4;
i<7;++
i)
700 cout <<
"\nTID- Disk " <<
i-3 <<
" :" << ssV[1][
i].
str();
702 for (
int i=1;
i<7;++
i)
703 cout <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
705 for (
int i=1;
i<10;++
i)
706 cout <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
707 for (
int i=10;
i<19;++
i)
708 cout <<
"\nTEC- Disk " <<
i-9 <<
" :" << ssV[3][
i].
str();
712 badModules.open(
"BadModules.log");
713 badModules <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
714 for (
int i=1;
i<5;++
i)
715 badModules <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
717 for (
int i=1;
i<4;++
i)
718 badModules <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
719 for (
int i=4;
i<7;++
i)
720 badModules <<
"\nTID- Disk " <<
i-3 <<
" :" << ssV[1][
i].
str();
722 for (
int i=1;
i<7;++
i)
723 badModules <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
725 for (
int i=1;
i<10;++
i)
726 badModules <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
727 for (
int i=10;
i<19;++
i)
728 badModules <<
"\nTEC- Disk " <<
i-9 <<
" :" << ssV[3][
i].
str();
734 cout <<
"Entering hot cold map generation!\n";
735 TStyle* gStyle =
new TStyle(
"gStyle",
"myStyle");
737 gStyle->SetPalette(1);
738 gStyle->SetCanvasColor(kWhite);
739 gStyle->SetOptStat(0);
744 for(Long_t maplayer = 1; maplayer <=22; maplayer++) {
746 if(maplayer > 0 && maplayer <= 4) {
748 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TIB",(
int)(maplayer)),
"TIB",100,-1,361,100,-100,100);
749 temph2->GetXaxis()->SetTitle(
"Phi");
750 temph2->GetXaxis()->SetBinLabel(1,TString(
"360"));
751 temph2->GetXaxis()->SetBinLabel(50,TString(
"180"));
752 temph2->GetXaxis()->SetBinLabel(100,TString(
"0"));
753 temph2->GetYaxis()->SetTitle(
"Global Z");
754 temph2->SetOption(
"colz");
757 else if(maplayer > 4 && maplayer <= 10) {
759 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TOB",(
int)(maplayer-4)),
"TOB",100,-1,361,100,-120,120);
760 temph2->GetXaxis()->SetTitle(
"Phi");
761 temph2->GetXaxis()->SetBinLabel(1,TString(
"360"));
762 temph2->GetXaxis()->SetBinLabel(50,TString(
"180"));
763 temph2->GetXaxis()->SetBinLabel(100,TString(
"0"));
764 temph2->GetYaxis()->SetTitle(
"Global Z");
765 temph2->SetOption(
"colz");
768 else if(maplayer > 10 && maplayer <= 13) {
771 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID-",(
int)(maplayer-10)),
"TID-",100,-100,100,100,-100,100);
772 temph2->GetXaxis()->SetTitle(
"Global Y");
773 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
774 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
775 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
776 temph2->GetYaxis()->SetTitle(
"Global X");
777 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
778 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
779 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
780 temph2->SetOption(
"colz");
782 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TID+",(
int)(maplayer-10)),
"TID+",100,-100,100,100,-100,100);
783 temph2->GetXaxis()->SetTitle(
"Global Y");
784 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
785 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
786 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
787 temph2->GetYaxis()->SetTitle(
"Global X");
788 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
789 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
790 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
791 temph2->SetOption(
"colz");
794 else if(maplayer > 13) {
797 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC-",(
int)(maplayer-13)),
"TEC-",100,-120,120,100,-120,120);
798 temph2->GetXaxis()->SetTitle(
"Global Y");
799 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
800 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
801 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
802 temph2->GetYaxis()->SetTitle(
"Global X");
803 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
804 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
805 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
806 temph2->SetOption(
"colz");
808 temph2 =
fs->
make<TH2F>(Form(
"%s%i",
"TEC+",(
int)(maplayer-13)),
"TEC+",100,-120,120,100,-120,120);
809 temph2->GetXaxis()->SetTitle(
"Global Y");
810 temph2->GetXaxis()->SetBinLabel(1,TString(
"+Y"));
811 temph2->GetXaxis()->SetBinLabel(50,TString(
"0"));
812 temph2->GetXaxis()->SetBinLabel(100,TString(
"-Y"));
813 temph2->GetYaxis()->SetTitle(
"Global X");
814 temph2->GetYaxis()->SetBinLabel(1,TString(
"-X"));
815 temph2->GetYaxis()->SetBinLabel(50,TString(
"0"));
816 temph2->GetYaxis()->SetBinLabel(100,TString(
"+X"));
817 temph2->SetOption(
"colz");
821 for(Long_t mylayer = 1; mylayer <= 22; mylayer++) {
825 vector<hit>::const_iterator iter;
826 for(iter =
hits[mylayer].
begin(); iter !=
hits[mylayer].end(); iter++) {
830 if(mylayer > 0 && mylayer <= 4) {
833 HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
835 else if(mylayer > 4 && mylayer <= 10) {
838 HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
840 else if(mylayer > 10 && mylayer <= 13) {
843 int side = (((iter->id)>>13) & 0x3);
844 if(side == 1)
HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y,iter->x,1.);
845 else if(side == 2)
HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y,iter->x,1.);
849 else if(mylayer > 13) {
852 int side = (((iter->id)>>18) & 0x3);
853 if(side == 1)
HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y,iter->x,1.);
854 else if(side == 2)
HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y,iter->x,1.);
860 cout <<
"Finished HotCold Map Generation\n";
864 cout <<
"Entering TKMap generation!\n";
871 double myeff, mynum, myden;
873 for(Long_t
i = 1;
i <= 22;
i++) {
878 map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
882 mynum = (double)(((*ih).second).second);
883 myden = (double)(((*ih).second).first);
884 if(myden>0) myeff = mynum/myden;
890 cout <<
"Layer " <<
i <<
" module " << (*ih).first <<
" efficiency " << myeff <<
" " << (((*ih).second).
second) <<
"/" << (((*ih).second).
first) << endl;
897 cout <<
"Module " << (*ih).first <<
" layer " <<
i <<
" is under occupancy at " << (((*ih).second).
first) << endl;
907 tkmapnum->
fill((*ih).first,mynum);
914 tkmap->
save(
true, 0, 0,
"SiStripHitEffTKMap.png");
915 tkmapbad->
save(
true, 0, 0,
"SiStripHitEffTKMapBad.png");
917 tkmapnum->
save(
true, 0, 0,
"SiStripHitEffTKMapNum.png");
918 tkmapden->
save(
true, 0, 0,
"SiStripHitEffTKMapDen.png");
919 cout <<
"Finished TKMap Generation\n";
924 cout <<
"Entering SQLite file generation!\n";
925 std::vector<unsigned int> BadStripList;
926 unsigned short NStrips;
932 map< unsigned int, double >::const_iterator it;
937 cout <<
"Number of strips module " << (*it).first <<
" is " << NStrips << endl;
938 BadStripList.push_back(pQuality->
encode(0,NStrips,0));
940 id1=(
unsigned int)(*it).first;
941 cout <<
"ID1 shoudl match list of modules above " << id1 << endl;
945 BadStripList.clear();
959 for(Long_t
i=1;
i<5;
i++) {subdetfound[
i]=0; subdettotal[
i]=0;}
961 for(Long_t
i=1;
i<=22;
i++) {
973 cout <<
"The total efficiency is " << double(totalfound)/double(totaltotal) << endl;
974 cout <<
" TIB: " << double(subdetfound[1])/subdettotal[1] << endl;
975 cout <<
" TOB: " << double(subdetfound[2])/subdettotal[2] << endl;
976 cout <<
" TID: " << double(subdetfound[3])/subdettotal[3] << endl;
977 cout <<
" TEC: " << double(subdetfound[4])/subdettotal[4] << endl;
990 TH1F *
found =
fs->
make<TH1F>(
"found",
"found",nLayers+1,0,nLayers+1);
991 TH1F *
all =
fs->
make<TH1F>(
"all",
"all",nLayers+1,0,nLayers+1);
992 TH1F *found2 =
fs->
make<TH1F>(
"found2",
"found2",nLayers+1,0,nLayers+1);
993 TH1F *all2 =
fs->
make<TH1F>(
"all2",
"all2",nLayers+1,0,nLayers+1);
995 found->SetBinContent(0,-1);
996 all->SetBinContent(0,1);
999 for (Long_t
i=1;
i< nLayers+2; ++
i) {
1000 found->SetBinContent(
i,1
e-6);
1001 all->SetBinContent(
i,1);
1002 found2->SetBinContent(
i,1
e-6);
1003 all2->SetBinContent(
i,1);
1006 TCanvas *c7 =
new TCanvas(
"c7",
" test ",10,10,800,600);
1007 c7->SetFillColor(0);
1010 int nLayers_max=nLayers+1;
1012 for (Long_t
i=1;
i< nLayers_max; ++
i) {
1029 for (Long_t
i=11;
i< 14; ++
i) {
1061 TGraphAsymmErrors *gr =
fs->
make<TGraphAsymmErrors>(nLayers+1);
1062 gr->SetName(
"eff_good");
1063 gr->BayesDivide(found,all);
1065 TGraphAsymmErrors *gr2 =
fs->
make<TGraphAsymmErrors>(nLayers+1);
1066 gr2->SetName(
"eff_all");
1067 gr2->BayesDivide(found2,all2);
1069 for(
int j = 0; j<nLayers+1; j++){
1070 gr->SetPointError(j, 0., 0., gr->GetErrorYlow(j),gr->GetErrorYhigh(j) );
1071 gr2->SetPointError(j, 0., 0., gr2->GetErrorYlow(j),gr2->GetErrorYhigh(j) );
1074 gr->GetXaxis()->SetLimits(0,nLayers);
1075 gr->SetMarkerColor(2);
1076 gr->SetMarkerSize(1.2);
1077 gr->SetLineColor(2);
1078 gr->SetLineWidth(4);
1079 gr->SetMarkerStyle(20);
1081 gr->SetMaximum(1.001);
1082 gr->GetYaxis()->SetTitle(
"Efficiency");
1083 gStyle->SetTitleFillColor(0);
1084 gStyle->SetTitleBorderSize(0);
1087 gr2->GetXaxis()->SetLimits(0,nLayers);
1088 gr2->SetMarkerColor(1);
1089 gr2->SetMarkerSize(1.2);
1090 gr2->SetLineColor(1);
1091 gr2->SetLineWidth(4);
1092 gr2->SetMarkerStyle(21);
1094 gr2->SetMaximum(1.001);
1095 gr2->GetYaxis()->SetTitle(
"Efficiency");
1098 for ( Long_t
k=1;
k<nLayers+1;
k++) {
1109 gr->GetXaxis()->SetBinLabel(((
k+1)*100+2)/(nLayers)-4,label);
1110 gr2->GetXaxis()->SetBinLabel(((
k+1)*100+2)/(nLayers)-4,label);
1113 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-6,label);
1114 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-6,label);
1119 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-4,label);
1120 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-4,label);
1123 gr->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-7,label);
1124 gr2->GetXaxis()->SetBinLabel((
k+1)*100/(nLayers)-7,label);
1130 gr->GetXaxis()->SetNdivisions(36);
1133 TPad *
overlay =
new TPad(
"overlay",
"",0,0,1,1);
1134 overlay->SetFillStyle(4000);
1135 overlay->SetFillColor(0);
1136 overlay->SetFrameFillStyle(4000);
1137 overlay->Draw(
"same");
1141 TLegend *
leg =
new TLegend(0.70,0.27,0.88,0.40);
1142 leg->AddEntry(gr,
"Good Modules",
"p");
1144 leg->SetTextSize(0.020);
1145 leg->SetFillColor(0);
1148 c7->SaveAs(
"Summary.png");
1153 cout<<
"Computing efficiency vs bx"<<endl;
1158 for(
unsigned int ilayer=1; ilayer<
nLayers; ilayer++) {
1159 TH1F *hfound =
fs->
make<TH1F>(Form(
"foundVsBx_layer%i", ilayer),Form(
"layer %i", ilayer),3565,0,3565);
1160 TH1F *htotal =
fs->
make<TH1F>(Form(
"totalVsBx_layer%i", ilayer),Form(
"layer %i", ilayer),3565,0,3565);
1162 for(
unsigned int ibx=0; ibx<3566; ibx++){
1163 hfound->SetBinContent(ibx, 1
e-6);
1164 htotal->SetBinContent(ibx, 1);
1166 map<unsigned int, vector<int> >::iterator iterMapvsBx;
1168 hfound->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1170 if(iterMapvsBx->second[ilayer]>0) htotal->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1175 TGraphAsymmErrors *geff =
fs->
make<TGraphAsymmErrors>(3564);
1176 geff->SetName(Form(
"effVsBx_layer%i", ilayer));
1177 geff->SetTitle(
"Hit Efficiency vs bx - "+
GetLayerName(ilayer));
1178 geff->BayesDivide(hfound,htotal);
1181 TGraphAsymmErrors *geff_avg =
fs->
make<TGraphAsymmErrors>();
1182 geff_avg->SetName(Form(
"effVsBxAvg_layer%i", ilayer));
1183 geff_avg->SetTitle(
"Hit Efficiency vs bx - "+
GetLayerName(ilayer));
1184 geff_avg->SetMarkerStyle(20);
1186 int previous_bx=-80;
1196 ibx=iterMapvsBx->first;
1197 delta_bx=ibx-previous_bx;
1200 eff=found/(
float)total;
1202 geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1203 low = TEfficiency::Bayesian(total, found, .683, 1, 1,
false);
1204 up = TEfficiency::Bayesian(total, found, .683, 1, 1,
true);
1205 geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1214 found+=hfound->GetBinContent(ibx);
1215 total+=htotal->GetBinContent(ibx);
1221 eff=found/(
float)total;
1223 geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1224 low = TEfficiency::Bayesian(total, found, .683, 1, 1,
false);
1225 up = TEfficiency::Bayesian(total, found, .683, 1, 1,
true);
1226 geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1233 TString layername=
"";
1234 TString ringlabel=
"D";
1237 layername = TString(
"TIB L") +
k;
1238 }
else if (k>4 && k<11) {
1239 layername = TString(
"TOB L")+(k-4);
1240 }
else if (k>10 && k<14) {
1241 layername = TString(
"TID ")+ringlabel+(k-10);
1243 layername = TString(
"TEC ")+ringlabel+(k-13);
1257 for(
unsigned int ilayer=1; ilayer<
nLayers; ilayer++) {
1259 hfound = vhfound[ilayer];
1260 htotal = vhtotal[ilayer];
1266 for (Long_t
i=0;
i< hfound->GetNbinsX()+1; ++
i) {
1267 if( hfound->GetBinContent(
i)==0) hfound->SetBinContent(
i,1
e-6);
1268 if( htotal->GetBinContent(
i)==0) htotal->SetBinContent(
i,1);
1271 TGraphAsymmErrors *geff =
fs->
make<TGraphAsymmErrors>(hfound->GetNbinsX());
1272 geff->SetName(Form(
"%s_layer%i", name.c_str(), ilayer));
1273 geff->BayesDivide(hfound, htotal);
1274 if(name==
"effVsLumi") geff->SetTitle(
"Hit Efficiency vs inst. lumi. - "+
GetLayerName(ilayer));
1275 if(name==
"effVsPU") geff->SetTitle(
"Hit Efficiency vs pileup - "+
GetLayerName(ilayer));
1276 if(name==
"effVsCM") geff->SetTitle(
"Hit Efficiency vs common Mode - "+
GetLayerName(ilayer));
1277 geff->SetMarkerStyle(20);
1284 cout<<
"Computing efficiency vs lumi"<<endl;
1288 unsigned int nLayersForAvg = 0;
1289 float layerLumi = 0;
1294 cout<<
"Lumi summary: (avg over trajectory measurements)"<<endl;
1295 for(
unsigned int ilayer=1; ilayer<
nLayers; ilayer++) {
1299 if(layerLumi!=0 && layerPU!=0) {
1305 avgLumi/=nLayersForAvg;
1306 avgPU/=nLayersForAvg;
1307 cout<<
"Avg conditions: lumi :"<<avgLumi<<
" pu: "<<avgPU<<endl;
1315 cout<<
"Computing efficiency vs CM"<<endl;
1321 TString layername=
"";
1322 TString ringlabel=
"D";
1325 layername = TString(
"TIB L") +
k;
1326 }
else if (k>4&&k<11) {
1327 layername = TString(
"TOB L")+(k-4);
1328 }
else if (k>10&&k<14) {
1329 layername = TString(
"TID- ")+ringlabel+(k-10);
1330 }
else if (k>13&&k<17) {
1331 layername = TString(
"TID+ ")+ringlabel+(k-13);
1333 layername = TString(
"TEC- ")+ringlabel+(k-16);
1335 layername = TString(
"TEC+ ")+ringlabel+(k-16-
nTEClayers);
1349 for(;rIter!=rIterEnd;++rIter){
1351 if ( ! obj->
put(rIter->detid,range) )
1352 edm::LogError(
"SiStripHitEffFromCalibTree")<<
"[SiStripHitEffFromCalibTree::getNewObject] detid already exists"<<std::endl;
1361 if((x>=0)&&(y>=0)) phi = atan(y/x);
1362 else if((x>=0)&&(y<=0)) phi = atan(y/x) + 2*
Pi;
1363 else if((x<=0)&&(y>=0)) phi = atan(y/x) +
Pi;
1364 else phi = atan(y/x) +
Pi;
1374 ssV[
i][component] <<
"\n\t\t " 1379 ssV[
i][component] <<
"x " <<( (BC.
BadFibers>>1)&0x1 );
1382 ssV[
i][component] << ( (BC.
BadFibers>>1)&0x1 ) <<
" " 1384 ssV[
i][component] <<
" \t " 1385 << ( (BC.
BadApvs)&0x1 ) <<
" " 1386 << ( (BC.
BadApvs>>1)&0x1 ) <<
" ";
1388 ssV[
i][component] <<
"x x " << ( (BC.
BadApvs>>2)&0x1 ) <<
" " 1391 ssV[
i][component] << ( (BC.
BadApvs>>2)&0x1 ) <<
" " 1392 << ( (BC.
BadApvs>>3)&0x1 ) <<
" " 1393 << ( (BC.
BadApvs>>4)&0x1 ) <<
" " 1394 << ( (BC.
BadApvs>>5)&0x1 ) <<
" ";
1399 NBadComponent[
i][component][2]+= ( (BC.
BadApvs>>5)&0x1 )+ ( (BC.
BadApvs>>4)&0x1 ) + ( (BC.
BadApvs>>3)&0x1 ) +
1407 NBadComponent[
i][0][0]++;
1408 NBadComponent[
i][component][0]++;
vector< TH2F * > HotColdMaps
T getParameter(std::string const &) const
EventNumber_t event() const
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
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
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
~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)
virtual float width() const =0
T x() const
Cartesian x coordinate.
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]
void fillc(int idmod, int RGBcode)
ContainerIterator getDataVectorBegin() const
Detector identifier class for the strip tracker.
bool _showOnlyGoodModules
virtual int nstrips() const =0
virtual void algoEndJob() override
vector< TH1F * > layertotal_vsLumi
vector< TH1F * > layerfound_vsCM
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)
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