]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
modifications to also run standalone in root
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Apr 2009 11:31:50 +0000 (11:31 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Apr 2009 11:31:50 +0000 (11:31 +0000)
PWG2/FLOW/FlowEventMakers/FlowEventSimpleMaker.cxx
PWG2/FLOW/FlowEventMakers/FlowEventSimpleMaker.h
PWG2/FLOW/macros/compareFlowResults.C
PWG2/FLOW/macros/makeWeights.C
PWG2/FLOW/macros/runFlowAnalysis.C

index c3b7bf76063325f37a665be0268d94d9607ee245..2fa97faaa2d401d5f8f179484450d8037755947c 100644 (file)
@@ -31,7 +31,9 @@
 
 ClassImp(FlowEventSimpleMaker)
 //----------------------------------------------------------------------- 
-FlowEventSimpleMaker::FlowEventSimpleMaker()
+FlowEventSimpleMaker::FlowEventSimpleMaker():
+  fMCReactionPlaneAngle(0.),
+  fCount(0)
 {
   //constructor
 }
@@ -43,41 +45,40 @@ FlowEventSimpleMaker::~FlowEventSimpleMaker()
 }
 
 //-----------------------------------------------------------------------   
-AliFlowEventSimple* FlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* RPCuts, AliFlowTrackSimpleCuts* POICuts)
+AliFlowEventSimple* FlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* rpCuts, AliFlowTrackSimpleCuts* poiCuts)
 {
   //fills the event from a TTree of kinematic.root files
   
   // number of times to use the same particle (trick to introduce nonflow)
   Int_t iLoops = 1;
   
-  //flags for particles passing RP and POI cuts
-  Bool_t bPassedRPCuts  = kFALSE;
-  Bool_t bPassedPOICuts = kFALSE;
+  //flags for particles passing int. and diff. flow cuts
+  Bool_t bPassedRPFlowCuts  = kFALSE;
+  Bool_t bPassedPOIFlowCuts = kFALSE;
   
   //track cut values
-  Double_t dPtMaxRP  = RPCuts->GetPtMax();
-  Double_t dPtMinRP  = RPCuts->GetPtMin();
-  Double_t dEtaMaxRP = RPCuts->GetEtaMax();
-  Double_t dEtaMinRP = RPCuts->GetEtaMin();
-  Double_t dPhiMaxRP = RPCuts->GetPhiMax();
-  Double_t dPhiMinRP = RPCuts->GetPhiMin();
-  Int_t iPIDRP       = RPCuts->GetPID();
+  Double_t dPtMaxRP  = rpCuts->GetPtMax();
+  Double_t dPtMinRP  = rpCuts->GetPtMin();
+  Double_t dEtaMaxRP = rpCuts->GetEtaMax();
+  Double_t dEtaMinRP = rpCuts->GetEtaMin();
+  Double_t dPhiMaxRP = rpCuts->GetPhiMax();
+  Double_t dPhiMinRP = rpCuts->GetPhiMin();
+  Int_t iPIDRP       = rpCuts->GetPID();
   
-  Double_t dPtMaxPOI  = POICuts->GetPtMax();
-  Double_t dPtMinPOI  = POICuts->GetPtMin();
-  Double_t dEtaMaxPOI = POICuts->GetEtaMax();
-  Double_t dEtaMinPOI = POICuts->GetEtaMin();
-  Double_t dPhiMaxPOI = POICuts->GetPhiMax();
-  Double_t dPhiMinPOI = POICuts->GetPhiMin();
-  Int_t iPIDPOI       = POICuts->GetPID();
+  Double_t dPtMaxPOI  = poiCuts->GetPtMax();
+  Double_t dPtMinPOI  = poiCuts->GetPtMin();
+  Double_t dEtaMaxPOI = poiCuts->GetEtaMax();
+  Double_t dEtaMinPOI = poiCuts->GetEtaMin();
+  Double_t dPhiMaxPOI = poiCuts->GetPhiMax();
+  Double_t dPhiMinPOI = poiCuts->GetPhiMin();
+  Int_t iPIDPOI       = poiCuts->GetPID();
   
   Int_t iNumberOfInputTracks = anInput->GetEntries() ;
-  //cerr<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
+
   TParticle* pParticle = new TParticle();
   anInput->SetBranchAddress("Particles",&pParticle);  
   //  AliFlowEventSimple* pEvent = new AliFlowEventSimple(iNumberOfInputTracks);
   AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
-  //cerr<<pEvent<<" pEvent "<<endl;
   
   Int_t iN = iNumberOfInputTracks; // additional variable to artificially fix the number of tracks
   //  Int_t iN = 576; //multiplicity for chi=1.5
@@ -86,27 +87,29 @@ AliFlowEventSimple* FlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrac
   
   Int_t iGoodTracks = 0;
   Int_t itrkN = 0;
+  Int_t iSelParticlesRP = 0;
   Int_t iSelParticlesPOI = 0;
-  Int_t iSelParticlesRP  = 0;
+  
   
   while (itrkN < iNumberOfInputTracks) {
     anInput->GetEntry(itrkN);   //get input particle
-    //checking the cuts for int. and diff. flow
-    if (pParticle->Pt() > dPtMinRP && pParticle->Pt() < dPtMaxRP &&
-       pParticle->Eta() > dEtaMinRP && pParticle->Eta() < dEtaMaxRP &&
-       pParticle->Phi() > dPhiMinRP && pParticle->Phi() < dPhiMaxRP &&
-       TMath::Abs(pParticle->GetPdgCode()) == iPIDRP) { 
-      bPassedRPCuts = kTRUE; 
-    } 
+    if (pParticle->IsPrimary()) {
+      //checking the cuts for int. and diff. flow
+      if (pParticle->Pt() > dPtMinRP && pParticle->Pt() < dPtMaxRP &&
+         pParticle->Eta() > dEtaMinRP && pParticle->Eta() < dEtaMaxRP &&
+         pParticle->Phi() > dPhiMinRP && pParticle->Phi() < dPhiMaxRP &&
+         TMath::Abs(pParticle->GetPdgCode()) == iPIDRP) { 
+       bPassedRPFlowCuts = kTRUE;
+      } 
     
-    if (pParticle->Pt() > dPtMinPOI && pParticle->Pt() < dPtMaxPOI &&
-       pParticle->Eta() > dEtaMinPOI && pParticle->Eta() < dEtaMaxPOI &&
-       pParticle->Phi() > dPhiMinPOI && pParticle->Phi() < dPhiMaxPOI &&
-       TMath::Abs(pParticle->GetPdgCode()) == iPIDPOI){ 
-      bPassedPOICuts = kTRUE; 
+      if (pParticle->Pt() > dPtMinPOI && pParticle->Pt() < dPtMaxPOI &&
+         pParticle->Eta() > dEtaMinPOI && pParticle->Eta() < dEtaMaxPOI &&
+         pParticle->Phi() > dPhiMinPOI && pParticle->Phi() < dPhiMaxPOI &&
+         TMath::Abs(pParticle->GetPdgCode()) == iPIDPOI){ 
+       bPassedPOIFlowCuts = kTRUE; 
+      }
     }
-    
-    if (bPassedRPCuts || bPassedPOICuts) {
+    if (bPassedRPFlowCuts || bPassedPOIFlowCuts) {
       for(Int_t d=0;d<iLoops;d++) {
        AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
        pTrack->SetPt(pParticle->Pt());
@@ -114,13 +117,12 @@ AliFlowEventSimple* FlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrac
        pTrack->SetPhi(pParticle->Phi());
        
        //marking the particles used for int. flow:
-       if(bPassedRPCuts && iSelParticlesRP < iN*iLoops) {  
-         //pTrack->SetForIntegratedFlow(kTRUE);
+       if(bPassedRPFlowCuts && iSelParticlesRP < iN*iLoops) {  
          pTrack->SetForRPSelection(kTRUE);
          iSelParticlesRP++;
        }
        //marking the particles used for diff. flow:
-       if(bPassedPOICuts) {
+       if(bPassedPOIFlowCuts) {
          pTrack->SetForPOISelection(kTRUE);
          iSelParticlesPOI++;
        }
@@ -130,16 +132,21 @@ AliFlowEventSimple* FlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrac
       }//end of for(Int_t d=0;d<iLoops;d++)
     }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts) 
     itrkN++;  
-    bPassedRPCuts  = kFALSE;
-    bPassedPOICuts = kFALSE;
+    bPassedRPFlowCuts  = kFALSE;
+    bPassedPOIFlowCuts = kFALSE;
   }//end of while (itrkN < iNumberOfInputTracks)
   
   pEvent->SetEventNSelTracksRP(iSelParticlesRP);  
-  pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for int. or for diff. flow
+  pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for RP or for POI selection
+  pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
+
+  if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
+  else cout<<" MC Reaction Plane Angle = unknown "<< endl;
 
-  cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout<<" # of selected tracks for RP  = "<<iSelParticlesRP<<endl;
-  cout<<" # of selected tracks for POI = "<<iSelParticlesPOI<<endl;  
+  cout<<" iGoodTracks = "<< iGoodTracks << endl;
+  cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
+  cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
+  cout << "# " << ++fCount << " events processed" << endl;
 
   delete pParticle;
   return pEvent;
index 58189c02e1f41aef06abd2a3d27d76e9aac4e58a..8770948ae2552e51428e3fba403b115189561def 100644 (file)
@@ -28,7 +28,9 @@ class FlowEventSimpleMaker {
  private:
   FlowEventSimpleMaker(const FlowEventSimpleMaker& anAnalysis);            //copy constructor
   FlowEventSimpleMaker& operator=(const FlowEventSimpleMaker& anAnalysis); //assignment operator
-          
+  Double_t  fMCReactionPlaneAngle;   // the angle of the reaction plane from the MC truth
+  Int_t     fCount;   // counter for the number of events processed
+         
   ClassDef(FlowEventSimpleMaker,0)    // macro for rootcint
 };
       
index 6c2d87713574e589dc2203f97fed661228b0fd7c..29d4f513c2672c4a23c4d47ec79a20f3c9ddebb4 100644 (file)
@@ -1,7 +1,18 @@
 //type of analysis can be: ESD, AOD, MC, ESDMC0, ESDMC1
 //const TString type = "ESD"; 
-void compareFlowResults(TString type="ESD")
+
+enum libModes {mLocal,mLocalSource};
+//mLocal: Analyze data on your computer using aliroot
+//mLocalSource: Analyze data on your computer using root + source files
+
+//void compareFlowResults(TString type="",Int_t mode=mLocalSource)
+void compareFlowResults(TString type="ESD",Int_t mode=mLocal)
 { 
+
+  // load needed libraries:                       
+  LoadLibraries(mode);
+
+
   //==================================================================================
   //             set here which plots will be shown by default
   //==================================================================================
@@ -16,7 +27,7 @@ void compareFlowResults(TString type="ESD")
   Bool_t plotDiffFlowEtaPOI = kTRUE;   //differential flow (Eta,POI)
   //==================================================================================
   
+  
   //==================================================================================
   // set here which methods will be plotted by default for differential flow (Pt,RP):
   Bool_t plotMCPtRP    = kFALSE;
@@ -207,28 +218,8 @@ void compareFlowResults(TString type="ESD")
   // LYZEP
   Int_t binLYZEPPOI = 13; 
   //==================================================================================
-                        
-                                                                        
-  //==================================================================================  
-  //load needed libraries:
-  gSystem->AddIncludePath("-I$ROOTSYS/include");
-  gSystem->Load("libTree.so");
-
-  // for AliRoot
-  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
-  gSystem->Load("libANALYSIS.so");
-  gSystem->Load("libPWG2flowCommon.so");
-  cerr<<"libPWG2flowCommon.so loaded ..."<<endl;
-  
-  // for root load histrogram classes
-  // output histosgrams
-  //  gROOT->LoadMacro("code/AliFlowCommonHist.cxx+");
-  //  gROOT->LoadMacro("code/AliFlowCommonHistResults.cxx+");
-  //  gROOT->LoadMacro("code/AliFlowLYZHist1.cxx+");
-  //  gROOT->LoadMacro("code/AliFlowLYZHist2.cxx+");  
-  //==================================================================================
-  
-  
+                                        
   //==================================================================================
   //                         accessing output files
   //==================================================================================
@@ -2757,3 +2748,55 @@ void compareFlowResults(TString type="ESD")
  //=====================================================================================
 
 }
+
+void LoadLibraries(const libModes mode) {
+  
+  //--------------------------------------
+  // Load the needed libraries most of them already loaded by aliroot
+  //--------------------------------------
+  gSystem->Load("libTree.so");
+  gSystem->Load("libGeom.so");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libXMLIO.so");
+  gSystem->Load("libPhysics.so");
+  
+  //----------------------------------------------------------
+  // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< 
+  //----------------------------------------------------------
+  if (mode==mLocal) {
+    //--------------------------------------------------------
+    // If you want to use already compiled libraries 
+    // in the aliroot distribution
+    //--------------------------------------------------------
+
+  //==================================================================================  
+  //load needed libraries:
+  gSystem->AddIncludePath("-I$ROOTSYS/include");
+  gSystem->Load("libTree.so");
+
+  // for AliRoot
+  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+  gSystem->Load("libANALYSIS.so");
+  gSystem->Load("libPWG2flowCommon.so");
+  cerr<<"libPWG2flowCommon.so loaded ..."<<endl;
+  
+  }
+  
+  else if (mode==mLocalSource) {
+    // In root inline compile
+
+    
+    // Output histosgrams
+    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHist.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHistResults.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist1.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist2.cxx+");
+       
+    cout << "finished loading macros!" << endl;  
+    
+  }  
+  
+}
+
+
index e9e8f67b54c9f371c159b3c6934f0f9f8a846af5..102d9bf6a707483e1f0104390836c8954c8f6faa 100755 (executable)
 // 3. cumulant order can be: 2nd, 4th, 6th or 8th.                                                   
 //==========================================================================================
 
-void makeWeights(TString type="ESD", TString method="GFC", TString cumulantOrder="4th")
+
+enum libModes {mLocal,mLocalSource};
+//mLocal: Analyze data on your computer using aliroot
+//mLocalSource: Analyze data on your computer using root + source files
+
+
+//void makeWeights(TString type="", TString method="GFC", TString cumulantOrder="4th", Int_t mode=mLocalSource)
+void makeWeights(TString type="ESD", TString method="GFC", TString cumulantOrder="4th", Int_t mode=mLocal)
 {
  // load needed libraries:
- gSystem->AddIncludePath("-I$ROOTSYS/include");
- gSystem->Load("libTree.so");
+  LoadLibraries(mode);
 
- // for AliRoot
- gSystem->AddIncludePath("-I$ALICE_ROOT/include");
- gSystem->Load("libANALYSIS.so");
- gSystem->Load("libPWG2flowCommon.so");
- cerr<<"libPWG2flowCommon.so loaded ..."<<endl;
 
  // open the output file from the first run of the specified method:
  TString inputFileName = "output";
@@ -160,4 +161,54 @@ void makeWeights(TString type="ESD", TString method="GFC", TString cumulantOrder
 }  
 
 
+void LoadLibraries(const libModes mode) {
+  
+  //--------------------------------------
+  // Load the needed libraries most of them already loaded by aliroot
+  //--------------------------------------
+  gSystem->Load("libTree.so");
+  gSystem->Load("libGeom.so");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libXMLIO.so");
+  gSystem->Load("libPhysics.so");
+  
+  //----------------------------------------------------------
+  // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< 
+  //----------------------------------------------------------
+  if (mode==mLocal) {
+    //--------------------------------------------------------
+    // If you want to use already compiled libraries 
+    // in the aliroot distribution
+    //--------------------------------------------------------
+    
+    //==================================================================================  
+    //load needed libraries:
+    gSystem->AddIncludePath("-I$ROOTSYS/include");
+    gSystem->Load("libTree.so");
+    
+    // for AliRoot
+    gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+    gSystem->Load("libANALYSIS.so");
+    gSystem->Load("libPWG2flowCommon.so");
+    cerr<<"libPWG2flowCommon.so loaded ..."<<endl;
+    
+  }
+  
+  else if (mode==mLocalSource) {
+    
+    // In root inline compile
+    
+    // Output histosgrams
+    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHist.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHistResults.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist1.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist2.cxx+");
+    
+    cout << "finished loading macros!" << endl;  
+    
+  }  
+  
+}
+
+
 
index 0335c4de67e5840c934b612c56767e6d8a4737f1..1657e1e3d0413f723e9093ca3a182240cd640df2 100644 (file)
@@ -226,7 +226,7 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char*
   //------------------------------------------------------------------------
   
   
-  //standard code
+  //standard code to read files in directory
   Int_t fCount = 0;
   TString execDir(gSystem->pwd());
   TString targetDir(dir);
@@ -319,6 +319,7 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char*
              //fill and save the flow event          
              AliFlowEventSimple *fEvent = fEventMaker->FillTracks(kTree, cutsInt, cutsDiff); 
                            
+             // do flow analysis for various methods
              if(MCEP) mcep->Make(fEvent);
              if(QC) qc->Make(fEvent);
              if(GFC) gfc->Make(fEvent);