From: gconesab Date: Tue, 20 Apr 2010 13:18:39 +0000 (+0000) Subject: Move the initialization of bad map to setting of bad channels, add the name of the... X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=486258c9c4b4bf827a2af48473847a500954252f;p=u%2Fmrichter%2FAliRoot.git Move the initialization of bad map to setting of bad channels, add the name of the task to the reader data members --- diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx index ca95da947fe..c5bb8576260 100755 --- a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx +++ b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx @@ -127,6 +127,9 @@ void AliAnalysisTaskParticleCorrelation::Init() // to avoid problems when reading MC generator particles AliPDG::AddParticlesToPdgDataBase(); + //Set in the reader the name of the task in case is needed + (fAna->GetReader())->SetTaskName(GetName()); + // Initialise analysis fAna->Init(); diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.cxx b/PWG4/PartCorrBase/AliCaloTrackReader.cxx index 824d2cf2eec..5b38417a538 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackReader.cxx @@ -60,7 +60,8 @@ ClassImp(AliCaloTrackReader) fCleanOutputStdAOD(kFALSE), fDeltaAODFileName("deltaAODPartCorr.root"),fFiredTriggerClassName(""), fEMCALGeoName("EMCAL_COMPLETE"),fPHOSGeoName("PHOSgeo"), fEMCALGeo(0x0), fPHOSGeo(0x0), fEMCALGeoMatrixSet(kFALSE), fPHOSGeoMatrixSet(kFALSE), fAnaLED(kFALSE), - fRemoveBadChannels(kFALSE),fEMCALBadChannelMap(0),fPHOSBadChannelMap(0) + fRemoveBadChannels(kFALSE),fEMCALBadChannelMap(new TObjArray()), + fPHOSBadChannelMap(new TObjArray()), fTaskName("") { //Ctor @@ -99,7 +100,9 @@ AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) : fEMCALGeo(new AliEMCALGeoUtils(*g.fEMCALGeo)), fPHOSGeo(new AliPHOSGeoUtils(*g.fPHOSGeo)), fEMCALGeoMatrixSet(g.fEMCALGeoMatrixSet), fPHOSGeoMatrixSet(g.fPHOSGeoMatrixSet), fAnaLED(g.fAnaLED), fRemoveBadChannels(g.fRemoveBadChannels), - fEMCALBadChannelMap(),fPHOSBadChannelMap() + fEMCALBadChannelMap(new TObjArray(*g.fEMCALBadChannelMap)), + fPHOSBadChannelMap(new TObjArray(*g.fPHOSBadChannelMap)), + fTaskName(g.fTaskName) { // cpy ctor } @@ -219,8 +222,17 @@ AliCaloTrackReader::~AliCaloTrackReader() { if(fPHOSGeo) delete fPHOSGeo ; if(fEMCALGeo) delete fEMCALGeo ; - fEMCALBadChannelMap.Delete(); - fPHOSBadChannelMap. Delete(); + if(fEMCALBadChannelMap) { + fEMCALBadChannelMap->Clear(); + delete fEMCALBadChannelMap; + } + if(fPHOSBadChannelMap) { + fPHOSBadChannelMap->Clear(); + delete fPHOSBadChannelMap; + } + + //fEMCALBadChannelMap. Delete(); + //fPHOSBadChannelMap. Delete(); } @@ -231,6 +243,9 @@ Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_ if (!fRemoveBadChannels) return kFALSE; + if(calorimeter == "EMCAL" && !fEMCALBadChannelMap->GetEntries()) return kFALSE; + if(calorimeter == "PHOS" && !fPHOSBadChannelMap ->GetEntries()) return kFALSE; + printf("hello\n"); Int_t icol = -1; Int_t irow = -1; Int_t imod = -1; @@ -240,6 +255,7 @@ Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_ if(calorimeter == "EMCAL"){ Int_t iTower = -1, iIphi = -1, iIeta = -1; fEMCALGeo->GetCellIndex(cellList[iCell],imod,iTower,iIphi,iIeta); + if(fEMCALBadChannelMap->GetEntries() <= imod) continue; fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol); if(GetEMCALChannelStatus(imod, icol, irow))return kTRUE; } @@ -249,12 +265,13 @@ Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_ irow = relId[2]; icol = relId[3]; imod = relId[0]-1; + if(fPHOSBadChannelMap->GetEntries() <= imod)continue; if(GetPHOSChannelStatus(imod, icol, irow)) return kTRUE; } else return kFALSE; }// cell cluster loop - + printf("hello 2\n"); return kFALSE; } @@ -395,11 +412,14 @@ void AliCaloTrackReader::Init() } else printf("AliCaloTrackReader::Init() - Second input not added, reader is not AOD\n"); } + + //printf("TaskName in reader: %s\n",fTaskName.Data()); + fEMCALBadChannelMap->SetName(Form("EMCALBadMap_%s",fTaskName.Data())); + fPHOSBadChannelMap->SetName(Form("PHOSBadMap_%s",fTaskName.Data())); } //_______________________________________________________________ void AliCaloTrackReader::InitParameters() { - //Initialize the parameters of the analysis. fDataType = kESD ; fCTSPtMin = 0.2 ; @@ -437,27 +457,39 @@ void AliCaloTrackReader::InitParameters() fAnaLED = kFALSE; fRemoveBadChannels = kFALSE; - +} + +//________________________________________________________________ +void AliCaloTrackReader::InitEMCALBadChannelStatusMap(){ + //Init EMCAL bad channels map + if(fDebug > 0 )printf("AliCaloTrackReader::InitEMCALBadChannelStatusMap()\n"); //In order to avoid rewriting the same histograms Bool_t oldStatus = TH1::AddDirectoryStatus(); TH1::AddDirectory(kFALSE); - - for (int i = 0; i < 12; i++) - fEMCALBadChannelMap.Add(new TH2I(Form("EMCALBadChannelMap_SM%d",i),Form("EMCALBadChannelMap_SM%d",i), - 48, 0, 48, 24, 0, 24)); - - for (int i = 0; i < 5; i++) - fPHOSBadChannelMap.Add(new TH2I(Form("PHOSBadChannelMap_Mod%d",i),Form("PHOSBadChannelMap_Mod%d",i), - 56, 0, 56, 64, 0, 64)); - - fEMCALBadChannelMap.SetOwner(kTRUE); - fPHOSBadChannelMap. SetOwner(kTRUE); - fEMCALBadChannelMap.Compress(); - fPHOSBadChannelMap. Compress(); - + + for (int i = 0; i < 12; i++) fEMCALBadChannelMap->Add(new TH2I(Form("EMCALBadChannelMap_SM%d_%s",i,fTaskName.Data()),Form("EMCALBadChannelMap_SM%d",i), 48, 0, 48, 24, 0, 24)); + + fEMCALBadChannelMap->SetOwner(kTRUE); + fEMCALBadChannelMap->Compress(); + //In order to avoid rewriting the same histograms - TH1::AddDirectory(oldStatus); - + TH1::AddDirectory(oldStatus); +} + +//________________________________________________________________ +void AliCaloTrackReader::InitPHOSBadChannelStatusMap(){ + //Init PHOS bad channels map + if(fDebug > 0 )printf("AliCaloTrackReader::InitPHOSBadChannelStatusMap()\n"); + //In order to avoid rewriting the same histograms + Bool_t oldStatus = TH1::AddDirectoryStatus(); + TH1::AddDirectory(kFALSE); + for (int i = 0; i < 5; i++)fPHOSBadChannelMap->Add(new TH2I(Form("PHOSBadChannelMap_Mod%d_%s",i,fTaskName.Data()),Form("PHOSBadChannelMap_Mod%d",i), 56, 0, 56, 64, 0, 64)); + + fPHOSBadChannelMap->SetOwner(kTRUE); + fPHOSBadChannelMap->Compress(); + + //In order to avoid rewriting the same histograms + TH1::AddDirectory(oldStatus); } //________________________________________________________________ @@ -489,6 +521,7 @@ void AliCaloTrackReader::Print(const Option_t * opt) const return; printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + printf("Task name : %s\n", fTaskName.Data()) ; printf("Data type : %d\n", fDataType) ; printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; @@ -510,7 +543,7 @@ void AliCaloTrackReader::Print(const Option_t * opt) const printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ; printf("Clean std AOD = %d\n", fCleanOutputStdAOD) ; printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ; - printf("Rremove Clusters with bad channels? %d\n",fRemoveBadChannels); + printf("Remove Clusters with bad channels? %d\n",fRemoveBadChannels); printf(" \n") ; } diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.h b/PWG4/PartCorrBase/AliCaloTrackReader.h index 6d1cf6f3f03..3c36683b737 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.h +++ b/PWG4/PartCorrBase/AliCaloTrackReader.h @@ -203,20 +203,36 @@ public: void SwitchOnBadChannelsRemoval() {fRemoveBadChannels = kTRUE ; } void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; } - Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { return (Int_t) ((TH2I*)fEMCALBadChannelMap[iSM])->GetBinContent(iCol,iRow);} - Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const { return (Int_t) ((TH2I*)fPHOSBadChannelMap[imod])->GetBinContent(iCol,iRow);} - - void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { ((TH2I*)fEMCALBadChannelMap[iSM])->SetBinContent(iCol,iRow,c);} - void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) { ((TH2I*)fPHOSBadChannelMap[imod])->SetBinContent(iCol,iRow,c);} - - TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap[iSM];} - TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap[imod];} + void InitEMCALBadChannelStatusMap() ; + void InitPHOSBadChannelStatusMap () ; + + Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { + if(fEMCALBadChannelMap->GetEntries()>0) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow); + else return -1;} - void SetEMCALChannelStatusMap(TObjArray map) {fEMCALBadChannelMap = map;} - void SetPHOSChannelStatusMap (TObjArray map) {fPHOSBadChannelMap = map;} + Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const { + if(fPHOSBadChannelMap->GetEntries()>0)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow); + else return -1;} + + void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { + if(!fEMCALBadChannelMap->GetEntries())InitEMCALBadChannelStatusMap() ; + ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);} + + void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) { + if(!fPHOSBadChannelMap->GetEntries()) InitPHOSBadChannelStatusMap() ; + ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);} + + TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);} + TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);} + + void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;} + void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap = map;} Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells); + TString GetTaskName() const {return fTaskName;} + void SetTaskName(TString name) {fTaskName = name;} + protected: Int_t fEventNumber; // Event number TString fCurrentFileName; // Current file name under analysis @@ -272,10 +288,11 @@ public: Bool_t fPHOSGeoMatrixSet ; // Check if the transformation matrix is set for PHOS Bool_t fAnaLED; // Analyze LED data only. Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels - TObjArray fEMCALBadChannelMap; //! Array of histograms with map of bad channels, EMCAL - TObjArray fPHOSBadChannelMap; //! Array of histograms with map of bad channels, PHOS + TObjArray *fEMCALBadChannelMap; //! Array of histograms with map of bad channels, EMCAL + TObjArray *fPHOSBadChannelMap; //! Array of histograms with map of bad channels, PHOS + TString fTaskName; // Name of task that executes the analysis - ClassDef(AliCaloTrackReader,12) + ClassDef(AliCaloTrackReader,13) } ;