]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added task for efficiency computation, aligned with revised code.
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Aug 2010 12:34:38 +0000 (12:34 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Aug 2010 12:34:38 +0000 (12:34 +0000)
Added addTask macros for alternative analysis tasks

PWG2/PWG2resonancesLinkDef.h
PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx
PWG2/RESONANCES/AliRsnAnalysisEffSE.h
PWG2/RESONANCES/macros/test/AddTaskAnalysisMonitor.C [new file with mode: 0644]
PWG2/RESONANCES/macros/test/AddTaskAnalysisPhi7TeV.C [new file with mode: 0644]
PWG2/RESONANCES/macros/test/ConfigTaskRsnTest.C
PWG2/RESONANCES/macros/test/ConfigTaskRsnTest2010.C [new file with mode: 0644]
PWG2/RESONANCES/macros/test/runLocal.C
PWG2/libPWG2resonances.pkg

index 3248077911374910e237f4953c03d3300a55cd34..0e72730ffe7bb1b533be9232941f9fb34e4d7f1c 100644 (file)
@@ -34,7 +34,7 @@
 
 #pragma link C++ class AliRsnAnalysisSE+;
 #pragma link C++ class AliRsnAnalysisME+;
-//#pragma link C++ class AliRsnAnalysisEffSE+;
+#pragma link C++ class AliRsnAnalysisEffSE+;
 
 #pragma link C++ class AliRsnTOFT0maker+;
 #pragma link C++ class AliRsnAnalysisPhi900GeV+;
index ad6680a63eba97c4cfa33a285548efc909ab9acb..c1369cb3769f68b61d6a17b950e7fe2cc5d6abe4 100644 (file)
@@ -24,12 +24,15 @@ ClassImp(AliRsnAnalysisEffSE)
 //_____________________________________________________________________________
 AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const char *name) :
   AliRsnVAnalysisTaskSE(name),
+  fUseITSSA(kTRUE),
+  fUseGlobal(kTRUE),
   fEventCuts(0x0),
   fStepListMC(0),
   fStepListESD(0),
   fAxisList(0),
   fPairDefList(0),
   fContainerList(0x0),
+  fOutList(0x0),
   fVar(0),
   fPair()
 {
@@ -47,12 +50,15 @@ AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const char *name) :
 //_____________________________________________________________________________
 AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const AliRsnAnalysisEffSE& copy) :
   AliRsnVAnalysisTaskSE(copy),
+  fUseITSSA(copy.fUseITSSA),
+  fUseGlobal(copy.fUseGlobal),
   fEventCuts(copy.fEventCuts),
   fStepListMC(copy.fStepListMC),
   fStepListESD(copy.fStepListESD),
   fAxisList(copy.fAxisList),
   fPairDefList(copy.fPairDefList),
   fContainerList(copy.fContainerList),
