Updated macros for PHOS alignment calculation
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTRDTriggerComponent.h
1 //-*- Mode: C++ -*-
2 // $Id$
3 #ifndef ALIHLTTRDTRIGGERCOMPONENT_H
4 #define ALIHLTTRDTRIGGERCOMPONENT_H
5
6 //* This file is property of and copyright by the ALICE HLT Project        *
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /// @file   AliHLTTRDTriggerComponent.h
11 /// @author Felix Rettig, Stefan Kirsch
12 /// @date   2012-08-16
13 /// @brief
14
15 #include "TString.h"
16 #include "AliHLTTrigger.h"
17 #include "AliESDEvent.h"
18 #include "AliESDTrdTrack.h"
19 #include "AliExternalTrackParam.h"
20 #include "AliTRDgeometry.h"
21 #ifdef __TRDHLTDEBUG
22   #include "AliTRDtrackingEventDisplay.h"
23 #endif
24
25 #define trd_det_lsi(det) ((det) / 6)               // convert TRD detector/chamber 0-539 index to linear stack index 0-89
26 #define trd_det_lyr(det) ((det) % 6)               // convert detector (=chamber) number 0-539 to local layer 0-5
27 #define trd_det_si(det) (((det) % 30) / 6)         // convert detector (=chamber) number 0-539 to local stack index 0-4
28
29 class TObjArray;
30 class TH1I;
31 class TH2I;
32 class AliHLTComponentBenchmark;
33 class AliESDtrack;
34 class AliHLTGlobalBarrelTrack;
35 class AliESDtrackCuts;
36 class AliHLTESDTrackCuts;
37 class AliTRDonlineTrackingDataContainer;
38
39 /**
40  * @class  AliHLTTRDTriggerComponent
41  */
42 class AliHLTTRDTriggerComponent : public AliHLTTrigger
43 {
44  public:
45
46   AliHLTTRDTriggerComponent();
47   virtual ~AliHLTTRDTriggerComponent();
48
49   virtual const char* GetTriggerName() const;
50   virtual AliHLTComponent* Spawn();
51
52  protected:
53   int DoInit(int argc, const char** argv);
54   int DoDeinit();
55   int Reconfigure(const char* cdbEntry, const char* chainId);
56   int ReadPreprocessorValues(const char* modules);
57   int ConfigureFromCDBObject(TString cdbPath);
58   int ScanConfigurationArgument(int argc, const char** argv);
59
60  private:
61   AliHLTTRDTriggerComponent (const AliHLTTRDTriggerComponent&);
62   AliHLTTRDTriggerComponent& operator=(const AliHLTTRDTriggerComponent&);
63   virtual int DoTrigger();
64
65   Bool_t CheckRefTrackCuts(AliESDtrack* track);
66
67   // TRD-trigger specific
68   void ScanTriggerClasses(const char* firedTriggerClasses);
69   int PrepareESDData();
70   int PrepareHLTData();
71   int PrepareTRDData();
72   int MatchTRDTracks();
73   int MatchTRDTracksESD();
74   int MatchTRDTracksHLT();
75   Bool_t TRDElectronTrigger(const char *ident, const Double_t minPt, const UShort_t minPID);
76
77   Bool_t TrackPlaneIntersect(AliExternalTrackParam *trk, Double_t pnt[3], Double_t norm[3], Double_t mag);
78
79   Int_t EstimateTrackDistance(AliExternalTrackParam *refParam,
80                                  const UShort_t stack,
81                                  const UShort_t layerMask,
82                                  const Float_t trklLocalY[6], const Int_t trklBinZ[6],
83                                  Double_t mag, Double_t *ydist, Double_t *zdist);
84
85   Int_t EstimateTrackDistance(AliESDtrack *esd_track,
86                                  const UShort_t stack,
87                                  const UShort_t layerMask,
88                                  const Float_t trklLocalY[6], const Int_t trklBinZ[6],
89                                  Double_t mag, Double_t *ydist, Double_t *zdist);
90
91   Double_t RateTrackMatch(Double_t distY, Double_t distZ, Double_t rpt, Double_t gpt);
92
93   void DumpTrackingData();
94   void AssignTrackInfo(TString* infoStr, const UInt_t stack, const UInt_t trackIndex, const char* flagStr = "");
95 #ifdef __TRDHLTDEBUG
96   void RenderEvent(const Bool_t showGtuTracks = kTRUE, const Bool_t showTracklets = kTRUE, const Bool_t showRefTracks = kTRUE);
97 #endif
98   void DbgLog(const char* prefix, ...);
99
100   TString  fName;                           //! trigger name
101   Double_t fRefTrackSelectionEtaLimit;      //! ref track preselection maximum eta
102   Double_t fRefTrackSelectionVertexXYLimit; //! ref track preselection maximum distance to ip in XY plane
103   Double_t fRefTrackSelectionVertexZLimit;  //! ref track preselection maximum distance to ip in Z
104   Double_t fRefTrackSelectionPtThreshold;   //! pt threshold for ref track preselection in GeV/c
105   Double_t fMatchRatingThreshold;           //! track match rating threshold
106   Double_t fElectronTriggerPtThresholdHSE;  //! pt threshold for HSE electron trigger
107   UShort_t fElectronTriggerPIDThresholdHSE; //! PID threshold for HSE electron trigger
108   Double_t fElectronTriggerPtThresholdHQU;  //! pt threshold for HQU electron trigger
109   UShort_t fElectronTriggerPIDThresholdHQU; //! PID threshold for HQU electron trigger
110   Bool_t fApplyRefTrackCuts;                //! switch on/off ref track cuts for matching
111   Bool_t fElectronTriggerOnL1TrgOnly;       //! run electron trigger only for events with L1 electron trigger
112   UShort_t fHistoMode;                      //! histogramming mode, 0: single event, 1: accumulative (debugging)
113   UShort_t fDebugLevel;                     //! set debug checks/output level, 0: debug off
114   Bool_t fExtendedHistos;                   //! switch on/off additional histograms
115   Bool_t fEventRendering;                   //! switch on/off event rendering
116   Bool_t fPushHistos;                       //! switch on/off pushing of histograms event by event
117   Bool_t fWriteHistos;                      //! switch on/off histogram writing on deinit
118
119   static const char* fgkDefaultOCDBEntry;                    //! default OCDB entry
120   static const char* fgkTriggerDecisionElectronHSE;          //! electron trigger flag string
121   static const char* fgkTriggerDecisionElectronHQU;          //! electron trigger flag string
122
123   static const AliHLTEventID_t fgkInvalidEventId = 0xffffffffffffffffllu;
124   static const unsigned int fkTRDLayers = 6;                 //! number of layers per stack in TRD
125   static const unsigned int fkTRDStacks = 90;                //! number of stacks in TRD
126   static const unsigned int fkTRDSectors = 18;               //! number of sectors in TRD
127   static const unsigned int fkMaxRefTracksPerStack = 25000;  //! maximum number of ref tracks per stack
128   static const unsigned int fkMaxRefTracks = 25000;          //! maximum number of ref tracks
129
130   static const unsigned int fkElectronTriggerHSE = 0x1;      //! HSE electron trigger flag
131   static const unsigned int fkElectronTriggerHQU = 0x2;      //! HSE electron trigger flag
132
133   AliHLTEventID_t fEventId;                                  //! hlt internal event id
134   Int_t fRunNumber;                                          //! run number
135   TString* fChunkId;                                         //! chunk identifier
136   UInt_t fSectorsWithData;                                   //! data present flags for each sector
137   Bool_t fIsMinBiasEvent;                                    //! indicates a minimum bias event
138   Bool_t fIsTRDElectronEvent;                                //! indicates a TRD L1 electron triggered event
139   Bool_t fESDtracksPresent;                                  //! indicates that ESD tracks are present
140   Bool_t fHLTtracksPresent;                                  //! indicates that HLT raw tracks are present
141
142   AliTRDgeometry* fTRDGeometry;                              //! instance of TRD geometry
143   AliESDEvent* fEsdEvent;                                    //! current ESD event
144   AliTRDonlineTrackingDataContainer* fTrackingData;          //! container for TRD tracking data
145   vector<AliHLTGlobalBarrelTrack>* fHLTTracks;               //! HLT raw tracks
146   AliESDtrackCuts* fRefTrackCuts;                            //! reference track cuts
147
148 #ifdef __TRDHLTDEBUG
149   AliTRDtrackingEventDisplay* fEventDisplay;                 //! event rendering
150   AliHLTComponentBenchmark* fBenchmark;                      //! benchmark instance
151 #endif
152
153   TObjArray* fHistArray;
154   TH1I* fHistMatchRating;                                    //! histo
155   TH2I* fHistMatchRatingByPt;                                //! histo
156   TH2I* fHistMatchRatingByPid;                               //! histo
157   TH1I* fHistTrackPt;                                        //! histo
158   TH1I* fHistTrackPtMatched;                                 //! histo
159   TH2I* fHistTrackPtCorr;                                    //! histo
160   TH1I* fHistTrackPid;                                       //! histo
161   TH1I* fHistTrackPidMatched;                                //! histo
162   TH1I* fHistElectronCandidatePt;                            //! histo
163   TH1I* fHistElectronCandidateMatchedPt;                     //! histo
164   TH1I* fHistElectronCandidatePid;                           //! histo
165   TH1I* fHistElectronCandidateMatchedPid;                    //! histo
166   TH2I* fHistRefTrackPid;                                    //! histo
167   TH2I* fHistMatchedRefTrackPid;                             //! histo
168   TH2I* fHistPIDvsTruncPID;                                  //! histo
169   TH2I* fHistElectronFalsePIDvsTruncPID;                     //! histo
170   TH2I* fHistElectronConfirmedPIDvsTruncPID;                 //! histo
171   TH2I* fHistTrackMatchingCombinations;                      //! histo
172   TH1I* fHistElectronTriggerBaseMinBias;                     //! histo
173   TH1I* fHistElectronTriggerBaseTrdL1;                       //! histo
174
175   ClassDef(AliHLTTRDTriggerComponent, 0)
176 };
177
178 #endif //ALIHLTTRDTRIGGERCOMPONENT_H