]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliReconstruction.cxx
Added to AliMagF the definition (const) of the polarities conventions.
[u/mrichter/AliRoot.git] / STEER / AliReconstruction.cxx
index ff6e2b5f3f8133e186cb64c4ec10d2a7b7fe5b76..ba6a391289d026c4f9086531b2b3fdfd6f9a2bf0 100644 (file)
 #include <TProofOutputFile.h>
 #include <TROOT.h>
 #include <TSystem.h>
+#include <THashTable.h>
 
 #include "AliAlignObj.h"
 #include "AliCDBEntry.h"
 #include "AliMultiplicity.h"
 #include "AliPID.h"
 #include "AliPlaneEff.h"
-#include "AliQA.h"
+#include "AliQAv1.h"
 #include "AliQADataMakerRec.h" 
 #include "AliQAManager.h"
-#include "AliRawEvent.h"
+#include "AliRawVEvent.h"
 #include "AliRawEventHeaderBase.h"
 #include "AliRawHLTManager.h"
 #include "AliRawReaderDate.h"
 #include "AliTracker.h"
 #include "AliTriggerClass.h"
 #include "AliTriggerCluster.h"
+#include "AliTriggerIR.h"
 #include "AliTriggerConfiguration.h"
 #include "AliV0vertexer.h"
 #include "AliVertexer.h"
@@ -194,7 +196,6 @@ const char* AliReconstruction::fgkDetectorName[AliReconstruction::kNDetectors] =
 //_____________________________________________________________________________
 AliReconstruction::AliReconstruction(const char* gAliceFilename) :
   TSelector(),
-  fUniformField(kFALSE),
   fRunVertexFinder(kTRUE),
   fRunVertexFinderTracks(kTRUE),
   fRunHLTTracking(kFALSE),
@@ -219,6 +220,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
   fUseTrackingErrorsForAlignment(""),
   fGAliceFileName(gAliceFilename),
   fRawInput(""),
+  fESDOutput(""),
   fEquipIdMap(""),
   fFirstEvent(0),
   fLastEvent(-1),
@@ -229,6 +231,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
   fUseHLTData(),
   fRunInfo(NULL),
   fEventInfo(),
+  fRunScalers(NULL),
 
   fRunLoader(NULL),
   fRawReader(NULL),
@@ -241,6 +244,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
   fDiamondProfileSPD(NULL),
   fDiamondProfile(NULL),
   fDiamondProfileTPC(NULL),
+  fListOfCosmicTriggers(NULL),
   
   fGRPData(NULL),
 
@@ -251,7 +255,6 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
   fInitCDBCalled(kFALSE),
   fSetRunNumberFromDataCalled(kFALSE),
   fQADetectors("ALL"), 
-  fQAManager(NULL),  
   fQATasks("ALL"), 
   fRunQA(kTRUE),  
   fRunGlobalQA(kTRUE),
@@ -279,7 +282,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
     fLoader[iDet] = NULL;
     fTracker[iDet] = NULL;
   }
-  for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) {
+  for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) {
     fQACycles[iDet] = 999999 ;
     fQAWriteExpert[iDet] = kFALSE ; 
   }
@@ -290,7 +293,6 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
 //_____________________________________________________________________________
 AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   TSelector(),
-  fUniformField(rec.fUniformField),
   fRunVertexFinder(rec.fRunVertexFinder),
   fRunVertexFinderTracks(rec.fRunVertexFinderTracks),
   fRunHLTTracking(rec.fRunHLTTracking),
@@ -315,6 +317,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fUseTrackingErrorsForAlignment(rec.fUseTrackingErrorsForAlignment),
   fGAliceFileName(rec.fGAliceFileName),
   fRawInput(rec.fRawInput),
+  fESDOutput(rec.fESDOutput),
   fEquipIdMap(rec.fEquipIdMap),
   fFirstEvent(rec.fFirstEvent),
   fLastEvent(rec.fLastEvent),
@@ -325,6 +328,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fUseHLTData(rec.fUseHLTData),
   fRunInfo(NULL),
   fEventInfo(),
+  fRunScalers(NULL),
 
   fRunLoader(NULL),
   fRawReader(NULL),
@@ -337,6 +341,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fDiamondProfileSPD(rec.fDiamondProfileSPD),
   fDiamondProfile(rec.fDiamondProfile),
   fDiamondProfileTPC(rec.fDiamondProfileTPC),
+  fListOfCosmicTriggers(NULL),
   
   fGRPData(NULL),
 
@@ -347,7 +352,6 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fInitCDBCalled(rec.fInitCDBCalled),
   fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled),
   fQADetectors(rec.fQADetectors), 
-  fQAManager(NULL),  
   fQATasks(rec.fQATasks), 
   fRunQA(rec.fRunQA),  
   fRunGlobalQA(rec.fRunGlobalQA),
@@ -378,7 +382,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
     fTracker[iDet] = NULL;
   }  
   
-  for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) {
+  for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) {
     fQACycles[iDet] = rec.fQACycles[iDet];
     fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; 
   }
@@ -400,7 +404,6 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
 // TSelector members should not be touched
   if(&rec == this) return *this;
 
-  fUniformField          = rec.fUniformField;
   fRunVertexFinder       = rec.fRunVertexFinder;
   fRunVertexFinderTracks = rec.fRunVertexFinderTracks;
   fRunHLTTracking        = rec.fRunHLTTracking;
@@ -425,6 +428,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
   fUseTrackingErrorsForAlignment = rec.fUseTrackingErrorsForAlignment;
   fGAliceFileName                = rec.fGAliceFileName;
   fRawInput                      = rec.fRawInput;