+  fOutList(0x0),
   fVar(0),
   fPair()
 {
@@ -91,13 +97,13 @@ void AliRsnAnalysisEffSE::RsnUserCreateOutputObjects()
   fVar.Set(nAxes);
 
   // retrieve number of bins for each axis
-  Int_t   *nBins     = new Int_t[nAxes];
-  TArrayD *binLimits = new TArrayD[nAxes];
+  Int_t   *nBins = new Int_t[nAxes];
+  TArrayD *array = new TArrayD[nAxes];
   for (iaxis = 0; iaxis < nAxes; iaxis++) 
   {
     AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
-    binLimits[iaxis] = fcnAxis->GetArray();
-    nBins[iaxis] = binLimits[iaxis].GetSize() - 1;
+    array[iaxis] = fcnAxis->GetArray();
+    nBins[iaxis] = array[iaxis].GetSize() - 1;
   }
 
   // create ouput list of containers
@@ -107,23 +113,24 @@ void AliRsnAnalysisEffSE::RsnUserCreateOutputObjects()
 
   // initialize output list
   OpenFile(2);
-  fOutList[1] = new TList();
-  fOutList[1]->SetOwner();
+  fOutList = new TList();
+  fOutList->SetOwner();
 
   // create the containers
   Int_t i, nDef = (Int_t)fPairDefList.GetEntries();
-  for (i = 0; i < nDef; i++) {
+  for (i = 0; i < nDef; i++) 
+  {
     AliRsnPairDef *def = (AliRsnPairDef*)fPairDefList[i];
-    AliCFContainer *cont = new AliCFContainer(Form("%s", def->GetPairName().Data()), "", nSteps, nAxes, nBins);
+    AliCFContainer *cont = new AliCFContainer(Form("%s", def->GetPairName()), "", nSteps, nAxes, nBins);
     // set the bin limits for each axis
-    for (iaxis = 0; iaxis < nAxes; iaxis++) cont->SetBinLimits(iaxis, binLimits[iaxis].GetArray());
+    for (iaxis = 0; iaxis < nAxes; iaxis++) cont->SetBinLimits(iaxis, array[iaxis].GetArray());
     // add the container to output list
     fContainerList->Add(cont);
   }
 
-  fOutList[1]->Add(fContainerList);
+  fOutList->Add(fContainerList);
 
-  PostData(2, fOutList[1]);
+  PostData(2, fOutList);
 
   AliDebug(AliLog::kDebug+2,"->");
 }
@@ -183,8 +190,9 @@ void AliRsnAnalysisEffSE::RsnUserExec(Option_t*)
   // they are checked here on the RSN event interface and,
   // if the event does not pass them, it is skipped and ProcessInfo
   // is updated accordingly
-  if (fEventCuts) {
-    if (!fEventCuts->IsSelected(AliRsnCut::kEvent, &fRsnEvent)) {
+  if (fEventCuts) 
+  {
+    if (!fEventCuts->IsSelected(&fRsnEvent)) {
       fTaskInfo.SetEventUsed(kFALSE);
       return;
     }
@@ -199,24 +207,160 @@ void AliRsnAnalysisEffSE::RsnUserExec(Option_t*)
   TObjArrayIter iter(&fPairDefList);
   while ( (pairDef = (AliRsnPairDef*)iter.Next()) )
   {
-    ProcessEventMC(pairDef);
-    ProcessEventESD(pairDef);
+    //ProcessEventMC(pairDef);
+    //ProcessEventESD(pairDef);
+    ProcessEvent(pairDef);
   }
 
   // Post the data
-  PostData(2, fOutList[1]);
+  PostData(2, fOutList);
 
   AliDebug(AliLog::kDebug+2,"->");
 }
 
 //_____________________________________________________________________________
-void AliRsnAnalysisEffSE::ProcessEventMC(AliRsnPairDef *pairDef)
+void AliRsnAnalysisEffSE::ProcessEvent(AliRsnPairDef *pairDef)
+{
+//
+// Process current event with the definitions of the specified step in MC list
+// and store results in the container slot defined in second argument.
+// It is associated with the AliCFContainer with the name of the pair.
+//
+
+  AliStack      *stack = fRsnEvent.GetRefMC()->Stack();
+  AliESDEvent   *esd   = fRsnEvent.GetRefESD();
+  AliMCEvent    *mc    = fRsnEvent.GetRefMC();
+  AliMCParticle *mother;
+
+  if (!pairDef) return;
+  AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
+  if (!cont) return;
+  
+  // get informations from pairDef
+  Int_t pdgM = 0, pdgD[2] = {0, 0};
+  Short_t chargeD[2] = {0, 0};
+  pdgM    = pairDef->GetMotherPDG();
+  pdgD[0] = AliPID::ParticleCode(pairDef->GetPID(0));
+  pdgD[1] = AliPID::ParticleCode(pairDef->GetPID(1));
+  chargeD[0] = pairDef->GetChargeShort(0);
+  chargeD[1] = pairDef->GetChargeShort(1);
+
+  // other utility variables
+  Int_t   label[2] = {-1, -1}, first, j, ipart;
+  Short_t charge[2] = {0, 0};
+  Short_t pairDefMatch[2] = {-1, -1};
+  Int_t   esdIndex[2];
+  TParticle *part[2] = {0, 0};
+
+  // in this case, we first take the resonance from MC
+  // and then we find its daughters and compute cuts on them
+  for (ipart = 0; ipart < stack->GetNprimary(); ipart++) 
+  {
+    // take a track from the MC event
+    mother = (AliMCParticle*) fMCEvent->GetTrack(ipart);
+    
+    // check that it is a binary decay and the PDG code matches
+    if (mother->Particle()->GetNDaughters() != 2) continue;
+    if (mother->Particle()->GetPdgCode() != pdgM) continue;
+
+    // store the labels of the two daughters
+    label[0] = mother->Particle()->GetFirstDaughter();
+    label[1] = mother->Particle()->GetLastDaughter();
+    
+    // retrieve the particles and other stuff
+    // check if they match the order in the pairDef
+    for (j = 0; j < 2; j++)
+    {
+      if (label[j] < 0) continue;
+      part[j]   = stack->Particle(label[j]);
+      pdgD[j]    = TMath::Abs(part[j]->GetPdgCode());
+      charge[j] = (Short_t)(part[j]->GetPDG()->Charge() / 3);
+      if (pdgD[j] == pairDef->GetPID(0) && charge[j] == pairDef->GetChargeShort(0))
+        pairDefMatch[j] = 0;
+      else if (pdgD[j] == pairDef->GetPID(1) && charge[j] == pairDef->GetChargeShort(1))
+        pairDefMatch[j] = 1;
+      else
+        pairDefMatch[j] = -1;
+        
+      // find corresponding ESD particle: first try rejecting fakes,
+      // and in case of failure, try accepting fakes
+      esdIndex[j] = FindESDtrack(label[j], esd, kTRUE);
+      if (esdIndex[j] < 0) esdIndex[j] = FindESDtrack(label[j], esd, kFALSE);
+    }
+    
+    // since each candidate good resonance is taken once, we must check
+    // that it matches the pair definition in any order, and reject in case
+    // in none of them the pair is OK
+    // anyway, we must associate the correct daughter to the correct data member
+    if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
+    {
+      // 1st track --> 1st member of PairDef
+      fDaughter[0].SetRef(mc->GetTrack(label[0]));
+      fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
+      fDaughter[0].SetGood();
+      // 2nd track --> 2nd member of PairDef
+      fDaughter[1].SetRef(mc->GetTrack(label[1]));
+      fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
+      fDaughter[1].SetGood();
+    }
+    else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
+    {
+      // 1st track --> 2nd member of PairDef
+      fDaughter[0].SetRef(mc->GetTrack(label[1]));
+      fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
+      fDaughter[0].SetGood();
+      // 2nd track --> 1st member of PairDef
+      fDaughter[1].SetRef(mc->GetTrack(label[0]));
+      fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
+      fDaughter[0].SetGood();
+    }
+    else
+    {
+      fDaughter[0].SetBad();
+      fDaughter[1].SetBad();
+    }
+    
+    // reject the pair if the matching was unsuccessful
+    if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
+    
+    // first, we set the internal AliRsnMother object to
+    // the MC particles and then operate the selections on MC
+    fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1));
+    FillContainer(cont, &fStepListMC, pairDef, 0);
+    
+    // then, if both particles found a good match in the ESD
+    // reassociate the ESD tracks to the pair and fill ESD containers
+    if (esdIndex[0] < 0 || esdIndex[1] < 0) continue;
+    if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
+    {
+      // 1st track --> 1st member of PairDef
+      fDaughter[0].SetRef(esd->GetTrack(esdIndex[0]));
+      // 2nd track --> 2nd member of PairDef
+      fDaughter[1].SetRef(mc->GetTrack(esdIndex[1]));
+    }
+    else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
+    {
+      // 1st track --> 2nd member of PairDef
+      fDaughter[0].SetRef(esd->GetTrack(esdIndex[1]));
+      // 2nd track --> 1st member of PairDef
+      fDaughter[1].SetRef(esd->GetTrack(esdIndex[0]));
+    }
+    fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1));
+    // here we must remember how many steps were already filled
+    first = (Int_t)fStepListMC.GetEntries();
+    FillContainer(cont, &fStepListESD, pairDef, first);
+  }
+}
+
+//_____________________________________________________________________________
+void AliRsnAnalysisEffSE::ProcessEventMC(AliRsnPairDef */*pairDef*/)
 {
 //
 // Process current event with the definitions of the specified step in MC list
 // and store results in the container slot defined in second argument
 //
 
+  /*
   AliStack      *stack = fMCEvent->Stack();
   AliMCParticle *mother, *daughter;
 
@@ -229,17 +373,19 @@ void AliRsnAnalysisEffSE::ProcessEventMC(AliRsnPairDef *pairDef)
 
   // in this case, we first take the resonance from MC
   // and then we find its daughters and compute cuts on them
-  for (ipart = 0; ipart < stack->GetNprimary(); ipart++) {
+  for (ipart = 0; ipart < stack->GetNprimary(); ipart++) 
+  {
     mother = (AliMCParticle*) fMCEvent->GetTrack(ipart);
     if (mother->Particle()->GetNDaughters() != 2) continue;
 
     i[0] = mother->Particle()->GetFirstDaughter();
     i[1] = mother->Particle()->GetLastDaughter();
 
-    for (j = 0; j < 2; j++) {
+    for (j = 0; j < 2; j++) 
+    {
       daughter = (AliMCParticle*) fMCEvent->GetTrack(i[j]);
       fDaughter[j].SetRef(daughter);
-      fDaughter[j].SetParticle(daughter->Particle());
+      fDaughter[j].SetRefMC(daughter);
       fDaughter[j].FindMotherPDG(stack);
     }
 
@@ -253,16 +399,18 @@ void AliRsnAnalysisEffSE::ProcessEventMC(AliRsnPairDef *pairDef)
     // create pair
     FillContainer(cont, &fStepListMC, pairDef, 0);
   }
+  */
 }
 
 //_____________________________________________________________________________
