-
-//____________________________________________________________________________
-
-Int_t AliEMCALGetter::ReadTreeD(const Int_t event)
-{
- // Read the digit tree gAlice->TreeD()
-
- TTree * treeD ;
- if(fToSplit){
- TFile * file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName));
- if(!file)
- file = TFile::Open(fDigitsFileName) ;
-
- // Get Digits Tree header from file
-
- TString treeName("TreeD") ;
- treeName += event ;
- treeD = dynamic_cast<TTree*>(file->Get(treeName.Data()));
-
- if(!treeD){ // TreeD not found in header file
- if (fDebug)
- Warning("ReadTreeD", "-> Cannot find TreeD in %s", fDigitsFileName.Data());
- return 1;
- }
- }
- else
- treeD = gAlice->TreeD() ;
-
- TObjArray * lob = static_cast<TObjArray*>(treeD->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- TBranch * digitsbranch = 0 ;
- TBranch * digitizerbranch = 0 ;
-
- Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(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)
- Warning("ReadTreeD", "-> Cannot find Digits and/or Digitizer with name %s", fDigitsTitle.Data());
- return 2;
- }
-
- //read digits
-
- if(!Digits(fDigitsTitle) )
- PostDigits(fDigitsTitle);
- digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
- digitsbranch->GetEntry(0) ;
-
- // read the Digitizer
-
- RemoveTask("D", fDigitsTitle) ; // I do not understand why I need that
- if(!Digitizer(fDigitsTitle))
- PostDigitizer(fDigitsTitle) ;
- digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
- digitizerbranch->GetEntry(0) ;
-
- lob->Delete();
-
- if(gAlice->TreeD()!=treeD)
- treeD->Delete();
-
- return 0 ;
-}
-
-//____________________________________________________________________________
-
-Int_t AliEMCALGetter::ReadTreeH()
-{
- // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
-
- TTree * treeH = gAlice->TreeH() ;
-
- if(!treeH) {// TreeH not found in header file
- if (fDebug)
- Warning("ReadTreeH", "-> Cannot find TreeH in %s", fHeaderFile.Data());
-
- TString searchFileName("EMCAL.HITS") ;
- if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
- searchFileName+="." ;
- searchFileName += fBranchTitle ;
- }
-
- searchFileName+=".root" ;
-
- if ( (treeH = TreeH(searchFileName)) ) { //found TreeH in the file which contains the hits
- if (fDebug)
- Info("ReadTreeH", "-> TreeH found in %s", searchFileName.Data());
- } else {
- Error("ReadTreeH", "-> TreeH not found ");
- return 1;
- }
- }
-
- TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
-
- if ( !hitsbranch ) {
- if (fDebug)
- Warning("ReadTreeH", "-> Cannot find branch EMCAL");
- return 2;
- }
-
- if(!Hits())
- PostHits() ;
-
- if (hitsbranch->GetEntries() > 1 ) {
- (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
- TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
- TClonesArray * hits = dynamic_cast<TClonesArray*>(*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<const AliEMCALHit *>(tempo->At(j)) ;
- new((*hits)[index]) AliEMCALHit( *hit ) ;
- index++ ;
- }
- }
- delete tempo ;
- }
- else {
- (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
- hitsbranch->SetAddress(HitsRef()) ;
- hitsbranch->GetEntry(0) ;
- }
- return 0 ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::Track(const Int_t itrack)
-{
- // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
- if(gAlice->TreeH()== 0){
- Error("ReadTreeH", "-> Cannot read TreeH ");
- return ;
- }
-
- TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
-
- if ( !hitsbranch ) {
- if (fDebug)
- Warning("ReadTreeH", "-> Cannot find branch EMCAL");
- return ;
- }
-
- if(!Hits())
- PostHits() ;
-
- (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
- hitsbranch->SetAddress(HitsRef()) ;
- hitsbranch->GetEntry(itrack) ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::ReadTreeQA()
-{
- if (fDebug)
- Warning("ReadTreeQA", "-> %s not implemented", ClassName());
-}
-
-
-
-//____________________________________________________________________________
-
-Int_t AliEMCALGetter::ReadTreeR(const Int_t event)
-
-{
- // Read the reconstrunction tree gAlice->TreeR()
- // A particularity has been introduced here :
- // if gime->Event(ievent,"R") is called branches with the current title are read, the current title
- // being for example give in AliEMCALPID(fileName, title)
- // if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any
- // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given)
- // from a given set of TrackSegments (with a given name)
- // This is why any is NOT used to read the branch of RecParticles
- // any migh have become obsolete : to be checked
- // See AliEMCALPIDv1
-
- TTree * treeR ;
-
- if(fToSplit){
- TFile * file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName));
- if(!file)
- file = TFile::Open(fRecPointsFileName) ;
- Info("ReadTreeR", "file=%s\n",fRecPointsFileName.Data());
- // Get Digits Tree header from file
-
- TString treeName("TreeR") ;
- treeName += event ;
- treeR = dynamic_cast<TTree*>(file->Get(treeName.Data()));
-
- if(!treeR){ // TreeR not found in header file
- if (fDebug)
- Warning("ReadTreeD", "-> Cannot find TreeR in %s", fRecPointsFileName.Data());
- return 1;
- }
- }
- else
- treeR = gAlice->TreeR() ;
-
- // RecPoints
-
- TObjArray * lob = static_cast<TObjArray*>(treeR->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- TBranch * towerbranch = 0 ;
- TBranch * preshowerbranch = 0 ;
- TBranch * clusterizerbranch = 0 ;
-
- Bool_t emcalTowerRPfound = kFALSE, emcalPreShoRPfound = kFALSE, clusterizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(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) {
- preshowerbranch = branch ;
- emcalPreShoRPfound = kTRUE ;
- }
- else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
- clusterizerbranch = branch ;
- clusterizerfound = kTRUE ;
- }
- }
- }
-
- if ( !emcalTowerRPfound || !emcalPreShoRPfound || !clusterizerfound) {
- if (fDebug)
- Warning("ReadTreeR", "-> Cannot find RecPoints and/or Clusterizer with name %s", fRecPointsTitle.Data());
- }
- else {
- if(!TowerRecPoints(fRecPointsTitle) )
- PostRecPoints(fRecPointsTitle) ;
- towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
- towerbranch->GetEntry(0) ;
-
- preshowerbranch->SetAddress(PreShowerRecPointsRef(fRecPointsTitle)) ;
- preshowerbranch->GetEntry(0) ;
-
- if(!Clusterizer(fRecPointsTitle) )
- PostClusterizer(fRecPointsTitle) ;
-
- clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
- clusterizerbranch->GetEntry(0) ;
- }
-
- if(gAlice->TreeR()!=treeR)
- treeR->Delete();
- return 0 ;
-}
-
-//____________________________________________________________________________
-
-Int_t AliEMCALGetter::ReadTreeS(const Int_t event)
-{
- // Reads the SDigits treeS from all files
- // Files, which should be opened are listed in emcalF
- // So, first get list of files
-
- TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
-
- if (!emcalF)
- emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
-
- TCollection * folderslist = emcalF->GetListOfFolders() ;
-
- // Now iterate over the list of files and read TreeS into Whiteboard
-
- TIter next(folderslist) ;
- TFolder * folder = 0 ;
- TFile * file;
- TTree * treeS = 0;
-
- while ( (folder = static_cast<TFolder*>(next())) ) {
- TString fileName("") ;
- if(fToSplit)
- fileName = folder->GetTitle() ;
- else
- fileName = folder->GetName() ;
-
- fileName.ReplaceAll("_","/") ;
- file = static_cast<TFile*>(gROOT->GetFile(fileName));
-
- if(!file)
- file = TFile::Open(fileName) ;
-
- // Get SDigits Tree header from file
-
- TString treeName("TreeS") ;
- treeName += event ;
- treeS = dynamic_cast<TTree*>(file->Get(treeName.Data()));
-
- if(!treeS){ // TreeS not found in header file
- if (fDebug)
- Warning("ReadTreeS", "-> Cannot find TreeS in %s", fileName.Data());
- return 1;
- }
-
- //set address of the SDigits and SDigitizer
-
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
- TBranch * branch = 0 ;
- TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
- TIter next(lob) ;
-
- Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(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)
- Warning("ReadSDigits", "-> Digits and/or Digitizer branch with name %s not found", GetName());
- return 2;
- }
-
- if ( !folder->FindObject(fSDigitsTitle) )
- PostSDigits(fSDigitsTitle,folder->GetName()) ;
-
- ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ;
-
- 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) ;
-
- if(gAlice->TreeS()!=treeS)
- treeS->Delete();
- }
- return 0 ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
-{
- // Read the summable digits fron treeS()
-
- TString filename("mergefile") ;
- filename+= input ;
-
- TFolder * emcalFolder = dynamic_cast<TFolder*>(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 ( !emcalfound || !sdigitizerfound ) {
- if (fDebug)
- Warning("ReadTreeS", "-> Digits and/or Digitizer branch not found");
- 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) ;
-
- if(gAlice->TreeS()!=treeS)
- treeS->Delete();
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::ReadPrimaries()
-{
-
- // Reads specific branches of primaries
-
- TClonesArray * ar = 0 ;
-
- if(! (ar = Primaries()) ) {
- PostPrimaries() ;
- ar = Primaries() ;
- }
-
- ar->Delete() ;
-
- if (TreeK(fHeaderFile)) { // treeK found in header file
- if (fDebug)
- Info("ReadPrimaries", "-> TreeK found in %s", fHeaderFile.Data());
- fNPrimaries = gAlice->GetNtrack() ;
- }
- else { // treeK not found in header file
- Error("ReadPrimaries", "-> TreeK not found ");
- return ;
- }
-
- Int_t index = 0 ;
-
- for (index = 0 ; index < fNPrimaries; index++) {
- new ((*ar)[index]) TParticle(*(Primary(index)));
- }
-}
-
-//____________________________________________________________________________
-
-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() ) {
- Error("Event", "-> %d not found in TreeE!", event);
- return ;
- }
-
- Bool_t any = kFALSE ;
-
- if (strstr(opt,"A") ) // do not check the title of the branches
- any = kTRUE;
-
- gAlice->GetEvent(event) ;
-
- if( strstr(opt,"R") )
- ReadTreeR(event) ;
-
- if( strstr(opt,"D") )
- ReadTreeD(event) ;
-
- if(strstr(opt,"S") )
- ReadTreeS(event) ;
-
- if(strstr(opt,"H") )
- ReadTreeH() ;
-
- if( strstr(opt,"Q") )
- ReadTreeQA() ;
-
- if( strstr(opt,"P") )
- ReadPrimaries() ;
-}
-
-//____________________________________________________________________________
-
-TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) 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 ( what.CompareTo("Primaries") == 0 ) {
- folder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
- if (folder)
- emcalO = dynamic_cast<TObject *>(folder->FindObject("Primaries")) ;
- else
- return 0 ;
- }
- else if ( what.CompareTo("Hits") == 0 ) {
- folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
- if (folder)
- emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
- }
- else if ( what.CompareTo("SDigits") == 0 ) {
- file.ReplaceAll("/","_") ;
- TString path = "EMCAL/" + file ;
- folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
- if (folder) {
- if (name.IsNull())
- name = fSDigitsTitle ;
- emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("Digits") == 0 ){
- folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
- if (folder) {
- if (name.IsNull())
- name = fDigitsTitle ;
- emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("TowerRecPoints") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
- if (folder) {
- if (name.IsNull())
- name = fRecPointsTitle ;
- emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("PreShowerRecPoints") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
- if (folder) {
- if (name.IsNull())
- name = fRecPointsTitle ;
- emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
-
- if (!emcalO) {
- if(fDebug)
- Warning("ReturnO", "-> Object %s not found in %s", what.Data(), folder->GetName());
- return 0 ;
- }
-
- return emcalO ;
-}
-
-//____________________________________________________________________________
-
-const TTask * AliEMCALGetter::ReturnT(TString what, TString name) 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<TTask*>(fTasksFolder->FindObject(search)) ;
-
- if (!tasks) {
- Error("AliReturnT", "-> Task %s not found!", what.Data());
- return 0 ;
- }
-
- TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
-
- if (!emcalT) {
- Error("ReturnT", "-> Task %s/EMCAL not found!", what.Data());
- 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") ;
- }
-
- TIter it(list) ;
- TTask * task = 0 ;
-
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(name)){
- return task ;}
- }
-
- if(fDebug)
- Warning("ReturnT", "-> Task %s/%s not found!", search.Data(), name.Data());
- return 0 ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::RemoveTask(TString opt, TString name) const
-
-{
- // remove a task from the folder
- // path is fTasksFolder/SDigitizer/EMCAL/name
-
- TTask * task = 0 ;
- TTask * emcal = 0 ;
- TList * lofTasks = 0 ;
-
- if (opt == "S") { // SDigitizer
- task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
- if (!task)
- return ;
- }
- else if (opt == "D") { // Digitizer
- task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
- if (!task)
- return ;
- }
- else if (opt == "C") { // Clusterizer
- task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
- if (!task)
- return ;
- }
- else {
- Warning("RemoveTask", "-> Unknown option %s");
- return ;
- }
-
- emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
-
- if (!emcal)
- return ;
-
- lofTasks = emcal->GetListOfTasks() ;
-
- if (!lofTasks)
- return ;
-
- TObject * obj = lofTasks->FindObject(name) ;
- if (obj)
-
- lofTasks->Remove(obj) ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::RemoveObjects(TString opt, TString name) const
-{
- // remove SDigits from the folder
- // path is fSDigitsFolder/fHeaderFileName/name
-
- TFolder * emcal = 0 ;
- TFolder * emcalmain = 0 ;
-
- if (opt == "H") { // Hits
- emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
- if (!emcal)
- return ;
- name = "Hits" ;
- }
- else if ( opt == "S") { // SDigits
- emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
- if (!emcalmain)
- return ;
- emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
- if (!emcal)
- return ;
- }
- else if (opt == "D") { // Digits
- emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
- if (!emcal)
- return ;
- }
- else if (opt == "RT") { // Tower RecPoints
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
- if (!emcal)
- return ;
- }
- else if (opt == "RP") { // Preshower RecPoints
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
- if (!emcal)
- return ;
- }
- else if (opt == "T") { // TrackSegments
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
- if (!emcal)
- return ;
- }
- else if (opt == "P") { // RecParticles
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
- if (!emcal)
- return ;
- }
- else {
- Warning("RemoveObjects", "-> Unknown option %s", opt.Data());
- return ;
- }
-
- TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject(name)) ;
-
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
-
- if (opt == "S")
- emcalmain->Remove(emcal) ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::RemoveSDigits() const
-{
- TFolder * emcal= dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
-
- if (!emcal)
- return ;
-
- emcal->SetOwner() ;
- emcal->Clear() ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::CleanWhiteBoard(void){
-
- TFolder * emcalmain = 0 ;
- TFolder * emcal ;
- TObjArray * ar ;
- TList * lofTasks = 0 ;
- TTask * task = 0 ;
- TTask * emcalt = 0 ;
-
- // Hits
-
- emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
-
- if (emcal){
- TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject("Hits")) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
-
- // SDigits
-
- emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
-
- if (emcalmain){
- emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
- if (emcal) {
- ar = dynamic_cast<TObjArray*>(emcal->FindObject(fSDigitsTitle)) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
- emcalmain->Remove(emcal) ;
- }
-
- // Digits
-
- emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
-
- if (emcal){
- ar = dynamic_cast<TObjArray*>(emcal->FindObject(fDigitsTitle)) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
-
- // TowerRecPoints
-
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
-
- if (emcal){
- ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
-
- // PreShowerRecPoints
-
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
-
- if (emcal){
- ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
-
- // TrackSegments
-
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
-
- if (emcal) {
- ar = dynamic_cast<TObjArray*>(emcal->FindObject(fTrackSegmentsTitle)) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
-
- // RecParticles
-
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
-
- if (emcal){
- ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecParticlesTitle)) ;
- if (ar) {
- emcal->Remove(ar) ;
- ar->Delete() ;
- delete ar ;
- }
- }
-
- //---- Now Tasks -----------
-
- TObject * obj ;
- TString sdname(fSDigitsTitle);
-
- // Digitizer
-
- task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
-
- if (task){
- emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
- if (emcalt){
- lofTasks = emcalt->GetListOfTasks() ;
- if (lofTasks){
- obj = lofTasks->FindObject(sdname.Data()) ;
- if (obj)
- lofTasks->Remove(obj) ;
- }
- }
- }
-
- sdname.Append(":") ;
-
- // Clusterizer, TrackSegmentMaker, PID
-
- task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if (task){
- emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
- if (emcalt){
- lofTasks = emcalt->GetListOfTasks() ;
- TIter next(lofTasks);
- while((obj=next())){
- TString oname(obj->GetName()) ;
- if (oname.BeginsWith(sdname)){
- lofTasks->Remove(obj) ;
- }
- }
- }
- }
-
- // SDigitizer
-
- sdname.Append(fHeaderFile) ;
- task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
-
- if (task) {
- emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
- if (emcalt){
- lofTasks = emcalt->GetListOfTasks() ;
- if (lofTasks){
- obj = lofTasks->FindObject(sdname.Data()) ;
- if (obj)
- lofTasks->Remove(obj) ;
- }
- }
- }
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::SetTitle(const char * branchTitle )
-
-{
- fBranchTitle = branchTitle ;
- fSDigitsTitle = branchTitle ;
- fDigitsTitle = branchTitle ;
- fRecPointsTitle = branchTitle ;
- fRecParticlesTitle = branchTitle ;
- fTrackSegmentsTitle = branchTitle ;
-
- if(fToSplit){
-
- //First - extract full path if necessary
-
- TString sFileName(fHeaderFile) ;
- Ssiz_t islash = sFileName.Last('/') ;
-
- if(islash<sFileName.Length())
- sFileName.Remove(islash+1,sFileName.Length()) ;
- else
- sFileName="" ;
-
- //Now construct file names
-
- fSDigitsFileName = sFileName ;
- fDigitsFileName = sFileName ;
- fRecPointsFileName = sFileName ;
- fRecParticlesFileName = sFileName ;
- fTrackSegmentsFileName = sFileName ;
- fSDigitsFileName += "EMCAL.SDigits." ;
- fDigitsFileName += "EMCAL.Digits." ;
- fRecPointsFileName += "EMCAL.RecData." ;
- fTrackSegmentsFileName+= "EMCAL.RecData." ;
- fRecParticlesFileName += "EMCAL.RecData." ;
-
- if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
- fSDigitsFileName += fBranchTitle ;
- fSDigitsFileName += "." ;
- fDigitsFileName += fBranchTitle ;
- fDigitsFileName += "." ;
- fRecPointsFileName += fBranchTitle ;
- fRecPointsFileName += "." ;
- fRecParticlesFileName += fBranchTitle ;
- fRecParticlesFileName += "." ;
- fTrackSegmentsFileName+= fBranchTitle ;
- fTrackSegmentsFileName+= "." ;
- }
-
- fSDigitsFileName += "root" ;
- fDigitsFileName += "root" ;
- fRecPointsFileName += "root" ;
- fRecParticlesFileName += "root" ;
- fTrackSegmentsFileName+= "root" ;
- }
- else{
- fSDigitsFileName = "" ;
- fDigitsFileName = "" ;
- fRecPointsFileName = "" ;
- fRecParticlesFileName = "" ;
- fTrackSegmentsFileName = "" ;
- }
-
- TFolder * emcalFolder ;
- emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
-
- if ( !emcalFolder )
- emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
-
- emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
-
- if ( !emcalFolder )
- emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
-
- //Make folder for SDigits
-
- TString subdir(fHeaderFile) ;
- subdir.ReplaceAll("/","_") ;
-
- emcalFolder->AddFolder(subdir, fSDigitsFileName.Data());
- emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
-
- if ( !emcalFolder )
- emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
-
- emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
-
- if ( !emcalFolder )
- emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALGetter::CloseSplitFiles(void){
-
- TFile * file ;
- file = static_cast<TFile*>(gROOT->GetFile(fSDigitsFileName.Data() ) ) ;
-
- if(file)
- file->Close() ;
-
- file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName.Data() ) ) ;
-
- if(file)
- file->Close() ;
-
- file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName.Data() ) ) ;
-
- if(file)
- file->Close() ;
-
- file = static_cast<TFile*>(gROOT->GetFile(fTrackSegmentsFileName.Data() ) ) ;
-
- if(file)
- file->Close() ;
-
- file = static_cast<TFile*>(gROOT->GetFile(fRecParticlesFileName.Data() ) ) ;
-
- if(file)
- file->Close() ;
-}
-
-
-
-
-
-