+  fESDOutput                     = rec.fESDOutput;
   fEquipIdMap                    = rec.fEquipIdMap;
   fFirstEvent                    = rec.fFirstEvent;
   fLastEvent                     = rec.fLastEvent;
@@ -443,6 +447,10 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
 
   fEventInfo                     = rec.fEventInfo;
 
+  delete fRunScalers; fRunScalers = NULL;
+  if (rec.fRunScalers) fRunScalers = new AliTriggerRunScalers(*rec.fRunScalers); 
+
+  
   fRunLoader       = NULL;
   fRawReader       = NULL;
   fParentRawReader = NULL;
@@ -455,7 +463,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
     delete fTracker[iDet]; fTracker[iDet] = NULL;
   }
   
-  for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) {
+  for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) {
     fQACycles[iDet] = rec.fQACycles[iDet];
     fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ;
   } 
@@ -469,6 +477,9 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
   delete fDiamondProfileTPC; fDiamondProfileTPC = NULL;
   if (rec.fDiamondProfileTPC) fDiamondProfileTPC = new AliESDVertex(*rec.fDiamondProfileTPC);
 
+  delete fListOfCosmicTriggers; fListOfCosmicTriggers = NULL;
+  if (rec.fListOfCosmicTriggers) fListOfCosmicTriggers = (THashTable*)((rec.fListOfCosmicTriggers)->Clone());
+
   delete fGRPData; fGRPData = NULL;
   //  if (rec.fGRPData) fGRPData = (TMap*)((rec.fGRPData)->Clone());
   if (rec.fGRPData) fGRPData = (AliGRPObject*)((rec.fGRPData)->Clone());
@@ -481,7 +492,6 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
   fInitCDBCalled               = rec.fInitCDBCalled;
   fSetRunNumberFromDataCalled  = rec.fSetRunNumberFromDataCalled;
   fQADetectors                 = rec.fQADetectors;
-  fQAManager                     = NULL;  
   fQATasks                     = rec.fQATasks; 
   fRunQA                       = rec.fRunQA;  
   fRunGlobalQA                 = rec.fRunGlobalQA;
@@ -510,14 +520,19 @@ AliReconstruction::~AliReconstruction()
 // clean up
 
   CleanUp();
+  if (fListOfCosmicTriggers) {
+    fListOfCosmicTriggers->Delete();
+    delete fListOfCosmicTriggers;
+  }
   delete fGRPData;
+  delete fRunScalers;
   fOptions.Delete();
   if (fAlignObjArray) {
     fAlignObjArray->Delete();
     delete fAlignObjArray;
   }
   fSpecCDBUri.Delete();
-  delete fQAManager;
+
   AliCodeTimer::Instance()->Print();
 }
 
@@ -530,16 +545,16 @@ void AliReconstruction::InitQA()
   if (fInitQACalled) return;
   fInitQACalled = kTRUE;
   
-  fQAManager = AliQAManager::QAManager("rec") ; 
+  AliQAManager * qam = AliQAManager::QAManager(AliQAv1::kRECMODE) ; 
   if (fWriteQAExpertData)
-    fQAManager->SetWriteExpert() ; 
+    qam->SetWriteExpert() ; 
  
-  if (fQAManager->IsDefaultStorageSet()) {
+  if (qam->IsDefaultStorageSet()) {
     AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
     AliWarning("Default QA reference storage has been already set !");
     AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fQARefUri.Data()));
     AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-    fQARefUri = fQAManager->GetDefaultStorage()->GetURI();