-void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef *pairDef)
+void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef */*pairDef*/)
 {
 //
 // Process current event with the definitions of the specified step in ESD list
 // and store results in the container slot defined in second argument
 //
 
+  /*
   Int_t i0, i1, first = (Int_t)fStepListMC.GetEntries();
 
   if (!pairDef) return;
@@ -289,6 +437,7 @@ void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef *pairDef)
       FillContainer(cont, &fStepListESD, pairDef, first);
     }
   }
+  */
 }
 
 //_____________________________________________________________________________
@@ -302,26 +451,22 @@ void AliRsnAnalysisEffSE::FillContainer(AliCFContainer *cont, const TObjArray *s
   Int_t istep, nSteps = stepList->GetEntries();
 
   // compute values for all axes
-  for (iaxis = 0; iaxis < nAxes; iaxis++) {
+  for (iaxis = 0; iaxis < nAxes; iaxis++) 
+  {
     AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
-    switch (fcnAxis->GetAxisObject()) {
-    case AliRsnValue::kPair:
-      fVar[iaxis] = (Double_t)fcnAxis->Eval(&fPair, pd);
-      break;
-    case AliRsnValue::kEvent:
-      fVar[iaxis] = (Double_t)fcnAxis->Eval(&fRsnEvent);
-      break;
-    default:
-      fVar[iaxis] = 0.0;
-    }
+    fVar[iaxis] = -1E10;
+    if (fcnAxis->Eval(&fPair, pd, &fRsnEvent)) fVar[iaxis] = (Float_t)fcnAxis->GetValue();
   }
 
   // fill all steps
-  for (istep = 0; istep < nSteps; istep++) {
+  for (istep = 0; istep < nSteps; istep++) 
+  {
     AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep);
-    if (!cutMgr->IsSelected(AliRsnCut::kParticle, &fDaughter[0])) break;
-    if (!cutMgr->IsSelected(AliRsnCut::kParticle, &fDaughter[1])) break;
-    if (!cutMgr->IsSelected(AliRsnCut::kPair,     &fPair)) break;
+    if (!cutMgr->PassCommonDaughterCuts(fPair.GetDaughter(0))) break;
+    if (!cutMgr->PassCommonDaughterCuts(fPair.GetDaughter(1))) break;
+    if (!cutMgr->PassDaughter1Cuts(fPair.GetDaughter(0))) break;
+    if (!cutMgr->PassDaughter2Cuts(fPair.GetDaughter(1))) break;
+    if (!cutMgr->PassMotherCuts(&fPair)) break;
     cont->Fill(fVar.GetArray(), istep + firstOutStep);
   }
 }
@@ -347,3 +492,70 @@ void AliRsnAnalysisEffSE::AddPairDef(AliRsnPairDef* pairDef)
   fPairDefList.AddLast(pairDef);
 }
 
