#include "AliEMCALTriggerElectronics.h"
#include "AliEMCALTriggerDCSConfigDB.h"
#include "AliEMCALTriggerDCSConfig.h"
+#include "AliEMCALTriggerData.h"
+#include "AliEMCALTriggerRawDigit.h"
+#include "AliEMCALTriggerPatch.h"
+#include "AliEMCALTriggerTypes.h"
ClassImp(AliEMCALReconstructor)
AliEMCALTriggerElectronics* AliEMCALReconstructor::fgTriggerProcessor = 0x0;
//____________________________________________________________________________
AliEMCALReconstructor::AliEMCALReconstructor()
- : fDebug(kFALSE), fList(0), fGeom(0),fCalibData(0),fPedestalData(0)
+ : fDebug(kFALSE), fList(0), fGeom(0),fCalibData(0),fPedestalData(0),fTriggerData(0x0)
{
// ctor
//Get calibration parameters
if(!fPedestalData)
{
- AliCDBEntry *entry = (AliCDBEntry*)
- AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
- if (entry) fPedestalData = (AliCaloCalibPedestal*) entry->GetObject();
+ AliCDBEntry *entry = (AliCDBEntry*)
+ AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
+ if (entry) fPedestalData = (AliCaloCalibPedestal*) entry->GetObject();
}
-
+
if(!fPedestalData)
AliFatal("Dead map not found in CDB!");
-
+
InitClusterizer();
-
+
if(!fGeom) AliFatal(Form("Could not get geometry!"));
AliEMCALTriggerDCSConfigDB* dcsConfigDB = AliEMCALTriggerDCSConfigDB::Instance();
if (!dcsConfig) AliFatal("No Trigger DCS Configuration from OCDB!");
fgTriggerProcessor = new AliEMCALTriggerElectronics( dcsConfig );
-
- //Init temporary list of digits
+
+ fTriggerData = new AliEMCALTriggerData();
+
+ //Init temporary list of digits
fgDigitsArr = new TClonesArray("AliEMCALDigit",1000);
fgClustersArr = new TObjArray(1000);
-
+
}
//____________________________________________________________________________
if(fGeom) delete fGeom;
if(fCalibData) delete fCalibData;
if(fPedestalData) delete fPedestalData;
-
+
if(fgDigitsArr){
fgDigitsArr->Clear("C");
delete fgDigitsArr;
AliEMCALRecParam *recParam = NULL;
AliCDBEntry *entry = (AliCDBEntry*)
- AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam");
+ AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam");
//Get The reco param for the default event specie
if (entry)
- recParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(0);
-
+ recParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(0);
+
if(!recParam)
AliFatal("RecoParam not found in CDB!");
-
+
if (recParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv1)
- {
- fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData,fPedestalData);
- }
+ {
+ fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData,fPedestalData);
+ }
else
- {
- fgClusterizer = new AliEMCALClusterizerNxN(fGeom, fCalibData,fPedestalData);
- }
+ {
+ fgClusterizer = new AliEMCALClusterizerNxN(fGeom, fCalibData,fPedestalData);
+ }
}
AliCodeTimerAuto("",0)
ReadDigitsArrayFromTree(digitsTree);
-
+
fgClusterizer->InitParameters();
fgClusterizer->SetOutput(clustersTree);
-
- AliEMCALTriggerData* trgData = new AliEMCALTriggerData();
-
- Int_t bufferSize = 32000;
-
- if (TBranch* triggerBranch = clustersTree->GetBranch("EMTRG"))
- triggerBranch->SetAddress(&trgData);
- else
- clustersTree->Branch("EMTRG","AliEMCALTriggerData",&trgData,bufferSize);
-
- TClonesArray *trgDigits = new TClonesArray("AliEMCALRawDigit",1000);
- TBranch *branchdig = digitsTree->GetBranch("EMTRG");
- if (!branchdig)
- {
- AliError("Can't get the branch with the EMCAL trigger digits !");
- return;
- }
-
- branchdig->SetAddress(&trgDigits);
- branchdig->GetEntry(0);
-
+
//Skip clusterization of LED events
if (GetRecParam()->GetEventSpecie()!=AliRecoParam::kCalib){
- Int_t v0M[2] = {0,0};
- fgTriggerProcessor->Digits2Trigger(trgDigits, v0M, trgData);
-
-
- if(fgDigitsArr && fgDigitsArr->GetEntries()) {
+ if(fgDigitsArr && fgDigitsArr->GetEntries()) {
fgClusterizer->SetInput(digitsTree);
}//not a LED event
clustersTree->Fill();
- trgDigits->Delete();
- delete trgDigits; trgDigits = 0x0;
- delete trgData; trgData = 0x0;
-
}
//____________________________________________________________________________
// Works on a single-event basis
rawReader->Reset() ;
+
+ fTriggerData->SetMode(1);
+
if(fgDigitsArr) fgDigitsArr->Clear("C");
-
- TClonesArray *digitsTrg = new TClonesArray("AliEMCALRawDigit", 200);
+
+ TClonesArray *digitsTrg = new TClonesArray("AliEMCALTriggerRawDigit", 32 * 96);
Int_t bufsize = 32000;
digitsTree->Branch("EMCAL", &fgDigitsArr, bufsize);
fgRawUtils->SetTimeMin(GetRecParam()->GetTimeMin());
fgRawUtils->SetTimeMax(GetRecParam()->GetTimeMax());
- fgRawUtils->Raw2Digits(rawReader,fgDigitsArr,fPedestalData,digitsTrg);
+ fgRawUtils->Raw2Digits(rawReader,fgDigitsArr,fPedestalData,digitsTrg,fTriggerData);
}//skip calibration event
else{
AliDebug(1," Calibration Event, skip!");
// Called by AliReconstruct after Reconstruct() and global tracking and vertexing
// and V0
// Works on the current event
- // printf(" ## AliEMCALReconstructor::FillESD() is started ### \n ");
+ // printf(" ## AliEMCALReconstructor::FillESD() is started ### \n ");
//return;
+ //FIXME UNCOMMENT WHEN ESDTRIGGER AVAILABLE
+// // 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");
+// }
+
+// TClonesArray *trgDigits = new TClonesArray("AliEMCALTriggerRawDigit",1000);
+
+// TBranch *branchtrg = digitsTree->GetBranch("EMTRG");
+
+// if (!branchtrg)
+// {
+// AliError("Can't get the branch with the EMCAL trigger digits!");
+// return;
+// }
+
+// branchtrg->SetAddress(&trgDigits);
+// branchtrg->GetEntry(0);
+
+// // Note: fgTriggerProcessor reset done at the end of this method
+// fgTriggerProcessor->Digits2Trigger(trgDigits, v0M, fTriggerData);
+
+// // Fill ESD
+// AliESDCaloTrigger* trgESD = esd->GetCaloTrigger("EMCAL");
+
+// if (trgESD)
+// {
+// trgESD->Allocate(trgDigits->GetEntriesFast());
+
+// 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("");
+
+// trgESD->Add(px, py, a, t, times, rdig->GetNL0Times(), rdig->GetL1TimeSum());
+// }
+// }
+
+// // cout << "End of Adding................." << endl;
+
+// trgESD->SetL1Threshold(0, fTriggerData->GetL1GammaThreshold());
+
+// 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);
+
+// 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
+
//########################################
//##############Fill CaloCells###############
//########################################
ReadDigitsArrayFromTree(digitsTree);
-// TClonesArray *digits = new TClonesArray("AliEMCALDigit",1000);
-// TBranch *branchdig = digitsTree->GetBranch("EMCAL");
-// if (!branchdig) {
-// AliError("can't get the branch with the EMCAL digits !");
-// return;
-// }
-// branchdig->SetAddress(&digits);
-// digitsTree->GetEvent(0);
+// TClonesArray *digits = new TClonesArray("AliEMCALDigit",1000);
+// TBranch *branchdig = digitsTree->GetBranch("EMCAL");
+// if (!branchdig) {
+// AliError("can't get the branch with the EMCAL digits !");
+// return;
+// }
+// branchdig->SetAddress(&digits);
+// digitsTree->GetEvent(0);
Int_t nDigits = fgDigitsArr->GetEntries(), idignew = 0 ;
AliDebug(1,Form("%d digits",nDigits));
Double_t *newFracList = new Double_t[newCellMult];
for(Int_t i = 0; i < newCellMult ; i++) {
newAbsIdList[i]=absIdList[i];
- newFracList[i]=fracList[i];
+ newFracList[i] =fracList[i];
}
ec->SetCellsAbsId(newAbsIdList);
ec->SetCellsAmplitudeFraction(newFracList);
pid->SetReconstructor(kTRUE);
pid->RunPID(esd);
delete pid;
-
- //delete digits;
- //delete clusters;
-
+
//Store EMCAL misalignment matrixes
FillMisalMatrixes(esd) ;