//
//logical place for putting the Loader specific to the given detector is detector itself
// but, to load detector one need to load gAlice, and by the way all other detectors
-// with their geometrieces and so on.
+// with their geometries and so on.
// So, if one need to open TPC clusters there is no principal need to read everything
//
// When RunLoader is read from the file it does not connect to the folder structure
AliRunLoader::~AliRunLoader()
{
-
+//dtor
UnloadHeader();
UnloadgAlice();
AliRunLoader::AliRunLoader(TFolder* topfolder):TNamed(fgkRunLoaderName,fgkRunLoaderName)
{
+//ctor
if(topfolder == 0x0)
{
Fatal("AliRunLoader(TFolder*)","Parameter is NULL");
/**************************************************************************/
Int_t AliRunLoader::SetEvent()
{
- //if kinematocs was loaded Cleans folder data
- //change
+//if kinematics was loaded Cleans folder data
+
Int_t retval;
retval = fKineDataLoader->SetEvent();
}
return (Int_t)TreeE()->GetEntries();
}
-
/**************************************************************************/
+
void AliRunLoader::MakeHeader()
{
//Makes header and connects it to header tree (if it exists)
Int_t AliRunLoader::LoadHeader()
{
+//loads treeE and reads header object for current event
if (TreeE())
{
Warning("LoadHeader","Header is already loaded. Use ReloadHeader to force reload. Nothing done");
AliHeader* AliRunLoader::GetHeader() const
{
+//returns pointer header object
return fHeader;
}
/**************************************************************************/
Int_t AliRunLoader::WriteGeometry(Option_t* opt)
{
+//writes geometry to the file
fGAFile->cd();
TGeometry* geo = GetAliRun()->GetGeometry();
if (geo == 0x0)
Int_t AliRunLoader::WriteHeader(Option_t* opt)
{
+//writes treeE
if (GetDebug()) Info("WriteHeader"," WRITING HEADER");
TTree* tree = TreeE();
Int_t AliRunLoader::WriteAliRun(Option_t* opt)
{
+//writes AliRun object to the file
fGAFile->cd();
- if (gAlice) gAlice->Write();
+ if (GetAliRun()) GetAliRun()->Write();
return 0;
}
/**************************************************************************/
Int_t AliRunLoader::WriteKinematics(Option_t* opt)
{
+//writes Kinematics
return fKineDataLoader->GetBaseLoader(0)->WriteData(opt);
}
/**************************************************************************/
Int_t AliRunLoader::WriteTrackRefs(Option_t* opt)
{
+//writes Track References tree
return fTrackRefsDataLoader->GetBaseLoader(0)->WriteData(opt);
}
/**************************************************************************/
Int_t AliRunLoader::WriteSDigits(Option_t* opt)
{
+//Calls WriteSDigits for all loaders
Int_t res;
Int_t result = 0;
TIter next(fLoaders);
Int_t AliRunLoader::WriteDigits(Option_t* opt)
{
+//Calls WriteDigits for all loaders
Int_t res;
Int_t result = 0;
TIter next(fLoaders);
Int_t AliRunLoader::WriteRecPoints(Option_t* opt)
{
+//Calls WriteRecPoints for all loaders
Int_t res;
Int_t result = 0;
TIter next(fLoaders);
Int_t AliRunLoader::WriteTracks(Option_t* opt)
{
+//Calls WriteTracks for all loaders
Int_t res;
Int_t result = 0;
TIter next(fLoaders);
Int_t AliRunLoader::WriteRunLoader(Option_t* opt)
{
+//Writes itself to the file
CdGAFile();
this->Write(0,TObject::kOverwrite);
return 0;
/**************************************************************************/
Int_t AliRunLoader::SetEventFolderName(const TString& name)
-{ //sets top folder name for this run; of alread
+{
+//sets top folder name for this run; of alread
if (name.IsNull())
{
Error("SetTopFolderName","Name is empty");
AliLoader* AliRunLoader::GetLoader(const char* detname) const
{
+//returns loader for given detector
+//note that naming convention is TPCLoader not just TPC
return (AliLoader*)fLoaders->FindObject(detname);
}
AliLoader* AliRunLoader::GetLoader(AliDetector* det) const
{
+//get loader for detector det
if(det == 0x0) return 0x0;
TString getname(det->GetName());
getname+="Loader";
void AliRunLoader::SetGAliceFile(TFile* gafile)
{
+//sets pointer to galice.root file
fGAFile = gafile;
}
/**************************************************************************/
AliRunLoader* AliRunLoader::GetRunLoader(const char* eventfoldername)
- {
+{
+//returns RunLoader from folder named eventfoldername
TFolder* evfold= dynamic_cast<TFolder*>(AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername));
if (evfold == 0x0)
{
AliRunLoader* runget = dynamic_cast<AliRunLoader*>(evfold->FindObject(AliRunLoader::fgkRunLoaderName));
return runget;
- }
+}
/**************************************************************************/
AliLoader* AliRunLoader::GetDetectorLoader(const char* detname)
tmp = sscanf(pdet,"%s",buff);//read the string from the input string pdet into buff
if ( (buff[0] == 0) || (tmp == 0) ) break; //if not read
- pdet = strstr(pdet,buff) + strlen(buff);;//move the input pointer about number of bytes (letters) read
+ pdet = strstr(pdet,buff) + strlen(buff);//move the input pointer about number of bytes (letters) read
//I am aware that is a little complicated. I don't know the number of spaces between detector names
//so I read the string, than I find where it starts (strstr) and move the pointer about length of a string
//If there is a better way, please write me (Piotr.Skowronski@cern.ch)
void AliRunLoader::UnloadKinematics()
{
+//Unloads Kinematics
fKineDataLoader->GetBaseLoader(0)->Unload();
}
/**************************************************************************/
void AliRunLoader::UnloadTrackRefs()
{
+//Unloads Track Refernces
fTrackRefsDataLoader->GetBaseLoader(0)->Unload();
}
/**************************************************************************/
void AliRunLoader::UnloadgAlice()
{
+//Unloads gAlice
if (gAlice == GetAliRun())
{
if (GetDebug()) Info("UnloadgAlice","Set gAlice = 0x0");
{
//Load track references from file (opens file and posts tree to folder)
- return fKineDataLoader->GetBaseLoader(0)->Load(option);
+ return fTrackRefsDataLoader->GetBaseLoader(0)->Load(option);
}
/**************************************************************************/
Int_t AliRunLoader::GetFileOffset() const
{
+//returns the file number that is added to the file name for current event
return Int_t(fCurrentEvent/fNEventsPerFile);
}
/*****************************************************************************/
const TString AliRunLoader::SetFileOffset(const TString& fname)
{
+//adds the the number to the file name at proper place for current event
Long_t offset = (Long_t)GetFileOffset();
if (offset < 1) return fname;
TString soffset;
for(Int_t isec=0;isec<fTPCParam->GetNSector();isec++)
if (IsSectorActive(isec))
{
- cout<<"Sector "<<isec<<"is active\n";
+ if (fDebug) Info("Hits2Digits","Sector %d is active.",isec);
Hits2DigitsSector(isec);
}
else
{
- cout<<"Sector "<<isec<<"is NOT active\n";
+ if (fDebug) Info("Hits2Digits","Sector %d is NOT active.",isec);
}
fLoader->WriteDigits("OVERWRITE");
+
+//this line prevents the crash in the similar one
+//on the beginning of this method
+//destructor attempts to reset the tree, which is deleted by the loader
+//need to be redesign
+ if(GetDigitsArray()) delete GetDigitsArray();
+ SetDigitsArray(0x0);
+
}
-
-
//__________________________________________________________________
void AliTPC::Hits2SDigits2(Int_t eventnumber)
{
if (branch)
{
branch->SetAddress(&fTrackHits);
- cout<<"AliTPC::SetTreeAddress2 fHitType&4 Setting"<<endl;
+ if (GetDebug()) Info("SetTreeAddress2","fHitType&4 Setting");
}
- else cout<<"AliTPC::SetTreeAddress2 fHitType&4 Failed"<<endl;
+ else
+ if (GetDebug()) Info("SetTreeAddress2","fHitType&4 Failed (can not find branch)");
+
}
if ((treeH)&&(fHitType&2)) {
branch = treeH->GetBranch(branchname);
if (branch)
{
branch->SetAddress(&fTrackHitsOld);
- cout<<"AliTPC::SetTreeAddress2 fHitType&2 Setting"<<endl;
+ if (GetDebug()) Info("SetTreeAddress2","fHitType&2 Setting");
}
- else cout<<"AliTPC::SetTreeAddress2 fHitType&2 Failed"<<endl;
+ else if (GetDebug())
+ Info("SetTreeAddress2","fHitType&2 Failed (can not find branch)");
}
//set address to TREETR
AliLoader* AliTPC::MakeLoader(const char* topfoldername)
{
- cout<<"AliTPC::MakeLoader ";
-
+//Makes TPC loader
fLoader = new AliTPCLoader(GetName(),topfoldername);
-
- if (fLoader)
- {
- cout<<"Success"<<endl;
- }
- else
- {
- cout<<"Failure"<<endl;
- }
-
return fLoader;
}