+    fQARefUri = qam->GetDefaultStorage()->GetURI();
   } else {
     if (fQARefUri.Length() > 0) {
        AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
@@ -553,48 +568,44 @@ void AliReconstruction::InitQA()
         AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                
       }
-    fQAManager->SetDefaultStorage(fQARefUri);
+    qam->SetDefaultStorage(fQARefUri);
   }
   
   if (fRunQA) {
-  fQAManager->SetActiveDetectors(fQADetectors) ; 
-  for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
-    fQAManager->SetCycleLength(AliQA::DETECTORINDEX_t(det), fQACycles[det]) ;  
-    fQAManager->SetWriteExpert(AliQA::DETECTORINDEX_t(det)) ;
+  qam->SetActiveDetectors(fQADetectors) ; 
+  for (Int_t det = 0 ; det < AliQAv1::kNDET ; det++) {
+    qam->SetCycleLength(AliQAv1::DETECTORINDEX_t(det), fQACycles[det]) ;  
+    qam->SetWriteExpert(AliQAv1::DETECTORINDEX_t(det)) ;
   }
-  if (!fRawReader && fQATasks.Contains(AliQA::kRAWS))
-    fQATasks.ReplaceAll(Form("%d",AliQA::kRAWS), "") ;
-  fQAManager->SetTasks(fQATasks) ; 
-  fQAManager->InitQADataMaker(AliCDBManager::Instance()->GetRun()) ; 
+  if (!fRawReader && !fInput && fQATasks.Contains(AliQAv1::kRAWS))
+    fQATasks.ReplaceAll(Form("%d",AliQAv1::kRAWS), "") ;
+  qam->SetTasks(fQATasks) ; 
+  qam->InitQADataMaker(AliCDBManager::Instance()->GetRun()) ; 
   }
   if (fRunGlobalQA) {
     Bool_t sameCycle = kFALSE ;
-    AliQADataMaker *qadm = fQAManager->GetQADataMaker(AliQA::kGLOBAL);
+    AliQADataMaker *qadm = qam->GetQADataMaker(AliQAv1::kGLOBAL);
     AliInfo(Form("Initializing the global QA data maker"));
-    if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) {
-      qadm->StartOfCycle(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; 
-      TObjArray **arr=qadm->Init(AliQA::kRECPOINTS);
+    if (fQATasks.Contains(Form("%d", AliQAv1::kRECPOINTS))) {
+      qadm->StartOfCycle(AliQAv1::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; 
+      TObjArray **arr=qadm->Init(AliQAv1::kRECPOINTS);
       AliTracker::SetResidualsArray(arr);
       sameCycle = kTRUE ; 
     }
-    if (fQATasks.Contains(Form("%d", AliQA::kESDS))) {
-      qadm->StartOfCycle(AliQA::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; 
-      qadm->Init(AliQA::kESDS);
+    if (fQATasks.Contains(Form("%d", AliQAv1::kESDS))) {
+      qadm->StartOfCycle(AliQAv1::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; 
+      qadm->Init(AliQAv1::kESDS);
     }
   }
     AliSysInfo::AddStamp("InitQA") ; 
 }
 
 //_____________________________________________________________________________
-void AliReconstruction::MergeQA()
+void AliReconstruction::MergeQA(const char *fileName)
 {
   //Initialize the QA and start of cycle 
   AliCodeTimerAuto("") ;
-  if ( ! fQAManager ) {
-    AliFatal("Hum... this should not happen") ; 
-  } else { 
-   fQAManager->Merge(AliCDBManager::Instance()->GetRun()) ; 
-  }
+  AliQAManager::QAManager()->Merge(AliCDBManager::Instance()->GetRun(),fileName) ; 
   AliSysInfo::AddStamp("MergeQA") ; 
 }
   
@@ -662,7 +673,7 @@ void AliReconstruction::SetQARefDefaultStorage(const char* uri) {
   // Activate it later within the Run() method
   
   fQARefUri = uri;
-  AliQA::SetQARefStorage(fQARefUri.Data()) ;
+  AliQAv1::SetQARefStorage(fQARefUri.Data()) ;
   
 }
 //_____________________________________________________________________________
@@ -852,6 +863,15 @@ void AliReconstruction::SetInput(const char* input)
   if (input) fRawInput = input;
 }
 
+//_____________________________________________________________________________
+void AliReconstruction::SetOutput(const char* output) 
+{
+  // Set the output ESD filename
+  // 'output' is a normalt ROOT url
+  // The method is used in case of raw-data reco with PROOF
+  if (output) fESDOutput.SetUrl(output);
+}
+
 //_____________________________________________________________________________
 void AliReconstruction::SetOption(const char* detector, const char* option)
 {
@@ -923,7 +943,6 @@ Bool_t AliReconstruction::SetFieldMap(Float_t l3Cur, Float_t diCur, Float_t l3Po
     fcL3 = 0;
     map  = AliMagF::k5kGUniform;
     s   += "0.0 T;  ";
-    fUniformField=kTRUE;        // track with the uniform (zero) B field
   } else {
     AliError(Form("Wrong L3 current (%f A)!",l3Cur));
     return kFALSE;
@@ -942,8 +961,13 @@ Bool_t AliReconstruction::SetFieldMap(Float_t l3Cur, Float_t diCur, Float_t l3Po
     return kFALSE;
   }
   //
-  if (l3Pol!=diPol && (map==AliMagF::k5kG || map==AliMagF::k2kG) && fcDip!=0) {
-    AliError("L3 and Dipole polarities must be the same");
+  //
+  if (fcDip!=0 && (map==AliMagF::k5kG || map==AliMagF::k2kG) && 
+      ((AliMagF::GetPolarityConvention()==AliMagF::kConvMap2005 && l3Pol!=diPol) ||
+       (AliMagF::GetPolarityConvention()==AliMagF::kConvDCS2008 && l3Pol==diPol) ||
+       (AliMagF::GetPolarityConvention()==AliMagF::kConvLHC     && l3Pol!=diPol)) ) {
+    AliError(Form("Wrong combination for L3/Dipole polarities (%c/%c) for convention %d",
+                 l3Pol>0?'+':'-',diPol>0?'+':'-',AliMagF::GetPolarityConvention()));
     return kFALSE;
   }
   //
@@ -993,7 +1017,11 @@ Bool_t AliReconstruction::InitGRP() {
        entry->SetOwner(0);
     }
 
-    AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
+    //    FIX ME: The unloading of GRP entry is temporarily disabled
+    //    because ZDC and VZERO are using it in order to initialize
+    //    their reconstructor objects. In the future one has to think
+    //    of propagating AliRunInfo to the reconstructors.
+    //    AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
   }
 
   if (!fGRPData) {
@@ -1163,6 +1191,17 @@ Bool_t AliReconstruction::InitGRP() {
      AliError("No TPC diamond profile found in OCDB!");
   }
 
+  entry = AliCDBManager::Instance()->Get("GRP/Calib/CosmicTriggers");
+  if (entry) {
+    fListOfCosmicTriggers = dynamic_cast<THashTable*>(entry->GetObject());
+    entry->SetOwner(0);
+    AliCDBManager::Instance()->UnloadFromCache("GRP/Calib/CosmicTriggers");
+  }
+
+  if (!fListOfCosmicTriggers) {
+    AliWarning("Can not get list of cosmic triggers from OCDB! Cosmic event specie will be effectively disabled!");
+  }
+
   return kTRUE;
 } 
 
@@ -1180,7 +1219,23 @@ Bool_t AliReconstruction::LoadCDB()
   }
   return kTRUE;
 }
+//_____________________________________________________________________________
+Bool_t AliReconstruction::LoadTriggerScalersCDB()
+{
+  AliCodeTimerAuto("");
+
+  AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/Scalers");
+
+  if (entry) { 
+   
+       AliInfo("Found an AliTriggerRunScalers in GRP/CTP/Scalers, reading it");
+       fRunScalers = dynamic_cast<AliTriggerRunScalers*> (entry->GetObject());
+       entry->SetOwner(0);
+       if (fRunScalers->CorrectScalersOverflow() == 0) AliInfo("32bit Trigger counters corrected for overflow");
 
+  }
+  return kTRUE;
+}
 //_____________________________________________________________________________
 Bool_t AliReconstruction::Run(const char* input)
 {
@@ -1195,12 +1250,14 @@ Bool_t AliReconstruction::Run(const char* input)
     // Proof mode
     if (gProof) {
       gProof->AddInput(this);
-      TUrl outputFile;
-      outputFile.SetProtocol("root",kTRUE);
-      outputFile.SetHost(gSystem->HostName());
-      outputFile.SetFile(Form("%s/AliESDs.root",gSystem->pwd()));
-      AliInfo(Form("Output file with ESDs is %s",outputFile.GetUrl()));
-      gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",outputFile.GetUrl()));
+      if (!fESDOutput.IsValid()) {
+       fESDOutput.SetProtocol("root",kTRUE);
+       fESDOutput.SetHost(gSystem->HostName());
+       fESDOutput.SetFile(Form("%s/AliESDs.root",gSystem->pwd()));
+      }
+      AliInfo(Form("Output file with ESDs is %s",fESDOutput.GetUrl()));
+      gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",fESDOutput.GetUrl()));
+      gProof->SetParameter("PROOF_MaxSlavesPerNode", 9999);
       chain->SetProof();
       chain->Process("AliReconstruction");
     }
@@ -1342,6 +1399,13 @@ void AliReconstruction::Begin(TTree *)
   }
   AliSysInfo::AddStamp("LoadCDB");
 
+  if (!LoadTriggerScalersCDB()) {
+    Abort("LoadTriggerScalersCDB", TSelector::kAbortProcess);
+    return;
+  }
+  AliSysInfo::AddStamp("LoadTriggerScalersCDB");
+
+
   // Read the reconstruction parameters from OCDB
   if (!InitRecoParams()) {
     AliWarning("Not all detectors have correct RecoParam objects initialized");
@@ -1515,7 +1579,7 @@ Bool_t AliReconstruction::Process(Long64_t entry)
   AliCodeTimerAuto("");
 
   TTree *currTree = fChain->GetTree();
-  AliRawEvent *event = new AliRawEvent;
+  AliRawVEvent *event = NULL;
   currTree->SetBranchAddress("rawevent",&event);
   currTree->GetEntry(entry);
   fRawReader = new AliRawReaderRoot(event);
@@ -1564,7 +1628,7 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
 
   // Fill Event-info object
   GetEventInfo();
-  fRecoParam.SetEventSpecie(fRunInfo,fEventInfo);
+  fRecoParam.SetEventSpecie(fRunInfo,fEventInfo,fListOfCosmicTriggers);
   AliInfo(Form("Current event specie: %s",fRecoParam.PrintEventSpecie()));
 
   // Set the reco-params
@@ -1576,8 +1640,10 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
       if (reconstructor && fRecoParam.GetDetRecoParamArray(iDet)) {
         const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet);
         reconstructor->SetRecoParam(par);
+       reconstructor->SetEventInfo(&fEventInfo);
         if (fRunQA) {
-          fQAManager->SetRecoParam(iDet, par) ; 
+          AliQAManager::QAManager()->SetRecoParam(iDet, par) ; 
+          AliQAManager::QAManager()->SetEventSpecie(AliRecoParam::Convert(par->GetEventSpecie())) ;
         }
       }
     }
@@ -1585,8 +1651,8 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
 
     // QA on single raw 
   if (fRunQA) {
-    fQAManager->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
-    fQAManager->RunOneEvent(fRawReader) ;  
+    AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
+    AliQAManager::QAManager()->RunOneEvent(fRawReader) ;  
   }
     // local single event reconstruction
     if (!fRunLocalReconstruction.IsNull()) {
@@ -1810,14 +1876,14 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
     if (fCleanESD) CleanESD(fesd);
 
   if (fRunQA) {
-    fQAManager->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
-    fQAManager->RunOneEvent(fesd) ; 
+    AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
+    AliQAManager::QAManager()->RunOneEvent(fesd) ; 
   }
   if (fRunGlobalQA) {
-      AliQADataMaker *qadm = fQAManager->GetQADataMaker(AliQA::kGLOBAL);
+    AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL);
       qadm->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
-    if (qadm && fQATasks.Contains(Form("%d", AliQA::kESDS)))
-      qadm->Exec(AliQA::kESDS, fesd);
+    if (qadm && fQATasks.Contains(Form("%d", AliQAv1::kESDS)))
+      qadm->Exec(AliQAv1::kESDS, fesd);
   }
 
     if (fWriteESDfriend) {
@@ -1853,12 +1919,15 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
   
     fEventInfo.Reset();
     for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
-      if (fReconstructor[iDet])
+      if (fReconstructor[iDet]) {
        fReconstructor[iDet]->SetRecoParam(NULL);
+       fReconstructor[iDet]->SetEventInfo(NULL);
+      }
+      if (fTracker[iDet]) fTracker[iDet]->SetEventInfo(NULL);
     }
        
   if (fRunQA || fRunGlobalQA) 
-      fQAManager->Increment() ; 
+    AliQAManager::QAManager()->Increment() ; 
   
     return kTRUE;
 }
@@ -1922,18 +1991,36 @@ void AliReconstruction::SlaveTerminate()
 
   // End of cycle for the in-loop  
   if (fRunQA) 
-    fQAManager->EndOfCycle() ;
+    AliQAManager::QAManager()->EndOfCycle() ;
   
   if (fRunGlobalQA) {
-    AliQADataMaker *qadm = fQAManager->GetQADataMaker(AliQA::kGLOBAL);
+    AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL);
     if (qadm) {
-      if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) 
-        qadm->EndOfCycle(AliQA::kRECPOINTS);
-      if (fQATasks.Contains(Form("%d", AliQA::kESDS))) 
-        qadm->EndOfCycle(AliQA::kESDS);
+      if (fQATasks.Contains(Form("%d", AliQAv1::kRECPOINTS))) 
+        qadm->EndOfCycle(AliQAv1::kRECPOINTS);
+      if (fQATasks.Contains(Form("%d", AliQAv1::kESDS))) 
+        qadm->EndOfCycle(AliQAv1::kESDS);
       qadm->Finish();
     }
   }
