From fca85276b60f88e97ee80908d44813b7fe833439 Mon Sep 17 00:00:00 2001 From: nilsen Date: Mon, 25 Mar 2002 10:48:55 +0000 Subject: [PATCH] New ITS SDigit merging with region of interest cut. Update for changes in AliDigitizer. Additional optimization should be done. --- ITS/AliITSDigitizer.cxx | 157 ++++++++++++++++++++++++++++++++++++---- ITS/AliITSDigitizer.h | 8 ++ 2 files changed, 150 insertions(+), 15 deletions(-) diff --git a/ITS/AliITSDigitizer.cxx b/ITS/AliITSDigitizer.cxx index 85bad452939..1733fd43dca 100644 --- a/ITS/AliITSDigitizer.cxx +++ b/ITS/AliITSDigitizer.cxx @@ -15,16 +15,19 @@ /* $Log$ +Revision 1.2 2002/03/15 17:26:40 nilsen +New SDigit version of ITS Digitizer. + Revision 1.1 2001/11/27 16:27:28 nilsen Adding AliITSDigitizer class to do merging and digitization . Based on the TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h file. The following files required minor changes. AliITS, added functions SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD. -AliITSsimulationSDD.cxx needed a Tree indepenent way of returning back to +AliITSsimulationSDD.cxx needed a Tree independent way of returning back to the original Root Directory in function Compress1D. Now it uses gDirectory. Revision 1.2 2002/03/01 E. Lopez -Diditization changed to start from SDigits instead of Hits. +Digitization changed to start from SDigits instead of Hits. The SDigits are reading as TClonesArray of AliITSpListItem */ @@ -33,6 +36,7 @@ The SDigits are reading as TClonesArray of AliITSpListItem #include #include #include +#include #include #include @@ -59,6 +63,8 @@ AliITSDigitizer::AliITSDigitizer() : AliDigitizer(){ fITS = 0; fActive = 0; + fRoif = -1; + fRoiifile = 0; } //______________________________________________________________________ AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){ @@ -74,16 +80,24 @@ AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){ if(!gAlice) { fITS = 0; fActive = 0; + fRoif = -1; + fRoiifile = 0; return; } // end if fITS = (AliITS *)(gAlice->GetDetector("ITS")); if(!fITS){ fActive = 0; + fRoif = -1; + fRoiifile = 0; return; } else if(fITS->GetITSgeom()){ fActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()]; + fRoif = -1; + fRoiifile = 0; } else{ fActive = 0; + fRoif = -1; + fRoiifile = 0; return; } // end if // fActive needs to be set to a default all kTRUE value @@ -103,21 +117,86 @@ AliITSDigitizer::~AliITSDigitizer(){ if(fActive) delete[] fActive; } //______________________________________________________________________ +Bool_t AliITSDigitizer::Init(const char *filename){ + // Initialization + // Inputs: + // none. + // Outputs: + // none. + // Return: + // none. + +// TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); +// if (file) {file->Close(); delete file;} + TFile *file = new TFile(filename); + if (!file->IsOpen()) { + Error("Init","Can't open %s!",filename); + return kFALSE; + } // end if !file + if (gAlice) delete gAlice; + gAlice = (AliRun*)file->Get("gAlice"); + if (!gAlice) { + Error("Init","AliRun object not found on file"); + return kFALSE; + } // end if !gAlice + + this->Init(); + delete gAlice; + gAlice=0; + return kTRUE; +} +//______________________________________________________________________ Bool_t AliITSDigitizer::Init(){ - // Iniliztion + // Initialization // Inputs: // none. // Outputs: // none. // Return: + // none. +// TTree *ts; + + if(!gAlice) { + fITS = 0; + fActive = 0; + fRoif = -1; + fRoiifile = 0; +// cout << "init !gAlice"<GetDetector("ITS")); + if(!fITS){ + fActive = 0; + fRoif = -1; + fRoiifile = 0; +// cout << "init !fITS"<GetITSgeom()){ + fActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()]; + } else{ + fActive = 0; + fRoif = -1; + fRoiifile = 0; +// cout << "init !fITS-GetITSgeom()"<GetITSgeom()->GetIndexMax();i++) fActive[i] = kTRUE; +/* + if(fRoif>=0 && fRoiifile>=0 && fRoiifileGetNinputs()){ + ts = GetManager()->GetInputTreeS(fRoiifile); + cout << "calling SetByReionOfInterest"<GetDetector("ITS")); + if(!fITS) fITS = (AliITS*)(gAlice->GetDetector("ITS")); if(!fITS){ Error("Exec","The ITS not found. aborting."); return; @@ -154,24 +233,25 @@ void AliITSDigitizer::Exec(Option_t* opt){ // Digitize fITS->MakeBranchInTreeD( GetManager()->GetTreeD() ); + if(fRoif!=-1)SetByRegionOfInterest(GetManager()->GetInputTreeS(fRoiifile)); for( Int_t module=0; moduleGetITSgeom()->GetModuleType( module ); if( !all && !det[id] ) continue; iDetType = fITS->DetType( id ); sim = (AliITSsimulation*)iDetType->GetSimulationModel(); - if( !sim ) { + if(!sim) { Error( "Exec", "The simulation class was not instanciated!" ); exit(1); } // end if !sim - + // Fill the module with the sum of SDigits sim->InitSimulationModule( module, event ); - cout << "Module=" << module; +// cout << "Module=" << module; for( Int_t ifiles=0; ifilesDigits +// cout << " end ifiles loop" << endl; + // Digitize current module sum(SDigits)->Digits sim->FinishSDigitiseModule(); // fills all branches - wasted disk space GetManager()->GetTreeD()->Fill(); fITS->ResetDigits(); } // end for module - cout << "end modules loop"<GetTreeD()->GetEntries(); GetManager()->GetTreeD()->Write( 0, TObject::kOverwrite ); @@ -205,3 +285,50 @@ void AliITSDigitizer::Exec(Option_t* opt){ sdig->Clear(); delete sdig; } +//______________________________________________________________________ +void AliITSDigitizer::SetByRegionOfInterest(TTree *ts){ + // Scans through the ITS branch of the SDigits tree, ts, for modules + // which have SDigits in them. For these modules, a flag is set to + // digitize only these modules. The value of fRoif determines how many + // neighboring modules will also be turned on. fRoif=0 will turn on only + // those modules with SDigits in them. fRoif=1 will turn on, in addition, + // those modules that are +-1 module from the one with the SDigits. And + // So on. This last feature is not supported yet. + // Inputs: + // TTree *ts The tree in which the existing SDigits will define the + // region of interest. + // Outputs: + // none. + // Return: + // none. + Int_t m,nm; + if(gAlice==0 && ts==0) return; + if(ts==0) ts = gAlice->TreeS(); + TBranch *brchSDigits = ts->GetBranch(fITS->GetName()); + TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 ); +// cout << "Region of Interest ts="<GetITSgeom()->GetIndexMax(); + for(m=0;mClear(); + delete sdig; +} diff --git a/ITS/AliITSDigitizer.h b/ITS/AliITSDigitizer.h index 17b068fc5ac..466f485bc9c 100644 --- a/ITS/AliITSDigitizer.h +++ b/ITS/AliITSDigitizer.h @@ -25,11 +25,15 @@ class AliITSDigitizer : public AliDigitizer{ virtual ~AliITSDigitizer(); // Standard routines. virtual Bool_t Init(); + virtual Bool_t Init(const char *filename); virtual void Exec(Option_t* opt=0); // Sets a particular module active virtual void SetModuleActive(Int_t i){if(fActive) fActive[i] = kTRUE;} // Sets a particular module inactive virtual void SetModuleInActive(Int_t i){if(fActive) fActive[i] = kFALSE;} + virtual void SetByRegionOfInterest(Int_t i=0){fRoif = i;}; + virtual void SetByRegionOfFileNumber(Int_t i=0){fRoiifile = i;}; + virtual void ClearByRegionOfInterest(){fRoif = -1;}; private: // Routines used internaly TClonesArray* GetHits(){return fITS->Hits();} @@ -37,9 +41,13 @@ class AliITSDigitizer : public AliDigitizer{ TObjArray* GetModules(){return fITS->GetModules();} AliITSmodule* GetModule(Int_t i){return fITS->GetModule(i);} AliRunDigitizer* GetManager(){return fManager;} + virtual void SetByRegionOfInterest(TTree *ts); private: AliITS *fITS; //! local pointer to ITS Bool_t *fActive; //! flag to indicate which module to digitize. + Int_t fRoif; //! Region of interest flag. + Int_t fRoiifile; //! The file number with which to determing the region + // of interest from. ClassDef(AliITSDigitizer,1) // Task to Digitize ITS from summable hits. }; -- 2.43.5