+//_____________________________________________________________________________
+Int_t AliRsnAnalysisEffSE::FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t rejectFakes)
+{
+//
+// Finds in the ESD a track whose label corresponds to that in argument.
+// When global tracks are enabled, tries first to find a global track 
+// satisfying that requirement.
+// If no global tracks are found, if ITS-SA are enable, tries to search among them
+// otherwise return a negative number.
+// If global tracks are disabled, search only among ITS SA
+//
+
+  Int_t i = 0;
+  Int_t ntracks = esd->GetNumberOfTracks();
+  
+  // loop for global tracks
+  if (fUseGlobal)
+  {
+    for (i = 0; i < ntracks; i++)
+    {
+      AliESDtrack *track = esd->GetTrack(i);
+      
+      // check that label match
+      if (TMath::Abs(track->GetLabel()) != label) continue;
+      
+      // check global flags
+      if (!track->IsOn(AliESDtrack::kTPCin)) continue;
+      
+      // if required, reject fakes
+      if (rejectFakes && track->GetLabel() < 0) continue;
+      
+      // if all checks are passed and we are searching among global
+      // this means that thie track is a global one with the right label
+      // then, the return value is set to this, and returned
+      return i;
+    }
+  }
+  
+  // loop for ITS-SA tracks (this happens only if no global tracks were found
+  // or searching among globals is disabled)
+  if (fUseITSSA)
+  {
+    for (i = 0; i < ntracks; i++)
+    {
+      AliESDtrack *track = esd->GetTrack(i);
+      
+      // check that label match
+      if (TMath::Abs(track->GetLabel()) != label) continue;
+      
+      // check global flags
+      if (!fUseGlobal && !track->IsOn(AliESDtrack::kITSpureSA)) continue;
+      if (track->IsOn(AliESDtrack::kTPCin)) continue;
+      if (!track->IsOn(AliESDtrack::kITSrefit)) continue;
+      
+      // if required, reject fakes
+      if (rejectFakes && track->GetLabel() < 0) continue;
+      
+      // if all checks are passed and we are searching among global
+      // this means that thie track is a global one with the right label
+      // then, the return value is set to this, and returned
+      return i;
+    }
+  }
+  
+  // if we reach this point, no match were found
+  return -1;
+}
index 1eb2b8959f61c63dbfe8eed582f58b78720b6e50..b30d5f761e8b03777eb77462550098b598b08c4a 100644 (file)
@@ -51,16 +51,21 @@ class AliRsnAnalysisEffSE : public AliRsnVAnalysisTaskSE
   private:
 
     AliRsnAnalysisEffSE& operator=(const AliRsnAnalysisEffSE& /*copy*/) {return *this;}
+    void                 ProcessEvent(AliRsnPairDef *pairDef);
     void                 ProcessEventMC(AliRsnPairDef *pairDef);
     void                 ProcessEventESD(AliRsnPairDef *pairDef);
     void                 FillContainer(AliCFContainer *cont, const TObjArray *stepList, AliRsnPairDef *pd, Int_t firstOutStep);
+    Int_t                FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t rejectFakes);
 
+    Bool_t                fUseITSSA;                // switch to use ITS standalone tracks
+    Bool_t                fUseGlobal;               // switch to use global tracks
     AliRsnCutSet         *fEventCuts;               // event cuts
     TObjArray             fStepListMC;              // list of cut managers for all steps with MC
     TObjArray             fStepListESD;             // list of cut managers for all steps with ESD
     TObjArray             fAxisList;                // list of axes of efficiency plots
     TObjArray             fPairDefList;             // decay channels
     TList                *fContainerList;           // list of CF containers
+    TList                *fOutList;                 // global output list
     TArrayD               fVar;                     // list of variables of the container
     AliRsnMother          fPair;                    // interface to pair
     AliRsnDaughter        fDaughter[2];             // interface to tracks
