// //
///////////////////////////////////////////////////////////////////////////////
-
#include <TStopwatch.h>
-#include "AliL3StandardIncludes.h"
-#include "AliL3Logging.h"
-#include "AliL3Transform.h"
-#include "AliL3Hough.h"
+#include "AliHLTStandardIncludes.h"
+#include "AliHLTLogging.h"
+#include "AliHLTTransform.h"
+#include "AliHLTHough.h"
#include "AliLog.h"
+#include <AliHLTITSclusterer.h>
+#include <AliHLTITSVertexerZ.h>
+#include <AliHLTITStracker.h>
#include "AliHoughFilter.h"
+#include "AliRawReaderRoot.h"
+#include <AliMagF.h>
+#include <AliKalmanTrack.h>
+#include <AliITSgeom.h>
+#include <AliESDVertex.h>
ClassImp(AliHoughFilter)
//_____________________________________________________________________________
-AliHoughFilter::AliHoughFilter()
+AliHoughFilter::AliHoughFilter():
+fPtmin(0),
+fITSgeom(NULL)
{
// default constructor
- AliL3Log::fgLevel = AliL3Log::kError;
- if (AliDebugLevel() > 0) AliL3Log::fgLevel = AliL3Log::kWarning;
- if (AliDebugLevel() > 1) AliL3Log::fgLevel = AliL3Log::kInformational;
- if (AliDebugLevel() > 2) AliL3Log::fgLevel = AliL3Log::kDebug;
- if (!AliL3Transform::Init("./", kFALSE)) {
+ // Init debug level
+ AliHLTLog::fgLevel = AliHLTLog::kError;
+ if (AliDebugLevel() > 0) AliHLTLog::fgLevel = AliHLTLog::kWarning;
+ if (AliDebugLevel() > 1) AliHLTLog::fgLevel = AliHLTLog::kInformational;
+ if (AliDebugLevel() > 2) AliHLTLog::fgLevel = AliHLTLog::kDebug;
+
+ // Init TPC HLT geometry
+ const char *path = gSystem->Getenv("ALICE_ROOT");
+ Char_t pathname[1024];
+ strcpy(pathname,path);
+ strcat(pathname,"/HLT/src");
+ if (!AliHLTTransform::Init(pathname, kFALSE))
AliError("HLT initialization failed!");
- }
+
+ // Init magnetic field
+ AliMagF* field = (AliMagF*)TGeoGlobalMagField::Instance();
+ AliTracker::SetFieldMap(field,kTRUE);
+ fPtmin = 0.1*AliHLTTransform::GetSolenoidField();
+
+ // Init ITS geometry
+ fITSgeom = new AliITSgeom();
+ fITSgeom->ReadNewFile("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det");
+ if (!fITSgeom)
+ AliError("ITS geometry not found!");
+
+ // Init PID
+ AliPID pid;
+}
+
+//_____________________________________________________________________________
+Bool_t AliHoughFilter::Filter(AliRawVEvent* event, AliESDEvent* esd)
+{
+ // Run fast online reconstruction
+ // based on the HLT tracking algorithms
+
+ TStopwatch globaltimer;
+ globaltimer.Start();
+
+ TStopwatch timer;
+ timer.Start();
+
+ TTree *treeITSclusters = new TTree("TreeL3ITSclusters"," "); //make a tree
+ treeITSclusters->SetDirectory(0);
+
+ RunITSclusterer(event,treeITSclusters);
+ RunITSvertexer(esd,treeITSclusters);
+ RunTPCtracking(event,esd);
+ RunITStracking(esd,treeITSclusters);
+ delete treeITSclusters;
+
+ AliInfo(Form("Event filter has finished in %f seconds\n\n\n\n\n\n",globaltimer.RealTime()));
+
+ return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliHoughFilter::Filter(AliRawEvent* event, AliESD* esd)
+void AliHoughFilter::RunITSclusterer(AliRawVEvent* event, TTree *treeClusters)
{
-// TPC hough transformation
+ // Run ITS Clusterer
+ // The clusters are stored in a tree
TStopwatch timer;
timer.Start();
- Float_t ptmin = 0.1*AliL3Transform::GetSolenoidField();
+ AliHLTITSclusterer clusterer(0);
+ AliRawReader *itsrawreader=new AliRawReaderRoot(event);
+ clusterer.Digits2Clusters(itsrawreader,treeClusters);
+ delete itsrawreader;
+ AliInfo(Form("ITS clusterer has finished in %f seconds\n",timer.RealTime()));
+
+}
+
+
+//_____________________________________________________________________________
+void AliHoughFilter::RunITSvertexer(AliESDEvent* esd, TTree *treeClusters)
+{
+ // Run SPD vertexerZ
+ // Store the result in the ESD
- AliL3Hough *hough1 = new AliL3Hough();
+ TStopwatch timer;
+ timer.Start();
+
+ AliHLTITSVertexerZ vertexer;
+ AliESDVertex *vertex = vertexer.FindVertexForCurrentEvent(fITSgeom,treeClusters);
+ esd->SetVertex(vertex);
+ AliInfo(Form("ITS vertexer has finished in %f seconds\n",timer.RealTime()));
+
+}
+
+//_____________________________________________________________________________
+void AliHoughFilter::RunTPCtracking(AliRawVEvent* event, AliESDEvent* esd)
+{
+ // Run hough transform tracking in TPC
+ // The z of the vertex is taken from the ESD
+ // The result of the tracking is stored in the ESD
+ TStopwatch timer;
+ timer.Start();
+
+ const AliESDVertex *vertex = esd->GetVertex();
+ Float_t zvertex = vertex->GetZv();
+
+ AliHLTHough *hough1 = new AliHLTHough();
hough1->SetThreshold(4);
- hough1->CalcTransformerParams(ptmin);
+ hough1->CalcTransformerParams(fPtmin);
hough1->SetPeakThreshold(70,-1);
- // Attention Z of the vertex to be taken from the event head!
- // So far for debug purposes it is fixed by hand...
- hough1->Init(100,4,event,3.82147);
+ hough1->Init(100,4,event,zvertex);
hough1->SetAddHistograms();
- AliL3Hough *hough2 = new AliL3Hough();
-
+ AliHLTHough *hough2 = new AliHLTHough();
+
hough2->SetThreshold(4);
- hough2->CalcTransformerParams(ptmin);
+ hough2->CalcTransformerParams(fPtmin);
hough2->SetPeakThreshold(70,-1);
- hough2->Init(100,4,event,3.82147);
+ hough2->Init(100,4,event,zvertex);
hough2->SetAddHistograms();
Int_t nglobaltracks = 0;
hough2->StartProcessInThread(18,35);
if(hough1->WaitForThreadFinish())
- AliFatal(" Can not join the required thread! ");
+ ::Fatal("AliHLTHough::WaitForThreadFinish"," Can not join the required thread! ");
if(hough2->WaitForThreadFinish())
- AliFatal(" Can not join the required thread! ");
-
- /* In case we run HLT code in the main thread
- for(Int_t slice=0; slice<=17; slice++)
- {
- hough1->ReadData(slice,0);
- hough1->Transform();
- hough1->AddAllHistogramsRows();
- hough1->FindTrackCandidatesRow();
- hough1->AddTracks();
- }
- for(Int_t slice=18; slice<=35; slice++)
- {
- hough2->ReadData(slice,0);
- hough2->Transform();
- hough2->AddAllHistogramsRows();
- hough2->FindTrackCandidatesRow();
- hough2->AddTracks();
- }
- */
+ ::Fatal("AliHLTHough::WaitForThreadFinish"," Can not join the required thread! ");
+
+ /* In case we run HLT code in the main thread
+ for(Int_t slice=0; slice<=17; slice++)
+ {
+ hough1->ReadData(slice,0);
+ hough1->Transform();
+ hough1->AddAllHistogramsRows();
+ hough1->FindTrackCandidatesRow();
+ hough1->AddTracks();
+ }
+ for(Int_t slice=18; slice<=35; slice++)
+ {
+ hough2->ReadData(slice,0);
+ hough2->Transform();
+ hough2->AddAllHistogramsRows();
+ hough2->FindTrackCandidatesRow();
+ hough2->AddTracks();
+ }
+ */
nglobaltracks += hough1->FillESD(esd);
nglobaltracks += hough2->FillESD(esd);
- /* In case we want to debug the ESD
- gSystem->MakeDirectory("hough1");
- hough1->WriteTracks("./hough1");
- gSystem->MakeDirectory("hough2");
- hough2->WriteTracks("./hough2");
- */
+ /* In case we want to debug the ESD
+ gSystem->MakeDirectory("hough1");
+ hough1->WriteTracks("./hough1");
+ gSystem->MakeDirectory("hough2");
+ hough2->WriteTracks("./hough2");
+ */
delete hough1;
delete hough2;
- printf("Filter has found %d TPC tracks in %f seconds\n", nglobaltracks,timer.RealTime());
+ AliInfo(Form("\nHough Transformer has found %d TPC tracks in %f seconds\n\n", nglobaltracks,timer.RealTime()));
+
+}
+
+//_____________________________________________________________________________
+void AliHoughFilter::RunITStracking(AliESDEvent* esd, TTree *treeClusters)
+{
+ // Run the ITS tracker
+ // The tracks from the HT TPC tracking are used as seeds
+ // The prologated tracks are updated in the ESD
+ TStopwatch timer;
+ timer.Start();
+
+ Double_t vtxPos[3];
+ Double_t vtxErr[3]={0.005,0.005,0.010};
+ const AliESDVertex *vertex = esd->GetVertex();
+ vertex->GetXYZ(vtxPos);
+
+ AliHLTITStracker itsTracker(0);
+ itsTracker.SetVertex(vtxPos,vtxErr);
+
+ itsTracker.LoadClusters(treeClusters);
+ itsTracker.Clusters2Tracks(esd);
+ itsTracker.UnloadClusters();
+ AliInfo(Form("ITS tracker has finished in %f seconds\n",timer.RealTime()));
- return kFALSE;
}