5 #include "AliAnalysisTaskEmcalJetPatchTriggerQA.h"
9 #include <TClonesArray.h>
13 #include <THnSparse.h>
15 #include <TLorentzVector.h>
16 #include <TParameter.h>
17 #include <TParticle.h>
21 #include "AliAODEvent.h"
22 #include "AliAnalysisManager.h"
23 #include "AliAnalysisTask.h"
24 #include "AliCentrality.h"
25 #include "AliESDEvent.h"
26 #include "AliESDInputHandler.h"
27 #include "AliEmcalJet.h"
28 #include "AliVCluster.h"
29 #include "AliRhoParameter.h"
30 #include "AliEmcalParticle.h"
31 #include "AliLocalRhoParameter.h"
32 #include "AliAnalysisTaskLocalRho.h"
33 #include <AliInputEventHandler.h>
34 #include <AliVEventHandler.h>
36 ClassImp(AliAnalysisTaskEmcalJetPatchTriggerQA)
38 //________________________________________________________________________
39 AliAnalysisTaskEmcalJetPatchTriggerQA::AliAnalysisTaskEmcalJetPatchTriggerQA() :
40 AliAnalysisTaskEmcalJet("ChristineQA",kFALSE),
45 // Default constructor.
46 SetMakeGeneralHistograms(kTRUE);
50 //________________________________________________________________________
51 AliAnalysisTaskEmcalJetPatchTriggerQA::AliAnalysisTaskEmcalJetPatchTriggerQA(const char *name) :
52 AliAnalysisTaskEmcalJet(name,kTRUE),
58 SetMakeGeneralHistograms(kTRUE);
60 // DefineInput(0,TChain::Class());
61 // DefineOutput(1, TList::Class());
64 //_______________________________________________________________________
65 AliAnalysisTaskEmcalJetPatchTriggerQA::~AliAnalysisTaskEmcalJetPatchTriggerQA()
75 //________________________________________________________________________
76 void AliAnalysisTaskEmcalJetPatchTriggerQA::UserCreateOutputObjects()
80 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
82 fHistNjetvsCent = new TH2F("NjetvsCent", "NjetvsCent", 100, 0.0, 100.0, 100, 0, 100);
83 fOutput->Add(fHistNjetvsCent);
85 UInt_t bitcode = 0; // bit codes, see GetDimParams() below
86 //bitcode = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9;
87 bitcode = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 ;
88 fhnJetTriggerQA = NewTHnSparseF("fhnJetTriggerQA", bitcode);
89 fhnJetTriggerQA->Sumw2();
90 fOutput->Add(fhnJetTriggerQA);
95 //________________________________________________________
96 void AliAnalysisTaskEmcalJetPatchTriggerQA::ExecOnce()
98 // Initialize the analysis
99 AliAnalysisTaskEmcalJet::ExecOnce();
103 //________________________________________________________________________
104 Bool_t AliAnalysisTaskEmcalJetPatchTriggerQA::Run()
106 // TEST TEST TEST TEST for OBJECTS!!
108 AliWarning(Form("%s: Could not retrieve LocalRho object!", GetName()));
109 fLocalRho = GetLocalRhoFromEvent(fLocalRhoName);
112 // check to see if we have any tracks
113 // if (!fJets) return kTRUE;
115 // get centrality bin
116 Int_t centbin = GetCentBin(fCent);
117 //for pp analyses we will just use the first centrality bin
121 // get event plane info from event
122 AliEventplane *aliEP = InputEvent()->GetEventplane();
124 fEPV0 = aliEP->GetEventplane("V0" ,InputEvent());
125 fEPV0A = aliEP->GetEventplane("V0A",InputEvent());
126 fEPV0C = aliEP->GetEventplane("V0C",InputEvent());
128 AliWarning(Form("%s: Could not retrieve event plane information!", GetName()));
131 // find NUMBER of jets
132 const Int_t Njets = fJets->GetEntriesFast();
135 // loop over jets in the event and make appropriate cuts
136 //cout<<"I at least get in the event and I have "<<Njets<<" jets"<<endl;
137 for (Int_t iJets = 0; iJets < Njets; ++iJets) {
138 AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJets->At(iJets));
139 if (!jet) // see if we have a jet
143 if ((jet->Phi()<fPhimin)||(jet->Phi()>fPhimax))
145 if ((jet->Eta()<fEtamin)||(jet->Eta()>fEtamax))
148 //cout<<"jet pt "<<jet->Pt()<<" area "<<jet->Area()<<" maxtrackpt "<<jet->MaxTrackPt()<<endl;
150 if (jet->Area()==0) // make sure jet has an area
152 if (jet->Pt()<0.1) // (should probably be higher..., but makes a cut on jet pT)
154 if (jet->MaxTrackPt()>100) // elminates fake tracks
156 //This somehow needs to be fixed but I'm not sure what it does yet. It seems the defaults are wacky.
157 if (! AcceptJet(jet)) // sees if jet is accepted
159 // jets.push_back(jet);
163 //cout<<"just accepted a jet!! woot woot"<<endl;
165 // Initializations and Calculations
166 // Double_t jetphi = jet->Phi();
167 //Double_t jeteta = jet->Eta(); // ETA of jet
169 Double_t jetPtraw = jet->Pt(); // raw pT of jet
170 Double_t jetPtLocal = -500; // initialize corr jet pt LOCAL
171 Double_t jetPtGlobal = -500; // initialize corr jet pt GLOBAL
172 Double_t jetarea = -500; // initialize jet area
173 jetarea = jet->Area(); // jet area
175 Float_t dEP = -500; // initialize angle between jet and event plane
176 dEP = RelativeEPJET(jet->Phi(),fEPV0);
178 // get LOCAL rho from event and fill histo's
179 fRhoVal = fRho->GetVal();
180 fLocalRhoVal = fLocalRho->GetLocalVal(jet->Phi(), 0.2); // jet angle, then jet radius
182 jetPtLocal = jet->Pt() - jetarea*fLocalRhoVal; // corrected pT of jet from LOCAL rho value
183 jetPtGlobal = jet->Pt() - jetarea*fRhoVal; // corrected pT of jet from GLOBAL rho value
185 // need to update entries soon
186 //Double_t Entries[10] = {centbin, jetPtLocal, jetPtGlobal, jetPtraw, jet->Eta(), jet->Phi(), dEP, fLocalRhoVal, fRhoVal, fEPV0};
187 Double_t Entries[9] = {centbin, jetPtLocal, jetPtGlobal, jetPtraw, jet->Phi(), dEP, fLocalRhoVal, fRhoVal, fEPV0};
188 fhnJetTriggerQA->Fill(Entries); // fill Sparse Histo with entries
190 // in plane and out of plane histo's
191 if( dEP>0 && dEP<=(TMath::Pi()/6) ){
192 // we are IN plane, lets fill some histo's
193 }else if( dEP>(TMath::Pi()/3) && dEP<=(TMath::Pi()/2) ){
194 // we are OUT of PLANE, lets fill some histo's
197 fHistNjetvsCent->Fill(fCent,NjetAcc);
200 } // LOOP over JETS in event
205 //________________________________________________________________________
206 void AliAnalysisTaskEmcalJetPatchTriggerQA::Terminate(Option_t *)
209 } // end of terminate
211 //________________________________________________________________________
212 Int_t AliAnalysisTaskEmcalJetPatchTriggerQA::GetCentBin(Double_t cent) const
213 { // Get centrality bin.
216 if (cent>=0 && cent<10)
218 else if (cent>=10 && cent<20)
220 else if (cent>=20 && cent<30)
222 else if (cent>=30 && cent<40)
224 else if (cent>=40 && cent<50)
226 else if (cent>=50 && cent<90)
231 //_________________________________________________________________________
232 Float_t AliAnalysisTaskEmcalJetPatchTriggerQA:: RelativeEPJET(Double_t jetAng, Double_t EPAng) const
233 { // function to calculate angle between jet and EP in the 1st quadrant (0,Pi/2)
234 Double_t dphi = (EPAng - jetAng);
236 // ran into trouble with a few dEP<-Pi so trying this...
237 if( dphi<-1*TMath::Pi() ){
238 dphi = dphi + 1*TMath::Pi();
241 if( (dphi>0) && (dphi<1*TMath::Pi()/2) ){
242 // Do nothing! we are in quadrant 1
243 }else if( (dphi>1*TMath::Pi()/2) && (dphi<1*TMath::Pi()) ){
244 dphi = 1*TMath::Pi() - dphi;
245 }else if( (dphi<0) && (dphi>-1*TMath::Pi()/2) ){
247 }else if( (dphi<-1*TMath::Pi()/2) && (dphi>-1*TMath::Pi()) ){
248 dphi = dphi + 1*TMath::Pi();
252 if( dphi < 0 || dphi > TMath::Pi()/2 )
253 AliWarning(Form("%s: dPHI not constrained from [0, Pi/2]", GetName()));
255 return dphi; // dphi in [0, Pi/2]
258 //______________________________________________________________________
259 THnSparse* AliAnalysisTaskEmcalJetPatchTriggerQA::NewTHnSparseF(const char* name, UInt_t entries)
261 // generate new THnSparseF, axes are defined in GetDimParams()
263 UInt_t tmp = entries;
266 tmp = tmp &~ -tmp; // clear lowest bit
269 TString hnTitle(name);
270 const Int_t dim = count;
277 while(c<dim && i<32){
281 GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
282 hnTitle += Form(";%s",label.Data());
290 return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
291 } // end of NewTHnSparseF
293 void AliAnalysisTaskEmcalJetPatchTriggerQA::GetDimParams(Int_t iEntry, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)
295 // stores label and binning of axis for THnSparse
296 const Double_t pi = TMath::Pi();
301 label = "V0 centrality (%)";
308 label = "Corrected jet p_{T}: Local #rho";
315 label = "Corrected jet p_{T}: Global #rho";
322 label = "Raw jet p_{T}";
331 xmin = 1.4;//-1.0*pi;
336 label = "Relative angle between jet and Reaction plane";
343 label = "Local #rho value";
350 label = "Global #rho value";
357 label = "fEPV0 event plane";
359 xmin = -TMath::Pi()/2.0;
360 xmax = TMath::Pi()/2.0;
364 } // end of getting dim-params