Ejemplo n.º 1
0
void doit()
{
   TFile* base = new TFile("f.db","recreate");
   TDirectory* a = base->mkdir("a","First Level Dir");
   a->cd();
   TH1D* ha = new TH1D("ha","ha",10,0,1);
   TDirectory* aa = a->mkdir("aa","Second Level Dira");
   aa->cd();
   TH1D* haa = new TH1D("haa","haa",10,0,1);
   
   a->ls();
   
   printf(" a: created@ %p  found@ %p\n", a,base->FindObjectAny("a"));
   printf("ha: created@ %p  found@ %p\n",ha,base->FindObjectAny("ha"));
   printf("ha: created@ %p  --found@ %p\n",ha,base->FindObjectAny("a/ha"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *k = (TDirectory*)base->FindObjectAny("a");
#else
   k = (TDirectory*)base->FindObjectAny("a");
#endif
   printf("ha: created@ %p  found@ %p\n",ha,k->FindObjectAny("ha"));
   
   printf("aa: created@ %p  found@ %p\n",aa,base->FindObjectAny("aa"));
   printf("aa: created@ %p  --found@ %p\n",aa,base->FindObjectAny("a/aa"));
   printf("aa: created@ %p  found@ %p\n",aa,k->FindObjectAny("aa"));
   
   printf("haa: created@ %p  found@ %p\n",haa,base->FindObjectAny("haa"));
   printf("haa: created@ %p  --found@ %p\n",haa,base->FindObjectAny("aa/haa"));
   printf("haa: created@ %p  --found@ %p\n",haa,base->FindObjectAny("a/aa/haa"));
   printf("haa: created@ %p  found@ %p\n",haa,k->FindObjectAny("haa"));
   printf("haa: created@ %p  --found@ %p\n",haa,k->FindObjectAny("aa/haa"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *kk = (TDirectory*)k->FindObjectAny("aa");
#else
   kk = (TDirectory*)k->FindObjectAny("aa");
#endif
   printf("haa: created@ %p  found@ %p\n",haa,kk->FindObjectAny("haa"));
   
   base->Write();
   
}
Ejemplo n.º 2
0
void doit2()
{
   TFile* base = new TFile("f.db","READ");
   
   TH1D *ha = 0;
   TH1D *haa = 0;
   TDirectory *aa = 0;

#ifdef ClingWorkAroundMissingDynamicScope
   TDirectory *a = (TDirectory*)base->Get("a");
#endif
   a->ls();
   
   printf(" a: created@ %p  found@ %p\n", a,base->FindObjectAny("a"));
   printf("ha: created@ %p  found@ %p\n",ha,base->FindObjectAny("ha"));
   printf("ha: created@ %p  --found@ %p\n",ha,base->FindObjectAny("a/ha"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *k = (TDirectory*)base->FindObjectAny("a");
#else
   k = (TDirectory*)base->FindObjectAny("a");
#endif
   printf("ha: created@ %p  found@ %p\n",ha,k->FindObjectAny("ha"));
   
   printf("aa: created@ %p  found@ %p\n",aa,base->FindObjectAny("aa"));
   printf("aa: created@ %p  --found@ %p\n",aa,base->FindObjectAny("a/aa"));
   printf("aa: created@ %p  found@ %p\n",aa,k->FindObjectAny("aa"));
   
   printf("haa: created@ %p  found@ %p\n",haa,base->FindObjectAny("haa"));
   printf("haa: created@ %p  --found@ %p\n",haa,base->FindObjectAny("aa/haa"));
   printf("haa: created@ %p  --found@ %p\n",haa,base->FindObjectAny("a/aa/haa"));
   printf("haa: created@ %p  found@ %p\n",haa,k->FindObjectAny("haa"));
   printf("haa: created@ %p  --found@ %p\n",haa,k->FindObjectAny("aa/haa"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *kk = (TDirectory*)k->FindObjectAny("aa");
#else
   kk = (TDirectory*)k->FindObjectAny("aa");
#endif
   printf("haa: created@ %p  found@ %p\n",haa,kk->FindObjectAny("haa"));
   
}
Ejemplo n.º 3
0
TH1* GetCentK(TDirectory* top, Double_t c1, Double_t c2, Int_t s,
	      TLegend* l)
{
  TString dname; dname.Form("cent%06.2f_%06.2f", c1, c2);
  dname.ReplaceAll(".", "d");
  TDirectory* d = top->GetDirectory(dname);
  if (!d) {
    Warning("GetCetnK", "Directory %s not found in %s",
	    dname.Data(), top->GetName());
    return;
  }

  TDirectory* det = d->GetDirectory("details");
  if (!det) {
    Warning("GetCetnK", "Directory details not found in %s",
	    d->GetName());
    d->ls();
    return;
  }

  TObject* o = det->Get("scalar");
  if (!o) {
    Warning("GetCetnK", "Object scalar not found in %s",
	    det->GetName());
    return;
  }

  if (!o->IsA()->InheritsFrom(TH1::Class())) {
    Warning("GetCetnK", "Object %s is not a TH1, but a %s",
	    o->GetName(), o->ClassName());
    return;
  }
  TH1* h = static_cast<TH1*>(o->Clone());
  Color_t col = cc[(s-1)%10];
  h->SetLineColor(col);
  h->SetMarkerColor(col);
  h->SetFillColor(col);
  h->SetFillStyle(1001);
  // h->SetTitle(Form("%5.2f-%5.2f%% #times %d", c1, c2, s));
  h->SetTitle(Form("%2.0f-%2.0f%% + %d", c1, c2, s-1));
  TF1* f = new TF1("", "[0]",-2.2,2.2);
  f->SetParameter(0,s-1);
  f->SetLineColor(col);
  f->SetLineStyle(7);
  f->SetLineWidth(1);
  // h->Scale(s);
  h->Add(f);
  h->GetListOfFunctions()->Add(f);
  f->SetParameter(0,s);
  for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
    if (TMath::Abs(h->GetBinCenter(i)) > 2) {
      h->SetBinContent(i,0);
      h->SetBinError(i,0);
    }
  }
  
  TLegendEntry* e = l->AddEntry(h, h->GetTitle(), "f");
  e->SetFillColor(col);
  e->SetFillStyle(1001);
  e->SetLineColor(col);

  return h;
}
Ejemplo n.º 4
0
printCalibObjectsInfo(const char* filename="CalibObjects.root")
{
  gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/LoadLibraries.C");
  TFile f(filename,"read");
 
  TDirectory* tpcCalib = dynamic_cast<TDirectory*>(f.Get("TPCCalib"));
  tpcCalib->ls();

  AliTPCcalibCalib* calibCalib = tpcCalib->Get("calibTPC");
  AliTPCcalibTimeGain* calibTimeGain = tpcCalib->Get("calibTimeGain");
  AliTPCcalibGainMult* calibGainMult = tpcCalib->Get("calibGainMult");
  AliTPCcalibTime* calibTime = tpcCalib->Get("calibTime");
  
  
  if (!calibCalib || !calibTimeGain || !calibGainMult || !calibTime)
  {
    printf("file empty\n");
    return;
  }

  printf("\ncalibTimeGain->GetHistGainTime()->GetEntries() = %10i, size: %.2f MB\n", calibTimeGain->GetHistGainTime()->GetEntries(), 
      (AliSysInfo::EstimateObjectSize(calibTimeGain->GetHistGainTime()))/1024./1024);
  printf("\n");
  
  printf("calibGainMult->GetHistGainSector()->GetEntries() = %10i, size: %.2f MB\n", calibGainMult->GetHistGainSector()->GetEntries(), 
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistGainSector())/1024./1024));
  printf("calibGainMult->GetHistPadEqual()->GetEntries()   = %10i, size: %.2f MB\n", calibGainMult->GetHistPadEqual()->GetEntries(), 
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistPadEqual())/1024./1024));
  printf("calibGainMult->GetHistGainMult()->GetEntries()   = %10i, size: %.2f MB\n", calibGainMult->GetHistGainMult()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistGainMult())/1024./1024));
  printf("calibGainMult->GetHistdEdxMap()->GetEntries()    = %10i, size: %.2f MB\n", calibGainMult->GetHistdEdxMap()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistdEdxMap())/1024./1024));
  printf("calibGainMult->GetHistdEdxMax()->GetEntries()    = %10i, size: %.2f MB\n", calibGainMult->GetHistdEdxMax()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistdEdxMax())/1024./1024));
  printf("calibGainMult->GetHistdEdxTot()->GetEntries()    = %10i, size: %.2f MB\n", calibGainMult->GetHistdEdxTot()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistdEdxTot())/1024./1024));
  printf("\n");

  for (int n=0; n<3; n++)
  {
    printf("calibTime->GetHistVdriftLaserA(%i)->GetEntries()          = %10i, size: %.2f MB\n", n, calibTime->GetHistVdriftLaserA(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetHistVdriftLaserA(n))/1024./1024));
    printf("calibTime->GetHistVdriftLaserC(%i)->GetEntries()          = %10i, size: %.2f MB\n", n, calibTime->GetHistVdriftLaserC(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetHistVdriftLaserC(n))/1024./1024));
  }

  for (int n=0; n<12; n++)
  {
    printf("calibTime->GetTPCVertexHisto(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetTPCVertexHisto(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetTPCVertexHisto(n))/1024./1024));
  }

  for (int n=0; n<5; n++)
  {
    printf("calibTime->GetTPCVertexHistoCorrelation(%i)->GetEntries() = %10i, size: %.2f MB\n", n, calibTime->GetTPCVertexHistoCorrelation(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetTPCVertexHistoCorrelation(n))/1024./1024));
    printf("calibTime->GetResHistoTPCCE(%i)->GetEntries()             = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCCE(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCCE(n))/1024./1024));
    printf("calibTime->GetResHistoTPCITS(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCITS(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCITS(n))/1024./1024));
    printf("calibTime->GetResHistoTPCvertex(%i)->GetEntries()         = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCvertex(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCvertex(n))/1024./1024));
    printf("calibTime->GetResHistoTPCTRD(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCTRD(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCTRD(n))/1024./1024));
    printf("calibTime->GetResHistoTPCTOF(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCTOF(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCTOF(n))/1024./1024));
  }

  TObjArray* TPCCluster = f.Get("TPCCluster");
  if (TPCCluster)
  {
    TPCCluster->Print();
    AliTPCcalibTracks* calibTracks = TPCCluster->FindObject("calibTracks");
    printf("calibTracks->fHisDeltaY->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisDeltaY)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisDeltaY)/1024./1024.));
    printf("calibTracks->fHisDeltaZ->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisDeltaZ)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisDeltaZ)/1024./1024.));
    printf("calibTracks->fHisRMSY->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisRMSY)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisRMSY)/1024./1024.));
    printf("calibTracks->fHisRMSZ->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisRMSZ)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisRMSZ)/1024./1024.));
    printf("calibTracks->fHisQmax->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisQmax)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisQmax)/1024./1024.));
    printf("calibTracks->fHisQtot->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisQtot)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisQtot)/1024./1024.));
  }


}
Ejemplo n.º 5
0
GenVBosonPlot(TString name, int rebin,float min = -1,float max =0, bool log=false){

  //  TCanvas* aCan = new TCanvas(name,name,0.6,0.6,0.8,0.8);

  TCanvas* aCan = new TCanvas(name);
  aCan->Divide(2,1);
  aCan->cd(1);
  if(log) aCan->SetLogy();
  // int rebin= 10;
  TFile* W = new TFile("results5/IC5Calo_WJets_madgraph.root");
  //W->ls();
  TDirectory* Wdir = ( TDirectory*) W->Get("GenVBoson200");
  Wdir->ls();
  TH1D* Wh = (TH1D*) Wdir->Get(name);
  Wh->Rebin(rebin);
  Wh->SetLineWidth(2);
  Wh->SetLineStyle(2);
  //  Wh->
  if(min>-.2)  Wh->GetXaxis()->SetRangeUser(min,max);
 
  Wh->DrawNormalized();
  //cout << Wh->GetMaximum() <<endl;
  Wh->GetXaxis()->SetRangeUser(0.00001,1);

  //  Wh->SetMaximum( Wh->GetMaximum()*1.75);


  TFile* Z = new TFile("results5/IC5Calo_Zinvisible_jets.root");
  //Z->ls();
  TDirectory* Zdir = ( TDirectory*) Z->Get("GenVBoson200");
  //  Zdir->ls();
  TH1D* Zh = (TH1D*) Zdir->Get(name);
  Zh->SetLineColor(kRed);
  Zh->SetLineWidth(2);
  Zh->SetLineStyle(2);

  Zh->Rebin(rebin);
  Zh->DrawNormalized("same");

  TFile* Ph = new TFile("results5/photon.root");
  Ph->ls();
  TDirectory* Phdir = ( TDirectory*) Ph->Get("GenVBoson200");
  // Phdir->ls();
  TH1D* Phh = (TH1D*) Phdir->Get(name);
  Phh->SetLineColor(kBlue);
  Phh->SetLineWidth(2);
  Phh->Rebin(rebin);
  Phh->DrawNormalized("same"); 

  TLegend* leg = new TLegend(0.5,0.5,0.7,0.7);
  leg->AddEntry(Zh,"Z","l" );
  leg->AddEntry(Wh,"W","l" );
  leg->AddEntry(Phh,"#gamma","l" );
  leg->Draw("same");

  aCan->cd(1);

  TH1D*  DivPhh = Phh->Clone();
  DivPhh->Divide(Zh);
  TH1D*  DivWh = Wh->Clone();
  DivWh->Divide(Zh);
  DivPhh->Draw();
DivWh->Draw("same");

}