Exemplo n.º 1
0
/// This is example function
void CheckProductions(){
  AliExternalInfo info;
  //to add there production yer
  TTree * treeRaw= info.GetTree("QA.Period","data","");
  treeRaw->SetAlias("isTPC","type==\"QA.TPC\"");
  treeRaw->SetAlias("isITS","type==\"QA.ITS\"");
  treeRaw->SetAlias("isTRD","type==\"QA.TRD\"");
  // black list for production
  treeRaw->SetAlias("isBlack","strstr(pass,\"clean\")!=0||strstr(pass,\"rec\")!=0||strstr(pass,\"its\")!=0||strstr(pass,\"cpass\")!=0||strstr(pass,\"vpass\")!=0||strstr(pass,\"muon\")!=0||strstr(pass,\"cosmic\")!=0||strstr(pass,\"align\")!=0||strstr(pass,\"FAST\")!=0||strstr(pass,\"scan\")!=0||strstr(pass,\"test\")!=0");
  /// export production in json format
  AliTreePlayer::selectWhatWhereOrderBy(treeRaw,"period:pass:type:nRuns:nRunsProd:runList","nRuns>0","",0,1000,"json","rawProduction.json");
}
Exemplo n.º 2
0
/// \brief Cache  MC production trees, store summary information in formated text files -> root trees
/// \param dataType  -
/// \param fileList
void CacheTestMCProductions(TString dataType, const char *fileList=NULL){
  AliExternalInfo info;
  info.fLoadMetadata=kFALSE;
  TObjArray* periodList = NULL;
  TArrayI nRuns;
  if (fileList!=NULL) {
    periodList=(gSystem->GetFromPipe(TString::Format("cat %s", fileList).Data())).Tokenize("\n");
    nRuns.Set(periodList->GetEntries());

  }else{
    TTree * tree = info.GetTree("MonALISA.ProductionMC","","");
    Int_t nProd=tree->GetEntries();
    periodList = new TObjArray(nProd);
    nRuns.Set(nProd);
    TLeaf *leaf = tree->GetLeaf("Tag");
    TLeaf *leafRuns = tree->GetLeaf("Number_of_runs");
    for (Int_t iProd=0; iProd<nProd; iProd++){
      tree->GetEntry(iProd);
      TString prodName=((char*)leaf->GetValuePointer());
      if (prodName.Contains("LHC")==0) continue;
      periodList->AddAt(new TObjString(((char*)leaf->GetValuePointer())),iProd);
      nRuns[iProd]=leafRuns->GetValue();
    }
    delete tree;
  }
  for (Int_t iPeriod=0; iPeriod<periodList->GetEntriesFast(); iPeriod++){
    TObjString * pName= (TObjString*)periodList->At(iPeriod);
    if (pName==NULL) continue;
    TTree* tree = info.GetTree(dataType.Data(),periodList->At(iPeriod)->GetName(),"passMC");
    if (tree){
      Int_t entries=tree->Draw("run","1","goff");
      TString sInfo=periodList->At(iPeriod)->GetName();
      sInfo+="\t";
      sInfo+=dataType;
      sInfo+="\t";
      sInfo+=TString::Format("%d\t",entries);
      sInfo+=TString::Format("%d\t",nRuns[iPeriod]);
      for (Int_t j=0; j<entries; j++) {
        sInfo+=TString::Format("%2.0f,",tree->GetV1()[j]);
        ::Info("CacheTestMCProductionsRun:","%s\t%s\t%d\t%d\t%d\t%2.0f",periodList->At(iPeriod)->GetName(),dataType.Data(),entries,nRuns[iPeriod],j, tree->GetV1()[j]);
      }
      sInfo+="0";
      ::Info("CacheTestMCProductionsPeriod:","%s\n",sInfo.Data());
      delete tree;
    }else{
      ::Error("CacheTestMCProductionsPeriod:","%s\t%s\t-1\t%d\t0",periodList->At(iPeriod)->GetName(), dataType.Data(),nRuns[iPeriod]);
    }
  }
}
Exemplo n.º 3
0
/*!
 * ### Example usage:
\code
    .L $AliRoot_SRC/STAT/Macros/aliExternalInfo.C+
    drawLogbook("LHC15o","pass1","QA.TPC.meanTPCncl>0","runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:MonALISA.RCT.tpc_value");
    drawLogbook("LHC10h","pass2","totalEventsPhysics>1000&&totalNumberOfFilesMigrated>20","runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:MonALISA.RCT.tpc_value");
    drawLogbook("LHC11h","pass2","totalEventsPhysics>1000&&totalNumberOfFilesMigrated>20","runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:MonALISA.RCT.tpc_value");
\endcode
*/
void drawLogbook(TString period, TString pass,TString runSelection="", TString varSelection="runDuration:totalEventsPhysics:totalNumberOfFilesMigrated"){
  TTree * treeLogbook = info.GetTree("Logbook",period,pass,"QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT");
  TObjArray *varList=0;
  if (varSelection[0]=='['){ //variable list using class selection
    // Use class selection to select variables
    varList=AliTreePlayer::selectMetadata(treeLogbook,varSelection,0);
    Int_t nvars=varList->GetEntries();
    for (Int_t i=0; i<nvars;i++){
      TString vname=varList->At(i)->GetName();
      vname.ReplaceAll(".class","");
    }
    // varList=AliTreePlayer::selectMetadata(treeLogbook, "[class==\"Logbook&&Time\"]",0);
  }else{
    varList=varSelection.Tokenize(":");
  }
  Int_t nvars=varList->GetEntries();
  TCanvas * canvas = new TCanvas("drawLogbook","drawLogbook",1200,1000);
  canvas->Divide(1,nvars);
  for (Int_t i=0; i<nvars; i++){
    canvas->cd(i+1);
    TString var=TString::Format("%s:run",varList->At(i)->GetName());
    TStatToolkit::MakeGraphSparse(treeLogbook,var,runSelection,25,1,1)->Draw("ap");
    Double_t mean = TMath::Mean(treeLogbook->GetSelectedRows(),treeLogbook->GetV1());
    Double_t sum  = treeLogbook->GetSelectedRows()*mean;
    latex.DrawLatexNDC(0.15,0.8,TString::Format("Mean=%0.0f",mean));
    latex.DrawLatexNDC(0.15,0.7,TString::Format("Sum=%0.0f",sum));
  }
  canvas->SaveAs(TString::Format("%s_%s.png",pass.Data(),period.Data()).Data());
}
Exemplo n.º 4
0
/*!
\code
 .L $AliRoot_SRC/STAT/Macros/aliExternalInfo.C
 makeHTMLPage("LHC15o","pass1", "QA.TPC.meanTPCncl>0", "run:runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:QA.TPC.meanMIP:QA.TPC.meanMIP", "Logbook;QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT")
 makeHTMLPage("LHC15o","pass1", "QA.TPC.meanTPCncl>0", "run:runDuration:totalEventsPhysics:ocdbStatusCounter:ocdbHVStatusCounter:TPC_Status:meanTPCncl_Status:PID_Status:DCAz_Status:DCAr_Status:tpcItsMatch_Status", "Logbook;QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT")
 makeHTMLPage("LHC15o","pass1", "QA.TPC.meanTPCncl>0", "run:runDuration:totalEventsPhysics:ocdbStatusCounter:ocdbHVStatusCounter:MonALISA.RCT.tpc_value:rctMismatch:TPC_Status:meanTPCncl_Status:PID_Status:DCAz_Status:DCAr_Status:tpcItsMatch_Status", "Logbook;QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT")
//
 makeHTMLPage("LHC15o","pass1", "QA.TPC.meanTPCncl>0", "run:runDuration:#%d{year}/%d{period.GetName()}/%d{pass.GetName()}/%d{run}:totalEventsPhysics:totalNumberOfFilesMigrated:QA.TPC.meanMIP", "Logbook;QA.TPC;")
 \endcode
 */
