Allow position recaculation for EMCAL rotational and translation shifts, add asymmetr...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Oct 2010 09:33:54 +0000 (09:33 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Oct 2010 09:33:54 +0000 (09:33 +0000)
PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx
PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.h
PWG4/CaloCalib/macros/anaEMCALCalib.C
PWG4/PartCorrBase/AliCalorimeterUtils.cxx

index fbe10ab..bd6940e 100644 (file)
@@ -49,7 +49,7 @@ ClassImp(AliAnalysisTaskEMCALPi0CalibSelection)
 //__________________________________________________
 AliAnalysisTaskEMCALPi0CalibSelection::AliAnalysisTaskEMCALPi0CalibSelection(const char* name) :
   AliAnalysisTaskSE(name),fEMCALGeo(0x0),//fCalibData(0x0), 
-  fEmin(0.5), fEmax(15.), fMinNCells(2), fGroupNCells(0),
+  fEmin(0.5), fEmax(15.), fAsyCut(1.),fMinNCells(2), fGroupNCells(0),
   fLogWeight(4.5), fCopyAOD(kFALSE), fSameSM(kFALSE), fOldAOD(kFALSE),
   fEMCALGeoName("EMCAL_FIRSTYEAR"), fNCellsFromEMCALBorder(0),
   fRemoveBadChannels(kFALSE),fEMCALBadChannelMap(0x0),
@@ -60,7 +60,6 @@ AliAnalysisTaskEMCALPi0CalibSelection::AliAnalysisTaskEMCALPi0CalibSelection(con
   fHOpeningAngle(0x0),  fHOpeningAngleDifferentSM(0x0),  
   fHIncidentAngle(0x0), fHIncidentAngleDifferentSM(0x0),
   fHAsymmetry(0x0),  fHAsymmetryDifferentSM(0x0),  
-
   fhNEvents(0x0),fCuts(0x0)
 {
   //Named constructor which should be used.
@@ -130,7 +129,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::LocalInit()
        char onePar[buffersize] ;
        fCuts = new TList();
 
-       snprintf(onePar,buffersize, "Custer cuts: %2.2f < E < %2.2f GeV; min number of cells %d;", fEmin,fEmax, fMinNCells) ;
+       snprintf(onePar,buffersize, "Custer cuts: %2.2f < E < %2.2f GeV; min number of cells %d; Assymetry cut %1.2f", fEmin,fEmax, fMinNCells, fAsyCut) ;
        fCuts->Add(new TObjString(onePar));
        snprintf(onePar,buffersize, "Group %d cells;", fGroupNCells) ;
        fCuts->Add(new TObjString(onePar));
@@ -802,7 +801,9 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */)
       //printf("*** mass %f\n",invmass);
       Float_t asym = TMath::Abs(p1.E()-p2.E())/(p1.E()+p2.E());
       //printf("asymmetry %f\n",asym);
-
+      
+      if(asym > fAsyCut) continue;
+      
       if(invmass < fMaxBin && invmass > fMinBin){
         
         //Check if cluster is in fidutial region, not too close to borders
@@ -831,9 +832,11 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */)
             //Float_t * posSM1cen = RecalculatePosition(11.5, 23.5, p1.E(),0, iSupMod1); 
             //Float_t * posSM2cen = RecalculatePosition(11.5, 23.5, p2.E(),0, iSupMod2); 
             Float_t posSM1cen[3]={0.,0.,0.};
-            fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, p1.E(),iSupMod1,0,fRecoUtils->GetMisalShiftArray(),posSM1cen); 
+            fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, p1.E(),iSupMod1,0,
+                                                fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM1cen); 
             Float_t posSM2cen[3]={0.,0.,0.}; 
-            fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, p2.E(),iSupMod2,0,fRecoUtils->GetMisalShiftArray(),posSM2cen); 
+            fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, p2.E(),iSupMod2,0,
+                                                fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM2cen); 
             //printf("SM1 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod1,posSM1cen[0],posSM1cen[1],posSM1cen[2]);
             //printf("SM2 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod2,posSM2cen[0],posSM2cen[1],posSM2cen[2]);
             