+
+  if (fRunQA || fRunGlobalQA) {
+    if (fInput) { 
+      if (TNamed *outputFileName = (TNamed *) fInput->FindObject("PROOF_OUTPUTFILE")) {
+       TString qaOutputFile = outputFileName->GetTitle();
+       qaOutputFile.ReplaceAll(gSystem->BaseName(TUrl(outputFileName->GetTitle()).GetFile()),
+                               Form("Merged.%s.Data.root",AliQAv1::GetQADataFileName()));
+       TProofOutputFile *qaProofFile = new TProofOutputFile(Form("Merged.%s.Data.root",AliQAv1::GetQADataFileName()));
+       qaProofFile->SetOutputFileName(qaOutputFile.Data());
+       fOutput->Add(qaProofFile);
+       MergeQA(qaProofFile->GetFileName());
+      }
+    }
+    else {
+      MergeQA();
+    }
+  }
+
   gROOT->cd();
   CleanUp();
 }
@@ -1945,8 +2032,11 @@ void AliReconstruction::Terminate()
   // In case of empty events the tags will contain dummy values
   AliCodeTimerAuto("");
 
-  AliESDTagCreator *esdtagCreator = new AliESDTagCreator();
-  esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData, AliQA::Instance()->GetQA(), AliQA::Instance()->GetEventSpecies(), AliQA::kNDET, AliRecoParam::kNSpecies);
+  // Do not call the ESD tag creator in case of PROOF-based reconstruction
+  if (!fInput) {
+    AliESDTagCreator *esdtagCreator = new AliESDTagCreator();
+    esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData, AliQAv1::Instance()->GetQA(), AliQAv1::Instance()->GetEventSpecies(), AliQAv1::kNDET, AliRecoParam::kNSpecies);
+  }
 
   // Cleanup of CDB manager: cache and active storages!
   AliCDBManager::Instance()->ClearCache();
