示例#1
0
 void BB::print_short() {
   lprintf("BB%-3ld %#lx [%ld..%ld]; prevs ",
           (void*)id(), this, (void*)first->id(), (void*)last->id());
   prevsBBLen = _prevs->length();
   _prevs->apply(printPrevBBs);
   lprintf("; ");
   if (next ()) lprintf("next BB%ld", (void*)next ()->id());
   if (next1()) lprintf(    " BB%ld", (void*)next1()->id());
 }
示例#2
0
Segment* Segment::next1(SegmentTypes types) const
      {
      for (Segment* s = next1(); s; s = s->next1()) {
            if (s->subtype() & types)
                  return s;
            }
      return 0;
      }
示例#3
0
 void AbstractArrayAtNode::gen() {
   BasicNode::gen();
   Label* argFail = NULL;          // if arg isn't a smi
   Label* indexFail = NULL;        // if arg is out of bounds
   Assembler* a = theAssembler;
   Location arr = genHelper->moveToReg(_src, Temp2);
   Location index = genHelper->moveToReg(arg, Temp1);
   Location size = Temp3;
   // load array size now (avoids load interlock for range check)
   a->LoadI(arr, sizeOffset, size);  
   if (!intArg) {
     // CP may have propagated a constant into arg
     intArg = arg->isConstPReg() && ((ConstPReg*)arg)->constant->is_smi();
   }
   if (!intArg) {
     // test arg for smiOop
     if (SICCountTypeTests) {
       a->startTypeTest(1, false, true);
       a->doOneTypeTest();
     }
     if (SICCountIntTagTests) a->markTagTest(1);
     a->AndCCI(index, Tag_Mask, G0);
     argFail = argFail->unify(a->BneForward(false));
     if (SICCountTypeTests) a->endTypeTest();
   }
   argFail = argFail->unify(testArg2());
   a->SubCCR(index, size, G0);
   indexFail = a->BgeuForward(false);
   Location res = isRegister(_dest->loc) ? _dest->loc : Temp1;
   bool needDestStore = genAccess(arr, index, res);
   if (needDestStore && !isRegister(_dest->loc)) {
     genHelper->moveRegToLoc(res, _dest->loc);
   }
   Label* done = a->BraForward(true);
   MergeNode* failMerge = (MergeNode*)next1();
   if (argFail) {
     argFail->define();
     if (error) {
       Location err = isRegister(error->loc) ? error->loc : Temp1;
       genHelper->loadImmediateOop(VMString[BADTYPEERROR], err);
       if (err != error->loc) genHelper->moveRegToLoc(err, error->loc);
     }
     if (failMerge) // test added by dmu 4/27/96
       failMerge->l = failMerge->l->unify(a->BraForward(true));
   }
   indexFail->define();
   if (error) {
     Location err = isRegister(error->loc) ? error->loc : Temp1;
     genHelper->loadImmediateOop(VMString[BADINDEXERROR], err);
     if (err != error->loc) genHelper->moveRegToLoc(err, error->loc);
   }
   if (failMerge) // test added by dmu 4/27/96
     failMerge->l = failMerge->l->unify(a->BraForward(true));
   done->define();
 }
示例#4
0
文件: file1.c 项目: ansrivas/codes
/**************************************************************************
*
* FUNCTION NAME: main
*
* DESCRIPTION: main for storage allocation program
*
* RETURNS: Returns nothing
**************************************************************************/
int main()
{
	a1 = 2;
	printf("\na1 = %d\n", a1);
	next();
	printf("\na1 = %d\n", a1);
	next1();
	printf("\na1 = %d\n", a1);

	return 0;
}
示例#5
0
Segment* Segment::nextCR(int track) const
      {
      Segment* seg = next1();
      for (; seg; seg = seg->next1()) {
            if (seg->subtype() == SegChordRest) {
                  if (track != -1 && !seg->element(track))
                        continue;
                  return seg;
                  }
            }
      return 0;
      }
示例#6
0
	lucene::analysis::Token* next(lucene::analysis::Token* token)
	{
		while (1)
		{
			int retTokenLength = 0;
			lucene::analysis::Token* ret = next1(token, retTokenLength);
			if (!ret)
                return NULL;

			if (retTokenLength > 0)
				return ret;
		}
	}
