X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALReconstructor.cxx;h=526a5680eaa46310f8ac80133408c635946e2215;hb=9519e3e3eab8deea511b84c15f82ee14d0b15130;hp=61c5955021e6e5eb04d3707d49568a6f72948c8a;hpb=80453a9fd33d1202229292bedd1d12174b06c4f1;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALReconstructor.cxx b/EMCAL/AliEMCALReconstructor.cxx index 61c5955021e..526a5680eaa 100644 --- a/EMCAL/AliEMCALReconstructor.cxx +++ b/EMCAL/AliEMCALReconstructor.cxx @@ -119,9 +119,7 @@ AliEMCALReconstructor::AliEMCALReconstructor() if(!fPedestalData) AliFatal("Dead map not found in CDB!"); - - InitClusterizer(); - + if(!fGeom) AliFatal(Form("Could not get geometry!")); AliEMCALTriggerDCSConfigDB* dcsConfigDB = AliEMCALTriggerDCSConfigDB::Instance(); @@ -174,32 +172,50 @@ AliEMCALReconstructor::~AliEMCALReconstructor() // fList = AliEMCALHistoUtilities::GetTriggersListOfHists(kTRUE); // } -//____________________________________________________________________________ -void AliEMCALReconstructor::InitClusterizer() +//____________________________________________________________________________ +void AliEMCALReconstructor::InitClusterizer() const { - //Init the clusterizer with geometry and calibration pointers, avoid doing it twice. - - AliEMCALRecParam *recParam = NULL; - AliCDBEntry *entry = (AliCDBEntry*) - AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam"); - //Get The reco param for the default event specie - if (entry) - recParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(0); - - if(!recParam){ - AliFatal("RecoParam not found in CDB!"); + //Init the clusterizer with geometry and calibration pointers, avoid doing it twice. + Int_t clusterizerType = -1; + Int_t eventType = -1; + if(GetRecParam()) { + clusterizerType = GetRecParam()->GetClusterizerFlag(); + eventType = GetRecParam()->GetEventSpecie(); } else{ - if (recParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv1) - { - fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData,fPedestalData); - } - else - { - fgClusterizer = new AliEMCALClusterizerNxN(fGeom, fCalibData,fPedestalData); + AliCDBEntry *entry = (AliCDBEntry*) + AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam"); + //Get The reco param for the default event specie + if (entry) { + AliEMCALRecParam *recParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(0); + if(recParam) clusterizerType = recParam->GetClusterizerFlag(); } } + //Check if clusterizer previously set corresponds to what is needed for this event type + if(fgClusterizer){ + if(eventType!=AliRecoParam::kCalib){ + //printf("ReCreate clusterizer? Clusterizer set <%d>, Clusterizer in use <%s>\n", + // clusterizerType, fgClusterizer->Version()); + + if (clusterizerType == AliEMCALRecParam::kClusterizerv1 && !strcmp(fgClusterizer->Version(),"clu-v1")) return; + + else if(clusterizerType == AliEMCALRecParam::kClusterizerNxN && !strcmp(fgClusterizer->Version(),"clu-NxN")) return; + + //Need to create new clusterizer, the one set previously is not the correct one + delete fgClusterizer; + } + else return; + } + + if (clusterizerType == AliEMCALRecParam::kClusterizerv1) + { + fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData,fPedestalData); + } + else + { + fgClusterizer = new AliEMCALClusterizerNxN(fGeom, fCalibData,fPedestalData); + } } //____________________________________________________________________________ @@ -215,12 +231,14 @@ void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) ReadDigitsArrayFromTree(digitsTree); + InitClusterizer(); + fgClusterizer->InitParameters(); fgClusterizer->SetOutput(clustersTree); - + //Skip clusterization of LED events if (GetRecParam()->GetEventSpecie()!=AliRecoParam::kCalib){ - + if(fgDigitsArr && fgDigitsArr->GetEntries()) { fgClusterizer->SetInput(digitsTree); @@ -299,92 +317,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] += (Int_t)esdV0->GetAdcV0C(i); + v0M[1] += (Int_t)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); + Int_t px, py; + if (fGeom->GetPositionInEMCALFromAbsFastORIndex(rdig->GetId(), px, py)) + { + Int_t a = -1, t = -1, times[10]; -// // rdig->Print(""); - -// 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((Int_t) pos.X(), (Int_t) pos.Y(), i, j); + } + } + } + } -// // Resetting -// fTriggerData->Reset(); -// // cout << "Reset trg data" << endl; - //FIXME UNCOMMENT WHEN ESDTRIGGER AVAILABLE + // Resetting + fTriggerData->Reset(); //######################################## //##############Fill CaloCells############### @@ -479,11 +493,11 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, for (Int_t iCell=0; iCell 0) { absIdList[newCellMult] = (UShort_t)(digitInts[iCell]); - //Uncomment when unfolding is done - //if(emcCells.GetCellAmplitude(digitInts[iCell])>0) - //fracList[newCellMult] = amplFloat[iCell]/(emcCells.GetCellAmplitude(digitInts[iCell])*calibration);//get cell calibration value - //else - fracList[newCellMult] = 0; + //Calculate Fraction + if(emcCells.GetCellAmplitude(digitInts[iCell])>0 && GetRecParam()->GetUnfold()) + fracList[newCellMult] = amplFloat[iCell]/(emcCells.GetCellAmplitude(digitInts[iCell]));//get cell calibration value + else + fracList[newCellMult] = 0; newCellMult++; } }