@@ -1080,13 +1083,13 @@ void AliAnalysisTaskEMCALPi0CalibSelection::GetMaxEnergyCellPosAndClusterPos(Ali
     
     //Float_t *xyzNew = RecalculatePosition(weightedRow, weightedCol, clEnergy, 0, iSupMod); //1 = electrons, 0 photons
     fEMCALGeo->RecalculateTowerPosition(weightedRow, weightedCol, iSupMod, clEnergy, 0, //1 = electrons, 0 photons
-                                        fRecoUtils->GetMisalShiftArray(), xyzNew);
+                                        fRecoUtils->GetMisalTransShiftArray(), fRecoUtils->GetMisalRotShiftArray(), xyzNew);
   }
   else {
     //printf("In Different SM\n");
     //Float_t *xyzNew = RecalculatePosition(iphi,        ieta,        clEnergy, 0, iSupMod); //1 = electrons, 0 photons
     fEMCALGeo->RecalculateTowerPosition(iphi, ieta, iSupMod, clEnergy, 0, //1 = electrons, 0 photons
-                                        fRecoUtils->GetMisalShiftArray(), xyzNew);
+                                        fRecoUtils->GetMisalTransShiftArray(), fRecoUtils->GetMisalRotShiftArray(), xyzNew);
     
   }
 
index ecbf20b..94377a3 100644 (file)
@@ -41,18 +41,19 @@ public:
   virtual void UserCreateOutputObjects();
   virtual void UserExec(Option_t * opt);
   virtual void LocalInit() ;
-
-  void SetClusterMinEnergy(Float_t emin) {fEmin=emin;}
-  void SetClusterMaxEnergy(Float_t emax) {fEmax=emax;}
-  void SetClusterMinNCells(Int_t n)      {fMinNCells=n;}
-  void SetNCellsGroup(Int_t n)           {fGroupNCells=n;}
-
-  void SetLogWeight(Float_t weight) {fLogWeight=weight;}
+  
+  void SetAsymmetryCut(Float_t asy)      {fAsyCut      = asy ;}
+  void SetClusterMinEnergy(Float_t emin) {fEmin        = emin;}
+  void SetClusterMaxEnergy(Float_t emax) {fEmax        = emax;}
+  void SetClusterMinNCells(Int_t n)      {fMinNCells   = n   ;}
+  void SetNCellsGroup(Int_t n)           {fGroupNCells = n   ;}
+  void SetLogWeight(Float_t w)           {fLogWeight   = w   ;}
+  
   //void SetCalibCorrections(AliEMCALCalibData* const cdata);
   void CreateAODFromESD();
   void CreateAODFromAOD();     
 
-  void CopyAOD(Bool_t copy)   { fCopyAOD = copy ; }
+  void CopyAOD(Bool_t copy)  { fCopyAOD = copy ; }
   Bool_t IsAODCopied() const { return fCopyAOD ; }
        
   void SwitchOnSameSM()    {fSameSM = kTRUE  ; }
@@ -63,8 +64,8 @@ public:
   void SwitchOnOldAODs()   {fOldAOD = kTRUE  ; }
   void SwitchOffOldAODs()  {fOldAOD = kFALSE ; }  
   
-  void SetGeometryName(TString name)   { fEMCALGeoName = name ; }
-  TString GeometryName() const { return fEMCALGeoName ; }
+  void SetGeometryName(TString name) { fEMCALGeoName = name ; }
+  TString GeometryName() const       { return fEMCALGeoName ; }
  
   //Modules fiducial region
   Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells) ;
@@ -87,15 +88,14 @@ public:
        ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
        
   TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
-       
-  void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
+  void   SetEMCALChannelStatusMap(TObjArray *map)  {fEMCALBadChannelMap = map;}
        
   Bool_t ClusterContainsBadChannel(UShort_t* cellList, Int_t nCells);
        
   // Recalibration
-  Bool_t IsRecalibrationOn()  const { return fRecalibration ; }
-  void SwitchOnRecalibration()    {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors();}
-  void SwitchOffRecalibration()   {fRecalibration = kFALSE ; }
+  Bool_t IsRecalibrationOn() const { return fRecalibration  ; }
+  void SwitchOnRecalibration()     {fRecalibration = kTRUE  ; InitEMCALRecalibrationFactors();}
+  void SwitchOffRecalibration()    {fRecalibration = kFALSE ; }
        
   void InitEMCALRecalibrationFactors() ;
   
@@ -115,12 +115,11 @@ public:
   Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells);
        
   void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) {fRecoUtils = ru;}
