+
+ outgime->TreeD()->AutoSave();
+ outgime->WriteDigits("OVERWRITE");
+ outgime->UnloadDigits();
+ for(ifiles=0; ifiles<nfiles; ifiles++ )
+ {
+ inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(fl[ifiles]));
+ ingime = inRL->GetLoader(loadname);
+ ingime->UnloadSDigits();
+ }
+
+ delete[] fl;
+ sdig->Clear();
+ delete sdig;
+ for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE;
+
+
+ return;
+}
+//______________________________________________________________________
+void AliITSDigitizer::SetByRegionOfInterest(TTree *ts){
+ // Scans through the ITS branch of the SDigits tree, ts, for modules
+ // which have SDigits in them. For these modules, a flag is set to
+ // digitize only these modules. The value of fRoif determines how many
+ // neighboring modules will also be turned on. fRoif=0 will turn on only
+ // those modules with SDigits in them. fRoif=1 will turn on, in addition,
+ // those modules that are +-1 module from the one with the SDigits. And
+ // So on. This last feature is not supported yet.
+ // Inputs:
+ // TTree *ts The tree in which the existing SDigits will define the
+ // region of interest.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Int_t m,nm,i;
+
+ if(fRoif==0) return;
+ if(ts==0) return;
+ TBranch *brchSDigits = ts->GetBranch(fITS->GetName());
+ TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 );
+ //cout << "Region of Interest ts="<<ts<<" brchSDigits="<<brchSDigits<<" sdig="<<sdig<<endl;
+
+ if( brchSDigits ) {
+ brchSDigits->SetAddress( &sdig );
+ } else {
+ Error( "SetByRegionOfInterest","branch ITS not found in TreeS");
+ return;
+ } // end if brchSDigits
+
+ nm = fITS->GetITSgeom()->GetIndexMax();
+ for(m=0;m<nm;m++){
+ //cout << " fModActive["<<m<<"]=";
+ fModActive[m] = kFALSE; // Not active by default
+ sdig->Clear();
+ brchSDigits->GetEvent(m);
+ if(sdig->GetLast()>=0) for(i=0;i<sdig->GetLast();i++){
+ // activate the necessary modules
+ if(((AliITSpList*)sdig->At(m))->GetpListItem(i)->GetSignal()>0.0){ // Must have non zero signal.
+ fModActive[m] = kTRUE;
+ break;
+ } // end if
+ } // end if. end for i.
+ //cout << fModActive[m];
+ //cout << endl;
+ } // end for m
+ AliDebug(1,"Digitization by Region of Interest selected");
+ sdig->Clear();
+ delete sdig;
+ return;