Adding monitor class to AliFemto (from D. Arominski)
authorlgraczyk <lgraczyk@cern.ch>
Tue, 30 Dec 2014 21:04:19 +0000 (22:04 +0100)
committerlgraczyk <lgraczyk@cern.ch>
Tue, 30 Dec 2014 21:04:19 +0000 (22:04 +0100)
PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx
PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.h
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairOriginMonitor.cxx [new file with mode: 0644]
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairOriginMonitor.h [new file with mode: 0644]
PWGCF/FEMTOSCOPY/AliFemtoUser/CMakeLists.txt
PWGCF/FEMTOSCOPY/AliFemtoUser/PWGCFfemtoscopyUserLinkDef.h

index f46a91b..362b0e7 100644 (file)
@@ -148,7 +148,8 @@ AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis() :
   fNeventsProcessed(0),
   fMinSizePartCollection(0),
   fVerbose(kTRUE),
-  fPerformSharedDaughterCut(kFALSE)
+  fPerformSharedDaughterCut(kFALSE),
+  fEnablePairMonitors(kFALSE)
 {
   // Default constructor
   //  mControlSwitch     = 0;
@@ -171,7 +172,8 @@ AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a)
   fNeventsProcessed(0),
   fMinSizePartCollection(0),
   fVerbose(kTRUE),
-  fPerformSharedDaughterCut(kFALSE)
+  fPerformSharedDaughterCut(kFALSE),
+  fEnablePairMonitors(kFALSE)
 {
   // Copy constructor
   //AliFemtoSimpleAnalysis();
@@ -300,6 +302,8 @@ AliFemtoSimpleAnalysis& AliFemtoSimpleAnalysis::operator=(const AliFemtoSimpleAn
 
   fPerformSharedDaughterCut = aAna.fPerformSharedDaughterCut;
 
+  fEnablePairMonitors = aAna.fEnablePairMonitors;
+
   return *this;
 }
 //______________________
@@ -392,11 +396,11 @@ void AliFemtoSimpleAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
       //------ Make real pairs. If identical, make pairs for one collection ------//
 
       if (AnalyzeIdenticalParticles()) {
-        MakePairs("real", fPicoEvent->FirstParticleCollection() );
+        MakePairs("real", fPicoEvent->FirstParticleCollection(), 0, EnablePairMonitors());
       }
       else {
         MakePairs("real", fPicoEvent->FirstParticleCollection(),
-                          fPicoEvent->SecondParticleCollection() );
+                 fPicoEvent->SecondParticleCollection(), EnablePairMonitors() );
       }
 
       if (fVerbose)