diff --git a/PWG2/RESONANCES/macros/test/AddTaskAnalysisMonitor.C b/PWG2/RESONANCES/macros/test/AddTaskAnalysisMonitor.C
new file mode 100644 (file)
index 0000000..c8956ba
--- /dev/null
@@ -0,0 +1,106 @@
+//
+// Macro to create the full analysis manager for Resonances
+//
+Bool_t AddTaskAnalysisMonitor
+(
+  const char *dataType,
+  const char *outName = "monitor.root"
+)
+{
+  // convert the last argument into a BOOL variable
+  Bool_t isMC = kTRUE;
+  if (!strcmp(dataType, "7TeV_pass1_data")) isMC = kFALSE;
+  if (!strcmp(dataType, "7TeV_pass2_data")) isMC = kFALSE;
+  
+  // retrieve analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  
+  /* promemoria TOF
+  - dati pass1
+  calibrateESD = kTRUE
+  correctTExp = kTRUE
+  useT0TOF = kTRUE
+  timeResolution = 100.
+  tuneTOFMC = kFALSE
+
+  - dati pass2
+  idem, anche se in teoria potresti usare
+  calibrateESD = kFALSE
+  suggerirei di lasciare come pass1
+
+  - MC tunato
+  calibrateESD = kFALSE
+  correctTExp = kTRUE
+  useT0TOF = kTRUE
+  timeResolution = 100.
+  tuneTOFMC = kTRUE
+  */
+
+  // add task macro
+  AliRsnAnalysisMonitorTask *task = new AliRsnAnalysisMonitorTask("taskRsnMonitor");
+  task->SelectCollisionCandidates();
+  task->SetTPCbands(5.0, 3.0);
+  task->SetTPClargeBandLimit(0.35);
+  task->SetITSband(4.0);
+  if (isMC) task->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
+  else      task->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
+  
+  // TPC cuts
+  task->GetCutsTPC().SetRequireTPCStandAlone(kTRUE); // to get chi2 and ncls of kTPCin
+  task->GetCutsTPC().SetMinNClustersTPC(70);
+  task->GetCutsTPC().SetMaxChi2PerClusterTPC(4);
+  task->GetCutsTPC().SetAcceptKinkDaughters(kFALSE);
+  task->GetCutsTPC().SetRequireTPCRefit(kTRUE);
+  // ITS
+  task->GetCutsTPC().SetRequireITSRefit(kTRUE);
+  task->GetCutsTPC().SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
+  task->GetCutsTPC().SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9");
+  task->GetCutsTPC().SetMaxDCAToVertexZ(1e6);
+  task->GetCutsTPC().SetDCAToVertex2D(kFALSE);
+  task->GetCutsTPC().SetRequireSigmaToVertex(kFALSE);
+  //esdTrackCuts->SetEtaRange(-0.8,+0.8);
+  
+  //task->GetCutsITS().SetRequireITSStandAlone(kTRUE);
+  //task->GetCutsITS().SetRequireITSPureStandAlone(kFALSE);
+  task->GetCutsITS().SetRequireITSRefit(kTRUE); 
+  task->GetCutsITS().SetMinNClustersITS(4);
+  task->GetCutsITS().SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  task->GetCutsITS().SetMaxChi2PerClusterITS(1.);
+  task->GetCutsITS().SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
+  task->GetCutsTPC().SetMaxDCAToVertexZ(1e6);
+  //task->GetCutsITS().SetRequireITSPid(kTRUE);
+  
+  if (!strcmp(dataType, "7TeV_pass1_data"))
+  {
+    task->SetTOFcalibrateESD(kTRUE);
+    task->SetTOFcorrectTExp(kTRUE);
+    task->SetTOFuseT0(kTRUE);
+    task->SetTOFtuneMC(kFALSE);
+    task->SetTOFresolution(100.0);
+  }
+  if (!strcmp(dataType, "7TeV_pass2_data"))
+  {
+    task->SetTOFcalibrateESD(kTRUE);  // potrebbe anche essere kFALSE
+    task->SetTOFcorrectTExp(kTRUE);
+    task->SetTOFuseT0(kTRUE);
+    task->SetTOFtuneMC(kFALSE);
+    task->SetTOFresolution(100.0);
+  }
+  else if (!strcmp(dataType, "7TeV_pass2_sim"))
+  {
+    task->SetTOFcalibrateESD(kFALSE);
+    task->SetTOFcorrectTExp(kTRUE);
+    task->SetTOFuseT0(kTRUE);
+    task->SetTOFtuneMC(kTRUE);
+    task->SetTOFresolution(100.0);
+  }
+  mgr->AddTask(task);
+  
+  // create containers for input/output
+  AliAnalysisDataContainer *out = mgr->CreateContainer("all" , TTree::Class(), AliAnalysisManager::kOutputContainer, outName);
+  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(task, 1, out);
+
+  return kTRUE;
+}
diff --git a/PWG2/RESONANCES/macros/test/AddTaskAnalysisPhi7TeV.C b/PWG2/RESONANCES/macros/test/AddTaskAnalysisPhi7TeV.C
new file mode 100644 (file)
index 0000000..faaa542
--- /dev/null
@@ -0,0 +1,118 @@
+//
+// Macro to create the full analysis manager for Resonances
+//
+Bool_t AddTaskAnalysisPhi7TeV
+(
+  const char *dataType,
+  const char *outName = "phi7TeV.root",
+
+)
+{
+  // convert the last argument into a BOOL variable
+  Bool_t isMC = kTRUE;
+  if (!strcmp(dataType, "7TeV_pass1_data")) isMC = kFALSE;
+  if (!strcmp(dataType, "7TeV_pass2_data")) isMC = kFALSE;
+  
+  // convert the last argument into a BOOL variable
+  Bool_t isMC = kTRUE;
+  if (!strcmp(dataType, "7TeV_pass2_data")) isMC = kFALSE;
+  
+  // retrieve analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  
+  /* promemoria TOF
+  - dati pass1
+  calibrateESD = kTRUE
+  correctTExp = kTRUE
+  useT0TOF = kTRUE
+  timeResolution = 100.
+  tuneTOFMC = kFALSE
+
+  - dati pass2
+  idem, anche se in teoria potresti usare
+  calibrateESD = kFALSE
+  suggerirei di lasciare come pass1
+
+  - MC tunato
+  calibrateESD = kFALSE
+  correctTExp = kTRUE
+  useT0TOF = kTRUE
+  timeResolution = 100.
+  tuneTOFMC = kTRUE
+  */
+
+  // add task macro
+  AliRsnAnalysisPhi7TeV *task = new AliRsnAnalysisPhi7TeV("taskRsnMonitor");
+  
+  task->SelectCollisionCandidates();
+  
+  task->SetMaxVz(10.0);
+  task->SetUseMC(kFALSE);
+  task->SetTPCrange(5.0, 3.0);
+  task->SetTPCpLimit(0.35);
+  task->SetITSband(4.0);
+  if (isMC) task->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
+  else      task->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
+  
+  // TPC cuts
+  task->GetCutsTPC()->SetRequireTPCStandAlone(kTRUE); // to get chi2 and ncls of kTPCin
+  task->GetCutsTPC()->SetMinNClustersTPC(70);
+  task->GetCutsTPC()->SetMaxChi2PerClusterTPC(4);
+  task->GetCutsTPC()->SetAcceptKinkDaughters(kFALSE);
+  task->GetCutsTPC()->SetRequireTPCRefit(kTRUE);
+  // ITS
+  task->GetCutsTPC()->SetRequireITSRefit(kTRUE);
+  task->GetCutsTPC()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
+  task->GetCutsTPC()->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9");
+  task->GetCutsTPC()->SetMaxDCAToVertexZ(1e6);
+  task->GetCutsTPC()->SetDCAToVertex2D(kFALSE);
+  task->GetCutsTPC()->SetRequireSigmaToVertex(kFALSE);
+  
+  //task->GetCutsITS()->SetRequireITSStandAlone(kTRUE);
+  //task->GetCutsITS()->SetRequireITSPureStandAlone(kFALSE);
+  task->GetCutsITS()->SetRequireITSRefit(kTRUE); 
+  task->GetCutsITS()->SetMinNClustersITS(4);
+  task->GetCutsITS()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  task->GetCutsITS()->SetMaxChi2PerClusterITS(1.);
+  task->GetCutsITS()->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
+  task->GetCutsTPC()->SetMaxDCAToVertexZ(1e6);
+  //task->GetCutsITS()->SetRequireITSPid(kTRUE);
+  
+  if (!strcmp(dataType, "7TeV_pass1_data"))
+  {
+    task->SetTOFcalibrateESD(kTRUE);
+    task->SetTOFcorrectTExp(kTRUE);
+    task->SetTOFuseT0(kTRUE);
+    task->SetTOFtuneMC(kFALSE);
+    task->SetTOFresolution(100.0);
+  }
+  if (!strcmp(dataType, "7TeV_pass2_data"))
+  {
+    task->SetTOFcalibrateESD(kTRUE);  // potrebbe anche essere kFALSE
+    task->SetTOFcorrectTExp(kTRUE);
+    task->SetTOFuseT0(kTRUE);
+    task->SetTOFtuneMC(kFALSE);
+    task->SetTOFresolution(100.0);
+  }
+  else if (!strcmp(dataType, "7TeV_pass2_sim"))
+  {
+    task->SetTOFcalibrateESD(kFALSE);
+    task->SetTOFcorrectTExp(kTRUE);
+    task->SetTOFuseT0(kTRUE);
+    task->SetTOFtuneMC(kTRUE);
+    task->SetTOFresolution(100.0);
+  }
+  mgr->AddTask(task);
+  
+  // create containers for input/output
+  AliAnalysisDataContainer *out1 = mgr->CreateContainer("all" , TTree::Class(), AliAnalysisManager::kOutputContainer, outName);
+  AliAnalysisDataContainer *out2 = mgr->CreateContainer("rsn" , TTree::Class(), AliAnalysisManager::kOutputContainer, outName);
+  AliAnalysisDataContainer *out3 = mgr->CreateContainer("info", TList::Class(), AliAnalysisManager::kOutputContainer, outName);
+  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(task, 1, out1);
+  mgr->ConnectOutput(task, 2, out2);
+  mgr->ConnectOutput(task, 3, out3);
+
+  return kTRUE;
+}
index 407b7cd526bf3a1df9c3c158b15fc7b54e9c5e6b..50b661d94f9f833b84f24ecc1e6b1efabeeca40d 100644 (file)
@@ -120,16 +120,16 @@ Bool_t RsnConfigTask(AliRsnAnalysisSE* &task, const char *dataLabel)
   AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
 
   // --> add related cuts
