Skip to content

Commit

Permalink
Add functionality to force recomputation of TOF tune-on-data
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrosa authored and chiarazampolli committed Mar 9, 2021
1 parent f5f9db2 commit af8aa8d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
7 changes: 6 additions & 1 deletion ANALYSIS/ANALYSISalice/AliAnalysisTaskPIDResponse.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fRecoPass(0),
fIsTunedOnData(kFALSE),
fTunedOnDataMask(0),
fRecoPassTuned(0),
fResetTuneOnDataTOF(kFALSE),
fUseTPCEtaCorrection(kTRUE),
fUseTPCMultiplicityCorrection(kTRUE),
fUseTPCPileupCorrection(kTRUE),
Expand Down Expand Up @@ -172,7 +173,10 @@ void AliAnalysisTaskPIDResponse::UserExec(Option_t */*option*/)

if (fRun!=fOldRun){
SetRecoInfo();
if(fIsTunedOnData) fPIDResponse->SetTunedOnData(kTRUE,fRecoPassTuned, fRecoPassNameTuned);
if(fIsTunedOnData) {
fPIDResponse->SetTunedOnData(kTRUE,fRecoPassTuned, fRecoPassNameTuned);
if(fResetTuneOnDataTOF) fPIDResponse->ResetTuneOnDataTOF();
}

fOldRun=fRun;

Expand All @@ -186,6 +190,7 @@ void AliAnalysisTaskPIDResponse::UserExec(Option_t */*option*/)
}

fPIDResponse->InitialiseEvent(event,fRecoPass, fRecoPassName);

