Skip to content

Commit

Permalink
Adding functionality to execute ROOT functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
abyzov committed Nov 21, 2014
1 parent 030f10a commit 5aec707
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
34 changes: 31 additions & 3 deletions HisMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//static const int N_CHROM_MAX = 20000;
static const int N_CHROM_MAX = 100000;


double my_gaus(double *x_arr,double *par)
{
double con = par[0];
Expand Down Expand Up @@ -344,8 +343,14 @@ void HisMaker::view(string *files,int n_files,bool useATcorr,bool useGCcorr)
TTimer *timer = new TTimer("gSystem->ProcessEvents();",50,kFALSE);
TString input = "";
while (input != "exit" && input != "quit") {
TString chrom = "",start = "",end = "",option = "";
if (parseInput(input,chrom,start,end,option)) {
TString chrom = "",start = "",end = "",option = "",tmp;
istringstream sin(input.Data());
sin>>tmp;
if (tmp == "execute") {
TString obj_class,class_fun,args;
sin>>obj_class>>class_fun>>args;
executeROOT(obj_class,class_fun,args);
} else if (parseInput(input,chrom,start,end,option)) {
chrom = Genome::makeCanonical(chrom.Data());
if (option == "genotype") {
for (int i = 0;i < n_files;i++) {
Expand All @@ -372,6 +377,29 @@ void HisMaker::view(string *files,int n_files,bool useATcorr,bool useGCcorr)
exit(0);
}

void interateOverPrimitives(TList *list)
{

}

void HisMaker::executeROOT(TString obj_class,TString class_fun,TString args)
{
if (!canv_view) return;

TIter i1(canv_view->GetListOfPrimitives());
while (TPad *pad = (TPad*)i1.Next()) {
pad->cd();
TIter i2(pad->GetListOfPrimitives());
while (TObject *obj = i2.Next())
if (obj->ClassName() == obj_class) obj->Execute(class_fun,args);
if (pad->ClassName() == obj_class) pad->Execute(class_fun,args);
pad->Update();
}
if (canv_view->ClassName() == obj_class) canv_view->Execute(class_fun,args);
canv_view->cd();
canv_view->Update();
}

void HisMaker::generateView(TString chrom,int start,int end,
bool useATcorr,bool useGCcorr,
string *files,int win)
Expand Down
1 change: 1 addition & 0 deletions HisMaker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public: // Viewing and genotyping
void genotype(string *files,int n_files,bool useATcorr,bool useGCcorr);

private:
void executeROOT(TString obj_class,TString class_fun,TString args);
void generateView(TString chrom,int start,int end,
bool useATcorr,bool useGCcorr,
string *files = NULL,int win = -1);
Expand Down

0 comments on commit 5aec707

Please sign in to comment.