32 #include <TClonesArray.h> 33 #include <TParameter.h> 53 #include "AliRawReader.h" 80 fDetectorDirName = GetName() ;
82 fParameterList[specie] = NULL ;
91 TNamed(qadm.GetName(), qadm.GetTitle()),
92 fOutput(qadm.fOutput),
93 fDetectorDir(qadm.fDetectorDir),
94 fDetectorDirName(qadm.fDetectorDirName),
95 fCurrentCycle(qadm.fCurrentCycle),
97 fCycleCounter(qadm.fCycleCounter),
98 fWriteExpert(qadm.fWriteExpert),
99 fParameterList(qadm.fParameterList),
101 fEventSpecie(qadm.fEventSpecie),
135 TClass * classType = hist->Class() ;
136 TString className(classType->GetName()) ;
137 if( ! className.BeginsWith(
"T") && ! classType->InheritsFrom(
"TH1") ) {
138 AliError(Form(
"QA data Object must be a generic ROOT object and derive fom TH1 and not %s", className.Data())) ;
142 hist->SetDirectory(0);
148 hist->SetName(name) ;
151 TParameter<double> *
p =
new TParameter<double>(cname, 9999.9999) ;
161 AliError(Form(
"%s - OUPS ! Already got an object (%p,%s) for index=%d => will most probably get a memory leak by replacing it with (%p,%s) !",
162 GetName(),old,old->GetName(),index,hist,hist->GetName()));
177 if (!list || !list[spec]) {
190 int prefLgt = prefix.Length();
195 TString hfname = rec->GetName();
196 if (!hfname.BeginsWith(prefix))
continue;
210 int nh = list->GetEntriesFast();
215 TString trigStr = triggers;
216 TObjArray* trigArr = trigStr.Tokenize(
" ");
217 int nTrigs = trigArr->GetEntriesFast();
218 Bool_t cloneAll=kFALSE, cloneMany=kFALSE;
220 AliError(Form(
"Triggers string supplied for histo %s is empty", hnm));
225 for (
int i=nTrigs;i--;) {
226 TObject* alias =
fgTrigClasses->FindObject( trigArr->At(i)->GetName() );
228 AliError(Form(
"Cloning for undefined trigger class %s was requested for histogram %s",trigArr->At(i)->GetName(),hnm));
229 delete trigArr->RemoveAt(i);
233 trigArr->At(i)->SetUniqueID( alias->GetUniqueID() );
236 TString histPatt = hnm;
237 if (histPatt ==
"*") {
246 TPRegexp rgx(
"%\\d*d");
247 if (histPatt.Contains(rgx)) {
248 const char *specials =
"^$.{}[]*+?\\";
249 for (
int i=strlen(specials);i--;) histPatt.ReplaceAll(specials+i,1,Form(
"\\%c",specials[i]),2);
250 rgx.Substitute(histPatt,
"\\d+",
"g");
251 histPatt.Prepend(
'^'); histPatt +=
"$";
254 else if ( histPatt.Contains(
"*") ) {
255 histPatt.ReplaceAll(
"*",
".*");
256 histPatt.Prepend(
'^'); histPatt +=
"$";
262 for (
int ih=0;ih<nh;ih++) {
263 TH1* hist = (TH1*)list->At(ih);
266 TString hname = hist->GetName();
268 TPRegexp patPR(histPatt);
269 if ( !hname.Contains(patPR) )
continue;
272 if ( hname.CompareTo(histPatt) )
continue;
278 if (!cloneMany)
break;
291 TH1* hist = (TH1*) list->At(index);
295 AliError(Form(
"Cloning per trigger is forbidden for histo %s at slot %d",hist->GetName(),index));
300 AliError(Form(
"histo %s at slot %d was already cloned!",((
TObjArray*)hist)->GetName(),index));
304 int nTrigs = trigArr->GetEntriesFast();
307 for (
int ib=14;ib<=23;ib++)
if (hist->TestBit(1<<ib)) clonesArr->SetBit(1<<ib);
314 clonesArr->SetName(hist->GetName());
315 for (
int itr=0;itr<nTrigs;itr++) {
316 TObject* trigClass = trigArr->At(itr);
317 TH1* hclone = (TH1*)hist->Clone(Form(
"%s%s%s",hist->GetName(),
fgkTriggerPrefix, trigClass->GetName()));
318 hclone->SetTitle(Form(
"%s %s",hist->GetTitle(), trigClass->GetName()));
319 hclone->SetDirectory(hist->GetDirectory());
322 clonesArr->AddAt(hclone, trigClass->GetUniqueID());
327 list->RemoveAt(index);
328 list->AddAt(clonesArr, index);
329 if (!keepOriginal)
delete hist;
331 clonesArr->SetOwner(kTRUE);
332 return clonesArr->GetEntries();
340 TString hnm = h->GetName();
354 TString trigStr = triggers;
356 int nTrigs = tarr->GetEntriesFast();
365 TString triggSet = pair->GetTitle();
366 for (
int itr=nTrigs;itr--;) {
367 if ( !triggSet.Contains(tarr->At(itr)->GetName()) )
continue;
385 TObject* data =
GetData(list,index);
400 return (TH1*)((
TObjArray*)data)->At(slot);
411 for (
int ih=0;ih<nHist;ih++) {
413 if (!histo)
return 0;
431 for (
int isl=0;isl<nHist;isl++) {
432 int slot = indexList[isl];
433 TObject* data =
GetData(list,slot);
434 if (!data) {
AliError(Form(
"Slot %d is not booked",slot));
return kFALSE;}
443 if (refArr) {
AliError(Form(
"Slot %d is not cloned, slot %d is cloned",slot, refSlot));
return kFALSE;}
448 if (!refArr) {
AliError(Form(
"Slot %d is not cloned, slot %d is cloned",refSlot,slot));
return kFALSE;}
451 if (refArr->GetEntriesFast()!=currArr->GetEntriesFast()) {
452 AliError(Form(
"Different number of clones: slot %d: %d vs slot %d: %d",
453 refSlot,refArr->GetEntriesFast(), slot,currArr->GetEntriesFast()));
458 AliError(Form(
"Slot %d kept original histo, slot %d did not",
464 for (
int ih=refArr->GetEntriesFast();ih--;) {
465 TH1* hRef = (TH1*)refArr->At(ih);
467 TString hnm = ((TH1*)currArr->At(ih))->GetName();
469 AliError(Form(
"Slots %d and %d have different trigger names for clone %d: %s vs %s",
470 refSlot,slot,ih,hRef->GetName(),hnm.Data()));
491 TObjArray *dest = optDest ? optDest : &garr;
492 dest->SetOwner(kFALSE);
494 TObject* data =
GetData(list,index);
502 for (
int icl=0;icl<ncl;icl++) {
505 TH1* histo =
dynamic_cast<TH1*
>(arr->At(indCl));
506 if (histo) dest->AddLast(histo);
512 if (histo) dest->AddLast(histo);
517 for (
int ih=arr->GetEntriesFast();ih--;)
if (arr->At(ih)) dest->AddLast(arr->At(ih));
530 count = arr->GetEntriesFast();
531 for (
int ih=count;ih--;){
532 TH1 *histo = (TH1*)arr->UncheckedAt(ih);
533 if (histo) histo->Fill(x);
546 count = arr->GetEntriesFast();
547 for (
int ih=count;ih--;){
548 TH1 *histo=(TH1*)arr->UncheckedAt(ih);
549 if (histo) histo->Fill(x,y);
562 count = arr->GetEntriesFast();
563 for (
int ih=count;ih--;)
if ((TH2*)arr->At(ih)) ((TH2*)arr->At(ih))->Fill(x,y,z);
575 count = arr->GetEntriesFast();
576 for (
int ih=count;ih--;)
if ((TH2*)arr->At(ih)) ((TH2*)arr->At(ih))->SetBinContent(bin,w);
588 count = arr->GetEntriesFast();
589 for (
int ih=count;ih--;)
if ((TH2*)arr->At(ih)) ((TH2*)arr->At(ih))->SetBinContent(binX,binY,w);
601 count = arr->GetEntriesFast();
602 for (
int ih=count;ih--;)
if ((TH2*)arr->At(ih)) ((TH2*)arr->At(ih))->SetBinError(bin,err);
614 count = arr->GetEntriesFast();
615 for (
int ih=count;ih--;)
if ((TH2*)arr->At(ih)) ((TH2*)arr->At(ih))->SetBinError(binX,binY,err);
627 count = arr->GetEntriesFast();
628 for (
int ih=count;ih--;)
if ((TH1*)arr->At(ih)) ((TH1*)arr->At(ih))->
Reset(option);
640 count = arr->GetEntriesFast();
641 for (
int ih=count;ih--;)
if ((TH1*)arr->At(ih)) ((TH1*)arr->At(ih))->ResetStats();
651 TH1 * hClone =
static_cast<TH1 *
>(hist->Clone(name)) ;
685 TObject* data =
GetData(list,index);
690 else return (TH1*)((
TObjArray*)data)->UncheckedAt(cloneID);
705 if (!list)
return 0x0;
717 TObjArray* destS = dest ? dest : &arrTransf;
718 destS->SetOwner(kFALSE);
722 int nh = arr->GetEntriesFast();
723 if (nh>destS->GetSize()) destS->Expand(nh);
724 for (
int ih=nh;ih--;) {
725 TObject* ob = arr->At(ih);
732 else if (!orig) ob = 0;
736 destS->SetUniqueID(arr->GetUniqueID());
764 TObject* histClone = NULL ;
767 if ( ! arr->GetEntriesFast() ) {
769 TString arrName(arr->GetName()) ;
788 if ( arr->At(index) ) {
789 histClone = arr->At(index);
820 const UInt_t kDummyID = 0xffff;
827 if (!aliases || !histos) {
841 for (
int ial=0;ial<nalias;ial++)
fgTrigClasses->At(ial)->SetUniqueID(kDummyID);
843 for (
int ih=nhisto;ih--;) {
845 TString histoReq = histo->GetTitle();
846 TObjArray* alList = histoReq.Tokenize(
" ");
849 AliErrorClass(Form(
"Invalid cloning request is found for histo %s :|%s|",histo->GetName(),histo->GetTitle()));
854 TString confirmedAliases =
"";
855 for (
int iha=alList->GetEntriesFast();iha--;) {
857 Bool_t aliasOK = kFALSE;
858 for (
int ial=0;ial<nalias;ial++) {
860 TString aliasName = alias->GetName();
861 if (aliasName == alList->At(iha)->GetName()) {
863 if (alias->GetUniqueID() == kDummyID) alias->SetUniqueID(naliasUsed++);
867 AliErrorClass(Form(
"Cloning for undefined trigger alias %s is requested for histo %s, SUPPRESSING",
868 alList->At(iha)->GetName(),histo->GetName()));
870 else confirmedAliases += Form(
"%s ",alList->At(iha)->GetName());
872 if (confirmedAliases.IsNull()) {
873 AliErrorClass(Form(
"All requested trigger aliases for histo %s are undefined, SUPPRESSING",histo->GetName()));
877 else histo->SetTitle(confirmedAliases.Data());
885 for (
int ial=0;ial<nalias;ial++) {
887 if (alias->GetUniqueID() != kDummyID) alias->SetUniqueID(naliasUsed++);
889 AliWarningClass(Form(
"Suppressing unused trigger alias %s\t->\t%s",alias->GetName(),alias->GetTitle()));
898 AliInfoClass(Form(
"%s -> %s",item->GetName(),item->GetTitle()));
904 AliInfoClass(Form(
"%s -> %s %s",item->GetName(),item->GetTitle(),
static UShort_t GetMaxQAObj()
static const char * GetEventSpecieName(EventSpecie_t es)
static UInt_t GetImageBit()
Bool_t CheckCloningConsistency(TObjArray **list, const Int_t *indexList, Int_t nHist, Bool_t checkTriggers=kFALSE)
TH1 * CloneMe(TH1 *hist, Int_t specie) const
static const Char_t * fgkTriggerPrefix
TList ** fParameterList
flag to write or not the expert QA data
static UInt_t GetExpertBit()
virtual Int_t ClonePerTrigClassA(TObjArray *list, const char *hnm, const char *triggers, Bool_t keepOriginal=kFALSE)
static TObjArray * fgTrigClasses
static UInt_t GetOrigHistoKeptBit()
void IncEvCountCycle(AliQAv1::TASKINDEX_t task, Int_t diff=1)
static void SetCloningRequest(TObjArray *aliases, TObjArray *histos)
virtual Int_t ClonePerTrigClassH(Int_t index, TObjArray *list, TObjArray *trigArr, Bool_t keepOriginal=kFALSE)
Int_t FillData(TObjArray **list, Int_t index, double x)
Bool_t IsValidEventSpecie(Int_t eventSpecieIndex, TObjArray **list)
static TObjArray * fgCloningRequest
static TFile * GetQAResultFile()
Int_t GetEvCountTotal(AliRecoParam::EventSpecie_t sp, AliQAv1::TASKINDEX_t task, Int_t trCl=-1) const
Char_t * GetHistoTrigger(const TH1 *h) const
Int_t SetDataBinError(TObjArray **list, Int_t index, int bin, double err)
Int_t GetEvCountCycle(AliRecoParam::EventSpecie_t sp, AliQAv1::TASKINDEX_t task, Int_t trCl=-1) const
static void ResetEventTrigClasses()
static TObjArray * GetDataOfTrigClass(TObjArray *arr, Int_t cloneID, TObjArray *dest=0)
Int_t SetDataBinContent(TObjArray **list, Int_t index, int bin, double w)
#define AliInfoClass(message)
TArrayI fEvCountTotal[AliRecoParam::kNSpecies]
TClonesArray * fDigitsArray
event specie, see AliRecoParam
TString fDetectorDirName
directory for the given detector in the file
virtual void InitRaws()=0
void IncEvCountTotal(AliQAv1::TASKINDEX_t task, Int_t diff=1)
#define AliErrorClass(message)
static DETECTORINDEX_t GetDetIndex(const char *name)
virtual void ClonePerTrigClassL(TObjArray **list, AliQAv1::TASKINDEX_t task)
static Bool_t IsEventTriggerSet()
static TObjArray fgEventTrigClasses
static Int_t GetNEventTrigClasses()
TObject * GetData(TObjArray **list, const Int_t index)
static EventSpecie_t ConvertIndex(Int_t index)
virtual void InitDigits()=0
virtual ~AliQADataMaker()
Int_t ResetStatsData(TObjArray **list, Int_t index)
virtual void InitRecPoints()=0
#define AliWarningClass(message)
static TNamed * GetEventTrigClass(Int_t i)
void rec(const char *filename="raw.root")
TObjArray * GetMatchingHistosSet(TObjArray **list, const Int_t *indexList, Int_t nHist, Int_t trigId)
TArrayI fEvCountCycle[AliRecoParam::kNSpecies]
array to hold the sdigits
static Int_t GetNTrigClasses()
TH1 * GetMatchingHisto(TObjArray **list, Int_t index, Int_t trigId)
virtual void InitHits()=0
virtual void DefaultEndOfDetectorCycle(AliQAv1::TASKINDEX_t task)
static Int_t SetEventTrigClasses(const char *triggers)
virtual TObjArray ** Init(AliQAv1::TASKINDEX_t, Int_t cycles=-1)=0
static UInt_t GetClonedBit()
#define AliDebug(logLevel, message)
void Set(QABIT_t bit, AliRecoParam::EventSpecie_t es)
Int_t ResetData(TObjArray **list, Int_t index, Option_t *option="")
AliQADataMaker(const Char_t *name="", const Char_t *title="")
Int_t Add2List(TH1 *hist, const Int_t index, TObjArray **list, const Bool_t expert=kFALSE, const Bool_t image=kFALSE, const Bool_t saveForCorr=kFALSE)
#define AliError(message)
static const char * GetQAName()
static Int_t AConvert(EventSpecie_t es)
static Int_t GetQADebugLevel()
TObjArray * GetMatchingHistos(TObjArray **list, Int_t index, TObjArray *optDest=0)
virtual void InitSDigits()=0
static TString GetTaskName(UInt_t tsk)
AliRecoParam::EventSpecie_t fEventSpecie
run number
virtual void InitESDs()=0
static AliQAv1 * Instance()
Bool_t IsCloningForbidden(TH1 *h) const