]>
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): | |
e04976bd | 58 | AliPHOSv1(name,title) |
bea63bea | 59 | { |
5f20d3fb | 60 | // ctor |
e04976bd | 61 | |
5f20d3fb | 62 | fHits= new TClonesArray("AliPHOSHit",1000) ; |
bea63bea | 63 | } |
64 | ||
65 | //____________________________________________________________________________ | |
5f20d3fb | 66 | AliPHOSv2::~AliPHOSv2() |
bea63bea | 67 | { |
5f20d3fb | 68 | // dtor |
69 | if ( fTmpHits) { | |
70 | fTmpHits->Delete() ; | |
71 | delete fTmpHits ; | |
72 | fTmpHits = 0 ; | |
73 | } | |
74 | ||
75 | if ( fEmcRecPoints ) { | |
76 | fEmcRecPoints->Delete() ; | |
77 | delete fEmcRecPoints ; | |
78 | fEmcRecPoints = 0 ; | |
79 | } | |
80 | ||
81 | if ( fPpsdRecPoints ) { | |
82 | fPpsdRecPoints->Delete() ; | |
83 | delete fPpsdRecPoints ; | |
84 | fPpsdRecPoints = 0 ; | |
85 | } | |
86 | ||
87 | if ( fTrackSegments ) { | |
88 | fTrackSegments->Delete() ; | |
89 | delete fTrackSegments ; | |
90 | fTrackSegments = 0 ; | |
91 | } | |
bea63bea | 92 | } |
93 | ||
94 | //____________________________________________________________________________ | |
5f20d3fb | 95 | void AliPHOSv2::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits) |
96 | { | |
97 | // Add a hit to the hit list. | |
fca6f6ef | 98 | // A PHOS hit is the sum of all hits in a single crystal |
99 | // or in a single PPSD gas cell | |
5f20d3fb | 100 | |
fca6f6ef | 101 | Int_t hitCounter ; |
102 | TClonesArray <mphits = *fTmpHits ; | |
5f20d3fb | 103 | AliPHOSHit *newHit ; |
fca6f6ef | 104 | AliPHOSHit *curHit ; |
105 | Bool_t deja = kFALSE ; | |
5f20d3fb | 106 | |
fca6f6ef | 107 | // In any case, fills the fTmpHit TClonesArray (with "accumulated hits") |
5f20d3fb | 108 | |
fca6f6ef | 109 | newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ; |
5f20d3fb | 110 | |
fca6f6ef | 111 | // We do want to save in TreeH the raw hits |
112 | TClonesArray &lhits = *fHits; | |
5f20d3fb | 113 | |
fca6f6ef | 114 | for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) { |
115 | curHit = (AliPHOSHit*) ltmphits[hitCounter] ; | |
116 | if( *curHit == *newHit ) { | |
117 | *curHit = *curHit + *newHit ; | |
118 | deja = kTRUE ; | |
5f20d3fb | 119 | } |
120 | } | |
fca6f6ef | 121 | |
122 | if ( !deja ) { | |
123 | new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ; | |
124 | fNTmpHits++ ; | |
5f20d3fb | 125 | } |
126 | ||
fca6f6ef | 127 | // We do want to save in TreeH the raw hits |
128 | new(lhits[fNhits]) AliPHOSHit(*newHit) ; | |
129 | fNhits++ ; | |
bea63bea | 130 | |
fca6f6ef | 131 | // Please note that the fTmpHits array must survive up to the |
132 | // end of the events, so it does not appear e.g. in ResetHits() ( | |
133 | // which is called at the end of each primary). | |
bea63bea | 134 | |
fca6f6ef | 135 | delete newHit; |
5f20d3fb | 136 | |
bea63bea | 137 | } |
138 | ||
fca6f6ef | 139 |