@@ -451,7 +455,7 @@ void AliFemtoSimpleAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
 }
 //_________________________
 void AliFemtoSimpleAnalysis::MakePairs(const char* typeIn, AliFemtoParticleCollection *partCollection1,
-                                      AliFemtoParticleCollection *partCollection2){
+                                      AliFemtoParticleCollection *partCollection2, Bool_t enablePairMonitors){
 // Build pairs, check pair cuts, and call CFs' AddRealPair() or
 // AddMixedPair() methods. If no second particle collection is
 // specfied, make pairs within first particle collection.
@@ -471,11 +475,11 @@ void AliFemtoSimpleAnalysis::MakePairs(const char* typeIn, AliFemtoParticleColle
   AliFemtoParticleIterator tEndOuterLoop   = partCollection1->end();    // will be one less if identical
   AliFemtoParticleIterator tStartInnerLoop;
   AliFemtoParticleIterator tEndInnerLoop;
-  if (partCollection2) {                        // Two collections:
+  if (partCollection2) {                         // Two collections:
     tStartInnerLoop = partCollection2->begin();  //   Full inner & outer loops
     tEndInnerLoop   = partCollection2->end();    //
   }
-  else {                                        // One collection:
+  else {                                         // One collection:
     tEndOuterLoop--;                             //   Outer loop goes to next-to-last particle
     tEndInnerLoop = partCollection1->end() ;     //   Inner loop goes to last particle
   }
@@ -490,8 +494,10 @@ void AliFemtoSimpleAnalysis::MakePairs(const char* typeIn, AliFemtoParticleColle
 
       // The following lines have to be uncommented if you want pairCutMonitors
       // they are not in // for speed reasons
-      //bool tmpPassPair = fPairCut->Pass(tPair);
-      //fPairCut->FillCutMonitor(tPair, tmpPassPair);
+      if(enablePairMonitors) {
+       bool tmpPassPair = fPairCut->Pass(tPair);
+       fPairCut->FillCutMonitor(tPair, tmpPassPair);
+      }
       // // if ( tmpPassPair )
 
       //---- If pair passes cut, loop over CF's and add pair to real/mixed ----//
index 91ec2c0..0e371f6 100644 (file)
@@ -56,6 +56,9 @@ class AliFemtoSimpleAnalysis : public AliFemtoAnalysis {
   void SetV0SharedDaughterCut(Bool_t aPerform);
   bool V0SharedDaughterCut();
 
+  void SetEnablePairMonitors(Bool_t aEnable);
+  Bool_t EnablePairMonitors();
+
   unsigned int NumEventsToMix() const;
   void SetNumEventsToMix(const unsigned int& NumberOfEventsToMix);
   AliFemtoPicoEvent* CurrentPicoEvent();
@@ -84,7 +87,8 @@ class AliFemtoSimpleAnalysis : public AliFemtoAnalysis {
   void AddEventProcessed();
   void MakePairs(const char* type, 
                 AliFemtoParticleCollection* ParticlesPassingCut1,
-                AliFemtoParticleCollection* ParticlesPssingCut2=0);
+                AliFemtoParticleCollection* ParticlesPssingCut2=0,
+                Bool_t enablePairMonitors=kFALSE);
 
   AliFemtoPicoEventCollectionVectorHideAway* fPicoEventCollectionVectorHideAway; //! Mixing Buffer used for Analyses which wrap this one 
 
@@ -102,6 +106,7 @@ class AliFemtoSimpleAnalysis : public AliFemtoAnalysis {
 
   Bool_t fVerbose;
   Bool_t fPerformSharedDaughterCut;
+  Bool_t fEnablePairMonitors;
 
 #ifdef __ROOT__
   ClassDef(AliFemtoSimpleAnalysis, 0)
@@ -122,6 +127,7 @@ inline AliFemtoPicoEventCollection*  AliFemtoSimpleAnalysis::MixingBuffer() {ret
 
 inline bool AliFemtoSimpleAnalysis::AnalyzeIdenticalParticles() const { return (fFirstParticleCut==fSecondParticleCut); }
 inline bool AliFemtoSimpleAnalysis::V0SharedDaughterCut() { return fPerformSharedDaughterCut; }
+inline bool AliFemtoSimpleAnalysis::EnablePairMonitors() { return fEnablePairMonitors; }
 
 // Set's
 inline void AliFemtoSimpleAnalysis::SetPairCut(AliFemtoPairCut* x) { fPairCut = x; x->SetAnalysis((AliFemtoAnalysis*)this);}
@@ -138,5 +144,5 @@ inline void AliFemtoSimpleAnalysis::SetMinSizePartCollection(unsigned int minSiz
 
 inline void AliFemtoSimpleAnalysis::SetVerboseMode(Bool_t aVerbose){fVerbose = aVerbose;}
 inline void AliFemtoSimpleAnalysis::SetV0SharedDaughterCut(Bool_t aPerform) { fPerformSharedDaughterCut = aPerform; }
-
+inline void AliFemtoSimpleAnalysis::SetEnablePairMonitors(Bool_t aEnable) { fEnablePairMonitors = aEnable; }
 #endif
diff --git a/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairOriginMonitor.cxx b/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairOriginMonitor.cxx
new file mode 100644 (file)
index 0000000..14cfbcb
--- /dev/null
@@ -0,0 +1,149 @@
+#include "AliFemtoPairOriginMonitor.h"
+#include <TH1D.h>
+#include <TH3D.h>
+#include <TList.h>
+#include "AliFemtoModelHiddenInfo.h"
+
+AliFemtoPairOriginMonitor::AliFemtoPairOriginMonitor():
+  fParticle1Origin(0),
+  fParticle2Origin(0),
+  fParticle1Id(0),
+  fParticle2Id(0)
+{
+  // Default constructor
+
+  fParticle1Origin =  new TH1D("POriginFirst", "Mothers PDG Codes", 6000, 0.0, 6000.0);
+  fParticle1Id =  new TH1D("PIdFirst", "Particle PDG Codes", 6000, 0.0, 6000.0);
+  fParticle2Origin =  new TH1D("POriginFirst", "Mothers PDG Codes", 6000, 0.0, 6000.0);
+  fParticle2Id =  new TH1D("PIdFirst", "Particle PDG Codes", 6000, 0.0, 6000.0);
+
+}
+AliFemtoPairOriginMonitor::AliFemtoPairOriginMonitor(const char *aName):
+  AliFemtoCutMonitor(),
+  fParticle1Origin(0),
+  fParticle2Origin(0),
+  fParticle1Id(0),
+  fParticle2Id(0)
+{
+  // Normal constructor
+  char name[200];
+
+  snprintf(name, 200, "POriginFirst%s", aName);
+  fParticle1Origin =  new TH1D(name, "Mothers PDG Codes", 6000, 0.0, 6000.0);
+  snprintf(name, 200, "PIdFirst%s", aName);
+  fParticle1Id =  new TH1D(name, "Particle PDG Codes", 6000, 0.0, 6000.0);
+
+  snprintf(name, 200, "POriginSecond%s", aName);
+  fParticle2Origin =  new TH1D(name, "Mothers PDG Codes", 6000, 0.0, 6000.0);
+  snprintf(name, 200, "PIdSecond%s", aName);
+  fParticle2Id =  new TH1D(name, "Particle PDG Codes", 6000, 0.0, 6000.0);
+
+}
+
+AliFemtoPairOriginMonitor::AliFemtoPairOriginMonitor(const AliFemtoPairOriginMonitor &aCut):
+  AliFemtoCutMonitor(),
+  fParticle1Origin(0),
+  fParticle2Origin(0),
+  fParticle1Id(0),
+  fParticle2Id(0)
+{
+  // copy constructor
+
+  if (fParticle1Origin) delete fParticle1Origin;
+  fParticle1Origin= new TH1D(*aCut.fParticle1Origin);
+  if (fParticle1Id) delete fParticle1Id;
+  fParticle1Id= new TH1D(*aCut.fParticle1Id);
+
+  if (fParticle1Origin) delete fParticle2Origin;
+  fParticle1Origin= new TH1D(*aCut.fParticle2Origin);
+  if (fParticle1Id) delete fParticle2Id;
+  fParticle1Id= new TH1D(*aCut.fParticle2Id);
+
+}
+
+void AliFemtoPairOriginMonitor::Fill(const AliFemtoPair* aPair) {
+
+  AliFemtoParticle *first = (AliFemtoParticle*)aPair->Track1();
+  AliFemtoParticle *second = (AliFemtoParticle*)aPair->Track2();
+
+  if(first!=NULL && second!=NULL) {
+    
+    AliFemtoModelHiddenInfo *tInfo1 = (AliFemtoModelHiddenInfo*)first->GetHiddenInfo();
+    AliFemtoModelHiddenInfo *tInfo2 = (AliFemtoModelHiddenInfo*)second->GetHiddenInfo();
+    if(tInfo1!=NULL && tInfo2!=NULL) {
+      Int_t part1ID = TMath::Abs(tInfo1->GetPDGPid());
+      Int_t mother1ID = TMath::Abs(tInfo1->GetMotherPdgCode());
+      
+      Int_t part2ID = TMath::Abs(tInfo2->GetPDGPid());
+      Int_t mother2ID = TMath::Abs(tInfo2->GetMotherPdgCode());      
+      
+      fParticle1Id->Fill(part1ID);
+      fParticle1Origin->Fill(mother1ID);
+      fParticle2Id->Fill(part2ID);
+      fParticle2Origin->Fill(mother2ID);
+    }
+  }
+}
+
+AliFemtoPairOriginMonitor::~AliFemtoPairOriginMonitor()
+{
+  // Destructor
+
+  delete fParticle1Origin;
+  delete fParticle1Id;
+  delete fParticle2Origin;
+  delete fParticle2Id;
+}
+
+AliFemtoPairOriginMonitor& AliFemtoPairOriginMonitor::operator=(const AliFemtoPairOriginMonitor& aCut)
+{
+  // assignment operator
+  if (this == &aCut)
+    return *this;
+
+
+  if (fParticle1Origin) delete fParticle1Origin;
+  fParticle1Origin= new TH1D(*aCut.fParticle1Origin);
+  if (fParticle1Id) delete fParticle1Id;
+  fParticle1Id= new TH1D(*aCut.fParticle1Id);
+
+  if (fParticle2Origin) delete fParticle2Origin;
+  fParticle2Origin= new TH1D(*aCut.fParticle2Origin);
+  if (fParticle2Id) delete fParticle2Id;
+  fParticle2Id= new TH1D(*aCut.fParticle2Id);
+
+
+  return *this;
+}
+
+AliFemtoString AliFemtoPairOriginMonitor::Report(){
+  // Prepare report from the execution
+  string stemp = "*** AliFemtoPairOriginMonitor report";
+  AliFemtoString returnThis = stemp;
+  return returnThis;
+}
+
+
+void AliFemtoPairOriginMonitor::Write()
+{
+  // Write out the relevant histograms
+
+  fParticle1Id->Write();
+  fParticle1Origin->Write();
+  fParticle2Id->Write();
+  fParticle2Origin->Write();
+
+}
+
+TList *AliFemtoPairOriginMonitor::GetOutputList()
+{
+  // Get the list of histograms to write
+  TList *tOutputList = new TList();
+
+  tOutputList->Add(fParticle1Id);
+  tOutputList->Add(fParticle1Origin);
+  tOutputList->Add(fParticle2Id);
+  tOutputList->Add(fParticle2Origin);
+
+  return tOutputList;
+}
diff --git a/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairOriginMonitor.h b/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairOriginMonitor.h
new file mode 100644 (file)
index 0000000..f336389
--- /dev/null
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+//  Author: Dominik Arominski, WUT                                            //
+//  dominik.arominski@cern.ch                                                 //
+//                                                                            //
+//  AliFemtoPairOriginMonitor - allows to extract origin and indentification  //
+//  of particles after both one-particle and pair-wise cuts.                  //
+//                                                                            //
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoPairOriginMonitor_H
+#define AliFemtoPairOriginMonitor_H
+
+#include "AliFemtoPair.h"
+#include "AliFemtoString.h"
+#include "AliFemtoParticleCollection.h"
+#include "AliFemtoCutMonitor.h"
+
+class AliFemtoEvent;
+class AliFemtoTrack;
+class AliFemtoV0;
+class AliFemtoKink;
+class AliFemtoPair; // Gael 12/04/02
+class TH1D;
+class TH2D;
+class TList;
+
+class AliFemtoPairOriginMonitor : public AliFemtoCutMonitor{
+
+public:
+  AliFemtoPairOriginMonitor();
+  AliFemtoPairOriginMonitor(const char *aName);
+  AliFemtoPairOriginMonitor(const AliFemtoPairOriginMonitor &aCut);
+  virtual ~AliFemtoPairOriginMonitor();
+
+  AliFemtoPairOriginMonitor& operator=(const AliFemtoPairOriginMonitor& aCut);
+
+  virtual AliFemtoString Report();
+  virtual void Fill(const AliFemtoEvent* aEvent) {AliFemtoCutMonitor::Fill(aEvent);}
+  virtual void Fill(const AliFemtoTrack* aTrack){AliFemtoCutMonitor::Fill(aTrack);}
+  virtual void Fill(const AliFemtoV0* aV0) {AliFemtoCutMonitor::Fill(aV0);}
+  virtual void Fill(const AliFemtoKink* aKink) {AliFemtoCutMonitor::Fill(aKink);}
+  virtual void Fill(const AliFemtoPair* aPair);
+  virtual void Fill(const AliFemtoParticleCollection* aCollection) {AliFemtoCutMonitor::Fill(aCollection);}
+  virtual void Fill(const AliFemtoEvent* aEvent,const AliFemtoParticleCollection* aCollection)
+  {AliFemtoCutMonitor::Fill(aEvent, aCollection);}
+  virtual void Fill(const AliFemtoParticleCollection* aCollection1,const AliFemtoParticleCollection* aCollection2) {AliFemtoCutMonitor::Fill(aCollection1, aCollection2);}
+  void Write();
+
+  virtual TList *GetOutputList();
+
+private:
+  TH1D *fParticle1Origin; //first particle in pair origin from MC
+  TH1D *fParticle2Origin; //second particle in pair origin from MC
+
+  TH1D *fParticle1Id;     //true particle identification from MC
+  TH1D *fParticle2Id;     //true particle identification from MC
+};
+
+#endif
index 09b0bc9..62b6322 100644 (file)
@@ -82,6 +82,7 @@ set(SRCS
   AliFemtoCorrFctnMinvMonitor.cxx
   AliFemtoCorrFctnPairFractions.cxx
   AliAnalysisTaskParticleEfficiency.cxx
+  AliFemtoPairOriginMonitor.cxx
   )
 
 # Headers from sources
index fed33af..367c3cc 100644 (file)
@@ -56,3 +56,4 @@
 #pragma link C++ class AliFemtoPicoEventRP;
 #pragma link C++ class AliFemtoCorrFctnPairFractions;
 #pragma link C++ class AliAnalysisTaskParticleEfficiency+;
+#pragma link C++ class AliFemtoPairOriginMonitor+;