#include #include #include "g_defines.h" #include "TChain.h" #include "TCanvas.h" #include "TH2F.h" #include "PDGHistos.h" #include "CChainGetter.h" void genHistos(PDGHistos Histos, vector TxtFiles, vector PDGCode, string SaveToFile) { /* PDGHistos test; test.Add(321, "K+"); test.Add(2212, "p+"); //test.Add(-11, "e+"); //test.Add(13, "Muon-"); test.Add(211, "Pi+"); vector TxtFiles; vector PDGCode; TxtFiles.push_back("/afs/e18/data/panda/MC/FAIRRoot/RUNMC/rs3/rs3_1_P321.auto"); //Change the file for the histo, too!!!!!!!!!!!! PDGCode.push_back(321); TxtFiles.push_back("/afs/e18/data/panda/MC/FAIRRoot/RUNMC/rs3/rs3_1_P2212.auto"); PDGCode.push_back(2212); //TxtFiles.push_back("/afs/e18/data/panda/MC/FAIRRoot/RUNMC/rs2/P-11Gesamt.txt"); //PDGCode.push_back(-11); //TxtFiles.push_back("/afs/e18/data/panda/MC/FAIRRoot/RUNMC/rs2/P13Gesamt.txt"); //PDGCode.push_back(13); TxtFiles.push_back("/afs/e18/data/panda/MC/FAIRRoot/RUNMC/rs3/rs3_1_P211.auto"); PDGCode.push_back(211); */ vector::const_iterator cit; int i=0; for(cit=TxtFiles.begin(); cit!=TxtFiles.end(); cit++) { cout << "Loading Files in: " << (*cit).c_str() << endl; CChainGetter chg; chg.SetFileExtension(".reco.root"); chg.SetFileListFile((*cit).c_str()); TChain* pC=chg.GetChain(); if(pC) { ostringstream CanvasName; CanvasName << "DEDX_trunc_" << i; TCanvas *pCanvas=new TCanvas( CanvasName.str().c_str(),CanvasName.str().c_str() ); ostringstream DrawCommand; DrawCommand << "TpcDEdxInfo._tpctruncdedx:TpcDEdxInfo._tpcp>>" << "DEDX_trunc_" << i << "(150,0,3,5000,0,100000)"; pC->Draw(DrawCommand.str().c_str()); //pC->Draw("TpcDEdxInfo._tpctruncdedx:TpcDEdxInfo._tpcp"); } else { cout << "Error loading Chain" << endl; } ostringstream HistogramName; HistogramName << "DEDX_trunc_" << i; TH2F *pHisto=(TH2F*)gDirectory->Get(HistogramName.str().c_str()); if(pHisto) { //pHisto->Draw(); Histos.Add(pHisto, PDGCode[i]); //pHisto->SetShowProjectionY(10); } else { cout << "Error getting DEDX Histo" << endl; } delete pC; i++; } Histos.CreateSummary(); Histos.Save(SaveToFile.c_str()); }