]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fixes for plugin analysis/proper inits (now seems to get same results as with local...
authordsilverm <dsilverm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Sep 2010 10:04:07 +0000 (10:04 +0000)
committerdsilverm <dsilverm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Sep 2010 10:04:07 +0000 (10:04 +0000)
PWG4/totEt/AliAnalysisEt.cxx
PWG4/totEt/AliAnalysisHadEt.cxx
PWG4/totEt/macros/CreateAlienHandlerCaloEtSim.C

index 681fdae0e624f70b7d3e883fd388a9bf6dd6c1ce..d7060435904b7f3f02b7076985705a05c699bdcd 100644 (file)
@@ -85,7 +85,6 @@ AliAnalysisEt::AliAnalysisEt() :
         ,fHistMesonEtAcc(0)
         ,fHistTMDeltaR(0)
 {
-
 }
 
 AliAnalysisEt::~AliAnalysisEt()
@@ -122,11 +121,8 @@ void AliAnalysisEt::FillOutputList(TList *list)
 }
 
 void AliAnalysisEt::Init()
-{// set up cuts and PDG info
-  if (!fCuts) fCuts = new AliAnalysisEtCuts();
-
-  if(!fPdgDB) fPdgDB = new TDatabasePDG();
-  SetParticleCodes();
+{// clear variables, set up cuts and PDG info
+  ResetEventValues();
 }
 
 void AliAnalysisEt::CreateHistograms()
@@ -246,32 +242,45 @@ void AliAnalysisEt::FillHistograms()
     fHistTMDeltaR;
     */
 }
+
 Int_t AliAnalysisEt::AnalyseEvent(AliVEvent *event)
