]>
Commit | Line | Data |
---|---|---|
bea63bea | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
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 | /* $Id$ */ | |
bea63bea | 17 | //_________________________________________________________________________ |
5f20d3fb | 18 | // Version of AliPHOSv1 which keeps all hits in TreeH |
19 | // AddHit, StepManager,and FinishEvent are redefined | |
bea63bea | 20 | // |
5f20d3fb | 21 | //*-- Author: Gines MARTINEZ (SUBATECH) |
bea63bea | 22 | |
23 | ||
24 | // --- ROOT system --- | |
5f20d3fb | 25 | |
26 | #include "TBRIK.h" | |
27 | #include "TNode.h" | |
bea63bea | 28 | #include "TRandom.h" |
29 | ||
30 | // --- Standard library --- | |
31 | ||
32 | #include <stdio.h> | |
33 | #include <string.h> | |
34 | #include <stdlib.h> | |
35 | #include <strstream.h> | |
36 | ||
37 | // --- AliRoot header files --- | |
38 | ||
39 | #include "AliPHOSv2.h" | |
40 | #include "AliPHOSHit.h" | |
41 | #include "AliPHOSDigit.h" | |
5f20d3fb | 42 | #include "AliPHOSReconstructioner.h" |
bea63bea | 43 | #include "AliRun.h" |
44 | #include "AliConst.h" | |
45 | ||
46 | ClassImp(AliPHOSv2) | |
47 | ||
5f20d3fb | 48 | //____________________________________________________________________________ |
49 | AliPHOSv2::AliPHOSv2() | |
50 | { | |
51 | // default ctor | |
52 | fNTmpHits = 0 ; | |
53 | fTmpHits = 0 ; | |
54 | } | |
55 | ||
bea63bea | 56 | //____________________________________________________________________________ |
57 | AliPHOSv2::AliPHOSv2(const char *name, const char *title): | |
5f20d3fb | 58 | AliPHOSv1(name,title) |
bea63bea | 59 | { |
5f20d3fb | 60 | // ctor |
61 | fHits= new TClonesArray("AliPHOSHit",1000) ; | |
bea63bea | 62 | } |
63 | ||
64 | //____________________________________________________________________________ | |
5f20d3fb | 65 | AliPHOSv2::~AliPHOSv2() |
bea63bea | 66 | { |
5f20d3fb | 67 | // dtor |
68 | if ( fTmpHits) { | |
69 | fTmpHits->Delete() ; | |
70 | delete fTmpHits ; | |
71 | fTmpHits = 0 ; | |
72 | } | |
73 | ||
74 | if ( fEmcRecPoints ) { | |
75 | fEmcRecPoints->Delete() ; | |
76 | delete fEmcRecPoints ; | |
77 | fEmcRecPoints = 0 ; | |
78 | } | |
79 | ||
80 | if ( fPpsdRecPoints ) { | |
81 | fPpsdRecPoints->Delete() ; | |
82 | delete fPpsdRecPoints ; | |
83 | fPpsdRecPoints = 0 ; | |
84 | } | |
85 | ||
86 | if ( fTrackSegments ) { | |
87 | fTrackSegments->Delete() ; | |
88 | delete fTrackSegments ; | |
89 | fTrackSegments = 0 ; | |
90 | } | |
bea63bea | 91 | } |
92 | ||
93 | //____________________________________________________________________________ | |
5f20d3fb | 94 | void AliPHOSv2::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits) |
95 | { | |
96 | // Add a hit to the hit list. | |
fca6f6ef | 97 | // A PHOS hit is the sum of all hits in a single crystal |
98 | // or in a single PPSD gas cell | |
5f20d3fb | 99 | |
fca6f6ef | 100 | Int_t hitCounter ; |
101 | TClonesArray <mphits = *fTmpHits ; | |
5f20d3fb | 102 | AliPHOSHit *newHit ; |
fca6f6ef | 103 | AliPHOSHit *curHit ; |
104 | Bool_t deja = kFALSE ; | |
5f20d3fb | 105 | |
fca6f6ef | 106 | // In any case, fills the fTmpHit TClonesArray (with "accumulated hits") |
5f20d3fb | 107 | |
fca6f6ef | 108 | newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ; |
5f20d3fb | 109 | |
fca6f6ef | 110 | // We do want to save in TreeH the raw hits |
111 | TClonesArray &lhits = *fHits; | |
5f20d3fb | 112 | |
fca6f6ef | 113 | for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) { |
114 | curHit = (AliPHOSHit*) ltmphits[hitCounter] ; | |
115 | if( *curHit == *newHit ) { | |
116 | *curHit = *curHit + *newHit ; | |
117 | deja = kTRUE ; | |
5f20d3fb | 118 | } |
119 | } | |
fca6f6ef | 120 | |
121 | if ( !deja ) { | |
122 | new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ; | |
123 | fNTmpHits++ ; | |
5f20d3fb | 124 | } |
125 | ||
fca6f6ef | 126 | // We do want to save in TreeH the raw hits |
127 | new(lhits[fNhits]) AliPHOSHit(*newHit) ; | |
128 | fNhits++ ; | |
bea63bea | 129 | |
fca6f6ef | 130 | // Please note that the fTmpHits array must survive up to the |
131 | // end of the events, so it does not appear e.g. in ResetHits() ( | |
132 | // which is called at the end of each primary). | |
bea63bea | 133 | |
fca6f6ef | 134 | delete newHit; |
5f20d3fb | 135 | |
bea63bea | 136 | } |
137 | ||
fca6f6ef | 138 |