@@ -1970,10 +2060,10 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
     // although the HLT loader is missing
     if (strcmp(fgkDetectorName[iDet], "HLT")==0) {
       if (fRawReader) {
-       reconstructor->Reconstruct(fRawReader, NULL);
+        reconstructor->Reconstruct(fRawReader, NULL);
       } else {
-       TTree* dummy=NULL;
-       reconstructor->Reconstruct(dummy, NULL);
+        TTree* dummy=NULL;
+        reconstructor->Reconstruct(dummy, NULL);
       }
       continue;
     }
@@ -2008,22 +2098,24 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
       loader->LoadDigits("read");
       TTree* digitsTree = loader->TreeD();
       if (!digitsTree) {
-       AliError(Form("Can't get the %s digits tree", fgkDetectorName[iDet]));
-       if (fStopOnError) return kFALSE;
+        AliError(Form("Can't get the %s digits tree", fgkDetectorName[iDet]));
+        if (fStopOnError) return kFALSE;
       } else {
-       reconstructor->Reconstruct(digitsTree, clustersTree);
+        reconstructor->Reconstruct(digitsTree, clustersTree);
+        if (fRunQA) {
+          AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
+          AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, digitsTree) ; 
+        }
       }
       loader->UnloadDigits();
     }
-
-               TString detQAStr(fQADetectors) ; 
                if (fRunQA) {
-      fQAManager->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
-                       fQAManager->RunOneEventInOneDetector(iDet, clustersTree) ; 
+      AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ;
+                       AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, clustersTree) ; 
     }
