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