From f243fbe6e13e9770c1b8baa4b482e93bd79bdd94 Mon Sep 17 00:00:00 2001 From: nilsen Date: Fri, 10 May 2002 22:31:30 +0000 Subject: [PATCH] Changes by Massimo Masera to allow Recpoints and Clusters to be written to separate files. --- ITS/AliITSreconstruction.cxx | 43 +++++++++++++++++++++++++++--------- ITS/AliITSreconstruction.h | 5 ++++- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/ITS/AliITSreconstruction.cxx b/ITS/AliITSreconstruction.cxx index e9df18dd08b..deb9c75a3e4 100644 --- a/ITS/AliITSreconstruction.cxx +++ b/ITS/AliITSreconstruction.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.3 2002/02/06 13:52:27 barbera +gAlice deletion corrected (from M. Masera) + Revision 1.2 2002/01/31 18:52:09 nilsen Minor change to allow the use of files that are already open. grun.C macro that also does ITS digitizationa and Reconstruction all in one go. @@ -59,6 +62,7 @@ AliITSreconstruction::AliITSreconstruction(){ fFilename = ""; fFile = 0; + fFile2 = 0; fITS = 0; fDet[0] = fDet[1] = fDet[2] = kTRUE; fInit = kFALSE; @@ -78,16 +82,16 @@ AliITSreconstruction::AliITSreconstruction(const char* filename){ // A standardly constructed AliITSreconstruction class. fFilename = filename; - + fFile2 = 0; + fFile = 0; if(filename){ fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data()); if(fFile) fFile->Close(); fFile = new TFile(fFilename.Data(),"UPDATE"); - // - if(gAlice) { - delete gAlice; - gAlice = 0; - } + if(gAlice) { + delete gAlice; + gAlice = 0; + } gAlice = (AliRun*)fFile->Get("gAlice"); if(!gAlice) { cout << "gAlice not found on file. Aborting." << endl; @@ -95,8 +99,6 @@ AliITSreconstruction::AliITSreconstruction(const char* filename){ return; } // end if !gAlice } // end if !filename. - - Init(); } //______________________________________________________________________ AliITSreconstruction::~AliITSreconstruction(){ @@ -123,7 +125,6 @@ Bool_t AliITSreconstruction::Init(){ // Return: // kTRUE if no errors initilizing this class occurse else kFALSE Int_t nparticles; - fITS = (AliITS*) gAlice->GetDetector("ITS"); if(!fITS){ cout << "ITS not found aborting. fITS=" << fITS << endl; @@ -225,11 +226,33 @@ void AliITSreconstruction::Exec(const Option_t *opt){ cout << "Initilization Failed, Can't run Exec." << endl; return; } // end if !fInit + TDirectory *curr = gDirectory; + if(fFile2)fFile2->cd(); for(evnt=0;evntGetEvent(evnt); gAlice->SetEvent(evnt); - if(!gAlice->TreeR()) gAlice->MakeTree("R"); + if(!gAlice->TreeR()){ + if(fFile2){ + gAlice->MakeTree("R",fFile2); + } + else { + gAlice->MakeTree("R"); + } + } fITS->MakeBranch("R"); fITS->DigitsToRecPoints(evnt,0,lopt); + cout << "end of recpoints finding *********************\n"; } // end for evnt + curr->cd(); +} +//______________________________________________________________________ +void AliITSreconstruction::SetOutputFile(TString filename){ + // Set a file name for recpoints. Used only if this file is not the file + // containing digits. This obj is deleted by AliRun. + fFile2 = gAlice->InitTreeFile("R",filename); } + + + + + diff --git a/ITS/AliITSreconstruction.h b/ITS/AliITSreconstruction.h index 5d8fb10cfa2..7bfc19a23cb 100644 --- a/ITS/AliITSreconstruction.h +++ b/ITS/AliITSreconstruction.h @@ -19,11 +19,14 @@ class AliITSreconstruction : public TTask{ virtual ~AliITSreconstruction();//Destructor virtual Bool_t Init(); virtual void Exec(const Option_t *opt="ALL"); + virtual void SetOutputFile(TString filename); private: Bool_t InitRec(); // Standard Reconstrution initilization. private: TFile *fFile; //! pointer to the file contatining the digits and // and will contain the RecPoints + TFile *fFile2; //! pointer to the file that will contain RecPoints + // (set only if <>fFile) Bool_t fDet[3]; //! logical specifing which detectors to reconstruct. Bool_t fInit; //! True if Init was sucessfull, else false. TString fFilename; //! input filename for Digits @@ -31,7 +34,7 @@ class AliITSreconstruction : public TTask{ Int_t fEnt0; //! first event to process, default 0. AliITS *fITS; //! Local pointer to ITS class. - ClassDef(AliITSreconstruction,1) // Task to Reconstruct ITS from Digits. + ClassDef(AliITSreconstruction,2) // Task to Reconstruct ITS from Digits. }; #endif -- 2.31.1