-  AliEMCALRecoUtils* GetEMCALRecoUtils() const {return fRecoUtils;}
+  AliEMCALRecoUtils* GetEMCALRecoUtils() const   {return fRecoUtils;}
   
   void SetInvariantMassHistoBinRange(Int_t nBins, Float_t minbin, Float_t maxbin){
        fNbins = nBins; fMinBin = minbin; fMaxBin = maxbin; }
          
-private:
   void GetMaxEnergyCellPosAndClusterPos(AliVCaloCells* cells, AliVCluster* clu, Int_t& iSM, Int_t& ieta, Int_t& iphi);
 
 private:
@@ -130,6 +129,7 @@ private:
        
   Float_t fEmin;          // min. cluster energy
   Float_t fEmax;          // max. cluster energy
+  Float_t fAsyCut;        // Asymmetry cut
   Int_t   fMinNCells;     // min. ncells in cluster
   Int_t   fGroupNCells;   // group n cells
   Float_t fLogWeight;     // log weight used in cluster recalibration
@@ -181,7 +181,7 @@ private:
   TH1I*   fhNEvents;        //! Number of events counter histogram
   TList * fCuts ;           //! List with analysis cuts
 
-  ClassDef(AliAnalysisTaskEMCALPi0CalibSelection,7);
+  ClassDef(AliAnalysisTaskEMCALPi0CalibSelection,8);
 
 };
 
index e1e91b9..c86a039 100644 (file)
@@ -47,7 +47,7 @@ void anaEMCALCalib(Int_t mode=mLocal)
   //Try to set the new library
   //gSystem->Load("./PWG4CaloCalib/libPWG4CaloCalib.so");
   //gSystem->ListLibraries();
-
+  
   //-------------------------------------------------------------------------------------------------
   //Create chain from ESD and from cross sections files, look below for options.
   //-------------------------------------------------------------------------------------------------
@@ -57,10 +57,10 @@ void anaEMCALCalib(Int_t mode=mLocal)
     cout<<"Wrong  data type "<<kInputData<<endl;
     break;
   }
-
+  
   TChain *chain       = new TChain(kTreeName) ;
   CreateChain(mode, chain);  
-
+  
   if(chain){
     AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen
     
@@ -68,32 +68,32 @@ void anaEMCALCalib(Int_t mode=mLocal)
     // Make the analysis manager
     //-------------------------------------
     AliAnalysisManager *mgr  = new AliAnalysisManager("Manager", "Manager");
-
+    
     // AOD output handler
     if(copy){
-       AliAODHandler* aodoutHandler   = new AliAODHandler();
-       aodoutHandler->SetOutputFileName("aod.root");
-       ////aodoutHandler->SetCreateNonStandardAOD();
-       mgr->SetOutputEventHandler(aodoutHandler);
+      AliAODHandler* aodoutHandler   = new AliAODHandler();
+      aodoutHandler->SetOutputFileName("aod.root");
+      ////aodoutHandler->SetCreateNonStandardAOD();
+      mgr->SetOutputEventHandler(aodoutHandler);
     }
-
+    
     //input
     if(kInputData == "ESD")
-      {
-       // ESD handler
-       AliESDInputHandler *esdHandler = new AliESDInputHandler();
-       mgr->SetInputEventHandler(esdHandler);
-       esdHandler->SetReadFriends(kFALSE);
-       cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl;
-      }
+    {
+      // ESD handler
+      AliESDInputHandler *esdHandler = new AliESDInputHandler();
+      mgr->SetInputEventHandler(esdHandler);
+      esdHandler->SetReadFriends(kFALSE);
+      cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl;
+    }
     if(kInputData == "AOD")
-      {
-       // AOD handler
-       AliAODInputHandler *aodHandler = new AliAODInputHandler();
-       mgr->SetInputEventHandler(aodHandler);
-       cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl;
-       
-      }
+    {
+      // AOD handler
+      AliAODInputHandler *aodHandler = new AliAODInputHandler();
+      mgr->SetInputEventHandler(aodHandler);
+      cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl;
+      
+    }
     
     //mgr->SetDebugLevel(1);
     
@@ -102,26 +102,27 @@ void anaEMCALCalib(Int_t mode=mLocal)
     //-------------------------------------------------------------------------
     AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
     AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
-
+    
     
     // ESD filter task
     if(kInputData == "ESD"){
-
+      
       gROOT->LoadMacro("AddTaskPhysicsSelection.C");
       AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
       if(!copy){
-       gROOT->LoadMacro("AddTaskESDFilter.C");
-       AliAnalysisTaskESDfilter *esdfilter = AddTaskESDFilter(kFALSE);
+        gROOT->LoadMacro("AddTaskESDFilter.C");
+        AliAnalysisTaskESDfilter *esdfilter = AddTaskESDFilter(kFALSE);
       }
     }
     
-
-   
+    
+    
     AliAnalysisTaskEMCALPi0CalibSelection * pi0calib = new AliAnalysisTaskEMCALPi0CalibSelection ("EMCALPi0Calibration");
     //pi0calib->SetDebugLevel(10); 
     pi0calib->CopyAOD(copy);
     pi0calib->SetClusterMinEnergy(0.5);
     pi0calib->SetClusterMaxEnergy(15.);
+    pi0calib->SetAsymmetryCut(0.7);
     pi0calib->SetClusterMinNCells(0);
     pi0calib->SetNCellsGroup(0);
     pi0calib->SwitchOnBadChannelsRemoval();
@@ -129,24 +130,25 @@ void anaEMCALCalib(Int_t mode=mLocal)
     pi0calib->SwitchOnOldAODs();
     pi0calib->SetNumberOfCellsFromEMCALBorder(1);
     AliEMCALRecoUtils * reco = pi0calib->GetEMCALRecoUtils();
-    reco->SetMisalShift(0,0.8);  reco->SetMisalShift(1,8.3); reco->SetMisalShift(2,1.);
-    reco->SetMisalShift(3,-7.5); reco->SetMisalShift(4,7.5); reco->SetMisalShift(5,2.);
+    reco->SetMisalTransShift(0,1.08);   reco->SetMisalTransShift(1,8.35); reco->SetMisalTransShift(2,1.12);
+    reco->SetMisalRotShift(3,-8.05);    reco->SetMisalRotShift(4,8.05);  
+    reco->SetMisalTransShift(3,-0.42);  reco->SetMisalTransShift(5,1.55);
     reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0GammaGamma);
     reco->SetNonLinearityParam(0,1.04);     reco->SetNonLinearityParam(1,-0.1445);
     reco->SetNonLinearityParam(2,1.046);    
