]>
Commit | Line | Data |
---|---|---|
7587f5a5 | 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 | ||
b2a60966 | 16 | /* $Id$ */ |
5f20d3fb | 17 | |
7587f5a5 | 18 | //_________________________________________________________________________ |
5f20d3fb | 19 | // Implementation version v1 of PHOS Manager class |
a3dfe79c | 20 | //--- |
21 | // Layout EMC + PPSD has name GPS2: | |
ed4205d8 | 22 | // Produces cumulated hits |
a3dfe79c | 23 | //--- |
24 | // Layout EMC + CPV has name IHEP: | |
ed4205d8 | 25 | // Produces hits for CPV, cumulated hits |
26 | //--- | |
27 | // Layout EMC + CPV + PPSD has name GPS: | |
28 | // Produces hits for CPV, cumulated hits | |
29 | //--- | |
5f20d3fb | 30 | //*-- Author: Yves Schutz (SUBATECH) |
b2a60966 | 31 | |
7587f5a5 | 32 | |
33 | // --- ROOT system --- | |
bea63bea | 34 | |
35 | #include "TBRIK.h" | |
36 | #include "TNode.h" | |
7587f5a5 | 37 | #include "TRandom.h" |
94de3818 | 38 | #include "TTree.h" |
7587f5a5 | 39 | |
5f20d3fb | 40 | |
7587f5a5 | 41 | // --- Standard library --- |
42 | ||
de9ec31b | 43 | #include <stdio.h> |
44 | #include <string.h> | |
45 | #include <stdlib.h> | |
46 | #include <strstream.h> | |
7587f5a5 | 47 | |
48 | // --- AliRoot header files --- | |
49 | ||
50 | #include "AliPHOSv1.h" | |
51 | #include "AliPHOSHit.h" | |
52 | #include "AliPHOSDigit.h" | |
bea63bea | 53 | #include "AliPHOSReconstructioner.h" |
7587f5a5 | 54 | #include "AliRun.h" |
55 | #include "AliConst.h" | |
94de3818 | 56 | #include "AliMC.h" |
7587f5a5 | 57 | |
58 | ClassImp(AliPHOSv1) | |
59 | ||
bea63bea | 60 | //____________________________________________________________________________ |
61 | AliPHOSv1::AliPHOSv1() | |
62 | { | |
5f20d3fb | 63 | // ctor |
fc879520 | 64 | |
3d402178 | 65 | // Create an empty array of AliPHOSCPVModule to satisfy |
fa412d9b | 66 | // AliPHOSv1::Streamer when reading root file |
ed4205d8 | 67 | |
68 | fReconstructioner = 0; | |
69 | fTrackSegmentMaker = 0; | |
037cc66d | 70 | |
71 | fHits = new TClonesArray("AliPHOSHit",1000) ; | |
ed4205d8 | 72 | |
037cc66d | 73 | // if ( 0==(fEMCModules=new TClonesArray("AliPHOSCPVModule",0)) ) { |
74 | // Error("AliPHOSv1","Can not create array of EMC modules"); | |
75 | // exit(1); | |
76 | // } | |
fa412d9b | 77 | |
037cc66d | 78 | // if ( 0==(fCPVModules=new TClonesArray("AliPHOSCPVModule",0)) ) { |
79 | // Error("AliPHOSv1","Can not create array of CPV modules"); | |
80 | // exit(1); | |
81 | // } | |
fc879520 | 82 | |
bea63bea | 83 | } |
84 | ||
7587f5a5 | 85 | //____________________________________________________________________________ |
86 | AliPHOSv1::AliPHOSv1(const char *name, const char *title): | |
e04976bd | 87 | AliPHOSv0(name,title) |
7587f5a5 | 88 | { |
5f20d3fb | 89 | // ctor : title is used to identify the layout |
fa412d9b | 90 | // GPS2 = 5 modules (EMC + PPSD) |
91 | // IHEP = 5 modules (EMC + CPV ) | |
ed4205d8 | 92 | // MIXT = 4 modules (EMC + CPV ) and 1 module (EMC + PPSD) |
5f20d3fb | 93 | // |
ed4205d8 | 94 | // We store hits : |
5f20d3fb | 95 | // - fHits (the "normal" one), which retains the hits associated with |
96 | // the current primary particle being tracked | |
97 | // (this array is reset after each primary has been tracked). | |
98 | // | |
fa412d9b | 99 | |
5f20d3fb | 100 | fPinElectronicNoise = 0.010 ; |
037cc66d | 101 | fDigitThreshold = 0.01 ; // 1 GeV |
102 | fDigitizeA= 0. ; | |
103 | fDigitizeB = 10000000. ; | |
104 | ||
5f20d3fb | 105 | |
106 | // We do not want to save in TreeH the raw hits | |
107 | // But save the cumulated hits instead (need to create the branch myself) | |
108 | // It is put in the Digit Tree because the TreeH is filled after each primary | |
fa412d9b | 109 | // and the TreeD at the end of the event (branch is set in FinishEvent() ). |
5f20d3fb | 110 | |
ed4205d8 | 111 | fHits= new TClonesArray("AliPHOSHit",1000) ; |
5f20d3fb | 112 | |
ed4205d8 | 113 | fNhits = 0 ; |
5f20d3fb | 114 | |
ed4205d8 | 115 | fReconstructioner = 0; |
116 | fTrackSegmentMaker = 0; | |
5f20d3fb | 117 | |
5f20d3fb | 118 | fIshunt = 1 ; // All hits are associated with primary particles |
fa412d9b | 119 | |
ed4205d8 | 120 | // Create array of EMC modules of the size of PHOS modules number |
121 | ||
037cc66d | 122 | // if ( 0==(fEMCModules=new TClonesArray("AliPHOSCPVModule",fGeom->GetNModules())) ) { |
123 | // Error("AliPHOSv1","Can not create array of EMC modules"); | |
124 | // exit(1); | |
125 | // } | |
126 | // TClonesArray &lemcmodule = *fEMCModules; | |
127 | // for (Int_t i=0; i<fGeom->GetNModules(); i++) new(lemcmodule[i]) AliPHOSCPVModule(); | |
ed4205d8 | 128 | |
fa412d9b | 129 | // Create array of CPV modules for the IHEP's version of CPV |
130 | ||
037cc66d | 131 | // if ( strcmp(fGeom->GetName(),"IHEP") == 0 || strcmp(fGeom->GetName(),"MIXT") == 0 ) { |
132 | // // Create array of CPV modules of the size of PHOS modules number | |
fa412d9b | 133 | |
037cc66d | 134 | // if ( 0==(fCPVModules=new TClonesArray("AliPHOSCPVModule",fGeom->GetNCPVModules())) ) { |
135 | // Error("AliPHOSv1","Can not create array of CPV modules"); | |
136 | // exit(1); | |
137 | // } | |
138 | // TClonesArray &lcpvmodule = *fCPVModules; | |
139 | // for (Int_t i=0; i<fGeom->GetNCPVModules(); i++) new(lcpvmodule[i]) AliPHOSCPVModule(); | |
140 | // } | |
141 | // else { | |
142 | // // Create an empty array of AliPHOSCPVModule to satisfy | |
143 | // // AliPHOSv1::Streamer when writing root file | |
fa412d9b | 144 | |
037cc66d | 145 | // fCPVModules=new TClonesArray("AliPHOSCPVModule",0); |
fa412d9b | 146 | |
037cc66d | 147 | // } |
5f20d3fb | 148 | } |
149 | ||
150 | //____________________________________________________________________________ | |
151 | AliPHOSv1::AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title): | |
152 | AliPHOSv0(name,title) | |
153 | { | |
154 | // ctor : title is used to identify the layout | |
155 | // GPS2 = 5 modules (EMC + PPSD) | |
156 | // We use 2 arrays of hits : | |
157 | // | |
158 | // - fHits (the "normal" one), which retains the hits associated with | |
159 | // the current primary particle being tracked | |
160 | // (this array is reset after each primary has been tracked). | |
161 | // | |
162 | // - fTmpHits, which retains all the hits of the current event. It | |
163 | // is used for the digitization part. | |
164 | ||
165 | fPinElectronicNoise = 0.010 ; | |
166 | ||
167 | // We do not want to save in TreeH the raw hits | |
168 | //fHits = new TClonesArray("AliPHOSHit",100) ; | |
169 | ||
ed4205d8 | 170 | fDigits = 0 ; |
171 | fHits= new TClonesArray("AliPHOSHit",1000) ; | |
b73f246d | 172 | |
ed4205d8 | 173 | fNhits = 0 ; |
5f20d3fb | 174 | |
175 | fIshunt = 1 ; // All hits are associated with primary particles | |
176 | ||
177 | // gets an instance of the geometry parameters class | |
178 | fGeom = AliPHOSGeometry::GetInstance(title, "") ; | |
179 | ||
180 | if (fGeom->IsInitialized() ) | |
88bdfa12 | 181 | cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << fGeom->GetName() << endl ; |
5f20d3fb | 182 | else |
fc879520 | 183 | cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ; |
5f20d3fb | 184 | |
185 | // Defining the PHOS Reconstructioner | |
186 | ||
187 | fReconstructioner = Reconstructioner ; | |
188 | ||
7587f5a5 | 189 | } |
b2a60966 | 190 | |
7587f5a5 | 191 | //____________________________________________________________________________ |
bea63bea | 192 | AliPHOSv1::~AliPHOSv1() |
b2a60966 | 193 | { |
bea63bea | 194 | // dtor |
5f20d3fb | 195 | |
ed4205d8 | 196 | if ( fHits) { |
197 | fHits->Delete() ; | |
198 | delete fHits ; | |
199 | fHits = 0 ; | |
8dfa469d | 200 | } |
5f20d3fb | 201 | |
037cc66d | 202 | if ( fSDigits) { |
203 | fSDigits->Delete() ; | |
204 | delete fSDigits ; | |
205 | fSDigits = 0 ; | |
206 | } | |
207 | ||
ed4205d8 | 208 | if ( fDigits) { |
209 | fDigits->Delete() ; | |
210 | delete fDigits ; | |
211 | fDigits = 0 ; | |
212 | } | |
5f20d3fb | 213 | |
ed4205d8 | 214 | if ( fEmcRecPoints ) { |
215 | fEmcRecPoints->Delete() ; | |
216 | delete fEmcRecPoints ; | |
217 | fEmcRecPoints = 0 ; | |
218 | } | |
219 | ||
220 | if ( fPpsdRecPoints ) { | |
221 | fPpsdRecPoints->Delete() ; | |
222 | delete fPpsdRecPoints ; | |
223 | fPpsdRecPoints = 0 ; | |
224 | } | |
fad3e5b9 | 225 | |
ed4205d8 | 226 | if ( fTrackSegments ) { |
227 | fTrackSegments->Delete() ; | |
228 | delete fTrackSegments ; | |
229 | fTrackSegments = 0 ; | |
230 | } | |
231 | ||
7587f5a5 | 232 | } |
233 | ||
7587f5a5 | 234 | //____________________________________________________________________________ |
037cc66d | 235 | void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits, Int_t trackpid, TLorentzVector p, Float_t * lpos) |
bea63bea | 236 | { |
237 | // Add a hit to the hit list. | |
5f20d3fb | 238 | // A PHOS hit is the sum of all hits in a single crystal |
239 | // or in a single PPSD gas cell | |
bea63bea | 240 | |
5f20d3fb | 241 | Int_t hitCounter ; |
bea63bea | 242 | AliPHOSHit *newHit ; |
5f20d3fb | 243 | AliPHOSHit *curHit ; |
244 | Bool_t deja = kFALSE ; | |
bea63bea | 245 | |
037cc66d | 246 | newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits, trackpid, p, lpos) ; |
bea63bea | 247 | |
7854a24a | 248 | for ( hitCounter = fNhits-1 ; hitCounter >= 0 && !deja ; hitCounter-- ) { |
ed4205d8 | 249 | curHit = (AliPHOSHit*) (*fHits)[hitCounter] ; |
250 | if( *curHit == *newHit ) { | |
251 | *curHit = *curHit + *newHit ; | |
252 | deja = kTRUE ; | |
5f20d3fb | 253 | } |
254 | } | |
255 | ||
256 | if ( !deja ) { | |
ed4205d8 | 257 | new((*fHits)[fNhits]) AliPHOSHit(*newHit) ; |
258 | fNhits++ ; | |
5f20d3fb | 259 | } |
260 | ||
bea63bea | 261 | delete newHit; |
bea63bea | 262 | } |
263 | ||
ed4205d8 | 264 | //____________________________________________________________________________ |
037cc66d | 265 | void AliPHOSv1::Hits2SDigits(){ |
266 | //Collects all hits in the same active volume into digit | |
ed4205d8 | 267 | |
bea63bea | 268 | Int_t i ; |
bea63bea | 269 | Int_t j ; |
fa412d9b | 270 | AliPHOSHit * hit ; |
bea63bea | 271 | AliPHOSDigit * newdigit ; |
272 | AliPHOSDigit * curdigit ; | |
273 | Bool_t deja = kFALSE ; | |
274 | ||
037cc66d | 275 | |
ed4205d8 | 276 | Int_t itrack ; |
037cc66d | 277 | for (itrack=0; itrack<gAlice->GetNtrack(); itrack++){ |
278 | ||
ed4205d8 | 279 | //=========== Get the Hits Tree for the Primary track itrack |
280 | gAlice->ResetHits(); | |
281 | gAlice->TreeH()->GetEvent(itrack); | |
282 | ||
037cc66d | 283 | |
ed4205d8 | 284 | for ( i = 0 ; i < fHits->GetEntries() ; i++ ) { |
285 | hit = (AliPHOSHit*)fHits->At(i) ; | |
286 | ||
287 | // Assign primary number only if contribution is significant | |
288 | if( hit->GetEnergy() > fDigitThreshold) | |
289 | newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ; | |
290 | else | |
291 | newdigit = new AliPHOSDigit( -1 , hit->GetId(), Digitize( hit->GetEnergy() ) ) ; | |
292 | deja =kFALSE ; | |
293 | ||
037cc66d | 294 | for ( j = 0 ; j < fnSdigits ; j++) { |
295 | curdigit = (AliPHOSDigit*) fSDigits->At(j) ; | |
ed4205d8 | 296 | if ( *curdigit == *newdigit) { |
297 | *curdigit = *curdigit + *newdigit ; | |
298 | deja = kTRUE ; | |
299 | } | |
bea63bea | 300 | } |
bea63bea | 301 | |
ed4205d8 | 302 | if ( !deja ) { |
037cc66d | 303 | new((*fSDigits)[fnSdigits]) AliPHOSDigit(* newdigit) ; |
304 | fnSdigits++ ; | |
ed4205d8 | 305 | } |
306 | ||
307 | delete newdigit ; | |
308 | } | |
309 | ||
310 | } // loop over tracks | |
037cc66d | 311 | |
312 | fSDigits->Sort() ; | |
313 | ||
314 | fnSdigits = fSDigits->GetEntries() ; | |
315 | fSDigits->Expand(fnSdigits) ; | |
316 | ||
317 | for (i = 0 ; i < fnSdigits ; i++) { | |
318 | AliPHOSDigit * digit = (AliPHOSDigit *) fSDigits->At(i) ; | |
319 | digit->SetIndexInList(i) ; | |
320 | } | |
321 | ||
322 | gAlice->TreeS()->Fill() ; | |
550bee17 | 323 | gAlice->TreeS()->Write(0,TObject::kOverwrite) ; |
324 | ||
037cc66d | 325 | |
326 | } | |
327 | //____________________________________________________________________________ | |
328 | void AliPHOSv1::SDigits2Digits(){ | |
329 | //Adds noise to the summable digits and removes everething below thresholds | |
330 | //Note, that sDigits should be SORTED in accordance with abs ID. | |
331 | ||
332 | ||
333 | gAlice->TreeS()->GetEvent(0) ; | |
037cc66d | 334 | |
335 | ||
336 | // Noise induced by the PIN diode of the PbWO crystals | |
337 | Int_t iCurSDigit = 0 ; | |
338 | //we assume, that there is al least one EMC digit... | |
550bee17 | 339 | if(fSDigits->GetEntries() == 0) { |
340 | cout << "PHOS::SDigits2Digits> No SDigits !!! Do not produce Digits " << endl ; | |
341 | return ; | |
342 | } | |
037cc66d | 343 | |
550bee17 | 344 | Int_t idCurSDigit = ((AliPHOSDigit *)fSDigits->At(0))->GetId() ; |
037cc66d | 345 | |
346 | Int_t absID ; | |
347 | for(absID = 1; absID < fGeom->GetNModules()*fGeom->GetNPhi()*fGeom->GetNZ(); absID++){ | |
037cc66d | 348 | Float_t noise = gRandom->Gaus(0., fPinElectronicNoise) ; |
349 | if(absID < idCurSDigit ){ | |
037cc66d | 350 | if(noise >fDigitThreshold ){ |
037cc66d | 351 | new((*fDigits)[fNdigits]) AliPHOSDigit( -1,absID,Digitize(noise) ) ; |
037cc66d | 352 | fNdigits++ ; |
353 | } | |
354 | } | |
355 | else{ //add noise and may be remove the true hit | |
037cc66d | 356 | Float_t signal = noise + Calibrate(((AliPHOSDigit *)fSDigits->At(iCurSDigit))->GetAmp()) ; |
037cc66d | 357 | if( signal >fDigitThreshold ){ |
037cc66d | 358 | AliPHOSDigit * digit = (AliPHOSDigit*) fSDigits->At(iCurSDigit) ; |
359 | new((*fDigits)[fNdigits]) AliPHOSDigit( *digit ) ; | |
360 | ((AliPHOSDigit *)fDigits->At(fNdigits))->SetAmp(Digitize(signal)); | |
037cc66d | 361 | fNdigits++ ; |
362 | } | |
363 | ||
364 | if(iCurSDigit < fSDigits->GetEntries()-1){ | |
365 | iCurSDigit++ ; | |
366 | idCurSDigit = ((AliPHOSDigit*)fSDigits->At(iCurSDigit))->GetId() ; | |
367 | } | |
368 | else | |
369 | idCurSDigit = 10000000; //no real hits left | |
370 | } | |
ed4205d8 | 371 | |
037cc66d | 372 | } |
373 | ||
374 | //remove PPSD/CPV digits below thresholds | |
375 | Int_t idigit ; | |
376 | for(idigit = iCurSDigit; idigit < fSDigits->GetEntries() ; idigit++){ //loop over CPV/PPSD digits | |
377 | ||
378 | AliPHOSDigit * digit = (AliPHOSDigit *) fSDigits->At(idigit) ; | |
379 | Float_t ene = Calibrate(digit->GetAmp()) ; | |
380 | ||
381 | Int_t relid[4] ; | |
382 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
383 | if ( relid[0] > fGeom->GetNCPVModules() ){ //ppsd | |
384 | if ( ( (relid[1] > 0) && (ene > fPpsdEnergyThreshold)) || //PPSD digit | |
385 | ( (relid[1] < 0) && (ene > fCpvEnergyThreshold ) ) ) //CPV digit | |
386 | new((*fDigits)[fNdigits]) AliPHOSDigit( *digit ) ; | |
387 | fNdigits++ ; | |
bea63bea | 388 | } |
037cc66d | 389 | } |
ed4205d8 | 390 | |
bea63bea | 391 | fDigits->Compress() ; |
ed4205d8 | 392 | |
393 | fNdigits = fDigits->GetEntries() ; | |
394 | fDigits->Expand(fNdigits) ; | |
bea63bea | 395 | |
037cc66d | 396 | Int_t i ; |
bea63bea | 397 | for (i = 0 ; i < fNdigits ; i++) { |
037cc66d | 398 | AliPHOSDigit * digit = (AliPHOSDigit *) fDigits->At(i) ; |
399 | digit->SetIndexInList(i) ; | |
bea63bea | 400 | } |
fa412d9b | 401 | |
ed4205d8 | 402 | gAlice->TreeD()->Fill() ; |
5f20d3fb | 403 | |
ed4205d8 | 404 | gAlice->TreeD()->Write(0,TObject::kOverwrite) ; |
405 | ||
406 | } | |
2ab0c725 | 407 | |
5f20d3fb | 408 | //___________________________________________________________________________ |
2ab0c725 | 409 | void AliPHOSv1::MakeBranch(Option_t* opt, char *file) |
037cc66d | 410 | { |
411 | ||
412 | ||
413 | char *cH ; | |
5f20d3fb | 414 | // Create new branche in the current Root Tree in the digit Tree |
5f20d3fb | 415 | AliDetector::MakeBranch(opt) ; |
037cc66d | 416 | |
417 | ||
418 | cH = strstr(opt,"S"); | |
419 | //Create a branch for SDigits | |
420 | if( cH ){ | |
421 | char branchname[20]; | |
422 | sprintf(branchname,"%s",GetName()); | |
423 | if(fSDigits) | |
424 | fSDigits->Clear(); | |
425 | else | |
426 | fSDigits = new TClonesArray("AliPHOSDigit",1000); | |
427 | fnSdigits = 0 ; | |
037cc66d | 428 | gAlice->MakeBranchInTree(gAlice->TreeS(),branchname,&fSDigits,fBufferSize,file); |
fa412d9b | 429 | } |
ed4205d8 | 430 | |
037cc66d | 431 | cH = strstr(opt,"D"); |
432 | //Create a branch for Digits | |
433 | if( cH ){ | |
434 | char branchname[20]; | |
435 | sprintf(branchname,"%s",GetName()); | |
436 | if(fSDigits) | |
437 | fDigits->Clear(); | |
438 | else | |
439 | fDigits = new TClonesArray("AliPHOSDigit",1000); | |
440 | fNdigits = 0 ; | |
441 | ||
442 | gAlice->MakeBranchInTree(gAlice->TreeD(),branchname,&fSDigits,fBufferSize,file); | |
443 | } | |
444 | ||
445 | cH = strstr(opt,"R"); | |
446 | //Create a branch for Reconstruction | |
447 | if( cH ){ | |
448 | char branchname[20]; | |
449 | ||
450 | Int_t splitlevel = 0 ; | |
451 | ||
452 | fEmcRecPoints->Delete() ; | |
453 | ||
454 | if ( fEmcRecPoints && gAlice->TreeR() ) { | |
455 | sprintf(branchname,"%sEmcRP",GetName()) ; | |
456 | gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ; | |
457 | } | |
458 | ||
459 | fPpsdRecPoints->Delete() ; | |
460 | ||
461 | if ( fPpsdRecPoints && gAlice->TreeR() ) { | |
462 | sprintf(branchname,"%sPpsdRP",GetName()) ; | |
463 | gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ; | |
464 | } | |
465 | ||
466 | fTrackSegments->Delete() ; | |
467 | ||
468 | if ( fTrackSegments && gAlice->TreeR() ) { | |
469 | sprintf(branchname,"%sTS",GetName()) ; | |
470 | gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ; | |
471 | } | |
472 | ||
473 | fRecParticles->Delete() ; | |
474 | ||
475 | if ( fRecParticles && gAlice->TreeR() ) { | |
476 | sprintf(branchname,"%sRP",GetName()) ; | |
477 | gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ; | |
478 | } | |
479 | ||
480 | } | |
481 | ||
bea63bea | 482 | } |
483 | ||
5f20d3fb | 484 | //_____________________________________________________________________________ |
485 | void AliPHOSv1::Reconstruction(AliPHOSReconstructioner * Reconstructioner) | |
486 | { | |
487 | // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and | |
488 | // 2. Creates TreeR with a branch for each list | |
489 | // 3. Steers the reconstruction processes | |
490 | // 4. Saves the 3 lists in TreeR | |
491 | // 5. Write the Tree to File | |
492 | ||
493 | fReconstructioner = Reconstructioner ; | |
037cc66d | 494 | |
5f20d3fb | 495 | // 1. |
496 | ||
497 | // gAlice->MakeTree("R") ; | |
5f20d3fb | 498 | |
037cc66d | 499 | MakeBranch("R") ; |
5f20d3fb | 500 | |
501 | // 3. | |
b73f246d | 502 | |
fad3e5b9 | 503 | fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles); |
b73f246d | 504 | |
fad3e5b9 | 505 | printf("Reconstruction: %d %d %d %d\n", |
506 | fEmcRecPoints->GetEntries(),fPpsdRecPoints->GetEntries(), | |
b73f246d | 507 | fTrackSegments->GetEntries(),fRecParticles->GetEntries()); |
5f20d3fb | 508 | |
509 | // 4. Expand or Shrink the arrays to the proper size | |
510 | ||
511 | Int_t size ; | |
512 | ||
513 | size = fEmcRecPoints->GetEntries() ; | |
514 | fEmcRecPoints->Expand(size) ; | |
ed4205d8 | 515 | |
5f20d3fb | 516 | size = fPpsdRecPoints->GetEntries() ; |
517 | fPpsdRecPoints->Expand(size) ; | |
518 | ||
519 | size = fTrackSegments->GetEntries() ; | |
520 | fTrackSegments->Expand(size) ; | |
521 | ||
522 | size = fRecParticles->GetEntries() ; | |
523 | fRecParticles->Expand(size) ; | |
524 | ||
525 | gAlice->TreeR()->Fill() ; | |
5f20d3fb | 526 | // 5. |
527 | ||
4a2ca5e9 | 528 | gAlice->TreeR()->Write(0,TObject::kOverwrite) ; |
5f20d3fb | 529 | |
530 | // Deleting reconstructed objects | |
531 | ResetReconstruction(); | |
532 | ||
533 | } | |
534 | ||
5f20d3fb | 535 | //____________________________________________________________________________ |
536 | void AliPHOSv1::ResetReconstruction() | |
537 | { | |
538 | // Deleting reconstructed objects | |
539 | ||
b73f246d | 540 | if ( fEmcRecPoints ) fEmcRecPoints ->Delete(); |
5f20d3fb | 541 | if ( fPpsdRecPoints ) fPpsdRecPoints->Delete(); |
542 | if ( fTrackSegments ) fTrackSegments->Delete(); | |
b73f246d | 543 | if ( fRecParticles ) fRecParticles ->Delete(); |
5f20d3fb | 544 | |
545 | } | |
5f20d3fb | 546 | |
5f20d3fb | 547 | //____________________________________________________________________________ |
548 | ||
7587f5a5 | 549 | void AliPHOSv1::StepManager(void) |
550 | { | |
b2a60966 | 551 | // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell |
b2a60966 | 552 | |
ed4205d8 | 553 | // if (gMC->IsTrackEntering()) |
554 | // cout << "Track enters the volume " << gMC->CurrentVolName() << endl; | |
555 | // if (gMC->IsTrackExiting()) | |
556 | // cout << "Track leaves the volume " << gMC->CurrentVolName() << endl; | |
557 | ||
7587f5a5 | 558 | Int_t relid[4] ; // (box, layer, row, column) indices |
fa412d9b | 559 | Int_t absid ; // absolute cell ID number |
2168f43b | 560 | Float_t xyze[4]={0,0,0,0} ; // position wrt MRS and energy deposited |
fa412d9b | 561 | TLorentzVector pos ; // Lorentz vector of the track current position |
037cc66d | 562 | TLorentzVector pmom ; //momentum of the particle initiated hit |
7854a24a | 563 | Float_t xyd[3] ; //local posiiton of the entering |
037cc66d | 564 | Bool_t entered = kFALSE ; |
fa412d9b | 565 | Int_t copy ; |
7587f5a5 | 566 | |
bea63bea | 567 | Int_t tracknumber = gAlice->CurrentTrack() ; |
fa412d9b | 568 | Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() ); |
569 | TString name = fGeom->GetName() ; | |
037cc66d | 570 | Int_t trackpid = 0 ; |
571 | ||
572 | if( gMC->IsTrackEntering() ){ // create hit with position and momentum of new particle, | |
573 | // but may be without energy deposition | |
574 | ||
575 | // Current position of the hit in the local ref. system | |
576 | gMC -> TrackPosition(pos); | |
577 | Float_t xyzm[3], xyzd[3] ; | |
578 | Int_t i; | |
579 | for (i=0; i<3; i++) xyzm[i] = pos[i]; | |
580 | gMC -> Gmtod (xyzm, xyzd, 1); // transform coordinate from master to daughter system | |
581 | xyd[0] = xyzd[0]; | |
7854a24a | 582 | xyd[1] =-xyzd[1]; |
583 | xyd[2] =-xyzd[2]; | |
584 | ||
037cc66d | 585 | |
586 | // Current momentum of the hit's track in the local ref. system | |
587 | gMC -> TrackMomentum(pmom); | |
588 | Float_t pm[3], pd[3]; | |
589 | for (i=0; i<3; i++) pm[i] = pmom[i]; | |
590 | gMC -> Gmtod (pm, pd, 2); // transform 3-momentum from master to daughter system | |
591 | pmom[0] = pd[0]; | |
592 | pmom[1] =-pd[1]; | |
593 | pmom[2] =-pd[2]; | |
594 | ||
595 | trackpid = gMC->TrackPid(); | |
596 | entered = kTRUE ; // Mark to create hit even withou energy deposition | |
597 | ||
598 | } | |
599 | ||
600 | ||
ed4205d8 | 601 | if ( name == "GPS2" || name == "MIXT" ) { // ======> CPV is a GPS' PPSD |
fa412d9b | 602 | |
b2a60966 | 603 | if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell |
7587f5a5 | 604 | { |
605 | gMC->TrackPosition(pos) ; | |
606 | xyze[0] = pos[0] ; | |
607 | xyze[1] = pos[1] ; | |
608 | xyze[2] = pos[2] ; | |
bea63bea | 609 | xyze[3] = gMC->Edep() ; |
7587f5a5 | 610 | |
037cc66d | 611 | if ( (xyze[3] != 0) || entered ) { // there is deposited energy or new particle entering PPSD |
7587f5a5 | 612 | gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number |
fad3e5b9 | 613 | if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){ |
ed4205d8 | 614 | relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules(); |
fad3e5b9 | 615 | } |
7587f5a5 | 616 | gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number |
ed4205d8 | 617 | // 1-> fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper |
618 | // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower | |
7587f5a5 | 619 | gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell |
620 | gMC->CurrentVolID(relid[3]) ; // get the column number | |
621 | ||
622 | // get the absolute Id number | |
623 | ||
bea63bea | 624 | fGeom->RelToAbsNumbering(relid, absid) ; |
7587f5a5 | 625 | |
bea63bea | 626 | // add current hit to the hit list |
037cc66d | 627 | AddHit(fIshunt, primary, tracknumber, absid, xyze, trackpid, pmom, xyd); |
628 | ||
7587f5a5 | 629 | |
630 | } // there is deposited energy | |
fa412d9b | 631 | } // We are inside the gas of the CPV |
632 | } // GPS2 configuration | |
633 | ||
ed4205d8 | 634 | if ( name == "IHEP" || name == "MIXT" ) { // ======> CPV is a IHEP's one |
fa412d9b | 635 | |
636 | // Yuri Kharlov, 28 September 2000 | |
637 | ||
638 | if( gMC->CurrentVolID(copy) == gMC->VolId("CPVQ") && | |
037cc66d | 639 | entered && |
640 | gMC->TrackCharge() != 0) { | |
fa412d9b | 641 | |
037cc66d | 642 | // Digitize the current CPV hit: |
643 | ||
644 | // 1. find pad response and | |
fa412d9b | 645 | |
a3dfe79c | 646 | Int_t moduleNumber; |
647 | gMC->CurrentVolOffID(3,moduleNumber); | |
648 | moduleNumber--; | |
fa412d9b | 649 | |
fa412d9b | 650 | |
3d402178 | 651 | TClonesArray *cpvDigits = new TClonesArray("AliPHOSCPVDigit",0); // array of digits for current hit |
a3dfe79c | 652 | CPVDigitize(pmom,xyd,moduleNumber,cpvDigits); |
fa412d9b | 653 | |
654 | Float_t xmean = 0; | |
655 | Float_t zmean = 0; | |
656 | Float_t qsum = 0; | |
cd461ab8 | 657 | Int_t idigit,ndigits; |
fa412d9b | 658 | |
659 | // 2. go through the current digit list and sum digits in pads | |
660 | ||
661 | ndigits = cpvDigits->GetEntriesFast(); | |
cd461ab8 | 662 | for (idigit=0; idigit<ndigits-1; idigit++) { |
3d402178 | 663 | AliPHOSCPVDigit *cpvDigit1 = (AliPHOSCPVDigit*) cpvDigits->UncheckedAt(idigit); |
fa412d9b | 664 | Float_t x1 = cpvDigit1->GetXpad() ; |
665 | Float_t z1 = cpvDigit1->GetYpad() ; | |
666 | for (Int_t jdigit=idigit+1; jdigit<ndigits; jdigit++) { | |
3d402178 | 667 | AliPHOSCPVDigit *cpvDigit2 = (AliPHOSCPVDigit*) cpvDigits->UncheckedAt(jdigit); |
fa412d9b | 668 | Float_t x2 = cpvDigit2->GetXpad() ; |
669 | Float_t z2 = cpvDigit2->GetYpad() ; | |
670 | if (x1==x2 && z1==z2) { | |
671 | Float_t qsum = cpvDigit1->GetQpad() + cpvDigit2->GetQpad() ; | |
672 | cpvDigit2->SetQpad(qsum) ; | |
673 | cpvDigits->RemoveAt(idigit) ; | |
674 | } | |
675 | } | |
676 | } | |
677 | cpvDigits->Compress() ; | |
678 | ||
679 | // 3. add digits to temporary hit list fTmpHits | |
680 | ||
681 | ndigits = cpvDigits->GetEntriesFast(); | |
cd461ab8 | 682 | for (idigit=0; idigit<ndigits; idigit++) { |
3d402178 | 683 | AliPHOSCPVDigit *cpvDigit = (AliPHOSCPVDigit*) cpvDigits->UncheckedAt(idigit); |
a3dfe79c | 684 | relid[0] = moduleNumber + 1 ; // CPV (or PHOS) module number |
fa412d9b | 685 | relid[1] =-1 ; // means CPV |
686 | relid[2] = cpvDigit->GetXpad() ; // column number of a pad | |
687 | relid[3] = cpvDigit->GetYpad() ; // row number of a pad | |
688 | ||
689 | // get the absolute Id number | |
690 | fGeom->RelToAbsNumbering(relid, absid) ; | |
691 | ||
692 | // add current digit to the temporary hit list | |
693 | xyze[0] = 0. ; | |
694 | xyze[1] = 0. ; | |
695 | xyze[2] = 0. ; | |
696 | xyze[3] = cpvDigit->GetQpad() ; // amplitude in a pad | |
697 | primary = -1; // No need in primary for CPV | |
037cc66d | 698 | AddHit(fIshunt, primary, tracknumber, absid, xyze, trackpid, pmom, xyd); |
fa412d9b | 699 | |
700 | if (cpvDigit->GetQpad() > 0.02) { | |
701 | xmean += cpvDigit->GetQpad() * (cpvDigit->GetXpad() + 0.5); | |
702 | zmean += cpvDigit->GetQpad() * (cpvDigit->GetYpad() + 0.5); | |
703 | qsum += cpvDigit->GetQpad(); | |
704 | } | |
705 | } | |
706 | delete cpvDigits; | |
707 | } | |
708 | } // end of IHEP configuration | |
7587f5a5 | 709 | |
037cc66d | 710 | |
fa412d9b | 711 | if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) { // We are inside a PBWO crystal |
712 | gMC->TrackPosition(pos) ; | |
713 | xyze[0] = pos[0] ; | |
714 | xyze[1] = pos[1] ; | |
715 | xyze[2] = pos[2] ; | |
716 | xyze[3] = gMC->Edep() ; | |
ed4205d8 | 717 | |
037cc66d | 718 | |
719 | if ( (xyze[3] != 0) || entered ) { // Track is inside the crystal and deposits some energy or just entered | |
ed4205d8 | 720 | |
fa412d9b | 721 | gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ; |
037cc66d | 722 | |
fad3e5b9 | 723 | if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 ) |
724 | relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules(); | |
725 | ||
fa412d9b | 726 | relid[1] = 0 ; // means PBW04 |
727 | gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module | |
728 | gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module | |
729 | ||
730 | // get the absolute Id number | |
fa412d9b | 731 | fGeom->RelToAbsNumbering(relid, absid) ; |
ed4205d8 | 732 | |
fa412d9b | 733 | // add current hit to the hit list |
037cc66d | 734 | AddHit(fIshunt, primary,tracknumber, absid, xyze, trackpid,pmom, xyd); |
735 | ||
ed4205d8 | 736 | |
fa412d9b | 737 | } // there is deposited energy |
738 | } // we are inside a PHOS Xtal | |
037cc66d | 739 | |
740 | ||
fa412d9b | 741 | } |
742 | ||
743 | //____________________________________________________________________________ | |
744 | void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumber, TClonesArray *cpvDigits) | |
745 | { | |
746 | // ------------------------------------------------------------------------ | |
747 | // Digitize one CPV hit: | |
748 | // On input take exact 4-momentum p and position zxhit of the hit, | |
749 | // find the pad response around this hit and | |
750 | // put the amplitudes in the pads into array digits | |
751 | // | |
752 | // Author: Yuri Kharlov (after Serguei Sadovsky) | |
753 | // 2 October 2000 | |
754 | // ------------------------------------------------------------------------ | |
755 | ||
a3dfe79c | 756 | const Float_t kCelWr = fGeom->GetPadSizePhi()/2; // Distance between wires (2 wires above 1 pad) |
757 | const Float_t kDetR = 0.1; // Relative energy fluctuation in track for 100 e- | |
758 | const Float_t kdEdx = 4.0; // Average energy loss in CPV; | |
759 | const Int_t kNgamz = 5; // Ionization size in Z | |
760 | const Int_t kNgamx = 9; // Ionization size in Phi | |
761 | const Float_t kNoise = 0.03; // charge noise in one pad | |
fa412d9b | 762 | |
763 | Float_t rnor1,rnor2; | |
764 | ||
765 | // Just a reminder on axes notation in the CPV module: | |
766 | // axis Z goes along the beam | |
767 | // axis X goes across the beam in the module plane | |
768 | // axis Y is a normal to the module plane showing from the IP | |
769 | ||
770 | Float_t hitX = zxhit[0]; | |
771 | Float_t hitZ =-zxhit[1]; | |
772 | Float_t pX = p.Px(); | |
773 | Float_t pZ =-p.Pz(); | |
774 | Float_t pNorm = p.Py(); | |
a3dfe79c | 775 | Float_t eloss = kdEdx; |
3d402178 | 776 | |
7eb9d12d | 777 | // cout << "CPVDigitize: YVK : "<<hitX<<" "<<hitZ<<" | "<<pX<<" "<<pZ<<" "<<pNorm<<endl; |
778 | ||
fa412d9b | 779 | Float_t dZY = pZ/pNorm * fGeom->GetCPVGasThickness(); |
780 | Float_t dXY = pX/pNorm * fGeom->GetCPVGasThickness(); | |
781 | gRandom->Rannor(rnor1,rnor2); | |
a3dfe79c | 782 | eloss *= (1 + kDetR*rnor1) * |
783 | TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(fGeom->GetCPVGasThickness(),2))); | |
fa412d9b | 784 | Float_t zhit1 = hitZ + fGeom->GetCPVActiveSize(1)/2 - dZY/2; |
785 | Float_t xhit1 = hitX + fGeom->GetCPVActiveSize(0)/2 - dXY/2; | |
786 | Float_t zhit2 = zhit1 + dZY; | |
787 | Float_t xhit2 = xhit1 + dXY; | |
788 | ||
a3dfe79c | 789 | Int_t iwht1 = (Int_t) (xhit1 / kCelWr); // wire (x) coordinate "in" |
790 | Int_t iwht2 = (Int_t) (xhit2 / kCelWr); // wire (x) coordinate "out" | |
fa412d9b | 791 | |
792 | Int_t nIter; | |
793 | Float_t zxe[3][5]; | |
794 | if (iwht1==iwht2) { // incline 1-wire hit | |
795 | nIter = 2; | |
796 | zxe[0][0] = (zhit1 + zhit2 - dZY*0.57735) / 2; | |
a3dfe79c | 797 | zxe[1][0] = (iwht1 + 0.5) * kCelWr; |
798 | zxe[2][0] = eloss/2; | |
fa412d9b | 799 | zxe[0][1] = (zhit1 + zhit2 + dZY*0.57735) / 2; |
a3dfe79c | 800 | zxe[1][1] = (iwht1 + 0.5) * kCelWr; |
801 | zxe[2][1] = eloss/2; | |
fa412d9b | 802 | } |
803 | else if (TMath::Abs(iwht1-iwht2) != 1) { // incline 3-wire hit | |
804 | nIter = 3; | |
805 | Int_t iwht3 = (iwht1 + iwht2) / 2; | |
a3dfe79c | 806 | Float_t xwht1 = (iwht1 + 0.5) * kCelWr; // wire 1 |
807 | Float_t xwht2 = (iwht2 + 0.5) * kCelWr; // wire 2 | |
808 | Float_t xwht3 = (iwht3 + 0.5) * kCelWr; // wire 3 | |
fa412d9b | 809 | Float_t xwr13 = (xwht1 + xwht3) / 2; // center 13 |
810 | Float_t xwr23 = (xwht2 + xwht3) / 2; // center 23 | |
811 | Float_t dxw1 = xhit1 - xwr13; | |
812 | Float_t dxw2 = xhit2 - xwr23; | |
a3dfe79c | 813 | Float_t egm1 = TMath::Abs(dxw1) / ( TMath::Abs(dxw1) + TMath::Abs(dxw2) + kCelWr ); |
814 | Float_t egm2 = TMath::Abs(dxw2) / ( TMath::Abs(dxw1) + TMath::Abs(dxw2) + kCelWr ); | |
815 | Float_t egm3 = kCelWr / ( TMath::Abs(dxw1) + TMath::Abs(dxw2) + kCelWr ); | |
fa412d9b | 816 | zxe[0][0] = (dXY*(xwr13-xwht1)/dXY + zhit1 + zhit1) / 2; |
817 | zxe[1][0] = xwht1; | |
a3dfe79c | 818 | zxe[2][0] = eloss * egm1; |
fa412d9b | 819 | zxe[0][1] = (dXY*(xwr23-xwht1)/dXY + zhit1 + zhit2) / 2; |
820 | zxe[1][1] = xwht2; | |
a3dfe79c | 821 | zxe[2][1] = eloss * egm2; |
fa412d9b | 822 | zxe[0][2] = dXY*(xwht3-xwht1)/dXY + zhit1; |
823 | zxe[1][2] = xwht3; | |
a3dfe79c | 824 | zxe[2][2] = eloss * egm3; |
fa412d9b | 825 | } |
826 | else { // incline 2-wire hit | |
827 | nIter = 2; | |
a3dfe79c | 828 | Float_t xwht1 = (iwht1 + 0.5) * kCelWr; |
829 | Float_t xwht2 = (iwht2 + 0.5) * kCelWr; | |
fa412d9b | 830 | Float_t xwr12 = (xwht1 + xwht2) / 2; |
831 | Float_t dxw1 = xhit1 - xwr12; | |
832 | Float_t dxw2 = xhit2 - xwr12; | |
833 | Float_t egm1 = TMath::Abs(dxw1) / ( TMath::Abs(dxw1) + TMath::Abs(dxw2) ); | |
834 | Float_t egm2 = TMath::Abs(dxw2) / ( TMath::Abs(dxw1) + TMath::Abs(dxw2) ); | |
835 | zxe[0][0] = (zhit1 + zhit2 - dZY*egm1) / 2; | |
836 | zxe[1][0] = xwht1; | |
a3dfe79c | 837 | zxe[2][0] = eloss * egm1; |
fa412d9b | 838 | zxe[0][1] = (zhit1 + zhit2 + dZY*egm2) / 2; |
839 | zxe[1][1] = xwht2; | |
a3dfe79c | 840 | zxe[2][1] = eloss * egm2; |
fa412d9b | 841 | } |
bea63bea | 842 | |
fa412d9b | 843 | // Finite size of ionization region |
844 | ||
ed4205d8 | 845 | Int_t nCellZ = fGeom->GetNumberOfCPVPadsZ(); |
846 | Int_t nCellX = fGeom->GetNumberOfCPVPadsPhi(); | |
a3dfe79c | 847 | Int_t nz3 = (kNgamz+1)/2; |
848 | Int_t nx3 = (kNgamx+1)/2; | |
849 | cpvDigits->Expand(nIter*kNgamx*kNgamz); | |
fa412d9b | 850 | TClonesArray &ldigits = *(TClonesArray *)cpvDigits; |
851 | ||
852 | for (Int_t iter=0; iter<nIter; iter++) { | |
853 | ||
854 | Float_t zhit = zxe[0][iter]; | |
855 | Float_t xhit = zxe[1][iter]; | |
856 | Float_t qhit = zxe[2][iter]; | |
857 | Float_t zcell = zhit / fGeom->GetPadSizeZ(); | |
858 | Float_t xcell = xhit / fGeom->GetPadSizePhi(); | |
859 | if ( zcell<=0 || xcell<=0 || | |
860 | zcell>=nCellZ || xcell>=nCellX) return; | |
861 | Int_t izcell = (Int_t) zcell; | |
862 | Int_t ixcell = (Int_t) xcell; | |
863 | Float_t zc = zcell - izcell - 0.5; | |
864 | Float_t xc = xcell - ixcell - 0.5; | |
a3dfe79c | 865 | for (Int_t iz=1; iz<=kNgamz; iz++) { |
fa412d9b | 866 | Int_t kzg = izcell + iz - nz3; |
867 | if (kzg<=0 || kzg>nCellZ) continue; | |
868 | Float_t zg = (Float_t)(iz-nz3) - zc; | |
a3dfe79c | 869 | for (Int_t ix=1; ix<=kNgamx; ix++) { |
fa412d9b | 870 | Int_t kxg = ixcell + ix - nx3; |
871 | if (kxg<=0 || kxg>nCellX) continue; | |
872 | Float_t xg = (Float_t)(ix-nx3) - xc; | |
873 | ||
874 | // Now calculate pad response | |
875 | Float_t qpad = CPVPadResponseFunction(qhit,zg,xg); | |
a3dfe79c | 876 | qpad += kNoise*rnor2; |
fa412d9b | 877 | if (qpad<0) continue; |
878 | ||
879 | // Fill the array with pad response ID and amplitude | |
3d402178 | 880 | new(ldigits[cpvDigits->GetEntriesFast()]) AliPHOSCPVDigit(kxg,kzg,qpad); |
fa412d9b | 881 | } |
fa412d9b | 882 | } |
fa412d9b | 883 | } |
884 | } | |
885 | ||
886 | //____________________________________________________________________________ | |
887 | Float_t AliPHOSv1::CPVPadResponseFunction(Float_t qhit, Float_t zhit, Float_t xhit) { | |
888 | // ------------------------------------------------------------------------ | |
889 | // Calculate the amplitude in one CPV pad using the | |
890 | // cumulative pad response function | |
891 | // Author: Yuri Kharlov (after Serguei Sadovski) | |
892 | // 3 October 2000 | |
893 | // ------------------------------------------------------------------------ | |
894 | ||
895 | Double_t dz = fGeom->GetPadSizeZ() / 2; | |
896 | Double_t dx = fGeom->GetPadSizePhi() / 2; | |
897 | Double_t z = zhit * fGeom->GetPadSizeZ(); | |
898 | Double_t x = xhit * fGeom->GetPadSizePhi(); | |
899 | Double_t amplitude = qhit * | |
900 | (CPVCumulPadResponse(z+dz,x+dx) - CPVCumulPadResponse(z+dz,x-dx) - | |
901 | CPVCumulPadResponse(z-dz,x+dx) + CPVCumulPadResponse(z-dz,x-dx)); | |
902 | return (Float_t)amplitude; | |
7587f5a5 | 903 | } |
904 | ||
fa412d9b | 905 | //____________________________________________________________________________ |
906 | Double_t AliPHOSv1::CPVCumulPadResponse(Double_t x, Double_t y) { | |
907 | // ------------------------------------------------------------------------ | |
908 | // Cumulative pad response function | |
909 | // It includes several terms from the CF decomposition in electrostatics | |
910 | // Note: this cumulative function is wrong since omits some terms | |
911 | // but the cell amplitude obtained with it is correct because | |
912 | // these omitting terms cancel | |
913 | // Author: Yuri Kharlov (after Serguei Sadovski) | |
914 | // 3 October 2000 | |
915 | // ------------------------------------------------------------------------ | |
916 | ||
a3dfe79c | 917 | const Double_t kA=1.0; |
918 | const Double_t kB=0.7; | |
fa412d9b | 919 | |
920 | Double_t r2 = x*x + y*y; | |
921 | Double_t xy = x*y; | |
922 | Double_t cumulPRF = 0; | |
923 | for (Int_t i=0; i<=4; i++) { | |
a3dfe79c | 924 | Double_t b1 = (2*i + 1) * kB; |
fa412d9b | 925 | cumulPRF += TMath::Power(-1,i) * TMath::ATan( xy / (b1*TMath::Sqrt(b1*b1 + r2)) ); |
926 | } | |
a3dfe79c | 927 | cumulPRF *= kA/(2*TMath::Pi()); |
fa412d9b | 928 | return cumulPRF; |
929 | } | |
7eb9d12d | 930 |