-       loader->WriteRecPoints("OVERWRITE");
-       loader->UnloadRecPoints();
-       AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr);
+    loader->WriteRecPoints("OVERWRITE");
+    loader->UnloadRecPoints();
+    AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr);
   }
   if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) {
     AliError(Form("the following detectors were not found: %s",
@@ -2125,6 +2217,12 @@ Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd)
   vertex->GetSigmaXYZ(vtxErr);
 
   esd->SetPrimaryVertexSPD(vertex);
+  AliESDVertex *vpileup = NULL;
+  Int_t novertices = 0;
+  vpileup = vertexer->GetAllVertices(novertices);
+  if(novertices>1){
+    for (Int_t kk=1; kk<novertices; kk++)esd->AddPileupVertexSPD(&vpileup[kk]);
+  }
   // if SPD multiplicity has been determined, it is stored in the ESD
   AliMultiplicity *mult = vertexer->GetMultiplicity();
   if(mult)esd->SetMultiplicity(mult);
@@ -2255,6 +2353,16 @@ Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd)
 
   AliInfo("running tracking");
 
+  // Set the event info which is used
+  // by the trackers in order to obtain
+  // information about read-out detectors,
+  // trigger etc.
+  AliDebug(1, "Setting event info");
+  for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
+    if (!fTracker[iDet]) continue;
+    fTracker[iDet]->SetEventInfo(&fEventInfo);
+  }
+
   //Fill the ESD with the T0 info (will be used by the TOF) 
   if (fReconstructor[11] && fLoader[11]) {
     fLoader[11]->LoadRecPoints("READ");
@@ -2305,8 +2413,8 @@ Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd)
       AliSysInfo::AddStamp(Form("RLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,1, eventNr);
       tree = fLoader[iDet]->TreeR();
       if (!tree) {
-       AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet]));
-       return kFALSE;
+        AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet]));
+        return kFALSE;
       }
       fTracker[iDet]->LoadClusters(tree); 
       AliSysInfo::AddStamp(Form("TLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr);
@@ -2314,8 +2422,18 @@ Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd)
 
     // run tracking
     if (iDet>1) // start filling residuals for the "outer" detectors
-    if (fRunGlobalQA) AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE);     
-
+      if (fRunGlobalQA) {
+        AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE);     
+        TObjArray ** arr = AliTracker::GetResidualsArray() ; 
+       if (arr) {
+         AliRecoParam::EventSpecie_t es=fRecoParam.GetEventSpecie();
+         TObjArray * elem = arr[AliRecoParam::AConvert(es)];
+         if ( elem && (! elem->At(0)) ) {
+           AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL);
+           if (qadm) qadm->InitRecPointsForTracker() ; 
+         }
+       }
+      }
     if (fTracker[iDet]->PropagateBack(esd) != 0) {
       AliError(Form("%s backward propagation failed", fgkDetectorName[iDet]));
       //      return kFALSE;
@@ -2344,8 +2462,19 @@ Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd)
 
     // run tracking
     if (iDet<2) // start filling residuals for TPC and ITS
-    if (fRunGlobalQA) AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE);     
-
+      if (fRunGlobalQA) {
+        AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE);     
+        TObjArray ** arr = AliTracker::GetResidualsArray() ; 
+       if (arr) {
+         AliRecoParam::EventSpecie_t es=fRecoParam.GetEventSpecie();
+         TObjArray * elem = arr[AliRecoParam::AConvert(es)];
+         if ( elem && (! elem->At(0)) ) {
+           AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL);
+           if (qadm) qadm->InitRecPointsForTracker() ; 
+         }
+       }
+      }
+    
     if (fTracker[iDet]->RefitInward(esd) != 0) {
       AliError(Form("%s inward refit failed", fgkDetectorName[iDet]));
       //      return kFALSE;
@@ -2481,19 +2610,33 @@ Bool_t AliReconstruction::FillTriggerESD(AliESDEvent*& esd)
       if (esd->GetBunchCrossNumber() != input.GetBCID())
        AliError(Form("Invalid bunch-crossing id found in CTP raw-data: %x %x",
                      input.GetBCID(),esd->GetBunchCrossNumber()));
+      AliESDHeader* esdheader = esd->GetHeader();
+      esdheader->SetL0TriggerInputs(input.GetL0Inputs());
+      esdheader->SetL1TriggerInputs(input.GetL1Inputs());
+      esdheader->SetL2TriggerInputs(input.GetL2Inputs());
+      // IR
+      UInt_t orbit=input.GetOrbitID();
+       for(Int_t i=0 ; i<input.GetNIRs() ; i++ )
+          if(TMath::Abs(Int_t(orbit-(input.GetIR(i))->GetOrbit()))<=1){
+            esdheader->AddTriggerIR(input.GetIR(i));
+         }
     }
-
-  // Here one has to add the filling of trigger inputs and
-  // interaction records
-  // ...
+  }
+  //Scalers
+  //fRunScalers->Print();
+  if(fRunScalers && fRunScalers->CheckRunScalers()){
+     AliTimeStamp* timestamp = new AliTimeStamp(esd->GetOrbitNumber(), esd->GetPeriodNumber(), esd->GetBunchCrossNumber());
+     //AliTimeStamp* timestamp = new AliTimeStamp(10308000, 0, (ULong64_t)486238);
+     AliESDHeader* esdheader = fesd->GetHeader();
+     for(Int_t i=0;i<50;i++){
+          if((1<<i) & esd->GetTriggerMask()){
+          AliTriggerScalersESD* scalesd = fRunScalers->GetScalersForEventClass( timestamp, i+1);
+          if(scalesd)esdheader->SetTriggerScalersRecord(scalesd);
+        }
+     }
   }
   return kTRUE;
 }
-
-
-
-
-
 //_____________________________________________________________________________
 Bool_t AliReconstruction::FillRawEventHeaderESD(AliESDEvent*& esd)
 {
@@ -2615,6 +2758,7 @@ AliReconstructor* AliReconstruction::GetReconstructor(Int_t iDet)
     if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) {
       const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet);
       fReconstructor[iDet]->SetRecoParam(par);
