Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-26 08:26:15

0001 #include "EvaluateRecoEffiHGCROC.h"
0002 
0003 
0004 // ****************************************************************************
0005 // Checking and opening input files
0006 // ****************************************************************************
0007 
0008 bool EvaluateRecoEffiGHCROC::CheckAndOpenIO(void){
0009 
0010   //Need to check first input to get the setup...I do not think it is necessary
0011   std::cout<<"Input file set to: '"<<inputFilePath.Data() <<std::endl;
0012   if(inputFilePath.IsNull()){
0013     std::cout<<"An input file is required, aborting"<<std::endl;
0014     return false;
0015   } 
0016 
0017   if( outputDir.IsNull()){
0018     std::cout << "No output directory set, aborting... "  << std::endl;
0019     return false;
0020   } else {
0021     gSystem->Exec("mkdir -p "+outputDir);
0022     std::cout << "Output directory set by default to " << outputDir << std::endl;
0023   }
0024 
0025   if( RunListInputName.IsNull() ){
0026     std::cout << "No run list given, aborting..."<<std::endl;
0027     return false;
0028   }
0029 
0030   std::cout <<"=============================================================" << std::endl;
0031   std::cout <<" Basic setup complete" << std::endl;
0032   std::cout <<"=============================================================" << std::endl;
0033   return true;
0034 }
0035 
0036 
0037 
0038 // ****************************************************************************
0039 // Primary process function 
0040 // ****************************************************************************
0041 bool EvaluateRecoEffiGHCROC::Process(){
0042     bool status;
0043     status = DoEvaluateRecoEffiHGCROC();
0044     return status;
0045 }
0046 
0047 
0048 // ****************************************************************************
0049 // Actual function with evaluation 
0050 // ****************************************************************************
0051 bool EvaluateRecoEffiGHCROC::DoEvaluateRecoEffiHGCROC(){
0052     
0053       
0054     StyleSettingsBasics();
0055     // ********************************************************************************************************
0056     // read run list and corresponding settings
0057     // ********************************************************************************************************
0058     std::map<int,RunInfo> ri=readRunInfosFromFile(RunListInputName.Data(),debug,0);
0059     std::map<int,runRecData> rED;
0060     // ********************************************************************************************************    
0061     // read folder and name from file
0062     // ********************************************************************************************************
0063     // std::vector<Int_t> runnumbers;
0064     // std::vector<TString> fileNames;
0065     std::ifstream in;
0066     in.open(inputFilePath,std::ios_base::in);
0067     if (!in) {
0068         std::cout << "ERROR: file " << inputFilePath.Data() << " not found!" << std::endl;
0069         return false;
0070     }
0071 
0072     TGraph* graphRecTrigger         = new TGraph();
0073     TGraph* graphTrigger            = new TGraph();
0074     TGraph* graphRecEffi            = new TGraph();
0075     TGraph* graphRecEffiVsNAttemp   = new TGraph();
0076     TGraph* graphRawFileSize        = new TGraph();
0077     TGraph* graphConvFileSize       = new TGraph();
0078     TGraph* graphCompression        = new TGraph();
0079     TGraph* graphReadPackets        = new TGraph();
0080     TGraph* graphBrokenPackets      = new TGraph();
0081     TGraph* graphResetsOffset       = new TGraph();
0082     TGraph* graphFracBrokenPackets  = new TGraph();
0083     
0084     // per FPGA triggers
0085     TGraph* graphEffiFPGA[8];
0086     TGraph* graphRecTriggerFPGA[8];
0087     TGraph* graphTriggerFPGA[8];
0088     for (int f = 0; f < 8; f++ ){
0089       graphEffiFPGA[f]              = new TGraph();
0090       graphTriggerFPGA[f]           = new TGraph();
0091       graphRecTriggerFPGA[f]        = new TGraph(); 
0092     }
0093     
0094     // per species effi
0095     TGraph* graphRecEffiSpecies[5];   // 0: pedestal
0096                                       // 1: muon
0097                                       // 2: e+/e-
0098                                       // 3: pi+/pi-
0099                                       // 3: p/anti-p
0100     TGraph* graphRecEffiNAttSpecies[5];   // 0: pedestal
0101                                       // 1: muon
0102                                       // 2: e+/e-
0103                                       // 3: pi+/pi-
0104                                       // 3: p/anti-p                                      
0105     for (int i = 0; i < 5; i++){
0106       graphRecEffiSpecies[i]      = new TGraph();
0107       graphRecEffiNAttSpecies[i]  = new TGraph();
0108     }
0109     
0110     double maxTrigg               = 0;
0111     std::map<int,RunInfo>::iterator it;
0112     double minEffi                = 10;
0113     double maxEffi                = -10;
0114     int nZeroEff                  = 0;
0115     int maxFPGA                   = 0;
0116     
0117     for( TString tempLine; tempLine.ReadLine(in, kTRUE); ) {
0118       // check if line should be considered
0119       if (tempLine.BeginsWith("%") || tempLine.BeginsWith("#")){
0120           continue;
0121       }
0122       if (debug > 0) std::cout << tempLine.Data() << std::endl;
0123 
0124       // Separate the string according to tabulators
0125       TObjArray *tempArr  = tempLine.Tokenize("_");
0126       if(tempArr->GetEntries()<1){
0127           if (debug > 1) std::cout << "nothing to be done" << std::endl;
0128           delete tempArr;
0129           continue;
0130       } else if (tempArr->GetEntries()==1){
0131           if (debug > 1) std::cout << "File name doesn't contain an _ :"  << tempLine.Data()<< std::endl;
0132       }
0133       TString fileEnd  = ((TString)((TObjString*)tempArr->At(tempArr->GetEntries()-1))->GetString());
0134       TObjArray *tempArr2  = fileEnd.Tokenize(".");
0135       if(tempArr2->GetEntries()<=1 ){
0136           if (debug > 1) std::cout << "line doesn't have a file ending" << std::endl;
0137           delete tempArr;
0138           delete tempArr2;
0139           continue;
0140       }
0141       TString ending  = ((TString)((TObjString*)tempArr2->At(1))->GetString());
0142       if (ending.CompareTo("root") != 0){
0143           if (debug > 1) std::cout << "This is not a root file, skipping.... : " << tempLine.Data() << std::endl;
0144           delete tempArr;
0145           delete tempArr2;
0146           continue;
0147       }  
0148       Int_t temprun     = ((TString)((TObjString*)tempArr2->At(0))->GetString()).Atoi();
0149       
0150       std::cout << temprun << "\t" << tempLine.Data() << std::endl;
0151       // clean-up
0152       delete tempArr;
0153       delete tempArr2;
0154       
0155       TFile* tempFile = new TFile(tempLine.Data(), "OPEN");
0156       if (tempFile->IsZombie()){
0157           std::cout << tempLine.Data() << " is broken, please remove from list or fix!" << std::endl;
0158           delete tempFile;
0159           continue;
0160       }
0161       it=ri.find(temprun);
0162       
0163       TH1D* histEvents = nullptr;
0164       TH1D* histEventPerFPGA[10]; // currently setting list to maximum 10 FPGAs
0165       
0166       histEvents = (TH1D*)tempFile->Get("hNEvents");
0167       if (!histEvents){
0168         std::cout << "Event histo does not exist for run " << temprun << "Aborting!"<< std::endl;
0169         delete tempFile;
0170         continue;
0171       }
0172       for (int f = 0; f < it->second.nFPGA; f++){
0173         histEventPerFPGA[f] = nullptr;
0174         histEventPerFPGA[f] = (TH1D*)tempFile->Get(Form("hNEventsKCU%i",f));
0175         if (!histEventPerFPGA[f]){
0176           std::cout << "Event histo for KCU "<<  f<<" does not exist for run " << temprun << "Aborting!"<< std::endl;
0177           delete tempFile;
0178           continue;
0179         }
0180       }
0181       
0182       runRecData tempRunRec;
0183       tempRunRec.runNr      = temprun;
0184       tempRunRec.pid        = it->second.pdg;
0185       tempRunRec.nFPGA      = it->second.nFPGA;
0186       if (maxFPGA < tempRunRec.nFPGA) 
0187         maxFPGA             = tempRunRec.nFPGA;
0188       tempRunRec.triggers     = histEvents->GetBinContent(1);
0189       tempRunRec.recEvents    = histEvents->GetBinContent(2);
0190       if (tempRunRec.triggers > 0)
0191         tempRunRec.recEffi      = (double)tempRunRec.recEvents/tempRunRec.triggers;
0192       else 
0193         tempRunRec.recEffi      = 0;
0194       for (int f= 0; f < tempRunRec.nFPGA; f++){
0195         tempRunRec.triggersPerFPGA[f]       = histEventPerFPGA[f]->GetBinContent(1);
0196         tempRunRec.recEventsPerFPGA[f]      = histEventPerFPGA[f]->GetBinContent(2);
0197         if (histEventPerFPGA[f]->GetBinContent(1)!= 0)
0198           tempRunRec.effiPerFPGA[f]         = (double)(tempRunRec.recEventsPerFPGA[f])/tempRunRec.triggersPerFPGA[f];
0199         else 
0200           tempRunRec.effiPerFPGA[f]         = 0.;
0201         tempRunRec.abortedEventsPerFPGA[f]  = histEventPerFPGA[f]->GetBinContent(3);
0202         tempRunRec.inProgEventsPerFPGA[f]   = histEventPerFPGA[f]->GetBinContent(4);
0203   
0204         graphEffiFPGA[f]->AddPoint(temprun,tempRunRec.effiPerFPGA[f]);
0205         graphTriggerFPGA[f]->AddPoint(temprun,tempRunRec.triggersPerFPGA[f]);
0206         graphRecTriggerFPGA[f]->AddPoint(temprun,tempRunRec.recEventsPerFPGA[f]);
0207       }
0208       if (histEvents->GetNbinsX() > 2){
0209         tempRunRec.resetsOffset     = histEvents->GetBinContent(5)/2.;
0210         tempRunRec.packets          = histEvents->GetBinContent(3);
0211         tempRunRec.brokenPackets    = histEvents->GetBinContent(4);
0212 
0213         if (tempRunRec.packets!= 0)
0214           tempRunRec.fracBroken     = (double)tempRunRec.brokenPackets/tempRunRec.packets*100;
0215         else 
0216           tempRunRec.fracBroken     = 0.;
0217         
0218         if(tempRunRec.packets > 0) 
0219           graphReadPackets->AddPoint(temprun,tempRunRec.packets);
0220         if(tempRunRec.brokenPackets > 0) 
0221           graphBrokenPackets->AddPoint(temprun,tempRunRec.brokenPackets);
0222         graphFracBrokenPackets->AddPoint(temprun,tempRunRec.fracBroken);
0223         graphResetsOffset->AddPoint(temprun,tempRunRec.resetsOffset);        
0224       }
0225       
0226       graphRecTrigger->AddPoint(temprun,tempRunRec.recEvents);
0227       graphTrigger->AddPoint(temprun,tempRunRec.triggers);
0228       
0229       if(tempRunRec.triggers!= 0){
0230         graphRecEffi->AddPoint(temprun,tempRunRec.recEffi);
0231         graphRecEffiVsNAttemp->AddPoint(tempRunRec.recEffi,tempRunRec.triggers);
0232         if (maxTrigg < tempRunRec.triggers)
0233           maxTrigg = tempRunRec.triggers;
0234         if (maxEffi < tempRunRec.recEffi)
0235           maxEffi = tempRunRec.recEffi;
0236         if (minEffi > tempRunRec.recEffi && minEffi > 0)
0237           minEffi = tempRunRec.recEffi;
0238         if (tempRunRec.recEffi <= 0.)
0239           nZeroEff++;
0240         
0241         // species dependent graphs
0242         std::cout << tempRunRec.pid << std::endl;
0243         if (tempRunRec.pid == 0){ // pedestal
0244           graphRecEffiSpecies[0]->AddPoint(temprun,tempRunRec.recEffi);
0245           graphRecEffiNAttSpecies[0]->AddPoint(tempRunRec.recEffi,tempRunRec.triggers);
0246         }
0247         if (tempRunRec.pid == -13 || tempRunRec.pid == 13 ){ // muon
0248           graphRecEffiSpecies[1]->AddPoint(temprun,tempRunRec.recEffi);
0249           graphRecEffiNAttSpecies[1]->AddPoint(tempRunRec.recEffi,tempRunRec.triggers);
0250         }
0251         if (tempRunRec.pid == -11 || tempRunRec.pid == 11 ){ // electron
0252           graphRecEffiSpecies[2]->AddPoint(temprun,tempRunRec.recEffi);
0253           graphRecEffiNAttSpecies[2]->AddPoint(tempRunRec.recEffi,tempRunRec.triggers);
0254         }
0255         if (tempRunRec.pid == 211 || tempRunRec.pid == -211){ // charged pion
0256           graphRecEffiSpecies[3]->AddPoint(temprun,tempRunRec.recEffi);
0257           graphRecEffiNAttSpecies[3]->AddPoint(tempRunRec.recEffi,tempRunRec.triggers);
0258         }
0259         if (tempRunRec.pid == 2212 || tempRunRec.pid == -2212){ // proton
0260           graphRecEffiSpecies[4]->AddPoint(temprun,tempRunRec.recEffi);
0261           graphRecEffiNAttSpecies[4]->AddPoint(tempRunRec.recEffi,tempRunRec.triggers);
0262         }
0263       }
0264       
0265       std::cout << (TString)(PrintRunRecData(tempRunRec, false)).Data() << std::endl;
0266       if (unconvertedDir.CompareTo("") != 0){
0267         TString sizeFile = gSystem->GetFromPipe("wc -c " +tempLine);
0268         // std::cout <<"full string:" <<  sizeFile.Data() << std::endl;
0269         TObjArray *tempArr3  = sizeFile.Tokenize(" ");
0270         Long64_t sizeC = ((TString)((TObjString*)tempArr3->At(0))->GetString()).Atoll();
0271         // std::cout << "first token: " << (TString)((TObjString*)tempArr3->At(0))->GetString().Data() << std::endl;
0272         TString rawFile = Form("%s/Run%03d.h2g", unconvertedDir.Data(), temprun);
0273         TString sizeFile2 = gSystem->GetFromPipe("wc -c " +rawFile);
0274         tempArr3  = sizeFile2.Tokenize(" ");
0275         Long64_t sizeR = ((TString)((TObjString*)tempArr3->At(0))->GetString()).Atoll();
0276         // std::cout <<"full string:" << sizeFile2.Data() << std::endl;
0277         Double_t sizeC_MB     = (Double_t)(sizeC)/1000./1000.;
0278         Double_t sizeR_MB     = (Double_t)(sizeR)/1000./1000.;
0279         Double_t compression  = sizeC_MB/sizeR_MB*100.;
0280         tempRunRec.sizeConv   = sizeC_MB;
0281         tempRunRec.sizeRaw    = sizeR_MB;
0282         tempRunRec.comp       = compression;
0283         
0284         // std::cout << "Sizes: "<< temprun << "\t" <<sizeC  <<"\t" << sizeC_MB << "\t"<< sizeR <<"\t" << sizeR_MB << "\t" << compression << std::endl;
0285         
0286         graphRawFileSize->AddPoint(temprun,tempRunRec.sizeRaw);
0287         graphConvFileSize->AddPoint(temprun,tempRunRec.sizeConv);
0288         graphCompression->AddPoint(temprun,tempRunRec.comp);
0289       }
0290       rED[temprun] = tempRunRec;
0291     } 
0292     std::cout << "runs completely unreconstructable " << nZeroEff << std::endl; 
0293     
0294     for (const auto& run : rED){
0295       std::cout << (TString)(PrintRunRecData(run.second, true)).Data();
0296     }
0297     
0298     Double_t maxPlotEffi = 1.05;
0299     if (minEffi < 0.3)
0300       maxPlotEffi        = 1.2;
0301   
0302     graphRecTrigger->Sort();
0303     graphRecTrigger->GetXaxis()->SetTitle("Run Nr.");
0304     graphRecTrigger->GetYaxis()->SetTitle("Rec. Triggers");
0305     graphTrigger->Sort();
0306     graphTrigger->GetXaxis()->SetTitle("Run Nr.");
0307     graphTrigger->GetYaxis()->SetTitle("Triggers");
0308     graphRecEffi->Sort();
0309     graphRecEffi->GetXaxis()->SetTitle("Run Nr.");
0310     graphRecEffi->GetYaxis()->SetTitle("#varepsilon_{rec}");
0311     graphRecEffiVsNAttemp->Sort();
0312     graphRecEffiVsNAttemp->GetYaxis()->SetTitle("#N_{trigg received}");
0313     graphRecEffiVsNAttemp->GetXaxis()->SetTitle("#varepsilon_{rec}");
0314     for (int i = 0; i < 5; i++){
0315       graphRecEffiSpecies[i]->Sort();
0316       graphRecEffiSpecies[i]->GetXaxis()->SetTitle("Run Nr.");
0317       graphRecEffiSpecies[i]->GetYaxis()->SetTitle("#varepsilon_{rec}");
0318       graphRecEffiNAttSpecies[i]->Sort();
0319       graphRecEffiNAttSpecies[i]->GetYaxis()->SetTitle("#N_{trigg received}");
0320       graphRecEffiNAttSpecies[i]->GetXaxis()->SetTitle("#varepsilon_{rec}");
0321     }
0322     
0323     TCanvas* canvas = new TCanvas("canvas","",0,0,800,600);
0324     DrawCanvasSettings( canvas,0.08, 0.01, 0.01, 0.1);
0325     TCanvas* canvas2 = new TCanvas("canvas2","",0,0,800,600);
0326     DrawCanvasSettings( canvas2,0.09, 0.01, 0.01, 0.1);
0327     canvas2->SetLogy(1);
0328     TCanvas* canvas3 = new TCanvas("canvas3","",0,0,800,600);
0329     DrawCanvasSettings( canvas3,0.09, 0.09, 0.015, 0.09);
0330     canvas3->SetLogy(1);
0331     canvas3->SetTicky(0);
0332     
0333     Double_t textSizePixel = 28;
0334     Double_t relSize       = textSizePixel/600;
0335     
0336     Double_t minTrigg      = TMath::MinElement(graphTrigger->GetN(),graphTrigger->GetY());
0337     if (minTrigg <= 0)  
0338       minTrigg             = 1;
0339     
0340     PlotTrendingCorr (canvas, 0.95,  0.95, relSize, textSizePixel, 
0341                   graphRecEffi, graphRecEffi->GetX()[0]-2 , graphRecEffi->GetX()[graphRecEffi->GetN()-1]+2, minEffi*0.9, maxPlotEffi, Form("%s/RecEffi",outputDir.Data()) , it->second);
0342     PlotTrendingMultiSpecies (canvas, 0.95,  0.95, relSize, textSizePixel, 
0343                   graphRecEffiSpecies, graphRecEffi->GetX()[0]-2 , graphRecEffi->GetX()[graphRecEffi->GetN()-1]+2, minEffi*0.9, maxPlotEffi, Form("%s/RecEffiSpecies",outputDir.Data()) , it->second);
0344     PlotTrendingCorr (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0345                   graphRecEffiVsNAttemp, minEffi*0.95 , 1, 1e3, maxTrigg*2, Form("%s/RecEffiVsAttempTriggers",outputDir.Data()) , it->second);
0346     PlotTrendingMultiSpecies (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0347                   graphRecEffiNAttSpecies, minEffi*0.95 , 1, 1e3, maxTrigg*2, Form("%s/RecEffiVsAttempTriggersSpecies",outputDir.Data()) , it->second);
0348 
0349     PlotTrendingMultiGraph (canvas3, 0.95,  0.95, relSize, textSizePixel, 
0350                             graphTrigger, graphRecTrigger, graphRecEffi,
0351                             graphTrigger->GetX()[0]-2 , graphTrigger->GetX()[graphTrigger->GetN()-1]+2, 
0352                             minTrigg, TMath::MaxElement(graphTrigger->GetN(),graphTrigger->GetY())*50. , minEffi*0.9, maxPlotEffi, 
0353                             Form("%s/TriggersRecComp",outputDir.Data()), it->second, 
0354                             "received", "reco.", "#varepsilon_{rec}" );
0355     for (int f = 0; f < maxFPGA; f++){
0356       graphEffiFPGA[f]->Sort();
0357       graphEffiFPGA[f]->GetXaxis()->SetTitle("Run Nr.");
0358       graphEffiFPGA[f]->GetYaxis()->SetTitle(Form("#varepsilon_{rec,FPGA %d}",f));
0359       graphTriggerFPGA[f]->Sort();
0360       graphTriggerFPGA[f]->GetXaxis()->SetTitle("Run Nr.");
0361       graphTriggerFPGA[f]->GetYaxis()->SetTitle(Form("Triggers FPGA %d",f));
0362       graphRecTriggerFPGA[f]->Sort();
0363       graphRecTriggerFPGA[f]->GetXaxis()->SetTitle("Run Nr.");
0364       graphRecTriggerFPGA[f]->GetYaxis()->SetTitle(Form("Triggers rec. FPGA %d",f));
0365       
0366       PlotTrendingMultiGraph (canvas3, 0.95,  0.95, relSize, textSizePixel, 
0367                               graphTriggerFPGA[f], graphRecTriggerFPGA[f], graphEffiFPGA[f],
0368                               graphTriggerFPGA[f]->GetX()[0]-2 , graphTriggerFPGA[f]->GetX()[graphTriggerFPGA[f]->GetN()-1]+2, 
0369                               minTrigg, TMath::MaxElement(graphTriggerFPGA[f]->GetN(),graphTriggerFPGA[f]->GetY())*50. , minEffi*0.9, maxPlotEffi, 
0370                               Form("%s/TriggersRecComp_FPGA_%d",outputDir.Data(),f), it->second, 
0371                               "received", "reco.", "#varepsilon_{rec, FPGA}" );
0372     }
0373     
0374     PlotTrendingMultiFPGA (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0375                         graphTrigger,  graphTriggerFPGA, maxFPGA,
0376                         graphTrigger->GetX()[0]-2 , graphTrigger->GetX()[graphTrigger->GetN()-1]+2,
0377                         minTrigg, TMath::MaxElement(graphTrigger->GetN(),graphTrigger->GetY())*50, 
0378                         Form("%s/TriggersFPGAOverview",outputDir.Data()),
0379                         it->second);
0380     PlotTrendingMultiFPGA (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0381                         graphRecTrigger,  graphRecTriggerFPGA, maxFPGA,
0382                         graphRecTrigger->GetX()[0]-2 , graphRecTrigger->GetX()[graphRecTrigger->GetN()-1]+2,
0383                         minTrigg, TMath::MaxElement(graphRecTrigger->GetN(),graphRecTrigger->GetY())*50, 
0384                         Form("%s/RecTriggersFPGAOverview",outputDir.Data()),
0385                         it->second);
0386     PlotTrendingMultiFPGA (canvas, 0.95,  0.95, relSize, textSizePixel, 
0387                         graphRecEffi,  graphEffiFPGA, maxFPGA,
0388                         graphRecEffi->GetX()[0]-2 , graphRecEffi->GetX()[graphRecEffi->GetN()-1]+2,
0389                         minEffi*0.9, maxPlotEffi, 
0390                         Form("%s/EffiFPGAOverview",outputDir.Data()),
0391                         it->second);    
0392     
0393     graphBrokenPackets->Sort();
0394     graphBrokenPackets->GetXaxis()->SetTitle("Run Nr.");
0395     graphBrokenPackets->GetYaxis()->SetTitle("broken packets");
0396     graphReadPackets->Sort();
0397     graphReadPackets->GetXaxis()->SetTitle("Run Nr.");
0398     graphReadPackets->GetYaxis()->SetTitle("read packets");
0399     graphFracBrokenPackets->Sort();
0400     graphFracBrokenPackets->GetXaxis()->SetTitle("Run Nr.");
0401     graphFracBrokenPackets->GetYaxis()->SetTitle("f (%)");
0402     graphResetsOffset->Sort();
0403     graphResetsOffset->GetXaxis()->SetTitle("Run Nr.");
0404     graphResetsOffset->GetYaxis()->SetTitle("offset resets");
0405     
0406     double maxBrokenPack  = 0;
0407     double maxReadPack    = 0;
0408     double maxFracBroken  = 0;
0409     double maxOffset  = 0;
0410     if (graphReadPackets->GetN() > 0){
0411       maxReadPack = TMath::MaxElement(graphReadPackets->GetN(),graphReadPackets->GetY());
0412     }
0413     if (graphBrokenPackets->GetN() > 0){
0414       maxBrokenPack = TMath::MaxElement(graphBrokenPackets->GetN(),graphBrokenPackets->GetY());
0415     }
0416     if (graphFracBrokenPackets->GetN() > 0){
0417       maxFracBroken = TMath::MaxElement(graphFracBrokenPackets->GetN(),graphFracBrokenPackets->GetY());
0418     }
0419     if (graphResetsOffset->GetN() > 0){
0420       maxOffset = TMath::MaxElement(graphResetsOffset->GetN(),graphResetsOffset->GetY());
0421     }
0422     
0423     PlotTrendingCorr (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0424                   graphBrokenPackets, graphBrokenPackets->GetX()[0]-2 , graphBrokenPackets->GetX()[graphBrokenPackets->GetN()-1]+2, 1, maxBrokenPack*10. , Form("%s/DataBrokenPackets",outputDir.Data()) , it->second);
0425     PlotTrendingCorr (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0426                   graphReadPackets, graphReadPackets->GetX()[0]-2 , graphReadPackets->GetX()[graphReadPackets->GetN()-1]+2, 1, maxReadPack*10. , Form("%s/DataReadPacket",outputDir.Data()) , it->second);
0427     PlotTrendingCorr (canvas, 0.95,  0.95, relSize, textSizePixel, 
0428                   graphFracBrokenPackets, graphFracBrokenPackets->GetX()[0]-2 , graphFracBrokenPackets->GetX()[graphFracBrokenPackets->GetN()-1]+2, 0, 10.5, Form("%s/FracBrokenPackset",outputDir.Data()) , it->second);
0429 
0430     graphReadPackets->GetYaxis()->SetTitle("data size (packets)");
0431     PlotTrendingMultiGraph (canvas3, 0.95,  0.95, relSize, textSizePixel, 
0432                             graphReadPackets, graphBrokenPackets, graphFracBrokenPackets,
0433                             graphReadPackets->GetX()[0]-2 , graphReadPackets->GetX()[graphReadPackets->GetN()-1]+2, 
0434                             1, maxReadPack*10. , 0.00, 10.5, 
0435                             Form("%s/DataPacketsComp",outputDir.Data()), it->second, 
0436                             "read", "invalid", "f = invalid/read" );
0437 
0438     PlotTrendingCorr (canvas, 0.95,  0.95, relSize, textSizePixel, 
0439                   graphResetsOffset, graphResetsOffset->GetX()[0]-2 , graphResetsOffset->GetX()[graphResetsOffset->GetN()-1]+2, 0, maxOffset*1.2, Form("%s/OffsetResets",outputDir.Data()) , it->second);
0440     
0441     if (unconvertedDir.CompareTo("") != 0){
0442       Double_t minSize = 1;
0443       if (TMath::MinElement(graphRawFileSize->GetN(),graphRawFileSize->GetY()) > minSize)
0444         minSize = TMath::MinElement(graphRawFileSize->GetN(),graphRawFileSize->GetY());
0445       Double_t minSizeConv = 1;
0446       if (TMath::MinElement(graphConvFileSize->GetN(),graphConvFileSize->GetY()) > minSizeConv)
0447         minSizeConv = TMath::MinElement(graphConvFileSize->GetN(),graphConvFileSize->GetY());
0448       
0449       graphCompression->Sort();
0450       graphCompression->GetXaxis()->SetTitle("Run Nr.");
0451       graphCompression->GetYaxis()->SetTitle("c (%)");
0452       
0453       graphRawFileSize->Sort();
0454       graphRawFileSize->GetXaxis()->SetTitle("Run Nr.");
0455       graphRawFileSize->GetYaxis()->SetTitle("File size raw (MB)");
0456 
0457       graphConvFileSize->Sort();
0458       graphConvFileSize->GetXaxis()->SetTitle("Run Nr.");
0459       graphConvFileSize->GetYaxis()->SetTitle("File size converted (MB)");
0460 
0461       PlotTrendingCorr (canvas, 0.95,  0.95, relSize, textSizePixel, 
0462                   graphCompression, graphCompression->GetX()[0]-2 , graphCompression->GetX()[graphCompression->GetN()-1]+2, 0, 105, Form("%s/DataCompression",outputDir.Data()) , it->second);
0463       PlotTrendingCorr (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0464                   graphRawFileSize, graphRawFileSize->GetX()[0]-2 , graphRawFileSize->GetX()[graphRawFileSize->GetN()-1]+2, minSize*0.9, TMath::MaxElement(graphRawFileSize->GetN(),graphRawFileSize->GetY())*10. , Form("%s/DataRawFileSize",outputDir.Data()), it->second );
0465       PlotTrendingCorr (canvas2, 0.95,  0.95, relSize, textSizePixel, 
0466                   graphConvFileSize, graphConvFileSize->GetX()[0]-2 , graphConvFileSize->GetX()[graphConvFileSize->GetN()-1]+2, minSizeConv*0.9, TMath::MaxElement(graphConvFileSize->GetN(),graphConvFileSize->GetY())*10., Form("%s/DataConvertedFileSize",outputDir.Data()), it->second );
0467       
0468       graphRawFileSize->GetYaxis()->SetTitle("File size (MB)");
0469       PlotTrendingMultiGraph (canvas3, 0.95,  0.95, relSize, textSizePixel, 
0470                               graphRawFileSize, graphConvFileSize, graphCompression,
0471                               graphRawFileSize->GetX()[0]-2 , graphRawFileSize->GetX()[graphRawFileSize->GetN()-1]+2, 
0472                               minSize*0.9, TMath::MaxElement(graphRawFileSize->GetN(),graphRawFileSize->GetY())*10. , 0.0, 105, 
0473                               Form("%s/DataFileSizeComp",outputDir.Data()), it->second , 
0474                             "raw file", "rec. file", "c = rec/raw");
0475     }
0476     
0477   return true;
0478 }