void makeHTMLPage(TString  period,TString  pass, TString runSelection, TString varSelection, TString source){
  TTree * tree = info.GetTree("Logbook",period,pass,source);
  AliTreePlayer::selectWhatWhereOrderBy(tree,varSelection.Data(), runSelection.Data(),"",0,100000,"html","table.html");
  delete tree;
  gSystem->GetFromPipe("$AliPhysics_SRC/PWGPP/scripts/makeHtmlv1.sh index.html table.html 0");

}
Exemplo n.º 5
0
/*!
 * ## Example usage:
 \code
   .L $AliRoot_SRC/STAT/Macros/aliExternalInfo.C+
  drawLogbookMultiExpr("LHC15o","pass1", "totalNumberOfFilesMigrated>2000", "runDuration;totalEventsPhysics/1000;totalNumberOfFilesMigrated:run");
  drawLogbookMultiExpr("LHC15o","pass1", "totalNumberOfFilesMigrated>2000&&QA.TPC.meanMIP>40", "runDuration;totalEventsPhysics/1000;totalNumberOfFilesMigrated:run");
\endcode
*/
void drawLogbookMultiExpr(TString period, TString pass,TString runSelection="", TString varSelection="runDuration;totalEventsPhysics/1000;totalNumberOfFilesMigrated:run") {
  TTree *treeLogbook = info.GetTree("Logbook", period, pass, "QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT");
  TLegend * legend = new TLegend(0.15,0.7,0.4,0.8, "Trending");
  TMultiGraph *m0 = TStatToolkit::MakeMultGraph(treeLogbook, "", varSelection.Data(), runSelection.Data(), "25;21;22;24", "1;2;4", kTRUE, 1, 6, legend);
  m0->Draw("ap");
  legend->Draw();
  delete treeLogbook;
}
Exemplo n.º 6
0
/// Export MC Anchor Guess + derived information in JSON format
/// To be used for the web browsing
void ExportMCAnchorJSON(){
  AliExternalInfo info;
  TTree*tree = info.GetTreeMCPassGuess();
  tree->SetAlias("MCProdNameA","MCProdName.fString");
  tree->SetAlias("MCAliphysicsA","MCAliphysics.fString");
  tree->SetAlias("MCAlirootA","MCAliroot.fString");
  tree->SetAlias("AnchorProdTagA","AnchorProdTag.fString");
  tree->SetAlias("AnchorPassNameA","AnchorPassName.fString");
  tree->SetAlias("AnchorAliphysicsA","Anchoraliphys.fString");
  tree->SetAlias("AnchorAlirootA","Anchoraliroot.fString");

  TString toExport="";
  toExport+="MCProdNameA:MCAliphysicsA:MCAlirootA:";
  toExport+="AnchorProdTagA:AnchorPassNameA:AnchorAlirootA:AnchorAliphysicsA:";
  toExport+="rankGuess:runNMatches:runNMC:runNAnchor";
  AliTreePlayer::selectWhatWhereOrderBy(tree,toExport,"","",0,100000,"json","MCAnchor.json");
  // to test output - print using jq
  // cat MCAnchor.json  | jq .tree[0,1]    # print first selected entries
  // cat MCAnchor.json  | jq -c '.tree[] | select(.AnchorProdTagA | contains("LHC15o"))'| jq    #print selected entries anchored to LHC15o
  // cat MCAnchor.json  | jq -c '.tree[] | select(.AnchorProdTagA | contains("LHC15o"))'| jq .MCProdNameA  # print prod name for selected entries anchored to LHC15o

}
Exemplo n.º 7
0
TTree * InitTrees(const char * detector,  const char *referenceDet){
  //
  // Init tree for given period
  //  all  trees stored in qaMap
  //  FriendTree added to the master treeQADet
  // Currentrly in the code we assume ID="run";
  // Bug in root tree ?  - in case more than one friend tree set - indeces looks corrupted 
  //    0.) QA tree per detector Raw+MC (if exist)
  //    1.) QA trees per refernce detectors specified by string refDet e.g "TPC;TRD;TOF"
  //    2.) Logbook tree per run
  //    3.) Logbook tree per run/detector
  //    3.) RCT table
  //    4.) CPass table 
  // 
  //  tree is created with addition of friend trees which can be used in queries
  //  queries as analog to the SQL statement

  /* 
    period="LHC15o"; pass="******"
  */
  ::Info("qaTrending::InitTrees::Begin","Detector %s, RefDet=%s",detector, referenceDet);
  AliExternalInfo info;
  Int_t treeCounter=0;
  // Load trees
  TObjArray * detArray=TString(referenceDet).Tokenize(";");
  Int_t nrefDets=detArray->GetEntries();
  TVectorF runCounter(5+nrefDets*2);  // <QADet>, <Logbook>, <Logbook.Det>, <MonAlisa>, <CPass>, <QA.RefDet>xnrefDets, <Logbook.RefDet>xnrefDets
  //
  ::Info("qaTrending::InitTrees::End","Laoding trees");
  treeQADet = info.GetTreeDataQA(detector,period, pass);
  if (!treeQADet){
    ::Error("qaTrending.InitTrees", "Input QA tree %s not available", detector); 
    return 0;
  }
  runCounter[treeCounter++]=treeQADet->Draw("run","1","goff");
  qaMap[TString::Format("QA.%s",detector).Data()]=treeQADet;
  //
  qaMap["Logbook"]=info.GetTree("Logbook",period,"");
  qaMap["Logbook"]->AddFriend(treeQADet,"QADet");
  treeQADet->AddFriend(qaMap["Logbook"],"Logbook");
  runCounter[treeCounter++]=treeQADet->Draw("run","1","goff");
  //
  qaMap["MonALISA.RCT"]=info.GetTree("MonALISA.RCT",period,pass);
  qaMap["MonALISA.RCT"]->AddFriend(treeQADet,"QADet");
  treeQADet->AddFriend(qaMap["MonALISA.RCT"],"MonALISA.RCT");
  runCounter[treeCounter++]=treeQADet->Draw("run","1","goff");
  //
  TTree *treeLogbookDetector =info.GetTree("Logbook.detector",period,"");
  if (treeLogbookDetector){
    if (detArray->GetEntries()>0){
      for (Int_t idet=0; idet<detArray->GetEntries(); idet++){
	// Load Logbook.RefDet
	const char *detName=detArray->At(idet)->GetName();	
	TTree * treeLog =treeLogbookDetector->CopyTree(TString::Format("detector==\"%s\"",detName).Data());
	if (treeLog->GetEntries()<=0){
	  ::Error("qaTrending.InitTrees","Missing Tree Logbook. %s - check the syntax",detName);
	}else{
	  treeLog->BuildIndex("run");
	  qaMap[TString::Format("Logbook.%s",detName).Data()]=treeLog;
	  treeLog->AddFriend(treeQADet, "QADet");
	  treeQADet->AddFriend(treeLog,  TString::Format("Logbook.%s",detName).Data());
	  runCounter[treeCounter++]=treeQADet->Draw("run","1","goff");
	}
	// Load QA.RefDet
	TTree * treeQARefDet = info.GetTreeDataQA(detName,period, pass);
	if (treeQARefDet){
	  qaMap[TString::Format("QA.%s",detName).Data()]=treeQARefDet;
	  treeQARefDet->AddFriend(treeQADet, "QADet");
	  treeQADet->AddFriend(treeQARefDet,  TString::Format("QA.%s",detName).Data());
	  runCounter[treeCounter++]=treeQADet->Draw("run","1","goff");
	}else{
	  ::Error("qaTrending.InitTrees","Missing Tree QA.%s - check the syntax",detName);
	}
      }
    }
  }
  //
  // Check consistency of data
  // 
  ::Info("qaTrending::InitTrees::End","Checking trees");
  TList *arrFriends = treeQADet->GetListOfFriends();
  for (Int_t ifriend=0; ifriend<arrFriends->GetEntries(); ifriend++){
    Int_t entries = treeQADet->Draw(TString::Format("run-%s.run", arrFriends->At(ifriend)->GetName()).Data(),"1","goff");
    Double_t mean=0;
    if (entries>0) {
      mean=TMath::Mean(entries, treeQADet->GetV1());
    }
    if (mean==0){
      ::Info("qaTrending::InitTrees", "Friend:\t%s\t%d\t%f", arrFriends->At(ifriend)->GetName(), entries,mean);
    }else{
      ::Error("qaTrending::InitTrees", "Friend:\t%s\t%d\t%f", arrFriends->At(ifriend)->GetName(), entries,mean);
    }
  }
  delete detArray;
  ::Info("qaTrending::InitTrees::End","Detector %s, RefDet=%s",detector, referenceDet);

  return treeQADet;  
}
Exemplo n.º 8
0
/// Cache MC production information
/// TODO - reset cache timeout before
void CacheMCProductionInfo(){
  AliExternalInfo info;
  TTree *tree = info.GetTreeMCPassGuess();
  delete tree;
}
Exemplo n.º 9
0
/// Cache MC production information
void CacheTrendingProductions(TString dataType){
  AliExternalInfo info;
  info.fLoadMetadata=kFALSE;
  TObjArray* periodList = NULL, *idList=NULL;
  //
  TTree * tree = info.GetTree("MonALISA.ProductionCycle","","");
  Int_t nProd=tree->GetEntries();
  periodList = new TObjArray(nProd);
  idList= new TObjArray(nProd);
  TLeaf *leafTag = tree->GetLeaf("Tag");
  TLeaf *leafID   =  tree->GetLeaf("ID");
  for (Int_t iProd=0; iProd<nProd; iProd++){
    tree->GetEntry(iProd);
    TString prodName=((char*)leafTag->GetValuePointer());
    TString  idName =TString::Format("%d",TMath::Nint(leafID->GetValue()));
    if (prodName.Contains("LHC")==0) continue;
    periodList->AddAt(new TObjString(prodName),iProd);
    idList->AddAt(new TObjString(idName),iProd);
  }
  delete tree;
  //
  for (Int_t iPeriod=0; iPeriod<periodList->GetEntriesFast(); iPeriod++) {
    TObjString * pName= (TObjString*)idList->At(iPeriod);
    if (pName==NULL) continue;
    TTree* treeP = info.GetTreeProdCycleByID(idList->At(iPeriod)->GetName());
    if (treeP==NULL) continue;
    TLeaf *leafOutput = treeP->GetLeaf("outputdir");
    Int_t nRuns= treeP->GetEntries();
    treeP->GetEntry(0);
    TString path=((char*)leafOutput->GetValuePointer());
    TObjArray *pArray = path.Tokenize("/");
    if (pArray==NULL) continue;
    Int_t nElems=pArray->GetEntries();
    if (nElems<4) continue;
    TString aperiod=pArray->At(3)->GetName();
    TString apass =pArray->At(nElems-1)->GetName();
    delete pArray;
    ::Info("CacheTrendingProductions","%s\t%s\t%s\t%s\t%d",idList->At(iPeriod)->GetName(),path.Data(), aperiod.Data(),apass.Data(),nRuns);
    delete treeP;
    TTree* treeQA = info.GetTree(dataType.Data(),aperiod.Data(),apass.Data());
    if (treeQA){
      Int_t entries=treeQA->Draw("run","1","goff");
      TString sInfo=aperiod;
      sInfo+="\t";
      sInfo+=apass;
      sInfo+="\t";
      sInfo+=dataType;
      sInfo+="\t";
      sInfo+=TString::Format("%d\t",entries);
      sInfo+=TString::Format("%d\t",nRuns);
      for (Int_t j=0; j<entries; j++) {
        sInfo+=TString::Format("%2.0f,",treeQA->GetV1()[j]);
        ::Info("CacheTrendingProductionsRun:","%s\t%s\t%s\t%d\t%d\t%2.0f",aperiod.Data(),apass.Data(),dataType.Data(),entries,nRuns,treeQA->GetV1()[j]);
      }
      sInfo+="0";
      ::Info("CacheTrendingProductionsPeriod:","%s\n",sInfo.Data());
      delete treeQA;
    }else{
      ::Error("CacheTrendingProductionsPeriod:","%s\t%s\t%s\t-1\t%d\t0",aperiod.Data(),apass.Data(), dataType.Data(),nRuns);
    }
  }
}
Exemplo n.º 10
0
/*!
 */
void drawLogbookMultiCut(TString period, TString pass,TString runSelection="", TString varSelection="LHCperiod:runDuration:totalEventsPhysics:totalNumberOfFilesMigrated") {
  TTree *treeLogbook = info.GetTree("Logbook", period, pass, "QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT");
  TMultiGraph *m1 = TStatToolkit::MakeMultGraph(treeLogbook,"","runDuration:run","totalNumberOfFilesMigrated>2000;(run<245000);abs(run-245500)<500;(run>246000)","figTemplateTRD","figTemplateTRD", kFALSE, 1,6,0);
  m1->Draw("ap");
}