-
-//     reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0GammaConversion);
-//     reco->SetNonLinearityParam(0,1.033);     reco->SetNonLinearityParam(1,0.0566186);
-//     reco->SetNonLinearityParam(2,0.982133);    
-
-
-//      reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC);
-//      reco->SetNonLinearityParam(0,1.001);     reco->SetNonLinearityParam(1,-0.01264);
-//      reco->SetNonLinearityParam(2,-0.03632);    
-//      reco->SetNonLinearityParam(3,0.1798);     reco->SetNonLinearityParam(4,-0.522);
-
+    
+    //     reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0GammaConversion);
+    //     reco->SetNonLinearityParam(0,1.033);     reco->SetNonLinearityParam(1,0.0566186);
+    //     reco->SetNonLinearityParam(2,0.982133);    
+    
+    
+    //      reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC);
+    //      reco->SetNonLinearityParam(0,1.001);     reco->SetNonLinearityParam(1,-0.01264);
+    //      reco->SetNonLinearityParam(2,-0.03632);    
+    //      reco->SetNonLinearityParam(3,0.1798);     reco->SetNonLinearityParam(4,-0.522);
+    
     reco->Print("");
-
+    
     // SM0
     pi0calib->SetEMCALChannelStatus(0,3,13);  pi0calib->SetEMCALChannelStatus(0,44,1); pi0calib->SetEMCALChannelStatus(0,3,13); 
     pi0calib->SetEMCALChannelStatus(0,20,7);  pi0calib->SetEMCALChannelStatus(0,38,2);   
@@ -164,35 +166,35 @@ void anaEMCALCalib(Int_t mode=mLocal)
     pi0calib->SetEMCALChannelStatus(2,19,22);
     //SM3
     pi0calib->SetEMCALChannelStatus(3,4,7);
-
+    
     mgr->AddTask(pi0calib);
