]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added an experimental class for single-track monitors.
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 23 Jun 2011 09:35:01 +0000 (09:35 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 23 Jun 2011 09:35:01 +0000 (09:35 +0000)
Added a flag for management of big outputs (requirement by Martin)
Corrected some coding conventions violations.

PWG2/CMakelibPWG2resonances.pkg
PWG2/PWG2resonancesLinkDef.h
PWG2/RESONANCES/AliRsnCutKaonForPhi2010.cxx
PWG2/RESONANCES/AliRsnMiniAnalysisTask.cxx
PWG2/RESONANCES/AliRsnMiniMonitor.cxx [new file with mode: 0644]
PWG2/RESONANCES/AliRsnMiniMonitor.h [new file with mode: 0644]
PWG2/RESONANCES/AliRsnMiniOutput.cxx
PWG2/RESONANCES/AliRsnPairDef.h
PWG2/RESONANCES/AliRsnValuePID.cxx
PWG2/RESONANCES/AliRsnValuePID.h

index 6d2553e005783287529a278008e9a479a61a234b..9ecb5955af677344f199cbc74428e1a9020ad688 100644 (file)
@@ -72,6 +72,7 @@ set ( SRCS RESONANCES/AliRsnDaughter.cxx
            RESONANCES/AliRsnMiniAxis.cxx
            RESONANCES/AliRsnMiniOutput.cxx
            RESONANCES/AliRsnMiniValue.cxx
+           RESONANCES/AliRsnMiniMonitor.cxx
            RESONANCES/AliRsnMiniAnalysisTask.cxx )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
index 0ccfa80d94be4560e55870bbdb56bb0acff9c52c..b72368f4b1dde7c29453a4c81433ae60bc98134e 100644 (file)
@@ -56,6 +56,7 @@
 #pragma link C++ class AliRsnMiniAxis+;
 #pragma link C++ class AliRsnMiniOutput+;
 #pragma link C++ class AliRsnMiniValue+;
+#pragma link C++ class AliRsnMiniMonitor+;
 #pragma link C++ class AliRsnMiniAnalysisTask+;
 
 
index 77613041550fc5db423838ddcb964e89a6bea078..5c1fbacce79e8dd7ab20a014e5f4a4f45676a884 100644 (file)
@@ -84,28 +84,49 @@ Bool_t AliRsnCutKaonForPhi2010::IsSelected(TObject *obj)
    
    // check if TOF is matched
    // and computes all values used in the PID cut
+   Bool_t   accept = kFALSE;
    Bool_t   isTOF  = MatchTOF(track);
    Double_t nsTPC  = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kKaon));
    Double_t nsTOF  = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kKaon));
    
    // if only one detector is chosen, do this here
    if (fOnlyTPC) {
-      return (nsTPC <= fCutTPC);
+      AliDebugClass(1, Form("Checking only TPC: nsigma = %f - cut = %f", nsTPC, fCutTPC));
+      accept = (nsTPC <= fCutTPC);
    } else if (fOnlyTOF) {
-      return (isTOF && (nsTOF <= fCutTOF));
+      if (!isTOF) {
+         AliDebugClass(1, "Checking only TOF: rejecting non-TOF track");
+         accept = kFALSE;
+      } else {
+         AliDebugClass(1, Form("Checking only TOF: nsigma = %f - cut = %f", nsTOF, fCutTOF));
+         accept = (nsTOF <= fCutTOF);
+      }
    } else {
       // combined PID:
       // below momentum threshold, start with TPC
       if (track->P() < fTOFthreshold) {
-         if (isTOF)
-            return ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
-         else
-            return (nsTPC <= fCutTPC);
+         AliDebugClass(1, Form("Checking both PID: p = %f below threshold (TOF not required)", track->P())); 
+         if (isTOF) {
+            AliDebugClass(1, Form("TOF present: nsigmaTPC: = %f - cut = %f", nsTPC, fCutTPC));
+            AliDebugClass(1, Form("TOF present: nsigmaTOF: = %f - cut = %f", nsTOF, fCutTOF));
+            accept = ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
+         } else {
+            AliDebugClass(1, Form("TOF absent : nsigmaTPC: = %f - cut = %f", nsTPC, fCutTPC));
+            accept = (nsTPC <= fCutTPC);
+         }
       } else {
-         if (isTOF) 
-            return ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
-         else
-            return kFALSE;
+         AliDebugClass(1, Form("Checking both PID: p = %f above threshold (TOF required)", track->P())); 
+         if (isTOF) {
+            AliDebugClass(1, Form("TOF present: nsigmaTPC: = %f - cut = %f", nsTPC, fCutTPC));
+            AliDebugClass(1, Form("TOF present: nsigmaTOF: = %f - cut = %f", nsTOF, fCutTOF));
+            accept = ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
+         } else {
+            AliDebugClass(1, "TOF absent : track rejected");
+            accept = kFALSE;
+         }
       }
    }
