X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSGetter.cxx;h=d52cb66c5a2ed0bc22373e599444d463f90d949f;hb=e3817e5f4ce8d76720d023a93be3b17b5d5a8fa5;hp=61a2aeb3e32448d818877d320aa91e77bc352780;hpb=7bb289a7da714a79aa515e33a1e8d081aa8744f9;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSGetter.cxx b/PHOS/AliPHOSGetter.cxx index 61a2aeb3e32..d52cb66c5a2 100644 --- a/PHOS/AliPHOSGetter.cxx +++ b/PHOS/AliPHOSGetter.cxx @@ -76,7 +76,7 @@ ClassImp(AliPHOSGetter) AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ; - TFile * AliPHOSGetter::fFile = 0 ; + TFile * AliPHOSGetter::fgFile = 0 ; //____________________________________________________________________________ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle, const Bool_t toSplit ) @@ -113,17 +113,17 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle, co if ( fHeaderFile != "aliroot" ) { // to call the getter without a file //open headers file - fFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; + fgFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; - if(!fFile) { //if file was not opened yet, read gAlice - fFile = TFile::Open(fHeaderFile.Data(),"update") ; - if (!fFile->IsOpen()) { + if(!fgFile) { //if file was not opened yet, read gAlice + fgFile = TFile::Open(fHeaderFile.Data(),"update") ; + if (!fgFile->IsOpen()) { Error("AliPHOSGetter", "Cannot open %s", fHeaderFile.Data() ) ; fFailed = kTRUE ; return ; } } - gAlice = dynamic_cast(fFile->Get("gAlice")) ; + gAlice = dynamic_cast(fgFile->Get("gAlice")) ; } if (!gAlice) { @@ -147,8 +147,9 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle, co } //____________________________________________________________________________ -AliPHOSGetter::~AliPHOSGetter(){ - +AliPHOSGetter::~AliPHOSGetter() +{ + // dtor if (fPrimaries) { fPrimaries->Delete() ; delete fPrimaries ; @@ -161,10 +162,10 @@ AliPHOSGetter::~AliPHOSGetter(){ while ( (folder = static_cast(next())) ) phosF->Remove(folder) ; - if (fFile) { - fFile->Close() ; - delete fFile ; - fFile = 0 ; + if (fgFile) { + fgFile->Close() ; + delete fgFile ; + fgFile = 0 ; } fgObjGetter = 0 ; @@ -173,6 +174,8 @@ AliPHOSGetter::~AliPHOSGetter(){ //____________________________________________________________________________ void AliPHOSGetter::CloseFile() { + // delete gAlice + if(gAlice) delete gAlice ; gAlice = 0 ; @@ -230,7 +233,7 @@ AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile, } //First checks, if header file already opened - if(!fgObjGetter->fFile){ + if(!fgObjGetter->fgFile){ fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ; if(fgObjGetter->fFailed) return 0; @@ -256,9 +259,9 @@ AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile, fgObjGetter->fModuleFolder->Remove(fgObjGetter->fModuleFolder->FindObject("PHOS")) ; delete gAlice ; } - if(fgObjGetter->fFile){ - fgObjGetter->fFile->Close() ; - fgObjGetter->fFile=0; + if(fgObjGetter->fgFile){ + fgObjGetter->fgFile->Close() ; + fgObjGetter->fgFile=0; } if(fgObjGetter->fToSplit) fgObjGetter->CloseSplitFiles() ; @@ -322,7 +325,7 @@ const Bool_t AliPHOSGetter::BranchExists(const TString recName) const file = TFile::Open(fSDigitsFileName.Data(),"update"); } else - file = fFile ; + file = fgFile ; tree = (TTree *)file->Get(name.Data()) ; @@ -365,6 +368,9 @@ const Bool_t AliPHOSGetter::BranchExists(const TString recName) const //____________________________________________________________________________ void AliPHOSGetter::ListBranches(Int_t event) const { + // Iterates over branches in each TreeH, TreeS, TreeD and TreeR and + // prints lists of branches to stdout + // (I don't know why this method is needed. Yu.Kharlov) TBranch * branch = 0 ; if (gAlice->GetEvent(event) == -1) @@ -417,6 +423,8 @@ void AliPHOSGetter::ListBranches(Int_t event) const //____________________________________________________________________________ void AliPHOSGetter::NewBranch(TString name, Int_t event) { + // Set titles for (S)Digits, RecPoints, TSegments and RecParticles branches + fBranchTitle = fSDigitsTitle = fDigitsTitle = fRecPointsTitle = fTrackSegmentsTitle = fRecParticlesTitle = name ; Event(event) ; } @@ -424,19 +432,20 @@ void AliPHOSGetter::NewBranch(TString name, Int_t event) //____________________________________________________________________________ Bool_t AliPHOSGetter::NewFile(TString name) { + // Open a new file fHeaderFile = name ; - fFile->Close() ; + fgFile->Close() ; fFailed = kFALSE; - fFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; - if(!fFile) { //if file was not opened yet, read gAlice - fFile = TFile::Open(fHeaderFile.Data(),"update") ; - if (!fFile->IsOpen()) { + fgFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; + if(!fgFile) { //if file was not opened yet, read gAlice + fgFile = TFile::Open(fHeaderFile.Data(),"update") ; + if (!fgFile->IsOpen()) { Error("NewFile", "Cannot open %s", fHeaderFile.Data() ) ; fFailed = kTRUE ; return fFailed ; } - gAlice = static_cast(fFile->Get("gAlice")) ; + gAlice = static_cast(fgFile->Get("gAlice")) ; } if (!gAlice) { @@ -461,6 +470,8 @@ const AliPHOS * AliPHOSGetter::PHOS() //____________________________________________________________________________ const AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() { + // Returns PHOS geometry + AliPHOSGeometry * rv = 0 ; if (PHOS() ) rv = PHOS()->GetGeometry() ; @@ -633,8 +644,8 @@ TObject** AliPHOSGetter::SDigitsRef(const char * name, const char * foldername) //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const -{ //---------- SDigitizer ------------------------- - +{ + //---------- SDigitizer ------------------------- // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname @@ -667,6 +678,7 @@ const Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const //____________________________________________________________________________ TObject** AliPHOSGetter::SDigitizerRef(const char * name) const { + //---------- return task SDigitizer ------------------------- TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; if ( !sd ) { @@ -686,9 +698,9 @@ TObject** AliPHOSGetter::SDigitizerRef(const char * name) const //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) const -{ //---------- SDigitizer ------------------------- - - // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname +{ + //---------- SDigitizer ------------------------- + // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; if ( !sd ) { @@ -749,9 +761,9 @@ const Bool_t AliPHOSGetter::PostDigits(const char * name) const //____________________________________________________________________________ TObject** AliPHOSGetter::DigitsRef(const char * name) const -{ //------- Digits ---------------------- - - // the hierarchy is //Folders/Run/Event/Data/PHOS/Digits/name +{ + //------- Digits ---------------------- + // the hierarchy is //Folders/Run/Event/Data/PHOS/Digits/name if ( !fDigitsFolder ) { Fatal("DigitsRef", "Folder //%s not found !", fDigitsFolder) ; @@ -773,7 +785,8 @@ TObject** AliPHOSGetter::DigitsRef(const char * name) const //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const -{ //---------- Digitizer ------------------------- +{ + //---------- Digitizer ------------------------- TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; @@ -802,9 +815,9 @@ const Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostDigitizer(const char * name) const -{ //---------- Digitizer ------------------------- - - // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname +{ + //---------- Digitizer ------------------------- + // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname TTask * d = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; if ( !d ) { @@ -843,6 +856,7 @@ const Bool_t AliPHOSGetter::PostDigitizer(const char * name) const //____________________________________________________________________________ TObject** AliPHOSGetter::DigitizerRef(const char * name) const { + // -------------- Return Digitizer task ------------------------------------ TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; if ( !sd ) { Fatal("DigitizerRef", "Task //%s/Digitizer not found !", fTasksFolder) ; @@ -995,7 +1009,8 @@ const Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const //____________________________________________________________________________ TObject** AliPHOSGetter::ClusterizerRef(const char * name) const -{ // ------------------ AliPHOSClusterizer ------------------------ +{ + // ------------------ AliPHOSClusterizer ------------------------ TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; @@ -1164,8 +1179,8 @@ const Bool_t AliPHOSGetter::PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm } //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const -{ //------------Track Segment Maker ------------------------------ - +{ + //------------Track Segment Maker ------------------------------ // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; @@ -1207,7 +1222,8 @@ const Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const //____________________________________________________________________________ TObject** AliPHOSGetter::TSMakerRef(const char * name) const -{ //------------Track Segment Maker ------------------------------ +{ + //------------Track Segment Maker ------------------------------ TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; @@ -1298,14 +1314,18 @@ TObject** AliPHOSGetter::RecParticlesRef(const char * name) const return phosFolder->GetListOfFolders()->GetObjectRef(tss) ; } //____________________________________________________________________________ -const UShort_t AliPHOSGetter::EventPattern(void){ +const UShort_t AliPHOSGetter::EventPattern(void) +{ + // Return the pattern (trigger bit register) of the beam-test event if(fBTE) return fBTE->GetPattern() ; else return 0 ; } //____________________________________________________________________________ -const Float_t AliPHOSGetter::BeamEnergy(void){ +const Float_t AliPHOSGetter::BeamEnergy(void) +{ + // Return the beam energy of the beam-test event if(fBTE) return fBTE->GetBeamEnergy() ; else @@ -1313,7 +1333,8 @@ const Float_t AliPHOSGetter::BeamEnergy(void){ } //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostPID(AliPHOSPID * pid) const -{ // ------------AliPHOS PID ----------------------------- +{ + // ------------AliPHOS PID ----------------------------- TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; @@ -1387,7 +1408,8 @@ const Bool_t AliPHOSGetter::PostPID(const char * name) const //____________________________________________________________________________ TObject** AliPHOSGetter::PIDRef(const char * name) const -{ //------------PID ------------------------------ +{ + //------------PID ------------------------------ TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; @@ -1647,6 +1669,8 @@ Int_t AliPHOSGetter::ReadTreeD(const Int_t event) //read digits if(!Digits(fDigitsTitle) ) PostDigits(fDigitsTitle); + else + Digits(fDigitsTitle)->Clear() ; digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; digitsbranch->GetEntry(0) ; @@ -1837,6 +1861,17 @@ Int_t AliPHOSGetter::ReadTreeR(const Int_t event) // any migh have become obsolete : to be checked // See AliPHOSPIDv1 + //first - clean if necessary + if(EmcRecPoints(fRecPointsTitle)){ + EmcRecPoints(fRecPointsTitle)->Delete() ; + CpvRecPoints(fRecPointsTitle)->Delete() ; + } + //clear TrackSegments + if(TrackSegments(fTrackSegmentsTitle)) + TrackSegments(fTrackSegmentsTitle)->Clear() ; + if(RecParticles(fRecParticlesTitle)) + RecParticles(fRecParticlesTitle)->Clear() ; + TTree * treeR ; if(fToSplit){ TFile * file = static_cast(gROOT->GetFile(fRecPointsFileName)); @@ -1889,7 +1924,6 @@ Int_t AliPHOSGetter::ReadTreeR(const Int_t event) } else { if(!EmcRecPoints(fRecPointsTitle) ) PostRecPoints(fRecPointsTitle) ; - emcbranch->SetAddress(EmcRecPointsRef(fRecPointsTitle)) ; emcbranch->GetEntry(0) ; @@ -2063,9 +2097,8 @@ Int_t AliPHOSGetter::ReadTreeS(const Int_t event) //____________________________________________________________________________ void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input) - -{ // Read the summable digits fron treeS() - +{ + // Read the summable digits fron treeS() TString filename("mergefile") ; filename+= input ; @@ -2285,15 +2318,7 @@ TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const } } else if ( what.CompareTo("Alarms") == 0 ){ - if (name.IsNull() ) - phosO = dynamic_cast(fQAFolder->FindObject("PHOS")) ; - else { - folder = dynamic_cast(fQAFolder->FindObject("PHOS")) ; - if (!folder) - phosO = 0 ; - else - phosO = dynamic_cast(folder->FindObject(name)) ; - } + phosO = dynamic_cast(fQAFolder->FindObject("PHOS")) ; } if (!phosO) { if(fDebug) @@ -2490,6 +2515,8 @@ void AliPHOSGetter::RemoveObjects(TString opt, TString name) const //____________________________________________________________________________ void AliPHOSGetter::RemoveSDigits() const { + // Clean SDigit array + TFolder * phos= dynamic_cast(fSDigitsFolder->FindObject("PHOS")) ; if (!phos) return ; @@ -2499,7 +2526,9 @@ void AliPHOSGetter::RemoveSDigits() const } //____________________________________________________________________________ -void AliPHOSGetter::CleanWhiteBoard(void){ +void AliPHOSGetter::CleanWhiteBoard(void) +{ + // Delete all PHOS objects from folders TFolder * phosmain = 0 ; TFolder * phos ; @@ -2653,6 +2682,8 @@ void AliPHOSGetter::CleanWhiteBoard(void){ //____________________________________________________________________________ void AliPHOSGetter::SetTitle(const char * branchTitle ) { + // Set branch titles and add folders with PHOS data + fBranchTitle = branchTitle ; fSDigitsTitle = branchTitle ; fDigitsTitle = branchTitle ; @@ -2726,7 +2757,9 @@ void AliPHOSGetter::SetTitle(const char * branchTitle ) } //____________________________________________________________________________ -void AliPHOSGetter::CloseSplitFiles(void){ +void AliPHOSGetter::CloseSplitFiles(void) +{ + // Close files opened in a split mode TFile * file ; file = static_cast(gROOT->GetFile(fSDigitsFileName.Data() ) ) ; if(file)