TProof * my_run(TProof * p, unsigned num, double from, double to) { if(p != NULL) TProof * p = TProof::Open("localhost"); TString sel = "TMySelector.cpp"; unsigned u; double tfrom, tto, sum, rres; double step = (to - from) / num; char pname[1024]; int nanosec; time_t sec; double tm[2]; TTimeStamp tst; // ############################################################################ for(u = 0, tfrom = from, tto = step; u < num; u++, tfrom += step, tto += step) { sprintf(pname, "from_%u", u); p->SetParameter(pname, tfrom); sprintf(pname, "to_%u", u); p->SetParameter(pname, tto); } sec = tst.GetSec(); nanosec = tst.GetNanoSec(); p->Process(sel, u); for(u = 0, sum = 0; u < num; u++) { sprintf(pname, "res_%u", u); sum += ((TParameter<Double_t> *) p->GetOutputList()->FindObject(pname))->GetVal(); } tst.Set(); tm[0] = tst.GetSec() - sec + 1 + (tst.GetNanoSec() - nanosec) / 1000000000.0; // ############################################################################ tst.Set(); sec = tst.GetSec(); nanosec = tst.GetNanoSec(); for(rres = 0, step = (to - from) / (num * 10000); from < to; from += step) rres += TMySelector::fun(from) * step; tst.Set(); tm[1] = tst.GetSec() - sec + 1 + (tst.GetNanoSec() - nanosec) / 1000000000.0; // ############################################################################ printf("\nРезультат:\n\n\tПараллельно = %lf (время: %lf секунд)\n\tПоследовательно = %lf (время: %lf секунд)\n\tАбсолютное отклонение = %lf\n\n", sum, tm[0], rres, tm[1], fabs(sum - rres)); return p; }
void Run_Simple_Test(char *host, const char *data_dir = "/var/tmp", Int_t dbg = 0) { if (gSystem->AccessPathName("../libEvent.so")) { gSystem->Exec("cd $ROOTSYS/test; make libEvent.so"); gSystem->Exec("./make_event_par.sh"); gSystem->Exec("ln -s ../Event.h"); gSystem->Load("../libEvent.so"); } TProof *p = 0; if (dbg > 0) { p = TProof::Open(host, "", "", dbg); } else { p = TProof::Open(host); } if (!p || !p->IsValid()) { cout << "Could not start the PROOF session - exit "<<endl; return; } if (dbg > 0) p->SetLogLevel(dbg); p->UploadPackage("event"); p->EnablePackage("event"); make_event_trees(data_dir, 100000, files_per_node); TDSet *d = make_tdset(data_dir, files_per_node); d->Print("a"); if (show_stats) gEnv->SetValue("Proof.StatsHist", 1); TDrawFeedback *fb(0); if (show_feedback) { if (show_stats) { p->AddFeedback("PROOF_ProcTimeHist"); p->AddFeedback("PROOF_LatencyHist"); p->AddFeedback("PROOF_EventsHist"); } p->AddFeedback("pt_dist"); fb = new TDrawFeedback(p); } // We load the selector before execution to avoid a problem affecting some versions // (in particular 5.22/00 and 5.22/00a); with problem-free versions this is equivalent // to direct processing via d->Process("EventTree_Proc.C+","") p->Load("EventTree_Proc.C+"); d->Process("EventTree_Proc"); if (fb) delete fb; }
void runLocal(TString dataset, TString treename = "", Long64_t nentries=TChain::kBigNumber, Long64_t firstentry = 0) { ProofAna* ana = new ProofAna(); //Need to provide a TList for local running TList* list = new TList(); ana->SetInputList(list); // Load dataset manager stuff, uses same local datasets as PROOF-Lite by design TString defaultdir(gSystem->HomeDirectory()); defaultdir.Append("/.proof"); TString dsetdir(gEnv->GetValue("ProofLite.Sandbox",defaultdir.Data())); dsetdir.Append("/datasets"); dsetdir.Prepend("dir:"); TDataSetManagerFile mgr(dsetdir); TString dsetfile(dataset); dsetfile.Append(".txt"); dsetfile.Prepend("../filelists/"); //Register dataset, if non-existent if(!mgr.ExistsDataSet(dataset)) { TFileCollection* dset = new TFileCollection(dataset,"",dsetfile); mgr.RegisterDataSet(dataset,dset,"V"); //This seems to return true regardless of success or failure at the moment if(treename.CompareTo("")!=0) { cout << "Setting default tree to " << treename << " (local and lite running)" << endl; TProof* lite = TProof::Open("lite://"); if(lite->SetDataSetTreeName(dataset,treename)) { cout << "Failure to set default tree to " << treename << endl; return; } delete lite; } } mgr.ShowDataSets(); // And yes, all this dataset garbage was to get the default tree name TFileCollection* dset = mgr.GetDataSet(dataset); TString defaultTree = dset->GetDefaultTreeName(); // Make TChain from TFileCollection...doesn't seem like there is a more direct way if(defaultTree.First("/")==0) defaultTree.Remove(0,1); TChain* T = new TChain(defaultTree); TList* filelist = (TList*)dset->GetList(); TIter next(filelist); TFileInfo* fileinfo = 0; while ((fileinfo = (TFileInfo*)next())) T->AddFile(fileinfo->GetCurrentUrl()->GetUrl()); // Process TChain T->Process(ana,"", nentries, firstentry); }
void analyseYield_p5(const char* WHICHHIST, const char* NTUPLEWEIGHT, const char* MOMCORRTYPE) { // directory with data TString protocol = "file://"; // TString protocol = "root://xrootd.rcac.purdue.edu/"; //from Norbert root://xrootd.rcac.purdue.edu//store/group/ewk/DY/DYM20/ntuple_skim_96_2_z5w.root my.root //TString protocol = "dcap://dcache.rcac.purdue.edu:22125/pnfs/rcac.purdue.edu/data"; TString dirname = "/mnt/hadoop/store/user/asvyatko/DYstudy/dataAnalysis13/rootfiles/"; //TString dirname = "/scratch/scratch95/a/asvyatko/DY2012_testdir/rootfiles/"; //TString dirname = "/store/group/ewk/DY/"; //TString dirname = "/store/group/ewk/DY/"; // QCD TFileCollection* c3a = new TFileCollection("GGmumuElast","GGmumuElast"); c3a->Add(protocol+dirname+"GGmumuElast"+"/*.root"); gEnv->SetValue("ProofLite.Sandbox", "/home/ba01/u115/asvyatko/DYStudy/CMSSW_5_3_3_patch2/src/DimuonAnalysis/DYPackage/ControlPlots/proofbox_p5"); TProof* p = TProof::Open("workers=1"); //"workers=5"); ////proof://pccmspurdue3:-1"); // set number of works to 2: TProof::Open("//lite:///?workers=2"); p->RegisterDataSet("GGmumuElast", c3a,"OV"); p->ShowDataSets(); TObjString* useNtupleWeightFlag = new TObjString(NTUPLEWEIGHT); p->AddInput(new TNamed("useNtupleWeightFlag",NTUPLEWEIGHT)); TObjString* histogramThis = new TObjString(WHICHHIST); p->AddInput(new TNamed("histogramThis",WHICHHIST)); TObjString* momCorrType = new TObjString(MOMCORRTYPE); p->AddInput(new TNamed("momCorrType",MOMCORRTYPE)); gROOT->Time(); p->SetParameter("PROOF_LookupOpt", "all"); p->Process("GGmumuElast#/recoTree/DiMuonTree","EventSelector_CP.C+"); }
void TestPeacVerifier() { // gSystem->Load("libPeacUtils.so"); // TProof *p = TProof::Open("skaf.saske.sk:1099","workers=1x"); // TProof *p = TProof::Open("skaf.saske.sk","workers=1x"); TProof *p = TProof::Open("alice-caf.cern.ch", "workers=1x"); p->UploadPackage("../pars/PeacUtils"); if (p->EnablePackage("PeacUtils")) return; // TProofNodes pn(p); // TMap *filesmap = new TMap; // TMap *nodesmap = pn.GetMapOfNodes(); // // TIter nxnd(nodesmap); // TList *wli = 0; // TObject *obj = 0; // Int_t kf = 1; // while ((obj = nxnd()) != 0) { // if ((wli = dynamic_cast<TList *>(nodesmap->GetValue(obj)))) { // THashList *fli = new THashList; // Int_t nf = wli->GetSize(); // TSlaveInfo *wi = (TSlaveInfo *) wli->First(); // Printf("WK: %s",wi->GetName()); // fli->Add(new TObjString(wi->GetName())); // filesmap->Add(new TObjString(obj->GetName()), fli); // } // } // // filesmap->SetName("PROOF_FilesToProcess"); // p->AddInput(filesmap); // TFileCollection *coll = p->GetDataSet("myDS"); // TFileCollection *coll = p->GetDataSet("myBigDS"); TFileCollection *coll = p->GetDataSet("/PWG2/mvala/LHC11a_000146805_p4_with_SDD"); TFileCollection *coll = p->GetDataSet("/PWG2/mvala/myDSNew"); if (!coll) return; coll->SetName("PROOF_PEAC_FileCollectionIn"); p->AddInput(coll); // p->SetParameter("PROOF_Packetizer", "TPacketizerFile"); // p->SetParameter("PROOF_ProcessNotAssigned", (Int_t)1); p->SetParameter("PROOF_Packetizer", "TPacketizerUnit"); // p->SetParameter("PROOF_ProcessNotAssigned", (Int_t)1); p->SetParameter("PROOF_UseMergers", "-1"); TStopwatch timer; timer.Start(); p->Process("TPeacVerifierSel", (Long64_t) 57); timer.Stop(); timer.Print(); }
void analyseYield_mc(const char* WHICHHIST, const char* NTUPLEWEIGHT, const char* MOMCORRTYPE, const char* MODE) { // directory with data TString protocol = "file://"; //TString dirname = "/home/asvyatko/DYStudy/CMSSW_5_3_3_patch2/src/DimuonAnalysis/DYPackage/test/ControlPlots_Purdue/"; TString dirname = "/scratch/lustreA/a/asvyatko/DY2013/rootfiles_Purdue/"; // data TFileCollection* c2a = new TFileCollection("DYM20_Purdue","DYM20_Purdue"); c2a->Add(protocol+dirname+"DYM20_Purdue/*9*.root"); //ntuple_skim_1_1_KzL.root"); //ntuple_skim_1_1_E3U.root"); gSystem->Load("Muon_cc.so"); gSystem->Load("Electron_cc.so"); gSystem->Load("Dimuon_cc.so"); gSystem->Load("Dielectron_cc.so"); gEnv->SetValue("ProofLite.Sandbox", "/home/asvyatko/DYStudy/CMSSW_5_3_3_patch2/src/DimuonAnalysis/DYPackage/test/ControlPlots_Purdue/proofbox/"); TProof* p = TProof::Open("workers=1"); p->RegisterDataSet("DYM20_Purdue", c2a,"OV"); p->ShowDataSets(); TObjString* mode = new TObjString(MODE); p->AddInput(new TNamed("mode",MODE)); gROOT->Time(); p->SetParameter("PROOF_LookupOpt", "all"); p->Process("DYM20_Purdue#/recoTree/DiLeptonTree","EventSelector.C+"); }
void FSRBinByBin(const char* MODE,TString datasetName, char* chunk, TString Alt) { // directory with data TString protocol = "file://"; //TString dirname = "/mnt/hadoop/store/user/asvyatko/DYstudy/dataAnalysis13/rootfiles/"; TString dirnameEE = "/scratch/scratch95/a/asvyatko/DY2013/rootfiles_Purdue/"; TString dirnameMuMu = "/scratch/lustreC/a/asvyatko/DY2013/rootfiles_Purdue/"; TString dirname = dirnameMuMu; if (datasetName.Contains("EE")) dirname = dirnameEE; TString ncores = "30"; //if (!datasetName.Contains("samp") && (chunk.Contains("_") || datasetName.Contains("00"))) ncores = "1"; if (!(datasetName.Contains("1020") || datasetName.Contains("samp"))) ncores = "3"; if (datasetName.Contains("1020")) ncores = "10"; TString beautiful = beautifulDataset(datasetName); TFileCollection* c = loadChunks(chunk[0],protocol,dirname,datasetName,beautiful); gSystem->Load("Muon_cc.so"); gSystem->Load("Electron_cc.so"); gSystem->Load("Dimuon_cc.so"); gSystem->Load("Dielectron_cc.so"); gEnv->SetValue("ProofLite.Sandbox", "/home/asvyatko/DYStudy/CMSSW_5_3_3_patch2/src/Analysis/DYPackage/test/FSRunfold_Purdue/proofbox/"); TProof* p = TProof::Open("workers="+ncores); p->RegisterDataSet(datasetName+chunk, c,"OV"); p->ShowDataSets(); TObjString* mode = new TObjString(MODE); p->AddInput(new TNamed("mode",MODE)); gROOT->Time(); p->SetParameter("PROOF_LookupOpt", "all"); p->Process(datasetName+chunk+"#/recoTree/DiLeptonTree","EventSelector_FSRUnfBBB.C+"); }
TProof *getProof(const char *url = "proof://localhost:40000", Int_t nwrks = -1, const char *dir = 0, const char *opt = "ask", Bool_t dyn = kFALSE, Bool_t tutords = kFALSE) { #ifdef __CINT__ Printf("getProof: this script can only be executed via ACliC:"); Printf("getProof: root [] .x <path>/getProof.C+"); Printf("getProof: or root [] .L <path>/getProof.C+"); Printf("getProof: root [] getProof(...)"); return; #endif TProof *p = 0; // Valgrind options, if any TString vopt, vopts; #ifndef WIN32 if (gSystem->Getenv("GETPROOF_VALGRIND")) { TString s(gSystem->Getenv("GETPROOF_VALGRIND")), t; Int_t from = 0; while (s.Tokenize(t, from , " ")) { if (t.BeginsWith("valgrind_opts:")) vopts = t; else vopt = t; } if (vopts.IsNull()) vopts = "valgrind_opts:--leak-check=full --track-origins=yes"; TProof::AddEnvVar("PROOF_WRAPPERCMD", vopts.Data()); Printf("getProof: valgrind run: '%s' (opts: '%s')", vopt.Data(), vopts.Data()); } #endif // If an URL has specified get a session there TUrl uu(url), uref(refloc); Bool_t ext = (strcmp(uu.GetHost(), uref.GetHost()) || (uu.GetPort() != uref.GetPort())) ? kTRUE : kFALSE; Bool_t lite = kFALSE; if (ext && url) { if (!strcmp(url, "lite://") || !url[0]) { if (!url[0]) uu.SetUrl("lite://"); if (dir && strlen(dir) > 0) gEnv->SetValue("Proof.Sandbox", dir); TString swrk("<default> workers"); if (nwrks > 0) { uu.SetOptions(Form("workers=%d", nwrks)); swrk.Form("%d workers", nwrks); } lite = kTRUE; gEnv->SetValue("Proof.MaxOldSessions", 1); Printf("getProof: trying to open a PROOF-Lite session with %s", swrk.Data()); } else { Printf("getProof: trying to open a session on the external cluster at '%s'", url); } p = TProof::Open(uu.GetUrl(), vopt); if (p && p->IsValid()) { // Check consistency if (ext && !lite && nwrks > 0) { Printf("getProof: WARNING: started/attached a session on external cluster (%s):" " 'nwrks=%d' ignored", url, nwrks); } if (ext && !lite && dir && strlen(dir) > 0) { Printf("getProof: WARNING: started/attached a session on external cluster (%s):" " 'dir=\"%s\"' ignored", url, dir); } if (ext && !strcmp(opt,"force")) { Printf("getProof: WARNING: started/attached a session on external cluster (%s):" " 'opt=\"force\"' ignored", url); } if (ext && dyn) { Printf("getProof: WARNING: started/attached a session on external cluster (%s):" " 'dyn=kTRUE' ignored", url); } // Done return p; } else { if (ext) { Printf("getProof: could not get/start a valid session at %s", url); return p; } else { Printf("getProof: could not get/start a valid session at %s - try resarting the daemon", url); } } if (p) delete p; p = 0; } #ifdef WIN32 // No support for local PROOF on Win32 (yet; the optimized local Proof will work there too) Printf("getProof: local PROOF not yet supported on Windows, sorry!"); return p; #else // Temp dir for tutorial daemons TString tutdir = dir; if (!tutdir.IsNull()) { if (gSystem->AccessPathName(tutdir)) { // Directory does not exist: try to make it gSystem->mkdir(tutdir.Data(), kTRUE); if (gSystem->AccessPathName(tutdir, kWritePermission)) { if (gSystem->AccessPathName(tutdir)) { Printf("getProof: unable to create the working area at the requested path: '%s'" " - cannot continue", tutdir.Data()); } else { Printf("getProof: working area at the requested path '%s'" " created but it is not writable - cannot continue", tutdir.Data()); } return p; } } else { // Check if it is writable ... if (gSystem->AccessPathName(dir, kWritePermission)) { // ... fail if not Printf("getProof: working area at the requested path '%s'" " exists but is not writable - cannot continue", tutdir.Data()); return p; } } } else { // Notify Printf("getProof: working area not specified temp "); // Force "/tmp/<user>" whenever possible to avoid length problems on MacOsX tutdir="/tmp"; if (gSystem->AccessPathName(tutdir, kWritePermission)) tutdir = gSystem->TempDirectory(); TString us; UserGroup_t *ug = gSystem->GetUserInfo(gSystem->GetUid()); if (!ug) { Printf("getProof: could not get user info"); return p; } us.Form("/%s", ug->fUser.Data()); if (!tutdir.EndsWith(us.Data())) tutdir += us; // Add our own subdir tutdir += "/.getproof"; if (gSystem->AccessPathName(tutdir)) { gSystem->mkdir(tutdir.Data(), kTRUE); if (gSystem->AccessPathName(tutdir, kWritePermission)) { Printf("getProof: unable to get a writable working area (tried: %s)" " - cannot continue", tutdir.Data()); return p; } } } Printf("getProof: working area (tutorial dir): %s", tutdir.Data()); // Dataset dir TString datasetdir; if (tutords) { datasetdir = Form("%s/dataset", tutdir.Data()); if (gSystem->AccessPathName(datasetdir, kWritePermission)) { gSystem->mkdir(datasetdir, kTRUE); if (gSystem->AccessPathName(datasetdir, kWritePermission)) { Printf("getProof: unable to get a writable dataset directory (tried: %s)" " - cannot continue", datasetdir.Data()); return p; } Printf("getProof: dataset dir: %s", datasetdir.Data()); } } // Local url (use a special port to try to not disturb running daemons) TUrl u(refloc); u.SetProtocol("proof"); if (!strcmp(uu.GetHost(), uref.GetHost()) && (uu.GetPort() != uref.GetPort())) u.SetPort(uu.GetPort()); Int_t lportp = u.GetPort(); Int_t lportx = lportp + 1; TString lurl = u.GetUrl(); // Prepare to start the daemon TString workarea = Form("%s/proof", tutdir.Data()); TString xpdcf(Form("%s/xpd.cf",tutdir.Data())); TString xpdlog(Form("%s/xpd.log",tutdir.Data())); TString xpdlogprt(Form("%s/xpdtut/xpd.log",tutdir.Data())); TString xpdpid(Form("%s/xpd.pid",tutdir.Data())); TString proofsessions(Form("%s/sessions",tutdir.Data())); TString cmd; Int_t rc = 0; // Is there something listening already ? Int_t pid = -1; Bool_t restart = kTRUE; if ((rc = checkXproofdAt(lportp)) == 1) { Printf("getProof: something else the a XProofd service is running on" " port %d - cannot continue", lportp); return p; } else if (rc == 0) { restart = kFALSE; pid = getXrootdPid(lportx); Printf("getProof: daemon found listening on dedicated ports {%d,%d} (pid: %d)", lportx, lportp, pid); if (isatty(0) == 0 || isatty(1) == 0) { // Cannot ask: always restart restart = kTRUE; } else { if (!strcmp(opt,"ask")) { char *answer = (char *) Getline("getProof: would you like to restart it (N,Y)? [N] "); if (answer && (answer[0] == 'Y' || answer[0] == 'y')) restart = kTRUE; } } if (!strcmp(opt,"force")) // Always restart restart = kTRUE; // Cleanup, if required if (restart) { Printf("getProof: cleaning existing instance ..."); // Cleaning up existing daemon cmd = Form("kill -9 %d", pid); if ((rc = gSystem->Exec(cmd)) != 0) Printf("getProof: problems stopping xrootd process %d (%d)", pid, rc); // Wait for all previous connections being cleaned Printf("getProof: wait 5 secs so that previous connections are cleaned ..."); gSystem->Sleep(5000); } } if (restart) { // Try to start something locally; make sure that everything is there char *xrootd = gSystem->Which(gSystem->Getenv("PATH"), "xrootd", kExecutePermission); if (!xrootd) { Printf("getProof: xrootd not found: please check the environment!"); return p; } // Cleanup the working area cmd = Form("rm -fr %s/xpdtut %s %s %s %s", tutdir.Data(), workarea.Data(), xpdcf.Data(), xpdpid.Data(), proofsessions.Data()); gSystem->Exec(cmd); // Try to start something locally; create the xrootd config file FILE *fcf = fopen(xpdcf.Data(), "w"); if (!fcf) { Printf("getProof: could not create config file for XPD (%s)", xpdcf.Data()); return p; } fprintf(fcf,"### Use admin path at %s/admin to avoid interferences with other users\n", tutdir.Data()); fprintf(fcf,"xrd.adminpath %s/admin\n", tutdir.Data()); #if defined(R__MACOSX) fprintf(fcf,"### Use dedicated socket path under /tmp to avoid length problems\n"); fprintf(fcf,"xpd.sockpathdir /tmp/xpd-sock\n"); #endif fprintf(fcf,"### Run data serving on port %d\n", lportp+1); fprintf(fcf,"xrd.port %d\n", lportp+1); fprintf(fcf,"### Load the XrdProofd protocol on port %d\n", lportp); fprintf(fcf,"xrd.protocol xproofd libXrdProofd.so\n"); fprintf(fcf,"xpd.port %d\n", lportp); if (nwrks > 0) { fprintf(fcf,"### Force number of local workers\n"); fprintf(fcf,"xpd.localwrks %d\n", nwrks); } fprintf(fcf,"### Root path for working dir\n"); fprintf(fcf,"xpd.workdir %s\n", workarea.Data()); fprintf(fcf,"### Allow different users to connect\n"); fprintf(fcf,"xpd.multiuser 1\n"); fprintf(fcf,"### Limit the number of query results kept in the master sandbox\n"); fprintf(fcf,"xpd.putrc ProofServ.UserQuotas: maxquerykept=10\n"); fprintf(fcf,"### Limit the number of sessions kept in the sandbox\n"); fprintf(fcf,"xpd.putrc Proof.MaxOldSessions: 1\n"); if (tutords) { fprintf(fcf,"### Use dataset directory under the tutorial dir\n"); fprintf(fcf,"xpd.datasetsrc file url:%s opt:-Cq:Av:As:\n", datasetdir.Data()); } if (dyn) { fprintf(fcf,"### Use dynamic, per-job scheduling\n"); fprintf(fcf,"xpd.putrc Proof.DynamicStartup 1\n"); } fprintf(fcf,"### Local data server for the temporary output files\n"); fprintf(fcf,"xpd.putenv LOCALDATASERVER=root://%s:%d\n", gSystem->HostName(), lportx); fclose(fcf); Printf("getProof: xrootd config file at %s", xpdcf.Data()); // Start xrootd in the background Printf("getProof: xrootd log file at %s", xpdlogprt.Data()); cmd = Form("%s -c %s -b -l %s -n xpdtut -p %d", xrootd, xpdcf.Data(), xpdlog.Data(), lportx); Printf("(NB: any error line from XrdClientSock::RecvRaw and XrdClientMessage::ReadRaw should be ignored)"); if ((rc = gSystem->Exec(cmd)) != 0) { Printf("getProof: problems starting xrootd (%d)", rc); return p; } delete[] xrootd; // Wait a bit Printf("getProof: waiting for xrootd to start ..."); gSystem->Sleep(2000); pid = getXrootdPid(lportx); Printf("getProof: xrootd pid: %d", pid); // Save it in the PID file FILE *fpid = fopen(xpdpid.Data(), "w"); if (!fpid) { Printf("getProof: could not create pid file for XPD"); } else { fprintf(fpid,"%d\n", pid); fclose(fpid); } } Printf("getProof: start / attach the PROOF session ..."); // Start / attach the session now p = TProof::Open(lurl, vopt.Data()); if (!p || !(p->IsValid())) { Printf("getProof: starting local session failed"); if (p) delete p; p = 0; return p; } // Return the session return p; #endif }
int main(int argc, char* argv[]){ //This line could be commented if you don't want display while running, by example using screen. //TApplication theApp("App",&argc,argv); //---------------------------------------// // Global variables: could be give as argument later //---------------------------------------// int nwnodes = 10; //8 to 10 is the optimal string macroName = "ProofSelectorTTBarTagAndProbe.C+"; //"+" should be put at the end to use ACLIC complication - This macro should inherit from TSelector string xmlFileName = string("/opt/sbg/data/data1/cms/jandrea/TopIPHC_2012_01_16/CMSSW_4_2_8_patch7/src/MiniTreeAnalysis/NTupleAnalysis/config/TTBarTagAndProbe.xml"); string outputFileName = "proof.root"; //---------------------------------------// // Decleration of TProof //---------------------------------------// //to be done before colling TProof system("../GeneralExamples/./clean_proof.sh ; echo 'Wait few seconds ... ' ; sleep 6"); system("rm -r $HOME/.proof"); TProof *proof = TProof::Open(""); proof->SetParallel(nwnodes); //you should not have any package yet proof->ShowPackages(); //proof->ClearPackages(); //Loading package related to NTupleAnalysis cout<<" ## Upload package NTAna.par: "; proof->UploadPackage("../NTAna.par"); cout<<" DONE [don't worry with symlink error - do rm NTAna if you change NTAna.par in the meanwhile !] "<<endl; proof->EnablePackage("NTAna"); //Adding histograms for feedback: must exist in the TSelector ! //proof->AddFeedback("fHist"); //give the "name" of the histogram and not the name of the variable TH1F* (could be the same !) //This line is required to display histograms durint the process TDrawFeedback fb(proof); //---------------------------------------// // Xml Loading & Dataset registration //---------------------------------------// vector < Dataset > datasets; AnalysisEnvironmentLoader anaEL (xmlFileName); anaEL.LoadSamples (datasets); // now the list of datasets written in the xml file is known cout<<" #------------------------------------# "<<endl; cout<<" PROOF DATASETS SUMMARY [normaly 0]"<<endl; proof->ShowDataSets(); cout<<" #------------------------------------# "<<endl; cout<<" # Registring dataset ... "<<endl; cout<<" Don't be worry with the checksum error message [at least I'm not ;-) ]"<<endl; cout<<" #------------------------------------# "<<endl; //Create datasets in proof format TFileCollection** fileCollec = new TFileCollection*[datasets.size()]; for(unsigned int i=0;i<datasets.size();i++){ fileCollec[i] = new TFileCollection(datasets[i].Name().c_str(),""); for(unsigned int j=0;j<datasets[i].Filenames().size();j++){ fileCollec[i]->Add(datasets[i].Filenames()[j].c_str()); } //register dataset in proof proof->RegisterDataSet(datasets[i].Name().c_str(),fileCollec[i]); proof->VerifyDataSet(datasets[i].Name().c_str()); } //summarize the list of datasets cout<<" #------------------------------------# "<<endl; cout<<" PROOF DATASETS SUMMARY"<<endl; proof->ShowDataSets(); cout<<" #------------------------------------# "<<endl; //---------------------------------------// // Loading of the xml file //---------------------------------------// //Possibility to give float ... ex: //Double_t f = 3.14; //proof->SetParameter("IN_FLOAT",f); //---------------------------------------// // Processing of the datasets //---------------------------------------// string outputFileNameModif = outputFileName.substr(0,outputFileName.size()-5); //string MergingCommand = "hadd "+outputFileNameModif+"_merged.root "+outputFileNameModif+"_*.root "; for(unsigned int i=0;i<datasets.size();i++){ proof->AddInput(new TNamed("PROOF_DATASETNAME", datasets[i].Name())); //---------------------------------------// // Loading of the xml file //---------------------------------------// //Possibility to give float ... ex: //Double_t f = 3.14; //proof->SetParameter("IN_FLOAT",f); proof->AddInput(new TNamed("PROOF_XMLFILENAME", xmlFileName)); proof->AddInput(new TNamed("PROOF_OUTPUTFILE", outputFileName)); cout<<"#------------------------------------# "<<endl; cout<<"PROOF PARAMETERS SUMMARY"<<endl; proof->ShowParameters(); cout<<"#------------------------------------# "<<endl; cout<<"################################################################"<<endl; cout<<"########### Processing the dataset "<<datasets[i].Name()<<endl; cout<<"################################################################"<<endl; //proof->Process(datasets[i].Name().c_str(),macroName.c_str()); //system("ps -ef |grep jandrea"); //gSystem->Load("../.lib/libNTupleAna_22-09-11_12-08-49.so"); //gSystem->Load("../../../MiniTreeFormat/NTFormat/src/libNTuple.so"); proof->Process(datasets[i].Name().c_str(),macroName.c_str()); string newFileName = outputFileNameModif+"_"+datasets[i].Name()+".root"; //system("sleep 30"); cout<<"Copying the output file with the name "<<endl; //string command = "cp "+outputFileName+" "+newFileName; //MergingCommand+=newFileName+" "; //system(command.c_str()); proof->ClearInput(); } //cout<<"## Merging of all the dataset into one single file with hadd: "<<outputFileName<<endl; //system(MergingCommand.c_str()); cout << "start backuping proof root files " << endl; system("mkdir backup_outputProof`date +\"%d-%m-%y_%H-%M-%S\"`; mv proof*.root backup_outputProof`date +\"%d-%m-%y_%H-%M-%S\"`/."); cout<<"###############################################################"<<endl; cout<<"################ May your job ##############"<<endl; cout<<"################ Live long and prosper ##############"<<endl; cout<<"###############################################################"<<endl; cout<< " "<< endl; cout<< " _ "<< endl; cout<< " .-T | _ "<< endl; cout<< " | | | / | "<< endl; cout<< " | | | / /`| "<< endl; cout<< " _ | | |/ / / "<< endl; cout<< " \\`\\| \'.\' / / "<< endl; cout<< " \\ \\`-. \'--| "<< endl; cout<< " \\ \' | "<< endl; cout<< " \\ \\ .` / "<< endl; cout<< " | | "<< endl; cout<< " "<< endl; cout<< " "<< endl; cout<<"###############################################################"<<endl; cout<<"###############################################################"<<endl; return (0); }
void InitAndLoadLibs(Int_t runMode=kMyRunModeLocal, Int_t workers=0,Bool_t debug=0) { // Loads libs and par files + custom task and classes // Custom stuff to be loaded // listToLoad->Add(new TObjString("$ALICE_ROOT/ANALYSIS/AliCentralitySelectionTask.cxx+")); listToLoad->Add(new TObjString("/Users/mfloris/Work/AliSoft/AliRoot-trunk/PWGPP/background/AliHistoListWrapper.cxx+")); // FIXME listToLoad->Add(new TObjString("AliAnalysisMultPbTrackHistoManager.cxx+")); listToLoad->Add(new TObjString("AliAnalysisMultPbCentralitySelector.cxx+")); listToLoad->Add(new TObjString("AliAnalysisTaskMultPbTracks.cxx+")); // listToLoad->Add(new TObjString("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.cxx+")); // listToLoad->Add(new TObjString("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx+")); // listToLoad->Add(new TObjString("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisTaskMultPbTracks.cxx+")); if (runMode == kMyRunModeCAF) { cout << "Init in CAF mode" << endl; gEnv->SetValue("XSec.GSI.DelegProxy", "2"); // TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("VO_ALICE@ROOT::v5-30-03-1"); TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("current"); TProof * p = TProof::Open("alice-caf.cern.ch", workers>0 ? Form("workers=%d",workers) : "1x"); // TProof * p = TProof::Open("skaf.saske.sk", workers>0 ? Form("workers=%d",workers) : ""); p->Exec("TObject *o = gEnv->GetTable()->FindObject(\"Proof.UseMergers\"); gEnv->GetTable()->Remove(o);", kTRUE); // TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("VO_ALICE@ROOT::v5-28-00f"); gProof->EnablePackage("VO_ALICE@AliRoot::v5-02-12-AN"); gSystem->Load("libCore"); gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); gSystem->Load("libMinuit"); gSystem->Load("libSTEERBase"); gSystem->Load("libESD"); gSystem->Load("libAOD"); gSystem->Load("libANALYSIS"); gSystem->Load("libOADB"); gSystem->Load("libANALYSISalice"); // Enable the needed package // gProof->UploadPackage("$ALICE_ROOT/obj/STEERBase"); // gProof->EnablePackage("$ALICE_ROOT/obj/STEERBase"); // gProof->UploadPackage("$ALICE_ROOT/obj/ESD"); // gProof->EnablePackage("$ALICE_ROOT/obj/ESD"); // gProof->UploadPackage("$ALICE_ROOT/obj/AOD"); // gProof->EnablePackage("$ALICE_ROOT/obj/AOD"); // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSIS"); // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSIS"); // gProof->UploadPackage("$ALICE_ROOT/obj/OADB"); // gProof->EnablePackage("$ALICE_ROOT/obj/OADB"); // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSISalice"); // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSISalice"); // gProof->UploadPackage("$ALICE_ROOT/obj/PWG0base"); // gProof->EnablePackage("$ALICE_ROOT/obj/PWG0base"); // gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/include")); // gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPb")); // gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG1/background")); } else if (runMode == kMyRunModeProofLite) { cout << "Init in CAF mode" << endl; gEnv->SetValue("XSec.GSI.DelegProxy", "2"); TProof * p = TProof::Open(""); // TProof * p = TProof::Open("skaf.saske.sk", workers>0 ? Form("workers=%d",workers) : ""); // p->Exec("TObject *o = gEnv->GetTable()->FindObject(\"Proof.UseMergers\"); gEnv->GetTable()->Remove(o);", kTRUE); // TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("VO_ALICE@ROOT::v5-28-00f"); // TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("5.28/00f"); gProof->UploadPackage("$ALICE_ROOT/ANALYSIS/macros/AliRootProofLite.par"); gProof->EnablePackage("AliRootProofLite"); } else { cout << "Init in Local or Grid mode" << endl; gSystem->Load("libCore"); gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); gSystem->Load("libMinuit"); gSystem->Load("libSTEERBase"); gSystem->Load("libESD"); gSystem->Load("libAOD"); gSystem->Load("libANALYSIS"); gSystem->Load("libOADB"); gSystem->Load("libANALYSISalice"); // Use AliRoot includes to compile our task gROOT->ProcessLine(".include $ALICE_ROOT/include"); // gSystem->Load("libVMC"); // gSystem->Load("libTree"); // gSystem->Load("libSTEERBase"); // gSystem->Load("libESD"); // gSystem->Load("libAOD"); // gSystem->Load("libANALYSIS"); // gSystem->Load("libANALYSISalice"); // gSystem->Load("libPWG0base"); gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPb")); gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWGPP/background")); // gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWGPP/background/")); } // Load helper classes TIterator * iter = listToLoad->MakeIterator(); TObjString * name = 0; while (name = (TObjString *)iter->Next()) { gSystem->ExpandPathName(name->String()); cout << name->String().Data(); if (runMode == kMyRunModeCAF || runMode == kMyRunModeProofLite) { gProof->Load(name->String()+(debug?"+g":"")); } else { gROOT->LoadMacro(name->String()+(debug?"+g":"")); } } }
void proof(Int_t runNum=-1,Int_t NumCores=10,TString OutPutName="histograms/temp.root") { //////////////////////////////////////////////////////////// // open the root files and put the together into a TChain // //////////////////////////////////////////////////////////// if (runNum != -99){ ch = new TChain("caltree"); std::cout << "Creating TChain... "; if (runNum ==-1){ // if no runNum give make a chain manually ch->Add("./rootfiles/run-0573-??.root"); } else { stringstream ss; ss<<"./rootfiles/run-"<<setfill('0')<<setw(4)<<runNum<<"-??.root"; ch->Add(ss.str().c_str()); if (OutPutName == "histograms/temp.root"){ ss.str(""); ss<<"histograms/HistogramsFromRun"<<runNum<<".root"; OutPutName=ss.str(); } } } std::cout << "Done." << std::endl; /////////////////////////////////////////////////////////////// // look for settings objects in each of the files // // in the chain. Set their names as settings0 1 2... // // for saving in the final histogram file // /////////////////////////////////////////////////////////////// vector <R00TLeSettings *> ListOfSettings; TObjArray *fileElements=ch->GetListOfFiles(); TIter next(fileElements); TChainElement *chEl=0; int FileSuccessCount=0; int count=0; while (( chEl=(TChainElement*)next() )) { TFile f(chEl->GetTitle()); if (f.IsOpen()){ FileSuccessCount++; }else { cout<<"Warning could not open "<<chEl->GetTitle()<<endl; } if ( f.GetListOfKeys()->Contains("TheSettings")) { stringstream ss; ss<<"Settings"<<count; TString newName = ss.str().c_str(); R00TLeSettings *temp = (R00TLeSettings*)f.Get("TheSettings"); temp->SetName(newName); ListOfSettings.push_back(temp); } else { cout<<"No Seetings object found in "<<chEl->GetTitle()<<endl; exit(1); } count++; } if ( FileSuccessCount == 0 ){ cout<<"No files were successfully opened"<<endl; return; } std::cout << "\nList of files:" << std::endl; ch->GetListOfFiles()->Print(); cout<<endl; TString user =gSystem->Getenv("R00TLe_User"); TString install =gSystem->Getenv("R00TLeInstall"); TString src = install+"/users/"+user+"/src/Analoop.cc+g"; TString user =gSystem->Getenv("R00TLe_User"); TString install =gSystem->Getenv("R00TLeInstall"); TString src = install+"/users/"+user+"/src/Analoop.cc+g"; TString soFile=install+"/users/"+user+"/src/Analoop_cc.so"; ///////////////////////////////////////// // compile and load Analoop in to ROOT // ///////////////////////////////////////// gROOT->ProcessLine(".L " +src); //////////////////////////////////////// // Set up the PROOF Sandbox directory // //////////////////////////////////////// TString sandbox = install + "/users/"+user+"/PROOF/"; gEnv->SetValue("ProofLite.SandBox",sandbox); ///////////////// // start PROOF // ///////////////// std::stringstream ss; ss<<NumCores; TString workerString = "workers=" + TString(ss.str().c_str()); TProof * p =TProof::Open(workerString); p->SetParameter("PROOF_UseTreeCache",1); p->SetParameter("PROOF_CacheSize",1024.*1024.); ////////////////////////////////////////////////////// // load the analoop library on each worker thread // ////////////////////////////////////////////////////// TString so_cmd = "gSystem->Load(\"" +soFile+ "\")"; p->Exec(so_cmd); ///////////////////////////////////////////////////////////// // make instance of analoop that will be passed into PROOF // ///////////////////////////////////////////////////////////// TSelector* myAnaloop = TSelector::GetSelector(src); ////////////////////////////////////////////////////////////// // Put the settings object from the first file in the input // // list of the selector // ////////////////////////////////////////////////////////////// TList * list = new TList(); list->Add(ListOfSettings[0]); myAnaloop->SetInputList(list); //////////////////////////////////////////////////////////////// // Magic lines that loop over the tchain and analyzes it with // // the analoop program using PROOF on different worker // // nodes // //////////////////////////////////////////////////////////////// ch->SetProof(kTRUE); ch->SetCacheSize(1024.*1024.); ch->AddBranchToCache("*",kTRUE); ch->Process(myAnaloop,OutPutName);//Deep Magicks //Preform Clean up for PROOF p->CleanupSession(gProof->GetSessionTag()); p->ClearCache(); p->Close(); delete ch; }
void runAnalysis(TString sample="all", TString proc="all", TString sys="all", TString updown="both", bool getLogs=false) { TString desdir = "/uscms/home/algomez/work/CMSSW_4_2_4/src/Yumiceva/TreeAnalyzer/test/backup/"; //TString desdir = "/eos/uscms/store/user/algomez/FourTop/resultsTreeAnalyzer/results13/"; TProof *p = TProof::Open("lite://", desdir ,desdir); //p->AddDynamicPath(""); p->Exec("gSystem->Load(\"/uscms/home/algomez/work/CMSSW_4_2_4/lib/slc5_amd64_gcc434/libYumicevaTop7TeV.so\")"); p->Exec("gSystem->Load(\"/uscms/home/algomez/work/CMSSW_4_2_4/lib/slc5_amd64_gcc434/libCondFormatsJetMETObjects.so\")"); p->AddIncludePath("/uscms/home/algomez/work/CMSSW_4_2_4/src/"); p->Archive(" ",desdir); //p->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION", "LOCAL")); if (sample=="tttt"|| sample=="ttttSM"||sample=="all") { TDSet *mc_tttt_SM = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_SM->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_SM-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_SM->Process("Analyzer.C+","sample=tttt_SM"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_SM->Process("Analyzer.C+", sys+"UP sample=tttt_SM"); if (updown == "both" || updown == "down") mc_tttt_SM->Process("Analyzer.C+", sys+"DOWN sample=tttt_SM"); } } if (sample=="tttt"||sample=="tttt400"||sample=="all") { TDSet *mc_tttt_Gh400 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh400->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh400_50k_1-Tuple-PATskim.root"); mc_tttt_Gh400->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh400_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh400->Process("Analyzer.C+","sample=tttt_Gh400"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh400->Process("Analyzer.C+", sys+"UP sample=tttt_Gh400"); if (updown == "both" || updown == "down") mc_tttt_Gh400->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh400"); } } if (sample=="tttt"||sample=="tttt500"||sample=="all") { TDSet *mc_tttt_Gh500 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh500->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh500_50k_1-Tuple-PATskim.root"); mc_tttt_Gh500->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh500_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh500->Process("Analyzer.C+","sample=tttt_Gh500"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh500->Process("Analyzer.C+", sys+"UP sample=tttt_Gh500"); if (updown == "both" || updown == "down") mc_tttt_Gh500->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh500"); } } if (sample=="tttt"||sample=="tttt600"||sample=="all") { TDSet *mc_tttt_Gh600 = new TDSet("top","*","/PATNtupleMaker"); //mc_tttt_Gh600->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh600_50k_1-Tuple-PATskim.root"); mc_tttt_Gh600->Add("/uscms/home/algomez/work/CMSSW_4_2_4/src/Yumiceva/Top7TeV/test/tttt_Gh600_test_FASTSIM_FULLSIM/tttt_Gh600-Tuple-PATskim.root"); //mc_tttt_Gh600->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh600_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh600->Process("Analyzer.C+","sample=tttt_Gh600"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh600->Process("Analyzer.C+", sys+"UP sample=tttt_Gh600"); if (updown == "both" || updown == "down") mc_tttt_Gh600->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh600"); } } if (sample=="tttt"||sample=="tttt700"||sample=="all") { TDSet *mc_tttt_Gh700 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh700->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh700_50k_1-Tuple-PATskim.root"); mc_tttt_Gh700->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh700_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh700->Process("Analyzer.C+","sample=tttt_Gh700"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh700->Process("Analyzer.C+", sys+"UP sample=tttt_Gh700"); if (updown == "both" || updown == "down") mc_tttt_Gh700->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh700"); } } if (sample=="tttt"||sample=="tttt800"||sample=="all") { TDSet *mc_tttt_Gh800 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh800->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh800_50k_1-Tuple-PATskim.root"); mc_tttt_Gh800->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh800_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh800->Process("Analyzer.C+","sample=tttt_Gh800"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh800->Process("Analyzer.C+", sys+"UP sample=tttt_Gh800"); if (updown == "both" || updown == "down") mc_tttt_Gh800->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh800"); } } if (sample=="tttt"||sample=="tttt900"||sample=="all") { TDSet *mc_tttt_Gh900 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh900->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh900_50k_1-Tuple-PATskim.root"); mc_tttt_Gh900->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh900_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh900->Process("Analyzer.C+","sample=tttt_Gh900"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh900->Process("Analyzer.C+", sys+"UP sample=tttt_Gh900"); if (updown == "both" || updown == "down") mc_tttt_Gh900->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh900"); } } if (sample=="tttt"||sample=="tttt1000"||sample=="all") { TDSet *mc_tttt_Gh1000 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh1000->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh1000_50k_1-Tuple-PATskim.root"); mc_tttt_Gh1000->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh1000_50k_2-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh1000->Process("Analyzer.C+","sample=tttt_Gh1000"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh1000->Process("Analyzer.C+", sys+"UP sample=tttt_Gh1000"); if (updown == "both" || updown == "down") mc_tttt_Gh1000->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh1000"); } } if (sample=="tttt"||sample=="ttttUED6"||sample=="all") { TDSet *mc_tttt_UED6 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_UED6->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_UED6-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_UED6->Process("Analyzer.C+","sample=ttttUED6"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_UED6->Process("Analyzer.C+", sys+"UP sample=ttttUED6"); if (updown == "both" || updown == "down") mc_tttt_UED6->Process("Analyzer.C+", sys+"DOWN sample=ttttUED6"); } } /*if (sample=="tttt"||sample=="tttt1200"||sample=="all") { TDSet *mc_tttt_Gh1200 = new TDSet("top","*","/PATNtupleMaker"); mc_tttt_Gh1200->Add("/eos/uscms/store/user/algomez/FourTop/Ntuples/tttt_Gh1200-Tuple-PATskim.root"); if (proc =="all" ) { mc_tttt_Gh1200->Process("Analyzer.C+","sample=tttt_Gh1200"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_tttt_Gh1200->Process("Analyzer.C+", sys+"UP sample=tttt_Gh1200"); if (updown == "both" || updown == "down") mc_tttt_Gh1200->Process("Analyzer.C+", sys+"DOWN sample=tttt_Gh1200"); } }*/ if (sample=="MC"||sample=="ttbar"||sample=="all") { TDSet *mc_ttbar = new TDSet("top","*","/PATNtupleMaker"); mc_ttbar->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TTbar_Fall11_Mu.root"); ///uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TTbar_Mu.root"); if (proc =="all" ) { mc_ttbar->Process("Analyzer.C+","sample=ttbar"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_ttbar->Process("Analyzer.C+", sys+"UP sample=ttbar"); if (updown == "both" || updown == "down") mc_ttbar->Process("Analyzer.C+", sys+"DOWN sample=ttbar"); } } if (sample=="TTbar"||sample=="all") { TDSet *mc_TTbar = new TDSet("top","*","/PATNtupleMaker"); mc_TTbar->Add("/eos/uscms/store/user/algomez/ttbar/ttbar_pythia8-Tuple-PATskim.root"); mc_TTbar->Add("/eos/uscms/store/user/algomez/ttbar/ttbar_pythia8_100k-Tuple-PATskim.root"); if (proc =="all" ) { mc_TTbar->Process("Analyzer.C+","sample=TTbar"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_TTbar->Process("Analyzer.C+", sys+"UP sample=TTbar"); if (updown == "both" || updown == "down") mc_TTbar->Process("Analyzer.C+", sys+"DOWN sample=TTbar"); } } if (sample=="TTbar_POWHEG"||sample=="all") { TDSet *mc_ttbar = new TDSet("top","*","/PATNtupleMaker"); mc_ttbar->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TT_Powheg_Mu.root"); if (proc =="all" ) mc_ttbar->Process("Analyzer.C+","sample=ttbar_powheg"); if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_ttbar->Process("Analyzer.C+", sys+"UP sample=ttbar_powheg"); if (updown == "both" || updown == "down") mc_ttbar->Process("Analyzer.C+", sys+"DOWN sample=ttbar_powheg"); } } if (sample=="TTbarM"||sample=="MC") { TDSet *mc_ttbarm = new TDSet("top","*","/PATNtupleMaker"); mc_ttbarm->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TTbar_matchup_Mu.root"); if (proc =="all" ) {mc_ttbarm->Process("Analyzer.C+","sample=ttbarMatchup");} } if (sample=="TTbarM"||sample=="MC") { TDSet *mc_ttbarm = new TDSet("top","*","/PATNtupleMaker"); mc_ttbarm->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TTbar_matchdown_Mu.root"); if (proc =="all" ) {mc_ttbarm->Process("Analyzer.C+","sample=ttbarMatchdown");} } if (sample=="TTbarQ"||sample=="MC") { TDSet *mc_ttbarm = new TDSet("top","*","/PATNtupleMaker"); mc_ttbarm->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TTbar_scaleup_Mu.root"); if (proc =="all" ) {mc_ttbarm->Process("Analyzer.C+","sample=ttbarScaleup");} } if (sample=="TTbarQ"||sample=="MC") { TDSet *mc_ttbarm = new TDSet("top","*","/PATNtupleMaker"); mc_ttbarm->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/TTbar_scaledown_Mu.root"); if (proc =="all" ) {mc_ttbarm->Process("Analyzer.C+","sample=ttbarScaledown");} } if (sample=="WJets"||sample=="all") { TDSet *mc_WJets = new TDSet("top","*","/PATNtupleMaker"); mc_WJets->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/WJets_Mu.root"); if (proc =="all" ) { mc_WJets->Process("Analyzer.C+","sample=WJets"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_WJets->Process("Analyzer.C+", sys+"UP sample=WJets"); if (updown == "both" || updown == "down") mc_WJets->Process("Analyzer.C+", sys+"DOWN sample=WJets"); } } if (sample=="MC"||sample=="Wjets"||sample=="Wbb"||sample=="all") { TDSet *mc_Wbb = new TDSet("top","*","/PATNtupleMaker"); mc_Wbb->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/WJets_Mu.root"); if (proc =="all" ) { mc_Wbb->Process("Analyzer.C+","sample=Wbb"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_Wbb->Process("Analyzer.C+", sys+"UP sample=Wbb"); if (updown == "both" || updown == "down") mc_Wbb->Process("Analyzer.C+", sys+"DOWN sample=Wbb"); } } if (sample=="MC"||sample=="Wjets"||sample=="Wcc"||sample=="all") { TDSet *mc_Wcc = new TDSet("top","*","/PATNtupleMaker"); mc_Wcc->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/WJets_Mu.root"); if (proc =="all" ) { mc_Wcc->Process("Analyzer.C+","sample=Wcc"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_Wcc->Process("Analyzer.C+", sys+"UP sample=Wcc"); if (updown == "both" || updown == "down") mc_Wcc->Process("Analyzer.C+", sys+"DOWN sample=Wcc"); } } if (sample=="MC"||sample=="Wjets"||sample=="Wqq"||sample=="all") { TDSet *mc_Wqq = new TDSet("top","*","/PATNtupleMaker"); mc_Wqq->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/WJets_Mu.root"); if (proc =="all" ) { mc_Wqq->Process("Analyzer.C+","sample=Wqq"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_Wqq->Process("Analyzer.C+", sys+"UP sample=Wqq"); if (updown == "both" || updown == "down") mc_Wqq->Process("Analyzer.C+", sys+"DOWN sample=Wqq"); } } if (sample=="QCD"||sample=="all") { TDSet *mc_QCD = new TDSet("top","*","/PATNtupleMaker"); mc_QCD->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/QCD_Mu.root"); if (proc =="all" ) { mc_QCD->Process("Analyzer.C+","sample=QCD"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_QCD->Process("Analyzer.C+", sys+"UP sample=QCD"); if (updown == "both" || updown == "down") mc_QCD->Process("Analyzer.C+", sys+"DOWN sample=QCD"); } } if (sample=="MC"||sample=="ST"||sample=="STsch"||sample=="all") { TDSet *mc_STsch = new TDSet("top","*","/PATNtupleMaker"); mc_STsch->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/STsch_Mu.root"); if (proc =="all" ) { mc_STsch->Process("Analyzer.C+","sample=STsch"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_STsch->Process("Analyzer.C+", sys+"UP sample=STsch"); if (updown == "both" || updown == "down") mc_STsch->Process("Analyzer.C+", sys+"DOWN sample=STsch"); } } if (sample=="MC"||sample=="ST"||sample=="STtch"||sample=="all") { TDSet *mc_STtch = new TDSet("top","*","/PATNtupleMaker"); mc_STtch->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/STtch_Mu.root"); if (proc =="all" ) { mc_STtch->Process("Analyzer.C+","sample=STtch"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_STtch->Process("Analyzer.C+", sys+"UP sample=STtch"); if (updown == "both" || updown == "down") mc_STtch->Process("Analyzer.C+", sys+"DOWN sample=STtch"); } } if (sample=="MC"||sample=="ST"||sample=="STtWch"||sample=="all") { TDSet *mc_STtWch = new TDSet("top","*","/PATNtupleMaker"); mc_STtWch->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/STtWch_Mu.root"); if (proc =="all" ) { mc_STtWch->Process("Analyzer.C+","sample=STtWch"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_STtWch->Process("Analyzer.C+", sys+"UP sample=STtWch"); if (updown == "both" || updown == "down") mc_STtWch->Process("Analyzer.C+", sys+"DOWN sample=STtWch"); } } if (sample=="MC"||sample=="ST"||sample=="STsch_bar"||sample=="all") { TDSet *mc_STsch_bar = new TDSet("top","*","/PATNtupleMaker"); mc_STsch_bar->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/STsch_bar_Mu.root"); if (proc =="all" ) { mc_STsch_bar->Process("Analyzer.C+","sample=STsch_bar"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_STsch_bar->Process("Analyzer.C+", sys+"UP sample=STsch_bar"); if (updown == "both" || updown == "down") mc_STsch_bar->Process("Analyzer.C+", sys+"DOWN sample=STsch_bar"); } } if (sample=="MC"||sample=="ST"||sample=="STtch_bar"||sample=="all") { TDSet *mc_STtch_bar = new TDSet("top","*","/PATNtupleMaker"); mc_STtch_bar->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/STtch_bar_Mu.root"); if (proc =="all" ) { mc_STtch_bar->Process("Analyzer.C+","sample=STtch_bar"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_STtch_bar->Process("Analyzer.C+", sys+"UP sample=STtch_bar"); if (updown == "both" || updown == "down") mc_STtch_bar->Process("Analyzer.C+", sys+"DOWN sample=STtch_bar"); } } if (sample=="MC"||sample=="ST"||sample=="STtWch_bar"||sample=="all") { TDSet *mc_STtWch_bar = new TDSet("top","*","/PATNtupleMaker"); mc_STtWch_bar->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/STtWch_bar_Mu.root"); if (proc =="all" ) { mc_STtWch_bar->Process("Analyzer.C+","sample=STtWch_bar"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_STtWch_bar->Process("Analyzer.C+", sys+"UP sample=STtWch_bar"); if (updown == "both" || updown == "down") mc_STtWch_bar->Process("Analyzer.C+", sys+"DOWN sample=STtWch_bar"); } } if (sample=="MC"||sample=="diboson"||sample=="WW"||sample=="all") { TDSet *mc_WW = new TDSet("top","*","/PATNtupleMaker"); mc_WW->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/WW_Mu.root"); if (proc =="all" ) { mc_WW->Process("Analyzer.C+","sample=WW"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_WW->Process("Analyzer.C+", sys+"UP sample=WW"); if (updown == "both" || updown == "down") mc_WW->Process("Analyzer.C+", sys+"DOWN sample=WW"); } } if (sample=="MC"||sample=="diboson"||sample=="WZ"||sample=="all") { TDSet *mc_WZ = new TDSet("top","*","/PATNtupleMaker"); mc_WZ->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/WZ_Mu.root"); if (proc =="all" ) { mc_WZ->Process("Analyzer.C+","sample=WZ"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_WZ->Process("Analyzer.C+", sys+"UP sample=WZ"); if (updown == "both" || updown == "down") mc_WZ->Process("Analyzer.C+", sys+"DOWN sample=WZ"); } } if (sample=="MC"||sample=="ZJets"||sample=="all") { TDSet *mc_ZJets = new TDSet("top","*","/PATNtupleMaker"); mc_ZJets->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/MC/v9_14/ZJets_Mu.root"); if (proc =="all" ) { mc_ZJets->Process("Analyzer.C+","sample=ZJets"); } if ( proc =="sys" ) { if (updown == "both" || updown == "up") mc_ZJets->Process("Analyzer.C+", sys+"UP sample=ZJets"); if (updown == "both" || updown == "down") mc_ZJets->Process("Analyzer.C+", sys+"DOWN sample=ZJets"); } } if (sample=="data"||sample=="all") { TDSet *data = new TDSet("top","*","/PATNtupleMaker"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_May10ReReco_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_PromptReco-v4_Run_165088_166967_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_PromptReco-v4_Run_167039_167913_Mu.root"); //data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Aug05ReReco_Mu.root"); //data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_PromptReco-v6_Run_172620_173198_Mu.root"); //data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_PromptReco-v6_Run_173236_173692_Mu.root"); //data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Run2011B-PromptReco-v1_175860_178380_Mu.root"); //data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Run2011B-PromptReco-v1_178420_180252_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Aug05ReReco_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_PromptReco-v6_Run_172620_173198_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_PromptReco-v6_Run_173236_173692_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Run2011B-PromptReco-v1_175860_177452_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Run2011B-PromptReco-v1_177718_178380_Mu.root"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/SingleMu_Run2011B-PromptReco-v1_178420_180252_Mu.root "); data->Process("Analyzer.C+","sample=data"); // get log files if (getLogs) { logList = p->GetManager()->GetSessionLogs()->GetListOfLogs(); for (int i=1; i< logList->GetSize(); ++i) { logElem = ( TProofLogElem* ) logList->At( i ); macro = logElem->GetMacro(); macro->SaveSource("data_muons_"+TString(Form("%i",i))+".stdout"); } } } if (sample=="dataMissing"||sample=="all") { TDSet *data = new TDSet("top","*","/PATNtupleMaker"); data->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011Muon/42x_v9_12/missing.root "); data->Process("Analyzer.C+","sample=dataMissing"); // get log files if (getLogs) { logList = p->GetManager()->GetSessionLogs()->GetListOfLogs(); for (int i=1; i< logList->GetSize(); ++i) { logElem = ( TProofLogElem* ) logList->At( i ); macro = logElem->GetMacro(); macro->SaveSource("data_missing_"+TString(Form("%i",i))+".stdout"); } } } if (sample=="dataQCD2"||sample=="all") { TDSet *dataQCD2 = new TDSet("top","*","/PATNtupleMaker"); dataQCD2->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011/42x/Run2011_May10ReReco_Mu.root"); dataQCD2->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011/42x/Run2011_PromptReco1_Mu.root"); dataQCD2->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011/42x/Run2011_PromptReco2_Mu.root"); dataQCD2->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011/42x/SingleMu_Aug05ReReco_Mu.root"); dataQCD2->Add("/uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011/42x/SingleMu_PromptReco-v6_Mu.root"); dataQCD2->Process("Analyzer.C+","QCD2 sample=data"); } }
void LoadLibraries(const anaModes mode, Bool_t useFlowParFiles ) { //-------------------------------------- // Load the needed libraries most of them already loaded by aliroot //-------------------------------------- gSystem->Load("libCore"); gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libXMLIO"); gSystem->Load("libPhysics"); gSystem->Load("libXMLParser"); gSystem->Load("libProof"); gSystem->Load("libMinuit"); if (mode==mLocal || mode==mGrid) { gSystem->Load("libSTEERBase"); gSystem->Load("libCDB"); gSystem->Load("libRAWDatabase"); gSystem->Load("libRAWDatarec"); gSystem->Load("libESD"); gSystem->Load("libAOD"); gSystem->Load("libSTEER"); gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); gSystem->Load("libTPCbase"); gSystem->Load("libTOFbase"); gSystem->Load("libTOFrec"); gSystem->Load("libTRDbase"); gSystem->Load("libVZERObase"); gSystem->Load("libVZEROrec"); gSystem->Load("libT0base"); gSystem->Load("libT0rec"); gSystem->Load("libTender"); gSystem->Load("libTenderSupplies"); if (useFlowParFiles) { AliAnalysisAlien::SetupPar("PWGflowBase"); AliAnalysisAlien::SetupPar("PWGflowTasks"); } else { gSystem->Load("libPWGflowBase"); gSystem->Load("libPWGflowTasks"); } } else if (mode==mPROOF) { TList* list = new TList(); list->Add(new TNamed("ALIROOT_MODE", "ALIROOT")); if (useFlowParFiles) list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:Tender:TenderSupplies")); else list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:Tender:TenderSupplies:PWGflowBase:PWGflowTasks")); //list->Add(new TNamed("ALIROOT_EXTRA_INCLUDES","PWG/FLOW/Base:PWG/FLOW/Tasks")); // Connect to proof printf("*** Connect to PROOF ***\n"); gEnv->SetValue("XSec.GSI.DelegProxy","2"); //TProof* proof = TProof::Open("alice-caf.cern.ch"); TProof* proof = TProof::Open("skaf.saske.sk"); // list the data available //gProof->ShowDataSets("/*/*"); //gProof->ShowDataSets("/alice/sim/"); //for MC Data //gProof->ShowDataSets("/alice/data/"); //for REAL Data proof->ClearPackages(); proof->EnablePackage("VO_ALICE@AliRoot::v4-21-14-AN",list); if (useFlowParFiles) { gProof->UploadPackage("PWGflowBase.par"); gProof->UploadPackage("PWGflowTasks.par"); } // Show enables Packages gProof->ShowEnabledPackages(); } } // end of void LoadLibraries(const anaModes mode)
void ABCD2vari_p3(const char* ISO) { //Only iso is external, all the regions go in a loop!!! to be fed in the macro at once TString PREFIX = "./"; //Get the fractions //gStyle->SetOptStat(0); TFile* fB = new TFile(PREFIX+"factor_qcd_"+TString(ISO)+"_B.root", "open"); fB->cd(); TH1D* hRatioB = (TH1D*)gDirectory->Get("hfactor"); hRatioB->Fit("pol0"); //2D needs, preliminary TH1D* hRatioB2030 = (TH1D*)gDirectory->Get("hfactor2030"); hRatioB2030->Fit("pol0"); TH1D* hRatioB3045 = (TH1D*)gDirectory->Get("hfactor3045"); hRatioB3045->Fit("pol0"); TH1D* hRatioB4560 = (TH1D*)gDirectory->Get("hfactor4560"); hRatioB4560->Fit("pol0"); TH1D* hRatioB60120 = (TH1D*)gDirectory->Get("hfactor60120"); hRatioB60120->Fit("pol0"); TH1D* hRatioB120200 = (TH1D*)gDirectory->Get("hfactor120200"); hRatioB120200->Fit("pol0"); TH1D* hRatioB2001500 = (TH1D*)gDirectory->Get("hfactor2001500"); hRatioB2001500->Fit("pol0"); TF1 *myfitB = (TF1*)hRatioB->GetFunction("pol0"); Double_t factor_B = myfitB->GetParameter(0); Double_t factor_B_err = myfitB->GetParError(0); //2D needs, preliminary TF1 *myfitB2030 = (TF1*)hRatioB2030->GetFunction("pol0"); Double_t factor_B2030 = myfitB2030->GetParameter(0); Double_t factor_B_err2030 = myfitB2030->GetParError(0); TF1 *myfitB3045 = (TF1*)hRatioB3045->GetFunction("pol0"); Double_t factor_B3045 = myfitB3045->GetParameter(0); Double_t factor_B_err3045 = myfitB3045->GetParError(0); TF1 *myfitB4560 = (TF1*)hRatioB4560->GetFunction("pol0"); Double_t factor_B4560 = myfitB4560->GetParameter(0); Double_t factor_B_err4560 = myfitB4560->GetParError(0); TF1 *myfitB60120 = (TF1*)hRatioB60120->GetFunction("pol0"); Double_t factor_B60120 = myfitB60120->GetParameter(0); Double_t factor_B_err60120 = myfitB60120->GetParError(0); TF1 *myfitB120200 = (TF1*)hRatioB120200->GetFunction("pol0"); Double_t factor_B120200 = myfitB120200->GetParameter(0); Double_t factor_B_err120200 = myfitB120200->GetParError(0); TF1 *myfitB2001500 = (TF1*)hRatioB2001500->GetFunction("pol0"); Double_t factor_B2001500 = myfitB2001500->GetParameter(0); Double_t factor_B_err2001500 = myfitB2001500->GetParError(0); //repeat for region D TFile* fD = new TFile(PREFIX+"factor_qcd_"+TString(ISO)+"_D.root", "open"); fD->cd(); TH1D* hRatioD = (TH1D*)gDirectory->Get("hfactor"); hRatioD->Fit("pol0"); //2D needs, preliminary TH1D* hRatioD2030 = (TH1D*)gDirectory->Get("hfactor2030"); hRatioD2030->Fit("pol0"); TH1D* hRatioD3045 = (TH1D*)gDirectory->Get("hfactor3045"); hRatioD3045->Fit("pol0"); TH1D* hRatioD4560 = (TH1D*)gDirectory->Get("hfactor4560"); hRatioD4560->Fit("pol0"); TH1D* hRatioD60120 = (TH1D*)gDirectory->Get("hfactor60120"); hRatioD60120->Fit("pol0"); TH1D* hRatioD120200 = (TH1D*)gDirectory->Get("hfactor120200"); hRatioD120200->Fit("pol0"); TH1D* hRatioD2001500 = (TH1D*)gDirectory->Get("hfactor2001500"); hRatioD2001500->Fit("pol0"); TF1 *myfitD = (TF1*)hRatioD->GetFunction("pol0"); Double_t factor_D = myfitD->GetParameter(0); Double_t factor_D_err = myfitD->GetParError(0); //2D needs, preliminary TF1 *myfitD2030 = (TF1*)hRatioD2030->GetFunction("pol0"); Double_t factor_D2030 = myfitD2030->GetParameter(0); Double_t factor_D_err2030 = myfitD2030->GetParError(0); TF1 *myfitD3045 = (TF1*)hRatioD3045->GetFunction("pol0"); Double_t factor_D3045 = myfitD3045->GetParameter(0); Double_t factor_D_err3045 = myfitB3045->GetParError(0); TF1 *myfitD4560 = (TF1*)hRatioD4560->GetFunction("pol0"); Double_t factor_D4560 = myfitD4560->GetParameter(0); Double_t factor_D_err4560 = myfitD4560->GetParError(0); TF1 *myfitD60120 = (TF1*)hRatioD60120->GetFunction("pol0"); Double_t factor_D60120 = myfitD60120->GetParameter(0); Double_t factor_D_err60120 = myfitD60120->GetParError(0); TF1 *myfitD120200 = (TF1*)hRatioD120200->GetFunction("pol0"); Double_t factor_D120200 = myfitD120200->GetParameter(0); Double_t factor_D_err120200 = myfitD120200->GetParError(0); TF1 *myfitD2001500 = (TF1*)hRatioD2001500->GetFunction("pol0"); Double_t factor_D2001500 = myfitD2001500->GetParameter(0); Double_t factor_D_err2001500 = myfitD2001500->GetParError(0); // directory with data TString protocol = "file://"; TString dirname = "/scratch/lustreC/a/asvyatko/DY2013/rootfiles/"; // EWK TFileCollection* c6 = new TFileCollection("WJets","WJets"); c6->Add(protocol+dirname+"WJets_PU"+"/*.root"); // diboson TFileCollection* c7a = new TFileCollection("WZJetsTo3LNu","WZJetsTo3LNu"); c7a->Add(protocol+dirname+"WZJetsTo3LNu_PU"+"/*.root"); TFileCollection* c7b = new TFileCollection("WZJetsTo2L2Q","WZJetsTo2L2Q"); c7b->Add(protocol+dirname+"WZJetsTo2L2Q_PU"+"/*.root"); TFileCollection* c7c = new TFileCollection("ZZJetsTo2L2Nu","ZZJetsTo2L2Nu"); c7c->Add(protocol+dirname+"ZZJetsTo2L2Nu_PU"+"/*.root"); TFileCollection* c7d = new TFileCollection("ZZJetsTo4L","ZZJetsTo4L"); c7d->Add(protocol+dirname+"ZZJetsTo4L_PU"+"/*.root"); TFileCollection* c7e = new TFileCollection("ZZJetsTo2L2Q","ZZJetsTo2L2Q"); c7e->Add(protocol+dirname+"ZZJetsTo2L2Q_PU"+"/*.root"); TFileCollection* c7f = new TFileCollection("WWJetsTo2L2Nu","WWJetsTo2L2Nu"); c7f->Add(protocol+dirname+"WWJetsTo2L2Nu_PU"+"/*.root"); //ttbar TFileCollection* c8a = new TFileCollection("tW","tW"); c8a->Add(protocol+dirname+"tW_PU"+"/*.root"); TFileCollection* c8b = new TFileCollection("tbarW","tbarW"); c8b->Add(protocol+dirname+"tbarW_PU"+"/*.root"); TFileCollection* c8c = new TFileCollection("tt1000","ttbar1000"); c8c->Add(protocol+dirname+"tt1000_PU"+"/*.root"); TFileCollection* c8d = new TFileCollection("tt700","ttbar700"); c8d->Add(protocol+dirname+"tt700_PU"+"/*.root"); TFileCollection* c8a = new TFileCollection("tW","tW"); c8a->Add(protocol+dirname+"tW_PU"+"/*.root"); TFileCollection* c8b = new TFileCollection("tbarW","tbarW"); c8b->Add(protocol+dirname+"tbarW_PU"+"/*.root"); TFileCollection* c8c = new TFileCollection("tt1000","ttbar1000"); c8c->Add(protocol+dirname+"tt1000_PU"+"/*.root"); TFileCollection* c8d = new TFileCollection("tt700","ttbar700"); c8d->Add(protocol+dirname+"tt700_PU"+"/*.root"); TFileCollection* c8e = new TFileCollection("ttjets","ttjets"); c8e->Add(protocol+dirname+"ttjets_PU_p1"+"/*.root"); c8e->Add(protocol+dirname+"ttjets_PU_p2"+"/*.root"); gEnv->SetValue("ProofLite.Sandbox", "/home/ba01/u115/asvyatko/DYStudy/CMSSW_5_3_3_patch2/src/DimuonAnalysis/DYPackage/test/ABCDmethod/proofbox_p3"); TProof* p = TProof::Open("workers=10"); //"workers=1"); ////proof://pccmspurdue3:-1"); // set number of works to 2: TProof::Open("//lite:///?workers=2"); p->RegisterDataSet("WJets", c6,"OV"); p->RegisterDataSet("WZJetsTo3LNu", c7a,"OV"); p->RegisterDataSet("WZJetsTo2L2Q", c7b,"OV"); p->RegisterDataSet("ZZJetsTo2L2Nu", c7c,"OV"); p->RegisterDataSet("ZZJetsTo4L", c7d,"OV"); p->RegisterDataSet("ZZJetsTo2L2Q", c7e,"OV"); p->RegisterDataSet("WWJetsTo2L2Nu", c7f,"OV"); p->RegisterDataSet("tW", c8a,"OV"); p->RegisterDataSet("tbarW", c8b,"OV"); p->RegisterDataSet("tt1000", c8c,"OV"); p->RegisterDataSet("tt700", c8d,"OV"); p->RegisterDataSet("ttjets", c8e,"OV"); p->ShowDataSets(); //FIXME try not to ue the class, just define the parameters you need and load them with AdInoput //this is correct TObjString* useNtupleWeightFlag = new TObjString("False"); p->AddInput(new TNamed("useNtupleWeightFlag","False")); TObjString* iso = new TObjString(ISO); p->AddInput(new TNamed("iso",ISO)); gROOT->ProcessLine(".L ../tools/misctools.C"); TObjString* factorB = new TObjString(fota(factor_B)); p->AddInput(new TNamed("factorB",fota(factor_B))); TObjString* factorB_err = new TObjString(fota(factor_B_err)); p->AddInput(new TNamed("factorB_err",fota(factor_B_err))); TObjString* factorB2030 = new TObjString(fota(factor_B2030)); p->AddInput(new TNamed("factorD2030",fota(factor_B2030))); TObjString* factorB_err2030 = new TObjString(fota(factor_B_err2030)); p->AddInput(new TNamed("factorB_err2030",fota(factor_B_err2030))); TObjString* factorB3045 = new TObjString(fota(factor_B3045)); p->AddInput(new TNamed("factorB3045",fota(factor_B3045))); TObjString* factorB_err3045 = new TObjString(fota(factor_B_err3045)); p->AddInput(new TNamed("factorB_err3045",fota(factor_B_err3045))); TObjString* factorB4560 = new TObjString(fota(factor_B4560)); p->AddInput(new TNamed("factorB4560",fota(factor_B4560))); TObjString* factorB_err4560 = new TObjString(fota(factor_B_err4560)); p->AddInput(new TNamed("factorB_err4560",fota(factor_B_err4560))); TObjString* factorB60120 = new TObjString(fota(factor_B60120)); p->AddInput(new TNamed("factorB60120",fota(factor_B60120))); TObjString* factorB_err60120 = new TObjString(fota(factor_B_err60120)); p->AddInput(new TNamed("factorB_err60120",fota(factor_B_err60120))); TObjString* factorB120200 = new TObjString(fota(factor_B120200)); p->AddInput(new TNamed("factorB120200",fota(factor_B120200))); TObjString* factorB_err120200 = new TObjString(fota(factor_B_err120200)); p->AddInput(new TNamed("factorB_err120200",fota(factor_B_err120200))); TObjString* factorB2001500 = new TObjString(fota(factor_B2001500)); p->AddInput(new TNamed("factorB2001500",fota(factor_B2001500))); TObjString* factorB_err2001500 = new TObjString(fota(factor_B_err2001500)); p->AddInput(new TNamed("factorB_err2001500",fota(factor_B_err2001500))); /*TObjString* factorC = new TObjString(fota(factor_C)); p->AddInput(new TNamed("factorC",fota(factor_C))); TObjString* factorC_err = new TObjString(fota(factor_C_err)); p->AddInput(new TNamed("factorC_err",fota(factor_C_err))); */ TObjString* factorD = new TObjString(fota(factor_D)); p->AddInput(new TNamed("factorD",fota(factor_D))); TObjString* factorD_err = new TObjString(fota(factor_D_err)); p->AddInput(new TNamed("factorD_err",fota(factor_D_err))); TObjString* factorD2030 = new TObjString(fota(factor_D2030)); p->AddInput(new TNamed("factorD2030",fota(factor_D2030))); TObjString* factorD_err2030 = new TObjString(fota(factor_D_err2030)); p->AddInput(new TNamed("factorD_err2030",fota(factor_D_err2030))); TObjString* factorD3045 = new TObjString(fota(factor_D3045)); p->AddInput(new TNamed("factorD3045",fota(factor_D3045))); TObjString* factorD_err3045 = new TObjString(fota(factor_D_err3045)); p->AddInput(new TNamed("factorD_err3045",fota(factor_D_err3045))); TObjString* factorD4560 = new TObjString(fota(factor_D4560)); p->AddInput(new TNamed("factorD4560",fota(factor_D4560))); TObjString* factorD_err4560 = new TObjString(fota(factor_D_err4560)); p->AddInput(new TNamed("factorD_err4560",fota(factor_D_err4560))); TObjString* factorD60120 = new TObjString(fota(factor_D60120)); p->AddInput(new TNamed("factorD60120",fota(factor_D60120))); TObjString* factorD_err60120 = new TObjString(fota(factor_D_err60120)); p->AddInput(new TNamed("factorD_err60120",fota(factor_D_err60120))); TObjString* factorD120200 = new TObjString(fota(factor_D120200)); p->AddInput(new TNamed("factorD120200",fota(factor_D120200))); TObjString* factorD_err120200 = new TObjString(fota(factor_D_err120200)); p->AddInput(new TNamed("factorD_err120200",fota(factor_D_err120200))); TObjString* factorD2001500 = new TObjString(fota(factor_D2001500)); p->AddInput(new TNamed("factorD2001500",fota(factor_D2001500))); TObjString* factorD_err2001500 = new TObjString(fota(factor_D_err2001500)); p->AddInput(new TNamed("factorD_err2001500",fota(factor_D_err2001500))); gROOT->Time(); p->SetParameter("PROOF_LookupOpt", "all"); p->Process("WJets#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("WZJetsTo3LNu#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("WZJetsTo2L2Q#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("ZZJetsTo2L2Nu#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("ZZJetsTo4L#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("ZZJetsTo2L2Q#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("WWJetsTo2L2Nu#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("tW#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("tbarW#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("tt1000#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("tt700#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); p->Process("ttjets#/recoTree/DiMuonTree","EventSelector_Bkg2.C+"); }