]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Move GetModuleNumberXXX methods from QA analysis to a common place for other analysis...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 30 Apr 2010 16:50:07 +0000 (16:50 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 30 Apr 2010 16:50:07 +0000 (16:50 +0000)
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h
PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
PWG4/PartCorrBase/AliCaloTrackAODReader.h
PWG4/PartCorrBase/AliCaloTrackESDReader.cxx
PWG4/PartCorrBase/AliCaloTrackESDReader.h
PWG4/PartCorrBase/AliCaloTrackReader.cxx
PWG4/PartCorrBase/AliCaloTrackReader.h
PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx
PWG4/PartCorrDep/AliAnaCalorimeterQA.h

index e149953931e5be4905891dcc1d606d3043b52ca9..3df83f8ddb72b50591b2d57d1511e23025fac3c3 100755 (executable)
@@ -17,9 +17,12 @@ class TObjArray ;
 #include <TObject.h>
 
 //Analysis
+class AliESDCaloCluster;
 class AliAODCaloCluster;
 class AliAODCaloCells;
-class AliCaloTrackReader ;   
+#include "AliCaloTrackReader.h"   
+#include "AliCaloTrackESDReader.h" 
+#include "AliCaloTrackAODReader.h" 
 class AliCaloPID ;
 class AliFiducialCut ;
 class AliIsolationCut ;
@@ -70,6 +73,14 @@ public:
   virtual AliCaloTrackReader * GetReader() const {return fReader ; }
   virtual void SetReader(AliCaloTrackReader * const reader) { fReader = reader ; }
   
+  //Calorimeter indexes information
+  Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const {
+         return fReader->GetModuleNumberCellIndexes(absId, calo, icol, irow,iRCU);}
+  Int_t GetModuleNumber(AliESDCaloCluster * cluster) const {
+         return ((AliCaloTrackESDReader*)fReader)->GetModuleNumber(cluster);}
+  Int_t GetModuleNumber(AliAODCaloCluster * cluster) const {
+         return ((AliCaloTrackAODReader*)fReader)->GetModuleNumber(cluster);}
+       
   virtual void Terminate(TList * /*outputList*/) {;}
        
   //analysis AOD branch
index 9d45e5312d55594e89ccf45b1c2b7ce432991452..91f9630579cd2d710a10f7024d512027ec7bbb05 100755 (executable)
@@ -323,6 +323,46 @@ Double_t AliCaloTrackAODReader::GetBField() const {
 
 }
 
+//____________________________________________________________________________________________________________________________________________________
+Int_t AliCaloTrackAODReader::GetModuleNumber(AliAODCaloCluster * cluster) const
+{
+       //Get the EMCAL/PHOS module number that corresponds to this cluster
+       TLorentzVector lv;
+       Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex.
+       cluster->GetMomentum(lv,v);
+       Float_t phi = lv.Phi();
+       if(phi < 0) phi+=TMath::TwoPi();        
+       Int_t absId = -1;
+       if(cluster->IsEMCALCluster()){
+               GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
+               if(GetDebug() > 2) 
+                       printf("AliCaloTrackAODReader::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
+                                  lv.Eta(), phi*TMath::RadToDeg(),absId, GetEMCALGeometry()->GetSuperModuleNumber(absId));
+               return GetEMCALGeometry()->GetSuperModuleNumber(absId) ;
+       }//EMCAL
+       else if(cluster->IsPHOSCluster()) {
+               Int_t    relId[4];
+               if ( cluster->GetNCells() > 0) {
+                       absId = cluster->GetCellAbsId(0);
+                       if(GetDebug() > 2) 
+                               printf("AliCaloTrackAODReader::GetModuleNumber(AOD) - PHOS: cluster eta %f, phi %f, e %f, absId %d\n",
+                                          lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId);
+               }
+               else return -1;
+               
+               if ( absId >= 0) {
+                       GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
+                       if(GetDebug() > 2) 
+                               printf("AliCaloTrackAODReader::GetModuleNumber(AOD) - PHOS: Module %d\n",relId[0]-1);
+                       return relId[0]-1;
+               }
+               else return -1;
+       }//PHOS
+       
+       return -1;
+}
+
+
 //____________________________________________________________________________
 void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* aod, AliMCEvent* mc) {
   // Connect the data pointers
index 14a67322bd545bf772d400b9f2c0ecfef8f345f6..516a4f75e4feeab1bab988dbf8250453c8113c19 100755 (executable)
@@ -45,6 +45,9 @@ public:
 
   TString GetFiredTriggerClasses() {return ((AliAODEvent*)GetInputEvent())->GetFiredTriggerClasses();}
        
+  // Get calorimeter (Super)module number where this cluster falled
+  Int_t GetModuleNumber(AliAODCaloCluster * cluster) const ;
+       
   void Print(const Option_t * opt) const;
        
 private:
index 6e5442e5cba3ba620ebecb8f9e479ba01b39d2a9..ebf87d9ade0f6591fcd520989870b9099448a161 100755 (executable)
@@ -375,6 +375,46 @@ void AliCaloTrackESDReader::FillInputPHOSCells() {
   
 }
 
+//____________________________________________________________________________________________________________________________________________________
+Int_t AliCaloTrackESDReader::GetModuleNumber(AliESDCaloCluster * cluster) const
+{
+       //Get the EMCAL/PHOS module number that corresponds to this cluster
+       TLorentzVector lv;
+       Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex.
+       cluster->GetMomentum(lv,v);
+       Float_t phi = lv.Phi();
+       if(phi < 0) phi+=TMath::TwoPi();        
+       Int_t absId = -1;
+       if(cluster->IsEMCAL()){
+               GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
+               if(GetDebug() > 2) 
+                       printf("AliCaloTrackESDReader::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
+                                  lv.Eta(), phi*TMath::RadToDeg(),absId, GetEMCALGeometry()->GetSuperModuleNumber(absId));
+               return GetEMCALGeometry()->GetSuperModuleNumber(absId) ;
+       }//EMCAL
+       else if(cluster->IsPHOS()){
+               Int_t    relId[4];
+               if ( cluster->GetNCells() > 0) {
+                       absId = cluster->GetCellAbsId(0);
+                       if(GetDebug() > 2) 
+                               printf("AliCaloTrackESDReader::GetModuleNumber(ESD) - PHOS: cluster eta %f, phi %f, e %f, absId %d\n",
+                                          lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId);
+               }
+               else return -1;
+               
+               if ( absId >= 0) {
+                       GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
+                       if(GetDebug() > 2) 
+                               printf("AliCaloESDTrackReader::GetModuleNumber(ESD) - PHOS: Module %d\n",relId[0]-1);
+                       return relId[0]-1;
+               }
+               else return -1;
+       }//PHOS
+       
+       return -1;
+}
+
+
 //____________________________________________________________________________
 void AliCaloTrackESDReader::GetVertex(Double_t  v[3]) const {
   //Return vertex position
index de087c14a2c7df2b760116552f428b1237c42e15..bf6dd44f41c9fc0c2ebe38e633f417ec7ce1aadf 100755 (executable)
@@ -42,6 +42,9 @@ class AliCaloTrackESDReader : public AliCaloTrackReader {
   void SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) ; 
        
   TString GetFiredTriggerClasses() {return ((AliESDEvent*)GetInputEvent())->GetFiredTriggerClasses();}
+
+  // Get calorimeter (Super)module number where this cluster falled
+  Int_t GetModuleNumber(AliESDCaloCluster * cluster) const;
        
   ClassDef(AliCaloTrackESDReader,1)
     } ;
index 5b38417a5389ab2cfe82d7e8d42eae6fc5521608..11d01b2fcfb6e1935b6a5a4aa1e0ec4669e5e775 100755 (executable)
@@ -245,7 +245,7 @@ Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_
        
        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;
@@ -271,7 +271,7 @@ Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_
                else return kFALSE;
                
        }// cell cluster loop
