]>
Commit | Line | Data |
---|---|---|
78cc8fa3 | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: Oystein Djuvsland * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | #include "AliHLTPHOSMIPCounter.h" | |
17 | #include "AliHLTPHOSDigitContainerDataStruct.h" | |
18 | #include "TH2I.h" | |
19 | ||
20 | AliHLTPHOSMIPCounter::AliHLTPHOSMIPCounter() | |
21 | : AliHLTPHOSBase(), | |
22 | fMIPCountEvent ( 0 ), | |
23 | fMIPCountTotal ( 0 ), | |
24 | fMIPRate ( 0 ), | |
25 | fLowerBound ( 0 ), | |
26 | fUpperBound ( 0 ), | |
27 | fUpperStartTime ( 0 ), | |
28 | fLowerStartTime ( 0 ), | |
29 | fZeroThreshold ( 0 ), | |
30 | fChannelHistPtr ( 0 ) | |
31 | { | |
32 | ||
33 | } | |
34 | ||
35 | ||
36 | AliHLTPHOSMIPCounter::~AliHLTPHOSMIPCounter() | |
37 | { | |
38 | } | |
39 | ||
40 | Int_t | |
41 | AliHLTPHOSMIPCounter::CountMIPs(AliHLTPHOSDigitContainerDataStruct* digitContainerPtr) | |
42 | { | |
43 | fMIPCountEvent = 0; | |
44 | Bool_t IsMIP = true; | |
45 | Int_t *dataPtr = 0; | |
46 | AliHLTPHOSDigitDataStruct *digitPtr; | |
1804b020 | 47 | for(UInt_t i = 0; i < digitContainerPtr->fNDigits; i++) |
78cc8fa3 | 48 | { |
49 | digitPtr = &(digitContainerPtr->fDigitDataStruct[i]); | |
50 | dataPtr = digitPtr->fData; | |
51 | if(digitPtr->fCrazyness != 0) | |
52 | { | |
53 | continue; | |
54 | } | |
55 | if(digitPtr->fAmplitude < fLowerBound || digitPtr->fAmplitude > fUpperBound) | |
56 | { | |
57 | continue; | |
58 | } | |
59 | for(Int_t time = (Int_t)(digitPtr->fTime - 2); time < (digitPtr->fTime - 3); time++) | |
60 | { | |
61 | if((Float_t)dataPtr[time] < (digitPtr->fAmplitude - (digitPtr->fAmplitude)/10)) | |
62 | { | |
63 | IsMIP = false; | |
64 | break; | |
65 | } | |
66 | } | |
67 | if(!IsMIP) | |
68 | continue; | |
69 | for(Int_t sample = 0; sample < fLowerStartTime; sample++) | |
70 | { | |
71 | if(dataPtr[sample] > fZeroThreshold || dataPtr[sample] < -fZeroThreshold) | |
72 | { | |
73 | IsMIP = false; | |
74 | break; | |
75 | } | |
76 | } | |
77 | if(dataPtr[(Int_t)fUpperStartTime + 3] < fZeroThreshold) | |
78 | IsMIP = false; | |
79 | if(IsMIP) | |
80 | { | |
81 | fMIPCountEvent++; | |
82 | fChannelHistPtr->Fill(digitPtr->fX, digitPtr->fZ); | |
83 | } | |
84 | } | |
85 | fMIPCountTotal += fMIPCountEvent; | |
86 | return fMIPCountEvent; | |
87 | } |