X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALGetter.cxx;h=11a9b9d34cd4c8a26b1815f337b9a58e26eaa6e6;hb=d920bdeee9a26efcad00dcedc27cb299a55196a2;hp=e0176c9cdaccb300a7490b2e5eb13462d2ab86fe;hpb=ed215ae7298e6c209b70d4f4e6ae57b471742aff;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALGetter.cxx b/EMCAL/AliEMCALGetter.cxx index e0176c9cdac..11a9b9d34cd 100644 --- a/EMCAL/AliEMCALGetter.cxx +++ b/EMCAL/AliEMCALGetter.cxx @@ -13,13 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* $Id: */ - -/* $Log: - 29.05.2001 Yuri Kharlov: - Everywhere reading the treese TTree->GetEvent(i) - is replaced by reading the branches TBranch->GetEntry(0) -*/ +/* $Id$ */ //_________________________________________________________________________ // A singleton. This class should be used in the analysis stage to get @@ -35,7 +29,7 @@ // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) // AliEMCALRecParticle * part = gime->RecParticle(1) ; // ................ -// please->GetEvent(event) ; // reads new event from galice.root +// gime->Event(event) ; // reads new event from galice.root // //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) //*-- Completely redesigned by Dmitri Peressounko March 2001 @@ -44,1840 +38,892 @@ //*-- systematic usage of TFolders without changing the interface ////////////////////////////////////////////////////////////////////////////// - // --- ROOT system --- -#include "TFile.h" -#include "TTree.h" -#include "TROOT.h" -#include "TObjString.h" -#include "TFolder.h" +#include +#include +#include +#include +#include +//#include +//#include // --- Standard library --- -#include // --- AliRoot header files --- -#include "AliRun.h" -#include "AliConfig.h" +#include "AliEMCAL.h" #include "AliEMCALGetter.h" -#include "AliEMCALHit.h" -#include "AliEMCALv1.h" -#include "AliEMCALDigitizer.h" -#include "AliEMCALSDigitizer.h" -#include "AliEMCALClusterizer.h" -#include "AliEMCALClusterizerv1.h" -//#include "AliEMCALTrackSegmentMaker.h" -//#include "AliEMCALTrackSegmentMakerv1.h" -//#include "AliEMCALTrackSegment.h" -//#include "AliEMCALPID.h" -//#include "AliEMCALPIDv1.h" -#include "AliEMCALGeometry.h" +#include "AliEMCALLoader.h" +#include "AliHeader.h" +#include "AliMC.h" +#include "AliRunLoader.h" +#include "AliStack.h" +#include "AliEMCALRawStream.h" +#include "AliRawReaderFile.h" ClassImp(AliEMCALGetter) - AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; +AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; +AliEMCALLoader * AliEMCALGetter::fgEmcalLoader = 0; +Int_t AliEMCALGetter::fgDebug = 0; +TString AliEMCALGetter::fVersion = ""; + +// TFile * AliEMCALGetter::fgFile = 0 ; //____________________________________________________________________________ -AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw) +AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* version, Option_t * openingOption) { - //Initialize all lists - - fDebug = 0 ; - - fHeaderFile = headerFile ; - fBranchTitle = branchTitle ; - fSDigitsTitle = branchTitle ; - fDigitsTitle = branchTitle ; - fRecPointsTitle = branchTitle ; - //fRecParticlesTitle = branchTitle ; - //fTrackSegmentsTitle = branchTitle ; - - fPrimaries = new TObjArray(1) ; - - fModuleFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Configuration/Modules")); - fHitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); - fSDigitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); - fDigitsFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/Data")); - fRecoFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Event/RecData")); - //fQAFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Run/Conditions/QA")); - fTasksFolder = dynamic_cast(gROOT->FindObjectAny("Folders/Tasks")) ; - - fFailed = kFALSE ; - - if (!fFile) - fFile = new TFile() ; - - if (fFile->IsOpen() ) - fFile->Close() ; - - if ( fHeaderFile != "aliroot" ) { // to call the getter without a file + // ctor only called by Instance() - //open headers file - fFile = static_cast(gROOT->GetFile(fHeaderFile.Data() ) ) ; - - if(!fFile){ //if file was not opened yet, read gAlice - // if(fHeaderFile.Contains("rfio")) // if we read file using HPSS - fFile = TFile::Open(fHeaderFile.Data(),rw) ; - //else - //fFile = new TFile(fHeaderFile.Data(),rw) ; - - if (!fFile->IsOpen()) { - cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ; - fFailed = kTRUE ; - return ; - } - - gAlice = static_cast(fFile->Get("gAlice")) ; - } - } + // initialize data members + SetDebug(0) ; + //fBTE = 0 ; + + fLoadingStatus = "" ; - if (!gAlice) { - cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; - fFailed = kTRUE ; - return ; - } - if (!EMCAL()) { - if (fDebug) - cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ; - AliConfig * conf = AliConfig::Instance() ; - conf->Add(static_cast(gAlice->GetDetector("EMCAL"))) ; - conf->Add(static_cast(gAlice->GetDetector("EMCAL"))) ; - } + fgObjGetter=this; - fDebug=0; + OpenFile(headerFile,version,openingOption); } -//____________________________________________________________________________ -AliEMCALGetter::~AliEMCALGetter(){ - - if (fPrimaries) { - fPrimaries->Delete() ; - delete fPrimaries ; - } - delete fFile ; -} //____________________________________________________________________________ -void AliEMCALGetter::CreateWhiteBoard() const +AliEMCALGetter::~AliEMCALGetter() { + //PH AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle()); + //PH delete rl; + fgEmcalLoader = 0 ; + fgObjGetter = 0; + fVersion = ""; +} +//____________________________________________________________________________ +void AliEMCALGetter::OpenFile(const char* headerFile, const char* version, Option_t * openingOption) { + fVersion = version; + AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ; + if (!rl) { + rl = AliRunLoader::Open(headerFile, version, openingOption); + if (!rl) { + Fatal("AliEMCALGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ; + return ; + } + if (rl->GetAliRun() == 0x0) { + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); // should be removed + } + } + fgEmcalLoader = dynamic_cast(rl->GetLoader("EMCALLoader")); + if ( !fgEmcalLoader ) + Error("AliEMCALGetter", "Could not find EMCALLoader") ; + else + fgEmcalLoader->SetTitle(version); } //____________________________________________________________________________ -AliEMCALGetter * AliEMCALGetter::GetInstance() +void AliEMCALGetter::Reset() { - // Returns the pointer of the unique instance already defined - - AliEMCALGetter * rv = 0 ; - if ( fgObjGetter ) - rv = fgObjGetter ; - else - cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ; + // resets things in case the getter is called consecutively with different files + // the EMCAL Loader is already deleted by the Run Loader - return rv ; } //____________________________________________________________________________ -AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile, - const char* branchTitle, const Option_t * rw) -{ - // Creates and returns the pointer of the unique instance - // Must be called only when the environment has changed - - if ( fgObjGetter ) - if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) && - (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0)) - return fgObjGetter ; - else - fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version - - fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ; - - // Posts a few item to the white board (folders) - // fgObjGetter->CreateWhiteBoard() ; - - return fgObjGetter ; - +AliEMCALClusterizer * AliEMCALGetter::Clusterizer() +{ + // return pointer to Clusterizer Tree + AliEMCALClusterizer * rv ; + rv = dynamic_cast(EmcalLoader()->Reconstructioner()) ; + if (!rv) { + Event(0, "R") ; + rv = dynamic_cast(EmcalLoader()->Reconstructioner()) ; + } + return rv ; } + //____________________________________________________________________________ -const AliEMCALv1 * AliEMCALGetter::EMCAL() +TClonesArray * AliEMCALGetter::Digits() const { - // returns the EMCAL object - AliEMCALv1 * emcal = dynamic_cast(fModuleFolder->FindObject("EMCAL")) ; - if (!emcal) - if (fDebug) - cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ; - return emcal ; -} + // asks the Loader to return the Digits container + + TClonesArray * rv = 0 ; + rv = EmcalLoader()->Digits() ; + + if( !rv ) { + EmcalLoader()->MakeDigitsArray() ; + rv = EmcalLoader()->Digits() ; + } + return rv ; +} //____________________________________________________________________________ -AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() -{ - AliEMCALGeometry * rv = 0 ; - if (EMCAL() ) - rv = EMCAL()->GetGeometry() ; +AliEMCALDigitizer * AliEMCALGetter::Digitizer() +{ + // return pointer to Digitizer Tree + AliEMCALDigitizer * rv ; + rv = dynamic_cast(EmcalLoader()->Digitizer()) ; + if (!rv) { + Event(0, "D") ; + rv = dynamic_cast(EmcalLoader()->Digitizer()) ; + } return rv ; -} +} //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostHits(void) const -{ //------- Hits ---------------------- +TObjArray * AliEMCALGetter::ECARecPoints() const +{ + // asks the Loader to return the EMC RecPoints container - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits + TObjArray * rv = 0 ; - TFolder * emcalFolder = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; - } - emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; - } - TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ; - hits->SetName("Hits") ; - emcalFolder->Add(hits) ; - - return kTRUE; -} + rv = EmcalLoader()->ECARecPoints() ; + if (!rv) { + EmcalLoader()->MakeRecPointsArray() ; + rv = EmcalLoader()->ECARecPoints() ; + } + return rv ; +} //____________________________________________________________________________ -TObject ** AliEMCALGetter::HitsRef(void) const -{ //------- Hits ---------------------- +TClonesArray * AliEMCALGetter::TrackSegments() const +{ + // asks the Loader to return the TrackSegments container + TClonesArray * rv = 0 ; - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits - if ( !fHitsFolder ) { - cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl; - return 0; - } - - TFolder * emcalFolder = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; - return 0; + rv = EmcalLoader()->TrackSegments() ; + if (!rv) { + EmcalLoader()->MakeTrackSegmentsArray() ; + rv = EmcalLoader()->TrackSegments() ; } - - TObject * h = emcalFolder->FindObject("Hits") ; - if(!h) { - cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ; - return 0 ; + return rv ; +} + +//____________________________________________________________________________ +AliEMCALTrackSegmentMaker * AliEMCALGetter::TrackSegmentMaker() +{ + // return pointer to TrackSegmentMaker Tree + AliEMCALTrackSegmentMaker * rv ; + rv = dynamic_cast(EmcalLoader()->TrackSegmentMaker()) ; + if (!rv) { + Event(0, "T") ; + rv = dynamic_cast(EmcalLoader()->TrackSegmentMaker()) ; } - else - return emcalFolder->GetListOfFolders()->GetObjectRef(h) ; + return rv ; } //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const -{ //---------- SDigits ------------------------- +TClonesArray * AliEMCALGetter::RecParticles() const +{ + // asks the Loader to return the TrackSegments container + TClonesArray * rv = 0 ; - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname - // because you can have sdigits from several hit files for mixing - - TFolder * emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; - } - emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - } - TString subdir(headerFile) ; - subdir.ReplaceAll("/", "_") ; - TFolder * emcalSubFolder = dynamic_cast(emcalFolder->FindObject(subdir)) ; - if ( !emcalSubFolder ) - emcalSubFolder = emcalFolder->AddFolder(subdir, ""); - - TObject * sd = emcalSubFolder->FindObject(name); - if ( sd ) { - if (fDebug) - cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir - << " already exists!" << endl ; - }else{ - TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ; - sdigits->SetName(name) ; - emcalSubFolder->Add(sdigits) ; + rv = EmcalLoader()->RecParticles() ; + if (!rv) { + EmcalLoader()->MakeRecParticlesArray() ; + rv = EmcalLoader()->RecParticles() ; } - - return kTRUE; -} + return rv ; +} //____________________________________________________________________________ -TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const -{ //------- SDigits ---------------------- - - // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits +void AliEMCALGetter::Event(Int_t event, const char* opt) +{ + // Reads the content of all Tree's S, D and R - if ( !fSDigitsFolder ) { - cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl; - return 0; - } - - TFolder * emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; - return 0; + if ( event >= MaxEvent() ) { + Error("Event", "%d not found in TreeE !", event) ; + return ; } - TFolder * emcalSubFolder = 0 ; - if(file) - emcalSubFolder = dynamic_cast(emcalFolder->FindObject(file)) ; - else - emcalSubFolder = dynamic_cast(emcalFolder->FindObject(fHeaderFile)) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + // checks if we are dealing with test-beam data +// TBranch * btb = rl->TreeE()->GetBranch("AliEMCALBeamTestEvent") ; +// if(btb){ +// if(!fBTE) +// fBTE = new AliEMCALBeamTestEvent() ; +// btb->SetAddress(&fBTE) ; +// btb->GetEntry(event) ; +// } +// else{ +// if(fBTE){ +// delete fBTE ; +// fBTE = 0 ; +// } +// } + + // Loads the type of object(s) requested - if(!emcalSubFolder) { - cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl; - return 0; - } + rl->GetEvent(event) ; - TObject * dis = emcalSubFolder->FindObject(name) ; - if(!dis) - return 0 ; - else - return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ; + if( strstr(opt,"X") || (strcmp(opt,"")==0) ) + ReadPrimaries() ; + + if(strstr(opt,"H") ) + ReadTreeH(); + + if(strstr(opt,"S") ) + ReadTreeS() ; + + if( strstr(opt,"D") ) + ReadTreeD() ; + if( strstr(opt,"R") ) + ReadTreeR() ; + + if( strstr(opt,"T") ) + ReadTreeT() ; + + if( strstr(opt,"P") ) + ReadTreeP() ; + + if( strstr(opt,"W") ) + ReadRaw(event) ; + } + //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const -{ //---------- SDigitizer ------------------------- - - // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname +Int_t AliEMCALGetter::EventNumber() const + { + // return the current event number + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return static_cast(rl->GetEventNumber()) ; +} +//____________________________________________________________________________ + TClonesArray * AliEMCALGetter::Hits() const +{ + // asks the loader to return the Hits container + + TClonesArray * rv = 0 ; + + rv = EmcalLoader()->Hits() ; + if ( !rv ) { + EmcalLoader()->LoadHits("read"); + rv = EmcalLoader()->Hits() ; + } + return rv ; +} - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; +//____________________________________________________________________________ +AliEMCALGetter * AliEMCALGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption) +{ + // Creates and returns the pointer of the unique instance + // Must be called only when the environment has changed - if ( !sd ) { - cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; - return kFALSE ; - } - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl; + if(!fgObjGetter){ // first time the getter is called + fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ; + } + else { // the getter has been called previously + AliRunLoader * rl = AliRunLoader::GetRunLoader(fVersion); + if (rl == 0) fgObjGetter->OpenFile(alirunFileName, version, openingOption) ; + else if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name + // check if the file is already open + TFile * galiceFile = dynamic_cast(gROOT->FindObject(rl->GetFileName()) ) ; + + if ( !galiceFile ) + fgObjGetter->OpenFile(alirunFileName, version, openingOption); + + else { // the file is already open check the version name + TString currentVersionName = rl->GetEventFolder()->GetName() ; + TString newVersionName(version) ; + if (currentVersionName == newVersionName) + if(fgDebug) + ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ; + else { + fgEmcalLoader->SetTitle(version); fVersion = version; + } + } + } + else { + AliRunLoader * rl = AliRunLoader::GetRunLoader(fVersion); + if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging + delete rl ; + fgObjGetter->OpenFile(alirunFileName, version, openingOption) ; } - emcal = new TTask("EMCAL", "") ; - sd->Add(emcal) ; - } - AliEMCALSDigitizer * emcalsd = dynamic_cast(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() )); - if (emcalsd) { - if (fDebug) - cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ; - emcal->GetListOfTasks()->Remove(emcalsd) ; } - emcal->Add(sdigitizer) ; - return kTRUE; - + if (!fgObjGetter) + ::Error("AliEMCALGetter::Instance", "Failed to create the EMCAL Getter object") ; + else + if (fgDebug) + Print() ; + + return fgObjGetter ; } //____________________________________________________________________________ -TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const -{ +AliEMCALGetter * AliEMCALGetter::Instance() +{ + // Returns the pointer of the unique instance already defined + + if(!fgObjGetter && fgDebug) + ::Warning("AliEMCALGetter::Instance", "Getter not initialized") ; - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if ( !sd ) { - cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; - abort(); - } + return fgObjGetter ; + +} - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl; - abort(); - } +//____________________________________________________________________________ +Int_t AliEMCALGetter::MaxEvent() const +{ + // returns the number of events in the run (from TE) - TTask * task = dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return static_cast(rl->GetNumberOfEvents()) ; +} - return emcal->GetListOfTasks()->GetObjectRef(task) ; +//____________________________________________________________________________ +TParticle * AliEMCALGetter::Primary(Int_t index) const +{ + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return rl->Stack()->Particle(index) ; +} -} +//____________________________________________________________________________ +Int_t AliEMCALGetter::NPrimaries() const +{ + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return (rl->GetHeader())->GetNtrack(); +} //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const -{ //---------- SDigitizer ------------------------- - - // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname +AliEMCAL * AliEMCALGetter:: EMCAL() const +{ + // returns the EMCAL object + AliEMCALLoader * loader = 0; + static AliEMCALLoader * oldloader = 0; + static AliEMCAL * emcal = 0; + + loader = EmcalLoader(); + if (loader != oldloader ) { + emcal = dynamic_cast(loader->GetModulesFolder()->FindObject("EMCAL")) ; + oldloader = loader; + } + if (!emcal) + if (fgDebug) + Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ; + return emcal ; +} - TTask * sd = dynamic_cast(fTasksFolder->FindObject("SDigitizer")) ; - if ( !sd ) { - cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; - return kFALSE ; - } - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - sd->Add(emcal) ; - } - TString sdname(name) ; - sdname.Append(":") ; - sdname.Append(file); - sdname.ReplaceAll("/","_") ; - AliEMCALSDigitizer * emcalsd = dynamic_cast(emcal->GetListOfTasks()->FindObject( sdname )); - if (!emcalsd) { - emcalsd = new AliEMCALSDigitizer() ; - //Note, we can not call constructor with parameters: it will call Getter and scrud up everething - emcalsd->SetName(sdname) ; - emcalsd->SetTitle(file) ; - emcal->Add(emcalsd) ; +//____________________________________________________________________________ +AliEMCALPID * AliEMCALGetter::PID() +{ + // return pointer to PID Tree + AliEMCALPID * rv ; + rv = dynamic_cast(EmcalLoader()->PIDTask()) ; + if (!rv) { + Event(0, "P") ; + rv = dynamic_cast(EmcalLoader()->PIDTask()) ; } - return kTRUE; - + return rv ; } //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostDigits(const char * name) const -{ //---------- Digits ------------------------- - - // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name +AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() const +{ + // Returns EMCAL geometry - TFolder * emcalFolder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; + AliEMCALGeometry * rv = 0 ; + if (EMCAL() ) + rv = EMCAL()->GetGeometry() ; + return rv ; +} - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl; - } - emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ; - } - - TObject* dig = emcalFolder->FindObject( name ) ; - if ( !dig ) { - TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ; - digits->SetName(name) ; - emcalFolder->Add(digits) ; - } - return kTRUE; +//____________________________________________________________________________ +void AliEMCALGetter::Print() +{ + // Print usefull information about the getter + + AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle()); + ::Info("Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ; } //____________________________________________________________________________ -TObject ** AliEMCALGetter::DigitsRef(const char * name) const -{ //------- Digits ---------------------- +void AliEMCALGetter::ReadPrimaries() +{ + // Read Primaries from Kinematics.root - // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name - - if ( !fDigitsFolder ) { - cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl; - return 0; - } + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); - TFolder * emcalFolder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; - return 0; - } - - TObject * d = emcalFolder->FindObject(name) ; - if(!d) - return 0 ; - else - return emcalFolder->GetListOfFolders()->GetObjectRef(d) ; - + // gets kine tree from the root file (Kinematics.root) + if ( ! rl->TreeK() ) // load treeK the first time + rl->LoadKinematics() ; + + if (fgDebug) + Info("ReadTreeK", "Found %d particles in event # %d", NPrimaries(), EventNumber() ) ; } //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const -{ //---------- Digitizer ------------------------- - - TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - - if ( !sd ) { - cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; - return kFALSE ; - } - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; +void AliEMCALGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) +{ + // Fits the raw signal time distribution + + const Int_t kNoiseThreshold = 0 ; + Double_t timezero1 = 0., timezero2 = 0., timemax = 0. ; + Double_t signal = 0., signalmax = 0. ; + Double_t energy = time = 0. ; + + if (lowGainFlag) { + timezero1 = timezero2 = signalmax = timemax = 0. ; + signalF->FixParameter(0, EMCAL()->GetRawFormatLowCharge()) ; + signalF->FixParameter(1, EMCAL()->GetRawFormatLowGain()) ; + Int_t index ; + for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) { + gLowGain->GetPoint(index, time, signal) ; + if (signal > kNoiseThreshold && timezero1 == 0.) + timezero1 = time ; + if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.) + timezero2 = time ; + if (signal > signalmax) { + signalmax = signal ; + timemax = time ; + } } - emcal = new TTask("EMCAL", "") ; - sd->Add(emcal) ; - } - - AliEMCALDigitizer * emcald = dynamic_cast(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ; - if (emcald) { - emcald->Delete() ; - emcal->GetListOfTasks()->Remove(emcald) ; + signalmax /= EMCAL()->RawResponseFunctionMax(EMCAL()->GetRawFormatLowCharge(), + EMCAL()->GetRawFormatLowGain()) ; + if ( timezero1 + EMCAL()->GetRawFormatTimePeak() < EMCAL()->GetRawFormatTimeMax() * 0.4 ) { // else its noise + signalF->SetParameter(2, signalmax) ; + signalF->SetParameter(3, timezero1) ; + gLowGain->Fit(signalF, "QRON", "", 0., timezero2); //, "QRON") ; + energy = signalF->GetParameter(2) ; + time = signalF->GetMaximumX() - EMCAL()->GetRawFormatTimePeak() - EMCAL()->GetRawFormatTimeTrigger() ; + } + } else { + timezero1 = timezero2 = signalmax = timemax = 0. ; + signalF->FixParameter(0, EMCAL()->GetRawFormatHighCharge()) ; + signalF->FixParameter(1, EMCAL()->GetRawFormatHighGain()) ; + Int_t index ; + for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) { + gHighGain->GetPoint(index, time, signal) ; + if (signal > kNoiseThreshold && timezero1 == 0.) + timezero1 = time ; + if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.) + timezero2 = time ; + if (signal > signalmax) { + signalmax = signal ; + timemax = time ; + } } - emcal->Add(digitizer) ; - return kTRUE; -} + signalmax /= EMCAL()->RawResponseFunctionMax(EMCAL()->GetRawFormatHighCharge(), + EMCAL()->GetRawFormatHighGain()) ;; + if ( timezero1 + EMCAL()->GetRawFormatTimePeak() < EMCAL()->GetRawFormatTimeMax() * 0.4 ) { // else its noise + signalF->SetParameter(2, signalmax) ; + signalF->SetParameter(3, timezero1) ; + gHighGain->Fit(signalF, "QRON", "", 0., timezero2) ; + energy = signalF->GetParameter(2) ; + time = signalF->GetMaximumX() - EMCAL()->GetRawFormatTimePeak() - EMCAL()->GetRawFormatTimeTrigger() ; + } + } + + if (time == 0. && energy == 0.) + amp = 0 ; + else { + AliEMCALDigitizer * digitizer = Digitizer() ; + amp = static_cast( (energy - digitizer->GetECApedestal()) / digitizer->GetECAchannel() + 0.5 ) ; + } + // dessin +// TCanvas * c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500); +// c1->SetFillColor(42); +// c1->SetGrid(); +// gLowGain->SetLineColor(2); +// gLowGain->SetLineWidth(4); +// gLowGain->SetMarkerColor(4); +// gLowGain->SetMarkerStyle(21); +// gLowGain->SetTitle("Lowgain"); +// gLowGain->GetXaxis()->SetTitle("X title"); +// gLowGain->GetYaxis()->SetTitle("Y title"); +// gLowGain->Draw("ACP"); + +// c1->Update(); +// c1->GetFrame()->SetFillColor(21); +// c1->GetFrame()->SetBorderSize(12); +// c1->Modified(); + +// TCanvas * c2 = new TCanvas("c2","A Simple Graph Example",200,10,700,500); +// c2->SetFillColor(42); +// c2->SetGrid(); +// gHighGain->SetLineColor(2); +// gHighGain->SetLineWidth(4); +// gHighGain->SetMarkerColor(4); +// gHighGain->SetMarkerStyle(21); +// gHighGain->SetTitle("Highgain"); +// gHighGain->GetXaxis()->SetTitle("X title"); +// gHighGain->GetYaxis()->SetTitle("Y title"); +// gHighGain->Draw("ACP"); + +// c2->Update(); +// c2->GetFrame()->SetFillColor(21); +// c2->GetFrame()->SetBorderSize(12); +// c2->Modified(); +} //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostDigitizer(const char * name) const -{ //---------- Digitizer ------------------------- +Int_t AliEMCALGetter::ReadRaw(Int_t event) +{ + // reads the raw format data, converts it into digits format and store digits in Digits() + // container. - // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname - - TTask * d = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if ( !d ) { - cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(d->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - d->Add(emcal) ; -} + AliRawReaderFile rawReader(event) ; + AliEMCALRawStream in(&rawReader); + + Bool_t first = kTRUE ; + + TF1 * signalF = new TF1("signal", AliEMCAL::RawResponseFunction, 0, EMCAL()->GetRawFormatTimeMax(), 4); + signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ; + + + Int_t id = -1; + Bool_t lowGainFlag = kFALSE ; + + TClonesArray * digits = Digits() ; + digits->Clear() ; + Int_t idigit = 0 ; + Int_t amp = 0 ; + Double_t time = 0. ; + + TGraph * gLowGain = new TGraph(EMCAL()->GetRawFormatTimeBins()) ; + TGraph * gHighGain= new TGraph(EMCAL()->GetRawFormatTimeBins()) ; + + while ( in.Next() ) { // EMCAL entries loop + if ( in.IsNewId() ) { + if (!first) { + FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ; + if (amp > 0) { + new((*digits)[idigit]) AliEMCALDigit( -1, -1, id, amp, time) ; + idigit++ ; + } + Int_t index ; + for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) { + gLowGain->SetPoint(index, index * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), 0) ; + gHighGain->SetPoint(index, index * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), 0) ; + } + } + first = kFALSE ; + id = in.GetId() ; + if (in.GetModule() == EMCAL()->GetRawFormatLowGainOffset() ) + lowGainFlag = kTRUE ; + else + lowGainFlag = kFALSE ; + } + if (lowGainFlag) + gLowGain->SetPoint(in.GetTime(), + in.GetTime()* EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), + in.GetSignal()) ; + else + gHighGain->SetPoint(in.GetTime(), + in.GetTime() * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), + in.GetSignal() ) ; + + } // EMCAL entries loop + digits->Sort() ; - AliEMCALDigitizer * emcald = dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; - if (!emcald) { - emcald = new AliEMCALDigitizer() ; - emcald->SetName(fDigitsTitle) ; - emcald->SetTitle(fHeaderFile) ; - emcal->Add(emcald) ; - } - return kTRUE; + delete signalF ; + delete gLowGain; + delete gHighGain ; + + return Digits()->GetEntriesFast() ; +} + + //____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeD() +{ + // Read the Digits + + EmcalLoader()->CleanDigits() ; + // gets TreeD from the root file (EMCAL.Digits.root) + //if ( !IsLoaded("D") ) { + EmcalLoader()->LoadDigits("UPDATE") ; + EmcalLoader()->LoadDigitizer("UPDATE") ; + // SetLoaded("D") ; + //} + return Digits()->GetEntries() ; } //____________________________________________________________________________ -TObject ** AliEMCALGetter::DigitizerRef(const char * name) const -{ - TTask * sd = dynamic_cast(fTasksFolder->FindObject("Digitizer")) ; - if ( !sd ) { - cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; - abort(); - } - - TTask * emcal = dynamic_cast(sd->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl; - abort(); - } +Int_t AliEMCALGetter::ReadTreeH() +{ + // Read the Hits + EmcalLoader()->CleanHits() ; + // gets TreeH from the root file (EMCAL.Hit.root) + //if ( !IsLoaded("H") ) { + EmcalLoader()->LoadHits("UPDATE") ; + //SetLoaded("H") ; + //} + return Hits()->GetEntries() ; +} - TTask * task = dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; +//____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeR() +{ + // Read the RecPoints - return emcal->GetListOfTasks()->GetObjectRef(task) ; + EmcalLoader()->CleanRecPoints() ; + // gets TreeR from the root file (EMCAL.RecPoints.root) + //if ( !IsLoaded("R") ) { + EmcalLoader()->LoadRecPoints("UPDATE") ; + EmcalLoader()->LoadClusterizer("UPDATE") ; + // SetLoaded("R") ; + //} + return ECARecPoints()->GetEntries() ; } - + //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostRecPoints(const char * name) const -{ // -------------- RecPoints ------------------------------------------- +Int_t AliEMCALGetter::ReadTreeT() +{ + // Read the TrackSegments - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name + EmcalLoader()->CleanTracks() ; + // gets TreeT from the root file (EMCAL.TrackSegments.root) + //if ( !IsLoaded("T") ) { + EmcalLoader()->LoadTracks("UPDATE") ; + EmcalLoader()->LoadTrackSegmentMaker("UPDATE") ; + // SetLoaded("T") ; + //} - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; - } - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; - } - - // Tower RecPoints - TFolder * emcalRPoTowerFolder = dynamic_cast(emcalFolder->FindObject("TowerRecPoints")) ; - if ( !emcalRPoTowerFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl; - } - emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ; - } + return TrackSegments()->GetEntries() ; +} +//____________________________________________________________________________ +Int_t AliEMCALGetter::ReadTreeP() +{ + // Read the RecParticles - TObject * erp = emcalFolder->FindObject( name ) ; - if ( !erp ) { - TObjArray * towerrp = new TObjArray(100) ; - towerrp->SetName(name) ; - emcalRPoTowerFolder->Add(towerrp) ; - } + EmcalLoader()->CleanRecParticles() ; + // gets TreeP from the root file (EMCAL.RecParticles.root) + // if ( !IsLoaded("P") ) { + EmcalLoader()->LoadRecParticles("UPDATE") ; + EmcalLoader()->LoadPID("UPDATE") ; + // SetLoaded("P") ; + // } - // Pre Shower RecPoints - TFolder * emcalRPoPreShoFolder = dynamic_cast(emcalFolder->FindObject("PreShoRecPoints")) ; - if ( !emcalRPoPreShoFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; - } - emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ; - } - - TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ; - if ( !crp ) { - TObjArray * preshorp = new TObjArray(100) ; - preshorp->SetName(name) ; - emcalRPoPreShoFolder->Add(preshorp) ; - } - return kTRUE; + return RecParticles()->GetEntries() ; } - //____________________________________________________________________________ -TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const -{ // -------------- RecPoints ------------------------------------------- +Int_t AliEMCALGetter::ReadTreeS() +{ + // Read the SDigits - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name - - if ( !fRecoFolder ) { - cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; - return 0 ; - } - - TFolder * towerFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; - if ( !towerFolder ) { - cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; - return 0; - } - - - TObject * trp = towerFolder->FindObject(name ) ; - if ( !trp ) { - return 0 ; - } - return towerFolder->GetListOfFolders()->GetObjectRef(trp) ; + // EmcalLoader()->CleanSDigits() ; + // gets TreeS from the root file (EMCAL.SDigits.root) + // if ( !IsLoaded("S") ) { + EmcalLoader()->LoadSDigits("READ") ; + EmcalLoader()->LoadSDigitizer("READ") ; + // SetLoaded("S") ; + //} -} + return SDigits()->GetEntries() ; +} //____________________________________________________________________________ -TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const -{ // -------------- RecPoints ------------------------------------------- +TClonesArray * AliEMCALGetter::SDigits() const +{ + // asks the Loader to return the Digits container + + TClonesArray * rv = 0 ; - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name - - if ( !fRecoFolder ) { - cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; - return 0 ; - } - - TFolder * preshoFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; - if ( !preshoFolder ) { - cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; - return 0; - } - - TObject * prp = preshoFolder->FindObject(name ) ; - if ( !prp ) { - return 0 ; + rv = EmcalLoader()->SDigits() ; + if (!rv) { + EmcalLoader()->MakeSDigitsArray() ; + rv = EmcalLoader()->SDigits() ; } - return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ; - -} + return rv ; +} //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const -{ // ------------------ AliEMCALClusterizer ------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALClusterizerv1 * emcalcl = dynamic_cast(emcal->GetListOfTasks()->FindObject(clu->GetName())) ; - if (emcalcl) { - if (fDebug) - cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ; - emcalcl->Delete() ; - emcal->GetListOfTasks()->Remove(emcalcl) ; +AliEMCALSDigitizer * AliEMCALGetter::SDigitizer() +{ + // Return pointer to SDigitizer task + AliEMCALSDigitizer * rv ; + rv = dynamic_cast(EmcalLoader()->SDigitizer()) ; + if (!rv) { + Event(0, "S") ; + rv = dynamic_cast(EmcalLoader()->SDigitizer()) ; } - emcal->Add(clu) ; - return kTRUE; -} + return rv ; +} //____________________________________________________________________________ -TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const -{ // ------------------ AliEMCALClusterizer ------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; +TParticle * AliEMCALGetter::Secondary(const TParticle* p, Int_t index) const +{ + // Return first (index=1) or second (index=2) secondary particle of primary particle p - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; + if(index <= 0) + return 0 ; + if(index > 2) return 0 ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - return 0 ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * clu = 0 ; - TString cluname(name) ; - cluname+=":clu-" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(cluname)){ - clu = task ; - break ; - } - } - if(clu) - return l->GetObjectRef(clu) ; + if(p) { + Int_t daughterIndex = p->GetDaughter(index-1) ; + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ; + } else return 0 ; } //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostClusterizer(const char * name) const -{ // ------------------ AliEMCALClusterizer ------------------------ +void AliEMCALGetter::Track(Int_t itrack) +{ + // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() + + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; + if( !TreeH() ) // load treeH the first time + rl->LoadHits() ; - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } + // first time create the container + TClonesArray * hits = Hits() ; + if ( hits ) + hits->Clear() ; - AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ; - TString clun(name) ; - clun+=":clu-v1" ; - emcalcl->SetName(clun) ; - emcal->Add(emcalcl) ; - return kTRUE; - + TBranch * emcalbranch = dynamic_cast(TreeH()->GetBranch("EMCAL")) ; + emcalbranch->SetAddress(&hits) ; + emcalbranch->GetEntry(itrack) ; } //____________________________________________________________________________ -/*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl; - } - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; - } - - TFolder * emcalTSFolder = dynamic_cast(emcalFolder->FindObject("TrackSegments")) ; - if ( !emcalTSFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl; - } - emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ; - } - - TObject * tss = emcalTSFolder->FindObject( name ) ; - if (!tss) { - TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ; - ts->SetName(name) ; - emcalTSFolder->Add(ts) ; - } - return kTRUE; -} - -//____________________________________________________________________________ -TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - if ( !fRecoFolder ) { - cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl; - return 0 ; - } - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; - if ( !emcalFolder ) { - cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; - return 0; - } - - TObject * tss = emcalFolder->FindObject(name) ; - if (!tss) { - return 0 ; - } - return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; -} - -//____________________________________________________________________________ -Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const -{ //------------Track Segment Maker ------------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALTrackSegmentMaker * emcalts = - dynamic_cast(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ; - if (emcalts) { - emcalts->Delete() ; - emcal->GetListOfTasks()->Remove(emcalts) ; - } - emcal->Add(tsmaker) ; - return kTRUE; - -} -//____________________________________________________________________________ -Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const -{ //------------Track Segment Maker ------------------------------ - - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALTrackSegmentMaker * emcalts = - dynamic_cast(emcal->GetListOfTasks()->FindObject(name)) ; - if (!emcalts) { - emcalts = new AliEMCALTrackSegmentMakerv1() ; - TString tsn(name); - tsn+=":tsm-v1" ; - emcalts->SetName(tsn) ; - emcal->Add(emcalts) ; - } - return kTRUE; - -} - -//____________________________________________________________________________ -TObject ** AliEMCALGetter::TSMakerRef(const char * name) const -{ //------------Track Segment Maker ------------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return 0 ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; - return 0 ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * tsm = 0 ; - TString tsmname(name) ; - tsmname+=":tsm-" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(tsmname)){ - tsm = task ; - break ; - } - } - - if(tsm) - return l->GetObjectRef(tsm) ; - else - return 0 ; - -} - -//____________________________________________________________________________ -Bool_t AliEMCALGetter::PostRecParticles(const char * name) const -{ // -------------------- RecParticles ------------------------ - - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL")) ; - - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; - } - emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; - } - - TFolder * emcalRPaFolder = dynamic_cast(emcalFolder->FindObject("RecParticles")) ; - if ( !emcalRPaFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl; - } - emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ; +TTree * AliEMCALGetter::TreeD() const +{ + // return pointer to Digits Tree + TTree * rv = 0 ; + rv = EmcalLoader()->TreeD() ; + if ( !rv ) { + EmcalLoader()->MakeTree("D"); + rv = EmcalLoader()->TreeD() ; } - - TObject * rps = emcalRPaFolder->FindObject( name ) ; - if ( !rps ) { - TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ; - rp->SetName(name) ; - emcalRPaFolder->Add(rp) ; - } - return kTRUE; -} - -//____________________________________________________________________________ -TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const -{ // ---------------TrackSegments ----------------------------------- - // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name - - if ( !fRecoFolder ) { - cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl; - return 0 ; - } - - TFolder * emcalFolder = dynamic_cast(fRecoFolder->FindObject("EMCAL/RecParticles")) ; - if ( !emcalFolder ) { - cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; - return 0; - } - - TObject * tss = emcalFolder->FindObject(name ) ; - if (!tss) { - return 0 ; - } - return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; + return rv ; } //____________________________________________________________________________ -Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const -{ // ------------AliEMCAL PID ----------------------------- - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; - } - - AliEMCALPID * emcalpid = dynamic_cast(emcal->GetListOfTasks()->FindObject(pid->GetName())) ; - if (emcalpid) { - if (fDebug) - cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName() - << " already exists" << endl ; - emcal->GetListOfTasks()->Remove(emcalpid) ; - } - - emcal->Add(pid) ; - return kTRUE; -} - -//____________________________________________________________________________ -Bool_t AliEMCALGetter::PostPID(const char * name) const -{ - // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return kFALSE ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - if (fDebug) { - cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; - cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; - } - emcal = new TTask("EMCAL", "") ; - tasks->Add(emcal) ; +TTree * AliEMCALGetter::TreeH() const +{ + // return pointer to Hits Tree + TTree * rv = 0 ; + rv = EmcalLoader()->TreeH() ; + if ( !rv ) { + EmcalLoader()->MakeTree("H"); + rv = EmcalLoader()->TreeH() ; } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TString pidname(name) ; - pidname+=":pid" ; - TTask * task ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(pidname)) - return kTRUE ; - } - - AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ; - pidname+="-v1" ; - emcalpid->SetName(pidname) ; - emcal->Add(emcalpid) ; - return kTRUE; -} - -//____________________________________________________________________________ -TObject ** AliEMCALGetter::PIDRef(const char * name) const -{ //------------PID ------------------------------ - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; - - if ( !tasks ) { - cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; - return 0 ; - } - - TTask * emcal = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if ( !emcal ) { - cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl; - return 0 ; - } - - TList * l = emcal->GetListOfTasks() ; - TIter it(l) ; - TTask * task ; - TTask * pid = 0 ; - TString pidname(name) ; - pidname+=":pid-" ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(pidname)){ - pid = task ; - break ; - } - } - - if(pid) - return l->GetObjectRef(pid) ; - else - return 0 ; - -} - -//____________________________________________________________________________ -Bool_t AliEMCALGetter::PostQA(void) const -{ // ------------------ QA --------------------------------- - - // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName - - TFolder * emcalFolder = dynamic_cast(fQAFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - if (fDebug) { - cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; - cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl; - } - emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ; - } - - return kTRUE; + return rv ; } //____________________________________________________________________________ -TObject ** AliEMCALGetter::AlarmsRef(void) const -{ //------- Alarms ---------------------- - - - // the hierarchy is //Folders/Run/Conditions/QA/EMCAL - if ( !fQAFolder ) { - cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl; - return 0; - } - - TFolder * emcalFolder = dynamic_cast(fQAFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; - return 0; - } - - return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ; -} -*/ -//____________________________________________________________________________ -const TParticle * AliEMCALGetter::Primary(Int_t index) const +TTree * AliEMCALGetter::TreeR() const { - // Return primary particle numbered by - - if(index < 0) - return 0 ; - - Int_t primaryIndex = index % 10000000 ; - Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ; - - if ( primaryList > 0 ) { - if (fDebug) { - cout << " Getter does not support currently Mixing of primary " << endl ; - cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<Particle(primaryIndex) ; + // return pointer to RecPoints Tree + + TTree * rv = 0 ; + rv = EmcalLoader()->TreeR() ; + if ( !rv ) { + EmcalLoader()->MakeTree("R"); + rv = EmcalLoader()->TreeR() ; + } + return rv ; } //____________________________________________________________________________ -void AliEMCALGetter::ReadTreeD() -{ - // Read the digit tree gAlice->TreeD() - if(gAlice->TreeD()== 0){ - cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ; - return ; - } - - TObjArray * lob = static_cast(gAlice->TreeD()->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TBranch * digitsbranch = 0 ; - TBranch * digitizerbranch = 0 ; - Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcalfound || !digitizerfound) ) { - if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { - digitsbranch = branch ; - emcalfound = kTRUE ; - } - else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { - digitizerbranch = branch ; - digitizerfound = kTRUE ; - } - } - - if ( !emcalfound || !digitizerfound ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " - << fDigitsTitle << endl ; - return ; - } - - //read digits - if(!Digits(fDigitsTitle) ) - PostDigits(fDigitsTitle); - digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; - digitsbranch->GetEntry(0) ; - - - // read the Digitizer - if(!Digitizer(fDigitsTitle)) - PostDigitizer(fDigitsTitle) ; - digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ; - digitizerbranch->GetEntry(0) ; - +TTree * AliEMCALGetter::TreeT() const +{ + // return pointer to TrackSegments Tree + TTree * rv = 0 ; + rv = EmcalLoader()->TreeT() ; + if ( !rv ) { + EmcalLoader()->MakeTree("T"); + rv = EmcalLoader()->TreeT() ; + } + return rv ; } - //____________________________________________________________________________ -void AliEMCALGetter::ReadTreeH() +TTree * AliEMCALGetter::TreeP() const { - // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() - - if(gAlice->TreeH()== 0){ - cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; - return ; - } + // return pointer to RecParticles Tree + TTree * rv = 0 ; + rv = EmcalLoader()->TreeP() ; + if ( !rv ) { + EmcalLoader()->MakeTree("P"); + rv = EmcalLoader()->TreeP() ; + } - TBranch * hitsbranch = static_cast(gAlice->TreeH()->GetBranch("EMCAL")) ; - if ( !hitsbranch ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; - return ; - } - if(!Hits()) - PostHits() ; - - if (hitsbranch->GetEntries() > 1 ) { - TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ; - TClonesArray * hits = dynamic_cast(*HitsRef()) ; - hitsbranch->SetAddress(&tempo) ; - Int_t index = 0 ; - Int_t i = 0 ; - for (i = 0 ; i < hitsbranch->GetEntries() ; i++) { - hitsbranch->GetEntry(i) ; - Int_t j = 0 ; - for ( j = 0 ; j < tempo->GetEntries() ; j++) { - const AliEMCALHit * hit = static_cast(tempo->At(j)) ; - new((*hits)[index]) AliEMCALHit( *hit ) ; - index++ ; - } - } - delete tempo ; - } - else { - hitsbranch->SetAddress(HitsRef()) ; - hitsbranch->GetEntry(0) ; - } + return rv ; } //____________________________________________________________________________ -void AliEMCALGetter::Track(Int_t itrack) +TTree * AliEMCALGetter::TreeS() const { - // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() - - if(gAlice->TreeH()== 0){ - cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; - return ; - } - - TBranch * hitsbranch = dynamic_cast(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ; - if ( !hitsbranch ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; - return ; - } - if(!Hits()) - PostHits() ; - hitsbranch->SetAddress(HitsRef()) ; - hitsbranch->GetEntry(itrack) ; - + // return pointer to SDigits Tree + TTree * rv = 0 ; + rv = EmcalLoader()->TreeS() ; + if ( !rv ) { + EmcalLoader()->MakeTree("S"); + rv = EmcalLoader()->TreeS() ; + } + return rv ; } -//____________________________________________________________________________ -// void AliEMCALGetter::ReadTreeQA() -//{ - // Read the digit tree gAlice->TreeQA() - // so far only EMCAL knows about this Tree - -// if(EMCAL()->TreeQA()== 0){ -// cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ; -// return ; -// } - -// TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ; -// if (!qabranch) { -// if (fDebug) -// cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ; -// return ; -// } - -// if(!Alarms()) -// PostQA() ; - -// qabranch->SetAddress(AlarmsRef()) ; -// qabranch->GetEntry(0) ; - -// PostQA("EMCAL") ; -// TFolder * alarmsF = Alarms() ; -// alarmsF->Clear() ; -// qabranch->SetAddress(&alarmsF) ; -// qabranch->GetEntry(0) ; - -//} - //____________________________________________________________________________ -void AliEMCALGetter::ReadTreeR() +Bool_t AliEMCALGetter::VersionExists(TString & opt) const { - // Read the reconstrunction tree gAlice->TreeR() + // checks if the version with the present name already exists in the same directory - if(gAlice->TreeR()== 0){ - cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ; - return ; - } - - // RecPoints - TObjArray * lob = static_cast(gAlice->TreeR()->GetListOfBranches()) ; - TIter next(lob) ; - TBranch * branch = 0 ; - TBranch * towerbranch = 0 ; - TBranch * preshobranch = 0 ; - TBranch * clusterizerbranch = 0 ; - Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) ) - if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) { - if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) { - towerbranch = branch ; - emcaltowerrpfound = kTRUE ; - } - else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) { - preshobranch = branch ; - emcalpreshorpfound = kTRUE ; - } - else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){ - clusterizerbranch = branch ; - clusterizerfound = kTRUE ; - } - } - - if ( !emcaltowerrpfound ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title " - << fRecPointsTitle << endl ; - return ; - } - if ( !emcalpreshorpfound ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title " - << fRecPointsTitle << endl ; - return ; - } - if ( !clusterizerfound ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title " - << fRecPointsTitle << endl ; - return ; - } - - // Read and Post the RecPoints - if(!TowerRecPoints(fRecPointsTitle) ) - PostRecPoints(fRecPointsTitle) ; - towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ; - towerbranch->GetEntry(0) ; - - preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ; - preshobranch->GetEntry(0) ; - - if(!Clusterizer(fRecPointsTitle) ) - PostClusterizer(fRecPointsTitle) ; - clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ; - clusterizerbranch->GetEntry(0) ; + Bool_t rv = kFALSE ; - - //------------------- TrackSegments --------------------- -// next.Reset() ; -// TBranch * tsbranch = 0 ; -// TBranch * tsmakerbranch = 0 ; -// Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ; - -// while ( (branch = static_cast(next())) && (!emcaltsfound || !tsmakerfound) ) -// if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) { -// if ( strcmp(branch->GetName(), "EMCALTS")==0){ -// tsbranch = branch ; -// emcaltsfound = kTRUE ; -// } -// else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) { -// tsmakerbranch = branch ; -// tsmakerfound = kTRUE ; -// } -// } - -// if ( !emcaltsfound || !tsmakerfound ) { -// if (fDebug) -// cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name " -// << fTrackSegmentsTitle << endl ; -// return ; -// } - -// // Read and Post the TrackSegments -// if(!TrackSegments(fTrackSegmentsTitle)) -// PostTrackSegments(fTrackSegmentsTitle) ; -// tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ; -// tsbranch->GetEntry(0) ; - -// // Read and Post the TrackSegment Maker -// if(!TrackSegmentMaker(fTrackSegmentsTitle)) -// PostTrackSegmentMaker(fTrackSegmentsTitle) ; -// tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ; -// tsmakerbranch->GetEntry(0) ; - - -// //------------ RecParticles ---------------------------- -// next.Reset() ; -// TBranch * rpabranch = 0 ; -// TBranch * pidbranch = 0 ; -// Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ; - -// while ( (branch = static_cast(next())) && (!emcalrpafound || !pidfound) ) -// if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) { -// if ( strcmp(branch->GetName(), "EMCALRP")==0) { -// rpabranch = branch ; -// emcalrpafound = kTRUE ; -// } -// else if (strcmp(branch->GetName(), "AliEMCALPID")==0) { -// pidbranch = branch ; -// pidfound = kTRUE ; -// } -// } - -// if ( !emcalrpafound || !pidfound ) { -// if (fDebug) -// cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name " -// << fRecParticlesTitle << endl ; -// return ; -// } - -// // Read and Post the RecParticles -// if(!RecParticles(fRecParticlesTitle)) -// PostRecParticles(fRecParticlesTitle) ; -// rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ; -// rpabranch->GetEntry(0) ; - -// // Read and Post the PID -// if(!PID(fRecParticlesTitle)) -// PostPID(fRecParticlesTitle) ; -// pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ; -// pidbranch->GetEntry(0) ; - - -} + AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); + TString version( rl->GetEventFolder()->GetName() ) ; -//____________________________________________________________________________ -void AliEMCALGetter::ReadTreeS(Int_t event) -{ - // Read the summable digits tree gAlice->TreeS() - - // loop over all opened files and read their SDigits to the White Board - TFolder * emcalF = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - if (!emcalF) - emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - TCollection * folderslist = emcalF->GetListOfFolders() ; + opt.ToLower() ; - //Add current file to list if it is not there yet - - TString subdir(fHeaderFile) ; - subdir.ReplaceAll("/","_") ; - - if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){ - emcalF->AddFolder(subdir, ""); - } - - TIter next(folderslist) ; - TFolder * folder = 0 ; - TFile * file; - TTree * treeS = 0; - while ( (folder = static_cast(next())) ) { - TString fileName(folder->GetName()) ; - fileName.ReplaceAll("_","/") ; - if(fHeaderFile.CompareTo(fileName) == 0 ) - treeS=gAlice->TreeS() ; - else{ - file = static_cast(gROOT->GetFile(fileName)); - file->cd() ; - - // Get SDigits Tree header from file - TString treeName("TreeS") ; - treeName += event ; - treeS = dynamic_cast(gDirectory->Get(treeName.Data())); + if ( opt == "sdigits") { + // add the version name to the root file name + TString fileName( EmcalLoader()->GetSDigitsFileName() ) ; + if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; + if ( !(gSystem->AccessPathName(fileName)) ) { + Warning("VersionExists", "The file %s already exists", fileName.Data()) ; + rv = kTRUE ; } - if(treeS==0){ - cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl; - return ; - } - - //set address of the SDigits and SDigitizer - TBranch * sdigitsBranch = 0; - TBranch * sdigitizerBranch = 0; - TBranch * branch = 0 ; - TObjArray * lob = static_cast(treeS->GetListOfBranches()) ; - TIter next(lob) ; - Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; - - while ( (branch = static_cast(next())) && (!emcalfound || !sdigitizerfound) ) { - if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { - emcalfound = kTRUE ; - sdigitsBranch = branch ; - } - - else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { - sdigitizerfound = kTRUE ; - sdigitizerBranch = branch ; - } - } - if ( !emcalfound || !sdigitizerfound ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle - << " not found" << endl ; - return ; - } - - if ( !folder->FindObject(fSDigitsTitle) ) - PostSDigits(fSDigitsTitle,folder->GetName()) ; - sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ; - sdigitsBranch->GetEntry(0) ; - - TString sdname(fSDigitsTitle) ; - sdname+=":" ; - sdname+=folder->GetName() ; - if(!SDigitizer(sdname) ) - PostSDigitizer(fSDigitsTitle,folder->GetName()) ; - sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; - sdigitizerBranch->GetEntry(0) ; - - } - - // After SDigits have been read from all files, return to the first one - - next.Reset(); - folder = static_cast(next()); - if(folder){ - TString fileName(folder->GetName()) ; - fileName.ReplaceAll("_","/") ; - file = static_cast(gROOT->GetFile(fileName)); - file ->cd() ; + EmcalLoader()->SetSDigitsFileName(fileName) ; } - -} -//____________________________________________________________________________ -void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input) -{ // Read the summable digits fron treeS() - - TString filename("mergefile") ; - filename+= input ; - - TFolder * emcalFolder = dynamic_cast(fSDigitsFolder->FindObject("EMCAL")) ; - if ( !emcalFolder ) { - emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; - } - TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ; - //set address of the SDigits and SDigitizer - TBranch * sdigitsBranch = 0; - TBranch * sdigitizerBranch = 0; - TBranch * branch = 0 ; - TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ; - TIter next(lob) ; - Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; - - while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) { - if ( strcmp(branch->GetName(), "EMCAL")==0) { - emcalfound = kTRUE ; - sdigitsBranch = branch ; - } - - else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) { - sdigitizerfound = kTRUE ; - sdigitizerBranch = branch ; + if ( opt == "digits") { + // add the version name to the root file name + TString fileName( EmcalLoader()->GetDigitsFileName() ) ; + if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name + fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; + if ( !(gSystem->AccessPathName(fileName)) ) { + Warning("VersionExists", "The file %s already exists", fileName.Data()) ; + rv = kTRUE ; } } - if ( !emcalfound || !sdigitizerfound ) { - if (fDebug) - cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ; - return ; - } - - if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) ) - PostSDigits(sdigitsBranch->GetTitle(),filename) ; - - sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ; - sdigitsBranch->GetEntry(0) ; - - TString sdname(sdigitsBranch->GetTitle()) ; - sdname+=":" ; - sdname+=filename ; - if(!SDigitizer(sdigitsBranch->GetTitle()) ) - PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; - - sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; - sdigitizerBranch->GetEntry(0) ; - -} - - -//____________________________________________________________________________ -void AliEMCALGetter::ReadPrimaries() -{ - // Reads specific branches of primaries - - fNPrimaries = gAlice->GetNtrack(); - - // //Check, is it necessary to open new files - // TArrayI* events = fDigitizer->GetCurrentEvents() ; - // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ; -// Int_t input ; -// for(input = 0; input < filenames->GetEntriesFast(); input++){ - -// TObjString * filename = (TObjString *) filenames->At(input) ; - -// //Test, if this file already open -// TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ; -// if(file == 0) -// file = new TFile( filename->GetString()) ; -// file->cd() ; - -// // Get Kine Tree from file -// // char treeName[20]; -// // sprintf(treeName,"TreeK%d",events->At(input)); -// // TTree * treeK = (TTree*)gDirectory->Get(treeName); -// // if (treeK) -// // treeK->SetBranchAddress("Particles", &fParticleBuffer); -// // else -// // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl; - -// // // Create the particle stack -// // if(!fParticles) fParticles = new TClonesArray("TParticle",1000); -// // // Build the pointer list -// // if(fParticleMap) { <---- -// // fParticleMap->Clear(); -// // fParticleMap->Expand(treeK->GetEntries()); -// // } else -// // fParticleMap = new TObjArray(treeK->GetEntries()); - -// // From gAlice->Particle(i) - - -// // if(!(*fParticleMap)[i]) { -// // Int_t nentries = fParticles->GetEntries(); - -// // // algorithmic way of getting entry index -// // // (primary particles are filled after secondaries) -// // Int_t entry; -// // if (iGetEntry(fParticleFileMap[i]); -// // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); -// // fParticleMap->AddAt((*fParticles)[nentries],i); -// // } -// // return (TParticle *) (*fParticleMap)[i]; - - - -// } - - -// //scan over opened files and read corresponding TreeK## - - return ; -} -//____________________________________________________________________________ -void AliEMCALGetter::Event(const Int_t event, const char* opt) -{ - // Reads the content of all Tree's S, D and R - - if (event >= gAlice->TreeE()->GetEntries() ) { - cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ; - return ; - } - gAlice->GetEvent(event) ; - - if(strstr(opt,"H") ) - ReadTreeH() ; - - if(strstr(opt,"S") ) - ReadTreeS(event) ; - - if( strstr(opt,"D") ) - ReadTreeD() ; - if( strstr(opt,"R") ) - ReadTreeR() ; - - // if( strstr(opt,"Q") ) - // ReadTreeQA() ; - - // if( strstr(opt,"P") || (strcmp(opt,"")==0) ) - // ReadPrimaries() ; + return rv ; } //____________________________________________________________________________ -TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const +UShort_t AliEMCALGetter::EventPattern(void) const { - // get the object named "what" from the folder - // folders are named like //Folders - - if ( file.IsNull() ) - file = fHeaderFile ; - - TFolder * folder = 0 ; - TObject * emcalO = 0 ; - - // if ( name.IsNull() ) { - if ( what.CompareTo("Hits") == 0 ) { - folder = dynamic_cast(fHitsFolder->FindObject("EMCAL")) ; - if (folder) - emcalO = dynamic_cast(folder->FindObject("Hits")) ; - } - else if ( what.CompareTo("SDigits") == 0 ) { - file.ReplaceAll("/","_") ; - TString path = "EMCAL/" + file ; - folder = dynamic_cast(fSDigitsFolder->FindObject(path.Data())) ; - if (folder) { - if (name.IsNull()) - name = fSDigitsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("Digits") == 0 ){ - folder = dynamic_cast(fDigitsFolder->FindObject("EMCAL")) ; - if (folder) { - if (name.IsNull()) - name = fDigitsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("TowerRecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("PreShoRecPoints") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; - if (folder) { - if (name.IsNull()) - name = fRecPointsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - /* - else if ( what.CompareTo("TrackSegments") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; - if (folder) { - if (name.IsNull()) - name = fTrackSegmentsTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("RecParticles") == 0 ) { - folder = dynamic_cast(fRecoFolder->FindObject("EMCAL/RecParticles")) ; - if (folder) { - if (name.IsNull()) - name = fRecParticlesTitle ; - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } - else if ( what.CompareTo("Alarms") == 0 ){ - if (name.IsNull() ) - emcalO = dynamic_cast(fQAFolder->FindObject("EMCAL")) ; - else { - folder = dynamic_cast(fQAFolder->FindObject("EMCAL")) ; - if (!folder) - emcalO = 0 ; - else - emcalO = dynamic_cast(folder->FindObject(name)) ; - } - } -*/ - if (!emcalO) { - if(fDebug) - cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ; + // Return the pattern (trigger bit register) of the beam-test event +// if(fBTE) +// return fBTE->GetPattern() ; +// else return 0 ; - } - return emcalO ; } - //____________________________________________________________________________ -const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const +Float_t AliEMCALGetter::BeamEnergy(void) const { - // get the TTask named "what" from the folder - // folders are named like //Folders/Tasks/what/EMCAL/name - - TString search(what) ; - if ( what.CompareTo("Clusterizer") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("TrackSegmentMaker") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("PID") == 0 ) - search = "Reconstructioner" ; - else if ( what.CompareTo("QATasks") == 0 ) - search = "QA" ; - - TTask * tasks = dynamic_cast(fTasksFolder->FindObject(search)) ; - - if (!tasks) { - cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ; - return 0 ; - } - - TTask * emcalT = dynamic_cast(tasks->GetListOfTasks()->FindObject("EMCAL")) ; - if (!emcalT) { - cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ; - return 0 ; - } - - TList * list = emcalT->GetListOfTasks() ; - - if (what.CompareTo("SDigitizer") == 0) { - if ( name.IsNull() ) - name = fSDigitsTitle ; - } else if (what.CompareTo("Digitizer") == 0){ - if ( name.IsNull() ) - name = fDigitsTitle ; - } else if (what.CompareTo("Clusterizer") == 0){ - if ( name.IsNull() ) - name = fRecPointsTitle ; - name.Append(":clu") ; - } - // else if (what.CompareTo("TrackSegmentMaker") == 0){ -// if ( name.IsNull() ) -// name = fTrackSegmentsTitle ; -// name.Append(":tsm") ; -// } -// else if (what.CompareTo("PID") == 0){ -// if ( name.IsNull() ) -// name = fRecParticlesTitle ; -// name.Append(":pid") ; -// } -// else if (what.CompareTo("QATasks") == 0){ -// if ( name.IsNull() ) -// return emcalT ; -// } - - TIter it(list) ; - TTask * task = 0 ; - while((task = static_cast(it.Next()) )){ - TString taskname(task->GetName()) ; - if(taskname.BeginsWith(name)){ - return task ;} - } - - if(fDebug) - cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ; - return 0 ; + // Return the beam energy of the beam-test event +// if(fBTE) +// return fBTE->GetBeamEnergy() ; +// else + return 0 ; }