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),
96 // Default constructor
97 fPhysicsSelection = new AliPhysicsSelection;
98 AliBackgroundSelection* backgroundSelection = new AliBackgroundSelection("bg","bg");
100 fPhysicsSelection->AddBackgroundIdentification(backgroundSelection);
101 //fPhysicsSelection->Initialize(104792);
102 // Do not use this - it is only for IO
106 //____________________________________________________________________
107 char* AliFMDAnaParameters::GetPath(const char* species) {
111 if(species == fgkBackgroundID)
112 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
113 fBackgroundPath.Data(),
121 if(species == fgkEnergyDistributionID)
122 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
124 fgkEnergyDistributionID,
131 if(species == fgkEventSelectionEffID)
132 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
133 fEventSelectionEffPath.Data(),
134 fgkEventSelectionEffID,
141 if(species == fgkSharingEffID)
142 path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
143 fSharingEffPath.Data(),
154 //____________________________________________________________________
155 void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what)
157 // Initialize the parameters manager. We need to get stuff from files here.
159 if (forceReInit) fIsInit = kFALSE;
161 if (what & kBackgroundCorrection) InitBackground();
162 if (what & kEnergyDistributions) InitEnergyDists();
163 if (what & kEventSelectionEfficiency) InitEventSelectionEff();
164 if (what & kSharingEfficiency) InitSharingEff();
173 //____________________________________________________________________
175 void AliFMDAnaParameters::InitBackground() {
176 //Init background correction objects.
178 TFile* fin = TFile::Open(GetPath(fgkBackgroundID));
182 fBackground = dynamic_cast<AliFMDAnaCalibBackgroundCorrection*>(fin->Get(fgkBackgroundID));
183 if (!fBackground) AliFatal("Invalid background object from CDB");
189 //____________________________________________________________________
191 void AliFMDAnaParameters::InitEnergyDists() {
192 //Init energy distributions
193 TFile* fin = TFile::Open(GetPath(fgkEnergyDistributionID));
197 fEnergyDistribution = dynamic_cast<AliFMDAnaCalibEnergyDistribution*>(fin->Get(fgkEnergyDistributionID));
199 if (!fEnergyDistribution) AliFatal("Invalid background object from CDB");
203 //____________________________________________________________________
205 void AliFMDAnaParameters::InitEventSelectionEff() {
206 //Init event selection objects
208 TFile* fin = TFile::Open(GetPath(fgkEventSelectionEffID));
212 fEventSelectionEfficiency = dynamic_cast<AliFMDAnaCalibEventSelectionEfficiency*>(fin->Get(fgkEventSelectionEffID));
213 if (!fEventSelectionEfficiency) AliFatal("Invalid background object from CDB");
217 //____________________________________________________________________
219 void AliFMDAnaParameters::InitSharingEff() {
221 fSharingObjectPresent = kTRUE;
222 TFile* fin = TFile::Open(GetPath(fgkSharingEffID));
225 fSharingObjectPresent = kFALSE;
229 fSharingEfficiency = dynamic_cast<AliFMDAnaCalibSharingEfficiency*>(fin->Get(fgkSharingEffID));
230 if (!fSharingEfficiency) {
231 fSharingObjectPresent = kFALSE;
236 //____________________________________________________________________
237 void AliFMDAnaParameters::FindEtaLimits() {
239 fEtaLowBinLimits.SetBins(4,0,4,2,0,2,GetNvtxBins(),0,GetNvtxBins());
240 fEtaHighBinLimits.SetBins(4,0,4,2,0,2,GetNvtxBins(),0,GetNvtxBins());
241 for(Int_t det=0; det<=3;det++) {
242 Int_t nRings = (det<=1 ? 1 : 2);
243 for (UShort_t ir = 0; ir < nRings; ir++) {
244 Char_t ringChar = (ir == 0 ? 'I' : 'O');
245 for(Int_t v =0; v<GetNvtxBins(); v++) {
246 fEtaLowBinLimits.SetBinContent(det,ir,v,GetFirstEtaBinFromMap(v, det, ringChar));
247 fEtaHighBinLimits.SetBinContent(det,ir,v,GetLastEtaBinFromMap(v, det, ringChar));
248 //std::cout<<det<<" "<<ringChar<<" "<<fEtaLowBinLimits.GetBinContent(det,ir,v)<<" "<<fEtaHighBinLimits.GetBinContent(det,ir,v)<<std::endl;
254 //____________________________________________________________________
256 void AliFMDAnaParameters::PrintStatus() const
258 //Print current status
259 TString energystring;
262 energystring.Form("900 GeV"); break;
264 energystring.Form("7000 GeV"); break;
266 energystring.Form("10000 GeV"); break;
268 energystring.Form("14000 GeV"); break;
270 energystring.Form("invalid energy"); break;
272 TString triggerstring;
275 triggerstring.Form("Minimum bias 1"); break;
277 triggerstring.Form("Minimum bias 2"); break;
279 triggerstring.Form("SPD FAST OR"); break;
281 triggerstring.Form("NO TRIGGER TEST"); break;
283 energystring.Form("invalid trigger"); break;
288 magstring.Form("5 kGaus"); break;
290 magstring.Form("0 kGaus"); break;
292 magstring.Form("invalid mag field"); break;
294 TString collsystemstring;
297 collsystemstring.Form("p+p"); break;
299 collsystemstring.Form("Pb+Pb"); break;
301 collsystemstring.Form("invalid collision system"); break;
305 std::cout<<"Energy = "<<energystring.Data()<<std::endl;
306 std::cout<<"Trigger = "<<triggerstring.Data()<<std::endl;
307 std::cout<<"Mag Field = "<<magstring.Data()<<std::endl;
308 std::cout<<"Coll System = "<<collsystemstring.Data()<<std::endl;
314 //____________________________________________________________________
315 Float_t AliFMDAnaParameters::GetVtxCutZ() {
316 //Get the z vtx cut in analysis
318 AliWarning("Not initialized yet. Call Init() to remedy");
322 return fBackground->GetVtxCutZ();
325 //____________________________________________________________________
326 Int_t AliFMDAnaParameters::GetNvtxBins() {
327 //Get number of vtx bins
329 AliWarning("Not initialized yet. Call Init() to remedy");
333 return fBackground->GetNvtxBins();
335 //____________________________________________________________________
336 TH1F* AliFMDAnaParameters::GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta) {
338 return fEnergyDistribution->GetEnergyDistribution(det, ring, eta);
340 //____________________________________________________________________
341 TH1F* AliFMDAnaParameters::GetEmptyEnergyDistribution(Int_t det, Char_t ring) {
343 return fEnergyDistribution->GetEmptyEnergyDistribution(det, ring);
345 //____________________________________________________________________
346 TH1F* AliFMDAnaParameters::GetRingEnergyDistribution(Int_t det, Char_t ring) {
348 return fEnergyDistribution->GetRingEnergyDistribution(det, ring);
350 //____________________________________________________________________
351 Float_t AliFMDAnaParameters::GetSigma(Int_t det, Char_t ring, Float_t eta) {
352 //Get sigma of Landau fits
354 AliWarning("Not initialized yet. Call Init() to remedy");
358 TH1F* hEnergyDist = GetEnergyDistribution(det,ring, eta);
359 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
361 //AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
364 Float_t sigma = fitFunc->GetParameter(2);
369 //____________________________________________________________________
370 Float_t AliFMDAnaParameters::GetMPV(Int_t det, Char_t ring, Float_t eta) {
371 //Get MPV of landau fits
373 AliWarning("Not initialized yet. Call Init() to remedy");
376 //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
377 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
378 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
380 AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
381 std::cout<<hEnergyDist->GetEntries()<<" "<<GetEtaBin(eta)<<std::endl;
385 Float_t mpv = fitFunc->GetParameter(1);
388 //____________________________________________________________________
389 Float_t AliFMDAnaParameters::GetConstant(Int_t det, Char_t ring, Float_t eta) {
390 //Get constant parameter of Landau fits
392 AliWarning("Not initialized yet. Call Init() to remedy");
396 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
397 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
399 AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
403 Float_t mpv = fitFunc->GetParameter(0);
406 //____________________________________________________________________
407 Float_t AliFMDAnaParameters::Get2MIPWeight(Int_t det, Char_t ring, Float_t eta) {
408 //Get 2 MIP weights of convoluted Landau fits
410 AliWarning("Not initialized yet. Call Init() to remedy");
414 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
415 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
416 if(!fitFunc) return 0;
417 Float_t twoMIPweight = fitFunc->GetParameter(3);
421 if(twoMIPweight < 1e-05)
426 //____________________________________________________________________
427 Float_t AliFMDAnaParameters::Get3MIPWeight(Int_t det, Char_t ring, Float_t eta) {
428 //Get 3 MIP weights of convoluted Landau fits
430 AliWarning("Not initialized yet. Call Init() to remedy");
434 TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
435 TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
436 if(!fitFunc) return 0;
437 Float_t threeMIPweight = fitFunc->GetParameter(4);
439 if(threeMIPweight < 1e-05)
442 Float_t twoMIPweight = fitFunc->GetParameter(3);
444 if(twoMIPweight < 1e-05)
447 return threeMIPweight;
449 //____________________________________________________________________
450 Int_t AliFMDAnaParameters::GetNetaBins() {
451 return GetBackgroundCorrection(1,'I',0)->GetNbinsX();
454 //____________________________________________________________________
455 Float_t AliFMDAnaParameters::GetEtaMin() {
457 return GetBackgroundCorrection(1,'I',0)->GetXaxis()->GetXmin();
459 //____________________________________________________________________
460 Float_t AliFMDAnaParameters::GetEtaMax() {
462 return GetBackgroundCorrection(1,'I',0)->GetXaxis()->GetXmax();
465 //____________________________________________________________________
466 Int_t AliFMDAnaParameters::GetEtaBin(Float_t eta) {
467 TAxis testaxis(GetNetaBins(),GetEtaMin(),GetEtaMax());
468 Int_t binnumber = testaxis.FindBin(eta) ;
473 //____________________________________________________________________
475 TH2F* AliFMDAnaParameters::GetBackgroundCorrection(Int_t det,
478 //Get background correction histogram
480 AliWarning("Not initialized yet. Call Init() to remedy");
486 if(vtxbin > fBackground->GetNvtxBins()) {
487 AliWarning(Form("No background object for vertex bin %d", vtxbin));
491 return fBackground->GetBgCorrection(det,ring,vtxbin);
493 //____________________________________________________________________
495 TH1F* AliFMDAnaParameters::GetDoubleHitCorrection(Int_t det,
497 //Get correction for several hits in strips for p+p
499 AliWarning("Not initialized yet. Call Init() to remedy");
503 return fBackground->GetDoubleHitCorrection(det,ring);
505 //_____________________________________________________________________
506 TH1F* AliFMDAnaParameters::GetSPDDeadCorrection(Int_t vtxbin) {
508 //Get correction for several hits in strips for p+p
510 AliWarning("Not initialized yet. Call Init() to remedy");
514 return fBackground->GetSPDDeadCorrection(vtxbin);
516 //_____________________________________________________________________
517 Float_t AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin) {
518 //Get event selection efficiency object
520 AliWarning("Not initialized yet. Call Init() to remedy");
523 return fEventSelectionEfficiency->GetCorrection(vtxbin);
526 //_____________________________________________________________________
527 TH2F* AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin, Char_t ring) {
528 //Get event selection efficiency object
530 AliWarning("Not initialized yet. Call Init() to remedy");
533 return fEventSelectionEfficiency->GetCorrection(vtxbin,ring);
536 //_____________________________________________________________________
537 TH1F* AliFMDAnaParameters::GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin) {
538 //Get sharing efficiency object
540 AliWarning("Not initialized yet. Call Init() to remedy");
544 return fSharingEfficiency->GetSharingEff(det,ring,vtxbin);
547 //_____________________________________________________________________
548 TH1F* AliFMDAnaParameters::GetSharingEfficiencyTrVtx(Int_t det, Char_t ring, Int_t vtxbin) {
549 //Get sharing efficiency object TrVtx
551 AliWarning("Not initialized yet. Call Init() to remedy");
555 return fSharingEfficiency->GetSharingEffTrVtx(det,ring,vtxbin);
558 //_____________________________________________________________________
559 Float_t AliFMDAnaParameters::GetMaxR(Char_t ring) const {
567 AliWarning("Unknown ring - must be I or O!");
571 //_____________________________________________________________________
572 Float_t AliFMDAnaParameters::GetMinR(Char_t ring) const{
580 AliWarning("Unknown ring - must be I or O!");
585 //_____________________________________________________________________
586 void AliFMDAnaParameters::SetCorners(Char_t ring) {
587 //Set corners (taken from nominal geometry)
589 fCorner1.Set(4.9895, 15.3560);
590 fCorner2.Set(1.8007, 17.2000);
593 fCorner1.Set(4.2231, 26.6638);
594 fCorner2.Set(1.8357, 27.9500);
598 //_____________________________________________________________________
599 Float_t AliFMDAnaParameters::GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const
601 //Get phi from sector
602 Int_t nsec = (ring == 'I' ? 20 : 40);
605 basephi = 1.72787594;
606 if(det == 2 && ring == 'I')
607 basephi = 0.15707963;
608 if(det == 2 && ring == 'O')
609 basephi = 0.078539818;
610 if(det == 3 && ring == 'I')
611 basephi = 2.984513044;
612 if(det == 3 && ring == 'O')
613 basephi = 3.06305289;
615 Float_t step = 2*TMath::Pi() / nsec;
618 phi = basephi - sec*step;
620 phi = basephi + sec*step;
623 phi = phi +2*TMath::Pi();
624 if(phi > 2*TMath::Pi() )
625 phi = phi - 2*TMath::Pi();
629 //_____________________________________________________________________
630 Float_t AliFMDAnaParameters::GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const
632 //Calculate eta from strip with vertex (redundant with AliESDFMD::Eta)
633 Float_t rad = GetMaxR(ring)-GetMinR(ring);
634 Float_t nStrips = (ring == 'I' ? 512 : 256);
635 Float_t segment = rad / nStrips;
636 Float_t r = GetMinR(ring) + segment*strip;
638 Int_t hybrid = sec / 2;
641 if(!(hybrid%2)) z = 320.266; else z = 319.766;
643 if(det == 2 && ring == 'I' ) {
644 if(!(hybrid%2)) z = 83.666; else z = 83.166;
646 if(det == 2 && ring == 'O' ) {
647 if(!(hybrid%2)) z = 74.966; else z = 75.466;
649 if(det == 3 && ring == 'I' ) {
650 if(!(hybrid%2)) z = -63.066; else z = -62.566;
652 if(det == 3 && ring == 'O' ) {
653 if(!(hybrid%2)) z = -74.966; else z = -75.466;
656 //std::cout<<det<<" "<<ring<<" "<<sec<<" "<<hybrid<<" "<<z<<std::endl;
658 // Float_t r = TMath::Sqrt(TMath::Power(x,2)+TMath::Power(y,2));
659 Float_t theta = TMath::ATan2(r,z-zvtx);
660 Float_t eta = -1*TMath::Log(TMath::Tan(0.5*theta));
665 //_____________________________________________________________________
667 Bool_t AliFMDAnaParameters::GetVertex(const AliESDEvent* esd, Double_t* vertexXYZ)
669 //Get the vertex from the ESD
670 const AliESDVertex* vertex = 0;
671 vertex = esd->GetPrimaryVertexSPD();
674 vertex->GetXYZ(vertexXYZ);
676 //if(vertexXYZ[0] == 0 || vertexXYZ[1] == 0 )
679 if(vertex->GetNContributors() <= 0)
682 if(vertex->GetZRes() > 0.1 )
685 return vertex->GetStatus();
688 //____________________________________________________________________
689 Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd, Trigger trig) {
690 //Did we have trig trigger ?
691 Trigger old = fTrigger;
693 Bool_t retval = IsEventTriggered(esd);
698 //____________________________________________________________________
699 Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd) const {
700 // check if the event was triggered
702 if (fCentralSelection) return kTRUE;
703 ULong64_t triggerMask = esd->GetTriggerMask();
705 TString triggers = esd->GetFiredTriggerClasses();
707 //if(triggers.Contains("CINT1B-ABCE-NOPF-ALL") || triggers.Contains("CINT1B-E-NOPF-ALL")) return kTRUE;
708 //else return kFALSE;
709 //if(triggers.Contains("CINT1B-E-NOPF-ALL")) return kFALSE;
711 // if(triggers.Contains("CINT1A-ABCE-NOPF-ALL")) return kFALSE;
712 // if(triggers.Contains("CINT1C-ABCE-NOPF-ALL")) return kFALSE;
714 // definitions from p-p.cfg
715 ULong64_t spdFO = (1 << 14);
716 ULong64_t v0left = (1 << 11);
717 ULong64_t v0right = (1 << 12);
718 AliTriggerAnalysis tAna;
720 //REMOVE WHEN FINISHED PLAYING WITH TRIGGERS!
721 //fPhysicsSelection->IsCollisionCandidate(esd);
723 fPhysicsSelection->SetAnalyzeMC(kTRUE);
728 if( fPhysicsSelection->IsCollisionCandidate(esd))
732 // if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right)))
738 if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
743 if (triggerMask & spdFO)
753 const AliMultiplicity* testmult = esd->GetMultiplicity();
754 Int_t nTrackLets = testmult->GetNumberOfTracklets();
755 Int_t nClusters = testmult->GetNumberOfSingleClusters();
756 Int_t fastOR = tAna.SPDFiredChips(esd, 0);
758 const AliESDVertex* vertex = 0;
759 vertex = esd->GetPrimaryVertexSPD();
760 Bool_t vtxstatus = vertex->GetStatus();
761 if(vertex->GetNContributors() <= 0)
764 if(vertex->GetZRes() > 0.1 )
767 Bool_t v0ABG = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0ABG);
769 Bool_t v0CBG = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0CBG);
770 Bool_t v0A = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0A);
771 Bool_t v0C = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0C);*/
772 // if(triggers.Contains("CINT1A-ABCE-NOPF-ALL") || triggers.Contains("CINT1C-ABCE-NOPF-ALL"))
773 if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL"))
783 //____________________________________________________________________
785 AliFMDAnaParameters::GetStripLength(Char_t ring, UShort_t strip)
787 //Get length of a strip
789 Float_t rad = GetMaxR(ring)-GetMinR(ring);
790 Float_t nStrips = (ring == 'I' ? 512 : 256);
791 Float_t segment = rad / nStrips;
793 //TVector2* corner1 = fmdring.GetVertex(2);
794 // TVector2* corner2 = fmdring.GetVertex(3);
798 std::cout<<GetMaxR(ring)<<" "<<fmdring.GetMaxR()<<std::endl;
799 std::cout<<GetMinR(ring)<<" "<<fmdring.GetMinR()<<std::endl;
800 std::cout<<corner1->X()<<" "<<fCorner1.X()<<std::endl;
801 std::cout<<corner2->X()<<" "<<fCorner2.X()<<std::endl;
802 std::cout<<corner1->Y()<<" "<<fCorner1.Y()<<std::endl;
803 std::cout<<corner2->Y()<<" "<<fCorner2.Y()<<std::endl;*/
804 Float_t slope = (fCorner1.Y() - fCorner2.Y()) / (fCorner1.X() - fCorner2.X());
805 Float_t constant = (fCorner2.Y()*fCorner1.X()-(fCorner2.X()*fCorner1.Y())) / (fCorner1.X() - fCorner2.X());
806 Float_t radius = GetMinR(ring) + strip*segment;
808 Float_t d = TMath::Power(TMath::Abs(radius*slope),2) + TMath::Power(radius,2) - TMath::Power(constant,2);
810 Float_t arclength = GetBaseStripLength(ring,strip);
813 Float_t x = (-1*TMath::Sqrt(d) -slope*constant) / (1+TMath::Power(slope,2));
814 Float_t y = slope*x + constant;
815 Float_t theta = TMath::ATan2(x,y);
817 if(x < fCorner1.X() && y > fCorner1.Y()) {
818 arclength = radius*theta; //One sector since theta is by definition half-hybrid
828 //____________________________________________________________________
830 AliFMDAnaParameters::GetBaseStripLength(Char_t ring, UShort_t strip)
832 //Get length of strip assuming that corners are not cut away
833 Float_t rad = GetMaxR(ring)-GetMinR(ring);
834 Float_t nStrips = (ring == 'I' ? 512 : 256);
835 Float_t nSec = (ring == 'I' ? 20 : 40);
836 Float_t segment = rad / nStrips;
837 Float_t basearc = 2*TMath::Pi() / (0.5*nSec); // One hybrid: 36 degrees inner, 18 outer
838 Float_t radius = GetMinR(ring) + strip*segment;
839 Float_t basearclength = 0.5*basearc * radius; // One sector
841 return basearclength;
843 //____________________________________________________________________
844 Int_t AliFMDAnaParameters::GetFirstEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring)
846 TH2F* hBg = GetBackgroundCorrection(det,ring,vtxbin);
848 if(det == 0) return hBg->GetXaxis()->FindBin(-1.95);
851 Int_t nNonZeroFirst = 0;
853 for(Int_t i=1;i<=hBg->GetNbinsX();i++) {
854 if(nNonZeroFirst == fNumberOfEtaBinsToCut && firstbin==-1) firstbin = i;
856 for(Int_t j=1;j<=hBg->GetNbinsY();j++) {
858 Float_t value = hBg->GetBinContent(i,j);
860 if(value > 0.001 && nNonZeroFirst<fNumberOfEtaBinsToCut)
861 {nNonZeroFirst++; break;}
870 //____________________________________________________________________
871 Int_t AliFMDAnaParameters::GetLastEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring)
873 TH2F* hBg = GetBackgroundCorrection(det,ring,vtxbin);
875 Int_t nNonZeroLast = 0;
877 if(det == 0) return hBg->GetXaxis()->FindBin(1.95);
879 for(Int_t i=hBg->GetNbinsX();i>0;i--) {
880 if(nNonZeroLast == fNumberOfEtaBinsToCut && lastbin==-1) lastbin = i;
882 for(Int_t j=1;j<=hBg->GetNbinsY();j++) {
884 Float_t value = hBg->GetBinContent(i,j);
886 if(value > 0.001 && nNonZeroLast<fNumberOfEtaBinsToCut)
887 {nNonZeroLast++; break; }
896 //____________________________________________________________________
897 Int_t AliFMDAnaParameters::GetFirstEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring)
899 Int_t ringNumber = (ring == 'I' ? 0 : 1);
900 return fEtaLowBinLimits.GetBinContent(det,ringNumber,vtxbin);
904 //____________________________________________________________________
905 Int_t AliFMDAnaParameters::GetLastEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring)
907 Int_t ringNumber = (ring == 'I' ? 0 : 1);
908 return fEtaHighBinLimits.GetBinContent(det,ringNumber,vtxbin);
911 //____________________________________________________________________