#include "AliITSDetTypeRec.h"
#include "AliITSDDLModuleMapSDD.h"
#include "AliITSRecPoint.h"
+#include "AliITSRecPointContainer.h"
#include "AliITSCalibrationSDD.h"
#include "AliITSMapSDD.h"
#include "AliITSCalibrationSSD.h"
fFastOrFiredMap(rec.fFastOrFiredMap){
// Copy constructor.
-
+ for(Int_t i=0; i<3; i++){
+ fkDigClassName[i]=rec.fkDigClassName[i]; // NB only copies Char_t*, so not so safe, but this code should never be reached anyways
+ }
}
//______________________________________________________________________
AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
if(fDDLMapSDD) delete fDDLMapSDD;
}
}
- if(fSSDCalibration) delete fSSDCalibration;
+ if(fSSDCalibration){
+ if(!(AliCDBManager::Instance()->GetCacheFlag())) {
+ delete fSSDCalibration;
+ fSSDCalibration = NULL;
+ }
+ }
if(fSPDDead){
if(!(AliCDBManager::Instance()->GetCacheFlag())) {
fSPDDead->Delete();
SetSegmentationModel(dettype,seg);
SetDigitClassName(dettype,"AliITSdigitSPD");
}
- if(fLoadOnlySPDCalib==kFALSE){
- if(dettype==1){
- seg = new AliITSsegmentationSDD();
+ if(dettype==1){
+ seg = new AliITSsegmentationSDD();
+ if(fLoadOnlySPDCalib==kFALSE){
AliITSCalibrationSDD* cal=(AliITSCalibrationSDD*)GetCalibrationModel(fgkDefaultNModulesSPD+1);
if(cal->IsAMAt20MHz()){
seg->SetPadSize(seg->Dpz(0),20.);
seg->SetNPads(seg->Npz()/2,128);
}
- SetSegmentationModel(dettype,seg);
- SetDigitClassName(dettype,"AliITSdigitSDD");
}
+ SetSegmentationModel(dettype,seg);
+ SetDigitClassName(dettype,"AliITSdigitSDD");
}
if(dettype==2){
AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD();
AliCDBEntry *noisySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDNoisy");
AliCDBEntry *deadSPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead");
- AliCDBEntry *pitCond = AliCDBManager::Instance()->Get("ITS/Calib/PITConditions");
+ AliCDBEntry *pitCond = AliCDBManager::Instance()->Get("TRIGGER/SPD/PITConditions");
if(!noisySPD || !deadSPD || !pitCond ){
AliFatal("SPD Calibration object retrieval failed! ");
return kFALSE;
}
TObject *emptyssd = 0; TString ssdobjectname;
- AliITSNoiseSSDv2 *noiseSSD = new AliITSNoiseSSDv2();
+ AliITSNoiseSSDv2 *noiseSSD = NULL;
emptyssd = (TObject *)entryNoiseSSD->GetObject();
ssdobjectname = emptyssd->GetName();
if(ssdobjectname=="TObjArray") {
TObjArray *noiseSSDOld = (TObjArray *)entryNoiseSSD->GetObject();
+ noiseSSD = new AliITSNoiseSSDv2();
ReadOldSSDNoise(noiseSSDOld, noiseSSD);
}
else if(ssdobjectname=="AliITSNoiseSSDv2")
if(!cacheStatus)entryNoiseSSD->SetObject(NULL);
entryNoiseSSD->SetOwner(kTRUE);
- AliITSGainSSDv2 *gainSSD = new AliITSGainSSDv2();
+ AliITSGainSSDv2 *gainSSD = NULL;;
emptyssd = (TObject *)entryGainSSD->GetObject();
ssdobjectname = emptyssd->GetName();
if(ssdobjectname=="Gain") {
TObjArray *gainSSDOld = (TObjArray *)entryGainSSD->GetObject();
+ gainSSD = new AliITSGainSSDv2();
ReadOldSSDGain(gainSSDOld, gainSSD);
}
else if(ssdobjectname=="AliITSGainSSDv2")
if(!cacheStatus)entryGainSSD->SetObject(NULL);
entryGainSSD->SetOwner(kTRUE);
- AliITSBadChannelsSSDv2 *badChannelsSSD = new AliITSBadChannelsSSDv2();
+ AliITSBadChannelsSSDv2 *badChannelsSSD = NULL;
emptyssd = (TObject *)entryBadChannelsSSD->GetObject();
ssdobjectname = emptyssd->GetName();
if(ssdobjectname=="TObjArray") {
TObjArray *badChannelsSSDOld = (TObjArray *)entryBadChannelsSSD->GetObject();
+ badChannelsSSD = new AliITSBadChannelsSSDv2();
ReadOldSSDBadChannels(badChannelsSSDOld, badChannelsSSD);
}
else if(ssdobjectname=="AliITSBadChannelsSSDv2")
strstr(opt,"SSD")};
if(optCluFind==0){
SetDefaultClusterFindersV2();
- AliInfo("V2 cluster finder has been selected \n");
+ AliDebug(1,"V2 cluster finder has been selected \n");
}else{
SetDefaultClusterFindersV2();
AliInfo("Cluster Finder Option not implemented, V2 cluster finder will be used \n");
// Remove PIT in-active chips from Fast-OR fired map
if (all || det[0]) { // SPD present
RemoveFastOrFiredInActive();
+ // here removing bits which have no associated clusters
+ RemoveFastOrFiredFromDead(GetFiredChipMap(treeR));
}
+
+ AliITSRecPointContainer* rpcont = AliITSRecPointContainer::Instance();
+ Int_t nClu[6];
+ nClu[0]=rpcont->GetNClustersInLayer(1,treeR);
+ for(Int_t iLay=2; iLay<=6; iLay++) nClu[iLay-1]=rpcont->GetNClustersInLayerFast(iLay);
+ AliInfo(Form("Number of RecPoints in ITS Layers = %d %d %d %d %d %d",
+ nClu[0],nClu[1],nClu[2],nClu[3],nClu[4],nClu[5]));
}
//______________________________________________________________________
void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){
strstr(opt,"SSD")};
Int_t id=0;
-
- TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
+ AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
+ rpc->FullReset();
+ TClonesArray* array = rpc->UncheckedGetClusters(0);
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;
- }
-
- DigitsToRecPoints(rawReader,clusters,opt);
+ DigitsToRecPoints(rawReader,opt);
Int_t nClusters =0;
- 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];
+ array = rpc->UncheckedGetClusters(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);
-
+ rpc->FullReset();
+
+ AliITSRecPointContainer* rpcont = AliITSRecPointContainer::Instance();
+ Int_t nClu[6];
+ nClu[0]=rpcont->GetNClustersInLayer(1,treeR);
+ for(Int_t iLay=2; iLay<=6; iLay++) nClu[iLay-1]=rpcont->GetNClustersInLayerFast(iLay);
+ AliInfo(Form("Number of RecPoints in ITS Layers = %d %d %d %d %d %d, Total = %d",
+ nClu[0],nClu[1],nClu[2],nClu[3],nClu[4],nClu[5],nClusters));
}
//______________________________________________________________________
-void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TClonesArray** clusters,Option_t *opt){
+void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,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
- // TClonesArray **clusters Clusters Array
// Outputs:
// none.
// Return:
if (!rec)
AliFatal("The reconstruction class was not instantiated");
rec->SetDetTypeRec(this);
- rec->RawdataToClusters(rawReader,clusters);
+ rec->RawdataToClusters(rawReader);
}
// Remove PIT in-active chips from Fast-OR fired map
if (all || det[0]) { // SPD present
RemoveFastOrFiredInActive();
+ // here removing bits which have no associated clusters
+ RemoveFastOrFiredFromDead(GetFiredChipMap());
+
}
}
//______________________________________________________________________
//______________________________________________________________________
void AliITSDetTypeRec::RemoveFastOrFiredInActive() {
// Removes the chips that were in-active in the pixel trigger (from fast-or fired map)
+
if (fTriggerConditions==NULL) {
AliError("Pixel trigger conditions are missing.");
return;
}
}
//______________________________________________________________________
+TBits AliITSDetTypeRec::GetFiredChipMap() const {
+
+ //
+ // TBits of the fired chips
+ //
+
+ AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
+
+ TBits isfiredchip(1200);
+
+ AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)GetSegmentationModel(0);
+ if(!segSPD) {
+ AliError("no segmentation model for SPD available, the fired chip map is empty. Exiting");
+ return isfiredchip;
+ }
+
+
+ for(Int_t imod =0; imod < fgkDefaultNModulesSPD; imod++){
+ TClonesArray *array = rpc->UncheckedGetClusters(imod);
+ if(!array) continue;
+ Int_t nCluster = array->GetEntriesFast();
+
+ while(nCluster--) {
+ AliITSRecPoint* cluster = (AliITSRecPoint*)array->UncheckedAt(nCluster);
+ if (cluster->GetLayer()>1)continue;
+ Float_t local[3]={-1,-1};
+ local[1]=cluster->GetDetLocalX();
+ local[0]=cluster->GetDetLocalZ();
+
+ Int_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(imod);
+ Int_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(imod);
+ Int_t row, col;
+ segSPD->LocalToDet(0.5,local[0],row,col);
+ Int_t chip = AliITSRawStreamSPD::GetOnlineChipFromOffline(imod,col);
+ Int_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
+ isfiredchip.SetBitNumber(chipkey,kTRUE);
+ }
+
+ }
+
+ return isfiredchip;
+
+}
+//______________________________________________________________________
+TBits AliITSDetTypeRec::GetFiredChipMap(TTree *treeR) const{
+ //
+ // TBits of the fired chips
+ //
+ TBits isfiredchip(1200);
+
+ if(!treeR) {
+ AliError("no treeR. fired chip map stays empty. Exiting.");
+ return isfiredchip;
+ }
+
+ AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
+ TClonesArray *recpoints = rpcont->FetchClusters(0,treeR);
+ if(!rpcont->GetStatusOK() || !rpcont->IsSPDActive()){
+ AliError("no clusters. fired chip map stays empty. Exiting.");
+ return isfiredchip;
+ }
+
+ AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)GetSegmentationModel(0);
+
+ for(Int_t imod =0; imod < fgkDefaultNModulesSPD; imod++){
+ recpoints = rpcont->UncheckedGetClusters(imod);
+ Int_t nCluster = recpoints->GetEntriesFast();
+
+ // loop over clusters
+ while(nCluster--) {
+ AliITSRecPoint* cluster = (AliITSRecPoint*)recpoints->UncheckedAt(nCluster);
+ if (cluster->GetLayer()>1)continue;
+ Float_t local[3]={-1,-1};
+ local[1]=cluster->GetDetLocalX();
+ local[0]=cluster->GetDetLocalZ();
+
+ Int_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(imod);
+ Int_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(imod);
+ Int_t row, col;
+ segSPD->LocalToDet(0.5,local[0],row,col);
+ Int_t chip = AliITSRawStreamSPD::GetOnlineChipFromOffline(imod,col);
+ Int_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
+ isfiredchip.SetBitNumber(chipkey,kTRUE);
+ }
+ }
+
+ return isfiredchip;
+}
+//______________________________________________________________________
+void AliITSDetTypeRec::RemoveFastOrFiredFromDead(TBits firedchipmap){
+ //
+ // resetting of the fast-or bit on cluster basis.
+ // fast-or bits can be remnant from SPD ideal simulation (no dead channels)
+ //
+
+ for(Int_t chipKey=0; chipKey<1200; chipKey++){
+ // FO masked chips have been previously removed
+ if(!fFastOrFiredMap.TestBitNumber(chipKey)) continue;
+ if(!firedchipmap.TestBitNumber(chipKey)) {
+ fFastOrFiredMap.SetBitNumber(chipKey,kFALSE);
+ AliDebug(2,Form("removing bit in key %i \n ",chipKey));
+ }
+ }
+
+}
+//______________________________________________________________________
void AliITSDetTypeRec::SetFastOrFiredMapOnline(UInt_t eq, UInt_t hs, UInt_t chip) {
// Set fast-or fired map for this chip
Int_t chipKey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
return SetFastOrFiredMap(chipKey);
}
-