]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/src/AliHLTReconstructor.cxx
Important changes to the reconstructor classes. Complete elimination of the run-loade...
[u/mrichter/AliRoot.git] / HLT / src / AliHLTReconstructor.cxx
index f26c4bb99225e0c28c429690653a151dab8cbf48..ef331b3c8c39b02540a0bff2f9ecaad619543921 100644 (file)
@@ -12,9 +12,6 @@
 #include <TArrayF.h>
 #include <TObjString.h>
 
-#include <AliRunLoader.h>
-#include <AliHeader.h>
-#include <AliGenEventHeader.h>
 #include <AliESDEvent.h>
 #include <AliESDHLTtrack.h>
 
@@ -31,7 +28,6 @@
 #include "AliHLTTrackArray.h"
 
 #include "AliLog.h"
-#include "AliRun.h"
 #include "AliITS.h"
 #include "AliHLTITStracker.h"
 #include "AliHLTTPCtracker.h"
@@ -126,14 +122,9 @@ AliHLTReconstructor::~AliHLTReconstructor()
   fpSystem=NULL;
 }
 
-void AliHLTReconstructor::Init(AliRunLoader* runLoader)
+void AliHLTReconstructor::Init()
 {
   // init the reconstructor
-  if(!runLoader) {
-    AliError("Missing RunLoader! 0x0");
-    return;
-  }
-
   if (!fpSystem) fpSystem=new AliHLTSystem;
   if (!fpSystem) {
     AliError("can not create AliHLTSystem object");
@@ -188,258 +179,253 @@ void AliHLTReconstructor::Init(AliRunLoader* runLoader)
     AliError("error while loading HLT libraries");
     return;
   }
-  if (!fpSystem->CheckStatus(AliHLTSystem::kReady) &&
-      (fpSystem->Configure(runLoader))<0) {
-    AliError("error during HLT system configuration");
-    return;
-  }
-}
-
-void AliHLTReconstructor::Reconstruct(AliRunLoader* runLoader) const
-{
-  // reconstruction of simulated data
-  Reconstruct(runLoader, NULL);
+  // No run-loaders anymore...needs a fix
+//   if (!fpSystem->CheckStatus(AliHLTSystem::kReady) &&
+//       (fpSystem->Configure(runLoader))<0) {
+//     AliError("error during HLT system configuration");
+//     return;
+//   }
 }
 
