- 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")};
- static Bool_t setDef=kTRUE;
- if (setDef) SetDefaultSimulation();
- setDef=kFALSE;
-
- Int_t nmodules;
- InitModules(size,nmodules);
- FillModules(evNumber,bgrev,nmodules,option,filename);
-
- AliITSsimulation *sim = 0;
- AliITSDetType *iDetType = 0;
- AliITSmodule *mod = 0;
- 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("HitsToDigits","The simulation class was not "
- "instanciated for module %d type %s!",module,
- geom->GetModuleTypeName(module));
- exit(1);
- } // end if !sim
- mod = (AliITSmodule *)fITSmodules->At(module);
- sim->DigitiseModule(mod,module,evNumber);
- // fills all branches - wasted disk space
- fLoader->TreeD()->Fill();
- ResetDigits();
- } // end for module
-
- ClearModules();
-
- fLoader->TreeD()->GetEntries();
- fLoader->TreeD()->AutoSave();
- // reset tree
- fLoader->TreeD()->Reset();
+
+
+ if(!GetITSgeom()){
+ Error("HitsToPreDigits","fGeom is null!");
+ return; // need transformations to do digitization.
+ }
+ AliITSgeom *geom = GetITSgeom();
+
+ AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
+
+ const char *all = strstr(opt1,"All");
+ const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
+ strstr(opt1,"SSD")};
+ Int_t nmodules;
+ InitModules(size,nmodules);
+ FillModules(evNumber,bgrev,nmodules,opt0,flnm);
+
+ AliITSsimulation *sim = 0;
+ AliITSmodule *mod = 0;
+ Int_t id,module;
+
+ TTree *lTR = pITSloader->TreeR();
+ if(!lTR) {
+ pITSloader->MakeTree("R");
+ lTR = pITSloader->TreeR();
+ }
+
+ TClonesArray* ptarray = new TClonesArray("AliITSRecPoint",1000);
+ TBranch* branch = (TBranch*)lTR->Branch("ITSRecPointsF",&ptarray);
+ branch->SetAddress(&ptarray);
+ //m.b. : this change is nothing but a nice way to make sure
+ //the CPU goes up !
+ for(module=0;module<geom->GetIndexMax();module++){
+ id = geom->GetModuleType(module);
+ if (!all && !det[id]) continue;
+ sim = (AliITSsimulation*)GetSimulationModel(id);
+ if (!sim) {
+ Error("HitsToFastPoints","The simulation class was not "
+ "instanciated for module %d type %x!",module,
+ geom->GetModuleTypeName(module));
+ exit(1);
+ } // end if !sim
+ mod = (AliITSmodule *)fITSmodules->At(module);
+ sim->CreateFastRecPoints(mod,module,gRandom,ptarray);
+ lTR->Fill();
+ } // end for module
+
+ ClearModules();
+ fLoader->WriteRecPoints("OVERWRITE");
+ delete ptarray;
+}
+//_____________________________________________________________________
+Int_t AliITS::Hits2Clusters(TTree *hTree, TTree *cTree) {
+ //------------------------------------------------------------
+ // This function creates ITS clusters
+ //------------------------------------------------------------
+ if(!GetITSgeom()){
+ Error("HitsToPreDigits","fGeom is null!");
+ return 1; // need transformations to do digitization.
+ }
+ AliITSgeom *geom=GetITSgeom();
+ Int_t mmax=geom->GetIndexMax();
+
+ InitModules(-1,mmax);
+ FillModules(hTree,0);
+
+ TClonesArray *points = new TClonesArray("AliITSRecPoint",1000);
+ TBranch *branch=cTree->GetBranch("ITSRecPoints");
+ if (!branch) cTree->Branch("ITSRecPoints",&points);
+ else branch->SetAddress(&points);
+
+ AliITSsimulationFastPoints sim;
+ Int_t ncl=0;
+ for (Int_t m=0; m<mmax; m++) {
+ AliITSmodule *mod=GetModule(m);
+ sim.CreateFastRecPoints(mod,m,gRandom,points);
+ ncl+=points->GetEntriesFast();
+ cTree->Fill();
+ points->Clear();
+ }
+
+ Info("Hits2Clusters","Number of found fast clusters : %d",ncl);
+
+ //cTree->Write();
+
+ delete points;
+ return 0;
+}
+
+//_____________________________________________________________________
+void AliITS::CheckLabels(Int_t lab[3]) const {
+ //------------------------------------------------------------
+ // Tries to find mother's labels
+ //------------------------------------------------------------
+
+ if(lab[0]<0 && lab[1]<0 && lab[2]<0) return; // In case of no labels just exit
+
+ Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
+ for (Int_t i=0;i<3;i++){
+ Int_t label = lab[i];
+ if (label>=0 && label<ntracks) {
+ TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
+ if (part->P() < 0.005) {
+ Int_t m=part->GetFirstMother();
+ if (m<0) {
+ continue;
+ }
+ if (part->GetStatusCode()>0) {
+ continue;
+ }
+ lab[i]=m;
+ }
+ }
+ }
+
+}
+
+//______________________________________________________________________
+void AliITS::SDigitsToDigits(Option_t *opt){
+ // Standard Summable digits to Digits function.
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ if(!fDetTypeSim) {
+ Error("SDigitsToSDigits","fDetTypeSim is 0!");
+ return;
+ }
+
+ fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ SetDefaults();
+ fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName());
+