-
-   pi0calib->SwitchOnRecalibration();
-  TFile * f = new TFile("RecalibrationFactors.root","read");
-  TH2F * h0 = (TH2F*)f->Get("EMCALRecalFactors_SM0")->Clone();
-  TH2F * h1 = (TH2F*)f->Get("EMCALRecalFactors_SM1")->Clone();
-  TH2F * h2 = (TH2F*)f->Get("EMCALRecalFactors_SM2")->Clone();
-  TH2F * h3 = (TH2F*)f->Get("EMCALRecalFactors_SM3")->Clone();
-
-  pi0calib->SetEMCALChannelRecalibrationFactors(0,h0);
-  pi0calib->SetEMCALChannelRecalibrationFactors(1,h1);
-  pi0calib->SetEMCALChannelRecalibrationFactors(2,h2);
-  pi0calib->SetEMCALChannelRecalibrationFactors(3,h3);
+    
+    pi0calib->SwitchOnRecalibration();
+    TFile * f = new TFile("RecalibrationFactors.root","read");
+    TH2F * h0 = (TH2F*)f->Get("EMCALRecalFactors_SM0")->Clone();
+    TH2F * h1 = (TH2F*)f->Get("EMCALRecalFactors_SM1")->Clone();
+    TH2F * h2 = (TH2F*)f->Get("EMCALRecalFactors_SM2")->Clone();
+    TH2F * h3 = (TH2F*)f->Get("EMCALRecalFactors_SM3")->Clone();
+    
+    pi0calib->SetEMCALChannelRecalibrationFactors(0,h0);
+    pi0calib->SetEMCALChannelRecalibrationFactors(1,h1);
+    pi0calib->SetEMCALChannelRecalibrationFactors(2,h2);
+    pi0calib->SetEMCALChannelRecalibrationFactors(3,h3);
     
     // Create containers for input/output
     AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer();
     if(copy) AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
     AliAnalysisDataContainer *coutput2 = 
-      mgr->CreateContainer("pi0calib", TList::Class(), AliAnalysisManager::kOutputContainer, "pi0calib.root");
+    mgr->CreateContainer("pi0calib", TList::Class(), AliAnalysisManager::kOutputContainer, "pi0calib.root");
     
     AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer("Cuts", TList::Class(), 
-                                                              AliAnalysisManager::kOutputContainer, "pi0calib.root");
+                                                               AliAnalysisManager::kOutputContainer, "pi0calib.root");
     
     mgr->ConnectInput  (pi0calib,     0, cinput1);
     if(copy) mgr->ConnectOutput (pi0calib, 0, coutput1 );
     mgr->ConnectOutput (pi0calib, 1, coutput2 );
     mgr->ConnectOutput (pi0calib, 2, cout_cuts);
-
+    
     //-----------------------
     // Run the analysis
     //-----------------------    
@@ -207,9 +209,9 @@ void anaEMCALCalib(Int_t mode=mLocal)
     mgr->InitAnalysis();
     mgr->PrintStatus();
     mgr->StartAnalysis(smode.Data(),chain);
-
-cout <<" Analysis ended sucessfully "<< endl ;
-
+    
+    cout <<" Analysis ended sucessfully "<< endl ;
+    
   }
   else cout << "Chain was not produced ! "<<endl;
   
index 588d08d..d5e1636 100755 (executable)
@@ -737,13 +737,13 @@ void AliCalorimeterUtils::RecalculateClusterPosition(AliVCaloCells* cells, AliVC
     
     //Float_t *xyzNew = RecalculatePosition(weightedRow, weightedCol, clEnergy, 0, iSupMod); //1 = electrons, 0 photons
     fEMCALGeo->RecalculateTowerPosition(weightedRow, weightedCol, imod, clEnergy, 0, //1 = electrons, 0 photons
-                                        fEMCALRecoUtils->GetMisalShiftArray(), xyzNew);
+                                        fEMCALRecoUtils->GetMisalTransShiftArray(), fEMCALRecoUtils->GetMisalRotShiftArray(), xyzNew);
   }
   else {
     //printf("In Different SM\n");
     //Float_t *xyzNew = RecalculatePosition(iphi,        ieta,        clEnergy, 0, iSupMod); //1 = electrons, 0 photons
     fEMCALGeo->RecalculateTowerPosition(iphi, ieta, imod, clEnergy, 0, //1 = electrons, 0 photons
-                                        fEMCALRecoUtils->GetMisalShiftArray(), xyzNew);
+                                        fEMCALRecoUtils->GetMisalTransShiftArray(), fEMCALRecoUtils->GetMisalRotShiftArray(), xyzNew);
     
   }