-void AliHLTReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const 
-{
-  // reconstruction of real data if rawReader!=NULL
-  if(!runLoader) {
-    AliError("Missing RunLoader! 0x0");
-    return;
-  }
-
-  Int_t nEvents = runLoader->GetNumberOfEvents();
-  int iResult=0;
-
-  if (fpSystem) {
-    if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
-      AliError("HLT system in error state");
-      return;
-    }
-    if ((iResult=fpSystem->Reconstruct(nEvents, runLoader, rawReader))>=0) {
-    }
-  }
-}
-
-void AliHLTReconstructor::ReconstructWithConformalMapping(AliRunLoader* runLoader,Int_t iEvent) const
-{
-  // reconstruct with conformal mapper
-  /*
-  AliLevel3 *fHLT = new AliLevel3(runLoader);
-  fHLT->Init("./", AliLevel3::kRunLoader, 1);
-
-  Int_t phiSegments = 50;
-  Int_t etaSegments = 100;
-  Int_t trackletlength = 3;
-  Int_t tracklength = 10;
-  Int_t rowscopetracklet = 2;
-  Int_t rowscopetrack = 10;
-  Double_t minPtFit = 0;
-  Double_t maxangle = 0.1745;
-  Double_t goodDist = 5;
-  Double_t maxphi = 0.1;
-  Double_t maxeta = 0.1;
-  Double_t hitChi2Cut = 20;
-  Double_t goodHitChi2 = 5;
-  Double_t trackChi2Cut = 10;
-  Double_t xyerror = -1;
-  Double_t zerror =  -1;
+// void AliHLTReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const 
+// {
+//   // reconstruction of real data if rawReader!=NULL
+//   if(!runLoader) {
+//     AliError("Missing RunLoader! 0x0");
+//     return;
+//   }
+
+//   Int_t nEvents = runLoader->GetNumberOfEvents();
+//   int iResult=0;
+
+//   if (fpSystem) {
+//     if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+//       AliError("HLT system in error state");
+//       return;
+//     }
+//     if ((iResult=fpSystem->Reconstruct(nEvents, runLoader, rawReader))>=0) {
+//     }
+//   }
+// }
+
+// void AliHLTReconstructor::ReconstructWithConformalMapping(AliRunLoader* runLoader,Int_t iEvent) const
+// {
+//   // reconstruct with conformal mapper
+//   /*
+//   AliLevel3 *fHLT = new AliLevel3(runLoader);
+//   fHLT->Init("./", AliLevel3::kRunLoader, 1);
+
+//   Int_t phiSegments = 50;
+//   Int_t etaSegments = 100;
+//   Int_t trackletlength = 3;
+//   Int_t tracklength = 10;
+//   Int_t rowscopetracklet = 2;
+//   Int_t rowscopetrack = 10;
+//   Double_t minPtFit = 0;
+//   Double_t maxangle = 0.1745;
+//   Double_t goodDist = 5;
+//   Double_t maxphi = 0.1;
+//   Double_t maxeta = 0.1;
+//   Double_t hitChi2Cut = 20;
+//   Double_t goodHitChi2 = 5;
+//   Double_t trackChi2Cut = 10;
+//   Double_t xyerror = -1;
+//   Double_t zerror =  -1;
   
-  fHLT->SetClusterFinderParam(xyerror,zerror,kTRUE);
-  fHLT->SetTrackerParam(phiSegments, etaSegments, 
-                       trackletlength, tracklength,
-                       rowscopetracklet, rowscopetrack,
-                       minPtFit, maxangle, goodDist, hitChi2Cut,
-                       goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, kTRUE);
-  fHLT->SetTrackerParam(phiSegments, etaSegments, 
-                       trackletlength, tracklength,
-                       rowscopetracklet, rowscopetrack,
-                       minPtFit, maxangle, goodDist, hitChi2Cut,
-                       goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, kFALSE);
-  fHLT->SetMergerParameters(2,3,0.003,0.1,0.05);
-  fHLT->DoMc();
-  fHLT->DoNonVertexTracking(); // 2 tracking passes, last without vertex contraint.
-  fHLT->WriteFiles("./hlt/");  
-  fHLT->ProcessEvent(0, 35, iEvent);
-  if(fDoBench){
-    char filename[256];
-    sprintf(filename, "confmap_%d",iEvent);
-    fHLT->DoBench(filename);
-  }
-
-  delete fHLT;
-  */
-}
-
-void AliHLTReconstructor::ReconstructWithHoughTransform(AliRunLoader* runLoader,Int_t iEvent) const
-{
-  //reconstruct with hough
-  //not used anymore, Hough tracking is moved out of the local
-  //reconstruction chain
-  Float_t ptmin = 0.1*AliHLTTransform::GetSolenoidField();
-
-  Float_t zvertex = 0;
-  TArrayF mcVertex(3); 
-  AliHeader * header = runLoader->GetHeader();
-  if (header) {
-    AliGenEventHeader * genHeader = header->GenEventHeader();
-    if (genHeader) genHeader->PrimaryVertex(mcVertex);
-  }
-  zvertex = mcVertex[2];
-
-  AliInfo(Form("Hough Transform will run with ptmin=%f and zvertex=%f", ptmin, zvertex));
-
-  AliHLTHough *hough = new AliHLTHough();
+//   fHLT->SetClusterFinderParam(xyerror,zerror,kTRUE);
+//   fHLT->SetTrackerParam(phiSegments, etaSegments, 
+//                     trackletlength, tracklength,
+//                     rowscopetracklet, rowscopetrack,
+//                     minPtFit, maxangle, goodDist, hitChi2Cut,
+//                     goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, kTRUE);
+//   fHLT->SetTrackerParam(phiSegments, etaSegments, 
+//                     trackletlength, tracklength,
+//                     rowscopetracklet, rowscopetrack,
+//                     minPtFit, maxangle, goodDist, hitChi2Cut,
+//                     goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, kFALSE);
+//   fHLT->SetMergerParameters(2,3,0.003,0.1,0.05);
+//   fHLT->DoMc();
+//   fHLT->DoNonVertexTracking(); // 2 tracking passes, last without vertex contraint.
+//   fHLT->WriteFiles("./hlt/");  
+//   fHLT->ProcessEvent(0, 35, iEvent);
+//   if(fDoBench){
+//     char filename[256];
+//     sprintf(filename, "confmap_%d",iEvent);
+//     fHLT->DoBench(filename);
+//   }
+
+//   delete fHLT;
+//   */
+// }
+
+// void AliHLTReconstructor::ReconstructWithHoughTransform(AliRunLoader* runLoader,Int_t iEvent) const
+// {
+//   //reconstruct with hough
+//   //not used anymore, Hough tracking is moved out of the local
+//   //reconstruction chain
+//   Float_t ptmin = 0.1*AliHLTTransform::GetSolenoidField();
+
+//   Float_t zvertex = 0;
+//   TArrayF mcVertex(3); 
+//   AliHeader * header = runLoader->GetHeader();
+//   if (header) {
+//     AliGenEventHeader * genHeader = header->GenEventHeader();
+//     if (genHeader) genHeader->PrimaryVertex(mcVertex);
+//   }
+//   zvertex = mcVertex[2];
+
+//   AliInfo(Form("Hough Transform will run with ptmin=%f and zvertex=%f", ptmin, zvertex));
+
+//   AliHLTHough *hough = new AliHLTHough();
     
-  hough->SetThreshold(4);
-  hough->CalcTransformerParams(ptmin);
-  hough->SetPeakThreshold(70,-1);
-  hough->SetRunLoader(runLoader);
-  hough->Init("./", kFALSE, 100, kFALSE,4,0,0,zvertex);
-  hough->SetAddHistograms();
-
-  for(Int_t slice=0; slice<=35; slice++)
-    {
-      //cout<<"Processing slice "<<slice<<endl;
-      hough->ReadData(slice,iEvent);
-      hough->Transform();
-      hough->AddAllHistogramsRows();
-      hough->FindTrackCandidatesRow();
-      //hough->WriteTracks(slice,"./hough");
-      hough->AddTracks();
-    }
-  hough->WriteTracks("./hough");
+//   hough->SetThreshold(4);
+//   hough->CalcTransformerParams(ptmin);
+//   hough->SetPeakThreshold(70,-1);
+//   hough->SetRunLoader(runLoader);
+//   hough->Init("./", kFALSE, 100, kFALSE,4,0,0,zvertex);
+//   hough->SetAddHistograms();
+
+//   for(Int_t slice=0; slice<=35; slice++)
+//     {
+//       //cout<<"Processing slice "<<slice<<endl;
+//       hough->ReadData(slice,iEvent);
+//       hough->Transform();
+//       hough->AddAllHistogramsRows();
+//       hough->FindTrackCandidatesRow();
+//       //hough->WriteTracks(slice,"./hough");
+//       hough->AddTracks();
+//     }
+//   hough->WriteTracks("./hough");
   
-  if(fDoBench){
-    char filename[256];
-    sprintf(filename, "hough_%d",iEvent);
-    hough->DoBench(filename);
-  }
-  delete hough;
-}
-
-void AliHLTReconstructor::FillESD(AliRunLoader* runLoader, 
-                                 AliESDEvent* esd) const
-{
-  //fill the esd file with found tracks
-  if(!runLoader) {
-    AliError("Missing RunLoader! 0x0");
-    return;
-  }
-  Int_t iEvent = runLoader->GetEventNumber();
-  if (fpSystem) {
-    if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
-      AliError("HLT system in error state");
-      return;
-    }
-    if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
-      AliError("HLT system in wrong state");
-      return;
-    }
-    fpSystem->FillESD(iEvent, runLoader, esd);
-  }
-  /*
-  if(fDoTracker) FillESDforConformalMapping(esd,iEvent);
-  if(fDoHough) FillESDforHoughTransform(esd,iEvent);
-  */
-}
-
-void AliHLTReconstructor::FillESDforConformalMapping(AliESDEvent* esd,Int_t iEvent) const
-{
-  //fill esd with tracks from conformal mapping
-  /*
-  Int_t slicerange[2]={0,35};
-  Int_t good = (int)(0.4*AliHLTTransform::GetNRows());
-  Int_t nclusters = (int)(0.4*AliHLTTransform::GetNRows());
-  Int_t nminpointsontracks = (int)(0.3*AliHLTTransform::GetNRows());
-  Float_t ptmin = 0.;
-  Float_t ptmax = 0.;
-  Float_t maxfalseratio = 0.1;
+//   if(fDoBench){
+//     char filename[256];
+//     sprintf(filename, "hough_%d",iEvent);
+//     hough->DoBench(filename);
+//   }
+//   delete hough;
+// }
+
+// void AliHLTReconstructor::FillESD(AliRunLoader* runLoader, 
+//                               AliESDEvent* esd) const
+// {
+//   //fill the esd file with found tracks
+//   if(!runLoader) {
+//     AliError("Missing RunLoader! 0x0");
+//     return;
+//   }
+//   Int_t iEvent = runLoader->GetEventNumber();
+//   if (fpSystem) {
+//     if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+//       AliError("HLT system in error state");
+//       return;
+//     }
+//     if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
+//       AliError("HLT system in wrong state");
+//       return;
+//     }
+//     fpSystem->FillESD(iEvent, runLoader, esd);
+//   }
+//   /*
+//   if(fDoTracker) FillESDforConformalMapping(esd,iEvent);
+//   if(fDoHough) FillESDforHoughTransform(esd,iEvent);
+//   */
+// }
+
+// void AliHLTReconstructor::FillESDforConformalMapping(AliESDEvent* esd,Int_t iEvent) const
+// {
+//   //fill esd with tracks from conformal mapping
+//   /*
+//   Int_t slicerange[2]={0,35};
+//   Int_t good = (int)(0.4*AliHLTTransform::GetNRows());
+//   Int_t nclusters = (int)(0.4*AliHLTTransform::GetNRows());
+//   Int_t nminpointsontracks = (int)(0.3*AliHLTTransform::GetNRows());
+//   Float_t ptmin = 0.;
+//   Float_t ptmax = 0.;
+//   Float_t maxfalseratio = 0.1;
   
-  AliHLTEvaluate *fHLTEval = new AliHLTEvaluate("./hlt",nclusters,good,ptmin,ptmax,slicerange);
-  fHLTEval->SetMaxFalseClusters(maxfalseratio);
-  fHLTEval->LoadData(iEvent,kTRUE);
-  fHLTEval->AssignPIDs();
-  fHLTEval->AssignIDs();
-  AliHLTTrackArray *fTracks = fHLTEval->GetTracks();
-  if(!fTracks){
-    delete fHLTEval;
-    return;
-  }
-  for(Int_t i=0; i<fTracks->GetNTracks(); i++)
-    {
-      AliHLTTrack *tpt = (AliHLTTrack *)fTracks->GetCheckedTrack(i);
-      if(!tpt) continue; 
-      if(tpt->GetNumberOfPoints() < nminpointsontracks) continue;
+//   AliHLTEvaluate *fHLTEval = new AliHLTEvaluate("./hlt",nclusters,good,ptmin,ptmax,slicerange);
+//   fHLTEval->SetMaxFalseClusters(maxfalseratio);
+//   fHLTEval->LoadData(iEvent,kTRUE);
+//   fHLTEval->AssignPIDs();
+//   fHLTEval->AssignIDs();
+//   AliHLTTrackArray *fTracks = fHLTEval->GetTracks();
+//   if(!fTracks){
+//     delete fHLTEval;
+//     return;
+//   }
+//   for(Int_t i=0; i<fTracks->GetNTracks(); i++)
+//     {
+//       AliHLTTrack *tpt = (AliHLTTrack *)fTracks->GetCheckedTrack(i);
+//       if(!tpt) continue; 
+//       if(tpt->GetNumberOfPoints() < nminpointsontracks) continue;
       
-      AliESDHLTtrack *esdtrack = new AliESDHLTtrack() ; 
-
-      esdtrack->SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow());
-      esdtrack->SetNHits(tpt->GetNHits());
-      esdtrack->SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ());
-      esdtrack->SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ());
-      esdtrack->SetPt(tpt->GetPt());
-      esdtrack->SetPsi(tpt->GetPsi());
-      esdtrack->SetTgl(tpt->GetTgl());
-      esdtrack->SetCharge(tpt->GetCharge());
-      esdtrack->SetMCid(tpt->GetMCid());
-      esdtrack->SetSector(tpt->GetSector());
-      esdtrack->SetPID(tpt->GetPID());
-      esdtrack->ComesFromMainVertex(tpt->ComesFromMainVertex());
-
-      esd->AddHLTConfMapTrack(esdtrack);
-      delete esdtrack;
-    }
-  delete fHLTEval;
-  */
-}
-
-void AliHLTReconstructor::FillESDforHoughTransform(AliESDEvent* esd,Int_t iEvent) const
-{
-  //fill esd with tracks from hough
-  char filename[256];
-  sprintf(filename,"./hough/tracks_%d.raw",iEvent);
+//       AliESDHLTtrack *esdtrack = new AliESDHLTtrack() ; 
+
+//       esdtrack->SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow());
+//       esdtrack->SetNHits(tpt->GetNHits());
+//       esdtrack->SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ());
+//       esdtrack->SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ());
+//       esdtrack->SetPt(tpt->GetPt());
+//       esdtrack->SetPsi(tpt->GetPsi());
+//       esdtrack->SetTgl(tpt->GetTgl());
+//       esdtrack->SetCharge(tpt->GetCharge());
+//       esdtrack->SetMCid(tpt->GetMCid());
+//       esdtrack->SetSector(tpt->GetSector());
+//       esdtrack->SetPID(tpt->GetPID());
+//       esdtrack->ComesFromMainVertex(tpt->ComesFromMainVertex());
+
+//       esd->AddHLTConfMapTrack(esdtrack);
+//       delete esdtrack;
+//     }
+//   delete fHLTEval;
+//   */
+// }
+
+// void AliHLTReconstructor::FillESDforHoughTransform(AliESDEvent* esd,Int_t iEvent) const
+// {
+//   //fill esd with tracks from hough
+//   char filename[256];
+//   sprintf(filename,"./hough/tracks_%d.raw",iEvent);
   
-  AliHLTFileHandler *tfile = new AliHLTFileHandler();
-  if(!tfile->SetBinaryInput(filename)){
-    AliError(Form("Missing file %s", filename));
-    return;
-  }
+//   AliHLTFileHandler *tfile = new AliHLTFileHandler();
+//   if(!tfile->SetBinaryInput(filename)){
+//     AliError(Form("Missing file %s", filename));
+//     return;
+//   }
   
-  AliHLTTrackArray *fTracks = new AliHLTTrackArray("AliHLTHoughTrack");
-  tfile->Binary2TrackArray(fTracks);
-  tfile->CloseBinaryInput();
-  delete tfile;
-  if(!fTracks) return; 
-  for(Int_t i=0; i<fTracks->GetNTracks(); i++)
-    {
-      AliHLTHoughTrack *tpt = (AliHLTHoughTrack *)fTracks->GetCheckedTrack(i);
-      if(!tpt) continue; 
+//   AliHLTTrackArray *fTracks = new AliHLTTrackArray("AliHLTHoughTrack");
+//   tfile->Binary2TrackArray(fTracks);
+//   tfile->CloseBinaryInput();
+//   delete tfile;
+//   if(!fTracks) return; 
+//   for(Int_t i=0; i<fTracks->GetNTracks(); i++)
+//     {
+//       AliHLTHoughTrack *tpt = (AliHLTHoughTrack *)fTracks->GetCheckedTrack(i);
+//       if(!tpt) continue; 
       
-      AliESDHLTtrack *esdtrack = new AliESDHLTtrack() ; 
-
-      esdtrack->SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow());
-      esdtrack->SetNHits(tpt->GetNHits());
-      esdtrack->SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ());
-      esdtrack->SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ());
-      esdtrack->SetPt(tpt->GetPt());
-      esdtrack->SetPsi(tpt->GetPsi());
-      esdtrack->SetTgl(tpt->GetTgl());
-      esdtrack->SetCharge(tpt->GetCharge());
-      esdtrack->SetMCid(tpt->GetMCid());
-      esdtrack->SetWeight(tpt->GetWeight());
-      esdtrack->SetSector(tpt->GetSector());
-      esdtrack->SetBinXY(tpt->GetBinX(),tpt->GetBinY(),tpt->GetSizeX(),tpt->GetSizeY());
-      esdtrack->SetPID(tpt->GetPID());
-      esdtrack->ComesFromMainVertex(tpt->ComesFromMainVertex());
-
-      esd->AddHLTHoughTrack(esdtrack);
-      delete esdtrack;
-    }
-
-  delete fTracks;
-}
+//       AliESDHLTtrack *esdtrack = new AliESDHLTtrack() ; 
+
+//       esdtrack->SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow());
+//       esdtrack->SetNHits(tpt->GetNHits());
+//       esdtrack->SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ());
+//       esdtrack->SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ());
+//       esdtrack->SetPt(tpt->GetPt());
+//       esdtrack->SetPsi(tpt->GetPsi());
+//       esdtrack->SetTgl(tpt->GetTgl());
+//       esdtrack->SetCharge(tpt->GetCharge());
+//       esdtrack->SetMCid(tpt->GetMCid());
+//       esdtrack->SetWeight(tpt->GetWeight());
+//       esdtrack->SetSector(tpt->GetSector());
+//       esdtrack->SetBinXY(tpt->GetBinX(),tpt->GetBinY(),tpt->GetSizeX(),tpt->GetSizeY());
+//       esdtrack->SetPID(tpt->GetPID());
+//       esdtrack->ComesFromMainVertex(tpt->ComesFromMainVertex());
+
+//       esd->AddHLTHoughTrack(esdtrack);
+//       delete esdtrack;
+//     }
+
+//   delete fTracks;
+// }
 
 /* The following functions are deprecated and need to be removed.
 AliTracker* AliHLTReconstructor::CreateTracker(AliRunLoader* runLoader) const