+   
+   AliDebugClass(1, Form("Track %s", (accept ? "accepted" : "rejected")));
+   return accept;
 }
index f3450ab461000c6a8e502d91b230f0bdb46a3a09..7f3a554d3c535ba23e707b3611e9ce5730e6c838 100644 (file)
@@ -393,7 +393,7 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput()
          ifill++;
          if (ifill >= fNMix) break;
       }
-      //cout << "Matches for event " << Form("%5d", ievt) << ": " << matched[ievt].Data() << " (" << ifill << ")" << endl;
+      AliDebugClass(1, Form("Matches for event %5d = %s", ievt, matched[ievt].Data()));
    }
    
    // perform mixing
@@ -407,7 +407,6 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput()
       TObjArrayIter next(list);
       while ( (os = (TObjString*)next()) ) {
          imix = os->GetString().Atoi();
-         //cout << "Mixing " << ievt << " with " << imix << endl;
          fEvBuffer->GetEntry(imix);
          for (idef = 0; idef < nDefs; idef++) {
             def = (AliRsnMiniOutput*)fHistograms[idef];
diff --git a/PWG2/RESONANCES/AliRsnMiniMonitor.cxx b/PWG2/RESONANCES/AliRsnMiniMonitor.cxx
new file mode 100644 (file)
index 0000000..e564581
--- /dev/null
@@ -0,0 +1,202 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  This class contains all code which is used to compute any of the values
+//  which can be of interest within a resonance analysis. Besides the obvious
+//  invariant mass, it allows to compute other utility values on all possible
+//  targets, in order to allow a wide spectrum of binning and checks.
+//  When needed, this object can also define a binning in the variable which
+//  it is required to compute, which is used for initializing axes of output
+//  histograms (see AliRsnFunction).
+//  The value computation requires this object to be passed the object whose
+//  informations will be used. This object can be of any allowed input type
+//  (track, pair, event), then this class must inherit from AliRsnTarget.
+//  Then, when value computation is attempted, a check on target type is done
+//  and computation is successful only if expected target matches that of the
+//  passed object.
+//  In some cases, the value computation can require a support external object,
+//  which must then be passed to this class. It can be of any type inheriting
+//  from TObject.
+//
+//  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+//           M. Vala (martin.vala@cern.ch)
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Riostream.h"
+
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+
+#include "AliLog.h"
+
+#include "AliRsnDaughter.h"
+#include "AliRsnEvent.h"
+
+#include "AliRsnMiniMonitor.h"
+
+ClassImp(AliRsnMiniMonitor)
+
+//__________________________________________________________________________________________________
+AliRsnMiniMonitor::AliRsnMiniMonitor() :
+   TNamed(), 
+   fType(kTypes), 
+   fCutID(-1), 
+   fListID(-1), 
+   fList(0x0)
+{
+//
+// Dummy constructor
+//
+}
+
+//__________________________________________________________________________________________________
+AliRsnMiniMonitor::AliRsnMiniMonitor(const char *name, EType type, Int_t cutID) :
+   TNamed(name, ""), 
+   fType(type), 
+   fCutID(cutID), 
+   fListID(-1), 
+   fList(0x0)
+{
+//
+// Default constructor
+//
+}
+   
+//__________________________________________________________________________________________________
+AliRsnMiniMonitor::AliRsnMiniMonitor(const AliRsnMiniMonitor& copy) :
+   TNamed(copy), 
+   fType(copy.fType), 
+   fCutID(copy.fCutID), 
+   fListID(copy.fListID), 
+   fList(copy.fList)
+{
+//
+// Copy constructor
+//
+}
+   
+//__________________________________________________________________________________________________
+AliRsnMiniMonitor& AliRsnMiniMonitor::operator=(const AliRsnMiniMonitor& copy) 
+{
+//
+// Assignment operator
+//
+   
+   TNamed::operator=(copy); 
+   fType = copy.fType; 
+   fCutID = copy.fCutID; 
+   fListID = copy.fListID; 
+   fList = copy.fList; 
+   
+   return (*this); 
+}
+
+//__________________________________________________________________________________________________
+Bool_t AliRsnMiniMonitor::Init(const char *name, TList *list)
+{
+//
+// Initialize this output histogram and put into the passed list
+//
+
+   // name
+   TString sname(name);
+   sname += '_';
+   sname += GetName();
+   
+   // check list
+   fList = list;
+   if (!list) {
+      AliError("No list!");
+      return kFALSE;
+   }
+   
+   // reset histogram
+   TH1 *histogram = 0x0;
+
+   switch (fType) {
+      case kdEdxTPCvsP: 
+         sname += "_TPCsignal";
+         histogram = new TH2F(sname.Data(), "", 500, 0.0, 5.0, 1000, 0.0, 1000.0);
+         break;
+      case ktimeTOFvsP:
+         sname += "_TOFsignal";
+         histogram = new TH2F(sname.Data(), "", 500, 0.0, 5.0, 1000, -5.0, 5.0);
+         break;
+      default:
+         AliError("Wrong enum type");
+         return kFALSE;
+   }
+   
+   // add to list
+   if (histogram && fList) {
+      histogram->Sumw2();
+      fList->Add(histogram);
+      fListID = fList->IndexOf(histogram);
+      AliInfo(Form("Histogram '%s' added to list in slot #%d", histogram->GetName(), fListID));
+      return kTRUE;
+   }
+   
+   return kFALSE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnMiniMonitor::Fill(AliRsnDaughter *track, AliRsnEvent *event)
+{
+//
+// Fill the histogram
+//
+
+   // retrieve object from list
+   if (!fList) {
+      AliError("List pointer is NULL");
+      return kFALSE;
+   }
+   TObject *obj = fList->At(fListID);
+   if (!obj) {
+      AliError("List object is NULL");
+      return kFALSE;
+   }
+
+   Double_t valueX, valueY;
+   AliVTrack *vtrack = track->Ref2Vtrack();
+
+   switch (fType) {
+      case kdEdxTPCvsP: 
+         if (!vtrack) {
+            AliWarning("Required vtrack for this value");
+            return kFALSE;
+         }
+         valueX = vtrack->GetTPCmomentum();
+         valueY = vtrack->GetTPCsignal();
+         ((TH2F*)obj)->Fill(valueX, valueY);
+         return kTRUE;
+      case ktimeTOFvsP:
+         if (!vtrack) {
+            AliWarning("Required vtrack for this value");
+            return kFALSE;
+         }
+         valueX = vtrack->P();
+         valueY = vtrack->GetTOFsignal();
+         ((TH2F*)obj)->Fill(valueX, valueY);
+         return kTRUE;
+      default:
+         AliError("Invalid value type");
+         return kFALSE;
+   }
+}
diff --git a/PWG2/RESONANCES/AliRsnMiniMonitor.h b/PWG2/RESONANCES/AliRsnMiniMonitor.h
new file mode 100644 (file)
index 0000000..0fa7227
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef AliRsnMiniMonitor_H
+#define AliRsnMiniMonitor_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Monitors
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "TObjArray.h"
+
+class AliRsnDaughter;
+class AliRsnEvent;
+
+class AliRsnMiniMonitor : public TNamed {
+public:
+
+   enum EType {
+      kdEdxTPCvsP,    // TPC signal vs. momentum
+      ktimeTOFvsP,    // TOF time vs. momentum
+      kTypes          // total number of cuts
+   };
+
+   AliRsnMiniMonitor();
+   AliRsnMiniMonitor(const char *name, EType type, Int_t cutID);
+   AliRsnMiniMonitor(const AliRsnMiniMonitor& copy);
+   AliRsnMiniMonitor& operator=(const AliRsnMiniMonitor& copy);
+   virtual ~AliRsnMiniMonitor() { }
+
+   EType              GetType()   {return fType;}
+   Int_t              GetCutID()  {return fCutID;}
+   Int_t              GetListID() {return fListID;}
+   
+   void               SetType(EType type)  {fType = type;}
+   void               SetCutID(Int_t id)   {fCutID = id;}
+
+   static const char* Label(EType type); 
+   Bool_t             Init(const char *name, TList *list);
+   Bool_t             Fill(AliRsnDaughter *track, AliRsnEvent *event);
+
+protected:
+
+   EType      fType;     //  monitor type
+   Int_t      fCutID;    //  ID for cut to be used
+   Int_t      fListID;   //  histogram ID in the list
+   TList     *fList;     //! global output list
+                                       
+   ClassDef(AliRsnMiniMonitor, 1)  //  AliRsnMiniMonitor class
+};
+
+inline const char* AliRsnMiniMonitor::Label(EType type)
+{
+   switch (type) {
+      case kdEdxTPCvsP: return "TPCsignal";
+      case ktimeTOFvsP: return "TOFsignal";
+      default         : return "X";
+   }
+}
+
+#endif
index 0c20c8e81b40f044a0edf08a56a2a1489c736cc1..06b4b664fa5f12726791338b9f460cdc9f9e0bae 100644 (file)
@@ -422,7 +422,8 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
    
    // it is necessary to know if criteria for the two daughters are the same
    // and if the two events are the same or not (mixing)
-   Bool_t sameCriteria = ((fCharge[0] == fCharge[1]) && (fCutID[0] == fCutID[1]));
+   //Bool_t sameCriteria = ((fCharge[0] == fCharge[1]) && (fCutID[0] == fCutID[1]));
+   Bool_t sameCriteria = ((fCharge[0] == fCharge[1]) && (fDaughter[0] == fDaughter[1]));
    Bool_t sameEvent = (event1->ID() == event2->ID());
    
    Int_t nsel1 = event1->CountParticles(fCharge[0], fCutID[0]);
@@ -445,7 +446,7 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
       // the first track *after* current one;
       // otherwise it starts from the beginning
       start = ((sameEvent && sameCriteria) ? i1 + 1 : 0);
-      cout << "START = " << endl;
+      AliDebugClass(2, Form("Start point = %d", start));
       // internal loop
       for (i2 = start; i2 < n2; i2++) {
          p2 = event2->GetParticle(i2);
index c3ba2db2956f523a01a3a8c6e619073e709c9f1c..d5c63ea4c66688cf9e9f64c191c5e5d5a7c6ad29 100644 (file)
@@ -32,9 +32,9 @@ public:
 
    void SetMotherPDG(Int_t pdg)                 {fMotherPDG = pdg;}
    void SetMotherMass(Double_t mass)            {fMotherMass = mass;}
-   void SetDef1(AliRsnDaughterDef *def)         {if (def) fDef1 = (*def);}
-   void SetDef2(AliRsnDaughterDef *def)         {if (def) fDef2 = (*def);}
-   void SetDef(Int_t i, AliRsnDaughterDef *def) {if (!def) return; if (i<1) fDef1 = (*def); else fDef2 = (*def);}
+   void SetDef1(const AliRsnDaughterDef *def)   {if (def) fDef1 = (*def);}
+   void SetDef2(const AliRsnDaughterDef *def)   {if (def) fDef2 = (*def);}
+   void SetDef(Int_t i, const AliRsnDaughterDef *def) {if (!def) return; if (i<1) fDef1 = (*def); else fDef2 = (*def);}
 
    Bool_t IsLikeSign()  const {return (fDef1.GetChargeC() == fDef2.GetChargeC());}
    Bool_t HasEqualPID() const {return (fDef1.GetPID() == fDef2.GetPID());}
index fa7b7b0f338bbe06640cf53c0b0e62c183df8f8b..45d7147e94d43c3d239cd660c79ea0760c1fd0f7 100644 (file)
@@ -1,3 +1,11 @@
+//
+// AliRsnValuePID
+// Implementation of values related to PID
+// which can be used to monitor or check cuts
+// based on tolerance ranges between detector signals
+// and expected responses for particle species
+//
+
 #include <Riostream.h>
 
 #include "AliVTrack.h"
index e8e96cadf47cd4f39b82c62c18d5f5b6ac76ca09..4de8c7076bad368037404396c9e7568f7d1f6038 100644 (file)
@@ -1,6 +1,14 @@
 #ifndef ALIRSNVALUEPID_H
 #define ALIRSNVALUEPID_H
 
+//
+// AliRsnValuePID
+// Implementation of values related to PID
+// which can be used to monitor or check cuts
+// based on tolerance ranges between detector signals
+// and expected responses for particle species
+//
+
 #include "AliPID.h"
 #include "AliRsnValue.h"
 
@@ -33,7 +41,7 @@ public:
    virtual ~AliRsnValuePID() { }
    
    void            SetValuePID(EValuePID type) {fValuePID = type;}
-   EValuePID       GetValuePID()               {return fValuePID;}
+   EValuePID       GetValuePID() const         {return fValuePID;}
    
    virtual Bool_t  Eval(TObject *object, Bool_t useMC = kFALSE);
    virtual void    Print(Option_t *option = "") const;