+      fReconstructor[iDet]->SetRunInfo(fRunInfo);
     }
     return fReconstructor[iDet];
   }
@@ -2696,6 +2840,7 @@ AliReconstructor* AliReconstruction::GetReconstructor(Int_t iDet)
   if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) {
     const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet);
     reconstructor->SetRecoParam(par);
+    reconstructor->SetRunInfo(fRunInfo);
   }
   return reconstructor;
 }
@@ -2709,7 +2854,7 @@ AliVertexer* AliReconstruction::CreateVertexer()
 
   AliVertexer* vertexer = NULL;
   AliReconstructor* itsReconstructor = GetReconstructor(0);
-  if (itsReconstructor) {
+  if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || fRunTracking.Contains("ITS"))) {
     vertexer = itsReconstructor->CreateVertexer();
   }
   if (!vertexer) {
@@ -2773,14 +2918,6 @@ void AliReconstruction::CleanUp()
   delete ftVertexer;
   ftVertexer = NULL;
   
-  if(!(AliCDBManager::Instance()->GetCacheFlag())) {
-    delete fDiamondProfileSPD;
-    fDiamondProfileSPD = NULL;
-    delete fDiamondProfile;
-    fDiamondProfile = NULL;
-    delete fDiamondProfileTPC;
-    fDiamondProfileTPC = NULL;
-  }
   delete fRunLoader;
   fRunLoader = NULL;
   delete fRawReader;
@@ -2793,6 +2930,12 @@ void AliReconstruction::CleanUp()
     delete ffile;
     ffile = NULL;
   }
+
+  if (AliQAManager::QAManager())
+    AliQAManager::QAManager()->ShowQA() ; 
+  AliQAManager::Destroy() ; 
+  
+  TGeoGlobalMagField::Instance()->SetField(NULL);
 }
 
 void AliReconstruction::WriteAlignmentData(AliESDEvent* esd)
@@ -2889,24 +3032,24 @@ void AliReconstruction::CheckQA()
 //     TString newRunTracking ;
 //     TString newFillESD ;
 //      
-//     for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) {
-//             TString detName(AliQA::GetDetName(iDet)) ;
-//             AliQA * qa = AliQA::Instance(AliQA::DETECTORINDEX_t(iDet)) ;       
-//      if ( qa->IsSet(AliQA::DETECTORINDEX_t(iDet), AliQA::kSIM, specie, AliQA::kFATAL)) {
+//     for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) {
+//             TString detName(AliQAv1::GetDetName(iDet)) ;
+//             AliQAv1 * qa = AliQAv1::Instance(AliQAv1::DETECTORINDEX_t(iDet)) ;       
+//      if ( qa->IsSet(AliQAv1::DETECTORINDEX_t(iDet), AliQAv1::kSIM, specie, AliQAv1::kFATAL)) {
 //        AliInfo(Form("QA status for %s %s in Hits and/or SDIGITS  and/or Digits was Fatal; No reconstruction performed", 
 //                   detName.Data(), AliRecoParam::GetEventSpecieName(es))) ;
 //                     } else {
-//                     if ( fRunLocalReconstruction.Contains(AliQA::GetDetName(iDet)) || 
+//                     if ( fRunLocalReconstruction.Contains(AliQAv1::GetDetName(iDet)) || 
 //                                     fRunLocalReconstruction.Contains("ALL") )  {
 //                             newRunLocalReconstruction += detName ; 
 //                             newRunLocalReconstruction += " " ;                      
 //                     }
-//                     if ( fRunTracking.Contains(AliQA::GetDetName(iDet)) || 
+//                     if ( fRunTracking.Contains(AliQAv1::GetDetName(iDet)) || 
 //                                     fRunTracking.Contains("ALL") )  {
 //                             newRunTracking += detName ; 
 //                             newRunTracking += " " ;                         
 //                     }
-//                     if ( fFillESD.Contains(AliQA::GetDetName(iDet)) || 
+//                     if ( fFillESD.Contains(AliQAv1::GetDetName(iDet)) || 
 //                                     fFillESD.Contains("ALL") )  {
 //                             newFillESD += detName ; 
 //                             newFillESD += " " ;                     
