1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //The design of this class is based on the AliFMDParameters class. Its purpose
17 //is to hold parameters for the analysis such as background correction and
20 //Author: Hans Hjersing Dalsgaard, NBI, hans.dalsgaard@cern.ch
23 #include "AliFMDDebug.h" // ALILOG_H
24 #include "AliFMDAnaParameters.h" // ALIFMDPARAMETERS_H
25 //#include <AliCDBManager.h> // ALICDBMANAGER_H
26 //#include <AliCDBEntry.h> // ALICDBMANAGER_H
27 //#include "AliFMDRing.h"
29 #include <Riostream.h>
35 #include "AliTriggerAnalysis.h"
36 #include "AliPhysicsSelection.h"
37 #include "AliBackgroundSelection.h"
38 #include "AliMultiplicity.h"
39 #include "AliESDEvent.h"
40 #include "AliESDVertex.h"
42 //====================================================================
43 ClassImp(AliFMDAnaParameters)
45 ; // This is here to keep Emacs for indenting the next line
48 //const char* AliFMDAnaParameters::fgkBackgroundCorrection = "FMD/Correction/Background";
49 //const char* AliFMDAnaParameters::fgkEnergyDists = "FMD/Correction/EnergyDistribution";
50 const char* AliFMDAnaParameters::fgkBackgroundID = "background";
51 const char* AliFMDAnaParameters::fgkEnergyDistributionID = "energydistributions";
52 const char* AliFMDAnaParameters::fgkEventSelectionEffID = "eventselectionefficiency";
53 const char* AliFMDAnaParameters::fgkSharingEffID = "sharingefficiency";
54 //____________________________________________________________________
55 AliFMDAnaParameters* AliFMDAnaParameters::fgInstance = 0;
57 //____________________________________________________________________
60 AliFMDAnaParameters::Instance()
62 // Get static instance
63 if (!fgInstance) fgInstance = new AliFMDAnaParameters;
67 //____________________________________________________________________
68 AliFMDAnaParameters::AliFMDAnaParameters() :
71 fEnergyDistribution(0),
72 fEventSelectionEfficiency(0),
73 fSharingEfficiency(0),
74 fCorner1(4.2231, 26.6638),
75 fCorner2(1.8357, 27.9500),
76 fEnergyPath("$ALICE_ROOT/PWG2/FORWARD/corrections/EnergyDistribution"),
77 fBackgroundPath("$ALICE_ROOT/PWG2/FORWARD/corrections/Background"),
78 fEventSelectionEffPath("$ALICE_ROOT/PWG2/FORWARD/corrections/EventSelectionEfficiency"),
79 fSharingEffPath("$ALICE_ROOT/PWG2/FORWARD/corrections/SharingEfficiency"),
80 fProcessPrimary(kFALSE),
89 fSPDhighLimit(999999999),
90 fCentralSelection(kFALSE),
91 fSharingObjectPresent(kTRUE),
92 fNumberOfEtaBinsToCut(1),
97 fTriggerEmpty(kFALSE),
98 fUseBuiltInNSD(kFALSE)
100 // Default constructor
101 fPhysicsSelection = new AliPhysicsSelection;
102 fPhysicsSelection->SetAnalyzeMC(kTRUE); //For the background correction. This is reset in Init if relevant
103 // fPhysicsSelection->SetUseBXNumbers(kFALSE);
106 AliBackgroundSelection* backgroundSelection = new AliBackgroundSelection("bg","bg");
107 backgroundSelection->Init();
108 fPhysicsSelection->AddBackgroundIdentification(backgroundSelection);
109 //fPhysicsSelection->Initialize(104792);
110 // Do not use this - it is only for IO
114 //____________________________________________________________________
115 char* AliFMDAnaParameters::GetPath(const char* species) {
119 if(species == fgkBackgroundID)
120 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
121 fBackgroundPath.Data(),
129 if(species == fgkEnergyDistributionID)
130 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
132 fgkEnergyDistributionID,
139 if(species == fgkEventSelectionEffID)
140 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
141 fEventSelectionEffPath.Data(),
142 fgkEventSelectionEffID,
149 if(species == fgkSharingEffID)
150 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
151 fSharingEffPath.Data(),
162 //____________________________________________________________________
163 void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what)
165 // Initialize the parameters manager. We need to get stuff from files here.
167 if (forceReInit) fIsInit = kFALSE;
169 if (what & kBackgroundCorrection) InitBackground();
170 if (what & kEnergyDistributions) InitEnergyDists();
171 if (what & kEventSelectionEfficiency) InitEventSelectionEff();
172 if (what & kSharingEfficiency) InitSharingEff();
180 fPhysicsSelection->SetAnalyzeMC(kTRUE);
182 else fPhysicsSelection->SetAnalyzeMC(kFALSE);
186 //____________________________________________________________________
188 void AliFMDAnaParameters::InitBackground() {
189 //Init background correction objects.
191 TFile* fin = TFile::Open(GetPath(fgkBackgroundID));
195 fBackground = dynamic_cast<AliFMDAnaCalibBackgroundCorrection*>(fin->Get(fgkBackgroundID));
196 if (!fBackground) AliFatal("Invalid background object from CDB");
202 //____________________________________________________________________
204 void AliFMDAnaParameters::InitEnergyDists() {
205 //Init energy distributions
206 TFile* fin = TFile::Open(GetPath(fgkEnergyDistributionID));
210 fEnergyDistribution = dynamic_cast<AliFMDAnaCalibEnergyDistribution*>(fin->Get(fgkEnergyDistributionID));
212 if (!fEnergyDistribution) AliFatal("Invalid background object from CDB");
216 //____________________________________________________________________
218 void AliFMDAnaParameters::InitEventSelectionEff() {
219 //Init event selection objects
221 TFile* fin = TFile::Open(GetPath(fgkEventSelectionEffID));
225 fEventSelectionEfficiency = dynamic_cast<AliFMDAnaCalibEventSelectionEfficiency*>(fin->Get(fgkEventSelectionEffID));
226 if (!fEventSelectionEfficiency) AliFatal("Invalid background object from CDB");
230 //____________________________________________________________________
232 void AliFMDAnaParameters::InitSharingEff() {
234 fSharingObjectPresent = kTRUE;
235 TFile* fin = TFile::Open(GetPath(fgkSharingEffID));
238 fSharingObjectPresent = kFALSE;
242 fSharingEfficiency = dynamic_cast<AliFMDAnaCalibSharingEfficiency*>(fin->Get(fgkSharingEffID));
243 if (!fSharingEfficiency) {
244 fSharingObjectPresent = kFALSE;
249 //____________________________________________________________________
250 void AliFMDAnaParameters::FindEtaLimits() {
252 fEtaLowBinLimits.SetBins(4,0,4,2,0,2,GetNvtxBins(),0,GetNvtxBins());
253 fEtaHighBinLimits.SetBins(4,0,4,2,0,2,GetNvtxBins(),0,GetNvtxBins());
254 for(Int_t det=0; det<=3;det++) {
255 Int_t nRings = (det<=1 ? 1 : 2);
256 for (UShort_t ir = 0; ir < nRings; ir++) {
257 Char_t ringChar = (ir == 0 ? 'I' : 'O');
258 for(Int_t v =0; v<GetNvtxBins(); v++) {
259 fEtaLowBinLimits.SetBinContent(det,ir,v,GetFirstEtaBinFromMap(v, det, ringChar));
260 fEtaHighBinLimits.SetBinContent(det,ir,v,GetLastEtaBinFromMap(v, det, ringChar));
261 //std::cout<<det<<" "<<ringChar<<" "<<fEtaLowBinLimits.GetBinContent(det,ir,v)<<" "<<fEtaHighBinLimits.GetBinContent(det,ir,v)<<std::endl;
267 //____________________________________________________________________
269 void AliFMDAnaParameters::PrintStatus() const
271 //Print current status
272 TString energystring;
275 energystring.Form("900 GeV"); break;
277 energystring.Form("7000 GeV"); break;
279 energystring.Form("10000 GeV"); break;
281 energystring.Form("14000 GeV"); break;
283 energystring.Form("invalid energy"); break;
285 TString triggerstring;
288 triggerstring.Form("Minimum bias 1"); break;
290 triggerstring.Form("Minimum bias 2"); break;
292 triggerstring.Form("SPD FAST OR"); break;
294 triggerstring.Form("NO TRIGGER TEST"); break;
296 energystring.Form("invalid trigger"); break;
301 magstring.Form("5 kGaus"); break;
303 magstring.Form("0 kGaus"); break;
305 magstring.Form("invalid mag field"); break;
307 TString collsystemstring;
310 collsystemstring.Form("p+p"); break;
312 collsystemstring.Form("Pb+Pb"); break;
314 collsystemstring.Form("invalid collision system"); break;
320 datastring.Form("Nature"); break;
322 datastring.Form("MC"); break;
324 datastring.Form("Unknown"); break ;
327 std::cout<<"Energy = "<<energystring.Data()<<std::endl;
328 std::cout<<"Trigger = "<<triggerstring.Data()<<std::endl;
329 std::cout<<"Mag Field = "<<magstring.Data()<<std::endl;
330 std::cout<<"Coll System = "<<collsystemstring.Data()<<std::endl;
331 std::cout<<"Data origin = "<<datastring.Data()<<std::endl;
337 //____________________________________________________________________
338 Float_t AliFMDAnaParameters::GetVtxCutZ() {
339 //Get the z vtx cut in analysis
341 AliWarning("Not initialized yet. Call Init() to remedy");
345 return fBackground->GetVtxCutZ();
348 //____________________________________________________________________
349 Int_t AliFMDAnaParameters::GetNvtxBins() {
350 //Get number of vtx bins
352 AliWarning("Not initialized yet. Call Init() to remedy");
356 return fBackground->GetNvtxBins();
358 //____________________________________________________________________
359 TH1F* AliFMDAnaParameters::GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta) {
361 return fEnergyDistribution->GetEnergyDistribution(det, ring, eta);
363 //____________________________________________________________________
364 TH1F* AliFMDAnaParameters::GetEmptyEnergyDistribution(Int_t det, Char_t ring) {
366 return fEnergyDistribution->GetEmptyEnergyDistribution(det, ring);
368 //____________________________________________________________________
369 TH1F* AliFMDAnaParameters::GetRingEnergyDistribution(Int_t det, Char_t ring) {
371 return fEnergyDistribution->GetRingEnergyDistribution(det, ring);
373 //____________________________________________________________________
374 Float_t AliFMDAnaParameters::GetSigma(Int_t det, Char_t ring, Float_t eta) {
375 //Get sigma of Landau fits
377 AliWarning("Not initialized yet. Call Init() to remedy");
381 TH1F* hEnergyDist = GetEnergyDistribution(det,ring, eta);
382 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
384 //AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
387 Float_t sigma = fitFunc->GetParameter(2);
392 //____________________________________________________________________
393 Float_t AliFMDAnaParameters::GetMPV(Int_t det, Char_t ring, Float_t eta) {
394 //Get MPV of landau fits
396 AliWarning("Not initialized yet. Call Init() to remedy");
399 //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
400 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
401 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
404 AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
405 std::cout<<hEnergyDist->GetEntries()<<" "<<GetEtaBin(eta)<<std::endl;
409 Float_t mpv = fitFunc->GetParameter(1);
412 //____________________________________________________________________
413 Float_t AliFMDAnaParameters::GetConstant(Int_t det, Char_t ring, Float_t eta) {
414 //Get constant parameter of Landau fits
416 AliWarning("Not initialized yet. Call Init() to remedy");
420 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
421 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
423 AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
427 Float_t mpv = fitFunc->GetParameter(0);
430 //____________________________________________________________________
431 Float_t AliFMDAnaParameters::Get2MIPWeight(Int_t det, Char_t ring, Float_t eta) {
432 //Get 2 MIP weights of convoluted Landau fits
434 AliWarning("Not initialized yet. Call Init() to remedy");
438 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
439 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
440 if(!fitFunc) return 0;
441 Float_t twoMIPweight = fitFunc->GetParameter(3);
445 if(twoMIPweight < 1e-05)
450 //____________________________________________________________________
451 Float_t AliFMDAnaParameters::Get3MIPWeight(Int_t det, Char_t ring, Float_t eta) {
452 //Get 3 MIP weights of convoluted Landau fits
454 AliWarning("Not initialized yet. Call Init() to remedy");
458 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
459 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
460 if(!fitFunc) return 0;
461 Float_t threeMIPweight = fitFunc->GetParameter(4);
463 if(threeMIPweight < 1e-05)
466 Float_t twoMIPweight = fitFunc->GetParameter(3);
468 if(twoMIPweight < 1e-05)
471 return threeMIPweight;
473 //____________________________________________________________________
474 Int_t AliFMDAnaParameters::GetNetaBins() {
475 return GetBackgroundCorrection(1,'I',5)->GetNbinsX();
478 //____________________________________________________________________
479 Float_t AliFMDAnaParameters::GetEtaMin() {
481 return GetBackgroundCorrection(1,'I',5)->GetXaxis()->GetXmin();
483 //____________________________________________________________________
484 Float_t AliFMDAnaParameters::GetEtaMax() {
486 return GetBackgroundCorrection(1,'I',5)->GetXaxis()->GetXmax();
489 //____________________________________________________________________
490 Int_t AliFMDAnaParameters::GetEtaBin(Float_t eta) {
492 TAxis testaxis(GetNetaBins(),GetEtaMin(),GetEtaMax());
493 Int_t binnumber = testaxis.FindBin(eta) ;
498 //____________________________________________________________________
500 TH2F* AliFMDAnaParameters::GetBackgroundCorrection(Int_t det,
503 //Get background correction histogram
505 AliWarning("Not initialized yet. Call Init() to remedy");
511 if(vtxbin > fBackground->GetNvtxBins()) {
512 AliWarning(Form("No background object for vertex bin %d", vtxbin));
516 return fBackground->GetBgCorrection(det,ring,vtxbin);
518 //____________________________________________________________________
520 TH1F* AliFMDAnaParameters::GetDoubleHitCorrection(Int_t det,
522 //Get correction for several hits in strips for p+p
524 AliWarning("Not initialized yet. Call Init() to remedy");
528 return fBackground->GetDoubleHitCorrection(det,ring);
530 //_____________________________________________________________________
531 TH1F* AliFMDAnaParameters::GetSPDDeadCorrection(Int_t vtxbin) {
533 //Get correction for several hits in strips for p+p
535 AliWarning("Not initialized yet. Call Init() to remedy");
539 return fBackground->GetSPDDeadCorrection(vtxbin);
541 //_____________________________________________________________________
542 Float_t AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin) {
543 //Get event selection efficiency object
545 AliWarning("Not initialized yet. Call Init() to remedy");
548 return fEventSelectionEfficiency->GetCorrection(vtxbin);
551 //_____________________________________________________________________
552 Float_t AliFMDAnaParameters::GetVtxSelectionEffFromMC() {
555 AliWarning("Not initialized yet. Call Init() to remedy");
558 return fEventSelectionEfficiency->GetVtxToTriggerRatio();
562 //_____________________________________________________________________
563 TH2F* AliFMDAnaParameters::GetEventSelectionEfficiency(Char_t* trig, Int_t vtxbin, Char_t ring) {
564 //Get event selection efficiency object
567 if(!test.Contains("NSD") && test.Contains("INEL")) {
568 AliWarning("Event selection efficiency only available for INEL and NSD");
572 AliWarning("Not initialized yet. Call Init() to remedy");
575 return fEventSelectionEfficiency->GetCorrection(trig,vtxbin,ring);
578 //_____________________________________________________________________
579 TH1F* AliFMDAnaParameters::GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin) {
580 //Get sharing efficiency object
582 AliWarning("Not initialized yet. Call Init() to remedy");
586 return fSharingEfficiency->GetSharingEff(det,ring,vtxbin);
589 //_____________________________________________________________________
590 TH1F* AliFMDAnaParameters::GetSharingEfficiencyTrVtx(Int_t det, Char_t ring, Int_t vtxbin) {
591 //Get sharing efficiency object TrVtx
593 AliWarning("Not initialized yet. Call Init() to remedy");
597 return fSharingEfficiency->GetSharingEffTrVtx(det,ring,vtxbin);
600 //_____________________________________________________________________
601 Float_t AliFMDAnaParameters::GetMaxR(Char_t ring) const {
609 AliWarning("Unknown ring - must be I or O!");
613 //_____________________________________________________________________
614 Float_t AliFMDAnaParameters::GetMinR(Char_t ring) const{
622 AliWarning("Unknown ring - must be I or O!");
627 //_____________________________________________________________________
628 void AliFMDAnaParameters::SetCorners(Char_t ring) {
629 //Set corners (taken from nominal geometry)
631 fCorner1.Set(4.9895, 15.3560);
632 fCorner2.Set(1.8007, 17.2000);
635 fCorner1.Set(4.2231, 26.6638);
636 fCorner2.Set(1.8357, 27.9500);
640 //_____________________________________________________________________
641 Float_t AliFMDAnaParameters::GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const
643 //Get phi from sector
644 Int_t nsec = (ring == 'I' ? 20 : 40);
647 basephi = 1.72787594;
648 if(det == 2 && ring == 'I')
649 basephi = 0.15707963;
650 if(det == 2 && ring == 'O')
651 basephi = 0.078539818;
652 if(det == 3 && ring == 'I')
653 basephi = 2.984513044;
654 if(det == 3 && ring == 'O')
655 basephi = 3.06305289;
657 Float_t step = 2*TMath::Pi() / nsec;
660 phi = basephi - sec*step;
662 phi = basephi + sec*step;
665 phi = phi +2*TMath::Pi();
666 if(phi > 2*TMath::Pi() )
667 phi = phi - 2*TMath::Pi();
671 //_____________________________________________________________________
672 Float_t AliFMDAnaParameters::GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const
674 //Calculate eta from strip with vertex (redundant with AliESDFMD::Eta)
675 Float_t rad = GetMaxR(ring)-GetMinR(ring);
676 Float_t nStrips = (ring == 'I' ? 512 : 256);
677 Float_t segment = rad / nStrips;
678 Float_t r = GetMinR(ring) + segment*strip;
680 Int_t hybrid = sec / 2;
683 if(!(hybrid%2)) z = 320.266; else z = 319.766;
685 if(det == 2 && ring == 'I' ) {
686 if(!(hybrid%2)) z = 83.666; else z = 83.166;
688 if(det == 2 && ring == 'O' ) {
689 if(!(hybrid%2)) z = 74.966; else z = 75.466;
691 if(det == 3 && ring == 'I' ) {
692 if(!(hybrid%2)) z = -63.066; else z = -62.566;
694 if(det == 3 && ring == 'O' ) {
695 if(!(hybrid%2)) z = -74.966; else z = -75.466;
698 //std::cout<<det<<" "<<ring<<" "<<sec<<" "<<hybrid<<" "<<z<<std::endl;
700 // Float_t r = TMath::Sqrt(TMath::Power(x,2)+TMath::Power(y,2));
701 Float_t theta = TMath::ATan2(r,z-zvtx);
702 Float_t eta = -1*TMath::Log(TMath::Tan(0.5*theta));
707 //_____________________________________________________________________
709 Bool_t AliFMDAnaParameters::GetVertex(const AliESDEvent* esd, Double_t* vertexXYZ)
711 //Get the vertex from the ESD
712 const AliESDVertex* vertex = 0;
713 vertex = esd->GetPrimaryVertexSPD();
716 vertex->GetXYZ(vertexXYZ);
718 //if(vertexXYZ[0] == 0 || vertexXYZ[1] == 0 )
721 if(vertex->GetNContributors() <= 0)
724 if(vertex->GetZRes() > 0.1 )
727 return vertex->GetStatus();
730 //____________________________________________________________________
731 void AliFMDAnaParameters::SetTriggerStatus(const AliESDEvent *esd) {
733 //ULong64_t triggerMask = esd->GetTriggerMask();
735 TString triggers = esd->GetFiredTriggerClasses();
737 //if(triggers.Contains("CINT1B-ABCE-NOPF-ALL") || triggers.Contains("CINT1B-E-NOPF-ALL")) return kTRUE;
738 //else return kFALSE;
739 //if(triggers.Contains("CINT1B-E-NOPF-ALL")) return kFALSE;
741 // if(triggers.Contains("CINT1A-ABCE-NOPF-ALL")) return kFALSE;
742 // if(triggers.Contains("CINT1C-ABCE-NOPF-ALL")) return kFALSE;
744 // definitions from p-p.cfg
745 //ULong64_t spdFO = (1 << 14);
746 // ULong64_t v0left = (1 << 11);
747 // ULong64_t v0right = (1 << 12);
749 AliTriggerAnalysis tAna;
751 //REMOVE WHEN FINISHED PLAYING WITH TRIGGERS!
752 //fPhysicsSelection->IsCollisionCandidate(esd);
755 // fPhysicsSelection->SetAnalyzeMC(kTRUE);
758 fTriggerInel = kFALSE;
759 fTriggerNSD = kFALSE;
760 fTriggerEmpty = kFALSE;
762 if(fPhysicsSelection->IsCollisionCandidate(esd)) {
763 fTriggerInel = kTRUE;
768 if ((tAna.FMDTrigger(esd, AliTriggerAnalysis::kASide) || tAna.V0Trigger(esd, AliTriggerAnalysis::kASide, kFALSE) == AliTriggerAnalysis::kV0BB) && (tAna.FMDTrigger(esd, AliTriggerAnalysis::kCSide) || tAna.V0Trigger(esd, AliTriggerAnalysis::kCSide, kFALSE) == AliTriggerAnalysis::kV0BB))
771 else nsd = tAna.IsOfflineTriggerFired(esd,AliTriggerAnalysis::kNSD1);
773 if(fTriggerInel && nsd) {
776 if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL")) {
777 fTriggerEmpty = kTRUE;
781 /*switch (fTrigger) {
783 if( fPhysicsSelection->IsCollisionCandidate(esd)) {
784 fTriggerInel = kTRUE;
790 if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
795 if (triggerMask & spdFO)
804 if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL"))
809 if(fPhysicsSelection->IsCollisionCandidate(esd) && tAna.IsOfflineTriggerFired(esd,AliTriggerAnalysis::kNSD1))
819 //____________________________________________________________________
820 Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd, Trigger trig) {
821 //Did we have trig trigger ?
822 Trigger old = fTrigger;
824 Bool_t retval = IsEventTriggered(esd);
830 //____________________________________________________________________
831 Bool_t AliFMDAnaParameters::IsEventTriggered(Trigger trigger) {
832 // check if the event was triggered
834 if (fCentralSelection) return kTRUE;
844 return fTriggerEmpty;
850 AliWarning("Trigger not implemented!!!");
859 //____________________________________________________________________
861 AliFMDAnaParameters::GetStripLength(Char_t ring, UShort_t strip)
863 //Get length of a strip
865 Float_t rad = GetMaxR(ring)-GetMinR(ring);
866 Float_t nStrips = (ring == 'I' ? 512 : 256);
867 Float_t segment = rad / nStrips;
869 //TVector2* corner1 = fmdring.GetVertex(2);
870 // TVector2* corner2 = fmdring.GetVertex(3);
874 std::cout<<GetMaxR(ring)<<" "<<fmdring.GetMaxR()<<std::endl;
875 std::cout<<GetMinR(ring)<<" "<<fmdring.GetMinR()<<std::endl;
876 std::cout<<corner1->X()<<" "<<fCorner1.X()<<std::endl;
877 std::cout<<corner2->X()<<" "<<fCorner2.X()<<std::endl;
878 std::cout<<corner1->Y()<<" "<<fCorner1.Y()<<std::endl;
879 std::cout<<corner2->Y()<<" "<<fCorner2.Y()<<std::endl;*/
880 Float_t slope = (fCorner1.Y() - fCorner2.Y()) / (fCorner1.X() - fCorner2.X());
881 Float_t constant = (fCorner2.Y()*fCorner1.X()-(fCorner2.X()*fCorner1.Y())) / (fCorner1.X() - fCorner2.X());
882 Float_t radius = GetMinR(ring) + strip*segment;
884 Float_t d = TMath::Power(TMath::Abs(radius*slope),2) + TMath::Power(radius,2) - TMath::Power(constant,2);
886 Float_t arclength = GetBaseStripLength(ring,strip);
889 Float_t x = (-1*TMath::Sqrt(d) -slope*constant) / (1+TMath::Power(slope,2));
890 Float_t y = slope*x + constant;
891 Float_t theta = TMath::ATan2(x,y);
893 if(x < fCorner1.X() && y > fCorner1.Y()) {
894 arclength = radius*theta; //One sector since theta is by definition half-hybrid
904 //____________________________________________________________________
906 AliFMDAnaParameters::GetBaseStripLength(Char_t ring, UShort_t strip)
908 //Get length of strip assuming that corners are not cut away
909 Float_t rad = GetMaxR(ring)-GetMinR(ring);
910 Float_t nStrips = (ring == 'I' ? 512 : 256);
911 Float_t nSec = (ring == 'I' ? 20 : 40);
912 Float_t segment = rad / nStrips;
913 Float_t basearc = 2*TMath::Pi() / (0.5*nSec); // One hybrid: 36 degrees inner, 18 outer
914 Float_t radius = GetMinR(ring) + strip*segment;
915 Float_t basearclength = 0.5*basearc * radius; // One sector
917 return basearclength;
919 //____________________________________________________________________
920 Int_t AliFMDAnaParameters::GetFirstEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring)
922 TH2F* hBg = GetBackgroundCorrection(det,ring,vtxbin);
924 if(det == 0) return hBg->GetXaxis()->FindBin(-1.95);
927 Int_t nNonZeroFirst = 0;
929 for(Int_t i=1;i<=hBg->GetNbinsX();i++) {
930 if(nNonZeroFirst == fNumberOfEtaBinsToCut && firstbin==-1) firstbin = i;
932 for(Int_t j=1;j<=hBg->GetNbinsY();j++) {
934 Float_t value = hBg->GetBinContent(i,j);
936 if(value > 0.001 && nNonZeroFirst<fNumberOfEtaBinsToCut)
937 {nNonZeroFirst++; break;}
946 //____________________________________________________________________
947 Int_t AliFMDAnaParameters::GetLastEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring)
949 TH2F* hBg = GetBackgroundCorrection(det,ring,vtxbin);
951 Int_t nNonZeroLast = 0;
953 if(det == 0) return hBg->GetXaxis()->FindBin(1.95);
955 for(Int_t i=hBg->GetNbinsX();i>0;i--) {
956 if(nNonZeroLast == fNumberOfEtaBinsToCut && lastbin==-1) lastbin = i;
958 for(Int_t j=1;j<=hBg->GetNbinsY();j++) {
960 Float_t value = hBg->GetBinContent(i,j);
962 if(value > 0.001 && nNonZeroLast<fNumberOfEtaBinsToCut)
963 {nNonZeroLast++; break; }
972 //____________________________________________________________________
973 Int_t AliFMDAnaParameters::GetFirstEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring)
975 Int_t ringNumber = (ring == 'I' ? 0 : 1);
976 return fEtaLowBinLimits.GetBinContent(det,ringNumber,vtxbin);
980 //____________________________________________________________________
981 Int_t AliFMDAnaParameters::GetLastEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring)
983 Int_t ringNumber = (ring == 'I' ? 0 : 1);
984 return fEtaHighBinLimits.GetBinContent(det,ringNumber,vtxbin);
987 //____________________________________________________________________