示例#7
0
static void remove(int i) {
    int prevIndex = prev1(i);
    int nextIndex = next1(i);

    if (prevIndex == 0) {
        /* at head */
        avail = nextIndex;
    } else {
        /* in the middle */
        next(prevIndex,nextIndex);
    }
    if (nextIndex != 0) {
        prev(nextIndex,prevIndex);
    }
}
示例#8
0
void writepdfs(std::string const c) {

  //gROOT->SetBatch(true);
  
  TFile * f1 = TFile::Open(c.c_str());

  TIter next1(f1->GetListOfKeys());
  TKey * key1;

  while ((key1 = (TKey*)next1())) {

    TCanvas * c1 = (TCanvas*)key1->ReadObj();
   
    c1->Draw();

    std::string str(c1->GetName());

    str += ".pdf";

    c1->SaveAs(str.c_str());
 
  }

}
示例#9
0
  void TArithRRNode::gen() {
    BasicNode::gen();
    if (constResult) {
      Location dest = isRegister(_dest->loc) ? _dest->loc : Temp2;
      Location l_ = genHelper->moveToReg(constResult, dest);
      if (l_ != _dest->loc) genHelper->moveRegToLoc(dest, _dest->loc);
    } else {
      Location t1, t2;
      bool reversed;
      if (SICCountIntTagTests)
        theAssembler->markTagTest(arg1IsInt ? 1 : 2);
      Location dest = arith_genHelper(_src, oper, _dest, op,
                                      t1, t2, reversed);

      Node* n= next1();
      if (n) {
        Label* l_= theAssembler->BvsForward(false);
        n->l= l_->unify(n->l);
      }
      
      // fill delay slot with tag test
      // caution: code below depends on temp reg assignments in arith_genHelper
      // also, the code in sicPrimline.c depends on Temp1 being set correctly
      if (arg1IsInt) {
        // only need to check arg2
        Location t = reversed ? t1 : t2;
        if (t == G0) {
          theAssembler->Nop();
        } else {
          theAssembler->AndCCI(t, Tag_Mask, Temp1);
        }
      } else {
        theAssembler->OrR(t1, t2, Temp1);
      }
      
      if (dest != _dest->loc) {
        // store result on stack (success case)
        theAssembler->StoreI(SP, spOffset(_dest->loc), dest);
      }
    }
  }
示例#10
0
 void BranchNode::gen() {
   BasicNode::gen();
   Label* l_;
   switch (op) {
    case ALBranchOp:   l_ = theAssembler->BraForward(false);   break;
    case EQBranchOp:   l_ = theAssembler->BeqForward(false);   break;
    case NEBranchOp:   l_ = theAssembler->BneForward(false);   break;
    case LTBranchOp:   l_ = theAssembler->BltForward(false);   break;
    case LEBranchOp:   l_ = theAssembler->BleForward(false);   break;
    case LTUBranchOp:  l_ = theAssembler->BltuForward(false);  break;
    case LEUBranchOp:  l_ = theAssembler->BleuForward(false);  break;
    case GTBranchOp:   l_ = theAssembler->BgtForward(false);   break;
    case GEBranchOp:   l_ = theAssembler->BgeForward(false);   break;
    case GTUBranchOp:  l_ = theAssembler->BgtuForward(false);  break;
    case GEUBranchOp:  l_ = theAssembler->BgeuForward(false);  break;
    case VSBranchOp:   l_ = theAssembler->BvsForward(false);   break;
    case VCBranchOp:   l_ = theAssembler->BvcForward(false);   break;
    default:           ShouldNotReachHere(); // unexpected branch type
   }
   theAssembler->Nop();
   Node* n = next1();
   n->l = l_->unify(n->l);
 }
示例#11
0
void* malloc(long bytes) {
    //Debug::printf("malloc(%d)\n",bytes);
    if (bytes == 0) return (void*) array;

    int ints = ((bytes + 3) / 4) + 2;
    if (ints < 4) ints = 4;

    int p = avail;
    sanity(p);

    void* res = 0;
    while ((p != 0) && (res == 0)) {
        if (!isAvail(p)) {
            //Debug::panic("block @ %d is not available\n",p);
        }
        int sz = size(p);
        if (sz >= ints) {
            remove(p);
            int extra = sz - ints;
            if (extra >= 4) {
                makeTaken(p,ints);
                //Debug::printf("idx = %d, sz = %d, ptr = %p\n",p,ints,&array[p+1]);
                makeAvail(p+ints,extra);
            } else {
                makeTaken(p,sz);
                //Debug::printf("idx = %d, sz = %d, ptr = %p\n",p,sz,&array[p+1]);
            }
            res = &array[p+1];
        } else {
            p = next1(p);
        }
    }
    if (res == 0) {
        //Debug::panic("heap is full, bytes=0x%x",bytes);
    }
    return res;
}        
示例#12
0
			uint64_t next1(uint64_t i) const
			{
				return next1(A.get(),i);
			}
