X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDReconstructor.cxx;h=c33a29b9a4ef0cd60fcdc2d1fec81aef8d92e823;hb=f4d11ac8d5898450f374a5e765f5e7610a588fdd;hp=98fec9d61f35b684fbcc171fbf00954ac54a6eb3;hpb=c5f589b9fa7e486a93197882c53d8edd4a0274f0;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDReconstructor.cxx b/TRD/AliTRDReconstructor.cxx index 98fec9d61f3..c33a29b9a4e 100644 --- a/TRD/AliTRDReconstructor.cxx +++ b/TRD/AliTRDReconstructor.cxx @@ -1,17 +1,17 @@ /************************************************************************** - * 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$ */ @@ -21,51 +21,135 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include +#include +#include +#include +#include -#include "AliRunLoader.h" #include "AliRawReader.h" -#include "AliLog.h" -#include "AliESDTrdTrack.h" -#include "AliESDEvent.h" #include "AliTRDReconstructor.h" #include "AliTRDclusterizer.h" -#include "AliTRDtracker.h" -#include "AliTRDpidESD.h" -#include "AliTRDgtuTrack.h" #include "AliTRDrawData.h" +#include "AliTRDrawStreamBase.h" #include "AliTRDdigitsManager.h" #include "AliTRDtrackerV1.h" -#include "AliTRDrecoParam.h" + +#define SETFLG(n,f) ((n) |= f) +#define CLRFLG(n,f) ((n) &= ~f) ClassImp(AliTRDReconstructor) -Bool_t AliTRDReconstructor::fgkSeedingOn = kFALSE; -Int_t AliTRDReconstructor::fgStreamLevel = 0; // Stream (debug) level -AliTRDrecoParam* AliTRDReconstructor::fgRecoParam = 0x0; +TClonesArray *AliTRDReconstructor::fgClusters = NULL; +TClonesArray *AliTRDReconstructor::fgTracklets = NULL; +AliTRDdigitsParam *AliTRDReconstructor::fgDigitsParam = NULL; +Char_t const * AliTRDReconstructor::fgSteerNames[kNsteer] = { + "DigitsConversion " + ,"Write Clusters " + ,"Write Online Tracklets " + ,"Stand Alone Tracking " + ,"HLT Mode " + ,"Process Online Tracklets" + ,"Debug Streaming " +}; +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] +}; +Char_t const * AliTRDReconstructor::fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks] = { + "Clusterizer" + ,"Tracker" + ,"PID" +}; +Char_t const * AliTRDReconstructor::fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks] = { + "cl" + ,"tr" + ,"pd" +}; +//_____________________________________________________________________________ +AliTRDReconstructor::AliTRDReconstructor() + :AliReconstructor() + ,fSteerParam(0) +{ + // 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); + + memset(fDebugStream, 0, sizeof(TTreeSRedirector *) * AliTRDrecoParam::kTRDreconstructionTasks); +} //_____________________________________________________________________________ -AliTRDReconstructor::~AliTRDReconstructor() { - if(fgRecoParam) delete fgRecoParam; +AliTRDReconstructor::~AliTRDReconstructor() +{ + // + // Destructor + // + + if(fgDigitsParam){ + delete fgDigitsParam; + fgDigitsParam = NULL; + } + 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]; + } } +//_____________________________________________________________________________ +void AliTRDReconstructor::Init(){ + // + // Init Options + // + SetOption(GetOption()); + Options(fSteerParam); + + // 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 + , 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]"); + //AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]"); AliTRDrawData rawData; rawReader->Reset(); rawReader->Select("TRD"); + rawData.OpenOutput(); + AliTRDrawStreamBase::SetRawStreamVersion(GetRecoParam()->GetRawStreamVersion()->Data()); AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader); manager->MakeBranch(digitsTree); manager->WriteDigits(); @@ -81,20 +165,30 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader // Reconstruct clusters // - AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]"); + //AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]"); - // TODO move it to rec.C. check TPC - fgRecoParam = AliTRDrecoParam::GetLowFluxParam(); rawReader->Reset(); rawReader->Select("TRD"); + AliTRDrawStreamBase::SetRawStreamVersion(GetRecoParam()->GetRawStreamVersion()->Data()); // New (fast) cluster finder - AliTRDclusterizer clusterer("clusterer","TRD clusterizer"); + AliTRDclusterizer clusterer(fgTaskNames[AliTRDrecoParam::kClusterizer], fgTaskNames[AliTRDrecoParam::kClusterizer]); + clusterer.SetReconstructor(this); clusterer.OpenOutput(clusterTree); - clusterer.SetAddLabels(kFALSE); + clusterer.OpenTrackletOutput(); + clusterer.SetUseLabels(kFALSE); clusterer.Raw2ClustersChamber(rawReader); + + 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); } //_____________________________________________________________________________ @@ -105,16 +199,23 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree // Reconstruct clusters // - AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]"); - - // TODO move it to rec.C. check TPC - fgRecoParam = AliTRDrecoParam::GetLowFluxParam(); - - AliTRDclusterizer clusterer("clusterer","TRD clusterizer"); + //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(); + 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); } //_____________________________________________________________________________ @@ -125,20 +226,67 @@ AliTracker *AliTRDReconstructor::CreateTracker() const // //return new AliTRDtracker(NULL); - - // TODO move it to rec.C. check TPC - fgRecoParam = AliTRDrecoParam::GetLowFluxParam(); - return new AliTRDtrackerV1(); + AliTRDtrackerV1 *tracker = new AliTRDtrackerV1(); + tracker->SetReconstructor(this); + return tracker; } //_____________________________________________________________________________ void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/ - , TTree* /*clusterTree*/ - , AliESDEvent* /*esd*/) const + , TTree* /*clusterTree*/ + , AliESDEvent* /*esd*/) const { // // Fill ESD // } + +//_____________________________________________________________________________ +void AliTRDReconstructor::SetDigitsParam(AliTRDdigitsParam const *par) +{ + if(fgDigitsParam) (*fgDigitsParam) = (*par); + else fgDigitsParam = new AliTRDdigitsParam(*par); +} + + +//_____________________________________________________________________________ +void AliTRDReconstructor::SetOption(Option_t *opt) +{ + // + // Read option string into the steer param. + // + + 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"):"")); + } +} +