// //
// class for HLT reconstruction //
// <Cvetan.Cheshkov@cern.ch> //
+// <loizides@ikf.uni-frankfurt.de> //
///////////////////////////////////////////////////////////////////////////////
// very ugly but it has to work fast
#include <TSystem.h>
#include <TArrayF.h>
+#include <AliRunLoader.h>
+#include <AliHeader.h>
+#include <AliGenEventHeader.h>
+#include <AliESD.h>
+#include <AliESDHLTtrack.h>
+
#include "AliL3StandardIncludes.h"
#include "AliL3Logging.h"
#include "AliLevel3.h"
#include "AliL3Track.h"
#include "AliL3HoughTrack.h"
#include "AliL3TrackArray.h"
-#include "AliRunLoader.h"
-#include "AliHeader.h"
-#include "AliGenEventHeader.h"
-#include "AliESD.h"
-#include "AliESDHLTtrack.h"
+
+#include "AliRun.h"
+#include "AliITS.h"
+#include "AliITSgeom.h"
+#include "AliL3ITStracker.h"
+#include "AliL3TPCtracker.h"
+#include "MUON/src/AliRoot/AliHLTMUONTracker.h"
#if __GNUC__== 3
using namespace std;
ClassImp(AliHLTReconstructor)
+AliHLTReconstructor::AliHLTReconstructor(): AliReconstructor()
+{
+ //constructor
+#ifndef use_logging
+ AliL3Log::fgLevel=AliL3Log::kWarning;
+#endif
+ fDoTracker=1;
+ fDoHough=0;
+ fDoBench=0;
+ fDoCleanUp=1;
+}
+
+AliHLTReconstructor::AliHLTReconstructor(Bool_t doTracker, Bool_t doHough): AliReconstructor()
+{
+ //constructor
+#ifndef use_logging
+ AliL3Log::fgLevel=AliL3Log::kWarning;
+#endif
+ fDoTracker=doTracker;
+ fDoHough=doHough;
+ fDoBench=0;
+ fDoCleanUp=1;
+}
+
+AliHLTReconstructor::~AliHLTReconstructor()
+{
+ //deconstructor
+ if(fDoCleanUp){
+ char name[256];
+ gSystem->Exec("rm -rf hlt");
+ sprintf(name, "rm -f confmap_*.root confmap_*.dat");
+ gSystem->Exec(name);
+ gSystem->Exec("rm -rf hough");
+ sprintf(name, "rm -f hough_*.root hough_*.dat");
+ gSystem->Exec(name);
+ }
+}
+
void AliHLTReconstructor::Reconstruct(AliRunLoader* runLoader) const
{
+ // do the standard and hough reconstruction chain
if(!runLoader) {
LOG(AliL3Log::kFatal,"AliHLTReconstructor::Reconstruct","RunLoader")
<<" Missing RunLoader! 0x0"<<ENDLOG;
Bool_t isinit=AliL3Transform::Init(runLoader);
if(!isinit){
- cerr << "Could not create transform settings, please check log for error messages!" << endl;
+ LOG(AliL3Log::kError,"AliHLTReconstructor::Reconstruct","Transformer")
+ << "Could not create transform settings, please check log for error messages!" << ENDLOG;
return;
}
for(Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
runLoader->GetEvent(iEvent);
- ReconstructWithConformalMapping(runLoader,iEvent);
- ReconstructWithHoughTransform(runLoader,iEvent);
+ if(fDoTracker) ReconstructWithConformalMapping(runLoader,iEvent);
+ if(fDoHough) ReconstructWithHoughTransform(runLoader,iEvent);
}
}
void AliHLTReconstructor::ReconstructWithConformalMapping(AliRunLoader* runLoader,Int_t iEvent) const
{
+ // reconstruct with conformal mapper
AliLevel3 *fHLT = new AliLevel3(runLoader);
fHLT->Init("./", AliLevel3::kRunLoader, 1);
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);
-
- char filename[256];
- sprintf(filename, "confmap_%d",iEvent);
- fHLT->DoBench(filename);
+ 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*AliL3Transform::GetSolenoidField();
Float_t zvertex = 0;
TArrayF mcVertex(3);
- runLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex);
+ AliHeader * header = runLoader->GetHeader();
+ if (header) {
+ AliGenEventHeader * genHeader = header->GenEventHeader();
+ if (genHeader) genHeader->PrimaryVertex(mcVertex);
+ }
zvertex = mcVertex[2];
- cout<<" Hough Tranform will run with ptmin="<<ptmin<<" and zvertex="<<zvertex<<endl;
+ LOG(AliL3Log::kInformational,"AliHLTReconstructor::Reconstruct","HoughTransform")
+ <<" Hough Transform will run with ptmin="<<ptmin<<" and zvertex="<<zvertex<<ENDLOG;
AliL3Hough *hough = new AliL3Hough();
hough->SetThreshold(4);
- hough->SetTransformerParams(76,140,ptmin,-1);
+ hough->CalcTransformerParams(ptmin);
hough->SetPeakThreshold(70,-1);
hough->SetRunLoader(runLoader);
hough->Init("./", kFALSE, 100, kFALSE,4,0,0,zvertex);
hough->SetAddHistograms();
- for(int slice=0; slice<=35; slice++)
+ for(Int_t slice=0; slice<=35; slice++)
{
- // cout<<"Processing slice "<<slice<<endl;
+ //cout<<"Processing slice "<<slice<<endl;
hough->ReadData(slice,iEvent);
hough->Transform();
hough->AddAllHistogramsRows();
hough->FindTrackCandidatesRow();
- // hough->WriteTracks(slice,"./hough");
+ //hough->WriteTracks(slice,"./hough");
hough->AddTracks();
}
hough->WriteTracks("./hough");
- char filename[256];
- sprintf(filename, "hough_%d",iEvent);
- hough->DoBench(filename);
-
+ if(fDoBench){
+ char filename[256];
+ sprintf(filename, "hough_%d",iEvent);
+ hough->DoBench(filename);
+ }
delete hough;
}
void AliHLTReconstructor::FillESD(AliRunLoader* runLoader,
AliESD* esd) const
{
+ //fill the esd file with found tracks
Int_t iEvent = runLoader->GetEventNumber();
- FillESDforConformalMapping(esd,iEvent);
- FillESDforHoughTransform(esd,iEvent);
+ if(fDoTracker) FillESDforConformalMapping(esd,iEvent);
+ if(fDoHough) FillESDforHoughTransform(esd,iEvent);
}
void AliHLTReconstructor::FillESDforConformalMapping(AliESD* esd,Int_t iEvent) const
{
- //Assign MC labels for found tracks
- int slicerange[2]={0,35};
- int good = (int)(0.4*AliL3Transform::GetNRows());
- int nclusters = (int)(0.4*AliL3Transform::GetNRows());
- float ptmin = 0.;
- float ptmax = 0.;
- float maxfalseratio = 0.1;
+ //fill esd with tracks from conformal mapping
+ Int_t slicerange[2]={0,35};
+ Int_t good = (int)(0.4*AliL3Transform::GetNRows());
+ Int_t nclusters = (int)(0.4*AliL3Transform::GetNRows());
+ Int_t nminpointsontracks = (int)(0.3*AliL3Transform::GetNRows());
+ Float_t ptmin = 0.;
+ Float_t ptmax = 0.;
+ Float_t maxfalseratio = 0.1;
AliL3Evaluate *fHLTEval = new AliL3Evaluate("./hlt",nclusters,good,ptmin,ptmax,slicerange);
fHLTEval->SetMaxFalseClusters(maxfalseratio);
-
fHLTEval->LoadData(iEvent,kTRUE);
fHLTEval->AssignPIDs();
fHLTEval->AssignIDs();
AliL3TrackArray *fTracks = fHLTEval->GetTracks();
+ if(!fTracks){
+ delete fHLTEval;
+ return;
+ }
for(Int_t i=0; i<fTracks->GetNTracks(); i++)
{
AliL3Track *tpt = (AliL3Track *)fTracks->GetCheckedTrack(i);
if(!tpt) continue;
+ if(tpt->GetNumberOfPoints() < nminpointsontracks) continue;
AliESDHLTtrack *esdtrack = new AliESDHLTtrack() ;
esd->AddHLTConfMapTrack(esdtrack);
delete esdtrack;
}
-
delete fHLTEval;
}
void AliHLTReconstructor::FillESDforHoughTransform(AliESD* esd,Int_t iEvent) const
{
+ //fill esd with tracks from hough
char filename[256];
sprintf(filename,"./hough/tracks_%d.raw",iEvent);
AliL3FileHandler *tfile = new AliL3FileHandler();
if(!tfile->SetBinaryInput(filename)){
- Error("FillESD","Inputfile ",filename," does not exist");
+ LOG(AliL3Log::kError,"AliHLTReconstructor::FillESDforHoughTransform","Input file")
+ <<" Missing file "<<filename<<ENDLOG;
return;
}
tfile->Binary2TrackArray(fTracks);
tfile->CloseBinaryInput();
delete tfile;
-
+ if(!fTracks) return;
for(Int_t i=0; i<fTracks->GetNTracks(); i++)
{
AliL3HoughTrack *tpt = (AliL3HoughTrack *)fTracks->GetCheckedTrack(i);
delete fTracks;
}
+AliTracker* AliHLTReconstructor::CreateTracker(AliRunLoader* runLoader) const
+{
+ //Create HLT trackers for TPC and ITS
+
+ TString opt = GetOption();
+ if(!opt.CompareTo("TPC")) {
+ // Create Hough tracker for TPC
+ return new AliL3TPCtracker(runLoader);
+ }
+ if(!opt.CompareTo("ITS")) {
+ // Create ITS tracker
+ AliITSgeom* geom = GetITSgeom(runLoader);
+ if (!geom) return NULL;
+ return new AliL3ITStracker(geom);
+ }
+ if(!opt.CompareTo("MUON")) {
+ return new AliHLTMUONTracker(runLoader);
+ }
+
+ return NULL;
+}
+
+//_____________________________________________________________________________
+AliITSgeom* AliHLTReconstructor::GetITSgeom(AliRunLoader* runLoader) const
+{
+// get the ITS geometry
+
+ if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
+ if (!runLoader->GetAliRun()) {
+ Error("GetITSgeom", "couldn't get AliRun object");
+ return NULL;
+ }
+ AliITS* its = (AliITS*) runLoader->GetAliRun()->GetDetector("ITS");
+ if (!its) {
+ Error("GetITSgeom", "couldn't get ITS detector");
+ return NULL;
+ }
+ if (!its->GetITSgeom()) {
+ Error("GetITSgeom", "no ITS geometry available");
+ return NULL;
+ }
+ return its->GetITSgeom();
+}
+
#endif