X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDReconstructor.cxx;h=6b1e018467bb25f738b8a01e57bf294ca9bd5316;hb=9a838fb778f46ceb900c62c1c1c9480dcdfcae5a;hp=6ef49234b4d7700fbf4e8296286a26a03480d899;hpb=0397ce53da53fd10fab96b997d49b7de67994c11;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDReconstructor.cxx b/TRD/AliTRDReconstructor.cxx index 6ef49234b4d..6b1e018467b 100644 --- a/TRD/AliTRDReconstructor.cxx +++ b/TRD/AliTRDReconstructor.cxx @@ -1,112 +1,322 @@ /************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ +* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * +* * +* Author: The ALICE Off-line Project. * +* Contributors are mentioned in the code where appropriate. * +* * +* Permission to use, copy, modify and distribute this software and its * +* documentation strictly for non-commercial purposes is hereby granted * +* without fee, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission notice * +* appear in the supporting documentation. The authors make no claims * +* about the suitability of this software for any purpose. It is * +* provided "as is" without express or implied warranty. * +**************************************************************************/ /* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // -// class for TRD reconstruction // +// Class for TRD reconstruction // +// // +// For the special options which can be used during reconstruction and their // +// default values pls. see function SetOption(). // // // /////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include -#include "AliTRDReconstructor.h" -#include "AliRunLoader.h" -#include "AliTRDclusterizerV1.h" -#include "AliTRDtracker.h" -#include "AliTRDpidESD.h" -#include #include "AliRawReader.h" -#include "AliLog.h" + +#include "AliTRDReconstructor.h" +#include "AliTRDclusterizer.h" +#include "AliTRDrawData.h" +#include "AliTRDrawStreamBase.h" +#include "AliTRDdigitsManager.h" +#include "AliTRDtrackerV1.h" + +#define SETFLG(n,f) ((n) |= f) +#define CLRFLG(n,f) ((n) &= ~f) ClassImp(AliTRDReconstructor) +TClonesArray *AliTRDReconstructor::fgClusters = NULL; +TClonesArray *AliTRDReconstructor::fgTracklets = NULL; +Char_t const * AliTRDReconstructor::fgSteerNames[kNsteer] = { + "DigitsConversion " + ,"Write Clusters " + ,"Write Online Tracklets " + ,"Stand Alone Tracking " + ,"HLT Mode " + ,"Process Online Trklts " + ,"Debug Streaming " + ,"Cl. Radial Correction " +}; +Char_t const * AliTRDReconstructor::fgSteerFlags[kNsteer] = { + "dc"// digits conversion [false] + ,"cw"// write clusters [true] + ,"tw"// write online tracklets [false] + ,"sa"// track seeding (stand alone tracking) [true] + ,"hlt"// HLT reconstruction [false] + ,"tp"// also use online tracklets for reconstruction [false] + ,"deb"// Write debug stream [false] + ,"cc" // Cluster radial correction during reconstruction [false] +}; +Char_t const * AliTRDReconstructor::fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks] = { + "Clusterizer" + ,"Tracker" + ,"PID" +}; +Char_t const * AliTRDReconstructor::fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks] = { + "cl" + ,"tr" + ,"pd" +}; +Int_t AliTRDReconstructor::fgNTimeBins = -1; +const Float_t AliTRDReconstructor::fgkMinClustersInTrack = 0.5; // +const Float_t AliTRDReconstructor::fgkLabelFraction = 0.8; // +const Double_t AliTRDReconstructor::fgkMaxChi2 = 12.0; // +const Double_t AliTRDReconstructor::fgkMaxSnp = 0.95; // Maximum local sine of the azimuthal angle +const Double_t AliTRDReconstructor::fgkMaxStep = 2.0; // Maximal step size in propagation +const Double_t AliTRDReconstructor::fgkEpsilon = 1.e-5; // Precision of radial coordinate -Bool_t AliTRDReconstructor::fgkSeedingOn = kFALSE; +//_____________________________________________________________________________ +AliTRDReconstructor::AliTRDReconstructor() + :AliReconstructor() + ,fSteerParam(0) + ,fClusterizer(NULL) +{ + // setting default "ON" steering parameters + // owner of debug streamers + SETFLG(fSteerParam, kOwner); + // write clusters [cw] + SETFLG(fSteerParam, kWriteClusters); + // track seeding (stand alone tracking) [sa] + SETFLG(fSteerParam, kSeeding); + // Cluster radial correction during reconstruction [cc] + //SETFLG(fSteerParam, kClRadialCorr); + memset(fDebugStream, 0, sizeof(TTreeSRedirector *) * AliTRDrecoParam::kTRDreconstructionTasks); +} //_____________________________________________________________________________ -void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader) const +AliTRDReconstructor::~AliTRDReconstructor() { -// reconstruct clusters + // + // Destructor + // + + if(fgClusters) { + fgClusters->Delete(); + delete fgClusters; + fgClusters = NULL; + } + if(fgTracklets) { + fgTracklets->Delete(); + delete fgTracklets; + fgTracklets = NULL; + } + if(fSteerParam&kOwner){ + for(Int_t itask = 0; itask < AliTRDrecoParam::kTRDreconstructionTasks; itask++) + if(fDebugStream[itask]) delete fDebugStream[itask]; + } + if(fClusterizer){ + delete fClusterizer; + fClusterizer = NULL; + } +} - AliLoader *loader=runLoader->GetLoader("TRDLoader"); - loader->LoadRecPoints("recreate"); - AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer"); - runLoader->CdGAFile(); - Int_t nEvents = runLoader->GetNumberOfEvents(); +//_____________________________________________________________________________ +void AliTRDReconstructor::Init(){ + // + // Init Options + // + SetOption(GetOption()); + Options(fSteerParam); - for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { - clusterer.Open(runLoader->GetFileName(), iEvent); - clusterer.ReadDigits(); - clusterer.MakeClusters(); - clusterer.WriteClusters(-1); + if(!fClusterizer){ + fClusterizer = new AliTRDclusterizer(fgTaskNames[AliTRDrecoParam::kClusterizer], fgTaskNames[AliTRDrecoParam::kClusterizer]); + fClusterizer->SetReconstructor(this); + } + + // Make Debug Streams when Debug Streaming + if(IsDebugStreaming()){ + for(Int_t task = 0; task < AliTRDrecoParam::kTRDreconstructionTasks; task++){ + TDirectory *savedir = gDirectory; + fDebugStream[task] = new TTreeSRedirector(Form("TRD.Debug%s.root", fgTaskNames[task])); + savedir->cd(); + SETFLG(fSteerParam, kOwner); + } } +} + +//_____________________________________________________________________________ +void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader + , TTree *digitsTree) const +{ + // + // Convert raw data digits into digit objects in a root tree + // + + //AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]"); + + AliTRDrawData rawData; + rawReader->Reset(); + rawReader->Select("TRD"); + AliTRDrawStreamBase::SetRawStreamVersion(GetRecoParam()->GetRawStreamVersion()->Data()); + AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader); + manager->MakeBranch(digitsTree); + manager->WriteDigits(); + delete manager; - loader->UnloadRecPoints(); } //_____________________________________________________________________________ -void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader, - AliRawReader* rawReader) const +void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader + , TTree *clusterTree) const { -// reconstruct clusters + // + // Reconstruct clusters + // - AliInfo("Reconstruct TRD clusters from RAW data"); + //AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]"); - AliLoader *loader=runLoader->GetLoader("TRDLoader"); - loader->LoadRecPoints("recreate"); - AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer"); - runLoader->CdGAFile(); - Int_t nEvents = runLoader->GetNumberOfEvents(); + rawReader->Reset(); + rawReader->Select("TRD"); + AliTRDrawStreamBase::SetRawStreamVersion(GetRecoParam()->GetRawStreamVersion()->Data()); - for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { - if (!rawReader->NextEvent()) break; - clusterer.Open(runLoader->GetFileName(), iEvent); - clusterer.ReadDigits(rawReader); - clusterer.MakeClusters(); - clusterer.WriteClusters(-1); + if(!fClusterizer){ + AliFatal("Clusterizer not available!"); + return; } - loader->UnloadRecPoints(); + fClusterizer->ResetRecPoints(); + + fClusterizer->OpenOutput(clusterTree); + fClusterizer->SetUseLabels(kFALSE); + fClusterizer->Raw2ClustersChamber(rawReader); + + fgNTimeBins = fClusterizer->GetNTimeBins(); + + if(IsWritingClusters()) return; + + // take over ownership of clusters + fgClusters = fClusterizer->RecPoints(); + fClusterizer->SetClustersOwner(kFALSE); + + // take over ownership of online tracklets + fgTracklets = fClusterizer->TrackletsArray(); + fClusterizer->SetTrackletsOwner(kFALSE); } //_____________________________________________________________________________ -AliTracker* AliTRDReconstructor::CreateTracker(AliRunLoader* runLoader) const +void AliTRDReconstructor::Reconstruct(TTree *digitsTree + , TTree *clusterTree) const { -// create a TRD tracker + // + // Reconstruct clusters + // + + //AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]"); + + AliTRDclusterizer clusterer(fgTaskNames[AliTRDrecoParam::kClusterizer], fgTaskNames[AliTRDrecoParam::kClusterizer]); + clusterer.SetReconstructor(this); + clusterer.OpenOutput(clusterTree); + clusterer.ReadDigits(digitsTree); + clusterer.MakeClusters(); + + fgNTimeBins = clusterer.GetNTimeBins(); + + if(IsWritingClusters()) return; + + // take over ownership of clusters + fgClusters = clusterer.RecPoints(); + clusterer.SetClustersOwner(kFALSE); + + // take over ownership of online tracklets + fgTracklets = clusterer.TrackletsArray(); + clusterer.SetTrackletsOwner(kFALSE); + +} + +//_____________________________________________________________________________ +AliTracker *AliTRDReconstructor::CreateTracker() const +{ + // + // Create a TRD tracker + // + + //return new AliTRDtracker(NULL); + AliTRDtrackerV1 *tracker = new AliTRDtrackerV1(); + tracker->SetReconstructor(this); + return tracker; + +} + +//_____________________________________________________________________________ +void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/ + , TTree* /*clusterTree*/ + , AliESDEvent* /*esd*/) const +{ + // + // Fill ESD + // - runLoader->CdGAFile(); - return new AliTRDtracker(gFile); } //_____________________________________________________________________________ -void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/, - AliESD* esd) const +void AliTRDReconstructor::SetOption(Option_t *opt) { -// make PID - - Double_t parTRD[] = { - 280., // Min. Ionizing Particle signal. Check it !!! - 0.23, // relative resolution Check it !!! - 10. // PID range (in sigmas) - }; - AliTRDpidESD trdPID(parTRD); - trdPID.MakePID(esd); + // + // Read option string into the steer param. + // + // The following string options are available during reconstruction. + // In square brackets the default values are given. + // "dc" : digits conversion [false] + // "cw" : write clusters [true] + // "tw" : write online tracklets [false] + // "sa" : track seeding (stand alone tracking) [true] + // "hlt" : HLT reconstruction [false] + // "tp" : also use online tracklets for reconstruction [false] + // "deb" : Write debug stream [false] + // "cc" : Cluster radial correction during reconstruction [false] + // + // To check the actual options used during reconstruction include the following line in your rec.C script + // AliLog::SetClassDebugLevel("AliTRDReconstructor", 1); + + AliReconstructor::SetOption(opt); + + TString s(opt); + TObjArray *opar = s.Tokenize(","); + for(Int_t ipar=0; iparGetEntriesFast(); ipar++){ + Bool_t processed = kFALSE; + TString sopt(((TObjString*)(*opar)[ipar])->String()); + for(Int_t iopt=0; iopt>iopt)&1)?" : ON":" : OFF"):"")); + } +}