// default ctor
}
-AliOADBPhysicsSelection::AliOADBPhysicsSelection(char* name) :
+AliOADBPhysicsSelection::AliOADBPhysicsSelection(const char* name) :
TNamed(name, "OADB object for the physics selection"), fNtriggerBits(NTRIGGERBITS), fNtriggerLogics(NTRIGGERLOGICS),fCollTrigClasses(0),fBGTrigClasses(0),fHardwareTrigger(0),fOfflineTrigger(0),fBeamSide(0)
{
// ctor, better use this one
AliOADBPhysicsSelection& AliOADBPhysicsSelection::operator=(const AliOADBPhysicsSelection& other) {
//Assignment operator
+ if(&other == this) return *this;
TNamed::operator=(other);
fCollTrigClasses = other.fCollTrigClasses;
void AliOADBPhysicsSelection::AddCollisionTriggerClass(AliVEvent::EOfflineTriggerTypes triggerMask, const char* className,const char * beamSide, UInt_t triggerLogic) {
// add collision trigger class
- TObjString * tclass = new TObjString(Form("%s &%u *%u",className,triggerMask, triggerLogic));
+ TObjString * tclass = new TObjString(Form("%s &%u *%u",ExpandTriggerString(className),triggerMask, triggerLogic));
fCollTrigClasses[GetActiveBit(triggerMask)]->Add(tclass);
SetBeamSide(tclass->String().Data(),beamSide);
}
void AliOADBPhysicsSelection::AddBGTriggerClass (AliVEvent::EOfflineTriggerTypes triggerMask, const char* className,const char * beamSide, UInt_t triggerLogic)
{
- // add bg gtrigger class
- TObjString * tclass = new TObjString(Form("%s &%u *%u",className,triggerMask, triggerLogic));
+ // add bg trigger class
+ TObjString * tclass = new TObjString(Form("%s &%u *%u",ExpandTriggerString(className),triggerMask, triggerLogic));
fBGTrigClasses [GetActiveBit(triggerMask)]->Add(tclass);
SetBeamSide(tclass->String().Data(),beamSide);
}
const TString AliOADBPhysicsSelection::GetBeamSide (const char * trigger) {
- // Associate beam site to trigger class name
+ // Associate beam side to trigger class name
TObjString * cname = new TObjString(trigger);
CleanKey(cname->String());
static TString retValue="";
void AliOADBPhysicsSelection::CleanKey(TString & str) {
- // Remove all wite spacese and "goodies" of the trigger class string (bx ids, trigger logic...)
+ // Remove all wite spaces and "goodies" of the trigger class string (bx ids, trigger logic...)
if(str.Index("*")>0)
str.Remove(str.Index("*")); // keep only the class name (no bx, offline trigger...)
if(str.Index("#")>0)
// Browse this object.
// If b=0, there is no Browse call TObject::Browse(0) instead.
// This means TObject::Inspect() will be invoked indirectly
-
- TFolder ** bitFolders = new TFolder*[fNtriggerBits];
+ static TFolder ** bitFolders = 0;
+ if(!bitFolders) {
+ bitFolders = new TFolder*[fNtriggerBits];
+ for(UInt_t ibit = 0; ibit < fNtriggerBits; ibit++){
+ bitFolders[ibit] = 0;
+ }
+
+ }
if (b) {
for(UInt_t ibit = 0; ibit < fNtriggerBits; ibit++){
- // if(bitFolders[ibit]) delete bitFolders[ibit];
+ if(bitFolders[ibit]) delete bitFolders[ibit];
bitFolders[ibit] = new TFolder (Form("Bit %2.2d", ibit), "Trigger bit folder");
+ bitFolders[ibit]->SetOwner(); // Delete also the TObjString when deleting the folder
for(UInt_t ilogic = 0; ilogic < fNtriggerLogics; ilogic++){
if(GetHardwareTrigger(ilogic) != "" || GetOfflineTrigger(ilogic) != "") {
bitFolders[ibit]->Add(new TObjString(Form("Hardware Trig [*%d][%s]",ilogic,GetHardwareTrigger(ilogic).Data())));
bitFolders[ibit]->Add(new TObjString(Form("Collision Class [%s] [%s]", coll->String().Data(),
GetBeamSide(coll->String().Data()).Data())));
}
+ delete itColl;
TIterator *itBG = fBGTrigClasses[ibit]->MakeIterator();
TObjString * bg = 0;
bitFolders[ibit]->Add(new TObjString(Form("Background Class [%s] [%s]", bg->String().Data(),
GetBeamSide(bg->String().Data()).Data())));
}
-
+ delete itBG;
b->Add(bitFolders[ibit]);
TObject::Browse(b);
}
-const UInt_t AliOADBPhysicsSelection::GetActiveBit(UInt_t mask) {
+UInt_t AliOADBPhysicsSelection::GetActiveBit(UInt_t mask) {
// Returns the active bit index in the mask
// Assumes only one bit is on.
// If more than one bit is lit, prints an error and returns the first.
// If no bit is on, prints an error and returns 0
- Int_t nbit = sizeof(mask)*8;
+ const Int_t kNBitsToCheck = 29;
+
+ // Int_t nbit = sizeof(mask)*8;
+ Int_t nbit = kNBitsToCheck;
Int_t activeBit = -1;
for(Int_t ibit = 0; ibit < nbit; ibit++){
if ( mask & (0x1 << ibit) ) {
return activeBit;
}
+
+const char* AliOADBPhysicsSelection::ExpandTriggerString(const char* className)
+{
+ // expands [] syntax
+ // E.g. +CVHN-B-[NOPF|PF]-[ALL|CENT]NOTRD goes to +CVHN-B-NOPF-ALLNOTRD,CVHN-B-NOPF-CENTNOTRD,CVHN-B-PF-ALLNOTRD,CVHN-B-PF-CENTNOTRD
+
+ static TString str;
+ str = className;
+ TObjArray* triggers = str.Tokenize(" ");
+ for (Int_t j=0; j<triggers->GetEntries(); j++)
+ {
+ str = triggers->At(j)->GetName();
+ str = str(1, str.Length());
+
+ TList list;
+ list.SetOwner();
+
+ TObjArray* triggers2 = str.Tokenize(",");
+ for (Int_t k=0; k<triggers2->GetEntries(); k++)
+ list.Add(new TObjString(triggers2->At(k)->GetName()));
+ delete triggers2;
+
+// list.Print();
+
+ while (1)
+ {
+ Int_t i=0;
+ for (i=0; i<list.GetEntries(); i++)
+ {
+ str = list.At(i)->GetName();
+
+ Int_t begin = str.Index("[");
+ Int_t end = str.Index("]");
+ if (begin >= 0 && end >= 0)
+ {
+ TString before = str(0, begin);
+ TString after = str(end+1, str.Length());
+ TString tokens = str(begin+1, end-begin-1);
+ // Printf("%s %s %s", before.Data(), tokens.Data(), after.Data());
+ Int_t pos = 0;
+ while (tokens.Index("|", pos) >= 0)
+ {
+ list.Add(new TObjString(before + tokens(pos, tokens.Index("|", pos) - pos) + after));
+ pos = tokens.Index("|", pos) + 1;
+ }
+ list.Add(new TObjString(before + tokens(pos, tokens.Length()) + after));
+ delete list.RemoveAt(i);
+
+ // list.Print();
+ i=-1;
+ }
+ }
+
+ str = "";
+ for (i=0; i<list.GetEntries(); i++)
+ {
+ str += list.At(i)->GetName();
+ str += ",";
+ }
+ str = str(0, str.Length() - 1);
+ break;
+ }
+
+ TString& target = ((TObjString*) triggers->At(j))->String();
+ target.Form("%c%s", target[0], str.Data());
+ }
+
+ str = "";
+ for (Int_t j=0; j<triggers->GetEntries(); j++)
+ {
+ str += triggers->At(j)->GetName();
+ str += " ";
+ }
+ str = str(0, str.Length() - 1);
+
+ delete triggers;
+ if (strcmp(className, str.Data()))
+ Printf("AliOADBPhysicsSelection::ExpandTriggerString: In: <%s> Out: <%s>", className, str.Data());
+ return str;
+}