示例#13
0
void RectMesh::populate() {
	vertices = new float[vertexCount * 3];
	for (unsigned i = 0; i < vertexCount; i++) {
		vertices[i * 3 + 0] = points[i][0];
		vertices[i * 3 + 1] = points[i][1];
		vertices[i * 3 + 2] = points[i][2];
	}

	indicies = new GLint[indicesCount];
	unsigned vertexIndex = 0;
	unsigned index = 0;
	bool odd = true;
	bool up = true;
	while (index < indicesCount) {
		indicies[index] = vertexIndex;
		if ((index + 1) % (2 * length) == 0) {
			indicies[++index] = vertexIndex;
			odd = !odd;
			up = !up;
		}

		if (up) {
			vertexIndex += length;
		} else {
			if (odd) {
				vertexIndex -= (length - 1);
			} else {
				vertexIndex -= (length + 1);
			}
		}

		up = !up;
		index++;
	}

	normals = new float[vertexCount * 3];
	unsigned int c, n1, n2;
	unsigned int prevC = 0;
	odd = true;
	for (unsigned i = 0; i < indicesCount; i++) {
		c = indicies[i];
		if (i == indicesCount - 2) {
			n1 = indicies[i - 1];
			n2 = indicies[i + 1];
		} else if (i == indicesCount - 1) {
			n1 = indicies[i - 2];
			n2 = indicies[i - 1];
		} else if (i % length == length - 2) {
			n1 = indicies[i - 1];
			n2 = indicies[i + 1];
		} else {
			n1 = indicies[i + 1];
			n2 = indicies[i + 2];
		}

		vec3 currentPoint(vertices[c * 3 + 0], vertices[c * 3 + 1], vertices[c * 3 + 2]);
		vec3 next1(vertices[n1 * 3 + 0], vertices[n1 * 3 + 1], vertices[n1 * 3 + 2]);
		vec3 next2(vertices[n2 * 3 + 0], vertices[n2 * 3 + 1], vertices[n2 * 3 + 2]);

		vec3 v1 = next1 - currentPoint;
		vec3 v2 = next2 - currentPoint;
		vec3 crossV = normalize(cross(v1, v2));

		if ((prevC == c) && (prevC != 0)) {
			odd = !odd;
		}

		if (!odd) {
			crossV = -crossV;
		}

		if (c > vertexCount - length - 1) {
			crossV = -crossV;
		}

		normals[c * 3 + 0] = crossV[0];
		normals[c * 3 + 1] = crossV[1];
		normals[c * 3 + 2] = crossV[2];
		prevC = c;
	}

	for (unsigned i = 0; i < indicesCount; i++) {
		c = indicies[i];
		if (i == indicesCount - 2) {
			n1 = indicies[i - 1];
			n2 = indicies[i];
		} else if (i == indicesCount - 1) {
			n1 = indicies[i - 2];
			n2 = indicies[i - 1];
		} else {
			n1 = indicies[i + 1];
			n2 = indicies[i + 2];
		}

		vec3 currentNormal(normals[c * 3 + 0], normals[c * 3 + 1], normals[c * 3 + 2]);
		vec3 nextNormal1(normals[n1 * 3 + 0], normals[n1 * 3 + 1], normals[n1 * 3 + 2]);
		vec3 nextNormal2(normals[n2 * 3 + 0], normals[n2 * 3 + 1], normals[n2 * 3 + 2]);

		vec3 totalNormal = normalize(currentNormal + nextNormal1 + nextNormal2);

		normals[c * 3 + 0] = totalNormal[0];
		normals[c * 3 + 1] = totalNormal[1];
		normals[c * 3 + 2] = totalNormal[2];
	}
}
示例#14
0
void addcanvases(){
  fSavePath = "data/perfLL";
  const Int_t narr = 20;
  gStyle->SetOptStat(0); 
  gStyle->SetOptTitle(0); 

  TFile *f1 = TFile::Open("c_l3.root");
  TIter next1(f1->GetListOfKeys());
  TKey *key1;
  Int_t it1 = 0;
  TCanvas *carr1[narr];

  while((key1 = (TKey*)next1())) {
    TClass *cl = gROOT->GetClass(key1->GetClassName());
    if (!cl->InheritsFrom("TCanvas")) continue;
    carr1[it1] = (TCanvas*)key1->ReadObj();
    it1++;
  }

  TFile *f2 = TFile::Open("c_l0.root");
  TIter next2(f2->GetListOfKeys());
  TKey *key2;
  Int_t it2 = 0;
  TCanvas *carr2[narr];

  while ((key2 = (TKey*)next2())) {
    TClass *cl = gROOT->GetClass(key2->GetClassName());
    if (!cl->InheritsFrom("TCanvas")) continue;
    carr2[it2] = (TCanvas*)key2->ReadObj();
    it2++;
  }

  TLegend *leg = new TLegend(0.2,0.7,0.5,0.9);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);


  for(Int_t i=0; i<it2; i++){
    carr1[i]->Draw();
    //leg->AddEntry( carr1[i],"3x3 full coverage","l");
    //leg->Draw();
    canvasAdd(carr1[i]);
    TIter next(carr2[i]->GetListOfPrimitives());
    TObject *obj;

    while((obj = next())){
      // if(obj->InheritsFrom("TH1F")){
      // 	TH1F *h = (TH1F*)obj;
      // 	std::cout<<"name "<< h->GetName() <<std::endl;      
      // 	h->SetLineStyle(7);
      // 	h->SetLineWidth(2);
      //   h->Draw("same");
      // }
      if(obj->InheritsFrom("TGraph")){
	TGraph *h = (TGraph*)obj;
	std::cout<<"name "<< h->GetName() <<std::endl;      
	h->SetLineColor(32);
	h->SetMarkerColor(2);
	//	h->SetLineWidth(2);
        h->Draw("same PL");
	// leg->AddEntry(h,"6.5x6.5 MCP PMTs coverage","lp");
	// leg->Draw();
      }

    }
  }
  std::cout<<"save all  " <<std::endl;
  
  canvasSave(0,1);
}
void makePlots_Combinations(short makePlots=0) {

	TString dirPlots("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/");

	TFile fIn ("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU140_sf1_nz4_pt3_5oo6_14k.root"); TString sLogic ("5oo6"); TString pName("Neutrino_PU140_sf1_nz4_pt3_5oo6_14k"); TString pTitle(" PU140 SF=1 Nz=4 Pt>3 GeV/c");
	TFile fIn2("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU140_sf1_nz4_pt3_6oo6_14k.root"); TString sLogic2("6oo6"); //TString pName("Neutrino_PU140_sf1_nz4_pt3_6oo6_14k"); TString pTitle(" PU140 SF=1 Nz=4 Pt>3 GeV/c");
	TFile fInOR("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU140_sf1_nz4_pt3_5oo6_14k_OverlapRemoved.root");

//	TFile fIn("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU200_sf1_nz4_pt3_5oo6_4k.root"); TString sLogic("5oo6"); TString pName("Neutrino_PU200_sf1_nz4_pt3_5oo6_4k"); TString pTitle(" PU200 SF=1 Nz=4 Pt>3 GeV/c");
//	TFile fInOR("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU200_sf1_nz4_pt3_5oo6_4k_OverlapRemoved.root");

//	TFile fIn("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU250_sf1_nz4_pt3_5oo6_4k.root"); TString sLogic("5oo6"); TString pName("Neutrino_PU250_sf1_nz4_pt3_5oo6_4k"); TString pTitle(" PU250 SF=1 Nz=4 Pt>3 GeV/c");
//	TFile fInOR("/home/rossin/Dropbox/TT/Work/figures_stubCleaning/stubCleaning_Neutrino_PU250_sf1_nz4_pt3_5oo6_4k_OverlapRemoved.root");


	TH1* h1stubsInLayer  [6][2];
	TH1* h1stubsInLayerOR[6][2];
	TH1* h1RoadPerEvent  [2];
	TH1* h1RoadPerEventOR[2];
	TH1* h1CombPerRoad   [2];
	TH1* h1CombPerRoadOR [2];
	TH1* h1CombPerEvent  [2];
	TH1* h1CombPerEventOR[2];

	TH1* h1RoadPerEvent6oo6  [2];
	TH1* h1CombPerRoad6oo6   [2];
	TH1* h1CombPerEvent6oo6  [2];

    TString sClean[2] = {TString(""), TString("_Cleaned")};

    for (unsigned short iLay=0; iLay<6; ++iLay) {
	    TList* tl = fIn.GetListOfKeys();
	    TIter next(tl);
	    TObject *obj;
	    char cc[20];
	    sprintf(cc,"_%d",iLay);
	    TString hString("h1stubsInLayer__"+sLogic+TString(cc));
	    while ((obj=next())) {
	    	TString hName(obj->GetName());
	    	if (hName==hString) {
	    		for (unsigned short iClean = 0; iClean < 2; ++iClean) {
	    		    char cc2[100];
	    			h1stubsInLayer  [iLay][iClean] = (TH1*) fIn  .Get(hName+sClean[iClean]);
	    			sprintf(cc2,"L%d - ",iLay+5);
	    			h1stubsInLayer  [iLay][iClean]->SetTitle(TString(cc2)+sLogic+pTitle);
	    			h1stubsInLayerOR[iLay][iClean] = (TH1*) fInOR.Get(hName+sClean[iClean]);
	    			if (h1stubsInLayer  [iLay][iClean]==0) {
		    			std::cout << "ERROR. " << hName+sClean[iClean] << " not loaded." << std::endl;
		    			return;
	    			}
	    			if (h1stubsInLayerOR[iLay][iClean]==0) {
		    			std::cout << "ERROR. " << hName+sClean[iClean] << " overlap removed not loaded." << std::endl;
		    			return;
	    			}
	    		}
	    	}
	    }
//	    std::cout << h1stubsInLayer  [iLay][0] << "\t" << h1stubsInLayer  [iLay][1] << "\t" << h1stubsInLayerOR[iLay][0] << "\t" << h1stubsInLayerOR[iLay][1] << std::endl;
	}

    for (unsigned short iClean = 0; iClean < 2; ++iClean) {
    	TString hString("h1RoadPerEvent_"+sLogic);
    	h1RoadPerEvent  [iClean] = (TH1*) fIn  .Get(hString+sClean[iClean]);
    	h1RoadPerEventOR[iClean] = (TH1*) fInOR.Get(hString+sClean[iClean]);
    	hString=TString("h1CombPerRoad_")+sLogic;
    	h1CombPerRoad   [iClean] = (TH1*) fIn  .Get(hString+sClean[iClean]);
    	h1CombPerRoadOR [iClean] = (TH1*) fInOR.Get(hString+sClean[iClean]);
    	hString=TString("h1CombPerEvent_")+sLogic;
    	h1CombPerEvent   [iClean] = (TH1*) fIn  .Get(hString+sClean[iClean]);
    	h1CombPerEventOR [iClean] = (TH1*) fInOR.Get(hString+sClean[iClean]);

    	hString=TString("h1RoadPerEvent_"+sLogic2);
    	h1RoadPerEvent6oo6 [iClean] = (TH1*) fIn2  .Get(hString+sClean[iClean]);
    	hString=TString("h1CombPerRoad_")+sLogic2;
    	h1CombPerRoad6oo6  [iClean] = (TH1*) fIn2  .Get(hString+sClean[iClean]);
    	hString=TString("h1CombPerEvent_")+sLogic2;
    	h1CombPerEvent6oo6 [iClean] = (TH1*) fIn2  .Get(hString+sClean[iClean]);
}

    TString cName("cStubsPerLayer_"+sLogic+pName);
    TString cTitle("StubsPerLayer "+sLogic+pTitle);
    TCanvas* cStubsPerLayer = new TCanvas(cName,cTitle,0,0,1400,900);
    cStubsPerLayer->Divide(3,2);
    for (unsigned short iLay=0; iLay<6; ++iLay) {
    	char cc3[100];
    	cStubsPerLayer->cd(iLay+1);
    	gPad->SetLogy();
    	h1stubsInLayer  [iLay][0]->DrawCopy();
    	TLegend* tl = new TLegend(0.3,0.75,0.9,0.9);
		sprintf(cc3,"Mean # stubs: %3.2lf",h1stubsInLayer  [iLay][0]->GetMean());
		TLegendEntry* tle = tl->AddEntry(h1stubsInLayer  [iLay][0],cc3,"l");
		tle->SetLineColor(h1stubsInLayer  [iLay][0]->GetLineColor());
		tle->SetLineWidth(h1stubsInLayer  [iLay][0]->GetLineWidth());
		tl->Draw("L");
    }
    if (makePlots) {
    	cStubsPerLayer->SaveAs(dirPlots+cName+"__.pdf");
    	cStubsPerLayer->SaveAs(dirPlots+cName+"__.png");
    }
    for (unsigned short iLay=0; iLay<6; ++iLay) {
    	char cc3[100];
    	cStubsPerLayer->cd(iLay+1);
    	gPad->SetLogy();
    	h1stubsInLayerOR[iLay][0]->SetLineColor(2);
    	h1stubsInLayerOR[iLay][0]->DrawCopy("same");
    	TLegend* tl = new TLegend(0.25,0.75,0.9,0.9);
		sprintf(cc3,"Mean # stubs: %3.2lf",h1stubsInLayer  [iLay][0]->GetMean());
		TLegendEntry* tle = tl->AddEntry(h1stubsInLayer  [iLay][0],cc3,"l");
		tle->SetLineColor(h1stubsInLayer  [iLay][0]->GetLineColor());
		tle->SetLineWidth(h1stubsInLayer  [iLay][0]->GetLineWidth());
		sprintf(cc3,"Mean # stubs Overlap Removed: %3.2lf",h1stubsInLayerOR[iLay][0]->GetMean());
		tle = tl->AddEntry(h1stubsInLayerOR[iLay][0],cc3,"l");
		tle->SetLineColor(h1stubsInLayerOR[iLay][0]->GetLineColor());
		tle->SetLineWidth(h1stubsInLayerOR[iLay][0]->GetLineWidth());
		tl->Draw("L");
    }
    if (makePlots) {
    	cStubsPerLayer->SaveAs(dirPlots+cName+"_OR_.pdf");
    	cStubsPerLayer->SaveAs(dirPlots+cName+"_OR_.png");
    }

    cName=TString("cStubsPerLayerDsClean_")+sLogic+pName;
    cTitle=TString("StubsPerLayer Ds clean ")+sLogic+pTitle;
    TCanvas* cStubsPerLayerDsClean = new TCanvas(cName,cTitle,0,0,1400,900);
    cStubsPerLayerDsClean->Divide(3,2);
    for (unsigned short iLay=0; iLay<6; ++iLay) {
    	char cc3[100];
    	cStubsPerLayerDsClean->cd(iLay+1);
    	gPad->SetLogy();
    	h1stubsInLayer  [iLay][0]->DrawCopy();
    	h1stubsInLayer  [iLay][1]->SetLineColor(8);
    	h1stubsInLayer  [iLay][1]->DrawCopy("same");
    	TLegend* tl = new TLegend(0.25,0.75,0.9,0.9);
		sprintf(cc3,"Mean # stubs: %3.2lf",h1stubsInLayer  [iLay][0]->GetMean());
		TLegendEntry* tle = tl->AddEntry(h1stubsInLayer  [iLay][0],cc3,"l");
		tle->SetLineColor(h1stubsInLayer  [iLay][0]->GetLineColor());
		tle->SetLineWidth(h1stubsInLayer  [iLay][0]->GetLineWidth());
		sprintf(cc3,"Mean # stubs #Deltas clean: %3.2lf",h1stubsInLayer  [iLay][1]->GetMean());
		tle = tl->AddEntry(h1stubsInLayer  [iLay][1],cc3,"l");
		tle->SetLineColor(h1stubsInLayer  [iLay][1]->GetLineColor());
		tle->SetLineWidth(h1stubsInLayer  [iLay][1]->GetLineWidth());
		tl->Draw("L");
    }
    if (makePlots) {
    	cStubsPerLayerDsClean->SaveAs(dirPlots+cName+"__.pdf");
    	cStubsPerLayerDsClean->SaveAs(dirPlots+cName+"__.png");
    }

    cName=TString("cStubsPerLayerDsCleanOR_")+sLogic+pName;
    cTitle=TString("StubsPerLayer #Deltas clean Overlap Removed ")+sLogic+pTitle;
    TCanvas* cStubsPerLayerDsCleanOR = new TCanvas(cName,cTitle,0,0,1400,900);
    cStubsPerLayerDsCleanOR->Divide(3,2);
    for (unsigned short iLay=0; iLay<6; ++iLay) {
    	char cc3[100];
    	cStubsPerLayerDsCleanOR->cd(iLay+1);
    	gPad->SetLogy();
    	h1stubsInLayer  [iLay][0]->DrawCopy();
    	h1stubsInLayerOR[iLay][0]->SetLineColor(2);
    	h1stubsInLayerOR[iLay][0]->DrawCopy("same");
    	h1stubsInLayerOR[iLay][1]->SetLineColor(6);
    	h1stubsInLayerOR[iLay][1]->DrawCopy("same");
    	TLegend* tl = new TLegend(0.25,0.70,0.9,0.9);
		sprintf(cc3,"Mean # stubs: %3.2lf",h1stubsInLayer  [iLay][0]->GetMean());
		TLegendEntry* tle = tl->AddEntry(h1stubsInLayer  [iLay][0],cc3,"l");
		tle->SetLineColor(h1stubsInLayer  [iLay][0]->GetLineColor());
		tle->SetLineWidth(h1stubsInLayer  [iLay][0]->GetLineWidth());
		sprintf(cc3,"Mean # stubs Ov. Rem.: %3.2lf",h1stubsInLayerOR[iLay][0]->GetMean());
		tle = tl->AddEntry(h1stubsInLayerOR[iLay][0],cc3,"l");
		tle->SetLineColor (h1stubsInLayerOR[iLay][0]->GetLineColor());
		tle->SetLineWidth (h1stubsInLayerOR[iLay][0]->GetLineWidth());
		sprintf(cc3,"Mean # stubs Ds clean Ov. Rem.: %3.2lf",h1stubsInLayerOR[iLay][1]->GetMean());
		tle = tl->AddEntry(h1stubsInLayerOR[iLay][1],cc3,"l");
		tle->SetLineColor (h1stubsInLayerOR[iLay][1]->GetLineColor());
		tle->SetLineWidth (h1stubsInLayerOR[iLay][1]->GetLineWidth());
		tl->Draw("L");
    }
    if (makePlots) {
    	cStubsPerLayerDsCleanOR->SaveAs(dirPlots+cName+"__.pdf");
    	cStubsPerLayerDsCleanOR->SaveAs(dirPlots+cName+"__.png");
    }

	const short nQuant = 4;
	double  percentiles   [nQuant] = {0.90, 0.95, 0.99, 0.999};
	double xpercentiles[6][nQuant];

    cName=TString("cRoadPerEvent_")+sLogic+pName;
    cTitle=TString("Roads per Tower "+sLogic+pTitle);
    TCanvas* cRoadPerEvent = new TCanvas(cName,cTitle,0,0,1400,900);
    cRoadPerEvent->SetLogy();
    h1RoadPerEvent  [0]->SetTitle(cTitle);
    h1RoadPerEvent  [0]->DrawCopy();
//    h1RoadPerEvent6oo6[0]->SetLineColor(14);
//    h1RoadPerEvent6oo6[0]->DrawCopy("same");
	char cc3[100];
	h1RoadPerEvent  [0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"                 #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1RoadPerEvent  [0]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	TLegend* tl = new TLegend(0.25,0.84,0.9,0.9);
	TLegendEntry* tle = tl->AddEntry(h1RoadPerEvent  [0],cc3,"l");
	tle->SetLineColor(h1RoadPerEvent  [0]->GetLineColor());
	tle->SetLineWidth(h1RoadPerEvent  [0]->GetLineWidth());
//	h1RoadPerEvent6oo6[0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
//	sprintf(cc3,"# roads/tower-6/6. #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1RoadPerEvent6oo6[0]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
//	tle = tl->AddEntry(h1RoadPerEvent6oo6[0],cc3,"l");
//	tle->SetLineColor(h1RoadPerEvent6oo6[0]->GetLineColor());
//	tle->SetLineWidth(h1RoadPerEvent6oo6[0]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cRoadPerEvent->SaveAs(dirPlots+cName+"__.pdf");
		cRoadPerEvent->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cRoadPerEvent_OR_")+sLogic+pName;
    cTitle=TString("Roads per Tower "+sLogic+pTitle);
    TCanvas* cRoadPerEventOR = new TCanvas(cName,cTitle,0,0,1400,900);
    cRoadPerEventOR->SetLogy();
    h1RoadPerEvent  [0]->SetTitle(cTitle);
    h1RoadPerEvent  [0]->DrawCopy();
	h1RoadPerEvent  [0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"                 #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1RoadPerEvent  [0]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	tl = new TLegend(0.25,0.8,0.9,0.9);
	tle = tl->AddEntry(h1RoadPerEvent  [0],cc3,"l");
	tle->SetLineColor(h1RoadPerEvent  [0]->GetLineColor());
	tle->SetLineWidth(h1RoadPerEvent  [0]->GetLineWidth());
    h1RoadPerEventOR[0]->SetLineColor(2);
    h1RoadPerEventOR[0]->DrawCopy("same");
	h1RoadPerEventOR[0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"Ov. Masked #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1RoadPerEventOR[0]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	tle = tl->AddEntry(h1RoadPerEventOR[0],cc3,"l");
	tle->SetLineColor(h1RoadPerEventOR[0]->GetLineColor());
	tle->SetLineWidth(h1RoadPerEventOR[0]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cRoadPerEventOR->SaveAs(dirPlots+cName+"__.pdf");
		cRoadPerEventOR->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cCombPerRoad_")+sLogic+pName;
    cTitle=TString("Combinations per Road "+sLogic+pTitle);
    TCanvas* cCombPerRoad = new TCanvas(cName,cTitle,0,0,1400,900);
    cCombPerRoad->SetLogy();
    h1CombPerRoad  [0]->SetTitle(cTitle);
    h1CombPerRoad  [0]->DrawCopy();
	h1CombPerRoad  [0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"# combinations/road.                               #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1CombPerRoad  [0]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	tl = new TLegend(0.25,0.75,0.9,0.9);
	tle = tl->AddEntry(h1CombPerRoad  [0],cc3,"l");
	tle->SetLineColor (h1CombPerRoad  [0]->GetLineColor());
	tle->SetLineWidth (h1CombPerRoad  [0]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cCombPerRoad->SaveAs(dirPlots+cName+"__.pdf");
		cCombPerRoad->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cCombPerRoad_OR_")+sLogic+pName;
    h1CombPerRoadOR[0]->SetLineColor(2);
    h1CombPerRoadOR[0]->DrawCopy("same");
	h1CombPerRoadOR[0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"# combinations/road.               Ov. Masked. #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1CombPerRoadOR[0]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	tle = tl->AddEntry(h1CombPerRoadOR[0],cc3,"l");
	tle->SetLineColor (h1CombPerRoadOR[0]->GetLineColor());
	tle->SetLineWidth (h1CombPerRoadOR[0]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cCombPerRoad->SaveAs(dirPlots+cName+"__.pdf");
		cCombPerRoad->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cCombPerRoad_OR_DsClean_")+sLogic+pName;
    h1CombPerRoadOR[1]->SetLineColor(8);
    h1CombPerRoadOR[1]->DrawCopy("same");
	h1CombPerRoadOR[1]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"# combinations/road. #Deltas clean Ov. Masked #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1CombPerRoadOR[1]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	tle = tl->AddEntry(h1CombPerRoadOR[1],cc3,"l");
	tle->SetLineColor (h1CombPerRoadOR[1]->GetLineColor());
	tle->SetLineWidth (h1CombPerRoadOR[1]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cCombPerRoad->SaveAs(dirPlots+cName+"__.pdf");
		cCombPerRoad->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cCombPerEvent_")+sLogic+pName;
    cTitle=TString("Combinations per Tower "+sLogic+pTitle);
    TCanvas* cCombPerEvent = new TCanvas(cName,cTitle,0,0,1400,900);
    cCombPerEvent->SetLogy();
    h1CombPerEvent  [0]->SetTitle(cTitle);
    h1CombPerEvent  [0]->DrawCopy();
	h1CombPerEvent  [0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"                           #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",45.7,percentiles[3]*100,772.4);
	tl = new TLegend(0.25,0.75,0.9,0.9);
	tle = tl->AddEntry(h1CombPerEvent  [0],cc3,"l");
	tle->SetLineColor (h1CombPerEvent  [0]->GetLineColor());
	tle->SetLineWidth (h1CombPerEvent  [0]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cCombPerEvent->SaveAs(dirPlots+cName+"__.pdf");
		cCombPerEvent->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cCombPerEvent_OR_")+sLogic+pName;
    h1CombPerEventOR[0]->SetLineColor(2);
    h1CombPerEventOR[0]->DrawCopy("same");
	h1CombPerEventOR[0]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"              Ov. Masked #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1CombPerEventOR[0]->GetMean(),percentiles[3]*100,467.4);
	tle = tl->AddEntry(h1CombPerEventOR[0],cc3,"l");
	tle->SetLineColor (h1CombPerEventOR[0]->GetLineColor());
	tle->SetLineWidth (h1CombPerEventOR[0]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cCombPerEvent->SaveAs(dirPlots+cName+"__.pdf");
		cCombPerEvent->SaveAs(dirPlots+cName+"__.png");
	}

    cName=TString("cCombPerEvent_OR_DsClean_")+sLogic+pName;
    h1CombPerEventOR[1]->SetLineColor(8);
//    h1CombPerEventOR[1]->SetTitle(cTitle);
//    h1CombPerEventOR[1]->DrawCopy();
    h1CombPerEvent  [0]->DrawCopy();
    h1CombPerEventOR[0]->DrawCopy("same");
    h1CombPerEventOR[1]->DrawCopy("same");
	h1CombPerEventOR[1]->GetQuantiles(nQuant,xpercentiles[0],percentiles);
	sprintf(cc3,"#Deltas clean Ov. Masked #mu=%3.1lf, #Lambda_{%3.1lf}=%3.1lf",h1CombPerEventOR[1]->GetMean(),percentiles[3]*100,xpercentiles[0][3]);
	tle = tl->AddEntry(h1CombPerEventOR[1],cc3,"l");
	tle->SetLineColor (h1CombPerEventOR[1]->GetLineColor());
	tle->SetLineWidth (h1CombPerEventOR[1]->GetLineWidth());
	tl->Draw("L");
	if (makePlots) {
		cCombPerEvent->SaveAs(dirPlots+cName+"__.pdf");
		cCombPerEvent->SaveAs(dirPlots+cName+"__.png");
	}

	TFile f1("/home/rossin/Dropbox/TT/Work/figures_stubOverlapRemoval/eff_LTF_SingleMuonTest_tt27_PU0_sf1_nz4_pt3_5oo6_95c_100k/efficiency1_10dedup_ppt_sf1_nz4.root");
	TFile f2("/home/rossin/Dropbox/TT/Work/figures_stubOverlapRemoval/eff_LTF_SingleMuonTest_tt27_PU0_sf1_nz4_pt3_5oo6_95c_100k_removeOverlap/efficiency1_10dedup_ppt_sf1_nz4.root");

	TCanvas* c1 = (TCanvas*) f1.Get("c1");
	TList* list1 = c1->GetListOfPrimitives();
	TIter next1(list1);
	TObject* obj1;
	TGraphAsymmErrors* eff_graph;
	while ((obj1 = next1())) {
		std::cout << obj1->GetName() << std::endl;
		if (obj1->GetName()==TString("eff_graph")) eff_graph = (TGraphAsymmErrors*) obj1;
	}

//	eff_graph->GetYaxis()->SetTitle("#varepsilon");
//	eff_graph->SetMinimum(0.8);
	TCanvas* c1OR = (TCanvas*) f2.Get("c1");
	c1OR->SetName("eff_OR");
	c1OR->SetTitle("eff_OR");
	TList* list = c1OR->GetListOfPrimitives();
	TIter next(list);
	TObject* obj;
	TGraphAsymmErrors* eff_graphOR;
	c1->Draw();
	while ((obj = next())) {
		std::cout << obj->GetName() << std::endl;
		if (obj->GetName()==TString("eff_graph")) {
			eff_graphOR = (TGraphAsymmErrors*) obj;
			eff_graphOR->SetLineStyle  (eff_graph->GetLineStyle());
			eff_graphOR->SetLineWidth  (eff_graph->GetLineWidth()/2);
			eff_graphOR->SetMarkerStyle(eff_graph->GetMarkerStyle());
			eff_graphOR->SetMarkerSize (eff_graph->GetMarkerSize());
			eff_graphOR->SetFillColor  (eff_graph->GetFillColor());
			eff_graphOR->SetFillStyle  (eff_graph->GetFillStyle());
			eff_graphOR->SetMarkerColor(4);
			eff_graphOR->SetLineColor(4);
			eff_graphOR->GetYaxis()->SetTitle("#varepsilon");
			eff_graphOR->Draw("same p");
		}
	}
	tl = new TLegend(0.4,.13,0.95,0.35);
	tl->AddEntry(eff_graph  ,"No Overlap Removal","p");
	tl->AddEntry(eff_graphOR,"     Overlap Removal","p");
	tl->Draw();
	if (makePlots) {
		c1->SaveAs(dirPlots+TString("totalRecoEff_OR")+"__.png");
		c1->SaveAs(dirPlots+TString("totalRecoEff_OR")+"__.pdf");
	}

	return;
}