+
+//_____________________________________________________________________
+void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
+ Option_t *opt0,Option_t *opt1,
+ const char *flnm){
+ // keep galice.root for signal and name differently the file for
+ // background when add! otherwise the track info for signal will be lost !
+ // the condition below will disappear when the geom class will be
+ // initialized for all versions - for the moment it is only for v5 !
+ // Inputs:
+ // Int_t evnt Event to be processed.
+ // Int_t bgrev Background Hit tree number.
+ // Int_t size Size used by InitModules. See InitModules.
+ // Option_t *opt0 Option passed to FillModules. See FillModules.
+ // Option_t *opt1 String indicating if merging hits or not. To
+ // merge hits set equal to "Add". Otherwise no
+ // background hits are considered.
+ // Test_t *flnm File name containing the background hits..
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+
+
+
+ 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 "
+ "instantiated for module %d type %s!",module,
+ geom->GetModuleTypeName(module));
+ exit(1);
+ } // end if !sim
+ mod = (AliITSmodule *)fITSmodules->At(module);
+ sim->CreateFastRecPoints(mod,module,gRandom,ptarray);
+ lTR->Fill();
+ ptarray->Clear();
+ } // 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();
+ }
+
+ AliDebug(1,Form("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) {
+ AliError("fDetTypeSim is 0!");
+ return;
+ }
+ const char *all = strstr(opt,"All");
+ const char *det[3] ={strstr(opt,"SPD"),strstr(opt,"SDD"),
+ strstr(opt,"SSD")};
+
+ // Reset Fast-OR signals for this event
+ fDetTypeSim->ResetFOSignals();
+
+ fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ SetDefaults();
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
+ fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName());
+
+ // Add Fast-OR signals to event (only one object per event)
+ if (all || det[0]) { // SPD present
+ WriteFOSignals();
+ }
+}
+