X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=PHOS%2FAliPHOSLoader.cxx;h=ca11c1e15265f60c6224bc2888b85a3784818cc2;hp=6c11305bf4a5102651be942a200a460ae926142f;hb=d5b302a6cc4645b860a5a72ae5080e3c2dbf0a65;hpb=803d1ab0e2c9c9a8116c05954c3d3cdcf1f33759 diff --git a/PHOS/AliPHOSLoader.cxx b/PHOS/AliPHOSLoader.cxx index 6c11305bf4a..ca11c1e1526 100644 --- a/PHOS/AliPHOSLoader.cxx +++ b/PHOS/AliPHOSLoader.cxx @@ -15,6 +15,26 @@ /* $Id$ */ +/* History of cvs commits: + * + * $Log$ + * Revision 1.18 2006/08/28 10:01:56 kharlov + * Effective C++ warnings fixed (Timur Pocheptsov) + * + * Revision 1.17 2006/08/25 16:00:53 kharlov + * Compliance with Effective C++AliPHOSHit.cxx + * + * Revision 1.16 2006/08/01 12:15:04 cvetan + * Adding a constructor from TFolder. Needed by AliReconstruction plugin scheme + * + * Revision 1.15 2005/07/12 20:07:35 hristov + * Changes needed to run simulation and reconstrruction in the same AliRoot session + * + * Revision 1.14 2005/05/28 14:19:04 schutz + * Compilation warnings fixed by T.P. + * + */ + //_________________________________________________________________________ // A singleton. This class should be used in the analysis stage to get // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, @@ -30,11 +50,11 @@ // ................ // please->GetEvent(event) ; // reads new event from galice.root // -//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) -//*-- Completely redesigned by Dmitri Peressounko March 2001 +//-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) +//-- Completely redesigned by Dmitri Peressounko March 2001 // -//*-- YS June 2001 : renamed the original AliPHOSIndexToObject and make -//*-- systematic usage of TFolders without changing the interface +//-- YS June 2001 : renamed the original AliPHOSIndexToObject and make +//-- systematic usage of TFolders without changing the interface ////////////////////////////////////////////////////////////////////////////// @@ -43,31 +63,15 @@ #include "TFile.h" #include "TTree.h" #include "TROOT.h" -#include "TObjString.h" -#include "TFolder.h" -#include "TParticle.h" // --- Standard library --- -#include // --- AliRoot header files --- - -#include "AliRun.h" -#include "AliConfig.h" -#include "AliDataLoader.h" +#include "AliObjectLoader.h" +#include "AliLog.h" #include "AliPHOSLoader.h" #include "AliPHOS.h" -#include "AliPHOSDigitizer.h" -#include "AliPHOSSDigitizer.h" -#include "AliPHOSClusterizer.h" -#include "AliPHOSClusterizerv1.h" -#include "AliPHOSTrackSegmentMaker.h" -#include "AliPHOSTrackSegmentMakerv1.h" -#include "AliPHOSTrackSegment.h" -#include "AliPHOSPID.h" -#include "AliPHOSPIDv1.h" -#include "AliPHOSGeometry.h" -#include "AliPHOSCalibrationDB.h" +#include "AliPHOSHit.h" ClassImp(AliPHOSLoader) @@ -85,16 +89,28 @@ const TString AliPHOSLoader::fgkCpvRecPointsBranchName("PHOSCpvRP");//Name for b const TString AliPHOSLoader::fgkTrackSegmentsBranchName("PHOSTS");//Name for branch with TrackSegments const TString AliPHOSLoader::fgkRecParticlesBranchName("PHOSRP");//Name for branch with Reconstructed Particles //____________________________________________________________________________ -AliPHOSLoader::AliPHOSLoader() - { - fDebug = 0; - } +AliPHOSLoader::AliPHOSLoader() : fBranchTitle(), fDebug(0), fTmpHits(0x0) +{ + //def ctor + fTmpHits = new TClonesArray("AliPHOSHit",1000); +} //____________________________________________________________________________ -AliPHOSLoader::AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername): - AliLoader(detname,eventfoldername) +AliPHOSLoader::AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername) : + AliLoader(detname, eventfoldername), + fBranchTitle(), fDebug(0), fTmpHits(0x0) { - fDebug=0; + //ctor } +//____________________________________________________________________________ +AliPHOSLoader::AliPHOSLoader(const Char_t *detname,TFolder *topfolder): + AliLoader(detname,topfolder), + fBranchTitle(), fDebug(0), fTmpHits(0x0) + +{ + //ctor + fTmpHits = new TClonesArray("AliPHOSHit",1000); +} + //____________________________________________________________________________ AliPHOSLoader::~AliPHOSLoader() @@ -107,16 +123,17 @@ AliPHOSLoader::~AliPHOSLoader() Clean(fgkCpvRecPointsName); Clean(fgkTracksName); Clean(fgkRecParticlesName); + CleanFolders() ; } -//____________________________________________________________________________ +//____________________________________________________________________________ void AliPHOSLoader::CleanFolders() { CleanRecParticles(); AliLoader::CleanFolders(); } -//____________________________________________________________________________ +//____________________________________________________________________________ Int_t AliPHOSLoader::SetEvent() { //Cleans loaded stuff and and sets Files and Directories @@ -126,7 +143,7 @@ Int_t AliPHOSLoader::SetEvent() Int_t retval = AliLoader::SetEvent(); if (retval) { - Error("SetEvent","AliLoader::SetEvent returned error"); + AliError("returned error"); return retval; } @@ -141,8 +158,8 @@ Int_t AliPHOSLoader::SetEvent() return 0; } -//____________________________________________________________________________ +//____________________________________________________________________________ Int_t AliPHOSLoader::GetEvent() { //Overloads GetEvent method called by AliRunLoader::GetEvent(Int_t) method @@ -154,7 +171,7 @@ Int_t AliPHOSLoader::GetEvent() retval = AliLoader::GetEvent(); if (retval) { - Error("GetEvent","AliLoader::GetEvent returned error"); + AliError("returned error"); return retval; } @@ -169,29 +186,17 @@ Int_t AliPHOSLoader::GetEvent() //Now, check if RecPart were loaded return 0; } -//____________________________________________________________________________ - - -//____________________________________________________________________________ -const AliPHOS * AliPHOSLoader::PHOS() -{ - // returns the PHOS object - AliPHOS * phos = dynamic_cast(GetModulesFolder()->FindObject(fDetectorName)); - if ( phos == 0x0) - if (fDebug) - cout << "WARNING: AliPHOSLoader::PHOS -> PHOS module not found in Folders" << endl ; - return phos ; -} - -//____________________________________________________________________________ -const AliPHOSGeometry * AliPHOSLoader::PHOSGeometry() -{ - AliPHOSGeometry * rv = 0 ; - if (PHOS() ) - rv = PHOS()->GetGeometry(); - return rv ; -} +// //____________________________________________________________________________ +// const AliPHOS * AliPHOSLoader::PHOS() +// { +// // returns the PHOS object +// AliPHOS * phos = dynamic_cast(GetModulesFolder()->FindObject(fDetectorName)); +// if ( phos == 0x0) +// if (fDebug) +// cout << "WARNING: AliPHOSLoader::PHOS -> PHOS module not found in Folders" << endl ; +// return phos ; +// } //____________________________________________________________________________ Int_t AliPHOSLoader::LoadHits(Option_t* opt) @@ -206,7 +211,7 @@ Int_t AliPHOSLoader::LoadHits(Option_t* opt) if (res) {//oops, error - Error("LoadHits","AliLoader::LoadHits returned error"); + AliError("returned error"); return res; } @@ -218,13 +223,14 @@ Int_t AliPHOSLoader::LoadHits(Option_t* opt) //____________________________________________________________________________ Int_t AliPHOSLoader::LoadSDigits(Option_t* opt) -{ //---------- SDigits ------------------------- +{ + //---------- SDigits ------------------------- Int_t res; //First call the AliLoader's method to send the TreeS to folder res = AliLoader::LoadSDigits(opt); if (res) {//oops, error - Error("PostSDigits","AliLoader::LoadSDigits returned error"); + AliError("returned error"); return res; } return ReadSDigits(); @@ -233,32 +239,34 @@ Int_t AliPHOSLoader::LoadSDigits(Option_t* opt) //____________________________________________________________________________ Int_t AliPHOSLoader::LoadDigits(Option_t* opt) { + //---------- Digits ------------------------- Int_t res; //First call the AliLoader's method to send the TreeS to folder res = AliLoader::LoadDigits(opt); if (res) {//oops, error - Error("LoadDigits","AliLoader::LoadDigits returned error"); + AliError("returned error"); return res; } return ReadDigits(); } //____________________________________________________________________________ Int_t AliPHOSLoader::LoadRecPoints(Option_t* opt) -{ // -------------- RecPoints ------------------------------------------- +{ + // -------------- RecPoints ------------------------------------------- Int_t res; //First call the AliLoader's method to send the TreeR to folder res = AliLoader::LoadRecPoints(opt); if (res) {//oops, error - Error("LoadRecPoints","AliLoader::LoadRecPoints returned error"); + AliError("returned error"); return res; } TFolder * phosFolder = GetDetectorDataFolder(); if ( phosFolder == 0x0 ) { - Error("PostDigits","Can not get detector data folder"); + AliError("Can not get detector data folder"); return 1; } return ReadRecPoints(); @@ -268,12 +276,12 @@ Int_t AliPHOSLoader::LoadRecPoints(Option_t* opt) Int_t AliPHOSLoader::LoadTracks(Option_t* opt) { //Loads Tracks: Open File, Reads Tree and posts, Read Data and Posts - if (GetDebug()) Info("LoadTracks","opt = %s",opt); + AliDebug(1, Form("opt = %s",opt)); Int_t res; res = AliLoader::LoadTracks(opt); if (res) {//oops, error - Error("LoadTracks","AliLoader::LoadTracks returned error"); + AliError("returned error"); return res; } return ReadTracks(); @@ -281,90 +289,100 @@ Int_t AliPHOSLoader::LoadTracks(Option_t* opt) //____________________________________________________________________________ Int_t AliPHOSLoader::LoadRecParticles(Option_t* opt) -{ // -------------- RecPoints ------------------------------------------- +{ + // -------------- RecPoints ------------------------------------------- Int_t res; //First call the AliLoader's method to send the TreeT to folder res = AliLoader::LoadRecParticles(opt); if (res) {//oops, error - Error("LoadRecParticles","AliLoader::LoadRecParticles returned error"); + AliError("returned error"); return res; } return ReadRecParticles(); } //____________________________________________________________________________ - -Int_t AliPHOSLoader::PostHits() +//PostHits etc. PostXXX must be const - not to hide virtual functions +//from base class AliLoader, but they call non-constant functions ReadXXX +//so I have to const_cast this pointer +Int_t AliPHOSLoader::PostHits()const { + // -------------- Hits ------------------------------------------- Int_t reval = AliLoader::PostHits(); if (reval) { - Error("PostHits","AliLoader:: returned error"); + AliError("returned error"); return reval; } - return ReadHits(); + + return const_cast(this)->ReadHits(); } //____________________________________________________________________________ -Int_t AliPHOSLoader::PostSDigits() +Int_t AliPHOSLoader::PostSDigits()const { + // -------------- SDigits ------------------------------------------- Int_t reval = AliLoader::PostSDigits(); if (reval) { - Error("PostSDigits","AliLoader::PostSDigits returned error"); + AliError("returned error"); return reval; } - return ReadSDigits(); + return const_cast(this)->ReadSDigits(); } //____________________________________________________________________________ -Int_t AliPHOSLoader::PostDigits() +Int_t AliPHOSLoader::PostDigits()const { + // -------------- Digits ------------------------------------------- Int_t reval = AliLoader::PostDigits(); if (reval) { - Error("PostDigits","AliLoader::PostDigits returned error"); + AliError("returned error"); return reval; } - return ReadDigits(); + return const_cast(this)->ReadDigits(); } //____________________________________________________________________________ -Int_t AliPHOSLoader::PostRecPoints() +Int_t AliPHOSLoader::PostRecPoints()const { + // -------------- RecPoints ------------------------------------------- Int_t reval = AliLoader::PostRecPoints(); if (reval) { - Error("PostRecPoints","AliLoader::PostRecPoints returned error"); + AliError("returned error"); return reval; } - return ReadRecPoints(); + return const_cast(this)->ReadRecPoints(); } //____________________________________________________________________________ -Int_t AliPHOSLoader::PostRecParticles() +Int_t AliPHOSLoader::PostRecParticles()const { + // -------------- RecParticles ------------------------------------------- Int_t reval = AliLoader::PostRecParticles(); if (reval) { - Error("PostRecParticles","AliLoader::PostRecParticles returned error"); + AliError("returned error"); return reval; } - return ReadRecParticles(); + return const_cast(this)->ReadRecParticles(); } //____________________________________________________________________________ -Int_t AliPHOSLoader::PostTracks() +Int_t AliPHOSLoader::PostTracks()const { + // -------------- Tracks ------------------------------------------- Int_t reval = AliLoader::PostTracks(); if (reval) { - Error("PostTracks","AliLoader::PostTracks returned error"); + AliError("returned error"); return reval; } - return ReadTracks(); + return const_cast(this)->ReadTracks(); } //____________________________________________________________________________ @@ -379,57 +397,47 @@ Int_t AliPHOSLoader::ReadHits() // Reads data from TreeH and stores it in TClonesArray that sits in DetectorDataFolder // TObject** hitref = HitsRef(); - if(hitref == 0x0) - { - MakeHitsArray(); - hitref = HitsRef(); - } + if(hitref == 0x0) { + MakeHitsArray(); + hitref = HitsRef(); + } - TClonesArray* hits = dynamic_cast(*hitref); + TClonesArray* hits = static_cast(*hitref); TTree* treeh = TreeH(); - if(treeh == 0) - { - Error("ReadHits"," Cannot read TreeH from folder"); + if(treeh == 0) { + AliError("Cannot read TreeH from folder"); return 1; } TBranch * hitsbranch = treeh->GetBranch(fDetectorName); - if (hitsbranch == 0) - { - Error("ReadHits"," Cannot find branch PHOS"); + if (hitsbranch == 0) { + AliError("Cannot find branch PHOS"); return 1; } + + AliDebug(1, "Reading Hits"); - if (GetDebug()) Info("ReadHits","Reading Hits"); - - if (hitsbranch->GetEntries() > 1) - { - TClonesArray * tempo = new TClonesArray("AliPHOSHit",1000); + if (hitsbranch->GetEntries() > 1) { - hitsbranch->SetAddress(&tempo); + hitsbranch->SetAddress(&fTmpHits); Int_t index = 0 ; - Int_t i = 0 ; - for (i = 0 ; i < hitsbranch->GetEntries(); i++) - { + for (Int_t i = 0 ; i < hitsbranch->GetEntries(); i++) { hitsbranch->GetEntry(i) ; - Int_t j = 0 ; - for ( j = 0 ; j < tempo->GetEntries() ; j++) - { - AliPHOSHit* hit = (AliPHOSHit*)tempo->At(j); - new((*hits)[index]) AliPHOSHit( *hit ) ; - index++ ; - } - } - delete tempo; - } - else - { + for (Int_t j = 0 ; j < fTmpHits->GetEntriesFast() ; j++) { + AliPHOSHit* hit = (AliPHOSHit*)fTmpHits->At(j); + new((*hits)[index]) AliPHOSHit( *hit ) ; + index++ ; + } + } + fTmpHits->Clear(); + } + else { hitsbranch->SetAddress(hitref); hitsbranch->GetEntry(0) ; - } - + } + return 0; } //____________________________________________________________________________ @@ -452,18 +460,18 @@ Int_t AliPHOSLoader::ReadSDigits() if(treeS==0) { //May happen if file is truncated or new in LoadSDigits - //Error("ReadSDigits","There is no SDigit Tree"); + //AliError("There is no SDigit Tree"); return 0; } TBranch * branch = treeS->GetBranch(fDetectorName); if (branch == 0) {//easy, maybe just a new tree - //Error("ReadSDigits"," Cannot find branch PHOS"); + //AliError("Cannot find branch PHOS"); return 0; } - branch->SetAddress(SDigitsRef()); + branch->SetAddress(sdref); branch->GetEntry(0); return 0; } @@ -488,14 +496,14 @@ Int_t AliPHOSLoader::ReadDigits() if(treeD==0) { //May happen if file is truncated or new in LoadSDigits - //Error("ReadDigits","There is no Digit Tree"); + //AliError("There is no Digit Tree"); return 0; } TBranch * branch = treeD->GetBranch(fDetectorName); if (branch == 0) {//easy, maybe just a new tree - //Error("ReadDigits"," Cannot find branch ",fDetectorName.Data()); + //AliError("Cannot find branch ",fDetectorName.Data()); return 0; } @@ -514,7 +522,7 @@ void AliPHOSLoader::Track(Int_t itrack) { if (LoadHits()) { - Error("Track","Can not load hits."); + AliError("Can not load hits."); return; } } @@ -531,32 +539,6 @@ void AliPHOSLoader::Track(Int_t itrack) hitsbranch->GetEntry(itrack); } -//____________________________________________________________________________ -void AliPHOSLoader::ReadTreeQA() -{ - // Read the digit tree gAlice->TreeQA() - // so far only PHOS knows about this Tree - - if(PHOS()->TreeQA()== 0){ - cerr << "ERROR: AliPHOSLoader::ReadTreeQA: can not read TreeQA " << endl ; - return ; - } - - TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS"); - if (!qabranch) { - if (fDebug) - cout << "WARNING: AliPHOSLoader::ReadTreeQA -> Cannot find QA Alarms for PHOS" << endl ; - return ; - } - -// if(!Alarms()) PostQA(); - - qabranch->SetAddress(AlarmsRef()) ; - - qabranch->GetEntry(0) ; - -} - //____________________________________________________________________________ Int_t AliPHOSLoader::ReadRecPoints() @@ -582,7 +564,8 @@ Int_t AliPHOSLoader::ReadRecPoints() if (emcbranch == 0x0) { - Error("ReadRecPoints","Can not get branch with EMC Rec. Points named %s",fgkEmcRecPointsBranchName.Data()); + AliError(Form("Can not get branch with EMC Rec. Points named %s", + fgkEmcRecPointsBranchName.Data())); retval = 1; } else @@ -593,7 +576,8 @@ Int_t AliPHOSLoader::ReadRecPoints() TBranch * cpvbranch = treeR->GetBranch(fgkCpvRecPointsBranchName); if (cpvbranch == 0x0) { - Error("ReadRecPoints","Can not get branch with CPV Rec. Points named %s",fgkCpvRecPointsBranchName.Data()); + AliError(Form("Can not get branch with CPV Rec. Points named %s", + fgkCpvRecPointsBranchName.Data())); retval = 2; } else @@ -603,13 +587,17 @@ Int_t AliPHOSLoader::ReadRecPoints() } Int_t ii ; - Int_t maxemc = emca->GetEntries() ; - for ( ii= 0 ; ii < maxemc ; ii++ ) - EmcRecPoints()->Add(emca->At(ii)) ; - - Int_t maxcpv = cpva->GetEntries() ; - for ( ii= 0 ; ii < maxcpv ; ii++ ) - CpvRecPoints()->Add(cpva->At(ii)) ; + if (emca != 0) { + Int_t maxemc = emca->GetEntries() ; + for ( ii= 0 ; ii < maxemc ; ii++ ) + EmcRecPoints()->Add(emca->At(ii)) ; + } + + if (cpva != 0) { + Int_t maxcpv = cpva->GetEntries() ; + for ( ii= 0 ; ii < maxcpv ; ii++ ) + CpvRecPoints()->Add(cpva->At(ii)) ; + } return retval; } @@ -632,14 +620,17 @@ Int_t AliPHOSLoader::ReadTracks() { //May happen if file is truncated or new in LoadSDigits, or the file is in update mode, //but tracking was not performed yet for a current event - //Error("ReadTracks","There is no Tree with Tracks"); + //AliError("There is no Tree with Tracks"); return 0; } TBranch * branch = treeT->GetBranch(fgkTrackSegmentsBranchName); +// AliInfo(Form("Branch named %s is opened: 0x%z", +// fgkTrackSegmentsBranchName.Data(),branch)); if (branch == 0) {//easy, maybe just a new tree - Error("ReadTracks"," Cannot find branch named %s",fgkTrackSegmentsBranchName.Data()); + AliError(Form("Cannot find branch named %s", + fgkTrackSegmentsBranchName.Data())); return 0; } @@ -670,14 +661,15 @@ Int_t AliPHOSLoader::ReadRecParticles() //May happen if file is truncated or new in LoadSDigits, //or the file is in update mode, //but tracking was not performed yet for a current event - // Error("ReadRecParticles","There is no Tree with Tracks and Reconstructed Particles"); + // AliError("There is no Tree with Tracks and Reconstructed Particles"); return 0; } TBranch * branch = treeP->GetBranch(fgkRecParticlesBranchName); if (branch == 0) {//easy, maybe just a new tree - Error("ReadRecParticles"," Cannot find branch %s",fgkRecParticlesBranchName.Data()); + AliError(Form("Cannot find branch %s", + fgkRecParticlesBranchName.Data())); return 0; } @@ -688,34 +680,23 @@ Int_t AliPHOSLoader::ReadRecParticles() } -AliPHOSGeometry* AliPHOSLoader::GetPHOSGeometry() -{ -//returns PHOS geometry from gAlice -//static Method used by some classes where it is not convienient to pass eventfoldername - if (gAlice == 0x0) - return 0x0; - AliPHOS* phos=dynamic_cast(gAlice->GetDetector("PHOS")); - if (phos == 0x0) - return 0x0; - return phos->GetGeometry(); -} /***************************************************************************************/ AliPHOSLoader* AliPHOSLoader::GetPHOSLoader(const char* eventfoldername) { + // Return PHOS loader AliRunLoader* rn = AliRunLoader::GetRunLoader(eventfoldername); - if (rn == 0x0) - { - cerr<<"Error: : " - << "Can not find Run Loader in folder "<(rn->GetLoader("PHOSLoader")); } /***************************************************************************************/ Bool_t AliPHOSLoader::BranchExists(const TString& recName) - { +{ + // Check if a branch named redName exists if (fBranchTitle.IsNull()) return kFALSE; TString dataname, zername ; TTree* tree; @@ -766,11 +747,13 @@ Bool_t AliPHOSLoader::BranchExists(const TString& recName) TString branchName(branch->GetName() ) ; TString branchTitle(branch->GetTitle() ) ; if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){ - Warning("BranchExists","branch %s with title %s ",dataname.Data(),fBranchTitle.Data()); + AliWarning(Form("branch %s with title %s ", + dataname.Data(),fBranchTitle.Data())); return kTRUE ; } if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){ - Warning("BranchExists","branch AliPHOS... with title %s ",branch->GetTitle()); + AliWarning(Form("branch AliPHOS... with title %s ", + branch->GetTitle())); return kTRUE ; } } @@ -779,57 +762,63 @@ Bool_t AliPHOSLoader::BranchExists(const TString& recName) } void AliPHOSLoader::SetBranchTitle(const TString& btitle) - { +{ + // Set branch title if (btitle.CompareTo(fBranchTitle) == 0) return; fBranchTitle = btitle; ReloadAll(); } + //____________________________________________________________________________ - -void AliPHOSLoader::CleanHits() +//Again, must be const not to hide virtual functions from AliLoader +//but there are calls to non-const functions, so I have to const_cast this pointer +void AliPHOSLoader::CleanHits()const { + // Clean Hits array AliLoader::CleanHits(); //Clear an array - TClonesArray* hits = Hits(); + TClonesArray* hits = const_cast(this)->Hits(); if (hits) hits->Clear(); } //____________________________________________________________________________ -void AliPHOSLoader::CleanSDigits() +void AliPHOSLoader::CleanSDigits()const { + // Clean SDigits array AliLoader::CleanSDigits(); - TClonesArray* sdigits = SDigits(); + TClonesArray* sdigits = const_cast(this)->SDigits(); if (sdigits) sdigits->Clear(); } //____________________________________________________________________________ -void AliPHOSLoader::CleanDigits() +void AliPHOSLoader::CleanDigits()const { + // Clean Digits array AliLoader::CleanDigits(); - TClonesArray* digits = Digits(); + TClonesArray* digits = const_cast(this)->Digits(); if (digits) digits->Clear(); } //____________________________________________________________________________ -void AliPHOSLoader::CleanRecPoints() +void AliPHOSLoader::CleanRecPoints()const { + // Clean RecPoints array AliLoader::CleanRecPoints(); - TObjArray* recpoints = EmcRecPoints(); + TObjArray* recpoints = const_cast(this)->EmcRecPoints(); if (recpoints) recpoints->Clear(); - recpoints = CpvRecPoints(); + recpoints = const_cast(this)->CpvRecPoints(); if (recpoints) recpoints->Clear(); } //____________________________________________________________________________ -void AliPHOSLoader::CleanTracks() +void AliPHOSLoader::CleanTracks()const { -//Cleans Tracks stuff - + //Cleans Tracks stuff AliLoader::CleanTracks();//tree //and clear the array - TClonesArray* tracks = TrackSegments(); + TClonesArray* tracks = const_cast(this)->TrackSegments(); if (tracks) tracks->Clear(); } @@ -837,7 +826,7 @@ void AliPHOSLoader::CleanTracks() void AliPHOSLoader::CleanRecParticles() { - + // Clean RecParticles array TClonesArray *recpar = RecParticles(); if (recpar) recpar->Clear(); @@ -845,36 +834,9 @@ void AliPHOSLoader::CleanRecParticles() } //____________________________________________________________________________ -void AliPHOSLoader::ReadCalibrationDB(const char * database,const char * filename) -{ - - if(fcdb && (strcmp(database,fcdb->GetTitle())==0)) - return ; - - TFile * file = gROOT->GetFile(filename) ; - if(!file) - file = TFile::Open(filename); - if(!file){ - Error ("ReadCalibrationDB", "Cannot open file %s", filename) ; - return ; - } - if(fcdb) - fcdb->Delete() ; - fcdb = dynamic_cast(file->Get("AliPHOSCalibrationDB")) ; - if(!fcdb) - Error ("ReadCalibrationDB", "No database %s in file %s", database, filename) ; -} -//____________________________________________________________________________ - -// AliPHOSSDigitizer* AliPHOSLoader::PHOSSDigitizer() -// { -// //return PHOS SDigitizer -// return dynamic_cast(SDigitizer()) ; -// } - -//____________________________________________________________________________ void AliPHOSLoader::MakeHitsArray() { + // Add Hits array to the data folder if (Hits()) return; TClonesArray* hits = new TClonesArray("AliPHOSHit",1000); hits->SetName(fgkHitsName); @@ -884,6 +846,7 @@ void AliPHOSLoader::MakeHitsArray() //____________________________________________________________________________ void AliPHOSLoader::MakeSDigitsArray() { + // Add SDigits array to the data folder if ( SDigits()) return; TClonesArray* sdigits = new TClonesArray("AliPHOSDigit",1); sdigits->SetName(fgkSDigitsName); @@ -893,6 +856,7 @@ void AliPHOSLoader::MakeSDigitsArray() //____________________________________________________________________________ void AliPHOSLoader::MakeDigitsArray() { + // Add Digits array to the data folder if ( Digits()) return; TClonesArray* digits = new TClonesArray("AliPHOSDigit",1); digits->SetName(fgkDigitsName); @@ -903,26 +867,28 @@ void AliPHOSLoader::MakeDigitsArray() //____________________________________________________________________________ void AliPHOSLoader::MakeRecPointsArray() { + // Add RecPoints array to the data folder if ( EmcRecPoints() == 0x0) { - if (GetDebug()>9) Info("MakeRecPointsArray","Making array for EMC"); + AliDebug(9, "Making array for EMC"); TObjArray* emc = new TObjArray(100) ; emc->SetName(fgkEmcRecPointsName) ; GetDetectorDataFolder()->Add(emc); } if ( CpvRecPoints() == 0x0) - { - if (GetDebug()>9) Info("MakeRecPointsArray","Making array for CPV"); - TObjArray* cpv = new TObjArray(100) ; - cpv->SetName(fgkCpvRecPointsName); - GetDetectorDataFolder()->Add(cpv); + { + AliDebug(9, "Making array for CPV"); + TObjArray* cpv = new TObjArray(100) ; + cpv->SetName(fgkCpvRecPointsName); + GetDetectorDataFolder()->Add(cpv); } } //____________________________________________________________________________ void AliPHOSLoader::MakeTrackSegmentsArray() { + // Add TrackSegments array to the data folder if ( TrackSegments()) return; TClonesArray * ts = new TClonesArray("AliPHOSTrackSegment",100) ; ts->SetName(fgkTracksName); @@ -933,6 +899,7 @@ void AliPHOSLoader::MakeTrackSegmentsArray() //____________________________________________________________________________ void AliPHOSLoader::MakeRecParticlesArray() { + // Add RecParticles array to the data folder if ( RecParticles()) return; TClonesArray * rp = new TClonesArray("AliPHOSRecParticle",100) ; rp->SetName(fgkRecParticlesName);