@@ -3039,7 +3182,7 @@ void AliReconstruction::RunAliEVE()
 Bool_t AliReconstruction::SetRunQA(TString detAndAction) 
 {
        // Allows to run QA for a selected set of detectors
-       // and a selected set of tasks among RAWS, RECPOINTS and ESDS
+       // and a selected set of tasks among RAWS, DIGITSR, RECPOINTS and ESDS
        // all selected detectors run the same selected tasks
        
        if (!detAndAction.Contains(":")) {
@@ -3053,16 +3196,18 @@ Bool_t AliReconstruction::SetRunQA(TString detAndAction)
                fQADetectors = fFillESD ; 
                fQATasks   = detAndAction(colon+1, detAndAction.Sizeof() ) ; 
        if (fQATasks.Contains("ALL") ) {
-               fQATasks = Form("%d %d %d", AliQA::kRAWS, AliQA::kRECPOINTS, AliQA::kESDS) ; 
+               fQATasks = Form("%d %d %d %d", AliQAv1::kRAWS, AliQAv1::kDIGITSR, AliQAv1::kRECPOINTS, AliQAv1::kESDS) ; 
        } else {
                fQATasks.ToUpper() ; 
                TString tempo("") ; 
                if ( fQATasks.Contains("RAW") ) 
-                       tempo = Form("%d ", AliQA::kRAWS) ; 
+                       tempo = Form("%d ", AliQAv1::kRAWS) ; 
+               if ( fQATasks.Contains("DIGIT") ) 
+                       tempo += Form("%d ", AliQAv1::kDIGITSR) ; 
                if ( fQATasks.Contains("RECPOINT") ) 
-                       tempo += Form("%d ", AliQA::kRECPOINTS) ; 
+                       tempo += Form("%d ", AliQAv1::kRECPOINTS) ; 
                if ( fQATasks.Contains("ESD") ) 
-                       tempo += Form("%d ", AliQA::kESDS) ; 
+                       tempo += Form("%d ", AliQAv1::kESDS) ; 
                fQATasks = tempo ; 
                if (fQATasks.IsNull()) {
                        AliInfo("No QA requested\n")  ;
@@ -3071,9 +3216,10 @@ Bool_t AliReconstruction::SetRunQA(TString detAndAction)
                }
        }       
        TString tempo(fQATasks) ; 
-       tempo.ReplaceAll(Form("%d", AliQA::kRAWS), AliQA::GetTaskName(AliQA::kRAWS))    ;
-       tempo.ReplaceAll(Form("%d", AliQA::kRECPOINTS), AliQA::GetTaskName(AliQA::kRECPOINTS)) ;        
-       tempo.ReplaceAll(Form("%d", AliQA::kESDS), AliQA::GetTaskName(AliQA::kESDS)) ;  
+       tempo.ReplaceAll(Form("%d", AliQAv1::kRAWS), AliQAv1::GetTaskName(AliQAv1::kRAWS))      ;
+       tempo.ReplaceAll(Form("%d", AliQAv1::kDIGITSR), AliQAv1::GetTaskName(AliQAv1::kDIGITSR)) ;      
+       tempo.ReplaceAll(Form("%d", AliQAv1::kRECPOINTS), AliQAv1::GetTaskName(AliQAv1::kRECPOINTS)) ;  
+       tempo.ReplaceAll(Form("%d", AliQAv1::kESDS), AliQAv1::GetTaskName(AliQAv1::kESDS)) ;    
        AliInfo( Form("QA will be done on \"%s\" for \"%s\"\n", fQADetectors.Data(), tempo.Data()) ) ;  
        fRunQA = kTRUE ;
        return kTRUE; 
@@ -3087,6 +3233,40 @@ Bool_t AliReconstruction::InitRecoParams()
 
   Bool_t isOK = kTRUE;
 
+  if (fRecoParam.GetDetRecoParamArray(kNDetectors)) {
+    AliInfo("Using custom GRP reconstruction parameters");
+  }
+  else {
+    AliInfo("Loading GRP reconstruction parameter objects");
+
+    AliCDBPath path("GRP","Calib","RecoParam");
+    AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath());
+    if(!entry){ 
+      AliWarning("Couldn't find GRP RecoParam entry in OCDB");
+      isOK = kFALSE;
+    }
+    else {
+      TObject *recoParamObj = entry->GetObject();
+      if (dynamic_cast<TObjArray*>(recoParamObj)) {
+       // GRP has a normal TobjArray of AliDetectorRecoParam objects
+       // Registering them in AliRecoParam
+       fRecoParam.AddDetRecoParamArray(kNDetectors,dynamic_cast<TObjArray*>(recoParamObj));
+      }
+      else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) {
+       // GRP has only onse set of reco parameters
+       // Registering it in AliRecoParam
+       AliInfo("Single set of GRP reconstruction parameters found");
+       dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault();
+       fRecoParam.AddDetRecoParam(kNDetectors,dynamic_cast<AliDetectorRecoParam*>(recoParamObj));
+      }
+      else {
+       AliError("No valid GRP RecoParam object found in the OCDB");
+       isOK = kFALSE;
+      }
+      entry->SetOwner(0);
+    }
+  }
+
   TString detStr = fLoadCDB;
   for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
 
@@ -3124,7 +3304,11 @@ Bool_t AliReconstruction::InitRecoParams()
        isOK = kFALSE;
       }
       entry->SetOwner(0);
-      AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
+      //      FIX ME: We have to disable the unloading of reco-param CDB
+      //      entries because QA framework is using them. Has to be fix in
+      //      a way that the QA takes the objects already constructed in
+      //      this method.
+      //      AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
     }
   }
 
@@ -3165,6 +3349,11 @@ Bool_t AliReconstruction::GetEventInfo()
     if (fRunLoader && (!fRunLoader->LoadTrigger())) {
       aCTP = fRunLoader->GetTrigger();
       fEventInfo.SetTriggerMask(aCTP->GetClassMask());
+      // get inputs from actp - just get
+      AliESDHeader* esdheader = fesd->GetHeader();
+      esdheader->SetL0TriggerInputs(aCTP->GetL0TriggerInputs());
+      esdheader->SetL1TriggerInputs(aCTP->GetL1TriggerInputs());
+      esdheader->SetL2TriggerInputs(aCTP->GetL2TriggerInputs());
       fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(aCTP->GetClusterMask()));
     }
     else {
@@ -3191,7 +3380,7 @@ Bool_t AliReconstruction::GetEventInfo()
       Int_t trindex = TMath::Nint(TMath::Log2(trclass->GetMask()));
       fesd->SetTriggerClass(trclass->GetName(),trindex);
       if (fRawReader) fRawReader->LoadTriggerClass(trclass->GetName(),trindex);
-      if (trmask & (1 << trindex)) {
+      if (trmask & (1ull << trindex)) {
        trclasses += " ";
        trclasses += trclass->GetName();
        trclasses += " ";