-       printf("hello 2\n");
+
        return kFALSE;
 
 }
@@ -377,6 +377,53 @@ AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader(Int_t input) const {
        }
 }
 
+//_____________________________________________________________________________________________________________
+Int_t AliCaloTrackReader::GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t & iRCU) const
+{
+       //Get the EMCAL/PHOS module, columns, row and RCU number that corresponds to this absId
+       Int_t imod = -1;
+       if ( absId >= 0) {
+               if(calo=="EMCAL"){
+                       Int_t iTower = -1, iIphi = -1, iIeta = -1; 
+                       fEMCALGeo->GetCellIndex(absId,imod,iTower,iIphi,iIeta); 
+                       fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
+                       
+                       //RCU0
+                       if (0<=irow&&irow<8) iRCU=0; // first cable row
+                       else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0; // first half; 
+                       //second cable row
+                       //RCU1
+                       else if(8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1; // second half; 
+                       //second cable row
+                       else if(16<=irow&&irow<24) iRCU=1; // third cable row
+                       
+                       if (imod%2==1) iRCU = 1 - iRCU; // swap for odd=C side, to allow us to cable both sides the same
+                       if (iRCU<0) {
+                               printf("AliCaloTrackReader::GetModuleNumberCellIndexes() - Wrong EMCAL RCU number = %d\n", iRCU);
+                               abort();
+                       }                       
+                       
+                       return imod ;
+               }//EMCAL
+               else{//PHOS
+                       Int_t    relId[4];
+                       fPHOSGeo->AbsToRelNumbering(absId,relId);
+                       irow = relId[2];
+                       icol = relId[3];
+                       imod = relId[0]-1;
+                       iRCU= (Int_t)(relId[2]-1)/16 ;
+                       //Int_t iBranch= (Int_t)(relid[3]-1)/28 ; //0 to 1
+                       if (iRCU >= 4) {
+                               printf("AliCaloTrackReader::GetModuleNumberCellIndexes() - Wrong PHOS RCU number = %d\n", iRCU);
+                               abort();
+                       }                       
+                       return imod;
+               }//PHOS 
+       }
+       
+       return -1;
+}
+
 //_______________________________________________________________
 void AliCaloTrackReader::Init()
 {
index 3c36683b737457c00aa0ec8c476b3d013fd18b3d..71957be771af2afda20fe946828f18029fda4a5c 100755 (executable)
@@ -233,6 +233,9 @@ public:
   TString  GetTaskName() const {return fTaskName;}
   void SetTaskName(TString name) {fTaskName = name;}
 
+  //Calorimeter indexes information
+  Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
+       
  protected:
   Int_t                   fEventNumber; // Event number
   TString          fCurrentFileName; // Current file name under analysis
index bf26d1f27b01283f6ea2f57ab0a47c8e89427adb..556c8c337f118b2026ce5b2b550cf8ef8dbbf448 100755 (executable)
@@ -1204,132 +1204,6 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        return outputContainer;
 }
 
-//____________________________________________________________________________________________________________________________________________________
-Int_t AliAnaCalorimeterQA::GetModuleNumber(AliESDCaloCluster * cluster) 
-{
-       //Get the EMCAL/PHOS module number that corresponds to this cluster
-       TLorentzVector lv;
-       Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex.
-       cluster->GetMomentum(lv,v);
-       Float_t phi = lv.Phi();
-       if(phi < 0) phi+=TMath::TwoPi();        
-       Int_t absId = -1;
-       if(fCalorimeter=="EMCAL"){
-               GetReader()->GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
-               if(GetDebug() > 2) 
-                       printf("AliAnaCalorimeterQA::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
-                                  lv.Eta(), phi*TMath::RadToDeg(),absId, GetReader()->GetEMCALGeometry()->GetSuperModuleNumber(absId));
-               return GetReader()->GetEMCALGeometry()->GetSuperModuleNumber(absId) ;
-       }//EMCAL
-       else{//PHOS
-               Int_t    relId[4];
-               if ( cluster->GetNCells() > 0) {
-                       absId = cluster->GetCellAbsId(0);
-                       if(GetDebug() > 2) 
-                               printf("AliAnaCalorimeterQA::GetModuleNumber(ESD) - PHOS: cluster eta %f, phi %f, e %f, absId %d\n",
-                                               lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId);
-               }
-               else return -1;
-               
-               if ( absId >= 0) {
-                       (GetReader()->GetPHOSGeometry())->AbsToRelNumbering(absId,relId);
-                       if(GetDebug() > 2) 
-                               printf("AliAnaCalorimeterQA::GetModuleNumber(ESD) - PHOS: Module %d\n",relId[0]-1);
-                       return relId[0]-1;
-               }
-               else return -1;
-       }//PHOS
-       
-       return -1;
-}
-
-//____________________________________________________________________________________________________________________________________________________
-Int_t AliAnaCalorimeterQA::GetModuleNumber(AliAODCaloCluster * cluster) 
-{
-       //Get the EMCAL/PHOS module number that corresponds to this cluster
-       TLorentzVector lv;
-       Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex.
-       cluster->GetMomentum(lv,v);
-       Float_t phi = lv.Phi();
-       if(phi < 0) phi+=TMath::TwoPi();        
-       Int_t absId = -1;
-       if(fCalorimeter=="EMCAL"){
-               GetReader()->GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
-               if(GetDebug() > 2) 
-                       printf("AliAnaCalorimeterQA::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
-                                  lv.Eta(), phi*TMath::RadToDeg(),absId, GetReader()->GetEMCALGeometry()->GetSuperModuleNumber(absId));
-               return GetReader()->GetEMCALGeometry()->GetSuperModuleNumber(absId) ;
-       }//EMCAL
-       else{//PHOS
-               Int_t    relId[4];
-               if ( cluster->GetNCells() > 0) {
-                       absId = cluster->GetCellAbsId(0);
-                       if(GetDebug() > 2) 
-                               printf("AliAnaCalorimeterQA::GetModuleNumber(AOD) - PHOS: cluster eta %f, phi %f, e %f, absId %d\n",
-                                          lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId);
-               }
-               else return -1;
-               
-               if ( absId >= 0) {
-                       GetReader()->GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
-                       if(GetDebug() > 2) 
-                               printf("AliAnaCalorimeterQA::GetModuleNumber(AOD) - PHOS: Module %d\n",relId[0]-1);
-                       return relId[0]-1;
-               }
-               else return -1;
-       }//PHOS
-       
-       return -1;
-}
-
-//_____________________________________________________________________________________________________________
-Int_t AliAnaCalorimeterQA::GetModuleNumberCellIndexes(const Int_t absId, Int_t & icol, Int_t & irow, Int_t & iRCU) 
-{
-       //Get the EMCAL/PHOS module, columns, row and RCU number that corresponds to this absId
-       Int_t imod = -1;
-       if ( absId >= 0) {
-               if(fCalorimeter=="EMCAL"){
-                       Int_t iTower = -1, iIphi = -1, iIeta = -1; 
-                       GetReader()->GetEMCALGeometry()->GetCellIndex(absId,imod,iTower,iIphi,iIeta); 
-                       GetReader()->GetEMCALGeometry()->GetCellPhiEtaIndexInSModule(imod,iTower,
-                                                                                                                                                iIphi, iIeta,irow,icol);
-                       
-                       //RCU0
-                       if (0<=irow&&irow<8) iRCU=0; // first cable row
-                       else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0; // first half; 
-                       //second cable row
-                       //RCU1
-                       else if(8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1; // second half; 
-                       //second cable row
-                       else if(16<=irow&&irow<24) iRCU=1; // third cable row
-                       
-                       if (imod%2==1) iRCU = 1 - iRCU; // swap for odd=C side, to allow us to cable both sides the same
-                       if (iRCU<0) {
-                               printf("AliAnaCalorimeterQA - Wrong EMCAL RCU number = %d\n", iRCU);
-                               abort();
-                       }                       
-                       
-                       return imod ;
-               }//EMCAL
-               else{//PHOS
-                       Int_t    relId[4];
-                       GetReader()->GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
-                       irow = relId[2];
-                       icol = relId[3];
-                       imod = relId[0]-1;
-                       iRCU= (Int_t)(relId[2]-1)/16 ;
-                       //Int_t iBranch= (Int_t)(relid[3]-1)/28 ; //0 to 1
-                       if (iRCU >= fNRCU) {
-                               printf("AliAnaCalorimeterQA - Wrong PHOS RCU number = %d\n", iRCU);
-                               abort();
-                       }                       
-                       return imod;
-               }//PHOS 
-       }
-       
-       return -1;
-}
-
 //_______________________________________________________________________________________________________________________________________
 Int_t AliAnaCalorimeterQA::GetNewRebinForRePlotting(TH1D* histo, const Float_t newXmin, const Float_t newXmax,const Int_t newXnbins) const
 {
@@ -1900,7 +1774,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
                
                for (Int_t iCell = 0; iCell < ncells; iCell++) {      
                        if(GetDebug() > 2)  printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cell->GetAmplitude(iCell), cell->GetCellNumber(iCell));
-                       nModule = GetModuleNumberCellIndexes(cell->GetCellNumber(iCell), icol, irow, iRCU);
+                       nModule = GetModuleNumberCellIndexes(cell->GetCellNumber(iCell),fCalorimeter, icol, irow, iRCU);
                        if(GetDebug() > 2) printf("\t module %d, column %d, row %d \n", nModule,icol,irow);
                        
                        if(nModule < fNModules) {       
@@ -1969,7 +1843,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
 //                                             time2    = cell2->GetTime(iCell2)*1e9;//transform time to ns
 //                                             //printf("%s: time %g\n",fCalorimeter.Data(), time);
 //                                             id2      = cell2->GetCellNumber(iCell2);
-//                                             nModule2 = GetModuleNumberCellIndexes(cell2->GetCellNumber(iCell2), icol2, irow2, iRCU2);
+//                                             nModule2 = GetModuleNumberCellIndexes(cell2->GetCellNumber(iCell2), fCalorimeter, icol2, irow2, iRCU2);
 //                                             Int_t index = (nModule2*fNRCU+iRCU2)+(fNModules*fNRCU)*(iRCU+fNRCU*nModule); 
 //                                             //printf("id %d, nModule %d, iRCU %d, id2 %d, nModule2 %d, iRCU2 %d, index %d: Histo Name %s\n",id, nModule,iRCU,cell2->GetCellNumber(iCell2),nModule2,iRCU2,index, fhTimeCorrRCU[index]->GetName());
 //                                             fhTimeCorrRCU[index]->Fill(time,time2); 
@@ -2035,7 +1909,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
                for (Int_t iCell = 0; iCell < ncells; iCell++) {  
                        id      = cell->GetCellNumber(iCell);
                        if(GetDebug() > 2 )  printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cell->GetAmplitude(iCell), id);
-                       nModule = GetModuleNumberCellIndexes(id, icol, irow, iRCU);
+                       nModule = GetModuleNumberCellIndexes(id, fCalorimeter, icol, irow, iRCU);
                        if(GetDebug() > 2) printf("\t module %d, column %d, row %d \n", nModule,icol,irow);
                        
                        if(nModule < fNModules) {       
index d5c2dbec100904340e3683ff55d34499874fd963..99d02a091f8652a505ed21965094fe8f53b2048f 100755 (executable)
@@ -64,10 +64,6 @@ public:
        
   void Terminate(TList * outputList);
   void ReadHistograms(TList * outputList); //Fill histograms with histograms in ouput list, needed in Terminate.
-
-  Int_t GetModuleNumber(AliESDCaloCluster * cluster);
-  Int_t GetModuleNumber(AliAODCaloCluster * cluster);
-  Int_t GetModuleNumberCellIndexes(const Int_t absId, Int_t & icol, Int_t & irow, Int_t &iRCU);
        
   void SetNumberOfModules(Int_t nmod) {fNModules = nmod;}