fill trigger information in ESDs
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Nov 2010 13:33:48 +0000 (13:33 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Nov 2010 13:33:48 +0000 (13:33 +0000)
EMCAL/AliEMCALReconstructor.cxx

index aca000f..eb24a96 100644 (file)
@@ -299,92 +299,88 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   // printf(" ## AliEMCALReconstructor::FillESD() is started ### \n ");
   //return;
 
-  //FIXME UNCOMMENT WHEN ESDTRIGGER AVAILABLE 
-//   // Trigger
-//   Int_t v0M[2] = {0, 0};
+  //########################################
+  // Trigger
+  //########################################
+
+   Int_t v0M[2] = {0, 0};
        
-//   AliESDVZERO* esdV0 = esd->GetVZEROData();
-
-//   if (esdV0) 
-//   {
-//       for (Int_t i = 0; i < 32; i++)
-//       {
-//               v0M[0] += esdV0->GetAdcV0C(i);
-//               v0M[1] += esdV0->GetAdcV0A(i);
-//       }
-//   }
-//   else
-//   {
-//       AliWarning("Cannot retrieve V0 ESD! Run w/ null V0 charges");
-//   }
+   AliESDVZERO* esdV0 = esd->GetVZEROData();
+
+   if (esdV0) 
+   {
+         for (Int_t i = 0; i < 32; i++)
+         {
+                 v0M[0] += esdV0->GetAdcV0C(i);
+                 v0M[1] += esdV0->GetAdcV0A(i);
+         }
+   }
+   else
+   {
+         AliWarning("Cannot retrieve V0 ESD! Run w/ null V0 charges");
+   }
 
-//   TClonesArray *trgDigits = new TClonesArray("AliEMCALTriggerRawDigit",1000);
+   TClonesArray *trgDigits = new TClonesArray("AliEMCALTriggerRawDigit",1000);
        
-//   TBranch *branchtrg = digitsTree->GetBranch("EMTRG");
+   TBranch *branchtrg = digitsTree->GetBranch("EMTRG");
        
-//   if (!branchtrg) 
-//   { 
-//       AliError("Can't get the branch with the EMCAL trigger digits!");
-//       return;
-//   }
+   if (!branchtrg) 
+   { 
+         AliError("Can't get the branch with the EMCAL trigger digits!");
+         return;
+   }
        
-//   branchtrg->SetAddress(&trgDigits);
-//   branchtrg->GetEntry(0);
+   branchtrg->SetAddress(&trgDigits);
+   branchtrg->GetEntry(0);
   
-//   // Note: fgTriggerProcessor reset done at the end of this method
-//   fgTriggerProcessor->Digits2Trigger(trgDigits, v0M, fTriggerData);
+   // Note: fgTriggerProcessor reset done at the end of this method
+   fgTriggerProcessor->Digits2Trigger(trgDigits, v0M, fTriggerData);
 
-//   // Fill ESD
-//   AliESDCaloTrigger* trgESD = esd->GetCaloTrigger("EMCAL");
+   // Fill ESD
+   AliESDCaloTrigger* trgESD = esd->GetCaloTrigger("EMCAL");
   
-//   if (trgESD)
-//   {
-//       trgESD->Allocate(trgDigits->GetEntriesFast());
+   if (trgESD)
+   {
+         trgESD->Allocate(trgDigits->GetEntriesFast());
          
-//       for (Int_t i = 0; i < trgDigits->GetEntriesFast(); i++)
-//       {       
-//               AliEMCALTriggerRawDigit* rdig = (AliEMCALTriggerRawDigit*)trgDigits->At(i);
+         for (Int_t i = 0; i < trgDigits->GetEntriesFast(); i++)
+         {       
+                 AliEMCALTriggerRawDigit* rdig = (AliEMCALTriggerRawDigit*)trgDigits->At(i);
                  
-//               Int_t px, py;
-//               if (fGeom->GetPositionInEMCALFromAbsFastORIndex(rdig->GetId(), px, py))
-//               {
-//                       Int_t a = -1, t = -1, times[10]; 
-                         
-//                       rdig->GetMaximum(a, t);
-//                       rdig->GetL0Times(times);
-                         
-// //                    rdig->Print("");
+                 Int_t px, py;
+                 if (fGeom->GetPositionInEMCALFromAbsFastORIndex(rdig->GetId(), px, py))
+                 {
+                         Int_t a = -1, t = -1, times[10]; 
                          
-//                       trgESD->Add(px, py, a, t, times, rdig->GetNL0Times(), rdig->GetL1TimeSum());
-//               }
-//       }
+                         rdig->GetMaximum(a, t);
+                         rdig->GetL0Times(times);
+                                                 
+                         trgESD->Add(px, py, a, t, times, rdig->GetNL0Times(), rdig->GetL1TimeSum());
+                 }
+         }
          
-// //    cout << "End of Adding................." << endl;
-
-//       trgESD->SetL1Threshold(0, fTriggerData->GetL1GammaThreshold());
+         trgESD->SetL1Threshold(0, fTriggerData->GetL1GammaThreshold());
          
-//       trgESD->SetL1Threshold(1, fTriggerData->GetL1JetThreshold()  );
+         trgESD->SetL1Threshold(1, fTriggerData->GetL1JetThreshold()  );
 
-//       for (Int_t i = 0; i < kTriggerTypeEnd; i++)
-//       {       
-//               for (Int_t j = 0; j < 2; j++)
-//               {
-//                       TClonesArray* patches = fTriggerData->GetPatches((TriggerType_t)i, j);
+         for (Int_t i = 0; i < kTriggerTypeEnd; i++)
+         {       
+                 for (Int_t j = 0; j < 2; j++)
+                 {
+                         TClonesArray* patches = fTriggerData->GetPatches((TriggerType_t)i, j);
                          
-//                       TIter NextPatch(patches);
-//                       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)NextPatch())
-//                       {
-//                               TVector2 pos; p->Position(pos);
-//                               trgESD->SetTriggerBits(pos.X(), pos.Y(), i, j);
-//                       }
-//               }
-//       }
-//   }
+                         TIter NextPatch(patches);
+                         while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)NextPatch())
+                         {
+                                 TVector2 pos; p->Position(pos);
+                                 trgESD->SetTriggerBits(pos.X(), pos.Y(), i, j);
+                         }
+                 }
+         }
+   }
 
-//   // Resetting
-//   fTriggerData->Reset();
-// //  cout << "Reset trg data" << endl;
-  //FIXME UNCOMMENT WHEN ESDTRIGGER AVAILABLE 
+   // Resetting
+   fTriggerData->Reset();
   
   //########################################
   //##############Fill CaloCells###############