- const char *all = strstr(opt,"All");
- const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
- strstr(opt,"SSD")};
- static Bool_t setRec=kTRUE;
- if (setRec) SetDefaultClusterFinders();
- setRec=kFALSE;
-
- TTree *treeC=TreeC();
-
- AliITSClusterFinder *rec = 0;
- AliITSDetType *iDetType = 0;
- Int_t id,module,first=0;
- for(module=0;module<geom->GetIndexMax();module++){
- id = geom->GetModuleType(module);
- if (!all && !det[id]) continue;
- if(det[id]) first = geom->GetStartDet(id);
- iDetType = DetType(id);
- rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
- TClonesArray *itsDigits = this->DigitsAddress(id);
- if (!rec) {
- Error("DigitsToRecPoints",
- "The reconstruction class was not instantiated!");
- exit(1);
- } // end if !rec
- this->ResetDigits();
- if (all) gAlice->TreeD()->GetEvent(lastentry+module);
- else gAlice->TreeD()->GetEvent(lastentry+(module-first));
- Int_t ndigits = itsDigits->GetEntriesFast();
- if (ndigits) rec->FindRawClusters(module);
- gAlice->TreeR()->Fill();
- ResetRecPoints();
- treeC->Fill();
- ResetClusters();
- } // end for module
+ AliITSRawStreamSPD inputSPD(rawReader);
+ while(1){
+ Bool_t next = inputSPD.Next();
+ if (!next) break;
+
+ Int_t module = inputSPD.GetModuleID();
+ Int_t column = inputSPD.GetColumn();
+ Int_t row = inputSPD.GetRow();
+ Int_t index = npx * column + row;
+
+ if (module >= size) continue;
+
+ last = (fModA[module])->GetEntries();
+ TClonesArray& dum = *fModA[module];
+ fDetTypeSim->GetSimuParam()->SPDThresholds(module,thr,sigma);
+ thr += 1.;
+ new (dum[last]) AliITSpListItem(-1, -1, module, index, thr);
+ }
+ rawReader->Reset();
+
+ //
+ // SDD
+ //
+ AliITSsegmentationSDD* segSDD = (AliITSsegmentationSDD*) fDetTypeSim->GetSegmentationModel(1);
+ npx = segSDD->Npx();
+ Int_t scalef=AliITSsimulationSDD::ScaleFourier(segSDD);
+ Int_t firstSDD=AliITSgeomTGeo::GetModuleIndex(3,1,1);
+ Int_t firstSSD=AliITSgeomTGeo::GetModuleIndex(5,1,1);
+
+ AliITSRawStream* inputSDD=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
+ for(Int_t iMod=firstSDD; iMod<firstSSD; iMod++){
+ AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel(iMod);
+ Bool_t isZeroSupp=cal->GetZeroSupp();
+ if(isZeroSupp){
+ for(Int_t iSid=0; iSid<2; iSid++) inputSDD->SetZeroSuppLowThreshold(iMod-firstSDD,iSid,cal->GetZSLowThreshold(iSid));
+ }else{
+ for(Int_t iSid=0; iSid<2; iSid++) inputSDD->SetZeroSuppLowThreshold(iMod-firstSDD,iSid,0);
+ }
+ }
+
+ AliITSDDLModuleMapSDD* ddlmap=fDetTypeSim->GetDDLModuleMapSDD();
+ inputSDD->SetDDLModuleMap(ddlmap);
+ while(inputSDD->Next()){
+ if(inputSDD->IsCompletedModule()==kFALSE &&
+ inputSDD->IsCompletedDDL()==kFALSE){
+
+ Int_t module = inputSDD->GetModuleID();
+ Int_t anode = inputSDD->GetCoord1()+segSDD->NpzHalf()*inputSDD->GetChannel();
+ Int_t time = inputSDD->GetCoord2();
+ Int_t signal10 = inputSDD->GetSignal();
+ Int_t index = AliITSpList::GetIndex(anode,time,scalef*npx);
+
+ if (module >= size) continue;
+ last = fModA[module]->GetEntries();
+ TClonesArray& dum = *fModA[module];
+ new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal10));
+ ((AliITSpListItem*) dum.At(last))->AddSignalAfterElect(module, index, Double_t(signal10));
+ }
+ }
+ delete inputSDD;
+ rawReader->Reset();
+
+ //
+ // SSD
+ //
+ AliITSsegmentationSSD* segSSD = (AliITSsegmentationSSD*) fDetTypeSim->GetSegmentationModel(2);
+ npx = segSSD->Npx();
+ AliITSRawStreamSSD inputSSD(rawReader);
+ while(1){
+ Bool_t next = inputSSD.Next();
+ if (!next) break;
+
+ Int_t module = inputSSD.GetModuleID();
+ if(module<0)AliError(Form("Invalid SSD module %d \n",module));
+ if(module<0)continue;
+ Int_t side = inputSSD.GetSideFlag();
+ Int_t strip = inputSSD.GetStrip();
+ Int_t signal = inputSSD.GetSignal();
+ Int_t index = npx * side + strip;
+
+ if (module >= size) continue;
+
+ last = fModA[module]->GetEntries();
+ TClonesArray& dum = *fModA[module];
+ new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal));
+ }
+ rawReader->Reset();
+ AliITSpListItem* sdig = 0;
+
+ Int_t firstssd = GetITSgeom()->GetStartDet(kSSD);
+ Double_t adcToEv = 1.;
+ for (Int_t mod = 0; mod < size; mod++)
+ {
+ if(mod>=firstssd) {
+ AliITSCalibrationSSD* calssd = (AliITSCalibrationSSD*)fDetTypeSim->GetCalibrationModel(mod);
+ adcToEv = 1./calssd->GetSSDDEvToADC(1.);
+ }
+ Int_t nsdig = fModA[mod]->GetEntries();
+ for (Int_t ie = 0; ie < nsdig; ie++) {
+ sdig = (AliITSpListItem*) (fModA[mod]->At(ie));
+ Double_t digsig = sdig->GetSignal();
+ if(mod>=firstssd) digsig*=adcToEv; // for SSD: convert back charge from ADC to electron
+ new (aSDigits[ie]) AliITSpListItem(-1, -1, mod, sdig->GetIndex(), digsig);
+ Float_t sig = sdig->GetSignalAfterElect();
+ if(mod>=firstssd) sig*=adcToEv;
+ if (sig > 0.) {
+ sdig = (AliITSpListItem*)aSDigits[ie];
+ sdig->AddSignalAfterElect(mod, sdig->GetIndex(), Double_t(sig));
+ }
+ }
+
+ tree->Fill();
+ aSDigits.Clear();
+ fModA[mod]->Clear();
+ }
+ loader->WriteSDigits("OVERWRITE");
+ return kTRUE;
+}