]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
From Magali: small modifications.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 31 Oct 2009 16:06:33 +0000 (16:06 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 31 Oct 2009 16:06:33 +0000 (16:06 +0000)
EVE/alice-macros/emcal_all.C
EVE/alice-macros/emcal_digits.C

index 6d0b267630b501791c9fb948e6ec17f83886f370..ee35e2401b63c4c5b8fe514613ccd3f203f557b4 100644 (file)
@@ -32,44 +32,75 @@ void emcal_all(const UInt_t evtNum = 0, Bool_t digFile = 0,
               const UInt_t eventsToProcess = 5, TString dirName = "./", 
               const TString esdTreeName = "esdTree", const char *  pattern = ".")
 {
               const UInt_t eventsToProcess = 5, TString dirName = "./", 
               const TString esdTreeName = "esdTree", const char *  pattern = ".")
 {
+
+  Int_t iLoader             = 1;
+  Int_t iESD                = 1;
+  Int_t iAOD                = 0;
+  Int_t iHits               = 1;
+  Int_t iDigits             = 1;
+  Int_t iClusters           = 1;
+
   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
-  if (rl == 0x0)
-    cout<<"Can not instatiate the Run Loader"<<endl;
-  AliESDEvent* esd = AliEveEventManager::AssertESD();
+  // runloader check already in AssertRunLoader function 
+  AliESDEvent* esd = 0x0;
+  if(iESD) esd = AliEveEventManager::AssertESD();
+  // esd check already in AssertESD function 
   AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
   Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
   if(evtID != evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
 
   AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
   Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
   if(evtID != evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
 
-  //Load Hits
-  rl->LoadHits("EMCAL");
-  //Load Digits
-  rl->LoadDigits("EMCAL");
-  //Load RecPoints
-  rl->LoadRecPoints("EMCAL");
-  
-  TTree* ht = rl->GetTreeH("EMCAL",false);
-  TTree* dt = rl->GetTreeD("EMCAL",false);
-  TTree *rt = rl->GetTreeR("EMCAL",false);
+  TTree* ht = 0x0; 
+  TTree* dt = 0x0; 
+  TTree* rt = 0x0; 
+  if(iLoader)
+    {
+      //Load Hits
+      if(iHits) {
+       if(!rl->LoadHits("EMCAL"))
+         ht = rl->GetTreeH("EMCAL",false);
+       else {printf("Please make sure a have a EMCal.Hits.root file \n"); return;}
+      }
+      //Load Digits
+      if(iDigits) {
+       if(!rl->LoadDigits("EMCAL"))
+         dt = rl->GetTreeD("EMCAL",false);
+       else {printf("Please make sure a have a EMCal.Digits.root file \n"); return;}
+      }
+      //Load RecPoints
+      if(iClusters) {
+       if(!rl->LoadRecPoints("EMCAL"))
+         rt = rl->GetTreeR("EMCAL",false);
+       else {printf("Please make sure a have a EMCal.RecPoints.root file \n"); return;}
+      }
+    }
 
   gGeoManager = gEve->GetDefaultGeometry();
   TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
   TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
   emcal_data = new AliEveEMCALData(rl,node,m);
 
   gGeoManager = gEve->GetDefaultGeometry();
   TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
   TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
   emcal_data = new AliEveEMCALData(rl,node,m);
-  emcal_data->SetESD(esd);
-  // RunLoader information
-//  emcal_data->LoadHits(ht); // Does not work with my aliroot version ?
-//  emcal_data->LoadDigits(dt);
-//  emcal_data->LoadRecPoints(rt);
-
-  // To be uncommented if use of emcalLoader
-  rl->GetEvent(evtNum);
-  emcal_data->LoadHitsFromEMCALLoader(emcl);       
-//  emcal_data->LoadDigitsFromEMCALLoader(emcl);     
-//  emcal_data->LoadRecPointsFromEMCALLoader(emcl); 
-
-  // To be uncommented to read esds
-  emcal_data->LoadDigitsFromESD();
-  emcal_data->LoadRecPointsFromESD();
+  if(iESD) emcal_data->SetESD(esd);
+
+  // Get information from RunLoader
+  if(iLoader)
+    {
+      if(iHits)     emcal_data->LoadHits(ht); // Does not work with my aliroot version 
+      if(iDigits)   emcal_data->LoadDigits(dt);
+      if(iClusters) emcal_data->LoadRecPoints(rt);
+      
+      rl->GetEvent(evtNum);
+
+      if(iHits)     emcal_data->LoadHitsFromEMCALLoader(emcl);       
+      if(iDigits)   emcal_data->LoadDigitsFromEMCALLoader(emcl);     
+      if(iClusters) emcal_data->LoadRecPointsFromEMCALLoader(emcl); 
+    }
+
+  // Get information from ESDs
+  if(iESD)
+    {
+      rl->GetEvent(evtNum);
+      if(iDigits) emcal_data->LoadDigitsFromESD();
+      if(iClusters) emcal_data->LoadRecPointsFromESD();
+    }
 
   gStyle->SetPalette(1, 0);
 
 
   gStyle->SetPalette(1, 0);
 
@@ -82,7 +113,6 @@ void emcal_all(const UInt_t evtNum = 0, Bool_t digFile = 0,
 
   for (Int_t sm=0; sm<12; sm++)
     {
 
   for (Int_t sm=0; sm<12; sm++)
     {
-      cout << "\n Form: " << Form("SM %d", sm) << endl;
       AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
       //      esm->SetSModuleID(sm);
       esm->SetDataSource(emcal_data);
       AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
       //      esm->SetSModuleID(sm);
       esm->SetDataSource(emcal_data);
index f297390a80412b67abfba75d1d24d028a2729181..54c23f11b6a4d2ddc3ad29bae9536e64ead3dd70 100644 (file)
@@ -24,7 +24,7 @@
 #include <EMCAL/AliEMCALGeometry.h>
 #include <EMCAL/AliEMCALDigit.h>
 
 #include <EMCAL/AliEMCALGeometry.h>
 #include <EMCAL/AliEMCALDigit.h>
 
-#include <iostream>
+#include <Riostream.h>
 #endif
 
 void emcal_digits()
 #endif
 
 void emcal_digits()
@@ -79,22 +79,6 @@ void emcal_digits()
 
     gEve->AddElement(q, l);
     smodules[sm] = q;
 
     gEve->AddElement(q, l);
     smodules[sm] = q;
-
-    // Add line
-    /*
-    TEveLine *ll = new TEveLine("Test");
-    ll->SetMainColor(kRed);
-    ll->SetLineWidth(2);
-
-    ll->SetNextPoint(0, -20, -20);
-    ll->SetNextPoint(0,  20, -20);
-    ll->SetNextPoint(0,  20,  20);
-    ll->SetNextPoint(0, -20,  20);
-    ll->SetNextPoint(0, -20, -20);
-    ll->RefMainTrans() = q->RefMainTrans();
-
-    q->AddElement(ll);
-    */
   }
 
   TClonesArray *digits = 0;
   }
 
   TClonesArray *digits = 0;
@@ -123,7 +107,7 @@ void emcal_digits()
       amp  = dig->GetAmp(); //amplitude in cell (digit)
       time = dig->GetTime();//time of creation of digit after collision
 
       amp  = dig->GetAmp(); //amplitude in cell (digit)
       time = dig->GetTime();//time of creation of digit after collision
 
-      std::cout<<"Cell ID "<<id<<" Amp "<<amp<<std::endl;//" time "<<time<<endl;
+      cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl;
 
       //Geometry methods
       geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta);
 
       //Geometry methods
       geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta);
@@ -132,19 +116,19 @@ void emcal_digits()
                                        iIphi, iIeta,iphi,ieta);
       //Gives label of cell in eta-phi position per each supermodule
 
                                        iIphi, iIeta,iphi,ieta);
       //Gives label of cell in eta-phi position per each supermodule
 
-      std::cout<< "SModule "<<iSupMod<<"; Tower "<<iTower
+      cout<< "SModule "<<iSupMod<<"; Tower "<<iTower
          <<"; Eta "<<iIeta<<"; Phi "<<iIphi
          <<"; Eta "<<iIeta<<"; Phi "<<iIphi
-         <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<std::endl;
+         <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl;
 
       geom->RelPosCellInSModule(id, x, y, z);
 
       geom->RelPosCellInSModule(id, x, y, z);
-      std::cout << x <<" "<< y <<" "<< z <<std::endl;
+      cout << x <<" "<< y <<" "<< z <<endl;
 
       TEveQuadSet* q = smodules[iSupMod];
       q->AddQuad(y, z);
       q->QuadValue(TMath::Nint(amp));
       q->QuadId(new AliEMCALDigit(*dig));
     } else {
 
       TEveQuadSet* q = smodules[iSupMod];
       q->AddQuad(y, z);
       q->QuadValue(TMath::Nint(amp));
       q->QuadId(new AliEMCALDigit(*dig));
     } else {
-      std::cout<<"Digit pointer 0x0"<<std::endl;
+      cout<<"Digit pointer 0x0"<<endl;
     }
   }
 
     }
   }