/*************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Conributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ //////////////////////////////////////////////////////////////////////// // This class defines the "Standard" reconstruction for the ITS // // detector. // // // //////////////////////////////////////////////////////////////////////// #include "TObjArray.h" #include "TTree.h" #include "AliCDBManager.h" #include "AliCDBStorage.h" #include "AliCDBEntry.h" #include "AliITSClusterFinder.h" #include "AliITSClusterFinderV2.h" #include "AliITSClusterFinderV2SPD.h" #include "AliITSClusterFinderV2SDD.h" #include "AliITSClusterFinderV2SSD.h" #include "AliITSClusterFinderSPD.h" #include "AliITSClusterFinderSDD.h" #include "AliITSClusterFinderSSD.h" #include "AliITSDetTypeRec.h" #include "AliITSgeom.h" #include "AliITSRawCluster.h" #include "AliITSRawClusterSPD.h" #include "AliITSRawClusterSDD.h" #include "AliITSRawClusterSSD.h" #include "AliITSRecPoint.h" #include "AliITSReconstructor.h" #include "AliITSRecoParam.h" #include "AliITSCalibrationSDD.h" #include "AliITSMapSDD.h" #include "AliITSDriftSpeedArraySDD.h" #include "AliITSDriftSpeedSDD.h" #include "AliITSCalibrationSSD.h" #include "AliITSNoiseSSD.h" #include "AliITSGainSSD.h" #include "AliITSBadChannelsSSD.h" #include "AliITSPedestalSSD.h" #include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" #include "AliITSsegmentationSSD.h" #include "AliLog.h" const Int_t AliITSDetTypeRec::fgkNdettypes = 3; const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240; const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260; const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698; ClassImp(AliITSDetTypeRec) //________________________________________________________________ AliITSDetTypeRec::AliITSDetTypeRec(): TObject(), fNMod(0), fITSgeom(0), fReconstruction(0), fSegmentation(0), fCalibration(0), fSSDCalibration(0), fSPDDead(0), fPreProcess(0), fPostProcess(0), fDigits(0), fDDLMapSDD(0), fRespSDD(0), fNdtype(0), fCtype(0), fNctype(0), fRecPoints(0), fNRecPoints(0), fSelectedVertexer(), fFirstcall(kTRUE){ // Standard Constructor // Inputs: // none. // Outputs: // none. // Return: // fReconstruction = new TObjArray(fgkNdettypes); fDigits = new TObjArray(fgkNdettypes); for(Int_t i=0; i<3; i++){ fClusterClassName[i]=0; fDigClassName[i]=0; fRecPointClassName[i]=0; } fSSDCalibration=new AliITSCalibrationSSD(); fNdtype = new Int_t[fgkNdettypes]; fCtype = new TObjArray(fgkNdettypes); fNctype = new Int_t[fgkNdettypes]; fNMod = new Int_t [fgkNdettypes]; fNMod[0] = fgkDefaultNModulesSPD; fNMod[1] = fgkDefaultNModulesSDD; fNMod[2] = fgkDefaultNModulesSSD; fRecPoints = new TClonesArray("AliITSRecPoint",3000); fNRecPoints = 0; for(Int_t i=0;i~AliITSDetTypeRec(); new(this) AliITSDetTypeRec(source); return *this; } //_____________________________________________________________________ AliITSDetTypeRec::~AliITSDetTypeRec(){ //Destructor if(fReconstruction){ fReconstruction->Delete(); delete fReconstruction; fReconstruction = 0; } if(fSegmentation){ fSegmentation->Delete(); delete fSegmentation; fSegmentation = 0; } if(fCalibration){ if(!(AliCDBManager::Instance()->GetCacheFlag())) { AliITSCalibration * calSPD = (AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()); if (calSPD) { AliITSresponse* rspd = calSPD->GetResponse(); if(rspd) delete rspd; } AliITSCalibration * calSSD = (AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()); if (calSSD) { AliITSresponse* rssd = calSSD->GetResponse(); if(rssd) delete rssd; } fCalibration->Delete(); delete fCalibration; fCalibration = 0; if(fRespSDD) delete fRespSDD; if(fDDLMapSDD) delete fDDLMapSDD; } } if(fSSDCalibration) delete fSSDCalibration; if(fSPDDead){ if(!(AliCDBManager::Instance()->GetCacheFlag())) { fSPDDead->Delete(); delete fSPDDead; fSPDDead = 0; } } if(fPreProcess) delete fPreProcess; if(fPostProcess) delete fPostProcess; if(fDigits){ fDigits->Delete(); delete fDigits; fDigits=0; } if(fRecPoints){ fRecPoints->Delete(); delete fRecPoints; fRecPoints=0; } if(fCtype) { fCtype->Delete(); delete fCtype; fCtype = 0; } delete [] fNctype; delete [] fNdtype; delete [] fNMod; if (fITSgeom) delete fITSgeom; } //___________________________________________________________________ void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){ //Set reconstruction model for detector type if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes); if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype); fReconstruction->AddAt(clf,dettype); } //______________________________________________________________________ AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){ //Get reconstruction model for detector type if(fReconstruction==0) { Warning("GetReconstructionModel","fReconstruction is 0!"); return 0; } return (AliITSClusterFinder*)fReconstruction->At(dettype); } //______________________________________________________________________ void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){ //Set segmentation model for detector type if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes); if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype); fSegmentation->AddAt(seg,dettype); } //______________________________________________________________________ AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){ //Get segmentation model for detector type if(fSegmentation==0) { Warning("GetSegmentationModel","fSegmentation is 0!"); return 0; } return (AliITSsegmentation*)fSegmentation->At(dettype); } //_______________________________________________________________________ void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){ //Set calibration (response) for the module iMod of type dettype if (fCalibration==0) { fCalibration = new TObjArray(GetITSgeom()->GetIndexMax()); fCalibration->SetOwner(kTRUE); fCalibration->Clear(); } if (fCalibration->At(iMod) != 0) delete (AliITSCalibration*) fCalibration->At(iMod); fCalibration->AddAt(cal,iMod); } //_______________________________________________________________________ void AliITSDetTypeRec::SetSPDDeadModel(Int_t iMod, AliITSCalibration *cal){ //Set dead pixel info for the SPD module iMod if (fSPDDead==0) { fSPDDead = new TObjArray(fgkDefaultNModulesSPD); fSPDDead->SetOwner(kTRUE); fSPDDead->Clear(); } if (fSPDDead->At(iMod) != 0) delete (AliITSCalibration*) fSPDDead->At(iMod); fSPDDead->AddAt(cal,iMod); } //_______________________________________________________________________ AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){ //Get calibration model for module type if(fCalibration==0) { Warning("GetalibrationModel","fCalibration is 0!"); return 0; } if(iModAt(iMod); }else{ Int_t i=iMod-(fgkDefaultNModulesSPD+fgkDefaultNModulesSDD); fSSDCalibration->SetModule(i); return (AliITSCalibration*)fSSDCalibration; } } //_______________________________________________________________________ AliITSCalibration* AliITSDetTypeRec::GetSPDDeadModel(Int_t iMod){ //Get SPD dead for module iMod if(fSPDDead==0) { AliWarning("fSPDDead is 0!"); return 0; } return (AliITSCalibration*)fSPDDead->At(iMod); } //______________________________________________________________________ void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){ // Set branch address for the tree of digits. const char *det[4] = {"SPD","SDD","SSD","ITS"}; TBranch *branch; Char_t* digclass; Int_t i; char branchname[30]; if(!treeD) return; if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes); for (i=0; iAt(i))) { fDigits->AddAt(new TClonesArray(digclass,1000),i); }else{ ResetDigits(i); } if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]); else sprintf(branchname,"%sDigits%d",det[3],i+1); if (fDigits) { branch = treeD->GetBranch(branchname); if (branch) branch->SetAddress(&((*fDigits)[i])); } } } //_______________________________________________________________________ TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name, const char *classname, void* address,Int_t size, Int_t splitlevel) { // // Makes branch in given tree and diverts them to a separate file // // // if (tree == 0x0) { Error("MakeBranchInTree","Making Branch %s Tree is NULL",name); return 0x0; } TBranch *branch = tree->GetBranch(name); if (branch) { return branch; } if (classname){ branch = tree->Branch(name,classname,address,size,splitlevel); } else { branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel); } return branch; } //____________________________________________________________________ void AliITSDetTypeRec::SetDefaults(){ //Set defaults for segmentation and response if(!GetITSgeom()){ Warning("SetDefaults","null pointer to AliITSgeomGeom !"); return; } AliITSsegmentation* seg; if(!GetCalibration()) {AliFatal("Exit");exit(0);} for(Int_t dettype=0;dettypeGetRun()); // Int_t run=GetRunNumber(); Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag(); if (fCalibration==0) { fCalibration = new TObjArray(GetITSgeom()->GetIndexMax()); fCalibration->SetOwner(!cacheStatus); fCalibration->Clear(); } // dead pixel are not used for local reconstruction AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDNoisy"); AliCDBEntry *deadSPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead"); AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD"); // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD"); AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD"); AliCDBEntry *entryPedestalSSD = AliCDBManager::Instance()->Get("ITS/Calib/PedestalSSD"); AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD"); AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD"); AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD"); AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD"); AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD"); AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD"); AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD"); AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD"); AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD"); if(!entrySPD || !deadSPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryPedestalSSD || !entryBadChannelsSSD || !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapASDD || !mapTSDD ){ AliFatal("Calibration object retrieval failed! "); return kFALSE; } TObjArray *calSPD = (TObjArray *)entrySPD->GetObject(); if(!cacheStatus)entrySPD->SetObject(NULL); entrySPD->SetOwner(kTRUE); TObjArray *caldeadSPD = (TObjArray *)deadSPD->GetObject(); if(!cacheStatus)deadSPD->SetObject(NULL); deadSPD->SetOwner(kTRUE); AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject(); if(!cacheStatus)entry2SPD->SetObject(NULL); entry2SPD->SetOwner(kTRUE); TObjArray *calSDD = (TObjArray *)entrySDD->GetObject(); if(!cacheStatus)entrySDD->SetObject(NULL); entrySDD->SetOwner(kTRUE); AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject(); if(!cacheStatus)entry2SDD->SetObject(NULL); entry2SDD->SetOwner(kTRUE); TObjArray *drSp = (TObjArray *)drSpSDD->GetObject(); if(!cacheStatus)drSpSDD->SetObject(NULL); drSpSDD->SetOwner(kTRUE); AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject(); if(!cacheStatus)ddlMapSDD->SetObject(NULL); ddlMapSDD->SetOwner(kTRUE); TObjArray *mapAn = (TObjArray *)mapASDD->GetObject(); if(!cacheStatus)mapASDD->SetObject(NULL); mapASDD->SetOwner(kTRUE); TObjArray *mapT = (TObjArray *)mapTSDD->GetObject(); if(!cacheStatus)mapTSDD->SetObject(NULL); mapTSDD->SetOwner(kTRUE); AliITSNoiseSSD *noiseSSD = (AliITSNoiseSSD *)entryNoiseSSD->GetObject(); if(!cacheStatus)entryNoiseSSD->SetObject(NULL); entryNoiseSSD->SetOwner(kTRUE); AliITSPedestalSSD *pedestalSSD = (AliITSPedestalSSD*)entryPedestalSSD->GetObject(); if(!cacheStatus)entryPedestalSSD->SetObject(NULL); entryPedestalSSD->SetOwner(kTRUE); AliITSGainSSD *gainSSD = (AliITSGainSSD *)entryGainSSD->GetObject(); if(!cacheStatus)entryGainSSD->SetObject(NULL); entryGainSSD->SetOwner(kTRUE); AliITSBadChannelsSSD *badchannelsSSD = (AliITSBadChannelsSSD*)entryBadChannelsSSD->GetObject(); if(!cacheStatus)entryBadChannelsSSD->SetObject(NULL); entryBadChannelsSSD->SetOwner(kTRUE); AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject(); if(!cacheStatus)entry2SSD->SetObject(NULL); entry2SSD->SetOwner(kTRUE); // DB entries are deleted. In this way metadeta objects are deleted as well if(!cacheStatus){ delete entrySPD; delete deadSPD; delete entrySDD; delete entryNoiseSSD; delete entryPedestalSSD; delete entryGainSSD; delete entryBadChannelsSSD; delete entry2SPD; delete entry2SDD; delete entry2SSD; delete mapASDD; delete mapTSDD; delete drSpSDD; delete ddlMapSDD; } if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!caldeadSPD) ||(!calSDD) || (!drSp) || (!ddlsdd) || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) { AliWarning("Can not get calibration from calibration database !"); return kFALSE; } fNMod[0] = calSPD->GetEntries(); fNMod[1] = calSDD->GetEntries(); //fNMod[2] = noiseSSD->GetEntries(); AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database", fNMod[0], fNMod[1], fNMod[2])); AliITSCalibration* cal; for (Int_t i=0; iAt(i); cal->SetResponse((AliITSresponse*)pSPD); SetCalibrationModel(i, cal); cal = (AliITSCalibration*) caldeadSPD->At(i); SetSPDDeadModel(i, cal); } fDDLMapSDD=ddlsdd; fRespSDD=pSDD; for(Int_t iddl=0; iddlGetModuleNumber(iddl,icar); if(iMod==-1) continue; Int_t i=iMod - fgkDefaultNModulesSPD; cal = (AliITSCalibration*) calSDD->At(i); Int_t i0=2*i; Int_t i1=1+2*i; AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0); AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0); AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0); AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1); AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1); AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1); cal->SetDriftSpeed(0,arr0); cal->SetDriftSpeed(1,arr1); cal->SetMapA(0,ma0); cal->SetMapA(1,ma1); cal->SetMapT(0,mt0); cal->SetMapT(1,mt1); SetCalibrationModel(iMod, cal); } } fSSDCalibration->SetResponse((AliITSresponse*)pSSD); fSSDCalibration->SetNoise(noiseSSD); fSSDCalibration->SetPedestal(pedestalSSD); fSSDCalibration->SetGain(gainSSD); fSSDCalibration->SetBadChannels(badchannelsSSD); //fSSDCalibration->FillBadChipMap(); /* for (Int_t i=0; iSetResponse((AliITSresponse*)pSSD); AliITSNoiseSSD *noise = (AliITSNoiseSSD*) (noiseSSD->At(i)); calibSSD->SetNoise(noise); AliITSPedestalSSD *pedestal = (AliITSPedestalSSD*) (pedestalSSD->At(i)); calibSSD->SetPedestal(pedestal); AliITSGainSSD *gain = (AliITSGainSSD*) (gainSSD->At(i)); calibSSD->SetGain(gain); AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (badchannelsSSD->At(i)); calibSSD->SetBadChannels(bad); calibSSD->FillBadChipMap(); Int_t iMod = i + fgkDefaultNModulesSPD + fgkDefaultNModulesSDD; SetCalibrationModel(iMod, calibSSD); } */ return kTRUE; } //________________________________________________________________ void AliITSDetTypeRec::SetDefaultClusterFinders(){ //set defaults for standard cluster finder if(!GetITSgeom()){ Warning("SetDefaults","null pointer to AliITSgeom!"); return; } AliITSClusterFinder *clf; for(Int_t dettype=0;dettypeInitGeometry(); if(!rawdata) clf->SetDigits(DigitsAddress(0)); SetReconstructionModel(dettype,clf); } } //SDD if(dettype==1){ if(!GetReconstructionModel(dettype)){ clf = new AliITSClusterFinderV2SDD(this); clf->InitGeometry(); if(!rawdata) clf->SetDigits(DigitsAddress(1)); SetReconstructionModel(dettype,clf); } } //SSD if(dettype==2){ if(!GetReconstructionModel(dettype)){ clf = new AliITSClusterFinderV2SSD(this); clf->InitGeometry(); if(!rawdata) clf->SetDigits(DigitsAddress(2)); SetReconstructionModel(dettype,clf); } } } } //______________________________________________________________________ void AliITSDetTypeRec::MakeBranch(TTree* tree, Option_t* option){ //Creates branches for clusters and recpoints Bool_t cR = (strstr(option,"R")!=0); Bool_t cRF = (strstr(option,"RF")!=0); if(cRF)cR = kFALSE; if(cR) MakeBranchR(tree); if(cRF) MakeBranchRF(tree); } //___________________________________________________________________ void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){ // Adds a raw cluster to the list TClonesArray &lc = *((TClonesArray*)fCtype->At(id)); switch(id){ case 0: new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); break; case 1: new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); break; case 2: new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); break; } } //___________________________________________________________________ void AliITSDetTypeRec::ResetDigits(){ // Reset number of digits and the digits array for the ITS detector. if(!fDigits) return; for(Int_t i=0;iAt(branch)) ((TClonesArray*)fDigits->At(branch))->Clear(); if(fNdtype) fNdtype[branch]=0; } //__________________________________________________________________ void AliITSDetTypeRec::ResetClusters(){ //Resets number of clusters and the cluster array for(Int_t i=0;iAt(i)) ((TClonesArray*)fCtype->At(i))->Clear(); if (fNctype) fNctype[i]=0; } //__________________________________________________________________ void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){ //Creates tree branches for recpoints // Inputs: // cont char *file File name where RecPoints branch is to be written // to. If blank it write the SDigits to the same // file in which the Hits were found. Int_t buffsz = 4000; char branchname[30]; // only one branch for rec points for all detector types Bool_t oFast= (strstr(opt,"Fast")!=0); Char_t detname[10] = "ITS"; if(oFast){ sprintf(branchname,"%sRecPointsF",detname); } else { sprintf(branchname,"%sRecPoints",detname); } if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000); if (treeR) MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99); } //______________________________________________________________________ void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){ // Set branch address for the Reconstructed points Trees. // Inputs: // TTree *treeR Tree containing the RecPoints. // Outputs: // none. // Return: char branchname[30]; Char_t namedet[10]="ITS"; if(!treeR) return; if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); TBranch *branch; sprintf(branchname,"%sRecPoints",namedet); branch = treeR->GetBranch(branchname); if (branch) { branch->SetAddress(&fRecPoints); }else { sprintf(branchname,"%sRecPointsF",namedet); branch = treeR->GetBranch(branchname); if (branch) { branch->SetAddress(&fRecPoints); } } } //____________________________________________________________________ void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){ // Add a reconstructed space point to the list // Inputs: // const AliITSRecPoint &r RecPoint class to be added to the tree // of reconstructed points TreeR. // Outputs: // none. // Return: // none. TClonesArray &lrecp = *fRecPoints; new(lrecp[fNRecPoints++]) AliITSRecPoint(r); } //______________________________________________________________________ void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Bool_t v2){ // cluster finding and reconstruction of space points // the condition below will disappear when the geom class will be // initialized for all versions - for the moment it is only for v5 ! // 7 is the SDD beam test version // Inputs: // TTree *treeD Digits tree // TTree *treeR Clusters tree // Int_t lastentry Offset for module when not all of the modules // are processed. // Option_t *opt String indicating which ITS sub-detectors should // be processed. If ="All" then all of the ITS // sub detectors are processed. const char *all = strstr(opt,"All"); const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), strstr(opt,"SSD")}; if(!v2) { SetDefaultClusterFinders(); AliInfo("Original cluster finder has been selected\n"); } else { SetDefaultClusterFindersV2(); AliInfo("V2 cluster finder has been selected \n"); } AliITSClusterFinder *rec = 0; Int_t id,module,first=0; for(module=0;moduleGetIndexMax();module++){ id = GetITSgeom()->GetModuleType(module); if (!all && !det[id]) continue; if(det[id]) first = GetITSgeom()->GetStartDet(id); rec = (AliITSClusterFinder*)GetReconstructionModel(id); TClonesArray *itsDigits = DigitsAddress(id); if (!rec) AliFatal("The reconstruction class was not instanciated!"); ResetDigits(); // MvL: Not sure we neeed this when rereading anyways if (all) { treeD->GetEvent(lastentry+module); }else { treeD->GetEvent(lastentry+(module-first)); } Int_t ndigits = itsDigits->GetEntriesFast(); if(ndigits>0){ rec->SetDetTypeRec(this); rec->SetDigits(DigitsAddress(id)); // rec->SetClusters(ClustersAddress(id)); rec->FindRawClusters(module); } // end if treeR->Fill(); ResetRecPoints(); ResetClusters(); } } //______________________________________________________________________ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){ // cluster finding and reconstruction of space points // the condition below will disappear when the geom class will be // initialized for all versions - for the moment it is only for v5 ! // 7 is the SDD beam test version // Inputs: // AliRawReader *rawReader Pointer to the raw-data reader // TTree *treeR Clusters tree // Outputs: // none. // Return: // none. const char *all = strstr(opt,"All"); const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), strstr(opt,"SSD")}; AliITSClusterFinderV2 *rec = 0; Int_t id=0; TClonesArray *array=new TClonesArray("AliITSRecPoint",1000); TBranch *branch = treeR->Branch("ITSRecPoints",&array); delete array; TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) { clusters[iModule] = NULL; } for(id=0;id<3;id++){ if (!all && !det[id]) continue; rec = (AliITSClusterFinderV2*)GetReconstructionModel(id); if (!rec) AliFatal("The reconstruction class was not instanciated"); rec->SetDetTypeRec(this); rec->RawdataToClusters(rawReader,clusters); } Int_t nClusters =0; TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint"); for(Int_t iModule=0;iModuleGetIndexMax();iModule++){ id = GetITSgeom()->GetModuleType(iModule); if (!all && !det[id]) continue; array = clusters[iModule]; if(!array){ AliDebug(1,Form("data for module %d missing!",iModule)); array = emptyArray; } branch->SetAddress(&array); treeR->Fill(); nClusters+=array->GetEntriesFast(); if (array != emptyArray) { array->Delete(); delete array; } } delete emptyArray; delete[] clusters; Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n", nClusters); }