#include "TTree.h"
#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
#include "AliCDBEntry.h"
-
#include "AliITSClusterFinder.h"
#include "AliITSClusterFinderV2.h"
#include "AliITSClusterFinderV2SPD.h"
#include "AliITSClusterFinderSPD.h"
#include "AliITSClusterFinderSDD.h"
#include "AliITSClusterFinderSSD.h"
-#include "AliITSclusterV2.h"
-#include "AliITSgeom.h"
#include "AliITSDetTypeRec.h"
#include "AliITSRawCluster.h"
#include "AliITSRawClusterSPD.h"
#include "AliITSRawClusterSDD.h"
#include "AliITSRawClusterSSD.h"
#include "AliITSRecPoint.h"
-#include "AliITSresponseSDD.h"
+#include "AliITSCalibrationSDD.h"
#include "AliITSsegmentationSPD.h"
#include "AliITSsegmentationSDD.h"
#include "AliITSsegmentationSSD.h"
+#include "AliLog.h"
const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
ClassImp(AliITSDetTypeRec)
//________________________________________________________________
-AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
-fGeom(), //
-fReconstruction(),// [NDet]
-fSegmentation(), // [NDet]
-fCalibration(), // [NMod]
-fPreProcess(), // [] e.g. Find Calibration values
-fPostProcess(), // [] e.g. find primary vertex
-fDigits(), //! [NMod][NDigits]
-fClusterClassName(), // String with Cluster class name
-fDigClassName(), // String with digit class name.
-fRecPointClassName(){// String with RecPoint class name
+AliITSDetTypeRec::AliITSDetTypeRec(): TObject(){
// Default Constructor
// Inputs:
// none.
// none.
// Return:
// A properly zero-ed AliITSDetTypeRec class.
+ fReconstruction = 0;
+ fSegmentation = 0;
+ fCalibration = 0;
+ fPreProcess = 0;
+ fPostProcess = 0;
+ fDigits = 0;;
+ for(Int_t i=0; i<3; i++){
+ fClusterClassName[i]=0;
+ fDigClassName[i]=0;
+ fRecPointClassName[i]=0;
+ }
+ fNdtype = 0;
+ fCtype = 0;
+ fNMod = 0;
+ fNctype = 0;
+ fRecPoints = 0;
+ fNRecPoints = 0;
+ SelectVertexer(" ");
+ fLoader = 0;
+ fRunNumber = 0;
+
+}
+//________________________________________________________________
+AliITSDetTypeRec::AliITSDetTypeRec(AliITSLoader *loader): TObject(){
+ // Standard Constructor
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ //
- fGeom = 0;
fReconstruction = new TObjArray(fgkNdettypes);
fSegmentation = 0;
fCalibration = 0;
fPreProcess = 0;
fPostProcess = 0;
fDigits = new TObjArray(fgkNdettypes);
+ for(Int_t i=0; i<3; i++){
+ fClusterClassName[i]=0;
+ fDigClassName[i]=0;
+ fRecPointClassName[i]=0;
+ }
fNdtype = new Int_t[fgkNdettypes];
fCtype = new TObjArray(fgkNdettypes);
fNctype = new Int_t[fgkNdettypes];
- fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+ fNMod = new Int_t [fgkNdettypes];
+ fNMod[0] = fgkDefaultNModulesSPD;
+ fNMod[1] = fgkDefaultNModulesSDD;
+ fNMod[2] = fgkDefaultNModulesSSD;
+ fRecPoints = new TClonesArray("AliITSRecPoint",3000);
fNRecPoints = 0;
- fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
- fNClustersV2 = 0;
for(Int_t i=0;i<fgkNdettypes;i++){
fNdtype[i]=0;
}
SelectVertexer(" ");
- fLoader = 0;
-
- fNMod[0] = fgkDefaultNModulesSPD;
- fNMod[1] = fgkDefaultNModulesSDD;
- fNMod[2] = fgkDefaultNModulesSSD;
-
+ fLoader = loader;
+
SetRunNumber();
}
//______________________________________________________________________
AliITSDetTypeRec::~AliITSDetTypeRec(){
//Destructor
- if(fGeom) delete fGeom;
- if(fReconstruction) delete fReconstruction;
- if(fSegmentation) delete fSegmentation;
- if(fCalibration) delete fCalibration;
+
+ if(fReconstruction){
+ fReconstruction->Delete();
+ delete fReconstruction;
+ fReconstruction = 0;
+ }
+ if(fSegmentation){
+ fSegmentation->Delete();
+ delete fSegmentation;
+ fSegmentation = 0;
+ }
+ if(fCalibration){
+ AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
+ AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
+ AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
+ if(rspd) delete rspd;
+ if(rsdd) delete rsdd;
+ if(rssd) delete rssd;
+ fCalibration->Delete();
+ delete fCalibration;
+ fCalibration = 0;
+ }
if(fPreProcess) delete fPreProcess;
if(fPostProcess) delete fPostProcess;
delete fRecPoints;
fRecPoints=0;
}
- if(fClustersV2){
- fClustersV2->Delete();
- delete fClustersV2;
- fClustersV2=0;
- }
if(fCtype) {
fCtype->Delete();
delete fCtype;
}
delete [] fNctype;
delete [] fNdtype;
+ delete [] fNMod;
if(fLoader) delete fLoader;
}
+
//___________________________________________________________________
void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
}
//_______________________________________________________________________
-void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSresponse *cal){
+void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
//Set calibration (response) for the module iMod of type dettype
if (fCalibration==0) {
- fCalibration = new TObjArray(fGeom->GetIndexMax());
+ fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
fCalibration->SetOwner(kTRUE);
fCalibration->Clear();
}
if (fCalibration->At(iMod) != 0)
- delete (AliITSresponse*) fCalibration->At(iMod);
+ delete (AliITSCalibration*) fCalibration->At(iMod);
fCalibration->AddAt(cal,iMod);
}
//_______________________________________________________________________
-AliITSresponse* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
+AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
//Get calibration model for module type
return 0;
}
- return (AliITSresponse*)fCalibration->At(iMod);
+ return (AliITSCalibration*)fCalibration->At(iMod);
}
//______________________________________________________________________
//Set defaults for segmentation and response
- if(fGeom==0){
- Warning("SetDefaults","fGeom is 0!");
+ if(!GetITSgeom()){
+ Warning("SetDefaults","null pointer to AliITSgeomGeom !");
return;
}
for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
if(dettype==0){
- seg = new AliITSsegmentationSPD(fGeom);
+ seg = new AliITSsegmentationSPD(GetITSgeom());
SetSegmentationModel(dettype,seg);
SetDigitClassName(dettype,"AliITSdigitSPD");
SetClusterClassName(dettype,"AliITSRawClusterSPD");
}
if(dettype==1){
- AliITSresponseSDD* res=(AliITSresponseSDD*) GetCalibrationModel(fGeom->GetStartSDD());
- seg = new AliITSsegmentationSDD(fGeom,res);
+ AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
+ seg = new AliITSsegmentationSDD(GetITSgeom(),res);
SetSegmentationModel(dettype,seg);
- const char *kopt = res->ZeroSuppOption();
+ const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
else SetDigitClassName(dettype,"AliITSdigitSDD");
SetClusterClassName(dettype,"AliITSRawClusterSDD");
}
if(dettype==2){
- AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(fGeom);
+ AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(GetITSgeom());
seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
Bool_t AliITSDetTypeRec::GetCalibration() {
// Get Default calibration if a storage is not defined.
- Bool_t deleteManager = kFALSE;
- if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
- AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
- deleteManager = kTRUE;
+
+ AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", fRunNumber);
+ AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", fRunNumber);
+ AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", fRunNumber);
+ AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", fRunNumber);
+ AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", fRunNumber);
+ AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", fRunNumber);
+
+ if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){
+ AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
+ AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+
+ entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", fRunNumber);
+ entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", fRunNumber);
+ entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", fRunNumber);
+ entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", fRunNumber);
+ entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", fRunNumber);
+ entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", fRunNumber);
+
+ AliCDBManager::Instance()->SetDefaultStorage(origStorage);
}
- AliCDBStorage *storage = AliCDBManager::Instance()->GetDefaultStorage();
- AliCDBEntry *entrySPD = storage->Get("ITS/Calib/RespSPD", fRunNumber);
+
TObjArray *respSPD = (TObjArray *)entrySPD->GetObject();
entrySPD->SetObject(NULL);
entrySPD->SetOwner(kTRUE);
- AliCDBEntry *entrySDD = storage->Get("ITS/Calib/RespSDD", fRunNumber);
+
+ AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
+ entry2SPD->SetObject(NULL);
+ entry2SPD->SetOwner(kTRUE);
+
TObjArray *respSDD = (TObjArray *)entrySDD->GetObject();
entrySDD->SetObject(NULL);
entrySDD->SetOwner(kTRUE);
- AliCDBEntry *entrySSD = storage->Get("ITS/Calib/RespSSD", fRunNumber);
+
+ AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
+ entry2SDD->SetObject(NULL);
+ entry2SDD->SetOwner(kTRUE);
+
TObjArray *respSSD = (TObjArray *)entrySSD->GetObject();
entrySSD->SetObject(NULL);
entrySSD->SetOwner(kTRUE);
+
+ AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
+ entry2SSD->SetObject(NULL);
+ entry2SSD->SetOwner(kTRUE);
+
// DB entries are dleted. In this waymetadeta objects are deleted as well
delete entrySPD;
delete entrySDD;
delete entrySSD;
- if(deleteManager){
- AliCDBManager::Instance()->Destroy();
- AliCDBManager::Instance()->UnsetDefaultStorage();
- storage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy()
- }
- if ((! respSPD)||(! respSDD)||(! respSSD)) {
+ delete entry2SPD;
+ delete entry2SDD;
+ delete entry2SSD;
+
+
+ if ((!pSPD)||(!pSDD)||(!pSSD) || (!respSPD) || (!respSDD) || (!respSSD)) {
AliWarning("Can not get calibration from calibration database !");
return kFALSE;
}
-
+
fNMod[0] = respSPD->GetEntries();
fNMod[1] = respSDD->GetEntries();
fNMod[2] = respSSD->GetEntries();
AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
fNMod[0], fNMod[1], fNMod[2]));
- AliITSresponse* res;
+ AliITSCalibration* res;
for (Int_t i=0; i<fNMod[0]; i++) {
- res = (AliITSresponse*) respSPD->At(i);
+ res = (AliITSCalibration*) respSPD->At(i);
+ res->SetResponse((AliITSresponse*)pSPD);
SetCalibrationModel(i, res);
}
for (Int_t i=0; i<fNMod[1]; i++) {
- res = (AliITSresponse*) respSDD->At(i);
+ res = (AliITSCalibration*) respSDD->At(i);
+ res->SetResponse((AliITSresponse*)pSDD);
Int_t iMod = i + fNMod[0];
SetCalibrationModel(iMod, res);
}
for (Int_t i=0; i<fNMod[2]; i++) {
- res = (AliITSresponse*) respSSD->At(i);
+ res = (AliITSCalibration*) respSSD->At(i);
+ res->SetResponse((AliITSresponse*)pSSD);
Int_t iMod = i + fNMod[0] + fNMod[1];
SetCalibrationModel(iMod, res);
}
//set defaults for standard cluster finder
- if(fGeom==0){
- Warning("SetDefaults","fGeom is 0!");
+ if(!GetITSgeom()){
+ Warning("SetDefaults","null pointer to AliITSgeom!");
return;
}
//Set defaults for cluster finder V2
- if(fGeom==0){
- Warning("SetDefaults","fGeom is 0!");
+ if(!GetITSgeom()){
+ Warning("SetDefaults","Null pointer to AliITSgeom !");
return;
}
//Creates branches for clusters and recpoints
Bool_t cR = (strstr(option,"R")!=0);
Bool_t cRF = (strstr(option,"RF")!=0);
- Bool_t v2 = (strstr(option,"v2")!=0);
if(cRF)cR = kFALSE;
if(cR) MakeBranchR(0);
if(cRF) MakeBranchRF(0);
- if(v2) MakeBranchR(0,"v2");
}
// only one branch for rec points for all detector types
Bool_t oFast= (strstr(opt,"Fast")!=0);
- Bool_t v2 = (strstr(opt,"v2")!=0);
Char_t detname[10] = "ITS";
if(oFast){
sprintf(branchname,"%sRecPointsF",detname);
- } else if(v2){
- sprintf(branchname,"Clusters");
} else {
sprintf(branchname,"%sRecPoints",detname);
}
- if(v2){
-
- if(!fClustersV2)fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
- if(fLoader->TreeR()){
- if(fClustersV2==0x0) fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
- MakeBranchInTree(fLoader->TreeR(),branchname,0,&fClustersV2,buffsz,99,file);
-
- }
- }else{
- if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
- if (fLoader->TreeR()) {
- if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
- 1000);
- MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
- } // end if
- }
+ if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+ if (fLoader->TreeR()) {
+ if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
+ 1000);
+ MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
+ } // end if
+
}
//______________________________________________________________________
if(!treeR) return;
if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
- TBranch *branch1;
- sprintf(branchname,"Clusters");
- branch1 = treeR->GetBranch(branchname);
- if(branch1){
- if(fClustersV2==0x0) fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
- branch1->SetAddress(&fClustersV2);
- }
- else{
- TBranch *branch;
- sprintf(branchname,"%sRecPoints",namedet);
+ 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);
- }else {
- sprintf(branchname,"%sRecPointsF",namedet);
- branch = treeR->GetBranch(branchname);
- if (branch) {
- branch->SetAddress(&fRecPoints);
- }
+ branch->SetAddress(&fRecPoints);
}
+
}
}
//____________________________________________________________________
TClonesArray &lrecp = *fRecPoints;
new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
}
-//______________________________________________________________________
-void AliITSDetTypeRec::AddClusterV2(const AliITSclusterV2 &r){
- // Add a reconstructed space point to the list
- // Inputs:
- // const AliITSClusterV2 &r class to be added to the tree
- // of reconstructed points TreeR.
- // Outputs:
- // none.
- // Return:
- // none.
-
- TClonesArray &lrecp = *fClustersV2;
- new(lrecp[fNClustersV2++]) AliITSclusterV2(r);
- }
//______________________________________________________________________
void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){
// be processed. If ="All" then all of the ITS
// sub detectors are processed.
- if(!fGeom){
- Warning("DigitsToRecPoints","fGeom is null!");
+ if(!GetITSgeom()){
+ Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
return;
}
if(!fLoader){
const char *all = strstr(opt,"All");
const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
strstr(opt,"SSD")};
- if(!v2) SetDefaultClusterFinders();
- else SetDefaultClusterFindersV2();
-
+ if(!v2) {
+ SetDefaultClusterFinders();
+ AliInfo("Original cluster finder has been selected\n");
+ }
+ else {
+ SetDefaultClusterFindersV2();
+ AliInfo("V2 cluster finder has been selected \n");
+ }
TTree *treeC=fLoader->TreeC();
if(!treeC){
}
AliITSClusterFinder *rec = 0;
Int_t id,module,first=0;
- for(module=0;module<fGeom->GetIndexMax();module++){
- id = fGeom->GetModuleType(module);
+ for(module=0;module<GetITSgeom()->GetIndexMax();module++){
+ id = GetITSgeom()->GetModuleType(module);
if (!all && !det[id]) continue;
- if(det[id]) first = fGeom->GetStartDet(id);
+ if(det[id]) first = GetITSgeom()->GetStartDet(id);
rec = (AliITSClusterFinder*)GetReconstructionModel(id);
TClonesArray *itsDigits = DigitsAddress(id);
if (!rec) {
} // end if
fLoader->TreeR()->Fill();
ResetRecPoints();
- ResetClustersV2();
treeC->Fill();
ResetClusters();
}
// none.
// Return:
// none.
- if(!fGeom){
- Warning("DigitsToRecPoints","fGeom is null!");
+ if(!GetITSgeom()){
+ Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
return;
}
if(!fLoader){
if(!fLoader->TreeR()) fLoader->MakeTree("R");
TTree* cTree = fLoader->TreeR();
- TClonesArray *array=new TClonesArray("AliITSclusterV2",1000);
- cTree->Branch("Clusters",&array);
+ TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
+ cTree->Branch("ITSRecPoints",&array);
delete array;
- TClonesArray** clusters = new TClonesArray*[fGeom->GetIndexMax()];
- for (Int_t iModule = 0; iModule < fGeom->GetIndexMax(); iModule++) {
+ TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
+ for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
clusters[iModule] = NULL;
}
for(id=0;id<3;id++){
rec->RawdataToClusters(rawReader,clusters);
}
Int_t nClusters =0;
- for(Int_t iModule=0;iModule<fGeom->GetIndexMax();iModule++){
+ for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
array = clusters[iModule];
if(!array){
Error("DigitsToRecPoints","data for module %d missing!",iModule);
- array = new TClonesArray("AliITSclusterV2");
+ array = new TClonesArray("AliITSRecPoint");
}
- cTree->SetBranchAddress("Clusters",&array);
+ cTree->SetBranchAddress("ITSRecPoints",&array);
cTree->Fill();
nClusters+=array->GetEntriesFast();
delete array;
fLoader->WriteRecPoints("OVERWRITE");
delete[] clusters;
- Info("DigitsToRecPoints", "total number of found clustersV2 in ITS: %d\n",
+ Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",
nClusters);
}