- // Allows to produce digits by superimposing background and signal event.
- // It is assumed, that headers file with SIGNAL events is opened in
- // the constructor.
- // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed
- // Thus we avoid writing (changing) huge and expensive
- // backgound files: all output will be writen into SIGNAL, i.e.
- // opened in constructor file.
- //
- // One can open as many files to mix with as one needs.
- // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
- // can be mixed.
-
- if( strcmp(GetName(), "") == 0 )
- Init() ;
-
- if(fManager){
- cout << "Can not use this method under AliRunDigitizer " << endl ;
- return ;
- }
-
- // check if the specified SDigits do not already exist on the White Board:
- // //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname
-
- TString path = "Folders/RunMC/Event/Data/PHOS/SDigits" ;
- path += headerFile ;
- path += "/" ;
- path += GetName() ;
- if ( gROOT->FindObjectAny(path.Data()) ) {
- cerr << "WARNING: AliPHOSDigitizer::MixWith -> Entry already exists, do not add" << endl ;
- return;
- }
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- gime->PostSDigits(GetName(),headerFile) ;
-
- // check if the requested file is already open or exist and if SDigits Branch exist
- TFile * file = (TFile*)gROOT->FindObject(headerFile);
- if ( !file ) {
- file = new TFile(headerFile, "READ") ;
- if (!file) {
- cerr << "ERROR: AliPHOSDigitizer::MixWith -> File " << headerFile << " does not exist!" << endl ;
- return ;
- }
- }
-
-}
-
-//__________________________________________________________________
-void AliPHOSDigitizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the Digits in a file separate from the hits file
-
- // I guess it is not going to work if we do merging
- if (fManager) {
- cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> Not yet available in case of merging activated " << endl ;
- return ;
- }
-
- TDirectory * cwd = gDirectory ;
- if ( !(gAlice->GetTreeDFileName() == splitFileName) ) {
- if (gAlice->GetTreeDFile() )
- gAlice->GetTreeDFile()->Close() ;
- }
-
- fSplitFile = gAlice->InitTreeFile("D",splitFileName.Data());
- fSplitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
-
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
-
- // copy TreeE
- AliHeader *header = new AliHeader();
- treeE->SetBranchAddress("Header", &header);
- treeE->SetBranchStatus("*",1);
- TTree *treeENew = treeE->CloneTree();
- treeENew->Write(0, TObject::kOverwrite);
-
- // copy AliceGeom
- TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
-
- gAlice->MakeTree("D",fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;
-}
-
-//__________________________________________________________________
-void AliPHOSDigitizer::Print(Option_t* option)const {