-  cutSetDaughterCommon->AddCut(cuts2010);
-  cutSetDaughterCommon->AddCut(cutPID);
+  //cutSetDaughterCommon->AddCut(cuts2010);
+  //cutSetDaughterCommon->AddCut(cutPID);
 
   // --> define schemes
-  cutSetDaughterCommon->SetCutScheme("cuts2010&cutPID");
+  //cutSetDaughterCommon->SetCutScheme("cuts2010&cutPID");
    
   // cut managers
   // define a proper name for each mult bin, to avoid omonyme output histos
-  pairPMhist->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
-  pairPMntp ->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
+  //pairPMhist->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
+  //pairPMntp ->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
 
   // function axes
   Double_t ybins[] = {-0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8};
diff --git a/PWG2/RESONANCES/macros/test/ConfigTaskRsnTest2010.C b/PWG2/RESONANCES/macros/test/ConfigTaskRsnTest2010.C
new file mode 100644 (file)
index 0000000..867254d
--- /dev/null
@@ -0,0 +1,221 @@
+//
+// This function configures the entire task for all resonances the user is interested in.
+// This is done by creating all configuration objects which are defined in the package.
+//
+// Generally speaking, one has to define the following objects for each resonance:
+//
+//  1 - an AliRsnPairDef to define the resonance decay channel to be studied
+//  2 - an AliRsnPair{Ntuple|Functions} where the output is stored
+//  3 - one or more AliRsnCut objects to define track selections
+//      which will have then to be organized into AliRsnCutSet objects
+//  4 - an AliRsnCutManager to include all cuts to be applied (see point 3)
+//  5 - definitions to build the TNtuple or histograms which are returned
+//
+// The return value is used to know if the configuration was successful
+//
+Bool_t RsnConfigTask(AliRsnAnalysisSE* &task, const char *dataLabel, Bool_t perfectPID, Bool_t useITS, Bool_t usePID)
+{
+  // for safety, return if no task is passed
+  if (!task)
+  {
+    Error("ConfigTaskRsn", "Task not found");
+    return kFALSE;
+  }
+  
+  // interpret the useful information from second argument
+  TString strDataLabel(dataLabel);
+  Bool_t isESD   = strDataLabel.Contains("ESD");
+  Bool_t isAOD   = strDataLabel.Contains("AOD");
+  Bool_t isSim   = strDataLabel.Contains("sim");
+  Bool_t isData  = strDataLabel.Contains("data");
+  Bool_t isPass1 = strDataLabel.Contains("pass1");
+  Bool_t isPass2 = strDataLabel.Contains("pass2");
+
+  //
+  // -- Set cuts for events (applied to all analyses) -----------------------------------------------
+  //
+  
+  // primary vertex range
+  AliRsnCutPrimaryVertex *cutVertex   = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
+  AliRsnCutSet           *cutSetEvent = new AliRsnCutSet("eventCuts", AliRsnCut::kEvent);
+  cutSetEvent->AddCut(cutVertex);
+  cutSetEvent->SetCutScheme("cutVertex");
+  task->SetEventCuts(cutSetEvent);
+
+  //
+  // -- Setup pairs ---------------------------------------------------------------------------------
+  //
+
+  // decay channels
+  AliRsnPairDef         *pairDefpm = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
+
+  // computation objects
+  AliRsnPairFunctions   *pairPMhist = new AliRsnPairFunctions("pairPMHist", pairDefpm);
+  AliRsnPairNtuple      *pairPMntp  = new AliRsnPairNtuple   ("pairPMNtp" , pairDefpm);
+
+  //
+  // -- Setup cuts ----------------------------------------------------------------------------------
+  //
+  
+  // -- track cut --
+  // --> global cuts for 2010 analysis
+  AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010("cuts2010");
+  // ----> set the flag for sim/data management
+  cuts2010->SetMC(isSim);
+  // ----> require to check PID
+  cuts2010->SetCheckITS(kFALSE);
+  cuts2010->SetCheckTPC(kFALSE);
+  cuts2010->SetCheckTOF(kFALSE);
+  // ----> set TPC ranges and calibration
+  cuts2010->SetTPCrange(5.0, 3.0);
+  cuts2010->SetTPCpLimit(0.35);
+  cuts2010->SetITSband(4.0);
+  if (isSim) cuts2010->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
+  else       cuts2010->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
+  // ----> set standard quality cuts for TPC global tracks
+  //cuts2010->GetCutsTPC()->SetRequireTPCStandAlone(kTRUE); // require to have the projection at inner TPC wall
+  cuts2010->GetCutsTPC()->SetMinNClustersTPC(70);
+  cuts2010->GetCutsTPC()->SetMaxChi2PerClusterTPC(4);
+  cuts2010->GetCutsTPC()->SetAcceptKinkDaughters(kFALSE);
+  cuts2010->GetCutsTPC()->SetRequireTPCRefit(kTRUE);
+  cuts2010->GetCutsTPC()->SetRequireITSRefit(kTRUE);
+  cuts2010->GetCutsTPC()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  cuts2010->GetCutsTPC()->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9"); // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
+  cuts2010->GetCutsTPC()->SetMaxDCAToVertexZ(1e6); // disabled
+  cuts2010->GetCutsTPC()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
+  cuts2010->GetCutsTPC()->SetRequireSigmaToVertex(kFALSE);
+  // ----> set standard quality cuts for ITS standalone tracks
+  cuts2010->GetCutsITS()->SetRequireITSStandAlone(kTRUE, kTRUE);
+  cuts2010->GetCutsITS()->SetRequireITSRefit(kTRUE);
+  cuts2010->GetCutsITS()->SetMinNClustersITS(4);
+  cuts2010->GetCutsITS()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  cuts2010->GetCutsITS()->SetMaxChi2PerClusterITS(1.);
+  cuts2010->GetCutsITS()->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55"); // DCA pt dependent
+  cuts2010->GetCutsITS()->SetMaxDCAToVertexZ(1e6); // disabled
+  cuts2010->GetCutsITS()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
+  // ----> set the configuration for TOF PID checks
+  if (isData && (isPass1 || isPass2))
+  {
+    cuts2010->SetTOFcalibrateESD(kTRUE);
+    //if (isPass2) cuts2010->SetTOFcalibrateESD(kFALSE); // potrebbe anche essere kFALSE
+    cuts2010->SetTOFcorrectTExp(kTRUE);
+    cuts2010->SetTOFuseT0(kTRUE);
+    cuts2010->SetTOFtuneMC(kFALSE);
+    cuts2010->SetTOFresolution(100.0);
+  }
+  else if (isSim)
+  {
+    cuts2010->SetTOFcalibrateESD(kFALSE);
+    cuts2010->SetTOFcorrectTExp(kTRUE);
+    cuts2010->SetTOFuseT0(kTRUE);
+    cuts2010->SetTOFtuneMC(kTRUE);
+    cuts2010->SetTOFresolution(100.0);
+  }
+  cuts2010->Initialize();
+  
+  // -- tracks --> perfect PID
+  AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE);
+  
+  // cut sets
+  AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
+
+  // --> add related cuts
+  cutSetDaughterCommon->AddCut(cuts2010);
+  cutSetDaughterCommon->AddCut(cutPID);
+
+  // --> define schemes
+  if (perfectPID)
+  {
+    if (useITS)
+    {
+      pairPMhist->SetName("pmPerfectITS");
+      cuts2010->SetUseITSSA(kTRUE);
+      cuts2010->SetCheckITS(kFALSE);
+      cuts2010->SetCheckTPC(kFALSE);
+      cuts2010->SetCheckTOF(kFALSE);
+      cutSetDaughterCommon->SetCutScheme("cuts2010&cutPID");
+    }
+    else
+    {
+      pairPMhist->SetName("pmPerfectNoITS");
+      cuts2010->SetUseITSSA(kFALSE);
+      cuts2010->SetCheckITS(kFALSE);
+      cuts2010->SetCheckTPC(kFALSE);
+      cuts2010->SetCheckTOF(kFALSE);
+      cutSetDaughterCommon->SetCutScheme("cuts2010&cutPID");
+    }
+  }
+  else
+  {
+    if (useITS)
+    {
+      if (usePID)
+      {
+        pairPMhist->SetName("pmExpITSpid");
+        cuts2010->SetUseITSSA(kTRUE);
+        cuts2010->SetCheckITS(kTRUE);
+        cuts2010->SetCheckTPC(kTRUE);
+        cuts2010->SetCheckTOF(kTRUE);
+        cutSetDaughterCommon->SetCutScheme("cuts2010");
+      }
+      else
+      {
+        pairPMhist->SetName("pmExpITSnopid");
+        cuts2010->SetUseITSSA(kTRUE);
+        cuts2010->SetCheckITS(kFALSE);
+        cuts2010->SetCheckTPC(kFALSE);
+        cuts2010->SetCheckTOF(kFALSE);
+        cutSetDaughterCommon->SetCutScheme("cuts2010");
+      }
+    }
+    else
+    {
+      if (usePID)
+      {
+        pairPMhist->SetName("pmExpNoITSpid");
+        cuts2010->SetUseITSSA(kFALSE);
+        cuts2010->SetCheckITS(kTRUE);
+        cuts2010->SetCheckTPC(kTRUE);
+        cuts2010->SetCheckTOF(kTRUE);
+        cutSetDaughterCommon->SetCutScheme("cuts2010");
+      }
+      else
+      {
+        pairPMhist->SetName("pmExpNoITSnopid");
+        cuts2010->SetUseITSSA(kFALSE);
+        cuts2010->SetCheckITS(kFALSE);
+        cuts2010->SetCheckTPC(kFALSE);
+        cuts2010->SetCheckTOF(kFALSE);
+        cutSetDaughterCommon->SetCutScheme("cuts2010");
+      }
+    }
+  }
+  
+  // cut managers
+  // define a proper name for each mult bin, to avoid omonyme output histos
+  pairPMhist->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
+  pairPMntp ->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
+
+  // function axes
+  AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMass,        50,  0.9,  1.4);
+  AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt,             50,  0.0, 20.0);
+
+  // functions for TH1-like output
+  AliRsnFunction *fcnPt    = new AliRsnFunction;
+  // --> add axes
+  fcnPt   ->AddAxis(axisIM);
+  fcnPt   ->AddAxis(axisPt);
+  
+  // add functions to TH1-like output
+  pairPMhist->AddFunction(fcnPt);
+  
+  // add values to TNtuple-like output
+  pairPMntp->AddValue(axisIM);
+  pairPMntp->AddValue(axisPt);
+  
+  // add everything to analysis manager
+  task->GetAnalysisManager()->Add(pairPMhist);
+  //task->GetAnalysisManager()->Add(pairPMntp);
+
+  return kTRUE;
+}
index e8cd58230c55e92acec6bc71e2efcb6e0bcb47be..1e91166a9a074215cff42bc8e8646a00e600cf9c 100644 (file)
@@ -26,7 +26,7 @@
 //
 void runLocal
 (
-  Int_t       nReadFiles  = 10,
+  Int_t       nReadFiles  = 1,
   Int_t       nSkipFiles  = 0,
   const char *addTaskName = "AddAnalysisTaskRsnTest.C",
   const char *inputSource = "/home/pulvir/analysis/resonances/LHC2010-7TeV-phi/rsn-package/sim.txt",
@@ -97,8 +97,11 @@ void runLocal
   //gROOT->LoadMacro("AddTaskAnalysisPhi7TeV.C");
   //AddTaskAnalysisPhi7TeV(dataLabel);
   
+  gROOT->LoadMacro("AddTaskAnalysisMonitor.C");
+  AddTaskAnalysisMonitor(dataLabel);
+  
   // add task macro
-  gROOT->ProcessLine(Form(".x %s(\"%s\")", addTaskName, dataLabel));
+  //gROOT->ProcessLine(Form(".x %s(\"%s\")", addTaskName, dataLabel));
 
   // create TChain of input events
   TChain *analysisChain = 0x0;
index fdf6e900df62efc05b33b6af40edb561abc0f7ec..445809b143f940c2118e7a1d9f5e24701e337bd4 100644 (file)
@@ -34,7 +34,7 @@ SRCS= RESONANCES/AliRsnDaughter.cxx \
       RESONANCES/AliRsnMonitorTrack.cxx \
       RESONANCES/AliRsnAnalysisMonitorTask.cxx \
       RESONANCES/AliRsnFitResult.cxx \
-#      RESONANCES/AliRsnAnalysisEffSE.cxx \
+      RESONANCES/AliRsnAnalysisEffSE.cxx \
 
 HDRS= $(SRCS:.cxx=.h)