All triggers considered for the counters and Rabs cut modification (Cynthia)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Nov 2011 17:10:43 +0000 (17:10 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Nov 2011 17:10:43 +0000 (17:10 +0000)
PWG3/muon/AliAnalysisTaskMuonQA.cxx
PWG3/muon/AliAnalysisTaskMuonQA.h

index b89af01..0919230 100644 (file)
@@ -70,7 +70,7 @@ AliAnalysisTaskMuonQA::AliAnalysisTaskMuonQA() :
   fTriggerClass(0x0),
   fSelectTriggerClass(0x0)
 {
-// Dummy constructor
+  // Dummy constructor
 }
 
 //________________________________________________________________________
@@ -213,7 +213,7 @@ void AliAnalysisTaskMuonQA::UserCreateOutputObjects()
   
   TH1F* hP = new TH1F("hP", "momentum distribution;p (GeV/c)", 300, 0., 300.);
   fList->AddAtAndExpand(hP, kP);
-    
+  
   TH1F* hPMuPlus = new TH1F("hPMuPlus", "momentum distribution of #mu^{+};p (GeV/c)", 300, 0., 300.);
   fList->AddAtAndExpand(hPMuPlus, kPMuPlus);
   
@@ -222,7 +222,7 @@ void AliAnalysisTaskMuonQA::UserCreateOutputObjects()
   
   Int_t nPtBins = 300;
   Double_t ptMin = 0., ptMax = 30.;
-  
+       
   TH1F* hPt = new TH1F("hPt", "transverse momentum distribution;p_{t} (GeV/c)", nPtBins, ptMin, ptMax);
   fList->AddAtAndExpand(hPt, kPt);
   
@@ -253,7 +253,7 @@ void AliAnalysisTaskMuonQA::UserCreateOutputObjects()
   
   TH1F* hNChamberHitPerTrack = new TH1F("hNChamberHitPerTrack", "number of chambers hit per track;n_{chamber hit}", 15, 0., 15.);
   fList->AddAtAndExpand(hNChamberHitPerTrack, kNChamberHitPerTrack);
-
+  
   // Matched tracks info
   TH1F* hPtMatchLpt = new TH1F("hPtMatchLpt", "transverse momentum distribution matching Lpt;p_{t} (GeV/c)", nPtBins, ptMin, ptMax);
   fList->AddAtAndExpand(hPtMatchLpt, kPtMatchLpt);
@@ -272,7 +272,7 @@ void AliAnalysisTaskMuonQA::UserCreateOutputObjects()
   
   TH1F* hPtMuMinusMatchHpt = new TH1F("hPtMuMinusMatchHpt", "transverse momentum distribution of #mu^{-} matching Hpt;p_{t} (GeV/c)", nPtBins, ptMin, ptMax);
   fList->AddAtAndExpand(hPtMuMinusMatchHpt, kPtMuMinusMatchHpt);  
-  
+       
   TH1F* hNClustersPerCh = new TH1F("hNClustersPerCh", "averaged number of clusters per chamber per track;chamber ID;<n_{clusters}>", nCh, -0.5, nCh-0.5);
   hNClustersPerCh->Sumw2();
   hNClustersPerCh->SetOption("P");
@@ -290,7 +290,7 @@ void AliAnalysisTaskMuonQA::UserCreateOutputObjects()
   for (Int_t i = 0; i < nCh; i++) {
     Float_t rMax = 0.5*dMax[i/2];
     TH2F* hClusterHitMapInCh = new TH2F(Form("hClusterHitMapInCh%d",i+1), Form("cluster position distribution in chamber %d;X (cm);Y (cm)",i+1),
-                                      100, -rMax, rMax, 100, -rMax, rMax);
+                                       100, -rMax, rMax, 100, -rMax, rMax);
     fListExpert->AddAtAndExpand(hClusterHitMapInCh, kClusterHitMapInCh+i);
     
     TH1F* hClusterChargeInCh = new TH1F(Form("hClusterChargeInCh%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC)",i+1), 100, 0., 1000.);
@@ -382,8 +382,9 @@ void AliAnalysisTaskMuonQA::UserExec(Option_t *)
   // --- fill event counters ---
   
   // build the list of trigger cases
-  TList* triggerCases = BuildListOfTriggerCases(FiredTriggerClasses);
-  
+  //TList* triggerCases = BuildListOfTriggerCases(FiredTriggerClasses);
+  TList* triggerCases = BuildListOfAllTriggerCases(FiredTriggerClasses);
+
   // loop over trigger cases
   TObjString* triggerKey = 0x0;
   TIter nextTriggerCase(triggerCases);
@@ -432,11 +433,11 @@ void AliAnalysisTaskMuonQA::UserExec(Option_t *)
       
       Double_t thetaTrackAbsEnd = TMath::ATan(esdTrack->GetRAtAbsorberEnd()/505.) * TMath::RadToDeg();
       Double_t trackPt = esdTrack->Pt();
-                       Double_t eta = esdTrack->Eta();
-      if (trackPt > 1. && nPVTracks>0 && thetaTrackAbsEnd>2. && thetaTrackAbsEnd < 9. && eta > -4. && eta < -2.5) lowPt = kTRUE;
-      if (trackPt > 2. && nPVTracks>0 && thetaTrackAbsEnd>2. && thetaTrackAbsEnd < 9. && eta > -4. && eta < -2.5) highPt = kTRUE;
+      Double_t eta = esdTrack->Eta();
+      if (trackPt > 1. && nPVTracks>0 && thetaTrackAbsEnd>2. && thetaTrackAbsEnd < 10. && eta > -4. && eta < -2.5) lowPt = kTRUE;
+      if (trackPt > 2. && nPVTracks>0 && thetaTrackAbsEnd>2. && thetaTrackAbsEnd < 10. && eta > -4. && eta < -2.5) highPt = kTRUE;
       
-      if (thetaTrackAbsEnd < 2. || thetaTrackAbsEnd > 9. || eta < -4. || eta > -2.5) accKey += "out";
+      if (thetaTrackAbsEnd < 2. || thetaTrackAbsEnd > 10. || eta < -4. || eta > -2.5) accKey += "out";
       else accKey += "in";
       
     } else {
@@ -749,6 +750,73 @@ UInt_t AliAnalysisTaskMuonQA::BuildTriggerWord(TString& FiredTriggerClasses)
 }
 
 //________________________________________________________________________
