From: prino Date: Wed, 17 Nov 2010 00:25:36 +0000 (+0000) Subject: Updated macros for SDD QA checks (M. Siciliano) X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=88522cc1951804baea6556fbe8477c331163e1c6 Updated macros for SDD QA checks (M. Siciliano) --- diff --git a/ITS/macrosSDD/ITSQArecoparam.C b/ITS/macrosSDD/ITSQArecoparam.C new file mode 100644 index 00000000000..3ae1d3964b9 --- /dev/null +++ b/ITS/macrosSDD/ITSQArecoparam.C @@ -0,0 +1,242 @@ +#if !defined(__CINT__) || defined(__MAKECINT__) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "AliRawReader.h" +#include "AliRawReaderRoot.h" +#include "AliRawReaderDate.h" +#include "AliITSQADataMakerRec.h" +#include "AliITSQASDDDataMakerRec.h" +#include "AliITSQAChecker.h" +#include "AliQAChecker.h" +#include "AliITSQASDDChecker.h" +#include "AliReconstructor.h" +#include "AliCDBManager.h" +#include "AliQAv1.h" +#include "AliGeomManager.h" +#include "AliITSInitGeometry.h" +#include "AliITSgeom.h" +#include "AliRecoParam.h" +#include "AliCDBPath.h" +#include "AliCDBEntry.h" +#include "AliRecoParam.h" +#include "AliDetectorRecoParam.h" +#include "AliITSReconstructor.h" +#include "AliITSRecPointContainer.h" +#include "AliLog.h" +#endif +void ITSQArecoparam(char *iFile,Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=1000000) +{ + TString namefile(iFile); + if(namefile.Contains("alien")) + { + TGrid::Connect("alien://"); + if(!gGrid) { + printf("gGrid not found! exit macro\n"); + return; + } + } + gStyle->SetPalette(1); + Int_t ic=0; + AliRawReader *rd=NULL; + if(strstr(iFile,".root")!=0){rd = new AliRawReaderRoot(iFile,FirstEvt);} + else{rd=new AliRawReaderDate(iFile,FirstEvt);} + Int_t runNumber = rd->GetRunNumber(); + cout << "ITS Quality Assurance Prototype" << endl; + //TStopwatch mytimer; + //TString namefile(iFile); + // Set OCDB if needed + AliCDBManager* man = AliCDBManager::Instance(); + if (!man->IsDefaultStorageSet()) { + printf("Setting a local default storage and run number \n"); + if(namefile.Contains("alien")){ + man->SetDefaultStorage("raw://"); + } + else{man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");} + man->SetRun(runNumber); + AliQAv1::SetQARefStorage("local://$ALICE_ROOT/QARef") ; + } + + AliITSQADataMakerRec *itsQAdm = new AliITSQADataMakerRec(kTRUE,idet,0); //online kTRUE + itsQAdm->SetWriteExpert() ; + itsQAdm->SetRunNumber(runNumber); + //________________________For the RecPoints____________________________________ + /************************************************/ + TPluginManager* pluginManager=NULL; + TPluginHandler* pluginHandler=NULL; + AliReconstructor* reconstructor = NULL; + AliITSRecPointContainer* rpcont=NULL; + AliGeomManager::LoadGeometry("geometry.root"); + AliGeomManager::ApplyAlignObjsFromCDB("ITS"); + // ITS initializations + + AliITSInitGeometry initgeom; + AliITSgeom *geom = initgeom.CreateAliITSgeom(); + printf("Geometry name: %s\n",(initgeom.GetGeometryName()).Data()); + + printf("Loading reconstruction parameter objects for detector ITS\n"); + AliRecoParam fRecoParam; + AliCDBPath path("ITS","Calib","RecoParam"); + AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); + Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag(); + if(!entry){printf("Couldn't find RecoParam entry in OCDB for detector ITS");entry=NULL;} + else { + TObject *recoParamObj = entry->GetObject(); + if (dynamic_cast(recoParamObj)) { + printf("RecoParam TObjArray\n"); + fRecoParam.AddDetRecoParamArray(0,dynamic_cast(recoParamObj)); + } + else if (dynamic_cast(recoParamObj)) { + printf("RecoParam AliDetectorRecoParam\n"); + printf("Single set of reconstruction parameters found for detector ITS"); + (dynamic_cast(recoParamObj))->SetAsDefault(); + fRecoParam.AddDetRecoParam(0,(dynamic_cast(recoParamObj))); + } + else {printf("Error: No valid RecoParam object found in the OCDB for detector ITS");} + entry->SetOwner(0); + } + if(!cacheStatus)entry->SetObject(NULL); + if(!cacheStatus){ delete entry;} + + // load the reconstructor object + pluginManager = gROOT->GetPluginManager(); + TString detName = "ITS"; + TString recName = "Ali" + detName + "Reconstructor"; + +pluginHandler = pluginManager->FindHandler("AliReconstructor", "ITS"); + // if not, add a plugin for it + if (!pluginHandler) { + printf("defining plugin for ITS\n"); + TString libs = gSystem->GetLibraries(); + if (libs.Contains("lib" + detName + "base.so") || + (gSystem->Load("lib" + detName + "base.so") >= 0)) {pluginManager->AddHandler("AliReconstructor", detName,recName, detName + "rec", recName + "()");} + else {pluginManager->AddHandler("AliReconstructor", detName,recName, detName, recName + "()");} + pluginHandler = pluginManager->FindHandler("AliReconstructor", detName); + } + if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {reconstructor = (AliReconstructor*) pluginHandler->ExecPlugin(0);} + if (fRecoParam.GetDetRecoParamArray(0) && !AliReconstructor::GetRecoParam(0)) { + const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(0); + reconstructor->Init(); + reconstructor->SetRecoParam(par); + } + + /*AliITSRecPointContainer**/ rpcont=AliITSRecPointContainer::Instance(); + rpcont->PrepareToRead(); + + Int_t cycleLength = 5; + //cout << "Processing Run " << runNumber << endl; + cout << "Init: " << AliQAv1::kRAWS << endl; + + TObjArray **objArray= itsQAdm->Init(AliQAv1::kRAWS, cycleLength); + cout<<"raw tobjarray :"<SetEventSpecie(AliRecoParam::kLowMult); + AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult); + itsQAdm->InitRaws(); + } + else{continue;} + } + itsQAdm->StartOfCycle(AliQAv1::kRAWS,runNumber,kFALSE); + /*********************************************************************/ + + cout << "Init: " << AliQAv1::kRECPOINTS << endl; + TObjArray **objArray1= itsQAdm->Init(AliQAv1::kRECPOINTS, cycleLength); + cout<<"recpoint tobjarray :"<SetEventSpecie(AliRecoParam::kLowMult); + AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult); + itsQAdm->InitRecPoints(); + } + else{continue;} + } + itsQAdm->StartOfCycle(AliQAv1::kRECPOINTS,runNumber,kTRUE); + + /*********************************************************************/ + Int_t iev = 0; + while(rd->NextEvent() && iev < MaxEvts ) { + cout<<">>>>>>> Processing event number: "<<++iev<IsCycleDone()) { + cout << "end of cycle" << endl; + AliQAChecker::Instance()->SetRunNumber(AliCDBManager::Instance()->GetRun()); + itsQAdm->EndOfCycle(AliQAv1::kRAWS); + itsQAdm->StartOfCycle(AliQAv1::kRAWS,ic++,kFALSE); + } + /******************************************************/ + /*************************************************/ + + if(itsQAdm->IsCycleDone()) { + cout << "end of cycle" << endl; + AliQAChecker::Instance()->SetRunNumber(AliCDBManager::Instance()->GetRun()); + itsQAdm->EndOfCycle(AliQAv1::kRECPOINTS); + itsQAdm->StartOfCycle(AliQAv1::kRECPOINTS,ic,kTRUE); + } + + /*************************************************/ + cout<<"Beginning Exec"<SetEventSpecie(AliRecoParam::kLowMult); + AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult); + itsQAdm->Exec(AliQAv1::kRAWS,rd); + /***************************************************/ + // if(kRecPoints){ + cout<<"AliQAv1::kRECPOINTS "<option is %s\n",option); + + rpcont->PrepareToRead(); + reconstructor->Reconstruct(rd,fTreeR); + + itsQAdm->SetEventSpecie(AliRecoParam::kLowMult); + AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult) ; + itsQAdm->Exec(AliQAv1::kRECPOINTS,fTreeR); + cout<<"Finishing Exec"<ResetRecPoints(); + delete fTreeR; + fTreeR=NULL; + /*****************************************************/ + } + + cout << "end RAWS cycle: " << AliQAv1::kRAWS << endl; + cout << "refStorage: " << AliQAv1::GetQARefStorage() << endl; + cout << "end of cycle 2" << endl; + AliQAChecker::Instance()->SetRunNumber(AliCDBManager::Instance()->GetRun()); + itsQAdm->EndOfCycle(AliQAv1::kRAWS); + cout << "Raws QA completed for " << iev << " events" << endl; + /*******************************************************************/ + + AliQAChecker::Instance()->SetRunNumber(AliCDBManager::Instance()->GetRun()); + itsQAdm->EndOfCycle(AliQAv1::kRECPOINTS); + cout << "RecPoints QA completed for " << iev << " events" << endl; + + /*******************************************************************/ + itsQAdm->Finish(); // write to the output File + + cout << "Call AliITSQASDDDataMakerRec destructor" << endl; + delete itsQAdm; + itsQAdm=NULL; + +} + diff --git a/ITS/macrosSDD/PlotQASDD.C b/ITS/macrosSDD/PlotQASDD.C index e4a95ea9e2a..0403d36d967 100644 --- a/ITS/macrosSDD/PlotQASDD.C +++ b/ITS/macrosSDD/PlotQASDD.C @@ -94,8 +94,12 @@ void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char // -------------This part is to read the number of chunks that were merged Float_t fChnknmbr=0.; FILE * pChunkNumber = fopen ("ChunkNumber.txt","r"); - fscanf(pChunkNumber, "%f", &fChnknmbr); + if(pChunkNumber){ + Int_t rv=fscanf(pChunkNumber, "%f", &fChnknmbr); fclose (pChunkNumber); + } + else fChnknmbr=1.; + gStyle->SetPalette(1); float fCNinv=1./fChnknmbr; // printf("\n====================>%f\n\n", fCNinv); @@ -607,6 +611,7 @@ void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char printf("...Found\n"); historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin); historaw2->SetTitle("Charge"); + historaw2->SetFillColor(0); if (irrpp==4) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();} if (irrpp!=4) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");} legend->AddEntry(historaw2,layer,"l"); @@ -656,6 +661,7 @@ void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char printf("...Found\n"); historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin); historaw2->SetTitle("Drift Time"); + historaw2->SetFillColor(0); if (irrpp==6) {historaw2->SetStats(0); historaw2->SetLineColor(2);historaw2->DrawCopy();} if (irrpp!=6) {historaw2->SetStats(0); historaw2->SetLineColor(4);historaw2->DrawCopy("same");} legend->AddEntry(historaw2,layer,"l"); diff --git a/ITS/macrosSDD/ReadQASDD.C b/ITS/macrosSDD/ReadQASDD.C index ec487abc65e..17953001029 100644 --- a/ITS/macrosSDD/ReadQASDD.C +++ b/ITS/macrosSDD/ReadQASDD.C @@ -10,7 +10,7 @@ #include #include #endif -void ReadQASDD(Int_t runNb = 101498,Int_t year=2009,Char_t period[10]="LHC09c",Char_t pass[8]="pass1",Char_t filetosearch[50]="Merged.QA.Data.root",Char_t initfileout[50]="File.QA") +void ReadQASDD(Int_t runNb = 101498,Int_t year=2009,Char_t period[10]="LHC09c",Char_t pass[8]="pass1",Int_t maxfiles=300,Char_t filetosearch[50]="Merged.QA.Data.root",Char_t initfileout[50]="File.QA") { //****************** Connection to alien ***************************************** @@ -44,8 +44,8 @@ void ReadQASDD(Int_t runNb = 101498,Int_t year=2009,Char_t period[10]="LHC09c",C Int_t mergedFiles = 0; Int_t nFiles = gr->GetEntries(); - if(nFiles>600) nFiles=600; - for (Int_t i = 0; i maxfiles) nFiles=maxfiles; + for (Int_t i = 3; i GetKey(i,"turl")); printf("%s\n\n", directory); diff --git a/ITS/macrosSDD/RunQAonSingleChunk.sh b/ITS/macrosSDD/RunQAonSingleChunk.sh new file mode 100755 index 00000000000..47cfbf9086c --- /dev/null +++ b/ITS/macrosSDD/RunQAonSingleChunk.sh @@ -0,0 +1,96 @@ +#!/bin/bash +RUN='123456' +PERIOD='LHC10a' +PASS='pass1' +YEAR='2010' +ALICE_ITS='$ALICE_ROOT/ITS' +TMPPLACE='/tmp' +TMPFOLDER='1' +EXECFOLDER='$HOME/macroQAshifter' +MAXFILES='300' +FILENAME='10000137137031.300.root' +FULLNAME='$PWD/$FILENAME' +echo "Run Number :[${RUN}]" +read +if [ "$REPLY" != "" ]; then +RUN=$REPLY +echo "Run $RUN" +fi +echo "Period :[${PERIOD}]" +read +if [ "$REPLY" != "" ]; then +PERIOD=$REPLY +echo "Period $PERIOD" +fi +echo "Pass : [${PASS}]" +read +if [ "$REPLY" != "" ]; then +PASS=$REPLY +echo "Pass $PASS " +fi +echo "Year :[${YEAR}]" +read +if [ "$REPLY" != "" ]; then +YEAR=$REPLY +echo "Year $YEAR" +fi +echo "FileName (if it is a LOCAL file, please insert the full path) : [${FILENAME}]" +read +if [ "$REPLY" != "" ]; then +FILENAME=$REPLY +fi +echo "FileName ${FILENAME}" +echo "folder with macros :[${EXECFOLDER}]" +read +if [ "$REPLY" != "" ]; then +EXECFOLDER=$REPLY +echo "Folder: $EXECFOLDER" +fi +echo "local file or alienfile (1=local 2=alien) :[${TMPFOLDER}]" +read +if [ "$REPLY" != "" ]; then +TMPFOLDER=$REPLY +fi +if [ "$TMPFOLDER" == "1" ]; then +FULLNAME=$FILENAME +else +FULLNAME=alien:///alice/data/${YEAR}/${PERIOD}/000${RUN}/raw/${FILENAME} +fi +echo "FullName ${FULLNAME}" +if [ ls -l "run$RUN" >/dev/null 2>&1 ]; then +echo "directory run$RUN exists " +else +mkdir "run$RUN" +fi +cd "run$RUN" +if [ ls -l $PASS > /dev/null 2>&1 ]; then +echo "directory $PASS exixsts" +else +mkdir $PASS +cd $PASS +fi +time aliroot -l </dev/null 2>&1 ]; then +echo "directory images exists" +else +mkdir images +fi +mv *.ps images/. +cd images +for i in *.ps; +do +gv $i & +sleep 2 +done +echo "Plots Done!!" +rm -rf $TMPPLACE/*.root +cd ../../../ diff --git a/ITS/macrosSDD/ShowSDDQA.sh b/ITS/macrosSDD/ShowSDDQA.sh index ec54fd869cd..6673be2bd97 100755 --- a/ITS/macrosSDD/ShowSDDQA.sh +++ b/ITS/macrosSDD/ShowSDDQA.sh @@ -7,45 +7,62 @@ ALICE_ITS='$ALICE_ROOT/ITS' TMPPLACE='/tmp' TMPFOLDER='1' EXECFOLDER='$HOME/macroQAshifter' +MAXFILES='300' echo "Run Number :[${RUN}]" read if [ "$REPLY" != "" ]; then -export RUN=$REPLY +RUN=$REPLY echo "Run $RUN" fi echo "Period :[${PERIOD}]" read if [ "$REPLY" != "" ]; then -export PERIOD=$REPLY +PERIOD=$REPLY echo "Period $PERIOD" fi echo "Pass : [${PASS}]" read if [ "$REPLY" != "" ]; then -export PASS=$REPLY +PASS=$REPLY echo "Pass $PASS " fi echo "Year :[${YEAR}]" read if [ "$REPLY" != "" ]; then -export YEAR=$REPLY +YEAR=$REPLY echo "Year $YEAR" fi echo "folder with macros :[${EXECFOLDER}]" read if [ "$REPLY" != "" ]; then -export EXECFOLDER=$REPLY +EXECFOLDER=$REPLY echo "Folder: $EXECFOLDER" fi echo "local or lxplus (1=local 2=lxplus) :[${TMPFOLDER}]" read if [ "$REPLY" != "" ]; then -export TMPFOLDER=$REPLY +TMPFOLDER=$REPLY fi if [ "$TMPFOLDER" == "1" ]; then -export TMPPLACE='/tmp' +TMPPLACE='/tmp' else -export TMPPLACE='/tmp/$USERNAME' +TMPPLACE='/tmp/$USERNAME' +fi +GOOD=130 +echo "Max number of files (Insert a number >0) :[${MAXFILES}]" +read +#case $REPLY in +# *[a-zA-Z]*|*[!0-9]*|*[-]*) +# echo "Wrong: it is not a number > 0";; +# *[0-9]*) +# MAXFILES=$REPLY +# echo "Max number of files: $MAXFILES" +# export GOOD=0 +# ;; +#esac +if [ "$REPLY" != "" ]; then +MAXFILES=$REPLY +echo "Max number of files: $MAXFILES" fi if [ ls -l "run$RUN" >/dev/null 2>&1 ]; then echo "directory run$RUN exists " @@ -59,12 +76,12 @@ else mkdir $PASS cd $PASS fi -time aliroot -l <