fPIDResponse->SetCurrentMCEvent(MCEvent());
AliESDpid *pidresp = dynamic_cast<AliESDpid*>(fPIDResponse);
if(pidresp && AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()){
Expand Down
8 changes: 5 additions & 3 deletions ANALYSIS/ANALYSISalice/AliAnalysisTaskPIDResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class AliAnalysisTaskPIDResponse : public AliAnalysisTaskSE {
void SetTuneOnData(Bool_t flag, Int_t recopass, TString recoPassName){fIsTunedOnData=flag; fRecoPassTuned=recopass; fRecoPassNameTuned=recoPassName;}
Bool_t GetTunedOnData() const { return fIsTunedOnData; };
void SetTuneOnDataMask(Int_t mask){fTunedOnDataMask=mask;};

void ResetTuneOnDataTOF(Bool_t flag=kTRUE) {fResetTuneOnDataTOF = flag;}

void SetUseTPCEtaCorrection(Bool_t useTPCEtaCorrection) { fUseTPCEtaCorrection = useTPCEtaCorrection; };
Bool_t UseTPCEtaCorrection() const { return fUseTPCEtaCorrection; };

Expand Down Expand Up @@ -82,7 +83,8 @@ class AliAnalysisTaskPIDResponse : public AliAnalysisTaskSE {
Bool_t fIsTunedOnData; ///< flag to tune MC on data (dE/dx)
Int_t fTunedOnDataMask; ///< mask to activate tuning on data on specific detectors
Int_t fRecoPassTuned; ///< Reco pass tuned on data for MC

Bool_t fResetTuneOnDataTOF; ///< Flag to force recomputation of tune-on-data for TOF

Bool_t fUseTPCEtaCorrection; ///< Use TPC eta correction
Bool_t fUseTPCMultiplicityCorrection; ///< Use TPC multiplicity correction
Bool_t fUseTPCPileupCorrection; ///< Use TPC multiplicity correction
Expand All @@ -100,6 +102,6 @@ class AliAnalysisTaskPIDResponse : public AliAnalysisTaskSE {
AliAnalysisTaskPIDResponse(const AliAnalysisTaskPIDResponse &other);
AliAnalysisTaskPIDResponse& operator=(const AliAnalysisTaskPIDResponse &other);

ClassDef(AliAnalysisTaskPIDResponse,11) // Task to properly set the PID response functions of all detectors
ClassDef(AliAnalysisTaskPIDResponse,12) // Task to properly set the PID response functions of all detectors
};
#endif
28 changes: 20 additions & 8 deletions STEER/STEERBase/AliPIDResponse.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ fUseTRDClusterCorrection(kFALSE),
fUseTRDCentralityCorrection(kFALSE),
fTOFtail(0.9),
fTOFPIDParams(NULL),
fResetTuneOnDataTOF(kFALSE),
fHMPIDPIDParams(NULL),
fEMCALPIDParams(NULL),
fCurrentEvent(NULL),
Expand Down Expand Up @@ -186,6 +187,7 @@ fUseTRDClusterCorrection(other.fUseTRDClusterCorrection),
fUseTRDCentralityCorrection(other.fUseTRDCentralityCorrection),
fTOFtail(0.9),
fTOFPIDParams(NULL),
fResetTuneOnDataTOF(kFALSE),
fHMPIDPIDParams(NULL),
fEMCALPIDParams(NULL),
fCurrentEvent(NULL),
Expand Down Expand Up @@ -256,6 +258,7 @@ AliPIDResponse& AliPIDResponse::operator=(const AliPIDResponse &other)
fEMCALPIDParams=NULL;
fTOFtail=0.9;
fTOFPIDParams=NULL;
fResetTuneOnDataTOF=other.fResetTuneOnDataTOF;
fHMPIDPIDParams=NULL;
fCurrentEvent=other.fCurrentEvent;
fCurrentMCEvent=other.fCurrentMCEvent;
Expand Down Expand Up @@ -683,17 +686,26 @@ void AliPIDResponse::InitialiseEvent(AliVEvent *event, Int_t pass, TString recoP
// Set centrality percentile for TRD
fTRDResponse.SetCentrality(fCurrCentrality);

// switch off some TOF channel according to OADB to match data TOF matching eff
if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) && fTOFPIDParams->GetTOFmatchingLossMC() > 0.01){
if (fTuneMConData) {
Int_t ntrk = event->GetNumberOfTracks();
for(Int_t i=0;i < ntrk;i++){
AliVParticle *trk = event->GetTrack(i);
Int_t channel = GetTOFResponse().GetTOFchannel(trk);
Int_t swoffEachOfThem = Int_t(100./fTOFPIDParams->GetTOFmatchingLossMC() + 0.5);
if(!(channel%swoffEachOfThem)) ((AliVTrack *) trk)->ResetStatus(AliVTrack::kTOFout);
// force recomputation of TOF Nsigma with tune-on-data to have latest development of tail parametrisation in old AODs
if(fResetTuneOnDataTOF) {
for(Int_t iTrack = 0; iTrack < ntrk; iTrack++) {
AliVTrack* track=dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
if(!track || track->GetTOFsignalTunedOnData() > 99999) continue;
track->SetTOFsignalTunedOnData(100000);
}
}
// switch off some TOF channel according to OADB to match data TOF matching eff
if(((fTuneMConDataMask & kDetTOF) == kDetTOF) && fTOFPIDParams->GetTOFmatchingLossMC() > 0.01){
for(Int_t i=0;i < ntrk;i++){
AliVParticle *trk = event->GetTrack(i);
Int_t channel = GetTOFResponse().GetTOFchannel(trk);
Int_t swoffEachOfThem = Int_t(100./fTOFPIDParams->GetTOFmatchingLossMC() + 0.5);
if(!(channel%swoffEachOfThem)) ((AliVTrack *) trk)->ResetStatus(AliVTrack::kTOFout);
}
}
}

}

//______________________________________________________________________________
Expand Down
4 changes: 3 additions & 1 deletion STEER/STEERBase/AliPIDResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class AliPIDResponse : public TNamed {
// TOF setting
void SetTOFtail(Float_t tail=0.9){if(tail > 0) fTOFtail=tail; else printf("TOF tail should be greater than 0 (nothing done)\n");};
void SetTOFResponse(AliVEvent *vevent,EStartTimeType_t option);
void ResetTuneOnDataTOF(Bool_t flag=kTRUE) {fResetTuneOnDataTOF = flag;}

// TunedOnData functionality
virtual Float_t GetITSsignalTunedOnData(const AliVTrack *t) const;
Expand Down Expand Up @@ -291,6 +292,7 @@ class AliPIDResponse : public TNamed {

Float_t fTOFtail; //! TOF tail effect used in TOF probability
AliTOFPIDParams *fTOFPIDParams; //! TOF PID Params - period depending (OADB loaded)
Bool_t fResetTuneOnDataTOF; /// flag to reset TOF tune-on-data in event initialisation

AliHMPIDPIDParams *fHMPIDPIDParams; //! HMPID PID Params (OADB loaded)

Expand Down Expand Up @@ -406,7 +408,7 @@ class AliPIDResponse : public TNamed {
EDetPidStatus GetPHOSPIDStatus(const AliVTrack *track) const;
EDetPidStatus GetEMCALPIDStatus(const AliVTrack *track) const;

ClassDef(AliPIDResponse, 20); //PID response handling
ClassDef(AliPIDResponse, 21); //PID response handling
};

#endif

0 comments on commit af8aa8d

Please sign in to comment.