]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliFMDMCEventInspector.cxx
Segregated the Landau+Gaus function from the AliForwardUtil dumping ground. Other...
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCEventInspector.cxx
index 02b4cc29a48de65a3b45bb6929f877084cf6462c..e1367e6dee6037eb004dd05876cd7cd8ad705b7c 100644 (file)
@@ -44,12 +44,14 @@ AliFMDMCEventInspector::AliFMDMCEventInspector()
     fHVertex(0),
     fHPhiR(0), 
     fHB(0),
+    fHMcC(0),
     fHBvsPart(0),
     fHBvsBin(0),
     fHBvsCent(0),
     fHVzComp(0),
     fHCentVsPart(0),
     fHCentVsBin(0),
+    fHCentVsMcC(0),
     fProduction("")
 {
   // 
@@ -63,12 +65,14 @@ AliFMDMCEventInspector::AliFMDMCEventInspector(const char* /* name */)
     fHVertex(0),
     fHPhiR(0), 
     fHB(0),
+    fHMcC(0),
     fHBvsPart(0),
     fHBvsBin(0),
     fHBvsCent(0),
     fHVzComp(0),
     fHCentVsPart(0),
     fHCentVsBin(0),
+    fHCentVsMcC(0),
     fProduction("")
 {
   // 
@@ -77,6 +81,7 @@ AliFMDMCEventInspector::AliFMDMCEventInspector(const char* /* name */)
   // Parameters:
   //   name Name of object
   //
+  fMC = true;
 }
 
 //____________________________________________________________________
@@ -85,12 +90,14 @@ AliFMDMCEventInspector::AliFMDMCEventInspector(const AliFMDMCEventInspector& o)
     fHVertex(0),
     fHPhiR(0), 
     fHB(0),
+    fHMcC(0),
     fHBvsPart(0),
     fHBvsBin(0),
     fHBvsCent(0),
     fHVzComp(0),
     fHCentVsPart(0),
     fHCentVsBin(0),
+    fHCentVsMcC(0),
     fProduction("")
 {
   // 
@@ -135,7 +142,13 @@ AliFMDMCEventInspector::SetupForData(const TAxis& vtxAxis)
   // Parameters:
   //   vtxAxis Vertex axis in use 
   //
+
+  // We temporary disable the displaced vertices so we can initialize
+  // the routine ourselves.
+  Bool_t saveDisplaced  = fUseDisplacedVertices;
+  fUseDisplacedVertices = false;
   AliFMDEventInspector::SetupForData(vtxAxis);
+  fUseDisplacedVertices = saveDisplaced;
 
   Int_t    maxPart = 450;
   Int_t    maxBin  = 225;
@@ -168,6 +181,11 @@ AliFMDMCEventInspector::SetupForData(const TAxis& vtxAxis)
   fHB->SetDirectory(0);
   fList->Add(fHB);
 
+  fHMcC = static_cast<TH1F*>(fHCent->Clone("mcC"));
+  fHMcC->SetFillColor(kCyan+2);
+  fHMcC->SetDirectory(0);
+  fList->Add(fHMcC);
+  
   fHBvsPart = new TH2F("bVsParticipants", "Impact parameter vs Participants",
                       5*maxB, 0, maxB, maxPart, -.5, maxPart-.5);
   fHBvsPart->SetXTitle("b [fm]");
@@ -221,18 +239,21 @@ AliFMDMCEventInspector::SetupForData(const TAxis& vtxAxis)
   fHCentVsBin->SetZTitle("Event");
   fHCentVsBin->SetDirectory(0);
   fList->Add(fHCentVsBin);
-}
 
-//____________________________________________________________________
-void
-AliFMDMCEventInspector::StoreInformation(Int_t runNo)
-{
-  // Store information about running conditions in the output list 
-  if (!fList) return;
-  AliFMDEventInspector::StoreInformation(runNo);
-  TParameter<bool>* mc = new TParameter<bool>("mc",true); // , fProduction.Data());
-  mc->SetUniqueID(1);
-  fList->Add(mc);
+  Int_t    nC = fHCent->GetNbinsX();
+  Double_t cL = fHCent->GetXaxis()->GetXmin();
+  Double_t cH = fHCent->GetXaxis()->GetXmax();
+  fHCentVsMcC = new TH2F("centralityRecoVsMC", 
+                        "Centrality from reconstruction vs MC derived", 
+                        nC, cL, cH, nC, cL, cH);
+  fHCentVsMcC->SetDirectory(0);
+  fHCentVsMcC->SetStats(0);
+  fHCentVsMcC->SetXTitle("Centralty from Reco [%]");
+  fHCentVsMcC->SetYTitle("Centralty derived from Impact Par. [%]");
+  fHCentVsMcC->SetZTitle("Events");
+  fList->Add(fHCentVsMcC);
+
+  if (fUseDisplacedVertices) fDisplacedVertex.SetupForData(fList, "", true);
 }
 
 namespace
@@ -434,10 +455,12 @@ AliFMDMCEventInspector::ProcessMC(AliMCEvent*       event,
   fHVertex->Fill(vz);
   fHPhiR->Fill(phiR);
   fHB->Fill(b);
+  fHMcC->Fill(c);
   fHBvsPart->Fill(b, npart);
   fHBvsBin->Fill(b, nbin);
 
   if(fUseDisplacedVertices) {
+#if 0
     // Put the vertex at fixed locations 
     Double_t zvtx  = vz;
     Double_t ratio = zvtx/37.5;
@@ -447,6 +470,11 @@ AliFMDMCEventInspector::ProcessMC(AliMCEvent*       event,
     zvtx = 37.5*((Double_t)ratioInt);
     if(TMath::Abs(zvtx) > 999) 
       return kBadVertex;
+#endif
+    if (!fDisplacedVertex.ProcessMC(event)) 
+      return kBadVertex;
+    if (fDisplacedVertex.IsSatellite())
+      vz = fDisplacedVertex.GetVertexZ();
   }
 
   // Check for the vertex bin 
@@ -462,6 +490,32 @@ AliFMDMCEventInspector::ProcessMC(AliMCEvent*       event,
   
   return kOk;
 }
+//____________________________________________________________________
+Bool_t
+AliFMDMCEventInspector::ReadCentrality(const AliESDEvent& esd, 
+                                      Double_t& cent, 
+                                      UShort_t& qual) const
+{
+  // 
+  // Read centrality from event 
+  // 
+  // Parameters:
+  //    esd  Event 
+  //    cent On return, the centrality or negative if not found
+  // 
+  // Return:
+  //    False on error, true otherwise 
+  //
+  Bool_t ret = AliFMDEventInspector::ReadCentrality(esd, cent, qual);
+  if (qual != 0) {
+    AliCentrality* centObj = const_cast<AliESDEvent&>(esd).GetCentrality();
+    if (!centObj)  return ret;
+
+    // For MC, we allow `bad' centrality selections 
+    cent = centObj->GetCentralityPercentileUnchecked(fCentMethod); 
+  }
+  return ret;
+}
 
 //____________________________________________________________________
 namespace {
@@ -565,16 +619,20 @@ AliFMDMCEventInspector::IsSingleDiffractive(AliStack* stack,
 //____________________________________________________________________
 Bool_t
 AliFMDMCEventInspector::CompareResults(Double_t vz,    Double_t trueVz, 
-                                      Double_t cent,  Double_t b,
+                                      Double_t cent,  Double_t mcC, 
+                                      Double_t b,    
                                       Int_t    npart, Int_t    nbin)
 {
   fHVzComp->Fill(trueVz, vz);
   fHBvsCent->Fill(b, cent);
   fHCentVsPart->Fill(npart, cent);
   fHCentVsBin->Fill(nbin, cent);
+  fHCentVsMcC->Fill(cent, mcC);
 
   return true;
 }  
+
+
 //
 // EOF
 //