AliPhysics  64f4410 (64f4410)
AddTaskEMCALTimeCalibration.C
Go to the documentation of this file.
1 
32  TString geometryName = "",//EMCAL_COMPLETE12SMV1_DCAL_8SM
33  Double_t minClusterEne = 1.0,
34  Double_t maxClusterEne = 500,
35  Int_t minNcells = 2,
36  Int_t maxNcells = 200,
37  Double_t minLambda0LG = 0.1,
38  Double_t maxLambda0LG = 4.0,
39  Double_t minLambda0 = 0.1,
40  Double_t maxLambda0 = 0.4,
41  Double_t maxRtrack = 0.025,
42  Double_t minCellEne = 0.4,
43  Double_t minTime = -20.,
44  Double_t maxTime = 20.,
45  Bool_t pileupFromSPDFlag = kFALSE,
46  TString referenceFileName = "",//Reference.root
47  TString referenceSMFileName = "",//ReferenceSM.root
48  Bool_t badReconstruction = kFALSE,
49  Bool_t fillHeavyHistos = kFALSE,
50  Int_t badMapType = 0,
51  TString badMapFileName = "",
52  Bool_t mostEneCellOnly = kFALSE)
53 {
54  // Get the pointer to the existing analysis manager via the static access method.
55  //==============================================================================
56  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
57  if (!mgr)
58  {
59  ::Error("AddTaskEMCALTimeCalibration", "No analysis manager to connect to.");
60  return NULL;
61  }
62 
63  // Check the analysis type using the event handlers connected to the analysis manager.
64  //==============================================================================
65  if (!mgr->GetInputEventHandler())
66  {
67  ::Error("AddTaskEMCALTimeCalibration", "This task requires an input event handler");
68  return NULL;
69  }
70 
71  AliAnalysisTaskEMCALTimeCalib *taskmbemcal = new AliAnalysisTaskEMCALTimeCalib("TimeCalibTask");
72  taskmbemcal->SelectCollisionCandidates(AliVEvent::kEMC1|AliVEvent::kEMC7|AliVEvent::kEMC8|AliVEvent::kEMCEJE|AliVEvent::kEMCEGA);
73  taskmbemcal->SetGeometryName(geometryName);
74  taskmbemcal->SetMinClusterEnergy (minClusterEne);
75  taskmbemcal->SetMaxClusterEnergy (maxClusterEne);
76  taskmbemcal->SetMinNcells (minNcells);
77  taskmbemcal->SetMaxNcells (maxNcells);
78  taskmbemcal->SetMinLambda0 (minLambda0);
79  taskmbemcal->SetMaxLambda0 (maxLambda0);
80  taskmbemcal->SetMinLambda0LG (minLambda0LG);
81  taskmbemcal->SetMaxLambda0LG (maxLambda0LG);
82  taskmbemcal->SetMaxRtrack (maxRtrack);
83  taskmbemcal->SetMinCellEnergy (minCellEne);
84  taskmbemcal->SetMinTime (minTime);
85  taskmbemcal->SetMaxTime (maxTime);
86 
87  if(fillHeavyHistos) taskmbemcal->SwithOnFillHeavyHisto();
88  else taskmbemcal->SwithOffFillHeavyHisto();
89 
90  if(mostEneCellOnly) taskmbemcal->SwitchOnMostEneCellOnly();
91  else taskmbemcal->SwitchOffMostEneCellOnly();
92 
93  // pass1
94  taskmbemcal->SetRawTimeHisto(200,400.,800.);
95  taskmbemcal->SetPassTimeHisto (200,400.,800.);
96  // pass2
97  if(referenceSMFileName.Length()!=0){
98  taskmbemcal->SetReferenceRunByRunFileName(referenceSMFileName);
99  taskmbemcal->LoadReferenceRunByRunHistos();
100  taskmbemcal->SetPassTimeHisto(800,400.,800.);
101  if(badReconstruction) { //add for runs before LHC15n muon_calo_pass1 in run2
102  taskmbemcal->SwitchOnBadReco();
103  taskmbemcal->SetPassTimeHisto(500,-100.,150.);
104  }
105  }
106 
107  //pass3
108  if(referenceFileName.Length()!=0){
109  taskmbemcal->SetReferenceFileName(referenceFileName);
110  taskmbemcal->LoadReferenceHistos();
111  taskmbemcal->SetPassTimeHisto(1000,-250.,250.);
112  }
113  if(pileupFromSPDFlag==kTRUE) taskmbemcal->SwitchOnPileupFromSPD();
114  else taskmbemcal->SwitchOffPileupFromSPD();
115 
116  //bad channel map
117  taskmbemcal->SetBadChannelMapSource(badMapType);
118  if(badMapType==2) {
119  taskmbemcal->SetBadChannelFileName(badMapFileName);
120  taskmbemcal->LoadBadChannelMapFile();
121  }
122 
123  //taskmbemcal->PrintInfo();
124 
125  if(outputFile.Length()==0) outputFile = AliAnalysisManager::GetCommonFileName();
126 
127  // Create containers for input/output
128  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
129  AliAnalysisDataContainer *coutput = mgr->CreateContainer("chistolist", TList::Class(),
130  AliAnalysisManager::kOutputContainer,
131  outputFile.Data());
132 
133  mgr->AddTask(taskmbemcal);
134  mgr->ConnectInput (taskmbemcal, 0, cinput1);
135  mgr->ConnectOutput (taskmbemcal, 1, coutput);
136 
137  return taskmbemcal;
138 }
void SetRawTimeHisto(Int_t nbins, Double_t lower, Double_t upper)
double Double_t
Definition: External.C:58
int Int_t
Definition: External.C:63
void SetPassTimeHisto(Int_t nbins, Double_t lower, Double_t upper)
Task to work on Time Calibration for EMCal/DCal.
AliAnalysisTaskEMCALTimeCalib * AddTaskEMCALTimeCalibration(TString outputFile="", TString geometryName="", Double_t minClusterEne=1.0, Double_t maxClusterEne=500, Int_t minNcells=2, Int_t maxNcells=200, Double_t minLambda0LG=0.1, Double_t maxLambda0LG=4.0, Double_t minLambda0=0.1, Double_t maxLambda0=0.4, Double_t maxRtrack=0.025, Double_t minCellEne=0.4, Double_t minTime=-20., Double_t maxTime=20., Bool_t pileupFromSPDFlag=kFALSE, TString referenceFileName="", TString referenceSMFileName="", Bool_t badReconstruction=kFALSE, Bool_t fillHeavyHistos=kFALSE, Int_t badMapType=0, TString badMapFileName="", Bool_t mostEneCellOnly=kFALSE)
void LoadReferenceHistos()
Load reference Histograms (for one period) from file.
bool Bool_t
Definition: External.C:53