]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGUD/multVScentPbPb/AliITSMultRecBg.h
Fix typo
[u/mrichter/AliRoot.git] / PWGUD / multVScentPbPb / AliITSMultRecBg.h
1 #ifndef ALIITSMULTRECBG_H
2 #define ALIITSMULTRECBG_H
3
4 ///////////////////////////////////////////////////////////////////////////////
5 //                                                                           //
6 // Class for generating combinatorial backgroung                             //
7 // for the SPD tracklets                                                     //
8 //                                                                           //
9 ///////////////////////////////////////////////////////////////////////////////
10
11 class TH2F;
12 class TTree;
13 #include <TArrayF.h>
14 #include "../ITS/AliITSMultReconstructor.h"
15 #include "../ITS/AliITSRecPoint.h"
16
17
18 class AliITSMultRecBg : public AliITSMultReconstructor 
19 {
20  public:
21   enum {kData,  // normal reconstruction
22         kBgRot, // bg with rotation
23         kBgInj, // bg with injection
24         kBgMix  // bg with mixing
25   };
26   //
27   AliITSMultRecBg();
28   virtual ~AliITSMultRecBg();
29   //
30   void    Run(TTree* tree, Float_t* vtx, TTree* treeMix=0);
31   //
32   void    SetRecType(UInt_t m=kData)                                  {fRecType = m;}
33   Int_t   GetRecType()                                          const {return fRecType;}
34   //
35   void    SetInjScale(Float_t s=1.)                  {fInjScale = s>0? s:1.;}
36   Int_t   GetNInjTrials(Int_t lr=-1)           const {return lr<0 ? fInjNTrials[0]+fInjNTrials[1] : fInjNTrials[lr];}
37   Int_t   GetNInjSuccsess(Int_t lr=-1)         const {return lr<0 ? fInjNSuccess[0]+fInjNSuccess[1] : fInjNSuccess[lr];}
38   //
39   void    Print(Option_t *opt=0)               const {AliITSMultReconstructor::Print(opt);}
40   //
41  protected:
42   virtual void CreateMultiplicityObject();
43   //
44   AliITSMultRecBg(const AliITSMultRecBg &src);
45   //     Injection stuff
46   void    GenInjBgSample(TTree* treeRP, Float_t *vtx);
47   Bool_t  PrepareInjBgGenerator(Float_t *vtx);
48   void    InitInjBg();
49   Bool_t  GenClusterToInject();
50   void    PlaceInjCluster();
51   Int_t   PickClusterPrototype(Int_t lr, Int_t ladInStave, Int_t stave2avoid);
52   UInt_t* GenClusterPattern(Int_t &npix, Int_t &ny, Int_t &nz, Float_t cy,Float_t &cz);
53   Int_t   SearchInjTracklet(const Float_t *vtx);
54   Int_t   GetPixelBitC(int stave, int chip,  int col, int row) const {return row+((col+((chip+stave*20)<<5))<<8);} // row + (col+ (chip + stave*20)*32)*256;
55   Int_t   GetPixelBitL(int stave, int ladder,int col, int row) const {return row+((col+(ladder+(stave<<2))*32*5)<<8);} // row + (col + (ladder + stave*4)*32*5)*256
56   void    ExtractPixelL(int id, int &stave, int &ladder, int &col, int &row) const;
57
58
59  private: 
60   AliITSMultRecBg& operator=(const AliITSMultRecBg& src);
61
62  protected:
63   enum {kInjFakeLabel=-999};
64   enum {kInjMaxNY=10, kInjMaxNZ=8};
65   //
66   Int_t fRecType;                            // what to generate: normal reco, injection etc.
67   //
68   // method specific members
69   //
70   // injection
71   Int_t    fInjLr;                            // injection layer
72   Int_t    fInjStave;                         // injection stave (counted from layer)
73   Int_t    fInjModule;                        // injection module (counted from layer)
74   Int_t    fInjModInStave;                    // injection module (counted from stave)
75   Double_t fInjX;                             // injection local X
76   Double_t fInjZ;                             // injection local Z
77   Int_t    fInjHitsN;                         // number of injected pixels
78   Int_t    fInjHits[256];                     // bit ids of injected pixels (GetPixelBitL/ExtractPixelL)
79   Int_t*   fAssociations[2];                  //! associations [0]: from L1 to L2, [1]: L2 to L1
80   Float_t  fInjScale;                         // scaling factor for generation
81   Int_t    fInjCurrTrial;                     // current trial id
82   Int_t    fInjNTrials[2];                    // number of injections per event for each layer
83   Int_t    fInjNSuccess[2];                   // number of successful injected tracklet generation
84   AliITSRecPoint fInjCluster;                 // fake cluster to inject
85   TH2F*    fInjSPDOcc[2];                     // occupancy in 2 SPD layers
86   TBits*   fInjSPDPatt[2];                    // occupancy pattern accounting for cluster types
87   Int_t*   fInjModuleClStart[2][4];           //! start of clusters for modules in given Z belt of each stave
88   Int_t*   fInjModuleClN[2][4];               //! number of clusters for modules in given Z belt of each stave
89   Int_t    fInjModuleTotClN[2][4];            // total number of clusters for modules in given Z belt
90   TArrayF  fInjBuffer;                        //! buffer for bg tracklets
91   //
92   ClassDef(AliITSMultRecBg,0)
93 };
94
95
96 inline void AliITSMultRecBg::ExtractPixelL(int id, int &stave, int &ladder, int &col, int &row) const
97 {
98   // get sensor data
99   enum {kNRow=256,kNCol=32*5,kNLadd=4};
100   row = id%kNRow;
101   id /= kNRow;
102   col = id%kNCol;
103   id /= kNCol;
104   ladder = id%kNLadd;
105   stave = id/kNLadd;
106 }
107
108
109 #endif