Exemplo n.º 1
0
TString GetTriggerClass(AliRawReaderChain* rawChain)
{
  ULong64_t triggerMask = rawChain->GetClassMask();

  // Convert a trigger mask to a trigger class
  AliCentralTrigger aCTP;
  TString configstr("");
  TString trclasses;
  if (!aCTP.LoadConfiguration(configstr)) { // Load CTP config from OCDB
    AliInfoGeneral("","No trigger configuration found in OCDB! The trigger configuration information will not be used!");
    return trclasses;
  }
  aCTP.SetClassMask(triggerMask);
  AliTriggerConfiguration *config = aCTP.GetConfiguration();
  const TObjArray& classesArray = config->GetClasses();
  Int_t nclasses = classesArray.GetEntriesFast();
  for( Int_t iclass=0; iclass < nclasses; iclass++ ) {
    AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass);
    if (trclass && trclass->GetMask()>0) {
      Int_t trindex = TMath::Nint(TMath::Log2(trclass->GetMask()));
      rawChain->LoadTriggerClass(trclass->GetName(),trindex);
      if (triggerMask & (1ull << trindex)) {
	trclasses += " ";
	trclasses += trclass->GetName();
	trclasses += " ";
      }
    }
  }
  return trclasses;
}
Exemplo n.º 2
0
const AliEventInfo* GetEventInfo()
{
    // Fill the event info object
    
    AliCentralTrigger *aCTP = NULL;
    if (AliEveEventManager::AssertRawReader())
    {
        fEventInfo.SetEventType(AliEveEventManager::AssertRawReader()->GetType());
        
        ULong64_t mask = AliEveEventManager::AssertRawReader()->GetClassMask();
        fEventInfo.SetTriggerMask(mask);
        UInt_t clmask = AliEveEventManager::AssertRawReader()->GetDetectorPattern()[0];
        fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(clmask));
        
        aCTP = new AliCentralTrigger();
        TString configstr("");
        if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB
            printf("No trigger configuration found in OCDB! The trigger configuration information will not be used!");
//            delete aCTP;
            return 0;
        }
        aCTP->SetClassMask(mask);
        aCTP->SetClusterMask(clmask);
        
        if (AliEveEventManager::AssertRunLoader())
        {
            AliCentralTrigger* rlCTP = AliEveEventManager::AssertRunLoader()->GetTrigger();
            if (rlCTP)
            {
                rlCTP->SetClassMask(mask);
                rlCTP->SetClusterMask(clmask);
            }
        }
    }
    else
    {
        fEventInfo.SetEventType(AliRawEventHeaderBase::kPhysicsEvent);
        
        if (AliEveEventManager::AssertRunLoader() &&
            (!AliEveEventManager::AssertRunLoader()->LoadTrigger()))
        {
            aCTP = AliEveEventManager::AssertRunLoader()->GetTrigger();
            fEventInfo.SetTriggerMask(aCTP->GetClassMask());
            // get inputs from actp - just get
            AliESDEvent *esdEvent = AliEveEventManager::Instance()->GetESD();
            
            if(esdEvent)
            {
                AliESDHeader* esdheader = esdEvent->GetHeader();
                esdheader->SetL0TriggerInputs(aCTP->GetL0TriggerInputs());
                esdheader->SetL1TriggerInputs(aCTP->GetL1TriggerInputs());
                esdheader->SetL2TriggerInputs(aCTP->GetL2TriggerInputs());
                fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(aCTP->GetClusterMask()));
            }
            else
            {
                cout<<"tpc_raw -- no ESD event"<<endl;
            }
        }
        else
        {
            printf("No trigger can be loaded! The trigger information will not be used!");
            return 0;
        }
    }
    
    AliTriggerConfiguration *config = aCTP->GetConfiguration();
    if (!config)
    {
        printf("No trigger configuration has been found! The trigger configuration information will not be used!");
//        if (AliEveEventManager::AssertRawReader()) delete aCTP;
        return 0;
    }
    
    TString declTriggerClasses;
    
    // Load trigger aliases and declare the trigger classes included in aliases
    AliCDBEntry * entry = AliCDBManager::Instance()->Get("GRP/CTP/Aliases");
    if (entry) {
        THashList * lst = dynamic_cast<THashList*>(entry->GetObject());
        if (lst) {
            lst->Sort(kFALSE); // to avoid problems with substrings
            if (AliEveEventManager::AssertRawReader()) AliEveEventManager::AssertRawReader()->LoadTriggerAlias(lst);
            // Now declare all the triggers present in the aliases
            TIter iter(lst);
            TNamed *nmd = 0;
            while((nmd = dynamic_cast<TNamed*>(iter.Next()))){
                declTriggerClasses += " ";
                declTriggerClasses += nmd->GetName();
            }
        }
        else {
            printf("Cannot cast the object with trigger aliases to THashList!");
        }
    }
    else {
        printf("No OCDB entry for the trigger aliases!");
    }
    
    // Load trigger classes for this run
    UChar_t clustmask = 0;
    TString trclasses;
    ULong64_t trmask = fEventInfo.GetTriggerMask();
    const TObjArray& classesArray = config->GetClasses();
    Int_t nclasses = classesArray.GetEntriesFast();
    for( Int_t iclass=0; iclass < nclasses; iclass++ ) {
        AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass);
        if (trclass && trclass->GetMask()>0) {
            Int_t trindex = TMath::Nint(TMath::Log2(trclass->GetMask()));
            if (AliEveEventManager::AssertESD()) AliEveEventManager::AssertESD()->SetTriggerClass(trclass->GetName(),trindex);
            if (AliEveEventManager::AssertRawReader()) AliEveEventManager::AssertRawReader()->LoadTriggerClass(trclass->GetName(),trindex);
            if (trmask & (1ull << trindex)) {
                trclasses += " ";
                trclasses += trclass->GetName();
                trclasses += " ";
                clustmask |= trclass->GetCluster()->GetClusterMask();
            }
        }
    }
    fEventInfo.SetTriggerClasses(trclasses);
    
    if (!aCTP->CheckTriggeredDetectors()) {
//        if (AliEveEventManager::AssertRawReader()) delete aCTP;
        cout<<"Check trigger detectors failed"<<endl;
        return 0;
    }
    
//    if (AliEveEventManager::AssertRawReader()) delete aCTP;
    
    // everything went ok, return pointer
    return (&fEventInfo);
}