]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Up from Salvatore
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Mar 2013 17:42:54 +0000 (17:42 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Mar 2013 17:42:54 +0000 (17:42 +0000)
PWG/EMCAL/AliAnalysisTaskEMCALClusterizeFast.cxx
PWG/EMCAL/AliAnalysisTaskEmcal.cxx
PWG/EMCAL/macros/AddTaskClusterizerFast.C
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.h
PWGJE/EMCALJetTasks/AliJetModelBaseTask.cxx
PWGJE/EMCALJetTasks/AliJetResponseMaker.cxx
PWGJE/EMCALJetTasks/AliJetResponseMaker.h
PWGJE/EMCALJetTasks/macros/AddTaskJetEmbeddingFromAOD.C
PWGJE/EMCALJetTasks/macros/AddTaskJetEmbeddingFromPYTHIA.C

index 5144586ec52611cfdcd20f9f433d835216a38946..89aba2ad3c69bb79794756a2f13c044ff084369a 100644 (file)
@@ -316,6 +316,7 @@ void AliAnalysisTaskEMCALClusterizeFast::Clusterize()
   }
 
   fClusterizer->Digits2Clusters("");
   if (fSubBackground) {
     if (fCalibData) {
       fClusterizer->SetInputCalibrated(kFALSE);   
@@ -345,13 +346,27 @@ void AliAnalysisTaskEMCALClusterizeFast::FillDigitsArray()
        Int_t cellMCLabel=-1;
        if (fCaloCells->GetCell(icell, cellNumber, cellAmplitude, cellTime, cellMCLabel, cellEFrac) != kTRUE)
          break;
-
-       if ((fInputCellType == kFEEDataMCOnly && cellMCLabel <= 0) ||
-           (fInputCellType == kFEEDataExcludeMC && cellMCLabel > 0))
-         continue;
+       
+       if (fInputCellType == kFEEDataMCOnly) {
+         if (cellMCLabel <= 0)
+           continue;
+         else {
+           cellAmplitude *= cellEFrac;
+           cellEFrac = 1;
+         }
+       }
+       else if (fInputCellType == kFEEDataExcludeMC) {
+         if (cellMCLabel > 0) 
+           continue;
+         else 
+           cellAmplitude *= 1 - cellEFrac;
+       }
 
        if (cellMCLabel > 0 && cellEFrac < 1e-6) cellEFrac = 1;
-    
+
+       if (cellAmplitude < 1e-6 || cellNumber < 0)
+         continue;
+       
        AliEMCALDigit *digit = new((*fDigitsArr)[idigit]) AliEMCALDigit(cellMCLabel, cellMCLabel, cellNumber,
                                                                        (Float_t)cellAmplitude, (Float_t)cellTime,
                                                                        AliEMCALDigit::kHG,idigit, 0, 0, cellEFrac*cellAmplitude);
@@ -362,11 +377,11 @@ void AliAnalysisTaskEMCALClusterizeFast::FillDigitsArray()
          fClusterizer->Calibrate(energy,time,cellNumber);
          digit->SetAmplitude(energy);
          avgE += energy;
-       } 
+       }
        idigit++;
       }
-      
-      fDigitsArr->Sort();
+
+      //fDigitsArr->Sort();
 
       if (fSubBackground) {
        avgE /= fGeom->GetNumberOfSuperModules()*48*24;
@@ -631,7 +646,7 @@ void AliAnalysisTaskEMCALClusterizeFast::RecPoints2Clusters(TClonesArray *clus)
       AliError(Form("Cannot get tracks named %s", fTrackName.Data()));
     }
   }
