45 cout<<
"pandaroot/macro/run/Tools.C loaded. Enjoy it."<<endl;
57 TLatex* pText=
new TLatex(posX,posY,text);
60 pText->SetTextColor(
col); pText->SetTextSize(size);
70 TString options =
"colz"; options += opt;
71 if(gPad->GetLogz() == 1 && h->GetMaximum()<
range) h->SetAxisRange(0.,
range,
"Z");
75 cout <<
"range "<<
range<<
" max "<<h->GetMaximum()<<
" min "<<h->GetMinimum()<<endl;
76 if( range < h->GetMaximum())
range = h->GetMaximum();
77 if(-
range > h->GetMinimum())
range = -1*h->GetMinimum();
79 if(h->GetMinimum() < 0.) h->SetAxisRange(-
range,
range,
"Z");
80 else h->SetAxisRange(0,
range,
"Z");
83 h->SetTitleOffset(0.8,
"T");
84 gPad->SetRightMargin(0.15);
85 h->DrawCopy(options.Data());
91 const Int_t NRGBs = 5;
92 const Int_t NCont = 99;
94 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
95 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
96 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
97 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
98 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
100 gStyle->SetNumberContours(NCont);
113 int entries = pad->GetListOfPrimitives()->GetEntries();
118 for(
int i=0;
i<entries;
i++){
119 name = pad->GetListOfPrimitives()->At(
i)->IsA()->GetName();
120 if( name.Contains(
"TH1") ){
121 TH1*
hist = (TH1*)pad->GetListOfPrimitives()->At(
i);
122 st = (TPaveStats*)hist->GetListOfFunctions()->FindObject(
"stats");
126 st->SetY1NDC(1-0.16*obj) ;
127 st->SetY2NDC( st->GetY1NDC()+0.15 ) ;
128 st->SetTextColor( hist->GetLineColor() );
129 st->SetLineColor( hist->GetLineColor() );
153 gStyle->SetOptFit ( 1011 );
154 gStyle->SetPaperSize(20,26);
155 gStyle->SetPadTopMargin(0.14);
156 gStyle->SetPadRightMargin(0.05);
157 gStyle->SetPadBottomMargin(0.14);
158 gStyle->SetPadLeftMargin(0.14);
159 gStyle->SetTextFont(22);
160 gStyle->SetTextSize(0.08);
161 gStyle->SetLabelFont(22,
"x");
162 gStyle->SetLabelFont(22,
"y");
163 gStyle->SetLabelFont(22,
"z");
164 gStyle->SetLabelSize(0.05,
"x");
165 gStyle->SetTitleSize(0.06,
"x");
166 gStyle->SetLabelSize(0.05,
"y");
167 gStyle->SetTitleSize(0.06,
"y");
168 gStyle->SetLabelSize(0.05,
"z");
169 gStyle->SetTitleSize(0.06,
"z");
171 gStyle->SetMarkerStyle(8);
172 gStyle->SetHistLineWidth(1);
173 gStyle->SetLineStyleString(2,
"[12 12]");
176 gStyle->SetOptTitle(1);
177 gStyle->SetOptStat(1);
178 gStyle->SetOptFit(1);
181 gStyle->SetPadTickX(1);
182 gStyle->SetPadTickY(1);
185 gStyle->SetNdivisions(509);
213 if( strcmp(gStyle->GetName(),
"PANDA")==0 )
return true;
227 TStyle *pandaStyle=
new TStyle(
"PANDA",
"PANDA approved plots style, modified by ralfk");
230 pandaStyle->SetFrameBorderMode(0);
231 pandaStyle->SetCanvasBorderMode(0);
232 pandaStyle->SetPadBorderMode(0);
233 pandaStyle->SetPadColor(0);
234 pandaStyle->SetCanvasColor(0);
235 pandaStyle->SetTitleColor(1);
236 pandaStyle->SetStatColor(0);
241 pandaStyle->SetTitleBorderSize(0);
242 pandaStyle->SetTitleColor(1);
243 pandaStyle->SetTitleFillColor(0);
244 pandaStyle->SetTitleFontSize(0.07);
247 pandaStyle->SetPaperSize(20,26);
248 pandaStyle->SetPadTopMargin(0.14);
249 pandaStyle->SetPadRightMargin(0.05);
250 pandaStyle->SetPadBottomMargin(0.14);
251 pandaStyle->SetPadLeftMargin(0.14);
263 pandaStyle->SetTextFont(22);
264 pandaStyle->SetTextSize(0.08);
265 pandaStyle->SetLabelFont(22,
"x");
266 pandaStyle->SetLabelFont(22,
"y");
267 pandaStyle->SetLabelFont(22,
"z");
268 pandaStyle->SetLabelSize(0.05,
"x");
269 pandaStyle->SetTitleSize(0.06,
"x");
270 pandaStyle->SetLabelSize(0.05,
"y");
271 pandaStyle->SetTitleSize(0.06,
"y");
272 pandaStyle->SetLabelSize(0.05,
"z");
273 pandaStyle->SetTitleSize(0.06,
"z");
276 pandaStyle->SetMarkerStyle(8);
277 pandaStyle->SetHistLineWidth(1);
278 pandaStyle->SetLineStyleString(2,
"[12 12]");
281 pandaStyle->SetOptTitle(1);
282 pandaStyle->SetOptStat(1);
283 pandaStyle->SetOptFit(1);
286 pandaStyle->SetPadTickX(1);
287 pandaStyle->SetPadTickY(1);
290 pandaStyle->SetNdivisions(509);
307 TH1D result(
"h1",
"h1", 1000, min, max);
308 int nbins = h2->GetNbinsX() * h2->GetNbinsY();
311 result.Fill(h2->GetBinContent(
i));
313 cout << h2->GetBinContent(
i) << endl;
324 if (!file) {cout<<
"File \""<<
filename.Data()<<
"\" is not there..."<<endl;
return true;}
325 TCanvas* can =
new TCanvas();
326 Int_t pixx = ceil(1.4*pix*divx);
327 Int_t pixy = pix*divy;
328 can->SetCanvasSize(pixx,pixy);
329 can->Divide(divx, divy);
332 ext.ReplaceAll(
"..",
".");
333 picname.ReplaceAll(
".root",
ext);
335 cout <<
"opening: " << pic.Data()<<endl;
339 TList* list = file->GetListOfKeys();
340 if (!list) {cout<<
"List not there..."<<endl;
return true;}
343 for(
int i=0;
i<list->GetEntries();
i++)
345 if(padcount > divx*divy)
347 can->Print(pic.Data());
349 can->SetCanvasSize(pixx,pixy);
350 can->Divide(divx, divy);
354 TKey*
key = (TKey*)list->At(
i);
355 keyclass = key->GetClassName();
357 if(keyclass.Contains(
"TH1"))
360 TH1* his = (TH1*)key->ReadObj();
361 his->GetXaxis()->SetNoExponent();
362 his->GetYaxis()->SetNoExponent();
363 TString options(his->GetOption());
364 if(options.Contains(
"log")){
366 options.ReplaceAll(
"log",
"");
367 his->SetOption(options.Data());
370 }
else if(keyclass.Contains(
"TH2"))
373 TH2* his2 = (TH2*)key->ReadObj();
374 his2->GetXaxis()->SetNoExponent();
375 his2->GetYaxis()->SetNoExponent();
376 TString options(his2->GetOption());
377 if(options.Contains(
"log")){
379 options.ReplaceAll(
"log",
"");
380 his2->SetOption(options.Data());
382 if(options.Contains(
"nice")){
383 options.ReplaceAll(
"nice",
"");
384 his2->SetOption(options.Data());
389 }
else if(keyclass.Contains(
"TProfile"))
392 TProfile* hpro = (TProfile*)key->ReadObj();
393 hpro->GetXaxis()->SetNoExponent();
394 hpro->GetYaxis()->SetNoExponent();
395 TString options(hpro->GetOption());
396 if(options.Contains(
"log")){
398 options.ReplaceAll(
"log",
"");
399 hpro->SetOption(options.Data());
407 can->Print(pic.Data());
409 can->Print(pic.Data());
410 cout <<
"closed: " << pic.Data()<<endl;
422 if (!file) {cout<<
"File \""<<
filename.Data()<<
"\" is not there..."<<endl;
return true;}
423 TCanvas* can =
new TCanvas();
424 Int_t pixx = ceil(1.4*pix*divx);
425 Int_t pixy = pix*divy;
426 can->SetCanvasSize(pixx,pixy);
427 can->Divide(divx, divy);
430 ext.ReplaceAll(
"..",
".");
431 picname.ReplaceAll(
".root",
ext);
433 cout <<
"opening: " << pic.Data()<<endl;
437 TList* list = file->GetListOfKeys();
438 if (!list) {cout<<
"List not there..."<<endl;
return true;}
441 for(
int i=0;
i<list->GetEntries();
i++)
443 TKey*
key = (TKey*)list->At(
i);
444 keyclass = key->GetClassName();
445 if(keyclass.CompareTo(
"TTree"))
continue;
446 TTree* baum = (TTree*)key->ReadObj();
447 printf(
"\t - Tree: %s\n",baum->GetName());
448 TObjArray* aeste = baum->GetListOfBranches();
449 for(
int asti=0;asti<aeste->GetEntriesFast();asti++)
451 TBranch* ast = (TBranch*)aeste->At(asti);
452 printf(
"\t\t - Branch: %s\n",ast->GetName());
453 TObjArray* bleatter = ast->GetListOfLeaves();
454 for(
int blatti=0;blatti<bleatter->GetEntriesFast();blatti++)
456 TLeaf* blatt = (TLeaf*)bleatter->At(blatti);
457 TString blattsorte=blatt->GetTypeName();
458 if( !blattsorte.CompareTo(
"Float_t") || !blattsorte.CompareTo(
"Int_t") || !blattsorte.CompareTo(
"Double_t"))
460 if(padcount > divx*divy)
462 printf(
" --- canvasdump ---");
463 can->Print(pic.Data());
465 can->SetCanvasSize(pixx,pixy);
466 can->Divide(divx, divy);
470 printf(
"\t\t\t - Leaf: %s (%s)\n",blatt->GetName(),blatt->GetTypeName());
471 baum->Draw(blatt->GetName());
477 can->Print(pic.Data());
479 can->Print(pic.Data());
480 cout <<
"closed: " << pic.Data()<<endl;
494 TIter
next(gROOT->GetListOfFiles());
496 TChain *
R=
new TChain(treename.Data());
497 while ( (fi=(TFile*)
next()) ) R->Add(fi->GetName());
498 cout<<(Int_t)R->GetEntries()<<endl;
504 cout <<
"-I- Using InitDefaultRun() from macro/run/Tools.C with the sim file " << filetag.Data() << endl;
505 FairRunAna*
fRun =
new FairRunAna();
506 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
508 filetag.ReplaceAll(
"_sim.root",
".root");
517 std::cout<<
"simFile="<<simFile.Data()<<std::endl;
518 std::cout<<
"parFile="<<parFile.Data()<<std::endl;
519 std::cout<<
"recoFile="<<recoFile.Data()<<std::endl;
520 std::cout<<
"trkFile="<<tracksFile.Data()<<std::endl;
521 std::cout<<
"pidFile="<<pidFile.Data()<<std::endl;
522 fRun->SetInputFile(simFile);
523 fRun->AddFriend(recoFile);
524 fRun->AddFriend(tracksFile);
525 fRun->AddFriend(pidFile);
526 FairParRootFileIo* parIO =
new FairParRootFileIo();
527 parIO->open(parFile.Data());
528 rtdb->setFirstInput(parIO);
529 rtdb->setOutput(parIO);
534 fRun->SetOutputFile(outFile.Data());
535 FairGeane* geane =
new FairGeane();
536 fRun->AddTask(geane);
544 Float_t rightmax = 1.1*hist->GetMaximum();
545 Float_t scale = gPad->GetUymax()/rightmax;
546 hist->SetLineColor(color);
551 TGaxis *
axis =
new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
552 gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,
"+L");
553 axis->SetLineColor(color);
554 axis->SetTextColor(color);
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
std::string GetParFileName(std::string addon="", bool cut=false)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
std::string GetSimFileName(std::string addon="", bool cut=false)
std::string GetRecoFileName(std::string addon="", bool cut=false)
A simple class which adds the corresponding file extensions to a given base class.
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
PndFileNameCreator namecreator("../data/Lars/MvdDtsSim.root")