* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
+ * 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 *
#include "TObjArray.h"
#include "TTree.h"
-#include "AliITSresponseSDD.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 "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;
//________________________________________________________________
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
- // Default Constructor
+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:
- // A properly zero-ed AliITSDetTypeRec class.
+ //
- 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;
+ }
+ fSSDCalibration=new AliITSCalibrationSSD();
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;
fNctype[i]=0;
}
- SelectVertexer(" ");
- fLoader = 0;
-
- fNMod[0] = fgkDefaultNModulesSPD;
- fNMod[1] = fgkDefaultNModulesSDD;
- fNMod[2] = fgkDefaultNModulesSSD;
-
- SetRunNumber();
+ SelectVertexer(" ");
}
+
//______________________________________________________________________
-AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec &/*rec*/):TObject(/*rec*/){
- // Copy constructor.
+AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec),
+fNMod(rec.fNMod),
+fITSgeom(rec.fITSgeom),
+fReconstruction(rec.fReconstruction),
+fSegmentation(rec.fSegmentation),
+fCalibration(rec.fCalibration),
+fSSDCalibration(rec.fSSDCalibration),
+fSPDDead(rec.fSPDDead),
+fPreProcess(rec.fPreProcess),
+fPostProcess(rec.fPostProcess),
+fDigits(rec.fDigits),
+fDDLMapSDD(rec.fDDLMapSDD),
+fRespSDD(rec.fRespSDD),
+fNdtype(rec.fNdtype),
+fCtype(rec.fCtype),
+fNctype(rec.fNctype),
+fRecPoints(rec.fRecPoints),
+fNRecPoints(rec.fNRecPoints),
+fSelectedVertexer(rec.fSelectedVertexer),
+fFirstcall(rec.fFirstcall)
+{
+
+ // Copy constructor.
- Error("Copy constructor","Copy constructor not allowed");
-
}
//______________________________________________________________________
-AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& /*source*/){
- // Assignment operator. This is a function which is not allowed to be
- // done.
- Error("operator=","Assignment operator not allowed\n");
- return *this;
+AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
+ // Assignment operator.
+ this->~AliITSDetTypeRec();
+ new(this) AliITSDetTypeRec(source);
+ return *this;
+
}
//_____________________________________________________________________
AliITSDetTypeRec::~AliITSDetTypeRec(){
-
//Destructor
-
+
if(fReconstruction){
fReconstruction->Delete();
delete fReconstruction;
fSegmentation = 0;
}
if(fCalibration){
- AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSPD()))->GetResponse();
- AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSDD()))->GetResponse();
- AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSSD()))->GetResponse();
- if(rspd) delete rspd;
- if(rsdd) delete rsdd;
- if(rssd) delete rssd;
- fCalibration->Delete();
- delete fCalibration;
- fCalibration = 0;
- }
- if(fGeom) delete fGeom;
+ 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;
delete fRecPoints;
fRecPoints=0;
}
- if(fClustersV2){
- fClustersV2->Delete();
- delete fClustersV2;
- fClustersV2=0;
- }
if(fCtype) {
fCtype->Delete();
delete fCtype;
}
delete [] fNctype;
delete [] fNdtype;
- if(fLoader) delete fLoader;
+ delete [] fNMod;
+ if (fITSgeom) delete fITSgeom;
+
}
+
//___________________________________________________________________
void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
//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();
}
}
//_______________________________________________________________________
+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
return 0;
}
- return (AliITSCalibration*)fCalibration->At(iMod);
+ if(iMod<fgkDefaultNModulesSPD+fgkDefaultNModulesSDD){
+ return (AliITSCalibration*)fCalibration->At(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;
+ }
-//______________________________________________________________________
-void AliITSDetTypeRec::SetTreeAddress(){
- // Set branch address for the Trees.
-
- TTree *treeR = fLoader->TreeR();
- TTree *treeD = fLoader->TreeD();
-
- SetTreeAddressD(treeD);
- SetTreeAddressR(treeR);
+ return (AliITSCalibration*)fSPDDead->At(iMod);
}
+
//______________________________________________________________________
void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
// Set branch address for the tree of digits.
TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
const char *classname,
void* address,Int_t size,
- Int_t splitlevel, const char */*file*/)
+ Int_t splitlevel)
{
//
// Makes branch in given tree and diverts them to a separate file
//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();
SetSegmentationModel(dettype,seg);
SetDigitClassName(dettype,"AliITSdigitSPD");
SetClusterClassName(dettype,"AliITSRawClusterSPD");
}
if(dettype==1){
- AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(fGeom->GetStartSDD());
- seg = new AliITSsegmentationSDD(fGeom,res);
+ seg = new AliITSsegmentationSDD();
SetSegmentationModel(dettype,seg);
- const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
- if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
- else SetDigitClassName(dettype,"AliITSdigitSDD");
+ SetDigitClassName(dettype,"AliITSdigitSDD");
SetClusterClassName(dettype,"AliITSRawClusterSDD");
-
}
if(dettype==2){
- AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(fGeom);
- 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.
+ AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD();
SetSegmentationModel(dettype,seg2);
SetDigitClassName(dettype,"AliITSdigitSSD");
SetClusterClassName(dettype,"AliITSRawClusterSSD");
Bool_t AliITSDetTypeRec::GetCalibration() {
// Get Default calibration if a storage is not defined.
+ if(!fFirstcall){
+ AliITSCalibration* cal = GetCalibrationModel(0);
+ if(cal)return kTRUE;
+ }
+ else {
+ fFirstcall = kFALSE;
+ }
- 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);
+ // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
+ // 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");
- TObjArray *respSPD = (TObjArray *)entrySPD->GetObject();
- entrySPD->SetObject(NULL);
+ // 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");
+ // Entry for the AliITSRecoParam object
+ AliCDBEntry *entryRP = AliCDBManager::Instance()->Get("ITS/Calib/RecoParam/");
+ 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();
- entry2SPD->SetObject(NULL);
+ if(!cacheStatus)entry2SPD->SetObject(NULL);
entry2SPD->SetOwner(kTRUE);
- TObjArray *respSDD = (TObjArray *)entrySDD->GetObject();
- entrySDD->SetObject(NULL);
+ TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
+ if(!cacheStatus)entrySDD->SetObject(NULL);
entrySDD->SetOwner(kTRUE);
AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
- entry2SDD->SetObject(NULL);
+ if(!cacheStatus)entry2SDD->SetObject(NULL);
entry2SDD->SetOwner(kTRUE);
- TObjArray *respSSD = (TObjArray *)entrySSD->GetObject();
- entrySSD->SetObject(NULL);
- entrySSD->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();
- entry2SSD->SetObject(NULL);
+ if(!cacheStatus)entry2SSD->SetObject(NULL);
entry2SSD->SetOwner(kTRUE);
- // DB entries are dleted. In this waymetadeta objects are deleted as well
- delete entrySPD;
- delete entrySDD;
- delete entrySSD;
- delete entry2SPD;
- delete entry2SDD;
- delete entry2SSD;
-
-
- if ((!pSPD)||(!pSDD)||(!pSSD) || (!respSPD) || (!respSDD) || (!respSSD)) {
+ if(!AliITSReconstructor::GetRecoParam()){
+ if(!entryRP) AliFatal("Calibration object (RecoParam) retrieval from OCDB failed! Hint: as an alternative you can set it in your reconstruction macro ");
+ AliITSRecoParam *rp = (AliITSRecoParam*)entryRP->GetObject();
+ if(!cacheStatus)entryRP->SetObject(NULL);
+ entryRP->SetOwner(kTRUE);
+ AliITSReconstructor::SetRecoParam(rp);
+ }
+ else {
+ AliWarning("AliITSRecoParam object has been already set in AliITSReconstructor. The OCDB instance will not be used\n");
+ }
+
+
+ // 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] = respSPD->GetEntries();
- fNMod[1] = respSDD->GetEntries();
- fNMod[2] = respSSD->GetEntries();
+ 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* res;
+ AliITSCalibration* cal;
for (Int_t i=0; i<fNMod[0]; i++) {
- res = (AliITSCalibration*) respSPD->At(i);
- res->SetResponse((AliITSresponse*)pSPD);
- SetCalibrationModel(i, res);
- }
- for (Int_t i=0; i<fNMod[1]; i++) {
- res = (AliITSCalibration*) respSDD->At(i);
- res->SetResponse((AliITSresponse*)pSDD);
- Int_t iMod = i + fNMod[0];
- SetCalibrationModel(iMod, res);
- }
+ cal = (AliITSCalibration*) calSPD->At(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; iddl<AliITSDDLModuleMapSDD::GetNDDLs(); iddl++){
+ for(Int_t icar=0; icar<AliITSDDLModuleMapSDD::GetNModPerDDL();icar++){
+ Int_t iMod=fDDLMapSDD->GetModuleNumber(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; i<fNMod[2]; i++) {
- res = (AliITSCalibration*) respSSD->At(i);
- res->SetResponse((AliITSresponse*)pSSD);
- Int_t iMod = i + fNMod[0] + fNMod[1];
- SetCalibrationModel(iMod, res);
+
+ AliITSCalibrationSSD *calibSSD = new AliITSCalibrationSSD();
+ calibSSD->SetResponse((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;
}
//set defaults for standard cluster finder
- if(fGeom==0){
- Warning("SetDefaults","fGeom is 0!");
+ if(!GetITSgeom()){
+ Warning("SetDefaults","null pointer to AliITSgeom!");
return;
}
AliITSClusterFinder *clf;
- MakeTreeC();
-
- for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
+ for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
//SPD
if(dettype==0){
if(!GetReconstructionModel(dettype)){
//Set defaults for cluster finder V2
- if(fGeom==0){
- Warning("SetDefaults","fGeom is 0!");
+ if(!GetITSgeom()){
+ Warning("SetDefaults","Null pointer to AliITSgeom !");
return;
}
AliITSClusterFinder *clf;
- MakeTreeC();
for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
//SPD
if(dettype==0){
}
//______________________________________________________________________
-void AliITSDetTypeRec::MakeBranch(Option_t* option){
+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);
- Bool_t v2 = (strstr(option,"v2")!=0);
if(cRF)cR = kFALSE;
- if(cR) MakeBranchR(0);
- if(cRF) MakeBranchRF(0);
- if(v2) MakeBranchR(0,"v2");
-
-}
-
-//_____________________________________________________________
-void AliITSDetTypeRec::MakeTreeC(){
-
- //Create a separate tree to store the clusters
- if(!fLoader){
- Warning("MakeTreeC","ITS loader is null!");
- return;
- }
- if(fLoader->TreeC()== 0x0) fLoader->MakeTree("C");
- MakeBranchC();
-}
-
-//______________________________________________________________
-void AliITSDetTypeRec::MakeBranchC(){
-
- //Make branches in the tree of clusters
-
- if(!fLoader){
- Warning("MakeBranchC","ITS loader is null!");
- return;
- }
- TTree* lTC = fLoader->TreeC();
- if(lTC==0x0){
- Error("MakeTreeC","Can not get TreeC from loader");
- return;
- }
-
- Int_t buffersize = 4000;
- Char_t branchname[30];
- Char_t* cluclass;
- const char *det[4]={"SPD","SDD","SSD","ITS"};
-
- for(Int_t i=0;i<fgkNdettypes;i++){
- cluclass = GetClusterClassName(i);
- if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
- if(!ClustersAddress(i)){
- fCtype->AddAt(new TClonesArray(cluclass,1000),i);
- }
- if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
- else sprintf(branchname,"%sClusters%d",det[3],i+1);
- if(fCtype && lTC){
- if(lTC->GetBranch(branchname)){
- Warning("MakeBranchC","Branch %s already exists in TreeC",branchname);
- } else{
- Info("MakeBranchC","Creating branch %s in TreeC",branchname);
- lTC->Branch(branchname,&((*fCtype)[i]),buffersize);
- }
- }
-
- }
-
-}
-
-//_______________________________________________________________
-void AliITSDetTypeRec::GetTreeC(Int_t event){
-
- //Get the clusters tree for this event and
- //sets the branch address
-
-
- if(!fLoader){
- Warning("GetTreeC","ITS loader is null!");
- return;
- }
-
- Char_t branchname[30];
- const char *det[4] = {"SPD","SDD","SSD","ITS"};
- TTree* lTC = fLoader->TreeC();
-
- ResetClusters();
- if(lTC) fLoader->CleanRawClusters();
-
- TBranch* branch;
- if(lTC){
- Char_t* cluclass;
- for(Int_t i=0;i<fgkNdettypes;i++){
- cluclass = GetClusterClassName(i);
- if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
- if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(cluclass,1000),i);
- if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
- else sprintf(branchname,"%sClusters%d",det[3],i+1);
- if(fCtype){
- branch = lTC->GetBranch(branchname);
- if(branch) branch->SetAddress(&((*fCtype)[i]));
- }
- }
- } else{
- Error("GetTreeC","cannot find clusters Tree for vent %d",event);
- }
+ if(cR) MakeBranchR(tree);
+ if(cRF) MakeBranchRF(tree);
}
if (fNctype) fNctype[i]=0;
}
//__________________________________________________________________
-void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){
+void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){
//Creates tree branches for recpoints
// Inputs:
// to. If blank it write the SDigits to the same
// file in which the Hits were found.
- if(!fLoader){
- Warning("MakeBranchR","ITS loader is null!");
- return;
- }
-
Int_t buffsz = 4000;
char branchname[30];
// 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 (treeR)
+ MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99);
}
//______________________________________________________________________
void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
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){
+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:
- // Int_t evNumber Event number to be processed.
+ // 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.
- if(!fGeom){
- Warning("DigitsToRecPoints","fGeom is null!");
- return;
- }
- if(!fLoader){
- Warning("DigitsToRecPoints","ITS loader is null!");
- return;
- }
-
const char *all = strstr(opt,"All");
const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
strstr(opt,"SSD")};
- if(!v2) SetDefaultClusterFinders();
- else SetDefaultClusterFindersV2();
-
-
- TTree *treeC=fLoader->TreeC();
- if(!treeC){
- MakeTreeC();
- MakeBranchC();
+ 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;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) {
- Error("DigitsToRecPoints",
- "The reconstruction class was not instanciated! event=%d",
- evNumber);
- exit(1);
- }
- ResetDigits();
- TTree *lTD = fLoader->TreeD();
+ if (!rec)
+ AliFatal("The reconstruction class was not instanciated!");
+ ResetDigits(); // MvL: Not sure we neeed this when rereading anyways
if (all) {
- lTD->GetEvent(lastentry+module);
+ treeD->GetEvent(lastentry+module);
}else {
- lTD->GetEvent(lastentry+(module-first));
+ 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->SetClusters(ClustersAddress(id));
rec->FindRawClusters(module);
} // end if
- fLoader->TreeR()->Fill();
+ treeR->Fill();
ResetRecPoints();
- ResetClustersV2();
- treeC->Fill();
ResetClusters();
}
-
- fLoader->WriteRecPoints("OVERWRITE");
- fLoader->WriteRawClusters("OVERWRITE");
}
//______________________________________________________________________
-void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
+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:
- // Int_t evNumber Event number to be processed.
- // 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.
+ // AliRawReader *rawReader Pointer to the raw-data reader
+ // TTree *treeR Clusters tree
// Outputs:
// none.
// Return:
// none.
- if(!fGeom){
- Warning("DigitsToRecPoints","fGeom is null!");
- return;
- }
- if(!fLoader){
- Warning("DigitsToRecPoints","ITS loader is null!");
- return;
- }
-
-
+ 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;
- 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);
+ TBranch *branch = treeR->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++){
+ if (!all && !det[id]) continue;
rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
+ if (!rec)
+ AliFatal("The reconstruction class was not instanciated");
rec->SetDetTypeRec(this);
- if (!rec) {
- Error("DigitsToRecPoints",
- "The reconstruction class was not instanciated");
- exit(1);
- }
rec->RawdataToClusters(rawReader,clusters);
}
Int_t nClusters =0;
- for(Int_t iModule=0;iModule<fGeom->GetIndexMax();iModule++){
+ TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
+ for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
+ id = GetITSgeom()->GetModuleType(iModule);
+ if (!all && !det[id]) continue;
array = clusters[iModule];
if(!array){
- Error("DigitsToRecPoints","data for module %d missing!",iModule);
- array = new TClonesArray("AliITSclusterV2");
+ AliDebug(1,Form("data for module %d missing!",iModule));
+ array = emptyArray;
}
- cTree->SetBranchAddress("Clusters",&array);
- cTree->Fill();
+ branch->SetAddress(&array);
+ treeR->Fill();
nClusters+=array->GetEntriesFast();
- delete array;
+
+ if (array != emptyArray) {
+ array->Delete();
+ delete array;
+ }
}
- fLoader->WriteRecPoints("OVERWRITE");
+ delete emptyArray;
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);
}