-
+  
   const Int_t Ncls = fClusterArr->GetEntries();
   AliDebug(1, Form("total no of clusters %d", Ncls)); 
   for(Int_t i=0, nout=clus->GetEntries(); i < Ncls; ++i) {
@@ -718,7 +733,6 @@ void AliAnalysisTaskEMCALClusterizeFast::RecPoints2Clusters(TClonesArray *clus)
 void AliAnalysisTaskEMCALClusterizeFast::UpdateCells()
 {
   // Update cells in case re-calibration was done.
-
   if (!fCalibData&&!fSubBackground)
     return;
 
@@ -875,7 +889,7 @@ void AliAnalysisTaskEMCALClusterizeFast::Init()
   fClusterArr = const_cast<TObjArray *>(fClusterizer->GetRecPoints());
 
   // Get the emcal cells
-  if (fInputCellType == kFEEData && !fCaloCells) {
+  if ((fInputCellType == kFEEData ||  fInputCellType == kFEEDataMCOnly || fInputCellType == kFEEDataExcludeMC) && !fCaloCells) {
     if (fCaloCellsName.IsNull()) {
       fCaloCells = InputEvent()->GetEMCALCells();
     }
index 60310e96b7962ce5434d5837d032140abb928478..5151619761c62254b3a5b9916d4cfaff82738068 100644 (file)
@@ -247,6 +247,9 @@ Bool_t AliAnalysisTaskEmcal::AcceptCluster(AliVCluster *clus) const
 
   if (!clus)
     return kFALSE;
+      
+  if (!clus->IsEMCAL())
+    return kFALSE;
 
   if (clus->GetLabel() > 0) {
     if (clus->TestBits(fMCClusterBitMap) != (Int_t)fMCClusterBitMap) {
@@ -260,9 +263,6 @@ Bool_t AliAnalysisTaskEmcal::AcceptCluster(AliVCluster *clus) const
       return kFALSE;
     }
   }
-      
-  if (!clus->IsEMCAL())
-    return kFALSE;
 
   if (clus->GetTOF() > fClusTimeCutUp || clus->GetTOF() < fClusTimeCutLow)
     return kFALSE;
index 44de65144b0d8e3cf74bf6b930344df9050f6edb..eeb63ec27470da4cf50bfc8fa5ed15e96c4a331b 100644 (file)
@@ -32,7 +32,7 @@ AliAnalysisTaskEMCALClusterizeFast* AddTaskClusterizerFast(
   task->SetAttachClusters(kTRUE);
   task->SetCaloClustersName(clusName);
   task->SetCaloCellsName(cellsName);
-  task->SetInputCellType(AliAnalysisTaskEMCALClusterizeFast::kFEEData);
+  task->SetInputCellType(inputCellType);
   task->SetUpdateCells(updateCells);
   task->SetClusterBadChannelCheck(remBC);
   task->SetRejectExoticClusters(remExotic);
index 24fb62269817c6398132a4e2223356d5693ff7ee..0398a83543720fbf4cea929205a1a2d93cfff417 100644 (file)
@@ -94,7 +94,6 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
 {
   // Default constructor.
   SetSuffix("AODEmbedding");
-  SetMarkMC(0);
   fAODfilterBits[0] = -1;
   fAODfilterBits[1] = -1;
   fEtaMin = -1;
@@ -157,7 +156,6 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t
 {
   // Standard constructor.
   SetSuffix("AODEmbedding");
-  SetMarkMC(0);
   fAODfilterBits[0] = -1;
   fAODfilterBits[1] = -1;
   fEtaMin = -1;
@@ -594,6 +592,10 @@ void AliJetEmbeddingFromAODTask::Run()
          AliError(Form("Could not find cluster %d in branch %s of tree %s!", i, fAODClusName.Data(), fAODTreeName.Data()));
          continue;
        }
+
+       if (!clus->IsEMCAL())
+         continue;
+
        TLorentzVector vect;
        Double_t vert[3] = {0,0,0};
        clus->GetMomentum(vect,vert);
@@ -602,14 +604,13 @@ void AliJetEmbeddingFromAODTask::Run()
            vect.Eta() < fEtaMin || vect.Eta() > fEtaMax ||
            vect.Phi() < fPhiMin || vect.Phi() > fPhiMax)
          continue;
-
+       
        Int_t label = 0;
        if (fIsAODMC) {
          label = clus->GetLabel();
          if (label <= 0) 
            AliWarning(Form("%s: Clus %d with label<=0", GetName(), i));
        }
-
        AddCluster(clus);
       }
     }
@@ -653,7 +654,6 @@ void AliJetEmbeddingFromAODTask::Run()
        totalEnergy += amp;
       }
     }
-
     AliDebug(2,Form("Added cells = %d (energy = %f), total cells = %d", fAddedCells, totalEnergy, totalCells));
   }
 }