-{
-  //this line is basically here to eliminate a compiler warning that event is not used.  Making it a virtual function did not work with the plugin.
-  cout<<"This event has "<<event->GetNumberOfTracks()<<" tracks"<<endl;
+{ //this line is basically here to eliminate a compiler warning that event is not used.  Making it a virtual function did not work with the plugin.
+  cout << "This event has " << event->GetNumberOfTracks() << " tracks" << endl;
+  ResetEventValues();
   return 0;
 }
 
 void AliAnalysisEt::ResetEventValues()
 { // clear
-    fTotEt = 0;
-    fTotEtAcc = 0;
-    fTotNeutralEt = 0;
-    fTotNeutralEtAcc = 0;
-    fTotChargedEt  = 0;
-    fTotChargedEtAcc = 0;
-    fMultiplicity = 0;
-    fChargedMultiplicity = 0;
-    fNeutralMultiplicity = 0;
-
-    if(!fPdgDB) fPdgDB = new TDatabasePDG();
-
-    if(fPiPlusCode==0){
+  fTotEt = 0;
+  fTotEtAcc = 0;
+  fTotNeutralEt = 0;
+  fTotNeutralEtAcc = 0;
+  fTotChargedEt  = 0;
+  fTotChargedEtAcc = 0;
+  fMultiplicity = 0;
+  fChargedMultiplicity = 0;
+  fNeutralMultiplicity = 0;
+  
+  if (!fCuts || !fPdgDB || fPiPlusCode==0) { // some Init's needed
+    cout << __FILE__ << ":" << __LINE__ << " : Init " << endl;
+    if (!fCuts) {
+      cout << " setting up Cuts " << endl;
+      fCuts = new AliAnalysisEtCuts();
+    }
+    if(!fPdgDB) {
+      cout << " setting up PdgDB " << endl;
+      fPdgDB = new TDatabasePDG();
+    }
+    
+    if (fPiPlusCode==0) {
       SetParticleCodes();
     }
+  }
+  return;
 }
 
+
 void AliAnalysisEt::SetParticleCodes()
 { // set PDG info    
   fPionMass = fPdgDB->GetParticle("pi+")->Mass();
index 3d086c259a58268b01cfec791b32b7acd13fbb4d..07ecfe676959f8aa41627f60b6f460b867147a09 100644 (file)
@@ -94,26 +94,8 @@ AliAnalysisHadEt::~AliAnalysisHadEt()
 
 Int_t AliAnalysisHadEt::AnalyseEvent(AliVEvent *event)
 { //this line is basically here to eliminate a compiler warning that event is not used.  Making it a virtual function did not work with the plugin.
-  cout<<"This event has "<<event->GetNumberOfTracks()<<" tracks"<<endl;
-     ResetEventValues();
-     AliMCEvent *mcEvent = dynamic_cast<AliMCEvent*>(event);
-
-    // Let's play with the stack!
-    AliStack *stack = mcEvent->Stack();
-
-    Int_t nPrim = stack->GetNtrack();
-
-    for (Int_t iPart = 0; iPart < nPrim; iPart++)
-    {
-
-        TParticle *part = stack->Particle(iPart);
-
-        if (!part)
-         {
-            Printf("ERROR: Could not get particle %d", iPart);
-            continue;
-         }
-    }
+  cout << "This event has " << event->GetNumberOfTracks() << " tracks" << endl;
+  ResetEventValues();
   return 0;
 }
 
@@ -122,11 +104,8 @@ void AliAnalysisHadEt::FillOutputList()
 }
 
 void AliAnalysisHadEt::Init()
-{//Initiate member vaiables to reasonable values
-  if (!fCuts) fCuts = new AliAnalysisEtCuts();
-
-  if(!fPdgDB) fPdgDB = new TDatabasePDG();
-  SetParticleCodes();  
+{// clear variables, set up cuts and PDG info
+  ResetEventValues();
 }
 
 void AliAnalysisHadEt::CreateHistograms()
@@ -139,15 +118,31 @@ void AliAnalysisHadEt::FillHistograms()
 
 void AliAnalysisHadEt::ResetEventValues()
 {//Resets event values of et to zero
-    fTotEt = 0;
-    fTotEtAcc = 0;
-    fTotNeutralEt = 0;
-    fTotNeutralEtAcc = 0;
-    fTotChargedEt  = 0;
-    fTotChargedEtAcc = 0;
-    fMultiplicity = 0;
-    fChargedMultiplicity = 0;
-    fNeutralMultiplicity = 0;
+  fTotEt = 0;
+  fTotEtAcc = 0;
+  fTotNeutralEt = 0;
+  fTotNeutralEtAcc = 0;
+  fTotChargedEt  = 0;
+  fTotChargedEtAcc = 0;
+  fMultiplicity = 0;
+  fChargedMultiplicity = 0;
+  fNeutralMultiplicity = 0;
+  
+  if (!fCuts || !fPdgDB || fPiPlusCode==0) { // some Init's needed
+    cout << __FILE__ << ":" << __LINE__ << " : Init " << endl;
+    if (!fCuts) {
+      cout << " setting up Cuts " << endl;
+      fCuts = new AliAnalysisEtCuts();
+    }
+    if(!fPdgDB) {
+      cout << " setting up PdgDB " << endl;
+      fPdgDB = new TDatabasePDG();
+    }
+    
+    if (fPiPlusCode==0) {
+      SetParticleCodes();
+    }
+  }
 }
 
 void AliAnalysisHadEt::SetParticleCodes()
@@ -175,6 +170,10 @@ void AliAnalysisHadEt::SetParticleCodes()
   fAntiNeutronCode = fPdgDB->GetParticle("antineutron")->PdgCode();
   fEPlusCode = fPdgDB->GetParticle("e+")->PdgCode();
   fEMinusCode = fPdgDB->GetParticle("e-")->PdgCode();
+  cout << "Resetting Codes: Pion " << fPiPlusCode
+       << "," << fPiMinusCode 
+       << " Kaon " << fKPlusCode 
+       << "," << fKMinusCode << endl;
 }
 
 void AliAnalysisHadEt::CreateEtaPtHisto2D(TString name, TString title)
index 379819ef58c65fffbbbf7d62db4c181013876ad4..edeb734c7c176caf9389faec9044cd8d3aecaa02 100644 (file)
@@ -44,7 +44,7 @@ AliAnalysisGrid* CreateAlienHandlerCaloEtSim(TString outputDir, TString outputNa
   plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
   // Declare the analysis source files names separated by blancs. To be compiled runtime IN THE SAME ORDER THEY ARE LISTED
   // using ACLiC on the worker nodes.
-  plugin->SetAnalysisSource("AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtMonteCarloEmcal.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisEtReconstructedEmcal.cxx AliAnalysisTaskTotEt.cxx");
+  plugin->SetAnalysisSource("AliAnalysisEtCuts.cxx AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtMonteCarloEmcal.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisEtReconstructedEmcal.cxx AliAnalysisTaskTotEt.cxx");
   // Declare all libraries (other than the default ones for the framework. These will be
   // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
   plugin->SetAdditionalLibs("AliAnalysisEtCuts.h AliAnalysisEt.h AliAnalysisEtMonteCarlo.h AliAnalysisEtMonteCarloPhos.h AliAnalysisEtMonteCarloEmcal.h AliAnalysisEtReconstructed.h AliAnalysisEtReconstructedPhos.h AliAnalysisEtReconstructedEmcal.h AliAnalysisTaskTotEt.h AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtMonteCarloEmcal.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisEtReconstructedEmcal.cxx AliAnalysisTaskTotEt.cxx");