- sprintf(branchname,"%s",GetName());
- // one branch for digits per type of detector
- const char *det[3] = {"SPD","SDD","SSD"};
- char digclass[40];
- char clclass[40];
- Int_t i;
- for (i=0; i<kNTYPES ;i++) {
- DetType(i)->GetClassNames(digclass,clclass);
- // digits
- if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
- if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
- else ResetDigits(i);
- } // end for i
- for (i=0; i<kNTYPES ;i++) {
- if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
- else sprintf(branchname,"%sDigits%d",GetName(),i+1);
- if (fDtype && treeD) {
- MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file);
- } // end if
- } // end for i
-}
-//______________________________________________________________________
-void AliITS::SetTreeAddressD(TTree *treeD){
- // Set branch address for the Trees.
- // Inputs:
- // TTree *treeD Tree containing the Digits.
- // Outputs:
- // none.
- // Return:
- // none.
- char branchname[30];
- const char *det[3] = {"SPD","SDD","SSD"};
- TBranch *branch;
- char digclass[40];
- char clclass[40];
- Int_t i;
-
- if(!treeD) return;
- for (i=0; i<kNTYPES; i++) {
- DetType(i)->GetClassNames(digclass,clclass);
- // digits
- if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
- if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
- else ResetDigits(i);
- if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
- else sprintf(branchname,"%sDigits%d",GetName(),i+1);
- if (fDtype) {
- branch = treeD->GetBranch(branchname);
- if (branch) branch->SetAddress(&((*fDtype)[i]));
- } // end if fDtype
- } // end for i
-}
-//______________________________________________________________________
-void AliITS::Hits2SDigits(){
- // Standard Hits to summable Digits function.
- // Inputs:
- // none.
- // Outputs:
- // none.
-
-// return; // Using Hits in place of the larger sDigits.
- AliRunLoader* rl = fLoader->GetRunLoader();
- AliHeader *header=rl->GetHeader(); // Get event number from this file.
- if (header == 0x0)
- {
- rl->LoadHeader();
- header=rl->GetHeader();
- if (header == 0x0) return;
- }
- // Do the Hits to Digits operation. Use Standard input values.
- // Event number from file, no background hit merging , use size from
- // AliITSgeom class, option="All", input from this file only.
- HitsToSDigits(header->GetEvent(),0,-1," ",fOpt," ");
-
-}
-//______________________________________________________________________
-void AliITS::Hits2PreDigits(){
- // Standard Hits to summable Digits function.
- // Inputs:
- // none.
- // Outputs:
- // none.
-
- AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
- // Do the Hits to Digits operation. Use Standard input values.
- // Event number from file, no background hit merging , use size from
- // AliITSgeom class, option="All", input from this file only.
- HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
-}
-//______________________________________________________________________
-void AliITS::SDigitsToDigits(Option_t *opt){
- // Standard Summable digits to Digits function.
- // Inputs:
- // none.
- // Outputs:
- // none.
- char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
- if(!GetITSgeom()) return; // need transformations to do digitization.
- AliITSgeom *geom = GetITSgeom();
-
- const char *all = strstr(opt,"All");
- const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
- strstr(opt,"SSD")};
- if( !det[0] && !det[1] && !det[2] ) all = "All";
- else all = 0;
- static Bool_t setDef=kTRUE;
- if (setDef) SetDefaultSimulation();
- setDef=kFALSE;
-
- AliITSsimulation *sim = 0;
- AliITSDetType *iDetType = 0;
- TTree *trees = fLoader->TreeS();
- if( !(trees && this->GetSDigits()) ){
- Error("SDigits2Digits","Error: No trees or SDigits. Returning.");
- return;
- } // end if
- sprintf( name, "%s", this->GetName() );
- TBranch *brchSDigits = trees->GetBranch( name );
-
- Int_t id,module;
- for(module=0;module<geom->GetIndexMax();module++){
- id = geom->GetModuleType(module);
- if (!all && !det[id]) continue;
- iDetType = DetType(id);
- sim = (AliITSsimulation*)iDetType->GetSimulationModel();
- if (!sim) {
- Error("SDigit2Digits",
- "The simulation class was not instanciated!");
- exit(1);
- } // end if !sim
- sim->InitSimulationModule(module,gAlice->GetEvNumber());
-//
- // add summable digits to module
- this->GetSDigits()->Clear();
- brchSDigits->GetEvent(module);
- sim->AddSDigitsToModule(GetSDigits(),0);
-//
- // Digitise current module sum(SDigits)->Digits
- sim->FinishSDigitiseModule();
-
- // fills all branches - wasted disk space
- fLoader->TreeD()->Fill();
- this->ResetDigits();
- } // end for module
-
- fLoader->TreeD()->GetEntries();
-
- fLoader->TreeD()->AutoSave();
- // reset tree
- fLoader->TreeD()->Reset();
-