index d05965c0f6b5b75348db7ab7d2f6150f21fc0a86..586ac757ce63ddff0b3d16e7bc6cd27d0f2e2447 100644 (file)
@@ -47,6 +47,7 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   void           SetJetConstituentMinPt(Double_t pt)               { fJetConstituentMinPt= pt    ; }
   void           SetJetType(Byte_t t)                              { fJetType            = t     ; }
   void           SetJetAlgo(Byte_t t)                              { fJetAlgo            = t     ; }
+  void           SetZVertexCut(Double_t z)                         { fZVertexCut         = z     ; }
 
  protected:
   Bool_t          ExecOnce()            ;// intialize task
index 6f5dfc6ac9b07457ae91d34823413fbf491b0173..5973ed2a86f75b1e0df21e588f104ae1a950ce58 100644 (file)
@@ -183,7 +183,7 @@ void AliJetModelBaseTask::UserExec(Option_t *)
 
   Run();
 
-  if (fCaloCells) {
+  if (fCaloCells && !fCopyArray) {
     delete fCaloCells;
     fCaloCells = tempCaloCells;
   }
@@ -447,12 +447,15 @@ Int_t AliJetModelBaseTask::AddCell(Double_t e, Int_t absId, Double_t time, Int_t
 {
   // Add a cell to the event.
 
-  if (label == 0)
+  if (label <= 0)
     label = fMarkMC;
   else
     label += fMCLabelShift;
 
-  Short_t pos = fOutCaloCells->GetCellPosition(absId);
+  Short_t pos = -1;
+  if (fCaloCells)  
+    pos = fCaloCells->GetCellPosition(absId);
+
   Double_t efrac = 1;
   Bool_t increaseOnSuccess = kFALSE;
 
@@ -468,12 +471,14 @@ Int_t AliJetModelBaseTask::AddCell(Double_t e, Int_t absId, Double_t time, Int_t
     Double_t old_efrac = 0;
     fOutCaloCells->GetCell(pos, cellNumber, old_e, old_time, old_label, old_efrac);
     
-    if (e / (old_e + e) < old_efrac) {
+    efrac = e / (old_e + e);
+
+    if (old_label > 0 && e < old_efrac * old_e) {
       label = old_label;
+      efrac = old_efrac;
       time = old_time;
     }
     
-    efrac = (e + old_e * old_efrac) / (e + old_e);
     e += old_e;
   }
 
@@ -517,7 +522,7 @@ AliVCluster* AliJetModelBaseTask::AddCluster(AliVCluster *oc)
   UInt_t nlabels = oc->GetNLabels();
   Int_t *labels = oc->GetLabels();
 
-  if (nlabels != 0 && labels) {
+  if (nlabels != 0 && labels && labels[0] >= 0) {
     AliESDCaloCluster *esdClus = dynamic_cast<AliESDCaloCluster*>(dc);
     if (esdClus) {
       TArrayI parents(nlabels, labels);
@@ -529,6 +534,18 @@ AliVCluster* AliJetModelBaseTask::AddCluster(AliVCluster *oc)
        aodClus->SetLabel(labels, nlabels); 
     }
   }
+  else if (fMarkMC != 0) {
+    AliESDCaloCluster *esdClus = dynamic_cast<AliESDCaloCluster*>(dc);
+    if (esdClus) {
+      TArrayI parents(1, &fMarkMC);
+      esdClus->AddLabels(parents); 
+    }
+    else {
+      AliAODCaloCluster *aodClus = dynamic_cast<AliAODCaloCluster*>(dc);
+      if (aodClus) 
+       aodClus->SetLabel(&fMarkMC,1); 
+    }
+  }
 
   return dc;
 }
@@ -670,6 +687,8 @@ void AliJetModelBaseTask::CopyCells()
   if (!fCaloCells)
     return;
 
+  fAddedCells = 0;
+  fCaloCells->Sort();
   for (Short_t i = 0; i < fCaloCells->GetNumberOfCells(); i++) {
     Int_t mclabel = 0;
     Double_t efrac = 0.;
@@ -683,10 +702,9 @@ void AliJetModelBaseTask::CopyCells()
       mclabel = 0;
 
     fOutCaloCells->SetCell(i, cellNum, amp, time, mclabel, efrac);
+    fAddedCells++;
   }
 
-  fAddedCells = fCaloCells->GetNumberOfCells();
-
   AliDebug(2, Form("%d cells from the current event", fAddedCells));
 }
 
index 3f7bf2ba0ade1ea4c346d55b1ac38d0d28f10640..2bdca64ce494ef1797438260fc13c08f776fd921 100644 (file)
@@ -65,6 +65,7 @@ AliJetResponseMaker::AliJetResponseMaker() :
   fHistTrials(0),
   fHistXsection(0),
   fHistEvents(0),
+  fMCEnergy1vsEnergy2(0),
   fHistJets1PhiEta(0),
   fHistJets1PtArea(0),
   fHistJets1CorrPtArea(0),
@@ -169,6 +170,7 @@ AliJetResponseMaker::AliJetResponseMaker(const char *name) :
   fHistTrials(0),
   fHistXsection(0),
   fHistEvents(0),
+  fMCEnergy1vsEnergy2(0),
   fHistJets1PhiEta(0),
   fHistJets1PtArea(0),
   fHistJets1CorrPtArea(0),
@@ -406,6 +408,14 @@ void AliJetResponseMaker::UserCreateOutputObjects()
     }
   }
 
+  if (fIsEmbedded) {
+    fMCEnergy1vsEnergy2 = new TH2F("fMCEnergy1vsEnergy2", "fMCEnergy1vsEnergy2", fNbins, fMinBinPt, fMaxBinPt*4, fNbins, fMinBinPt, fMaxBinPt*4);
+    fMCEnergy1vsEnergy2->GetXaxis()->SetTitle("#Sigmap_{T,1}^{MC}");
+    fMCEnergy1vsEnergy2->GetYaxis()->SetTitle("#Sigmap_{T,2}");
+    fMCEnergy1vsEnergy2->GetZaxis()->SetTitle("counts");
+    fOutput->Add(fMCEnergy1vsEnergy2);
+  }
+
   // Jets 1 histograms
   fHistLeadingJets1PtArea = new TH2F("fHistLeadingJets1PtArea", "fHistLeadingJets1PtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt);
   fHistLeadingJets1PtArea->GetXaxis()->SetTitle("area");
@@ -1050,6 +1060,13 @@ void AliJetResponseMaker::DoJetLoop(Bool_t order)
     }
 
     jet2->ResetMatching();
+
+
+    if (!AcceptJet(jet2))
+      continue;
+
+    if (jet2->Eta() < fJet2MinEta || jet2->Eta() > fJet2MaxEta || jet2->Phi() < fJet2MinPhi || jet2->Phi() > fJet2MaxPhi)
+      continue;
   }
     
   for (Int_t i = 0; i < nJets1; i++) {
@@ -1066,6 +1083,9 @@ void AliJetResponseMaker::DoJetLoop(Bool_t order)
     if (!AcceptJet(jet1))
       continue;
 
+    if (jet1->MCPt() < 1)
+      continue;
+
     if (order) {
      if (jet1->Eta() < fJet2MinEta || jet1->Eta() > fJet2MaxEta || jet1->Phi() < fJet2MinPhi || jet1->Phi() > fJet2MaxPhi)
        continue;
@@ -1092,7 +1112,7 @@ void AliJetResponseMaker::DoJetLoop(Bool_t order)
          continue;
       }
       else {
-       if (jet1->Eta() < fJet2MinEta || jet1->Eta() > fJet2MaxEta || jet1->Phi() < fJet2MinPhi || jet1->Phi() > fJet2MaxPhi)
+       if (jet2->Eta() < fJet2MinEta || jet2->Eta() > fJet2MaxEta || jet2->Phi() < fJet2MinPhi || jet2->Phi() > fJet2MaxPhi)
          continue;
       }
 
@@ -1392,6 +1412,8 @@ Bool_t AliJetResponseMaker::FillHistograms()
   Int_t naccJets2 = 0;
   Int_t naccJets2Acceptance = 0;
 
+  Double_t totalPt2 = 0;
+
   for (Int_t i = 0; i < nJets2; i++) {
 
     AliEmcalJet* jet2 = static_cast<AliEmcalJet*>(fJets2->At(indexes[i]));
@@ -1409,6 +1431,8 @@ Bool_t AliJetResponseMaker::FillHistograms()
       
       fHistJets2PtAreaAcceptance->Fill(jet2->Area(), jet2->Pt());
       fHistJets2PhiEtaAcceptance->Fill(jet2->Eta(), jet2->Phi());
+
+      totalPt2 += jet2->Pt();
       
       if (naccJets2Acceptance < fNLeadingJets)
        fHistLeadingJets2PtAreaAcceptance->Fill(jet2->Area(), jet2->Pt());
@@ -1566,6 +1590,7 @@ Bool_t AliJetResponseMaker::FillHistograms()
 
   const Int_t nJets1 = fJets->GetEntriesFast();
   Int_t naccJets1 = 0;
+  Double_t totalMCPt1 = 0;
 
   for (Int_t i = 0; i < nJets1; i++) {
 
@@ -1598,6 +1623,8 @@ Bool_t AliJetResponseMaker::FillHistograms()
     fHistJets1PtArea->Fill(jet1->Area(), jet1->Pt());
     fHistJets1PhiEta->Fill(jet1->Eta(), jet1->Phi());
 
+    totalMCPt1 += jet1->MCPt();
+
     if (naccJets1 < fNLeadingJets)
       fHistLeadingJets1PtArea->Fill(jet1->Area(), jet1->Pt());
 
@@ -1634,5 +1661,8 @@ Bool_t AliJetResponseMaker::FillHistograms()
     naccJets1++;
   }
 
+  if (fIsEmbedded) 
+    fMCEnergy1vsEnergy2->Fill(totalMCPt1, totalPt2);
+
   return kTRUE;
 }
index 9d48b99fccae63298c31f378fa59f143d75c2bd2..ac8bfa6001306ce1caaf341d6fd0b187caa276fd 100644 (file)
@@ -93,6 +93,7 @@ class AliJetResponseMaker : public AliAnalysisTaskEmcalJet {
   TH1                        *fHistTrials;                             //!trials from pyxsec.root
   TProfile                   *fHistXsection;                           //!x section from pyxsec.root
   TH1                        *fHistEvents;                             //!total number of events per pt hard bin
+  TH2                        *fMCEnergy1vsEnergy2;                     //!total MC energy jet 1 vs total energy jet 2
   // Jets 1
   TH2                        *fHistJets1PhiEta;                        //!phi-eta distribution of jets 1
   TH2                        *fHistJets1PtArea;                        //!inclusive jet pt vs area histogram 1
index 07636a7da8d5efa9981ad44f98ea3c6fbc12ae28..deba4f7615b7abac7540dd4f2fdab90d243c23fa 100644 (file)
@@ -60,6 +60,7 @@ AliJetEmbeddingFromAODTask* AddTaskJetEmbeddingFromAOD(
   jetEmb->SetTriggerMask(mask);
   jetEmb->SetCopyArray(copyArray);
   jetEmb->SetNClusters(1);
+  jetEmb->SetMarkMC(0);
 
   jetEmb->SetIncludeNoITS(includeNoITS);
   TString runPeriod(runperiod);
index 52f62d998f95738ddd23c3942f11478d8307277c..972e0415d88ff8f676cbc5cea2e111f4b9faae6f 100644 (file)
@@ -63,6 +63,8 @@ AliJetEmbeddingFromPYTHIATask* AddTaskJetEmbeddingFromPYTHIA(
   jetEmb->SetCopyArray(copyArray);
   jetEmb->SetJetMinPt(minJetPt);
   jetEmb->SetNClusters(1);
+  jetEmb->SetMarkMC(0);
+
   if (strcmp(fileTable, "") != 0)
     jetEmb->SetFileTable(GenerateFileTable(fileTable));