From c8fe2783489236d4d3aff0b807d1f507720af244 Mon Sep 17 00:00:00 2001 From: hristov Date: Fri, 13 Aug 2010 06:24:20 +0000 Subject: [PATCH] Changes for report #69974: Virtual class for calorimeter analysis objects --- ANALYSIS/AliAnalysisTaskESDfilter.cxx | 41 +- ANALYSIS/AliAnalysisTaskME.cxx | 4 +- ANALYSIS/AliAnalysisTaskME.h | 5 +- ANALYSIS/AliMultiEventInputHandler.h | 1 + EMCAL/AliEMCALAodCluster.cxx | 6 +- EMCAL/AliEMCALClusterizerNxN.cxx | 2 +- EMCAL/AliEMCALClusterizerv1.cxx | 2 +- EMCAL/AliEMCALPID.cxx | 17 +- EMCAL/AliEMCALReconstructor.cxx | 10 +- EMCAL/AliEMCALTracker.cxx | 2 +- EMCAL/macros/TestESD.C | 352 +- ESDCheck/AliEMCALQATask.cxx | 4 +- ESDCheck/AliPHOSQATask.cxx | 2 +- EVE/EveDet/AliEveEMCALData.cxx | 2 +- HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx | 8 +- HLT/CALO/AliHLTCaloClusterAnalyser.cxx | 2 +- JETAN/AliJetESDFillUnitArrayEMCalDigits.cxx | 2 +- PHOS/AliPHOSAodCluster.cxx | 6 +- PHOS/AliPHOSQADataMakerRec.cxx | 2 +- PHOS/AliPHOSReconstructor.cxx | 8 +- PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx | 35 +- .../AliAnalysisTaskEMCALPi0CalibSelection.cxx | 114 +- .../AliAnalysisTaskPHOSPi0CalibSelection.cxx | 20 +- PWG4/JCORRAN/AliJCORRANTask.cxx | 26 +- PWG4/PWG4PartCorrBaseLinkDef.h | 1 + PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx | 37 +- PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h | 96 +- .../AliAnalysisTaskParticleCorrelationM.cxx | 226 + .../AliAnalysisTaskParticleCorrelationM.h | 59 + PWG4/PartCorrBase/AliCaloPID.cxx | 56 +- PWG4/PartCorrBase/AliCaloTrackAODReader.cxx | 297 +- PWG4/PartCorrBase/AliCaloTrackAODReader.h | 12 +- PWG4/PartCorrBase/AliCaloTrackESDReader.cxx | 684 +-- PWG4/PartCorrBase/AliCaloTrackESDReader.h | 12 +- PWG4/PartCorrBase/AliCaloTrackReader.cxx | 395 +- PWG4/PartCorrBase/AliCaloTrackReader.h | 39 +- PWG4/PartCorrBase/AliCalorimeterUtils.cxx | 367 +- PWG4/PartCorrBase/AliCalorimeterUtils.h | 18 +- PWG4/PartCorrDep/AliAnaBtag.cxx | 2 +- PWG4/PartCorrDep/AliAnaCaloTrigger.cxx | 2 +- PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx | 4351 ++++++++--------- PWG4/PartCorrDep/AliAnaCalorimeterQA.h | 6 +- PWG4/PartCorrDep/AliAnaElectron.cxx | 4 +- PWG4/PartCorrDep/AliAnaExample.cxx | 7 +- .../AliAnaParticleHadronCorrelation.cxx | 624 +-- ...liAnaParticleJetLeadingConeCorrelation.cxx | 2 +- PWG4/PartCorrDep/AliAnaPhoton.cxx | 567 +-- PWG4/PartCorrDep/AliAnaPi0.cxx | 397 +- PWG4/PartCorrDep/AliAnaPi0.h | 5 + PWG4/PartCorrDep/AliAnaPi0EbE.cxx | 146 +- .../AliAnalysisTaskPHOSExample.cxx | 6 +- PWG4/libPWG4PartCorrBase.pkg | 1 + PWG4/macros/ana.C | 209 +- PWG4/macros/anaM.C | 497 ++ STEER/AODLinkDef.h | 4 +- STEER/AliAODCaloCells.cxx | 64 +- STEER/AliAODCaloCells.h | 28 +- STEER/AliAODCaloCluster.cxx | 2 +- STEER/AliAODCaloCluster.h | 17 +- STEER/AliAODCluster.cxx | 77 +- STEER/AliAODCluster.h | 113 +- STEER/AliAODEvent.cxx | 130 +- STEER/AliAODEvent.h | 16 +- STEER/AliAODHandler.cxx | 9 +- STEER/AliAODRecoDecay.h | 1 + STEER/AliAODTrack.cxx | 9 + STEER/AliAODTrack.h | 6 +- STEER/AliAODv0.h | 4 + STEER/AliESDCaloCells.cxx | 63 +- STEER/AliESDCaloCells.h | 24 +- STEER/AliESDCaloCluster.cxx | 65 +- STEER/AliESDCaloCluster.h | 181 +- STEER/AliESDEvent.h | 13 +- STEER/AliESDtrack.h | 2 +- STEER/AliESDv0.h | 4 + STEER/AliMCEvent.h | 7 +- STEER/AliMixedEvent.cxx | 212 +- STEER/AliMixedEvent.h | 45 +- STEER/AliVCaloCells.cxx | 28 + STEER/AliVCaloCells.h | 53 + STEER/AliVCluster.cxx | 43 + STEER/AliVCluster.h | 125 + STEER/AliVEvent.h | 21 + STEER/AliVTrack.h | 7 + STEER/STEERBaseLinkDef.h | 2 + STEER/libSTEERBase.pkg | 1 + 86 files changed, 6261 insertions(+), 4913 deletions(-) create mode 100755 PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx create mode 100755 PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h create mode 100644 PWG4/macros/anaM.C create mode 100644 STEER/AliVCaloCells.cxx create mode 100644 STEER/AliVCaloCells.h create mode 100644 STEER/AliVCluster.cxx create mode 100644 STEER/AliVCluster.h diff --git a/ANALYSIS/AliAnalysisTaskESDfilter.cxx b/ANALYSIS/AliAnalysisTaskESDfilter.cxx index 290eace9d9e..ba72ab02f6d 100644 --- a/ANALYSIS/AliAnalysisTaskESDfilter.cxx +++ b/ANALYSIS/AliAnalysisTaskESDfilter.cxx @@ -1145,50 +1145,39 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() { AliESDCaloCluster * cluster = esd->GetCaloCluster(iClust); - Int_t id = cluster->GetID(); - Int_t nLabel = cluster->GetNLabels(); - TArrayI* labels = cluster->GetLabels(); - Int_t *label = 0; - if (labels){ - label = (cluster->GetLabels())->GetArray(); - for(int i = 0;i < labels->GetSize();++i){ - if(mcH)mcH->SelectParticle(label[i]); - } - } + Int_t id = cluster->GetID(); + Int_t nLabel = cluster->GetNLabels(); + Int_t *labels = cluster->GetLabels(); + if(labels){ + for(int i = 0;i < nLabel;++i){ + if(mcH)mcH->SelectParticle(labels[i]); + } + } Float_t energy = cluster->E(); cluster->GetPosition(posF); - Char_t ttype = AliAODCluster::kUndef; - if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) { - ttype=AliAODCluster::kPHOSNeutral; - } - else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) { - ttype = AliAODCluster::kEMCALClusterv1; - } - - AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) AliAODCaloCluster(id, nLabel, - label, + labels, energy, posF, NULL, - ttype); + cluster->GetType(),0); caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), - cluster->GetClusterDisp(), + cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), cluster->GetEmcCpvDistance(), cluster->GetNExMax(),cluster->GetTOF()) ; - caloCluster->SetPIDFromESD(cluster->GetPid()); + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); TArrayI* matchedT = cluster->GetTracksMatched(); - if (nTracks>0 && matchedT && cluster->GetTrackMatched() >= 0) { + if (nTracks>0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) { for (Int_t im = 0; im < matchedT->GetSize(); im++) { Int_t iESDtrack = matchedT->At(im);; if (aodTrackRefs->At(iESDtrack) != 0) { @@ -1208,7 +1197,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() { AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells()); aodEMcells.CreateContainer(nEMcell); - aodEMcells.SetType(AliAODCaloCells::kEMCAL); + aodEMcells.SetType(AliAODCaloCells::kEMCALCell); for (Int_t iCell = 0; iCell < nEMcell; iCell++) { aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell)); } @@ -1222,7 +1211,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() { AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); aodPHcells.CreateContainer(nPHcell); - aodPHcells.SetType(AliAODCaloCells::kPHOS); + aodPHcells.SetType(AliAODCaloCells::kPHOSCell); for (Int_t iCell = 0; iCell < nPHcell; iCell++) { aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell)); } diff --git a/ANALYSIS/AliAnalysisTaskME.cxx b/ANALYSIS/AliAnalysisTaskME.cxx index c922604e2af..02738031e6f 100644 --- a/ANALYSIS/AliAnalysisTaskME.cxx +++ b/ANALYSIS/AliAnalysisTaskME.cxx @@ -169,13 +169,13 @@ const char* AliAnalysisTaskME::CurrentFileName() else return ""; } -void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj) +void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj, const char *fname) { // Add a new branch to the aod tree AliAODHandler* handler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); if (handler) { - handler->AddBranch(cname, addobj); + handler->AddBranch(cname, addobj, fname); } } diff --git a/ANALYSIS/AliAnalysisTaskME.h b/ANALYSIS/AliAnalysisTaskME.h index 9f5015d604b..0928f1b7301 100644 --- a/ANALYSIS/AliAnalysisTaskME.h +++ b/ANALYSIS/AliAnalysisTaskME.h @@ -34,14 +34,15 @@ class AliAnalysisTaskME : public AliAnalysisTask virtual void UserCreateOutputObjects() {;} virtual void UserExec(Option_t* /*option*/) {;} // Helpers for adding branches to the AOD - virtual void AddAODBranch(const char* cname, void* addobj); -// Getters + virtual void AddAODBranch(const char* cname, void* addobj, const char *fname=""); + // Getters virtual Int_t DebugLevel() {return fDebug; } virtual AliVEvent* GetEvent(Int_t iev); virtual AliAODEvent* AODEvent() {return fOutputAOD; } virtual TTree* OutputTree() {return fTreeA; } virtual Long64_t Entry() {return fEntry; } virtual const char* CurrentFileName(); + protected: Int_t fDebug; // Debug flag Int_t fEntry; // Current entry in the chain diff --git a/ANALYSIS/AliMultiEventInputHandler.h b/ANALYSIS/AliMultiEventInputHandler.h index 0b492a554c7..bea1092ac2a 100644 --- a/ANALYSIS/AliMultiEventInputHandler.h +++ b/ANALYSIS/AliMultiEventInputHandler.h @@ -32,6 +32,7 @@ class AliMultiEventInputHandler : public AliInputEventHandler { virtual AliVEvent *GetEvent() const {return GetLatestEvent();} virtual AliVEvent *GetEvent(Int_t iev) const; AliVEvent *GetLatestEvent() const {return fEventBuffer[fIndex];} + Int_t GetFormat() { return fFormat ;} // From the interface virtual Bool_t Init(Option_t* /*opt*/) {return kTRUE;} virtual Bool_t Init(TTree* tree, Option_t* /*opt*/); diff --git a/EMCAL/AliEMCALAodCluster.cxx b/EMCAL/AliEMCALAodCluster.cxx index 0de255ff1ee..fe017383668 100644 --- a/EMCAL/AliEMCALAodCluster.cxx +++ b/EMCAL/AliEMCALAodCluster.cxx @@ -224,9 +224,9 @@ void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString e TVector3 gpos ; emcalgeo->GetGlobal(clXYZ, gpos, iSupMod); - SetPosition(0,gpos[0]) ; - SetPosition(1,gpos[1]) ; - SetPosition(2,gpos[2]) ; + SetPositionAt(gpos[0],0) ; + SetPositionAt(gpos[1],1) ; + SetPositionAt(gpos[2],2) ; //Calculate dispersion for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) { diff --git a/EMCAL/AliEMCALClusterizerNxN.cxx b/EMCAL/AliEMCALClusterizerNxN.cxx index 98eebec2428..6e9b441729c 100644 --- a/EMCAL/AliEMCALClusterizerNxN.cxx +++ b/EMCAL/AliEMCALClusterizerNxN.cxx @@ -319,7 +319,7 @@ void AliEMCALClusterizerNxN::MakeClusters() fRecPoints->AddAt(recPoint, fNumberOfECAClusters) ; recPoint = dynamic_cast(fRecPoints->At(fNumberOfECAClusters)) ; fNumberOfECAClusters++ ; - recPoint->SetClusterType(AliESDCaloCluster::kEMCALClusterv1); + recPoint->SetClusterType(AliVCluster::kEMCALClusterv1); AliDebug(9, Form("Number of cells per cluster (max is 9!): %d", clusterDigitList.GetEntries())); for (Int_t idig = 0; idig < clusterDigitList.GetEntries(); idig++) diff --git a/EMCAL/AliEMCALClusterizerv1.cxx b/EMCAL/AliEMCALClusterizerv1.cxx index c834a99a8e5..a333caeb2cf 100644 --- a/EMCAL/AliEMCALClusterizerv1.cxx +++ b/EMCAL/AliEMCALClusterizerv1.cxx @@ -338,7 +338,7 @@ void AliEMCALClusterizerv1::MakeClusters() recPoint = dynamic_cast(fRecPoints->At(fNumberOfECAClusters)) ; fNumberOfECAClusters++ ; - recPoint->SetClusterType(AliESDCaloCluster::kEMCALClusterv1); + recPoint->SetClusterType(AliVCluster::kEMCALClusterv1); recPoint->AddDigit(*digit, Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId()),kFALSE) ; //Time or TimeR? TObjArray clusterDigits; diff --git a/EMCAL/AliEMCALPID.cxx b/EMCAL/AliEMCALPID.cxx index ebcc8a50c0f..71cd6631c4a 100644 --- a/EMCAL/AliEMCALPID.cxx +++ b/EMCAL/AliEMCALPID.cxx @@ -36,11 +36,11 @@ // // kElectron : fPIDFinal[0] // kMuon : fPIDFinal[1] -// kPion : fPIDFinal[2] -// kKaon : fPIDFinal[3] +// kPion : fPIDFinal[2] +// kKaon : fPIDFinal[3] // kProton : fPIDFinal[4] // kPhoton : fPIDFinal[5] -// kPi0 : fPIDFinal[6] +// kPi0 : fPIDFinal[6] // kNeutron : fPIDFinal[7] // kKaon0 : fPIDFinal[8] // kEleCon : fPIDFinal[9] @@ -116,7 +116,7 @@ void AliEMCALPID::RunPID(AliESDEvent *esd) Int_t nClusters = esd->GetNumberOfCaloClusters(); Int_t firstCluster = 0; - Double_t energy, lambda0; + Double_t energy=0., lambda0=0.; for (Int_t iCluster = firstCluster; iCluster < (nClusters + firstCluster); iCluster++) { AliESDCaloCluster *clust = esd->GetCaloCluster(iCluster); @@ -124,9 +124,8 @@ void AliEMCALPID::RunPID(AliESDEvent *esd) energy = clust->E(); lambda0 = clust->GetM02(); - // verify cluster type - Int_t clusterType= clust->GetClusterType(); - if (clusterType == AliESDCaloCluster::kEMCALClusterv1 && lambda0 != 0 && energy < 1000) { + + if (lambda0 != 0 && energy < 1000) { // reject clusters with lambda0 = 0 @@ -159,8 +158,8 @@ void AliEMCALPID::RunPID(AliESDEvent *esd) if(fReconstructor){ // In case it is called during reconstruction. // cout << "############# Fill ESDs with PIDWeight ##########" << endl; - clust->SetPid(fPIDFinal);} - } // end if (clusterType...) + clust->SetPID(fPIDFinal);} + } // end if (lambda0 != 0 && energy < 1000) } // end for (iCluster...) } diff --git a/EMCAL/AliEMCALReconstructor.cxx b/EMCAL/AliEMCALReconstructor.cxx index 048721c14f8..10cc902f3b9 100644 --- a/EMCAL/AliEMCALReconstructor.cxx +++ b/EMCAL/AliEMCALReconstructor.cxx @@ -308,7 +308,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, AliESDCaloCells &emcCells = *(esd->GetEMCALCells()); emcCells.CreateContainer(nDigits); - emcCells.SetType(AliESDCaloCells::kEMCALCell); + emcCells.SetType(AliVCaloCells::kEMCALCell); Float_t energy = 0; for (Int_t idig = 0 ; idig < nDigits ; idig++) { const AliEMCALDigit * dig = (const AliEMCALDigit*)digits->At(idig); @@ -362,7 +362,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, //######################################## for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) { const AliEMCALRecPoint * clust = (const AliEMCALRecPoint*)clusters->At(iClust); - //if(clust->GetClusterType()== AliESDCaloCluster::kEMCALClusterv1) nRP++; else nPC++; + //if(clust->GetClusterType()== AliVCluster::kEMCALClusterv1) nRP++; else nPC++; if (Debug()) clust->Print(); // Get information from EMCAL reconstruction points Float_t xyz[3]; @@ -403,7 +403,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, Int_t *parentList = clust->GetParents(parentMult); // fills the ESDCaloCluster AliESDCaloCluster * ec = new AliESDCaloCluster() ; - ec->SetClusterType(AliESDCaloCluster::kEMCALClusterv1); + ec->SetType(AliVCluster::kEMCALClusterv1); ec->SetPosition(xyz); ec->SetE(clust->GetEnergy()); @@ -420,8 +420,8 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, } ec->SetCellsAbsId(newAbsIdList); ec->SetCellsAmplitudeFraction(newFracList); - ec->SetClusterDisp(clust->GetDispersion()); - ec->SetClusterChi2(-1); //not yet implemented + ec->SetDispersion(clust->GetDispersion()); + ec->SetChi2(-1); //not yet implemented ec->SetM02(elipAxis[0]*elipAxis[0]) ; ec->SetM20(elipAxis[1]*elipAxis[1]) ; ec->SetTOF(clust->GetTime()) ; //time-of-fligh diff --git a/EMCAL/AliEMCALTracker.cxx b/EMCAL/AliEMCALTracker.cxx index 80e5cf3e3db..98c999c09f2 100644 --- a/EMCAL/AliEMCALTracker.cxx +++ b/EMCAL/AliEMCALTracker.cxx @@ -284,7 +284,7 @@ Int_t AliEMCALTracker::LoadClusters(TTree *cTree) for (Int_t i = 0; i < nClusters; i++) { AliEMCALRecPoint *cluster = (AliEMCALRecPoint*)clusters->At(i); if (!cluster) continue; - if (cluster->GetClusterType() != AliESDCaloCluster::kEMCALClusterv1) continue; + if (cluster->GetClusterType() != AliVCluster::kEMCALClusterv1) continue; AliEMCALMatchCluster *matchCluster = new AliEMCALMatchCluster(i, cluster); fClusters->AddLast(matchCluster); } diff --git a/EMCAL/macros/TestESD.C b/EMCAL/macros/TestESD.C index 05931382570..c82a18e9fcb 100644 --- a/EMCAL/macros/TestESD.C +++ b/EMCAL/macros/TestESD.C @@ -1,20 +1,13 @@ + #if !defined(__CINT__) || defined(__MAKECINT__) //Root include files -#include +//#include #include -#include -#include -#include -#include -#include -#include -#include +//#include #include -#include #include #include -#include //AliRoot include files #include "AliRunLoader.h" @@ -24,159 +17,256 @@ #include "AliESDCaloCluster.h" #include "AliESDCaloCells.h" #include "AliPID.h" -#include "AliLog.h" +#include "AliEMCALGeometry.h" #endif //Change the bool depending on what information you want to print // when all FALSE, prints minimum cluster information. -Bool_t kPrintKine = kTRUE; //Do not use for raw data. -Bool_t kPrintCaloCells = kFALSE; +Bool_t kPrintKine = kFALSE; //Do not use for raw data. +Bool_t kPrintCaloCells = kFALSE; Bool_t kPrintTrackMatches = kFALSE; Bool_t kPrintClusterCells = kFALSE; +Bool_t kPrintClusterPID = kFALSE; void TestESD() { - - TGeoManager::Import("geometry.root"); - AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE") ; - + // Main method to read information stored in AliESDCaloClusters and AliESDCaloCells + + // Init some example histograms + // ESD + TH1F * hEta = (TH1F*) new TH1F("hEta","reco eta",1000, -0.71,0.71); + TH1F * hPhi = (TH1F*) new TH1F("hPhi","reco phi",130, 70,200); + TH1F * hE = (TH1F*) new TH1F("hE" ,"reco e",300, 0,30); + TH1F * hTime = (TH1F*) new TH1F("hTime" ,"reco time",1000, 0,1000); + hEta ->SetXTitle("#eta"); + hPhi ->SetXTitle("#phi (deg)"); + hE ->SetXTitle("E (GeV)"); + hTime->SetXTitle("time (ns)"); + + // Monte Carlo + TH1F * hMCEta = (TH1F*) new TH1F("hMCEta","MC eta",1000, -0.71,0.71); + TH1F * hMCPhi = (TH1F*) new TH1F("hMCPhi","MC phi",130, 70,200); + TH1F * hMCE = (TH1F*) new TH1F("hMCE" ,"MC e",300, 0,30); + hMCEta->SetXTitle("#eta"); + hMCPhi->SetXTitle("#phi (deg)"); + hMCE ->SetXTitle("E (GeV)"); + + //ESD - MonteCarlo + TH1F * hDEta = (TH1F*) new TH1F("hDEta"," eta cluster - eta MC",500, -0.05,0.05); + TH1F * hDPhi = (TH1F*) new TH1F("hDPhi","phi cluster - phi MC",200, -20,20); + TH1F * hDE = (TH1F*) new TH1F("hDE" ,"e cluster - e MC",200, -10,10); + hDEta->SetXTitle("#eta_{reco}-#eta_{MC}"); + hDPhi->SetXTitle("#phi_{reco}-#phi_{MC} (deg)"); + hDE ->SetXTitle("E_{reco}-E_{MC} (GeV)"); + + //Open the ESD file, get the tree with events TFile* f = new TFile("AliESDs.root"); 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") ; + Float_t pos[3]; + + //Loop of events Int_t nEvt = esdTree->GetEntries(); - Float_t pos[3] = {0.,0.,0.}; - for(Int_t iev = 0; iev < nEvt; iev++) { cout << "<<<< Event: " << iev+1 << "/" << nEvt << " >>>>"<GetEvent(iev); - - //In case you want to play with MC data - AliStack *stack = 0; - if(kPrintKine){ - AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(), "read"); - rl->LoadKinematics(); - rl->GetEvent(iev); - stack = rl->Stack(); - } - - //get reconstructed vertex position - Double_t vertex_position[3]; - esd->GetVertex()->GetXYZ(vertex_position); - - //GetCellsClusters Array - AliESDCaloCells &cells= *(esd->GetEMCALCells()); - // Uncomment to see the full list of digit amplitudes and times. - if(kPrintCaloCells){ - Int_t nTotalCells = cells.GetNumberOfCells() ; - Int_t type = cells.GetType(); - for (Int_t icell= 0; icell < nTotalCells; icell++) { - cout<<"Cell : "<GetEMCALClusters(caloClusters); + + //Pass the geometry transformation matrix from ESDs to geometry + for(Int_t mod=0; mod < (geom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ + //printf("matrix %d\n",mod); + if(esd->GetEMCALMatrix(mod)) { + //printf("EMCAL: mod %d, matrix %p\n",mod, esd->GetEMCALMatrix(mod)); + //(esd->GetEMCALMatrix(mod))->Print(""); + geom->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ; + }//matrix + }//module + + //In case you want to play with MC data, get stack + AliStack *stack = 0; + if(kPrintKine){ + AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(), "read"); + rl->LoadKinematics(); + rl->GetEvent(iev); + stack = rl->Stack(); + } + + //get reconstructed vertex position + Double_t vertex_position[3]; + esd->GetVertex()->GetXYZ(vertex_position); + + //------------------------------------------------------ + //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 : "<Clear(); + esd->GetEMCALClusters(caloClusters); + //loop over clusters Int_t nclus = caloClusters->GetEntries(); for (Int_t icl = 0; icl < nclus; icl++) { - - AliESDCaloCluster* clus = (AliESDCaloCluster*)caloClusters->At(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]); - TLorentzVector p; - clus->GetMomentum(p,vertex_position); + + //We can get a momentum TLorentzVector per cluster, corrected by the vertex position + //TLorentzVector p; + //clus->GetMomentum(p,vertex_position); + Double_t cphi = vpos.Phi(); Double_t ceta = vpos.Eta(); - - Int_t nMatched = clus->GetNTracksMatched(); - Int_t trackIndex = clus->GetTrackMatched(); - Int_t nLabels = clus->GetNLabels(); + + Int_t nMatched = clus->GetNTracksMatched(); + Int_t trackIndex = clus->GetTrackMatchedIndex(); + Int_t nLabels = clus->GetNLabels(); Int_t labelIndex = clus->GetLabel(); - - Int_t nCells = clus->GetNCells(); - - //For later: ADD CHECK THAT CLUSTER IS WITHIN SM FIDUCIAL VOLUME - - cout << "Cluster: " << icl+1 << "/" << nclus << " Energy: " << energy << " Phi: " - << cphi*TMath::RadToDeg() << " Eta: " << ceta << " NCells: " << nCells << " #Matches: " << nMatched - << " Index: " << trackIndex << " #Labels: " << nLabels << " Index: " - << labelIndex << endl; - - 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; - } - - } - - //Get CaloCells of cluster and print - if(kPrintClusterCells){ - UShort_t * index = clus->GetCellsAbsId() ; - Double_t * fraction = clus->GetCellsAmplitudeFraction() ; - 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) ; - Float_t time = cells.GetCellTime(absId); - cout<<" Cluster Cell: AbsID : "<< absId << "; Amplitude "<< amp << "; Fraction "<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 - cout<< "SModule "<GetNCells(); - //Print primary info - if(!stack || !kPrintKine) continue; + //Fill some histograms + hEta->Fill(ceta); + hPhi->Fill(cphi*TMath::RadToDeg()); + hE ->Fill(energy); + hTime->Fill(clus->GetTOF()*1e9); + + //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 "<GetTOF()*1e9<<" ns "<= 0 && labelIndex < stack->GetNtrack()){ - TParticle * particle = stack->Particle(labelIndex); - //Print primary values - cout<<" More contributing primary: "<GetName()<< "; Energy "<Energy()<<"; Eta "<Eta()<<"; Phi "<Phi()*TMath::RadToDeg()<Particle((clus->GetLabels())->At(i)); - cout<<" Other contributing primary: "<GetName()<< "; Energy "<Energy()<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: "<GetName()<<"; with kinematics: "<Energy()<<"; Phi: "<Phi()*TMath::RadToDeg()<<"; Eta: "<Eta()<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: "<GetName()<< "; Energy "<Energy()<= stack->GetNtrack()) cout <<"PROBLEM, label is too large : "<= particles in stack "<< stack->GetNtrack() <= 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; } - - + }// 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]); + }//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 << " == "<GetCellAbsId(i) <<"; Amplitude "<< amp << "; Fraction "<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 "<Write(); + hPhi->Write(); + hE ->Write(); + hTime->Write(); + if(kPrintKine){ + hMCEta->Write(); + hMCPhi->Write(); + hMCE ->Write(); + hDEta->Write(); + hDPhi->Write(); + hDE ->Write(); } - - - + fhisto->Close(); } diff --git a/ESDCheck/AliEMCALQATask.cxx b/ESDCheck/AliEMCALQATask.cxx index 475a11b4361..c3fbf957c5d 100644 --- a/ESDCheck/AliEMCALQATask.cxx +++ b/ESDCheck/AliEMCALQATask.cxx @@ -192,14 +192,14 @@ void AliEMCALQATask::Exec(Option_t *) AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(emcalCluster) ; if (caloCluster) { Float_t pos[3] ; - if(caloCluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) { + if(caloCluster->IsEMCAL()) { caloCluster->GetPosition(pos) ; fhEMCALPos->Fill(pos[0],pos[1],pos[2]) ; fhEMCALEnergy->Fill(caloCluster->E()) ; fhEMCALDigits->Fill(entry, caloCluster->GetNCells()) ; numberOfEmcalClustersv1++ ; numberOfDigitsInEmcal += caloCluster->GetNCells() ; - // Float_t * pid = clus->GetPid() ; + // const Double_t * pid = clus->GetPID() ; // if(pid[AliPID::kPhoton]>0.9){ emcalVector[numberOfPhotonsInEmcal] = new TVector3(pos[0],pos[1],pos[2]) ; emcalPhotonsEnergy[numberOfPhotonsInEmcal] = caloCluster->E() ; diff --git a/ESDCheck/AliPHOSQATask.cxx b/ESDCheck/AliPHOSQATask.cxx index 591769f86c8..4fbc929ae74 100644 --- a/ESDCheck/AliPHOSQATask.cxx +++ b/ESDCheck/AliPHOSQATask.cxx @@ -198,7 +198,7 @@ void AliPHOSQATask::Exec(Option_t *) fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ; fhPHOSDigits->Fill(entry, caloCluster->GetNCells() ) ; numberOfDigitsInPhos += caloCluster->GetNCells() ; - Double_t * pid = caloCluster->GetPid() ; + const Double_t * pid = caloCluster->GetPID() ; if(pid[AliPID::kPhoton] > 0.9) { phosVector[numberOfPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ; phosPhotonsEnergy[numberOfPhotonsInPhos]=caloCluster->E() ; diff --git a/EVE/EveDet/AliEveEMCALData.cxx b/EVE/EveDet/AliEveEMCALData.cxx index fe9151c7929..580deb0510d 100644 --- a/EVE/EveDet/AliEveEMCALData.cxx +++ b/EVE/EveDet/AliEveEMCALData.cxx @@ -652,7 +652,7 @@ void AliEveEMCALData::LoadRecPointsFromESD() // adc // Int_t eneInt = (Int_t)energy*500+0.5; Double_t eneInt = energy/0.0153; // To be modified with correct OCDB conversion - Double_t disp = clus->GetClusterDisp() ; + Double_t disp = clus->GetDispersion() ; clus->GetPosition(pos) ; // Global position TVector3 vpos(pos[0],pos[1],pos[2]) ; diff --git a/HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx b/HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx index 31af8b6f700..8cfdfcf4ffe 100644 --- a/HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx +++ b/HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx @@ -69,14 +69,14 @@ AliHLTESDCaloClusterMaker::FillESD(AliESDEvent *esdPtr, const AliHLTCaloClusterH AliESDCaloCluster esdCluster; esdCluster.SetID(caloClusterStructPtr->fID); - esdCluster.SetClusterType(caloClusterStructPtr->fClusterType); + esdCluster.SetType(caloClusterStructPtr->fClusterType); esdCluster.SetPosition((Float_t*)(caloClusterStructPtr->fGlobalPos)); esdCluster.SetE(caloClusterStructPtr->fEnergy); esdCluster.SetTOF(caloClusterStructPtr->fTOF); - esdCluster.SetClusterDisp(caloClusterStructPtr->fDispersion); - esdCluster.SetClusterChi2(caloClusterStructPtr->fFitQuality); + esdCluster.SetDispersion(caloClusterStructPtr->fDispersion); + esdCluster.SetChi2(caloClusterStructPtr->fFitQuality); const Float_t *pid = caloClusterStructPtr->fPID; - esdCluster.SetPid(pid); + esdCluster.SetPID(pid); esdCluster.SetM20(caloClusterStructPtr->fM20); esdCluster.SetM02(caloClusterStructPtr->fM02); esdCluster.SetNExMax(caloClusterStructPtr->fNExMax); diff --git a/HLT/CALO/AliHLTCaloClusterAnalyser.cxx b/HLT/CALO/AliHLTCaloClusterAnalyser.cxx index 3fbe574e535..5370b66d23c 100644 --- a/HLT/CALO/AliHLTCaloClusterAnalyser.cxx +++ b/HLT/CALO/AliHLTCaloClusterAnalyser.cxx @@ -57,7 +57,7 @@ AliHLTCaloClusterAnalyser::AliHLTCaloClusterAnalyser() : fDoPID(false), fHaveDistanceToBadChannel(false), fGeometry(0), - fClusterType(AliESDCaloCluster::kPHOSCluster), + fClusterType(AliVCluster::kPHOSNeutral), fRecoParamsPtr(0), fCutOnSingleCellClusters(false), fSingleCellEnergyCut(0.5) diff --git a/JETAN/AliJetESDFillUnitArrayEMCalDigits.cxx b/JETAN/AliJetESDFillUnitArrayEMCalDigits.cxx index d8581d27841..7747140f97c 100755 --- a/JETAN/AliJetESDFillUnitArrayEMCalDigits.cxx +++ b/JETAN/AliJetESDFillUnitArrayEMCalDigits.cxx @@ -266,7 +266,7 @@ void AliJetESDFillUnitArrayEMCalDigits::Exec(Option_t* const /*option*/) Int_t digMult = fClus->GetNCells() ; UShort_t *digID = fClus->GetCellsAbsId() ; //(not used ?) Double_t *digAmpFrac = fClus->GetCellsAmplitudeFraction() ; - Int_t trackIndex = fClus->GetTrackMatched(); + Int_t trackIndex = fClus->GetTrackMatchedIndex(); // Do double-counted electron correction if (fApplyElectronCorrection != 0 && trackIndex !=-1 ) diff --git a/PHOS/AliPHOSAodCluster.cxx b/PHOS/AliPHOSAodCluster.cxx index 9bd0fc58472..1625b7bda53 100755 --- a/PHOS/AliPHOSAodCluster.cxx +++ b/PHOS/AliPHOSAodCluster.cxx @@ -230,7 +230,7 @@ void AliPHOSAodCluster::EvalCoord(Float_t logWeight, TVector3 &vtx) //Go to the global system TVector3 gps ; phosgeom->Local2Global(phosMod, xMean, zMean, gps) ; - SetPosition(0, gps[0]) ; - SetPosition(1, gps[1]) ; - SetPosition(2, gps[2]) ; + SetPositionAt(gps[0],0) ; + SetPositionAt(gps[1],1) ; + SetPositionAt(gps[2],2) ; } diff --git a/PHOS/AliPHOSQADataMakerRec.cxx b/PHOS/AliPHOSQADataMakerRec.cxx index a2dd251bfaa..3d60a4b3e01 100644 --- a/PHOS/AliPHOSQADataMakerRec.cxx +++ b/PHOS/AliPHOSQADataMakerRec.cxx @@ -344,7 +344,7 @@ void AliPHOSQADataMakerRec::MakeESDs(AliESDEvent * esd) AliESDCaloCluster * clu = esd->GetCaloCluster(index) ; if( clu->IsPHOS() ) { GetESDsData(kESDSpec)->Fill(clu->E()) ; - Double_t *pid=clu->GetPid() ; + const Double_t * pid = clu->GetPID() ; GetESDsData(kESDpid)->Fill(pid[AliPID::kPhoton]) ; eTot+=clu->E() ; nTot++ ; diff --git a/PHOS/AliPHOSReconstructor.cxx b/PHOS/AliPHOSReconstructor.cxx index 32120efb00c..9afd29bf7bc 100644 --- a/PHOS/AliPHOSReconstructor.cxx +++ b/PHOS/AliPHOSReconstructor.cxx @@ -293,17 +293,17 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, energy = rp->Energy(); // fills the ESDCaloCluster - ec->SetClusterType(AliESDCaloCluster::kPHOSCluster); + ec->SetType(AliVCluster::kPHOSNeutral); ec->SetPosition(xyz); //rec.point position in MARS ec->SetE(energy); //total or core particle energy - ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion - ec->SetPid(rp->GetPID()) ; //array of particle identification + ec->SetDispersion(emcRP->GetDispersion()); //cluster dispersion + ec->SetPID(rp->GetPID()) ; //array of particle identification ec->SetM02(emcRP->GetM2x()) ; //second moment M2x ec->SetM20(emcRP->GetM2z()) ; //second moment M2z ec->SetNExMax(emcRP->GetNExMax()); //number of local maxima ec->SetEmcCpvDistance(ts->GetCpvDistance("r")); //Only radius, what about separate x,z???? ec->SetTrackDistance(ts->GetCpvDistance("x"),ts->GetCpvDistance("z")); - ec->SetClusterChi2(-1); //not yet implemented + ec->SetChi2(-1); //not yet implemented ec->SetTOF(emcRP->GetTime()); //Time of flight - already calibrated in EMCRecPoint //Cells contributing to clusters diff --git a/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx b/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx index a746272724e..c51830354f8 100644 --- a/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx +++ b/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx @@ -68,7 +68,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD() for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.; // Update the header - AliAODHeader* headerin = aod->GetHeader(); + AliAODHeader* headerin = aod->GetHeader(); AliAODHeader* header = AODEvent()->GetHeader(); header->SetRunNumber(headerin->GetRunNumber()); header->SetBunchCrossNumber(headerin->GetBunchCrossNumber()); @@ -93,7 +93,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD() // // Int_t nVertices = 1 ;/* = prim. vtx*/; - Int_t nCaloClus = aod->GetNCaloClusters(); + Int_t nCaloClus = aod->GetNumberOfCaloClusters(); AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0); @@ -122,8 +122,8 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD() AliAODCaloCluster * cluster = aod->GetCaloCluster(iClust); //Check which calorimeter information we want to keep. - if (fCalorimeter.Contains("PHOS") && !fCalorimeter.Contains("EMCAL") && cluster->IsEMCALCluster()) continue ; - else if(fCalorimeter.Contains("EMCAL") && !fCalorimeter.Contains("PHOS") && cluster->IsPHOSCluster()) continue ; + if (fCalorimeter.Contains("PHOS") && !fCalorimeter.Contains("EMCAL") && cluster->IsEMCAL()) continue ; + else if(fCalorimeter.Contains("EMCAL") && !fCalorimeter.Contains("PHOS") && cluster->IsPHOS()) continue ; Int_t id = cluster->GetID(); Float_t energy = cluster->E(); @@ -140,13 +140,13 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD() NULL, ttype); - caloCluster->SetCaloCluster(cluster->GetDistToBadChannel(), + caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), cluster->GetEmcCpvDistance(), cluster->GetNExMax(),cluster->GetTOF()) ; - caloCluster->SetPIDFromESD(cluster->PID()); + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); @@ -162,7 +162,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD() AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells()); aodEMcells.CreateContainer(nEMcell); - aodEMcells.SetType(AliAODCaloCells::kEMCAL); + aodEMcells.SetType(AliVCaloCells::kEMCALCell); for (Int_t iCell = 0; iCell < nEMcell; iCell++) { aodEMcells.SetCell(iCell,aodinEMcells.GetCellNumber(iCell),aodinEMcells.GetAmplitude(iCell)); } @@ -176,7 +176,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD() AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); aodPHcells.CreateContainer(nPHcell); - aodPHcells.SetType(AliAODCaloCells::kPHOS); + aodPHcells.SetType(AliVCaloCells::kPHOSCell); for (Int_t iCell = 0; iCell < nPHcell; iCell++) { aodPHcells.SetCell(iCell,aodinPHcells.GetCellNumber(iCell),aodinPHcells.GetAmplitude(iCell)); } @@ -264,15 +264,6 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD() Int_t id = cluster->GetID(); Float_t energy = cluster->E(); cluster->GetPosition(posF); - Char_t ttype = AliAODCluster::kUndef; - - if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) { - ttype=AliAODCluster::kPHOSNeutral; - } - else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) { - ttype = AliAODCluster::kEMCALClusterv1; - } - AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) AliAODCaloCluster(id, @@ -281,15 +272,15 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD() energy, posF, NULL, - ttype); + cluster->GetType()); caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), - cluster->GetClusterDisp(), + cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), cluster->GetEmcCpvDistance(), cluster->GetNExMax(),cluster->GetTOF()) ; - caloCluster->SetPIDFromESD(cluster->GetPid()); + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); @@ -305,7 +296,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD() AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells()); aodEMcells.CreateContainer(nEMcell); - aodEMcells.SetType(AliAODCaloCells::kEMCAL); + aodEMcells.SetType(AliVCaloCells::kEMCALCell); for (Int_t iCell = 0; iCell < nEMcell; iCell++) { aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell)); } @@ -319,7 +310,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD() AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); aodPHcells.CreateContainer(nPHcell); - aodPHcells.SetType(AliAODCaloCells::kPHOS); + aodPHcells.SetType(AliVCaloCells::kPHOSCell); for (Int_t iCell = 0; iCell < nPHcell; iCell++) { aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell)); } diff --git a/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx b/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx index 291b0563e3e..43ef96ab0ac 100644 --- a/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx +++ b/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx @@ -35,11 +35,9 @@ #include "AliAnalysisTaskEMCALPi0CalibSelection.h" #include "AliAODEvent.h" #include "AliESDEvent.h" -#include "AliESDCaloCluster.h" -#include "AliESDCaloCells.h" #include "AliEMCALGeometry.h" -#include "AliAODCaloCluster.h" -#include "AliAODCaloCells.h" +#include "AliVCluster.h" +#include "AliVCaloCells.h" //#include "AliEMCALAodCluster.h" //#include "AliEMCALCalibData.h" @@ -126,7 +124,6 @@ void AliAnalysisTaskEMCALPi0CalibSelection::LocalInit() void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromAOD() { // Copy AOD header, vertex, CaloClusters and CaloCells to output AOD - AliAODEvent* aod = dynamic_cast(InputEvent()); // set arrays and pointers @@ -162,7 +159,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromAOD() // // Int_t nVertices = 1 ;/* = prim. vtx*/; - Int_t nCaloClus = aod->GetNCaloClusters(); + Int_t nCaloClus = aod->GetNumberOfCaloClusters(); AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0); @@ -178,64 +175,64 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromAOD() vtx->GetCovMatrix(covVtx); //covariance matrix AliAODVertex * primary = new(vertices[jVertices++]) - AliAODVertex(pos, covVtx, vtx->GetChi2perNDF(), NULL, -1, AliAODVertex::kPrimary); + AliAODVertex(pos, covVtx, vtx->GetChi2perNDF(), NULL, -1, AliAODVertex::kPrimary); primary->SetName(vtx->GetName()); primary->SetTitle(vtx->GetTitle()); // Access to the AOD container of clusters TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters()); Int_t jClusters=0; + printf("nCaloClus %d\n",nCaloClus); for (Int_t iClust=0; iClustGetCaloCluster(iClust); //Check if it is a EMCAL cluster - if(!cluster->IsEMCALCluster()) continue ; - - if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue; - - + if(!cluster->IsEMCAL()) continue ; + printf("EMCAL cluster %d, ncells %d\n",iClust, cluster->GetNCells()); + if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue; + printf("copy\n"); Int_t id = cluster->GetID(); Float_t energy = cluster->E(); cluster->GetPosition(posF); Char_t ttype = cluster->GetType(); AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) - AliAODCaloCluster(id, - 0, - 0x0, - energy, - posF, - NULL, - ttype); - - caloCluster->SetCaloCluster(cluster->GetDistToBadChannel(), - cluster->GetDispersion(), - cluster->GetM20(), cluster->GetM02(), - cluster->GetEmcCpvDistance(), - cluster->GetNExMax(),cluster->GetTOF()) ; + AliAODCaloCluster(id, + 0, + 0x0, + energy, + posF, + NULL, + ttype); - caloCluster->SetPIDFromESD(cluster->PID()); + caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), + cluster->GetDispersion(), + cluster->GetM20(), cluster->GetM02(), + cluster->GetEmcCpvDistance(), + cluster->GetNExMax(),cluster->GetTOF()) ; + + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); - + caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); } - + caloClusters.Expand(jClusters); // resize TObjArray // end of loop on calo clusters // fill EMCAL cell info if (aod->GetEMCALCells()) { // protection against missing AOD information - AliAODCaloCells &aodinEMcells = *(aod->GetEMCALCells()); + AliAODCaloCells &aodinEMcells = *(aod->GetEMCALCells()); Int_t nEMcell = aodinEMcells.GetNumberOfCells() ; AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells()); aodEMcells.CreateContainer(nEMcell); - aodEMcells.SetType(AliAODCaloCells::kEMCAL); - - Double_t calibFactor = 1; + aodEMcells.SetType(AliAODCaloCells::kEMCALCell); + + Double_t calibFactor = 1; for (Int_t iCell = 0; iCell < nEMcell; iCell++) { aodEMcells.SetCell(iCell,aodinEMcells.GetCellNumber(iCell),aodinEMcells.GetAmplitude(iCell)*calibFactor); } @@ -250,7 +247,6 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromESD() { // Copy Header, Vertex, CaloClusters and CaloCells from ESDs to AODs - AliESDEvent* esd = dynamic_cast(InputEvent()); // set arrays and pointers @@ -303,13 +299,14 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromESD() vtx->GetCovMatrix(covVtx); //covariance matrix AliAODVertex * primary = new(vertices[jVertices++]) - AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary); + AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary); primary->SetName(vtx->GetName()); primary->SetTitle(vtx->GetTitle()); // Access to the AOD container of clusters TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters()); Int_t jClusters=0; + printf("nCaloClus %d\n",nCaloClus); for (Int_t iClust=0; iClustIsEMCAL()) continue ; - if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue; - + printf("EMCAL cluster %d, ncells %d\n",iClust, cluster->GetNCells()); + + if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue; + printf("copy\n"); + Int_t id = cluster->GetID(); Float_t energy = cluster->E(); cluster->GetPosition(posF); AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) - AliAODCaloCluster(id, - 0, - 0x0, - energy, - posF, - NULL, - AliAODCluster::kEMCALClusterv1); + AliAODCaloCluster(id, + 0, + 0x0, + energy, + posF, + NULL, + AliVCluster::kEMCALClusterv1); caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), - cluster->GetClusterDisp(), - cluster->GetM20(), cluster->GetM02(), - cluster->GetEmcCpvDistance(), - cluster->GetNExMax(),cluster->GetTOF()) ; + cluster->GetDispersion(), + cluster->GetM20(), cluster->GetM02(), + cluster->GetEmcCpvDistance(), + cluster->GetNExMax(),cluster->GetTOF()) ; - caloCluster->SetPIDFromESD(cluster->GetPid()); + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); - + } - + caloClusters.Expand(jClusters); // resize TObjArray // end of loop on calo clusters // fill EMCAL cell info - + if( esd->GetEMCALCells()) { // protection against missing ESD information AliESDCaloCells &esdEMcells = *(esd->GetEMCALCells()); - Int_t nEMcell = esdEMcells.GetNumberOfCells() ; + Int_t nEMcell = esdEMcells.GetNumberOfCells() ; AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells()); aodEMcells.CreateContainer(nEMcell); - aodEMcells.SetType(AliAODCaloCells::kEMCAL); + aodEMcells.SetType(AliAODCaloCells::kEMCALCell); - Double_t calibFactor = 1; - for (Int_t iCell = 0; iCell < nEMcell; iCell++) { + Double_t calibFactor = 1; + for (Int_t iCell = 0; iCell < nEMcell; iCell++) { aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell)*calibFactor); } aodEMcells.Sort(); @@ -485,7 +485,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */) for(Int_t iClu=0; iCluAt(iClu); - if(!fCopyAOD && kESD && ClusterContainsBadChannel(c1->GetCellsAbsId(), c1->GetNCells())) continue; + if(!fCopyAOD && ClusterContainsBadChannel(c1->GetCellsAbsId(), c1->GetNCells())) continue; Float_t e1i = c1->E(); // cluster energy before correction if(e1i < fEmin) continue; @@ -533,7 +533,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */) for (Int_t jClu=iClu; jCluAt(jClu); if(c2->IsEqual(c1)) continue; - if(!fCopyAOD && kESD && ClusterContainsBadChannel(c2->GetCellsAbsId(), c2->GetNCells())) continue; + if(!fCopyAOD && ClusterContainsBadChannel(c2->GetCellsAbsId(), c2->GetNCells())) continue; Float_t e2i = c2->E(); if(e2i < fEmin) continue; diff --git a/PWG4/CaloCalib/AliAnalysisTaskPHOSPi0CalibSelection.cxx b/PWG4/CaloCalib/AliAnalysisTaskPHOSPi0CalibSelection.cxx index 2578d369e5c..563440ca497 100644 --- a/PWG4/CaloCalib/AliAnalysisTaskPHOSPi0CalibSelection.cxx +++ b/PWG4/CaloCalib/AliAnalysisTaskPHOSPi0CalibSelection.cxx @@ -132,7 +132,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD() // // Int_t nVertices = 1 ;/* = prim. vtx*/; - Int_t nCaloClus = aod->GetNCaloClusters(); + Int_t nCaloClus = aod->GetNumberOfCaloClusters(); AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0); @@ -161,7 +161,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD() AliAODCaloCluster * cluster = aod->GetCaloCluster(iClust); //Check if it is a PHOS cluster - if(!cluster->IsPHOSCluster()) continue ; + if(!cluster->IsPHOS()) continue ; Int_t id = cluster->GetID(); Float_t energy = cluster->E(); @@ -177,13 +177,13 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD() NULL, ttype); - caloCluster->SetCaloCluster(cluster->GetDistToBadChannel(), + caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), cluster->GetEmcCpvDistance(), cluster->GetNExMax(),cluster->GetTOF()) ; - caloCluster->SetPIDFromESD(cluster->PID()); + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); @@ -200,7 +200,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD() AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); aodPHcells.CreateContainer(nPHcell); - aodPHcells.SetType(AliAODCaloCells::kPHOS); + aodPHcells.SetType(AliVCaloCells::kPHOSCell); for (Int_t iCell = 0; iCell < nPHcell; iCell++) { aodPHcells.SetCell(iCell,aodinPHcells.GetCellNumber(iCell),aodinPHcells.GetAmplitude(iCell)); } @@ -297,12 +297,12 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromESD() AliAODCluster::kPHOSNeutral); caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), - cluster->GetClusterDisp(), + cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), cluster->GetEmcCpvDistance(), cluster->GetNExMax(),cluster->GetTOF()) ; - caloCluster->SetPIDFromESD(cluster->GetPid()); + caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); @@ -318,7 +318,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromESD() AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); aodPHcells.CreateContainer(nPHcell); - aodPHcells.SetType(AliAODCaloCells::kPHOS); + aodPHcells.SetType(AliVCaloCells::kPHOSCell); for (Int_t iCell = 0; iCell < nPHcell; iCell++) { aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell)); } @@ -427,7 +427,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::UserExec(Option_t* /* option */) for(Int_t iClu=0; iCluAt(iClu); - if(!c1->IsPHOSCluster()) continue; // EMCAL cluster! + if(!c1->IsPHOS()) continue; // EMCAL cluster! Float_t e1i = c1->E(); // cluster energy before correction if(e1iAt(jClu); - if(!c2->IsPHOSCluster()) continue; // EMCAL cluster! + if(!c2->IsPHOS()) continue; // EMCAL cluster! if(c2->IsEqual(c1)) continue; Float_t e2i = c2->E(); diff --git a/PWG4/JCORRAN/AliJCORRANTask.cxx b/PWG4/JCORRAN/AliJCORRANTask.cxx index 12e5c829b3d..5bc958a3b85 100755 --- a/PWG4/JCORRAN/AliJCORRANTask.cxx +++ b/PWG4/JCORRAN/AliJCORRANTask.cxx @@ -401,7 +401,7 @@ void AliJCORRANTask::ReadESDTracks(const AliESDEvent * esd) ctrack->SetPhi(p3.Phi()); ctrack->SetPID(pid); ctrack->SetFlavor(kNone);//kHadron); - ctrack->SetCharge(track->Charge()); + ctrack->SetCharge(track->Charge()); ctrack->ConvertAliPID(); ctrack->SetEta(eta); @@ -478,15 +478,15 @@ void AliJCORRANTask::ReadESDCaloClusters(const AliESDEvent* esd) for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) { AliESDCaloCluster *caloCluster = esd->GetCaloCluster(icluster) ; if(!caloCluster) continue; - if(caloCluster->GetTrackMatched()==-1){ + if(caloCluster->GetTrackMatchedIndex()==-1){ if(caloCluster->E()AddAliJPhoton(nPhotons); AliJPhoton *pht = fPhotonList->GetAliJPhoton(nPhotons); pht->SetFlavor(kPhoton); pht->SetE(caloCluster->E()); - pht->SetChi2(caloCluster->GetClusterChi2()); - pht->SetPID(caloCluster->GetPid()); + pht->SetChi2(caloCluster->Chi2()); + pht->SetPID(caloCluster->GetPID()); Float_t pos[3]; caloCluster->GetPosition(pos) ; pht->SetX(pos[0]); pht->SetY(pos[1]); @@ -498,7 +498,7 @@ void AliJCORRANTask::ReadESDCaloClusters(const AliESDEvent* esd) if(caloCluster->IsEMCAL()) pht->SetCaloType(AliJPhoton::kEMCALCalo); if(caloCluster->IsPHOS()) pht->SetCaloType(AliJPhoton::kPHOSCalo); pht->SetDistToBadChannel(caloCluster->GetDistanceToBadChannel()); - pht->SetDispersion(caloCluster->GetClusterDisp()); + pht->SetDispersion(caloCluster->GetDispersion()); pht->SetM20(caloCluster->GetM20()); pht->SetM02(caloCluster->GetM02()); pht->SetEmcCpvDist(caloCluster->GetEmcCpvDistance()); @@ -517,7 +517,7 @@ void AliJCORRANTask::ReadESDCaloClusters(const AliESDEvent* esd) void AliJCORRANTask::ReadAODCaloClusters(const AliAODEvent* aod) { // Read the AliAODCaloClusters and fill the list of AliJPhoton containers - Int_t numberOfCaloClusters = aod->GetNCaloClusters() ; + Int_t numberOfCaloClusters = aod->GetNumberOfCaloClusters() ; if(fDebug < 5) cout << "AOD::number of ESD caloclusters " << numberOfCaloClusters << endl; Short_t nPhotons = 0; for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) { @@ -531,7 +531,7 @@ void AliJCORRANTask::ReadAODCaloClusters(const AliAODEvent* aod) pht->SetE(caloCluster->E()); pht->SetFlavor(kPhoton); pht->SetChi2(caloCluster->Chi2()); - pht->SetPID((Double_t*)caloCluster->PID()); + pht->SetPID((Double_t*)caloCluster->GetPID()); Float_t pos[3]; caloCluster->GetPosition(pos) ; pht->SetX(pos[0]); pht->SetY(pos[1]); @@ -540,16 +540,16 @@ void AliJCORRANTask::ReadAODCaloClusters(const AliAODEvent* aod) pht->SetTheta(atan2(sqrt(pos[0]*pos[1]+pos[1]*pos[1]),pos[2])); pht->SetPt(caloCluster->E()*sin(atan2(sqrt(pos[0]*pos[0]+pos[1]*pos[1]),pos[2]))); pht->SetCharge(0); - if(caloCluster->IsEMCALCluster()) pht->SetCaloType(AliJPhoton::kEMCALCalo); - if(caloCluster->IsPHOSCluster()) pht->SetCaloType(AliJPhoton::kPHOSCalo); - pht->SetDistToBadChannel(caloCluster->GetDistToBadChannel()); + if(caloCluster->IsEMCAL()) pht->SetCaloType(AliJPhoton::kEMCALCalo); + if(caloCluster->IsPHOS()) pht->SetCaloType(AliJPhoton::kPHOSCalo); + pht->SetDistToBadChannel(caloCluster->GetDistanceToBadChannel()); pht->SetDispersion(caloCluster->GetDispersion()); pht->SetM20(caloCluster->GetM20()); pht->SetM02(caloCluster->GetM02()); pht->SetEmcCpvDist(caloCluster->GetEmcCpvDistance()); pht->SetNCells(int(caloCluster->GetNCells())); pht->SetCellsAbsId(caloCluster->GetCellsAbsId()); - Int_t imoduleID = GetSuperModuleNumber(caloCluster->IsEMCALCluster(), caloCluster->GetCellAbsId(0)); + Int_t imoduleID = GetSuperModuleNumber(caloCluster->IsEMCAL(), caloCluster->GetCellAbsId(0)); pht->SetSuperModuleID(imoduleID); fPhotonList->SetNPhotons(++nPhotons); @@ -709,7 +709,7 @@ bool AliJCORRANTask::ContainsESDHighECaloClusters(){ for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) { AliESDCaloCluster *caloCluster = esd->GetCaloCluster(icluster) ; if(!caloCluster) continue; - if(caloCluster->GetTrackMatched()==-1){ + if(caloCluster->GetTrackMatchedIndex()==-1){ //sotre calo clusters above 1 GeV if( caloCluster->E() > fLowerCutOnLeadingCaloClusterE){ isThisEventToBeStored = kTRUE; @@ -726,7 +726,7 @@ bool AliJCORRANTask::ContainsESDHighECaloClusters(){ aod = (AliAODEvent*)InputEvent(); } - Int_t numberOfCaloClusters = aod->GetNCaloClusters() ; + Int_t numberOfCaloClusters = aod->GetNumberOfCaloClusters() ; // loop over all the Calo Clusters for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) { AliAODCaloCluster *caloCluster = aod->GetCaloCluster(icluster) ; diff --git a/PWG4/PWG4PartCorrBaseLinkDef.h b/PWG4/PWG4PartCorrBaseLinkDef.h index fc0ee62e19b..08577dc403c 100755 --- a/PWG4/PWG4PartCorrBaseLinkDef.h +++ b/PWG4/PWG4PartCorrBaseLinkDef.h @@ -13,6 +13,7 @@ #pragma link C++ class AliAnaPartCorrMaker+; #pragma link C++ class AliAnaPartCorrBaseClass+; #pragma link C++ class AliAnalysisTaskParticleCorrelation+; +#pragma link C++ class AliAnalysisTaskParticleCorrelationM+; #pragma link C++ class AliCaloTrackReader+; #pragma link C++ class AliCaloTrackESDReader+; #pragma link C++ class AliCaloTrackAODReader+; diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx index b7907d402db..030b581e936 100755 --- a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx @@ -37,6 +37,8 @@ #include "AliAODEvent.h" #include "AliAODHandler.h" #include "AliAnalysisManager.h" +#include "AliMixedEvent.h" +#include "AliAODPWG4Particle.h" ClassImp(AliAnaPartCorrBaseClass) @@ -57,7 +59,7 @@ ClassImp(AliAnaPartCorrBaseClass) fHistoPhiBins(0), fHistoPhiMax(0.), fHistoPhiMin(0.), fHistoEtaBins(0), fHistoEtaMax(0.), fHistoEtaMin(0.), fHistoMassBins(0), fHistoMassMax(0.), fHistoMassMin(0.), - fHistoAsymBins(0), fHistoAsymMax(0.), fHistoAsymMin(0.) + fHistoAsymBins(0), fHistoAsymMax(0.), fHistoAsymMin(0.), fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL) { //Default Ctor @@ -180,6 +182,14 @@ AliAnaPartCorrBaseClass::~AliAnaPartCorrBaseClass() if(fIC) delete fIC ; if(fMCUtils) delete fMCUtils ; if(fNMS) delete fNMS ; + + if (fMixedEvent) { + for (Int_t i = 0; i < fNMixedEvent; i++) { + delete [] fVertex[i] ; + } + } + delete [] fVertex ; + // printf("--- analysis deleted \n"); } @@ -517,7 +527,7 @@ void AliAnaPartCorrBaseClass::InitParameters() fHistoAsymBins = 10 ; fHistoAsymMax = 1. ; fHistoAsymMin = 0. ; - + } //__________________________________________________________________ @@ -550,3 +560,26 @@ void AliAnaPartCorrBaseClass::Print(const Option_t * opt) const printf(" \n") ; } + +//__________________________________________________________________ +AliMixedEvent * AliAnaPartCorrBaseClass::GetMixedEvent() +{ + //gets the mixed event objects and does some setting + if (!fMixedEvent) { + fMixedEvent = dynamic_cast(GetReader()->GetInputEvent()) ; + if (fMixedEvent) { + fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; + } + fVertex = new Double_t*[fNMixedEvent] ; + for (Int_t i = 0; i < fNMixedEvent; i++) { + fVertex[i] = new Double_t[3] ; + fVertex[i][0] = 0.0 ; + fVertex[i][1] = 0.0 ; + fVertex[i][2] = 0.0 ; + } + } + return fMixedEvent ; +} + + + diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h index 42fe305a8ae..61d3d58ceb9 100755 --- a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h @@ -4,20 +4,20 @@ * See cxx source for full Copyright notice */ /* $Id: $ */ -//_________________________________________________________________________ -// Base class for analysis algorithms -//-- Author: Gustavo Conesa (INFN-LNF) + //_________________________________________________________________________ + // Base class for analysis algorithms + //-- Author: Gustavo Conesa (INFN-LNF) #include -//ROOT + //ROOT class TClonesArray ; class TObjArray ; #include #include class TObjString; -//Analysis + //Analysis class AliESDCaloCluster; class AliAODCaloCluster; class AliAODCaloCells; @@ -34,28 +34,29 @@ class AliGenEventHeader ; #include "AliAODPWG4ParticleCorrelation.h" class AliEMCALGeoUtils; class AliPHOSGeoUtils; +#include "AliMixedEvent.h" class AliAnaPartCorrBaseClass : public TObject { - public: +public: AliAnaPartCorrBaseClass() ; // default ctor virtual ~AliAnaPartCorrBaseClass() ; //virtual dtor - private: +private: AliAnaPartCorrBaseClass(const AliAnaPartCorrBaseClass & g) ; // cpy ctor AliAnaPartCorrBaseClass & operator = (const AliAnaPartCorrBaseClass & g) ;//cpy assignment - public: - // virtual void AddAODCaloCluster(AliAODCaloCluster calo) ; +public: + // virtual void AddAODCaloCluster(AliAODCaloCluster calo) ; virtual void AddAODParticle(AliAODPWG4Particle part) ; -// virtual void ConnectAODCaloClusters(); + // virtual void ConnectAODCaloClusters(); virtual void ConnectAODPHOSCells(); virtual void ConnectAODEMCALCells(); virtual void ConnectInputOutputAODBranches(); virtual TList * GetCreateOutputObjects() { return (new TList) ;} - //virtual TList * GetAnalysisOutputContainer() { return fAnaOutContainer ;} + //virtual TList * GetAnalysisOutputContainer() { return fAnaOutContainer ;} virtual void AddToHistogramsName(TString add) { fAddToHistogramsName = add; } virtual TString GetAddedHistogramsStringToName() {return fAddToHistogramsName ;} @@ -77,26 +78,26 @@ class AliAnaPartCorrBaseClass : public TObject { virtual void SetDebug(Int_t d) { fDebug = d ; } virtual Int_t GetEventNumber() const ; - + virtual AliCaloTrackReader * GetReader() const {return fReader ; } virtual void SetReader(AliCaloTrackReader * const reader) { fReader = reader ; } - //Calorimeter helper class access methods + //Calorimeter helper class access methods AliEMCALGeoUtils * GetEMCALGeometry() const { return fCaloUtils->GetEMCALGeometry(); } AliPHOSGeoUtils * GetPHOSGeometry() const { return fCaloUtils->GetPHOSGeometry() ; } - + Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const { return fCaloUtils->GetModuleNumberCellIndexes(absId, calo, icol, irow,iRCU);} Int_t GetModuleNumber(AliAODPWG4Particle * part) const { return fCaloUtils->GetModuleNumber(part, fReader->GetInputEvent());} - Int_t GetModuleNumber(AliESDCaloCluster * cluster) const { - return fCaloUtils->GetModuleNumber(cluster);} - Int_t GetModuleNumber(AliAODCaloCluster * cluster) const { + Int_t GetModuleNumber(AliVCluster * cluster) const { return fCaloUtils->GetModuleNumber(cluster);} + // Int_t GetModuleNumber(AliAODCaloCluster * cluster) const { + // return fCaloUtils->GetModuleNumber(cluster);} virtual void Terminate(TList * /*outputList*/) {;} - //analysis AOD branch + //analysis AOD branch virtual TClonesArray * GetCreateOutputAODBranch() ; virtual TString GetInputAODName() const {return fInputAODName ; } virtual void SetInputAODName(TString name) { fInputAODName = name; } @@ -110,12 +111,12 @@ class AliAnaPartCorrBaseClass : public TObject { virtual TString GetAODObjArrayName() const {return fAODObjArrayName;} virtual void SetAODObjArrayName(TString name) {fAODObjArrayName = name; } - + virtual TClonesArray* GetInputAODBranch() const {return fInputAODBranch ;} virtual TClonesArray* GetOutputAODBranch() const {if(fNewAOD) return fOutputAODBranch; else return fInputAODBranch ;} virtual TClonesArray* GetAODBranch(TString aodBranchName) const ; -// virtual TClonesArray* GetAODCaloClusters() const {return fAODCaloClusters ;} + // virtual TClonesArray* GetAODCaloClusters() const {return fAODCaloClusters ;} virtual TClonesArray* GetAODCaloClusters() const ; virtual TClonesArray* GetAODTracks() const ; virtual AliAODCaloCells* GetAODCaloCells() const {return fAODCaloCells ;} @@ -133,7 +134,7 @@ class AliAnaPartCorrBaseClass : public TObject { virtual AliHeader* GetMCHeader() const ; virtual AliGenEventHeader* GetMCGenEventHeader() const ; - //Analysis helpers classes pointers setters and getters + //Analysis helpers classes pointers setters and getters virtual AliCaloPID * GetCaloPID() {if(!fCaloPID) fCaloPID = new AliCaloPID(); return fCaloPID ;} virtual void SetCaloPID(AliCaloPID * const pid) { fCaloPID = pid ;} @@ -152,7 +153,7 @@ class AliAnaPartCorrBaseClass : public TObject { virtual Bool_t IsDataMC() {return fDataMC ; } virtual void SwitchOnDataMC() {fDataMC = kTRUE ; if(!fMCUtils)fMCUtils = new AliMCAnalysisUtils();} virtual void SwitchOffDataMC() {fDataMC = kFALSE ; } - + virtual Bool_t IsFiducialCutOn() { return fCheckFidCut ; } virtual void SwitchOnFiducialCut() { fCheckFidCut = kTRUE; if(!fFidCut)fFidCut = new AliFiducialCut();} virtual void SwitchOffFiducialCut() { fCheckFidCut = kFALSE;} @@ -172,8 +173,8 @@ class AliAnaPartCorrBaseClass : public TObject { virtual void SetPtCutRange(Double_t ptmin, Double_t ptmax) { fMaxPt=ptmax; fMinPt=ptmin;} - //Histogrammes setters and getters - //Pt, Energy + //Histogrammes setters and getters + //Pt, Energy virtual void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n) { fHistoPtBins = n ; fHistoPtMax = max ; @@ -184,7 +185,7 @@ class AliAnaPartCorrBaseClass : public TObject { virtual Float_t GetHistoPtMin() const { return fHistoPtMin ; } virtual Float_t GetHistoPtMax() const { return fHistoPtMax ; } - //Azimuthal angle + //Azimuthal angle virtual void SetHistoPhiRangeAndNBins(Float_t min, Float_t max, Int_t n) { fHistoPhiBins = n ; fHistoPhiMax = max ; @@ -195,7 +196,7 @@ class AliAnaPartCorrBaseClass : public TObject { virtual Float_t GetHistoPhiMin() const { return fHistoPhiMin ; } virtual Float_t GetHistoPhiMax() const { return fHistoPhiMax ; } - //Pseudorapidity-rapidity + //Pseudorapidity-rapidity virtual void SetHistoEtaRangeAndNBins(Float_t min, Float_t max, Int_t n) { fHistoEtaBins = n ; fHistoEtaMax = max ; @@ -206,29 +207,34 @@ class AliAnaPartCorrBaseClass : public TObject { virtual Float_t GetHistoEtaMin() const { return fHistoEtaMin ; } virtual Float_t GetHistoEtaMax() const { return fHistoEtaMax ; } - //Mass + //Mass virtual void SetHistoMassRangeAndNBins(Float_t min, Float_t max, Int_t n) { - fHistoMassBins = n ; - fHistoMassMax = max ; - fHistoMassMin = min ; + fHistoMassBins = n ; + fHistoMassMax = max ; + fHistoMassMin = min ; } virtual Int_t GetHistoMassBins() const { return fHistoMassBins ; } virtual Float_t GetHistoMassMin() const { return fHistoMassMin ; } virtual Float_t GetHistoMassMax() const { return fHistoMassMax ; } - //Asymetry + //Asymetry virtual void SetHistoAsymmetryRangeAndNBins(Float_t min, Float_t max, Int_t n) { - fHistoAsymBins = n ; - fHistoAsymMax = max ; - fHistoAsymMin = min ; + fHistoAsymBins = n ; + fHistoAsymMax = max ; + fHistoAsymMin = min ; } virtual Int_t GetHistoAsymmetryBins() const { return fHistoAsymBins ; } virtual Float_t GetHistoAsymmetryMin() const { return fHistoAsymMin ; } virtual Float_t GetHistoAsymmetryMax() const { return fHistoAsymMax ; } + + virtual AliMixedEvent * GetMixedEvent() ; + Int_t GetNMixedEvent() const { return fNMixedEvent ; } + Double_t * GetVertex(Int_t i) const { return fVertex[i] ; } + - private: +private: Bool_t fDataMC ; // Flag to access MC data when using ESD or AOD Int_t fDebug ; // Debug level @@ -249,20 +255,20 @@ class AliAnaPartCorrBaseClass : public TObject { TString fAODObjArrayName ; // Name of ref array kept in a TList in AliAODParticleCorrelation with clusters or track references. TString fAddToHistogramsName;// Add this string to histograms name - //TClonesArray* fAODCaloClusters ; //! selected PHOS/EMCAL CaloClusters + //TClonesArray* fAODCaloClusters ; //! selected PHOS/EMCAL CaloClusters AliAODCaloCells * fAODCaloCells ; //! selected PHOS/EMCAL CaloCells - //Analysis helper classes access pointers + //Analysis helper classes access pointers AliCaloPID * fCaloPID; //! PID calculation AliFiducialCut * fFidCut; //! Acceptance cuts AliIsolationCut * fIC; //! Isolation cut AliMCAnalysisUtils * fMCUtils; //! MonteCarlo Analysis utils AliNeutralMesonSelection * fNMS; //! Neutral Meson Selection AliCalorimeterUtils * fCaloUtils ; // Pointer to CalorimeterUtils - - //TList * fAnaOutContainer; // Temporal histogram output container, contents to be added to the main container passed to the main analysis frame - - //Histograms binning and range + + //TList * fAnaOutContainer; // Temporal histogram output container, contents to be added to the main container passed to the main analysis frame + + //Histograms binning and range Int_t fHistoPtBins ; // Number of bins in pt axis Float_t fHistoPtMax ; // Maximum value of pt histogram range Float_t fHistoPtMin ; // Minimum value of pt histogram range @@ -278,9 +284,15 @@ class AliAnaPartCorrBaseClass : public TObject { Int_t fHistoAsymBins ; // Number of bins in asymmetry axis Float_t fHistoAsymMax ; // Maximum value of asymmetry histogram range Float_t fHistoAsymMin ; // Minimum value of asymmetry histogram range + + AliMixedEvent * fMixedEvent ; //! mixed event object + Int_t fNMixedEvent ; //! number of events in mixed event buffer + Double_t ** fVertex ; //! vertex array 3 dim for each mixed event buffer + + ClassDef(AliAnaPartCorrBaseClass,7) - } ; +} ; #endif //ALIANAPARTCORRBASECLASS_H diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx new file mode 100755 index 00000000000..a7a81b10a6f --- /dev/null +++ b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx @@ -0,0 +1,226 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +/* $Id$ */ + +//_________________________________________________________________________ +// Analysis task that executes the analysis classes +// that depend on the PartCorr frame, frame for Particle identification and correlations. +// Specially designed for calorimeters but also can be used for charged tracks +// Input of this task is a configuration file that contains all the settings of the analyis +// +// -- Author: Gustavo Conesa (INFN-LNF) + +#include + +// --- Root --- +#include +#include +#include +//#include +//#include + +// --- Analysis --- +#include "AliAnalysisTaskParticleCorrelationM.h" +#include "AliAnaPartCorrMaker.h" +#include "AliCaloTrackReader.h" +#include "AliPDG.h" +#include "AliAnalysisManager.h" +#include "AliMultiEventInputHandler.h" +#include "AliMixedEvent.h" +#include "AliAODEvent.h" +#include "AliESDEvent.h" + +ClassImp(AliAnalysisTaskParticleCorrelationM) + +//////////////////////////////////////////////////////////////////////// +AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM(): + AliAnalysisTaskME(), + fAna(0x0), + fOutputContainer(0x0), + fConfigName(""), fCuts(0x0), fInputEvent(NULL) +{ + // Default constructor +} + +//_____________________________________________________ +AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM(const char* name): + AliAnalysisTaskME(name), + fAna(0x0), + fOutputContainer(0x0), + fConfigName(""), fCuts(0x0), fInputEvent(NULL) +{ + // Default constructor + + DefineOutput(1, TList::Class()); + DefineOutput(2, TList::Class()); // will contain cuts or local params +} + +//_____________________________________________________ +AliAnalysisTaskParticleCorrelationM::~AliAnalysisTaskParticleCorrelationM() +{ + // Remove all pointers + +// printf("********** Delete Task\n"); +// // Do not delete it here, already done somewhere else, need to understand where. +// if(fOutputContainer){ +// fOutputContainer->Clear() ; +// delete fOutputContainer ; +// } + + delete fInputEvent ; + if(fAna) delete fAna; + +// printf("********** Task deleted \n"); +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() +{ + // Create the output container + if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - Begin\n"); + + //Get list of aod arrays, add each aod array to analysis frame + TClonesArray *array = 0; + TList * list = fAna->GetAODBranchList(); + TString deltaAODName = (fAna->GetReader())->GetDeltaAODFileName(); + for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){ + array = (TClonesArray*) list->At(iaod); + if(deltaAODName!="") AddAODBranch("TClonesArray", &array, deltaAODName);//Put it in DeltaAOD file + else AddAODBranch("TClonesArray", &array);//Put it in standard AOD file + } + + //Histograms container + OpenFile(1); + fOutputContainer = fAna->GetOutputContainer(); + fOutputContainer->SetOwner(kTRUE); + if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - End\n"); + + PostData(1,fOutputContainer); + +} +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelationM::LocalInit() +{ + // Local Initialization + + //Call the Init to initialize the configuration of the analysis + Init(); + + // Create cuts/param objects and publish to slot + fCuts = fAna->GetListOfAnalysisCuts(); + + // Post Data + PostData(2, fCuts); + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelationM::Init() +{ + // Initialization + + if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::Init() - Begin\n"); + + fInputEvent = new AliMixedEvent() ; + + // Call configuration file if specified + + if (fConfigName.Length()) { + printf("AliAnalysisTaskParticleCorrelationM::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data()); + gROOT->LoadMacro(fConfigName+".C"); + fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); + } + + if(!fAna) { + printf("AliAnalysisTaskParticleCorrelationM::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n"); + abort(); + } + + // Add different generator particles to PDG Data Base + // to avoid problems when reading MC generator particles + AliPDG::AddParticlesToPdgDataBase(); + + //Set in the reader the name of the task in case is needed + (fAna->GetReader())->SetTaskName(GetName()); + + // Initialise analysis + fAna->Init(); + + //Delta AOD + if((fAna->GetReader())->GetDeltaAODFileName()!="") + AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName()); + + if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::Init() - End\n"); + +} + + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelationM::UserExec(Option_t */*option*/) +{ + // Execute analysis for current event + // + if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserExec() - Begin\n"); + + //Get the type of data, check if type is correct + Int_t datatype = fAna->GetReader()->GetDataType(); + if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && + datatype != AliCaloTrackReader::kMC){ + printf("AliAnalysisTaskParticleCorrelationM::UserExec() - Wrong type of data\n"); + return ; + } + + Int_t nev = fInputHandler->GetBufferSize(); + fInputEvent->Reset(); + + for (Int_t iev = 0; iev < nev; iev++) { + if (datatype == AliCaloTrackReader::kESD) { + AliESDEvent* esd = dynamic_cast(GetEvent(iev)); + fInputEvent->AddEvent(esd); + } else if (datatype == AliCaloTrackReader::kAOD) { + AliAODEvent* aod = dynamic_cast(GetEvent(iev)); + fInputEvent->AddEvent(aod); + } else { + AliFatal("need to implement mixed event for MC") ; + } + } + fInputEvent->Init(); + + fAna->GetReader()->SetInputOutputMCEvent(fInputEvent, AODEvent(), MCEvent()); + + //Process event + fAna->ProcessEvent((Int_t) Entry(), CurrentFileName()); + //printf("AliAnalysisTaskParticleCorrelationM::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName()); + if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserExec() - End\n"); + + PostData(1, fOutputContainer); + + //gObjectTable->Print(); + + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelationM::Terminate(Option_t */*option*/) +{ + // Terminate analysis + // Do some plots + + // Get merged histograms from the output container + // Propagate histagrams to maker + fAna->Terminate((TList*)GetOutputData(1)); + +} + diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h new file mode 100755 index 00000000000..1cedd5a3d04 --- /dev/null +++ b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h @@ -0,0 +1,59 @@ +#ifndef AliAnalysisTaskParticleCorrelationM_H +#define AliAnalysisTaskParticleCorrelationM_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//_________________________________________________________________________ +// Analysis task that executes the analysis classes +// that depend on the PartCorr frame, frame for Particle identification and correlations. +// Specially designed for calorimeters but also can be used for charged tracks +// Input of this task is a configuration file that contains all the settings of the analyis +// +// -- Author: Gustavo Conesa (INFN-LNF) + +//--- Root --- +class TList; + +//--- AliRoot --- +#include "AliAnalysisTaskME.h" +class AliAnaPartCorrMaker; +class AliMixedEvent; +class AliMCEvent; + +class AliAnalysisTaskParticleCorrelationM : public AliAnalysisTaskME +{ + public: + AliAnalysisTaskParticleCorrelationM(); + AliAnalysisTaskParticleCorrelationM(const char* name); + virtual ~AliAnalysisTaskParticleCorrelationM() ;// virtual dtor + + // Implementation of interface methods + virtual void UserCreateOutputObjects(); + virtual void Init(); + virtual void LocalInit() ; + virtual void UserExec(Option_t *option); + virtual void Terminate(Option_t *option); + + void SetConfigFileName(TString name ) {fConfigName = name ; } + TString GetConfigFileName() const {return fConfigName ; } + + void SetAnalysisMaker(AliAnaPartCorrMaker * const maker) {fAna = maker;} + AliMixedEvent * InputEvent(){ return fInputEvent ; } + AliMCEvent* MCEvent() {return NULL;} // do something about MC event + + private: + AliAnalysisTaskParticleCorrelationM(const AliAnalysisTaskParticleCorrelationM&); // Not implemented + AliAnalysisTaskParticleCorrelationM& operator=(const AliAnalysisTaskParticleCorrelationM&); // Not implemented + + AliAnaPartCorrMaker* fAna; // Pointer to the manager class + TList * fOutputContainer ; //! Histogram container + TString fConfigName ; // Configuration file name + TList * fCuts ; //! List with analysis cuts + + AliMixedEvent * fInputEvent; + + ClassDef(AliAnalysisTaskParticleCorrelationM, 3); // Analysis task for standard gamma correlation analysis +}; + +#endif //AliAnalysisTaskParticleCorrelationM_H diff --git a/PWG4/PartCorrBase/AliCaloPID.cxx b/PWG4/PartCorrBase/AliCaloPID.cxx index 5bc5eb68d27..b80f755bf0d 100755 --- a/PWG4/PartCorrBase/AliCaloPID.cxx +++ b/PWG4/PartCorrBase/AliCaloPID.cxx @@ -250,24 +250,24 @@ Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t } if(fDebug > 0) printf("AliCaloPID::GetPdg: calo %s, 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", - calo.Data(),pid[AliAODCluster::kPhoton], pid[AliAODCluster::kPi0], - pid[AliAODCluster::kElectron], pid[AliAODCluster::kEleCon], - pid[AliAODCluster::kPion], pid[AliAODCluster::kKaon], pid[AliAODCluster::kProton], - pid[AliAODCluster::kNeutron], pid[AliAODCluster::kKaon0]); + calo.Data(),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]); Int_t pdg = kNeutralUnknown ; - Float_t chargedHadronWeight = pid[AliAODCluster::kProton]+pid[AliAODCluster::kKaon]+ - pid[AliAODCluster::kPion]+pid[AliAODCluster::kMuon]; - Float_t neutralHadronWeight = pid[AliAODCluster::kNeutron]+pid[AliAODCluster::kKaon0]; - Float_t allChargedWeight = pid[AliAODCluster::kElectron]+pid[AliAODCluster::kEleCon]+ chargedHadronWeight; - Float_t allNeutralWeight = pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kPi0]+ neutralHadronWeight; + Float_t chargedHadronWeight = pid[AliVCluster::kProton]+pid[AliVCluster::kKaon]+ + pid[AliVCluster::kPion]+pid[AliVCluster::kMuon]; + Float_t neutralHadronWeight = pid[AliVCluster::kNeutron]+pid[AliVCluster::kKaon0]; + Float_t allChargedWeight = pid[AliVCluster::kElectron]+pid[AliVCluster::kEleCon]+ chargedHadronWeight; + Float_t allNeutralWeight = pid[AliVCluster::kPhoton]+pid[AliVCluster::kPi0]+ neutralHadronWeight; //Select most probable ID if(calo=="PHOS"){ - if(pid[AliAODCluster::kPhoton] > wPh) pdg = kPhoton ; - else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; - else if(pid[AliAODCluster::kElectron] > wE) pdg = kElectron ; - else if(pid[AliAODCluster::kEleCon] > wE) pdg = kEleCon ; + if(pid[AliVCluster::kPhoton] > wPh) pdg = kPhoton ; + else if(pid[AliVCluster::kPi0] > wPi0) pdg = kPi0 ; + else if(pid[AliVCluster::kElectron] > wE) pdg = kElectron ; + else if(pid[AliVCluster::kEleCon] > wE) pdg = kEleCon ; else if(chargedHadronWeight > wCh) pdg = kChargedHadron ; else if(neutralHadronWeight > wNe) pdg = kNeutralHadron ; else if(allChargedWeight > allNeutralWeight) @@ -277,10 +277,10 @@ Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t } else{//EMCAL - if(pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kElectron] > wPh) pdg = kPhoton ; //temporal sollution until track matching for electrons is considered - //if(pid[AliAODCluster::kPhoton] > wPh) pdg = kPhoton ; - else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; - //else if(pid[AliAODCluster::kElectron] > wE) pdg = kElectron ; + if(pid[AliVCluster::kPhoton]+pid[AliVCluster::kElectron] > wPh) pdg = kPhoton ; //temporal sollution until track matching for electrons is considered + //if(pid[AliVCluster::kPhoton] > wPh) pdg = kPhoton ; + else if(pid[AliVCluster::kPi0] > wPi0) pdg = kPi0 ; + //else if(pid[AliVCluster::kElectron] > wE) pdg = kElectron ; else if(chargedHadronWeight + neutralHadronWeight > wCh) pdg = kChargedHadron ; else if(neutralHadronWeight + chargedHadronWeight > wNe) pdg = kNeutralHadron ; else pdg = kNeutralUnknown ; @@ -301,18 +301,18 @@ Int_t AliCaloPID::GetPdg(const TString calo,const TLorentzVector mom, const AliA if(fDebug > 0) printf("AliCaloPID::GetPdg: Calorimeter %s, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %1.11f, distCPV %3.2f, distToBC %1.1f, NMax %d\n", calo.Data(),energy,lambda0,cluster->GetM20(),cluster->GetDispersion(),cluster->GetTOF(), - cluster->GetEmcCpvDistance(), cluster->GetDistToBadChannel(),cluster->GetNExMax()); + cluster->GetEmcCpvDistance(), cluster->GetDistanceToBadChannel(),cluster->GetNExMax()); if(calo == "EMCAL") { //Recalculate Bayesian if(fRecalculateBayesian){ if(fDebug > 0) { - const Double_t *pid0 = cluster->PID(); + const Double_t *pid0 = cluster->GetPID(); printf("AliCaloPID::GetPdg: BEFORE calo %s, 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", - calo.Data(),pid0[AliAODCluster::kPhoton], pid0[AliAODCluster::kPi0], - pid0[AliAODCluster::kElectron], pid0[AliAODCluster::kEleCon], - pid0[AliAODCluster::kPion], pid0[AliAODCluster::kKaon], pid0[AliAODCluster::kProton], - pid0[AliAODCluster::kNeutron], pid0[AliAODCluster::kKaon0]); + calo.Data(),pid0[AliVCluster::kPhoton], pid0[AliVCluster::kPi0], + pid0[AliVCluster::kElectron], pid0[AliVCluster::kEleCon], + pid0[AliVCluster::kPion], pid0[AliVCluster::kKaon], pid0[AliVCluster::kProton], + pid0[AliVCluster::kNeutron], pid0[AliVCluster::kKaon0]); } fEMCALPIDUtils->ComputePID(energy, lambda0); @@ -323,10 +323,10 @@ Int_t AliCaloPID::GetPdg(const TString calo,const TLorentzVector mom, const AliA } - // If no use of bayesian, simple PID - if(lambda0 < 0.25) return kPhoton ; - //else return kNeutralHadron ; - else return kPi0 ; + // If no use of bayesian, simple PID + if(lambda0 < 0.25) return kPhoton ; + //else return kNeutralHadron ; + else return kPi0 ; } // if(calo == "PHOS") { @@ -434,7 +434,7 @@ void AliCaloPID::SetPIDBits(const TString calo, const AliAODCaloCluster * cluste ph->SetChargedBit(ntr>0) ; //Temporary cut, should we evaluate distance? //Set PID pdg - ph->SetPdg(GetPdg(calo,cluster->PID(),ph->E())); + ph->SetPdg(GetPdg(calo,cluster->GetPID(),ph->E())); if(fDebug > 0){ printf("AliCaloPID::SetPIDBits: TOF %e, Dispersion %2.2f, NTracks %d\n",tof , disp, ntr); diff --git a/PWG4/PartCorrBase/AliCaloTrackAODReader.cxx b/PWG4/PartCorrBase/AliCaloTrackAODReader.cxx index a3d0be097ab..0840e79d7e6 100755 --- a/PWG4/PartCorrBase/AliCaloTrackAODReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackAODReader.cxx @@ -36,13 +36,15 @@ #include "AliESDtrack.h" #include "AliFiducialCut.h" #include "AliAODInputHandler.h" +#include "AliMultiEventInputHandler.h" #include "AliAnalysisManager.h" +#include "AliMixedEvent.h" ClassImp(AliCaloTrackAODReader) //____________________________________________________________________________ AliCaloTrackAODReader::AliCaloTrackAODReader() : - AliCaloTrackReader(), fWriteOutputStdAOD(kFALSE) + AliCaloTrackReader() { //Default Ctor @@ -74,267 +76,6 @@ AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & aodr) // //} -//____________________________________________________________________________ -void AliCaloTrackAODReader::FillInputCTS() { - //Return array with Central Tracking System (CTS) tracks - if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS()\n"); - Int_t nTracks = fInputEvent->GetNumberOfTracks() ; - Int_t naod = 0; - Double_t p[3]; - for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop - AliAODTrack * track = ((AliAODEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd - - //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits - if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; - - track->GetPxPyPz(p) ; - TLorentzVector momentum(p[0],p[1],p[2],0); - - if(fCTSPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue; - - if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - if(fWriteOutputStdAOD){ - AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track); - fAODCTS->Add(newtrack); //Use AOD stored in output for references. - } - else fAODCTS->Add(track); - }//Pt and Fiducial cut passed. - }// track loop - - fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast(); - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod entries %d\n", fAODCTSNormalInputEntries); - - //If second input event available, add the clusters. - if(fSecondInputAODTree && fSecondInputAODEvent){ - nTracks = fSecondInputAODEvent->GetNumberOfTracks() ; - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - Add second input tracks, entries %d\n", nTracks) ; - for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop - AliAODTrack * track = ((AliAODEvent*)fSecondInputAODEvent)->GetTrack(itrack) ; // retrieve track from esd - - //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits - if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; - - track->GetPxPyPz(p) ; - TLorentzVector momentum(p[0],p[1],p[2],0); - - if(fCTSPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue; - - if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - if(fWriteOutputStdAOD){ - AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track); - fAODCTS->Add(newtrack); //Use AOD stored in output for references. - } - else fAODCTS->Add(track); - - }//Pt and Fiducial cut passed. - }// track loop - - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod normal entries %d, after second input %d\n", fAODCTSNormalInputEntries, fAODCTS->GetEntriesFast()); - } //second input loop - -} - -//____________________________________________________________________________ -void AliCaloTrackAODReader::FillInputEMCAL() { - //Return array with EMCAL clusters in aod format - if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputEMCAL()\n"); - - //Get vertex for momentum calculation - Double_t v[3] ; //vertex ; - GetVertex(v); - - Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); - //Loop to select clusters in fiducial cut and fill container with aodClusters - Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); - for (Int_t iclus = 0; iclus < nclusters; iclus++) { - AliAODCaloCluster * clus = 0; - if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) { - if (clus->IsEMCALCluster()){ - - //Check if the cluster contains any bad channel and if close to calorimeter borders - if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus,((AliAODEvent*)fInputEvent)->GetEMCALCells())) continue; - - TLorentzVector momentum ; - clus->GetMomentum(momentum, v); - - if(fEMCALPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue; - - if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - //Recalibrate the cluster energy - if(GetCaloUtils()->IsRecalibrationOn()) { - Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetEMCALCells()); - clus->SetE(energy); - } - - if(fWriteOutputStdAOD){ - AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); - fAODEMCAL->Add(newclus); - } - else fAODEMCAL->Add(clus); - }//Pt and Fiducial cut passed. - }//EMCAL cluster - }// cluster exists - }// cluster loop - - fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast(); - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod entries %d\n", fAODEMCALNormalInputEntries); - - //If second input event available, add the clusters. - if(fSecondInputAODTree && fSecondInputAODEvent){ - GetSecondInputAODVertex(v); - nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters(); - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Add second input clusters, entries %d\n", nclusters) ; - for (Int_t iclus = 0; iclus < nclusters; iclus++) { - AliAODCaloCluster * clus = 0; - if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) { - if (clus->IsEMCALCluster()){ - TLorentzVector momentum ; - clus->GetMomentum(momentum, v); - - if(fEMCALPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue; - - if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - if(fWriteOutputStdAOD){ - AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); - fAODEMCAL->Add(newclus); - } - else fAODEMCAL->Add(clus); - }//Pt and Fiducial cut passed. - }//EMCAL cluster - }// cluster exists - }// cluster loop - - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod normal entries %d, after second input %d\n", fAODEMCALNormalInputEntries, fAODEMCAL->GetEntriesFast()); - - } //second input loop -} - -//____________________________________________________________________________ -void AliCaloTrackAODReader::FillInputPHOS() { - //Return array with PHOS clusters in aod format - if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputPHOS()\n"); - - //Get vertex for momentum calculation - Double_t v[3] ; //vertex ; - GetVertex(v); - - Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); - //Loop to select clusters in fiducial cut and fill container with aodClusters - Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); - for (Int_t iclus = 0; iclus < nclusters; iclus++) { - AliAODCaloCluster * clus = 0; - if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) { - if (clus->IsPHOSCluster()){ - - //Check if the cluster contains any bad channel and if close to calorimeter borders - if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliAODEvent*)fInputEvent)->GetPHOSCells())) continue; - - TLorentzVector momentum ; - clus->GetMomentum(momentum, v); - - if(fPHOSPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue; - - if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - //Recalibrate the cluster energy - if(GetCaloUtils()->IsRecalibrationOn()) { - Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells()); - clus->SetE(energy); - } - - if(fWriteOutputStdAOD){ - AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); - fAODPHOS->Add(newclus); - } - else fAODPHOS->Add(clus); - }//Pt and Fiducial cut passed. - }//PHOS cluster - }//cluster exists - }//esd cluster loop - - fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ; - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod entries %d\n", fAODPHOSNormalInputEntries); - - //If second input event available, add the clusters. - if(fSecondInputAODTree && fSecondInputAODEvent){ - GetSecondInputAODVertex(v); - nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters(); - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - Add second input clusters, entries %d\n", nclusters); - for (Int_t iclus = 0; iclus < nclusters; iclus++) { - AliAODCaloCluster * clus = 0; - if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) { - if (clus->IsPHOSCluster()){ - TLorentzVector momentum ; - clus->GetMomentum(momentum, v); - - if(fPHOSPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue; - - if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - if(fWriteOutputStdAOD){ - AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); - fAODPHOS->Add(newclus); - } - else fAODPHOS->Add(clus); - }//Pt and Fiducial cut passed. - }//PHOS cluster - }// cluster exists - }// cluster loop - if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod normal entries %d, after second input %d\n", fAODPHOSNormalInputEntries, fAODPHOS->GetEntriesFast()); - } //second input loop - -} - -//____________________________________________________________________________ -void AliCaloTrackAODReader::FillInputEMCALCells() { - //Return array with EMCAL cells in aod format - - fEMCALCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetEMCALCells(); - -} - -//____________________________________________________________________________ -void AliCaloTrackAODReader::FillInputPHOSCells() { - //Return array with PHOS cells in aod format - - fPHOSCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetPHOSCells(); - -} - -//____________________________________________________________________________ -void AliCaloTrackAODReader::GetVertex(Double_t v[3]) const { - //Return vertex position - if(((AliAODEvent*)fInputEvent)->GetPrimaryVertex()) - ((AliAODEvent*)fInputEvent)->GetPrimaryVertex()->GetXYZ(v); - else { - printf("AliCaloTrackAODReader::GetVertex() - No vertex available, InputEvent()->GetPrimaryVertex() = 0, return (0,0,0)\n"); - v[0]=0; v[1]=0; v[2]=0; - } - - -} //____________________________________________________________________________ void AliCaloTrackAODReader::GetSecondInputAODVertex(Double_t v[3]) const { @@ -348,7 +89,7 @@ void AliCaloTrackAODReader::GetSecondInputAODVertex(Double_t v[3]) const { Double_t AliCaloTrackAODReader::GetBField() const { //Return magnetic field - Double_t bfield = ((AliAODEvent*)fInputEvent)->GetMagneticField(); + Double_t bfield = fInputEvent->GetMagneticField(); return bfield; @@ -359,14 +100,31 @@ void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* // Connect the data pointers // If input is AOD, do analysis with input, if not, do analysis with the output aod. - if(!strcmp(input->GetName(),"AliESDEvent")) { + //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents()); + + Bool_t tesd = kFALSE ; + Bool_t taod = kTRUE ; + if ( strcmp(input->GetName(), "AliMixedEvent") == 0 ) { + AliMultiEventInputHandler* multiEH = dynamic_cast((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); + if (multiEH->GetFormat() == 0 ) { + tesd = kTRUE ; + } else if (multiEH->GetFormat() == 1) { + taod = kTRUE ; + } + } + if (strcmp(input->GetName(),"AliESDEvent") == 0) { + tesd = kTRUE ; + } else if (strcmp(input->GetName(),"AliAODEvent") == 0) { + taod = kTRUE ; + } + + + if(tesd) { SetInputEvent(aod); SetOutputEvent(aod); } - else if(!strcmp(input->GetName(),"AliAODEvent")){ - - AliAODInputHandler* aodIH = static_cast((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); - //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents()); + else if(taod){ + AliAODInputHandler* aodIH = dynamic_cast((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); if (aodIH && aodIH->GetMergeEvents()) { //Merged events, use output AOD. SetInputEvent(aod); @@ -378,8 +136,7 @@ void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* } } else{ - printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()); - abort(); + AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName())); } SetMC(mc); diff --git a/PWG4/PartCorrBase/AliCaloTrackAODReader.h b/PWG4/PartCorrBase/AliCaloTrackAODReader.h index 0fc8a0c2f98..25640919fac 100755 --- a/PWG4/PartCorrBase/AliCaloTrackAODReader.h +++ b/PWG4/PartCorrBase/AliCaloTrackAODReader.h @@ -28,16 +28,10 @@ public: //AliCaloTrackAODReader & operator = (const AliCaloTrackAODReader & g) ;//cpy assignment virtual ~AliCaloTrackAODReader() {;} //virtual dtor - void FillInputCTS() ; - void FillInputEMCAL() ; - void FillInputPHOS() ; - void FillInputEMCALCells() ; - void FillInputPHOSCells() ; - + Double_t GetBField() const; void GetSecondInputAODVertex(Double_t v[3]) const ; - void GetVertex(Double_t v[3]) const ; void SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) ; void SwitchOnWriteStdAOD() {fWriteOutputStdAOD = kTRUE;} @@ -47,10 +41,8 @@ public: void Print(const Option_t * opt) const; -private: - Bool_t fWriteOutputStdAOD; // Write selected standard tracks and caloclusters in output AOD - ClassDef(AliCaloTrackAODReader,4) + ClassDef(AliCaloTrackAODReader,5) } ; #endif //ALICALOTRACKAODREADER_H diff --git a/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx b/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx index 8286c0da76a..63a1f6ae5c9 100755 --- a/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx @@ -40,7 +40,11 @@ #include "AliAODTrack.h" #include "AliAODPid.h" #include "AliAODEvent.h" +#include "AliMultiEventInputHandler.h" +#include "AliAnalysisManager.h" #include "AliFiducialCut.h" +#include "AliMixedEvent.h" + ClassImp(AliCaloTrackESDReader) @@ -82,338 +86,353 @@ AliCaloTrackESDReader::AliCaloTrackESDReader(const AliCaloTrackESDReader & g) : //} //____________________________________________________________________________ -void AliCaloTrackESDReader::FillInputCTS() { - //Return array with CTS tracks - if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputCTS()\n"); - - //TObjArray * fAODCTS = new TObjArray(); - Int_t nTracks = fInputEvent->GetNumberOfTracks() ; - Int_t naod = 0; - Double_t pos[3]; - Double_t p[3]; - Double_t covTr[21]; - Double_t pid[10]; - Double_t bfield = ((AliESDEvent*)fInputEvent)->GetMagneticField(); - - Double_t timezero = 0; //TO BE FIXED - - //List of output tracks - TClonesArray &tracks = *(fOutputEvent->GetTracks()); - - //To be replaced by call to AliEMCALGeoUtils when the class becomes available - Double_t radius = 441.0; //[cm] EMCAL radius +13cm - - if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - org entries %d\n", nTracks); - for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop - AliESDtrack * track = (AliESDtrack*) ((AliESDEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd - - //We want tracks fitted in the detectors: TPCrefit, ITSrefit ... check the set bits. - if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; - - track->GetPxPyPz(p) ; - TLorentzVector momentum(p[0],p[1],p[2],0); - - if(fCTSPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue; - - if(fDebug > 3 && momentum.Pt() > 0.2) printf("AliCaloTrackESDReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - track->GetXYZ(pos); - track->GetCovarianceXYZPxPyPz(covTr); - track->GetESDpid(pid); - - Float_t impactXY, impactZ; - - track->GetImpactParameters(impactXY,impactZ); - - if (impactXY<3) { - // track inside the beam pipe - //Put new aod object in file in AOD tracks array - AliAODTrack *aodTrack = new(tracks[naod++]) - //AliAODTrack *aodTrack = new((*(fOutputEvent->GetTracks()))[naod++]) - AliAODTrack(track->GetID(), track->GetLabel(), p, kTRUE, pos, kFALSE,covTr, (Short_t)track->GetSign(), track->GetITSClusterMap(), - pid, - 0x0,//primary, - kTRUE, // check if this is right - kTRUE, // check if this is right - AliAODTrack::kPrimary, - 0); - - aodTrack->SetFlags(track->GetStatus()); - aodTrack->ConvertAliPIDtoAODPID(); - - //fill needed AliAODPid information, including - //Extrapolate track to EMCAL surface for AOD-level track-cluster matching - AliAODPid *aodpid = new AliAODPid; - aodpid->SetITSsignal(track->GetITSsignal()); - aodpid->SetTPCsignal(track->GetTPCsignal()); - //n TRD planes = 6 - Int_t nslices = track->GetNumberOfTRDslices()*6; - Double_t *trdslices = new Double_t[nslices]; - for(Int_t iSl =0; iSl < track->GetNumberOfTRDslices(); iSl++) { - for(Int_t iPl =0; iPl<6; iPl++) trdslices[iPl*track->GetNumberOfTRDslices()+iSl] = track->GetTRDslice(iPl,iSl); - } - aodpid->SetTRDsignal(track->GetNumberOfTRDslices()*6,trdslices); - Double_t times[AliAODPid::kSPECIES]; track->GetIntegratedTimes(times); - aodpid->SetIntegratedTimes(times); - - aodpid->SetTOFsignal(track->GetTOFsignal()-timezero); // to be fixed - aodpid->SetHMPIDsignal(track->GetHMPIDsignal()); - - Double_t emcpos[3] = {0.,0.,0.}; - Double_t emcmom[3] = {0.,0.,0.}; - aodpid->SetEMCALPosition(emcpos); - aodpid->SetEMCALMomentum(emcmom); - - AliExternalTrackParam *outerparam = (AliExternalTrackParam*)track->GetOuterParam(); - if(!outerparam) continue; - - Bool_t okpos = outerparam->GetXYZAt(radius,bfield,emcpos); - Bool_t okmom = outerparam->GetPxPyPzAt(radius,bfield,emcmom); - if(!(okpos && okmom)) continue; - - aodpid->SetEMCALPosition(emcpos); - aodpid->SetEMCALMomentum(emcmom); - - aodTrack->SetDetPID(aodpid); - } - else continue; // outside the beam pipe: orphan track - }//Pt and Fiducial cut passed. - }// track loop - - //Put references to selected tracks in array - for(Int_t itrack = 0; itrack < (fOutputEvent->GetTracks())->GetEntriesFast(); itrack++){ - AliAODTrack * track = (AliAODTrack*) (fOutputEvent->GetTracks())->At(itrack); - fAODCTS->Add(track); - } - - if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - aod entries %d\n", fAODCTS->GetEntriesFast()); -} - -//____________________________________________________________________________ -void AliCaloTrackESDReader::FillInputEMCAL() { - //Return array with EMCAL clusters in aod format - if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputEMCAL()\n"); - - //Get vertex for momentum calculation - Double_t v[3] ; //vertex ; - GetVertex(v); - - Float_t pos[3] ; - Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); - Int_t nTracks = fInputEvent->GetNumberOfTracks() ; - - //Loop to select clusters in fiducial cut and fill container with aodClusters - for (Int_t iclus = 0; iclus < ((AliESDEvent*)fInputEvent)->GetNumberOfCaloClusters(); iclus++) { - AliESDCaloCluster * clus = 0; - if ( (clus = ((AliESDEvent*)fInputEvent)->GetCaloCluster(iclus)) ) { - if (clus->IsEMCAL()){ - - //Check if the cluster contains any bad channel and if close to calorimeter borders - if( GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliESDEvent*)fInputEvent)->GetEMCALCells())) continue; - - TLorentzVector momentum ; - clus->GetMomentum(momentum, v); - if(fDebug > 3 && momentum.E() > 0.1) printf("AliCaloTrackESDReader::FillInputEMCAL() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - if(fEMCALPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue; - - if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - clus->GetPosition(pos) ; - Int_t id = clus->GetID(); - Int_t nLabel = clus->GetNLabels(); - Int_t *labels=0x0; - if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); - - Float_t energy = clus->E(); - Char_t ttype= AliAODCluster::kEMCALClusterv1; - - //Recalibrate the cluster energy - if(GetCaloUtils()->IsRecalibrationOn()) energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliESDCaloCells*)GetEMCALCells()); - - - //Put new aod object in file in AOD calo clusters array - AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) - AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL,ttype,0); - - // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", - // pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], - // pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]); - caloCluster->SetPIDFromESD(clus->GetPid()); - caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), - clus->GetM20(), clus->GetM02(), - clus->GetEmcCpvDistance(), clus->GetNExMax(), clus->GetTOF()) ; - - - if(fDebug > 3 && momentum.E() > 0.1) - printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, NexMax %d, TOF %e\n", - clus->GetDistanceToBadChannel(), clus->GetClusterDisp(),clus->GetM20(), clus->GetM02(), - clus->GetNExMax(), clus->GetTOF()); - - caloCluster->SetNCells(clus->GetNCells()); - caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); - caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); - - TArrayI* matchedT = clus->GetTracksMatched(); - if (nTracks > 0 && matchedT && clus->GetTrackMatched() >= 0) { - for (Int_t im = 0; im < matchedT->GetSize(); im++) { - Int_t iESDtrack = matchedT->At(im); - if(iESDtrack < nTracks && iESDtrack > -1) - caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack))); - } - } - //Fill reference array - }//Pt and Fiducial cut passed. - }//EMCAL cluster - }//cluster exists - }//esd cluster loop - - //Put references to selected clusters in array - for(Int_t iclus = 0; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){ - AliAODCaloCluster * clus = (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus); - fAODEMCAL->Add(clus); - } - if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputEMCAL() - aod entries %d\n", fAODEMCAL->GetEntriesFast()); - -} - -//____________________________________________________________________________ -void AliCaloTrackESDReader::FillInputPHOS() { - //Return array with PHOS clusters in aod format - if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputPHOS()\n"); - - Int_t nEMCAL = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); - //Get vertex for momentum calculation - Double_t v[3] ; //vertex ; - GetVertex(v); - - Float_t pos[3] ; - Double_t * pid = new Double_t[AliPID::kSPECIESN]; - Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); - Int_t nTracks = fInputEvent->GetNumberOfTracks() ; - - //Loop to select clusters in fiducial cut and fill container with aodClusters - for (Int_t iclus = 0; iclus < ((AliESDEvent*)fInputEvent)->GetNumberOfCaloClusters(); iclus++) { - AliESDCaloCluster * clus = 0; - if ( (clus = ((AliESDEvent*)fInputEvent)->GetCaloCluster(iclus)) ) { - if (clus->IsPHOS()){ - - //Check if the cluster contains any bad channel and if close to calorimeter borders - if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliESDEvent*)fInputEvent)->GetPHOSCells())) continue; - - TLorentzVector momentum ; - clus->GetMomentum(momentum, v); - if(fDebug > 3 && momentum.E() > 0.1)printf("AliCaloTrackESDReader::FillInputPHOS() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - if(fPHOSPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue; - - if(fDebug > 2 && momentum.E() > 0.1)printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - clus->GetPosition(pos) ; - Int_t id = clus->GetID(); - Int_t nLabel = clus->GetNLabels(); - Int_t *labels=0x0; - if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); - Float_t energy = clus->E(); - - //Phos cluster type - pid = clus->GetPid(); - // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", - // pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], - // pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]); - Char_t ttype= AliAODCluster::kPHOSNeutral; - Float_t wNeutral = pid[AliPID::kNeutron]+ pid[AliPID::kKaon0]+pid[AliPID::kPhoton]+pid[AliPID::kPi0]; - Float_t wCharged = pid[AliPID::kMuon] + pid[AliPID::kElectron] + pid[AliPID::kEleCon]+ - pid[AliPID::kProton]+pid[AliPID::kKaon]+pid[AliPID::kPion]; - if( wCharged > wNeutral) ttype= AliAODCluster::kPHOSCharged; - - //Recalibrate the cluster energy - if(GetCaloUtils()->IsRecalibrationOn()) energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliESDCaloCells*)GetPHOSCells()); - - //Put new aod object in file in AOD calo clusters array - AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) - AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL, ttype, 0); - - - caloCluster->SetPIDFromESD(pid); - caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), - clus->GetM20(), clus->GetM02(), - clus->GetEmcCpvDistance(), clus->GetNExMax()) ; - - if(fDebug > 3 && momentum.E() > 0.2) - printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, EmcCpvDist %3.3f, NexMax %d, TOF %e\n", - clus->GetDistanceToBadChannel(), clus->GetClusterDisp(),clus->GetM20(), clus->GetM02(), - clus->GetEmcCpvDistance(), clus->GetNExMax(), clus->GetTOF()); - - caloCluster->SetNCells(clus->GetNCells()); - caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); - caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); - - TArrayI* matchedT = clus->GetTracksMatched(); - if (nTracks > 0 && matchedT && clus->GetTrackMatched() >= 0) { - for (Int_t im = 0; im < matchedT->GetSize(); im++) { - Int_t iESDtrack = matchedT->At(im); - if(iESDtrack < nTracks && iESDtrack > -1) - caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack))); - } - } - }//Pt and Fiducial cut passed. - }//PHOS cluster - }//cluster exists - }//esd cluster loop - - //Put references to selected clusters in array - for(Int_t iclus = nEMCAL; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){ - AliAODCaloCluster * clus = (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus); - fAODPHOS->Add(clus); - } - if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputPHOS() - aod entries %d\n", fAODPHOS->GetEntriesFast()); - -} - -//____________________________________________________________________________ -void AliCaloTrackESDReader::FillInputEMCALCells() { - //Return array with EMCAL cells in esd format - - fEMCALCells = (TNamed*) ((AliESDEvent*)fInputEvent)->GetEMCALCells(); - -} - -//____________________________________________________________________________ -void AliCaloTrackESDReader::FillInputPHOSCells() { - //Return array with PHOS cells in esd format - - fPHOSCells = (TNamed*) ((AliESDEvent*)fInputEvent)->GetPHOSCells(); - -} - +//void AliCaloTrackESDReader::FillInputCTS() { +// //Return array with CTS tracks +// if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputCTS()\n"); +// +// //TObjArray * fAODCTS = new TObjArray(); +// Int_t nTracks = fInputEvent->GetNumberOfTracks() ; +// Int_t naod = 0; +// Double_t pos[3]; +// Double_t p[3]; +// Double_t covTr[21]; +// Double_t pid[10]; +// Double_t bfield = fInputEvent->GetMagneticField(); +// +// Double_t timezero = 0; //TO BE FIXED +// +// //List of output tracks +// TClonesArray &tracks = *(fOutputEvent->GetTracks()); +// +// //To be replaced by call to AliEMCALGeoUtils when the class becomes available +// Double_t radius = 441.0; //[cm] EMCAL radius +13cm +// +// if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - org entries %d\n", nTracks); +// for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop +// AliESDtrack * track = (AliESDtrack*) fInputEvent->GetTrack(itrack) ; // retrieve track from esd +// +// //We want tracks fitted in the detectors: TPCrefit, ITSrefit ... check the set bits. +// if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; +// +// track->GetPxPyPz(p) ; +// TLorentzVector momentum(p[0],p[1],p[2],0); +// +// if(fCTSPtMin < momentum.Pt()){ +// +// if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue; +// +// if(fDebug > 3 && momentum.Pt() > 0.2) printf("AliCaloTrackESDReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", +// momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// +// track->GetXYZ(pos); +// track->GetCovarianceXYZPxPyPz(covTr); +// track->GetESDpid(pid); +// +// Float_t impactXY, impactZ; +// +// track->GetImpactParameters(impactXY,impactZ); +// +// if (impactXY<3) { +// // track inside the beam pipe +// //Put new aod object in file in AOD tracks array +// AliAODTrack *aodTrack = new(tracks[naod++]) +// //AliAODTrack *aodTrack = new((*(fOutputEvent->GetTracks()))[naod++]) +// AliAODTrack(track->GetID(), track->GetLabel(), p, kTRUE, pos, kFALSE,covTr, (Short_t)track->GetSign(), track->GetITSClusterMap(), +// pid, +// 0x0,//primary, +// kTRUE, // check if this is right +// kTRUE, // check if this is right +// AliAODTrack::kPrimary, +// 0); +// +// aodTrack->SetFlags(track->GetStatus()); +// aodTrack->ConvertAliPIDtoAODPID(); +// +// //fill needed AliAODPid information, including +// //Extrapolate track to EMCAL surface for AOD-level track-cluster matching +// AliAODPid *aodpid = new AliAODPid; +// aodpid->SetITSsignal(track->GetITSsignal()); +// aodpid->SetTPCsignal(track->GetTPCsignal()); +// //n TRD planes = 6 +// Int_t nslices = track->GetNumberOfTRDslices()*6; +// Double_t *trdslices = new Double_t[nslices]; +// for(Int_t iSl =0; iSl < track->GetNumberOfTRDslices(); iSl++) { +// for(Int_t iPl =0; iPl<6; iPl++) trdslices[iPl*track->GetNumberOfTRDslices()+iSl] = track->GetTRDslice(iPl,iSl); +// } +// aodpid->SetTRDsignal(track->GetNumberOfTRDslices()*6,trdslices); +// Double_t times[AliAODPid::kSPECIES]; track->GetIntegratedTimes(times); +// aodpid->SetIntegratedTimes(times); +// +// aodpid->SetTOFsignal(track->GetTOFsignal()-timezero); // to be fixed +// aodpid->SetHMPIDsignal(track->GetHMPIDsignal()); +// +// Double_t emcpos[3] = {0.,0.,0.}; +// Double_t emcmom[3] = {0.,0.,0.}; +// aodpid->SetEMCALPosition(emcpos); +// aodpid->SetEMCALMomentum(emcmom); +// +// AliExternalTrackParam *outerparam = (AliExternalTrackParam*)track->GetOuterParam(); +// if(!outerparam) continue; +// +// Bool_t okpos = outerparam->GetXYZAt(radius,bfield,emcpos); +// Bool_t okmom = outerparam->GetPxPyPzAt(radius,bfield,emcmom); +// if(!(okpos && okmom)) continue; +// +// aodpid->SetEMCALPosition(emcpos); +// aodpid->SetEMCALMomentum(emcmom); +// +// aodTrack->SetDetPID(aodpid); +// } +// else continue; // outside the beam pipe: orphan track +// }//Pt and Fiducial cut passed. +// }// track loop +// +// //Put references to selected tracks in array +// for(Int_t itrack = 0; itrack < (fOutputEvent->GetTracks())->GetEntriesFast(); itrack++){ +// AliAODTrack * track = (AliAODTrack*) (fOutputEvent->GetTracks())->At(itrack); +// fAODCTS->Add(track); +// } +// +// if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - aod entries %d\n", fAODCTS->GetEntriesFast()); +//} +// +////____________________________________________________________________________ +//void AliCaloTrackESDReader::FillInputEMCAL() { +// //Return array with EMCAL clusters in aod format +// if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputEMCAL()\n"); +// +// Float_t pos[3] ; +// Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); +// Int_t nTracks = fInputEvent->GetNumberOfTracks() ; +// +// //Loop to select clusters in fiducial cut and fill container with aodClusters +// for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++) { +// AliESDCaloCluster * clus = 0; +// if ( (clus = (AliESDCaloCluster *)fInputEvent->GetCaloCluster(iclus)) ) { +// if (clus->IsEMCAL()){ +// +// //Check if the cluster contains any bad channel and if close to calorimeter borders +// Int_t vindex = 0 ; +// if (fMixedEvent) +// vindex = fMixedEvent->EventIndexForCaloCluster(iclus); +// +// if( GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) +// continue; +// if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetEMCALCells(), fInputEvent, vindex)) +// continue; +// +// TLorentzVector momentum ; +// clus->GetMomentum(momentum, fVertex[vindex]); +// if(fDebug > 3 && momentum.E() > 0.1) +// printf("AliCaloTrackESDReader::FillInputEMCAL() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", +// momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// if(fEMCALPtMin < momentum.Pt()){ +// +// if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) +// continue; +// +// if(fDebug > 2 && momentum.E() > 0.1) +// printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", +// momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// +// clus->GetPosition(pos) ; +// Int_t id = clus->GetID(); +// +// Int_t nLabel = clus->GetNLabels(); +// Int_t *labels = clus->GetLabels(); +// +// Float_t energy = clus->E(); +// Char_t ttype= AliAODCluster::kEMCALClusterv1; +// +// //Recalibrate the cluster energy +// if(GetCaloUtils()->IsRecalibrationOn()) +// energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells()); +// +// +// //Put new aod object in file in AOD calo clusters array +// AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) +// AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL,ttype,0); +// +// // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", +// // pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], +// // pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]); +// caloCluster->SetPIDFromESD(clus->GetPID()); +// caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetDispersion(), +// clus->GetM20(), clus->GetM02(), +// clus->GetEmcCpvDistance(), clus->GetNExMax(), clus->GetTOF()) ; +// +// +// if(fDebug > 3 && momentum.E() > 0.1) +// printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, NexMax %d, TOF %e\n", +// clus->GetDistanceToBadChannel(), clus->GetDispersion(),clus->GetM20(), clus->GetM02(), +// clus->GetNExMax(), clus->GetTOF()); +// +// caloCluster->SetNCells(clus->GetNCells()); +// caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); +// caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); +// +// TArrayI* matchedT = clus->GetTracksMatched(); +// if (nTracks > 0 && matchedT && clus->GetTrackMatchedIndex() >= 0) { +// for (Int_t im = 0; im < matchedT->GetSize(); im++) { +// Int_t iESDtrack = matchedT->At(im); +// if(iESDtrack < nTracks && iESDtrack > -1) +// caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack))); +// } +// } +// //Fill reference array +// }//Pt and Fiducial cut passed. +// }//EMCAL cluster +// }//cluster exists +// }//esd cluster loop +// +// //Put references to selected clusters in array +// for(Int_t iclus = 0; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){ +// AliAODCaloCluster * clus = (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus); +// if (fMixedEvent) { +// clus->SetID(iclus) ; +// } +// fAODEMCAL->Add(clus); +// } +// if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputEMCAL() - aod entries %d\n", fAODEMCAL->GetEntriesFast()); +// +//} +// +// //____________________________________________________________________________ +//void AliCaloTrackESDReader::FillInputPHOS() { +// //Return array with PHOS clusters in aod format +// if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputPHOS()\n"); +// +// Int_t nPHOS = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); +// Float_t pos[3] ; +// Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); +// Int_t nTracks = fInputEvent->GetNumberOfTracks() ; +// +// //Loop to select clusters in fiducial cut and fill container with aodClusters +// for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++) { +// AliESDCaloCluster * clus = 0; +// if ( (clus = (AliESDCaloCluster *)fInputEvent->GetCaloCluster(iclus)) ) { +// if (clus->IsPHOS()){ +// //Check if the cluster contains any bad channel and if close to calorimeter borders +// Int_t vindex = 0 ; +// if (fMixedEvent) +// vindex = fMixedEvent->EventIndexForCaloCluster(iclus); +// if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) +// continue; +// if(!GetCaloUtils()->CheckCellFiducialRegion(clus, (AliESDCaloCells*)fInputEvent->GetPHOSCells(), fInputEvent, vindex)) +// continue; +// +// TLorentzVector momentum ; +// clus->GetMomentum(momentum, fVertex[vindex]); +// if(fDebug > 3 && momentum.E() > 0.1) +// printf("AliCaloTrackESDReader::FillInputPHOS() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", +// momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// if(fPHOSPtMin < momentum.Pt()){ +// +// if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) +// continue; +// +// if(fDebug > 2 && momentum.E() > 0.1) +// printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", +// momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// +// clus->GetPosition(pos) ; +// Int_t id = clus->GetID(); +// Int_t nLabel = clus->GetNLabels(); +// Int_t *labels = clus->GetLabels(); +// Float_t energy = clus->E(); +// +// //Phos cluster type +// const Double_t * pid = clus->GetPID(); +// // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", +// // pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], +// // pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]); +// Char_t ttype= AliAODCluster::kPHOSNeutral; +// Float_t wNeutral = pid[AliPID::kNeutron]+ pid[AliPID::kKaon0]+pid[AliPID::kPhoton]+pid[AliPID::kPi0]; +// Float_t wCharged = pid[AliPID::kMuon] + pid[AliPID::kElectron] + pid[AliPID::kEleCon]+ +// pid[AliPID::kProton]+pid[AliPID::kKaon]+pid[AliPID::kPion]; +// if( wCharged > wNeutral) ttype= AliAODCluster::kPHOSCharged; +// +// //Recalibrate the cluster energy +// if(GetCaloUtils()->IsRecalibrationOn()) +// energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetPHOSCells()); +// +// //Put new aod object in file in AOD calo clusters array +// AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) +// AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL, ttype, 0); +// +// +// caloCluster->SetPIDFromESD(pid); +// caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetDispersion(), +// clus->GetM20(), clus->GetM02(), +// clus->GetEmcCpvDistance(), clus->GetNExMax()) ; +// +// if(fDebug > 3 && momentum.E() > 0.2) +// printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, EmcCpvDist %3.3f, NexMax %d, TOF %e\n", +// clus->GetDistanceToBadChannel(), clus->GetDispersion(),clus->GetM20(), clus->GetM02(), +// clus->GetEmcCpvDistance(), clus->GetNExMax(), clus->GetTOF()); +// +// caloCluster->SetNCells(clus->GetNCells()); +// caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); +// caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); +// +// TArrayI* matchedT = clus->GetTracksMatched(); +// if (nTracks > 0 && matchedT && clus->GetTrackMatchedIndex() >= 0) { +// for (Int_t im = 0; im < matchedT->GetSize(); im++) { +// Int_t iESDtrack = matchedT->At(im); +// if(iESDtrack < nTracks && iESDtrack > -1) +// caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack))); +// } +// } +// }//Pt and Fiducial cut passed. +// }//PHOS cluster +// }//cluster exists +// }//esd cluster loop +// +// //Put references to selected clusters in array +// +// for(Int_t iclus = nPHOS; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){ +// AliAODCaloCluster * clus = (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus); +// if (fMixedEvent) { +// clus->SetID(iclus) ; +// } +// fAODPHOS->Add(clus); +// } +// if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputPHOS() - aod entries %d\n", fAODPHOS->GetEntriesFast()); +// +//} +// +// //____________________________________________________________________________ +//void AliCaloTrackESDReader::FillInputEMCALCells() { +// //Return array with EMCAL cells in esd format +// +// fEMCALCells = fInputEvent->GetEMCALCells(); +// +//} +// +////____________________________________________________________________________ +//void AliCaloTrackESDReader::FillInputPHOSCells() { +// //Return array with PHOS cells in esd format +// +// fPHOSCells = fInputEvent->GetPHOSCells(); +// +//} +// //____________________________________________________________________________ -void AliCaloTrackESDReader::GetVertex(Double_t v[3]) const { - //Return vertex position - - //((AliESDEvent*)fInputEvent)->GetVertex()->GetXYZ(v) ;//SPD - ((AliESDEvent*)fInputEvent)->GetPrimaryVertex()->GetXYZ(v); - -} +//void AliCaloTrackESDReader::GetVertex(Double_t v[3]) const { +// //Return vertex position +// +// //((AliESDEvent*)fInputEvent)->GetVertex()->GetXYZ(v) ;//SPD +// fInputEvent->GetPrimaryVertex()->GetXYZ(v); +// +//} //____________________________________________________________________________ Double_t AliCaloTrackESDReader::GetBField() const { //Return magnetic field - Double_t bfield = ((AliESDEvent*)fInputEvent)->GetMagneticField(); + Double_t bfield = fInputEvent->GetMagneticField(); return bfield; } @@ -423,9 +442,20 @@ Double_t AliCaloTrackESDReader::GetBField() const { void AliCaloTrackESDReader::SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) { // Connect the data pointers - if(strcmp(esd->GetName(),"AliESDEvent")){ - printf("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName()); - abort(); + Bool_t tesd = kFALSE ; + + if ( strcmp(esd->GetName(), "AliMixedEvent") == 0 ) { + AliMultiEventInputHandler* multiEH = dynamic_cast((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); + if (multiEH->GetFormat() == 0 ) { + tesd = kTRUE ; + } + } + if (strcmp(esd->GetName(),"AliESDEvent") == 0) { + tesd = kTRUE ; + } + + if(!tesd){ + AliFatal(Form("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName())); } SetInputEvent(esd); diff --git a/PWG4/PartCorrBase/AliCaloTrackESDReader.h b/PWG4/PartCorrBase/AliCaloTrackESDReader.h index 6bd29350e34..c903e630cc8 100755 --- a/PWG4/PartCorrBase/AliCaloTrackESDReader.h +++ b/PWG4/PartCorrBase/AliCaloTrackESDReader.h @@ -31,13 +31,13 @@ class AliCaloTrackESDReader : public AliCaloTrackReader { //AliCaloTrackESDReader & operator = (const AliCaloTrackESDReader & g) ;//cpy assignment virtual ~AliCaloTrackESDReader() {;} //virtual dtor - void FillInputCTS () ; - void FillInputEMCAL() ; - void FillInputPHOS () ; - void FillInputEMCALCells() ; - void FillInputPHOSCells() ; +// void FillInputCTS () ; +// void FillInputEMCAL() ; +// void FillInputPHOS () ; +// void FillInputEMCALCells() ; +// void FillInputPHOSCells() ; - void GetVertex(Double_t v[3]) const ; +// void GetVertex(Double_t v[3]) const ; Double_t GetBField() const; void SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) ; diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.cxx b/PWG4/PartCorrBase/AliCaloTrackReader.cxx index 0d1caae08f8..470a39a85f9 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackReader.cxx @@ -34,7 +34,11 @@ #include "AliMCEvent.h" #include "AliAODMCHeader.h" #include "AliGenPythiaEventHeader.h" +#include "AliVEvent.h" #include "AliAODEvent.h" +#include "AliVTrack.h" +#include "AliVParticle.h" +#include "AliMixedEvent.h" ClassImp(AliCaloTrackReader) @@ -55,7 +59,8 @@ ClassImp(AliCaloTrackReader) fAODPHOSNormalInputEntries(0), fTrackStatus(0), fReadStack(kFALSE), fReadAODMCParticles(kFALSE), fCleanOutputStdAOD(kFALSE), fDeltaAODFileName("deltaAODPartCorr.root"),fFiredTriggerClassName(""), - fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0) + fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0), + fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL), fWriteOutputStdAOD(kFALSE) { //Ctor @@ -185,6 +190,12 @@ AliCaloTrackReader::~AliCaloTrackReader() { fPHOSCells->Clear() ; delete fPHOSCells ; } + if (fMixedEvent) { + for (Int_t i = 0; i < fNMixedEvent; i++) { + delete [] fVertex[i] ; + } + } + delete [] fVertex ; // Pointers not owned, done by the analysis frame // if(fInputEvent) delete fInputEvent ; @@ -268,21 +279,24 @@ AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const { //____________________________________________________________________________ TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const { - //Return list of particles in AOD. Do it for the corresponding input event. - if(fDataType == kAOD){ - //Normal input AOD - if(input == 0) return (TClonesArray*)((AliAODEvent*)fInputEvent)->FindListObject("mcparticles"); - //Second input AOD - else if(input == 1 && fSecondInputAODEvent) return (TClonesArray*) fSecondInputAODEvent->FindListObject("mcparticles"); - else { - printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); - return 0x0; - } - } - else { - printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); - return 0x0; - } + //Return list of particles in AOD. Do it for the corresponding input event. + TClonesArray * rv = NULL ; + // if(fDataType == kAOD){ + //Normal input AOD + AliAODEvent * evt = NULL ; + if (evt) { + if(input == 0){ + evt = dynamic_cast (fInputEvent) ; + rv = (TClonesArray*)evt->FindListObject("mcparticles"); + } else if(input == 1 && fSecondInputAODEvent){ //Second input AOD + rv = (TClonesArray*) fSecondInputAODEvent->FindListObject("mcparticles"); + } else { + printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); + } + } else { + printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); + } + return rv ; } //____________________________________________________________________________ @@ -417,7 +431,8 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * curre if(fInputEvent->GetHeader()) eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType(); if( fFiredTriggerClassName !="" && !fAnaLED){ - if(eventType!=7)return kFALSE; //Only physics event, do not use for simulated events!!! + if(eventType!=7) + return kFALSE; //Only physics event, do not use for simulated events!!! if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n", GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName)); @@ -474,12 +489,26 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * curre } - if(fFillEMCALCells) FillInputEMCALCells(); - if(fFillPHOSCells) FillInputPHOSCells(); + + for (Int_t iev = 0; iev < fNMixedEvent; iev++) { + if (!fMixedEvent) { + GetVertex() ; + } + else + fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]); + } + + if(fFillEMCALCells) + FillInputEMCALCells(); + if(fFillPHOSCells) + FillInputPHOSCells(); - if(fFillCTS) FillInputCTS(); - if(fFillEMCAL) FillInputEMCAL(); - if(fFillPHOS) FillInputPHOS(); + if(fFillCTS) + FillInputCTS(); + if(fFillEMCAL) + FillInputEMCAL(); + if(fFillPHOS) + FillInputPHOS(); return kTRUE ; @@ -501,3 +530,325 @@ void AliCaloTrackReader::ResetLists() { } } + +//____________________________________________________________________________ +void AliCaloTrackReader::SetInputEvent(AliVEvent* const input) +{ + fInputEvent = input; + fMixedEvent = dynamic_cast(GetInputEvent()) ; + if (fMixedEvent) { + fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; + } + fVertex = new Double_t*[fNMixedEvent] ; + for (Int_t i = 0; i < fNMixedEvent; i++) { + fVertex[i] = new Double_t[3] ; + fVertex[i][0] = 0.0 ; + fVertex[i][1] = 0.0 ; + fVertex[i][2] = 0.0 ; + } +} + +//____________________________________________________________________________ +Double_t * AliCaloTrackReader::GetVertex() { + //Return vertex position + if (fMixedEvent) + return NULL ; + if(fInputEvent->GetPrimaryVertex()) + fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]); + else { + printf("AliCaloTrackReader::GetVertex() - No vertex available, InputEvent()->GetPrimaryVertex() = 0, return (0,0,0)\n"); + fVertex[0][0]=0.0; fVertex[0][1]=0.0; fVertex[0][2]=0.0; + } + return fVertex[0] ; +} + + //____________________________________________________________________________ +void AliCaloTrackReader::FillInputCTS() { + //Return array with Central Tracking System (CTS) tracks + if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS()\n"); + Int_t nTracks = fInputEvent->GetNumberOfTracks() ; + Int_t naod = 0; + Double_t p[3]; + for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop + AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd + + //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits + if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) + continue ; + + track->GetPxPyPz(p) ; + TLorentzVector momentum(p[0],p[1],p[2],0); + + if(fCTSPtMin < momentum.Pt()){ + + if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) + continue; + + if(fDebug > 2 && momentum.Pt() > 0.1) + printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + if (fMixedEvent) { + track->SetID(itrack); + } + if(fWriteOutputStdAOD){ + AliAODTrack * aodTrack = dynamic_cast (track) ; + if (aodTrack) { + AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*aodTrack); + fAODCTS->Add(newtrack); //Use AOD stored in output for references. + } else { + AliError("Can only write AOD tracks to output AOD !") ; + } + } + else { + fAODCTS->Add(track); + } + }//Pt and Fiducial cut passed. + }// track loop + + fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast(); + if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod entries %d\n", fAODCTSNormalInputEntries); + + // //If second input event available, add the clusters. + // if(fSecondInputAODTree && fSecondInputAODEvent){ + // nTracks = fSecondInputAODEvent->GetNumberOfTracks() ; + // if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - Add second input tracks, entries %d\n", nTracks) ; + // for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop + // AliAODTrack * track = ((AliAODEvent*)fSecondInputAODEvent)->GetTrack(itrack) ; // retrieve track from esd + // + // //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits + // if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; + // + // track->GetPxPyPz(p) ; + // TLorentzVector momentum(p[0],p[1],p[2],0); + // + // if(fCTSPtMin < momentum.Pt()){ + // + // if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue; + // + // if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + // momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + // + // if(fWriteOutputStdAOD){ + // AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track); + // fAODCTS->Add(newtrack); //Use AOD stored in output for references. + // } + // else fAODCTS->Add(track); + // + // }//Pt and Fiducial cut passed. + // }// track loop + // + // if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod normal entries %d, after second input %d\n", fAODCTSNormalInputEntries, fAODCTS->GetEntriesFast()); + // } //second input loop + // +} + + //____________________________________________________________________________ +void AliCaloTrackReader::FillInputEMCAL() { + //Return array with EMCAL clusters in aod format + if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputEMCAL()\n"); + + Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); + //Loop to select clusters in fiducial cut and fill container with aodClusters + Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); + for (Int_t iclus = 0; iclus < nclusters; iclus++) { + AliVCluster * clus = 0; + if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) { + if (clus->IsEMCAL()){ + + //Check if the cluster contains any bad channel and if close to calorimeter borders + Int_t vindex = 0 ; + if (fMixedEvent) + vindex = fMixedEvent->EventIndexForCaloCluster(iclus); + + if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) + continue; + if(!GetCaloUtils()->CheckCellFiducialRegion(clus, (AliVCaloCells*)fInputEvent->GetEMCALCells(), fInputEvent, vindex)) + continue; + + TLorentzVector momentum ; + + clus->GetMomentum(momentum, fVertex[vindex]); + + if(fEMCALPtMin < momentum.Pt()){ + + if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) + continue; + + if(fDebug > 2 && momentum.E() > 0.1) + printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + //Recalibrate the cluster energy + if(GetCaloUtils()->IsRecalibrationOn()) { + Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetEMCALCells()); + clus->SetE(energy); + } + + if (fMixedEvent) { + clus->SetID(iclus) ; + } + if(fWriteOutputStdAOD){ + AliAODCaloCluster * aodClus = dynamic_cast (clus) ; + if (aodClus) { + AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*aodClus); + fAODEMCAL->Add(newclus); + } else { + AliError("Can only write AOD clusters to output AOD !") ; + } + } else { + fAODEMCAL->Add(clus); + } + }//Pt and Fiducial cut passed. + }//EMCAL cluster + }// cluster exists + }// cluster loop + fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast(); + if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod entries %d\n", fAODEMCALNormalInputEntries); + + //If second input event available, add the clusters. + // if(fSecondInputAODTree && fSecondInputAODEvent){ + // GetSecondInputAODVertex(v); + // nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNumberOfCaloClusters(); + // if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Add second input clusters, entries %d\n", nclusters) ; + // for (Int_t iclus = 0; iclus < nclusters; iclus++) { + // AliAODCaloCluster * clus = 0; + // if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) { + // if (clus->IsEMCAL()){ + // TLorentzVector momentum ; + // clus->GetMomentum(momentum, v); + // + // if(fEMCALPtMin < momentum.Pt()){ + // + // if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue; + // + // if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + // momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + // if(fWriteOutputStdAOD){ + // AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); + // fAODEMCAL->Add(newclus); + // } + // else fAODEMCAL->Add(clus); + // }//Pt and Fiducial cut passed. + // }//EMCAL cluster + // }// cluster exists + // }// cluster loop + // + // if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod normal entries %d, after second input %d\n", fAODEMCALNormalInputEntries, fAODEMCAL->GetEntriesFast()); + // + // } //second input loop +} + + //____________________________________________________________________________ +void AliCaloTrackReader::FillInputPHOS() { + //Return array with PHOS clusters in aod format + if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputPHOS()\n"); + + //Get vertex for momentum calculation + + Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); + //Loop to select clusters in fiducial cut and fill container with aodClusters + Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); + for (Int_t iclus = 0; iclus < nclusters; iclus++) { + AliVCluster * clus = 0; + if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) { + if (clus->IsPHOS()){ + //Check if the cluster contains any bad channel and if close to calorimeter borders + Int_t vindex = 0 ; + if (fMixedEvent) + vindex = fMixedEvent->EventIndexForCaloCluster(iclus); + if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) + continue; + if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex)) + continue; + + TLorentzVector momentum ; + + clus->GetMomentum(momentum, fVertex[vindex]); + + if(fPHOSPtMin < momentum.Pt()){ + + if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) + continue; + + if(fDebug > 2 && momentum.E() > 0.1) + printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + //Recalibrate the cluster energy + if(GetCaloUtils()->IsRecalibrationOn()) { + Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells()); + clus->SetE(energy); + } + + if (fMixedEvent) { + clus->SetID(iclus) ; + } + + if(fWriteOutputStdAOD){ + AliAODCaloCluster * aodClus = dynamic_cast (clus) ; + if (aodClus) { + AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*aodClus); + fAODPHOS->Add(newclus); + } else { + AliError("Can only write AOD clusters to output AOD !") ; + } + } else { + fAODPHOS->Add(clus); + } + }//Pt and Fiducial cut passed. + }//PHOS cluster + }//cluster exists + }//esd cluster loop + + fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ; + if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod entries %d\n", fAODPHOSNormalInputEntries); + + //If second input event available, add the clusters. + // if(fSecondInputAODTree && fSecondInputAODEvent){ + // GetSecondInputAODVertex(v); + // nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNumberOfCaloClusters(); + // if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - Add second input clusters, entries %d\n", nclusters); + // for (Int_t iclus = 0; iclus < nclusters; iclus++) { + // AliAODCaloCluster * clus = 0; + // if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) { + // if (clus->IsPHOS()){ + // TLorentzVector momentum ; + // clus->GetMomentum(momentum, v); + // + // if(fPHOSPtMin < momentum.Pt()){ + // + // if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue; + // + // if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + // momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + // if(fWriteOutputStdAOD){ + // AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); + // fAODPHOS->Add(newclus); + // } + // else fAODPHOS->Add(clus); + // }//Pt and Fiducial cut passed. + // }//PHOS cluster + // }// cluster exists + // }// cluster loop + // if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod normal entries %d, after second input %d\n", fAODPHOSNormalInputEntries, fAODPHOS->GetEntriesFast()); + // } //second input loop + +} + + //____________________________________________________________________________ +void AliCaloTrackReader::FillInputEMCALCells() { + //Return array with EMCAL cells in aod format + + fEMCALCells = fInputEvent->GetEMCALCells(); + +} + + //____________________________________________________________________________ +void AliCaloTrackReader::FillInputPHOSCells() { + //Return array with PHOS cells in aod format + + fPHOSCells = fInputEvent->GetPHOSCells(); + +} + diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.h b/PWG4/PartCorrBase/AliCaloTrackReader.h index b9bda81f618..fc85a07eac9 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.h +++ b/PWG4/PartCorrBase/AliCaloTrackReader.h @@ -27,6 +27,8 @@ class AliGenEventHeader ; class AliVEvent; class AliAODEvent; class AliMCEvent; +class AliMixedEvent; +#include "AliVCaloCells.h" #include "AliFiducialCut.h" class AliAODMCHeader; #include "AliCalorimeterUtils.h" @@ -93,17 +95,17 @@ public: void SwitchOffPHOSCells() {fFillPHOSCells = kFALSE ; } virtual Bool_t FillInputEvent(const Int_t iEntry, const char *currentFileName) ; - virtual void FillInputCTS() {;} - virtual void FillInputEMCAL() {;} - virtual void FillInputPHOS() {;} - virtual void FillInputEMCALCells() {;} - virtual void FillInputPHOSCells() {;} + virtual void FillInputCTS() ; + virtual void FillInputEMCAL() ; + virtual void FillInputPHOS() ; + virtual void FillInputEMCALCells() ; + virtual void FillInputPHOSCells() ; virtual TObjArray* GetAODCTS() const {return fAODCTS ;} virtual TObjArray* GetAODEMCAL() const {return fAODEMCAL ;} virtual TObjArray* GetAODPHOS() const {return fAODPHOS ;} - virtual TNamed* GetEMCALCells() const {return fEMCALCells ;} - virtual TNamed* GetPHOSCells() const {return fPHOSCells ;} + virtual AliVCaloCells* GetEMCALCells() const { return fEMCALCells ;} + virtual AliVCaloCells* GetPHOSCells() const { return fPHOSCells ;} //Get MC informatio //Kinematics and galice.root available @@ -123,7 +125,8 @@ public: virtual void Init(); - virtual void SetInputEvent(AliVEvent* const input) {fInputEvent = input;} +// virtual void SetInputEvent(AliVEvent* const input) {fInputEvent = input;} + virtual void SetInputEvent(AliVEvent* const input) ; virtual void SetOutputEvent(AliAODEvent* const aod) {fOutputEvent = aod;} virtual void SetMC(AliMCEvent* const mc) {fMC = mc;} @@ -186,6 +189,9 @@ public: AliCalorimeterUtils * GetCaloUtils() const {return fCaloUtils ; } void SetCaloUtils(AliCalorimeterUtils * caloutils) { fCaloUtils = caloutils ; } + + Double_t * GetVertex() ; + protected: Int_t fEventNumber; // Event number @@ -205,8 +211,8 @@ public: TObjArray * fAODCTS ; //! temporal referenced array with tracks TObjArray * fAODEMCAL ; //! temporal referenced array with EMCAL CaloClusters TObjArray * fAODPHOS ; //! temporal referenced array with PHOS CaloClusters - TNamed * fEMCALCells ; //! temporal array with EMCAL CaloCells, ESD or AOD - TNamed * fPHOSCells ; //! temporal array with PHOS CaloCells, ESD or AOD + AliVCaloCells *fEMCALCells ; //! temporal array with EMCAL CaloCells, ESD or AOD + AliVCaloCells *fPHOSCells ; //! temporal array with PHOS CaloCells, ESD or AOD AliVEvent * fInputEvent; //! pointer to esd or aod input AliAODEvent * fOutputEvent; //! pointer to aod output @@ -229,9 +235,9 @@ public: ULong_t fTrackStatus ; // Track selection bit, select tracks refitted in TPC, ITS ... Bool_t fReadStack ; // Access kine information from stack - Bool_t fReadAODMCParticles ; // Access kine information from filtered AOD MC particles + Bool_t fReadAODMCParticles ; // Access kine information from filtered AOD MC particles - Bool_t fCleanOutputStdAOD; // clean the written standard tracks and caloclusters in output AOD + Bool_t fCleanOutputStdAOD; // clean the written standard tracks and caloclusters in output AOD TString fDeltaAODFileName ; // Delta AOD file name TString fFiredTriggerClassName ; // Name of trigger event type used to do the analysis @@ -240,8 +246,15 @@ public: TString fTaskName; // Name of task that executes the analysis AliCalorimeterUtils * fCaloUtils ; // Pointer to CalorimeterUtils + + AliMixedEvent* fMixedEvent ; //! mixed event object. This class is not the owner + Int_t fNMixedEvent ; //! number of events in mixed event buffer + Double_t ** fVertex ; //! vertex array 3 dim for each mixed event buffer + + Bool_t fWriteOutputStdAOD; // Write selected standard tracks and caloclusters in output AOD + - ClassDef(AliCaloTrackReader,15) + ClassDef(AliCaloTrackReader,16) } ; diff --git a/PWG4/PartCorrBase/AliCalorimeterUtils.cxx b/PWG4/PartCorrBase/AliCalorimeterUtils.cxx index 0a136615aea..511874ffb8d 100755 --- a/PWG4/PartCorrBase/AliCalorimeterUtils.cxx +++ b/PWG4/PartCorrBase/AliCalorimeterUtils.cxx @@ -28,13 +28,11 @@ //---- ANALYSIS system ---- #include "AliCalorimeterUtils.h" -#include "AliAODEvent.h" -#include "AliESDEvent.h" +#include "AliVEvent.h" #include "AliAODPWG4Particle.h" -#include "AliAODCaloCluster.h" -#include "AliESDCaloCluster.h" -#include "AliAODCaloCells.h" -#include "AliESDCaloCells.h" +#include "AliVCluster.h" +#include "AliVCaloCells.h" +#include "AliMixedEvent.h" ClassImp(AliCalorimeterUtils) @@ -43,7 +41,7 @@ ClassImp(AliCalorimeterUtils) //____________________________________________________________________________ AliCalorimeterUtils::AliCalorimeterUtils() : TObject(), fDebug(0), - fEMCALGeoName("EMCAL_COMPLETE"),fPHOSGeoName("PHOSgeo"), + fEMCALGeoName("EMCAL_FIRSTYEAR"),fPHOSGeoName("PHOSgeo"), fEMCALGeo(0x0), fPHOSGeo(0x0), fEMCALGeoMatrixSet(kFALSE), fPHOSGeoMatrixSet(kFALSE), fRemoveBadChannels(kFALSE), @@ -108,25 +106,61 @@ AliCalorimeterUtils::~AliCalorimeterUtils() { } //_______________________________________________________________ -Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster, AliAODCaloCells* cells) const { +Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev) const { + // Given the list of AbsId of the cluster, get the maximum cell and // check if there are fNCellsFromBorder from the calorimeter border - //If the distance to the border is 0 or negative just exit accept all clusters - if(cells->GetType()==AliAODCaloCells::kEMCAL && fNCellsFromEMCALBorder <= 0 ) return kTRUE; - if(cells->GetType()==AliAODCaloCells::kPHOS && fNCellsFromPHOSBorder <= 0 ) return kTRUE; + //If the distance to the border is 0 or negative just exit accept all clusters + if(cells->GetType()==AliVCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE; + if(cells->GetType()==AliVCaloCells::kPHOSCell && fNCellsFromPHOSBorder <= 0 ) return kTRUE; - //Find cells with maximum amplitude - Int_t absIdMax = -1; + Int_t absIdMax = -1; Float_t ampMax = -1; - for(Int_t i = 0; i < cluster->GetNCells() ; i++){ - Int_t absId = cluster->GetCellAbsId(i) ; - Float_t amp = cells->GetCellAmplitude(absId); - if(amp > ampMax){ - ampMax = amp; - absIdMax = absId; - } - } + + AliMixedEvent * mixEvent = dynamic_cast (event); + Int_t nMixedEvents = 0 ; + Int_t * cellsCumul = NULL ; + Int_t numberOfCells = 0 ; + if (mixEvent){ + nMixedEvents = mixEvent->GetNumberOfEvents() ; + if (cells->GetType()==AliVCaloCells::kEMCALCell) { + cellsCumul = mixEvent->GetEMCALCellsCumul() ; + numberOfCells = mixEvent->GetNumberOfEMCALCells() ; + } + + else if (cells->GetType()==AliVCaloCells::kPHOSCell) { + cellsCumul = mixEvent->GetPHOSCellsCumul() ; + numberOfCells = mixEvent->GetNumberOfPHOSCells() ; + } + Int_t startCell = cellsCumul[iev] ; + Int_t endCell = (iev+1 < nMixedEvents)?cellsCumul[iev+1]:numberOfCells; + //Find cells with maximum amplitude + 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) ; + if (absId == cellNumber) { + if(amp > ampMax){ + ampMax = amp; + absIdMax = absId; + } + } + } + } + } else { + for(Int_t i = 0; i < cluster->GetNCells() ; i++){ + Int_t absId = cluster->GetCellAbsId(i) ; + Float_t amp = cells->GetCellAmplitude(absId); + if(amp > ampMax){ + ampMax = amp; + absIdMax = absId; + } + } + } if(fDebug > 1) printf("AliCalorimeterUtils::CheckCellFiducialRegion(AOD) - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", @@ -138,7 +172,7 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster, Bool_t okrow = kFALSE; Bool_t okcol = kFALSE; - if(cells->GetType()==AliAODCaloCells::kEMCAL){ + if(cells->GetType()==AliVCaloCells::kEMCALCell){ Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); @@ -172,7 +206,7 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster, else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow); } }//EMCAL - else if(cells->GetType()==AliAODCaloCells::kPHOS){ + else if(cells->GetType()==AliVCaloCells::kPHOSCell){ Int_t relId[4]; Int_t irow = -1, icol = -1; fPHOSGeo->AbsToRelNumbering(absIdMax,relId); @@ -196,92 +230,92 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster, } //_______________________________________________________________ -Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const { - // Given the list of AbsId of the cluster, get the maximum cell and - // check if there are fNCellsFromBorder from the calorimeter border - - //If the distance to the border is 0 or negative just exit accept all clusters - if(cells->GetType()==AliESDCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE; - if(cells->GetType()==AliESDCaloCells::kPHOSCell && fNCellsFromPHOSBorder <= 0 ) return kTRUE; - - //Find cell with maximum amplitude - Int_t absIdMax = -1; - Float_t ampMax = -1; - for(Int_t i = 0; i < cluster->GetNCells() ; i++){ - Int_t absId = cluster->GetCellAbsId(i) ; - Float_t amp = cells->GetCellAmplitude(absId); - if(amp > ampMax){ - ampMax = amp; - absIdMax = absId; - } - } - - if(fDebug > 1) - printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", - absIdMax, ampMax, cluster->E()); - if(absIdMax==-1) return kFALSE; - - //Check if the cell is close to the borders: - Bool_t okrow = kFALSE; - Bool_t okcol = kFALSE; - - if(cells->GetType()==AliESDCaloCells::kEMCALCell){ - - Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; - fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); - fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta); - - //Check rows/phi - if(iSM < 10){ - if(iphi >= fNCellsFromEMCALBorder && iphi < 24-fNCellsFromEMCALBorder) okrow =kTRUE; - } - else{ - if(iphi >= fNCellsFromEMCALBorder && iphi < 12-fNCellsFromEMCALBorder) okrow =kTRUE; - } - - //Check collumns/eta - if(!fNoEMCALBorderAtEta0){ - if(ieta > fNCellsFromEMCALBorder && ieta < 48-fNCellsFromEMCALBorder) okcol =kTRUE; - } - else{ - if(iSM%2==0){ - if(ieta >= fNCellsFromEMCALBorder) okcol = kTRUE; - } - else { - if(ieta < 48-fNCellsFromEMCALBorder) okcol = kTRUE; - } - }//eta 0 not checked - if(fDebug > 1) - { - printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ?", - fNCellsFromEMCALBorder, ieta, iphi, iSM); - if (okcol && okrow ) printf(" YES \n"); - else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow); - } - }//EMCAL - else if(cells->GetType()==AliESDCaloCells::kPHOSCell){ - Int_t relId[4]; - Int_t irow = -1, icol = -1; - fPHOSGeo->AbsToRelNumbering(absIdMax,relId); - irow = relId[2]; - icol = relId[3]; - //imod = relId[0]-1; - if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE; - if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE; - if(fDebug > 1) - { - printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - PHOS Cluster in %d cells fiducial volume: icol %d, irow %d, Module %d ?", - fNCellsFromPHOSBorder, icol, irow,relId[0]-1); - if (okcol && okrow ) printf(" YES \n"); - else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow); - } - }//PHOS - - if (okcol && okrow) return kTRUE; - else return kFALSE; - -} - +//Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const { +// // Given the list of AbsId of the cluster, get the maximum cell and +// // check if there are fNCellsFromBorder from the calorimeter border +// +// //If the distance to the border is 0 or negative just exit accept all clusters +// if(cells->GetType()==AliVCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE; +// if(cells->GetType()==AliVCaloCells::kPHOSCell && fNCellsFromPHOSBorder <= 0 ) return kTRUE; +// +// //Find cell with maximum amplitude +// Int_t absIdMax = -1; +// Float_t ampMax = -1; +// for(Int_t i = 0; i < cluster->GetNCells() ; i++){ +// Int_t absId = cluster->GetCellAbsId(i) ; +// Float_t amp = cells->GetCellAmplitude(absId); +// if(amp > ampMax){ +// ampMax = amp; +// absIdMax = absId; +// } +// } +// +// if(fDebug > 1) +// printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", +// absIdMax, ampMax, cluster->E()); +// if(absIdMax==-1) return kFALSE; +// +// //Check if the cell is close to the borders: +// Bool_t okrow = kFALSE; +// Bool_t okcol = kFALSE; +// +// if(cells->GetType()==AliESDCaloCells::kEMCALCell){ +// +// Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; +// fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); +// fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta); +// +// //Check rows/phi +// if(iSM < 10){ +// if(iphi >= fNCellsFromEMCALBorder && iphi < 24-fNCellsFromEMCALBorder) okrow =kTRUE; +// } +// else{ +// if(iphi >= fNCellsFromEMCALBorder && iphi < 12-fNCellsFromEMCALBorder) okrow =kTRUE; +// } +// +// //Check collumns/eta +// if(!fNoEMCALBorderAtEta0){ +// if(ieta > fNCellsFromEMCALBorder && ieta < 48-fNCellsFromEMCALBorder) okcol =kTRUE; +// } +// else{ +// if(iSM%2==0){ +// if(ieta >= fNCellsFromEMCALBorder) okcol = kTRUE; +// } +// else { +// if(ieta < 48-fNCellsFromEMCALBorder) okcol = kTRUE; +// } +// }//eta 0 not checked +// if(fDebug > 1) +// { +// printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ?", +// fNCellsFromEMCALBorder, ieta, iphi, iSM); +// if (okcol && okrow ) printf(" YES \n"); +// else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow); +// } +// }//EMCAL +// else if(cells->GetType()==AliVCaloCells::kPHOSCell){ +// Int_t relId[4]; +// Int_t irow = -1, icol = -1; +// fPHOSGeo->AbsToRelNumbering(absIdMax,relId); +// irow = relId[2]; +// icol = relId[3]; +// //imod = relId[0]-1; +// if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE; +// if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE; +// if(fDebug > 1) +// { +// printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - PHOS Cluster in %d cells fiducial volume: icol %d, irow %d, Module %d ?", +// fNCellsFromPHOSBorder, icol, irow,relId[0]-1); +// if (okcol && okrow ) printf(" YES \n"); +// else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow); +// } +// }//PHOS +// +// if (okcol && okrow) return kTRUE; +// else return kFALSE; +// +//} +// //_________________________________________________________________________________________________________ Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells){ @@ -337,21 +371,15 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEv return fEMCALGeo->GetSuperModuleNumber(absId) ; }//EMCAL else if(particle->GetDetector()=="PHOS"){ - if(!strcmp(inputEvent->GetName(),"AliESDEvent")) { - AliESDCaloCluster *cluster = ((AliESDEvent*)inputEvent)->GetCaloCluster(particle->GetCaloLabel(0)); - return GetModuleNumber(cluster); - }//ESDs - else{ - AliAODCaloCluster *cluster = ((AliAODEvent*)inputEvent)->GetCaloCluster(particle->GetCaloLabel(0)); - return GetModuleNumber(cluster); - }//AODs + AliVCluster *cluster = inputEvent->GetCaloCluster(particle->GetCaloLabel(0)); + return GetModuleNumber(cluster); }//PHOS return -1; } //____________________________________________________________________________________________________________________________________________________ -Int_t AliCalorimeterUtils::GetModuleNumber(AliAODCaloCluster * cluster) const +Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const { //Get the EMCAL/PHOS module number that corresponds to this cluster, input are AODs TLorentzVector lv; @@ -360,14 +388,14 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODCaloCluster * cluster) const Float_t phi = lv.Phi(); if(phi < 0) phi+=TMath::TwoPi(); Int_t absId = -1; - if(cluster->IsEMCALCluster()){ + if(cluster->IsEMCAL()){ fEMCALGeo->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId); if(fDebug > 2) printf("AliCalorimeterUtils::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n", lv.Eta(), phi*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId)); return fEMCALGeo->GetSuperModuleNumber(absId) ; }//EMCAL - else if(cluster->IsPHOSCluster()) { + else if(cluster->IsPHOS()) { Int_t relId[4]; if ( cluster->GetNCells() > 0) { absId = cluster->GetCellAbsId(0); @@ -389,46 +417,6 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODCaloCluster * cluster) const return -1; } -//____________________________________________________________________________________________________________________________________________________ -Int_t AliCalorimeterUtils::GetModuleNumber(AliESDCaloCluster * cluster) const -{ - //Get the EMCAL/PHOS module number that corresponds to this cluster, input are ESDs - TLorentzVector lv; - Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex. - cluster->GetMomentum(lv,v); - Float_t phi = lv.Phi(); - if(phi < 0) phi+=TMath::TwoPi(); - Int_t absId = -1; - if(cluster->IsEMCAL()){ - fEMCALGeo->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId); - if(fDebug > 2) - printf("AliCalorimeterUtils::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n", - lv.Eta(), phi*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId)); - return fEMCALGeo->GetSuperModuleNumber(absId) ; - }//EMCAL - else if(cluster->IsPHOS()){ - Int_t relId[4]; - if ( cluster->GetNCells() > 0) { - absId = cluster->GetCellAbsId(0); - if(fDebug > 2) - printf("AliCalorimeterUtils::GetModuleNumber(ESD) - PHOS: cluster eta %f, phi %f, e %f, absId %d\n", - lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId); - } - else return -1; - - if ( absId >= 0) { - fPHOSGeo->AbsToRelNumbering(absId,relId); - if(fDebug > 2) - printf("AliCalorimeterUtils::GetModuleNumber(ESD) - PHOS: Module %d\n",relId[0]-1); - return relId[0]-1; - } - else return -1; - }//PHOS - - return -1; -} - - //_____________________________________________________________________________________________________________ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t & iRCU) const { @@ -489,7 +477,7 @@ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(const Int_t absId, const T void AliCalorimeterUtils::InitParameters() { //Initialize the parameters of the analysis. - fEMCALGeoName = "EMCAL_COMPLETE"; + fEMCALGeoName = "EMCAL_FIRSTYEAR"; fPHOSGeoName = "PHOSgeo"; if(gGeoManager) {// geoManager was set @@ -649,7 +637,7 @@ void AliCalorimeterUtils::Print(const Option_t * opt) const } //________________________________________________________________ -Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliESDCaloCluster * cluster, AliESDCaloCells * cells){ +Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliVCluster * cluster, AliVCaloCells * cells){ // Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that compose the cluster. // ESD case @@ -688,55 +676,8 @@ Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliESDCaloCluster * cluste printf("AliCalorimeterUtils::RecalibrateClusterEnergy(ESD) - Energy before %f, after %f\n",cluster->E(),energy); return energy; - } -//________________________________________________________________ -Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliAODCaloCluster * cluster, AliAODCaloCells * cells){ - // Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that compose the cluster. - // AOD case - - if(!cells) { - printf("AliCalorimeterUtils::RecalibrateClusterEnergy(AOD) - Cells pointer does not exist, stop!"); - abort(); - } - - //Get the cluster number of cells and list of absId, check what kind of cluster do we have. - UShort_t * index = cluster->GetCellsAbsId() ; - Double_t * fraction = cluster->GetCellsAmplitudeFraction() ; - Int_t ncells = cluster->GetNCells(); - TString calo = "EMCAL"; - if(cluster->IsPHOSCluster()) calo = "PHOS"; - - //Initialize some used variables - Float_t energy = 0; - Int_t absId = -1; - Int_t icol = -1, irow = -1, iRCU = -1, module=1; - Float_t factor = 1, frac = 0; - - //Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy - for(Int_t icell = 0; icell < ncells; icell++){ - absId = index[icell]; - frac = fraction[icell]; - if(frac < 1e-3) frac = 1; //in case of EMCAL, this is set as 0, not used. - module = GetModuleNumberCellIndexes(absId,calo,icol,irow,iRCU); - if(cluster->IsPHOSCluster()) factor = GetPHOSChannelRecalibrationFactor (module,icol,irow); - else factor = GetEMCALChannelRecalibrationFactor(module,icol,irow); - if(fDebug>2) - printf("AliCalorimeterUtils::RecalibrateClusterEnergy(ESD) - recalibrate cell: %s, module %d, col %d, row %d, cell fraction %f,recalibration factor %f, cell energy %f\n", - calo.Data(),module,icol,irow,frac,factor,cells->GetCellAmplitude(absId)); - - energy += cells->GetCellAmplitude(absId)*factor*frac; - } - - if(fDebug>1) - printf("AliCalorimeterUtils::RecalibrateClusterEnergy(ESD) - Energy before %f, after %f\n",cluster->E(),energy); - - return energy; - -} - - //________________________________________________________________ void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEvent) { @@ -748,9 +689,9 @@ void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEven printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load EMCAL misalignment matrices. \n"); if(!strcmp(inputEvent->GetName(),"AliESDEvent")) { for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ - if(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod)) { + if(inputEvent->GetEMCALMatrix(mod)) { //printf("EMCAL: mod %d, matrix %p\n",mod, ((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod)); - fEMCALGeo->SetMisalMatrix(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod),mod) ; + fEMCALGeo->SetMisalMatrix(inputEvent->GetEMCALMatrix(mod),mod) ; fEMCALGeoMatrixSet = kTRUE;//At least one, so good } }// loop over super modules @@ -767,9 +708,9 @@ void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEven printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load PHOS misalignment matrices. \n"); if(!strcmp(inputEvent->GetName(),"AliESDEvent")) { for(Int_t mod=0; mod < 5; mod++){ - if(((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod)) { + if(inputEvent->GetPHOSMatrix(mod)) { //printf("PHOS: mod %d, matrix %p\n",mod, ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod)); - fPHOSGeo->SetMisalMatrix(((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod),mod) ; + fPHOSGeo->SetMisalMatrix(inputEvent->GetPHOSMatrix(mod),mod) ; fPHOSGeoMatrixSet = kTRUE; //At least one so good } }// loop over modules diff --git a/PWG4/PartCorrBase/AliCalorimeterUtils.h b/PWG4/PartCorrBase/AliCalorimeterUtils.h index 8bef611f962..afb3aaa2f71 100755 --- a/PWG4/PartCorrBase/AliCalorimeterUtils.h +++ b/PWG4/PartCorrBase/AliCalorimeterUtils.h @@ -22,10 +22,8 @@ class TArrayF; //--- ANALYSIS system --- class AliVEvent; class AliAODPWG4Particle; -class AliAODCaloCluster; -class AliAODCaloCells; -class AliESDCaloCluster; -class AliESDCaloCells; +class AliVCluster; +class AliVCaloCells; #include "AliPHOSGeoUtils.h" #include "AliEMCALGeoUtils.h" @@ -97,14 +95,14 @@ class AliCalorimeterUtils : public TObject { //Calorimeter indexes information Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const; - Int_t GetModuleNumber(AliAODCaloCluster * cluster) const; - Int_t GetModuleNumber(AliESDCaloCluster * cluster) const; + Int_t GetModuleNumber(AliVCluster * cluster) const; + // Int_t GetModuleNumber(AliESDCaloCluster * cluster) const; Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ; //Modules fiducial region - Bool_t CheckCellFiducialRegion(AliAODCaloCluster* cluster, AliAODCaloCells* cells) const ; - Bool_t CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const ; + Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ; + // Bool_t CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const ; void SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; } Int_t GetNumberOfCellsFromEMCALBorder() const {return fNCellsFromEMCALBorder; } @@ -147,8 +145,8 @@ class AliCalorimeterUtils : public TObject { void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;} void SetPHOSChannelRecalibrationFactors (TObjArray *map) {fPHOSRecalibrationFactors = map;} - Float_t RecalibrateClusterEnergy(AliESDCaloCluster* cluster, AliESDCaloCells * cells); - Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells); + Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells); + //Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells); private: diff --git a/PWG4/PartCorrDep/AliAnaBtag.cxx b/PWG4/PartCorrDep/AliAnaBtag.cxx index acb04dadefb..98515a1819e 100644 --- a/PWG4/PartCorrDep/AliAnaBtag.cxx +++ b/PWG4/PartCorrDep/AliAnaBtag.cxx @@ -305,7 +305,7 @@ void AliAnaBtag::MakeAnalysisFillAOD() if (clus->GetM02() < 0.06 ) continue; - Double_t x[3]; + Float_t x[3]; clus->GetPosition(x); TVector3 cluspos(x[0],x[1],x[2]); Double_t deta = teta - cluspos.Eta(); diff --git a/PWG4/PartCorrDep/AliAnaCaloTrigger.cxx b/PWG4/PartCorrDep/AliAnaCaloTrigger.cxx index 3ed46c59dc6..407ec8f3225 100755 --- a/PWG4/PartCorrDep/AliAnaCaloTrigger.cxx +++ b/PWG4/PartCorrDep/AliAnaCaloTrigger.cxx @@ -205,7 +205,7 @@ void AliAnaCaloTrigger::UserExec(Option_t *) labelmax = cluster->GetLabel(); } - Double_t * pid = cluster->GetPid() ; + const Double_t * pid = cluster->GetPID() ; if(pid[AliPID::kPhoton] > 0.9) { if ( cluEnergy > phEnMax) { diff --git a/PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx b/PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx index 8df3cf5ae98..c3f7311d879 100755 --- a/PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx +++ b/PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx @@ -14,16 +14,16 @@ **************************************************************************/ /* $Id: $ */ -//_________________________________________________________________________ -// Class to check results from simulations or reconstructed real data. -// Fill few histograms and do some checking plots -// -//-- Author: Gustavo Conesa (INFN-LNF) -//_________________________________________________________________________ + //_________________________________________________________________________ + // Class to check results from simulations or reconstructed real data. + // Fill few histograms and do some checking plots + // + //-- Author: Gustavo Conesa (INFN-LNF) + //_________________________________________________________________________ -// --- ROOT system --- -//#include "Riostream.h" + // --- ROOT system --- + //#include "Riostream.h" #include "TObjArray.h" #include "TParticle.h" #include "TDatabasePDG.h" @@ -36,184 +36,181 @@ #include "TStyle.h" #include -//---- AliRoot system ---- + //---- AliRoot system ---- #include "AliAnaCalorimeterQA.h" #include "AliCaloTrackReader.h" #include "AliStack.h" -#include "AliAODCaloCells.h" -#include "AliESDCaloCells.h" -#include "AliAODCaloCluster.h" +#include "AliVCaloCells.h" #include "AliFiducialCut.h" -#include "AliESDtrack.h" -#include "AliAODTrack.h" -#include "AliESDCaloCluster.h" -#include "AliESDEvent.h" -#include "AliAODEvent.h" +#include "AliVTrack.h" +#include "AliVCluster.h" +#include "AliVEvent.h" #include "AliVEventHandler.h" #include "AliAnalysisManager.h" #include "AliAODMCParticle.h" #include "AliMCAnalysisUtils.h" #include "AliAODPid.h" +#include "AliExternalTrackParam.h" ClassImp(AliAnaCalorimeterQA) - -//____________________________________________________________________________ - AliAnaCalorimeterQA::AliAnaCalorimeterQA() : - AliAnaPartCorrBaseClass(), fCalorimeter(""), fStyleMacro(""), - fMakePlots(kFALSE), fCorrelateCalos(kFALSE), fNModules(12), fNRCU(2), - fTimeCutMin(-1), fTimeCutMax(9999999), - fHistoPOverEBins(100), fHistoPOverEMax(100.), fHistoPOverEMin(0.), - fHistodEdxBins(100), fHistodEdxMax(100.), fHistodEdxMin(0.), - fHistodRBins(100), fHistodRMax(100.), fHistodRMin(0.), - fHistoTimeBins(100), fHistoTimeMax(100.), fHistoTimeMin(0.), - fHistoNBins(100), fHistoNMax(100), fHistoNMin(0), - fHistoRatioBins(100), fHistoRatioMax(100.), fHistoRatioMin(0.), - fHistoVertexDistBins(100), fHistoVertexDistMax(100.), fHistoVertexDistMin(0.), - fHistoRBins(100), fHistoRMax(1000), fHistoRMin(-1000), - fHistoXBins(100), fHistoXMax(1000), fHistoXMin(-1000), - fHistoYBins(100), fHistoYMax(1000), fHistoYMin(-1000), - fHistoZBins(100), fHistoZMax(1000), fHistoZMin(-1000), - fHistoSSBins(40), fHistoSSMax(10), fHistoSSMin(0), - fhE(0),fhPt(0),fhPhi(0),fhEta(0), fhEtaPhiE(0), - fhECharged(0),fhPtCharged(0),fhPhiCharged(0),fhEtaCharged(0), fhEtaPhiECharged(0), - //fhEChargedNoOut(0),fhPtChargedNoOut(0),fhPhiChargedNoOut(0),fhEtaChargedNoOut(0), fhEtaPhiChargedNoOut(0), - fhDeltaE(0), fhDeltaPt(0),fhDeltaPhi(0),fhDeltaEta(0), fhRatioE(0), fhRatioPt(0),fhRatioPhi(0),fhRatioEta(0), - fh2E(0),fh2Pt(0),fh2Phi(0),fh2Eta(0), - fhLambda(0), fhDispersion(0), - fhIM(0), fhIMCellCut(0),fhAsym(0), - fhNCellsPerCluster(0),fhNCellsPerClusterMIP(0), fhNCellsPerClusterMIPCharged(0), fhNClusters(0), - fhClusterTimeEnergy(0),fhCellTimeSpreadRespectToCellMax(0),fhCellIdCellLargeTimeSpread(0), - fhRNCells(0),fhXNCells(0),fhYNCells(0),fhZNCells(0), - fhRE(0), fhXE(0), fhYE(0), fhZE(0), fhXYZ(0), - fhRCellE(0), fhXCellE(0), fhYCellE(0), fhZCellE(0),fhXYZCell(0), - fhDeltaCellClusterRNCells(0),fhDeltaCellClusterXNCells(0),fhDeltaCellClusterYNCells(0),fhDeltaCellClusterZNCells(0), - fhDeltaCellClusterRE(0), fhDeltaCellClusterXE(0), fhDeltaCellClusterYE(0), fhDeltaCellClusterZE(0), - fhNCells(0), fhAmplitude(0), fhAmpId(0), fhEtaPhiAmp(0), - fhTime(0), fhTimeId(0), fhTimeAmp(0), //fhT0Time(0), fhT0TimeId(0), fhT0TimeAmp(0), - fhCaloCorrNClusters(0), fhCaloCorrEClusters(0), fhCaloCorrNCells(0), fhCaloCorrECells(0), - fhEMod(0), fhNClustersMod(0), fhNCellsPerClusterMod(0), fhNCellsMod(0), - fhGridCellsMod(0), fhGridCellsEMod(0), fhGridCellsTimeMod(0), - fhAmplitudeMod(0), fhAmplitudeModFraction(0),fhTimeAmpPerRCU(0), //fhT0TimeAmpPerRCU(0), - //fhTimeCorrRCU(0), - fhIMMod(0), fhIMCellCutMod(0), - fhGenGamPt(0),fhGenGamEta(0),fhGenGamPhi(0),fhGenPi0Pt(0),fhGenPi0Eta(0),fhGenPi0Phi(0), - fhGenEtaPt(0),fhGenEtaEta(0),fhGenEtaPhi(0),fhGenOmegaPt(0),fhGenOmegaEta(0),fhGenOmegaPhi(0), - fhGenElePt(0),fhGenEleEta(0),fhGenElePhi(0), fhEMVxyz(0), fhEMR(0), fhHaVxyz(0), fhHaR(0), - fhGamE(0),fhGamPt(0),fhGamPhi(0),fhGamEta(0), - fhGamDeltaE(0), fhGamDeltaPt(0),fhGamDeltaPhi(0),fhGamDeltaEta(0), - fhGamRatioE(0), fhGamRatioPt(0),fhGamRatioPhi(0),fhGamRatioEta(0), - fhEleE(0),fhElePt(0),fhElePhi(0),fhEleEta(0), - fhPi0E(0),fhPi0Pt(0),fhPi0Phi(0),fhPi0Eta(0), - fhNeHadE(0),fhNeHadPt(0),fhNeHadPhi(0),fhNeHadEta(0), - fhChHadE(0),fhChHadPt(0),fhChHadPhi(0),fhChHadEta(0), - fhGamECharged(0),fhGamPtCharged(0),fhGamPhiCharged(0),fhGamEtaCharged(0), - fhEleECharged(0),fhElePtCharged(0),fhElePhiCharged(0),fhEleEtaCharged(0), - fhPi0ECharged(0),fhPi0PtCharged(0),fhPi0PhiCharged(0),fhPi0EtaCharged(0), - fhNeHadECharged(0),fhNeHadPtCharged(0),fhNeHadPhiCharged(0),fhNeHadEtaCharged(0), - fhChHadECharged(0),fhChHadPtCharged(0),fhChHadPhiCharged(0),fhChHadEtaCharged(0), - fhGenGamAccE(0),fhGenGamAccPt(0),fhGenGamAccEta(0),fhGenGamAccPhi(0), - fhGenPi0AccE(0),fhGenPi0AccPt(0),fhGenPi0AccEta(0),fhGenPi0AccPhi(0), - fh1pOverE(0),fh1dR(0),fh2EledEdx(0), fh2MatchdEdx(0),fhMCEle1pOverE(0),fhMCEle1dR(0),fhMCEle2MatchdEdx(0), - fhMCChHad1pOverE(0), fhMCChHad1dR(0), fhMCChHad2MatchdEdx(0), - fhMCNeutral1pOverE(0),fhMCNeutral1dR(0),fhMCNeutral2MatchdEdx(0), - fh1pOverER02(0), fhMCEle1pOverER02(0), fhMCChHad1pOverER02(0), fhMCNeutral1pOverER02(0) + + //____________________________________________________________________________ +AliAnaCalorimeterQA::AliAnaCalorimeterQA() : +AliAnaPartCorrBaseClass(), fCalorimeter(""), fStyleMacro(""), +fMakePlots(kFALSE), fCorrelateCalos(kFALSE), fNModules(12), fNRCU(2), +fTimeCutMin(-1), fTimeCutMax(9999999), +fHistoPOverEBins(100), fHistoPOverEMax(100.), fHistoPOverEMin(0.), +fHistodEdxBins(100), fHistodEdxMax(100.), fHistodEdxMin(0.), +fHistodRBins(100), fHistodRMax(100.), fHistodRMin(0.), +fHistoTimeBins(100), fHistoTimeMax(100.), fHistoTimeMin(0.), +fHistoNBins(100), fHistoNMax(100), fHistoNMin(0), +fHistoRatioBins(100), fHistoRatioMax(100.), fHistoRatioMin(0.), +fHistoVertexDistBins(100), fHistoVertexDistMax(100.), fHistoVertexDistMin(0.), +fHistoRBins(100), fHistoRMax(1000), fHistoRMin(-1000), +fHistoXBins(100), fHistoXMax(1000), fHistoXMin(-1000), +fHistoYBins(100), fHistoYMax(1000), fHistoYMin(-1000), +fHistoZBins(100), fHistoZMax(1000), fHistoZMin(-1000), +fHistoSSBins(40), fHistoSSMax(10), fHistoSSMin(0), +fhE(0),fhPt(0),fhPhi(0),fhEta(0), fhEtaPhiE(0), +fhECharged(0),fhPtCharged(0),fhPhiCharged(0),fhEtaCharged(0), fhEtaPhiECharged(0), + //fhEChargedNoOut(0),fhPtChargedNoOut(0),fhPhiChargedNoOut(0),fhEtaChargedNoOut(0), fhEtaPhiChargedNoOut(0), +fhDeltaE(0), fhDeltaPt(0),fhDeltaPhi(0),fhDeltaEta(0), fhRatioE(0), fhRatioPt(0),fhRatioPhi(0),fhRatioEta(0), +fh2E(0),fh2Pt(0),fh2Phi(0),fh2Eta(0), +fhLambda(0), fhDispersion(0), +fhIM(0), fhIMCellCut(0),fhAsym(0), +fhNCellsPerCluster(0),fhNCellsPerClusterMIP(0), fhNCellsPerClusterMIPCharged(0), fhNClusters(0), +fhClusterTimeEnergy(0),fhCellTimeSpreadRespectToCellMax(0),fhCellIdCellLargeTimeSpread(0), +fhRNCells(0),fhXNCells(0),fhYNCells(0),fhZNCells(0), +fhRE(0), fhXE(0), fhYE(0), fhZE(0), fhXYZ(0), +fhRCellE(0), fhXCellE(0), fhYCellE(0), fhZCellE(0),fhXYZCell(0), +fhDeltaCellClusterRNCells(0),fhDeltaCellClusterXNCells(0),fhDeltaCellClusterYNCells(0),fhDeltaCellClusterZNCells(0), +fhDeltaCellClusterRE(0), fhDeltaCellClusterXE(0), fhDeltaCellClusterYE(0), fhDeltaCellClusterZE(0), +fhNCells(0), fhAmplitude(0), fhAmpId(0), fhEtaPhiAmp(0), +fhTime(0), fhTimeId(0), fhTimeAmp(0), //fhT0Time(0), fhT0TimeId(0), fhT0TimeAmp(0), +fhCaloCorrNClusters(0), fhCaloCorrEClusters(0), fhCaloCorrNCells(0), fhCaloCorrECells(0), +fhEMod(0), fhNClustersMod(0), fhNCellsPerClusterMod(0), fhNCellsMod(0), +fhGridCellsMod(0), fhGridCellsEMod(0), fhGridCellsTimeMod(0), +fhAmplitudeMod(0), fhAmplitudeModFraction(0),fhTimeAmpPerRCU(0), //fhT0TimeAmpPerRCU(0), + //fhTimeCorrRCU(0), +fhIMMod(0), fhIMCellCutMod(0), +fhGenGamPt(0),fhGenGamEta(0),fhGenGamPhi(0),fhGenPi0Pt(0),fhGenPi0Eta(0),fhGenPi0Phi(0), +fhGenEtaPt(0),fhGenEtaEta(0),fhGenEtaPhi(0),fhGenOmegaPt(0),fhGenOmegaEta(0),fhGenOmegaPhi(0), +fhGenElePt(0),fhGenEleEta(0),fhGenElePhi(0), fhEMVxyz(0), fhEMR(0), fhHaVxyz(0), fhHaR(0), +fhGamE(0),fhGamPt(0),fhGamPhi(0),fhGamEta(0), +fhGamDeltaE(0), fhGamDeltaPt(0),fhGamDeltaPhi(0),fhGamDeltaEta(0), +fhGamRatioE(0), fhGamRatioPt(0),fhGamRatioPhi(0),fhGamRatioEta(0), +fhEleE(0),fhElePt(0),fhElePhi(0),fhEleEta(0), +fhPi0E(0),fhPi0Pt(0),fhPi0Phi(0),fhPi0Eta(0), +fhNeHadE(0),fhNeHadPt(0),fhNeHadPhi(0),fhNeHadEta(0), +fhChHadE(0),fhChHadPt(0),fhChHadPhi(0),fhChHadEta(0), +fhGamECharged(0),fhGamPtCharged(0),fhGamPhiCharged(0),fhGamEtaCharged(0), +fhEleECharged(0),fhElePtCharged(0),fhElePhiCharged(0),fhEleEtaCharged(0), +fhPi0ECharged(0),fhPi0PtCharged(0),fhPi0PhiCharged(0),fhPi0EtaCharged(0), +fhNeHadECharged(0),fhNeHadPtCharged(0),fhNeHadPhiCharged(0),fhNeHadEtaCharged(0), +fhChHadECharged(0),fhChHadPtCharged(0),fhChHadPhiCharged(0),fhChHadEtaCharged(0), +fhGenGamAccE(0),fhGenGamAccPt(0),fhGenGamAccEta(0),fhGenGamAccPhi(0), +fhGenPi0AccE(0),fhGenPi0AccPt(0),fhGenPi0AccEta(0),fhGenPi0AccPhi(0), +fh1pOverE(0),fh1dR(0),fh2EledEdx(0), fh2MatchdEdx(0),fhMCEle1pOverE(0),fhMCEle1dR(0),fhMCEle2MatchdEdx(0), +fhMCChHad1pOverE(0), fhMCChHad1dR(0), fhMCChHad2MatchdEdx(0), +fhMCNeutral1pOverE(0),fhMCNeutral1dR(0),fhMCNeutral2MatchdEdx(0), +fh1pOverER02(0), fhMCEle1pOverER02(0), fhMCChHad1pOverER02(0), fhMCNeutral1pOverER02(0) { - //Default Ctor + //Default Ctor - //Initialize parameters + //Initialize parameters InitParameters(); } /* -//____________________________________________________________________________ -AliAnaCalorimeterQA::AliAnaCalorimeterQA(const AliAnaCalorimeterQA & qa) : - AliAnaPartCorrBaseClass(qa), fCalorimeter(qa.fCalorimeter), fStyleMacro(qa.fStyleMacro), - fMakePlots(qa.fMakePlots), fCorrelateCalos(qa.fCorrelateCalos), fNModules(qa.fNModules), fNRCU(qa.fNRCU), - fTimeCutMin(qa.fTimeCutMin), fTimeCutMax(qa.fTimeCutMax), - fHistoPOverEBins(qa.fHistoPOverEBins), fHistoPOverEMax(qa.fHistoPOverEMax), fHistoPOverEMin(qa.fHistoPOverEMin), - fHistodEdxBins(qa.fHistodEdxBins), fHistodEdxMax(qa.fHistodEdxMax), fHistodEdxMin(qa.fHistodEdxMin), - fHistodRBins(qa.fHistodRBins), fHistodRMax(qa.fHistodRMax), fHistodRMin(qa.fHistodRMin), - fHistoTimeBins(qa.fHistoTimeBins), fHistoTimeMax(qa.fHistoTimeMax), fHistoTimeMin(qa.fHistoTimeMin), - fHistoNBins(qa.fHistoNBins), fHistoNMax(qa.fHistoNMax), fHistoNMin(qa.fHistoNMin), - fHistoRatioBins(qa.fHistoRatioBins), fHistoRatioMax(qa.fHistoRatioMax), fHistoRatioMin(qa.fHistoRatioMin), - fHistoVertexDistBins(qa.fHistoVertexDistBins), fHistoVertexDistMax(qa.fHistoVertexDistMax), fHistoVertexDistMin(qa.fHistoVertexDistMin), - fHistoRBins(qa.fHistoRBins), fHistoRMax(qa.fHistoRMax), fHistoRMin(qa.fHistoRMin), - fHistoXBins(qa.fHistoXBins), fHistoXMax(qa.fHistoXMax), fHistoXMin(qa.fHistoXMin), - fHistoYBins(qa.fHistoYBins), fHistoYMax(qa.fHistoYMax), fHistoYMin(qa.fHistoYMin), - fHistoZBins(qa.fHistoZBins), fHistoZMax(qa.fHistoZMax), fHistoZMin(qa.fHistoZMin), - fHistoSSBins(qa.fHistoSSBins),fHistoSSMax(qa.fHistoSSMax), fHistoSSMin(qa.fHistoSSMin), - fhE(qa.fhE),fhPt(qa.fhPt), fhPhi(qa.fhPhi), fhEta(qa.fhEta), fhEtaPhiE(qa.fhEtaPhiE), - fhECharged(qa.fhECharged),fhPtCharged(qa.fhPtCharged),fhPhiCharged(qa.fhPhiCharged), - fhEtaCharged(qa.fhEtaCharged), fhEtaPhiECharged(qa.fhEtaPhiECharged), - //fhEChargedNoOut(qa.fhEChargedNoOut),fhPtChargedNoOut(qa.fhPtChargedNoOut),fhPhiChargedNoOut(qa.fhPhiChargedNoOut), - //fhEtaChargedNoOut(qa.fhEtaChargedNoOut), fhEtaPhiChargedNoOut(qa.fhEtaPhiChargedNoOut), - fhDeltaE(qa.fhDeltaE), fhDeltaPt(qa.fhDeltaPt), fhDeltaPhi(qa.fhDeltaPhi), fhDeltaEta(qa.fhDeltaEta), - fhRatioE(qa.fhRatioE), fhRatioPt(qa.fhRatioPt), fhRatioPhi(qa.fhRatioPhi), fhRatioEta(qa.fhRatioEta), - fh2E(qa.fh2E), fh2Pt(qa.fh2Pt), fh2Phi(qa.fh2Phi),fh2Eta(qa.fh2Eta), - fhLambda(qa.fhLambda), fhDispersion(qa.fhDispersion), - fhIM(qa.fhIM), fhIMCellCut(qa.fhIMCellCut), fhAsym(qa.fhAsym), - fhNCellsPerCluster(qa.fhNCellsPerCluster), fhNCellsPerClusterMIP(qa.fhNCellsPerClusterMIP), - fhNCellsPerClusterMIPCharged(qa.fhNCellsPerClusterMIPCharged),fhNClusters(qa.fhNClusters), - fhClusterTimeEnergy(qa.fhClusterTimeEnergy), - fhCellTimeSpreadRespectToCellMax(qa.fhCellTimeSpreadRespectToCellMax), - fhCellIdCellLargeTimeSpread(qa.fhCellIdCellLargeTimeSpread), - fhRNCells(qa.fhRNCells),fhXNCells(qa.fhXNCells),fhYNCells(qa.fhYNCells),fhZNCells(qa.fhZNCells), - fhRE(qa.fhRE), fhXE(qa.fhXE), fhYE(qa.fhYE), fhZE(qa.fhZE), fhXYZ(qa.fhXYZ), - fhRCellE(qa.fhXCellE), fhXCellE(qa.fhXCellE), fhYCellE(qa.fhYCellE), fhZCellE(qa.fhZCellE),fhXYZCell(qa.fhXYZCell), - fhDeltaCellClusterRNCells(qa.fhDeltaCellClusterRNCells),fhDeltaCellClusterXNCells(qa.fhDeltaCellClusterXNCells), - fhDeltaCellClusterYNCells(qa.fhDeltaCellClusterYNCells),fhDeltaCellClusterZNCells(qa.fhDeltaCellClusterZNCells), - fhDeltaCellClusterRE(qa.fhDeltaCellClusterRE), fhDeltaCellClusterXE(qa.fhDeltaCellClusterXE), - fhDeltaCellClusterYE(qa.fhDeltaCellClusterYE), fhDeltaCellClusterZE(qa.fhDeltaCellClusterZE), - fhNCells(qa.fhNCells), fhAmplitude(qa.fhAmplitude), fhAmpId(fhAmpId), fhEtaPhiAmp(qa.fhEtaPhiAmp), - fhTime(qa.fhTime), fhTimeId(qa.fhTimeId),fhTimeAmp(qa.fhTimeAmp), - //fhT0Time(qa.fhT0Time),fhT0TimeId(qa.fhT0TimeId), fhT0TimeAmp(qa.fhT0TimeAmp), - fhCaloCorrNClusters(qa.fhCaloCorrNClusters), fhCaloCorrEClusters(qa.fhCaloCorrEClusters), - fhCaloCorrNCells(qa.fhCaloCorrNCells), fhCaloCorrECells(qa.fhCaloCorrECells), - fhEMod(qa.fhEMod), fhNClustersMod(qa.fhNClustersMod), - fhNCellsPerClusterMod(qa.fhNCellsPerClusterMod), fhNCellsMod(qa.fhNCellsMod), - fhGridCellsMod(qa.fhGridCellsMod), fhGridCellsEMod(qa.fhGridCellsEMod), fhGridCellsTimeMod(qa.fhGridCellsTimeMod), - fhAmplitudeMod(qa.fhAmplitudeMod), fhAmplitudeModFraction(qa.fhAmplitudeModFraction), - fhTimeAmpPerRCU(qa.fhTimeAmpPerRCU), //fhT0TimeAmpPerRCU(qa.fhT0TimeAmpPerRCU), fhTimeCorrRCU(qa.fhTimeCorrRCU), - fhIMMod(qa.fhIMMod),fhIMCellCutMod(qa.fhIMCellCutMod), - fhGenGamPt(qa.fhGenGamPt), fhGenGamEta(qa.fhGenGamEta), fhGenGamPhi(qa.fhGenGamPhi), - fhGenPi0Pt(qa.fhGenPi0Pt), fhGenPi0Eta(qa.fhGenPi0Eta), fhGenPi0Phi(qa.fhGenPi0Phi), - fhGenEtaPt(qa.fhGenEtaPt), fhGenEtaEta(qa.fhGenEtaEta), fhGenEtaPhi(qa.fhGenEtaPhi), - fhGenOmegaPt(qa.fhGenOmegaPt), fhGenOmegaEta(qa.fhGenOmegaEta), fhGenOmegaPhi(qa.fhGenOmegaPhi), - fhGenElePt(qa.fhGenElePt), fhGenEleEta(qa.fhGenEleEta), fhGenElePhi(qa.fhGenElePhi), - fhEMVxyz(qa.fhEMVxyz), fhEMR(qa.fhEMR), fhHaVxyz(qa.fhHaVxyz), fhHaR(qa.fhHaR), - fhGamE(qa.fhGamE),fhGamPt(qa.fhGamPt),fhGamPhi(qa.fhGamPhi),fhGamEta(qa.fhGamEta), - fhGamDeltaE(qa.fhGamDeltaE), fhGamDeltaPt(qa.fhGamDeltaPt), fhGamDeltaPhi(qa.fhGamDeltaPhi), fhGamDeltaEta(qa.fhGamDeltaEta), - fhGamRatioE(qa.fhGamRatioE), fhGamRatioPt(qa.fhGamRatioPt), fhGamRatioPhi(qa.fhGamRatioPhi), fhGamRatioEta(qa.fhGamRatioEta), - fhEleE(qa.fhEleE),fhElePt(qa.fhElePt),fhElePhi(qa.fhElePhi),fhEleEta(qa.fhEleEta), - fhPi0E(qa.fhPi0E),fhPi0Pt(qa.fhPi0Pt),fhPi0Phi(qa.fhPi0Phi),fhPi0Eta(qa.fhPi0Eta), - fhNeHadE(qa.fhNeHadE),fhNeHadPt(qa.fhNeHadPt),fhNeHadPhi(qa.fhNeHadPhi),fhNeHadEta(qa.fhNeHadEta), - fhChHadE(qa.fhChHadE),fhChHadPt(qa.fhChHadPt),fhChHadPhi(qa.fhChHadPhi),fhChHadEta(qa.fhChHadEta), - fhGamECharged(qa.fhGamECharged),fhGamPtCharged(qa.fhGamPtCharged),fhGamPhiCharged(qa.fhGamPhiCharged),fhGamEtaCharged(qa.fhGamEtaCharged), - fhEleECharged(qa.fhEleECharged),fhElePtCharged(qa.fhElePtCharged),fhElePhiCharged(qa.fhElePhiCharged),fhEleEtaCharged(qa.fhEleEtaCharged), - fhPi0ECharged(qa.fhPi0ECharged),fhPi0PtCharged(qa.fhPi0PtCharged),fhPi0PhiCharged(qa.fhPi0PhiCharged),fhPi0EtaCharged(qa.fhPi0EtaCharged), - fhNeHadECharged(qa.fhNeHadECharged),fhNeHadPtCharged(qa.fhNeHadPtCharged),fhNeHadPhiCharged(qa.fhNeHadPhiCharged),fhNeHadEtaCharged(qa.fhNeHadEtaCharged), - fhChHadECharged(qa.fhChHadECharged),fhChHadPtCharged(qa.fhChHadPtCharged),fhChHadPhiCharged(qa.fhChHadPhiCharged),fhChHadEtaCharged(qa.fhChHadEtaCharged), - fhGenGamAccE(qa.fhGenGamAccE),fhGenGamAccPt(qa.fhGenGamAccPt),fhGenGamAccEta(qa.fhGenGamAccEta),fhGenGamAccPhi(qa.fhGenGamAccPhi), - fhGenPi0AccE(qa.fhGenPi0AccE),fhGenPi0AccPt(qa.fhGenPi0AccPt),fhGenPi0AccEta(qa.fhGenPi0AccEta),fhGenPi0AccPhi(qa.fhGenPi0AccPhi), - fh1pOverE(qa.fh1pOverE),fh1dR(qa.fh1dR),fh2EledEdx(qa.fh2EledEdx), fh2MatchdEdx(qa.fh2MatchdEdx), - fhMCEle1pOverE(qa.fhMCEle1pOverE),fhMCEle1dR(qa.fhMCEle1dR), fhMCEle2MatchdEdx(qa.fhMCEle2MatchdEdx), - fhMCChHad1pOverE(qa.fhMCChHad1pOverE),fhMCChHad1dR(qa.fhMCChHad1dR), fhMCChHad2MatchdEdx(qa.fhMCChHad2MatchdEdx), - fhMCNeutral1pOverE(qa.fhMCNeutral1pOverE),fhMCNeutral1dR(qa.fhMCNeutral1dR), fhMCNeutral2MatchdEdx(qa.fhMCNeutral2MatchdEdx), - fh1pOverER02(qa.fh1pOverER02), fhMCEle1pOverER02(qa.fhMCEle1pOverER02),fhMCChHad1pOverER02(qa.fhMCChHad1pOverER02), fhMCNeutral1pOverER02(qa.fhMCNeutral1pOverER02) -{ - // cpy ctor - -} -*/ -//________________________________________________________________________________________________________________________________________________ -//AliAnaCalorimeterQA::~AliAnaCalorimeterQA() { + //____________________________________________________________________________ + AliAnaCalorimeterQA::AliAnaCalorimeterQA(const AliAnaCalorimeterQA & qa) : + AliAnaPartCorrBaseClass(qa), fCalorimeter(qa.fCalorimeter), fStyleMacro(qa.fStyleMacro), + fMakePlots(qa.fMakePlots), fCorrelateCalos(qa.fCorrelateCalos), fNModules(qa.fNModules), fNRCU(qa.fNRCU), + fTimeCutMin(qa.fTimeCutMin), fTimeCutMax(qa.fTimeCutMax), + fHistoPOverEBins(qa.fHistoPOverEBins), fHistoPOverEMax(qa.fHistoPOverEMax), fHistoPOverEMin(qa.fHistoPOverEMin), + fHistodEdxBins(qa.fHistodEdxBins), fHistodEdxMax(qa.fHistodEdxMax), fHistodEdxMin(qa.fHistodEdxMin), + fHistodRBins(qa.fHistodRBins), fHistodRMax(qa.fHistodRMax), fHistodRMin(qa.fHistodRMin), + fHistoTimeBins(qa.fHistoTimeBins), fHistoTimeMax(qa.fHistoTimeMax), fHistoTimeMin(qa.fHistoTimeMin), + fHistoNBins(qa.fHistoNBins), fHistoNMax(qa.fHistoNMax), fHistoNMin(qa.fHistoNMin), + fHistoRatioBins(qa.fHistoRatioBins), fHistoRatioMax(qa.fHistoRatioMax), fHistoRatioMin(qa.fHistoRatioMin), + fHistoVertexDistBins(qa.fHistoVertexDistBins), fHistoVertexDistMax(qa.fHistoVertexDistMax), fHistoVertexDistMin(qa.fHistoVertexDistMin), + fHistoRBins(qa.fHistoRBins), fHistoRMax(qa.fHistoRMax), fHistoRMin(qa.fHistoRMin), + fHistoXBins(qa.fHistoXBins), fHistoXMax(qa.fHistoXMax), fHistoXMin(qa.fHistoXMin), + fHistoYBins(qa.fHistoYBins), fHistoYMax(qa.fHistoYMax), fHistoYMin(qa.fHistoYMin), + fHistoZBins(qa.fHistoZBins), fHistoZMax(qa.fHistoZMax), fHistoZMin(qa.fHistoZMin), + fHistoSSBins(qa.fHistoSSBins),fHistoSSMax(qa.fHistoSSMax), fHistoSSMin(qa.fHistoSSMin), + fhE(qa.fhE),fhPt(qa.fhPt), fhPhi(qa.fhPhi), fhEta(qa.fhEta), fhEtaPhiE(qa.fhEtaPhiE), + fhECharged(qa.fhECharged),fhPtCharged(qa.fhPtCharged),fhPhiCharged(qa.fhPhiCharged), + fhEtaCharged(qa.fhEtaCharged), fhEtaPhiECharged(qa.fhEtaPhiECharged), + //fhEChargedNoOut(qa.fhEChargedNoOut),fhPtChargedNoOut(qa.fhPtChargedNoOut),fhPhiChargedNoOut(qa.fhPhiChargedNoOut), + //fhEtaChargedNoOut(qa.fhEtaChargedNoOut), fhEtaPhiChargedNoOut(qa.fhEtaPhiChargedNoOut), + fhDeltaE(qa.fhDeltaE), fhDeltaPt(qa.fhDeltaPt), fhDeltaPhi(qa.fhDeltaPhi), fhDeltaEta(qa.fhDeltaEta), + fhRatioE(qa.fhRatioE), fhRatioPt(qa.fhRatioPt), fhRatioPhi(qa.fhRatioPhi), fhRatioEta(qa.fhRatioEta), + fh2E(qa.fh2E), fh2Pt(qa.fh2Pt), fh2Phi(qa.fh2Phi),fh2Eta(qa.fh2Eta), + fhLambda(qa.fhLambda), fhDispersion(qa.fhDispersion), + fhIM(qa.fhIM), fhIMCellCut(qa.fhIMCellCut), fhAsym(qa.fhAsym), + fhNCellsPerCluster(qa.fhNCellsPerCluster), fhNCellsPerClusterMIP(qa.fhNCellsPerClusterMIP), + fhNCellsPerClusterMIPCharged(qa.fhNCellsPerClusterMIPCharged),fhNClusters(qa.fhNClusters), + fhClusterTimeEnergy(qa.fhClusterTimeEnergy), + fhCellTimeSpreadRespectToCellMax(qa.fhCellTimeSpreadRespectToCellMax), + fhCellIdCellLargeTimeSpread(qa.fhCellIdCellLargeTimeSpread), + fhRNCells(qa.fhRNCells),fhXNCells(qa.fhXNCells),fhYNCells(qa.fhYNCells),fhZNCells(qa.fhZNCells), + fhRE(qa.fhRE), fhXE(qa.fhXE), fhYE(qa.fhYE), fhZE(qa.fhZE), fhXYZ(qa.fhXYZ), + fhRCellE(qa.fhXCellE), fhXCellE(qa.fhXCellE), fhYCellE(qa.fhYCellE), fhZCellE(qa.fhZCellE),fhXYZCell(qa.fhXYZCell), + fhDeltaCellClusterRNCells(qa.fhDeltaCellClusterRNCells),fhDeltaCellClusterXNCells(qa.fhDeltaCellClusterXNCells), + fhDeltaCellClusterYNCells(qa.fhDeltaCellClusterYNCells),fhDeltaCellClusterZNCells(qa.fhDeltaCellClusterZNCells), + fhDeltaCellClusterRE(qa.fhDeltaCellClusterRE), fhDeltaCellClusterXE(qa.fhDeltaCellClusterXE), + fhDeltaCellClusterYE(qa.fhDeltaCellClusterYE), fhDeltaCellClusterZE(qa.fhDeltaCellClusterZE), + fhNCells(qa.fhNCells), fhAmplitude(qa.fhAmplitude), fhAmpId(fhAmpId), fhEtaPhiAmp(qa.fhEtaPhiAmp), + fhTime(qa.fhTime), fhTimeId(qa.fhTimeId),fhTimeAmp(qa.fhTimeAmp), + //fhT0Time(qa.fhT0Time),fhT0TimeId(qa.fhT0TimeId), fhT0TimeAmp(qa.fhT0TimeAmp), + fhCaloCorrNClusters(qa.fhCaloCorrNClusters), fhCaloCorrEClusters(qa.fhCaloCorrEClusters), + fhCaloCorrNCells(qa.fhCaloCorrNCells), fhCaloCorrECells(qa.fhCaloCorrECells), + fhEMod(qa.fhEMod), fhNClustersMod(qa.fhNClustersMod), + fhNCellsPerClusterMod(qa.fhNCellsPerClusterMod), fhNCellsMod(qa.fhNCellsMod), + fhGridCellsMod(qa.fhGridCellsMod), fhGridCellsEMod(qa.fhGridCellsEMod), fhGridCellsTimeMod(qa.fhGridCellsTimeMod), + fhAmplitudeMod(qa.fhAmplitudeMod), fhAmplitudeModFraction(qa.fhAmplitudeModFraction), + fhTimeAmpPerRCU(qa.fhTimeAmpPerRCU), //fhT0TimeAmpPerRCU(qa.fhT0TimeAmpPerRCU), fhTimeCorrRCU(qa.fhTimeCorrRCU), + fhIMMod(qa.fhIMMod),fhIMCellCutMod(qa.fhIMCellCutMod), + fhGenGamPt(qa.fhGenGamPt), fhGenGamEta(qa.fhGenGamEta), fhGenGamPhi(qa.fhGenGamPhi), + fhGenPi0Pt(qa.fhGenPi0Pt), fhGenPi0Eta(qa.fhGenPi0Eta), fhGenPi0Phi(qa.fhGenPi0Phi), + fhGenEtaPt(qa.fhGenEtaPt), fhGenEtaEta(qa.fhGenEtaEta), fhGenEtaPhi(qa.fhGenEtaPhi), + fhGenOmegaPt(qa.fhGenOmegaPt), fhGenOmegaEta(qa.fhGenOmegaEta), fhGenOmegaPhi(qa.fhGenOmegaPhi), + fhGenElePt(qa.fhGenElePt), fhGenEleEta(qa.fhGenEleEta), fhGenElePhi(qa.fhGenElePhi), + fhEMVxyz(qa.fhEMVxyz), fhEMR(qa.fhEMR), fhHaVxyz(qa.fhHaVxyz), fhHaR(qa.fhHaR), + fhGamE(qa.fhGamE),fhGamPt(qa.fhGamPt),fhGamPhi(qa.fhGamPhi),fhGamEta(qa.fhGamEta), + fhGamDeltaE(qa.fhGamDeltaE), fhGamDeltaPt(qa.fhGamDeltaPt), fhGamDeltaPhi(qa.fhGamDeltaPhi), fhGamDeltaEta(qa.fhGamDeltaEta), + fhGamRatioE(qa.fhGamRatioE), fhGamRatioPt(qa.fhGamRatioPt), fhGamRatioPhi(qa.fhGamRatioPhi), fhGamRatioEta(qa.fhGamRatioEta), + fhEleE(qa.fhEleE),fhElePt(qa.fhElePt),fhElePhi(qa.fhElePhi),fhEleEta(qa.fhEleEta), + fhPi0E(qa.fhPi0E),fhPi0Pt(qa.fhPi0Pt),fhPi0Phi(qa.fhPi0Phi),fhPi0Eta(qa.fhPi0Eta), + fhNeHadE(qa.fhNeHadE),fhNeHadPt(qa.fhNeHadPt),fhNeHadPhi(qa.fhNeHadPhi),fhNeHadEta(qa.fhNeHadEta), + fhChHadE(qa.fhChHadE),fhChHadPt(qa.fhChHadPt),fhChHadPhi(qa.fhChHadPhi),fhChHadEta(qa.fhChHadEta), + fhGamECharged(qa.fhGamECharged),fhGamPtCharged(qa.fhGamPtCharged),fhGamPhiCharged(qa.fhGamPhiCharged),fhGamEtaCharged(qa.fhGamEtaCharged), + fhEleECharged(qa.fhEleECharged),fhElePtCharged(qa.fhElePtCharged),fhElePhiCharged(qa.fhElePhiCharged),fhEleEtaCharged(qa.fhEleEtaCharged), + fhPi0ECharged(qa.fhPi0ECharged),fhPi0PtCharged(qa.fhPi0PtCharged),fhPi0PhiCharged(qa.fhPi0PhiCharged),fhPi0EtaCharged(qa.fhPi0EtaCharged), + fhNeHadECharged(qa.fhNeHadECharged),fhNeHadPtCharged(qa.fhNeHadPtCharged),fhNeHadPhiCharged(qa.fhNeHadPhiCharged),fhNeHadEtaCharged(qa.fhNeHadEtaCharged), + fhChHadECharged(qa.fhChHadECharged),fhChHadPtCharged(qa.fhChHadPtCharged),fhChHadPhiCharged(qa.fhChHadPhiCharged),fhChHadEtaCharged(qa.fhChHadEtaCharged), + fhGenGamAccE(qa.fhGenGamAccE),fhGenGamAccPt(qa.fhGenGamAccPt),fhGenGamAccEta(qa.fhGenGamAccEta),fhGenGamAccPhi(qa.fhGenGamAccPhi), + fhGenPi0AccE(qa.fhGenPi0AccE),fhGenPi0AccPt(qa.fhGenPi0AccPt),fhGenPi0AccEta(qa.fhGenPi0AccEta),fhGenPi0AccPhi(qa.fhGenPi0AccPhi), + fh1pOverE(qa.fh1pOverE),fh1dR(qa.fh1dR),fh2EledEdx(qa.fh2EledEdx), fh2MatchdEdx(qa.fh2MatchdEdx), + fhMCEle1pOverE(qa.fhMCEle1pOverE),fhMCEle1dR(qa.fhMCEle1dR), fhMCEle2MatchdEdx(qa.fhMCEle2MatchdEdx), + fhMCChHad1pOverE(qa.fhMCChHad1pOverE),fhMCChHad1dR(qa.fhMCChHad1dR), fhMCChHad2MatchdEdx(qa.fhMCChHad2MatchdEdx), + fhMCNeutral1pOverE(qa.fhMCNeutral1pOverE),fhMCNeutral1dR(qa.fhMCNeutral1dR), fhMCNeutral2MatchdEdx(qa.fhMCNeutral2MatchdEdx), + fh1pOverER02(qa.fh1pOverER02), fhMCEle1pOverER02(qa.fhMCEle1pOverER02),fhMCChHad1pOverER02(qa.fhMCChHad1pOverER02), fhMCNeutral1pOverER02(qa.fhMCNeutral1pOverER02) + { + // cpy ctor + + } + */ + //________________________________________________________________________________________________________________________________________________ + //AliAnaCalorimeterQA::~AliAnaCalorimeterQA() { // dtor - -//} -//________________________________________________________________________ + //} + + //________________________________________________________________________ TObjString * AliAnaCalorimeterQA::GetAnalysisCuts() { - //Save parameters used for analysis + //Save parameters used for analysis TString parList ; //this will be list of parameters used for this analysis. char onePar[255] ; @@ -223,27 +220,27 @@ TObjString * AliAnaCalorimeterQA::GetAnalysisCuts() parList+=onePar ; sprintf(onePar,"Time Cut : %2.2f < T < %2.2f ns \n",fTimeCutMin, fTimeCutMax) ; parList+=onePar ; - - //Get parameters set in base class. - //parList += GetBaseParametersList() ; + + //Get parameters set in base class. + //parList += GetBaseParametersList() ; - //Get parameters set in FiducialCut class (not available yet) - //parlist += GetFidCut()->GetFidCutParametersList() + //Get parameters set in FiducialCut class (not available yet) + //parlist += GetFidCut()->GetFidCutParametersList() return new TObjString(parList) ; } -//________________________________________________________________________ + //________________________________________________________________________ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() { - // Create histograms to be saved in output file and - // store them in outputContainer - + // Create histograms to be saved in output file and + // store them in outputContainer + TList * outputContainer = new TList() ; outputContainer->SetName("QAHistos") ; - //Histograms + //Histograms Int_t nptbins = GetHistoPtBins(); Float_t ptmax = GetHistoPtMax(); Float_t ptmin = GetHistoPtMin(); Int_t nphibins = GetHistoPhiBins(); Float_t phimax = GetHistoPhiMax(); Float_t phimin = GetHistoPhiMin(); Int_t netabins = GetHistoEtaBins(); Float_t etamax = GetHistoEtaMax(); Float_t etamin = GetHistoEtaMin(); @@ -262,11 +259,11 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() Int_t zbins = GetHistoZBins(); Float_t zmax = GetHistoZMax(); Float_t zmin = GetHistoZMin(); Int_t ssbins = GetHistoShowerShapeBins(); Float_t ssmax = GetHistoShowerShapeMax(); Float_t ssmin = GetHistoShowerShapeMin(); - //EMCAL + //EMCAL Int_t colmax = 48; Int_t rowmax = 24; fNRCU = 2 ; - //PHOS + //PHOS if(fCalorimeter=="PHOS"){ colmax = 56; rowmax = 64; @@ -291,35 +288,35 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhEta); fhEtaPhiE = new TH3F ("hEtaPhiE","#eta vs #phi vs energy, reconstructed clusters", - netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); + netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); fhEtaPhiE->SetXTitle("#eta "); fhEtaPhiE->SetYTitle("#phi (rad)"); fhEtaPhiE->SetZTitle("E (GeV) "); outputContainer->Add(fhEtaPhiE); fhClusterTimeEnergy = new TH2F ("hClusterTimeEnergy","energy vs TOF, reconstructed clusters", - nptbins,ptmin,ptmax, ntimebins,timemin,timemax); + nptbins,ptmin,ptmax, ntimebins,timemin,timemax); fhClusterTimeEnergy->SetXTitle("E (GeV) "); fhClusterTimeEnergy->SetYTitle("TOF (ns)"); outputContainer->Add(fhClusterTimeEnergy); - //Shower shape + //Shower shape fhLambda = new TH3F ("hLambda","#lambda_{0}^{2} vs #lambda_{1}^{2} vs energy, reconstructed clusters", - ssbins,ssmin,ssmax,ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); + ssbins,ssmin,ssmax,ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); fhLambda->SetXTitle("#lambda_{0}^{2} "); fhLambda->SetYTitle("#lambda_{1}^{2} "); fhLambda->SetZTitle("E (GeV) "); outputContainer->Add(fhLambda); fhDispersion = new TH2F ("hDispersion"," dispersion vs energy, reconstructed clusters", - ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); + ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); fhDispersion->SetXTitle("Dispersion "); fhDispersion->SetYTitle("E (GeV) "); outputContainer->Add(fhDispersion); - //Track Matching - + //Track Matching + fhECharged = new TH1F ("hECharged","E reconstructed clusters, matched with track", nptbins,ptmin,ptmax); fhECharged->SetXTitle("E (GeV)"); outputContainer->Add(fhECharged); @@ -337,34 +334,34 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhEtaCharged); fhEtaPhiECharged = new TH3F ("hEtaPhiECharged","#eta vs #phi, reconstructed clusters, matched with track", - netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); + netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); fhEtaPhiECharged->SetXTitle("#eta "); fhEtaPhiECharged->SetYTitle("#phi "); fhEtaPhiECharged->SetZTitle("E (GeV) "); outputContainer->Add(fhEtaPhiECharged); - - -// fhEChargedNoOut = new TH1F ("hEChargedNoOut","E reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax); -// fhEChargedNoOut->SetXTitle("E (GeV)"); -// outputContainer->Add(fhEChargedNoOut); -// -// fhPtChargedNoOut = new TH1F ("hPtChargedNoOut","p_{T} reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax); -// fhPtChargedNoOut->SetXTitle("p_{T} (GeV/c)"); -// outputContainer->Add(fhPtChargedNoOut); -// -// fhPhiChargedNoOut = new TH1F ("hPhiChargedNoOut","#phi reconstructed clusters, matched with track, no output track params",nphibins,phimin,phimax); -// fhPhiChargedNoOut->SetXTitle("#phi (rad)"); -// outputContainer->Add(fhPhiChargedNoOut); -// -// fhEtaChargedNoOut = new TH1F ("hEtaChargedNoOut","#eta reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax); -// fhEtaChargedNoOut->SetXTitle("#eta "); -// outputContainer->Add(fhEtaChargedNoOut); -// -// fhEtaPhiChargedNoOut = new TH2F ("hEtaPhiChargedNoOut","#eta vs #phi, reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax,nphibins,phimin,phimax); -// fhEtaPhiChargedNoOut->SetXTitle("#eta "); -// fhEtaPhiChargedNoOut->SetYTitle("#phi "); -// outputContainer->Add(fhEtaPhiChargedNoOut); - + + + // fhEChargedNoOut = new TH1F ("hEChargedNoOut","E reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax); + // fhEChargedNoOut->SetXTitle("E (GeV)"); + // outputContainer->Add(fhEChargedNoOut); + // + // fhPtChargedNoOut = new TH1F ("hPtChargedNoOut","p_{T} reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax); + // fhPtChargedNoOut->SetXTitle("p_{T} (GeV/c)"); + // outputContainer->Add(fhPtChargedNoOut); + // + // fhPhiChargedNoOut = new TH1F ("hPhiChargedNoOut","#phi reconstructed clusters, matched with track, no output track params",nphibins,phimin,phimax); + // fhPhiChargedNoOut->SetXTitle("#phi (rad)"); + // outputContainer->Add(fhPhiChargedNoOut); + // + // fhEtaChargedNoOut = new TH1F ("hEtaChargedNoOut","#eta reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax); + // fhEtaChargedNoOut->SetXTitle("#eta "); + // outputContainer->Add(fhEtaChargedNoOut); + // + // fhEtaPhiChargedNoOut = new TH2F ("hEtaPhiChargedNoOut","#eta vs #phi, reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax,nphibins,phimin,phimax); + // fhEtaPhiChargedNoOut->SetXTitle("#eta "); + // fhEtaPhiChargedNoOut->SetYTitle("#phi "); + // outputContainer->Add(fhEtaPhiChargedNoOut); + fh1pOverE = new TH2F("h1pOverE","TRACK matches p/E",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax); fh1pOverE->SetYTitle("p/E"); fh1pOverE->SetXTitle("p_{T} (GeV/c)"); @@ -412,7 +409,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhNCellsPerClusterMIP = new TH3F ("hNCellsPerClusterMIP","# cells per cluster vs energy vs #eta, smaller bin for MIP search", - 100,0.,1., 6,0,5,netabins,etamin,etamax); + 100,0.,1., 6,0,5,netabins,etamin,etamax); fhNCellsPerClusterMIP->SetXTitle("E (GeV)"); fhNCellsPerClusterMIP->SetYTitle("n cells"); fhNCellsPerClusterMIP->SetZTitle("#eta"); @@ -420,7 +417,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhNCellsPerClusterMIPCharged = new TH3F ("hNCellsPerClusterMIPCharged","# cells per track-matched cluster vs energy vs #eta, smaller bin for MIP search", - 100,0.,1., 6,0,5,netabins,etamin,etamax); + 100,0.,1., 6,0,5,netabins,etamin,etamax); fhNCellsPerClusterMIPCharged->SetXTitle("E (GeV)"); fhNCellsPerClusterMIPCharged->SetYTitle("n cells"); fhNCellsPerClusterMIPCharged->SetZTitle("#eta"); @@ -460,7 +457,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhXE->SetXTitle("x (cm)"); fhXE->SetYTitle("E (GeV)"); outputContainer->Add(fhXE); - + fhYE = new TH2F ("hYE","Cluster Y position vs cluster energy",ybins,ymin,ymax,nptbins,ptmin,ptmax); fhYE->SetXTitle("y (cm)"); fhYE->SetYTitle("E (GeV)"); @@ -476,7 +473,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhXYZ->SetYTitle("y (cm)"); fhXYZ->SetZTitle("z (cm) "); outputContainer->Add(fhXYZ); - + fhRCellE = new TH2F ("hRCellE","Cell R position vs cell energy",rbins,rmin,rmax,nptbins,ptmin,ptmax); fhRCellE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)"); fhRCellE->SetYTitle("E (GeV)"); @@ -486,7 +483,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhXCellE->SetXTitle("x (cm)"); fhXCellE->SetYTitle("E (GeV)"); outputContainer->Add(fhXCellE); - + fhYCellE = new TH2F ("hYCellE","Cell Y position vs cell energy",ybins,ymin,ymax,nptbins,ptmin,ptmax); fhYCellE->SetXTitle("y (cm)"); fhYCellE->SetYTitle("E (GeV)"); @@ -502,13 +499,13 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhXYZCell->SetYTitle("y (cm)"); fhXYZCell->SetZTitle("z (cm)"); outputContainer->Add(fhXYZCell); - - + + Float_t dx = TMath::Abs(xmin)+TMath::Abs(xmax); Float_t dy = TMath::Abs(ymin)+TMath::Abs(ymax); Float_t dz = TMath::Abs(zmin)+TMath::Abs(zmax); Float_t dr = TMath::Abs(rmin)+TMath::Abs(rmax); - + fhDeltaCellClusterRNCells = new TH2F ("hDeltaCellClusterRNCells","Cluster-Cell R position vs N Clusters per Cell",rbins*2,-dr,dr,nbins,nmin,nmax); fhDeltaCellClusterRNCells->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)"); fhDeltaCellClusterRNCells->SetYTitle("N cells per cluster"); @@ -554,13 +551,13 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhEtaPhiAmp->SetYTitle("#phi (rad)"); fhEtaPhiAmp->SetZTitle("E (GeV) "); outputContainer->Add(fhEtaPhiAmp); - - - //Calo cells + + + //Calo cells fhNCells = new TH1F ("hNCells","# cells", colmax*rowmax*fNModules,0,colmax*rowmax*fNModules); fhNCells->SetXTitle("n cells"); outputContainer->Add(fhNCells); - + fhAmplitude = new TH1F ("hAmplitude","Cell Energy", nptbins*2,ptmin,ptmax); fhAmplitude->SetXTitle("Cell Energy (GeV)"); outputContainer->Add(fhAmplitude); @@ -572,7 +569,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhAmpId); - //Cell Time histograms, time only available in ESDs + //Cell Time histograms, time only available in ESDs if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { fhCellTimeSpreadRespectToCellMax = new TH1F ("hCellTimeSpreadRespectToCellMax","t_{cell max}-t_{cell i} per cluster", 100,-200,200); @@ -586,30 +583,30 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhTime = new TH1F ("hTime","Cell Time",ntimebins,timemin,timemax); fhTime->SetXTitle("Cell Time (ns)"); outputContainer->Add(fhTime); - + fhTimeId = new TH2F ("hTimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules); fhTimeId->SetXTitle("Cell Time (ns)"); fhTimeId->SetYTitle("Cell Absolute Id"); outputContainer->Add(fhTimeId); - + fhTimeAmp = new TH2F ("hTimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax); fhTimeAmp->SetYTitle("Cell Time (ns)"); fhTimeAmp->SetXTitle("Cell Energy (GeV)"); outputContainer->Add(fhTimeAmp); -// fhT0Time = new TH1F ("hT0Time","Cell Time",ntimebins,timemin,timemax); -// fhT0Time->SetXTitle("T_{0} - T_{EMCal} (ns)"); -// outputContainer->Add(fhT0Time); -// -// fhT0TimeId = new TH2F ("hT0TimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules); -// fhT0TimeId->SetXTitle("T_{0} - T_{EMCal} (ns)"); -// fhT0TimeId->SetYTitle("Cell Absolute Id"); -// outputContainer->Add(fhT0TimeId); -// -// fhT0TimeAmp = new TH2F ("hT0TimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax); -// fhT0TimeAmp->SetYTitle("T_{0} - T_{EMCal} (ns)"); -// fhT0TimeAmp->SetXTitle("Cell Energy (GeV)"); -// outputContainer->Add(fhT0TimeAmp); + // fhT0Time = new TH1F ("hT0Time","Cell Time",ntimebins,timemin,timemax); + // fhT0Time->SetXTitle("T_{0} - T_{EMCal} (ns)"); + // outputContainer->Add(fhT0Time); + // + // fhT0TimeId = new TH2F ("hT0TimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules); + // fhT0TimeId->SetXTitle("T_{0} - T_{EMCal} (ns)"); + // fhT0TimeId->SetYTitle("Cell Absolute Id"); + // outputContainer->Add(fhT0TimeId); + // + // fhT0TimeAmp = new TH2F ("hT0TimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax); + // fhT0TimeAmp->SetYTitle("T_{0} - T_{EMCal} (ns)"); + // fhT0TimeAmp->SetXTitle("Cell Energy (GeV)"); + // outputContainer->Add(fhT0TimeAmp); } @@ -619,24 +616,24 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhCaloCorrNClusters->SetXTitle("number of clusters in EMCAL"); fhCaloCorrNClusters->SetYTitle("number of clusters in PHOS"); outputContainer->Add(fhCaloCorrNClusters); - + fhCaloCorrEClusters = new TH2F ("hCaloCorrEClusters","summed energy of clusters in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*2,nptbins,ptmin,ptmax*2); fhCaloCorrEClusters->SetXTitle("#Sigma E of clusters in EMCAL (GeV)"); fhCaloCorrEClusters->SetYTitle("#Sigma E of clusters in PHOS (GeV)"); outputContainer->Add(fhCaloCorrEClusters); - + fhCaloCorrNCells = new TH2F ("hCaloCorrNCells","# Cells in EMCAL vs PHOS", nbins,nmin,nmax, nbins,nmin,nmax); fhCaloCorrNCells->SetXTitle("number of Cells in EMCAL"); fhCaloCorrNCells->SetYTitle("number of Cells in PHOS"); outputContainer->Add(fhCaloCorrNCells); - + fhCaloCorrECells = new TH2F ("hCaloCorrECells","summed energy of Cells in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*2,nptbins,ptmin,ptmax*2); fhCaloCorrECells->SetXTitle("#Sigma E of Cells in EMCAL (GeV)"); fhCaloCorrECells->SetYTitle("#Sigma E of Cells in PHOS (GeV)"); outputContainer->Add(fhCaloCorrECells); }//correlate calorimeters - //Module histograms + //Module histograms fhEMod = new TH1F*[fNModules]; fhNClustersMod = new TH1F*[fNModules]; fhNCellsPerClusterMod = new TH2F*[fNModules]; @@ -647,14 +644,14 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhAmplitudeMod = new TH1F*[fNModules]; if(fCalorimeter=="EMCAL") fhAmplitudeModFraction = new TH1F*[fNModules*3]; - + fhTimeAmpPerRCU = new TH2F*[fNModules*fNRCU]; - //fhT0TimeAmpPerRCU = new TH2F*[fNModules*fNRCU]; - //fhTimeCorrRCU = new TH2F*[fNModules*fNRCU*fNModules*fNRCU]; + //fhT0TimeAmpPerRCU = new TH2F*[fNModules*fNRCU]; + //fhTimeCorrRCU = new TH2F*[fNModules*fNRCU*fNModules*fNRCU]; fhIMMod = new TH2F*[fNModules]; fhIMCellCutMod = new TH2F*[fNModules]; - + for(Int_t imod = 0; imod < fNModules; imod++){ fhEMod[imod] = new TH1F (Form("hE_Mod%d",imod),Form("Cluster reconstructed Energy in Module %d ",imod), nptbins,ptmin,ptmax); @@ -666,8 +663,8 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhNClustersMod[imod]); fhNCellsPerClusterMod[imod] = new TH2F (Form("hNCellsPerCluster_Mod%d",imod), - Form("# cells per cluster vs cluster energy in Module %d",imod), - nptbins,ptmin,ptmax, nbins,nmin,nmax); + Form("# cells per cluster vs cluster energy in Module %d",imod), + nptbins,ptmin,ptmax, nbins,nmin,nmax); fhNCellsPerClusterMod[imod]->SetXTitle("E (GeV)"); fhNCellsPerClusterMod[imod]->SetYTitle("n cells"); outputContainer->Add(fhNCellsPerClusterMod[imod]); @@ -676,19 +673,19 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhNCellsMod[imod]->SetXTitle("n cells"); outputContainer->Add(fhNCellsMod[imod]); fhGridCellsMod[imod] = new TH2F (Form("hGridCells_Mod%d",imod),Form("Entries in grid of cells in Module %d",imod), - colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); + colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); fhGridCellsMod[imod]->SetYTitle("row (phi direction)"); fhGridCellsMod[imod]->SetXTitle("column (eta direction)"); outputContainer->Add(fhGridCellsMod[imod]); - + fhGridCellsEMod[imod] = new TH2F (Form("hGridCellsE_Mod%d",imod),Form("Accumulated energy in grid of cells in Module %d",imod), - colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); + colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); fhGridCellsEMod[imod]->SetYTitle("row (phi direction)"); fhGridCellsEMod[imod]->SetXTitle("column (eta direction)"); outputContainer->Add(fhGridCellsEMod[imod]); fhGridCellsTimeMod[imod] = new TH2F (Form("hGridCellsTime_Mod%d",imod),Form("Accumulated time in grid of cells in Module %d, with E > 0.5 GeV",imod), - colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); + colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); fhGridCellsTimeMod[imod]->SetYTitle("row (phi direction)"); fhGridCellsTimeMod[imod]->SetXTitle("column (eta direction)"); outputContainer->Add(fhGridCellsTimeMod[imod]); @@ -707,45 +704,45 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() } for(Int_t ircu = 0; ircu < fNRCU; ircu++){ - fhTimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hTimeAmp_Mod%d_RCU%d",imod,ircu), - Form("Cell Energy vs Cell Time in Module %d, RCU %d ",imod,ircu), - nptbins,ptmin,ptmax,ntimebins,timemin,timemax); - fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)"); - fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("time (ns)"); - outputContainer->Add(fhTimeAmpPerRCU[imod*fNRCU+ircu]); + fhTimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hTimeAmp_Mod%d_RCU%d",imod,ircu), + Form("Cell Energy vs Cell Time in Module %d, RCU %d ",imod,ircu), + nptbins,ptmin,ptmax,ntimebins,timemin,timemax); + fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)"); + fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("time (ns)"); + outputContainer->Add(fhTimeAmpPerRCU[imod*fNRCU+ircu]); -// fhT0TimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hT0TimeAmp_Mod%d_RCU%d",imod,ircu), -// Form("Cell Energy vs T0-Cell Time in Module %d, RCU %d ",imod,ircu), -// nptbins,ptmin,ptmax,ntimebins,timemin,timemax); -// fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)"); -// fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("T_{0} - T_{EMCal} (ns)"); -// outputContainer->Add(fhT0TimeAmpPerRCU[imod*fNRCU+ircu]); -// + // fhT0TimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hT0TimeAmp_Mod%d_RCU%d",imod,ircu), + // Form("Cell Energy vs T0-Cell Time in Module %d, RCU %d ",imod,ircu), + // nptbins,ptmin,ptmax,ntimebins,timemin,timemax); + // fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)"); + // fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("T_{0} - T_{EMCal} (ns)"); + // outputContainer->Add(fhT0TimeAmpPerRCU[imod*fNRCU+ircu]); + // -// for(Int_t imod2 = 0; imod2 < fNModules; imod2++){ -// for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){ -// Int_t index = (imod2*fNRCU+ircu2)+(fNModules*fNRCU)*(ircu+imod)+fNRCU*fNModules*imod; -// fhTimeCorrRCU[index] = new TH2F (Form("hTimeCorrRCU_Mod%d_RCU%d_CompareTo_Mod%d_RCU%d",imod, ircu,imod2, ircu2), -// Form("Cell Energy > 0.3, Correlate cell Time in Module %d, RCU %d to Module %d, RCU %d",imod,ircu,imod2, ircu2), -// ntimebins,timemin,timemax,ntimebins,timemin,timemax); -// fhTimeCorrRCU[index]->SetXTitle("Trigger Cell Time (ns)"); -// fhTimeCorrRCU[index]->SetYTitle("Cell Time (ns)"); -// outputContainer->Add(fhTimeCorrRCU[index]); -// } -// } + // for(Int_t imod2 = 0; imod2 < fNModules; imod2++){ + // for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){ + // Int_t index = (imod2*fNRCU+ircu2)+(fNModules*fNRCU)*(ircu+imod)+fNRCU*fNModules*imod; + // fhTimeCorrRCU[index] = new TH2F (Form("hTimeCorrRCU_Mod%d_RCU%d_CompareTo_Mod%d_RCU%d",imod, ircu,imod2, ircu2), + // Form("Cell Energy > 0.3, Correlate cell Time in Module %d, RCU %d to Module %d, RCU %d",imod,ircu,imod2, ircu2), + // ntimebins,timemin,timemax,ntimebins,timemin,timemax); + // fhTimeCorrRCU[index]->SetXTitle("Trigger Cell Time (ns)"); + // fhTimeCorrRCU[index]->SetYTitle("Cell Time (ns)"); + // outputContainer->Add(fhTimeCorrRCU[index]); + // } + // } } fhIMMod[imod] = new TH2F (Form("hIM_Mod%d",imod), - Form("Cluster pairs Invariant mass vs reconstructed pair energy in Module %d",imod), - nptbins,ptmin,ptmax,nmassbins,massmin,massmax); + Form("Cluster pairs Invariant mass vs reconstructed pair energy in Module %d",imod), + nptbins,ptmin,ptmax,nmassbins,massmin,massmax); fhIMMod[imod]->SetXTitle("p_{T, cluster pairs} (GeV) "); fhIMMod[imod]->SetYTitle("M_{cluster pairs} (GeV/c^{2})"); outputContainer->Add(fhIMMod[imod]); - + fhIMCellCutMod[imod] = new TH2F (Form("hIMCellCut_Mod%d",imod), - Form("Cluster (n cells > 1) pairs Invariant mass vs reconstructed pair energy in Module %d",imod), - nptbins,ptmin,ptmax,nmassbins,massmin,massmax); + Form("Cluster (n cells > 1) pairs Invariant mass vs reconstructed pair energy in Module %d",imod), + nptbins,ptmin,ptmax,nmassbins,massmin,massmax); fhIMCellCutMod[imod]->SetXTitle("p_{T, cluster pairs} (GeV) "); fhIMCellCutMod[imod]->SetYTitle("M_{cluster pairs} (GeV/c^{2})"); outputContainer->Add(fhIMCellCutMod[imod]); @@ -753,7 +750,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() } - //Monte Carlo Histograms + //Monte Carlo Histograms if(IsDataMC()){ fhDeltaE = new TH1F ("hDeltaE","MC - Reco E ", nptbins*2,-ptmax,ptmax); @@ -808,7 +805,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fh2Eta->SetYTitle("#eta_{gen} "); outputContainer->Add(fh2Eta); - //Fill histos depending on origin of cluster + //Fill histos depending on origin of cluster fhGamE = new TH2F ("hGamE","E reconstructed vs E generated from #gamma", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax); fhGamE->SetXTitle("E_{rec} (GeV)"); fhGamE->SetXTitle("E_{gen} (GeV)"); @@ -860,7 +857,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhGamRatioEta = new TH1F ("hGamRatioEta","#gamma Reco/MC #eta",nratiobins,ratiomin,ratiomax); fhGamRatioEta->SetXTitle("#eta_{reco}/#eta_{gen} "); outputContainer->Add(fhGamRatioEta); - + fhPi0E = new TH2F ("hPi0E","E reconstructed vs E generated from #pi^{0}", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax); fhPi0E->SetXTitle("E_{rec} (GeV)"); fhPi0E->SetYTitle("E_{gen} (GeV)"); @@ -941,7 +938,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhChHadEta->SetYTitle("#eta_{gen} "); outputContainer->Add(fhChHadEta); - //Charged clusters + //Charged clusters fhGamECharged = new TH2F ("hGamECharged","E reconstructed vs E generated from #gamma, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax); fhGamECharged->SetXTitle("E_{rec} (GeV)"); @@ -1044,18 +1041,18 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhChHadEtaCharged->SetYTitle("#eta_{gen} "); outputContainer->Add(fhChHadEtaCharged); - //Vertex of generated particles + //Vertex of generated particles fhEMVxyz = new TH2F ("hEMVxyz","Production vertex of reconstructed ElectroMagnetic particles",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500); fhEMVxyz->SetXTitle("v_{x}"); fhEMVxyz->SetYTitle("v_{y}"); - //fhEMVxyz->SetZTitle("v_{z}"); + //fhEMVxyz->SetZTitle("v_{z}"); outputContainer->Add(fhEMVxyz); fhHaVxyz = new TH2F ("hHaVxyz","Production vertex of reconstructed hadrons",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500); fhHaVxyz->SetXTitle("v_{x}"); fhHaVxyz->SetYTitle("v_{y}"); - //fhHaVxyz->SetZTitle("v_{z}"); + //fhHaVxyz->SetZTitle("v_{z}"); outputContainer->Add(fhHaVxyz); fhEMR = new TH2F ("hEMR","Distance to production vertex of reconstructed ElectroMagnetic particles vs E rec",nptbins,ptmin,ptmax,nvdistbins,vdistmin,vdistmax); @@ -1068,9 +1065,9 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhHaR->SetYTitle("TMath::Sqrt(v_{x}^{2}+v_{y}^{2})"); outputContainer->Add(fhHaR); - + - //Pure MC + //Pure MC fhGenGamPt = new TH1F("hGenGamPt" ,"p_{T} of generated #gamma",nptbins,ptmin,ptmax); fhGenGamEta = new TH1F("hGenGamEta","Y of generated #gamma",netabins,etamin,etamax); fhGenGamPhi = new TH1F("hGenGamPhi","#phi of generated #gamma",nphibins,phimin,phimax); @@ -1097,7 +1094,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhGenGamPt); outputContainer->Add(fhGenGamEta); outputContainer->Add(fhGenGamPhi); - + fhGenPi0Pt->SetXTitle("p_{T} (GeV/c)"); fhGenPi0Eta->SetXTitle("#eta"); fhGenPi0Phi->SetXTitle("#phi (rad)"); @@ -1111,7 +1108,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhGenEtaPt); outputContainer->Add(fhGenEtaEta); outputContainer->Add(fhGenEtaPhi); - + fhGenOmegaPt->SetXTitle("p_{T} (GeV/c)"); fhGenOmegaEta->SetXTitle("#eta"); fhGenOmegaPhi->SetXTitle("#phi (rad)"); @@ -1154,7 +1151,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() outputContainer->Add(fhGenPi0AccEta); outputContainer->Add(fhGenPi0AccPhi); - //Track Matching + //Track Matching fhMCEle1pOverE = new TH2F("hMCEle1pOverE","TRACK matches p/E, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax); fhMCEle1pOverE->SetYTitle("p/E"); @@ -1197,7 +1194,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhMCNeutral2MatchdEdx->SetXTitle("p (GeV/c)"); fhMCNeutral2MatchdEdx->SetYTitle(""); outputContainer->Add(fhMCNeutral2MatchdEdx); - + fhMCEle1pOverER02 = new TH2F("hMCEle1pOverER02","TRACK matches p/E, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax); fhMCEle1pOverER02->SetYTitle("p/E"); fhMCEle1pOverER02->SetXTitle("p_{T} (GeV/c)"); @@ -1213,25 +1210,25 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects() fhMCNeutral1pOverER02->SetXTitle("p_{T} (GeV/c)"); outputContainer->Add(fhMCNeutral1pOverER02); } - + return outputContainer; } -//_______________________________________________________________________________________________________________________________________ + //_______________________________________________________________________________________________________________________________________ Int_t AliAnaCalorimeterQA::GetNewRebinForRePlotting(TH1D* histo, const Float_t newXmin, const Float_t newXmax,const Int_t newXnbins) const { - //Calculate the rebinning for the new requested bin size, only used when replotting executing the Terminte + //Calculate the rebinning for the new requested bin size, only used when replotting executing the Terminte Float_t oldbinsize = histo->GetBinWidth(0); Float_t newbinsize = TMath::Abs(newXmax-newXmin) / newXnbins; - //printf("bin size, old %f, new %f\n",oldbinsize,newbinsize); + //printf("bin size, old %f, new %f\n",oldbinsize,newbinsize); if(newbinsize > oldbinsize) return (Int_t) (newbinsize/oldbinsize); else return 1; } -//__________________________________________________ + //__________________________________________________ void AliAnaCalorimeterQA::Init() { - //Check if the data or settings are ok + //Check if the data or settings are ok if(fCalorimeter != "PHOS" && fCalorimeter !="EMCAL"){ printf("AliAnaCalorimeterQA::Init() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data()); abort(); @@ -1245,12 +1242,12 @@ void AliAnaCalorimeterQA::Init() } -//__________________________________________________ + //__________________________________________________ void AliAnaCalorimeterQA::InitParameters() { - //Initialize the parameters of the analysis. + //Initialize the parameters of the analysis. AddToHistogramsName("AnaCaloQA_"); - + fCalorimeter = "EMCAL"; //or PHOS fStyleMacro = "" ; fNModules = 12; // set maximum to maximum number of EMCAL modules @@ -1273,16 +1270,16 @@ void AliAnaCalorimeterQA::InitParameters() } -//__________________________________________________________________ + //__________________________________________________________________ void AliAnaCalorimeterQA::Print(const Option_t * opt) const { - //Print some relevant parameters set for the analysis + //Print some relevant parameters set for the analysis if(! opt) return; printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; AliAnaPartCorrBaseClass::Print(" "); - + printf("Select Calorimeter %s \n",fCalorimeter.Data()); printf("Make plots? %d \n",fMakePlots); printf("Plots style macro %s \n",fStyleMacro.Data()); @@ -1298,13 +1295,13 @@ void AliAnaCalorimeterQA::Print(const Option_t * opt) const printf("Histograms: %d < N < %d, Nbin = %d\n" , fHistoNMin, fHistoNMax, fHistoNBins); printf("Histograms: %3.1f < Ratio< %3.1f, Nbin = %d\n", fHistoRatioMin, fHistoRatioMax, fHistoRatioBins); printf("Histograms: %3.1f < Vertex Distance < %3.1f, Nbin = %d\n", fHistoVertexDistMin, fHistoVertexDistMax, fHistoVertexDistBins); - + } -//__________________________________________________________________ + //__________________________________________________________________ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() { - //Fill Calorimeter QA histograms + //Fill Calorimeter QA histograms TLorentzVector mom ; TLorentzVector mom2 ; TRefArray * caloClusters = new TRefArray(); @@ -1315,39 +1312,39 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() Int_t nTracksMatched = 0; Int_t trackIndex = 0; Int_t nModule = -1; - - //Play with the MC stack if available - //Get the MC arrays and do some checks + + //Play with the MC stack if available + //Get the MC arrays and do some checks if(IsDataMC()){ if(GetReader()->ReadStack()){ - + if(!GetMCStack()) { printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n"); abort(); } - //Fill some pure MC histograms, only primaries. + //Fill some pure MC histograms, only primaries. for(Int_t i=0 ; iGetNprimary(); i++){//Only primary particles, for all MC transport put GetNtrack() TParticle *primary = GetMCStack()->Particle(i) ; - //printf("i %d, %s: status = %d, primary? %d\n",i, primary->GetName(), primary->GetStatusCode(), primary->IsPrimary()); + //printf("i %d, %s: status = %d, primary? %d\n",i, primary->GetName(), primary->GetStatusCode(), primary->IsPrimary()); if (primary->GetStatusCode() > 11) continue; //Working for PYTHIA and simple generators, check for HERWIG primary->Momentum(mom); MCHistograms(mom,TMath::Abs(primary->GetPdgCode())); } //primary loop } else if(GetReader()->ReadAODMCParticles()){ - + if(!GetReader()->GetAODMCParticles(0)) { printf("AliAnaPhoton::MakeAnalysisFillHistograms() - AODMCParticles not available!\n"); abort(); } - //Fill some pure MC histograms, only primaries. + //Fill some pure MC histograms, only primaries. for(Int_t i=0 ; i < (GetReader()->GetAODMCParticles(0))->GetEntriesFast(); i++){ AliAODMCParticle *aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(i) ; - //printf("i %d, %s: primary? %d physical primary? %d, flag %d\n", - // i,(TDatabasePDG::Instance()->GetParticle(aodprimary->GetPdgCode()))->GetName(), - // aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), aodprimary->GetFlag()); + //printf("i %d, %s: primary? %d physical primary? %d, flag %d\n", + // i,(TDatabasePDG::Instance()->GetParticle(aodprimary->GetPdgCode()))->GetName(), + // aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), aodprimary->GetFlag()); if (!aodprimary->IsPrimary()) continue; //accept all which is not MC transport generated. Don't know how to avoid partons - //aodprimary->Momentum(mom); + //aodprimary->Momentum(mom); mom.SetPxPyPzE(aodprimary->Px(),aodprimary->Py(),aodprimary->Pz(),aodprimary->E()); MCHistograms(mom,TMath::Abs(aodprimary->GetPdgCode())); } //primary loop @@ -1356,39 +1353,25 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() }// is data and MC - //Get List with CaloClusters + //Get List with CaloClusters - if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { - if (fCalorimeter == "EMCAL") ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALClusters(caloClusters);//GetAODEMCAL(); - else if(fCalorimeter == "PHOS") ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSClusters (caloClusters);//GetAODPHOS(); - else { - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data()); - abort(); - } - } - else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD) { - if (fCalorimeter == "EMCAL") ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALClusters(caloClusters);//GetAODEMCAL(); - else if(fCalorimeter == "PHOS") ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSClusters (caloClusters);//GetAODPHOS(); - else { - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data()); - abort(); - } - } + if (fCalorimeter == "EMCAL") GetReader()->GetInputEvent()->GetEMCALClusters(caloClusters);//GetAODEMCAL(); + else if(fCalorimeter == "PHOS") GetReader()->GetInputEvent()->GetPHOSClusters (caloClusters);//GetAODPHOS(); + else + AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data())); - if(!caloClusters) { - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters available\n"); - abort(); - } + if(!caloClusters) + AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters available\n")); - //---------------------------------------------------------- - //Correlate Calorimeters - //---------------------------------------------------------- + //---------------------------------------------------------- + //Correlate Calorimeters + //---------------------------------------------------------- if(fCorrelateCalos) CorrelateCalorimeters(caloClusters); - + - //---------------------------------------------------------- - // CALOCLUSTERS - //---------------------------------------------------------- + //---------------------------------------------------------- + // CALOCLUSTERS + //---------------------------------------------------------- nCaloClusters = caloClusters->GetEntriesFast() ; fhNClusters->Fill(nCaloClusters); @@ -1398,92 +1381,90 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() if(GetDebug() > 0) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In %s there are %d clusters \n", fCalorimeter.Data(), nCaloClusters); - //Get vertex for photon momentum calculation + //Get vertex for photon momentum calculation Double_t v[3] = {0,0,0}; //vertex ; GetReader()->GetVertex(v); - TObject * track = 0x0; + AliVTrack * track = 0x0; Float_t pos[3] ; Float_t showerShape[3] ; Double_t tof = 0; - //Loop over CaloClusters - //if(nCaloClusters > 0)printf("QA : Vertex Cut passed %f, cut %f, entries %d, %s\n",v[2], 40., nCaloClusters, fCalorimeter.Data()); + //Loop over CaloClusters + //if(nCaloClusters > 0)printf("QA : Vertex Cut passed %f, cut %f, entries %d, %s\n",v[2], 40., nCaloClusters, fCalorimeter.Data()); for(Int_t iclus = 0; iclus < nCaloClusters; iclus++){ if(GetDebug() > 0) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - cluster: %d/%d, data %d \n", - iclus+1,nCaloClusters,GetReader()->GetDataType()); + iclus+1,nCaloClusters,GetReader()->GetDataType()); if(GetReader()->GetDataType()==AliCaloTrackReader::kESD){ - AliESDCaloCluster* clus = (AliESDCaloCluster*) (caloClusters->At(iclus)); - AliESDCaloCells * cell = 0x0; - if(fCalorimeter == "PHOS") cell = ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - else cell = ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); + AliVCluster* clus = (AliVCluster*)caloClusters->At(iclus); + AliVCaloCells * cell = 0x0; + if(fCalorimeter == "PHOS") cell = GetReader()->GetInputEvent()->GetPHOSCells(); + else cell = GetReader()->GetInputEvent()->GetEMCALCells(); - //Check if the cluster contains any bad channel or it is close to the calorimeter borders + //Check if the cluster contains any bad channel or it is close to the calorimeter borders if( GetCaloUtils()->ClusterContainsBadChannel(fCalorimeter,clus->GetCellsAbsId(), clus->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus, cell)) continue; - //Recalibrate the cluster energy + if(!GetCaloUtils()->CheckCellFiducialRegion(clus, cell, GetReader()->GetInputEvent(), 0)) continue; + //Recalibrate the cluster energy if( GetCaloUtils()->IsRecalibrationOn()) { Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, cell); clus->SetE(energy); } - //Get cluster kinematics + //Get cluster kinematics clus->GetPosition(pos); clus->GetMomentum(mom,v); tof = clus->GetTOF()*1e9; if(tof < fTimeCutMin || tof > fTimeCutMax) continue; - //Check only certain regions + //Check only certain regions Bool_t in = kTRUE; if(IsFiducialCutOn()) in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ; if(!in) continue; - //Get module of cluster + //Get module of cluster nModule = GetModuleNumber(clus); if(nModule < fNModules) nClustersInModule[nModule]++; - //MC labels + //MC labels nLabel = clus->GetNLabels(); - //labels = clus->GetLabels(); - if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); - //Cells per cluster + labels = clus->GetLabels(); + //Cells per cluster nCaloCellsPerCluster = clus->GetNCells(); - //if(mom.E() > 10 && nCaloCellsPerCluster == 1 ) printf("%s:************** E = %f ********** ncells = %d\n",fCalorimeter.Data(), mom.E(),nCaloCellsPerCluster); - //matched cluster with tracks + //if(mom.E() > 10 && nCaloCellsPerCluster == 1 ) printf("%s:************** E = %f ********** ncells = %d\n",fCalorimeter.Data(), mom.E(),nCaloCellsPerCluster); + //matched cluster with tracks nTracksMatched = clus->GetNTracksMatched(); - trackIndex = clus->GetTrackMatched(); + trackIndex = clus->GetTrackMatchedIndex(); if(trackIndex >= 0){ - track = (AliESDtrack*) ((AliESDEvent*)GetReader()->GetInputEvent())->GetTrack(trackIndex); + track = (AliVTrack*)GetReader()->GetInputEvent()->GetTrack(trackIndex); } else{ if(nTracksMatched == 1) nTracksMatched = 0; track = 0; } - //Shower shape parameters + //Shower shape parameters showerShape[0] = clus->GetM20(); showerShape[1] = clus->GetM02(); - //showerShape[2] = clus->GetDispersion(); - showerShape[2] = clus->GetClusterDisp(); - - //====================== - //Cells in cluster - //====================== - - //Get list of contributors + showerShape[2] = clus->GetDispersion(); + + //====================== + //Cells in cluster + //====================== + + //Get list of contributors UShort_t * indexList = clus->GetCellsAbsId() ; - // check time of cells respect to max energy cell - //Get maximum energy cell + // check time of cells respect to max energy cell + //Get maximum energy cell Float_t emax = -1; Double_t tmax = -1; Int_t imax = -1; Int_t absId = -1 ; - //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster); - //Loop on cluster cells + //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster); + //Loop on cluster cells for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) { - // printf("Index %d\n",ipos); + // printf("Index %d\n",ipos); absId = indexList[ipos]; - //Get position of cell compare to cluster + //Get position of cell compare to cluster if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ Double_t cellpos[] = {0, 0, 0}; @@ -1501,21 +1482,21 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]); fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; fhDeltaCellClusterRE ->Fill(r-rcell, mom.E()) ; - -// Float_t celleta = 0, cellphi = 0; -// GetEMCALGeometry()->EtaPhiFromIndex(absId, celleta, cellphi); -// Int_t imod = -1, iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1; -// GetEMCALGeometry()->GetCellIndex(absId,imod,iTower,iIphi,iIeta); -// GetEMCALGeometry()->GetCellPhiEtaIndexInSModule(imod,iTower, -// iIphi, iIeta,iphi,ieta); -// printf("AbsId %d, SM %d, Index eta %d, phi %d\n", absId, imod, ieta, iphi); -// printf("Cluster E %f, eta %f, phi %f; Cell: Amp %f, eta %f, phi%f\n", mom.E(),mom.Eta(), mom.Phi()*TMath::RadToDeg(), cell->GetCellAmplitude(absId),celleta, cellphi*TMath::RadToDeg()); -// printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]); -// printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]); -// printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]); -// printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell); -// - + + // Float_t celleta = 0, cellphi = 0; + // GetEMCALGeometry()->EtaPhiFromIndex(absId, celleta, cellphi); + // Int_t imod = -1, iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1; + // GetEMCALGeometry()->GetCellIndex(absId,imod,iTower,iIphi,iIeta); + // GetEMCALGeometry()->GetCellPhiEtaIndexInSModule(imod,iTower, + // iIphi, iIeta,iphi,ieta); + // printf("AbsId %d, SM %d, Index eta %d, phi %d\n", absId, imod, ieta, iphi); + // printf("Cluster E %f, eta %f, phi %f; Cell: Amp %f, eta %f, phi%f\n", mom.E(),mom.Eta(), mom.Phi()*TMath::RadToDeg(), cell->GetCellAmplitude(absId),celleta, cellphi*TMath::RadToDeg()); + // printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]); + // printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]); + // printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]); + // printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell); + // + }//EMCAL and its matrices are available else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){ TVector3 xyz; @@ -1540,22 +1521,22 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; fhDeltaCellClusterRE ->Fill(r-rcell, mom.E()) ; -// printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]); -// printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]); -// printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]); -// printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell); + // printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]); + // printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]); + // printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]); + // printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell); }//PHOS and its matrices are available - - //Find maximum energy cluster + + //Find maximum energy cluster if(cell->GetCellAmplitude(absId) > emax) { imax = ipos; emax = cell->GetCellAmplitude(absId); tmax = cell->GetCellTime(absId); } - + }// cluster cell loop - // check time of cells respect to max energy cell + // check time of cells respect to max energy cell if(nCaloCellsPerCluster > 1){ for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) { if(imax == ipos) continue; @@ -1566,212 +1547,72 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() }// fill cell-cluster histogram loop }//check time of cells respect to max energy cell - - - }//ESDs - else{ - AliAODCaloCluster* clus = (AliAODCaloCluster*) (caloClusters->At(iclus)); - AliAODCaloCells * cell = 0x0; - if(fCalorimeter == "PHOS") cell = ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - else cell = ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - - //Check if the cluster contains any bad channel or it is close to calorimeter borders - if( GetCaloUtils()->ClusterContainsBadChannel(fCalorimeter,clus->GetCellsAbsId(), clus->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus, cell)) continue; - //Recalibrate the cluster energy - if( GetCaloUtils()->IsRecalibrationOn()) { - Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, cell); - clus->SetE(energy); - } - - //Get cluster kinematics - clus->GetPosition(pos); - clus->GetMomentum(mom,v); - tof = clus->GetTOF()*1e9; - if(tof < fTimeCutMin || tof > fTimeCutMax) continue; - - //Check only certain regions - Bool_t in = kTRUE; - if(IsFiducialCutOn()) in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ; - if(!in) continue; - //Get module of cluster - nModule = GetModuleNumber(clus); - if(nModule < fNModules) nClustersInModule[nModule]++; - //MC labels - nLabel = clus->GetNLabel(); - //labels = clus->GetLabels(); - if(clus->GetLabels()) labels = clus->GetLabels(); - //Cells per cluster - nCaloCellsPerCluster = clus->GetNCells(); - //matched cluster with tracks - nTracksMatched = clus->GetNTracksMatched(); - if(nTracksMatched > 0) - track = (AliAODTrack*)clus->GetTrackMatched(0); - - //Shower shape parameters - showerShape[0] = clus->GetM20(); - showerShape[1] = clus->GetM02(); - showerShape[2] = clus->GetDispersion(); - - //====================== - //Cells in cluster - //====================== - - //Get list of contributors - UShort_t * indexList = clus->GetCellsAbsId() ; - Int_t absId = -1 ; - //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster); - //Loop on cluster cells - for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) { - // printf("Index %d\n",ipos); - absId = indexList[ipos]; - - //Get position of cell compare to cluster - if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ - - Double_t cellpos[] = {0, 0, 0}; - GetEMCALGeometry()->GetGlobal(absId, cellpos); - - fhDeltaCellClusterXNCells->Fill(pos[0]-cellpos[0],nCaloCellsPerCluster) ; - fhDeltaCellClusterYNCells->Fill(pos[1]-cellpos[1],nCaloCellsPerCluster) ; - fhDeltaCellClusterZNCells->Fill(pos[2]-cellpos[2],nCaloCellsPerCluster) ; - - fhDeltaCellClusterXE->Fill(pos[0]-cellpos[0],mom.E()) ; - fhDeltaCellClusterYE->Fill(pos[1]-cellpos[1],mom.E()) ; - fhDeltaCellClusterZE->Fill(pos[2]-cellpos[2],mom.E()) ; - - Float_t r = TMath::Sqrt(pos[0]*pos[0] +pos[1]*pos[1]);// +pos[2]*pos[2]); - Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]); - fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; - fhDeltaCellClusterRE ->Fill(r-rcell, mom.E()) ; - -// printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]); -// printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]); -// printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]); -// printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell); - - }// EMCAL and its matrices are available - else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){ - TVector3 xyz; - Int_t relId[4], module; - Float_t xCell, zCell; - - GetPHOSGeometry()->AbsToRelNumbering(absId,relId); - module = relId[0]; - GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell); - GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz); - - fhDeltaCellClusterXNCells->Fill(pos[0]-xyz.X(),nCaloCellsPerCluster) ; - fhDeltaCellClusterYNCells->Fill(pos[1]-xyz.Y(),nCaloCellsPerCluster) ; - fhDeltaCellClusterZNCells->Fill(pos[2]-xyz.Z(),nCaloCellsPerCluster) ; - - fhDeltaCellClusterXE->Fill(pos[0]-xyz.X(),mom.E()) ; - fhDeltaCellClusterYE->Fill(pos[1]-xyz.Y(),mom.E()) ; - fhDeltaCellClusterZE->Fill(pos[2]-xyz.Z(),mom.E()) ; - - Float_t r = TMath::Sqrt(pos[0]*pos[0] +pos[1]*pos[1]);// +pos[2]*pos[2]); - Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y());//+xyz.Z()*xyz.Z()); - fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; - fhDeltaCellClusterRE ->Fill(r-rcell, mom.E()) ; - -// printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]); -// printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]); -// printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]); -// printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell); - - } //PHOS and its matrices are available - }// cluster cell loop - - }//AODs - - //----------------------------------------------------------- - //Fill histograms related to single cluster or track matching - //----------------------------------------------------------- - - ClusterHistograms(mom, tof, pos, showerShape, nCaloCellsPerCluster, nModule, nTracksMatched, track, labels, nLabel); - - - //----------------------------------------------------------- - //Invariant mass - //----------------------------------------------------------- - if(GetDebug()>1) printf("Invariant mass \n"); - - //do not do for bad vertex - Float_t fZvtxCut = 40. ; - if(v[2]<-fZvtxCut || v[2]> fZvtxCut) continue ; //Event can not be used (vertex, centrality,... cuts not fulfilled) - - Int_t nModule2 = -1; - Int_t nCaloCellsPerCluster2=0; - if (nCaloClusters > 1 ) { - for(Int_t jclus = iclus + 1 ; jclus < nCaloClusters ; jclus++) { - if(GetReader()->GetDataType()==AliCaloTrackReader::kESD){ - AliESDCaloCluster* clus2 = (AliESDCaloCluster*) (caloClusters->At(jclus)); - AliESDCaloCells * cell2 = 0x0; - if(fCalorimeter == "PHOS") cell2 = ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - else cell2 = ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - //Check if the cluster contains any bad channel or it is close to calorimeter borders + + //----------------------------------------------------------- + //Fill histograms related to single cluster or track matching + //----------------------------------------------------------- + + ClusterHistograms(mom, tof, pos, showerShape, nCaloCellsPerCluster, nModule, nTracksMatched, track, labels, nLabel); + + + //----------------------------------------------------------- + //Invariant mass + //----------------------------------------------------------- + if(GetDebug()>1) printf("Invariant mass \n"); + + //do not do for bad vertex + Float_t fZvtxCut = 40. ; + if(v[2]<-fZvtxCut || v[2]> fZvtxCut) continue ; //Event can not be used (vertex, centrality,... cuts not fulfilled) + + Int_t nModule2 = -1; + Int_t nCaloCellsPerCluster2=0; + if (nCaloClusters > 1 ) { + for(Int_t jclus = iclus + 1 ; jclus < nCaloClusters ; jclus++) { + AliVCluster* clus2 = (AliVCluster*)caloClusters->At(jclus); + AliVCaloCells * cell2 = 0x0; + if(fCalorimeter == "PHOS") cell2 = GetReader()->GetInputEvent()->GetPHOSCells(); + else cell2 = GetReader()->GetInputEvent()->GetEMCALCells(); + //Check if the cluster contains any bad channel or it is close to calorimeter borders if( GetCaloUtils()->ClusterContainsBadChannel(fCalorimeter,clus2->GetCellsAbsId(), clus2->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus2, cell2)) continue; - - //Get cluster kinematics + if(!GetCaloUtils()->CheckCellFiducialRegion(clus2, cell2, GetReader()->GetInputEvent(), 0)) continue; + + //Get cluster kinematics clus2->GetMomentum(mom2,v); - //Check only certain regions + //Check only certain regions Bool_t in2 = kTRUE; if(IsFiducialCutOn()) in2 = GetFiducialCut()->IsInFiducialCut(mom2,fCalorimeter) ; if(!in2) continue; - //Get module of cluster - nModule2 = GetModuleNumber(clus2); - //Cells per cluster - nCaloCellsPerCluster2 = clus2->GetNCells(); - - } - else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD){ - AliAODCaloCluster* clus2 = (AliAODCaloCluster*) (caloClusters->At(jclus)); - AliAODCaloCells * cell2 = 0x0; - if(fCalorimeter == "PHOS") cell2 = ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - else cell2 = ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - //Check if the cluster contains any bad channel or it is close to calorimeter borders - if( GetCaloUtils()->ClusterContainsBadChannel(fCalorimeter,clus2->GetCellsAbsId(), clus2->GetNCells())) continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus2, cell2)) continue; - - //Get cluster kinematics - clus2->GetMomentum(mom2,v); - //Check only certain regions - Bool_t in2 = kTRUE; - if(IsFiducialCutOn()) in2 = GetFiducialCut()->IsInFiducialCut(mom2,fCalorimeter) ; - if(!in2) continue; - //Get module of cluster + //Get module of cluster nModule2 = GetModuleNumber(clus2); - //Cells per cluster + //Cells per cluster nCaloCellsPerCluster2 = clus2->GetNCells(); - } - - //Fill invariant mass histograms - //All modules - - //printf("QA : Fill inv mass histo: pt1 %f, pt2 %f, pt12 %f, mass %f, calo %s \n",mom.Pt(),mom2.Pt(),(mom+mom2).Pt(),(mom+mom2).M(), fCalorimeter.Data()); + } + //Fill invariant mass histograms + //All modules + + //printf("QA : Fill inv mass histo: pt1 %f, pt2 %f, pt12 %f, mass %f, calo %s \n",mom.Pt(),mom2.Pt(),(mom+mom2).Pt(),(mom+mom2).M(), fCalorimeter.Data()); fhIM ->Fill((mom+mom2).Pt(),(mom+mom2).M()); - //Single module + //Single module if(nModule == nModule2 && nModule >=0 && nModule < fNModules) fhIMMod[nModule]->Fill((mom+mom2).Pt(),(mom+mom2).M()); - - //Select only clusters with at least 2 cells + + //Select only clusters with at least 2 cells if(nCaloCellsPerCluster > 1 && nCaloCellsPerCluster2 > 1) { - //All modules + //All modules fhIMCellCut ->Fill((mom+mom2).Pt(),(mom+mom2).M()); - //Single modules + //Single modules if(nModule == nModule2 && nModule >=0 && nModule < fNModules) fhIMCellCutMod[nModule]->Fill((mom+mom2).Pt(),(mom+mom2).M()); } - - //Asymetry histograms + + //Asymetry histograms fhAsym->Fill((mom+mom2).Pt(),TMath::Abs((mom.E()-mom2.E())/(mom.E()+mom2.E()))); - + }// 2nd cluster loop }////more than 1 cluster in calorimeter }//cluster loop - //Number of clusters per module + //Number of clusters per module for(Int_t imod = 0; imod < fNModules; imod++ ){ if(GetDebug() > 1) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - module %d calo %s clusters %d\n", imod, fCalorimeter.Data(), nClustersInModule[imod]); @@ -1779,10 +1620,10 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() } delete [] nClustersInModule; delete caloClusters; - - //---------------------------------------------------------- - // CALOCELLS - //---------------------------------------------------------- + + //---------------------------------------------------------- + // CALOCELLS + //---------------------------------------------------------- Int_t *nCellsInModule = new Int_t[fNModules]; for(Int_t imod = 0; imod < fNModules; imod++ ) nCellsInModule[imod] = 0; @@ -1794,251 +1635,155 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() Int_t id = -1; Float_t recalF = 1.; - if(GetReader()->GetDataType()==AliCaloTrackReader::kESD){ - AliESDCaloCells * cell = 0x0; - Int_t ncells = 0; - if(fCalorimeter == "PHOS") cell = ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - else cell = ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - - if(!cell) { - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - STOP: No %s ESD CELLS available for analysis\n",fCalorimeter.Data()); - abort(); - } - - ncells = cell->GetNumberOfCells() ; - fhNCells->Fill(ncells) ; - if(GetDebug() > 0) - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In ESD %s cell entries %d\n", fCalorimeter.Data(), ncells); - - for (Int_t iCell = 0; iCell < ncells; iCell++) { - if(GetDebug() > 2) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cell->GetAmplitude(iCell), cell->GetCellNumber(iCell)); - nModule = GetModuleNumberCellIndexes(cell->GetCellNumber(iCell),fCalorimeter, icol, irow, iRCU); - if(GetDebug() > 2) printf("\t module %d, column %d, row %d \n", nModule,icol,irow); - - if(nModule < fNModules) { + AliVCaloCells * cell = 0x0; + Int_t ncells = 0; + if(fCalorimeter == "PHOS") + cell = GetReader()->GetInputEvent()->GetPHOSCells(); + else + cell = GetReader()->GetInputEvent()->GetEMCALCells(); + + if(!cell) { + printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - STOP: No %s ESD CELLS available for analysis\n",fCalorimeter.Data()); + abort(); + } + + ncells = cell->GetNumberOfCells() ; + fhNCells->Fill(ncells) ; + if(GetDebug() > 0) + printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In ESD %s cell entries %d\n", fCalorimeter.Data(), ncells); + + for (Int_t iCell = 0; iCell < ncells; iCell++) { + if(GetDebug() > 2) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cell->GetAmplitude(iCell), cell->GetCellNumber(iCell)); + nModule = GetModuleNumberCellIndexes(cell->GetCellNumber(iCell),fCalorimeter, icol, irow, iRCU); + if(GetDebug() > 2) printf("\t module %d, column %d, row %d \n", nModule,icol,irow); + + if(nModule < fNModules) { //Check if the cell is a bad channel - if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn()){ - if(fCalorimeter=="EMCAL"){ - if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue; - } - else { - if(GetCaloUtils()->GetPHOSChannelStatus(nModule,icol,irow)) { - printf("PHOS bad channel\n"); - continue; - } - } - } - + if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn()){ + if(fCalorimeter=="EMCAL"){ + if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue; + } + else { + if(GetCaloUtils()->GetPHOSChannelStatus(nModule,icol,irow)) { + printf("PHOS bad channel\n"); + continue; + } + } + } + //Get Recalibration factor if set - if (GetCaloUtils()->IsRecalibrationOn()) { - if(fCalorimeter == "PHOS") recalF = GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow); - else recalF = GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow); - if(fCalorimeter == "PHOS")printf("Recalibration factor (sm,row,col)=(%d,%d,%d) - %f\n",nModule,icol,irow,recalF); - } - - amp = cell->GetAmplitude(iCell)*recalF; - time = cell->GetTime(iCell)*1e9;//transform time to ns - + if (GetCaloUtils()->IsRecalibrationOn()) { + if(fCalorimeter == "PHOS") recalF = GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow); + else recalF = GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow); + if(fCalorimeter == "PHOS")printf("Recalibration factor (sm,row,col)=(%d,%d,%d) - %f\n",nModule,icol,irow,recalF); + } + + amp = cell->GetAmplitude(iCell)*recalF; + time = cell->GetTime(iCell)*1e9;//transform time to ns + //if(amp > 3 && fCalorimeter=="EMCAL") printf("Amp = %f, time = %f, (mod, col, row)= (%d,%d,%d)\n", // amp,time,nModule,icol,irow); - - if(time < fTimeCutMin || time > fTimeCutMax) continue; - + + if(time < fTimeCutMin || time > fTimeCutMax) continue; + //printf("%s: time %g\n",fCalorimeter.Data(), time); - id = cell->GetCellNumber(iCell); - fhAmplitude->Fill(amp); - fhAmpId ->Fill(amp,id); - fhTime ->Fill(time); - fhTimeId ->Fill(time,id); - fhTimeAmp ->Fill(amp,time); - //Double_t t0 = ((AliESDEvent*)GetReader()->GetInputEvent())->GetT0(); + id = cell->GetCellNumber(iCell); + fhAmplitude->Fill(amp); + fhAmpId ->Fill(amp,id); + fhTime ->Fill(time); + fhTimeId ->Fill(time,id); + fhTimeAmp ->Fill(amp,time); + //Double_t t0 = GetReader()->GetInputEvent()->GetT0(); //printf("---->>> Time EMCal %e, T0 %e, T0 vertex %e, T0 clock %e, T0 trig %d \n",time,t0, - // ((AliESDEvent*)GetReader()->GetInputEvent())->GetT0zVertex(), - // ((AliESDEvent*)GetReader()->GetInputEvent())->GetT0clock(), - // ((AliESDEvent*)GetReader()->GetInputEvent())->GetT0Trig()); + // GetReader()->GetInputEvent()->GetT0zVertex(), + // GetReader()->GetInputEvent()->GetT0clock(), + // GetReader()->GetInputEvent()->GetT0Trig()); //fhT0Time ->Fill(time-t0); //fhT0TimeId ->Fill(time-t0,id); //fhT0TimeAmp ->Fill(amp,time-t0); - - fhAmplitudeMod[nModule]->Fill(amp); - if(fCalorimeter=="EMCAL"){ - Int_t ifrac = 0; - if(icol > 15 && icol < 32) ifrac = 1; - else if(icol > 31) ifrac = 2; - fhAmplitudeModFraction[nModule*3+ifrac]->Fill(amp); - - - } - - fhTimeAmpPerRCU [nModule*fNRCU+iRCU]->Fill(amp, time); + + fhAmplitudeMod[nModule]->Fill(amp); + if(fCalorimeter=="EMCAL"){ + Int_t ifrac = 0; + if(icol > 15 && icol < 32) ifrac = 1; + else if(icol > 31) ifrac = 2; + fhAmplitudeModFraction[nModule*3+ifrac]->Fill(amp); + + + } + + fhTimeAmpPerRCU [nModule*fNRCU+iRCU]->Fill(amp, time); //printf("id %d, nModule %d, iRCU %d: Histo Name %s\n",id, nModule,iRCU, fhTimeAmpPerRCU[nModule*fNRCU+iRCU]->GetName()); //fhT0TimeAmpPerRCU[nModule*fNRCU+iRCU]->Fill(amp, time-t0); - nCellsInModule[nModule]++; - fhGridCellsMod[nModule] ->Fill(icol,irow); - fhGridCellsEMod[nModule] ->Fill(icol,irow,amp); - if(amp > 0.3){ - fhGridCellsTimeMod[nModule]->Fill(icol,irow,time); - -// AliESDCaloCells * cell2 = 0x0; -// if(fCalorimeter == "PHOS") cell2 = ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); -// else cell2 = ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); -// Int_t icol2 = -1; -// Int_t irow2 = -1; -// Int_t iRCU2 = -1; -// Float_t amp2 = 0.; -// Float_t time2 = 0.; -// Int_t id2 = -1; -// Int_t nModule2 = -1; -// for (Int_t iCell2 = 0; iCell2 < ncells; iCell2++) { -// amp2 = cell2->GetAmplitude(iCell2); -// if(amp2 < 0.3) continue; -// if(iCell2 == iCell) continue; -// time2 = cell2->GetTime(iCell2)*1e9;//transform time to ns -// //printf("%s: time %g\n",fCalorimeter.Data(), time); -// id2 = cell2->GetCellNumber(iCell2); -// nModule2 = GetModuleNumberCellIndexes(cell2->GetCellNumber(iCell2), fCalorimeter, icol2, irow2, iRCU2); -// Int_t index = (nModule2*fNRCU+iRCU2)+(fNModules*fNRCU)*(iRCU+fNRCU*nModule); -// //printf("id %d, nModule %d, iRCU %d, id2 %d, nModule2 %d, iRCU2 %d, index %d: Histo Name %s\n",id, nModule,iRCU,cell2->GetCellNumber(iCell2),nModule2,iRCU2,index, fhTimeCorrRCU[index]->GetName()); -// fhTimeCorrRCU[index]->Fill(time,time2); -// -// }// second cell loop - }// amplitude cut - }//nmodules - - //Get Eta-Phi position of Cell - if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ - Float_t celleta = 0.; - Float_t cellphi = 0.; - GetEMCALGeometry()->EtaPhiFromIndex(id, celleta, cellphi); - fhEtaPhiAmp->Fill(celleta,cellphi,amp); - - Double_t cellpos[] = {0, 0, 0}; - GetEMCALGeometry()->GetGlobal(id, cellpos); - fhXCellE->Fill(cellpos[0],amp) ; - fhYCellE->Fill(cellpos[1],amp) ; - fhZCellE->Fill(cellpos[2],amp) ; - Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]); - fhRCellE->Fill(rcell,amp) ; - - fhXYZCell->Fill(cellpos[0],cellpos[1],cellpos[2]) ; - }//EMCAL Cells - else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){ - TVector3 xyz; - Int_t relId[4], module; - Float_t xCell, zCell; - - GetPHOSGeometry()->AbsToRelNumbering(id,relId); - module = relId[0]; - GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell); - GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz); - Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y()); - fhXCellE ->Fill(xyz.X(),amp) ; - fhYCellE ->Fill(xyz.Y(),amp) ; - fhZCellE ->Fill(xyz.Z(),amp) ; - fhRCellE ->Fill(rcell ,amp) ; - fhXYZCell->Fill(xyz.X(),xyz.Y(),xyz.Z()) ; - }//PHOS cells - - }//cell loop - }//ESD - else{//AOD - AliAODCaloCells * cell = 0x0; - Int_t ncells = 0; - - if(fCalorimeter == "PHOS") cell = ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - else cell = ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - - if(!cell) { - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - STOP: No %s AOD CELLS available for analysis\n",fCalorimeter.Data()); - //abort(); - return; - } - - ncells = cell->GetNumberOfCells() ; - fhNCells->Fill(ncells) ; - if(GetDebug() > 0) - printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In AOD %s cell entries %d\n", fCalorimeter.Data(), ncells); - - for (Int_t iCell = 0; iCell < ncells; iCell++) { - id = cell->GetCellNumber(iCell); - if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cell->GetAmplitude(iCell), id); - nModule = GetModuleNumberCellIndexes(id, fCalorimeter, icol, irow, iRCU); - if(GetDebug() > 2) printf("\t module %d, column %d, row %d \n", nModule,icol,irow); - - if(nModule < fNModules) { - //Check if the cell is a bad channel - if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn()){ - if(fCalorimeter=="EMCAL"){ - if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue; - } - else{ - if(GetCaloUtils()->GetPHOSChannelStatus(nModule,icol,irow)) continue; - } - } - - //Get Recalibration factor if set - if (GetCaloUtils()->IsRecalibrationOn()) { - if(fCalorimeter == "PHOS") recalF = GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow); - else recalF = GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow); - //printf("Recalibration factor (sm,row,col)=(%d,%d,%d) - %f\n",nModule,icol,irow,recalF); - } - - amp = cell->GetAmplitude(iCell)*recalF; - fhAmplitude->Fill(amp); - fhAmpId ->Fill(amp,id); - fhAmplitudeMod[nModule]->Fill(amp); - if(fCalorimeter=="EMCAL"){ - Int_t ifrac = 0; - if(icol > 15 && icol < 32) ifrac = 1; - else if(icol > 31) ifrac = 2; - fhAmplitudeModFraction[nModule*3+ifrac]->Fill(amp); - } - - fhTimeAmpPerRCU[nModule*fNRCU+iRCU]->Fill(amp, -1); - - nCellsInModule[nModule]++; - fhGridCellsMod[nModule] ->Fill(icol,irow); - fhGridCellsEMod[nModule]->Fill(icol,irow,amp); - - }//nmodules - + nCellsInModule[nModule]++; + fhGridCellsMod[nModule] ->Fill(icol,irow); + fhGridCellsEMod[nModule] ->Fill(icol,irow,amp); + if(amp > 0.3){ + fhGridCellsTimeMod[nModule]->Fill(icol,irow,time); + + // AliESDCaloCells * cell2 = 0x0; + // if(fCalorimeter == "PHOS") cell2 = GetReader()->GetInputEvent()->GetPHOSCells(); + // else cell2 = GetReader()->GetInputEvent()->GetEMCALCells(); + // Int_t icol2 = -1; + // Int_t irow2 = -1; + // Int_t iRCU2 = -1; + // Float_t amp2 = 0.; + // Float_t time2 = 0.; + // Int_t id2 = -1; + // Int_t nModule2 = -1; + // for (Int_t iCell2 = 0; iCell2 < ncells; iCell2++) { + // amp2 = cell2->GetAmplitude(iCell2); + // if(amp2 < 0.3) continue; + // if(iCell2 == iCell) continue; + // time2 = cell2->GetTime(iCell2)*1e9;//transform time to ns + // //printf("%s: time %g\n",fCalorimeter.Data(), time); + // id2 = cell2->GetCellNumber(iCell2); + // nModule2 = GetModuleNumberCellIndexes(cell2->GetCellNumber(iCell2), fCalorimeter, icol2, irow2, iRCU2); + // Int_t index = (nModule2*fNRCU+iRCU2)+(fNModules*fNRCU)*(iRCU+fNRCU*nModule); + // //printf("id %d, nModule %d, iRCU %d, id2 %d, nModule2 %d, iRCU2 %d, index %d: Histo Name %s\n",id, nModule,iRCU,cell2->GetCellNumber(iCell2),nModule2,iRCU2,index, fhTimeCorrRCU[index]->GetName()); + // fhTimeCorrRCU[index]->Fill(time,time2); + // + // }// second cell loop + }// amplitude cut + }//nmodules + //Get Eta-Phi position of Cell - if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ - Float_t celleta = 0.; - Float_t cellphi = 0.; - GetEMCALGeometry()->EtaPhiFromIndex(id, celleta, cellphi); - fhEtaPhiAmp->Fill(celleta,cellphi,amp); - - Double_t cellpos[] = {0, 0, 0}; - GetEMCALGeometry()->GetGlobal(id, cellpos); - fhXCellE->Fill(cellpos[0],amp) ; - fhYCellE->Fill(cellpos[1],amp) ; - fhZCellE->Fill(cellpos[2],amp) ; - Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]); - fhRCellE->Fill(rcell,amp) ; - - fhXYZCell->Fill(cellpos[0],cellpos[1],cellpos[2]) ; - }//EMCAL Cells - else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){ - TVector3 xyz; - Int_t relId[4], module; - Float_t xCell, zCell; - - GetPHOSGeometry()->AbsToRelNumbering(id,relId); - module = relId[0]; - GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell); - GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz); - Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y()); - fhXCellE ->Fill(xyz.X(),amp) ; - fhYCellE ->Fill(xyz.Y(),amp) ; - fhZCellE ->Fill(xyz.Z(),amp) ; - fhRCellE ->Fill(rcell ,amp) ; - fhXYZCell->Fill(xyz.X(),xyz.Y(),xyz.Z()) ; - }//PHOS Cells - }//cell loop - }//AOD - - //Number of cells per module + if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ + Float_t celleta = 0.; + Float_t cellphi = 0.; + GetEMCALGeometry()->EtaPhiFromIndex(id, celleta, cellphi); + fhEtaPhiAmp->Fill(celleta,cellphi,amp); + + Double_t cellpos[] = {0, 0, 0}; + GetEMCALGeometry()->GetGlobal(id, cellpos); + fhXCellE->Fill(cellpos[0],amp) ; + fhYCellE->Fill(cellpos[1],amp) ; + fhZCellE->Fill(cellpos[2],amp) ; + Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]); + fhRCellE->Fill(rcell,amp) ; + + fhXYZCell->Fill(cellpos[0],cellpos[1],cellpos[2]) ; + }//EMCAL Cells + else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){ + TVector3 xyz; + Int_t relId[4], module; + Float_t xCell, zCell; + + GetPHOSGeometry()->AbsToRelNumbering(id,relId); + module = relId[0]; + GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell); + GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz); + Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y()); + fhXCellE ->Fill(xyz.X(),amp) ; + fhYCellE ->Fill(xyz.Y(),amp) ; + fhZCellE ->Fill(xyz.Z(),amp) ; + fhRCellE ->Fill(rcell ,amp) ; + fhXYZCell->Fill(xyz.X(),xyz.Y(),xyz.Z()) ; + }//PHOS cells + + }//cell loop + + //Number of cells per module for(Int_t imod = 0; imod < fNModules; imod++ ) { if(GetDebug() > 1) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - module %d calo %s cells %d\n", imod, fCalorimeter.Data(), nCellsInModule[imod]); @@ -2051,16 +1796,16 @@ void AliAnaCalorimeterQA::MakeAnalysisFillHistograms() } -//__________________________________ + //__________________________________ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Double_t tof, Float_t *pos, Float_t *showerShape, - const Int_t nCaloCellsPerCluster,const Int_t nModule, - const Int_t nTracksMatched, const TObject * track, - const Int_t * labels, const Int_t nLabels){ - //Fill CaloCluster related histograms + const Int_t nCaloCellsPerCluster,const Int_t nModule, + const Int_t nTracksMatched, const AliVTrack * track, + const Int_t * labels, const Int_t nLabels){ + //Fill CaloCluster related histograms AliAODMCParticle * aodprimary = 0x0; TParticle * primary = 0x0; - Int_t tag = 0; + Int_t tag = 0; Float_t e = mom.E(); Float_t pt = mom.Pt(); @@ -2070,12 +1815,12 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub if(GetDebug() > 0) { printf("AliAnaCalorimeterQA::ClusterHistograms() - cluster: E %2.3f, pT %2.3f, eta %2.3f, phi %2.3f \n",e,pt,eta,phi*TMath::RadToDeg()); if(IsDataMC()) { - //printf("\t Primaries: nlabels %d, labels pointer %p\n",nLabels,labels); + //printf("\t Primaries: nlabels %d, labels pointer %p\n",nLabels,labels); printf("\t Primaries: nlabels %d\n",nLabels); if(!nLabels || !labels) printf("\t Strange, no labels!!!\n"); } } - + fhE ->Fill(e); if(nModule < fNModules) fhEMod[nModule]->Fill(e); fhPt ->Fill(pt); @@ -2090,11 +1835,11 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub fhRE ->Fill(rxyz,e); fhClusterTimeEnergy->Fill(e,tof); - //Shower shape parameters + //Shower shape parameters fhLambda->Fill(showerShape[0], showerShape[1], e); fhDispersion->Fill(showerShape[2],e); - - //Cells per cluster + + //Cells per cluster fhNCellsPerCluster ->Fill(e, nCaloCellsPerCluster,eta); fhNCellsPerClusterMIP->Fill(e, nCaloCellsPerCluster,eta); fhXNCells->Fill(pos[0],nCaloCellsPerCluster); @@ -2104,27 +1849,27 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub if(nModule < fNModules) fhNCellsPerClusterMod[nModule]->Fill(e, nCaloCellsPerCluster); - //Fill histograms only possible when simulation + //Fill histograms only possible when simulation if(IsDataMC() && nLabels > 0 && labels){ - - //Play with the MC stack if available + + //Play with the MC stack if available Int_t label = labels[0]; - + if(label < 0) { if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterHistograms() *** bad label ***: label %d \n", label); return; } - + Int_t pdg =-1; Int_t pdg0 =-1;Int_t status = -1; Int_t iMother = -1; Int_t iParent = -1; Float_t vxMC= 0; Float_t vyMC = 0; Float_t eMC = 0; Float_t ptMC= 0; Float_t phiMC =0; Float_t etaMC = 0; Int_t charge = 0; - //Check the origin. + //Check the origin. tag = GetMCAnalysisUtils()->CheckOrigin(labels,nLabels, GetReader(),0); - + if(GetReader()->ReadStack() && !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown)){ //it MC stack and known tag - + if( label >= GetMCStack()->GetNtrack()) { if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterHistograms() *** large label ***: label %d, n tracks %d \n", label, GetMCStack()->GetNtrack()); return ; @@ -2138,15 +1883,15 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub vxMC = primary->Vx(); vyMC = primary->Vy(); iParent = primary->GetFirstMother(); - + if(GetDebug() > 1 ) { printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n"); printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg0, primary->GetName(),status, iParent); } - - //Get final particle, no conversion products + + //Get final particle, no conversion products if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)){ - //Get the parent + //Get the parent primary = GetMCStack()->Particle(iParent); pdg = TMath::Abs(primary->GetPdgCode()); if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n"); @@ -2158,17 +1903,17 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub pdg = TMath::Abs(primary->GetPdgCode()); if(GetDebug() > 1 )printf("\t pdg %d, index %d, %s, status %d \n",pdg, iMother, primary->GetName(),status); } - + if(GetDebug() > 1 ) { printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n"); printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg, primary->GetName(), status, iParent); } - + } - - //Overlapped pi0 (or eta, there will be very few), get the meson + + //Overlapped pi0 (or eta, there will be very few), get the meson if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || - GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){ + GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){ if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: \n"); while(pdg != 111 && pdg != 221){ iMother = iParent; @@ -2179,24 +1924,24 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub if(GetDebug() > 1 ) printf("\t pdg %d, %s, index %d\n",pdg, primary->GetName(),iMother); if(iMother==-1) { printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n"); - //break; + //break; } } - + if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", - primary->GetName(),iMother); + primary->GetName(),iMother); } - + eMC = primary->Energy(); ptMC = primary->Pt(); phiMC = primary->Phi(); etaMC = primary->Eta(); pdg = TMath::Abs(primary->GetPdgCode()); charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge(); - + } else if(GetReader()->ReadAODMCParticles() && !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown)){//it MC AOD and known tag - //Get the list of MC particles + //Get the list of MC particles if(!GetReader()->GetAODMCParticles(0)) { printf("AliAnaCalorimeterQA::ClusterHistograms() - MCParticles not available!\n"); abort(); @@ -2210,18 +1955,18 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub vxMC = aodprimary->Xv(); vyMC = aodprimary->Yv(); iParent = aodprimary->GetMother(); - + if(GetDebug() > 1 ) { printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n"); printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d \n", - iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent); + iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent); } - //Get final particle, no conversion products + //Get final particle, no conversion products if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)){ if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n"); - //Get the parent + //Get the parent aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iParent); pdg = TMath::Abs(aodprimary->GetPdgCode()); while ((pdg == 22 || pdg == 11) && !aodprimary->IsPhysicalPrimary()) { @@ -2232,20 +1977,20 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub pdg = TMath::Abs(aodprimary->GetPdgCode()); if(GetDebug() > 1 ) printf("\t pdg %d, index %d, Primary? %d, Physical Primary? %d \n", - pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()); + pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()); } if(GetDebug() > 1 ) { printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n"); printf("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d \n", - iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()); + iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()); } } - - //Overlapped pi0 (or eta, there will be very few), get the meson + + //Overlapped pi0 (or eta, there will be very few), get the meson if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || - GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){ + GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){ if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: PDG %d, mom %d \n",pdg, iMother); while(pdg != 111 && pdg != 221){ @@ -2254,19 +1999,19 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub status = aodprimary->IsPrimary(); iParent = aodprimary->GetMother(); pdg = TMath::Abs(aodprimary->GetPdgCode()); - + if(GetDebug() > 1 ) printf("\t pdg %d, index %d\n",pdg, iMother); if(iMother==-1) { printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n"); - //break; + //break; } } if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", - aodprimary->GetName(),iMother); + aodprimary->GetName(),iMother); } - + status = aodprimary->IsPrimary(); eMC = aodprimary->E(); ptMC = aodprimary->Pt(); @@ -2274,21 +2019,21 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub etaMC = aodprimary->Eta(); pdg = TMath::Abs(aodprimary->GetPdgCode()); charge = aodprimary->Charge(); - + } - - //Float_t vz = primary->Vz(); + + //Float_t vz = primary->Vz(); Float_t rVMC = TMath::Sqrt(vxMC*vxMC + vyMC*vyMC); if((pdg == 22 || TMath::Abs(pdg)==11) && status!=1) { fhEMVxyz ->Fill(vxMC,vyMC);//,vz); fhEMR ->Fill(e,rVMC); } - - //printf("reco e %f, pt %f, phi %f, eta %f \n", e, pt, phi, eta); - //printf("prim e %f, pt %f, phi %f, eta %f \n", eMC,ptMC,phiMC ,etaMC ); - //printf("vertex: vx %f, vy %f, vz %f, r %f \n", vxMC, vyMC, vz, r); - - + + //printf("reco e %f, pt %f, phi %f, eta %f \n", e, pt, phi, eta); + //printf("prim e %f, pt %f, phi %f, eta %f \n", eMC,ptMC,phiMC ,etaMC ); + //printf("vertex: vx %f, vy %f, vz %f, r %f \n", vxMC, vyMC, vz, r); + + fh2E ->Fill(e, eMC); fh2Pt ->Fill(pt, ptMC); fh2Phi ->Fill(phi, phiMC); @@ -2301,41 +2046,41 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub if(ptMC > 0) fhRatioPt ->Fill(pt/ptMC); if(phiMC > 0) fhRatioPhi->Fill(phi/phiMC); if(etaMC > 0) fhRatioEta->Fill(eta/etaMC); - - - //Overlapped pi0 (or eta, there will be very few) + + + //Overlapped pi0 (or eta, there will be very few) if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || - GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){ - fhPi0E ->Fill(e,eMC); - fhPi0Pt ->Fill(pt,ptMC); - fhPi0Eta ->Fill(eta,etaMC); - fhPi0Phi ->Fill(phi,phiMC); - if( nTracksMatched > 0){ - fhPi0ECharged ->Fill(e,eMC); - fhPi0PtCharged ->Fill(pt,ptMC); - fhPi0PhiCharged ->Fill(phi,phiMC); - fhPi0EtaCharged ->Fill(eta,etaMC); - } + GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){ + fhPi0E ->Fill(e,eMC); + fhPi0Pt ->Fill(pt,ptMC); + fhPi0Eta ->Fill(eta,etaMC); + fhPi0Phi ->Fill(phi,phiMC); + if( nTracksMatched > 0){ + fhPi0ECharged ->Fill(e,eMC); + fhPi0PtCharged ->Fill(pt,ptMC); + fhPi0PhiCharged ->Fill(phi,phiMC); + fhPi0EtaCharged ->Fill(eta,etaMC); + } }//Overlapped pizero decay else if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPhoton)){ - fhGamE ->Fill(e,eMC); - fhGamPt ->Fill(pt,ptMC); - fhGamEta ->Fill(eta,etaMC); - fhGamPhi ->Fill(phi,phiMC); - fhGamDeltaE ->Fill(eMC-e); - fhGamDeltaPt ->Fill(ptMC-pt); - fhGamDeltaPhi->Fill(phiMC-phi); - fhGamDeltaEta->Fill(etaMC-eta); - if(eMC > 0) fhGamRatioE ->Fill(e/eMC); - if(ptMC > 0) fhGamRatioPt ->Fill(pt/ptMC); - if(phiMC > 0) fhGamRatioPhi->Fill(phi/phiMC); - if(etaMC > 0) fhGamRatioEta->Fill(eta/etaMC); - if( nTracksMatched > 0){ - fhGamECharged ->Fill(e,eMC); - fhGamPtCharged ->Fill(pt,ptMC); - fhGamPhiCharged ->Fill(phi,phiMC); - fhGamEtaCharged ->Fill(eta,etaMC); - } + fhGamE ->Fill(e,eMC); + fhGamPt ->Fill(pt,ptMC); + fhGamEta ->Fill(eta,etaMC); + fhGamPhi ->Fill(phi,phiMC); + fhGamDeltaE ->Fill(eMC-e); + fhGamDeltaPt ->Fill(ptMC-pt); + fhGamDeltaPhi->Fill(phiMC-phi); + fhGamDeltaEta->Fill(etaMC-eta); + if(eMC > 0) fhGamRatioE ->Fill(e/eMC); + if(ptMC > 0) fhGamRatioPt ->Fill(pt/ptMC); + if(phiMC > 0) fhGamRatioPhi->Fill(phi/phiMC); + if(etaMC > 0) fhGamRatioEta->Fill(eta/etaMC); + if( nTracksMatched > 0){ + fhGamECharged ->Fill(e,eMC); + fhGamPtCharged ->Fill(pt,ptMC); + fhGamPhiCharged ->Fill(phi,phiMC); + fhGamEtaCharged ->Fill(eta,etaMC); + } }//photon else if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCElectron)){ fhEleE ->Fill(e,eMC); @@ -2380,12 +2125,12 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub } } }//Work with MC - + - //Match tracks and clusters - //To be Modified in case of AODs + //Match tracks and clusters + //To be Modified in case of AODs - //if(ntracksmatched==1 && trackIndex==-1) ntracksmatched=0; + //if(ntracksmatched==1 && trackIndex==-1) ntracksmatched=0; if( nTracksMatched > 0){ fhECharged ->Fill(e); @@ -2395,8 +2140,8 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub fhEtaPhiECharged->Fill(eta,phi,e); fhNCellsPerClusterMIPCharged->Fill(e, nCaloCellsPerCluster,eta); - //printf("track index %d ntracks %d\n", esd->GetNumberOfTracks()); - //Study the track and matched cluster if track exists. + //printf("track index %d ntracks %d\n", esd->GetNumberOfTracks()); + //Study the track and matched cluster if track exists. if(!track) return; Double_t emcpos[3] = {0.,0.,0.}; Double_t emcmom[3] = {0.,0.,0.}; @@ -2414,223 +2159,177 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub Int_t nITS = 0; Int_t nTPC = 0; - //In case of ESDs get the parameters in this way - if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { - if (((AliESDtrack*)track)->GetOuterParam() ) { - okout = kTRUE; - - bfield = ((AliESDEvent*)GetReader()->GetInputEvent())->GetMagneticField(); - okpos = ((AliESDtrack*)track)->GetOuterParam()->GetXYZAt(radius,bfield,emcpos); - okmom = ((AliESDtrack*)track)->GetOuterParam()->GetPxPyPzAt(radius,bfield,emcmom); - if(!(okpos && okmom)) return; - - TVector3 position(emcpos[0],emcpos[1],emcpos[2]); - TVector3 momentum(emcmom[0],emcmom[1],emcmom[2]); - tphi = position.Phi(); - teta = position.Eta(); - tmom = momentum.Mag(); - - //Double_t tphi = ((AliESDtrack*)track)->GetOuterParam()->Phi(); - //Double_t teta = ((AliESDtrack*)track)->GetOuterParam()->Eta(); - //Double_t tmom = ((AliESDtrack*)track)->GetOuterParam()->P(); - tpt = ((AliESDtrack*)track)->Pt(); - tmom2 = ((AliESDtrack*)track)->P(); - tpcSignal = ((AliESDtrack*)track)->GetTPCsignal(); - - nITS = ((AliESDtrack*)track)->GetNcls(0); - nTPC = ((AliESDtrack*)track)->GetNcls(1); - }//Outer param available - }// ESDs - else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD) { - AliAODPid* pid = (AliAODPid*) ((AliAODTrack *) track)->GetDetPid(); - if (pid) { - okout = kTRUE; - pid->GetEMCALPosition(emcpos); - pid->GetEMCALMomentum(emcmom); - - TVector3 position(emcpos[0],emcpos[1],emcpos[2]); - TVector3 momentum(emcmom[0],emcmom[1],emcmom[2]); - tphi = position.Phi(); - teta = position.Eta(); - tmom = momentum.Mag(); - - tpt = ((AliAODTrack*)track)->Pt(); - tmom2 = ((AliAODTrack*)track)->P(); - tpcSignal = pid->GetTPCsignal(); - - //nITS = ((AliAODTrack*)track)->GetNcls(0); - //nTPC = ((AliAODTrack*)track)->GetNcls(1); - }//Outer param available - }//AODs - else return; //Do nothing case not implemented. - - if(okout){ - Double_t deta = teta - eta; - Double_t dphi = tphi - phi; - if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi(); - if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi(); - Double_t dR = sqrt(dphi*dphi + deta*deta); + //In case of ESDs get the parameters in this way + // if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { + if (track->GetOuterParam() ) { + okout = kTRUE; + + bfield = GetReader()->GetInputEvent()->GetMagneticField(); + okpos = track->GetOuterParam()->GetXYZAt(radius,bfield,emcpos); + okmom = track->GetOuterParam()->GetPxPyPzAt(radius,bfield,emcmom); + if(!(okpos && okmom)) return; + + TVector3 position(emcpos[0],emcpos[1],emcpos[2]); + TVector3 momentum(emcmom[0],emcmom[1],emcmom[2]); + tphi = position.Phi(); + teta = position.Eta(); + tmom = momentum.Mag(); + + //Double_t tphi = track->GetOuterParam()->Phi(); + //Double_t teta = track->GetOuterParam()->Eta(); + //Double_t tmom = track->GetOuterParam()->P(); + tpt = track->Pt(); + tmom2 = track->P(); + tpcSignal = track->GetTPCsignal(); + + nITS = track->GetNcls(0); + nTPC = track->GetNcls(1); + }//Outer param available + //}// ESDs + // else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD) { + // AliAODPid* pid = (AliAODPid*) ((AliAODTrack *) track)->GetDetPid(); + // if (pid) { + // okout = kTRUE; + // pid->GetEMCALPosition(emcpos); + // pid->GetEMCALMomentum(emcmom); + // + // TVector3 position(emcpos[0],emcpos[1],emcpos[2]); + // TVector3 momentum(emcmom[0],emcmom[1],emcmom[2]); + // tphi = position.Phi(); + // teta = position.Eta(); + // tmom = momentum.Mag(); + // + // tpt = ((AliAODTrack*)track)->Pt(); + // tmom2 = ((AliAODTrack*)track)->P(); + // tpcSignal = pid->GetTPCsignal(); + // + // //nITS = ((AliAODTrack*)track)->GetNcls(0); + // //nTPC = ((AliAODTrack*)track)->GetNcls(1); + // }//Outer param available + // }//AODs + // else return; //Do nothing case not implemented. + + if(okout){ + Double_t deta = teta - eta; + Double_t dphi = tphi - phi; + 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/e; + Double_t pOverE = tmom/e; - fh1pOverE->Fill(tpt, pOverE); - if(dR < 0.02) fh1pOverER02->Fill(tpt,pOverE); + fh1pOverE->Fill(tpt, pOverE); + if(dR < 0.02) fh1pOverER02->Fill(tpt,pOverE); - fh1dR->Fill(dR); - fh2MatchdEdx->Fill(tmom2,tpcSignal); + fh1dR->Fill(dR); + fh2MatchdEdx->Fill(tmom2,tpcSignal); - if(IsDataMC() && primary){ - Int_t pdg = primary->GetPdgCode(); - Double_t charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge(); + if(IsDataMC() && primary){ + Int_t pdg = primary->GetPdgCode(); + Double_t charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge(); - if(TMath::Abs(pdg) == 11){ - fhMCEle1pOverE->Fill(tpt,pOverE); - fhMCEle1dR->Fill(dR); - fhMCEle2MatchdEdx->Fill(tmom2,tpcSignal); - if(dR < 0.02) fhMCEle1pOverER02->Fill(tpt,pOverE); - } - else if(charge!=0){ - fhMCChHad1pOverE->Fill(tpt,pOverE); - fhMCChHad1dR->Fill(dR); - fhMCChHad2MatchdEdx->Fill(tmom2,tpcSignal); - if(dR < 0.02) fhMCChHad1pOverER02->Fill(tpt,pOverE); - } - else if(charge == 0){ - fhMCNeutral1pOverE->Fill(tpt,pOverE); - fhMCNeutral1dR->Fill(dR); - fhMCNeutral2MatchdEdx->Fill(tmom2,tpcSignal); - if(dR < 0.02) fhMCNeutral1pOverER02->Fill(tpt,pOverE); - } - }//DataMC - - if(dR < 0.02 && pOverE > 0.5 && pOverE < 1.5 - && nCaloCellsPerCluster > 1 && nITS > 3 && nTPC > 20) { - fh2EledEdx->Fill(tmom2,tpcSignal); - } - } - else{//no ESD external param or AODPid -// ULong_t status=AliESDtrack::kTPCrefit; -// status|=AliESDtrack::kITSrefit; - //printf("track status %d\n", track->GetStatus() ); -// fhEChargedNoOut ->Fill(e); -// fhPtChargedNoOut ->Fill(pt); -// fhPhiChargedNoOut ->Fill(phi); -// fhEtaChargedNoOut ->Fill(eta); -// fhEtaPhiChargedNoOut ->Fill(eta,phi); -// if(GetDebug() >= 0 && ((((AliESDtrack*)track)->GetStatus() & status) == status)) printf("ITS+TPC\n"); - if(GetDebug() >= 0) printf("No ESD external param or AliAODPid \n"); - - }//No out params + if(TMath::Abs(pdg) == 11){ + fhMCEle1pOverE->Fill(tpt,pOverE); + fhMCEle1dR->Fill(dR); + fhMCEle2MatchdEdx->Fill(tmom2,tpcSignal); + if(dR < 0.02) fhMCEle1pOverER02->Fill(tpt,pOverE); + } + else if(charge!=0){ + fhMCChHad1pOverE->Fill(tpt,pOverE); + fhMCChHad1dR->Fill(dR); + fhMCChHad2MatchdEdx->Fill(tmom2,tpcSignal); + if(dR < 0.02) fhMCChHad1pOverER02->Fill(tpt,pOverE); + } + else if(charge == 0){ + fhMCNeutral1pOverE->Fill(tpt,pOverE); + fhMCNeutral1dR->Fill(dR); + fhMCNeutral2MatchdEdx->Fill(tmom2,tpcSignal); + if(dR < 0.02) fhMCNeutral1pOverER02->Fill(tpt,pOverE); + } + }//DataMC + + if(dR < 0.02 && pOverE > 0.5 && pOverE < 1.5 + && nCaloCellsPerCluster > 1 && nITS > 3 && nTPC > 20) { + fh2EledEdx->Fill(tmom2,tpcSignal); + } + } + else{//no ESD external param or AODPid + // ULong_t status=AliESDtrack::kTPCrefit; + // status|=AliESDtrack::kITSrefit; + //printf("track status %d\n", track->GetStatus() ); + // fhEChargedNoOut ->Fill(e); + // fhPtChargedNoOut ->Fill(pt); + // fhPhiChargedNoOut ->Fill(phi); + // fhEtaChargedNoOut ->Fill(eta); + // fhEtaPhiChargedNoOut ->Fill(eta,phi); + // if(GetDebug() >= 0 && ((track->GetStatus() & status) == status)) printf("ITS+TPC\n"); + if(GetDebug() >= 0) printf("No ESD external param or AliAODPid \n"); + + }//No out params }//matched clusters with tracks - + }// Clusters - -//__________________________________ + + //__________________________________ void AliAnaCalorimeterQA::CorrelateCalorimeters(TRefArray* refArray){ - // Correlate information from PHOS and EMCAL + // Correlate information from PHOS and EMCAL TRefArray * caloClustersEMCAL = 0; TRefArray * caloClustersPHOS = 0; - // Get once the array of clusters per calorimeter, avoid an extra loop. - if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { - if(fCalorimeter == "EMCAL"){ - caloClustersPHOS = new TRefArray(); - ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSClusters(caloClustersPHOS); - caloClustersEMCAL = new TRefArray(*refArray); - } - else if(fCalorimeter == "PHOS") { - caloClustersEMCAL = new TRefArray(); - ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALClusters (caloClustersEMCAL); - caloClustersPHOS = new TRefArray(*refArray); - } - - //Fill histograms with clusters - - fhCaloCorrNClusters->Fill(caloClustersEMCAL->GetEntriesFast(),caloClustersPHOS->GetEntriesFast()); - Float_t sumClusterEnergyEMCAL = 0; - Float_t sumClusterEnergyPHOS = 0; - Int_t iclus = 0; - for(iclus = 0 ; iclus < caloClustersEMCAL->GetEntriesFast() ; iclus++) - sumClusterEnergyEMCAL += ((AliESDCaloCluster*) (caloClustersEMCAL->At(iclus)))->E(); - for(iclus = 0 ; iclus < caloClustersPHOS->GetEntriesFast(); iclus++) - sumClusterEnergyPHOS += ((AliESDCaloCluster*) (caloClustersPHOS->At(iclus)))->E(); - fhCaloCorrEClusters->Fill(sumClusterEnergyEMCAL,sumClusterEnergyPHOS); - - //Fill histograms with cells - - AliESDCaloCells * cellsEMCAL = ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - AliESDCaloCells * cellsPHOS = ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - fhCaloCorrNCells ->Fill(cellsEMCAL->GetNumberOfCells(),cellsPHOS->GetNumberOfCells()); - - Int_t icell = 0; - Float_t sumCellEnergyEMCAL = 0; - Float_t sumCellEnergyPHOS = 0; - for(icell = 0 ; icell < cellsEMCAL->GetNumberOfCells() ; icell++) - sumCellEnergyEMCAL += cellsEMCAL->GetAmplitude(icell); - for(icell = 0 ; icell < cellsPHOS->GetNumberOfCells(); icell++) - sumCellEnergyPHOS += cellsPHOS->GetAmplitude(icell); - fhCaloCorrECells->Fill(sumCellEnergyEMCAL,sumCellEnergyPHOS); - if(GetDebug() > 0 ){ - printf("AliAnaCalorimeterQA::CorrelateCalorimeters() - ESD: \n"); - printf("\t EMCAL: N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n", - cellsEMCAL->GetNumberOfCells(),caloClustersEMCAL->GetEntriesFast(),sumCellEnergyEMCAL,sumClusterEnergyEMCAL); - printf("\t PHOS : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n", - cellsPHOS->GetNumberOfCells(),caloClustersPHOS->GetEntriesFast(),sumCellEnergyPHOS,sumClusterEnergyPHOS); - } - }//ESD - else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD) { - if(fCalorimeter == "EMCAL"){ - ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSClusters(caloClustersPHOS); - caloClustersEMCAL = refArray; - } - else if(fCalorimeter == "PHOS") { - ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALClusters (caloClustersEMCAL); - caloClustersEMCAL = refArray; - } - + // Get once the array of clusters per calorimeter, avoid an extra loop. + if(fCalorimeter == "EMCAL"){ + caloClustersPHOS = new TRefArray(); + GetReader()->GetInputEvent()->GetPHOSClusters(caloClustersPHOS); + caloClustersEMCAL = new TRefArray(*refArray); + } + else if(fCalorimeter == "PHOS") { + caloClustersEMCAL = new TRefArray(); + GetReader()->GetInputEvent()->GetEMCALClusters (caloClustersEMCAL); + caloClustersPHOS = new TRefArray(*refArray); + } + //Fill histograms with clusters - - fhCaloCorrNClusters->Fill(caloClustersEMCAL->GetEntriesFast(),caloClustersPHOS->GetEntriesFast()); - Float_t sumClusterEnergyEMCAL = 0; - Float_t sumClusterEnergyPHOS = 0; - Int_t iclus = 0; - for(iclus = 0 ; iclus < caloClustersEMCAL->GetEntriesFast() ; iclus++) - sumClusterEnergyEMCAL += ((AliAODCaloCluster*) (caloClustersEMCAL->At(iclus)))->E(); - for(iclus = 0 ; iclus < caloClustersPHOS->GetEntriesFast(); iclus++) - sumClusterEnergyPHOS += ((AliAODCaloCluster*) (caloClustersPHOS->At(iclus)))->E(); - fhCaloCorrEClusters->Fill(sumClusterEnergyEMCAL,sumClusterEnergyPHOS); - - //Fill histograms with cells - - AliAODCaloCells * cellsEMCAL = ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALCells(); - AliAODCaloCells * cellsPHOS = ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSCells(); - fhCaloCorrNCells ->Fill(cellsEMCAL->GetNumberOfCells(),cellsPHOS->GetNumberOfCells()); - - Int_t icell = 0; - Float_t sumCellEnergyEMCAL = 0; - Float_t sumCellEnergyPHOS = 0; - for(icell = 0 ; icell < cellsEMCAL->GetNumberOfCells() ; icell++) - sumCellEnergyEMCAL += cellsEMCAL->GetAmplitude(icell); - for(icell = 0 ; icell < cellsPHOS->GetNumberOfCells(); icell++) - sumCellEnergyPHOS += cellsPHOS->GetAmplitude(icell); - fhCaloCorrECells->Fill(sumCellEnergyEMCAL,sumCellEnergyPHOS); - if(GetDebug() > 0 ){ - printf("AliAnaCalorimeterQA::CorrelateCalorimeters() - ESD: \n"); - printf("\t EMCAL: N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n", - cellsEMCAL->GetNumberOfCells(),caloClustersEMCAL->GetEntriesFast(),sumCellEnergyEMCAL,sumClusterEnergyEMCAL); - printf("\t PHOS : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n", - cellsPHOS->GetNumberOfCells(),caloClustersPHOS->GetEntriesFast(),sumCellEnergyPHOS,sumClusterEnergyPHOS); - } - }//AOD + + fhCaloCorrNClusters->Fill(caloClustersEMCAL->GetEntriesFast(),caloClustersPHOS->GetEntriesFast()); + Float_t sumClusterEnergyEMCAL = 0; + Float_t sumClusterEnergyPHOS = 0; + Int_t iclus = 0; + for(iclus = 0 ; iclus < caloClustersEMCAL->GetEntriesFast() ; iclus++) + sumClusterEnergyEMCAL += ((AliVCluster*)caloClustersEMCAL->At(iclus))->E(); + for(iclus = 0 ; iclus < caloClustersPHOS->GetEntriesFast(); iclus++) + sumClusterEnergyPHOS += ((AliVCluster*)caloClustersPHOS->At(iclus))->E(); + fhCaloCorrEClusters->Fill(sumClusterEnergyEMCAL,sumClusterEnergyPHOS); + + //Fill histograms with cells + + AliVCaloCells * cellsEMCAL = GetReader()->GetInputEvent()->GetEMCALCells(); + AliVCaloCells * cellsPHOS = GetReader()->GetInputEvent()->GetPHOSCells(); + fhCaloCorrNCells ->Fill(cellsEMCAL->GetNumberOfCells(),cellsPHOS->GetNumberOfCells()); + + Int_t icell = 0; + Float_t sumCellEnergyEMCAL = 0; + Float_t sumCellEnergyPHOS = 0; + for(icell = 0 ; icell < cellsEMCAL->GetNumberOfCells() ; icell++) + sumCellEnergyEMCAL += cellsEMCAL->GetAmplitude(icell); + for(icell = 0 ; icell < cellsPHOS->GetNumberOfCells(); icell++) + sumCellEnergyPHOS += cellsPHOS->GetAmplitude(icell); + fhCaloCorrECells->Fill(sumCellEnergyEMCAL,sumCellEnergyPHOS); + if(GetDebug() > 0 ){ + printf("AliAnaCalorimeterQA::CorrelateCalorimeters() - ESD: \n"); + printf("\t EMCAL: N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n", + cellsEMCAL->GetNumberOfCells(),caloClustersEMCAL->GetEntriesFast(),sumCellEnergyEMCAL,sumClusterEnergyEMCAL); + printf("\t PHOS : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n", + cellsPHOS->GetNumberOfCells(),caloClustersPHOS->GetEntriesFast(),sumCellEnergyPHOS,sumClusterEnergyPHOS); + } delete caloClustersEMCAL; delete caloClustersPHOS; } -//______________________________________________________________________________ + //______________________________________________________________________________ void AliAnaCalorimeterQA::MCHistograms(const TLorentzVector mom, const Int_t pdg){ - //Fill pure monte carlo related histograms + //Fill pure monte carlo related histograms Float_t eMC = mom.E(); Float_t ptMC = mom.Pt(); @@ -2640,7 +2339,7 @@ void AliAnaCalorimeterQA::MCHistograms(const TLorentzVector mom, const Int_t pdg Float_t etaMC = mom.Eta(); if (TMath::Abs(etaMC) > 1) return; - + Bool_t in = kTRUE; if(IsFiducialCutOn()) in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ; @@ -2683,19 +2382,19 @@ void AliAnaCalorimeterQA::MCHistograms(const TLorentzVector mom, const Int_t pdg } } - -//________________________________________________________________________ + + //________________________________________________________________________ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) { - // Needed when Terminate is executed in distributed environment - // Refill analysis histograms of this class with corresponding histograms in output list. + // Needed when Terminate is executed in distributed environment + // Refill analysis histograms of this class with corresponding histograms in output list. - // Histograms of this analsys are kept in the same list as other analysis, recover the position of - // the first one and then add the next + // Histograms of this analsys are kept in the same list as other analysis, recover the position of + // the first one and then add the next Int_t index = outputList->IndexOf(outputList->FindObject(GetAddedHistogramsStringToName()+"hE")); - //printf("Calo: %s, index: %d, nmodules %d\n",fCalorimeter.Data(),index,fNModules); + //printf("Calo: %s, index: %d, nmodules %d\n",fCalorimeter.Data(),index,fNModules); - //Read histograms, must be in the same order as in GetCreateOutputObject. + //Read histograms, must be in the same order as in GetCreateOutputObject. fhE = (TH1F *) outputList->At(index++); fhPt = (TH1F *) outputList->At(index++); fhPhi = (TH1F *) outputList->At(index++); @@ -2713,12 +2412,12 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) fhEtaCharged = (TH1F *) outputList->At(index++); fhEtaPhiECharged = (TH3F *) outputList->At(index++); -// fhEChargedNoOut = (TH1F *) outputList->At(index++); -// fhPtChargedNoOut = (TH1F *) outputList->At(index++); -// fhPhiChargedNoOut = (TH1F *) outputList->At(index++); -// fhEtaChargedNoOut = (TH1F *) outputList->At(index++); -// fhEtaPhiChargedNoOut = (TH2F *) outputList->At(index++); - + // fhEChargedNoOut = (TH1F *) outputList->At(index++); + // fhPtChargedNoOut = (TH1F *) outputList->At(index++); + // fhPhiChargedNoOut = (TH1F *) outputList->At(index++); + // fhEtaChargedNoOut = (TH1F *) outputList->At(index++); + // fhEtaPhiChargedNoOut = (TH2F *) outputList->At(index++); + fh1pOverE = (TH2F *) outputList->At(index++); fh1dR = (TH1F *) outputList->At(index++); fh2MatchdEdx = (TH2F *) outputList->At(index++); @@ -2762,19 +2461,19 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) fhNCells = (TH1F *) outputList->At(index++); fhAmplitude = (TH1F *) outputList->At(index++); fhAmpId = (TH2F *) outputList->At(index++); - + if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { fhCellTimeSpreadRespectToCellMax = (TH1F *) outputList->At(index++); fhCellIdCellLargeTimeSpread = (TH1F *) outputList->At(index++); - + fhTime = (TH1F *) outputList->At(index++); fhTimeId = (TH2F *) outputList->At(index++); fhTimeAmp = (TH2F *) outputList->At(index++); -// fhT0Time = (TH1F *) outputList->At(index++); -// fhT0TimeId = (TH2F *) outputList->At(index++); -// fhT0TimeAmp = (TH2F *) outputList->At(index++); + // fhT0Time = (TH1F *) outputList->At(index++); + // fhT0TimeId = (TH2F *) outputList->At(index++); + // fhT0TimeAmp = (TH2F *) outputList->At(index++); } @@ -2786,7 +2485,7 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) fhCaloCorrECells = (TH2F *) outputList->At(index++); } - //Module histograms + //Module histograms fhEMod = new TH1F*[fNModules]; fhNClustersMod = new TH1F*[fNModules]; fhNCellsPerClusterMod = new TH2F*[fNModules]; @@ -2799,12 +2498,12 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) if(fCalorimeter=="EMCAL") fhAmplitudeModFraction = new TH1F*[fNModules*3]; - //EMCAL + //EMCAL fhTimeAmpPerRCU = new TH2F*[fNModules*fNRCU]; fhIMMod = new TH2F*[fNModules]; fhIMCellCutMod = new TH2F*[fNModules]; - + for(Int_t imod = 0 ; imod < fNModules; imod++){ fhEMod[imod] = (TH1F *) outputList->At(index++); fhNClustersMod[imod] = (TH1F *) outputList->At(index++); @@ -2824,16 +2523,16 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) for(Int_t ircu = 0; ircu < fNRCU; ircu++){ fhTimeAmpPerRCU[imod*fNRCU+ircu] = (TH2F *) outputList->At(index++); - //fhT0TimeAmpPerRCU[imod*fNRCU+ircu] = (TH2F *) outputList->At(index++); -// for(Int_t imod2 = 0; imod2 < fNModules; imod2++){ -// for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){ -// fhTimeCorrRCU[imod*fNRCU+ircu+imod2*fNRCU+ircu2] = (TH2F *) outputList->At(index++); -// } -// } + //fhT0TimeAmpPerRCU[imod*fNRCU+ircu] = (TH2F *) outputList->At(index++); + // for(Int_t imod2 = 0; imod2 < fNModules; imod2++){ + // for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){ + // fhTimeCorrRCU[imod*fNRCU+ircu+imod2*fNRCU+ircu2] = (TH2F *) outputList->At(index++); + // } + // } } fhIMMod[imod] = (TH2F *) outputList->At(index++); fhIMCellCutMod[imod] = (TH2F *) outputList->At(index++); - + } if(IsDataMC()){ @@ -2866,7 +2565,7 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) fhGamRatioPt = (TH1F *) outputList->At(index++); fhGamRatioPhi = (TH1F *) outputList->At(index++); fhGamRatioEta = (TH1F *) outputList->At(index++); - + fhPi0E = (TH2F *) outputList->At(index++); fhPi0Pt = (TH2F *) outputList->At(index++); fhPi0Phi = (TH2F *) outputList->At(index++); @@ -2891,7 +2590,7 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) fhGamPtCharged = (TH2F *) outputList->At(index++); fhGamPhiCharged = (TH2F *) outputList->At(index++); fhGamEtaCharged = (TH2F *) outputList->At(index++); - + fhPi0ECharged = (TH2F *) outputList->At(index++); fhPi0PtCharged = (TH2F *) outputList->At(index++); fhPi0PhiCharged = (TH2F *) outputList->At(index++); @@ -2912,8 +2611,8 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) fhChHadPhiCharged = (TH2F *) outputList->At(index++); fhChHadEtaCharged = (TH2F *) outputList->At(index++); -// fhEMVxyz = (TH3F *) outputList->At(index++); -// fhHaVxyz = (TH3F *) outputList->At(index++); + // fhEMVxyz = (TH3F *) outputList->At(index++); + // fhHaVxyz = (TH3F *) outputList->At(index++); fhEMVxyz = (TH2F *) outputList->At(index++); fhHaVxyz = (TH2F *) outputList->At(index++); @@ -2968,54 +2667,54 @@ void AliAnaCalorimeterQA::ReadHistograms(TList* outputList) } } -//__________________________________________________________________ + //__________________________________________________________________ void AliAnaCalorimeterQA::Terminate(TList* outputList) { - //Do plots if requested - + //Do plots if requested + if(GetDebug() > 0) printf("AliAnaCalorimeterQA::Terminate() - Make plots for %s? %d\n",fCalorimeter.Data(), fMakePlots); if(!fMakePlots) return; - //Do some plots to end - if(fStyleMacro!="")gROOT->Macro(fStyleMacro); - //Recover histograms from output histograms list, needed for distributed analysis. + //Do some plots to end + if(fStyleMacro!="")gROOT->Macro(fStyleMacro); + //Recover histograms from output histograms list, needed for distributed analysis. ReadHistograms(outputList); - //printf(" AliAnaCalorimeterQA::Terminate() *** %s Report:", GetName()) ; - //printf(" AliAnaCalorimeterQA::Terminate() pt : %5.3f , RMS : %5.3f \n", fhPt->GetMean(), fhPt->GetRMS() ) ; - + //printf(" AliAnaCalorimeterQA::Terminate() *** %s Report:", GetName()) ; + //printf(" AliAnaCalorimeterQA::Terminate() pt : %5.3f , RMS : %5.3f \n", fhPt->GetMean(), fhPt->GetRMS() ) ; + char name[128]; char cname[128]; - //In case terminate is executed after the analysis, in a second step, and we want to rebin or to change the range of the histograms for plotting + //In case terminate is executed after the analysis, in a second step, and we want to rebin or to change the range of the histograms for plotting Int_t nptbins = GetHistoPtBins(); Float_t ptmax = GetHistoPtMax(); Float_t ptmin = GetHistoPtMin(); Int_t nphibins = GetHistoPhiBins(); Float_t phimax = GetHistoPhiMax(); Float_t phimin = GetHistoPhiMin(); Int_t netabins = GetHistoEtaBins(); Float_t etamax = GetHistoEtaMax(); Float_t etamin = GetHistoEtaMin(); -// Int_t nmassbins = GetHistoMassBins(); Float_t massmax = GetHistoMassMax(); Float_t massmin = GetHistoMassMin(); -// Int_t nasymbins = GetHistoAsymmetryBins(); Float_t asymmax = GetHistoAsymmetryMax(); Float_t asymmin = GetHistoAsymmetryMin(); -// Int_t nPoverEbins = GetHistoPOverEBins(); Float_t pOverEmax = GetHistoPOverEMax(); Float_t pOverEmin = GetHistoPOverEMin(); -// Int_t ndedxbins = GetHistodEdxBins(); Float_t dedxmax = GetHistodEdxMax(); Float_t dedxmin = GetHistodEdxMin(); -// Int_t ndRbins = GetHistodRBins(); Float_t dRmax = GetHistodRMax(); Float_t dRmin = GetHistodRMin(); + // Int_t nmassbins = GetHistoMassBins(); Float_t massmax = GetHistoMassMax(); Float_t massmin = GetHistoMassMin(); + // Int_t nasymbins = GetHistoAsymmetryBins(); Float_t asymmax = GetHistoAsymmetryMax(); Float_t asymmin = GetHistoAsymmetryMin(); + // Int_t nPoverEbins = GetHistoPOverEBins(); Float_t pOverEmax = GetHistoPOverEMax(); Float_t pOverEmin = GetHistoPOverEMin(); + // Int_t ndedxbins = GetHistodEdxBins(); Float_t dedxmax = GetHistodEdxMax(); Float_t dedxmin = GetHistodEdxMin(); + // Int_t ndRbins = GetHistodRBins(); Float_t dRmax = GetHistodRMax(); Float_t dRmin = GetHistodRMin(); Int_t ntimebins = GetHistoTimeBins(); Float_t timemax = GetHistoTimeMax(); Float_t timemin = GetHistoTimeMin(); Int_t nbins = GetHistoNClusterCellBins(); Int_t nmax = GetHistoNClusterCellMax(); Int_t nmin = GetHistoNClusterCellMin(); -// Int_t nratiobins = GetHistoRatioBins(); Float_t ratiomax = GetHistoRatioMax(); Float_t ratiomin = GetHistoRatioMin(); -// Int_t nvdistbins = GetHistoVertexDistBins(); Float_t vdistmax = GetHistoVertexDistMax(); Float_t vdistmin = GetHistoVertexDistMin(); + // Int_t nratiobins = GetHistoRatioBins(); Float_t ratiomax = GetHistoRatioMax(); Float_t ratiomin = GetHistoRatioMin(); + // Int_t nvdistbins = GetHistoVertexDistBins(); Float_t vdistmax = GetHistoVertexDistMax(); Float_t vdistmin = GetHistoVertexDistMin(); Int_t rbins = GetHistoRBins(); Float_t rmax = GetHistoRMax(); Float_t rmin = GetHistoRMin(); Int_t xbins = GetHistoXBins(); Float_t xmax = GetHistoXMax(); Float_t xmin = GetHistoXMin(); Int_t ybins = GetHistoYBins(); Float_t ymax = GetHistoYMax(); Float_t ymin = GetHistoYMin(); Int_t zbins = GetHistoZBins(); Float_t zmax = GetHistoZMax(); Float_t zmin = GetHistoZMin(); - //Color code for the different modules + //Color code for the different modules Int_t modColorIndex[]={2,4,6,8}; - //-------------------------------------------------- - // Cluster energy distributions, module dependence - //-------------------------------------------------- + //-------------------------------------------------- + // Cluster energy distributions, module dependence + //-------------------------------------------------- sprintf(cname,"QA_%s_ClusterEnergy",fCalorimeter.Data()); TCanvas * c = new TCanvas(cname, "Energy distributions", 800, 400) ; c->Divide(2, 1); Int_t rbE = GetNewRebinForRePlotting((TH1D*)fhE, ptmin, ptmax,nptbins) ; - //printf("new E rb %d\n",rbE); + //printf("new E rb %d\n",rbE); fhE->Rebin(rbE); fhE->SetAxisRange(ptmin,ptmax,"X"); c->cd(1) ; @@ -3037,13 +2736,13 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendE.Draw(); - //Ratio of modules + //Ratio of modules c->cd(2) ; TLegend pLegendER(0.55,0.8,0.9,0.9); pLegendER.SetTextSize(0.03); pLegendER.SetFillColor(10); pLegendER.SetBorderSize(1); - + for(Int_t imod = 1; imod < fNModules; imod++){ TH1D * htmp = (TH1D*)fhEMod[imod]->Clone(Form("hERat%d",imod)); htmp->Divide(fhEMod[0]); @@ -3066,15 +2765,15 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_ClusterEnergy.eps",fCalorimeter.Data()); c->Print(name); printf("Plot: %s\n",name); - //-------------------------------------------------- - // Cell energy distributions, module dependence - //-------------------------------------------------- + //-------------------------------------------------- + // Cell energy distributions, module dependence + //-------------------------------------------------- sprintf(cname,"%s_QA_CellEnergy",fCalorimeter.Data()); TCanvas * ca = new TCanvas(cname, "Cell Energy distributions", 800, 400) ; ca->Divide(2, 1); Int_t rbAmp = GetNewRebinForRePlotting((TH1D*)fhAmplitude, ptmin, ptmax,nptbins*2) ; - //printf("new Amp rb %d\n",rbAmp); + //printf("new Amp rb %d\n",rbAmp); fhAmplitude->Rebin(rbAmp); fhAmplitude->SetAxisRange(ptmin,ptmax,"X"); @@ -3123,13 +2822,13 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) pLegendAR.Draw(); sprintf(name,"QA_%s_CellEnergy.eps",fCalorimeter.Data()); ca->Print(name); printf("Plot: %s\n",name); - - //---------------------------------------------------------- - // Cell energy distributions, FRACTION of module dependence - // See Super Module calibration difference - //--------------------------------------------------------- + + //---------------------------------------------------------- + // Cell energy distributions, FRACTION of module dependence + // See Super Module calibration difference + //--------------------------------------------------------- if(fCalorimeter=="EMCAL"){ - //Close To Eta 0 + //Close To Eta 0 sprintf(cname,"%s_QA_SMThirds",fCalorimeter.Data()); TCanvas * cfrac = new TCanvas(cname, "SM Thirds ratios", 800, 1200) ; cfrac->Divide(2, 3); @@ -3155,7 +2854,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } hAverageThird1 ->Scale(1./fNModules); pLegend1.Draw(); - //Ratio + //Ratio cfrac->cd(2) ; for(Int_t imod = 0; imod < fNModules; imod++){ Int_t ifrac = 0; @@ -3172,9 +2871,9 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } else htmp -> Draw("same HE"); } - //pLegend1.Draw(); + //pLegend1.Draw(); - //Middle Eta + //Middle Eta cfrac->cd(3) ; if(fhAmplitude->GetEntries() > 0) gPad->SetLogy(); @@ -3199,7 +2898,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) hAverageThird2->Scale(1./fNModules); pLegend2.Draw(); - //Ratio + //Ratio cfrac->cd(4) ; for(Int_t imod = 0; imod < fNModules; imod++){ @@ -3216,9 +2915,9 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } else htmp -> Draw("same HE"); } - //pLegend2.Draw(); + //pLegend2.Draw(); - //Close To Eta 0.7 + //Close To Eta 0.7 cfrac->cd(5) ; if(fhAmplitude->GetEntries() > 0) gPad->SetLogy(); @@ -3261,16 +2960,16 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } else htmp ->Draw("same HE"); } - //pLegend3.Draw(); + //pLegend3.Draw(); sprintf(name,"QA_%s_CellEnergyModuleFraction.eps",fCalorimeter.Data()); cfrac->Print(name); printf("Create plot %s\n",name); }//EMCAL - //---------------------------------------------------------- - // Cluster eta and phi distributions, energy cut dependence - //--------------------------------------------------------- + //---------------------------------------------------------- + // Cluster eta and phi distributions, energy cut dependence + //--------------------------------------------------------- sprintf(cname,"%s_QA_EtaPhiCluster",fCalorimeter.Data()); TCanvas * cetaphic = new TCanvas(cname, "Eta-Phi Reconstructed distributions", 1200, 400) ; @@ -3283,7 +2982,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) Int_t ecutcolor[]= {2, 4, 6, 7, 8, 9, 12}; TH1D * hE = fhEtaPhiE->ProjectionZ(); - //PHI + //PHI cetaphic->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3297,16 +2996,16 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) if(htmp){ htmp->SetMinimum(1); rbPhi = GetNewRebinForRePlotting(htmp, phimin, phimax,nphibins) ; - //printf("new Phi rb %d\n",rbPhi); + //printf("new Phi rb %d\n",rbPhi); htmp->Rebin(rbPhi); htmp->SetTitle("#phi of clusters for energy in cluster > threshold"); htmp->SetAxisRange(phimin,phimax,"X"); htmp->Draw("HE"); pLegendPhiCl.AddEntry(htmp,"No cut","L"); - + for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhEtaPhiE->ProjectionY(Form("hphi_cluster_cut%d",i),0,-1,binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbPhi); @@ -3317,7 +3016,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendPhiCl.Draw(); - //ETA + //ETA cetaphic->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3325,7 +3024,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) htmp = fhEtaPhiE->ProjectionX("heta_cluster_nocut",0,-1,0,-1); htmp ->SetLineColor(1); rbEta = GetNewRebinForRePlotting(htmp,etamin, etamax,netabins) ; - //printf("new Eta rb %d\n",rbEta); + //printf("new Eta rb %d\n",rbEta); if(htmp){ htmp->Rebin(rbEta); htmp->SetMinimum(1); @@ -3335,32 +3034,32 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhEtaPhiE->ProjectionX(Form("heta_cluster_cut%d",i),0,-1,binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbEta); htmp->Draw("same HE"); } } - //ETA vs PHI + //ETA vs PHI cetaphic->cd(3) ; TH2D* hEtaPhiCl = (TH2D*) fhEtaPhiE->Project3D("xy"); hEtaPhiCl->SetAxisRange(etamin,etamax,"X"); hEtaPhiCl->SetAxisRange(phimin,phimax,"Y"); hEtaPhiCl->Draw("colz"); - + sprintf(name,"QA_%s_ClusterEtaPhi.eps",fCalorimeter.Data()); cetaphic->Print(name); printf("Create plot %s\n",name); - - //---------------------------------------------------------- - // Cell eta and phi distributions, energy cut dependence - //--------------------------------------------------------- + + //---------------------------------------------------------- + // Cell eta and phi distributions, energy cut dependence + //--------------------------------------------------------- sprintf(cname,"%s_QA_EtaPhiCell",fCalorimeter.Data()); TCanvas * cetaphicell = new TCanvas(cname, "Eta-Phi Cells distributions", 1200, 400) ; cetaphicell->Divide(3, 1); - //PHI + //PHI cetaphicell->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3381,7 +3080,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhEtaPhiAmp->ProjectionY(Form("hphi_cell_cut%d",i),0,-1,binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbPhi); @@ -3392,7 +3091,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendPhiCell.Draw(); - //ETA + //ETA cetaphicell->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3408,7 +3107,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhEtaPhiAmp->ProjectionX(Form("heta_cell_cut%d",i),0,-1,binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbEta); @@ -3416,7 +3115,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } } - //ETA vs PHI + //ETA vs PHI cetaphicell->cd(3) ; TH2D* hEtaPhiCell = (TH2D*) fhEtaPhiAmp->Project3D("xy"); hEtaPhiCell->SetAxisRange(etamin,etamax,"X"); @@ -3426,11 +3125,11 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_CellEtaPhi.eps",fCalorimeter.Data()); cetaphicell->Print(name); printf("Create plot %s\n",name); - //////////////////////////////////////// - ///////// Global Positions ///////////// - //////////////////////////////////////// + //////////////////////////////////////// + ///////// Global Positions ///////////// + //////////////////////////////////////// - //CLUSTERS + //CLUSTERS sprintf(cname,"%s_QA_ClusterXY",fCalorimeter.Data()); TCanvas * cxyz = new TCanvas(cname, "Cluster XY distributions", 1200, 400) ; cxyz->Divide(3, 1); @@ -3461,25 +3160,25 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(cname,"QA_%s_ClusterX",fCalorimeter.Data()); TCanvas * cx = new TCanvas(cname, "Cluster X distributions", 1200, 400) ; cx->Divide(3, 1); - + cx->cd(1) ; TH1D * hX = (TH1D*) fhXYZ->Project3D("xe" ); - //gPad->SetLogy(); + //gPad->SetLogy(); gPad->SetGridy(); hX->SetTitle("Cluster X "); hX->Draw("HE"); rbX = GetNewRebinForRePlotting(hX, xmin, xmax,xbins) ; - //printf("new X rb %d\n",rbX); + //printf("new X rb %d\n",rbX); hX->Rebin(rbX); hX->SetMinimum(hX->GetMaximum()/2); hX->SetAxisRange(xmin,xmax); - + cx->cd(2) ; TH1D * hY = (TH1D*) fhXYZ->Project3D("ye" ); - //gPad->SetLogy(); + //gPad->SetLogy(); hY->SetTitle("Cluster Y "); rbY = GetNewRebinForRePlotting(hY, ymin, ymax, ybins) ; - //printf("new Y rb %d\n",rbY); + //printf("new Y rb %d\n",rbY); hY->Rebin(rbY); hY->SetMinimum(1); hY->SetAxisRange(ymin,ymax); @@ -3487,10 +3186,10 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cx->cd(3) ; TH1D * hZ = (TH1D*) fhXYZ->Project3D("ze" ); - //gPad->SetLogy(); + //gPad->SetLogy(); gPad->SetGridy(); rbZ = GetNewRebinForRePlotting(hZ,zmin, zmax,zbins) ; - //printf("new Z rb %d\n",rbZ); + //printf("new Z rb %d\n",rbZ); hZ->Rebin(rbZ); hZ->SetMinimum(hZ->GetMaximum()/2); hZ->SetAxisRange(zmin,zmax); @@ -3498,8 +3197,8 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_ClusterX_Y_Z.eps",fCalorimeter.Data()); cx->Print(name); printf("Create plot %s\n",name); - - //CELLS + + //CELLS sprintf(cname,"%s_QA_CellXY",fCalorimeter.Data()); TCanvas * cellxyz = new TCanvas(cname, "Cell XY distributions", 1200, 400) ; @@ -3520,7 +3219,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) hXZCell->SetTitle("Cell X vs Z"); hXZCell->GetYaxis()->SetTitleOffset(1.6); hXZCell->Draw("colz"); - + sprintf(name,"QA_%s_CellXY_YZ_XZ.eps",fCalorimeter.Data()); cellxyz->Print(name); printf("Create plot %s\n",name); @@ -3531,17 +3230,17 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cellx->cd(1) ; TH1D * hXCell = (TH1D*) fhXYZCell->Project3D("xe" ); - //gPad->SetLogy(); + //gPad->SetLogy(); gPad->SetGridy(); hXCell->SetTitle("Cell X "); hXCell->Rebin(rbX); hXCell->SetMinimum(hXCell->GetMaximum()/2); hXCell->SetAxisRange(xmin,xmax); hXCell->Draw("HE"); - + cellx->cd(2) ; TH1D * hYCell = (TH1D*) fhXYZCell->Project3D("ye" ); - //gPad->SetLogy(); + //gPad->SetLogy(); hYCell->SetTitle("Cell Y "); hYCell->Rebin(rbY); hYCell->SetAxisRange(ymin,ymax); @@ -3550,7 +3249,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cellx->cd(3) ; TH1D * hZCell = (TH1D*) fhXYZCell->Project3D("ze" ); - //gPad->SetLogy(); + //gPad->SetLogy(); gPad->SetGridy(); hZCell->SetAxisRange(zmin,zmax); hZCell->SetTitle("Cell Z "); @@ -3560,16 +3259,16 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_CellX_Y_Z.eps",fCalorimeter.Data()); cellx->Print(name); printf("Create plot %s\n",name); - + - //---------------------------------------------------------- - // Cluster X, Y, Z, R, energy cut dependence - //--------------------------------------------------------- + //---------------------------------------------------------- + // Cluster X, Y, Z, R, energy cut dependence + //--------------------------------------------------------- sprintf(cname,"%s_QA_ClusterX_Y_Z_R_ECut",fCalorimeter.Data()); TCanvas * cxe = new TCanvas(cname, "Cluster X Y Z R, E cut", 800, 800) ; cxe->Divide(2, 2); - //R + //R cxe->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3584,7 +3283,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) if(htmp){ htmp->SetMinimum(1); rbR = GetNewRebinForRePlotting(htmp, rmin, rmax,rbins) ; - //printf("new R rb %d\n",rbR); + //printf("new R rb %d\n",rbR); htmp->Rebin(rbR); htmp->SetTitle("r of clusters for energy in cluster > threshold"); htmp->SetAxisRange(rmin,rmax,"X"); @@ -3593,7 +3292,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhRE->ProjectionX(Form("hre_cluster_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbR); @@ -3603,7 +3302,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendXCl.Draw(); - //X + //X cxe->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3617,14 +3316,14 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhXE->ProjectionX(Form("hxe_cluster_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbX); htmp->Draw("same HE"); } } - //Y + //Y cxe->cd(3) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3638,14 +3337,14 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhYE->ProjectionX(Form("hye_cluster_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbY); htmp->Draw("same HE"); } } - //Z + //Z cxe->cd(4) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3660,7 +3359,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhZE->ProjectionX(Form("hze_cluster_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbZ); @@ -3672,15 +3371,15 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cxe->Print(name); printf("Create plot %s\n",name); - //---------------------------------------------------------- - // Cluster X, Y, Z, R, NCells in cluster dependence - //--------------------------------------------------------- + //---------------------------------------------------------- + // Cluster X, Y, Z, R, NCells in cluster dependence + //--------------------------------------------------------- Int_t ncellcut[]={2, 3, 4}; Int_t ncellcuts = 3; sprintf(cname,"%s_QA_ClusterX_Y_Z_R_NCellsCut",fCalorimeter.Data()); TCanvas * cxn = new TCanvas(cname, "Cluster X Y Z R, NCells cut", 800, 800) ; cxn->Divide(2, 2); - //R + //R cxn->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3712,7 +3411,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendXClN.Draw(); - //X + //X cxn->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3732,7 +3431,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) htmp->Draw("same HE"); } } - //Y + //Y cxn->cd(3) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3752,7 +3451,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) htmp->Draw("same HE"); } } - //Z + //Z cxn->cd(4) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3778,14 +3477,14 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cxn->Print(name); printf("Create plot %s\n",name); - //---------------------------------------------------------- - // Cell X, Y, Z, R, energy cut dependence - //--------------------------------------------------------- + //---------------------------------------------------------- + // Cell X, Y, Z, R, energy cut dependence + //--------------------------------------------------------- sprintf(cname,"%s_QA_CellX_Y_Z_R_ECut",fCalorimeter.Data()); TCanvas * cxecell = new TCanvas(cname, "Cell X Y Z R, E cut", 800, 800) ; cxecell->Divide(2, 2); - //R + //R cxecell->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3806,7 +3505,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhRCellE->ProjectionX(Form("hre_celr_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbR); @@ -3816,7 +3515,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendXCell.Draw(); - //X + //X cxecell->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3831,14 +3530,14 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhXCellE->ProjectionX(Form("hxe_cells_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbX); htmp->Draw("same HE"); } } - //Y + //Y cxecell->cd(3) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3852,14 +3551,14 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhYCellE->ProjectionX(Form("hye_cells_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbY); htmp->Draw("same HE"); } } - //Z + //Z cxecell->cd(4) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3873,7 +3572,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhZCellE->ProjectionX(Form("hze_cells_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbZ); @@ -3884,18 +3583,18 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cxecell->Print(name); printf("Create plot %s\n",name); - //---------------------------------------------------------- - // Cluster-Cell X, Y, Z, R, cluster energy cut dependence - //--------------------------------------------------------- + //---------------------------------------------------------- + // Cluster-Cell X, Y, Z, R, cluster energy cut dependence + //--------------------------------------------------------- Int_t rbDR= 1;//rbR; Int_t rbDX= 1;//rbX; Int_t rbDY= 1;//rbY; Int_t rbDZ= 1;//rbZ; - + sprintf(cname,"%s_QA_DeltaClusterCellX_Y_Z_R_ECut",fCalorimeter.Data()); TCanvas * cxde = new TCanvas(cname, "Cluster-Cell X, Y, Z, R, E cut", 800, 800) ; cxde->Divide(2, 2); - //R + //R cxde->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3916,7 +3615,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhDeltaCellClusterRE->ProjectionX(Form("hrde_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbDR); @@ -3926,7 +3625,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendXClD.Draw(); - //X + //X cxde->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3940,7 +3639,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhDeltaCellClusterXE->ProjectionX(Form("hxde_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbDX); @@ -3948,7 +3647,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } } - //Y + //Y cxde->cd(3) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3962,7 +3661,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhDeltaCellClusterYE->ProjectionX(Form("hyde_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbDY); @@ -3970,7 +3669,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } } - //Z + //Z cxde->cd(4) ; gPad->SetLogy(); gPad->SetGridy(); @@ -3985,7 +3684,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) for (Int_t i = 0; i < ncuts; i++) { binmin = hE->FindBin(ecut[i]); - //printf(" bins %d for e %f\n",binmin[i],ecut[i]); + //printf(" bins %d for e %f\n",binmin[i],ecut[i]); htmp = fhDeltaCellClusterZE->ProjectionX(Form("hzde_cut%d",i),binmin,-1); htmp->SetLineColor(ecutcolor[i]); htmp->Rebin(rbZ); @@ -3998,13 +3697,13 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cxde->Print(name); printf("Create plot %s\n",name); - //---------------------------------------------------------- - // Cluster-Cell X, Y, Z, R, NCells in cluster dependence - //--------------------------------------------------------- + //---------------------------------------------------------- + // Cluster-Cell X, Y, Z, R, NCells in cluster dependence + //--------------------------------------------------------- sprintf(cname,"%s_QA_DeltaClusterCellX_Y_Z_R_NCellsCut",fCalorimeter.Data()); TCanvas * cxdn = new TCanvas(cname, "Cluster-Cell X Y Z R, NCells cut", 800, 800) ; cxdn->Divide(2, 2); - //R + //R cxdn->cd(1) ; gPad->SetLogy(); gPad->SetGridy(); @@ -4036,7 +3735,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } pLegendXClDN.Draw(); - //X + //X cxdn->cd(2) ; gPad->SetLogy(); gPad->SetGridy(); @@ -4057,7 +3756,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } } - //Y + //Y cxdn->cd(3) ; gPad->SetLogy(); gPad->SetGridy(); @@ -4078,7 +3777,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } } - //Z + //Z cxdn->cd(4) ; gPad->SetLogy(); gPad->SetGridy(); @@ -4103,17 +3802,17 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_DeltaClusterCellX_Y_Z_R_NCellsCut.eps",fCalorimeter.Data()); cxdn->Print(name); printf("Create plot %s\n",name); - + - //---------------------------------------------------------- - //Reconstructed clusters energy-eta-phi distributions, matched with tracks - //---------------------------------------------------------- + //---------------------------------------------------------- + //Reconstructed clusters energy-eta-phi distributions, matched with tracks + //---------------------------------------------------------- TH1F * hEChargedClone = (TH1F*) fhECharged->Clone(Form("%sClone",fhECharged->GetName())); TH1F * hPtChargedClone = (TH1F*) fhPtCharged->Clone(Form("%sClone",fhPtCharged->GetName())); TH1F * hEtaChargedClone = (TH1F*) fhEtaCharged->Clone(Form("%sClone",fhEtaCharged->GetName())); TH1F * hPhiChargedClone = (TH1F*) fhPhiCharged->Clone(Form("%sClone",fhPhiCharged->GetName())); - + sprintf(cname,"QA_%s_rectrackmatch",fCalorimeter.Data()); TCanvas * ccltm = new TCanvas(cname, "Reconstructed clusters E-Phi-Eta, matched with tracks", 1200, 400) ; @@ -4125,7 +3824,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) fhECharged->SetAxisRange(ptmin,ptmax,"X"); fhECharged->SetMinimum(1); fhECharged->Draw(); - + ccltm->cd(2) ; if(fhPhiCharged->GetEntries() > 0) gPad->SetLogy(); fhPhiCharged->Rebin(rbPhi); @@ -4143,9 +3842,9 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_ClusterEnergyPhiEta_TrackMatched.eps",fCalorimeter.Data()); ccltm->Print(name); printf("Plot: %s\n",name); - //---------------------------------------------------------- - // Ratio of reconstructed clusters energy-eta-phi distributions, matched with tracks over all - //---------------------------------------------------------- + //---------------------------------------------------------- + // Ratio of reconstructed clusters energy-eta-phi distributions, matched with tracks over all + //---------------------------------------------------------- sprintf(cname,"%s_QA_ChargedRatio",fCalorimeter.Data()); TCanvas * ccharge = new TCanvas(cname, "Charged clusters over all clusters", 1200, 400) ; @@ -4159,7 +3858,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) fhECharged->SetMaximum(0.5); fhECharged->SetYTitle("track-matched clusters / all clusters"); fhECharged->Draw("HE"); - + ccharge->cd(2) ; fhPhiCharged->Sumw2(); fhPhi->Rebin(rbPhi); @@ -4183,9 +3882,9 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_ClustersMatchedToAllRatios.eps",fCalorimeter.Data()); ccharge->Print(name); printf("Create plot %s\n",name); - //------------------------------------------- - // N Cells - N Clusters - N Cells per cluster - //------------------------------------------- + //------------------------------------------- + // N Cells - N Clusters - N Cells per cluster + //------------------------------------------- sprintf(cname,"QA_%s_nclustercells",fCalorimeter.Data()); TCanvas * cN = new TCanvas(cname, " Number of CaloClusters and CaloCells", 800, 1200) ; cN->Divide(2, 3); @@ -4286,7 +3985,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) htmp->SetLineColor(modColorIndex[imod]); if(imod==1){ htmp->SetTitle("Ratio # cells per cluster in module X / module 0"); - //htmp->SetAxisRange(ptmin,ptmax,"X"); + //htmp->SetAxisRange(ptmin,ptmax,"X"); htmp->SetMaximum(3.5); htmp->SetMinimum(0); htmp->Draw("HE"); @@ -4298,11 +3997,11 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) sprintf(name,"QA_%s_NumberCaloClustersAndCaloCells.eps",fCalorimeter.Data()); cN->Print(name); printf("Print plot %s\n",name); - //---------------------------------------------------- - // Cell Time histograms, time only available in ESDs - //---------------------------------------------------- + //---------------------------------------------------- + // Cell Time histograms, time only available in ESDs + //---------------------------------------------------- if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) { - + sprintf(cname,"QA_%s_cellstime",fCalorimeter.Data()); TCanvas * ctime = new TCanvas(cname, " Cells time", 1200, 400) ; ctime->Divide(3, 1); @@ -4315,156 +4014,156 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) fhTime->Rebin(rbTime); fhTime->SetAxisRange(timemin,timemax,"X"); fhTime->Draw(); - + ctime->cd(2) ; fhTimeId->SetTitleOffset(1.8,"Y"); fhTimeId->SetAxisRange(timemin,timemax,"X"); fhTimeId->Draw("colz"); - + ctime->cd(3) ; fhTimeAmp->SetTitle("Cell Energy vs Cell Time"); fhTimeAmp->SetTitleOffset(1.8,"Y"); fhTimeAmp->SetAxisRange(timemin,timemax,"Y"); fhTimeAmp->SetAxisRange(ptmin,ptmax,"X"); fhTimeAmp->Draw("colz"); - + sprintf(name,"QA_%s_CellsTime.eps",fCalorimeter.Data()); ctime->Print(name); printf("Plot: %s\n",name); } - //--------------------------------- - //Grid of cell per module plots - //--------------------------------- + //--------------------------------- + //Grid of cell per module plots + //--------------------------------- { - //Number of entries per cell - gStyle->SetPadRightMargin(0.15); - sprintf(cname,"%s_QA_GridCellEntries",fCalorimeter.Data()); - TCanvas *cgrid = new TCanvas("cgrid","Number of entries per cell", 12,12,800,400); - if(fNModules%2 == 0) - cgrid->Divide(fNModules/2,2); - else - cgrid->Divide(fNModules/2+1,2); - - for(Int_t imod = 0; imod < fNModules ; imod++){ - cgrid->cd(imod+1); - gPad->SetLogz(); - gPad->SetGridy(); - gPad->SetGridx(); - //fhGridCellsMod[imod]->GetYAxis()->SetTitleColor(1); - fhGridCellsMod[imod]->SetZTitle("Counts "); - fhGridCellsMod[imod]->SetYTitle("row (phi direction) "); - //fhGridCellsMod[imod]->SetLabelSize(0.025,"z"); - fhGridCellsMod[imod]->Draw("colz"); - } - sprintf(name,"QA_%s_GridCellsEntries.eps",fCalorimeter.Data()); - cgrid->Print(name); printf("Create plot %s\n",name); - - sprintf(cname,"%s_QA_GridCellAccumEnergy",fCalorimeter.Data()); - TCanvas *cgridE = new TCanvas("cgridE","Summed energy per cell", 12,12,800,400); - if(fNModules%2 == 0) - cgridE->Divide(fNModules/2,2); - else - cgridE->Divide(fNModules/2+1,2); - for(Int_t imod = 0; imod < fNModules ; imod++){ - cgridE->cd(imod+1); - gPad->SetLogz(); - gPad->SetGridy(); - gPad->SetGridx(); - //fhGridCellsEMod[imod]->SetLabelSize(0.025,"z"); - fhGridCellsEMod[imod]->SetZTitle("Accumulated Energy (GeV) "); - fhGridCellsEMod[imod]->SetYTitle("row (phi direction) "); - fhGridCellsEMod[imod]->Draw("colz"); - } - sprintf(name,"QA_%s_GridCellsAccumEnergy.eps",fCalorimeter.Data()); - cgridE->Print(name); printf("Create plot %s\n",name); - - //Accumulated energy per cell - sprintf(cname,"%s_QA_GridCellAverageEnergy",fCalorimeter.Data()); - TCanvas *cgridEA = new TCanvas("cgridEA","Average energy per cell", 12,12,800,400); - if(fNModules%2 == 0) - cgridEA->Divide(fNModules/2,2); - else - cgridEA->Divide(fNModules/2+1,2); - for(Int_t imod = 0; imod < fNModules ; imod++){ - cgridEA->cd(imod+1); - gPad->SetLogz(); - gPad->SetGridy(); - gPad->SetGridx(); - //fhGridCellsEMod[imod]->SetLabelSize(0.025,"z"); - fhGridCellsEMod[imod]->SetZTitle("Average Energy (GeV) "); - fhGridCellsEMod[imod]->Divide(fhGridCellsMod[imod]); - fhGridCellsEMod[imod]->Draw("colz"); - } - sprintf(name,"QA_%s_GridCellsAverageEnergy.eps",fCalorimeter.Data()); - cgridEA->Print(name); printf("Create plot %s\n",name); - - //Accumulated Time per cell, E > 0.5 GeV - - sprintf(cname,"%s_QA_GridCellAccumTime",fCalorimeter.Data()); - TCanvas *cgridT = new TCanvas("cgridT","Summed time per cell", 12,12,800,400); - if(fNModules%2 == 0) - cgridT->Divide(fNModules/2,2); - else - cgridE->Divide(fNModules/2+1,2); - for(Int_t imod = 0; imod < fNModules ; imod++){ - cgridT->cd(imod+1); - gPad->SetLogz(); - gPad->SetGridy(); - gPad->SetGridx(); - //fhGridCellsTimeMod[imod]->SetLabelSize(0.025,"z"); - fhGridCellsTimeMod[imod]->SetZTitle("Accumulated Time (ns) "); - fhGridCellsTimeMod[imod]->SetYTitle("row (phi direction) "); - fhGridCellsTimeMod[imod]->Draw("colz"); - } - sprintf(name,"QA_%s_GridCellsAccumTime.eps",fCalorimeter.Data()); - cgridT->Print(name); printf("Create plot %s\n",name); + //Number of entries per cell + gStyle->SetPadRightMargin(0.15); + sprintf(cname,"%s_QA_GridCellEntries",fCalorimeter.Data()); + TCanvas *cgrid = new TCanvas("cgrid","Number of entries per cell", 12,12,800,400); + if(fNModules%2 == 0) + cgrid->Divide(fNModules/2,2); + else + cgrid->Divide(fNModules/2+1,2); + + for(Int_t imod = 0; imod < fNModules ; imod++){ + cgrid->cd(imod+1); + gPad->SetLogz(); + gPad->SetGridy(); + gPad->SetGridx(); + //fhGridCellsMod[imod]->GetYAxis()->SetTitleColor(1); + fhGridCellsMod[imod]->SetZTitle("Counts "); + fhGridCellsMod[imod]->SetYTitle("row (phi direction) "); + //fhGridCellsMod[imod]->SetLabelSize(0.025,"z"); + fhGridCellsMod[imod]->Draw("colz"); + } + sprintf(name,"QA_%s_GridCellsEntries.eps",fCalorimeter.Data()); + cgrid->Print(name); printf("Create plot %s\n",name); + + sprintf(cname,"%s_QA_GridCellAccumEnergy",fCalorimeter.Data()); + TCanvas *cgridE = new TCanvas("cgridE","Summed energy per cell", 12,12,800,400); + if(fNModules%2 == 0) + cgridE->Divide(fNModules/2,2); + else + cgridE->Divide(fNModules/2+1,2); + for(Int_t imod = 0; imod < fNModules ; imod++){ + cgridE->cd(imod+1); + gPad->SetLogz(); + gPad->SetGridy(); + gPad->SetGridx(); + //fhGridCellsEMod[imod]->SetLabelSize(0.025,"z"); + fhGridCellsEMod[imod]->SetZTitle("Accumulated Energy (GeV) "); + fhGridCellsEMod[imod]->SetYTitle("row (phi direction) "); + fhGridCellsEMod[imod]->Draw("colz"); + } + sprintf(name,"QA_%s_GridCellsAccumEnergy.eps",fCalorimeter.Data()); + cgridE->Print(name); printf("Create plot %s\n",name); + + //Accumulated energy per cell + sprintf(cname,"%s_QA_GridCellAverageEnergy",fCalorimeter.Data()); + TCanvas *cgridEA = new TCanvas("cgridEA","Average energy per cell", 12,12,800,400); + if(fNModules%2 == 0) + cgridEA->Divide(fNModules/2,2); + else + cgridEA->Divide(fNModules/2+1,2); + for(Int_t imod = 0; imod < fNModules ; imod++){ + cgridEA->cd(imod+1); + gPad->SetLogz(); + gPad->SetGridy(); + gPad->SetGridx(); + //fhGridCellsEMod[imod]->SetLabelSize(0.025,"z"); + fhGridCellsEMod[imod]->SetZTitle("Average Energy (GeV) "); + fhGridCellsEMod[imod]->Divide(fhGridCellsMod[imod]); + fhGridCellsEMod[imod]->Draw("colz"); + } + sprintf(name,"QA_%s_GridCellsAverageEnergy.eps",fCalorimeter.Data()); + cgridEA->Print(name); printf("Create plot %s\n",name); + + //Accumulated Time per cell, E > 0.5 GeV + + sprintf(cname,"%s_QA_GridCellAccumTime",fCalorimeter.Data()); + TCanvas *cgridT = new TCanvas("cgridT","Summed time per cell", 12,12,800,400); + if(fNModules%2 == 0) + cgridT->Divide(fNModules/2,2); + else + cgridE->Divide(fNModules/2+1,2); + for(Int_t imod = 0; imod < fNModules ; imod++){ + cgridT->cd(imod+1); + gPad->SetLogz(); + gPad->SetGridy(); + gPad->SetGridx(); + //fhGridCellsTimeMod[imod]->SetLabelSize(0.025,"z"); + fhGridCellsTimeMod[imod]->SetZTitle("Accumulated Time (ns) "); + fhGridCellsTimeMod[imod]->SetYTitle("row (phi direction) "); + fhGridCellsTimeMod[imod]->Draw("colz"); + } + sprintf(name,"QA_%s_GridCellsAccumTime.eps",fCalorimeter.Data()); + cgridT->Print(name); printf("Create plot %s\n",name); } - //--------------------------------------------- - //Calorimeter Correlation, PHOS vs EMCAL - //--------------------------------------------- + //--------------------------------------------- + //Calorimeter Correlation, PHOS vs EMCAL + //--------------------------------------------- if(fCorrelateCalos){ sprintf(cname,"QA_%s_CaloCorr_EMCALvsPHOS",fCalorimeter.Data()); TCanvas * ccorr = new TCanvas(cname, " EMCAL vs PHOS", 400, 400) ; ccorr->Divide(2, 2); - + ccorr->cd(1) ; - //gPad->SetLogy(); - //gPad->SetLogx(); + //gPad->SetLogy(); + //gPad->SetLogx(); fhCaloCorrNClusters->SetAxisRange(nmin,nmax,"X"); fhCaloCorrNClusters->SetAxisRange(nmin,nmax,"Y"); fhCaloCorrNClusters ->Draw(); - + ccorr->cd(2) ; - //gPad->SetLogy(); - //gPad->SetLogx(); + //gPad->SetLogy(); + //gPad->SetLogx(); fhCaloCorrNCells->SetAxisRange(nmin,nmax,"X"); fhCaloCorrNCells->SetAxisRange(nmin,nmax,"Y"); fhCaloCorrNCells->Draw(); - - //gPad->SetLogy(); - //gPad->SetLogx(); + + //gPad->SetLogy(); + //gPad->SetLogx(); fhCaloCorrEClusters->SetAxisRange(ptmin,ptmax,"X"); fhCaloCorrEClusters->SetAxisRange(ptmin,ptmax,"Y"); fhCaloCorrEClusters->Draw(); - + ccorr->cd(4) ; - //gPad->SetLogy(); - //gPad->SetLogx(); + //gPad->SetLogy(); + //gPad->SetLogx(); fhCaloCorrECells->SetAxisRange(ptmin,ptmax,"X"); fhCaloCorrECells->SetAxisRange(ptmin,ptmax,"Y"); fhCaloCorrECells->Draw(); - + sprintf(name,"QA_%s_CaloCorr_EMCALvsPHOS.eps",fCalorimeter.Data()); ccorr->Print(name); printf("Plot: %s\n",name); } - - //---------------------------- - //Invariant mass - //----------------------------- + + //---------------------------- + //Invariant mass + //----------------------------- Int_t imbinmin = -1; Int_t imbinmax = -1; @@ -4474,16 +4173,16 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) Int_t emax = (Int_t) fhIM->GetXaxis()->GetXmax(); Int_t emin = (Int_t) fhIM->GetXaxis()->GetXmin(); if (emin != 0 ) printf("emin != 0 \n"); - //printf("IM: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax); + //printf("IM: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax); sprintf(cname,"QA_%s_IM",fCalorimeter.Data()); - // printf("c5\n"); + // printf("c5\n"); TCanvas * c5 = new TCanvas(cname, "Invariant mass", 600, 400) ; c5->Divide(2, 3); c5->cd(1) ; - //fhIM->SetLineColor(4); - //fhIM->Draw(); + //fhIM->SetLineColor(4); + //fhIM->Draw(); imbinmin = 0; imbinmax = (Int_t) (1-emin)*nebins/emax; TH1D *pyim1 = fhIM->ProjectionY(Form("%s_py1",fhIM->GetName()),imbinmin,imbinmax); @@ -4495,7 +4194,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) pLegendIM.AddEntry(pyim1,"all modules","L"); pLegendIM.SetFillColor(10); pLegendIM.SetBorderSize(1); - //FIXME + //FIXME for(Int_t imod = 0; imod < fNModules; imod++){ pyim1 = fhIMMod[imod]->ProjectionY(Form("%s_py1",fhIMMod[imod]->GetName()),imbinmin,imbinmax); pLegendIM.AddEntry(pyim1,Form("module %d",imod),"L"); @@ -4573,24 +4272,24 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) c5->Print(name); printf("Plot: %s\n",name); } - //-------------------------------------------------- - //Invariant mass, clusters with more than one cell - //------------------------------------------------- + //-------------------------------------------------- + //Invariant mass, clusters with more than one cell + //------------------------------------------------- if(fhIMCellCut->GetEntries() > 1){ Int_t nebins = fhIMCellCut->GetNbinsX(); Int_t emax = (Int_t) fhIMCellCut->GetXaxis()->GetXmax(); Int_t emin = (Int_t) fhIMCellCut->GetXaxis()->GetXmin(); if (emin != 0 ) printf("emin != 0 \n"); - //printf("IMCellCut: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax); + //printf("IMCellCut: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax); sprintf(cname,"QA_%s_IMCellCut",fCalorimeter.Data()); - // printf("c5cc\n"); + // printf("c5cc\n"); TCanvas * c5cc = new TCanvas(cname, "Invariant mass, Cell Cut", 600, 400) ; c5cc->Divide(2, 3); c5cc->cd(1) ; - //fhIMCellCut->SetLineColor(4); - //fhIMCellCut->Draw(); + //fhIMCellCut->SetLineColor(4); + //fhIMCellCut->Draw(); imbinmin = 0; imbinmax = (Int_t) (1-emin)*nebins/emax; TH1D *pyimcc1 = fhIMCellCut->ProjectionY(Form("%s_py1",fhIMCellCut->GetName()),imbinmin,imbinmax); @@ -4681,16 +4380,16 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) } - //Asymmetry + //Asymmetry if(fhAsym->GetEntries() > 1){ Int_t nebins = fhAsym->GetNbinsX(); Int_t emax = (Int_t) fhAsym->GetXaxis()->GetXmax(); Int_t emin = (Int_t) fhAsym->GetXaxis()->GetXmin(); if (emin != 0 ) printf("emin != 0 \n"); - //printf("Asym: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax); + //printf("Asym: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax); sprintf(cname,"QA_%s_Asym",fCalorimeter.Data()); - // printf("c5\n"); + // printf("c5\n"); TCanvas * c5b = new TCanvas(cname, "Asymmetry", 400, 400) ; c5b->Divide(2, 2); @@ -4729,798 +4428,798 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) if(IsDataMC()){ - //Reconstructed vs MC distributions - //printf("c6\n"); - sprintf(cname,"QA_%s_recvsmc",fCalorimeter.Data()); - TCanvas * c6 = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ; - c6->Divide(2, 2); - - c6->cd(1) ; - fh2E->SetTitleOffset(1.6,"Y"); - fh2E->SetLineColor(4); - fh2E->Draw(); - - c6->cd(2) ; - fh2Pt->SetTitleOffset(1.6,"Y"); - fh2Pt->SetLineColor(4); - fh2Pt->Draw(); - - c6->cd(3) ; - fh2Phi->SetTitleOffset(1.6,"Y"); - fh2Phi->SetLineColor(4); - fh2Phi->Draw(); - - c6->cd(4) ; - fh2Eta->SetTitleOffset(1.6,"Y"); - fh2Eta->SetLineColor(4); - fh2Eta->Draw(); - - sprintf(name,"QA_%s_ReconstructedVSMCDistributions.eps",fCalorimeter.Data()); - c6->Print(name); printf("Plot: %s\n",name); - - //Reconstructed vs MC distributions - //printf("c6\n"); - sprintf(cname,"QA_%s_gamrecvsmc",fCalorimeter.Data()); - TCanvas * c6Gam = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ; - c6Gam->Divide(2, 2); - - c6Gam->cd(1) ; - fhGamE->Draw(); - - c6Gam->cd(2) ; - fhGamPt->Draw(); - - c6Gam->cd(3) ; - fhGamPhi->Draw(); - - c6Gam->cd(4) ; - fhGamEta->Draw(); - - sprintf(name,"QA_%s_GammaReconstructedVSMCDistributions.eps",fCalorimeter.Data()); - c6->Print(name); printf("Plot: %s\n",name); - - //Generated - reconstructed - //printf("c7\n"); - sprintf(cname,"QA_%s_diffgenrec",fCalorimeter.Data()); - TCanvas * c7 = new TCanvas(cname, "generated - reconstructed", 400, 400) ; - c7->Divide(2, 2); - - c7->cd(1) ; - if(fhDeltaE->GetEntries() > 0) gPad->SetLogy(); - fhGamDeltaE->SetLineColor(4); - fhDeltaE->Draw(); - fhGamDeltaE->Draw("same"); - - TLegend pLegendd(0.65,0.55,0.9,0.8); - pLegendd.SetTextSize(0.06); - pLegendd.AddEntry(fhDeltaE,"all","L"); - pLegendd.AddEntry(fhGamDeltaE,"from #gamma","L"); - pLegendd.SetFillColor(10); - pLegendd.SetBorderSize(1); - pLegendd.Draw(); - - c7->cd(2) ; - if(fhDeltaPt->GetEntries() > 0) gPad->SetLogy(); - fhGamDeltaPt->SetLineColor(4); - fhDeltaPt->Draw(); - fhGamDeltaPt->Draw("same"); - - c7->cd(3) ; - fhGamDeltaPhi->SetLineColor(4); - fhDeltaPhi->Draw(); - fhGamDeltaPhi->Draw("same"); - - c7->cd(4) ; - fhGamDeltaEta->SetLineColor(4); - fhDeltaEta->Draw(); - fhGamDeltaEta->Draw("same"); - - sprintf(name,"QA_%s_DiffGeneratedReconstructed.eps",fCalorimeter.Data()); - c7->Print(name); printf("Plot: %s\n",name); - - // Reconstructed / Generated - //printf("c8\n"); - sprintf(cname,"QA_%s_ratiorecgen",fCalorimeter.Data()); - TCanvas * c8 = new TCanvas(cname, " reconstructed / generated", 400, 400) ; - c8->Divide(2, 2); - - c8->cd(1) ; - if(fhRatioE->GetEntries() > 0) gPad->SetLogy(); - fhGamRatioE->SetLineColor(4); - fhRatioE->Draw(); - fhGamRatioE->Draw("same"); - - TLegend pLegendr(0.65,0.55,0.9,0.8); - pLegendr.SetTextSize(0.06); - pLegendr.AddEntry(fhRatioE,"all","L"); - pLegendr.AddEntry(fhGamRatioE,"from #gamma","L"); - pLegendr.SetFillColor(10); - pLegendr.SetBorderSize(1); - pLegendr.Draw(); - - c8->cd(2) ; - if(fhRatioPt->GetEntries() > 0) gPad->SetLogy(); - fhGamRatioPt->SetLineColor(4); - fhRatioPt->Draw(); - fhGamRatioPt->Draw("same"); - - c8->cd(3) ; - fhGamRatioPhi->SetLineColor(4); - fhRatioPhi->Draw(); - fhGamRatioPhi->Draw("same"); - - c8->cd(4) ; - fhGamRatioEta->SetLineColor(4); - fhRatioEta->Draw(); - fhGamRatioEta->Draw("same"); - - sprintf(name,"QA_%s_ReconstructedDivGenerated.eps",fCalorimeter.Data()); - c8->Print(name); printf("Plot: %s\n",name); - - //MC - - //Generated distributions - //printf("c1\n"); - sprintf(cname,"QA_%s_gen",fCalorimeter.Data()); - TCanvas * c10 = new TCanvas(cname, "Generated distributions", 600, 200) ; - c10->Divide(3, 1); - - c10->cd(1) ; - gPad->SetLogy(); - TH1F * haxispt = (TH1F*) fhGenPi0Pt->Clone(Form("%s_axispt",fhGenPi0Pt->GetName())); - haxispt->SetTitle("Generated Particles p_{T}, |#eta| < 1"); - fhGenPi0Pt->SetLineColor(1); - fhGenGamPt->SetLineColor(4); - fhGenEtaPt->SetLineColor(2); - fhGenOmegaPt->SetLineColor(7); - fhGenElePt->SetLineColor(6); - - //Select the maximum of the histogram to show all lines. - if(fhGenPi0Pt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenEtaPt->GetMaximum() && - fhGenPi0Pt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenElePt->GetMaximum()) - haxispt->SetMaximum(fhGenPi0Pt->GetMaximum()); - else if(fhGenGamPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenEtaPt->GetMaximum() && - fhGenGamPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenElePt->GetMaximum()) - haxispt->SetMaximum(fhGenGamPt->GetMaximum()); - else if(fhGenEtaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && - fhGenEtaPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenElePt->GetMaximum()) - haxispt->SetMaximum(fhGenEtaPt->GetMaximum()); - else if(fhGenOmegaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenEtaPt->GetMaximum() && - fhGenOmegaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenElePt->GetMaximum()) - haxispt->SetMaximum(fhGenOmegaPt->GetMaximum()); - else if(fhGenElePt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenEtaPt->GetMaximum() && - fhGenElePt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenGamPt->GetMaximum()) - haxispt->SetMaximum(fhGenElePt->GetMaximum()); - haxispt->SetMinimum(1); - haxispt->Draw("axis"); - fhGenPi0Pt->Draw("same"); - fhGenGamPt->Draw("same"); - fhGenEtaPt->Draw("same"); - fhGenOmegaPt->Draw("same"); - fhGenElePt->Draw("same"); - - TLegend pLegend(0.85,0.65,0.95,0.93); - pLegend.SetTextSize(0.06); - pLegend.AddEntry(fhGenPi0Pt," #pi^{0}","L"); - pLegend.AddEntry(fhGenGamPt," #gamma","L"); - pLegend.AddEntry(fhGenEtaPt," #eta","L"); - pLegend.AddEntry(fhGenOmegaPt," #omega","L"); - pLegend.AddEntry(fhGenElePt," e^{#pm}","L"); - pLegend.SetFillColor(10); - pLegend.SetBorderSize(1); - pLegend.Draw(); - - c10->cd(2) ; - gPad->SetLogy(); - TH1F * haxiseta = (TH1F*) fhGenPi0Eta->Clone(Form("%s_axiseta",fhGenPi0Eta->GetName())); - haxiseta->SetTitle("Generated Particles #eta, |#eta| < 1"); - fhGenPi0Eta->SetLineColor(1); - fhGenGamEta->SetLineColor(4); - fhGenEtaEta->SetLineColor(2); - fhGenOmegaEta->SetLineColor(7); - fhGenEleEta->SetLineColor(6); - //Select the maximum of the histogram to show all lines. - if(fhGenPi0Eta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEtaEta->GetMaximum() && - fhGenPi0Eta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEleEta->GetMaximum()) - haxiseta->SetMaximum(fhGenPi0Eta->GetMaximum()); - else if(fhGenGamEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && - fhGenGamEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEleEta->GetMaximum()) - haxiseta->SetMaximum(fhGenGamEta->GetMaximum()); - else if(fhGenEtaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && - fhGenEtaEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenEleEta->GetMaximum()) - haxiseta->SetMaximum(fhGenEtaEta->GetMaximum()); - else if(fhGenOmegaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && - fhGenOmegaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEleEta->GetMaximum()) - haxiseta->SetMaximum(fhGenOmegaEta->GetMaximum()); - else if(fhGenEleEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && - fhGenEleEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenGamEta->GetMaximum()) - haxiseta->SetMaximum(fhGenEleEta->GetMaximum()); - haxiseta->SetMinimum(100); - haxiseta->Draw("axis"); - fhGenPi0Eta->Draw("same"); - fhGenGamEta->Draw("same"); - fhGenEtaEta->Draw("same"); - fhGenOmegaEta->Draw("same"); - fhGenEleEta->Draw("same"); - - - c10->cd(3) ; - gPad->SetLogy(); - TH1F * haxisphi = (TH1F*) fhGenPi0Phi->Clone(Form("%s_axisphi",fhGenPi0Phi->GetName())); - haxisphi->SetTitle("Generated Particles #phi, |#eta| < 1"); - fhGenPi0Phi->SetLineColor(1); - fhGenGamPhi->SetLineColor(4); - fhGenEtaPhi->SetLineColor(2); - fhGenOmegaPhi->SetLineColor(7); - fhGenElePhi->SetLineColor(6); - //Select the maximum of the histogram to show all lines. - if(fhGenPi0Phi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && - fhGenPi0Phi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenElePhi->GetMaximum()) - haxisphi->SetMaximum(fhGenPi0Phi->GetMaximum()); - else if(fhGenGamPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && - fhGenGamPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenElePhi->GetMaximum()) - haxisphi->SetMaximum(fhGenGamPhi->GetMaximum()); - else if(fhGenEtaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && - fhGenEtaPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenElePhi->GetMaximum()) - haxisphi->SetMaximum(fhGenEtaPhi->GetMaximum()); - else if(fhGenOmegaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && - fhGenOmegaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenElePhi->GetMaximum()) - haxisphi->SetMaximum(fhGenOmegaPhi->GetMaximum()); - else if(fhGenElePhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && - fhGenElePhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenGamPhi->GetMaximum()) - haxisphi->SetMaximum(fhGenElePhi->GetMaximum()); - haxisphi->SetMinimum(100); - haxisphi->Draw("axis"); - fhGenPi0Phi->Draw("same"); - fhGenGamPhi->Draw("same"); - fhGenEtaPhi->Draw("same"); - fhGenOmegaPhi->Draw("same"); - fhGenElePhi->Draw("same"); - - sprintf(name,"QA_%s_GeneratedDistributions.eps",fCalorimeter.Data()); - c10->Print(name); printf("Plot: %s\n",name); - - - //Reconstructed clusters depending on its original particle. - //printf("c1\n"); - sprintf(cname,"QA_%s_recgenid",fCalorimeter.Data()); - TCanvas * c11 = new TCanvas(cname, "Reconstructed particles, function of their original particle ID", 400, 400) ; - c11->Divide(2, 2); - - - c11->cd(1) ; - gPad->SetLogy(); - TH1F * hGamE = (TH1F*) fhGamE->ProjectionX(Form("%s_px",fhGamE->GetName()),-1,-1); - TH1F * hPi0E = (TH1F*) fhPi0E->ProjectionX(Form("%s_px",fhPi0E->GetName()),-1,-1); - TH1F * hEleE = (TH1F*) fhEleE->ProjectionX(Form("%s_px",fhEleE->GetName()),-1,-1); - TH1F * hNeHadE = (TH1F*) fhNeHadE->ProjectionX(Form("%s_px",fhNeHadE->GetName()),-1,-1); - TH1F * hChHadE = (TH1F*) fhChHadE->ProjectionX(Form("%s_px",fhChHadE->GetName()),-1,-1); - TH1F * haxisE = (TH1F*) hPi0E->Clone(Form("%s_axisE",fhPi0E->GetName())); - haxisE->SetTitle("Reconstructed particles E, function of their original particle ID"); - hPi0E->SetLineColor(1); - hGamE->SetLineColor(4); - hNeHadE->SetLineColor(2); - hChHadE->SetLineColor(7); - hEleE->SetLineColor(6); - - //Select the maximum of the histogram to show all lines. - if(hPi0E->GetMaximum() >= hGamE->GetMaximum() && hPi0E->GetMaximum() >= hNeHadE->GetMaximum() && - hPi0E->GetMaximum() >= hChHadE->GetMaximum() && hPi0E->GetMaximum() >= hEleE->GetMaximum()) - haxisE->SetMaximum(hPi0E->GetMaximum()); - else if(hGamE->GetMaximum() >= hPi0E->GetMaximum() && hGamE->GetMaximum() >= hNeHadE->GetMaximum() && - hGamE->GetMaximum() >= hChHadE->GetMaximum() && hGamE->GetMaximum() >= hEleE->GetMaximum()) - haxisE->SetMaximum(hGamE->GetMaximum()); - else if(hNeHadE->GetMaximum() >= hPi0E->GetMaximum() && hNeHadE->GetMaximum() >= hGamE->GetMaximum() && - hNeHadE->GetMaximum() >= hChHadE->GetMaximum() && hNeHadE->GetMaximum() >= hEleE->GetMaximum()) - haxisE->SetMaximum(hNeHadE->GetMaximum()); - else if(hChHadE->GetMaximum() >= hPi0E->GetMaximum() && hChHadE->GetMaximum() >= hNeHadE->GetMaximum() && - hChHadE->GetMaximum() >= hGamE->GetMaximum() && hChHadE->GetMaximum() >= hEleE->GetMaximum()) - haxisE->SetMaximum(hChHadE->GetMaximum()); - else if(hEleE->GetMaximum() >= hPi0E->GetMaximum() && hEleE->GetMaximum() >= hNeHadE->GetMaximum() && - hEleE->GetMaximum() >= hChHadE->GetMaximum() && hEleE->GetMaximum() >= hGamE->GetMaximum()) - haxisE->SetMaximum(hEleE->GetMaximum()); - haxisE->SetXTitle("E (GeV)"); - haxisE->SetMinimum(1); - haxisE->Draw("axis"); - hPi0E->Draw("same"); - hGamE->Draw("same"); - hNeHadE->Draw("same"); - hChHadE->Draw("same"); - hEleE->Draw("same"); - - TLegend pLegend2(0.8,0.65,0.95,0.93); - pLegend2.SetTextSize(0.06); - pLegend2.AddEntry(hPi0E," #pi^{0}","L"); - pLegend2.AddEntry(hGamE," #gamma","L"); - pLegend2.AddEntry(hEleE," e^{#pm}","L"); - pLegend2.AddEntry(hChHadE," h^{#pm}","L"); - pLegend2.AddEntry(hNeHadE," h^{0}","L"); - pLegend2.SetFillColor(10); - pLegend2.SetBorderSize(1); - pLegend2.Draw(); - - - c11->cd(2) ; - gPad->SetLogy(); - //printf("%s, %s, %s, %s, %s\n",fhGamPt->GetName(),fhPi0Pt->GetName(),fhElePt->GetName(),fhNeHadPt->GetName(), fhChHadPt->GetName()); - TH1F * hGamPt = (TH1F*) fhGamPt->ProjectionX(Form("%s_px",fhGamPt->GetName()),-1,-1); - TH1F * hPi0Pt = (TH1F*) fhPi0Pt->ProjectionX(Form("%s_px",fhPi0Pt->GetName()),-1,-1); - TH1F * hElePt = (TH1F*) fhElePt->ProjectionX(Form("%s_px",fhElePt->GetName()),-1,-1); - TH1F * hNeHadPt = (TH1F*) fhNeHadPt->ProjectionX(Form("%s_px",fhNeHadPt->GetName()),-1,-1); - TH1F * hChHadPt = (TH1F*) fhChHadPt->ProjectionX(Form("%s_px",fhChHadPt->GetName()),-1,-1); - haxispt = (TH1F*) hPi0Pt->Clone(Form("%s_axisPt",fhPi0Pt->GetName())); - haxispt->SetTitle("Reconstructed particles p_{T}, function of their original particle ID"); - hPi0Pt->SetLineColor(1); - hGamPt->SetLineColor(4); - hNeHadPt->SetLineColor(2); - hChHadPt->SetLineColor(7); - hElePt->SetLineColor(6); - - //Select the maximum of the histogram to show all lines. - if(hPi0Pt->GetMaximum() >= hGamPt->GetMaximum() && hPi0Pt->GetMaximum() >= hNeHadPt->GetMaximum() && - hPi0Pt->GetMaximum() >= hChHadPt->GetMaximum() && hPi0Pt->GetMaximum() >= hElePt->GetMaximum()) - haxispt->SetMaximum(hPi0Pt->GetMaximum()); - else if(hGamPt->GetMaximum() >= hPi0Pt->GetMaximum() && hGamPt->GetMaximum() >= hNeHadPt->GetMaximum() && - hGamPt->GetMaximum() >= hChHadPt->GetMaximum() && hGamPt->GetMaximum() >= hElePt->GetMaximum()) - haxispt->SetMaximum(hGamPt->GetMaximum()); - else if(hNeHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hNeHadPt->GetMaximum() >= hGamPt->GetMaximum() && - hNeHadPt->GetMaximum() >= hChHadPt->GetMaximum() && hNeHadPt->GetMaximum() >= hElePt->GetMaximum()) - haxispt->SetMaximum(hNeHadPt->GetMaximum()); - else if(hChHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hChHadPt->GetMaximum() >= hNeHadPt->GetMaximum() && - hChHadPt->GetMaximum() >= hGamPt->GetMaximum() && hChHadPt->GetMaximum() >= hElePt->GetMaximum()) - haxispt->SetMaximum(hChHadPt->GetMaximum()); - else if(hElePt->GetMaximum() >= hPi0Pt->GetMaximum() && hElePt->GetMaximum() >= hNeHadPt->GetMaximum() && - hElePt->GetMaximum() >= hChHadPt->GetMaximum() && hElePt->GetMaximum() >= hGamPt->GetMaximum()) - haxispt->SetMaximum(hElePt->GetMaximum()); - haxispt->SetXTitle("p_{T} (GeV/c)"); - haxispt->SetMinimum(1); - haxispt->Draw("axis"); - hPi0Pt->Draw("same"); - hGamPt->Draw("same"); - hNeHadPt->Draw("same"); - hChHadPt->Draw("same"); - hElePt->Draw("same"); - - c11->cd(3) ; - gPad->SetLogy(); - - TH1F * hGamEta = (TH1F*) fhGamEta->ProjectionX(Form("%s_px",fhGamEta->GetName()),-1,-1); - TH1F * hPi0Eta = (TH1F*) fhPi0Eta->ProjectionX(Form("%s_px",fhPi0Eta->GetName()),-1,-1); - TH1F * hEleEta = (TH1F*) fhEleEta->ProjectionX(Form("%s_px",fhEleEta->GetName()),-1,-1); - TH1F * hNeHadEta = (TH1F*) fhNeHadEta->ProjectionX(Form("%s_px",fhNeHadEta->GetName()),-1,-1); - TH1F * hChHadEta = (TH1F*) fhChHadEta->ProjectionX(Form("%s_px",fhChHadEta->GetName()),-1,-1); - haxiseta = (TH1F*) hPi0Eta->Clone(Form("%s_axisEta",fhPi0Eta->GetName())); - haxiseta->SetTitle("Reconstructed particles #eta, function of their original particle ID"); - hPi0Eta->SetLineColor(1); - hGamEta->SetLineColor(4); - hNeHadEta->SetLineColor(2); - hChHadEta->SetLineColor(7); - hEleEta->SetLineColor(6); - //Select the maximum of the histogram to show all lines. - if(hPi0Eta->GetMaximum() >= hGamEta->GetMaximum() && hPi0Eta->GetMaximum() >= hNeHadEta->GetMaximum() && - hPi0Eta->GetMaximum() >= hChHadEta->GetMaximum() && hPi0Eta->GetMaximum() >= hEleEta->GetMaximum()) - haxiseta->SetMaximum(hPi0Eta->GetMaximum()); - else if(hGamEta->GetMaximum() >= hPi0Eta->GetMaximum() && hGamEta->GetMaximum() >= hNeHadEta->GetMaximum() && - hGamEta->GetMaximum() >= hChHadEta->GetMaximum() && hGamEta->GetMaximum() >= hEleEta->GetMaximum()) - haxiseta->SetMaximum(hGamEta->GetMaximum()); - else if(hNeHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hNeHadEta->GetMaximum() >= hGamEta->GetMaximum() && - hNeHadEta->GetMaximum() >= hChHadEta->GetMaximum() && hNeHadEta->GetMaximum() >= hEleEta->GetMaximum()) - haxiseta->SetMaximum(hNeHadEta->GetMaximum()); - else if(hChHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hChHadEta->GetMaximum() >= hNeHadEta->GetMaximum() && - hChHadEta->GetMaximum() >= hGamEta->GetMaximum() && hChHadEta->GetMaximum() >= hEleEta->GetMaximum()) - haxiseta->SetMaximum(hChHadEta->GetMaximum()); - else if(hEleEta->GetMaximum() >= hPi0Eta->GetMaximum() && hEleEta->GetMaximum() >= hNeHadEta->GetMaximum() && - hEleEta->GetMaximum() >= hChHadEta->GetMaximum() && hEleEta->GetMaximum() >= hGamEta->GetMaximum()) - haxiseta->SetMaximum(hEleEta->GetMaximum()); - - haxiseta->SetXTitle("#eta"); - haxiseta->Draw("axis"); - hPi0Eta->Draw("same"); - hGamEta->Draw("same"); - hNeHadEta->Draw("same"); - hChHadEta->Draw("same"); - hEleEta->Draw("same"); - - - c11->cd(4) ; - gPad->SetLogy(); - TH1F * hGamPhi = (TH1F*) fhGamPhi->ProjectionX(Form("%s_px",fhGamPhi->GetName()),-1,-1); - TH1F * hPi0Phi = (TH1F*) fhPi0Phi->ProjectionX(Form("%s_px",fhPi0Phi->GetName()),-1,-1); - TH1F * hElePhi = (TH1F*) fhElePhi->ProjectionX(Form("%s_px",fhElePhi->GetName()),-1,-1); - TH1F * hNeHadPhi = (TH1F*) fhNeHadPhi->ProjectionX(Form("%s_px",fhNeHadPhi->GetName()),-1,-1); - TH1F * hChHadPhi = (TH1F*) fhChHadPhi->ProjectionX(Form("%s_px",fhChHadPhi->GetName()),-1,-1); - haxisphi = (TH1F*) hPi0Phi->Clone(Form("%s_axisPhi",fhPi0Phi->GetName())); - haxisphi->SetTitle("Reconstructed particles #phi, function of their original particle ID"); - - hPi0Phi->SetLineColor(1); - hGamPhi->SetLineColor(4); - hNeHadPhi->SetLineColor(2); - hChHadPhi->SetLineColor(7); - hElePhi->SetLineColor(6); - //Select the maximum of the histogram to show all lines. - if(hPi0Phi->GetMaximum() >= hGamPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hNeHadPhi->GetMaximum() && - hPi0Phi->GetMaximum() >= hChHadPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hElePhi->GetMaximum()) - haxisphi->SetMaximum(hPi0Phi->GetMaximum()); - else if(hGamPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hGamPhi->GetMaximum() >= hNeHadPhi->GetMaximum() && - hGamPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hGamPhi->GetMaximum() >= hElePhi->GetMaximum()) - haxisphi->SetMaximum(hGamPhi->GetMaximum()); - else if(hNeHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hNeHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && - hNeHadPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hNeHadPhi->GetMaximum() >= hElePhi->GetMaximum()) - haxisphi->SetMaximum(hNeHadPhi->GetMaximum()); - else if(hChHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hChHadPhi->GetMaximum() >= hNeHadPhi->GetMaximum() && - hChHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && hChHadPhi->GetMaximum() >= hElePhi->GetMaximum()) - haxisphi->SetMaximum(hChHadPhi->GetMaximum()); - else if(hElePhi->GetMaximum() >= hPi0Phi->GetMaximum() && hElePhi->GetMaximum() >= hNeHadPhi->GetMaximum() && - hElePhi->GetMaximum() >= hChHadPhi->GetMaximum() && hElePhi->GetMaximum() >= hGamPhi->GetMaximum()) - haxisphi->SetMaximum(hElePhi->GetMaximum()); - haxisphi->SetXTitle("#phi (rad)"); - haxisphi->Draw("axis"); - hPi0Phi->Draw("same"); - hGamPhi->Draw("same"); - hNeHadPhi->Draw("same"); - hChHadPhi->Draw("same"); - hElePhi->Draw("same"); - - sprintf(name,"QA_%s_RecDistributionsGenID.eps",fCalorimeter.Data()); - c11->Print(name); printf("Plot: %s\n",name); - - - //Ratio reconstructed clusters / generated particles in acceptance, for different particle ID - //printf("c1\n"); - - TH1F * hPi0EClone = (TH1F*) hPi0E ->Clone(Form("%s_Clone",fhPi0E->GetName())); - TH1F * hGamEClone = (TH1F*) hGamE ->Clone(Form("%s_Clone",fhGamE->GetName())); - TH1F * hPi0PtClone = (TH1F*) hPi0Pt ->Clone(Form("%s_Clone",fhPi0Pt->GetName())); - TH1F * hGamPtClone = (TH1F*) hGamPt ->Clone(Form("%s_Clone",fhGamPt->GetName())); - TH1F * hPi0EtaClone = (TH1F*) hPi0Eta->Clone(Form("%s_Clone",fhPi0Eta->GetName())); - TH1F * hGamEtaClone = (TH1F*) hGamEta->Clone(Form("%s_Clone",fhGamEta->GetName())); - TH1F * hPi0PhiClone = (TH1F*) hPi0Phi->Clone(Form("%s_Clone",fhPi0Phi->GetName())); - TH1F * hGamPhiClone = (TH1F*) hGamPhi->Clone(Form("%s_Clone",fhGamPhi->GetName())); - - sprintf(cname,"QA_%s_recgenidratio",fCalorimeter.Data()); - TCanvas * c12 = new TCanvas(cname, "Ratio reconstructed clusters / generated particles in acceptance, for different particle ID", 400, 400) ; - c12->Divide(2, 2); - - c12->cd(1) ; - gPad->SetLogy(); - haxisE->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); - hPi0EClone->Divide(fhGenPi0AccE); - hGamEClone->Divide(fhGenGamAccE); - haxisE->SetMaximum(5); - haxisE->SetMinimum(1e-2); - haxisE->SetXTitle("E (GeV)"); - haxisE->SetYTitle("ratio = rec/gen"); - haxisE->Draw("axis"); - hPi0E->Draw("same"); - hGamE->Draw("same"); - - TLegend pLegend3(0.75,0.2,0.9,0.4); - pLegend3.SetTextSize(0.06); - pLegend3.AddEntry(hPi0EClone," #pi^{0}","L"); - pLegend3.AddEntry(hGamEClone," #gamma","L"); - pLegend3.SetFillColor(10); - pLegend3.SetBorderSize(1); - pLegend3.Draw(); - - c12->cd(2) ; - gPad->SetLogy(); - haxispt->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); - hPi0PtClone->Divide(fhGenPi0AccPt); - hGamPtClone->Divide(fhGenGamAccPt); - haxispt->SetMaximum(5); - haxispt->SetMinimum(1e-2); - haxispt->SetXTitle("p_{T} (GeV/c)"); - haxispt->SetYTitle("ratio = rec/gen"); - haxispt->Draw("axis"); - hPi0PtClone->Draw("same"); - hGamPtClone->Draw("same"); - - c12->cd(3) ; - gPad->SetLogy(); - - haxiseta->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); - hPi0EtaClone->Divide(fhGenPi0AccEta); - hGamEtaClone->Divide(fhGenGamAccEta); - haxiseta->SetMaximum(1.2); - haxiseta->SetMinimum(1e-2); - haxiseta->SetYTitle("ratio = rec/gen"); - haxiseta->SetXTitle("#eta"); - haxiseta->Draw("axis"); - hPi0EtaClone->Draw("same"); - hGamEtaClone->Draw("same"); - - - c12->cd(4) ; - gPad->SetLogy(); - haxisphi->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); - hPi0PhiClone->Divide(fhGenPi0AccPhi); - hGamPhiClone->Divide(fhGenGamAccPhi); - haxisphi->SetYTitle("ratio = rec/gen"); - haxisphi->SetXTitle("#phi (rad)"); - haxisphi->SetMaximum(1.2); - haxisphi->SetMinimum(1e-2); - haxisphi->Draw("axis"); - hPi0PhiClone->Draw("same"); - hGamPhiClone->Draw("same"); - - sprintf(name,"QA_%s_EfficiencyGenID.eps",fCalorimeter.Data()); - c12->Print(name); printf("Plot: %s\n",name); - - - - //Reconstructed distributions - //printf("c1\n"); - sprintf(cname,"QA_%s_vertex",fCalorimeter.Data()); - TCanvas * c13 = new TCanvas(cname, "Particle vertex", 400, 400) ; - c13->Divide(2, 2); - - c13->cd(1) ; - //gPad->SetLogy(); - fhEMVxyz->SetTitleOffset(1.6,"Y"); - fhEMVxyz->Draw(); - - c13->cd(2) ; - //gPad->SetLogy(); - fhHaVxyz->SetTitleOffset(1.6,"Y"); - fhHaVxyz->Draw(); - - c13->cd(3) ; - gPad->SetLogy(); - TH1F * hEMR = (TH1F*) fhEMR->ProjectionY(Form("%s_py",fhEMR->GetName()),-1,-1); - hEMR->SetLineColor(4); - hEMR->Draw(); - - c13->cd(4) ; - gPad->SetLogy(); - TH1F * hHaR = (TH1F*) fhHaR->ProjectionY(Form("%s_py",fhHaR->GetName()),-1,-1); - hHaR->SetLineColor(4); - hHaR->Draw(); - - - sprintf(name,"QA_%s_ParticleVertex.eps",fCalorimeter.Data()); - c13->Print(name); printf("Plot: %s\n",name); - - - //Track-matching distributions - - //Reconstructed distributions, matched with tracks, generated particle dependence - //printf("c2\n"); - sprintf(cname,"QA_%s_rectrackmatchGenID",fCalorimeter.Data()); - TCanvas * c22ch = new TCanvas(cname, "Reconstructed distributions, matched with tracks, for different particle ID", 400, 400) ; - c22ch->Divide(2, 2); - - c22ch->cd(1) ; - - TH1F * hGamECharged = (TH1F*) fhGamECharged->ProjectionX(Form("%s_px",fhGamECharged->GetName()),-1,-1); - TH1F * hPi0ECharged = (TH1F*) fhPi0ECharged->ProjectionX(Form("%s_px",fhPi0ECharged->GetName()),-1,-1); - TH1F * hEleECharged = (TH1F*) fhEleECharged->ProjectionX(Form("%s_px",fhEleECharged->GetName()),-1,-1); - TH1F * hNeHadECharged = (TH1F*) fhNeHadECharged->ProjectionX(Form("%s_px",fhNeHadECharged->GetName()),-1,-1); - TH1F * hChHadECharged = (TH1F*) fhChHadECharged->ProjectionX(Form("%s_px",fhChHadECharged->GetName()),-1,-1); - hPi0ECharged->SetLineColor(1); - hGamECharged->SetLineColor(4); - hNeHadECharged->SetLineColor(2); - hChHadECharged->SetLineColor(7); - hEleECharged->SetLineColor(6); - gPad->SetLogy(); - fhECharged->SetLineColor(3); - fhECharged->SetMinimum(0.5); - fhECharged->Draw(); - hPi0ECharged->Draw("same"); - hGamECharged->Draw("same"); - hNeHadECharged->Draw("same"); - hChHadECharged->Draw("same"); - hEleECharged->Draw("same"); - TLegend pLegend22(0.75,0.45,0.9,0.8); - pLegend22.SetTextSize(0.06); - pLegend22.AddEntry(fhECharged,"all","L"); - pLegend22.AddEntry(hPi0ECharged,"#pi^{0}","L"); - pLegend22.AddEntry(hGamECharged,"#gamma","L"); - pLegend22.AddEntry(hEleECharged,"e^{#pm}","L"); - pLegend22.AddEntry(hChHadECharged,"h^{#pm}","L"); - pLegend22.AddEntry(hNeHadECharged,"h^{0}","L"); - pLegend22.SetFillColor(10); - pLegend22.SetBorderSize(1); - pLegend22.Draw(); - - c22ch->cd(2) ; - - TH1F * hGamPtCharged = (TH1F*) fhGamPtCharged->ProjectionX(Form("%s_px",fhGamPtCharged->GetName()),-1,-1); - TH1F * hPi0PtCharged = (TH1F*) fhPi0PtCharged->ProjectionX(Form("%s_px",fhPi0PtCharged->GetName()),-1,-1); - TH1F * hElePtCharged = (TH1F*) fhElePtCharged->ProjectionX(Form("%s_px",fhElePtCharged->GetName()),-1,-1); - TH1F * hNeHadPtCharged = (TH1F*) fhNeHadPtCharged->ProjectionX(Form("%s_px",fhNeHadPtCharged->GetName()),-1,-1); - TH1F * hChHadPtCharged = (TH1F*) fhChHadPtCharged->ProjectionX(Form("%s_px",fhChHadPtCharged->GetName()),-1,-1); - hPi0PtCharged->SetLineColor(1); - hGamPtCharged->SetLineColor(4); - hNeHadPtCharged->SetLineColor(2); - hChHadPtCharged->SetLineColor(7); - hElePtCharged->SetLineColor(6); - gPad->SetLogy(); - fhPtCharged->SetLineColor(3); - fhPtCharged->SetMinimum(0.5); - fhPtCharged->Draw(); - hPi0PtCharged->Draw("same"); - hGamPtCharged->Draw("same"); - hNeHadPtCharged->Draw("same"); - hChHadPtCharged->Draw("same"); - hElePtCharged->Draw("same"); - - c22ch->cd(4) ; - - TH1F * hGamEtaCharged = (TH1F*) fhGamEtaCharged->ProjectionX(Form("%s_px",fhGamEtaCharged->GetName()),-1,-1); - TH1F * hPi0EtaCharged = (TH1F*) fhPi0EtaCharged->ProjectionX(Form("%s_px",fhPi0EtaCharged->GetName()),-1,-1); - TH1F * hEleEtaCharged = (TH1F*) fhEleEtaCharged->ProjectionX(Form("%s_px",fhEleEtaCharged->GetName()),-1,-1); - TH1F * hNeHadEtaCharged = (TH1F*) fhNeHadEtaCharged->ProjectionX(Form("%s_px",fhNeHadEtaCharged->GetName()),-1,-1); - TH1F * hChHadEtaCharged = (TH1F*) fhChHadEtaCharged->ProjectionX(Form("%s_px",fhChHadEtaCharged->GetName()),-1,-1); - hPi0EtaCharged->SetLineColor(1); - hGamEtaCharged->SetLineColor(4); - hNeHadEtaCharged->SetLineColor(2); - hChHadEtaCharged->SetLineColor(7); - hEleEtaCharged->SetLineColor(6); - gPad->SetLogy(); - fhEtaCharged->SetLineColor(3); - fhEtaCharged->SetMinimum(0.5); - fhEtaCharged->Draw(); - hPi0EtaCharged->Draw("same"); - hGamEtaCharged->Draw("same"); - hNeHadEtaCharged->Draw("same"); - hChHadEtaCharged->Draw("same"); - hEleEtaCharged->Draw("same"); - - c22ch->cd(3) ; - - TH1F * hGamPhiCharged = (TH1F*) fhGamPhiCharged->ProjectionX(Form("%s_px",fhGamPhiCharged->GetName()),-1,-1); - TH1F * hPi0PhiCharged = (TH1F*) fhPi0PhiCharged->ProjectionX(Form("%s_px",fhPi0PhiCharged->GetName()),-1,-1); - TH1F * hElePhiCharged = (TH1F*) fhElePhiCharged->ProjectionX(Form("%s_px",fhElePhiCharged->GetName()),-1,-1); - TH1F * hNeHadPhiCharged = (TH1F*) fhNeHadPhiCharged->ProjectionX(Form("%s_px",fhNeHadPhiCharged->GetName()),-1,-1); - TH1F * hChHadPhiCharged = (TH1F*) fhChHadPhiCharged->ProjectionX(Form("%s_px",fhChHadPhiCharged->GetName()),-1,-1); - hPi0PhiCharged->SetLineColor(1); - hGamPhiCharged->SetLineColor(4); - hNeHadPhiCharged->SetLineColor(2); - hChHadPhiCharged->SetLineColor(7); - hElePhiCharged->SetLineColor(6); - gPad->SetLogy(); - fhPhiCharged->SetLineColor(3); - fhPhiCharged->SetMinimum(0.5); - fhPhiCharged->Draw(); - hPi0PhiCharged->Draw("same"); - hGamPhiCharged->Draw("same"); - hNeHadPhiCharged->Draw("same"); - hChHadPhiCharged->Draw("same"); - hElePhiCharged->Draw("same"); - - - sprintf(name,"QA_%s_ReconstructedDistributions_TrackMatchedGenID.eps",fCalorimeter.Data()); - c22ch->Print(name); printf("Plot: %s\n",name); - - TH1F * hGamEChargedClone = (TH1F*) hGamECharged->Clone(Form("%s_Clone",fhGamECharged->GetName())); - TH1F * hGamPtChargedClone = (TH1F*) hGamPtCharged->Clone(Form("%s_Clone",fhGamPtCharged->GetName())); - TH1F * hGamEtaChargedClone = (TH1F*) hGamEtaCharged->Clone(Form("%s_Clone",fhGamEtaCharged->GetName())); - TH1F * hGamPhiChargedClone = (TH1F*) hGamPhiCharged->Clone(Form("%s_Clone",fhGamPhiCharged->GetName())); - - TH1F * hPi0EChargedClone = (TH1F*) hPi0ECharged->Clone(Form("%s_Clone",fhPi0ECharged->GetName())); - TH1F * hPi0PtChargedClone = (TH1F*) hPi0PtCharged->Clone(Form("%s_Clone",fhPi0PtCharged->GetName())); - TH1F * hPi0EtaChargedClone = (TH1F*) hPi0EtaCharged->Clone(Form("%s_Clone",fhPi0EtaCharged->GetName())); - TH1F * hPi0PhiChargedClone = (TH1F*) hPi0PhiCharged->Clone(Form("%s_Clone",fhPi0PhiCharged->GetName())); - - TH1F * hEleEChargedClone = (TH1F*) hEleECharged->Clone(Form("%s_Clone",fhEleECharged->GetName())); - TH1F * hElePtChargedClone = (TH1F*) hElePtCharged->Clone(Form("%s_Clone",fhElePtCharged->GetName())); - TH1F * hEleEtaChargedClone = (TH1F*) hEleEtaCharged->Clone(Form("%s_Clone",fhEleEtaCharged->GetName())); - TH1F * hElePhiChargedClone = (TH1F*) hElePhiCharged->Clone(Form("%s_Clone",fhElePhiCharged->GetName())); - - TH1F * hNeHadEChargedClone = (TH1F*) hNeHadECharged->Clone(Form("%s_Clone",fhNeHadECharged->GetName())); - TH1F * hNeHadPtChargedClone = (TH1F*) hNeHadPtCharged->Clone(Form("%s_Clone",fhNeHadPtCharged->GetName())); - TH1F * hNeHadEtaChargedClone = (TH1F*) hNeHadEtaCharged->Clone(Form("%s_Clone",fhNeHadEtaCharged->GetName())); - TH1F * hNeHadPhiChargedClone = (TH1F*) hNeHadPhiCharged->Clone(Form("%s_Clone",fhNeHadPhiCharged->GetName())); - - TH1F * hChHadEChargedClone = (TH1F*) hChHadECharged->Clone(Form("%s_Clone",fhChHadECharged->GetName())); - TH1F * hChHadPtChargedClone = (TH1F*) hChHadPtCharged->Clone(Form("%s_Clone",fhChHadPtCharged->GetName())); - TH1F * hChHadEtaChargedClone = (TH1F*) hChHadEtaCharged->Clone(Form("%s_Clone",fhChHadEtaCharged->GetName())); - TH1F * hChHadPhiChargedClone = (TH1F*) hChHadPhiCharged->Clone(Form("%s_Clone",fhChHadPhiCharged->GetName())); - - //Ratio: reconstructed track matched/ all reconstructed - //printf("c3\n"); - sprintf(cname,"QA_%s_rectrackmatchratGenID",fCalorimeter.Data()); - TCanvas * c3ch = new TCanvas(cname, "Ratio: reconstructed track matched/ all reconstructed, for different particle ID", 400, 400) ; - c3ch->Divide(2, 2); - - c3ch->cd(1) ; - hEChargedClone->SetMaximum(1.2); - hEChargedClone->SetMinimum(0.001); - hEChargedClone->SetLineColor(3); - hEChargedClone->SetYTitle("track matched / all"); - hPi0EChargedClone->Divide(hPi0E); - hGamEChargedClone->Divide(hGamE); - hEleEChargedClone->Divide(hEleE); - hNeHadEChargedClone->Divide(hNeHadE); - hChHadEChargedClone->Divide(hChHadE); - hEChargedClone->Draw(); - hPi0EChargedClone->Draw("same"); - hGamEChargedClone->Draw("same"); - hEleEChargedClone->Draw("same"); - hNeHadEChargedClone->Draw("same"); - hChHadEChargedClone->Draw("same"); - - TLegend pLegend3ch(0.75,0.45,0.9,0.8); - pLegend3ch.SetTextSize(0.06); - pLegend3ch.AddEntry(hEChargedClone,"all","L"); - pLegend3ch.AddEntry(hPi0EChargedClone,"#pi^{0}","L"); - pLegend3ch.AddEntry(hGamEChargedClone,"#gamma","L"); - pLegend3ch.AddEntry(hEleEChargedClone,"e^{#pm}","L"); - pLegend3ch.AddEntry(hChHadEChargedClone,"h^{#pm}","L"); - pLegend3ch.AddEntry(hNeHadEChargedClone,"h^{0}","L"); - pLegend3ch.SetFillColor(10); - pLegend3ch.SetBorderSize(1); - pLegend3ch.Draw(); - - c3ch->cd(2) ; - hPtChargedClone->SetMaximum(1.2); - hPtChargedClone->SetMinimum(0.001); - hPtChargedClone->SetLineColor(3); - hPtChargedClone->SetYTitle("track matched / all"); - hPi0PtChargedClone->Divide(hPi0Pt); - hGamPtChargedClone->Divide(hGamPt); - hElePtChargedClone->Divide(hElePt); - hNeHadPtChargedClone->Divide(hNeHadPt); - hChHadPtChargedClone->Divide(hChHadPt); - hPtChargedClone->Draw(); - hPi0PtChargedClone->Draw("same"); - hGamPtChargedClone->Draw("same"); - hElePtChargedClone->Draw("same"); - hNeHadPtChargedClone->Draw("same"); - hChHadPtChargedClone->Draw("same"); - - c3ch->cd(4) ; - hEtaChargedClone->SetMaximum(1.2); - hEtaChargedClone->SetMinimum(0.001); - hEtaChargedClone->SetLineColor(3); - hEtaChargedClone->SetYTitle("track matched / all"); - hPi0EtaChargedClone->Divide(hPi0Eta); - hGamEtaChargedClone->Divide(hGamEta); - hEleEtaChargedClone->Divide(hEleEta); - hNeHadEtaChargedClone->Divide(hNeHadEta); - hChHadEtaChargedClone->Divide(hChHadEta); - hEtaChargedClone->Draw(); - hPi0EtaChargedClone->Draw("same"); - hGamEtaChargedClone->Draw("same"); - hEleEtaChargedClone->Draw("same"); - hNeHadEtaChargedClone->Draw("same"); - hChHadEtaChargedClone->Draw("same"); - - c3ch->cd(3) ; - hPhiChargedClone->SetMaximum(1.2); - hPhiChargedClone->SetMinimum(0.001); - hPhiChargedClone->SetLineColor(3); - hPhiChargedClone->SetYTitle("track matched / all"); - hPi0PhiChargedClone->Divide(hPi0Phi); - hGamPhiChargedClone->Divide(hGamPhi); - hElePhiChargedClone->Divide(hElePhi); - hNeHadPhiChargedClone->Divide(hNeHadPhi); - hChHadPhiChargedClone->Divide(hChHadPhi); - hPhiChargedClone->Draw(); - hPi0PhiChargedClone->Draw("same"); - hGamPhiChargedClone->Draw("same"); - hElePhiChargedClone->Draw("same"); - hNeHadPhiChargedClone->Draw("same"); - hChHadPhiChargedClone->Draw("same"); - - sprintf(name,"QA_%s_RatioReconstructedMatchedDistributionsGenID.eps",fCalorimeter.Data()); - c3ch->Print(name); printf("Plot: %s\n",name); - + //Reconstructed vs MC distributions + //printf("c6\n"); + sprintf(cname,"QA_%s_recvsmc",fCalorimeter.Data()); + TCanvas * c6 = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ; + c6->Divide(2, 2); + + c6->cd(1) ; + fh2E->SetTitleOffset(1.6,"Y"); + fh2E->SetLineColor(4); + fh2E->Draw(); + + c6->cd(2) ; + fh2Pt->SetTitleOffset(1.6,"Y"); + fh2Pt->SetLineColor(4); + fh2Pt->Draw(); + + c6->cd(3) ; + fh2Phi->SetTitleOffset(1.6,"Y"); + fh2Phi->SetLineColor(4); + fh2Phi->Draw(); + + c6->cd(4) ; + fh2Eta->SetTitleOffset(1.6,"Y"); + fh2Eta->SetLineColor(4); + fh2Eta->Draw(); + + sprintf(name,"QA_%s_ReconstructedVSMCDistributions.eps",fCalorimeter.Data()); + c6->Print(name); printf("Plot: %s\n",name); + + //Reconstructed vs MC distributions + //printf("c6\n"); + sprintf(cname,"QA_%s_gamrecvsmc",fCalorimeter.Data()); + TCanvas * c6Gam = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ; + c6Gam->Divide(2, 2); + + c6Gam->cd(1) ; + fhGamE->Draw(); + + c6Gam->cd(2) ; + fhGamPt->Draw(); + + c6Gam->cd(3) ; + fhGamPhi->Draw(); + + c6Gam->cd(4) ; + fhGamEta->Draw(); + + sprintf(name,"QA_%s_GammaReconstructedVSMCDistributions.eps",fCalorimeter.Data()); + c6->Print(name); printf("Plot: %s\n",name); + + //Generated - reconstructed + //printf("c7\n"); + sprintf(cname,"QA_%s_diffgenrec",fCalorimeter.Data()); + TCanvas * c7 = new TCanvas(cname, "generated - reconstructed", 400, 400) ; + c7->Divide(2, 2); + + c7->cd(1) ; + if(fhDeltaE->GetEntries() > 0) gPad->SetLogy(); + fhGamDeltaE->SetLineColor(4); + fhDeltaE->Draw(); + fhGamDeltaE->Draw("same"); + + TLegend pLegendd(0.65,0.55,0.9,0.8); + pLegendd.SetTextSize(0.06); + pLegendd.AddEntry(fhDeltaE,"all","L"); + pLegendd.AddEntry(fhGamDeltaE,"from #gamma","L"); + pLegendd.SetFillColor(10); + pLegendd.SetBorderSize(1); + pLegendd.Draw(); + + c7->cd(2) ; + if(fhDeltaPt->GetEntries() > 0) gPad->SetLogy(); + fhGamDeltaPt->SetLineColor(4); + fhDeltaPt->Draw(); + fhGamDeltaPt->Draw("same"); + + c7->cd(3) ; + fhGamDeltaPhi->SetLineColor(4); + fhDeltaPhi->Draw(); + fhGamDeltaPhi->Draw("same"); + + c7->cd(4) ; + fhGamDeltaEta->SetLineColor(4); + fhDeltaEta->Draw(); + fhGamDeltaEta->Draw("same"); + + sprintf(name,"QA_%s_DiffGeneratedReconstructed.eps",fCalorimeter.Data()); + c7->Print(name); printf("Plot: %s\n",name); + + // Reconstructed / Generated + //printf("c8\n"); + sprintf(cname,"QA_%s_ratiorecgen",fCalorimeter.Data()); + TCanvas * c8 = new TCanvas(cname, " reconstructed / generated", 400, 400) ; + c8->Divide(2, 2); + + c8->cd(1) ; + if(fhRatioE->GetEntries() > 0) gPad->SetLogy(); + fhGamRatioE->SetLineColor(4); + fhRatioE->Draw(); + fhGamRatioE->Draw("same"); + + TLegend pLegendr(0.65,0.55,0.9,0.8); + pLegendr.SetTextSize(0.06); + pLegendr.AddEntry(fhRatioE,"all","L"); + pLegendr.AddEntry(fhGamRatioE,"from #gamma","L"); + pLegendr.SetFillColor(10); + pLegendr.SetBorderSize(1); + pLegendr.Draw(); + + c8->cd(2) ; + if(fhRatioPt->GetEntries() > 0) gPad->SetLogy(); + fhGamRatioPt->SetLineColor(4); + fhRatioPt->Draw(); + fhGamRatioPt->Draw("same"); + + c8->cd(3) ; + fhGamRatioPhi->SetLineColor(4); + fhRatioPhi->Draw(); + fhGamRatioPhi->Draw("same"); + + c8->cd(4) ; + fhGamRatioEta->SetLineColor(4); + fhRatioEta->Draw(); + fhGamRatioEta->Draw("same"); + + sprintf(name,"QA_%s_ReconstructedDivGenerated.eps",fCalorimeter.Data()); + c8->Print(name); printf("Plot: %s\n",name); + + //MC + + //Generated distributions + //printf("c1\n"); + sprintf(cname,"QA_%s_gen",fCalorimeter.Data()); + TCanvas * c10 = new TCanvas(cname, "Generated distributions", 600, 200) ; + c10->Divide(3, 1); + + c10->cd(1) ; + gPad->SetLogy(); + TH1F * haxispt = (TH1F*) fhGenPi0Pt->Clone(Form("%s_axispt",fhGenPi0Pt->GetName())); + haxispt->SetTitle("Generated Particles p_{T}, |#eta| < 1"); + fhGenPi0Pt->SetLineColor(1); + fhGenGamPt->SetLineColor(4); + fhGenEtaPt->SetLineColor(2); + fhGenOmegaPt->SetLineColor(7); + fhGenElePt->SetLineColor(6); + + //Select the maximum of the histogram to show all lines. + if(fhGenPi0Pt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenEtaPt->GetMaximum() && + fhGenPi0Pt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenElePt->GetMaximum()) + haxispt->SetMaximum(fhGenPi0Pt->GetMaximum()); + else if(fhGenGamPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenEtaPt->GetMaximum() && + fhGenGamPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenElePt->GetMaximum()) + haxispt->SetMaximum(fhGenGamPt->GetMaximum()); + else if(fhGenEtaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && + fhGenEtaPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenElePt->GetMaximum()) + haxispt->SetMaximum(fhGenEtaPt->GetMaximum()); + else if(fhGenOmegaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenEtaPt->GetMaximum() && + fhGenOmegaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenElePt->GetMaximum()) + haxispt->SetMaximum(fhGenOmegaPt->GetMaximum()); + else if(fhGenElePt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenEtaPt->GetMaximum() && + fhGenElePt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenGamPt->GetMaximum()) + haxispt->SetMaximum(fhGenElePt->GetMaximum()); + haxispt->SetMinimum(1); + haxispt->Draw("axis"); + fhGenPi0Pt->Draw("same"); + fhGenGamPt->Draw("same"); + fhGenEtaPt->Draw("same"); + fhGenOmegaPt->Draw("same"); + fhGenElePt->Draw("same"); + + TLegend pLegend(0.85,0.65,0.95,0.93); + pLegend.SetTextSize(0.06); + pLegend.AddEntry(fhGenPi0Pt," #pi^{0}","L"); + pLegend.AddEntry(fhGenGamPt," #gamma","L"); + pLegend.AddEntry(fhGenEtaPt," #eta","L"); + pLegend.AddEntry(fhGenOmegaPt," #omega","L"); + pLegend.AddEntry(fhGenElePt," e^{#pm}","L"); + pLegend.SetFillColor(10); + pLegend.SetBorderSize(1); + pLegend.Draw(); + + c10->cd(2) ; + gPad->SetLogy(); + TH1F * haxiseta = (TH1F*) fhGenPi0Eta->Clone(Form("%s_axiseta",fhGenPi0Eta->GetName())); + haxiseta->SetTitle("Generated Particles #eta, |#eta| < 1"); + fhGenPi0Eta->SetLineColor(1); + fhGenGamEta->SetLineColor(4); + fhGenEtaEta->SetLineColor(2); + fhGenOmegaEta->SetLineColor(7); + fhGenEleEta->SetLineColor(6); + //Select the maximum of the histogram to show all lines. + if(fhGenPi0Eta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEtaEta->GetMaximum() && + fhGenPi0Eta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEleEta->GetMaximum()) + haxiseta->SetMaximum(fhGenPi0Eta->GetMaximum()); + else if(fhGenGamEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && + fhGenGamEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEleEta->GetMaximum()) + haxiseta->SetMaximum(fhGenGamEta->GetMaximum()); + else if(fhGenEtaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && + fhGenEtaEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenEleEta->GetMaximum()) + haxiseta->SetMaximum(fhGenEtaEta->GetMaximum()); + else if(fhGenOmegaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && + fhGenOmegaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEleEta->GetMaximum()) + haxiseta->SetMaximum(fhGenOmegaEta->GetMaximum()); + else if(fhGenEleEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && + fhGenEleEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenGamEta->GetMaximum()) + haxiseta->SetMaximum(fhGenEleEta->GetMaximum()); + haxiseta->SetMinimum(100); + haxiseta->Draw("axis"); + fhGenPi0Eta->Draw("same"); + fhGenGamEta->Draw("same"); + fhGenEtaEta->Draw("same"); + fhGenOmegaEta->Draw("same"); + fhGenEleEta->Draw("same"); + + + c10->cd(3) ; + gPad->SetLogy(); + TH1F * haxisphi = (TH1F*) fhGenPi0Phi->Clone(Form("%s_axisphi",fhGenPi0Phi->GetName())); + haxisphi->SetTitle("Generated Particles #phi, |#eta| < 1"); + fhGenPi0Phi->SetLineColor(1); + fhGenGamPhi->SetLineColor(4); + fhGenEtaPhi->SetLineColor(2); + fhGenOmegaPhi->SetLineColor(7); + fhGenElePhi->SetLineColor(6); + //Select the maximum of the histogram to show all lines. + if(fhGenPi0Phi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && + fhGenPi0Phi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenElePhi->GetMaximum()) + haxisphi->SetMaximum(fhGenPi0Phi->GetMaximum()); + else if(fhGenGamPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && + fhGenGamPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenElePhi->GetMaximum()) + haxisphi->SetMaximum(fhGenGamPhi->GetMaximum()); + else if(fhGenEtaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && + fhGenEtaPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenElePhi->GetMaximum()) + haxisphi->SetMaximum(fhGenEtaPhi->GetMaximum()); + else if(fhGenOmegaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && + fhGenOmegaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenElePhi->GetMaximum()) + haxisphi->SetMaximum(fhGenOmegaPhi->GetMaximum()); + else if(fhGenElePhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && + fhGenElePhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenGamPhi->GetMaximum()) + haxisphi->SetMaximum(fhGenElePhi->GetMaximum()); + haxisphi->SetMinimum(100); + haxisphi->Draw("axis"); + fhGenPi0Phi->Draw("same"); + fhGenGamPhi->Draw("same"); + fhGenEtaPhi->Draw("same"); + fhGenOmegaPhi->Draw("same"); + fhGenElePhi->Draw("same"); + + sprintf(name,"QA_%s_GeneratedDistributions.eps",fCalorimeter.Data()); + c10->Print(name); printf("Plot: %s\n",name); + + + //Reconstructed clusters depending on its original particle. + //printf("c1\n"); + sprintf(cname,"QA_%s_recgenid",fCalorimeter.Data()); + TCanvas * c11 = new TCanvas(cname, "Reconstructed particles, function of their original particle ID", 400, 400) ; + c11->Divide(2, 2); + + + c11->cd(1) ; + gPad->SetLogy(); + TH1F * hGamE = (TH1F*) fhGamE->ProjectionX(Form("%s_px",fhGamE->GetName()),-1,-1); + TH1F * hPi0E = (TH1F*) fhPi0E->ProjectionX(Form("%s_px",fhPi0E->GetName()),-1,-1); + TH1F * hEleE = (TH1F*) fhEleE->ProjectionX(Form("%s_px",fhEleE->GetName()),-1,-1); + TH1F * hNeHadE = (TH1F*) fhNeHadE->ProjectionX(Form("%s_px",fhNeHadE->GetName()),-1,-1); + TH1F * hChHadE = (TH1F*) fhChHadE->ProjectionX(Form("%s_px",fhChHadE->GetName()),-1,-1); + TH1F * haxisE = (TH1F*) hPi0E->Clone(Form("%s_axisE",fhPi0E->GetName())); + haxisE->SetTitle("Reconstructed particles E, function of their original particle ID"); + hPi0E->SetLineColor(1); + hGamE->SetLineColor(4); + hNeHadE->SetLineColor(2); + hChHadE->SetLineColor(7); + hEleE->SetLineColor(6); + + //Select the maximum of the histogram to show all lines. + if(hPi0E->GetMaximum() >= hGamE->GetMaximum() && hPi0E->GetMaximum() >= hNeHadE->GetMaximum() && + hPi0E->GetMaximum() >= hChHadE->GetMaximum() && hPi0E->GetMaximum() >= hEleE->GetMaximum()) + haxisE->SetMaximum(hPi0E->GetMaximum()); + else if(hGamE->GetMaximum() >= hPi0E->GetMaximum() && hGamE->GetMaximum() >= hNeHadE->GetMaximum() && + hGamE->GetMaximum() >= hChHadE->GetMaximum() && hGamE->GetMaximum() >= hEleE->GetMaximum()) + haxisE->SetMaximum(hGamE->GetMaximum()); + else if(hNeHadE->GetMaximum() >= hPi0E->GetMaximum() && hNeHadE->GetMaximum() >= hGamE->GetMaximum() && + hNeHadE->GetMaximum() >= hChHadE->GetMaximum() && hNeHadE->GetMaximum() >= hEleE->GetMaximum()) + haxisE->SetMaximum(hNeHadE->GetMaximum()); + else if(hChHadE->GetMaximum() >= hPi0E->GetMaximum() && hChHadE->GetMaximum() >= hNeHadE->GetMaximum() && + hChHadE->GetMaximum() >= hGamE->GetMaximum() && hChHadE->GetMaximum() >= hEleE->GetMaximum()) + haxisE->SetMaximum(hChHadE->GetMaximum()); + else if(hEleE->GetMaximum() >= hPi0E->GetMaximum() && hEleE->GetMaximum() >= hNeHadE->GetMaximum() && + hEleE->GetMaximum() >= hChHadE->GetMaximum() && hEleE->GetMaximum() >= hGamE->GetMaximum()) + haxisE->SetMaximum(hEleE->GetMaximum()); + haxisE->SetXTitle("E (GeV)"); + haxisE->SetMinimum(1); + haxisE->Draw("axis"); + hPi0E->Draw("same"); + hGamE->Draw("same"); + hNeHadE->Draw("same"); + hChHadE->Draw("same"); + hEleE->Draw("same"); + + TLegend pLegend2(0.8,0.65,0.95,0.93); + pLegend2.SetTextSize(0.06); + pLegend2.AddEntry(hPi0E," #pi^{0}","L"); + pLegend2.AddEntry(hGamE," #gamma","L"); + pLegend2.AddEntry(hEleE," e^{#pm}","L"); + pLegend2.AddEntry(hChHadE," h^{#pm}","L"); + pLegend2.AddEntry(hNeHadE," h^{0}","L"); + pLegend2.SetFillColor(10); + pLegend2.SetBorderSize(1); + pLegend2.Draw(); + + + c11->cd(2) ; + gPad->SetLogy(); + //printf("%s, %s, %s, %s, %s\n",fhGamPt->GetName(),fhPi0Pt->GetName(),fhElePt->GetName(),fhNeHadPt->GetName(), fhChHadPt->GetName()); + TH1F * hGamPt = (TH1F*) fhGamPt->ProjectionX(Form("%s_px",fhGamPt->GetName()),-1,-1); + TH1F * hPi0Pt = (TH1F*) fhPi0Pt->ProjectionX(Form("%s_px",fhPi0Pt->GetName()),-1,-1); + TH1F * hElePt = (TH1F*) fhElePt->ProjectionX(Form("%s_px",fhElePt->GetName()),-1,-1); + TH1F * hNeHadPt = (TH1F*) fhNeHadPt->ProjectionX(Form("%s_px",fhNeHadPt->GetName()),-1,-1); + TH1F * hChHadPt = (TH1F*) fhChHadPt->ProjectionX(Form("%s_px",fhChHadPt->GetName()),-1,-1); + haxispt = (TH1F*) hPi0Pt->Clone(Form("%s_axisPt",fhPi0Pt->GetName())); + haxispt->SetTitle("Reconstructed particles p_{T}, function of their original particle ID"); + hPi0Pt->SetLineColor(1); + hGamPt->SetLineColor(4); + hNeHadPt->SetLineColor(2); + hChHadPt->SetLineColor(7); + hElePt->SetLineColor(6); + + //Select the maximum of the histogram to show all lines. + if(hPi0Pt->GetMaximum() >= hGamPt->GetMaximum() && hPi0Pt->GetMaximum() >= hNeHadPt->GetMaximum() && + hPi0Pt->GetMaximum() >= hChHadPt->GetMaximum() && hPi0Pt->GetMaximum() >= hElePt->GetMaximum()) + haxispt->SetMaximum(hPi0Pt->GetMaximum()); + else if(hGamPt->GetMaximum() >= hPi0Pt->GetMaximum() && hGamPt->GetMaximum() >= hNeHadPt->GetMaximum() && + hGamPt->GetMaximum() >= hChHadPt->GetMaximum() && hGamPt->GetMaximum() >= hElePt->GetMaximum()) + haxispt->SetMaximum(hGamPt->GetMaximum()); + else if(hNeHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hNeHadPt->GetMaximum() >= hGamPt->GetMaximum() && + hNeHadPt->GetMaximum() >= hChHadPt->GetMaximum() && hNeHadPt->GetMaximum() >= hElePt->GetMaximum()) + haxispt->SetMaximum(hNeHadPt->GetMaximum()); + else if(hChHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hChHadPt->GetMaximum() >= hNeHadPt->GetMaximum() && + hChHadPt->GetMaximum() >= hGamPt->GetMaximum() && hChHadPt->GetMaximum() >= hElePt->GetMaximum()) + haxispt->SetMaximum(hChHadPt->GetMaximum()); + else if(hElePt->GetMaximum() >= hPi0Pt->GetMaximum() && hElePt->GetMaximum() >= hNeHadPt->GetMaximum() && + hElePt->GetMaximum() >= hChHadPt->GetMaximum() && hElePt->GetMaximum() >= hGamPt->GetMaximum()) + haxispt->SetMaximum(hElePt->GetMaximum()); + haxispt->SetXTitle("p_{T} (GeV/c)"); + haxispt->SetMinimum(1); + haxispt->Draw("axis"); + hPi0Pt->Draw("same"); + hGamPt->Draw("same"); + hNeHadPt->Draw("same"); + hChHadPt->Draw("same"); + hElePt->Draw("same"); + + c11->cd(3) ; + gPad->SetLogy(); + + TH1F * hGamEta = (TH1F*) fhGamEta->ProjectionX(Form("%s_px",fhGamEta->GetName()),-1,-1); + TH1F * hPi0Eta = (TH1F*) fhPi0Eta->ProjectionX(Form("%s_px",fhPi0Eta->GetName()),-1,-1); + TH1F * hEleEta = (TH1F*) fhEleEta->ProjectionX(Form("%s_px",fhEleEta->GetName()),-1,-1); + TH1F * hNeHadEta = (TH1F*) fhNeHadEta->ProjectionX(Form("%s_px",fhNeHadEta->GetName()),-1,-1); + TH1F * hChHadEta = (TH1F*) fhChHadEta->ProjectionX(Form("%s_px",fhChHadEta->GetName()),-1,-1); + haxiseta = (TH1F*) hPi0Eta->Clone(Form("%s_axisEta",fhPi0Eta->GetName())); + haxiseta->SetTitle("Reconstructed particles #eta, function of their original particle ID"); + hPi0Eta->SetLineColor(1); + hGamEta->SetLineColor(4); + hNeHadEta->SetLineColor(2); + hChHadEta->SetLineColor(7); + hEleEta->SetLineColor(6); + //Select the maximum of the histogram to show all lines. + if(hPi0Eta->GetMaximum() >= hGamEta->GetMaximum() && hPi0Eta->GetMaximum() >= hNeHadEta->GetMaximum() && + hPi0Eta->GetMaximum() >= hChHadEta->GetMaximum() && hPi0Eta->GetMaximum() >= hEleEta->GetMaximum()) + haxiseta->SetMaximum(hPi0Eta->GetMaximum()); + else if(hGamEta->GetMaximum() >= hPi0Eta->GetMaximum() && hGamEta->GetMaximum() >= hNeHadEta->GetMaximum() && + hGamEta->GetMaximum() >= hChHadEta->GetMaximum() && hGamEta->GetMaximum() >= hEleEta->GetMaximum()) + haxiseta->SetMaximum(hGamEta->GetMaximum()); + else if(hNeHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hNeHadEta->GetMaximum() >= hGamEta->GetMaximum() && + hNeHadEta->GetMaximum() >= hChHadEta->GetMaximum() && hNeHadEta->GetMaximum() >= hEleEta->GetMaximum()) + haxiseta->SetMaximum(hNeHadEta->GetMaximum()); + else if(hChHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hChHadEta->GetMaximum() >= hNeHadEta->GetMaximum() && + hChHadEta->GetMaximum() >= hGamEta->GetMaximum() && hChHadEta->GetMaximum() >= hEleEta->GetMaximum()) + haxiseta->SetMaximum(hChHadEta->GetMaximum()); + else if(hEleEta->GetMaximum() >= hPi0Eta->GetMaximum() && hEleEta->GetMaximum() >= hNeHadEta->GetMaximum() && + hEleEta->GetMaximum() >= hChHadEta->GetMaximum() && hEleEta->GetMaximum() >= hGamEta->GetMaximum()) + haxiseta->SetMaximum(hEleEta->GetMaximum()); + + haxiseta->SetXTitle("#eta"); + haxiseta->Draw("axis"); + hPi0Eta->Draw("same"); + hGamEta->Draw("same"); + hNeHadEta->Draw("same"); + hChHadEta->Draw("same"); + hEleEta->Draw("same"); + + + c11->cd(4) ; + gPad->SetLogy(); + TH1F * hGamPhi = (TH1F*) fhGamPhi->ProjectionX(Form("%s_px",fhGamPhi->GetName()),-1,-1); + TH1F * hPi0Phi = (TH1F*) fhPi0Phi->ProjectionX(Form("%s_px",fhPi0Phi->GetName()),-1,-1); + TH1F * hElePhi = (TH1F*) fhElePhi->ProjectionX(Form("%s_px",fhElePhi->GetName()),-1,-1); + TH1F * hNeHadPhi = (TH1F*) fhNeHadPhi->ProjectionX(Form("%s_px",fhNeHadPhi->GetName()),-1,-1); + TH1F * hChHadPhi = (TH1F*) fhChHadPhi->ProjectionX(Form("%s_px",fhChHadPhi->GetName()),-1,-1); + haxisphi = (TH1F*) hPi0Phi->Clone(Form("%s_axisPhi",fhPi0Phi->GetName())); + haxisphi->SetTitle("Reconstructed particles #phi, function of their original particle ID"); + + hPi0Phi->SetLineColor(1); + hGamPhi->SetLineColor(4); + hNeHadPhi->SetLineColor(2); + hChHadPhi->SetLineColor(7); + hElePhi->SetLineColor(6); + //Select the maximum of the histogram to show all lines. + if(hPi0Phi->GetMaximum() >= hGamPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hNeHadPhi->GetMaximum() && + hPi0Phi->GetMaximum() >= hChHadPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hElePhi->GetMaximum()) + haxisphi->SetMaximum(hPi0Phi->GetMaximum()); + else if(hGamPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hGamPhi->GetMaximum() >= hNeHadPhi->GetMaximum() && + hGamPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hGamPhi->GetMaximum() >= hElePhi->GetMaximum()) + haxisphi->SetMaximum(hGamPhi->GetMaximum()); + else if(hNeHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hNeHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && + hNeHadPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hNeHadPhi->GetMaximum() >= hElePhi->GetMaximum()) + haxisphi->SetMaximum(hNeHadPhi->GetMaximum()); + else if(hChHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hChHadPhi->GetMaximum() >= hNeHadPhi->GetMaximum() && + hChHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && hChHadPhi->GetMaximum() >= hElePhi->GetMaximum()) + haxisphi->SetMaximum(hChHadPhi->GetMaximum()); + else if(hElePhi->GetMaximum() >= hPi0Phi->GetMaximum() && hElePhi->GetMaximum() >= hNeHadPhi->GetMaximum() && + hElePhi->GetMaximum() >= hChHadPhi->GetMaximum() && hElePhi->GetMaximum() >= hGamPhi->GetMaximum()) + haxisphi->SetMaximum(hElePhi->GetMaximum()); + haxisphi->SetXTitle("#phi (rad)"); + haxisphi->Draw("axis"); + hPi0Phi->Draw("same"); + hGamPhi->Draw("same"); + hNeHadPhi->Draw("same"); + hChHadPhi->Draw("same"); + hElePhi->Draw("same"); + + sprintf(name,"QA_%s_RecDistributionsGenID.eps",fCalorimeter.Data()); + c11->Print(name); printf("Plot: %s\n",name); + + + //Ratio reconstructed clusters / generated particles in acceptance, for different particle ID + //printf("c1\n"); + + TH1F * hPi0EClone = (TH1F*) hPi0E ->Clone(Form("%s_Clone",fhPi0E->GetName())); + TH1F * hGamEClone = (TH1F*) hGamE ->Clone(Form("%s_Clone",fhGamE->GetName())); + TH1F * hPi0PtClone = (TH1F*) hPi0Pt ->Clone(Form("%s_Clone",fhPi0Pt->GetName())); + TH1F * hGamPtClone = (TH1F*) hGamPt ->Clone(Form("%s_Clone",fhGamPt->GetName())); + TH1F * hPi0EtaClone = (TH1F*) hPi0Eta->Clone(Form("%s_Clone",fhPi0Eta->GetName())); + TH1F * hGamEtaClone = (TH1F*) hGamEta->Clone(Form("%s_Clone",fhGamEta->GetName())); + TH1F * hPi0PhiClone = (TH1F*) hPi0Phi->Clone(Form("%s_Clone",fhPi0Phi->GetName())); + TH1F * hGamPhiClone = (TH1F*) hGamPhi->Clone(Form("%s_Clone",fhGamPhi->GetName())); + + sprintf(cname,"QA_%s_recgenidratio",fCalorimeter.Data()); + TCanvas * c12 = new TCanvas(cname, "Ratio reconstructed clusters / generated particles in acceptance, for different particle ID", 400, 400) ; + c12->Divide(2, 2); + + c12->cd(1) ; + gPad->SetLogy(); + haxisE->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); + hPi0EClone->Divide(fhGenPi0AccE); + hGamEClone->Divide(fhGenGamAccE); + haxisE->SetMaximum(5); + haxisE->SetMinimum(1e-2); + haxisE->SetXTitle("E (GeV)"); + haxisE->SetYTitle("ratio = rec/gen"); + haxisE->Draw("axis"); + hPi0E->Draw("same"); + hGamE->Draw("same"); + + TLegend pLegend3(0.75,0.2,0.9,0.4); + pLegend3.SetTextSize(0.06); + pLegend3.AddEntry(hPi0EClone," #pi^{0}","L"); + pLegend3.AddEntry(hGamEClone," #gamma","L"); + pLegend3.SetFillColor(10); + pLegend3.SetBorderSize(1); + pLegend3.Draw(); + + c12->cd(2) ; + gPad->SetLogy(); + haxispt->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); + hPi0PtClone->Divide(fhGenPi0AccPt); + hGamPtClone->Divide(fhGenGamAccPt); + haxispt->SetMaximum(5); + haxispt->SetMinimum(1e-2); + haxispt->SetXTitle("p_{T} (GeV/c)"); + haxispt->SetYTitle("ratio = rec/gen"); + haxispt->Draw("axis"); + hPi0PtClone->Draw("same"); + hGamPtClone->Draw("same"); + + c12->cd(3) ; + gPad->SetLogy(); + + haxiseta->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); + hPi0EtaClone->Divide(fhGenPi0AccEta); + hGamEtaClone->Divide(fhGenGamAccEta); + haxiseta->SetMaximum(1.2); + haxiseta->SetMinimum(1e-2); + haxiseta->SetYTitle("ratio = rec/gen"); + haxiseta->SetXTitle("#eta"); + haxiseta->Draw("axis"); + hPi0EtaClone->Draw("same"); + hGamEtaClone->Draw("same"); + + + c12->cd(4) ; + gPad->SetLogy(); + haxisphi->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID"); + hPi0PhiClone->Divide(fhGenPi0AccPhi); + hGamPhiClone->Divide(fhGenGamAccPhi); + haxisphi->SetYTitle("ratio = rec/gen"); + haxisphi->SetXTitle("#phi (rad)"); + haxisphi->SetMaximum(1.2); + haxisphi->SetMinimum(1e-2); + haxisphi->Draw("axis"); + hPi0PhiClone->Draw("same"); + hGamPhiClone->Draw("same"); + + sprintf(name,"QA_%s_EfficiencyGenID.eps",fCalorimeter.Data()); + c12->Print(name); printf("Plot: %s\n",name); + + + + //Reconstructed distributions + //printf("c1\n"); + sprintf(cname,"QA_%s_vertex",fCalorimeter.Data()); + TCanvas * c13 = new TCanvas(cname, "Particle vertex", 400, 400) ; + c13->Divide(2, 2); + + c13->cd(1) ; + //gPad->SetLogy(); + fhEMVxyz->SetTitleOffset(1.6,"Y"); + fhEMVxyz->Draw(); + + c13->cd(2) ; + //gPad->SetLogy(); + fhHaVxyz->SetTitleOffset(1.6,"Y"); + fhHaVxyz->Draw(); + + c13->cd(3) ; + gPad->SetLogy(); + TH1F * hEMR = (TH1F*) fhEMR->ProjectionY(Form("%s_py",fhEMR->GetName()),-1,-1); + hEMR->SetLineColor(4); + hEMR->Draw(); + + c13->cd(4) ; + gPad->SetLogy(); + TH1F * hHaR = (TH1F*) fhHaR->ProjectionY(Form("%s_py",fhHaR->GetName()),-1,-1); + hHaR->SetLineColor(4); + hHaR->Draw(); + + + sprintf(name,"QA_%s_ParticleVertex.eps",fCalorimeter.Data()); + c13->Print(name); printf("Plot: %s\n",name); + + + //Track-matching distributions + + //Reconstructed distributions, matched with tracks, generated particle dependence + //printf("c2\n"); + sprintf(cname,"QA_%s_rectrackmatchGenID",fCalorimeter.Data()); + TCanvas * c22ch = new TCanvas(cname, "Reconstructed distributions, matched with tracks, for different particle ID", 400, 400) ; + c22ch->Divide(2, 2); + + c22ch->cd(1) ; + + TH1F * hGamECharged = (TH1F*) fhGamECharged->ProjectionX(Form("%s_px",fhGamECharged->GetName()),-1,-1); + TH1F * hPi0ECharged = (TH1F*) fhPi0ECharged->ProjectionX(Form("%s_px",fhPi0ECharged->GetName()),-1,-1); + TH1F * hEleECharged = (TH1F*) fhEleECharged->ProjectionX(Form("%s_px",fhEleECharged->GetName()),-1,-1); + TH1F * hNeHadECharged = (TH1F*) fhNeHadECharged->ProjectionX(Form("%s_px",fhNeHadECharged->GetName()),-1,-1); + TH1F * hChHadECharged = (TH1F*) fhChHadECharged->ProjectionX(Form("%s_px",fhChHadECharged->GetName()),-1,-1); + hPi0ECharged->SetLineColor(1); + hGamECharged->SetLineColor(4); + hNeHadECharged->SetLineColor(2); + hChHadECharged->SetLineColor(7); + hEleECharged->SetLineColor(6); + gPad->SetLogy(); + fhECharged->SetLineColor(3); + fhECharged->SetMinimum(0.5); + fhECharged->Draw(); + hPi0ECharged->Draw("same"); + hGamECharged->Draw("same"); + hNeHadECharged->Draw("same"); + hChHadECharged->Draw("same"); + hEleECharged->Draw("same"); + TLegend pLegend22(0.75,0.45,0.9,0.8); + pLegend22.SetTextSize(0.06); + pLegend22.AddEntry(fhECharged,"all","L"); + pLegend22.AddEntry(hPi0ECharged,"#pi^{0}","L"); + pLegend22.AddEntry(hGamECharged,"#gamma","L"); + pLegend22.AddEntry(hEleECharged,"e^{#pm}","L"); + pLegend22.AddEntry(hChHadECharged,"h^{#pm}","L"); + pLegend22.AddEntry(hNeHadECharged,"h^{0}","L"); + pLegend22.SetFillColor(10); + pLegend22.SetBorderSize(1); + pLegend22.Draw(); + + c22ch->cd(2) ; + + TH1F * hGamPtCharged = (TH1F*) fhGamPtCharged->ProjectionX(Form("%s_px",fhGamPtCharged->GetName()),-1,-1); + TH1F * hPi0PtCharged = (TH1F*) fhPi0PtCharged->ProjectionX(Form("%s_px",fhPi0PtCharged->GetName()),-1,-1); + TH1F * hElePtCharged = (TH1F*) fhElePtCharged->ProjectionX(Form("%s_px",fhElePtCharged->GetName()),-1,-1); + TH1F * hNeHadPtCharged = (TH1F*) fhNeHadPtCharged->ProjectionX(Form("%s_px",fhNeHadPtCharged->GetName()),-1,-1); + TH1F * hChHadPtCharged = (TH1F*) fhChHadPtCharged->ProjectionX(Form("%s_px",fhChHadPtCharged->GetName()),-1,-1); + hPi0PtCharged->SetLineColor(1); + hGamPtCharged->SetLineColor(4); + hNeHadPtCharged->SetLineColor(2); + hChHadPtCharged->SetLineColor(7); + hElePtCharged->SetLineColor(6); + gPad->SetLogy(); + fhPtCharged->SetLineColor(3); + fhPtCharged->SetMinimum(0.5); + fhPtCharged->Draw(); + hPi0PtCharged->Draw("same"); + hGamPtCharged->Draw("same"); + hNeHadPtCharged->Draw("same"); + hChHadPtCharged->Draw("same"); + hElePtCharged->Draw("same"); + + c22ch->cd(4) ; + + TH1F * hGamEtaCharged = (TH1F*) fhGamEtaCharged->ProjectionX(Form("%s_px",fhGamEtaCharged->GetName()),-1,-1); + TH1F * hPi0EtaCharged = (TH1F*) fhPi0EtaCharged->ProjectionX(Form("%s_px",fhPi0EtaCharged->GetName()),-1,-1); + TH1F * hEleEtaCharged = (TH1F*) fhEleEtaCharged->ProjectionX(Form("%s_px",fhEleEtaCharged->GetName()),-1,-1); + TH1F * hNeHadEtaCharged = (TH1F*) fhNeHadEtaCharged->ProjectionX(Form("%s_px",fhNeHadEtaCharged->GetName()),-1,-1); + TH1F * hChHadEtaCharged = (TH1F*) fhChHadEtaCharged->ProjectionX(Form("%s_px",fhChHadEtaCharged->GetName()),-1,-1); + hPi0EtaCharged->SetLineColor(1); + hGamEtaCharged->SetLineColor(4); + hNeHadEtaCharged->SetLineColor(2); + hChHadEtaCharged->SetLineColor(7); + hEleEtaCharged->SetLineColor(6); + gPad->SetLogy(); + fhEtaCharged->SetLineColor(3); + fhEtaCharged->SetMinimum(0.5); + fhEtaCharged->Draw(); + hPi0EtaCharged->Draw("same"); + hGamEtaCharged->Draw("same"); + hNeHadEtaCharged->Draw("same"); + hChHadEtaCharged->Draw("same"); + hEleEtaCharged->Draw("same"); + + c22ch->cd(3) ; + + TH1F * hGamPhiCharged = (TH1F*) fhGamPhiCharged->ProjectionX(Form("%s_px",fhGamPhiCharged->GetName()),-1,-1); + TH1F * hPi0PhiCharged = (TH1F*) fhPi0PhiCharged->ProjectionX(Form("%s_px",fhPi0PhiCharged->GetName()),-1,-1); + TH1F * hElePhiCharged = (TH1F*) fhElePhiCharged->ProjectionX(Form("%s_px",fhElePhiCharged->GetName()),-1,-1); + TH1F * hNeHadPhiCharged = (TH1F*) fhNeHadPhiCharged->ProjectionX(Form("%s_px",fhNeHadPhiCharged->GetName()),-1,-1); + TH1F * hChHadPhiCharged = (TH1F*) fhChHadPhiCharged->ProjectionX(Form("%s_px",fhChHadPhiCharged->GetName()),-1,-1); + hPi0PhiCharged->SetLineColor(1); + hGamPhiCharged->SetLineColor(4); + hNeHadPhiCharged->SetLineColor(2); + hChHadPhiCharged->SetLineColor(7); + hElePhiCharged->SetLineColor(6); + gPad->SetLogy(); + fhPhiCharged->SetLineColor(3); + fhPhiCharged->SetMinimum(0.5); + fhPhiCharged->Draw(); + hPi0PhiCharged->Draw("same"); + hGamPhiCharged->Draw("same"); + hNeHadPhiCharged->Draw("same"); + hChHadPhiCharged->Draw("same"); + hElePhiCharged->Draw("same"); + + + sprintf(name,"QA_%s_ReconstructedDistributions_TrackMatchedGenID.eps",fCalorimeter.Data()); + c22ch->Print(name); printf("Plot: %s\n",name); + + TH1F * hGamEChargedClone = (TH1F*) hGamECharged->Clone(Form("%s_Clone",fhGamECharged->GetName())); + TH1F * hGamPtChargedClone = (TH1F*) hGamPtCharged->Clone(Form("%s_Clone",fhGamPtCharged->GetName())); + TH1F * hGamEtaChargedClone = (TH1F*) hGamEtaCharged->Clone(Form("%s_Clone",fhGamEtaCharged->GetName())); + TH1F * hGamPhiChargedClone = (TH1F*) hGamPhiCharged->Clone(Form("%s_Clone",fhGamPhiCharged->GetName())); + + TH1F * hPi0EChargedClone = (TH1F*) hPi0ECharged->Clone(Form("%s_Clone",fhPi0ECharged->GetName())); + TH1F * hPi0PtChargedClone = (TH1F*) hPi0PtCharged->Clone(Form("%s_Clone",fhPi0PtCharged->GetName())); + TH1F * hPi0EtaChargedClone = (TH1F*) hPi0EtaCharged->Clone(Form("%s_Clone",fhPi0EtaCharged->GetName())); + TH1F * hPi0PhiChargedClone = (TH1F*) hPi0PhiCharged->Clone(Form("%s_Clone",fhPi0PhiCharged->GetName())); + + TH1F * hEleEChargedClone = (TH1F*) hEleECharged->Clone(Form("%s_Clone",fhEleECharged->GetName())); + TH1F * hElePtChargedClone = (TH1F*) hElePtCharged->Clone(Form("%s_Clone",fhElePtCharged->GetName())); + TH1F * hEleEtaChargedClone = (TH1F*) hEleEtaCharged->Clone(Form("%s_Clone",fhEleEtaCharged->GetName())); + TH1F * hElePhiChargedClone = (TH1F*) hElePhiCharged->Clone(Form("%s_Clone",fhElePhiCharged->GetName())); + + TH1F * hNeHadEChargedClone = (TH1F*) hNeHadECharged->Clone(Form("%s_Clone",fhNeHadECharged->GetName())); + TH1F * hNeHadPtChargedClone = (TH1F*) hNeHadPtCharged->Clone(Form("%s_Clone",fhNeHadPtCharged->GetName())); + TH1F * hNeHadEtaChargedClone = (TH1F*) hNeHadEtaCharged->Clone(Form("%s_Clone",fhNeHadEtaCharged->GetName())); + TH1F * hNeHadPhiChargedClone = (TH1F*) hNeHadPhiCharged->Clone(Form("%s_Clone",fhNeHadPhiCharged->GetName())); + + TH1F * hChHadEChargedClone = (TH1F*) hChHadECharged->Clone(Form("%s_Clone",fhChHadECharged->GetName())); + TH1F * hChHadPtChargedClone = (TH1F*) hChHadPtCharged->Clone(Form("%s_Clone",fhChHadPtCharged->GetName())); + TH1F * hChHadEtaChargedClone = (TH1F*) hChHadEtaCharged->Clone(Form("%s_Clone",fhChHadEtaCharged->GetName())); + TH1F * hChHadPhiChargedClone = (TH1F*) hChHadPhiCharged->Clone(Form("%s_Clone",fhChHadPhiCharged->GetName())); + + //Ratio: reconstructed track matched/ all reconstructed + //printf("c3\n"); + sprintf(cname,"QA_%s_rectrackmatchratGenID",fCalorimeter.Data()); + TCanvas * c3ch = new TCanvas(cname, "Ratio: reconstructed track matched/ all reconstructed, for different particle ID", 400, 400) ; + c3ch->Divide(2, 2); + + c3ch->cd(1) ; + hEChargedClone->SetMaximum(1.2); + hEChargedClone->SetMinimum(0.001); + hEChargedClone->SetLineColor(3); + hEChargedClone->SetYTitle("track matched / all"); + hPi0EChargedClone->Divide(hPi0E); + hGamEChargedClone->Divide(hGamE); + hEleEChargedClone->Divide(hEleE); + hNeHadEChargedClone->Divide(hNeHadE); + hChHadEChargedClone->Divide(hChHadE); + hEChargedClone->Draw(); + hPi0EChargedClone->Draw("same"); + hGamEChargedClone->Draw("same"); + hEleEChargedClone->Draw("same"); + hNeHadEChargedClone->Draw("same"); + hChHadEChargedClone->Draw("same"); + + TLegend pLegend3ch(0.75,0.45,0.9,0.8); + pLegend3ch.SetTextSize(0.06); + pLegend3ch.AddEntry(hEChargedClone,"all","L"); + pLegend3ch.AddEntry(hPi0EChargedClone,"#pi^{0}","L"); + pLegend3ch.AddEntry(hGamEChargedClone,"#gamma","L"); + pLegend3ch.AddEntry(hEleEChargedClone,"e^{#pm}","L"); + pLegend3ch.AddEntry(hChHadEChargedClone,"h^{#pm}","L"); + pLegend3ch.AddEntry(hNeHadEChargedClone,"h^{0}","L"); + pLegend3ch.SetFillColor(10); + pLegend3ch.SetBorderSize(1); + pLegend3ch.Draw(); + + c3ch->cd(2) ; + hPtChargedClone->SetMaximum(1.2); + hPtChargedClone->SetMinimum(0.001); + hPtChargedClone->SetLineColor(3); + hPtChargedClone->SetYTitle("track matched / all"); + hPi0PtChargedClone->Divide(hPi0Pt); + hGamPtChargedClone->Divide(hGamPt); + hElePtChargedClone->Divide(hElePt); + hNeHadPtChargedClone->Divide(hNeHadPt); + hChHadPtChargedClone->Divide(hChHadPt); + hPtChargedClone->Draw(); + hPi0PtChargedClone->Draw("same"); + hGamPtChargedClone->Draw("same"); + hElePtChargedClone->Draw("same"); + hNeHadPtChargedClone->Draw("same"); + hChHadPtChargedClone->Draw("same"); + + c3ch->cd(4) ; + hEtaChargedClone->SetMaximum(1.2); + hEtaChargedClone->SetMinimum(0.001); + hEtaChargedClone->SetLineColor(3); + hEtaChargedClone->SetYTitle("track matched / all"); + hPi0EtaChargedClone->Divide(hPi0Eta); + hGamEtaChargedClone->Divide(hGamEta); + hEleEtaChargedClone->Divide(hEleEta); + hNeHadEtaChargedClone->Divide(hNeHadEta); + hChHadEtaChargedClone->Divide(hChHadEta); + hEtaChargedClone->Draw(); + hPi0EtaChargedClone->Draw("same"); + hGamEtaChargedClone->Draw("same"); + hEleEtaChargedClone->Draw("same"); + hNeHadEtaChargedClone->Draw("same"); + hChHadEtaChargedClone->Draw("same"); + + c3ch->cd(3) ; + hPhiChargedClone->SetMaximum(1.2); + hPhiChargedClone->SetMinimum(0.001); + hPhiChargedClone->SetLineColor(3); + hPhiChargedClone->SetYTitle("track matched / all"); + hPi0PhiChargedClone->Divide(hPi0Phi); + hGamPhiChargedClone->Divide(hGamPhi); + hElePhiChargedClone->Divide(hElePhi); + hNeHadPhiChargedClone->Divide(hNeHadPhi); + hChHadPhiChargedClone->Divide(hChHadPhi); + hPhiChargedClone->Draw(); + hPi0PhiChargedClone->Draw("same"); + hGamPhiChargedClone->Draw("same"); + hElePhiChargedClone->Draw("same"); + hNeHadPhiChargedClone->Draw("same"); + hChHadPhiChargedClone->Draw("same"); + + sprintf(name,"QA_%s_RatioReconstructedMatchedDistributionsGenID.eps",fCalorimeter.Data()); + c3ch->Print(name); printf("Plot: %s\n",name); + } - //Track-matching distributions - + //Track-matching distributions + sprintf(cname,"QA_%s_trkmatch",fCalorimeter.Data()); TCanvas *cme = new TCanvas(cname,"Track-matching distributions", 400, 400); cme->Divide(2,2); - + TLegend pLegendpE0(0.6,0.55,0.9,0.8); pLegendpE0.SetTextSize(0.04); pLegendpE0.AddEntry(fh1pOverE,"all","L"); pLegendpE0.AddEntry(fh1pOverER02,"dR < 0.02","L"); pLegendpE0.SetFillColor(10); pLegendpE0.SetBorderSize(1); - //pLegendpE0.Draw(); - + //pLegendpE0.Draw(); + cme->cd(1); if(fh1pOverE->GetEntries() > 0) gPad->SetLogy(); fh1pOverE->SetTitle("Track matches p/E"); @@ -5528,7 +5227,7 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) fh1pOverER02->SetLineColor(4); fh1pOverER02->Draw("same"); pLegendpE0.Draw(); - + cme->cd(2); if(fh1dR->GetEntries() > 0) gPad->SetLogy(); fh1dR->Draw(); @@ -5543,121 +5242,121 @@ void AliAnaCalorimeterQA::Terminate(TList* outputList) cme->Print(name); printf("Plot: %s\n",name); if(IsDataMC()){ - sprintf(cname,"QA_%s_trkmatchMCEle",fCalorimeter.Data()); - TCanvas *cmemc = new TCanvas(cname,"Track-matching distributions from MC electrons", 600, 200); - cmemc->Divide(3,1); - - cmemc->cd(1); - gPad->SetLogy(); - fhMCEle1pOverE->Draw(); - fhMCEle1pOverER02->SetLineColor(4); - fhMCEle1pOverE->SetLineColor(1); - fhMCEle1pOverER02->Draw("same"); - pLegendpE0.Draw(); - - cmemc->cd(2); - gPad->SetLogy(); - fhMCEle1dR->Draw(); - - cmemc->cd(3); - fhMCEle2MatchdEdx->Draw(); - - sprintf(name,"QA_%s_TrackMatchingDistMCEle.eps",fCalorimeter.Data()); - cmemc->Print(name); printf("Plot: %s\n",name); - - - sprintf(cname,"QA_%s_trkmatchMCChHad",fCalorimeter.Data()); - TCanvas *cmemchad = new TCanvas(cname,"Track-matching distributions from MC charged hadrons", 600, 200); - cmemchad->Divide(3,1); - - cmemchad->cd(1); - gPad->SetLogy(); - fhMCChHad1pOverE->Draw(); - fhMCChHad1pOverER02->SetLineColor(4); - fhMCChHad1pOverE->SetLineColor(1); - fhMCChHad1pOverER02->Draw("same"); - pLegendpE0.Draw(); - - cmemchad->cd(2); - gPad->SetLogy(); - fhMCChHad1dR->Draw(); - - cmemchad->cd(3); - fhMCChHad2MatchdEdx->Draw(); - - sprintf(name,"QA_%s_TrackMatchingDistMCChHad.eps",fCalorimeter.Data()); - cmemchad->Print(name); printf("Plot: %s\n",name); - - sprintf(cname,"QA_%s_trkmatchMCNeutral",fCalorimeter.Data()); - TCanvas *cmemcn = new TCanvas(cname,"Track-matching distributions from MC neutrals", 600, 200); - cmemcn->Divide(3,1); - - cmemcn->cd(1); - gPad->SetLogy(); - fhMCNeutral1pOverE->Draw(); - fhMCNeutral1pOverE->SetLineColor(1); - fhMCNeutral1pOverER02->SetLineColor(4); - fhMCNeutral1pOverER02->Draw("same"); - pLegendpE0.Draw(); - - cmemcn->cd(2); - gPad->SetLogy(); - fhMCNeutral1dR->Draw(); - - cmemcn->cd(3); - fhMCNeutral2MatchdEdx->Draw(); + sprintf(cname,"QA_%s_trkmatchMCEle",fCalorimeter.Data()); + TCanvas *cmemc = new TCanvas(cname,"Track-matching distributions from MC electrons", 600, 200); + cmemc->Divide(3,1); + + cmemc->cd(1); + gPad->SetLogy(); + fhMCEle1pOverE->Draw(); + fhMCEle1pOverER02->SetLineColor(4); + fhMCEle1pOverE->SetLineColor(1); + fhMCEle1pOverER02->Draw("same"); + pLegendpE0.Draw(); + + cmemc->cd(2); + gPad->SetLogy(); + fhMCEle1dR->Draw(); + + cmemc->cd(3); + fhMCEle2MatchdEdx->Draw(); + + sprintf(name,"QA_%s_TrackMatchingDistMCEle.eps",fCalorimeter.Data()); + cmemc->Print(name); printf("Plot: %s\n",name); + - sprintf(name,"QA_%s_TrackMatchingDistMCNeutral.eps",fCalorimeter.Data()); - cmemcn->Print(name); printf("Plot: %s\n",name); - - sprintf(cname,"QA_%s_trkmatchpE",fCalorimeter.Data()); - TCanvas *cmpoe = new TCanvas(cname,"Track-matching distributions, p/E", 400, 200); - cmpoe->Divide(2,1); + sprintf(cname,"QA_%s_trkmatchMCChHad",fCalorimeter.Data()); + TCanvas *cmemchad = new TCanvas(cname,"Track-matching distributions from MC charged hadrons", 600, 200); + cmemchad->Divide(3,1); + + cmemchad->cd(1); + gPad->SetLogy(); + fhMCChHad1pOverE->Draw(); + fhMCChHad1pOverER02->SetLineColor(4); + fhMCChHad1pOverE->SetLineColor(1); + fhMCChHad1pOverER02->Draw("same"); + pLegendpE0.Draw(); + + cmemchad->cd(2); + gPad->SetLogy(); + fhMCChHad1dR->Draw(); + + cmemchad->cd(3); + fhMCChHad2MatchdEdx->Draw(); - cmpoe->cd(1); - gPad->SetLogy(); - fh1pOverE->SetLineColor(1); - fhMCEle1pOverE->SetLineColor(4); - fhMCChHad1pOverE->SetLineColor(2); - fhMCNeutral1pOverE->SetLineColor(7); - fh1pOverER02->SetMinimum(0.5); - fh1pOverE->Draw(); - fhMCEle1pOverE->Draw("same"); - fhMCChHad1pOverE->Draw("same"); - fhMCNeutral1pOverE->Draw("same"); - TLegend pLegendpE(0.65,0.55,0.9,0.8); - pLegendpE.SetTextSize(0.06); - pLegendpE.AddEntry(fh1pOverE,"all","L"); - pLegendpE.AddEntry(fhMCEle1pOverE,"e^{#pm}","L"); - pLegendpE.AddEntry(fhMCChHad1pOverE,"h^{#pm}","L"); - pLegendpE.AddEntry(fhMCNeutral1pOverE,"neutrals","L"); - pLegendpE.SetFillColor(10); - pLegendpE.SetBorderSize(1); - pLegendpE.Draw(); - - cmpoe->cd(2); - gPad->SetLogy(); - fh1pOverER02->SetTitle("Track matches p/E, dR<0.2"); - fh1pOverER02->SetLineColor(1); - fhMCEle1pOverER02->SetLineColor(4); - fhMCChHad1pOverER02->SetLineColor(2); - fhMCNeutral1pOverER02->SetLineColor(7); - fh1pOverER02->SetMaximum(fh1pOverE->GetMaximum()); - fh1pOverER02->SetMinimum(0.5); - fh1pOverER02->Draw(); - fhMCEle1pOverER02->Draw("same"); - fhMCChHad1pOverER02->Draw("same"); - fhMCNeutral1pOverER02->Draw("same"); - - // TLegend pLegendpE2(0.65,0.55,0.9,0.8); - // pLegendpE2.SetTextSize(0.06); - // pLegendpE2.SetHeader("dR < 0.02"); - // pLegendpE2.SetFillColor(10); - // pLegendpE2.SetBorderSize(1); - // pLegendpE2.Draw(); - - sprintf(name,"QA_%s_TrackMatchingPOverE.eps",fCalorimeter.Data()); - cmpoe->Print(name); printf("Plot: %s\n",name); + sprintf(name,"QA_%s_TrackMatchingDistMCChHad.eps",fCalorimeter.Data()); + cmemchad->Print(name); printf("Plot: %s\n",name); + + sprintf(cname,"QA_%s_trkmatchMCNeutral",fCalorimeter.Data()); + TCanvas *cmemcn = new TCanvas(cname,"Track-matching distributions from MC neutrals", 600, 200); + cmemcn->Divide(3,1); + + cmemcn->cd(1); + gPad->SetLogy(); + fhMCNeutral1pOverE->Draw(); + fhMCNeutral1pOverE->SetLineColor(1); + fhMCNeutral1pOverER02->SetLineColor(4); + fhMCNeutral1pOverER02->Draw("same"); + pLegendpE0.Draw(); + + cmemcn->cd(2); + gPad->SetLogy(); + fhMCNeutral1dR->Draw(); + + cmemcn->cd(3); + fhMCNeutral2MatchdEdx->Draw(); + + sprintf(name,"QA_%s_TrackMatchingDistMCNeutral.eps",fCalorimeter.Data()); + cmemcn->Print(name); printf("Plot: %s\n",name); + + sprintf(cname,"QA_%s_trkmatchpE",fCalorimeter.Data()); + TCanvas *cmpoe = new TCanvas(cname,"Track-matching distributions, p/E", 400, 200); + cmpoe->Divide(2,1); + + cmpoe->cd(1); + gPad->SetLogy(); + fh1pOverE->SetLineColor(1); + fhMCEle1pOverE->SetLineColor(4); + fhMCChHad1pOverE->SetLineColor(2); + fhMCNeutral1pOverE->SetLineColor(7); + fh1pOverER02->SetMinimum(0.5); + fh1pOverE->Draw(); + fhMCEle1pOverE->Draw("same"); + fhMCChHad1pOverE->Draw("same"); + fhMCNeutral1pOverE->Draw("same"); + TLegend pLegendpE(0.65,0.55,0.9,0.8); + pLegendpE.SetTextSize(0.06); + pLegendpE.AddEntry(fh1pOverE,"all","L"); + pLegendpE.AddEntry(fhMCEle1pOverE,"e^{#pm}","L"); + pLegendpE.AddEntry(fhMCChHad1pOverE,"h^{#pm}","L"); + pLegendpE.AddEntry(fhMCNeutral1pOverE,"neutrals","L"); + pLegendpE.SetFillColor(10); + pLegendpE.SetBorderSize(1); + pLegendpE.Draw(); + + cmpoe->cd(2); + gPad->SetLogy(); + fh1pOverER02->SetTitle("Track matches p/E, dR<0.2"); + fh1pOverER02->SetLineColor(1); + fhMCEle1pOverER02->SetLineColor(4); + fhMCChHad1pOverER02->SetLineColor(2); + fhMCNeutral1pOverER02->SetLineColor(7); + fh1pOverER02->SetMaximum(fh1pOverE->GetMaximum()); + fh1pOverER02->SetMinimum(0.5); + fh1pOverER02->Draw(); + fhMCEle1pOverER02->Draw("same"); + fhMCChHad1pOverER02->Draw("same"); + fhMCNeutral1pOverER02->Draw("same"); + + // TLegend pLegendpE2(0.65,0.55,0.9,0.8); + // pLegendpE2.SetTextSize(0.06); + // pLegendpE2.SetHeader("dR < 0.02"); + // pLegendpE2.SetFillColor(10); + // pLegendpE2.SetBorderSize(1); + // pLegendpE2.Draw(); + + sprintf(name,"QA_%s_TrackMatchingPOverE.eps",fCalorimeter.Data()); + cmpoe->Print(name); printf("Plot: %s\n",name); } char line[1024] ; diff --git a/PWG4/PartCorrDep/AliAnaCalorimeterQA.h b/PWG4/PartCorrDep/AliAnaCalorimeterQA.h index 4bb7814ec96..efcedcba8bc 100755 --- a/PWG4/PartCorrDep/AliAnaCalorimeterQA.h +++ b/PWG4/PartCorrDep/AliAnaCalorimeterQA.h @@ -17,8 +17,8 @@ class TH1F; class TObjString; // --- Analysis system --- -class AliESDCaloCluster; -class AliAODCaloCluster; +class AliVCaloCluster; +class AliVTrack; #include "AliAnaPartCorrBaseClass.h" @@ -35,7 +35,7 @@ public: void ClusterHistograms(const TLorentzVector mom, const Double_t tof, Float_t *pos, Float_t * showerShape, const Int_t nCaloCellsPerCluster, const Int_t nModule, - const Int_t nTracksMatched, const TObject* track, + const Int_t nTracksMatched, const AliVTrack* track, const Int_t * labels, const Int_t nLabels); TObjString * GetAnalysisCuts(); diff --git a/PWG4/PartCorrDep/AliAnaElectron.cxx b/PWG4/PartCorrDep/AliAnaElectron.cxx index 496555969a7..1e0d38cfbd0 100755 --- a/PWG4/PartCorrDep/AliAnaElectron.cxx +++ b/PWG4/PartCorrDep/AliAnaElectron.cxx @@ -797,7 +797,7 @@ void AliAnaElectron::MakeAnalysisFillAOD() if (clus->GetM20() < 0.03 ) continue; if (clus->GetM02() < 0.03 ) continue; - Double_t x[3]; + Float_t x[3]; clus->GetPosition(x); TVector3 cluspos(x[0],x[1],x[2]); Double_t deta = teta - cluspos.Eta(); @@ -838,7 +838,7 @@ void AliAnaElectron::MakeAnalysisFillAOD() //Do you want the cluster or the track label? Int_t input = 0; if(GetReader()->GetAODEMCALNormalInputEntries() <= iclus) input = 1; - cmctag = GetMCAnalysisUtils()->CheckOrigin(clus->GetLabel(0),GetReader(),input); + cmctag = GetMCAnalysisUtils()->CheckOrigin(clus->GetLabel(),GetReader(),input); } if(fWriteNtuple) { diff --git a/PWG4/PartCorrDep/AliAnaExample.cxx b/PWG4/PartCorrDep/AliAnaExample.cxx index 56068bbbd7f..0e490beb274 100755 --- a/PWG4/PartCorrDep/AliAnaExample.cxx +++ b/PWG4/PartCorrDep/AliAnaExample.cxx @@ -230,8 +230,7 @@ void AliAnaExample::MakeAnalysisFillAOD() Int_t pdg = fPdg; if(IsCaloPIDOn()){ - Double_t pid[13]; - calo->GetPID(pid); + const Double_t *pid = calo->GetPID(); pdg = GetCaloPID()->GetPdg(fDetector,pid,mom.E()); //pdg = GetCaloPID()->GetPdg(fDetector,mom, // calo->GetM02(), calo->GetM02(), @@ -249,7 +248,7 @@ void AliAnaExample::MakeAnalysisFillAOD() if(mom.Pt() > GetMinPt() && pdg ==fPdg && in) { AliAODPWG4Particle ph = AliAODPWG4Particle(mom); //AddAODParticleCorrelation(AliAODPWG4ParticleCorrelation(mom)); - ph.SetLabel(calo->GetLabel(0)); + ph.SetLabel(calo->GetLabel()); ph.SetPdg(pdg); ph.SetDetector(fDetector); AddAODParticle(ph); @@ -282,7 +281,7 @@ void AliAnaExample::MakeAnalysisFillAOD() Int_t ncells = esdCell->GetNumberOfCells() ; GetAODCaloCells()->CreateContainer(ncells); - GetAODCaloCells()->SetType((AliAODCaloCells::AODCells_t) esdCell->GetType()); + GetAODCaloCells()->SetType(esdCell->GetType()); for (Int_t iCell = 0; iCell < ncells; iCell++) { if(GetDebug() > 2) printf("AliAnaExample::MakeAnalysisFillAOD() - Cell : amp %f, absId %d, time %f\n", esdCell->GetAmplitude(iCell), esdCell->GetCellNumber(iCell), esdCell->GetTime(iCell)); diff --git a/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx b/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx index 3e2644b3603..8f829b55dd1 100755 --- a/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx +++ b/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx @@ -45,6 +45,7 @@ #include "TParticle.h" #include "AliStack.h" #include "AliAODMCParticle.h" +#include "AliMixedEvent.h" ClassImp(AliAnaParticleHadronCorrelation) @@ -209,12 +210,12 @@ TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() //Correlation with charged hadrons if(GetReader()->IsCTSSwitchedOn()) { - fhDeltaPhiDeltaEtaCharged = new TH2F - ("DeltaPhiDeltaEtaCharged","#phi_{trigger} - #phi_{h^{#pm}} vs #eta_{trigger} - #eta_{h^{#pm}}", - 140,-2.,5.,200,-2,2); - fhDeltaPhiDeltaEtaCharged->SetXTitle("#Delta #phi"); - fhDeltaPhiDeltaEtaCharged->SetYTitle("#Delta #eta"); - + fhDeltaPhiDeltaEtaCharged = new TH2F + ("DeltaPhiDeltaEtaCharged","#phi_{trigger} - #phi_{h^{#pm}} vs #eta_{trigger} - #eta_{h^{#pm}}", + 140,-2.,5.,200,-2,2); + fhDeltaPhiDeltaEtaCharged->SetXTitle("#Delta #phi"); + fhDeltaPhiDeltaEtaCharged->SetYTitle("#Delta #eta"); + fhPhiCharged = new TH2F ("PhiCharged","#phi_{h^{#pm}} vs p_{T #pm}", nptbins,ptmin,ptmax,nphibins,phimin,phimax); @@ -275,7 +276,7 @@ TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() fhPtHbpUeCharged->SetYTitle("ln(1/x_{E})"); fhPtHbpUeCharged->SetXTitle("p_{T trigger}"); - outputContainer->Add(fhDeltaPhiDeltaEtaCharged); + outputContainer->Add(fhDeltaPhiDeltaEtaCharged); outputContainer->Add(fhPhiCharged) ; outputContainer->Add(fhEtaCharged) ; outputContainer->Add(fhDeltaPhiCharged) ; @@ -335,11 +336,11 @@ TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() //Correlation with neutral hadrons if(GetReader()->IsEMCALSwitchedOn() || GetReader()->IsPHOSSwitchedOn()){ - fhDeltaPhiDeltaEtaNeutral = new TH2F - ("DeltaPhiDeltaEtaNeutral","#phi_{trigger} - #phi_{h^{0}} vs #eta_{trigger} - #eta_{h^{0}}", - 140,-2.,5.,200,-2,2); - fhDeltaPhiDeltaEtaNeutral->SetXTitle("#Delta #phi"); - fhDeltaPhiDeltaEtaNeutral->SetYTitle("#Delta #eta"); + fhDeltaPhiDeltaEtaNeutral = new TH2F + ("DeltaPhiDeltaEtaNeutral","#phi_{trigger} - #phi_{h^{0}} vs #eta_{trigger} - #eta_{h^{0}}", + 140,-2.,5.,200,-2,2); + fhDeltaPhiDeltaEtaNeutral->SetXTitle("#Delta #phi"); + fhDeltaPhiDeltaEtaNeutral->SetYTitle("#Delta #eta"); fhPhiNeutral = new TH2F ("PhiNeutral","#phi_{#pi^{0}} vs p_{T #pi^{0}}", @@ -388,21 +389,21 @@ TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() nptbins,ptmin,ptmax,200,0.,2.); fhPtImbalanceUeNeutral->SetYTitle("z_{trigger #pi^{0}}"); fhPtImbalanceUeNeutral->SetXTitle("p_{T trigger}"); - - fhPtHbpNeutral = + + fhPtHbpNeutral = new TH2F("HbpNeutral","#xi = ln(1/x_{E}) with neutral particles", - nptbins,ptmin,ptmax,200,0.,10.); - fhPtHbpNeutral->SetYTitle("ln(1/x_{E})"); - fhPtHbpNeutral->SetXTitle("p_{T trigger}"); - - fhPtHbpUeNeutral = + nptbins,ptmin,ptmax,200,0.,10.); + fhPtHbpNeutral->SetYTitle("ln(1/x_{E})"); + fhPtHbpNeutral->SetXTitle("p_{T trigger}"); + + fhPtHbpUeNeutral = new TH2F("HbpUeNeutral","#xi = ln(1/x_{E}) with neutral particles", - nptbins,ptmin,ptmax,200,0.,10.); - fhPtHbpUeNeutral->SetYTitle("ln(1/x_{E})"); - fhPtHbpUeNeutral->SetXTitle("p_{T trigger}"); - - - outputContainer->Add(fhDeltaPhiDeltaEtaNeutral); + nptbins,ptmin,ptmax,200,0.,10.); + fhPtHbpUeNeutral->SetYTitle("ln(1/x_{E})"); + fhPtHbpUeNeutral->SetXTitle("p_{T trigger}"); + + + outputContainer->Add(fhDeltaPhiDeltaEtaNeutral); outputContainer->Add(fhPhiNeutral) ; outputContainer->Add(fhEtaNeutral) ; outputContainer->Add(fhDeltaPhiNeutral) ; @@ -411,8 +412,8 @@ TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() outputContainer->Add(fhDeltaEtaNeutral) ; outputContainer->Add(fhPtImbalanceNeutral) ; outputContainer->Add(fhPtImbalanceUeNeutral) ; - outputContainer->Add(fhPtHbpNeutral) ; - outputContainer->Add(fhPtHbpUeNeutral) ; + outputContainer->Add(fhPtHbpNeutral) ; + outputContainer->Add(fhPtHbpUeNeutral) ; if(fMakeSeveralUE){ fhDeltaPhiUeLeftNeutral = new TH2F @@ -443,20 +444,20 @@ TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() fhPtImbalanceUeRightNeutral->SetXTitle("p_{T trigger}"); outputContainer->Add(fhPtImbalanceUeRightNeutral) ; - fhPtHbpUeLeftNeutral = + fhPtHbpUeLeftNeutral = new TH2F("HbpUeNeutralLeft","#xi = ln(1/x_{E}) with neutral UE left side of trigger", - nptbins,ptmin,ptmax,200,0.,10.); - fhPtHbpUeLeftNeutral->SetYTitle("ln(1/x_{E})"); - fhPtHbpUeLeftNeutral->SetXTitle("p_{T trigger}"); - outputContainer->Add(fhPtHbpUeLeftNeutral) ; - - fhPtHbpUeRightNeutral = + nptbins,ptmin,ptmax,200,0.,10.); + fhPtHbpUeLeftNeutral->SetYTitle("ln(1/x_{E})"); + fhPtHbpUeLeftNeutral->SetXTitle("p_{T trigger}"); + outputContainer->Add(fhPtHbpUeLeftNeutral) ; + + fhPtHbpUeRightNeutral = new TH2F("HbpUeNeutralRight","#xi = ln(1/x_{E}) with neutral UE right side of trigger", - nptbins,ptmin,ptmax,200,0.,10.); - fhPtHbpUeRightNeutral->SetYTitle("ln(1/x_{E})"); - fhPtHbpUeRightNeutral->SetXTitle("p_{T trigger}"); - outputContainer->Add(fhPtHbpUeRightNeutral) ; - + nptbins,ptmin,ptmax,200,0.,10.); + fhPtHbpUeRightNeutral->SetYTitle("ln(1/x_{E})"); + fhPtHbpUeRightNeutral->SetXTitle("p_{T trigger}"); + outputContainer->Add(fhPtHbpUeRightNeutral) ; + } //Keep neutral meson selection histograms if requiered @@ -518,7 +519,7 @@ void AliAnaParticleHadronCorrelation::Print(const Option_t * opt) const //____________________________________________________________________________ void AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() { - //Particle-Hadron Correlation Analysis, fill AODs + //Particle-Hadron Correlation Analysis, fill AODs if(!GetInputAODBranch()){ printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data()); @@ -526,8 +527,8 @@ void AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() } if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation")){ - printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be and not <%s> \n",GetInputAODBranch()->GetClass()->GetName()); - abort(); + printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be and not <%s> \n",GetInputAODBranch()->GetClass()->GetName()); + abort(); } if(GetDebug() > 1){ @@ -538,45 +539,45 @@ void AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In PHOS aod entries %d\n", GetAODPHOS()->GetEntriesFast()); } - //Loop on stored AOD particles, trigger + //Loop on stored AOD particles, trigger Double_t ptTrig = 0.; Int_t trigIndex = -1; Int_t naod = GetInputAODBranch()->GetEntriesFast(); for(Int_t iaod = 0; iaod < naod ; iaod++){ AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod)); - //find the leading particles with highest momentum - if (particle->Pt()>ptTrig) { - ptTrig = particle->Pt() ; - trigIndex = iaod ; - } + //find the leading particles with highest momentum + if (particle->Pt()>ptTrig) { + ptTrig = particle->Pt() ; + trigIndex = iaod ; + } }//Aod branch loop - //Do correlation with leading particle + //Do correlation with leading particle if(trigIndex!=-1){ - AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex)); - //Make correlation with charged hadrons - if(GetReader()->IsCTSSwitchedOn() ) - MakeChargedCorrelation(particle, GetAODCTS(),kFALSE); + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex)); + //Make correlation with charged hadrons + if(GetReader()->IsCTSSwitchedOn() ) + MakeChargedCorrelation(particle, GetAODCTS(),kFALSE); - //Make correlation with neutral pions - //Trigger particle in PHOS, correlation with EMCAL + //Make correlation with neutral pions + //Trigger particle in PHOS, correlation with EMCAL if(particle->GetDetector()=="PHOS" && GetReader()->IsEMCALSwitchedOn() && GetAODEMCAL()->GetEntriesFast() > 0) MakeNeutralCorrelationFillAOD(particle, GetAODEMCAL(),"EMCAL"); - //Trigger particle in EMCAL, correlation with PHOS + //Trigger particle in EMCAL, correlation with PHOS else if(particle->GetDetector()=="EMCAL" && GetReader()->IsPHOSSwitchedOn() && GetAODPHOS()->GetEntriesFast() > 0) MakeNeutralCorrelationFillAOD(particle, GetAODPHOS(),"PHOS"); - //Trigger particle in CTS, correlation with PHOS, EMCAL and CTS + //Trigger particle in CTS, correlation with PHOS, EMCAL and CTS else if(particle->GetDetector()=="CTS" ){ if(GetReader()->IsPHOSSwitchedOn() && GetAODPHOS()->GetEntriesFast() > 0) - MakeNeutralCorrelationFillAOD(particle, GetAODPHOS(),"PHOS"); + MakeNeutralCorrelationFillAOD(particle, GetAODPHOS(),"PHOS"); if(GetReader()->IsEMCALSwitchedOn() && GetAODEMCAL()->GetEntriesFast() > 0) - MakeNeutralCorrelationFillAOD(particle, GetAODEMCAL(),"EMCAL"); + MakeNeutralCorrelationFillAOD(particle, GetAODEMCAL(),"EMCAL"); } - - + + }//Correlate leading - + if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - End fill AODs \n"); } @@ -615,13 +616,13 @@ void AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() if(trigIndex!=-1){ //using trigger partilce to do correlations AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex)); - //Fill leading particle histogram - fhPtLeading->Fill(particle->Pt()); - Float_t phi = particle->Phi(); - if(phi<0)phi+=TMath::TwoPi(); - fhPhiLeading->Fill(particle->Pt(), phi); - fhEtaLeading->Fill(particle->Pt(), particle->Eta()); - + //Fill leading particle histogram + fhPtLeading->Fill(particle->Pt()); + Float_t phi = particle->Phi(); + if(phi<0)phi+=TMath::TwoPi(); + fhPhiLeading->Fill(particle->Pt(), phi); + fhEtaLeading->Fill(particle->Pt(), particle->Eta()); + //Make correlation with charged hadrons TObjArray * reftracks = particle->GetObjArray(GetAODObjArrayName()+"Tracks"); if(reftracks){ @@ -644,126 +645,145 @@ void AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() //____________________________________________________________________________ void AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4ParticleCorrelation *aodParticle, TObjArray* const pl, const Bool_t bFillHisto) { - // Charged Hadron Correlation Analysis - if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Make trigger particle - charged hadron correlation \n"); + // Charged Hadron Correlation Analysis + if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Make trigger particle - charged hadron correlation \n"); - Double_t ptTrig = aodParticle->Pt(); - Double_t pxTrig = aodParticle->Px(); - Double_t pyTrig = aodParticle->Py(); - - Double_t phiTrig = aodParticle->Phi(); - - Double_t pt = -100.; - Double_t px = -100.; - Double_t py = -100.; - Double_t rat = -100.; - Double_t xE = -100.; - Double_t cosi = -100.; - Double_t phi = -100. ; - Double_t eta = -100. ; - TVector3 p3; + Int_t evtIndex11 = 0 ; + Int_t evtIndex12 = 0 ; + if (GetMixedEvent()) { + evtIndex11 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(0)) ; + evtIndex12 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(1)) ; + } + + Double_t ptTrig = aodParticle->Pt(); + Double_t pxTrig = aodParticle->Px(); + Double_t pyTrig = aodParticle->Py(); + + Double_t phiTrig = aodParticle->Phi(); + + Double_t pt = -100.; + Double_t px = -100.; + Double_t py = -100.; + Double_t rat = -100.; + Double_t xE = -100.; + Double_t cosi = -100.; + Double_t phi = -100. ; + Double_t eta = -100. ; + TVector3 p3; - TObjArray * reftracks =0x0; - Int_t nrefs = 0; + TObjArray * reftracks =0x0; + Int_t nrefs = 0; - //Track loop, select tracks with good pt, phi and fill AODs or histograms - for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ ){ - AliAODTrack * track = (AliAODTrack *) (pl->At(ipr)) ; - if(track->GetID()==aodParticle->GetTrackLabel(0)) continue ; - if(track->Pt()>ptTrig) continue ; - Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; - p3.SetXYZ(mom[0],mom[1],mom[2]); - pt = p3.Pt(); - px = p3.Px(); - py = p3.Py(); - eta = p3.Eta(); - phi = p3.Phi() ; - if(phi < 0) phi+=TMath::TwoPi(); - rat = pt/ptTrig ; - xE = -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig); - if(xE <0.)xE =-xE; - cosi = TMath::Log(1/xE); - // printf("rat = %f, xE = %f, cosi =%f \n", rat, xE, cosi); - // printf("phi = %f \n", phi); + //Track loop, select tracks with good pt, phi and fill AODs or histograms + //Int_t currentIndex = -1 ; + for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ ){ + AliAODTrack * track = (AliAODTrack *) (pl->At(ipr)) ; + Int_t evtIndex2 = 0 ; + if (GetMixedEvent()) { + evtIndex2 = GetMixedEvent()->EventIndex(track->GetID()) ; + if (evtIndex11 == evtIndex2 || evtIndex12 == evtIndex2) // photon and track from different events + continue ; +// if(currentIndex == evtIndex2) // tracks from different event +// continue ; +// currentIndex = evtIndex2 ; + } + if(track->GetID()==aodParticle->GetTrackLabel(0)) + continue ; + if(track->Pt()>ptTrig) + continue ; + Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; + p3.SetXYZ(mom[0],mom[1],mom[2]); + pt = p3.Pt(); + px = p3.Px(); + py = p3.Py(); + eta = p3.Eta(); + phi = p3.Phi() ; + if(phi < 0) phi+=TMath::TwoPi(); + rat = pt/ptTrig ; + xE = -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig); + if(xE <0.)xE =-xE; + cosi = TMath::Log(1/xE); + // printf("rat = %f, xE = %f, cosi =%f \n", rat, xE, cosi); + // printf("phi = %f \n", phi); - if(IsFiducialCutOn()){ - Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ; - if(! in ) continue ; - } - - //Select only hadrons in pt range - if(pt < GetMinPt() || pt > GetMaxPt()) continue ; + if(IsFiducialCutOn()){ + Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ; + if(! in ) continue ; + } + + //Select only hadrons in pt range + if(pt < GetMinPt() || pt > GetMaxPt()) continue ; - //Selection within angular range - Float_t deltaphi = phiTrig-phi; - if(deltaphi< -TMath::PiOver2()) deltaphi+=TMath::TwoPi(); - if(deltaphi>3*TMath::PiOver2()) deltaphi-=TMath::TwoPi(); + //Selection within angular range + Float_t deltaphi = phiTrig-phi; + if(deltaphi< -TMath::PiOver2()) deltaphi+=TMath::TwoPi(); + if(deltaphi>3*TMath::PiOver2()) deltaphi-=TMath::TwoPi(); - if(GetDebug() > 2) - printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Charged hadron: pt %f, phi %f, phi trigger %f. Cuts: delta phi %2.2f < %2.2f < %2.2f, pT min %2.2f \n", - pt,phi, phiTrig,fDeltaPhiMinCut, deltaphi, fDeltaPhiMaxCut, GetMinPt()); + if(GetDebug() > 2) + printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Charged hadron: pt %f, phi %f, phi trigger %f. Cuts: delta phi %2.2f < %2.2f < %2.2f, pT min %2.2f \n", + pt,phi, phiTrig,fDeltaPhiMinCut, deltaphi, fDeltaPhiMaxCut, GetMinPt()); - if(bFillHisto){ - // Fill Histograms - fhEtaCharged->Fill(pt,eta); - fhPhiCharged->Fill(pt,phi); - fhDeltaEtaCharged->Fill(ptTrig,aodParticle->Eta()-eta); - fhDeltaPhiCharged->Fill(ptTrig, deltaphi); - fhDeltaPhiDeltaEtaCharged->Fill(deltaphi,aodParticle->Eta()-eta); - - if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta); - - //delta phi cut for correlation - if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) { - fhDeltaPhiChargedPt->Fill(pt,deltaphi); - fhPtImbalanceCharged->Fill(ptTrig,rat); - fhPtHbpCharged->Fill(ptTrig,cosi); - } + if(bFillHisto){ + // Fill Histograms + fhEtaCharged->Fill(pt,eta); + fhPhiCharged->Fill(pt,phi); + fhDeltaEtaCharged->Fill(ptTrig,aodParticle->Eta()-eta); + fhDeltaPhiCharged->Fill(ptTrig, deltaphi); + fhDeltaPhiDeltaEtaCharged->Fill(deltaphi,aodParticle->Eta()-eta); + + if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta); + + //delta phi cut for correlation + if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) { + fhDeltaPhiChargedPt->Fill(pt,deltaphi); + fhPtImbalanceCharged->Fill(ptTrig,rat); + fhPtHbpCharged->Fill(ptTrig,cosi); + } else { - fhDeltaPhiUeChargedPt->Fill(pt,deltaphi); - fhPtImbalanceUeCharged->Fill(ptTrig,rat); - fhPtHbpUeCharged->Fill(ptTrig,cosi); + fhDeltaPhiUeChargedPt->Fill(pt,deltaphi); + fhPtImbalanceUeCharged->Fill(ptTrig,rat); + fhPtHbpUeCharged->Fill(ptTrig,cosi); } - //several UE calculation + //several UE calculation if(fMakeSeveralUE){ - if((deltaphi<-fUeDeltaPhiMinCut) && (deltaphi >-fUeDeltaPhiMaxCut)){ - fhDeltaPhiUeLeftCharged->Fill(pt,deltaphi); - fhPtImbalanceUeLeftCharged->Fill(ptTrig,rat); - fhPtHbpUeLeftCharged->Fill(ptTrig,cosi); - } - if((deltaphi>fUeDeltaPhiMinCut) && (deltaphi Fill(pt,deltaphi); - fhPtImbalanceUeRightCharged->Fill(ptTrig,rat); - fhPtHbpUeRightCharged->Fill(ptTrig,cosi); - - } + if((deltaphi<-fUeDeltaPhiMinCut) && (deltaphi >-fUeDeltaPhiMaxCut)){ + fhDeltaPhiUeLeftCharged->Fill(pt,deltaphi); + fhPtImbalanceUeLeftCharged->Fill(ptTrig,rat); + fhPtHbpUeLeftCharged->Fill(ptTrig,cosi); + } + if((deltaphi>fUeDeltaPhiMinCut) && (deltaphi Fill(pt,deltaphi); + fhPtImbalanceUeRightCharged->Fill(ptTrig,rat); + fhPtHbpUeRightCharged->Fill(ptTrig,cosi); + + } } //several UE calculation - - } - else{ - nrefs++; - if(nrefs==1){ - reftracks = new TObjArray(0); - reftracks->SetName(GetAODObjArrayName()+"Tracks"); - reftracks->SetOwner(kFALSE); - } - reftracks->Add(track); - }//aod particle loop - }// track loop + + } + else{ + nrefs++; + if(nrefs==1){ + reftracks = new TObjArray(0); + reftracks->SetName(GetAODObjArrayName()+"Tracks"); + reftracks->SetOwner(kFALSE); + } + reftracks->Add(track); + }//aod particle loop + }// track loop - //Fill AOD with reference tracks, if not filling histograms - if(!bFillHisto && reftracks) { - aodParticle->AddObjArray(reftracks); - } - - //delete reftracks; + //Fill AOD with reference tracks, if not filling histograms + if(!bFillHisto && reftracks) { + aodParticle->AddObjArray(reftracks); + } + + //delete reftracks; } -//____________________________________________________________________________ + //____________________________________________________________________________ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD(AliAODPWG4ParticleCorrelation* const aodParticle,TObjArray* const pl, TString detector) { - // Neutral Pion Correlation Analysis, find pi0, put them in new output aod, if correlation cuts passed + // Neutral Pion Correlation Analysis, find pi0, put them in new output aod, if correlation cuts passed if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Make trigger particle - neutral hadron correlation \n"); if(!NewOutputAOD()){ @@ -776,148 +796,180 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD(AliAODPWG4P TLorentzVector gammai; TLorentzVector gammaj; - //Get vertex for photon momentum calculation - Double_t vertex[] = {0,0,0} ; //vertex - Double_t vertex2[] = {0,0,0} ; //vertex of second input aod + //Get vertex for photon momentum calculation + + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) + { + for (Int_t iev = 0; iev < GetNMixedEvent(); iev++) { + if (!GetMixedEvent()) + GetReader()->GetVertex(GetVertex(iev)); + else + GetMixedEvent()->GetVertexOfEvent(iev)->GetXYZ(GetVertex(iev)); + } + } + Double_t vertex2[] = {0.0,0.0,0.0} ; //vertex of second input aod if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) { - GetReader()->GetVertex(vertex); - if(GetReader()->GetSecondInputAODTree()) GetReader()->GetSecondInputAODVertex(vertex2); + if(GetReader()->GetSecondInputAODTree()) GetReader()->GetSecondInputAODVertex(vertex2); } - //Cluster loop, select pairs with good pt, phi and fill AODs or histograms - //Int_t iEvent= GetReader()->GetEventNumber() ; + //Cluster loop, select pairs with good pt, phi and fill AODs or histograms + //Int_t iEvent= GetReader()->GetEventNumber() ; Int_t nclus = pl->GetEntriesFast(); for(Int_t iclus = 0;iclus < nclus ; iclus ++ ){ AliAODCaloCluster * calo = (AliAODCaloCluster *) (pl->At(iclus)) ; - //Input from second AOD? - Int_t inputi = 0; - if (aodParticle->GetDetector() == "EMCAL" && GetReader()->GetAODEMCALNormalInputEntries() <= iclus) inputi = 1 ; - else if(aodParticle->GetDetector() == "PHOS" && GetReader()->GetAODPHOSNormalInputEntries() <= iclus) inputi = 1; - - //Cluster selection, not charged, with photon or pi0 id and in fiducial cut - Int_t pdg=0; - if (inputi == 0 && !SelectCluster(calo, vertex, gammai, pdg)) continue ; - else if(inputi == 1 && !SelectCluster(calo, vertex2, gammai, pdg)) continue ; + Int_t evtIndex1 = 0 ; + if (GetMixedEvent()) { + evtIndex1=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; + } + - if(GetDebug() > 2) + //Input from second AOD? + Int_t inputi = 0; + if (aodParticle->GetDetector() == "EMCAL" && GetReader()->GetAODEMCALNormalInputEntries() <= iclus) + inputi = 1 ; + else if(aodParticle->GetDetector() == "PHOS" && GetReader()->GetAODPHOSNormalInputEntries() <= iclus) + inputi = 1; + + //Cluster selection, not charged, with photon or pi0 id and in fiducial cut + Int_t pdg=0; + if (inputi == 0 && !SelectCluster(calo, GetVertex(evtIndex1), gammai, pdg)) + continue ; + else if(inputi == 1 && !SelectCluster(calo, vertex2, gammai, pdg)) + continue ; + + if(GetDebug() > 2) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Neutral cluster in %s: pt %f, phi %f, phi trigger %f. Cuts: delta phi min %2.2f, max %2.2f, pT min %2.2f \n", - detector.Data(), gammai.Pt(),gammai.Phi(),phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt()); + detector.Data(), gammai.Pt(),gammai.Phi(),phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt()); - //2 gamma overlapped, found with PID + //2 gamma overlapped, found with PID if(pdg == AliCaloPID::kPi0){ - //Select only hadrons in pt range - if(gammai.Pt() < GetMinPt() || gammai.Pt() > GetMaxPt()) continue ; + //Select only hadrons in pt range + if(gammai.Pt() < GetMinPt() || gammai.Pt() > GetMaxPt()) + continue ; - //Selection within angular range + //Selection within angular range Float_t phi = gammai.Phi(); if(phi < 0) phi+=TMath::TwoPi(); - //Float_t deltaphi = TMath::Abs(phiTrig-phi); - //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ; + //Float_t deltaphi = TMath::Abs(phiTrig-phi); + //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ; AliAODPWG4Particle pi0 = AliAODPWG4Particle(gammai); - //pi0.SetLabel(calo->GetLabel(0)); + //pi0.SetLabel(calo->GetLabel()); pi0.SetPdg(AliCaloPID::kPi0); pi0.SetDetector(detector); if(IsDataMC()){ - pi0.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetReader(),inputi)); - if(GetDebug() > 0) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Origin of candidate %d\n",pi0.GetTag()); - }//Work with stack also - //Set the indeces of the original caloclusters + pi0.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(),GetReader(),inputi)); + if(GetDebug() > 0) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Origin of candidate %d\n",pi0.GetTag()); + }//Work with stack also + //Set the indeces of the original caloclusters pi0.SetCaloLabel(calo->GetID(),-1); AddAODParticle(pi0); if(GetDebug() > 2) - printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Correlated with selected pi0 (pid): pt %f, phi %f\n",pi0.Pt(),pi0.Phi()); + printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Correlated with selected pi0 (pid): pt %f, phi %f\n",pi0.Pt(),pi0.Phi()); }// pdg = 111 - //Make invariant mass analysis + //Make invariant mass analysis else if(pdg == AliCaloPID::kPhoton){ - //Search the photon companion in case it comes from a Pi0 decay - //Apply several cuts to select the good pair; + //Search the photon companion in case it comes from a Pi0 decay + //Apply several cuts to select the good pair; for(Int_t jclus = iclus+1; jclus < pl->GetEntries() ; jclus ++ ){ - AliAODCaloCluster * calo2 = (AliAODCaloCluster *) (pl->At(jclus)) ; - - //Input from second AOD? - Int_t inputj = 0; - if (aodParticle->GetDetector() == "EMCAL" && GetReader()->GetAODEMCALNormalInputEntries() <= jclus) inputj = 1; - else if(aodParticle->GetDetector() == "PHOS" && GetReader()->GetAODPHOSNormalInputEntries() <= jclus) inputj = 1; - - //Cluster selection, not charged with photon or pi0 id and in fiducial cut - Int_t pdgj=0; - if (inputj == 0 && !SelectCluster(calo2, vertex, gammaj, pdgj)) continue ; - else if(inputj == 1 && !SelectCluster(calo2, vertex2, gammaj, pdgj)) continue ; - - if(!SelectCluster(calo2,vertex, gammaj, pdgj)) continue ; - - if(pdgj == AliCaloPID::kPhoton ){ - - if((gammai+gammaj).Pt() < GetMinPt() || (gammai+gammaj).Pt() > GetMaxPt()) continue ; - - //Selection within angular range - Float_t phi = (gammai+gammaj).Phi(); - if(phi < 0) phi+=TMath::TwoPi(); - //Float_t deltaphi = TMath::Abs(phiTrig-phi); - //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ; - - //Select good pair (aperture and invariant mass) - if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){ - - if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Neutral Hadron Correlation: AOD Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f\n", - (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M()); - - TLorentzVector pi0mom = gammai+gammaj; - AliAODPWG4Particle pi0 = AliAODPWG4Particle(pi0mom); - //pi0.SetLabel(calo->GetLabel(0)); - pi0.SetPdg(AliCaloPID::kPi0); - pi0.SetDetector(detector); - if(IsDataMC()){ - //Check origin of the candidates - - Int_t label1 = calo->GetLabel(0); - Int_t label2 = calo2->GetLabel(0); - Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), inputi); - Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), inputj); - - if(GetDebug() > 0) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2); - if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) && GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay)){ - - //Check if pi0 mother is the same - if(GetReader()->ReadStack()){ - TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree - label1 = mother1->GetFirstMother(); - //mother1 = GetMCStack()->Particle(label1);//pi0 - - TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree - label2 = mother2->GetFirstMother(); - //mother2 = GetMCStack()->Particle(label2);//pi0 - } - else if(GetReader()->ReadAODMCParticles()){ - AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(inputi))->At(label1);//photon in kine tree - label1 = mother1->GetMother(); - //mother1 = GetMCStack()->Particle(label1);//pi0 - AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(inputj))->At(label2);//photon in kine tree - label2 = mother2->GetMother(); - //mother2 = GetMCStack()->Particle(label2);//pi0 - } - - //printf("mother1 %d, mother2 %d\n",label1,label2); - if(label1 == label2) - GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0); - } - }//Work with mc information also - pi0.SetTag(tag); - //Set the indeces of the original caloclusters - pi0.SetCaloLabel(calo->GetID(), calo2->GetID()); - AddAODParticle(pi0); - - - }//Pair selected - }//if pair of gammas + AliAODCaloCluster * calo2 = (AliAODCaloCluster *) (pl->At(jclus)) ; + Int_t evtIndex2 = 0 ; + if (GetMixedEvent()) { + evtIndex2=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; + } + if (GetMixedEvent() && (evtIndex1 == evtIndex2)) + continue ; + + //Input from second AOD? + Int_t inputj = 0; + if (aodParticle->GetDetector() == "EMCAL" && GetReader()->GetAODEMCALNormalInputEntries() <= jclus) + inputj = 1; + else if(aodParticle->GetDetector() == "PHOS" && GetReader()->GetAODPHOSNormalInputEntries() <= jclus) + inputj = 1; + + //Cluster selection, not charged with photon or pi0 id and in fiducial cut + Int_t pdgj=0; + if (inputj == 0 && !SelectCluster(calo2, GetVertex(evtIndex2), gammaj, pdgj)) + continue ; + else if(inputj == 1 && !SelectCluster(calo2, vertex2, gammaj, pdgj)) + continue ; + + if(!SelectCluster(calo2,GetVertex(evtIndex2), gammaj, pdgj)) + continue ; + + if(pdgj == AliCaloPID::kPhoton ){ + + if((gammai+gammaj).Pt() < GetMinPt() || (gammai+gammaj).Pt() > GetMaxPt()) + continue ; + + //Selection within angular range + Float_t phi = (gammai+gammaj).Phi(); + if(phi < 0) phi+=TMath::TwoPi(); + //Float_t deltaphi = TMath::Abs(phiTrig-phi); + //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ; + + //Select good pair (aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){ + + if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Neutral Hadron Correlation: AOD Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f\n", + (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M()); + + TLorentzVector pi0mom = gammai+gammaj; + AliAODPWG4Particle pi0 = AliAODPWG4Particle(pi0mom); + //pi0.SetLabel(calo->GetLabel()); + pi0.SetPdg(AliCaloPID::kPi0); + pi0.SetDetector(detector); + if(IsDataMC()){ + //Check origin of the candidates + + Int_t label1 = calo->GetLabel(); + Int_t label2 = calo2->GetLabel(); + Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), inputi); + Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), inputj); + + if(GetDebug() > 0) + printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2); + if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) && GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay)){ + + //Check if pi0 mother is the same + if(GetReader()->ReadStack()){ + TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree + label1 = mother1->GetFirstMother(); + //mother1 = GetMCStack()->Particle(label1);//pi0 + + TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree + label2 = mother2->GetFirstMother(); + //mother2 = GetMCStack()->Particle(label2);//pi0 + } + else if(GetReader()->ReadAODMCParticles()){ + AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(inputi))->At(label1);//photon in kine tree + label1 = mother1->GetMother(); + //mother1 = GetMCStack()->Particle(label1);//pi0 + AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(inputj))->At(label2);//photon in kine tree + label2 = mother2->GetMother(); + //mother2 = GetMCStack()->Particle(label2);//pi0 + } + + //printf("mother1 %d, mother2 %d\n",label1,label2); + if(label1 == label2) + GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0); + } + }//Work with mc information also + pi0.SetTag(tag); + //Set the indeces of the original caloclusters + pi0.SetCaloLabel(calo->GetID(), calo2->GetID()); + AddAODParticle(pi0); + + + }//Pair selected + }//if pair of gammas }//2nd loop }// if pdg = 22 }//1st loop @@ -1027,8 +1079,8 @@ Bool_t AliAnaParticleHadronCorrelation::SelectCluster(AliAODCaloCluster * calo, if(calo->GetNTracksMatched() > 0) return kFALSE; TString detector = ""; - if(calo->IsPHOSCluster()) detector= "PHOS"; - else if(calo->IsEMCALCluster()) detector= "EMCAL"; + if (calo->IsPHOS()) detector= "PHOS"; + else if(calo->IsEMCAL()) detector= "EMCAL"; //Check PID calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line @@ -1038,7 +1090,7 @@ Bool_t AliAnaParticleHadronCorrelation::SelectCluster(AliAODCaloCluster * calo, //or redo PID, recommended option for EMCal. if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) - pdg = GetCaloPID()->GetPdg(detector,calo->PID(),mom.E());//PID with weights + pdg = GetCaloPID()->GetPdg(detector,calo->GetPID(),mom.E());//PID with weights else pdg = GetCaloPID()->GetPdg(detector,mom,calo);//PID recalculated diff --git a/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx b/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx index edd0a9e2edc..d9be2e7ded1 100755 --- a/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx +++ b/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx @@ -1695,7 +1695,7 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::SelectCluster(AliAODCaloCluster //Get most probable PID, 2 options check PID weights (in MC this option is mandatory) //or redo PID, recommended option for EMCal. if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) - pdg = GetCaloPID()->GetPdg("EMCAL",calo->PID(),mom.E());//PID with weights + pdg = GetCaloPID()->GetPdg("EMCAL",calo->GetPID(),mom.E());//PID with weights else pdg = GetCaloPID()->GetPdg("EMCAL",mom,calo);//PID recalculated diff --git a/PWG4/PartCorrDep/AliAnaPhoton.cxx b/PWG4/PartCorrDep/AliAnaPhoton.cxx index a14704adeba..a7a99a93ae6 100755 --- a/PWG4/PartCorrDep/AliAnaPhoton.cxx +++ b/PWG4/PartCorrDep/AliAnaPhoton.cxx @@ -6,7 +6,7 @@ * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes hereby granted * - * without fee, provided that the above copyright notice appears in all * + * without fee, providGetMixedEvent()ed that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * @@ -40,6 +40,8 @@ #include "AliFiducialCut.h" #include "AliAODCaloCluster.h" #include "AliAODMCParticle.h" +#include "AliMixedEvent.h" + ClassImp(AliAnaPhoton) @@ -258,23 +260,23 @@ TList * AliAnaPhoton::GetCreateOutputObjects() fh2Pt->SetYTitle("p_{T,gen} (GeV/c)"); outputContainer->Add(fh2Pt); - fhPtMCPhoton = new TH1F("hPtMCPhoton","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); - fhPtMCPhoton->SetYTitle("N"); - fhPtMCPhoton->SetXTitle("p_{T #gamma}(GeV/c)"); - outputContainer->Add(fhPtMCPhoton) ; - - fhPhiMCPhoton = new TH2F - ("hPhiMCPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); - fhPhiMCPhoton->SetYTitle("#phi"); - fhPhiMCPhoton->SetXTitle("p_{T #gamma} (GeV/c)"); - outputContainer->Add(fhPhiMCPhoton) ; - - fhEtaMCPhoton = new TH2F - ("hEtaMCPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); - fhEtaMCPhoton->SetYTitle("#eta"); - fhEtaMCPhoton->SetXTitle("p_{T #gamma} (GeV/c)"); - outputContainer->Add(fhEtaMCPhoton) ; - + fhPtMCPhoton = new TH1F("hPtMCPhoton","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtMCPhoton->SetYTitle("N"); + fhPtMCPhoton->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtMCPhoton) ; + + fhPhiMCPhoton = new TH2F + ("hPhiMCPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiMCPhoton->SetYTitle("#phi"); + fhPhiMCPhoton->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiMCPhoton) ; + + fhEtaMCPhoton = new TH2F + ("hEtaMCPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaMCPhoton->SetYTitle("#eta"); + fhEtaMCPhoton->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaMCPhoton) ; + fhPtPrompt = new TH1F("hPtMCPrompt","Number of prompt #gamma over calorimeter",nptbins,ptmin,ptmax); fhPtPrompt->SetYTitle("N"); fhPtPrompt->SetXTitle("p_{T #gamma}(GeV/c)"); @@ -444,78 +446,95 @@ void AliAnaPhoton::InitParameters() //__________________________________________________________________ void AliAnaPhoton::MakeAnalysisFillAOD() { - //Do analysis and fill aods - //Search for photons in fCalorimeter - TObjArray * pl = 0x0; + //Do analysis and fill aods + //Search for photons in fCalorimeter + + //Get vertex for photon momentum calculation - //Get vertex for photon momentum calculation - Double_t vertex[] = {0,0,0} ; //vertex + for (Int_t iev = 0; iev < GetNMixedEvent(); iev++) { + if (!GetMixedEvent()) + GetReader()->GetVertex(GetVertex(iev)); + else + GetMixedEvent()->GetVertexOfEvent(iev)->GetXYZ(GetVertex(iev)); + } + Double_t vertex2[] = {0,0,0} ; //vertex from second input aod + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) { - GetReader()->GetVertex(vertex); - if(GetReader()->GetSecondInputAODTree()) GetReader()->GetSecondInputAODVertex(vertex2); + if(GetReader()->GetSecondInputAODTree()) + GetReader()->GetSecondInputAODVertex(vertex2); } - //printf("Vertex 0: %f,%f,%f\n",vertex[0],vertex[1],vertex[2]); - //printf("Vertex 1: %f,%f,%f\n",vertex2[0],vertex2[1],vertex2[2]); - //Select the Calorimeter of the photon + //printf("Vertex 0: %f,%f,%f\n",vertex[0],vertex[1],vertex[2]); + //printf("Vertex 1: %f,%f,%f\n",vertex2[0],vertex2[1],vertex2[2]); + //Select the Calorimeter of the photon + TObjArray * pl = 0x0; if(fCalorimeter == "PHOS") pl = GetAODPHOS(); else if (fCalorimeter == "EMCAL") pl = GetAODEMCAL(); - //Fill AODCaloClusters and AODParticle with PHOS aods + //Fill AODCaloClusters and AODParticle with PHOS/EMCAL aods TLorentzVector mom, mom2 ; Int_t nCaloClusters = pl->GetEntriesFast(); Bool_t * indexConverted = new Bool_t[nCaloClusters]; - for (Int_t i = 0; i < nCaloClusters; i++) indexConverted[i] = kFALSE; + for (Int_t i = 0; i < nCaloClusters; i++) + indexConverted[i] = kFALSE; for(Int_t icalo = 0; icalo < nCaloClusters; icalo++){ AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo)); + + Int_t evtIndex = 0 ; + if (GetMixedEvent()) { + evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; + } + //Cluster selection, not charged, with photon id and in fiducial cut - //Cluster selection, not charged, with photon id and in fiducial cut - - //Input from second AOD? - Int_t input = 0; - if (fCalorimeter == "EMCAL" && GetReader()->GetAODEMCALNormalInputEntries() <= icalo) input = 1 ; - else if(fCalorimeter == "PHOS" && GetReader()->GetAODPHOSNormalInputEntries() <= icalo) input = 1; + //Input from second AOD? + Int_t input = 0; + if (fCalorimeter == "EMCAL" && GetReader()->GetAODEMCALNormalInputEntries() <= icalo) + input = 1 ; + else if(fCalorimeter == "PHOS" && GetReader()->GetAODPHOSNormalInputEntries() <= icalo) + input = 1; - //Get Momentum vector, - if (input == 0) calo->GetMomentum(mom,vertex) ;//Assume that come from vertex in straight line - else if(input == 1) calo->GetMomentum(mom,vertex2);//Assume that come from vertex in straight line - - //If too small or big pt, skip it + //Get Momentum vector, + if (input == 0) + calo->GetMomentum(mom,GetVertex(evtIndex)) ;//Assume that come from vertex in straight line + else if(input == 1) + calo->GetMomentum(mom,vertex2);//Assume that come from vertex in straight line + + //If too small or big pt, skip it if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ; Double_t tof = calo->GetTOF()*1e9; + + if(tof < fTimeCutMin || tof > fTimeCutMax) continue; - if(tof < fTimeCutMin || tof > fTimeCutMax) continue; - - if(calo->GetNCells() <= fNCellsCut) continue; + if(calo->GetNCells() <= fNCellsCut) continue; - //printf("AliAnaPhoton::Current Event %d; Current File Name : %s, E %f, pT %f, Ecl %f\n",GetReader()->GetEventNumber(),(GetReader()->GetCurrentFileName()).Data(), mom.E(), mom.Pt(),calo->E()); - - //Check acceptance selection + //printf("AliAnaPhoton::Current Event %d; Current File Name : %s, E %f, pT %f, Ecl %f\n",GetReader()->GetEventNumber(),(GetReader()->GetCurrentFileName()).Data(), mom.E(), mom.Pt(),calo->E()); + + //Check acceptance selection if(IsFiducialCutOn()){ Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ; if(! in ) continue ; } - - //Create AOD for analysis + + //Create AOD for analysis AliAODPWG4Particle aodph = AliAODPWG4Particle(mom); - Int_t label = calo->GetLabel(0); + Int_t label = calo->GetLabel(); aodph.SetLabel(label); - aodph.SetInputFileIndex(input); - - //printf("Index %d, Id %d\n",icalo, calo->GetID()); - //Set the indeces of the original caloclusters + aodph.SetInputFileIndex(input); + + //printf("Index %d, Id %d\n",icalo, calo->GetID()); + //Set the indeces of the original caloclusters aodph.SetCaloLabel(calo->GetID(),-1); aodph.SetDetector(fCalorimeter); if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodph.Pt(),aodph.Phi(),aodph.Eta()); - //Check Distance to Bad channel, set bit. - Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel + //Check Distance to Bad channel, set bit. + Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ; if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm) continue ; @@ -526,110 +545,114 @@ void AliAnaPhoton::MakeAnalysisFillAOD() else if(distBad > fMinDist2) aodph.SetDistToBad(1) ; else aodph.SetDistToBad(0) ; - //Skip matched clusters with tracks - if(fRejectTrackMatch && calo->GetNTracksMatched() > 0) continue ; - - //Check PID - //PID selection or bit setting + //Skip matched clusters with tracks + if(fRejectTrackMatch && calo->GetNTracksMatched() > 0) continue ; + + //Check PID + //PID selection or bit setting if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){ - //Get most probable PID, check PID weights (in MC this option is mandatory) - aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + //Get most probable PID, check PID weights (in MC this option is mandatory) + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->GetPID(),mom.E()));//PID with weights if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PDG of identified particle %d\n",aodph.GetPdg()); - //If primary is not photon, skip it. + //If primary is not photon, skip it. if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ; } else if(IsCaloPIDOn()){ - - //Get most probable PID, 2 options check PID weights - //or redo PID, recommended option for EMCal. + + //Get most probable PID, 2 options check PID weights + //or redo PID, recommended option for EMCal. if(!IsCaloPIDRecalculationOn()) - aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->GetPID(),mom.E()));//PID with weights else - aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PDG of identified particle %d\n",aodph.GetPdg()); - //If cluster does not pass pid, not photon, skip it. + //If cluster does not pass pid, not photon, skip it. if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ; } else{ - //Set PID bits for later selection (AliAnaPi0 for example) - //GetPDG already called in SetPIDBits. + //Set PID bits for later selection (AliAnaPi0 for example) + //GetPDG already called in SetPIDBits. GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph); if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PID Bits set \n"); } if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetPdg()); - //Play with the MC stack if available - //Check origin of the candidates + //Play with the MC stack if available + //Check origin of the candidates if(IsDataMC()){ - - aodph.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabel(),GetReader(), aodph.GetInputFileIndex())); + + aodph.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader(), aodph.GetInputFileIndex())); if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Origin of candidate, bit map %d\n",aodph.GetTag()); }//Work with stack also - - // Check if cluster comes from a conversion in the material in front of the calorimeter - // Do invariant mass of all pairs, if mass is close to 0, then it is conversion. - - if(fCheckConversion && nCaloClusters > 1){ - Bool_t bConverted = kFALSE; - Int_t id2 = -1; + + // Check if cluster comes from a conversion in the material in front of the calorimeter + // Do invariant mass of all pairs, if mass is close to 0, then it is conversion. + + if(fCheckConversion && nCaloClusters > 1){ + Bool_t bConverted = kFALSE; + Int_t id2 = -1; - //Check if set previously as converted couple, if so skip its use. - if (indexConverted[icalo]) continue; + //Check if set previously as converted couple, if so skip its use. + if (indexConverted[icalo]) continue; - for(Int_t jcalo = icalo + 1 ; jcalo < nCaloClusters ; jcalo++) { - //Check if set previously as converted couple, if so skip its use. - if (indexConverted[jcalo]) continue; - //printf("Check Conversion indeces %d and %d\n",icalo,jcalo); - AliAODCaloCluster * calo2 = (AliAODCaloCluster*) (pl->At(jcalo)); //Get cluster kinematics - calo2->GetMomentum(mom2,vertex); - //Check only certain regions - Bool_t in2 = kTRUE; - if(IsFiducialCutOn()) in2 = GetFiducialCut()->IsInFiducialCut(mom2,fCalorimeter) ; - if(!in2) continue; - - //Get mass of pair, if small, take this pair. - //printf("\t both in calo, mass %f, cut %f\n",(mom+mom2).M(),fMassCut); - if((mom+mom2).M() < fMassCut){ - bConverted = kTRUE; - id2 = calo2->GetID(); - indexConverted[jcalo]=kTRUE; - break; - } + for(Int_t jcalo = icalo + 1 ; jcalo < nCaloClusters ; jcalo++) { + //Check if set previously as converted couple, if so skip its use. + if (indexConverted[jcalo]) continue; + //printf("Check Conversion indeces %d and %d\n",icalo,jcalo); + AliAODCaloCluster * calo2 = (AliAODCaloCluster*) (pl->At(jcalo)); //Get cluster kinematics + Int_t evtIndex2 = 0 ; + if (GetMixedEvent()) { + evtIndex2=GetMixedEvent()->EventIndexForCaloCluster(calo2->GetID()) ; + } + calo2->GetMomentum(mom2,GetVertex(evtIndex2)); + //Check only certain regions + Bool_t in2 = kTRUE; + if(IsFiducialCutOn()) in2 = GetFiducialCut()->IsInFiducialCut(mom2,fCalorimeter) ; + if(!in2) continue; + + //Get mass of pair, if small, take this pair. + //printf("\t both in calo, mass %f, cut %f\n",(mom+mom2).M(),fMassCut); + if((mom+mom2).M() < fMassCut){ + bConverted = kTRUE; + id2 = calo2->GetID(); + indexConverted[jcalo]=kTRUE; + break; + } - }//Mass loop + }//Mass loop - if(bConverted){ - if(fAddConvertedPairsToAOD){ - //Create AOD of pair analysis - TLorentzVector mpair = mom+mom2; - AliAODPWG4Particle aodpair = AliAODPWG4Particle(mpair); - aodpair.SetLabel(aodph.GetLabel()); - aodpair.SetInputFileIndex(input); - - //printf("Index %d, Id %d\n",icalo, calo->GetID()); - //Set the indeces of the original caloclusters - aodpair.SetCaloLabel(calo->GetID(),id2); - aodpair.SetDetector(fCalorimeter); - aodpair.SetPdg(aodph.GetPdg()); - aodpair.SetTag(aodph.GetTag()); - - //Add AOD with pair object to aod branch - AddAODParticle(aodpair); - //printf("\t \t both added pair\n"); - } - - //Do not add the current calocluster - continue; - }//converted pair - }//check conversion - //printf("\t \t added single cluster %d\n",icalo); + if(bConverted){ + if(fAddConvertedPairsToAOD){ + //Create AOD of pair analysis + TLorentzVector mpair = mom+mom2; + AliAODPWG4Particle aodpair = AliAODPWG4Particle(mpair); + aodpair.SetLabel(aodph.GetLabel()); + aodpair.SetInputFileIndex(input); + + //printf("Index %d, Id %d\n",icalo, calo->GetID()); + //Set the indeces of the original caloclusters + aodpair.SetCaloLabel(calo->GetID(),id2); + aodpair.SetDetector(fCalorimeter); + aodpair.SetPdg(aodph.GetPdg()); + aodpair.SetTag(aodph.GetTag()); + + //Add AOD with pair object to aod branch + AddAODParticle(aodpair); + //printf("\t \t both added pair\n"); + } + + //Do not add the current calocluster + continue; + }//converted pair + }//check conversion + //printf("\t \t added single cluster %d\n",icalo); - //Add AOD with photon object to aod branch + //Add AOD with photon object to aod branch AddAODParticle(aodph); }//loop @@ -683,82 +706,82 @@ void AliAnaPhoton::MakeAnalysisFillHistograms() if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod); for(Int_t iaod = 0; iaod < naod ; iaod++){ - AliAODPWG4Particle* ph = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); - Int_t pdg = ph->GetPdg(); - - if(GetDebug() > 3) - printf("AliAnaPhoton::MakeAnalysisFillHistograms() - PDG %d, MC TAG %d, Calorimeter %s\n", ph->GetPdg(),ph->GetTag(), (ph->GetDetector()).Data()) ; - - //If PID used, fill histos with photons in Calorimeter fCalorimeter - if(IsCaloPIDOn() && pdg != AliCaloPID::kPhoton) continue; - if(ph->GetDetector() != fCalorimeter) continue; - - if(GetDebug() > 2) - printf("AliAnaPhoton::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ; - - //Fill photon histograms - Float_t ptcluster = ph->Pt(); - Float_t phicluster = ph->Phi(); - Float_t etacluster = ph->Eta(); - Float_t ecluster = ph->E(); - - fhPtPhoton ->Fill(ptcluster); - fhPhiPhoton ->Fill(ptcluster,phicluster); - fhEtaPhoton ->Fill(ptcluster,etacluster); - - //Play with the MC data if available - if(IsDataMC()){ + AliAODPWG4Particle* ph = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); + Int_t pdg = ph->GetPdg(); + + if(GetDebug() > 3) + printf("AliAnaPhoton::MakeAnalysisFillHistograms() - PDG %d, MC TAG %d, Calorimeter %s\n", ph->GetPdg(),ph->GetTag(), (ph->GetDetector()).Data()) ; + + //If PID used, fill histos with photons in Calorimeter fCalorimeter + if(IsCaloPIDOn() && pdg != AliCaloPID::kPhoton) continue; + if(ph->GetDetector() != fCalorimeter) continue; + + if(GetDebug() > 2) + printf("AliAnaPhoton::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ; + + //Fill photon histograms + Float_t ptcluster = ph->Pt(); + Float_t phicluster = ph->Phi(); + Float_t etacluster = ph->Eta(); + Float_t ecluster = ph->E(); + + fhPtPhoton ->Fill(ptcluster); + fhPhiPhoton ->Fill(ptcluster,phicluster); + fhEtaPhoton ->Fill(ptcluster,etacluster); + + //Play with the MC data if available + if(IsDataMC()){ + + Int_t tag =ph->GetTag(); + + if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton)) + { + fhPtMCPhoton ->Fill(ptcluster); + fhPhiMCPhoton ->Fill(ptcluster,phicluster); + fhEtaMCPhoton ->Fill(ptcluster,etacluster); - Int_t tag =ph->GetTag(); + if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion)) + { + fhPtConversion ->Fill(ptcluster); + fhPhiConversion ->Fill(ptcluster,phicluster); + fhEtaConversion ->Fill(ptcluster,etacluster); + } - if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton)) - { - fhPtMCPhoton ->Fill(ptcluster); - fhPhiMCPhoton ->Fill(ptcluster,phicluster); - fhEtaMCPhoton ->Fill(ptcluster,etacluster); - - if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion)) - { - fhPtConversion ->Fill(ptcluster); - fhPhiConversion ->Fill(ptcluster,phicluster); - fhEtaConversion ->Fill(ptcluster,etacluster); - } - - if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPrompt)){ - fhPtPrompt ->Fill(ptcluster); - fhPhiPrompt ->Fill(ptcluster,phicluster); - fhEtaPrompt ->Fill(ptcluster,etacluster); - } - else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCFragmentation)) - { - fhPtFragmentation ->Fill(ptcluster); - fhPhiFragmentation ->Fill(ptcluster,phicluster); - fhEtaFragmentation ->Fill(ptcluster,etacluster); - } - else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCISR)) - { - fhPtISR ->Fill(ptcluster); - fhPhiISR ->Fill(ptcluster,phicluster); - fhEtaISR ->Fill(ptcluster,etacluster); - } - else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay)) - { - fhPtPi0Decay ->Fill(ptcluster); - fhPhiPi0Decay ->Fill(ptcluster,phicluster); - fhEtaPi0Decay ->Fill(ptcluster,etacluster); - } - else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay) || GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay)) - { - fhPtOtherDecay ->Fill(ptcluster); - fhPhiOtherDecay ->Fill(ptcluster,phicluster); - fhEtaOtherDecay ->Fill(ptcluster,etacluster); - } + if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPrompt)){ + fhPtPrompt ->Fill(ptcluster); + fhPhiPrompt ->Fill(ptcluster,phicluster); + fhEtaPrompt ->Fill(ptcluster,etacluster); } - else{ - fhPtUnknown ->Fill(ptcluster); - fhPhiUnknown ->Fill(ptcluster,phicluster); - fhEtaUnknown ->Fill(ptcluster,etacluster); - + else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCFragmentation)) + { + fhPtFragmentation ->Fill(ptcluster); + fhPhiFragmentation ->Fill(ptcluster,phicluster); + fhEtaFragmentation ->Fill(ptcluster,etacluster); + } + else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCISR)) + { + fhPtISR ->Fill(ptcluster); + fhPhiISR ->Fill(ptcluster,phicluster); + fhEtaISR ->Fill(ptcluster,etacluster); + } + else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay)) + { + fhPtPi0Decay ->Fill(ptcluster); + fhPhiPi0Decay ->Fill(ptcluster,phicluster); + fhEtaPi0Decay ->Fill(ptcluster,etacluster); + } + else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay) || GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay)) + { + fhPtOtherDecay ->Fill(ptcluster); + fhPhiOtherDecay ->Fill(ptcluster,phicluster); + fhEtaOtherDecay ->Fill(ptcluster,etacluster); + } + } + else{ + fhPtUnknown ->Fill(ptcluster); + fhPhiUnknown ->Fill(ptcluster,phicluster); + fhEtaUnknown ->Fill(ptcluster,etacluster); + // printf(" AliAnaPhoton::MakeAnalysisFillHistograms() - Label %d, pT %2.3f Unknown, bits set: ", // ph->GetLabel(),ph->Pt()); // for(Int_t i = 0; i < 20; i++) { @@ -766,80 +789,80 @@ void AliAnaPhoton::MakeAnalysisFillHistograms() // } // printf("\n"); - } - - - // Access MC information in stack if requested, check that it exists. - Int_t label =ph->GetLabel(); - if(label < 0) { - printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** bad label ***: label %d \n", label); + } + + + // Access MC information in stack if requested, check that it exists. + Int_t label =ph->GetLabel(); + if(label < 0) { + printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** bad label ***: label %d \n", label); + continue; + } + + Float_t eprim = 0; + Float_t ptprim = 0; + if(GetReader()->ReadStack()){ + + if(label >= stack->GetNtrack()) { + if(GetDebug() > 2) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack()); + continue ; + } + + primary = stack->Particle(label); + if(!primary){ + printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label); continue; - } - - Float_t eprim = 0; - Float_t ptprim = 0; - if(GetReader()->ReadStack()){ - - if(label >= stack->GetNtrack()) { - if(GetDebug() > 2) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack()); - continue ; - } - - primary = stack->Particle(label); - if(!primary){ - printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label); - continue; + } + eprim = primary->Energy(); + ptprim = primary->Pt(); + + } + else if(GetReader()->ReadAODMCParticles()){ + //Check which is the input + if(ph->GetInputFileIndex() == 0){ + if(!mcparticles0) continue; + if(label >= mcparticles0->GetEntriesFast()) { + if(GetDebug() > 2) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", + label, mcparticles0->GetEntriesFast()); + continue ; } - eprim = primary->Energy(); - ptprim = primary->Pt(); + //Get the particle + aodprimary = (AliAODMCParticle*) mcparticles0->At(label); - } - else if(GetReader()->ReadAODMCParticles()){ - //Check which is the input - if(ph->GetInputFileIndex() == 0){ - if(!mcparticles0) continue; - if(label >= mcparticles0->GetEntriesFast()) { - if(GetDebug() > 2) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", - label, mcparticles0->GetEntriesFast()); - continue ; - } - //Get the particle - aodprimary = (AliAODMCParticle*) mcparticles0->At(label); - - } - else {//Second input - if(!mcparticles1) continue; - if(label >= mcparticles1->GetEntriesFast()) { - if(GetDebug() > 2) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", - label, mcparticles1->GetEntriesFast()); - continue ; - } - //Get the particle - aodprimary = (AliAODMCParticle*) mcparticles1->At(label); - - }//second input - - if(!aodprimary){ - printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label); - continue; + } + else {//Second input + if(!mcparticles1) continue; + if(label >= mcparticles1->GetEntriesFast()) { + if(GetDebug() > 2) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", + label, mcparticles1->GetEntriesFast()); + continue ; } + //Get the particle + aodprimary = (AliAODMCParticle*) mcparticles1->At(label); - eprim = aodprimary->E(); - ptprim = aodprimary->Pt(); - - } + }//second input + + if(!aodprimary){ + printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label); + continue; + } + + eprim = aodprimary->E(); + ptprim = aodprimary->Pt(); + + } + + fh2E ->Fill(ecluster, eprim); + fh2Pt ->Fill(ptcluster, ptprim); + fhDeltaE ->Fill(eprim-ecluster); + fhDeltaPt->Fill(ptprim-ptcluster); + if(eprim > 0) fhRatioE ->Fill(ecluster/eprim); + if(ptprim > 0) fhRatioPt ->Fill(ptcluster/ptprim); + + }//Histograms with MC + + }// aod loop - fh2E ->Fill(ecluster, eprim); - fh2Pt ->Fill(ptcluster, ptprim); - fhDeltaE ->Fill(eprim-ecluster); - fhDeltaPt->Fill(ptprim-ptcluster); - if(eprim > 0) fhRatioE ->Fill(ecluster/eprim); - if(ptprim > 0) fhRatioPt ->Fill(ptcluster/ptprim); - - }//Histograms with MC - - }// aod loop - } diff --git a/PWG4/PartCorrDep/AliAnaPi0.cxx b/PWG4/PartCorrDep/AliAnaPi0.cxx index 30643bafc88..dc64e57efa0 100755 --- a/PWG4/PartCorrDep/AliAnaPi0.cxx +++ b/PWG4/PartCorrDep/AliAnaPi0.cxx @@ -47,6 +47,8 @@ #include "AliESDEvent.h" #include "AliAODEvent.h" #include "AliNeutralMesonSelection.h" +#include "AliMixedEvent.h" + ClassImp(AliAnaPi0) @@ -390,7 +392,7 @@ void AliAnaPi0::Print(const Option_t * /*opt*/) const printf("------------------------------------------------------\n") ; } - + //____________________________________________________________________________________________________________________________________________________ void AliAnaPi0::MakeAnalysisFillHistograms() { @@ -401,33 +403,49 @@ void AliAnaPi0::MakeAnalysisFillHistograms() Int_t iRun=(GetReader()->GetInputEvent())->GetRunNumber() ; if(IsBadRun(iRun)) return ; - Double_t vert[]={0,0,0} ; //vertex ; - GetReader()->GetVertex(vert); - if(vert[2]<-fZvtxCut || vert[2]> fZvtxCut) return ; //Event can not be used (vertex, centrality,... cuts not fulfilled) - - //Get Centrality and calculate centrality bin - //Does not exist in ESD yet??????? - Int_t curCentrBin=0 ; - - //Get Reaction Plain position and calculate RP bin - //does not exist in ESD yet???? - Int_t curRPBin=0 ; - - Int_t curZvertBin=(Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ; - - fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ; - Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ; - if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot); + if(GetDebug() > 1) + printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot); + if(nPhot < 2 ) + return ; Int_t module1 = -1; Int_t module2 = -1; for(Int_t i1=0; i1At(i1)) ; + // get the event index in the mixed buffer where the photon comes from + Double_t vert[] = {0.0, 0.0, 0.0} ; //vertex + Int_t evtIndex1 = 0 ; + Int_t currentEvtIndex = -1 ; + Int_t curCentrBin = 0 ; + Int_t curRPBin = 0 ; + Int_t curZvertBin = 0 ; + evtIndex1 = GetEventIndex(p1, vert) ; + if ( evtIndex1 == -1 ) + return ; + if ( evtIndex1 == -2 ) + continue ; + if (evtIndex1 != currentEvtIndex) { + //Get Reaction Plan position and calculate RP bin + //does not exist in ESD yet???? + curCentrBin = 0 ; + curRPBin = 0 ; + curZvertBin = (Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ; + fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ; + currentEvtIndex = evtIndex1 ; + } + TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); //Get Module number module1 = GetModuleNumber(p1); for(Int_t i2=i1+1; i2At(i2)) ; + Int_t evtIndex2 = GetEventIndex(p2, vert) ; + if ( evtIndex2 == -1 ) + return ; + if ( evtIndex2 == -2 ) + continue ; + if (GetMixedEvent() && (evtIndex1 == evtIndex2)) + continue ; TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); //Get module number module2 = GetModuleNumber(p2); @@ -435,181 +453,178 @@ void AliAnaPi0::MakeAnalysisFillHistograms() Double_t pt = (photon1 + photon2).Pt(); Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; if(GetDebug() > 2) - printf("AliAnaPi0::MakeAnalysisFillHistograms() - Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", - p1->Pt(), p2->Pt(), pt,m,a); - + printf("AliAnaPi0::MakeAnalysisFillHistograms() - Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", + p1->Pt(), p2->Pt(), pt,m,a); //Check if opening angle is too large or too small compared to what is expected Double_t angle = photon1.Angle(photon2.Vect()); //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue; //printf("angle %f\n",angle); - if(fUseAngleCut && angle < 0.1) continue; + if(fUseAngleCut && angle < 0.1) + continue; fhRealOpeningAngle ->Fill(pt,angle); fhRealCosOpeningAngle->Fill(pt,TMath::Cos(angle)); - //Fill module dependent histograms //if(module1==module2) printf("mod1 %d\n",module1); if(module1==module2 && module1 >=0 && module1Fill(pt,a,m) ; - - for(Int_t ipid=0; ipidIsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ - fhRe1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; - if(p1->DistToBad()>0 && p2->DistToBad()>0){ - fhRe2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; - if(p1->DistToBad()>1 && p2->DistToBad()>1){ - fhRe3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; - } - } - } - } - } - } - - //Fill mixed - - TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ; - Int_t nMixed = evMixList->GetSize() ; - for(Int_t ii=0; iiAt(ii)); - Int_t nPhot2=ev2->GetEntriesFast() ; - Double_t m = -999; - if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d\n", ii, nPhot); - - for(Int_t i1=0; i1At(i1)) ; - TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); - for(Int_t i2=0; i2At(i2)) ; - - TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); - m = (photon1+photon2).M() ; - Double_t pt = (photon1 + photon2).Pt(); - Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; - - //Check if opening angle is too large or too small compared to what is expected - Double_t angle = photon1.Angle(photon2.Vect()); - //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue; - if(fUseAngleCut && angle < 0.1) continue; - - if(GetDebug() > 2) - printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", - p1->Pt(), p2->Pt(), pt,m,a); - for(Int_t ipid=0; ipidIsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ - fhMi1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; - if(p1->DistToBad()>0 && p2->DistToBad()>0){ - fhMi2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; - if(p1->DistToBad()>1 && p2->DistToBad()>1){ - fhMi3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; - } - - } - } - } - } + fhReMod[module1]->Fill(pt,a,m) ; + + for(Int_t ipid=0; ipidIsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ + fhRe1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>0 && p2->DistToBad()>0){ + fhRe2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>1 && p2->DistToBad()>1){ + fhRe3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + } + } + } + } } } - - TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch()); - //Add current event to buffer and Remove redandant events - if(currentEvent->GetEntriesFast()>0){ - evMixList->AddFirst(currentEvent) ; - currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer - if(evMixList->GetSize()>=fNmaxMixEv) - { - TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ; - evMixList->RemoveLast() ; - delete tmp ; - } - } - else{ //empty event - delete currentEvent ; - currentEvent=0 ; - } - - //Acceptance +// +// //Fill mixed +// +// TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ; +// Int_t nMixed = evMixList->GetSize() ; +// for(Int_t ii=0; iiAt(ii)); +// Int_t nPhot2=ev2->GetEntriesFast() ; +// Double_t m = -999; +// if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d\n", ii, nPhot); +// +// for(Int_t i1=0; i1At(i1)) ; +// TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); +// for(Int_t i2=0; i2At(i2)) ; +// +// TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); +// m = (photon1+photon2).M() ; +// Double_t pt = (photon1 + photon2).Pt(); +// Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; +// +// //Check if opening angle is too large or too small compared to what is expected +// Double_t angle = photon1.Angle(photon2.Vect()); +// //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue; +// if(fUseAngleCut && angle < 0.1) continue; +// +// if(GetDebug() > 2) +// printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", +// p1->Pt(), p2->Pt(), pt,m,a); +// for(Int_t ipid=0; ipidIsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ +// fhMi1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; +// if(p1->DistToBad()>0 && p2->DistToBad()>0){ +// fhMi2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; +// if(p1->DistToBad()>1 && p2->DistToBad()>1){ +// fhMi3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; +// } +// +// } +// } +// } +// } +// } +// } +// +// TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch()); +// //Add current event to buffer and Remove redundant events +// if(currentEvent->GetEntriesFast()>0){ +// evMixList->AddFirst(currentEvent) ; +// currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer +// if(evMixList->GetSize()>=fNmaxMixEv) +// { +// TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ; +// evMixList->RemoveLast() ; +// delete tmp ; +// } +// } +// else{ //empty event +// delete currentEvent ; +// currentEvent=0 ; +// } + + //Acceptance if(IsDataMC() && GetReader()->ReadStack()){ AliStack * stack = GetMCStack(); if(stack && (IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC)) ){ for(Int_t i=0 ; iGetNprimary(); i++){ - TParticle * prim = stack->Particle(i) ; - if(prim->GetPdgCode() == 111){ - Double_t pi0Pt = prim->Pt() ; - //printf("pi0, pt %2.2f\n",pi0Pt); - if(prim->Energy() == TMath::Abs(prim->Pz())) continue ; //Protection against floating point exception - Double_t pi0Y = 0.5*TMath::Log((prim->Energy()-prim->Pz())/(prim->Energy()+prim->Pz())) ; - Double_t phi = TMath::RadToDeg()*prim->Phi() ; - if(TMath::Abs(pi0Y) < 0.5){ - fhPrimPt->Fill(pi0Pt) ; - } - fhPrimY ->Fill(pi0Y) ; - fhPrimPhi->Fill(phi) ; - - //Check if both photons hit Calorimeter - Int_t iphot1=prim->GetFirstDaughter() ; - Int_t iphot2=prim->GetLastDaughter() ; - if(iphot1>-1 && iphot1GetNtrack() && iphot2>-1 && iphot2GetNtrack()){ - TParticle * phot1 = stack->Particle(iphot1) ; - TParticle * phot2 = stack->Particle(iphot2) ; - if(phot1 && phot2 && phot1->GetPdgCode()==22 && phot2->GetPdgCode()==22){ - //printf("2 photons: photon 1: pt %2.2f, phi %3.2f, eta %1.2f; photon 2: pt %2.2f, phi %3.2f, eta %1.2f\n", - // phot1->Pt(), phot1->Phi()*180./3.1415, phot1->Eta(), phot2->Pt(), phot2->Phi()*180./3.1415, phot2->Eta()); - - TLorentzVector lv1, lv2; - phot1->Momentum(lv1); - phot2->Momentum(lv2); - - Bool_t inacceptance = kFALSE; - if(fCalorimeter == "PHOS"){ - if(GetPHOSGeometry() && GetCaloUtils()->IsPHOSGeoMatrixSet()){ - Int_t mod ; - Double_t x,z ; - if(GetPHOSGeometry()->ImpactOnEmc(phot1,mod,z,x) && GetPHOSGeometry()->ImpactOnEmc(phot2,mod,z,x)) - inacceptance = kTRUE; - if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance); - } - else{ - - if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter)) - inacceptance = kTRUE ; - if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); - } - - } - else if(fCalorimeter == "EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ - if(GetEMCALGeometry()){ - if(GetEMCALGeometry()->Impact(phot1) && GetEMCALGeometry()->Impact(phot2)) - inacceptance = kTRUE; - if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance); - } - else{ - if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter)) - inacceptance = kTRUE ; - if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); - } - } - - if(inacceptance){ - - fhPrimAccPt->Fill(pi0Pt) ; - fhPrimAccPhi->Fill(phi) ; - fhPrimAccY->Fill(pi0Y) ; - Double_t angle = lv1.Angle(lv2.Vect()); - fhPrimOpeningAngle ->Fill(pi0Pt,angle); - fhPrimCosOpeningAngle->Fill(pi0Pt,TMath::Cos(angle)); - - }//Accepted - }// 2 photons - }//Check daughters exist - }// Primary pi0 + TParticle * prim = stack->Particle(i) ; + if(prim->GetPdgCode() == 111){ + Double_t pi0Pt = prim->Pt() ; + //printf("pi0, pt %2.2f\n",pi0Pt); + if(prim->Energy() == TMath::Abs(prim->Pz())) continue ; //Protection against floating point exception + Double_t pi0Y = 0.5*TMath::Log((prim->Energy()-prim->Pz())/(prim->Energy()+prim->Pz())) ; + Double_t phi = TMath::RadToDeg()*prim->Phi() ; + if(TMath::Abs(pi0Y) < 0.5){ + fhPrimPt->Fill(pi0Pt) ; + } + fhPrimY ->Fill(pi0Y) ; + fhPrimPhi->Fill(phi) ; + + //Check if both photons hit Calorimeter + Int_t iphot1=prim->GetFirstDaughter() ; + Int_t iphot2=prim->GetLastDaughter() ; + if(iphot1>-1 && iphot1GetNtrack() && iphot2>-1 && iphot2GetNtrack()){ + TParticle * phot1 = stack->Particle(iphot1) ; + TParticle * phot2 = stack->Particle(iphot2) ; + if(phot1 && phot2 && phot1->GetPdgCode()==22 && phot2->GetPdgCode()==22){ + //printf("2 photons: photon 1: pt %2.2f, phi %3.2f, eta %1.2f; photon 2: pt %2.2f, phi %3.2f, eta %1.2f\n", + // phot1->Pt(), phot1->Phi()*180./3.1415, phot1->Eta(), phot2->Pt(), phot2->Phi()*180./3.1415, phot2->Eta()); + + TLorentzVector lv1, lv2; + phot1->Momentum(lv1); + phot2->Momentum(lv2); + + Bool_t inacceptance = kFALSE; + if(fCalorimeter == "PHOS"){ + if(GetPHOSGeometry() && GetCaloUtils()->IsPHOSGeoMatrixSet()){ + Int_t mod ; + Double_t x,z ; + if(GetPHOSGeometry()->ImpactOnEmc(phot1,mod,z,x) && GetPHOSGeometry()->ImpactOnEmc(phot2,mod,z,x)) + inacceptance = kTRUE; + if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance); + } + else{ + + if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter)) + inacceptance = kTRUE ; + if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); + } + + } + else if(fCalorimeter == "EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ + if(GetEMCALGeometry()){ + if(GetEMCALGeometry()->Impact(phot1) && GetEMCALGeometry()->Impact(phot2)) + inacceptance = kTRUE; + if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance); + } + else{ + if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter)) + inacceptance = kTRUE ; + if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); + } + } + + if(inacceptance){ + + fhPrimAccPt->Fill(pi0Pt) ; + fhPrimAccPhi->Fill(phi) ; + fhPrimAccY->Fill(pi0Y) ; + Double_t angle = lv1.Angle(lv2.Vect()); + fhPrimOpeningAngle ->Fill(pi0Pt,angle); + fhPrimCosOpeningAngle->Fill(pi0Pt,TMath::Cos(angle)); + + }//Accepted + }// 2 photons + }//Check daughters exist + }// Primary pi0 }//loop on primaries }//stack exists and data is MC }//read stack else if(GetReader()->ReadAODMCParticles()){ if(GetDebug() >= 0) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Acceptance calculation with MCParticles not implemented yet\n"); } - } //________________________________________________________________________ @@ -766,8 +781,36 @@ void AliAnaPi0::Terminate(TList* outputList) printf(" AliAnaPi0::Terminate() - !! All the eps files are in %s_%s.tar.gz !!!\n", GetName(), fCalorimeter.Data()); } - - - - - + //____________________________________________________________________________________________________________________________________________________ +Int_t AliAnaPi0::GetEventIndex(AliAODPWG4Particle * part, Double_t * vert) +{ + // retieves the event index and checks the vertex + // in the mixed buffer returns -2 if vertex NOK + // for normal events returns 0 if vertex OK and -1 if vertex NOK + + Int_t rv = -1 ; + if (GetMixedEvent()){ + TObjArray * pl = 0x0; + if (part->GetDetector().Contains("PHOS")) { + pl = GetAODPHOS(); + } else if (part->GetDetector().Contains("EMCAL")) { + pl = GetAODEMCAL(); + } else { + AliFatal(Form("%s is an unknown calorimeter", part->GetDetector().Data())) ; + } + rv = GetMixedEvent()->EventIndexForCaloCluster(part->GetCaloLabel(0)) ; + GetMixedEvent()->GetVertexOfEvent(rv)->GetXYZ(vert); + if(vert[2] < -fZvtxCut || vert[2] > fZvtxCut) + rv = -2 ; //Event can not be used (vertex, centrality,... cuts not fulfilled) + } else { + Double_t * tempo = GetReader()->GetVertex() ; + vert[0] = tempo[0] ; + vert[1] = tempo[1] ; + vert[2] = tempo[2] ; + if(vert[2] < -fZvtxCut || vert[2] > fZvtxCut) + rv = -1 ; //Event can not be used (vertex, centrality,... cuts not fulfilled) + else + rv = 0 ; + } + return rv ; +} diff --git a/PWG4/PartCorrDep/AliAnaPi0.h b/PWG4/PartCorrDep/AliAnaPi0.h index 8727f2162a2..ae5f33ebcbf 100755 --- a/PWG4/PartCorrDep/AliAnaPi0.h +++ b/PWG4/PartCorrDep/AliAnaPi0.h @@ -21,6 +21,7 @@ class TObjString; //Analysis class AliAODEvent ; class AliESDEvent ; +class AliAODPWG4Particle ; #include "AliAnaPartCorrBaseClass.h" class AliAnaPi0 : public AliAnaPartCorrBaseClass { @@ -72,6 +73,10 @@ class AliAnaPi0 : public AliAnaPartCorrBaseClass { void SwitchOnAngleSelection() {fUseAngleCut = kTRUE ; } void SwitchOffAngleSelection() {fUseAngleCut = kFALSE ; } + + virtual Int_t GetEventIndex(AliAODPWG4Particle * part, Double_t * vert) ; + + private: Bool_t IsBadRun(Int_t /*iRun*/) const {return kFALSE;} //Tests if this run bad according to private list diff --git a/PWG4/PartCorrDep/AliAnaPi0EbE.cxx b/PWG4/PartCorrDep/AliAnaPi0EbE.cxx index b87f7d00e1c..b8ecc437c3c 100755 --- a/PWG4/PartCorrDep/AliAnaPi0EbE.cxx +++ b/PWG4/PartCorrDep/AliAnaPi0EbE.cxx @@ -261,10 +261,10 @@ void AliAnaPi0EbE::MakeAnalysisFillAOD() //__________________________________________________________________ void AliAnaPi0EbE::MakeInvMassInCalorimeter() { - //Do analysis and fill aods - //Search for the photon decay in calorimeters - //Read photon list from AOD, produced in class AliAnaPhoton - //Check if 2 photons have the mass of the pi0. + //Do analysis and fill aods + //Search for the photon decay in calorimeters + //Read photon list from AOD, produced in class AliAnaPhoton + //Check if 2 photons have the mass of the pi0. TLorentzVector mom1; TLorentzVector mom2; @@ -279,70 +279,82 @@ void AliAnaPi0EbE::MakeInvMassInCalorimeter() } for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){ AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton)); + + Int_t evtIndex1 = 0 ; + if(GetMixedEvent()) + evtIndex1 = GetMixedEvent()->EventIndexForCaloCluster(photon1->GetCaloLabel(0)) ; + mom1 = *(photon1->Momentum()); for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast()-1; jphoton++){ AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(jphoton)); + Int_t evtIndex2 = 0 ; + if(GetMixedEvent()) + evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ; + if(GetMixedEvent() && (evtIndex1 == evtIndex2)) + continue ; + mom2 = *(photon2->Momentum()); - Int_t input = -1; //if -1 photons come from different files, not a pi0 - if(photon1->GetInputFileIndex() == photon2->GetInputFileIndex()) input = photon1->GetInputFileIndex(); - - //Select good pair (good phi, pt cuts, aperture and invariant mass) + Int_t input = -1; //if -1 photons come from different files, not a pi0 + if(photon1->GetInputFileIndex() == photon2->GetInputFileIndex()) + input = photon1->GetInputFileIndex(); + + //Select good pair (good phi, pt cuts, aperture and invariant mass) if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)) - { - if(GetDebug()>1) - printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta()); - - //Play with the MC stack if available - if(IsDataMC()){ - //Check origin of the candidates - Int_t label1 = photon1->GetLabel(); - Int_t label2 = photon2->GetLabel(); - tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), photon1->GetInputFileIndex()); - tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex()); - - if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2); - if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) && GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay)){ - - //Check if pi0 mother is the same - if(GetReader()->ReadStack()){ - TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree - label1 = mother1->GetFirstMother(); - //mother1 = GetMCStack()->Particle(label1);//pi0 - - TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree - label2 = mother2->GetFirstMother(); - //mother2 = GetMCStack()->Particle(label2);//pi0 - } - else if(GetReader()->ReadAODMCParticles() && (input > -1)){ - AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon1->GetInputFileIndex()))->At(label1);//photon in kine tree - label1 = mother1->GetMother(); - //mother1 = GetMCStack()->Particle(label1);//pi0 - AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon2->GetInputFileIndex()))->At(label2);//photon in kine tree - label2 = mother2->GetMother(); - //mother2 = GetMCStack()->Particle(label2);//pi0 - } - - //printf("mother1 %d, mother2 %d\n",label1,label2); - if(label1 == label2) - GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0); - } - }//Work with stack also - - //Create AOD for analysis - mom = mom1+mom2; - AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom); - //pi0.SetLabel(calo->GetLabel(0)); - pi0.SetPdg(AliCaloPID::kPi0); - pi0.SetDetector(photon1->GetDetector()); - pi0.SetTag(tag); - //Set the indeces of the original caloclusters - pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0)); - pi0.SetInputFileIndex(input); - AddAODParticle(pi0); - }//pi0 + { + if(GetDebug()>1) + printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta()); + + //Play with the MC stack if available + if(IsDataMC()){ + //Check origin of the candidates + Int_t label1 = photon1->GetLabel(); + Int_t label2 = photon2->GetLabel(); + tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), photon1->GetInputFileIndex()); + tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex()); + + if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2); + if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) && GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay)){ + + //Check if pi0 mother is the same + if(GetReader()->ReadStack()){ + TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree + label1 = mother1->GetFirstMother(); + //mother1 = GetMCStack()->Particle(label1);//pi0 + + TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree + label2 = mother2->GetFirstMother(); + //mother2 = GetMCStack()->Particle(label2);//pi0 + } + else if(GetReader()->ReadAODMCParticles() && (input > -1)){ + AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon1->GetInputFileIndex()))->At(label1);//photon in kine tree + label1 = mother1->GetMother(); + //mother1 = GetMCStack()->Particle(label1);//pi0 + AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon2->GetInputFileIndex()))->At(label2);//photon in kine tree + label2 = mother2->GetMother(); + //mother2 = GetMCStack()->Particle(label2);//pi0 + } + + //printf("mother1 %d, mother2 %d\n",label1,label2); + if(label1 == label2) + GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0); + } + }//Work with stack also + + //Create AOD for analysis + mom = mom1+mom2; + AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom); + //pi0.SetLabel(calo->GetLabel()); + pi0.SetPdg(AliCaloPID::kPi0); + pi0.SetDetector(photon1->GetDetector()); + pi0.SetTag(tag); + //Set the indeces of the original caloclusters + pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0)); + pi0.SetInputFileIndex(input); + AddAODParticle(pi0); + }//pi0 }//2n photon loop }//1st photon loop @@ -427,7 +439,7 @@ void AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() //Create AOD for analysis mom = mom1+mom2; AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom); - //pi0.SetLabel(calo->GetLabel(0)); + //pi0.SetLabel(calo->GetLabel()); pi0.SetPdg(AliCaloPID::kPi0); pi0.SetDetector(photon1->GetDetector()); pi0.SetTag(tag); @@ -493,7 +505,7 @@ void AliAnaPi0EbE::MakeShowerShapeIdentification() //Create AOD for analysis AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom); - aodpi0.SetLabel(calo->GetLabel(0)); + aodpi0.SetLabel(calo->GetLabel()); //Set the indeces of the original caloclusters aodpi0.SetCaloLabel(calo->GetID(),-1); aodpi0.SetDetector(fCalorimeter); @@ -501,7 +513,7 @@ void AliAnaPi0EbE::MakeShowerShapeIdentification() printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodpi0.Pt(),aodpi0.Phi(),aodpi0.Eta()); //Check Distance to Bad channel, set bit. - Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel + Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ; if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm) continue ; @@ -516,7 +528,7 @@ void AliAnaPi0EbE::MakeShowerShapeIdentification() //PID selection or bit setting if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){ //Get most probable PID, check PID weights (in MC this option is mandatory) - aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->GetPID(),mom.E()));//PID with weights if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: PDG of identified particle %d\n",aodpi0.GetPdg()); //If primary is not pi0, skip it. @@ -529,7 +541,7 @@ void AliAnaPi0EbE::MakeShowerShapeIdentification() //Get most probable PID, 2 options check PID weights //or redo PID, recommended option for EMCal. if(!IsCaloPIDRecalculationOn()) - aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->GetPID(),mom.E()));//PID with weights else aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated @@ -555,8 +567,8 @@ void AliAnaPi0EbE::MakeShowerShapeIdentification() GetReader()->GetDataType() != AliCaloTrackReader::kMC){ aodpi0.SetInputFileIndex(input); Int_t tag =0; - tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetReader(), aodpi0.GetInputFileIndex()); - //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabel(), GetReader(), aodpi0.GetInputFileIndex(), tag); + tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(),GetReader(), aodpi0.GetInputFileIndex()); + //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag); aodpi0.SetTag(tag); if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",aodpi0.GetTag()); } diff --git a/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx b/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx index e158353a7d9..9f828dcdc7f 100755 --- a/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx +++ b/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx @@ -15,7 +15,7 @@ /* $Id: */ -//_________________________________________________________________________∫ +//________________________________________________________________________ // A basic analysis task to analyse photon detected by PHOS // A basic analysis task to analyse photon detected by PHOS // A basic analysis task to analyse photon detected by PHOS @@ -184,7 +184,7 @@ void AliAnalysisTaskPHOSExample::UserExec(Option_t *) AliESDEvent* esd = (AliESDEvent*)InputEvent(); //************************ PHOS ************************************* - TRefArray * caloClustersArr = new TRefArray(); + TRefArray * caloClustersArr = new TRefArray(); esd->GetPHOSClusters(caloClustersArr); const Int_t kNumberOfPhosClusters = caloClustersArr->GetEntries() ; @@ -209,7 +209,7 @@ void AliAnalysisTaskPHOSExample::UserExec(Option_t *) fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ; fhPHOSDigits->Fill(Entry(), caloCluster->GetNCells() ) ; numberOfDigitsInPhos += caloCluster->GetNCells() ; - Double_t * pid = caloCluster->GetPid() ; + const Double_t * pid = caloCluster->GetPID() ; if(pid[AliPID::kPhoton] > GetPhotonId() ) { phosVector[fPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ; phosPhotonsEnergy[fPhotonsInPhos]=caloCluster->E() ; diff --git a/PWG4/libPWG4PartCorrBase.pkg b/PWG4/libPWG4PartCorrBase.pkg index ed66fb7ccb1..15f6f5756f7 100755 --- a/PWG4/libPWG4PartCorrBase.pkg +++ b/PWG4/libPWG4PartCorrBase.pkg @@ -4,6 +4,7 @@ SRCS = PartCorrBase/AliNeutralMesonSelection.cxx PartCorrBase/AliFiducialCut.cxx PartCorrBase/AliCaloPID.cxx PartCorrBase/AliMCAnalysisUtils.cxx PartCorrBase/AliIsolationCut.cxx\ PartCorrBase/AliAnaScale.cxx PartCorrBase/AliAnaPartCorrMaker.cxx \ PartCorrBase/AliAnaPartCorrBaseClass.cxx PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx \ + PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx \ PartCorrBase/AliCaloTrackReader.cxx PartCorrBase/AliCaloTrackESDReader.cxx \ PartCorrBase/AliCaloTrackAODReader.cxx PartCorrBase/AliCaloTrackMCReader.cxx PartCorrBase/AliCalorimeterUtils.cxx diff --git a/PWG4/macros/ana.C b/PWG4/macros/ana.C index 69955e83aa2..ed37555db80 100644 --- a/PWG4/macros/ana.C +++ b/PWG4/macros/ana.C @@ -18,10 +18,10 @@ enum anaModes {mLocal, mLocalCAF,mPROOF,mGRID}; //--------------------------------------------------------------------------- //Settings to read locally several files, only for "mLocal" mode //The different values are default, they can be set with environmental -//variables: INDIR, PATTERN, NEVENT, respectivelly -char * kInDir = "/user/data/files/"; +//variables: INDIR, PATTERN, NFILES, respectivelly +char * kInDir = "/Users/schutz/group/benjamin/pi0"; char * kPattern = ""; // Data are in files kInDir/kPattern+i -Int_t kEvent = 1; // Number of files +Int_t kFile = 1; // Number of files //--------------------------------------------------------------------------- //Collection file for grid analysis char * kXML = "collection.xml"; @@ -32,14 +32,13 @@ char * kXML = "collection.xml"; //This is an specific case for normalization of Pythia files. const Bool_t kGetXSectionFromFileAndScale = kFALSE ; const char * kXSFileName = "pyxsec.root"; -const Int_t kNumberOfEventsPerFile = 100; //--------------------------------------------------------------------------- -const Bool_t kMC = kTRUE; //With real data kMC = kFALSE -const TString kInputData = "ESD";//ESD, AOD, MC or deltaAOD -TString kTreeName = "esdTree"; +const Bool_t kMC = kFALSE; //With real data kMC = kFALSE +const TString kInputData = "AOD"; //ESD, AOD, MC +TString kTreeName = "aodTree"; -void ana(Int_t mode=mLocal, TString configName = "ConfigAnalysisPhoton") +void ana(Int_t mode=mLocal) { // Main @@ -52,16 +51,16 @@ void ana(Int_t mode=mLocal, TString configName = "ConfigAnalysisPhoton") //------------------------------------------------------------------------------------------------- //Create chain from ESD and from cross sections files, look below for options. - //------------------------------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------- if(kInputData == "ESD") kTreeName = "esdTree" ; - else if(kInputData.Contains("AOD")) kTreeName = "aodTree" ; + else if(kInputData == "AOD") kTreeName = "aodTree" ; else if (kInputData == "MC") kTreeName = "TE" ; else { cout<<"Wrong data type "<SetReadTR(kFALSE);//Do not search TrackRef file mgr->SetMCtruthEventHandler(mcHandler); - if( kInputData == "MC") mgr->SetInputEventHandler(NULL); + if( kInputData == "MC") mgr->SetInputEventHandler(NULL); } // AOD output handler - if(kInputData!="deltaAOD"){ - AliAODHandler* aodoutHandler = new AliAODHandler(); - aodoutHandler->SetOutputFileName("aod.root"); - //aodoutHandler->SetCreateNonStandardAOD(); - mgr->SetOutputEventHandler(aodoutHandler); - } - + AliAODHandler* aodoutHandler = new AliAODHandler(); + aodoutHandler->SetOutputFileName("aod.root"); + ////aodoutHandler->SetCreateNonStandardAOD(); + mgr->SetOutputEventHandler(aodoutHandler); + //input - if(kInputData == "ESD"){ + if(kInputData == "ESD") + { // ESD handler AliESDInputHandler *esdHandler = new AliESDInputHandler(); mgr->SetInputEventHandler(esdHandler); - } - if(kInputData.Contains("AOD")){ + cout<<"ESD handler "<GetInputEventHandler()<AddFriend("deltaAODPartCorr.root"); mgr->SetInputEventHandler(aodHandler); + cout<<"AOD handler "<GetInputEventHandler()<SetDebugLevel(-1); // For debugging, do not uncomment if you want no messages. + // mgr->SetDebugLevel(-1); // For debugging, do not uncomment if you want no messages. //------------------------------------------------------------------------- //Define task, put here any other task that you want to use. //------------------------------------------------------------------------- - AliAnalysisTaskParticleCorrelation * taskpwg4 = new AliAnalysisTaskParticleCorrelation ("Particle"); - taskpwg4->SetConfigFileName(configName); //Default name is ConfigAnalysis - - mgr->AddTask(taskpwg4); - - // Create containers for input/output AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer(); - AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(), - AliAnalysisManager::kOutputContainer, "histos.root"); - - mgr->ConnectInput (taskpwg4, 0, cinput1); - if(kInputData != "deltaAOD") mgr->ConnectOutput (taskpwg4, 0, coutput1 ); - mgr->ConnectOutput (taskpwg4, 1, coutput2 ); - - //------------------------ - //Scaling task - //----------------------- - Int_t nfiles = chainxs->GetEntries(); - //cout<<"Get? "< 0){ - //cout<<"Init AnaScale"<Set(xsection/ntrials/nfiles) ; - scale->MakeSumw2(kFALSE);//If you want histograms with error bars set to kTRUE - //scale->SetDebugLevel(2); - mgr->AddTask(scale); - - AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosscaled", TList::Class(), - AliAnalysisManager::kOutputContainer, "histosscaled.root"); - mgr->ConnectInput (scale, 0, coutput2); - mgr->ConnectOutput (scale, 0, coutput3 ); - } - + +// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C"); +// AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kFALSE); +// + gROOT->LoadMacro("AddTaskPartCorr.C"); + + + AliAnalysisTaskParticleCorrelation *taskEMCAL = AddTaskPartCorr(kInputData,"EMCAL", kTRUE, kFALSE); + mgr->AddTask(taskEMCAL); + AliAnalysisTaskParticleCorrelation *taskPHOS = AddTaskPartCorr(kInputData,"PHOS", kTRUE, kFALSE); + mgr->AddTask(taskPHOS); + + //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCalorimeterQA.C"); + //gROOT->LoadMacro("AddTaskCalorimeterQA.C"); + //AliAnalysisTaskParticleCorrelation *taskQA = AddTaskCalorimeterQA(kInputData,kFALSE,kTRUE); + + //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C"); + //AliAnalysisTaskOmegaPi0PiPi * taskomega = AddTaskomega3pi(); + //mgr->AddTask(taskomega); + + + //----------------------- // Run the analysis //----------------------- @@ -185,30 +170,45 @@ void LoadLibraries(const anaModes mode) { // If you want to use already compiled libraries // in the aliroot distribution //-------------------------------------------------------- - //gSystem->Load("libSTEERBase"); - //gSystem->Load("libESD"); - //gSystem->Load("libAOD"); - //gSystem->Load("libANALYSIS"); - //gSystem->Load("libANALYSISalice"); + //gSystem->Load("/Users/Gustavo/Work/analysis/STEERBase/libSTEERBase.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/ESD/libESD.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/AOD/libAOD.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/ANALYSIS/libANALYSIS.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/ANALYSISalice/libANALYSISalice.so"); //gSystem->Load("libPHOSUtils"); - //gSystem->Load("libEMCALUtils"); - //gSystem->Load("libPWG4PartCorrBase"); - //gSystem->Load("libPWG4PartCorrDep"); + //gSystem->Load("/Users/Gustavo/Work/analysis/PWG4PartCorrBase/libPWG4PartCorrBase.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/PWG4PartCorrDep/libPWG4PartCorrDep.so"); + gSystem->Load("libSTEERBase.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libAOD.so"); + gSystem->Load("libANALYSIS.so"); + gSystem->Load("libANALYSISalice.so"); + gSystem->Load("libPHOSUtils"); + gSystem->Load("libEMCALUtils"); + gSystem->Load("libPWG4PartCorrBase.so"); + gSystem->Load("libPWG4PartCorrDep.so"); + gSystem->Load("libPWG4omega3pi.so"); + gSystem->Load("libCORRFW.so"); + gSystem->Load("libPWG3base.so"); + gSystem->Load("libPWG3muon.so"); + //-------------------------------------------------------- //If you want to use root and par files from aliroot //-------------------------------------------------------- - SetupPar("STEERBase"); - SetupPar("ESD"); - SetupPar("AOD"); - SetupPar("ANALYSIS"); - SetupPar("ANALYSISalice"); - SetupPar("PHOSUtils"); - SetupPar("EMCALUtils"); - // //Create Geometry -// TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!! - SetupPar("PWG4PartCorrBase"); - SetupPar("PWG4PartCorrDep"); +// SetupPar("STEERBase"); +// SetupPar("ESD"); +// SetupPar("AOD"); +// SetupPar("ANALYSIS"); +// SetupPar("ANALYSISalice"); +// //If your analysis needs PHOS geometry uncomment following lines +// SetupPar("PHOSUtils"); +// SetupPar("EMCALUtils"); +// // //Create Geometry +// // TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!! +// SetupPar("PWG4PartCorrBase"); +// SetupPar("PWG4PartCorrDep"); +// //SetupPar("PWG4omega3pi"); } //--------------------------------------------------------- @@ -241,11 +241,8 @@ void LoadLibraries(const anaModes mode) { gProof->UploadPackage("ANALYSIS.par"); gProof->EnablePackage("ANALYSIS"); // Enable the PHOS geometry Package - gProof->UploadPackage("PHOSUtils.par"); - gProof->EnablePackage("PHOSUtils"); - // Enable the PHOS geometry Package - gProof->UploadPackage("EMCALUtils.par"); - gProof->EnablePackage("EMCALUtils"); + //gProof->UploadPackage("PHOSUtils.par"); + //gProof->EnablePackage("PHOSUtils"); // Enable PartCorr analysis gProof->UploadPackage("PWG4PartCorrBase.par"); gProof->EnablePackage("PWG4PartCorrBase"); @@ -327,7 +324,7 @@ void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){ else if(mode == mLocal){ //If you want to add several ESD files sitting in a common directory INDIR //Specify as environmental variables the directory (INDIR), the number of files - //to analyze (NEVENT) and the pattern name of the directories with files (PATTERN) + //to analyze (NFILES) and the pattern name of the directories with files (PATTERN) if(gSystem->Getenv("INDIR")) kInDir = gSystem->Getenv("INDIR") ; @@ -337,24 +334,38 @@ void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){ kPattern = gSystem->Getenv("PATTERN") ; else cout<<"PATTERN not set, use default: "<Getenv("NEVENT")) - kEvent = atoi(gSystem->Getenv("NEVENT")) ; - else cout<<"NEVENT not set, use default: "<Getenv("NFILES")) + kFile = atoi(gSystem->Getenv("NFILES")) ; + else cout<<"NFILES not set, use default: "<cd(kInDir) ) {//check if ESDs directory exist printf("%s does not exist\n", kInDir) ; return ; } - cout<<"INDIR : "<Getenv("XSFILE")) + //kXSFileName = gSystem->Getenv("XSFILE") ; + //else cout<<" XS file name not set, use default: "<Getenv("GENER"); + if(kGener) { + cout<<"GENER "<GetEntries(), skipped) ; + printf("number of entries # %lld, skipped %d\n", chain->GetEntries(), skipped*100) ; } else { TString input = "AliESDs.root" ; diff --git a/PWG4/macros/anaM.C b/PWG4/macros/anaM.C new file mode 100644 index 00000000000..081fe8e1ff0 --- /dev/null +++ b/PWG4/macros/anaM.C @@ -0,0 +1,497 @@ +/* $Id$ */ +//-------------------------------------------------- +// Example macro to do analysis with the +// analysis classes in PWG4PartCorr +// Can be executed with Root and AliRoot +// +// Pay attention to the options and definitions +// set in the lines below +// +// Author : Gustavo Conesa Balbastre (INFN-LNF) +// +//------------------------------------------------- +enum anaModes {mLocal, mLocalCAF,mPROOF,mGRID,mMix}; +//mLocal: Analyze locally files in your computer +//mLocalCAF: Analyze locally CAF files +//mPROOF: Analyze CAF files with PROOF + +//--------------------------------------------------------------------------- +//Settings to read locally several files, only for "mLocal" mode +//The different values are default, they can be set with environmental +//variables: INDIR, PATTERN, NFILES, respectivelly +char * kInDir = "/Users/schutz/group/benjamin/pi0"; +char * kPattern = ""; // Data are in files kInDir/kPattern+i +Int_t kFile = 1; // Number of files +//--------------------------------------------------------------------------- +//Collection file for grid analysis +char * kXML = "collection.xml"; +//--------------------------------------------------------------------------- +//Scale histograms from file. Change to kTRUE when xsection file exists +//Put name of file containing xsection +//Put number of events per ESD file +//This is an specific case for normalization of Pythia files. +const Bool_t kGetXSectionFromFileAndScale = kFALSE ; +const char * kXSFileName = "pyxsec.root"; +//--------------------------------------------------------------------------- + +const Bool_t kMC = kFALSE; //With real data kMC = kFALSE +const TString kInputData = "AOD"; //ESD, AOD, MC +TString kTreeName ; + +void anaM(Int_t mode=mMix) +{ + // Main + + //-------------------------------------------------------------------- + // Load analysis libraries + // Look at the method below, + // change whatever you need for your analysis case + // ------------------------------------------------------------------ + LoadLibraries(mode) ; + + //------------------------------------------------------------------------------------------------- + //Create chain from ESD and from cross sections files, look below for options. + //------------------------------------------------------------------------------------------------- + if(kInputData == "ESD") kTreeName = "esdTree" ; + else if(kInputData == "AOD") kTreeName = "aodTree" ; + else if (kInputData == "MC") kTreeName = "TE" ; + else { + cout<<"Wrong data type "<SetReadTR(kFALSE);//Do not search TrackRef file + mgr->SetMCtruthEventHandler(mcHandler); + if( kInputData == "MC") mgr->SetInputEventHandler(NULL); + } + + // AOD output handler + AliAODHandler* aodoutHandler = new AliAODHandler(); + aodoutHandler->SetOutputFileName("aod.root"); + ////aodoutHandler->SetCreateNonStandardAOD(); + mgr->SetOutputEventHandler(aodoutHandler); + + //input + Int_t maxiterations = 1; + AliEventPoolLoop* pool = new AliEventPoolLoop(maxiterations); + pool->SetChain(chain); + + AliMultiEventInputHandler *inpHandler = NULL ; + if(kInputData == "ESD"){ + // ESD handler + inpHandler = new AliMultiEventInputHandler(2, 0); + } + if(kInputData == "AOD"){ + // AOD handler + inpHandler = new AliMultiEventInputHandler(2, 1); + } + mgr->SetInputEventHandler(inpHandler); + cout<<"Input handler "<GetInputEventHandler()<SetEventPool(pool); + inpHandler->SetEventPool(pool); + + //mgr->SetDebugLevel(10); // For debugging, do not uncomment if you want no messages. + + //------------------------------------------------------------------------- + //Define task, put here any other task that you want to use. + //------------------------------------------------------------------------- + // AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); + // AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer(); + + //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C"); + //AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kTRUE); + + gROOT->LoadMacro("AddTaskPartCorrM.C"); + + + AliAnalysisTaskParticleCorrelationM *taskEMCAL = AddTaskPartCorrM("AOD","EMCAL", kTRUE,kFALSE); + mgr->AddTask(taskEMCAL); + AliAnalysisTaskParticleCorrelationM *taskPHOS = AddTaskPartCorrM("AOD","PHOS", kTRUE, kFALSE); + mgr->AddTask(taskPHOS); + + //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCalorimeterQA.C"); + //gROOT->LoadMacro("AddTaskCalorimeterQA.C"); + //AliAnalysisTaskParticleCorrelation *taskQA = AddTaskCalorimeterQA(kInputData,kFALSE,kTRUE); + + //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C"); + //AliAnalysisTaskOmegaPi0PiPi * taskomega = AddTaskomega3pi(); + //mgr->AddTask(taskomega); + + + + //----------------------- + // Run the analysis + //----------------------- + TString smode = ""; + if (mode==mLocal || mode == mLocalCAF) + smode = "local"; + else if (mode==mPROOF) + smode = "proof"; + else if (mode==mGRID) + smode = "local"; + else if (mode==mMix) + smode = "mix"; + + mgr->InitAnalysis(); + mgr->PrintStatus(); + mgr->StartAnalysis(smode.Data(),chain,1000); + +cout <<" Analysis ended sucessfully "<< endl ; + + } + else cout << "Chain was not produced ! "<Load("libTree.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libXMLIO.so"); + + //---------------------------------------------------------- + // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< + //---------------------------------------------------------- + if (mode==mLocal || mode == mLocalCAF || mode == mGRID || mode == mMix) { + //-------------------------------------------------------- + // If you want to use already compiled libraries + // in the aliroot distribution + //-------------------------------------------------------- + //gSystem->Load("/Users/Gustavo/Work/analysis/STEERBase/libSTEERBase.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/ESD/libESD.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/AOD/libAOD.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/ANALYSIS/libANALYSIS.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/ANALYSISalice/libANALYSISalice.so"); + //gSystem->Load("libPHOSUtils"); + //gSystem->Load("/Users/Gustavo/Work/analysis/PWG4PartCorrBase/libPWG4PartCorrBase.so"); + //gSystem->Load("/Users/Gustavo/Work/analysis/PWG4PartCorrDep/libPWG4PartCorrDep.so"); + + gSystem->Load("libSTEERBase.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libAOD.so"); + gSystem->Load("libANALYSIS.so"); + gSystem->Load("libANALYSISalice.so"); + gSystem->Load("libPHOSUtils"); + gSystem->Load("libEMCALUtils"); + gSystem->Load("libPWG4PartCorrBase.so"); + gSystem->Load("libPWG4PartCorrDep.so"); +// gSystem->Load("libPWG4omega3pi.so"); +// gSystem->Load("libCORRFW.so"); +// gSystem->Load("libPWG3base.so"); +// gSystem->Load("libPWG3muon.so"); + + //-------------------------------------------------------- + //If you want to use root and par files from aliroot + //-------------------------------------------------------- +// SetupPar("STEERBase"); +// SetupPar("ESD"); +// SetupPar("AOD"); +// SetupPar("ANALYSIS"); +// SetupPar("ANALYSISalice"); +// //If your analysis needs PHOS geometry uncomment following lines +// SetupPar("PHOSUtils"); +// SetupPar("EMCALUtils"); +// // //Create Geometry +// // TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!! +// SetupPar("PWG4PartCorrBase"); +// SetupPar("PWG4PartCorrDep"); +// //SetupPar("PWG4omega3pi"); + } + + //--------------------------------------------------------- + // <<<<<<<<<< PROOF mode >>>>>>>>>>>> + //--------------------------------------------------------- + else if (mode==mPROOF) { + // + // Connect to proof + // Put appropriate username here + // TProof::Reset("proof://mgheata@lxb6046.cern.ch"); + TProof::Open("proof://mgheata@lxb6046.cern.ch"); + + // gProof->ClearPackages(); + // gProof->ClearPackage("ESD"); + // gProof->ClearPackage("AOD"); + // gProof->ClearPackage("ANALYSIS"); + // gProof->ClearPackage("PWG4PartCorrBase"); + // gProof->ClearPackage("PWG4PartCorrDep"); + + // Enable the STEERBase Package + gProof->UploadPackage("STEERBase.par"); + gProof->EnablePackage("STEERBase"); + // Enable the ESD Package + gProof->UploadPackage("ESD.par"); + gProof->EnablePackage("ESD"); + // Enable the AOD Package + gProof->UploadPackage("AOD.par"); + gProof->EnablePackage("AOD"); + // Enable the Analysis Package + gProof->UploadPackage("ANALYSIS.par"); + gProof->EnablePackage("ANALYSIS"); + // Enable the PHOS geometry Package + //gProof->UploadPackage("PHOSUtils.par"); + //gProof->EnablePackage("PHOSUtils"); + // Enable PartCorr analysis + gProof->UploadPackage("PWG4PartCorrBase.par"); + gProof->EnablePackage("PWG4PartCorrBase"); + gProof->UploadPackage("PWG4PartCorrDep.par"); + gProof->EnablePackage("PWG4PartCorrDep"); + gProof->ShowEnabledPackages(); + } + +} + +void SetupPar(char* pararchivename) +{ + //Load par files, create analysis libraries + //For testing, if par file already decompressed and modified + //classes then do not decompress. + + TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; + TString parpar(Form("%s.par", pararchivename)) ; + if ( gSystem->AccessPathName(parpar.Data()) ) { + gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; + TString processline(Form(".! make %s", parpar.Data())) ; + gROOT->ProcessLine(processline.Data()) ; + gSystem->ChangeDirectory(cdir) ; + processline = Form(".! mv $ALICE_ROOT/%s .", parpar.Data()) ; + gROOT->ProcessLine(processline.Data()) ; + } + if ( gSystem->AccessPathName(pararchivename) ) { + TString processline = Form(".! tar xvzf %s",parpar.Data()) ; + gROOT->ProcessLine(processline.Data()); + } + + TString ocwd = gSystem->WorkingDirectory(); + gSystem->ChangeDirectory(pararchivename); + + // check for BUILD.sh and execute + if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { + printf("*******************************\n"); + printf("*** Building PAR archive ***\n"); + cout<Exec("PROOF-INF/BUILD.sh")) { + Error("runProcess","Cannot Build the PAR Archive! - Abort!"); + return -1; + } + } + // check for SETUP.C and execute + if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { + printf("*******************************\n"); + printf("*** Setup PAR archive ***\n"); + cout<Macro("PROOF-INF/SETUP.C"); + } + + gSystem->ChangeDirectory(ocwd.Data()); + printf("Current dir: %s\n", ocwd.Data()); +} + + + +void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){ + //Fills chain with data + TString ocwd = gSystem->WorkingDirectory(); + + //----------------------------------------------------------- + //Analysis of CAF data locally and with PROOF + //----------------------------------------------------------- + if(mode ==mPROOF || mode ==mLocalCAF){ + // Chain from CAF + gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); + // The second parameter is the number of input files in the chain + chain = CreateESDChain("ESD12001.txt", 5); + } + + //--------------------------------------- + //Local files analysis + //--------------------------------------- + else if(mode == mLocal || mode == mMix){ + //If you want to add several ESD files sitting in a common directory INDIR + //Specify as environmental variables the directory (INDIR), the number of files + //to analyze (NFILES) and the pattern name of the directories with files (PATTERN) + + if(gSystem->Getenv("INDIR")) + kInDir = gSystem->Getenv("INDIR") ; + else cout<<"INDIR not set, use default: "<Getenv("PATTERN")) + kPattern = gSystem->Getenv("PATTERN") ; + else cout<<"PATTERN not set, use default: "<Getenv("NFILES")) + kFile = atoi(gSystem->Getenv("NFILES")) ; + else cout<<"NFILES not set, use default: "<cd(kInDir) ) {//check if ESDs directory exist + printf("%s does not exist\n", kInDir) ; + return ; + } + + //if(gSystem->Getenv("XSFILE")) + //kXSFileName = gSystem->Getenv("XSFILE") ; + //else cout<<" XS file name not set, use default: "<Getenv("GENER"); + if(kGener) { + cout<<"GENER "<Get(kTreeName) ) { + printf("++++ Adding %s\n", file) ; + chain->AddFile(file); + chainxs->Add(filexs) ; + } + } + else { + printf("---- Skipping %s\n", file) ; + skipped++ ; + } + } + printf("number of entries # %lld, skipped %d\n", chain->GetEntries(), skipped*100) ; + } + else { + TString input = "AliESDs.root" ; + cout<<">>>>>> No list added, take a single file <<<<<<<<< "<AddFile(input); + } + + }// local files analysis + + //------------------------------ + //GRID xml files + //----------------------------- + else if(mode == mGRID){ + //Get colection file. It is specified by the environmental + //variable XML + + if(gSystem->Getenv("XML") ) + kXML = gSystem->Getenv("XML"); + else + sprintf(kXML, "collection.xml") ; + + if (!TFile::Open(kXML)) { + printf("No collection file with name -- %s -- was found\n",kXML); + return ; + } + else cout<<"XML file "<Load("libNetx.so") ; + gSystem->Load("libRAliEn.so"); + TGrid::Connect("alien://") ; + + //Feed Grid with collection file + //TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\", 0)", kXML)); + TGridCollection * collection = (TGridCollection*) TAlienCollection::Open(kXML); + if (! collection) { + AliError(Form("%s not found", kXML)) ; + return kFALSE ; + } + TGridResult* result = collection->GetGridResult("",0 ,0); + + // Makes the ESD chain + printf("*** Getting the Chain ***\n"); + for (Int_t index = 0; index < result->GetEntries(); index++) { + TString alienURL = result->GetKey(index, "turl") ; + cout << "================== " << alienURL << endl ; + chain->Add(alienURL) ; + alienURL.ReplaceAll("AliESDs.root",kXSFileName); + chainxs->Add(alienURL) ; + } + }// xml analysis + + gSystem->ChangeDirectory(ocwd.Data()); +} + +//________________________________________________ +void GetAverageXsection(TTree * tree, Double_t & xs, Float_t & ntr) +{ + // Read the PYTHIA statistics from the file pyxsec.root created by + // the function WriteXsection(): + // integrated cross section (xsection) and + // the number of Pyevent() calls (ntrials) + // and calculate the weight per one event xsection/ntrials + // The spectrum calculated by a user should be + // multiplied by this weight, something like this: + // TH1F *userSpectrum ... // book and fill the spectrum + // userSpectrum->Scale(weight) + // + // Yuri Kharlov 19 June 2007 + // Gustavo Conesa 15 April 2008 + Double_t xsection = 0; + UInt_t ntrials = 0; + xs = 0; + ntr = 0; + + Int_t nfiles = tree->GetEntries() ; + if (tree && nfiles > 0) { + tree->SetBranchAddress("xsection",&xsection); + tree->SetBranchAddress("ntrials",&ntrials); + for(Int_t i = 0; i < nfiles; i++){ + tree->GetEntry(i); + xs += xsection ; + ntr += ntrials ; + cout << "xsection " <>>> Empty tree !!!! <<<<< "<=0 && pos < fNCells) { fCellNumber[pos] = cellNumber; - fAmplitude[pos] = amplitude; + fAmplitude[pos] = amplitude; fIsSorted = kFALSE; return kTRUE; } else { diff --git a/STEER/AliAODCaloCells.h b/STEER/AliAODCaloCells.h index 18da2b09d80..d40564b1ab6 100644 --- a/STEER/AliAODCaloCells.h +++ b/STEER/AliAODCaloCells.h @@ -11,18 +11,14 @@ #ifndef ALIAODCELLS_H #define ALIAODCELLS_H -#include +#include #include -class AliAODCaloCells : public TNamed +class AliAODCaloCells : public AliVCaloCells { public: - enum AODCells_t {kUndef = -1, - kEMCAL, - kPHOS}; - AliAODCaloCells(); - AliAODCaloCells(const char* name, const char* title, AODCells_t ttype=kUndef); + AliAODCaloCells(const char* name, const char* title, VCells_t ttype=kUndef); AliAODCaloCells(const AliAODCaloCells& cells); AliAODCaloCells& operator=(const AliAODCaloCells& cells); @@ -32,17 +28,22 @@ class AliAODCaloCells : public TNamed void DeleteContainer(); void Sort(); - Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude); + Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time = -1); Short_t GetNumberOfCells() const { return fNCells; } - inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude) const; + 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 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(AODCells_t ttype) { fType=ttype; } + void SetType(Char_t ttype) { fType=ttype; } + protected: Int_t fNCells; // Number of cells @@ -52,11 +53,11 @@ class AliAODCaloCells : public TNamed Char_t fType; // Cell type - ClassDef(AliAODCaloCells, 1); + ClassDef(AliAODCaloCells, 2); }; -Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude) const +Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t& /*time*/) const { if (pos>=0 && pos=0 && fCellNumber[pos] == cellNumber) { return fAmplitude[pos]; } else { - Warning("GetCellAmplitude","Wrong cell array index %d", pos); return 0.; } } diff --git a/STEER/AliAODCaloCluster.cxx b/STEER/AliAODCaloCluster.cxx index 908188a24f1..20d59249194 100644 --- a/STEER/AliAODCaloCluster.cxx +++ b/STEER/AliAODCaloCluster.cxx @@ -203,7 +203,7 @@ void AliAODCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) { //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; " Double32_t energy = E(); - Double32_t pos[3]; + Float_t pos[3]; GetPosition(pos); if(vertex){//calculate direction from vertex diff --git a/STEER/AliAODCaloCluster.h b/STEER/AliAODCaloCluster.h index c432a6e7b16..b3cc53b89cc 100644 --- a/STEER/AliAODCaloCluster.h +++ b/STEER/AliAODCaloCluster.h @@ -47,12 +47,12 @@ class AliAODCaloCluster : public AliAODCluster { // getters - Double_t GetDistToBadChannel() const { return fDistToBadChannel; } + Double_t GetDistanceToBadChannel() const { return fDistToBadChannel; } Double_t GetDispersion() const { return fDispersion; } Double_t GetM20() const { return fM20; } Double_t GetM02() const { return fM02; } Double_t GetEmcCpvDistance() const { return fEmcCpvDistance; } - UShort_t GetNExMax() const { return fNExMax; } + UChar_t GetNExMax() const { return fNExMax; } Double_t GetTOF() const { return fTOF; } Int_t GetNTracksMatched() const { return fTracksMatched.GetEntriesFast(); } @@ -74,15 +74,20 @@ class AliAODCaloCluster : public AliAODCluster { Double_t GetCellAmplitudeFraction(Int_t i) const { if (fCellsAmpFraction && i >=0 && i < fNCells ) return fCellsAmpFraction[i]; else return -1;} - + + //Not defined yet in AODs, put a large number the track is not matched. + Double_t GetTrackDx(void)const {return 10000. ;} + Double_t GetTrackDz(void)const {return 10000. ;} + // setters void SetDistToBadChannel(Double_t dist) { fDistToBadChannel = dist; } void SetDispersion(Double_t disp) { fDispersion = disp; } void SetM20(Double_t m20) { fM20 = m20; } void SetM02(Double_t m02) { fM02 = m02; } void SetEmcCpvDistance(Double_t emcCpvDist) { fEmcCpvDistance = emcCpvDist; } - void SetNExMax(UShort_t nExMax) { fNExMax = nExMax; } + void SetNExMax(UChar_t nExMax) { fNExMax = nExMax; } void SetTOF(Double_t tof) { fTOF = tof; } + void SetTrackDistance(Double_t, Double_t ){ ; } void SetCaloCluster(Double_t dist = -999., Double_t disp = -1., @@ -115,7 +120,7 @@ class AliAODCaloCluster : public AliAODCluster { Double32_t fM02; // 2-nd moment along the second eigen axis Double32_t fEmcCpvDistance; // the distance from PHOS EMC rec.point to the closest CPV rec.point UShort_t fNExMax; // number of (Ex-)maxima before unfolding - Double32_t fTOF; ////[0,0,12] time-of-flight + Double32_t fTOF; ////[0,0,12] time-of-flight TRefArray fTracksMatched; // references to tracks close to cluster. First entry is the most likely match. @@ -123,7 +128,7 @@ class AliAODCaloCluster : public AliAODCluster { UShort_t *fCellsAbsId; //[fNCells] array of cell absId numbers Double32_t *fCellsAmpFraction; //[fNCells][0.,1.,16] array with cell amplitudes fraction. - ClassDef(AliAODCaloCluster,5); + ClassDef(AliAODCaloCluster,6); }; #endif diff --git a/STEER/AliAODCluster.cxx b/STEER/AliAODCluster.cxx index 83ffd665b5c..8c49de0a482 100644 --- a/STEER/AliAODCluster.cxx +++ b/STEER/AliAODCluster.cxx @@ -25,7 +25,8 @@ ClassImp(AliAODCluster) //______________________________________________________________________________ -AliAODCluster::AliAODCluster() : +AliAODCluster::AliAODCluster() : + AliVCluster(), fEnergy(0), fChi2(-999.), fID(-999), @@ -36,8 +37,8 @@ AliAODCluster::AliAODCluster() : { // default constructor - SetPosition((Float_t*)NULL); - SetPID((Float_t*)NULL); + SetPosition(NULL); + SetPID(NULL); } //______________________________________________________________________________ @@ -49,6 +50,7 @@ AliAODCluster::AliAODCluster(Int_t id, Double_t pid[13], Char_t ttype, UInt_t selectInfo) : + AliVCluster(), fEnergy(energy), fChi2(-999.), fID(id), @@ -59,8 +61,8 @@ AliAODCluster::AliAODCluster(Int_t id, { // constructor - SetPosition(x); - SetPID(pid); + if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);} + if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);} SetLabel(label, nLabel); } @@ -73,6 +75,7 @@ AliAODCluster::AliAODCluster(Int_t id, Float_t pid[13], Char_t ttype, UInt_t selectInfo) : + AliVCluster(), fEnergy(energy), fChi2(-999.), fID(id), @@ -82,9 +85,8 @@ AliAODCluster::AliAODCluster(Int_t id, fType(ttype) { // constructor - - SetPosition(x); - SetPID(pid); + if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);} + if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);} SetLabel(label, nLabel); } @@ -100,7 +102,7 @@ AliAODCluster::~AliAODCluster() //______________________________________________________________________________ AliAODCluster::AliAODCluster(const AliAODCluster& clus) : - TObject(clus), + AliVCluster(clus), fEnergy(clus.fEnergy), fChi2(clus.fChi2), fID(clus.fID), @@ -111,8 +113,9 @@ AliAODCluster::AliAODCluster(const AliAODCluster& clus) : { // Copy constructor - clus.GetPosition(fPosition); - SetPID(clus.fPID); + if(fPosition) {for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];} + if(fPID) {for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];} + SetLabel(clus.fLabel, clus.fNLabel); } @@ -121,10 +124,10 @@ AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus) { // Assignment operator if(this!=&clus) { - - clus.GetPosition(fPosition); - clus.GetPID(fPID); - + + if(fPosition) {for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];} + if(fPID) {for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];} + fEnergy = clus.fEnergy; fChi2 = clus.fChi2; @@ -139,16 +142,15 @@ AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus) } //______________________________________________________________________________ -template void AliAODCluster::SetPosition(const T *x) +void AliAODCluster::SetPosition(Float_t *x) { // set the position - + if (x) { - fPosition[0] = x[0]; - fPosition[1] = x[1]; - fPosition[2] = x[2]; + fPosition[0] = x[0]; + fPosition[1] = x[1]; + fPosition[2] = x[2]; } else { - fPosition[0] = -999.; fPosition[1] = -999.; fPosition[2] = -999.; @@ -156,31 +158,33 @@ template void AliAODCluster::SetPosition(const T *x) } //______________________________________________________________________________ -AliAODCluster::AODCluPID_t AliAODCluster::GetMostProbablePID() const +UShort_t AliAODCluster::GetMostProbablePID() const { // Returns the most probable PID array element. Int_t nPID = 13; + UShort_t unknown = AliVCluster::kUnknown; + if (fPID) { - AODCluPID_t loc = kUnknown; + UShort_t loc = unknown; Double_t max = 0.; Bool_t allTheSame = kTRUE; for (Int_t iPID = 0; iPID < nPID; iPID++) { if (fPID[iPID] >= max) { - if (fPID[iPID] > max) { - allTheSame = kFALSE; - max = fPID[iPID]; - loc = (AODCluPID_t)iPID; - } else { - allTheSame = kTRUE; - } + if (fPID[iPID] > max) { + allTheSame = kFALSE; + max = fPID[iPID]; + loc = (UShort_t)iPID; + } else { + allTheSame = kTRUE; + } } } - return allTheSame ? kUnknown : loc; + return allTheSame ? unknown : loc; } else { - return kUnknown; + return unknown; } } @@ -205,7 +209,7 @@ void AliAODCluster::SetLabel(Int_t *label, UInt_t size) } //______________________________________________________________________________ -Int_t AliAODCluster::GetLabel(UInt_t i) const +Int_t AliAODCluster::GetLabelAt(UInt_t i) const { if (fLabel && i < (UInt_t)fNLabel) { return fLabel[i]; @@ -232,5 +236,10 @@ void AliAODCluster::Print(Option_t* /* option */) const printf("Cluster type: %d\n", GetType()); printf(" energy = %f\n", E()); printf(" chi2 = %f\n", Chi2()); - printf(" PID object: %p\n", static_cast(PID())); + const Double_t *pid = GetPID(); + printf("PID weights: photon %0.2f, pi0 %0.2f, electron %0.2f, conversion electron %0.2f\n, 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]); } diff --git a/STEER/AliAODCluster.h b/STEER/AliAODCluster.h index 897f3456ce8..fc8354c3154 100644 --- a/STEER/AliAODCluster.h +++ b/STEER/AliAODCluster.h @@ -10,35 +10,12 @@ // Author: Markus Oldenburg, CERN //------------------------------------------------------------------------- -#include +#include -class AliAODCluster : public TObject { +class AliAODCluster : public AliVCluster { public: - enum AODClu_t {kUndef = -1, - kPHOSNeutral, - kPHOSCharged, - kEMCALClusterv1, - kPMDNeutral, - kPMDCharged}; - - enum AODCluPID_t { - kElectron = 0, - kMuon = 1, - kPion = 2, - kKaon = 3, - kProton = 4, - kPhoton = 5, - kPi0 = 6, - kNeutron = 7, - kKaon0 = 8, - kEleCon = 9, - kUnknown = 10, - kCharged = 11, //For PMD? - kNeutral =12 //For PMD? - }; - AliAODCluster(); AliAODCluster(Int_t id, UInt_t nLabel, @@ -57,78 +34,80 @@ class AliAODCluster : public TObject { Float_t pid[13], Char_t ttype=kUndef, UInt_t selectInfo=0); - + virtual ~AliAODCluster(); AliAODCluster(const AliAODCluster& clus); AliAODCluster& operator=(const AliAODCluster& clus); Double_t Chi2() const { return fChi2; } - - virtual Double_t E() const { return fEnergy; } - + + Double_t E() const { return fEnergy; } + // PID - virtual const Double_t *PID() const { return fPID; } - AODCluPID_t GetMostProbablePID() const; - - template void GetPID(T *pid) const { - for(Int_t i=0; i<13; ++i) pid[i]=fPID[i];} - - template void SetPID(const T *pid) { - if(pid) for(Int_t i=0; i<13; ++i) fPID[i]=pid[i]; - else {for(Int_t i=0; i<13; fPID[i++]=0) ;} fPID[AliAODCluster::kUnknown]=1.;} - - template void SetPIDFromESD(const T *pid) { - if(pid) {for(Int_t i=0; i<11; ++i) fPID[i]=pid[i]; fPID[11]=0; fPID[12]=0;} - else {for(Int_t i=0; i<13; fPID[i++]=0) ;} fPID[AliAODCluster::kUnknown]=1.;} - - Int_t GetID() const { return fID; } - Int_t GetLabel(UInt_t i) const; + + UShort_t GetMostProbablePID() const; + const Double_t *GetPID() const { return fPID; }//{ for(Int_t i=0; i<13; ++i) pid[i]=fPID[i]; } + Int_t GetID() const { return fID; } + Int_t GetLabel() const { + if( fLabel && fNLabel > 0) return fLabel[0]; + else return -1;} //Most likely the track associated to the cluster + Int_t GetLabelAt(UInt_t i) const; Int_t * GetLabels() const {return fLabel ; } - UInt_t GetNLabel() const { return (UInt_t)fNLabel; } + UInt_t GetNLabels() const { return (UInt_t)fNLabel; } Bool_t TestFilterBit(UInt_t filterBit) const { return (Bool_t) ((filterBit & fFilterMap) != 0); } Char_t GetType() const { return fType; } - - template Bool_t GetPosition(T *x) const { - x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2]; - return kTRUE;} - - Bool_t IsEMCALCluster() {if(fType == kEMCALClusterv1) return kTRUE; + + void GetPosition(Float_t *x) const { + x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];} + + Bool_t IsEMCAL() const {if(fType == kEMCALClusterv1) return kTRUE; else return kFALSE;} - Bool_t IsPHOSCluster() {if(fType == kPHOSCharged || fType == kPHOSNeutral) return kTRUE; + Bool_t IsPHOS() const {if(fType == kPHOSCharged || fType == kPHOSNeutral) return kTRUE; else return kFALSE;} - + // print void Print(const Option_t *opt = "") const; - + // setters void SetE(Double32_t energy) {fEnergy = energy ; } - void SetPosition(Int_t ipos, Double32_t pos) {fPosition[ipos] = pos ;} void SetID(Int_t id) { fID = id; } - void SetType(AODClu_t ttype) { fType=ttype; } + void SetType(Char_t ttype) { fType=ttype; } void SetLabel(Int_t *label, UInt_t size); - void RemoveLabel(); - - template void SetPosition(const T *x); - void SetChi2(Double_t chi2) { fChi2 = chi2; } - + + void SetPosition(Float_t *x); + void SetPositionAt(Float_t x,Int_t i) { if(i>=0 && i<3) fPosition[i] = x ; + else printf("Bad index for position array, i = %d\n",i);} + + void SetPIDAt(Float_t x,Int_t i) { if(i>=0 && i<13) fPID[i] = x ; + else printf("Bad index for PID array, i = %d\n",i);} + void SetPID(const Float_t *pid) { + if(pid) for(Int_t i=0; i<13; ++i) fPID[i]=pid[i]; + else {for(Int_t i=0; i<13; fPID[i++]=0) ;} fPID[AliAODCluster::kUnknown]=1.;} + template void SetPIDFromESD(const T *pid) { + if(pid) {for(Int_t i=0; i<11; ++i) fPID[i]=pid[i]; fPID[11]=0; fPID[12]=0;} + else {for(Int_t i=0; i<13; fPID[i++]=0) ;} fPID[AliAODCluster::kUnknown]=1.;} + + void RemoveLabel(); + + private : - + // Energy & position Double32_t fEnergy; // energy Double32_t fPosition[3]; // position of the cluster - + Double32_t fChi2; // chi2 (probably not necessary for PMD) Double32_t fPID[13]; // [0.,1.,8] pointer to PID object - + Int_t fID; // unique cluster ID, points back to the ESD cluster Int_t fNLabel; // number of original track for this cluster Int_t *fLabel; // [fNLabel] particle label, points back to MC tracks UInt_t fFilterMap; // filter information, one bit per set of cuts Char_t fType; // cluster type - - ClassDef(AliAODCluster,5); + + ClassDef(AliAODCluster,6); }; #endif diff --git a/STEER/AliAODEvent.cxx b/STEER/AliAODEvent.cxx index 4dbb5dd6c8b..318c85c1ca4 100644 --- a/STEER/AliAODEvent.cxx +++ b/STEER/AliAODEvent.cxx @@ -436,9 +436,9 @@ Int_t AliAODEvent::GetPHOSClusters(TRefArray *clusters) const AliAODCaloCluster *cl = 0; Bool_t first = kTRUE; - for (Int_t i = 0; i < GetNCaloClusters() ; i++) { + for (Int_t i = 0; i < GetNumberOfCaloClusters() ; i++) { if ( (cl = GetCaloCluster(i)) ) { - if (cl->IsPHOSCluster()){ + if (cl->IsPHOS()){ if(first) { new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); first=kFALSE; @@ -459,9 +459,9 @@ Int_t AliAODEvent::GetEMCALClusters(TRefArray *clusters) const clusters->Clear(); AliAODCaloCluster *cl = 0; Bool_t first = kTRUE; - for (Int_t i = 0; i < GetNCaloClusters(); i++) { + for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { if ( (cl = GetCaloCluster(i)) ) { - if (cl->IsEMCALCluster()){ + if (cl->IsEMCAL()){ if(first) { new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); first=kFALSE; @@ -510,101 +510,101 @@ Int_t AliAODEvent::GetNumberOfMuonTracks() const void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/) { - // Connects aod event to tree + // Connects aod event to tree if(!tree){ Printf("%s %d AliAODEvent::ReadFromTree() Zero Pointer to Tree \n",(char*)__FILE__,__LINE__); return; } - // load the TTree + // load the TTree if(!tree->GetTree())tree->LoadTree(0); - - // Try to find AliAODEvent + + // Try to find AliAODEvent AliAODEvent *aodEvent = 0; aodEvent = (AliAODEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliAODEvent"); if(aodEvent){ - // Check if already connected to tree + // Check if already connected to tree TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree")); if (connectedList && (strcmp(opt, "reconnect"))) { - // If connected use the connected list of objects - fAODObjects->Delete(); - fAODObjects = connectedList; - GetStdContent(); - fConnected = kTRUE; - return; + // If connected use the connected list of objects + fAODObjects->Delete(); + fAODObjects = connectedList; + GetStdContent(); + fConnected = kTRUE; + return; } - // Connect to tree - // prevent a memory leak when reading back the TList - // if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete(); - - // create a new TList from the UserInfo TList... - // copy constructor does not work... + // Connect to tree + // prevent a memory leak when reading back the TList + // if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete(); + + // create a new TList from the UserInfo TList... + // copy constructor does not work... fAODObjects = (TList*)(aodEvent->GetList()->Clone()); fAODObjects->SetOwner(kTRUE); if(fAODObjects->GetEntries()GetEntries(),kAODListN); + (char*)__FILE__,__LINE__,fAODObjects->GetEntries(),kAODListN); } - // - // Let's find out whether we have friends + // + // Let's find out whether we have friends TList* friendL = tree->GetTree()->GetListOfFriends(); if (friendL) { - TIter next(friendL); - TFriendElement* fe; - while ((fe = (TFriendElement*)next())){ - aodEvent = (AliAODEvent*)(fe->GetTree()->GetUserInfo()->FindObject("AliAODEvent")); - if (!aodEvent) { - printf("No UserInfo on tree \n"); - } else { - - TList* objL = (TList*)(aodEvent->GetList()->Clone()); - printf("Get list of object from tree %d !!\n", objL->GetEntries()); - TIter nextobject(objL); - TObject* obj = 0; - while((obj = nextobject())) - { - printf("Adding object from friend %s !\n", obj->GetName()); - fAODObjects->Add(obj); - } // object "branch" loop - } // has userinfo - } // friend loop + TIter next(friendL); + TFriendElement* fe; + while ((fe = (TFriendElement*)next())){ + aodEvent = (AliAODEvent*)(fe->GetTree()->GetUserInfo()->FindObject("AliAODEvent")); + if (!aodEvent) { + printf("No UserInfo on tree \n"); + } else { + + TList* objL = (TList*)(aodEvent->GetList()->Clone()); + printf("Get list of object from tree %d !!\n", objL->GetEntries()); + TIter nextobject(objL); + TObject* obj = 0; + while((obj = nextobject())) + { + printf("Adding object from friend %s !\n", obj->GetName()); + fAODObjects->Add(obj); + } // object "branch" loop + } // has userinfo + } // friend loop } // has friends - - -// set the branch addresses + + + // set the branch addresses TIter next(fAODObjects); TNamed *el; while((el=(TNamed*)next())){ TString bname(el->GetName()); - // check if branch exists under this Name + // check if branch exists under this Name TBranch *br = tree->GetTree()->GetBranch(bname.Data()); if(br){ - tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el)); + tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el)); } else { - br = tree->GetBranch(Form("%s.",bname.Data())); - if(br){ - tree->SetBranchAddress(Form("%s.",bname.Data()),fAODObjects->GetObjectRef(el)); - } - else{ - printf("%s %d AliAODEvent::ReadFromTree() No Branch found with Name %s. \n", - (char*)__FILE__,__LINE__,bname.Data()); - } + br = tree->GetBranch(Form("%s.",bname.Data())); + if(br){ + tree->SetBranchAddress(Form("%s.",bname.Data()),fAODObjects->GetObjectRef(el)); + } + else{ + printf("%s %d AliAODEvent::ReadFromTree() No Branch found with Name %s. \n", + (char*)__FILE__,__LINE__,bname.Data()); + } } } GetStdContent(); - // when reading back we are not owner of the list - // must not delete it + // when reading back we are not owner of the list + // must not delete it fAODObjects->SetOwner(kTRUE); fAODObjects->SetName("AODObjectsConnectedToTree"); - // we are not owner of the list objects - // must not delete it + // we are not owner of the list objects + // must not delete it tree->GetUserInfo()->Add(fAODObjects); fConnected = kTRUE; }// no aodEvent else { - // we can't get the list from the user data, create standard content - // and set it by hand + // we can't get the list from the user data, create standard content + // and set it by hand CreateStdContent(); TIter next(fAODObjects); TNamed *el; @@ -613,12 +613,12 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/) tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el)); } GetStdContent(); - // when reading back we are not owner of the list - // must not delete it + // when reading back we are not owner of the list + // must not delete it fAODObjects->SetOwner(kTRUE); } } -//______________________________________________________________________________ + //______________________________________________________________________________ Int_t AliAODEvent::GetNumberOfPileupVerticesSPD() const{ // count number of SPD pileup vertices Int_t nVertices=GetNumberOfVertices(); diff --git a/STEER/AliAODEvent.h b/STEER/AliAODEvent.h index 04cb376e6b1..22c9c69ee4d 100644 --- a/STEER/AliAODEvent.h +++ b/STEER/AliAODEvent.h @@ -154,8 +154,8 @@ class AliAODEvent : public AliVEvent { {new((*fCascades)[fCascades->GetEntriesFast()]) AliAODcascade(*cascade); return fCascades->GetEntriesFast()-1;} // -- EMCAL and PHOS Cluster - TClonesArray *GetCaloClusters() const { return fCaloClusters; } - Int_t GetNCaloClusters() const { return fCaloClusters->GetEntriesFast(); } + TClonesArray *GetCaloClusters() const { return fCaloClusters; } + Int_t GetNumberOfCaloClusters() const { return fCaloClusters->GetEntriesFast(); } AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return (AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster); } Int_t AddCaloCluster(const AliAODCaloCluster* clus) {new((*fCaloClusters)[fCaloClusters->GetEntriesFast()]) AliAODCaloCluster(*clus); return fCaloClusters->GetEntriesFast()-1;} @@ -191,6 +191,9 @@ class AliAODEvent : public AliVEvent { // -- Calorimeter Cells AliAODCaloCells *GetEMCALCells() const { return fEmcalCells; } AliAODCaloCells *GetPHOSCells() const { return fPhosCells; } + const TGeoHMatrix* GetPHOSMatrix(Int_t /*i*/) const { return NULL; } + const TGeoHMatrix* GetEMCALMatrix(Int_t /*i*/)const { return NULL; } + // -- Dimuons TClonesArray *GetDimuons() const { return fDimuons; } @@ -223,7 +226,14 @@ class AliAODEvent : public AliVEvent { void Print(Option_t *option="") const; void MakeEntriesReferencable(); static void AssignIDtoCollection(TCollection* col); - private : + + //Following needed only for mixed event + virtual Int_t EventIndex(Int_t) const {return 0;} + virtual Int_t EventIndexForCaloCluster(Int_t) const {return 0;} + virtual Int_t EventIndexForPHOSCell(Int_t) const {return 0;} + virtual Int_t EventIndexForEMCALCell(Int_t) const {return 0;} + + private : TList *fAODObjects; // list of AODObjects TFolder *fAODFolder; // folder structure of branches diff --git a/STEER/AliAODHandler.cxx b/STEER/AliAODHandler.cxx index 01dcb7e4089..dd1fea22d29 100644 --- a/STEER/AliAODHandler.cxx +++ b/STEER/AliAODHandler.cxx @@ -133,7 +133,8 @@ Bool_t AliAODHandler::Init(Option_t* opt) Bool_t createStdAOD = fIsStandard || fFillAOD; if(!fAODEvent && createStdAOD){ fAODEvent = new AliAODEvent(); - if (fIsStandard) fAODEvent->CreateStdContent(); + if (fIsStandard) + fAODEvent->CreateStdContent(); } // // File opening according to execution mode @@ -358,15 +359,15 @@ void AliAODHandler::StoreMCParticles(){ // AOD calo cluster TClonesArray *clusters = fAODEvent->GetCaloClusters(); if(clusters){ - for (Int_t iClust = 0;iClust < fAODEvent->GetNCaloClusters(); ++iClust) { + for (Int_t iClust = 0;iClust < fAODEvent->GetNumberOfCaloClusters(); ++iClust) { AliAODCaloCluster * cluster = fAODEvent->GetCaloCluster(iClust); - UInt_t nLabel = cluster->GetNLabel(); + UInt_t nLabel = cluster->GetNLabels(); // Ugly but do not want to fragment memory by creating // new Int_t (nLabel) Int_t* labels = const_cast(cluster->GetLabels()); if (labels){ for(UInt_t i = 0;i < nLabel;++i){ - labels[i] = fMCEventH->GetNewLabel(cluster->GetLabel(i)); + labels[i] = fMCEventH->GetNewLabel(cluster->GetLabelAt(i)); } } // cluster->SetLabels(labels,nLabel); diff --git a/STEER/AliAODRecoDecay.h b/STEER/AliAODRecoDecay.h index 944e8922f50..c765eb88dc2 100644 --- a/STEER/AliAODRecoDecay.h +++ b/STEER/AliAODRecoDecay.h @@ -173,6 +173,7 @@ class AliAODRecoDecay : public AliVTrack { {printf("Dummy function"); return (Double_t)-999.;} Int_t GetLabel() const {return -1;} Int_t PdgCode() const {return 0;} + protected: Int_t MatchToMC(Int_t pdgabs,TClonesArray *mcArray,Int_t dgLabels[10],Int_t ndg,Int_t ndgCk=0,Int_t *pdgDg=0) const; diff --git a/STEER/AliAODTrack.cxx b/STEER/AliAODTrack.cxx index 99e9d5c8663..fa384d86315 100644 --- a/STEER/AliAODTrack.cxx +++ b/STEER/AliAODTrack.cxx @@ -557,3 +557,12 @@ Bool_t AliAODTrack::PropagateToDCA(const AliVVertex *vtx, return kTRUE; } +//______________________________________________________________________________ +Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const +{ + //--------------------------------------------------------------------- + // This function returns the global track momentum components + //--------------------------------------------------------------------- + p[0]=Px(); p[1]=Py(); p[2]=Pz(); + return kTRUE; +} diff --git a/STEER/AliAODTrack.h b/STEER/AliAODTrack.h index 50219381655..a2fa3b967ae 100644 --- a/STEER/AliAODTrack.h +++ b/STEER/AliAODTrack.h @@ -17,6 +17,7 @@ #include "AliAODVertex.h" #include "AliAODRedCov.h" #include "AliAODPid.h" + class AliVVertex; @@ -151,8 +152,9 @@ class AliAODTrack : public AliVTrack { template void GetP(T *p) const { p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];} - template void GetPxPyPz(T *p) const { - p[0] = Px(); p[1] = Py(); p[2] = Pz();} +// template void GetPxPyPz(T *p) const { +// p[0] = Px(); p[1] = Py(); p[2] = Pz();} + Bool_t GetPxPyPz(Double_t *p) const; template Bool_t GetPosition(T *x) const { x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2]; diff --git a/STEER/AliAODv0.h b/STEER/AliAODv0.h index b960e0415c9..d3c11a94637 100644 --- a/STEER/AliAODv0.h +++ b/STEER/AliAODv0.h @@ -85,6 +85,10 @@ public: Int_t GetLabel() const {return -1;} // Dummy Int_t PdgCode() const {return 0;} // Dummy + virtual Bool_t GetPxPyPz(Double_t */*p*/) const { return kFALSE; } + virtual void SetID(Short_t /*id*/) {;} + + protected: Double32_t fDcaV0ToPrimVertex; // dca of V0 to primary vertex Bool_t fOnFlyStatus; // if kTRUE, then this V0 is recontructed diff --git a/STEER/AliESDCaloCells.cxx b/STEER/AliESDCaloCells.cxx index da5c2d98140..5e36b59b2ac 100644 --- a/STEER/AliESDCaloCells.cxx +++ b/STEER/AliESDCaloCells.cxx @@ -27,27 +27,32 @@ ClassImp(AliESDCaloCells) //_______________________________________________________________________ AliESDCaloCells::AliESDCaloCells() : - TNamed(), fNCells(0), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(kTRUE), fType(kUndef) + AliVCaloCells(), fNCells(0), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(kTRUE), fType(kUndef) { // default constructor } //_______________________________________________________________________ - AliESDCaloCells::AliESDCaloCells(const char* name, const char* title, ESDCells_t ttype) : - TNamed(name, title), fNCells(0), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(kTRUE), fType(ttype) - { - // TNamed 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 constructor } //_______________________________________________________________________ AliESDCaloCells::AliESDCaloCells(const AliESDCaloCells& c) : - TNamed(c), fNCells(c.fNCells), fCellNumber(), fAmplitude(), fTime(), fIsSorted(c.fIsSorted), fType(c.fType) + AliVCaloCells(c), fNCells(c.fNCells), fCellNumber(0), fAmplitude(0), fTime(0), fIsSorted(c.fIsSorted), fType(c.fType) { // copy constructor + fCellNumber = new Short_t[fNCells]; + fAmplitude = 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]; + fCellNumber[i] = c.fCellNumber[i]; + fAmplitude[i] = c.fAmplitude[i]; + fTime[i] = c.fTime[i]; + fAmplitude[i] = c.fAmplitude[i]; + } } @@ -57,7 +62,6 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source) // assignment operator if(&source == this) return *this; - TNamed::operator=(source); if(fNCells != source.fNCells){ DeleteContainer(); @@ -71,9 +75,9 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source) for(Int_t i = 0; i < fNCells; i++){ - fCellNumber[i] = source.fCellNumber[i]; - fAmplitude[i] = source.fAmplitude[i]; - fTime[i] = source.fTime[i]; + fCellNumber[i] = source.fCellNumber[i]; + fAmplitude[i] = source.fAmplitude[i]; + fTime[i] = source.fTime[i]; } return *this; @@ -117,8 +121,13 @@ void AliESDCaloCells::CreateContainer(Short_t nCells) fNCells = nCells; 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]; + + // set to zero + for(int i = 0;i=0 && pos < fNCells) { fCellNumber[pos] = cellNumber; - fAmplitude[pos] = amplitude; - fTime[pos] = time; + fAmplitude[pos] = amplitude; + fTime[pos] = time; + fIsSorted = kFALSE; return kTRUE; } else { diff --git a/STEER/AliESDCaloCells.h b/STEER/AliESDCaloCells.h index 69057c3f271..28463c0626b 100644 --- a/STEER/AliESDCaloCells.h +++ b/STEER/AliESDCaloCells.h @@ -13,28 +13,24 @@ //------------------------------------------------------------------------- -#include +#include #include -class AliESDCaloCells : public TNamed +class AliESDCaloCells : public AliVCaloCells { public: - enum ESDCells_t {kUndef = -1, - kPHOSCell, - kEMCALCell}; - AliESDCaloCells(); - AliESDCaloCells(const char* name, const char* title, ESDCells_t ttype=kUndef); + AliESDCaloCells(const char* name, const char* title, VCells_t ttype=kUndef); AliESDCaloCells(const AliESDCaloCells & cells); AliESDCaloCells & operator=(const AliESDCaloCells& source); virtual ~AliESDCaloCells(); virtual void Copy(TObject &obj) const; - Bool_t IsEMCAL() const {return (fType == kEMCALCell);} - Bool_t IsPHOS() const {return (fType == kPHOSCell);} - Char_t GetType() const { return fType;} - void SetType(ESDCells_t ttype) { fType=ttype; } + 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(); @@ -52,15 +48,16 @@ class AliESDCaloCells : public TNamed inline Short_t GetCellNumber(Short_t pos) const; + 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 *fTime; //[fNCells][0.,0.,16] array with cell times Bool_t fIsSorted; //! true if cell arrays are sorted by index Char_t fType; // Cell type - ClassDef(AliESDCaloCells, 1); + ClassDef(AliESDCaloCells, 2); }; @@ -140,5 +137,4 @@ Short_t AliESDCaloCells::GetCellNumber(Short_t pos) const } } - #endif diff --git a/STEER/AliESDCaloCluster.cxx b/STEER/AliESDCaloCluster.cxx index d305651cbd5..7dd2a0934ed 100644 --- a/STEER/AliESDCaloCluster.cxx +++ b/STEER/AliESDCaloCluster.cxx @@ -31,7 +31,7 @@ ClassImp(AliESDCaloCluster) //_______________________________________________________________________ AliESDCaloCluster::AliESDCaloCluster() : - TObject(), + AliVCluster(), fTracksMatched(0x0), fLabels(0x0), fNCells(0), @@ -58,7 +58,7 @@ AliESDCaloCluster::AliESDCaloCluster() : //_______________________________________________________________________ AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) : - TObject(clus), + AliVCluster(clus), fTracksMatched(clus.fTracksMatched?new TArrayI(*clus.fTracksMatched):0x0), fLabels(clus.fLabels?new TArrayI(*clus.fLabels):0x0), fNCells(clus.fNCells), @@ -111,7 +111,7 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source) // assignment operator if(&source == this) return *this; - TObject::operator=(source); + AliVCluster::operator=(source); fGlobalPos[0] = source.fGlobalPos[0]; fGlobalPos[1] = source.fGlobalPos[1]; fGlobalPos[2] = source.fGlobalPos[2]; @@ -211,7 +211,7 @@ AliESDCaloCluster::~AliESDCaloCluster(){ } //_______________________________________________________________________ -void AliESDCaloCluster::SetPid(const Float_t *p) { +void AliESDCaloCluster::SetPID(const Float_t *p) { // Sets the probability of each particle type // Copied from AliESDtrack SetPIDValues // This function copies "n" PID weights from "scr" to "dest" @@ -249,34 +249,53 @@ void AliESDCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) { //Vertex can be recovered with esd pointer doing: //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; " - Double32_t pos[3]={ fGlobalPos[0], fGlobalPos[1], fGlobalPos[2]}; - if(vertex){//calculate direction from vertex - pos[0]-=vertex[0]; - pos[1]-=vertex[1]; - pos[2]-=vertex[2]; - } - - Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2] ) ; - - p.SetPxPyPzE( fEnergy*pos[0]/r, fEnergy*pos[1]/r, fEnergy*pos[2]/r, fEnergy) ; + Double32_t pos[3]={ fGlobalPos[0], fGlobalPos[1], fGlobalPos[2]}; + if(vertex){//calculate direction from vertex + pos[0]-=vertex[0]; + pos[1]-=vertex[1]; + pos[2]-=vertex[2]; + } + + Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2] ) ; + + p.SetPxPyPzE( fEnergy*pos[0]/r, fEnergy*pos[1]/r, fEnergy*pos[2]/r, fEnergy) ; } //_______________________________________________________________________ void AliESDCaloCluster::SetCellsAbsId(UShort_t *array) { // Set the array of cell absId numbers - if (fNCells) { - fCellsAbsId = new UShort_t[fNCells]; - for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i]; - } + if (fNCells) { + fCellsAbsId = new UShort_t[fNCells]; + for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i]; + } } //_______________________________________________________________________ void AliESDCaloCluster::SetCellsAmplitudeFraction(Double32_t *array) { - // Set the array of cell amplitude fraction - if (fNCells) { - fCellsAmpFraction = new Double32_t[fNCells]; - for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i]; - } + // Set the array of cell amplitude fraction + if (fNCells) { + fCellsAmpFraction = new Double32_t[fNCells]; + for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i]; + } } + +//______________________________________________________________________________ +void AliESDCaloCluster::SetPosition(Float_t *x) +{ + // set the position + + if (x) { + fGlobalPos[0] = x[0]; + fGlobalPos[1] = x[1]; + fGlobalPos[2] = x[2]; + } else { + + fGlobalPos[0] = -999.; + fGlobalPos[1] = -999.; + fGlobalPos[2] = -999.; + } +} + + diff --git a/STEER/AliESDCaloCluster.h b/STEER/AliESDCaloCluster.h index 575c1de38ab..59924beda02 100644 --- a/STEER/AliESDCaloCluster.h +++ b/STEER/AliESDCaloCluster.h @@ -15,80 +15,76 @@ // J.L. Klay (LLNL) //------------------------------------------------------------------------- -#include +#include #include "AliPID.h" #include "TArrayS.h" #include "TArrayI.h" +#include "AliLog.h" class TLorentzVector; -class AliESDCaloCluster : public TObject +class AliESDCaloCluster : public AliVCluster { - -public: - + + public: + AliESDCaloCluster(); AliESDCaloCluster(const AliESDCaloCluster& clus); AliESDCaloCluster & operator=(const AliESDCaloCluster& source); virtual ~AliESDCaloCluster(); virtual void Copy(TObject &) const; - - void SetID(Int_t id) {fID = id;} + + void SetID(Int_t id) {fID = id;} Int_t GetID() const {return fID;} - - //similar to AliAODCluster but offset by one for - // backward comp. -1 was undefined, which only applied - // for PHOS clusters before - enum ESDClu_t {kUndef = -2, - kPHOSCluster, - kEMCALPseudoCluster, //Not any more in use, keep for backward comp. - kEMCALClusterv1}; - - void SetClusterType(Int_t type) { fClusterType = type; } - Char_t GetClusterType() const {return fClusterType; } - - Bool_t IsEMCAL() const {return (fClusterType == kEMCALClusterv1);} - Bool_t IsPHOS() const {return (fClusterType == kPHOSCluster);} - - void SetPosition(const Float_t *pos) { - fGlobalPos[0] = pos[0]; fGlobalPos[1] = pos[1]; fGlobalPos[2] = pos[2]; - } - void GetPosition(Float_t *pos) const { - pos[0] = fGlobalPos[0]; pos[1] = fGlobalPos[1]; pos[2] = fGlobalPos[2]; - } - - void SetE(Float_t ene) { fEnergy = ene;} - Double_t E() const { return fEnergy;} - - void SetClusterDisp(Float_t disp) { fDispersion = disp; } - Double_t GetClusterDisp() const { return fDispersion; } - - void SetClusterChi2(Float_t chi2) { fChi2 = chi2; } - Double_t GetClusterChi2() const { return fChi2; } - - void SetPid(const Float_t *p); - Double_t *GetPid() {return fPID;} - - void SetM20(Float_t m20) { fM20 = m20; } - Double_t GetM20() const { return fM20; } - - void SetM02(Float_t m02) { fM02 = m02; } - Double_t GetM02() const { return fM02; } - - void SetNExMax(UChar_t nExMax) { fNExMax = nExMax; } - UChar_t GetNExMax() const { return fNExMax; } - - void SetEmcCpvDistance(Float_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; } + + void SetType(Char_t type) { fClusterType = type; } + Char_t GetType() const {return fClusterType; } + + Bool_t IsEMCAL() const {if(fClusterType == kEMCALClusterv1) return kTRUE; else return kFALSE;} + Bool_t IsPHOS() const {if(fClusterType == kPHOSNeutral || fClusterType == kPHOSCharged) return kTRUE; + else return kFALSE;} + + void GetPosition (Float_t *x) const { + x[0]=fGlobalPos[0]; x[1]=fGlobalPos[1]; x[2]=fGlobalPos[2];} + void SetPosition (Float_t *x); + void SetPositionAt(Float_t pos, Int_t ipos) {if(ipos>=0 && ipos<3) fGlobalPos[ipos] = pos ; + else AliInfo(Form("Bad index for position array, i = %d\n",ipos));} + + void SetE(Double_t ene) { fEnergy = ene;} + Double_t E() const { return fEnergy;} + + void SetDispersion(Double_t disp) { fDispersion = disp; } + Double_t GetDispersion() const { return fDispersion; } + + void SetChi2(Double_t chi2) { fChi2 = chi2; } + Double_t Chi2() const { return fChi2; } + + const Double_t *GetPID() const { return fPID; } + //for(Int_t i=0; i=0 && iGetArray();} + + Int_t GetTrackMatchedIndex() const {if( fTracksMatched && fTracksMatched->GetSize() >0) return fTracksMatched->At(0); else return -1;} //Most likely the track associated to the cluster - Int_t GetLabel() const - {if( fLabels && fLabels->GetSize() >0) return fLabels->At(0); + + Int_t GetLabel() const { + if( fLabels && fLabels->GetSize() >0) return fLabels->At(0); else return -1;} //Most likely the track associated to the cluster + Int_t GetLabelAt(UInt_t i) const { + if (fLabels && i < (UInt_t)fLabels->GetSize()) return fLabels->At(i); + else return -999; } - Int_t GetNTracksMatched() const {if (fTracksMatched) return fTracksMatched->GetSize(); + Int_t GetNTracksMatched() const { if (fTracksMatched) return fTracksMatched->GetSize(); else return -1;} - Int_t GetNLabels() const { if (fLabels) return fLabels->GetSize(); + UInt_t GetNLabels() const { if (fLabels) return fLabels->GetSize(); else return -1;} - + void GetMomentum(TLorentzVector& p, Double_t * vertexPosition ); - - // --- NEW --- - void SetNCells(Int_t n) { fNCells = n;} + + void SetNCells(Int_t n) { fNCells = n;} Int_t GetNCells() const { return fNCells;} - void SetCellsAbsId(UShort_t *array) ; + void SetCellsAbsId(UShort_t *array) ; UShort_t *GetCellsAbsId() {return fCellsAbsId;} - void SetCellsAmplitudeFraction(Double32_t *array) ; + void SetCellsAmplitudeFraction(Double32_t *array) ; Double32_t *GetCellsAmplitudeFraction() {return fCellsAmpFraction;} Int_t GetCellAbsId(Int_t i) const { @@ -133,38 +133,39 @@ public: Double_t GetCellAmplitudeFraction(Int_t i) const { if (fCellsAmpFraction && i >=0 && i < fNCells ) return fCellsAmpFraction[i]; else return -1;} - -protected: - + + protected: + TArrayI * fTracksMatched; //Index of tracks close to cluster. First entry is the most likely match. - TArrayI * fLabels; //list of primaries that generated the cluster, ordered in deposited energy. - - //NEW - Int_t fNCells ; - UShort_t *fCellsAbsId; //[fNCells] array of cell absId numbers - Double32_t *fCellsAmpFraction; //[fNCells][0.,1.,16] array with cell amplitudes fraction. - - + TArrayI * fLabels; //list of primaries that generated the cluster, ordered in deposited energy. + + Int_t fNCells ; + UShort_t * fCellsAbsId; //[fNCells] array of cell absId numbers + Double32_t * fCellsAmpFraction; //[fNCells][0.,1.,16] array with cell amplitudes fraction. + Double32_t fGlobalPos[3]; // position in global coordinate systemD Double32_t fEnergy; // energy measured by calorimeter Double32_t fDispersion; // cluster dispersion, for shape analysis Double32_t fChi2; // chi2 of cluster fi Double32_t fM20; // 2-nd moment along the main eigen axis Double32_t fM02; // 2-nd moment along the second eigen axis - + Double32_t fEmcCpvDistance; // the distance from PHOS EMC rec.point to the closest CPV rec.point Double32_t fTrackDx ; // Distance to closest track in phi Double32_t fTrackDz ; // Distance to closest track in z - + Double32_t fDistToBadChannel; // Distance to nearest bad channel Double32_t fPID[AliPID::kSPECIESN]; //[0,1,8]"detector response probabilities" (for the PID) - Int_t fID; // Unique Id of the cluster - UChar_t fNExMax ; // number of (Ex-)maxima before unfolding - Char_t fClusterType; // Flag for different cluster type/versions - Double32_t fTOF; //[0,0,12] time-of-flight + Int_t fID; // Unique Id of the cluster + UChar_t fNExMax ; // number of (Ex-)maxima before unfolding + Char_t fClusterType; // Flag for different cluster type/versions + Double_t fTOF; //[0,0,12] time-of-flight + + + ClassDef(AliESDCaloCluster,11) //ESDCaloCluster - ClassDef(AliESDCaloCluster,10) //ESDCaloCluster -}; + }; #endif + diff --git a/STEER/AliESDEvent.h b/STEER/AliESDEvent.h index abda314e1bb..5cb7d84e061 100644 --- a/STEER/AliESDEvent.h +++ b/STEER/AliESDEvent.h @@ -35,6 +35,10 @@ #include "AliESDtrack.h" // same for AliESDVertex (which is a AliVVertex) #include "AliESDVertex.h" +// same for CaloCells and CaloClusters (which is a AliVCaloCells, AliVCluster) +#include "AliESDCaloCluster.h" +#include "AliESDCaloCells.h" + class AliESDfriend; class AliESDVZERO; @@ -43,8 +47,6 @@ class AliESDVertex; class AliESDPmdTrack; class AliESDFMD; class AliESDkink; -class AliESDCaloCluster; -class AliESDCaloCells; class AliESDv0; class AliMultiplicity; class AliRawDataErrorLog; @@ -399,6 +401,13 @@ public: void SetStdNames(); void CopyFromOldESD(); TList* GetList() const {return fESDObjects;} + + //Following needed only for mixed event + virtual Int_t EventIndex(Int_t) const {return 0;} + virtual Int_t EventIndexForCaloCluster(Int_t) const {return 0;} + virtual Int_t EventIndexForPHOSCell(Int_t) const {return 0;} + virtual Int_t EventIndexForEMCALCell(Int_t) const {return 0;} + protected: AliESDEvent(const AliESDEvent&); diff --git a/STEER/AliESDtrack.h b/STEER/AliESDtrack.h index 1741bf26f00..e1aa085b2d2 100644 --- a/STEER/AliESDtrack.h +++ b/STEER/AliESDtrack.h @@ -77,7 +77,7 @@ public: void AddCalibObject(TObject * object); // add calib object to the list TObject * GetCalibObject(Int_t index); // return calib objct at given position void MakeMiniESDtrack(); - void SetID(Int_t id) { fID =id;} + void SetID(Short_t id) { fID =id;} Int_t GetID() const { return fID;} void SetVertexID(Char_t id) { fVertexID=id;} Char_t GetVertexID() const { return fVertexID;} diff --git a/STEER/AliESDv0.h b/STEER/AliESDv0.h index 50807c8e613..09114d77131 100644 --- a/STEER/AliESDv0.h +++ b/STEER/AliESDv0.h @@ -135,6 +135,10 @@ public: const Double_t *GetNormDCAPrimP() const {return fNormDCAPrim;} // Dummy Int_t PdgCode() const {return 0;} + + //virtual Bool_t GetPxPyPz(Double_t */*p*/) const { return kFALSE; } + virtual void SetID(Short_t /*id*/) {;} + protected: AliExternalTrackParam fParamN; // external parameters of negative particle diff --git a/STEER/AliMCEvent.h b/STEER/AliMCEvent.h index ad5c85f0259..4d29ba576d8 100644 --- a/STEER/AliMCEvent.h +++ b/STEER/AliMCEvent.h @@ -127,7 +127,12 @@ public: virtual void SetParticleArray(TClonesArray* mcParticles) {fMCParticles = mcParticles; fNparticles = fMCParticles->GetEntries(); fExternal = kTRUE;} - + //Following needed only for mixed event + virtual Int_t EventIndex(Int_t) const {return 0;} + virtual Int_t EventIndexForCaloCluster(Int_t) const {return 0;} + virtual Int_t EventIndexForPHOSCell(Int_t) const {return 0;} + virtual Int_t EventIndexForEMCALCell(Int_t) const {return 0;} + private: virtual void ReorderAndExpandTreeTR(); virtual Int_t FindIndexAndEvent(Int_t oldidx, AliMCEvent*& event) const; diff --git a/STEER/AliMixedEvent.cxx b/STEER/AliMixedEvent.cxx index 65aa4b970f2..7b651f1e5db 100644 --- a/STEER/AliMixedEvent.cxx +++ b/STEER/AliMixedEvent.cxx @@ -31,28 +31,51 @@ #include #include #include +#include "AliESDCaloCluster.h" +#include "AliAODCaloCluster.h" +#include "AliAODCaloCells.h" +#include "AliESDCaloCells.h" +#include "AliLog.h" +#include "AliVCaloCells.h" + ClassImp(AliMixedEvent) AliMixedEvent::AliMixedEvent() : - AliVEvent(), - fEventList(), - fNEvents(0), - fNumberOfTracks(0), - fNTracksCumul(0), - fMeanVertex(0) + AliVEvent(), + fEventList(), + fNEvents(0), + fNumberOfTracks(0), + fNumberOfCaloClusters(0), + fNumberOfPHOSCells(0), + fNumberOfEMCALCells(0), + fNTracksCumul(0), + fNCaloClustersCumul(0), + fNPHOSCellsCumul(0), + fNEMCALCellsCumul(0), + fPHOSCells(NULL), + fEMCALCells(NULL), + fMeanVertex(0) { // Default constructor } AliMixedEvent::AliMixedEvent(const AliMixedEvent& Evnt) : - AliVEvent(Evnt), - fEventList(), - fNEvents(0), - fNumberOfTracks(0), - fNTracksCumul(0), - fMeanVertex(0) + AliVEvent(Evnt), + fEventList(), + fNEvents(0), + fNumberOfTracks(0), + fNumberOfCaloClusters(0), + fNumberOfPHOSCells(0), + fNumberOfEMCALCells(0), + fNTracksCumul(0), + fNCaloClustersCumul(0), + fNPHOSCellsCumul(0), + fNEMCALCellsCumul(0), + fPHOSCells(NULL), + fEMCALCells(NULL), + fMeanVertex(0) { } // Copy constructor AliMixedEvent& AliMixedEvent::operator=(const AliMixedEvent& vEvnt) @@ -63,6 +86,14 @@ AliMixedEvent& AliMixedEvent::operator=(const AliMixedEvent& vEvnt) return *this; } +AliMixedEvent::~AliMixedEvent() +{ + // dtor + Reset(); + delete fPHOSCells ; + delete fEMCALCells ; +} + void AliMixedEvent::AddEvent(AliVEvent* evt) { @@ -74,19 +105,79 @@ void AliMixedEvent::AddEvent(AliVEvent* evt) void AliMixedEvent::Init() { // Initialize meta information - fNEvents = fEventList.GetEntries(); - fNTracksCumul = new Int_t[fNEvents]; - fNumberOfTracks = 0; - TIter next(&fEventList); - AliVEvent* event; - Int_t iev = 0; + fNEvents = fEventList.GetEntries(); + fNTracksCumul = new Int_t[fNEvents]; + fNumberOfTracks = 0; + fNCaloClustersCumul = new Int_t[fNEvents]; + fNumberOfCaloClusters = 0; + fNumberOfPHOSCells = 0; + fNumberOfEMCALCells = 0; + fNPHOSCellsCumul = new Int_t[fNEvents]; + fNEMCALCellsCumul = new Int_t[fNEvents]; + + TIter next(&fEventList); + AliVEvent* event; + Int_t iev = 0; - while((event = (AliVEvent*)next())) { - fNTracksCumul[iev++] = fNumberOfTracks; - fNumberOfTracks += (event->GetNumberOfTracks()); + while((event = (AliVEvent*)next())) { + fNTracksCumul[iev] = fNumberOfTracks; + fNumberOfTracks += (event->GetNumberOfTracks()); + fNCaloClustersCumul[iev] = fNumberOfCaloClusters; + fNumberOfCaloClusters += event->GetNumberOfCaloClusters(); + fNPHOSCellsCumul[iev] = fNumberOfPHOSCells; + if (event->GetPHOSCells()) + fNumberOfPHOSCells += event->GetPHOSCells()->GetNumberOfCells(); + fNEMCALCellsCumul[iev] = fNumberOfEMCALCells; + if (event->GetEMCALCells()) + fNumberOfEMCALCells += event->GetEMCALCells()->GetNumberOfCells(); + iev++ ; + } + if (!fPHOSCells) { + AliVEvent* evt = (AliVEvent*) (fEventList.At(0)); + if (dynamic_cast(evt->GetCaloCluster(0))) { //it's a ESD + fPHOSCells = new AliESDCaloCells() ; + } else if (dynamic_cast(evt->GetCaloCluster(0))) { //it's a ESD + fPHOSCells = new AliAODCaloCells() ; + } else { + AliFatal("Unrecognized CaloCluster type (not ESD nor AOD)") ; } -} + } + fPHOSCells->SetType(AliVCaloCells::kPHOSCell) ; + fPHOSCells->CreateContainer(fNumberOfPHOSCells) ; + + if (!fEMCALCells){ + AliVEvent* evt = (AliVEvent*) (fEventList.At(0)); + if (dynamic_cast(evt->GetCaloCluster(0))) { //it's a ESD + fEMCALCells = new AliESDCaloCells() ; + } else if (dynamic_cast(evt->GetCaloCluster(0))) { //it's a ESD + fEMCALCells = new AliAODCaloCells() ; + } else { + AliFatal("Unrecognized CaloCluster type (not ESD nor AOD)") ; + } + } + fEMCALCells->SetType(AliVCaloCells::kEMCALCell) ; + fEMCALCells->CreateContainer(fNumberOfEMCALCells) ; + + next.Reset() ; + Short_t phosPos = 0, emcalPos = 0; + while((event = (AliVEvent*)next())) { + if (event->GetPHOSCells()) { + Int_t ncells = event->GetPHOSCells()->GetNumberOfCells() ; + AliVCaloCells * phosCells = event->GetPHOSCells() ; + for (Int_t icell = 0; icell < ncells; icell++) { + fPHOSCells->SetCell(phosPos++, phosCells->GetCellNumber(icell), phosCells->GetAmplitude(icell), phosCells->GetTime(icell)) ; + } + } + if (event->GetEMCALCells()) { + Int_t ncells = event->GetEMCALCells()->GetNumberOfCells() ; + AliVCaloCells * emcalCells = event->GetEMCALCells() ; + for (Int_t icell = 0; icell < ncells; icell++) { + fEMCALCells->SetCell(emcalPos++, emcalCells->GetCellNumber(icell), emcalCells->GetAmplitude(icell), emcalCells->GetTime(icell)) ; + } + } + } +} AliVParticle* AliMixedEvent::GetTrack(Int_t i) const { @@ -99,33 +190,92 @@ AliVParticle* AliMixedEvent::GetTrack(Int_t i) const return (evt->GetTrack(irel)); } +AliVCluster* AliMixedEvent::GetCaloCluster(Int_t i) const +{ + // Return calo cluster # i + Int_t iEv = TMath::BinarySearch(fNEvents, fNCaloClustersCumul, i); + while((iEv < (fNEvents - 1)) && (fNCaloClustersCumul[iEv] == fNCaloClustersCumul[iEv+1])) {iEv++;} + + Int_t irel = i - fNCaloClustersCumul[iEv]; + AliVEvent* evt = (AliVEvent*) (fEventList.At(iEv)); + return (evt->GetCaloCluster(irel)); +} + const AliVVertex* AliMixedEvent::GetEventVertex(Int_t i) const { - // Return track # i + // Return vertex of track # i Int_t iEv = TMath::BinarySearch(fNEvents, fNTracksCumul, i); while((iEv < (fNEvents - 1)) && (fNTracksCumul[iEv] == fNTracksCumul[iEv+1])) {iEv++;} AliVEvent* evt = (AliVEvent*) (fEventList.At(iEv)); return (evt->GetPrimaryVertex()); } +const AliVVertex* AliMixedEvent::GetVertexOfEvent(Int_t i) const +{ + // Return vertex of event # i + if (i > fNEvents) + AliFatal(Form("%d events in buffer, event %d requested", fNEvents, i)) ; + AliVEvent* evt = (AliVEvent*) (fEventList.At(i)); + return (evt->GetPrimaryVertex()); +} + void AliMixedEvent::Reset() { // Reset the event - fEventList.Clear(); - fNEvents = 0; - fNumberOfTracks = 0; - if (fNTracksCumul) { - delete[] fNTracksCumul; - fNTracksCumul = 0; - } + fEventList.Clear(); + fNEvents = 0; + fNumberOfTracks = 0; + fNumberOfCaloClusters = 0; + fNumberOfPHOSCells = 0; + fNumberOfEMCALCells = 0; + if (fNTracksCumul) { + delete[] fNTracksCumul; + fNTracksCumul = 0; + } + if (fNCaloClustersCumul) { + delete[] fNCaloClustersCumul; + fNCaloClustersCumul = 0; + } + if (fNPHOSCellsCumul) { + delete[] fNPHOSCellsCumul; + fNPHOSCellsCumul = 0; + } + if (fNEMCALCellsCumul) { + delete[] fNEMCALCellsCumul; + fNEMCALCellsCumul = 0; + } + if (fPHOSCells) { + fPHOSCells->DeleteContainer(); + } + if (fEMCALCells) { + fEMCALCells->DeleteContainer(); + } } -Int_t AliMixedEvent::EventIndex(Int_t itrack) +Int_t AliMixedEvent::EventIndex(Int_t itrack) const { // Return the event index for track #itrack return TMath::BinarySearch(fNEvents, fNTracksCumul, itrack); } +Int_t AliMixedEvent::EventIndexForCaloCluster(Int_t icluster) const +{ + // Return the event index for track #itrack + return TMath::BinarySearch(fNEvents, fNCaloClustersCumul, icluster); +} + +Int_t AliMixedEvent::EventIndexForPHOSCell(Int_t icell) const +{ + // Return the event index for track #itrack + return TMath::BinarySearch(fNEvents, fNPHOSCellsCumul, icell); +} + +Int_t AliMixedEvent::EventIndexForEMCALCell(Int_t icell) const +{ + // Return the event index for track #itrack + return TMath::BinarySearch(fNEvents, fNEMCALCellsCumul, icell); +} + Bool_t AliMixedEvent::ComputeVtx(TObjArray *vertices, Double_t *pos,Double_t *sig,Int_t *nContributors){ // // Calculate the mean vertex psoitions from events in the buffer diff --git a/STEER/AliMixedEvent.h b/STEER/AliMixedEvent.h index 2ae3d1ae6b7..b5a6fa41e6d 100644 --- a/STEER/AliMixedEvent.h +++ b/STEER/AliMixedEvent.h @@ -24,7 +24,7 @@ class AliMixedEvent : public AliVEvent { public: AliMixedEvent(); - virtual ~AliMixedEvent() {Reset();} + virtual ~AliMixedEvent() ; AliMixedEvent(const AliMixedEvent& vEvnt); AliMixedEvent& operator=(const AliMixedEvent& vEvnt); @@ -44,7 +44,9 @@ public: virtual void Reset(); virtual void Init(); const AliVVertex* GetEventVertex(Int_t i) const; - + const AliVVertex* GetVertexOfEvent(Int_t i) const; + Int_t GetNumberOfEvents() {return fNEvents;} + // Header virtual AliVHeader* GetHeader() const {return 0;} @@ -63,7 +65,7 @@ public: virtual Double_t GetDiamondY() const {return -999.;} virtual void GetDiamondCovXY(Float_t cov[3]) const {cov[0]=-999.; return;} - + // Delegated methods for fHeader virtual void SetOrbitNumber(UInt_t /*n*/) {;} virtual void SetBunchCrossNumber(UShort_t /*n*/) {;} @@ -88,18 +90,41 @@ public: virtual Int_t GetNumberOfTracks() const {return fNumberOfTracks;} virtual Int_t GetNumberOfV0s() const {return -999;} virtual Int_t GetNumberOfCascades() const {return -999;} - - virtual Int_t EventIndex(Int_t itrack); + + // Calo Clusters and cells + virtual AliVCluster *GetCaloCluster(Int_t i) const; + virtual Int_t GetNumberOfCaloClusters() const {return fNumberOfCaloClusters;} + virtual AliVCaloCells *GetPHOSCells() const {return fPHOSCells;} + virtual AliVCaloCells *GetEMCALCells() const {return fEMCALCells;} + virtual Int_t GetNumberOfPHOSCells() const {return fNumberOfPHOSCells;} + virtual Int_t GetNumberOfEMCALCells() const {return fNumberOfEMCALCells;} + virtual Int_t* GetPHOSCellsCumul() const {return fNPHOSCellsCumul;} + virtual Int_t* GetEMCALCellsCumul() const {return fNEMCALCellsCumul;} + virtual Int_t GetNCaloClustersCumul(Int_t iev) const {return fNCaloClustersCumul[iev];} + + + virtual Int_t EventIndex(Int_t itrack) const; + virtual Int_t EventIndexForCaloCluster(Int_t iclu) const; + virtual Int_t EventIndexForPHOSCell(Int_t icell) const; + virtual Int_t EventIndexForEMCALCell(Int_t icell) const; // Primary vertex virtual const AliVVertex *GetPrimaryVertex() const {return fMeanVertex;} virtual Bool_t ComputeVtx(TObjArray *vertices, Double_t *pos,Double_t *sig,Int_t *nContributors); private: - TList fEventList; //! List of Events - Int_t fNEvents; //! Number of Events - Int_t fNumberOfTracks; //! Total number of tracks - Int_t* fNTracksCumul; //! Cumulant - AliVVertex* fMeanVertex; //! Mean vertex + TList fEventList; //! List of Events + Int_t fNEvents; //! Number of Events + Int_t fNumberOfTracks; //! Total number of tracks + Int_t fNumberOfCaloClusters; //! Total number of calo clusters + Int_t fNumberOfPHOSCells; //! Total number of PHOS Cells + Int_t fNumberOfEMCALCells; //! Total number of EMCAL Cells + Int_t* fNTracksCumul; //! Cumulant + Int_t* fNCaloClustersCumul; //! Cumulant + Int_t* fNPHOSCellsCumul; //! Cumulant + Int_t* fNEMCALCellsCumul; //! Cumulant + AliVCaloCells* fPHOSCells; //! array ofPHOS cells + AliVCaloCells* fEMCALCells; //! array ofPHOS cells + AliVVertex* fMeanVertex; //! Mean vertex ClassDef(AliMixedEvent, 0) // Container for mixed events }; diff --git a/STEER/AliVCaloCells.cxx b/STEER/AliVCaloCells.cxx new file mode 100644 index 00000000000..2170a1fd894 --- /dev/null +++ b/STEER/AliVCaloCells.cxx @@ -0,0 +1,28 @@ +/************************************************************************** + * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// +// Virtual class to access calorimeter cell data +// Author: Gustavo Conesa Balbastre INFN-LNF +// +//------------------------------------------------------------------------- + +#include "AliVCaloCells.h" + +ClassImp(AliVCaloCells) + diff --git a/STEER/AliVCaloCells.h b/STEER/AliVCaloCells.h new file mode 100644 index 00000000000..d29de03ebb4 --- /dev/null +++ b/STEER/AliVCaloCells.h @@ -0,0 +1,53 @@ +#ifndef ALIVCALOCELLS_H +#define ALIVCALOCELLS_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------------------------- +// +// Virtual class to access calorimeter cell data +// Author: Gustavo Conesa Balbastre INFN-LNF +// +//------------------------------------------------------------------------- + + +#include +#include + +class AliVCaloCells : public TNamed +{ + public: + + enum VCells_t {kUndef = -1, + kPHOSCell, + kEMCALCell}; + + AliVCaloCells() : TNamed() {;} + AliVCaloCells(const char* name, const char* title) : TNamed(name, title) {;} + AliVCaloCells(const AliVCaloCells& cells) : TNamed(cells.GetName(), cells.GetTitle()) {;} + virtual ~AliVCaloCells(){;} + + 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 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 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; + + ClassDef(AliVCaloCells, 0); +}; + +#endif diff --git a/STEER/AliVCluster.cxx b/STEER/AliVCluster.cxx new file mode 100644 index 00000000000..4e846b66bcc --- /dev/null +++ b/STEER/AliVCluster.cxx @@ -0,0 +1,43 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//----------------------------------------------------------------- +// +// Virtual class to access calorimeter +// (EMCAL, PHOS, PMD, FMD) cluster data +// Author: Gustavo Conesa Balbastre LPSC-Grenoble +// +//----------------------------------------------------------------- + +#include "AliVCluster.h" + +ClassImp(AliVCluster) + + AliVCluster::AliVCluster(const AliVCluster& vclus) : + TObject(vclus) { ; } // Copy constructor + +AliVCluster& AliVCluster::operator=(const AliVCluster& vclus) +{ + //Assignment operator + if (this!=&vclus) { + TObject::operator=(vclus); + } + + return *this; +} + + diff --git a/STEER/AliVCluster.h b/STEER/AliVCluster.h new file mode 100644 index 00000000000..f282dbc1b81 --- /dev/null +++ b/STEER/AliVCluster.h @@ -0,0 +1,125 @@ +#ifndef ALIVCLUSTER_H +#define ALIVCLUSTER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id$ */ + +//------------------------------------------------------------------------- +// +// Virtual class to access calorimeter +// (EMCAL, PHOS, PMD, FMD) cluster data +// Author: Gustavo Conesa Balbastre LPSC-Grenoble +// +//------------------------------------------------------------------------- + +#include +#include + +class AliVCluster : public TObject +{ + + public: + + AliVCluster() { ; } + virtual ~AliVCluster() { ; } + AliVCluster(const AliVCluster& clus); + AliVCluster & operator=(const AliVCluster& source); + + enum VClu_t {kUndef = -2, + kPHOSNeutral, + kPHOSCharged, + kEMCALClusterv1, + kPMDNeutral, + kPMDCharged}; + + enum VCluPID_t { + kElectron = 0, + kMuon = 1, + kPion = 2, + kKaon = 3, + kProton = 4, + kPhoton = 5, + kPi0 = 6, + kNeutron = 7, + kKaon0 = 8, + kEleCon = 9, + kUnknown = 10, + kCharged = 11,//For PMD? + kNeutral = 12 //For PMD? + }; + + //Common EMCAL/PHOS/FMD/PMD + + virtual void SetID(Int_t ) { ; } + virtual Int_t GetID() const {return 0 ; } + + virtual void SetType(Char_t ) { ; } + virtual Char_t GetType() const {return kUndef ; } + + virtual void SetE(Double_t ) { ; } + virtual Double_t E() const {return 0. ; } + + virtual void SetChi2(Double_t ) { ; } + virtual Double_t Chi2() const {return 0. ; } + + virtual void SetPositionAt(Float_t,Int_t) { ; } + virtual void SetPosition(Float_t *) { ; } + virtual void GetPosition(Float_t *) const { ; } + + virtual void SetPIDAt(Float_t , Int_t) { ; } + virtual void SetPID(const Float_t *) { ; } + virtual const Double_t *GetPID() const { return 0 ; } + + //CaloClusters, PHOS/EMCAL + + virtual Bool_t IsEMCAL() const {return -1 ; } + virtual Bool_t IsPHOS() const {return -1 ; } + + virtual void SetDispersion(Double_t ) { ; } + virtual Double_t GetDispersion() const {return 0. ;} + + virtual void SetM20(Double_t) { ; } + virtual Double_t GetM20() const {return 0. ; } + + virtual void SetM02(Double_t) { ; } + virtual Double_t GetM02() const {return 0. ; } + + virtual void SetNExMax(UChar_t) { ; } + virtual UChar_t GetNExMax() const {return 0 ; } + + virtual void SetTOF(Double_t) { ; } + virtual Double_t GetTOF() const {return 0. ; } + + virtual void SetEmcCpvDistance(Double_t) { ; } + virtual Double_t GetEmcCpvDistance() const {return 0. ; } + virtual void SetTrackDistance(Double_t, Double_t ){ ; } + virtual Double_t GetTrackDx(void)const {return 0. ; } + virtual Double_t GetTrackDz(void)const {return 0. ; } + + virtual void SetDistanceToBadChannel(Double_t) { ; } + virtual Double_t GetDistanceToBadChannel() const {return 0. ; } + + virtual void SetNCells(Int_t) { ; } + virtual Int_t GetNCells() const {return 0 ; } + + virtual UShort_t *GetCellsAbsId() {return 0 ; } + virtual Double_t *GetCellsAmplitudeFraction() {return 0 ; } + virtual Int_t GetCellAbsId(Int_t) const {return 0 ; } + virtual Double_t GetCellAmplitudeFraction(Int_t) const {return 0. ; } + + virtual Int_t GetLabel() const {return -1 ;} + virtual Int_t GetLabelAt(UInt_t) const {return -1 ;} + virtual Int_t *GetLabels() const {return 0 ; } + virtual UInt_t GetNLabels() const {return 0 ; } + + virtual Int_t GetNTracksMatched() const {return 0 ; } + virtual TObject *GetTrackMatched(Int_t) const {return 0 ; }//AODCaloCluster + virtual Int_t GetTrackMatchedIndex() const {return -1; }//ESDCaloCluster + + virtual void GetMomentum(TLorentzVector &/*tl*/, Double_t * /*v*/) { ; } + + ClassDef(AliVCluster,0) //VCluster + }; + +#endif //ALIVCLUSTER_H + diff --git a/STEER/AliVEvent.h b/STEER/AliVEvent.h index af580ef8a99..f06e47a9dd8 100644 --- a/STEER/AliVEvent.h +++ b/STEER/AliVEvent.h @@ -15,9 +15,13 @@ #include #include +#include #include "AliVHeader.h" #include "AliVParticle.h" #include "AliVVertex.h" +#include "AliVCluster.h" +#include "AliVCaloCells.h" +#include "TRefArray.h" class AliVEvent : public TObject { @@ -97,6 +101,17 @@ public: virtual Int_t GetNumberOfV0s() const = 0; virtual Int_t GetNumberOfCascades() const = 0; + // Calorimeter Clusters/Cells + virtual AliVCluster *GetCaloCluster(Int_t) const {return 0;} + virtual Int_t GetNumberOfCaloClusters() const {return 0;} + virtual Int_t GetEMCALClusters(TRefArray *) const {return 0;} + virtual Int_t GetPHOSClusters (TRefArray *) const {return 0;} + virtual AliVCaloCells *GetEMCALCells() const {return 0;} + virtual AliVCaloCells *GetPHOSCells() const {return 0;} + const TGeoHMatrix* GetPHOSMatrix(Int_t /*i*/) const {return NULL;} + const TGeoHMatrix* GetEMCALMatrix(Int_t /*i*/) const {return NULL;} + + // Primary vertex virtual const AliVVertex *GetPrimaryVertex() const {return 0x0;} virtual Bool_t IsPileupFromSPD(Int_t /*minContributors*/, @@ -107,6 +122,12 @@ public: const{ return kFALSE; } + + virtual Int_t EventIndex(Int_t itrack) const = 0; + virtual Int_t EventIndexForCaloCluster(Int_t iclu) const= 0; + virtual Int_t EventIndexForPHOSCell(Int_t icell) const= 0; + virtual Int_t EventIndexForEMCALCell(Int_t icell) const= 0; + //---------- end of new stuff diff --git a/STEER/AliVTrack.h b/STEER/AliVTrack.h index 1b928940ec6..0375cd5dc43 100644 --- a/STEER/AliVTrack.h +++ b/STEER/AliVTrack.h @@ -14,6 +14,7 @@ #include "AliVParticle.h" class AliVVertex; +class AliExternalTrackParam; class AliVTrack: public AliVParticle { @@ -26,12 +27,18 @@ public: virtual Int_t GetID() const = 0; virtual UChar_t GetITSClusterMap() const = 0; virtual UShort_t GetTPCNcls() const { return 0;} + virtual Double_t GetTPCsignal() const { return 0.; } virtual ULong_t GetStatus() const = 0; virtual Bool_t GetXYZ(Double_t *p) const = 0; virtual Double_t GetBz() const; virtual void GetBxByBz(Double_t b[3]) const; virtual Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const = 0; virtual Bool_t PropagateToDCA(const AliVVertex *vtx,Double_t b,Double_t maxd,Double_t dz[2],Double_t covar[3]) = 0; + virtual const AliExternalTrackParam * GetOuterParam() const { return NULL; } + virtual Int_t GetNcls(Int_t /*idet*/) const { return 0; } + virtual Bool_t GetPxPyPz(Double_t */*p*/) const { return kFALSE; } + virtual void SetID(Short_t /*id*/) {;} + ClassDef(AliVTrack,1) // base class for tracks }; diff --git a/STEER/STEERBaseLinkDef.h b/STEER/STEERBaseLinkDef.h index ac0122eef16..816e731d97e 100644 --- a/STEER/STEERBaseLinkDef.h +++ b/STEER/STEERBaseLinkDef.h @@ -12,6 +12,8 @@ #pragma link C++ class AliVParticle+; #pragma link C++ class AliVTrack+; +#pragma link C++ class AliVCluster+; +#pragma link C++ class AliVCaloCells+; #pragma link C++ class AliVVertex+; #pragma link C++ class AliVEvent+; #pragma link C++ class AliVHeader+; diff --git a/STEER/libSTEERBase.pkg b/STEER/libSTEERBase.pkg index 4686863d96c..7574b958bad 100644 --- a/STEER/libSTEERBase.pkg +++ b/STEER/libSTEERBase.pkg @@ -2,6 +2,7 @@ SRCS = AliVParticle.cxx \ AliVTrack.cxx \ + AliVCluster.cxx AliVCaloCells.cxx \ AliVVertex.cxx \ AliVEvent.cxx \ AliMixedEvent.cxx \ -- 2.39.3