added possibility to loop only over particles with a given sign
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jul 2006 16:40:13 +0000 (16:40 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jul 2006 16:40:13 +0000 (16:40 +0000)
PWG0/dNdEta/AlidNdEtaCorrection.h
PWG0/dNdEta/AlidNdEtaCorrectionSelector.cxx
PWG0/dNdEta/AlidNdEtaCorrectionSelector.h
PWG0/dNdEta/dNdEtaAnalysis.h
PWG0/dNdEta/makeCorrection2.C

index 17d97aac600105b29516158d4bf39f47c915c1f4..bedf5329ac124806c91146ad0643c3404b1aa148 100644 (file)
@@ -78,7 +78,7 @@ public:
 protected:
   AliCorrectionMatrix3D* fTrack2ParticleCorrection; //-> handles the track-to-particle correction, function of vtx_z, eta, pt
   AliCorrectionMatrix2D* fVertexRecoCorrection;     //-> handles the vertex reconstruction efficiency, function of n_clustersITS and vtx_z
-  AliCorrectionMatrix2D* fTriggerCorrection;       //-> handles the trigger efficiency efficiency, function of n_clustersITS and vtx_z
+  AliCorrectionMatrix2D* fTriggerCorrection;       //-> handles the trigger efficiency, function of n_clustersITS and vtx_z
 
   AliCorrectionMatrix2D* fTriggerBiasCorrection;          //-> MB to desired sample
 
index 60494d5f4207fa0a710c5e14bdac727a13ecd16c..955583e071f25f4a118991d0f4d0843301d738da 100644 (file)
@@ -31,7 +31,8 @@ ClassImp(AlidNdEtaCorrectionSelector)
 AlidNdEtaCorrectionSelector::AlidNdEtaCorrectionSelector() :
   AliSelectorRL(),
   fEsdTrackCuts(0),
-  fdNdEtaCorrection(0)
+  fdNdEtaCorrection(0),
+  fSignMode(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -48,6 +49,24 @@ AlidNdEtaCorrectionSelector::~AlidNdEtaCorrectionSelector()
   // list is deleted by the TSelector dtor
 }
 
+Bool_t AlidNdEtaCorrectionSelector::SignOK(Double_t charge)
+{
+  // returns if a particle with this sign should be counted
+  // this is determined by the value of fSignMode, which should have the same sign
+  // as the charge
+  // if fSignMode is 0 all particles are counted
+
+  if (fSignMode > 0)
+    if (charge < 0)
+      return kFALSE;
+
+  if (fSignMode < 0)
+    if (charge > 0)
+      return kFALSE;
+
+  return kTRUE;
+}
+
 void AlidNdEtaCorrectionSelector::Begin(TTree * tree)
 {
   // The Begin() function is called at the start of the query.
@@ -55,6 +74,20 @@ void AlidNdEtaCorrectionSelector::Begin(TTree * tree)
   // The tree argument is deprecated (on PROOF 0 is passed).
 
   AliSelectorRL::Begin(tree);
+
+  TString option = GetOption();
+  AliInfo(Form("Called with option %s.", option.Data()));
+
+  if (option.Contains("only-positive"))
+  {
+    AliInfo("Processing only positive particles.");
+    fSignMode = 1;
+  }
+  else if (option.Contains("only-negative"))
+  {
+    AliInfo("Processing only negative particles.");
+    fSignMode = -1;
+  }
 }
 
 void AlidNdEtaCorrectionSelector::SlaveBegin(TTree * tree)
@@ -156,6 +189,9 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
     if (AliPWG0Helper::IsPrimaryCharged(particle, nPrim) == kFALSE)
       continue;
 
+    if (SignOK(particle->GetPDG()->Charge()) == kFALSE)
+        continue;
+
     Float_t eta = particle->Eta();
     Float_t pt = particle->Pt();
 
@@ -171,8 +207,7 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
   // loop over esd tracks
   Int_t nTracks = fESD->GetNumberOfTracks();
 
-  // count the number of "good" tracks for vertex reconstruction efficiency
-  // TODO change to number of ITS clusters or similar
+  // count the number of "good" tracks as parameter for vertex reconstruction efficiency
   Int_t nGoodTracks = 0;
   for (Int_t t=0; t<nTracks; t++)
   {
@@ -201,11 +236,13 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
       continue;
     }
 
+    if (SignOK(particle->GetPDG()->Charge()) == kFALSE)
+        continue;
+
     if (vertexReconstructed)
       fdNdEtaCorrection->FillParticleWhenMeasuredTrack(vtxMC[2], particle->Eta(), particle->Pt());
   } // end of track loop
 
-
   fdNdEtaCorrection->FillEvent(vtxMC[2], nGoodTracks);
   if (eventTriggered)
   {
@@ -247,7 +284,7 @@ void AlidNdEtaCorrectionSelector::Terminate()
 
   fdNdEtaCorrection->Finish();
 
-  TFile* fout = new TFile("correction_map.root","RECREATE");
+  TFile* fout = new TFile(Form("correction_map%s.root", GetOption()), "RECREATE");
 
   fEsdTrackCuts->SaveHistograms("esd_track_cuts");
   fdNdEtaCorrection->SaveHistograms();
index 496ad01cf8bde77e46222c583fb3714aeef27eb8..1ced507b2084b08d2de303b6bafd47a91157116d 100644 (file)
@@ -20,12 +20,14 @@ class AlidNdEtaCorrectionSelector : public AliSelectorRL {
     virtual void    Terminate();
 
  protected:
-    Bool_t  CheckVertex();
-  
+    Bool_t SignOK(Double_t charge);
+
     AliESDtrackCuts*  fEsdTrackCuts;          // Object containing the parameters of the esd track cuts
 
     AlidNdEtaCorrection* fdNdEtaCorrection;      // contains the intermediate histograms (on each slave)
 
+    Int_t fSignMode;  // if 0 process all particles, if +-1 process only particles with that sign
+
  private:
 
   ClassDef(AlidNdEtaCorrectionSelector, 0);
index bd4eba61f81404da07ab71e463899fc5535e1b37..409dd7b566760a5b2f9fbbb3308e783f3b5e4223 100644 (file)
@@ -64,7 +64,7 @@ protected:
   TH1D* fdNdEta[kVertexBinning]; // dndeta results for different vertex bins (0 = full range)
   TH1D* fdNdEtaPtCutOffCorrected[kVertexBinning];  // dndeta results for different vertex bins (0 = full range), pt cut off corrected
 
-  ClassDef(dNdEtaAnalysis, 0)
+  ClassDef(dNdEtaAnalysis, 1)
 };
 
 #endif
index 5da9f38d605d03dc1e71f575cbe52885e82d990b..d97f4f5795563ef405e3d5a04c45b73b03b48ba8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "../CreateESDChain.C"
 
-void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0, Bool_t debug = kFALSE)
+void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0, Bool_t debug = kFALSE, const Char_t* option = "")
 {
   gSystem->Load("libPWG0base");
   gSystem->Load("libPWG0dep");
@@ -36,5 +36,5 @@ void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0, Bool_t d
   if (debug != kFALSE)
     selector += "g";
 
-  chain->Process(selector);
+  chain->Process(selector, option);
 }