aodEMcells.CreateContainer(nEMcell);\r
aodEMcells.SetType(AliAODCaloCells::kEMCALCell);\r
for (Int_t iCell = 0; iCell < nEMcell; iCell++) { \r
- aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell));\r
+ aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell),
+ esdEMcells.GetTime(iCell), esdEMcells.GetMCLabel(iCell), esdEMcells.GetEFraction(iCell));\r
}\r
aodEMcells.Sort();\r
}\r
aodPHcells.CreateContainer(nPHcell);\r
aodPHcells.SetType(AliAODCaloCells::kPHOSCell);\r
for (Int_t iCell = 0; iCell < nPHcell; iCell++) { \r
- aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));\r
+ aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),
+ esdPHcells.GetTime(iCell), esdPHcells.GetMCLabel(iCell), esdPHcells.GetEFraction(iCell));\r
}\r
aodPHcells.Sort();\r
}\r
// EMCAL cells
//*fgAODEmcalCells = *(aod->GetEMCALCells()); // This will be valid after 10.Mar.2011.
- if(aodH->GetMergeEMCALCells()) {
+ if(aodH->GetMergeEMCALCells())
+ {
AliAODCaloCells* copycells = aod->GetEMCALCells();
fgAODEmcalCells->CreateContainer(copycells->GetNumberOfCells());
nc = copycells->GetNumberOfCells();
- while( nc-- ){ fgAODEmcalCells->SetCell(nc,copycells->GetCellNumber(nc),copycells->GetAmplitude(nc)); }
-
+
+ while( nc-- ){ fgAODEmcalCells->SetCell(nc,copycells->GetCellNumber(nc),copycells->GetAmplitude(nc),
+ copycells->GetTime(nc),copycells->GetMCLabel(nc),copycells->GetEFraction(nc)); }
+
AliAODCaloCells* cellsA = aodH->GetEventToMerge()->GetEMCALCells();
- if( cellsA ){
+ if( cellsA )
+ {
Int_t ncells = cellsA->GetNumberOfCells();
nc = fgAODEmcalCells->GetNumberOfCells();
- for (Int_t i = 0; i < ncells; i++) {
+
+ for (Int_t i = 0; i < ncells; i++)
+ {
Int_t cn = cellsA->GetCellNumber(i);
Int_t pos = fgAODEmcalCells->GetCellPosition(cn);
- if (pos >= 0) {
+
+ if (pos >= 0)
+ {
Double_t amp = cellsA->GetAmplitude(i) + fgAODEmcalCells->GetAmplitude(pos);
- fgAODEmcalCells->SetCell(pos, cn, amp);
- } else {
+
+ //Check if it is MC, depending on that assing the mc lable, time and e fraction
+ Double_t time = 0;
+ Int_t mclabel =-1;
+ Int_t efrac = 0;
+ if(cellsA->GetMCLabel(i) >= 0 && fgAODEmcalCells->GetMCLabel(i) < 0)
+ {
+ mclabel = cellsA->GetMCLabel(i) ;
+ time = fgAODEmcalCells->GetTime(i) ; // Time from data
+ if(amp > 0) efrac = cellsA->GetAmplitude(i) / amp;
+ }
+ else if(fgAODEmcalCells->GetMCLabel(i) >= 0 && cellsA->GetMCLabel(i) < 0)
+ {
+ mclabel = fgAODEmcalCells->GetMCLabel(i) ;
+ time = cellsA->GetTime(i) ; // Time from data
+ if(amp > 0) efrac = fgAODEmcalCells->GetAmplitude(i) / amp;
+ }
+ else
+ { // take all from input
+ mclabel = cellsA->GetMCLabel(i) ;
+ time = cellsA->GetTime(i) ;
+ if(amp > 0) efrac = cellsA->GetAmplitude(i) / amp;
+ }
+
+ fgAODEmcalCells->SetCell(pos, cn, amp,cellsA->GetTime(i),mclabel,efrac);
+
+ } else
+ {
AliAODCaloCells* copycells1 = new AliAODCaloCells(*fgAODEmcalCells);
fgAODEmcalCells->CreateContainer(nc+1);
Int_t nn = copycells1->GetNumberOfCells();
- while( nn-- ){ fgAODEmcalCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn)); }
- fgAODEmcalCells->SetCell(nc++,cn,cellsA->GetAmplitude(i));
+
+ while( nn-- ){ fgAODEmcalCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn),
+ copycells1->GetTime(nn),copycells1->GetMCLabel(nn),0.); }
+
+ fgAODEmcalCells->SetCell(nc++,cn,cellsA->GetAmplitude(i),cellsA->GetTime(i), cellsA->GetMCLabel(i),0.);
+
delete copycells1;
- }
- }
+ }
+ }
fgAODEmcalCells->Sort();
- }
- } // merge emcal cells
+ }
+ } // merge emcal cells
// PHOS cells
//*fgAODPhosCells = *(aod->GetPHOSCells()); // This will be valid after 10.Mar.2011.
- if(aodH->GetMergePHOSCells()) {
+ if(aodH->GetMergePHOSCells())
+ {
AliAODCaloCells* copycells = aod->GetPHOSCells();
fgAODPhosCells->CreateContainer(copycells->GetNumberOfCells());
nc = copycells->GetNumberOfCells();
- while( nc-- ){ fgAODPhosCells->SetCell(nc,copycells->GetCellNumber(nc),copycells->GetAmplitude(nc)); }
+
+ while( nc-- ){ fgAODPhosCells->SetCell(nc,copycells->GetCellNumber(nc),copycells->GetAmplitude(nc),
+ copycells->GetTime(nc),copycells->GetMCLabel(nc),copycells->GetEFraction(nc)); }
+
AliAODCaloCells* cellsP = aodH->GetEventToMerge()->GetPHOSCells();
- if( cellsP ){
+ if( cellsP )
+ {
Int_t ncellsP = cellsP->GetNumberOfCells();
nc = fgAODPhosCells->GetNumberOfCells();
- for (Int_t i = 0; i < ncellsP; i++) {
+ for (Int_t i = 0; i < ncellsP; i++)
+ {
Int_t cn = cellsP->GetCellNumber(i);
Int_t pos = fgAODPhosCells->GetCellPosition(cn);
- if (pos >= 0) {
+
+ if (pos >= 0)
+ {
Double_t amp = cellsP->GetAmplitude(i) + fgAODPhosCells->GetAmplitude(pos);
- fgAODPhosCells->SetCell(pos, cn, amp);
- } else {
+
+ //Check if it is MC, depending on that assing the mc lable, time and e fraction
+ Double_t time = 0;
+ Int_t mclabel =-1;
+ Int_t efrac = 0;
+ if(cellsP->GetMCLabel(i) >= 0 && fgAODPhosCells->GetMCLabel(i) < 0)
+ {
+ mclabel = cellsP->GetMCLabel(i) ;
+ time = fgAODPhosCells->GetTime(i) ; // Time from data
+ if(amp > 0) efrac = cellsP->GetAmplitude(i) / amp;
+ }
+ else if(fgAODPhosCells->GetMCLabel(i) >= 0 && cellsP->GetMCLabel(i) < 0)
+ {
+ mclabel = fgAODPhosCells->GetMCLabel(i) ;
+ time = cellsP->GetTime(i) ; // Time from data
+ if(amp > 0) efrac = fgAODPhosCells->GetAmplitude(i) / amp;
+ }
+ else
+ { // take all from input
+ mclabel = cellsP->GetMCLabel(i) ;
+ time = cellsP->GetTime(i) ;
+ if(amp > 0) efrac = cellsP->GetAmplitude(i) / amp;
+ }
+
+ fgAODPhosCells->SetCell(pos, cn, amp,cellsP->GetTime(i),mclabel,efrac);
+
+ } else
+ {
AliAODCaloCells* copycells1 = new AliAODCaloCells(*fgAODPhosCells);
fgAODPhosCells->CreateContainer(nc+1);
Int_t nn = copycells1->GetNumberOfCells();
- while( nn-- ){ fgAODPhosCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn)); }
- fgAODPhosCells->SetCell(nc++,cn,cellsP->GetAmplitude(i));
+
+ while( nn-- ){ fgAODPhosCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn),
+ copycells1->GetTime(nn),copycells1->GetMCLabel(nn),0.); }
+
+ fgAODPhosCells->SetCell(nc++,cn,cellsP->GetAmplitude(i),cellsP->GetTime(i), cellsP->GetMCLabel(i),0.);
+
delete copycells1;
- }
- }
+ }
+ }
fgAODPhosCells->Sort();
- }
- } // Merge PHOS Cells
+ }
+ } // Merge PHOS Cells
- if (aodH->GetMergeEMCALTrigger())
+ if (aodH->GetMergeEMCALTrigger() && aod->GetCaloTrigger("EMCAL"))
{
- Int_t EMCALts[48][64], px, py, ts;
- Float_t EMCALfo[48][64], am;
+ Int_t tsEMCAL[48][64], px, py, ts;
+ Float_t foEMCAL[48][64], am;
for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++)
{
- EMCALts[i][j] = 0;
- EMCALfo[i][j] = 0.;
+ tsEMCAL[i][j] = 0;
+ foEMCAL[i][j] = 0.;
}
-
- AliAODCaloTrigger& trg0 = *(aod->GetCaloTrigger("EMCAL"));
-
- trg0.Reset();
- while (trg0.Next())
- {
- trg0.GetPosition(px, py);
-
- if (px > -1 && py > -1)
- {
- trg0.GetL1TimeSum(ts);
- if (ts > -1) EMCALts[px][py] += ts;
-
- trg0.GetAmplitude(am);
- if (am > -1) EMCALfo[px][py] += am;
- }
- }
-
- AliAODCaloTrigger& trg1 = *((aodH->GetEventToMerge())->GetCaloTrigger("EMCAL"));
-
- trg1.Reset();
- while (trg1.Next())
- {
- trg1.GetPosition(px, py);
-
- if (px > -1 && py > -1)
- {
- trg1.GetL1TimeSum(ts);
- if (ts > -1) EMCALts[px][py] += ts;
-
- trg1.GetAmplitude(am);
- if (am > -1) EMCALfo[px][py] += am;
- }
- }
-
- int nEntries = 0;
- for (Int_t i = 0; i < 48; i++)
- for (Int_t j = 0; j < 64; j++)
- if (EMCALts[i][j] || EMCALfo[i][j]) nEntries++;
-
- fgAODEMCALTrigger->Allocate(nEntries);
- Int_t L0times[10]; for (int i = 0; i < 10; i++) L0times[i] = -1;
-
- for (Int_t i = 0; i < 48; i++)
- for (Int_t j = 0; j < 64; j++)
- if (EMCALts[i][j] || EMCALfo[i][j])
- fgAODEMCALTrigger->Add(i, j, EMCALfo[i][j], -1., L0times, 0, EMCALts[i][j], 0);
- }
+
+ AliAODCaloTrigger& trg0 = *(aod->GetCaloTrigger("EMCAL"));
+ trg0.Reset();
+ while (trg0.Next())
+ {
+ trg0.GetPosition(px, py);
+
+ if (px > -1 && py > -1)
+ {
+ trg0.GetL1TimeSum(ts);
+ if (ts > -1) tsEMCAL[px][py] += ts;
+
+ trg0.GetAmplitude(am);
+ if (am > -1) foEMCAL[px][py] += am;
+ }
+ }
+
+ AliAODCaloTrigger& trg1 = *((aodH->GetEventToMerge())->GetCaloTrigger("EMCAL"));
+
+ trg1.Reset();
+ while (trg1.Next())
+ {
+ trg1.GetPosition(px, py);
+
+ if (px > -1 && py > -1)
+ {
+ trg1.GetL1TimeSum(ts);
+ if (ts > -1) tsEMCAL[px][py] += ts;
+
+ trg1.GetAmplitude(am);
+ if (am > -1) foEMCAL[px][py] += am;
+ }
+ }
+
+ int nEntries = 0;
+ for (Int_t i = 0; i < 48; i++)
+ for (Int_t j = 0; j < 64; j++)
+ if (tsEMCAL[i][j] || foEMCAL[i][j]) nEntries++;
+
+ fgAODEMCALTrigger->Allocate(nEntries);
+ Int_t timesL0[10]; for (int i = 0; i < 10; i++) timesL0[i] = -1;
+
+ for (Int_t i = 0; i < 48; i++)
+ for (Int_t j = 0; j < 64; j++)
+ if (tsEMCAL[i][j] || foEMCAL[i][j])
+ fgAODEMCALTrigger->Add(i, j, foEMCAL[i][j], -1., timesL0, 0, tsEMCAL[i][j], 0);
+ }
if (aodH->GetMergePHOSTrigger())
{
Int_t ncells = cells->GetNumberOfCells();
for (Int_t icell = 0, idigit = 0; icell < ncells; ++icell)
{
- Double_t cellAmplitude=0, cellTime=0;
- Short_t cellNumber=0;
+ Double_t cellAmplitude=0, cellTime=0, efrac = 0;
+ Short_t cellNumber=0, mcLabel=-1;
- if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime) != kTRUE)
+ if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime, mcLabel, efrac) != kTRUE)
break;
// Do not add if already too low (some cells set to 0 if bad channels)
#endif
+Bool_t kPrintCaloCells = kTRUE;
+Bool_t kPrintCaloClusters = kTRUE;
+
+
void TestAOD() {
- TFile* f = new TFile("aod.root");
+ TFile* f = new TFile("AliAOD.root");
TTree* aodTree = (TTree*)f->Get("aodTree");
AliAODEvent* aod = new AliAODEvent();
cout << "Event: " << iev+1 << "/" << nEvt << endl;
aodTree->GetEvent(iev);
- TRefArray* caloClusters = new TRefArray();
- aod->GetEMCALClusters(caloClusters);
-
//get reconstructed vertex position
Double_t vertex_position[3] = { aod->GetPrimaryVertex()->GetX(),
aod->GetPrimaryVertex()->GetY(),
aod->GetPrimaryVertex()->GetZ()};
- Int_t nclus = caloClusters->GetEntries();
- for (Int_t icl = 0; icl < nclus; icl++) {
-
- AliAODCaloCluster* clus = (AliAODCaloCluster*)caloClusters->At(icl);
- Float_t energy = clus->E();
- TLorentzVector p;
- clus->GetMomentum(p,vertex_position);
- Int_t nMatched = clus->GetNTracksMatched();
-
- cout << "Cluster: " << icl+1 << "/" << nclus << " Energy: " << energy << " Phi: " << p.Phi() << " Eta: " << p.Eta() << " #Matches: " << nMatched << endl;
-
-
+ //------------------------------------------------------
+ // Clusters loop
+ //------------------------------------------------------
+ if(kPrintCaloClusters)
+ {
+ TRefArray* caloClusters = new TRefArray();
+ aod->GetEMCALClusters(caloClusters);
+
+ Int_t nclus = caloClusters->GetEntries();
+ for (Int_t icl = 0; icl < nclus; icl++)
+ {
+
+ AliAODCaloCluster* clus = (AliAODCaloCluster*)caloClusters->At(icl);
+ Float_t energy = clus->E();
+ Float_t time = clus->GetTOF()*1.e9;
+ TLorentzVector p;
+ clus->GetMomentum(p,vertex_position);
+ Int_t nMatched = clus->GetNTracksMatched();
+
+ cout << "Cluster: " << icl+1 << "/" << nclus << " - Energy: " << energy << "; Time "<<time
+ <<"; Phi: " << p.Phi() << "; Eta: " << p.Eta() << "; #Matches: " << nMatched << endl;
+
+ }
+ }
+
+ //------------------------------------------------------
+ // Cells loop
+ //------------------------------------------------------
+
+ if(kPrintCaloCells)
+ {
+ AliVCaloCells &cells= *(aod->GetEMCALCells());
+ Int_t nTotalCells = cells.GetNumberOfCells() ;
+ //Int_t type = cells.GetType();
+ for (Int_t icell= 0; icell < nTotalCells; icell++) {
+ cout<<"Cell : "<<icell<<"/"<<nTotalCells<<" - ID: "<<cells.GetCellNumber(icell)<<"; Amplitude: "<<cells.GetAmplitude(icell)<<"; Time: "<<cells.GetTime(icell)*1e9;
+ cout << "; MC label "<<cells.GetMCLabel(icell)<<"; Embeded E fraction "<<cells.GetEFraction(icell);
+ cout<<endl;
+ }// cell loop
}
-
+
}
//Change the bool depending on what information you want to print
// when all FALSE, prints minimum cluster information.
Bool_t kPrintKine = kFALSE; //Do not use for raw data.
-Bool_t kPrintCaloCells = kFALSE;
+Bool_t kPrintCaloCells = kTRUE;
Bool_t kPrintCaloTrigger = kFALSE;
Bool_t kPrintTrackMatches = kFALSE;
Bool_t kPrintClusterCells = kFALSE;
TTree* esdTree = (TTree*)f->Get("esdTree");
AliESDEvent* esd = new AliESDEvent();
esd->ReadFromTree(esdTree);
-
+
//Init geometry and array that will contain the clusters
TRefArray* caloClusters = new TRefArray();
AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEAR") ;
//Get Cells Array, all cells in event, print cells info
//------------------------------------------------------
AliVCaloCells &cells= *(esd->GetEMCALCells());
- //AliESDCaloCells &cells= *(esd->GetEMCALCells());
-
+
if(kPrintCaloCells){
Int_t nTotalCells = cells.GetNumberOfCells() ;
//Int_t type = cells.GetType();
for (Int_t icell= 0; icell < nTotalCells; icell++) {
- cout<<"Cell : "<<icell<<"/"<<nTotalCells<<" ID: "<<cells.GetCellNumber(icell)<<" Amplitude: "<<cells.GetAmplitude(icell)<<" Time: "<<cells.GetTime(icell)*1e9<<endl;
- }// cell loop
+ cout<<"Cell : "<<icell<<"/"<<nTotalCells<<" - ID: "<<cells.GetCellNumber(icell)<<"; Amplitude: "<<cells.GetAmplitude(icell)<<"; Time: "<<cells.GetTime(icell)*1e9;
+ cout << "; MC label "<<cells.GetMCLabel(icell)<<"; Embeded E fraction "<<cells.GetEFraction(icell);
+ cout<<endl; }// cell loop
}
//------------------------------------------------------
// Calo Trigger
//------------------------------------------------------
-
+
if(kPrintCaloTrigger)
{
AliESDCaloTrigger& trg = *(esd->GetCaloTrigger("EMCAL"));
}
}
}
-
+
//------------------------------------------------------
// Calo Clusters
//------------------------------------------------------
//Get CaloClusters Array
- caloClusters->Clear();
esd->GetEMCALClusters(caloClusters);
//loop over clusters
for (Int_t icl = 0; icl < nclus; icl++) {
AliVCluster* clus = (AliVCluster*)caloClusters->At(icl);
- //AliESDCluster* clus = (AliESDCluster*)caloClusters->At(icl);
Float_t energy = clus->E();
clus->GetPosition(pos);
TVector3 vpos(pos[0],pos[1],pos[2]);
Int_t nLabels = clus->GetNLabels();
Int_t labelIndex = clus->GetLabel();
Int_t nCells = clus->GetNCells();
-
+
//Fill some histograms
hEta->Fill(ceta);
hPhi->Fill(cphi*TMath::RadToDeg());
//Print basic cluster information
cout << "Cluster: " << icl+1 << "/" << nclus << " Energy: " << energy << "; Phi: "
- << cphi*TMath::RadToDeg() << "; Eta: " << ceta << "; NCells: " << nCells << " ;#Matches: " << nMatched
- << "; Index: " << trackIndex << "; #Labels: " << nLabels << " Index: "
- << labelIndex << "; Time "<<clus->GetTOF()*1e9<<" ns "<<endl;
+ << cphi*TMath::RadToDeg() << "; Eta: " << ceta << "; NCells: " << nCells << " ;#Matches: " << nMatched
+ << "; Index: " << trackIndex << "; #Labels: " << nLabels << " Index: "
+ << labelIndex << "; Time "<<clus->GetTOF()*1e9<<" ns "<<endl;
//Print primary info
if(stack && kPrintKine) {
- if(labelIndex >= 0 && labelIndex < stack->GetNtrack()){
- TParticle * particle = stack->Particle(labelIndex);
- //Fill histograms with primary info
- hMCEta->Fill(particle->Eta());
- hMCPhi->Fill(particle->Phi()*TMath::RadToDeg());
- hMCE ->Fill(particle->Energy());
- hDEta ->Fill(ceta-particle->Eta());
- hDPhi ->Fill(cphi*TMath::RadToDeg()-particle->Phi()*TMath::RadToDeg());
- hDE ->Fill(energy-particle->Energy());
- //Print primary values
- cout<<" More contributing primary: "<<particle->GetName()<<"; with kinematics: "<<endl;
- cout<<" \t Energy: "<<particle->Energy()<<"; Phi: "<<particle->Phi()*TMath::RadToDeg()<<"; Eta: "<<particle->Eta()<<endl;
- for(Int_t i = 1; i < nLabels; i++){
- //particle = stack->Particle((((AliESDCaloCluster*)clus)->GetLabelsArray())->At(i));
- particle = stack->Particle((clus->GetLabels())[i]);
- //or Int_t *labels = clus->GetLabels();
- //particle = stack->Particle(labels[i]);
- cout<<" Other contributing primary: "<<particle->GetName()<< "; Energy "<<particle->Energy()<<endl;
- }
- }
- else if( labelIndex >= stack->GetNtrack()) cout <<"PROBLEM, label is too large : "<<labelIndex<<" >= particles in stack "<< stack->GetNtrack() <<endl;
- else cout<<"Negative label!!! : "<<labelIndex<<endl;
+ if(labelIndex >= 0 && labelIndex < stack->GetNtrack()){
+ TParticle * particle = stack->Particle(labelIndex);
+ //Fill histograms with primary info
+ hMCEta->Fill(particle->Eta());
+ hMCPhi->Fill(particle->Phi()*TMath::RadToDeg());
+ hMCE ->Fill(particle->Energy());
+ hDEta ->Fill(ceta-particle->Eta());
+ hDPhi ->Fill(cphi*TMath::RadToDeg()-particle->Phi()*TMath::RadToDeg());
+ hDE ->Fill(energy-particle->Energy());
+ //Print primary values
+ cout<<" More contributing primary: "<<particle->GetName()<<"; with kinematics: "<<endl;
+ cout<<" \t Energy: "<<particle->Energy()<<"; Phi: "<<particle->Phi()*TMath::RadToDeg()<<"; Eta: "<<particle->Eta()<<endl;
+ for(Int_t i = 1; i < nLabels; i++){
+ //particle = stack->Particle((((AliESDCaloCluster*)clus)->GetLabelsArray())->At(i));
+ particle = stack->Particle((clus->GetLabels())[i]);
+ //or Int_t *labels = clus->GetLabels();
+ //particle = stack->Particle(labels[i]);
+ cout<<" Other contributing primary: "<<particle->GetName()<< "; Energy "<<particle->Energy()<<endl;
+ }
+ }
+ else if( labelIndex >= stack->GetNtrack()) cout <<"PROBLEM, label is too large : "<<labelIndex<<" >= particles in stack "<< stack->GetNtrack() <<endl;
+ else cout<<"Negative label!!! : "<<labelIndex<<endl;
} // play with stack
// Matching results
if(kPrintTrackMatches && trackIndex >= 0) {
- AliESDtrack* track = esd->GetTrack(trackIndex);
- Double_t tphi = track->GetOuterParam()->Phi();
- Double_t teta = track->GetOuterParam()->Eta();
- Double_t tmom = track->GetOuterParam()->P();
- cout << "\t Track Momentum: " << tmom << " phi: " << tphi << " eta: " << teta << endl;
-
- Double_t deta = teta - ceta;
- Double_t dphi = tphi - cphi;
- if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi();
- if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi();
- Double_t dR = sqrt(dphi*dphi + deta*deta);
-
- Double_t pOverE = tmom/energy;
-
- if(dR < 0.02 && pOverE < 1.8 && nCells > 1) {
- cout << "\n\t Excellent MATCH! dR = " << dR << " p/E = " << pOverE << " nCells = " << nCells << endl;
- }
+ AliESDtrack* track = esd->GetTrack(trackIndex);
+ Double_t tphi = track->GetOuterParam()->Phi();
+ Double_t teta = track->GetOuterParam()->Eta();
+ Double_t tmom = track->GetOuterParam()->P();
+ cout << "\t Track Momentum: " << tmom << " phi: " << tphi << " eta: " << teta << endl;
+
+ Double_t deta = teta - ceta;
+ Double_t dphi = tphi - cphi;
+ if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi();
+ if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi();
+ Double_t dR = sqrt(dphi*dphi + deta*deta);
+
+ Double_t pOverE = tmom/energy;
+
+ if(dR < 0.02 && pOverE < 1.8 && nCells > 1) {
+ cout << "\n\t Excellent MATCH! dR = " << dR << " p/E = " << pOverE << " nCells = " << nCells << endl;
+ }
}// matching
//Get PID weights and print them
if(kPrintClusterPID){
- const Double_t *pid = clus->GetPID();
- printf("PID weights: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
- pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0],
- pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
- pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton],
- pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]);
+ const Double_t *pid = clus->GetPID();
+ printf("PID weights: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
+ pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0],
+ pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
+ pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton],
+ pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]);
}//PID
//Get CaloCells of cluster and print their info, position.
if(kPrintClusterCells){
- UShort_t * index = clus->GetCellsAbsId() ;
- Double_t * fraction = clus->GetCellsAmplitudeFraction() ;
- Int_t sm = -1;
- for(Int_t i = 0; i < nCells ; i++){
- Int_t absId = index[i]; // or clus->GetCellNumber(i) ;
- Double_t ampFract = fraction[i];
- Float_t amp = cells.GetCellAmplitude(absId) ;
- Double_t time = cells.GetCellTime(absId);
- cout<<"\t Cluster Cell: AbsID : "<< absId << " == "<<clus->GetCellAbsId(i) <<"; Amplitude "<< amp << "; Fraction "<<ampFract<<"; Time " <<time*1e9<<endl;
- //Geometry methods
- Int_t iSupMod = 0 ;
- Int_t iTower = 0 ;
- Int_t iIphi = 0 ;
- Int_t iIeta = 0 ;
- Int_t iphi = 0 ;
- Int_t ieta = 0 ;
- if(geom){
- geom->GetCellIndex(absId,iSupMod,iTower,iIphi,iIeta);
- //Gives SuperModule and Tower numbers
- geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
- iIphi, iIeta,iphi,ieta);
- //Gives label of cell in eta-phi position per each supermodule
- Float_t cellPhi = 0;
- Float_t cellEta = 0;
- geom->EtaPhiFromIndex(absId,cellEta,cellPhi);
- cout<< " SModule "<<iSupMod<<"; Tower "<<iTower <<"; Eta "<<iIeta
- <<"; Phi "<<iIphi<<"; Index: Cell Eta "<<ieta<<"; Cell Phi "<<iphi
- <<"; Global: Cell Eta "<<cellEta<<"; Cell Phi "<<cellPhi*TMath::RadToDeg()<<endl;
- if(i==0) sm = iSupMod;
- else{
- if(sm!=iSupMod) printf("******CLUSTER SHARED BY 2 SuperModules!!!!\n");
- }
- }// geometry on
- }// cluster cell loop
+ UShort_t * index = clus->GetCellsAbsId() ;
+ Double_t * fraction = clus->GetCellsAmplitudeFraction() ;
+ Int_t sm = -1;
+ for(Int_t i = 0; i < nCells ; i++){
+ Int_t absId = index[i]; // or clus->GetCellNumber(i) ;
+ Double_t ampFract = fraction[i];
+ Float_t amp = cells.GetCellAmplitude(absId) ;
+ Double_t time = cells.GetCellTime(absId);
+ cout<<"\t Cluster Cell: AbsID : "<< absId << " == "<<clus->GetCellAbsId(i) <<"; Amplitude "<< amp << "; Fraction "<<ampFract<<"; Time " <<time*1e9<<endl;
+ //Geometry methods
+ Int_t iSupMod = 0 ;
+ Int_t iTower = 0 ;
+ Int_t iIphi = 0 ;
+ Int_t iIeta = 0 ;
+ Int_t iphi = 0 ;
+ Int_t ieta = 0 ;
+ if(geom){
+ geom->GetCellIndex(absId,iSupMod,iTower,iIphi,iIeta);
+ //Gives SuperModule and Tower numbers
+ geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
+ iIphi, iIeta,iphi,ieta);
+ //Gives label of cell in eta-phi position per each supermodule
+ Float_t cellPhi = 0;
+ Float_t cellEta = 0;
+ geom->EtaPhiFromIndex(absId,cellEta,cellPhi);
+ cout<< " SModule "<<iSupMod<<"; Tower "<<iTower <<"; Eta "<<iIeta
+ <<"; Phi "<<iIphi<<"; Index: Cell Eta "<<ieta<<"; Cell Phi "<<iphi
+ <<"; Global: Cell Eta "<<cellEta<<"; Cell Phi "<<cellPhi*TMath::RadToDeg()<<endl;
+ if(i==0) sm = iSupMod;
+ else{
+ if(sm!=iSupMod) printf("******CLUSTER SHARED BY 2 SuperModules!!!!\n");
+ }
+ }// geometry on
+ }// cluster cell loop
}// print cell clusters
} //cluster loop
} // event loop
for(Int_t i = 0; i < cluster->GetNCells() ; i++){
Int_t absId = cluster->GetCellAbsId(i) ;
for (Int_t j = startCell; j < endCell ; j++) {
- Short_t cellNumber;
- Double_t amp ;
- Double_t time;
- cells->GetCell(j, cellNumber, amp, time) ;
+ Short_t cellNumber, mclabel;
+ Double_t amp, time, efrac;
+ cells->GetCell(j, cellNumber, amp, time,mclabel,efrac) ;
if (absId == cellNumber) {
if(amp > ampMax){
ampMax = amp;
}
if(!fEMCALRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi)){ //Channel is not declared as bad
- aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor);
+ aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor,
+ eventEMcells.GetTime(iCell),eventEMcells.GetMCLabel(iCell),eventEMcells.GetEFraction(iCell));
//printf("GOOD channel\n");
}
else {
- aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0);
+ aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0,-1,-1,0);
//printf("BAD channel\n");
}
}
aodPHcells.CreateContainer(nPHcell);
aodPHcells.SetType(AliVCaloCells::kPHOSCell);
for (Int_t iCell = 0; iCell < nPHcell; iCell++) {
- aodPHcells.SetCell(iCell,eventPHcells.GetCellNumber(iCell),eventPHcells.GetAmplitude(iCell));
+ aodPHcells.SetCell(iCell,eventPHcells.GetCellNumber(iCell),eventPHcells.GetAmplitude(iCell),
+ eventPHcells.GetTime(iCell),eventPHcells.GetMCLabel(iCell),eventPHcells.GetEFraction(iCell));
}
aodPHcells.Sort();
}
Double_t cellAmplitude = 0;
Double_t cellTime = 0;
Short_t cellNumber = 0;
+ Short_t cellMCLabel = 0;
+ Double_t cellEFrac = 0;
Int_t nClustersOrg = 0;
// Fill the array with the EMCAL clusters, copy them
//CalibrateCells
for (Int_t icell = 0; icell < cells->GetNumberOfCells(); icell++)
{
- if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime) != kTRUE)
+ if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime, cellMCLabel, cellEFrac) != kTRUE)
break;
Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
if(!fRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi))
{ //Channel is not declared as bad
- aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor);
+ aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor,
+ eventEMcells.GetTime(iCell),eventEMcells.GetMCLabel(iCell),eventEMcells.GetEFraction(iCell));
}
else
{
- aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0);
+ aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0,-1,-1,0);
}
}
aodEMcells.Sort();
Double_t avgE = 0; // for background subtraction
const Int_t ncells = cells->GetNumberOfCells();
for (Int_t icell = 0, idigit = 0; icell < ncells; ++icell) {
- Double_t cellAmplitude=0, cellTime=0;
- Short_t cellNumber=0;
- if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime) != kTRUE)
+ Double_t cellAmplitude=0, cellTime=0, cellEFrac = 0;
+ Short_t cellNumber=0, cellMCLabel=-1;
+ if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime, cellMCLabel, cellEFrac) != kTRUE)
break;
AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->New(idigit));
digit->SetId(cellNumber);
return;
for (Int_t i = 0; i<ncells; ++i) {
- Short_t id=-1;
- Double_t amp=0,time=0;
- if (!cells->GetCell(i, id, amp, time))
+ Short_t id=-1, mclabel = -1;
+ Double_t amp=0,time=0, efrac = 0;
+ if (!cells->GetCell(i, id, amp, time,mclabel,efrac))
continue;
amp -= cellMeanE;
if (amp<0.001)
{
nCells ++;
- Double_t amp =0., time = 0.;
+ Double_t amp =0., time = 0., efrac = 0;
+ Short_t mclabel = -1;
- cells.GetCell(icell, absId, amp, time);
+ cells.GetCell(icell, absId, amp, time,mclabel,efrac);
fGeometry->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
fGeometry->GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta, iphi, ieta);
{
// Fill cell histograms not related with a cluster
- Short_t absId;
- Double_t amp, time;
+ Short_t absId,mclabel;
+ Double_t amp, time,efrac;
Int_t sm;
for (Short_t c = 0; c < cells->GetNumberOfCells(); c++) {
- cells->GetCell(c, absId, amp, time);
+ cells->GetCell(c, absId, amp, time,mclabel,efrac);
if ((sm = GetSM(absId)) < 0) continue;
if (fhECells[sm]) fhECells[sm]->Fill(amp);
aodPHcells.CreateContainer(nPHcell);
aodPHcells.SetType(AliAODCaloCells::kPHOSCell);
for (Int_t iCell = 0; iCell < nPHcell; iCell++) {
- aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));
+ aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),
+ esdPHcells.GetTime(iCell),esdPHcells.GetMCLabel(iCell),0);
}
aodPHcells.Sort();
}
aodEMcells.CreateContainer(nEMcell);
aodEMcells.SetType(AliAODCaloCells::kEMCALCell);
for (Int_t iCell = 0; iCell < nEMcell; iCell++) {
- aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell));
+ aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell),
+ esdEMcells.GetTime(iCell),esdEMcells.GetMCLabel(iCell),0);
}
aodEMcells.Sort();
}
fEmbeddedCells->CreateContainer(nPHcell);
fEmbeddedCells->SetType(AliAODCaloCells::kPHOSCell);
for (Int_t iCell = 0; iCell < nPHcell; iCell++) {
- fEmbeddedCells->SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));
+ fEmbeddedCells->SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),
+ esdPHcells.GetTime(iCell),esdPHcells.GetMCLabel(iCell),0);
}
fEmbeddedCells->Sort();
}
//First copy data digits
Int_t ndigit=0 ;
for (Short_t icell = 0; icell < fCellsPHOS->GetNumberOfCells(); icell++) {
- Short_t id=0;
- Double_t time=0., amp=0. ;
- if (fCellsPHOS->GetCell(icell, id, amp, time) != kTRUE)
+ Short_t id=0, mcLabel=-1;
+ Double_t time=0., amp=0., efrac = 0. ;
+ if (fCellsPHOS->GetCell(icell, id, amp, time,mcLabel,efrac) != kTRUE)
break;
new((*fDigitsArr)[ndigit]) AliPHOSDigit(-1,id,float(amp),float(time),ndigit);
for(Int_t ic=0; ic < clus->GetNCells(); ic++ ){
for (Int_t icell = 0; icell < cellsS->GetNumberOfCells(); icell++){
- Short_t cellNumber;
- Double_t cellAmplitude=0., cellTime=0. ;
- cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime) ;
+ Short_t cellNumber, mcLabel = -1;
+ Double_t cellAmplitude=0., cellTime=0., efrac = 0 ;
+ cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime,mcLabel,efrac) ;
if(cellNumber==index[ic]){
cellLabels[icell]=label;
cellSecondLabels[icell]=label2;
// printf("================End Signal==================\n") ;
for (Int_t icell = 0; icell < cellsS->GetNumberOfCells(); icell++) {
- Short_t cellNumber;
- Double_t cellAmplitude=0., cellTime=0. ;
- if (cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime) != kTRUE)
+ Short_t cellNumber, mcLabel = -1;
+ Double_t cellAmplitude=0., cellTime=0., efrac ;
+ if (cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime, mcLabel, efrac) != kTRUE)
break;
//Add only digits related to the cluster, no noisy digits...
if(cellLabels[icell]==-1)
ClassImp(AliAODCaloCells)
-AliAODCaloCells::AliAODCaloCells() : AliVCaloCells(), fNCells(0), fCellNumber(0), fAmplitude(0), fIsSorted(kTRUE), fType(kUndef)
+//_______________________________________________________
+AliAODCaloCells::AliAODCaloCells() :
+ AliVCaloCells(), fNCells(0), fCellNumber(0),
+ fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+ fIsSorted(kTRUE), fType(kUndef)
{
// default constructor
}
+//_____________________________________________________________________________________
AliAODCaloCells::AliAODCaloCells(const char* name, const char* title, VCells_t ttype) :
- AliVCaloCells(name, title), fNCells(0), fCellNumber(0), fAmplitude(0), fIsSorted(kTRUE), fType(ttype)
+ AliVCaloCells(name, title), fNCells(0), fCellNumber(0),
+ fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+ fIsSorted(kTRUE), fType(ttype)
{
//constructor
}
+//________________________________________________________________
AliAODCaloCells::AliAODCaloCells(const AliAODCaloCells& cells) :
- AliVCaloCells(cells),
- fNCells(cells.fNCells),
- fCellNumber(0),
- fAmplitude(0),
- fIsSorted(cells.fIsSorted),
- fType(cells.fType)
+ AliVCaloCells(cells), fNCells(cells.fNCells), fCellNumber(0),
+ fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+ fIsSorted(cells.fIsSorted), fType(cells.fType)
{
// Copy constructor
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
-
+ fTime = new Double32_t[fNCells];
+ fMCLabel = new Short_t[fNCells];
+ fEFraction = new Double32_t[fNCells];
+
for (Int_t i = 0; i < fNCells; i++) {
fCellNumber[i] = cells.fCellNumber[i];
fAmplitude[i] = cells.fAmplitude[i];
+ if(cells.fMCLabel) fTime[i] = cells.fTime[i];
+ if(cells.fMCLabel) fMCLabel[i] = cells.fMCLabel[i];
+ if(cells.fEFraction)fEFraction[i] = cells.fEFraction[i];
}
}
+//________________________________________________________________________
AliAODCaloCells& AliAODCaloCells::operator=(const AliAODCaloCells& source)
{
- // Assignment operator
- if(this != &source) {
+ // Assignment operator
+ if(this != &source)
+ {
AliVCaloCells::operator=(source);
- if(fNCells != source.fNCells) {
+ if(fNCells != source.fNCells)
+ {
delete [] fCellNumber;
delete [] fAmplitude;
+ delete [] fTime;
+ delete [] fMCLabel;
+ delete [] fEFraction;
+
fNCells = source.fNCells;
+
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
+ fTime = new Double32_t[fNCells];
+ fMCLabel = new Short_t[fNCells];
+ fEFraction = new Double32_t[fNCells];
}
+
memcpy(fCellNumber,source.fCellNumber, fNCells*sizeof(Short_t));
memcpy(fAmplitude, source.fAmplitude, fNCells*sizeof(Double32_t));
+ if(source.fTime && fTime) memcpy(fTime, source.fTime, fNCells*sizeof(Double32_t));
+ if(source.fMCLabel && fMCLabel) memcpy(fMCLabel, source.fMCLabel, fNCells*sizeof(Short_t));
+ if(source.fEFraction && fEFraction) memcpy(fEFraction, source.fEFraction, fNCells*sizeof(Double32_t));
+
fIsSorted = source.fIsSorted;
fType = source.fType;
}
}
+//_________________________________
AliAODCaloCells::~AliAODCaloCells()
{
// destructor
DeleteContainer();
}
-void AliAODCaloCells::Copy(TObject &obj) const {
+void AliAODCaloCells::Copy(TObject &obj) const
+{
// this overwrites the virtual TOBject::Copy()
// to allow run time copying without casting
}
-AliVCaloCells *AliAODCaloCells::CopyCaloCells(Bool_t all = kTRUE) const {
+//______________________________________________________________________
+AliVCaloCells *AliAODCaloCells::CopyCaloCells(Bool_t all = kTRUE) const
+{
// copy the calo cells into a new object. If option all=FALSE, just the object type,
// for mixing
obj->SetNumberOfCells(fNCells);
for (Short_t i = 0; i < fNCells; i++)
- obj->SetCell(i,fCellNumber[i],fAmplitude[i],-1);
+ {
+ Int_t mclabel = -1;
+ if(fMCLabel) mclabel = fMCLabel[i];
+
+ Float_t efrac = 0.;
+ if(fEFraction) efrac = fEFraction[i];
+
+ Float_t time = -1;
+ if(fTime) time = fTime[i];
+
+ obj->SetCell(i,fCellNumber[i],fAmplitude[i],time,mclabel,efrac);
+ }
}
return obj;
}
+//___________________________________________________
void AliAODCaloCells::CreateContainer(Short_t nCells)
{
// function that creates container to store calorimeter cell data
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
+ fTime = new Double32_t[fNCells];
+ fMCLabel = new Short_t[fNCells];
+ fEFraction = new Double32_t[fNCells];
// set to zero
for(int i = 0;i<fNCells;++i){
- fAmplitude[i] = fCellNumber[i] = 0 ;
+ fAmplitude[i] = fCellNumber[i] = fTime[i] =fMCLabel[i] = fEFraction[i] = 0 ;
}
}
+//_____________________________________
void AliAODCaloCells::DeleteContainer()
{
// deletes allocated memory
fAmplitude = NULL;
}
+ if (fTime)
+ {
+ delete[] fTime;
+ fTime = NULL;
+ }
+
+ if (fMCLabel)
+ {
+ delete[] fMCLabel;
+ fMCLabel = NULL;
+ }
+
+ if (fEFraction)
+ {
+ delete[] fEFraction;
+ fEFraction = NULL;
+ }
+
+
fNCells = 0;
fIsSorted = kFALSE;
}
+//__________________________
void AliAODCaloCells::Sort()
{
// sort the cell array by cell number
Short_t *newIndex = new Short_t[fNCells];
Double32_t *newAmplitude = new Double32_t[fNCells];
- for (Int_t i=0; i < fNCells; i++) {
+ Double32_t *newTime = new Double32_t[fNCells];
+ Short_t *newMCLabel = new Short_t[fNCells];
+ Double32_t *newEFraction = new Double32_t[fNCells];
+
+ for (Int_t i=0; i < fNCells; i++)
+ {
newIndex[i] = fCellNumber[idxArray[i]];
- newAmplitude[i] = fAmplitude[idxArray[i]];
+ newAmplitude[i] = fAmplitude [idxArray[i]];
+ if(fTime) newTime[i] = fTime [idxArray[i]];
+ if(fMCLabel) newMCLabel[i] = fMCLabel [idxArray[i]];
+ if(fEFraction) newEFraction[i] = fEFraction[idxArray[i]];
}
+
delete [] fCellNumber;
delete [] fAmplitude;
+ delete [] fTime;
+ delete [] fMCLabel;
+ delete [] fEFraction;
+
+
fCellNumber = newIndex;
fAmplitude = newAmplitude;
-
+ if(fTime) fTime = newTime;
+ if(fMCLabel) fMCLabel = newMCLabel;
+ if(fEFraction) fEFraction = newEFraction;
+
delete [] idxArray;
fIsSorted = kTRUE;
}
-Bool_t AliAODCaloCells::SetCell(Short_t pos, Short_t cellNumber, Double32_t amplitude, Double32_t /*time*/)
+//________________________________________________________________________________________
+Bool_t AliAODCaloCells::SetCell(Short_t pos, Short_t cellNumber, Double32_t amplitude,
+ Double32_t time, Short_t mclabel, Double32_t efrac)
{
// Sets a cell at the given position
- if (pos>=0 && pos < fNCells) {
+ if (pos>=0 && pos < fNCells)
+ {
fCellNumber[pos] = cellNumber;
fAmplitude[pos] = amplitude;
- fIsSorted = kFALSE;
+
+ if(!fTime) fTime = new Double_t[fNCells];
+ if(!fMCLabel) fMCLabel = new Short_t[fNCells];
+ if(!fEFraction) fEFraction = new Double32_t[fNCells];
+
+ fTime[pos] = time;
+ fMCLabel[pos] = mclabel;
+ fEFraction[pos] = efrac;
+
+ fIsSorted = kFALSE;
+
return kTRUE;
+
} else {
return kFALSE;
}
}
+
+
+
+
AliAODCaloCells(const char* name, const char* title, VCells_t ttype=kUndef);
AliAODCaloCells(const AliAODCaloCells& cells);
AliAODCaloCells& operator=(const AliAODCaloCells& cells);
- virtual void Copy(TObject &obj) const;
- virtual AliVCaloCells* CopyCaloCells(Bool_t all) const;
-
virtual ~AliAODCaloCells();
- void Clear(const Option_t*);
- void CreateContainer(Short_t nCells);
- void DeleteContainer();
- void Sort();
+ virtual AliVCaloCells* CopyCaloCells(Bool_t all) const;
+ virtual void Copy(TObject &obj) const;
+ void Clear(const Option_t*);
+ void CreateContainer(Short_t nCells);
+ void DeleteContainer();
+ void Sort();
- Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time = -1);
+ inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time, Short_t &mclabel, Double_t &efrac) const ;
+ Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time, Short_t mclabel = -1, Double_t efrac = 0.) ;
+
+ Short_t GetNumberOfCells() const { return fNCells ; }
+ void SetNumberOfCells(Int_t n) { fNCells = n ; }
- Short_t GetNumberOfCells() const { return fNCells; }
- void SetNumberOfCells(Int_t n) { fNCells = n ; }
- inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const;
inline Double_t GetCellAmplitude(Short_t cellNumber);
inline Short_t GetCellPosition(Short_t cellNumber);
+ inline Double_t GetCellTime(Short_t cellNumber);
+
inline Double_t GetAmplitude(Short_t pos) const;
- Double_t GetCellTime(Short_t /*cellNumber*/) {return -1;}
inline Short_t GetCellNumber(Short_t pos) const;
- Double_t GetTime(Short_t /*pos*/) const {return -1;}
- Bool_t IsEMCAL() const {return (fType == kEMCALCell);}
- Bool_t IsPHOS() const {return (fType == kPHOSCell);}
- Char_t GetType() const { return fType;}
- void SetType(Char_t ttype) { fType=ttype; }
-
-
+ inline Double_t GetTime(Short_t pos) const;
+
+ Bool_t IsEMCAL() const { return (fType == kEMCALCell); }
+ Bool_t IsPHOS() const { return (fType == kPHOSCell) ; }
+
+ Char_t GetType() const { return fType;}
+ void SetType(Char_t ttype) { fType=ttype; }
+
+ // MC & embedding
+ inline Short_t GetCellMCLabel(Short_t cellNumber) ;
+ inline Short_t GetMCLabel(Short_t pos) const ;
+
+ inline Double_t GetCellEFraction(Short_t cellNumber) ;
+ inline Double_t GetEFraction(Short_t pos) const ;
+
+ inline void SetEFraction (Short_t pos, Double32_t efrac) ;
+ inline void SetCellEFraction(Short_t cellNumber, Double32_t efrac) ;
+
protected:
+
Int_t fNCells; // Number of cells
Short_t *fCellNumber; //[fNCells] array of cell numbers
Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
+ Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times
+ Double32_t *fEFraction; //[fNCells][0.,0.,16] array with fraction of MC energy and data - for embedding
+ Short_t *fMCLabel; //[fNCells] array of MC labels
Bool_t fIsSorted; //! true if cell arrays are sorted by index
Char_t fType; // Cell type
+ ClassDef(AliAODCaloCells, 3);
- ClassDef(AliAODCaloCells, 2);
};
-
-Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t& /*time*/) const
+Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude,
+ Double_t &time, Short_t & mclabel, Double_t & efrac) const
{
- if (pos>=0 && pos<fNCells) {
+ if (pos>=0 && pos<fNCells)
+ {
cellNumber = fCellNumber[pos];
- amplitude = fAmplitude[pos];
+ amplitude = fAmplitude[pos];
+
+ if(fTime) time = fTime[pos];
+ else time =-1.;
+ if(fMCLabel) mclabel = fMCLabel[pos];
+ else mclabel =-1 ;
+ if(fEFraction) efrac = fEFraction[pos];
+ else efrac = 0 ;
+
return kTRUE;
+
} else {
- Warning("GetCell","Invalid cell array index %d", pos);
return kFALSE;
}
}
-
Double_t AliAODCaloCells::GetCellAmplitude(Short_t cellNumber)
{
if (!fIsSorted) {
}
}
+Double_t AliAODCaloCells::GetCellTime(Short_t cellNumber)
+{
+ if(!fTime) return -1;
+
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) {
+ return fTime[pos];
+ } else {
+ return -1.;
+ }
+}
Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const
{
if (pos>=0 && pos<fNCells) {
return fAmplitude[pos];
} else {
- Warning("GetAmplitude","Invalid cell array index %d", pos);
return 0.;
}
}
+Double_t AliAODCaloCells::GetTime(Short_t pos) const
+{
+ if (pos>=0 && pos<fNCells && fTime) {
+ return fTime[pos];
+ } else {
+ return -1.;
+ }
+}
Short_t AliAODCaloCells::GetCellNumber(Short_t pos) const
{
if (pos>=0 && pos<fNCells) {
return fCellNumber[pos];
} else {
- Warning("GetCellNumber","Invalid cell array index %d", pos);
return fNCells;
}
}
return pos;
}
+Short_t AliAODCaloCells::GetMCLabel(Short_t pos) const
+{
+ if (pos>=0 && pos<fNCells && fMCLabel) {
+ return fMCLabel[pos];
+ } else {
+ return 0.;
+ }
+}
+
+Double_t AliAODCaloCells::GetEFraction(Short_t pos) const
+{
+ if (pos>=0 && pos<fNCells && fEFraction) {
+ return fEFraction[pos];
+ } else {
+ return 0.;
+ }
+}
+
+Short_t AliAODCaloCells::GetCellMCLabel(Short_t cellNumber)
+{
+ if(!fMCLabel) return -1;
+
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && fCellNumber[pos] == cellNumber) {
+ return fMCLabel[pos];
+ } else {
+ return 0.;
+ }
+}
+
+Double_t AliAODCaloCells::GetCellEFraction(Short_t cellNumber)
+{
+ if(!fEFraction) return 0;
+
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) {
+ return fEFraction[pos];
+ } else {
+ return -1.;
+ }
+}
+
+void AliAODCaloCells::SetEFraction(Short_t pos, Double32_t efrac)
+{
+ // Sets the fraction of energy from MC with respect to data at the given position
+
+
+ if (pos>=0 && pos < fNCells)
+ {
+ if(!fEFraction) fEFraction = new Double32_t[fNCells];
+ fEFraction[pos] = efrac;
+ }
+}
+
+void AliAODCaloCells::SetCellEFraction(Short_t cellNumber, Double32_t efrac)
+{
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber)
+ {
+ if(!fEFraction) fEFraction = new Double32_t[fNCells];
+ fEFraction[pos] = efrac;
+ }
+}
+
#endif
ClassImp(AliESDCaloCells)
-//_______________________________________________________________________
+//_____________________________________________________
AliESDCaloCells::AliESDCaloCells() :
- AliVCaloCells(), fNCells(0), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(kTRUE), fType(kUndef)
+ AliVCaloCells(), fNCells(0), fCellNumber(0),
+ fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+ fIsSorted(kTRUE), fType(kUndef)
{
// default constructor
}
-//_______________________________________________________________________
+//______________________________________________________________________________________
AliESDCaloCells::AliESDCaloCells(const char* name, const char* title, VCells_t ttype) :
- AliVCaloCells(name, title), fNCells(0), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(kTRUE), fType(ttype)
+ AliVCaloCells(name, title), fNCells(0), fCellNumber(0),
+ fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+ fIsSorted(kTRUE), fType(ttype)
{
// AliVCaloCells constructor
}
-//_______________________________________________________________________
+//__________________________________________________________
AliESDCaloCells::AliESDCaloCells(const AliESDCaloCells& c) :
- AliVCaloCells(c), fNCells(c.fNCells), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(c.fIsSorted), fType(c.fType)
+ AliVCaloCells(c), fNCells(c.fNCells), fCellNumber(0),
+ fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+ fIsSorted(c.fIsSorted), fType(c.fType)
{
// copy constructor
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
fTime = new Double32_t[fNCells];
-
- for(Int_t i = 0; i < fNCells; i++){
+ fMCLabel = new Short_t[fNCells];
+ fEFraction = new Double32_t[fNCells];
+
+ for(Int_t i = 0; i < fNCells; i++)
+ {
fCellNumber[i] = c.fCellNumber[i];
fAmplitude[i] = c.fAmplitude[i];
fTime[i] = c.fTime[i];
- fAmplitude[i] = c.fAmplitude[i];
-
+ if(c.fMCLabel) fMCLabel[i] = c.fMCLabel[i];
+ if(c.fEFraction)fEFraction[i] = c.fEFraction[i];
}
}
-//_______________________________________________________________________
+//__________________________________________________________________________
AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source)
{
// assignment operator
- if(this != &source) {
+ if(this != &source)
+ {
AliVCaloCells::operator=(source);
- if(fNCells != source.fNCells) {
+ if(fNCells != source.fNCells)
+ {
delete [] fCellNumber;
delete [] fAmplitude;
delete [] fTime;
+ delete [] fMCLabel;
+ delete [] fEFraction;
+
fNCells = source.fNCells;
+
fCellNumber = new Short_t[fNCells];
- fAmplitude = new Double32_t[fNCells];
- fTime = new Double32_t[fNCells];
+ fAmplitude = new Double32_t[fNCells];
+ fTime = new Double32_t[fNCells];
+ fMCLabel = new Short_t[fNCells];
+ fTime = new Double32_t[fNCells];
}
- memcpy(fCellNumber,source.fCellNumber,fNCells*sizeof(Short_t));
- memcpy(fAmplitude,source.fAmplitude,fNCells*sizeof(Double32_t));
- memcpy(fTime,source.fTime,fNCells*sizeof(Double32_t));
+ memcpy(fCellNumber,source.fCellNumber,fNCells*sizeof(Short_t));
+ memcpy(fAmplitude, source.fAmplitude, fNCells*sizeof(Double32_t));
+ memcpy(fTime, source.fTime, fNCells*sizeof(Double32_t));
+ if(source.fMCLabel && fMCLabel) memcpy(fMCLabel, source.fMCLabel, fNCells*sizeof(Short_t));
+ if(source.fEFraction && fEFraction) memcpy(fEFraction, source.fEFraction, fNCells*sizeof(Double32_t));
+
fIsSorted = source.fIsSorted;
fType = source.fType;
return *this;
}
-//_______________________________________________________________________
-void AliESDCaloCells::Copy(TObject &obj) const {
-
+//____________________________________________
+void AliESDCaloCells::Copy(TObject &obj) const
+{
// this overwrites the virtual TOBject::Copy()
// to allow run time copying without casting
// in AliESDEvent
}
-//_______________________________________________________________________
-AliVCaloCells* AliESDCaloCells::CopyCaloCells(Bool_t all = kTRUE) const {
-
+//______________________________________________________________________
+AliVCaloCells* AliESDCaloCells::CopyCaloCells(Bool_t all = kTRUE) const
+{
// copy the calo cells into a new object. If option all=FALSE, just the object type,
// for mixing
obj->SetNumberOfCells(fNCells);
for (Short_t i = 0; i < fNCells; i++)
- obj->SetCell(i,fCellNumber[i],fAmplitude[i],fTime[i]);
+ {
+ Int_t mclabel = -1;
+ if(fMCLabel) mclabel = fMCLabel[i];
+
+ Float_t efrac = 0.;
+ if(fEFraction) efrac = fEFraction[i];
+
+ obj->SetCell(i,fCellNumber[i],fAmplitude[i],fTime[i],mclabel,efrac);
+ }
}
return obj;
}
-//_______________________________________________________________________
+//_________________________________
AliESDCaloCells::~AliESDCaloCells()
{
// destructor
DeleteContainer();
}
-//_______________________________________________________________________
+//__________________________________________
void AliESDCaloCells::Clear(const Option_t*)
{
// clear
}
-//_______________________________________________________________________
+//___________________________________________________
void AliESDCaloCells::CreateContainer(Short_t nCells)
{
// function that creates container to store calorimeter cell data
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
fTime = new Double32_t[fNCells];
-
- // set to zero
- for(int i = 0;i<fNCells;++i){
- fAmplitude[i] = fCellNumber[i] = 0 ;
+ fMCLabel = new Short_t[fNCells];
+ fEFraction = new Double32_t[fNCells];
+
+ // set to zero
+ for(int i = 0;i<fNCells;++i)
+ {
+ fAmplitude[i] = fCellNumber[i] = fEFraction[i] = 0 ;
+ fTime[i] = fMCLabel[i] = -1 ;
}
}
-//_______________________________________________________________________
+//_____________________________________
void AliESDCaloCells::DeleteContainer()
{
// deletes allocated memory
fTime = NULL;
}
+ if (fMCLabel)
+ {
+ delete[] fMCLabel;
+ fMCLabel = NULL;
+ }
+
+ if (fEFraction)
+ {
+ delete[] fEFraction;
+ fEFraction = NULL;
+ }
+
fNCells = 0;
fIsSorted = kFALSE;
+
}
-//_______________________________________________________________________
+//__________________________
void AliESDCaloCells::Sort()
{
// sort the cell array by cell number
Int_t *idxArray = new Int_t[fNCells];
TMath::Sort(fNCells,fCellNumber,idxArray,kFALSE);
- Short_t *newIndex = new Short_t[fNCells];
+ Short_t *newIndex = new Short_t[fNCells];
Double32_t *newAmplitude = new Double32_t[fNCells];
Double32_t *newTime = new Double32_t[fNCells];
- for (Int_t i=0; i < fNCells; i++) {
+ Short_t *newMCLabel = new Short_t[fNCells];
+ Double32_t *newEFraction = new Double32_t[fNCells];
+
+ for (Int_t i=0; i < fNCells; i++)
+ {
newIndex[i] = fCellNumber[idxArray[i]];
- newAmplitude[i] = fAmplitude[idxArray[i]];
- newTime[i] = fTime[idxArray[i]];
+ newAmplitude[i] = fAmplitude [idxArray[i]];
+ newTime[i] = fTime [idxArray[i]];
+ if(fMCLabel) newMCLabel[i] = fMCLabel [idxArray[i]];
+ if(fEFraction) newEFraction[i] = fEFraction[idxArray[i]];
}
+
delete [] fCellNumber;
delete [] fAmplitude;
delete [] fTime;
+ delete [] fMCLabel;
+ delete [] fEFraction;
fCellNumber = newIndex;
fAmplitude = newAmplitude;
fTime = newTime;
+ if(fMCLabel) fMCLabel = newMCLabel;
+ if(fEFraction) fEFraction = newEFraction;
delete [] idxArray;
fIsSorted = kTRUE;
}
-//_______________________________________________________________________
-Bool_t AliESDCaloCells::SetCell(Short_t pos, Short_t cellNumber, Double32_t amplitude, Double32_t time)
+//________________________________________________________________________________________
+Bool_t AliESDCaloCells::SetCell(Short_t pos, Short_t cellNumber, Double32_t amplitude,
+ Double32_t time, Short_t mclabel, Double32_t efrac)
{
// Sets a cell at the given position
- if (pos>=0 && pos < fNCells) {
+ if (pos>=0 && pos < fNCells)
+ {
fCellNumber[pos] = cellNumber;
fAmplitude[pos] = amplitude;
fTime[pos] = time;
+
+ if(!fMCLabel) fMCLabel = new Short_t[fNCells];
+ if(!fEFraction) fEFraction = new Double32_t[fNCells];
+ fMCLabel[pos] = mclabel;
+ fEFraction[pos] = efrac;
+
fIsSorted = kFALSE;
+
return kTRUE;
+
} else {
return kFALSE;
}
AliESDCaloCells(const AliESDCaloCells & cells);
AliESDCaloCells & operator=(const AliESDCaloCells& source);
virtual ~AliESDCaloCells();
- virtual void Copy(TObject &obj) const;
+
virtual AliVCaloCells * CopyCaloCells(Bool_t all) const;
- void Clear(const Option_t*);
+ virtual void Copy(TObject &obj) const;
+ void Clear(const Option_t*);
+ void CreateContainer(Short_t nCells);
+ void DeleteContainer();
+ void Sort();
- Bool_t IsEMCAL() const { return (fType == kEMCALCell);}
- Bool_t IsPHOS() const { return (fType == kPHOSCell) ;}
- Char_t GetType() const { return fType;}
- void SetType(Char_t ttype) { fType = ttype; }
-
- void CreateContainer(Short_t nCells);
- void DeleteContainer();
- void Sort();
+ Bool_t IsEMCAL() const { return (fType == kEMCALCell); }
+ Bool_t IsPHOS() const { return (fType == kPHOSCell) ; }
+ Char_t GetType() const { return fType ; }
+ void SetType(Char_t t){ fType = t ; }
+
+ inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time, Short_t &mclabel, Double_t &efrac) const;
+ Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time, Short_t mclabel = -1, Double_t efrac = 0.);
+
+ Short_t GetNumberOfCells() const { return fNCells ; }
+ void SetNumberOfCells(Int_t n) { fNCells = n ; }
- Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time);
- Short_t GetNumberOfCells() const { return fNCells; }
- void SetNumberOfCells(Int_t n) { fNCells = n ; }
- inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const;
inline Double_t GetCellAmplitude(Short_t cellNumber);
+ inline Short_t GetCellPosition(Short_t cellNumber);
inline Double_t GetCellTime(Short_t cellNumber);
+
inline Double_t GetAmplitude(Short_t pos) const;
inline Double_t GetTime(Short_t pos) const;
inline Short_t GetCellNumber(Short_t pos) const;
+ // MC & embedding
+ inline Short_t GetCellMCLabel(Short_t cellNumber) ;
+ inline Short_t GetMCLabel(Short_t pos) const ;
+
+ inline Double_t GetCellEFraction(Short_t cellNumber) ;
+ inline Double_t GetEFraction(Short_t pos) const ;
+
+ inline void SetEFraction (Short_t pos, Double32_t efrac) ;
+ inline void SetCellEFraction(Short_t cellNumber, Double32_t efrac) ;
+
protected:
+
Int_t fNCells; // Number of cells
Short_t *fCellNumber; //[fNCells] array of cell numbers
Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times
+ Double32_t *fEFraction; //[fNCells][0.,0.,16] array with fraction of MC energy and data - for embedding
+ Short_t *fMCLabel; //[fNCells] array of MC labels
Bool_t fIsSorted; //! true if cell arrays are sorted by index
Char_t fType; // Cell type
- ClassDef(AliESDCaloCells, 2);
+ ClassDef(AliESDCaloCells, 3);
};
-Bool_t AliESDCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t & time) const
+Bool_t AliESDCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude,
+ Double_t & time, Short_t & mclabel, Double_t & efrac) const
{
- if (pos>=0 && pos<fNCells) {
+ if (pos>=0 && pos<fNCells)
+ {
cellNumber = fCellNumber[pos];
- amplitude = fAmplitude[pos];
- time = fTime[pos];
+ amplitude = fAmplitude[pos];
+ time = fTime[pos];
+
+ if(fMCLabel) mclabel = fMCLabel[pos];
+ else mclabel =-1 ;
+ if(fEFraction) efrac = fEFraction[pos];
+ else efrac = 0 ;
+
return kTRUE;
- } else {
- Error("GetCell","Invalid cell array index %d", pos);
+
+ } else
+ {
return kFALSE;
}
}
-
Double_t AliESDCaloCells::GetCellAmplitude(Short_t cellNumber)
{
if (!fIsSorted) {
if (pos>=0 && pos<fNCells) {
return fAmplitude[pos];
} else {
- Error("GetAmplitude","Invalid cell array index %d", pos);
return 0.;
}
}
if (pos>=0 && pos<fNCells) {
return fTime[pos];
} else {
- Error("GetTime","Invalid cell array index %d", pos);
- return 0.;
+ return -1.;
}
}
if (pos>=0 && pos<fNCells) {
return fCellNumber[pos];
} else {
- Error("GetCellNumber","Invalid cell array index %d", pos);
return fNCells;
}
}
+Short_t AliESDCaloCells::GetCellPosition(Short_t cellNumber)
+{
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Int_t nabove, nbelow, middle;
+ Short_t pos = -1;
+
+ nabove = fNCells + 1;
+ nbelow = 0;
+ while (nabove - nbelow > 1) {
+ middle = (nabove + nbelow) / 2;
+ if (cellNumber == fCellNumber[middle-1]) {
+ pos = middle - 1;
+ break;
+ }
+ if (cellNumber < fCellNumber[middle-1]) nabove = middle;
+ else nbelow = middle;
+ }
+
+ return pos;
+}
+
+Short_t AliESDCaloCells::GetMCLabel(Short_t pos) const
+{
+ if (pos>=0 && pos<fNCells && fMCLabel) {
+ return fMCLabel[pos];
+ } else {
+ return -1 ;
+ }
+}
+
+Double_t AliESDCaloCells::GetEFraction(Short_t pos) const
+{
+ if (pos>=0 && pos<fNCells && fEFraction) {
+ return fEFraction[pos];
+ } else {
+ return 0.;
+ }
+}
+
+Short_t AliESDCaloCells::GetCellMCLabel(Short_t cellNumber)
+{
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && fCellNumber[pos] == cellNumber && fMCLabel) {
+ return fMCLabel[pos];
+ } else {
+ return -1;
+ }
+}
+
+Double_t AliESDCaloCells::GetCellEFraction(Short_t cellNumber)
+{
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber && fEFraction) {
+ return fEFraction[pos];
+ } else {
+ return 0.;
+ }
+}
+
+void AliESDCaloCells::SetEFraction(Short_t pos, Double32_t efrac)
+{
+ // Sets the fraction of energy from MC with respect to data at the given position
+
+ if (pos>=0 && pos < fNCells)
+ {
+ if(!fEFraction) fEFraction = new Double32_t[fNCells];
+ fEFraction[pos] = efrac;
+ }
+}
+
+void AliESDCaloCells::SetCellEFraction(Short_t cellNumber, Double32_t efrac)
+{
+ if (!fIsSorted) {
+ Sort();
+ fIsSorted=kTRUE;
+ }
+
+ Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+ if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber)
+ {
+ if(!fEFraction) fEFraction = new Double32_t[fNCells];
+ fEFraction[pos] = efrac;
+ }
+}
+
+
#endif
Int_t ncells = event->GetPHOSCells()->GetNumberOfCells() ;
for (Int_t icell = 0; icell < ncells; icell++) {
- fPHOSCells->SetCell(phosPos++, phosCells->GetCellNumber(icell), phosCells->GetAmplitude(icell), phosCells->GetTime(icell)) ;
+ fPHOSCells->SetCell(phosPos++, phosCells->GetCellNumber(icell), phosCells->GetAmplitude(icell),
+ phosCells->GetTime(icell),phosCells->GetMCLabel(icell),phosCells->GetEFraction(icell)) ;
}
}// phos cells
Int_t ncells = emcalCells->GetNumberOfCells() ;
for (Int_t icell = 0; icell < ncells; icell++) {
- fEMCALCells->SetCell(emcalPos++, emcalCells->GetCellNumber(icell), emcalCells->GetAmplitude(icell), emcalCells->GetTime(icell)) ;
+ fEMCALCells->SetCell(emcalPos++, emcalCells->GetCellNumber(icell), emcalCells->GetAmplitude(icell),
+ emcalCells->GetTime(icell),emcalCells->GetMCLabel(icell),emcalCells->GetEFraction(icell)) ;
}
}//EMCAL cells
}//while event
kPHOSCell,
kEMCALCell};
- AliVCaloCells() : TNamed() {;}
+ AliVCaloCells() : TNamed() {;}
AliVCaloCells(const char* name, const char* title) : TNamed(name, title) {;}
AliVCaloCells(const AliVCaloCells& cells) : TNamed(cells.GetName(), cells.GetTitle()) {;}
AliVCaloCells & operator=(const AliVCaloCells& cells ) ;
- virtual ~AliVCaloCells(){;}
+ virtual ~AliVCaloCells() {;}
void Clear(const Option_t*) {;}
- virtual Bool_t IsEMCAL() const = 0;
- virtual Bool_t IsPHOS() const = 0;
- virtual Char_t GetType() const = 0;
- virtual void SetType(Char_t ttype) = 0;
-
- virtual void CreateContainer(Short_t nCells) = 0;
- virtual void DeleteContainer() = 0;
- virtual void Sort() = 0;
+ virtual Bool_t IsEMCAL() const = 0;
+ virtual Bool_t IsPHOS() const = 0;
+ virtual Char_t GetType() const = 0;
+ virtual void SetType(Char_t ttype) = 0;
+
+ virtual void CreateContainer(Short_t nCells) = 0;
+ virtual void DeleteContainer() = 0;
+ virtual void Sort() = 0;
+
+ virtual Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time, Short_t &mclabel, Double_t &efrac) const = 0;
+ virtual Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time, Short_t mclabel=-1, Double_t efrac=0) = 0;
- virtual Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time) = 0;
- virtual Short_t GetNumberOfCells() const = 0;
- virtual void SetNumberOfCells(Int_t n) = 0;
+ virtual Short_t GetNumberOfCells() const = 0;
+ virtual void SetNumberOfCells(Int_t n) = 0;
- virtual Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const = 0;
- virtual Double_t GetCellAmplitude(Short_t cellNumber) = 0;
- virtual Double_t GetCellTime(Short_t cellNumber) = 0;
- virtual Double_t GetAmplitude(Short_t pos) const = 0;
- virtual Double_t GetTime(Short_t pos) const = 0;
- virtual Short_t GetCellNumber(Short_t pos) const = 0;
+ virtual Double_t GetCellAmplitude(Short_t cellNumber) = 0;
+ virtual Double_t GetCellTime(Short_t cellNumber) = 0;
+ virtual Short_t GetCellPosition(Short_t cellNumber) = 0;
+ virtual Double_t GetAmplitude(Short_t pos) const = 0;
+ virtual Double_t GetTime(Short_t pos) const = 0;
+ virtual Short_t GetCellNumber(Short_t pos) const = 0;
+
virtual void Copy(TObject &obj) const = 0;
virtual AliVCaloCells* CopyCaloCells(Bool_t all) const = 0;
+ // MC & embedding
+ virtual Short_t GetCellMCLabel(Short_t cellNumber) = 0;
+ virtual Short_t GetMCLabel(Short_t pos) const = 0;
+
+ virtual Double_t GetCellEFraction(Short_t cellNumber) = 0;
+ virtual Double_t GetEFraction(Short_t pos) const = 0;
+
+ virtual void SetCellEFraction(Short_t cellNumber, Double_t efrac) = 0;
+ virtual void SetEFraction (Short_t pos, Double_t efrac) = 0;
+
ClassDef(AliVCaloCells, 0);
};