+TList* AliAnalysisTaskMuonQA::BuildListOfAllTriggerCases(TString& FiredTriggerClasses)
+{
+  /// build the list of trigger for the counters from the fired trigger classes
+  /// returned TList must be deleted by user
+  
+  TList* list = new TList();
+  list->SetOwner();
+  
+  // add case any
+  list->AddLast(new TObjString("trigger:any"));
+  
+  TObjString* trigClasseName = 0x0;
+  TObjArray *obj = FiredTriggerClasses.Tokenize(" ");
+  if ( obj ){
+    TIter nextTrigger(obj);
+    while ((trigClasseName = static_cast<TObjString*>(nextTrigger()))) {
+                       
+      //AliInfo(Form("trigger name %s %s",trigClasseName->GetName(),FiredTriggerClasses.Data()));
+                       
+      //Add specific trigger
+      list->AddLast(new TObjString(Form("trigger:%s",trigClasseName->GetName())));
+    }
+    delete obj;
+    if(trigClasseName) delete trigClasseName;
+  }
+  
+  // add case other if no specific trigger was found
+  if (list->GetSize() == 1) list->AddLast(new TObjString("trigger:other"));
+       
+  return list;
+}
+
+
+//________________________________________________________________________
+TList* AliAnalysisTaskMuonQA::BuildListOfSelectedTriggerCases(TString& FiredTriggerClasses)
+{
+  /// build the list of trigger for the counters from the fired trigger classes
+  /// returned TList must be deleted by user
+  
+  TList* list = new TList();
+  list->SetOwner();
+  
+  // add case any
+  list->AddLast(new TObjString("trigger:any"));
+  
+  TObjString* trigClasseName = 0x0;
+  TObjArray *obj = FiredTriggerClasses.Tokenize(" ");
+  if ( obj ){
+    TIter nextTrigger(obj);
+    while ((trigClasseName = static_cast<TObjString*>(nextTrigger()))) {
+                       
+      //AliInfo(Form("trigger name %s %s",trigClasseName->GetName(),FiredTriggerClasses.Data()));
+      //loop on rejected trigger if (trigClasseName.Contains()
+      //Add specific trigger
+      list->AddLast(new TObjString(Form("trigger:%s",trigClasseName->GetName())));
+    }
+    delete obj;
+    if(trigClasseName) delete trigClasseName;
+  }
+  
+  // add case other if no specific trigger was found
+  if (list->GetSize() == 1) list->AddLast(new TObjString("trigger:other"));
+       
+  return list;
+}
+
+//________________________________________________________________________
 TList* AliAnalysisTaskMuonQA::BuildListOfTriggerCases(TString& FiredTriggerClasses)
 {
   /// build the list of trigger for the counters from the fired trigger classes and the list of trigger classes
@@ -763,12 +831,16 @@ TList* AliAnalysisTaskMuonQA::BuildListOfTriggerCases(TString& FiredTriggerClass
   list->AddLast(new TObjString("trigger:any"));
   
   TObjString* trigClasseName = 0x0;
+       
   TIter nextTrigger(fTriggerClass);
   while ((trigClasseName = static_cast<TObjString*>(nextTrigger()))) {
     
+    //AliInfo(Form("trigger name %s %s",trigClasseName->GetName(),FiredTriggerClasses.Data()));
+    //  cout<<"trigger name loop on "<<trigClasseName->GetName()<<" to look for "<<FiredTriggerClasses.Data()<<endl;
     TRegexp GenericTriggerClasseName(trigClasseName->String());
     if (FiredTriggerClasses.Contains(GenericTriggerClasseName)) {
-      
+      //AliInfo(Form("trigger names match = %s %s",trigClasseName->GetName(),FiredTriggerClasses.Data()));
+      //cout<<"trigger names match "<<trigClasseName->GetName()<<" and "<<FiredTriggerClasses.Data()<<endl;
       // add specific trigger case
       TObjString* trigShortName = static_cast<TObjString*>(fTriggerClass->GetValue(trigClasseName));
       list->AddLast(new TObjString(Form("trigger:%s",trigShortName->GetName())));
@@ -776,17 +848,12 @@ TList* AliAnalysisTaskMuonQA::BuildListOfTriggerCases(TString& FiredTriggerClass
       // check for CINT1B and CMUS1B trigger
       if (trigShortName->String() == "CINT1B") foundCINT1B = kTRUE;
       else if (trigShortName->String() == "CMUS1B") foundCMUS1B = kTRUE;
-      
     }
-    
   }
-  
+       
   // add the special case CINT1B+CMUS1B
   if (foundCINT1B && foundCMUS1B) list->AddLast(new TObjString("trigger:CINT1B+CMUS1B"));
-  
-  // add case other if no specific trigger was found
-  if (list->GetSize() == 1) list->AddLast(new TObjString("trigger:other"));
-  
+        
   return list;
 }
 
index d0e356a..94b4a78 100644 (file)
@@ -16,7 +16,7 @@ class TObjArray;
 class AliCounterCollection;
 
 class AliAnalysisTaskMuonQA : public AliAnalysisTaskSE {
-public:
+ public:
   
   AliAnalysisTaskMuonQA();
   AliAnalysisTaskMuonQA(const char *name);
@@ -36,14 +36,14 @@ public:
   /// - if the physics selection is used, apply the mask to the trigger word returned by the physics selection
   /// - if not, apply the mask to the trigger word built by looking for triggers listed in "fSelectTriggerClass"
   void SelectTrigger(Bool_t flag = kTRUE, UInt_t mask = AliVEvent::kMUON) {fSelectTrigger = flag; fTriggerMask = mask;}
-  
+       
   /// Select track matching the trigger to fill histograms
   void SelectMatched(Bool_t flag = kTRUE) {fSelectMatched = flag;}
   
   /// Use only tracks passing the acceptance cuts (Rabs, eta)
   void ApplyAccCut(Bool_t flag = kTRUE) { fApplyAccCut = flag; }
   
-private:
+ private:
   
   /// Not implemented
   AliAnalysisTaskMuonQA(const AliAnalysisTaskMuonQA& rhs);
@@ -55,8 +55,10 @@ private:
   UInt_t BuildTriggerWord(TString& FiredTriggerClasses);
   
   TList* BuildListOfTriggerCases(TString& FiredTriggerClasses);
-  
-private:
+  TList* BuildListOfAllTriggerCases(TString& FiredTriggerClasses);
+  TList* BuildListOfSelectedTriggerCases(TString& FiredTriggerClasses);
+       
+ private:
   
   enum eList {
     kNTracks                 = 0,  ///< number of tracks
@@ -75,7 +77,7 @@ private:
     kChi2                    = 13, ///< normalized chi2 distribution
     kProbChi2                = 14, ///< distribution of probability of chi2
     kNClustersPerTrack       = 15, ///< number of clusters per track
-    kNChamberHitPerTrack     = 16, ///< number of chamber hit per track
+    kNChamberHitPerTrack     = 16,  ///< number of chamber hit per track
     kPtMatchLpt              = 17, ///< Pt distribution match Lpt
     kPtMatchHpt              = 18, ///< Pt distribution match Hpt
     kPtMuPlusMatchLpt        = 19,  ///< Pt distribution of mu+ match Lpt