]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.cxx
Fixed compiling error for HP (multiple declaration)
[u/mrichter/AliRoot.git] / RICH / AliRICH.cxx
CommitLineData
4c039060 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/*
2e5f0f7b 17 $Log$
237c933d 18 Revision 1.17 2000/06/09 14:58:37 jbarbosa
19 New digitisation per particle type
20
d28b5fc2 21 Revision 1.16 2000/04/19 12:55:43 morsch
22 Newly structured and updated version (JB, AM)
23
4c039060 24*/
25
2e5f0f7b 26
ddae0931 27////////////////////////////////////////////////
28// Manager and hits classes for set:RICH //
29////////////////////////////////////////////////
fe4da5cc 30
ddae0931 31#include <TBRIK.h>
32#include <TTUBE.h>
fe4da5cc 33#include <TNode.h>
34#include <TRandom.h>
ddae0931 35#include <TObject.h>
36#include <TVector.h>
37#include <TObjArray.h>
2e5f0f7b 38#include <TArrayF.h>
237c933d 39#include <TFile.h>
40#include <TParticle.h>
41#include <iostream.h>
fe4da5cc 42
fe4da5cc 43#include "AliRICH.h"
237c933d 44#include "AliRICHSegmentation.h"
45#include "AliRICHHit.h"
46#include "AliRICHCerenkov.h"
47#include "AliRICHPadHit.h"
48#include "AliRICHDigit.h"
49#include "AliRICHTransientDigit.h"
50#include "AliRICHRawCluster.h"
51#include "AliRICHRecHit.h"
52#include "AliRICHHitMapA1.h"
2e5f0f7b 53#include "AliRICHClusterFinder.h"
fe4da5cc 54#include "AliRun.h"
ddae0931 55#include "AliMC.h"
2e5f0f7b 56#include "AliPoints.h"
ddae0931 57#include "AliCallf77.h"
237c933d 58
ddae0931 59
60// Static variables for the pad-hit iterator routines
61static Int_t sMaxIterPad=0;
62static Int_t sCurIterPad=0;
63static TClonesArray *fClusters2;
64static TClonesArray *fHits2;
2e5f0f7b 65static TTree *TrH1;
ddae0931 66
fe4da5cc 67ClassImp(AliRICH)
ddae0931 68
69//___________________________________________
fe4da5cc 70AliRICH::AliRICH()
71{
237c933d 72// Default constructor for RICH manager class
73
ddae0931 74 fIshunt = 0;
75 fHits = 0;
2e5f0f7b 76 fPadHits = 0;
77 fNPadHits = 0;
78 fNcerenkovs = 0;
ddae0931 79 fDchambers = 0;
ddae0931 80 fCerenkovs = 0;
81 fNdch = 0;
fe4da5cc 82}
ddae0931 83
84//___________________________________________
fe4da5cc 85AliRICH::AliRICH(const char *name, const char *title)
ddae0931 86 : AliDetector(name,title)
fe4da5cc 87{
ddae0931 88//Begin_Html
89/*
90 <img src="gif/alirich.gif">
91*/
92//End_Html
93
2e5f0f7b 94 fHits = new TClonesArray("AliRICHHit",1000 );
1cedd08a 95 gAlice->AddHitList(fHits);
2e5f0f7b 96 fPadHits = new TClonesArray("AliRICHPadHit",100000);
97 fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
98 gAlice->AddHitList(fCerenkovs);
99 //gAlice->AddHitList(fHits);
100 fNPadHits = 0;
101 fNcerenkovs = 0;
102 fIshunt = 0;
ddae0931 103
237c933d 104 fNdch = new Int_t[kNCH];
ddae0931 105
237c933d 106 fDchambers = new TObjArray(kNCH);
2e5f0f7b 107
237c933d 108 fRecHits = new TObjArray(kNCH);
ddae0931 109
110 Int_t i;
111
237c933d 112 for (i=0; i<kNCH ;i++) {
2e5f0f7b 113 (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000);
ddae0931 114 fNdch[i]=0;
115 }
2e5f0f7b 116
237c933d 117 fNrawch = new Int_t[kNCH];
ddae0931 118
237c933d 119 fRawClusters = new TObjArray(kNCH);
d28b5fc2 120 //printf("Created fRwClusters with adress:%p",fRawClusters);
2e5f0f7b 121
237c933d 122 for (i=0; i<kNCH ;i++) {
2e5f0f7b 123 (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000);
124 fNrawch[i]=0;
125 }
126
237c933d 127 fNrechits = new Int_t[kNCH];
ddae0931 128
237c933d 129 for (i=0; i<kNCH ;i++) {
2e5f0f7b 130 (*fRecHits)[i] = new TClonesArray("AliRICHRecHit",1000);
131 }
d28b5fc2 132 //printf("Created fRecHits with adress:%p",fRecHits);
2e5f0f7b 133
134
ddae0931 135 SetMarkerColor(kRed);
fe4da5cc 136}
137
237c933d 138AliRICH::AliRICH(const AliRICH& RICH)
139{
140// Copy Constructor
141}
142
143
ddae0931 144//___________________________________________
fe4da5cc 145AliRICH::~AliRICH()
146{
237c933d 147
148// Destructor of RICH manager class
149
ddae0931 150 fIshunt = 0;
151 delete fHits;
2e5f0f7b 152 delete fPadHits;
ddae0931 153 delete fCerenkovs;
fe4da5cc 154}
155
ddae0931 156//___________________________________________
fe4da5cc 157void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
158{
237c933d 159
160//
161// Adds a hit to the Hits list
162//
163
ddae0931 164 TClonesArray &lhits = *fHits;
2e5f0f7b 165 new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits);
fe4da5cc 166}
fe4da5cc 167//_____________________________________________________________________________
ddae0931 168void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
169{
237c933d 170
171//
172// Adds a RICH cerenkov hit to the Cerenkov Hits list
173//
174
ddae0931 175 TClonesArray &lcerenkovs = *fCerenkovs;
176 new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
2e5f0f7b 177 //printf ("Done for Cerenkov %d\n\n\n\n",fNcerenkovs);
fe4da5cc 178}
ddae0931 179//___________________________________________
2e5f0f7b 180void AliRICH::AddPadHit(Int_t *clhits)
ddae0931 181{
237c933d 182
183//
184// Add a RICH pad hit to the list
185//
186
2e5f0f7b 187 TClonesArray &lPadHits = *fPadHits;
188 new(lPadHits[fNPadHits++]) AliRICHPadHit(clhits);
fe4da5cc 189}
fe4da5cc 190//_____________________________________________________________________________
ddae0931 191void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
192{
237c933d 193
194 //
195 // Add a RICH digit to the list
196 //
ddae0931 197
198 TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]);
2e5f0f7b 199 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
fe4da5cc 200}
201
202//_____________________________________________________________________________
2e5f0f7b 203void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
fe4da5cc 204{
ddae0931 205 //
2e5f0f7b 206 // Add a RICH digit to the list
ddae0931 207 //
2e5f0f7b 208
209 TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
210 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
fe4da5cc 211}
212
2e5f0f7b 213//_____________________________________________________________________________
214void AliRICH::AddRecHit(Int_t id, Float_t *rechit)
215{
237c933d 216
217 //
218 // Add a RICH reconstructed hit to the list
219 //
fe4da5cc 220
2e5f0f7b 221 TClonesArray &lrec = *((TClonesArray*)(*fRecHits)[id]);
222 new(lrec[fNrechits[id]++]) AliRICHRecHit(id,rechit);
223}
fe4da5cc 224
ddae0931 225//___________________________________________
226void AliRICH::BuildGeometry()
227
fe4da5cc 228{
237c933d 229
230 //
231 // Builds a TNode geometry for event display
232 //
233 TNode *node, *top;
ddae0931 234
235 const int kColorRICH = kGreen;
236 //
237c933d 237 top=gAlice->GetGeometry()->GetNode("alice");
ddae0931 238
239
240 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
241
237c933d 242 top->cd();
ddae0931 243 Float_t pos1[3]={0,471.8999,165.2599};
2e5f0f7b 244 //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
245 new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
237c933d 246 node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
ddae0931 247
248
237c933d 249 node->SetLineColor(kColorRICH);
250 fNodes->Add(node);
251 top->cd();
ddae0931 252
253 Float_t pos2[3]={171,470,0};
2e5f0f7b 254 //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
255 new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
237c933d 256 node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
ddae0931 257
258
237c933d 259 node->SetLineColor(kColorRICH);
260 fNodes->Add(node);
261 top->cd();
ddae0931 262 Float_t pos3[3]={0,500,0};
2e5f0f7b 263 //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
264 new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
237c933d 265 node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
ddae0931 266
267
237c933d 268 node->SetLineColor(kColorRICH);
269 fNodes->Add(node);
270 top->cd();
ddae0931 271 Float_t pos4[3]={-171,470,0};
2e5f0f7b 272 //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],
273 new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
237c933d 274 node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
ddae0931 275
276
237c933d 277 node->SetLineColor(kColorRICH);
278 fNodes->Add(node);
279 top->cd();
ddae0931 280 Float_t pos5[3]={161.3999,443.3999,-165.3};
2e5f0f7b 281 //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
282 new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
237c933d 283 node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
ddae0931 284
237c933d 285 node->SetLineColor(kColorRICH);
286 fNodes->Add(node);
287 top->cd();
ddae0931 288 Float_t pos6[3]={0., 471.9, -165.3,};
2e5f0f7b 289 //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
290 new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
237c933d 291 node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
ddae0931 292
293
237c933d 294 node->SetLineColor(kColorRICH);
295 fNodes->Add(node);
296 top->cd();
ddae0931 297 Float_t pos7[3]={-161.399,443.3999,-165.3};
2e5f0f7b 298 //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
299 new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
237c933d 300 node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
301 node->SetLineColor(kColorRICH);
302 fNodes->Add(node);
ddae0931 303
fe4da5cc 304}
305
ddae0931 306//___________________________________________
307Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
308{
237c933d 309
310// Default value
311
ddae0931 312 return 9999;
313}
fe4da5cc 314
ddae0931 315//___________________________________________
316void AliRICH::MakeBranch(Option_t* option)
fe4da5cc 317{
237c933d 318 // Create Tree branches for the RICH.
fe4da5cc 319
237c933d 320 const Int_t kBufferSize = 4000;
ddae0931 321 char branchname[20];
fe4da5cc 322
ddae0931 323
324 AliDetector::MakeBranch(option);
325 sprintf(branchname,"%sCerenkov",GetName());
326 if (fCerenkovs && gAlice->TreeH()) {
237c933d 327 gAlice->TreeH()->Branch(branchname,&fCerenkovs, kBufferSize);
ddae0931 328 printf("Making Branch %s for Cerenkov Hits\n",branchname);
fe4da5cc 329 }
ddae0931 330
2e5f0f7b 331 sprintf(branchname,"%sPadHits",GetName());
332 if (fPadHits && gAlice->TreeH()) {
237c933d 333 gAlice->TreeH()->Branch(branchname,&fPadHits, kBufferSize);
2e5f0f7b 334 printf("Making Branch %s for PadHits\n",branchname);
fe4da5cc 335 }
336
ddae0931 337// one branch for digits per chamber
338 Int_t i;
339
237c933d 340 for (i=0; i<kNCH ;i++) {
ddae0931 341 sprintf(branchname,"%sDigits%d",GetName(),i+1);
342
343 if (fDchambers && gAlice->TreeD()) {
237c933d 344 gAlice->TreeD()->Branch(branchname,&((*fDchambers)[i]), kBufferSize);
ddae0931 345 printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
346 }
fe4da5cc 347 }
2e5f0f7b 348
349// one branch for raw clusters per chamber
237c933d 350 for (i=0; i<kNCH ;i++) {
2e5f0f7b 351 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
352
353 if (fRawClusters && gAlice->TreeR()) {
237c933d 354 gAlice->TreeR()->Branch(branchname,&((*fRawClusters)[i]), kBufferSize);
2e5f0f7b 355 printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1);
356 }
357 }
358
359 // one branch for rec hits per chamber
237c933d 360 for (i=0; i<kNCH ;i++) {
2e5f0f7b 361 sprintf(branchname,"%sRecHits%d",GetName(),i+1);
362
363 if (fRecHits && gAlice->TreeR()) {
237c933d 364 gAlice->TreeR()->Branch(branchname,&((*fRecHits)[i]), kBufferSize);
2e5f0f7b 365 printf("Making Branch %s for rec. hits in chamber %d\n",branchname,i+1);
366 }
367 }
fe4da5cc 368}
369
ddae0931 370//___________________________________________
371void AliRICH::SetTreeAddress()
fe4da5cc 372{
237c933d 373 // Set branch address for the Hits and Digits Tree.
2e5f0f7b 374 char branchname[20];
375 Int_t i;
376
ddae0931 377 AliDetector::SetTreeAddress();
378
379 TBranch *branch;
380 TTree *treeH = gAlice->TreeH();
381 TTree *treeD = gAlice->TreeD();
2e5f0f7b 382 TTree *treeR = gAlice->TreeR();
ddae0931 383
384 if (treeH) {
2e5f0f7b 385 if (fPadHits) {
386 branch = treeH->GetBranch("RICHPadHits");
387 if (branch) branch->SetAddress(&fPadHits);
fe4da5cc 388 }
ddae0931 389 if (fCerenkovs) {
390 branch = treeH->GetBranch("RICHCerenkov");
391 if (branch) branch->SetAddress(&fCerenkovs);
fe4da5cc 392 }
ddae0931 393 }
394
395 if (treeD) {
237c933d 396 for (int i=0; i<kNCH; i++) {
ddae0931 397 sprintf(branchname,"%sDigits%d",GetName(),i+1);
398 if (fDchambers) {
399 branch = treeD->GetBranch(branchname);
400 if (branch) branch->SetAddress(&((*fDchambers)[i]));
401 }
fe4da5cc 402 }
fe4da5cc 403 }
2e5f0f7b 404 if (treeR) {
237c933d 405 for (i=0; i<kNCH; i++) {
2e5f0f7b 406 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
407 if (fRawClusters) {
408 branch = treeR->GetBranch(branchname);
409 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
410 }
411 }
412
237c933d 413 for (i=0; i<kNCH; i++) {
2e5f0f7b 414 sprintf(branchname,"%sRecHits%d",GetName(),i+1);
415 if (fRecHits) {
416 branch = treeR->GetBranch(branchname);
417 if (branch) branch->SetAddress(&((*fRecHits)[i]));
418 }
419 }
420
421 }
ddae0931 422}
423//___________________________________________
424void AliRICH::ResetHits()
425{
237c933d 426 // Reset number of clusters and the cluster array for this detector
ddae0931 427 AliDetector::ResetHits();
2e5f0f7b 428 fNPadHits = 0;
429 fNcerenkovs = 0;
430 if (fPadHits) fPadHits->Clear();
ddae0931 431 if (fCerenkovs) fCerenkovs->Clear();
fe4da5cc 432}
433
2e5f0f7b 434
ddae0931 435//____________________________________________
436void AliRICH::ResetDigits()
437{
237c933d 438 //
439 // Reset number of digits and the digits array for this detector
440 //
441 for ( int i=0;i<kNCH;i++ ) {
ddae0931 442 if ((*fDchambers)[i]) (*fDchambers)[i]->Clear();
443 if (fNdch) fNdch[i]=0;
444 }
445}
2e5f0f7b 446
ddae0931 447//____________________________________________
2e5f0f7b 448void AliRICH::ResetRawClusters()
fe4da5cc 449{
237c933d 450 //
451 // Reset number of raw clusters and the raw clust array for this detector
452 //
453 for ( int i=0;i<kNCH;i++ ) {
2e5f0f7b 454 if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
455 if (fNrawch) fNrawch[i]=0;
fe4da5cc 456 }
ddae0931 457}
fe4da5cc 458
2e5f0f7b 459//____________________________________________
460void AliRICH::ResetRecHits()
fe4da5cc 461{
237c933d 462 //
463 // Reset number of raw clusters and the raw clust array for this detector
464 //
2e5f0f7b 465
237c933d 466 for ( int i=0;i<kNCH;i++ ) {
2e5f0f7b 467 if ((*fRecHits)[i]) ((TClonesArray*)(*fRecHits)[i])->Clear();
468 if (fNrechits) fNrechits[i]=0;
469 }
fe4da5cc 470}
471
ddae0931 472//___________________________________________
2e5f0f7b 473void AliRICH::SetGeometryModel(Int_t id, AliRICHGeometry *geometry)
fe4da5cc 474{
237c933d 475
476//
477// Setter for the RICH geometry model
478//
479
480
2e5f0f7b 481 ((AliRICHChamber*) (*fChambers)[id])->GeometryModel(geometry);
fe4da5cc 482}
483
ddae0931 484//___________________________________________
2e5f0f7b 485void AliRICH::SetSegmentationModel(Int_t id, AliRICHSegmentation *segmentation)
ddae0931 486{
237c933d 487
488//
489// Setter for the RICH segmentation model
490//
491
2e5f0f7b 492 ((AliRICHChamber*) (*fChambers)[id])->SegmentationModel(segmentation);
ddae0931 493}
fe4da5cc 494
ddae0931 495//___________________________________________
2e5f0f7b 496void AliRICH::SetResponseModel(Int_t id, AliRICHResponse *response)
fe4da5cc 497{
237c933d 498
499//
500// Setter for the RICH response model
501//
502
2e5f0f7b 503 ((AliRICHChamber*) (*fChambers)[id])->ResponseModel(response);
fe4da5cc 504}
505
2e5f0f7b 506void AliRICH::SetReconstructionModel(Int_t id, AliRICHClusterFinder *reconst)
ddae0931 507{
237c933d 508
509//
510// Setter for the RICH reconstruction model (clusters)
511//
512
2e5f0f7b 513 ((AliRICHChamber*) (*fChambers)[id])->ReconstructionModel(reconst);
fe4da5cc 514}
515
ddae0931 516void AliRICH::SetNsec(Int_t id, Int_t nsec)
517{
237c933d 518
519//
520// Sets the number of padplanes
521//
522
2e5f0f7b 523 ((AliRICHChamber*) (*fChambers)[id])->SetNsec(nsec);
ddae0931 524}
525
526
527//___________________________________________
528
529void AliRICH::StepManager()
fe4da5cc 530{
237c933d 531
532// Dummy step manager (should never be called)
533
ddae0931 534}
2e5f0f7b 535
237c933d 536void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
ddae0931 537{
2e5f0f7b 538
ddae0931 539//
540// Loop on chambers and on cathode planes
541//
2e5f0f7b 542 for (Int_t icat=1;icat<2;icat++) {
543 gAlice->ResetDigits();
544 gAlice->TreeD()->GetEvent(1); // spurious +1 ...
237c933d 545 for (Int_t ich=0;ich<kNCH;ich++) {
2e5f0f7b 546 AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
237c933d 547 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
548 if (pRICHdigits == 0)
2e5f0f7b 549 continue;
550 //
551 // Get ready the current chamber stuff
552 //
553 AliRICHResponse* response = iChamber->GetResponseModel();
554 AliRICHSegmentation* seg = iChamber->GetSegmentationModel();
555 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
556 if (seg) {
557 rec->SetSegmentation(seg);
558 rec->SetResponse(response);
237c933d 559 rec->SetDigits(pRICHdigits);
2e5f0f7b 560 rec->SetChamber(ich);
561 if (nev==0) rec->CalibrateCOG();
562 rec->FindRawClusters();
563 }
564 TClonesArray *fRch;
565 fRch=RawClustAddress(ich);
566 fRch->Sort();
567 } // for ich
568
569 gAlice->TreeR()->Fill();
570 TClonesArray *fRch;
237c933d 571 for (int i=0;i<kNCH;i++) {
2e5f0f7b 572 fRch=RawClustAddress(i);
573 int nraw=fRch->GetEntriesFast();
574 printf ("Chamber %d, raw clusters %d\n",i,nraw);
575 }
576
577 ResetRawClusters();
578
579 } // for icat
580
581 char hname[30];
582 sprintf(hname,"TreeR%d",nev);
583 gAlice->TreeR()->Write(hname);
584 gAlice->TreeR()->Reset();
585
586 //gObjectTable->Print();
ddae0931 587}
588
589
590//______________________________________________________________________________
591void AliRICH::Streamer(TBuffer &R__b)
592{
593 // Stream an object of class AliRICH.
2e5f0f7b 594 AliRICHChamber *iChamber;
595 AliRICHSegmentation *segmentation;
596 AliRICHResponse *response;
ddae0931 597 TClonesArray *digitsaddress;
2e5f0f7b 598 TClonesArray *rawcladdress;
599 TClonesArray *rechitaddress;
ddae0931 600
601 if (R__b.IsReading()) {
602 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
603 AliDetector::Streamer(R__b);
2e5f0f7b 604 R__b >> fNPadHits;
605 R__b >> fPadHits; // diff
606 R__b >> fNcerenkovs;
607 R__b >> fCerenkovs; // diff
ddae0931 608 R__b >> fDchambers;
2e5f0f7b 609 R__b >> fRawClusters;
610 R__b >> fRecHits; //diff
ddae0931 611 R__b.ReadArray(fNdch);
2e5f0f7b 612 R__b.ReadArray(fNrawch);
613 R__b.ReadArray(fNrechits);
614//
ddae0931 615 R__b >> fChambers;
616// Stream chamber related information
237c933d 617 for (Int_t i =0; i<kNCH; i++) {
2e5f0f7b 618 iChamber=(AliRICHChamber*) (*fChambers)[i];
ddae0931 619 iChamber->Streamer(R__b);
2e5f0f7b 620 segmentation=iChamber->GetSegmentationModel();
621 segmentation->Streamer(R__b);
622 response=iChamber->GetResponseModel();
ddae0931 623 response->Streamer(R__b);
2e5f0f7b 624 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
625 rawcladdress->Streamer(R__b);
626 rechitaddress=(TClonesArray*) (*fRecHits)[i];
627 rechitaddress->Streamer(R__b);
ddae0931 628 digitsaddress=(TClonesArray*) (*fDchambers)[i];
629 digitsaddress->Streamer(R__b);
630 }
631
632 } else {
633 R__b.WriteVersion(AliRICH::IsA());
634 AliDetector::Streamer(R__b);
2e5f0f7b 635 R__b << fNPadHits;
636 R__b << fPadHits; // diff
637 R__b << fNcerenkovs;
638 R__b << fCerenkovs; // diff
ddae0931 639 R__b << fDchambers;
2e5f0f7b 640 R__b << fRawClusters;
641 R__b << fRecHits; //diff
237c933d 642 R__b.WriteArray(fNdch, kNCH);
643 R__b.WriteArray(fNrawch, kNCH);
644 R__b.WriteArray(fNrechits, kNCH);
ddae0931 645 //
ddae0931 646 R__b << fChambers;
647// Stream chamber related information
237c933d 648 for (Int_t i =0; i<kNCH; i++) {
2e5f0f7b 649 iChamber=(AliRICHChamber*) (*fChambers)[i];
ddae0931 650 iChamber->Streamer(R__b);
2e5f0f7b 651 segmentation=iChamber->GetSegmentationModel();
652 segmentation->Streamer(R__b);
653 response=iChamber->GetResponseModel();
ddae0931 654 response->Streamer(R__b);
2e5f0f7b 655 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
656 rawcladdress->Streamer(R__b);
657 rechitaddress=(TClonesArray*) (*fRecHits)[i];
658 rechitaddress->Streamer(R__b);
ddae0931 659 digitsaddress=(TClonesArray*) (*fDchambers)[i];
660 digitsaddress->Streamer(R__b);
661 }
fe4da5cc 662 }
ddae0931 663}
2e5f0f7b 664AliRICHPadHit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters )
ddae0931 665{
666//
667 // Initialise the pad iterator
668 // Return the address of the first padhit for hit
669 TClonesArray *theClusters = clusters;
670 Int_t nclust = theClusters->GetEntriesFast();
671 if (nclust && hit->fPHlast > 0) {
2e5f0f7b 672 sMaxIterPad=Int_t(hit->fPHlast);
673 sCurIterPad=Int_t(hit->fPHfirst);
674 return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1);
ddae0931 675 } else {
676 return 0;
fe4da5cc 677 }
ddae0931 678
fe4da5cc 679}
680
2e5f0f7b 681AliRICHPadHit* AliRICH::NextPad(TClonesArray *clusters)
fe4da5cc 682{
237c933d 683
684 // Iterates over pads
685
ddae0931 686 sCurIterPad++;
687 if (sCurIterPad <= sMaxIterPad) {
2e5f0f7b 688 return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1);
ddae0931 689 } else {
690 return 0;
691 }
fe4da5cc 692}
693
fe4da5cc 694
d28b5fc2 695void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename)
fe4da5cc 696{
ddae0931 697 // keep galice.root for signal and name differently the file for
698 // background when add! otherwise the track info for signal will be lost !
2e5f0f7b 699
c90dd3e2 700 static Bool_t first=kTRUE;
237c933d 701 static TFile *pFile;
702 char *addBackground = strstr(option,"Add");
ddae0931 703
2e5f0f7b 704 FILE* points; //these will be the digits...
705
706 points=fopen("points.dat","w");
707
708 AliRICHChamber* iChamber;
709 AliRICHSegmentation* segmentation;
ddae0931 710
d28b5fc2 711 Int_t digitse=0;
ddae0931 712 Int_t trk[50];
713 Int_t chtrk[50];
714 TObjArray *list=new TObjArray;
237c933d 715 static TClonesArray *pAddress=0;
716 if(!pAddress) pAddress=new TClonesArray("TVector",1000);
2e5f0f7b 717 Int_t digits[5];
ddae0931 718
237c933d 719 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
720 AliRICHHitMap* pHitMap[10];
2e5f0f7b 721 Int_t i;
237c933d 722 for (i=0; i<10; i++) {pHitMap[i]=0;}
723 if (addBackground ) {
ddae0931 724 if(first) {
725 fFileName=filename;
726 cout<<"filename"<<fFileName<<endl;
237c933d 727 pFile=new TFile(fFileName);
ddae0931 728 cout<<"I have opened "<<fFileName<<" file "<<endl;
2e5f0f7b 729 fHits2 = new TClonesArray("AliRICHHit",1000 );
730 fClusters2 = new TClonesArray("AliRICHPadHit",10000);
c90dd3e2 731 first=kFALSE;
ddae0931 732 }
237c933d 733 pFile->cd();
ddae0931 734 // Get Hits Tree header from file
735 if(fHits2) fHits2->Clear();
736 if(fClusters2) fClusters2->Clear();
2e5f0f7b 737 if(TrH1) delete TrH1;
738 TrH1=0;
739
ddae0931 740 char treeName[20];
741 sprintf(treeName,"TreeH%d",nev);
2e5f0f7b 742 TrH1 = (TTree*)gDirectory->Get(treeName);
743 if (!TrH1) {
ddae0931 744 printf("ERROR: cannot find Hits Tree for event:%d\n",nev);
745 }
746 // Set branch addresses
747 TBranch *branch;
748 char branchname[20];
749 sprintf(branchname,"%s",GetName());
2e5f0f7b 750 if (TrH1 && fHits2) {
751 branch = TrH1->GetBranch(branchname);
ddae0931 752 if (branch) branch->SetAddress(&fHits2);
753 }
2e5f0f7b 754 if (TrH1 && fClusters2) {
755 branch = TrH1->GetBranch("RICHCluster");
ddae0931 756 if (branch) branch->SetAddress(&fClusters2);
757 }
758 }
759 //
760 // loop over cathodes
761 //
762 AliRICHHitMap* hm;
2e5f0f7b 763 Int_t countadr=0;
f91473f6 764 for (int icat=0; icat<1; icat++) {
ddae0931 765 Int_t counter=0;
237c933d 766 for (i =0; i<kNCH; i++) {
2e5f0f7b 767 iChamber=(AliRICHChamber*) (*fChambers)[i];
ddae0931 768 if (iChamber->Nsec()==1 && icat==1) {
769 continue;
770 } else {
771 segmentation=iChamber->GetSegmentationModel(icat+1);
772 }
237c933d 773 pHitMap[i] = new AliRICHHitMapA1(segmentation, list);
ddae0931 774 }
ddae0931 775//
776// Loop over tracks
777//
778
237c933d 779 TTree *treeH = gAlice->TreeH();
780 Int_t ntracks =(Int_t) treeH->GetEntries();
ddae0931 781 for (Int_t track=0; track<ntracks; track++) {
782 gAlice->ResetHits();
237c933d 783 treeH->GetEvent(track);
ddae0931 784//
785// Loop over hits
237c933d 786 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
ddae0931 787 mHit;
237c933d 788 mHit=(AliRICHHit*)pRICH->NextHit())
ddae0931 789 {
d28b5fc2 790
791 digitse=0;
792
793 Int_t nch = mHit->fChamber-1; // chamber number
237c933d 794 if (nch >kNCH) continue;
795 iChamber = &(pRICH->Chamber(nch));
d28b5fc2 796
797 TParticle *current = (TParticle*)(*gAlice->Particles())[track];
798
799 Int_t particle = current->GetPdgCode();
800
801 //printf("Flag:%d\n",flag);
802 //printf("Track:%d\n",track);
803 //printf("Particle:%d\n",particle);
804
805 if (flag == 0)
806 digitse=1;
807
808 if (flag == 1)
809 if(TMath::Abs(particle) == 211 || TMath::Abs(particle) == 111)
810 digitse=1;
811
812 if (flag == 2)
813 if(TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
814 || TMath::Abs(particle)==311)
815 digitse=1;
816
817 if (flag == 3 && TMath::Abs(particle)==2212)
818 digitse=1;
819
820 if (flag == 4 && TMath::Abs(particle)==13)
821 digitse=1;
822
823 if (flag == 5 && TMath::Abs(particle)==11)
824 digitse=1;
825
826 if (flag == 6 && TMath::Abs(particle)==2112)
827 digitse=1;
828
829
830 //printf ("Particle: %d, Flag: %d, Digitse: %d\n",particle,flag,digitse);
831
832
833 if (digitse)
834 {
2e5f0f7b 835
ddae0931 836//
837// Loop over pad hits
d28b5fc2 838 for (AliRICHPadHit* mPad=
237c933d 839 (AliRICHPadHit*)pRICH->FirstPad(mHit,fPadHits);
d28b5fc2 840 mPad;
237c933d 841 mPad=(AliRICHPadHit*)pRICH->NextPad(fPadHits))
d28b5fc2 842 {
843 Int_t cathode = mPad->fCathode; // cathode number
844 Int_t ipx = mPad->fPadX; // pad number on X
845 Int_t ipy = mPad->fPadY; // pad number on Y
846 Int_t iqpad = mPad->fQpad; // charge per pad
847 //
848 //
849 //printf("X:%d, Y:%d, Q:%d\n",ipx,ipy,iqpad);
850
851 Float_t thex, they;
852 segmentation=iChamber->GetSegmentationModel(cathode);
853 segmentation->GetPadCxy(ipx,ipy,thex,they);
237c933d 854 new((*pAddress)[countadr++]) TVector(2);
855 TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
d28b5fc2 856 trinfo(0)=(Float_t)track;
857 trinfo(1)=(Float_t)iqpad;
858
859 digits[0]=ipx;
860 digits[1]=ipy;
861 digits[2]=iqpad;
862
863 AliRICHTransientDigit* pdigit;
864 // build the list of fired pads and update the info
237c933d 865 if (!pHitMap[nch]->TestHit(ipx, ipy)) {
d28b5fc2 866 list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter);
237c933d 867 pHitMap[nch]->SetHit(ipx, ipy, counter);
ddae0931 868 counter++;
2e5f0f7b 869 pdigit=(AliRICHTransientDigit*)list->At(list->GetLast());
ddae0931 870 // list of tracks
871 TObjArray *trlist=(TObjArray*)pdigit->TrackList();
872 trlist->Add(&trinfo);
d28b5fc2 873 } else {
237c933d 874 pdigit=(AliRICHTransientDigit*) pHitMap[nch]->GetHit(ipx, ipy);
ddae0931 875 // update charge
876 (*pdigit).fSignal+=iqpad;
877 // update list of tracks
878 TObjArray* trlist=(TObjArray*)pdigit->TrackList();
237c933d 879 Int_t lastEntry=trlist->GetLast();
880 TVector *ptrkP=(TVector*)trlist->At(lastEntry);
881 TVector &ptrk=*ptrkP;
882 Int_t lastTrack=Int_t(ptrk(0));
883 Int_t lastCharge=Int_t(ptrk(1));
884 if (lastTrack==track) {
885 lastCharge+=iqpad;
886 trlist->RemoveAt(lastEntry);
887 trinfo(0)=lastTrack;
888 trinfo(1)=lastCharge;
889 trlist->AddAt(&trinfo,lastEntry);
ddae0931 890 } else {
891 trlist->Add(&trinfo);
892 }
893 // check the track list
894 Int_t nptracks=trlist->GetEntriesFast();
895 if (nptracks > 2) {
2e5f0f7b 896 printf("Attention - tracks: %d (>2)\n",nptracks);
897 //printf("cat,nch,ix,iy %d %d %d %d \n",icat+1,nch,ipx,ipy);
ddae0931 898 for (Int_t tr=0;tr<nptracks;tr++) {
237c933d 899 TVector *pptrkP=(TVector*)trlist->At(tr);
900 TVector &pptrk=*pptrkP;
ddae0931 901 trk[tr]=Int_t(pptrk(0));
902 chtrk[tr]=Int_t(pptrk(1));
903 }
904 } // end if nptracks
d28b5fc2 905 } // end if pdigit
906 } //end loop over clusters
907 }// track type condition
ddae0931 908 } // hit loop
909 } // track loop
910
ddae0931 911 // open the file with background
912
237c933d 913 if (addBackground ) {
2e5f0f7b 914 ntracks =(Int_t)TrH1->GetEntries();
915 //printf("background - icat,ntracks1 %d %d\n",icat,ntracks);
916 //printf("background - Start loop over tracks \n");
ddae0931 917//
918// Loop over tracks
919//
f91473f6 920 for (Int_t trak=0; trak<ntracks; trak++) {
ddae0931 921 if (fHits2) fHits2->Clear();
922 if (fClusters2) fClusters2->Clear();
2e5f0f7b 923 TrH1->GetEvent(trak);
ddae0931 924//
925// Loop over hits
2e5f0f7b 926 AliRICHHit* mHit;
f91473f6 927 for(int j=0;j<fHits2->GetEntriesFast();++j)
ddae0931 928 {
2e5f0f7b 929 mHit=(AliRICHHit*) (*fHits2)[j];
ddae0931 930 Int_t nch = mHit->fChamber-1; // chamber number
2e5f0f7b 931 if (nch >6) continue;
237c933d 932 iChamber = &(pRICH->Chamber(nch));
ddae0931 933 Int_t rmin = (Int_t)iChamber->RInner();
934 Int_t rmax = (Int_t)iChamber->ROuter();
935//
936// Loop over pad hits
2e5f0f7b 937 for (AliRICHPadHit* mPad=
237c933d 938 (AliRICHPadHit*)pRICH->FirstPad(mHit,fClusters2);
ddae0931 939 mPad;
237c933d 940 mPad=(AliRICHPadHit*)pRICH->NextPad(fClusters2))
ddae0931 941 {
942 Int_t cathode = mPad->fCathode; // cathode number
943 Int_t ipx = mPad->fPadX; // pad number on X
944 Int_t ipy = mPad->fPadY; // pad number on Y
945 Int_t iqpad = mPad->fQpad; // charge per pad
f91473f6 946 if (trak==3 && nch==0 && icat==0) printf("bgr - trak,iqpad,ipx,ipy %d %d %d %d\n",trak,iqpad,ipx,ipy);
ddae0931 947//
948//
ddae0931 949 Float_t thex, they;
950 segmentation=iChamber->GetSegmentationModel(cathode);
951 segmentation->GetPadCxy(ipx,ipy,thex,they);
952 Float_t rpad=TMath::Sqrt(thex*thex+they*they);
953 if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
237c933d 954 new((*pAddress)[countadr++]) TVector(2);
955 TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
ddae0931 956 trinfo(0)=-1; // tag background
957 trinfo(1)=-1;
ddae0931 958 digits[0]=ipx;
959 digits[1]=ipy;
960 digits[2]=iqpad;
f91473f6 961 if (trak <4 && icat==0 && nch==0)
237c933d 962 printf("bgr - pHitMap[nch]->TestHit(ipx, ipy),trak %d %d\n",
963 pHitMap[nch]->TestHit(ipx, ipy),trak);
2e5f0f7b 964 AliRICHTransientDigit* pdigit;
ddae0931 965 // build the list of fired pads and update the info
237c933d 966 if (!pHitMap[nch]->TestHit(ipx, ipy)) {
2e5f0f7b 967 list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter);
ddae0931 968
237c933d 969 pHitMap[nch]->SetHit(ipx, ipy, counter);
ddae0931 970 counter++;
971 printf("bgr new elem in list - counter %d\n",counter);
972
2e5f0f7b 973 pdigit=(AliRICHTransientDigit*)list->At(list->GetLast());
ddae0931 974 // list of tracks
975 TObjArray *trlist=(TObjArray*)pdigit->TrackList();
976 trlist->Add(&trinfo);
977 } else {
237c933d 978 pdigit=(AliRICHTransientDigit*) pHitMap[nch]->GetHit(ipx, ipy);
ddae0931 979 // update charge
980 (*pdigit).fSignal+=iqpad;
981 // update list of tracks
982 TObjArray* trlist=(TObjArray*)pdigit->TrackList();
237c933d 983 Int_t lastEntry=trlist->GetLast();
984 TVector *ptrkP=(TVector*)trlist->At(lastEntry);
985 TVector &ptrk=*ptrkP;
986 Int_t lastTrack=Int_t(ptrk(0));
987 if (lastTrack==-1) {
ddae0931 988 continue;
989 } else {
990 trlist->Add(&trinfo);
991 }
992 // check the track list
993 Int_t nptracks=trlist->GetEntriesFast();
994 if (nptracks > 0) {
995 for (Int_t tr=0;tr<nptracks;tr++) {
237c933d 996 TVector *pptrkP=(TVector*)trlist->At(tr);
997 TVector &pptrk=*pptrkP;
ddae0931 998 trk[tr]=Int_t(pptrk(0));
999 chtrk[tr]=Int_t(pptrk(1));
1000 }
1001 } // end if nptracks
1002 } // end if pdigit
1003 } //end loop over clusters
1004 } // hit loop
1005 } // track loop
ddae0931 1006 TTree *fAli=gAlice->TreeK();
237c933d 1007 if (fAli) pFile =fAli->GetCurrentFile();
1008 pFile->cd();
ddae0931 1009 } // if Add
1010
1011 Int_t tracks[10];
1012 Int_t charges[10];
2e5f0f7b 1013 //cout<<"Start filling digits \n "<<endl;
ddae0931 1014 Int_t nentries=list->GetEntriesFast();
2e5f0f7b 1015 //printf(" \n \n nentries %d \n",nentries);
ddae0931 1016
1017 // start filling the digits
1018
1019 for (Int_t nent=0;nent<nentries;nent++) {
2e5f0f7b 1020 AliRICHTransientDigit *address=(AliRICHTransientDigit*)list->At(nent);
ddae0931 1021 if (address==0) continue;
1022 Int_t ich=address->fChamber;
1023 Int_t q=address->fSignal;
2e5f0f7b 1024 iChamber=(AliRICHChamber*) (*fChambers)[ich];
1025 AliRICHResponse * response=iChamber->GetResponseModel();
1026 Int_t adcmax= (Int_t) response->MaxAdc();
1027 // add white noise and do zero-suppression and signal truncation (new electronics,old electronics gaus 1.2,0.2)
237c933d 1028 Float_t meanNoise = gRandom->Gaus(1.7, 0.25);
1029 Float_t noise = gRandom->Gaus(0, meanNoise);
1030 q+=(Int_t)noise;
2e5f0f7b 1031// magic number to be parametrised !!!
1032 if ( q <= 6.8) continue;
1033 if ( q >= adcmax) q=adcmax;
ddae0931 1034 digits[0]=address->fPadX;
1035 digits[1]=address->fPadY;
1036 digits[2]=q;
1037
1038 TObjArray* trlist=(TObjArray*)address->TrackList();
1039 Int_t nptracks=trlist->GetEntriesFast();
1040
1041 // this was changed to accomodate the real number of tracks
1042 if (nptracks > 10) {
2e5f0f7b 1043 cout<<"Attention - tracks > 10 "<<nptracks<<endl;
ddae0931 1044 nptracks=10;
1045 }
1046 if (nptracks > 2) {
2e5f0f7b 1047 printf("Attention - tracks > 2 %d \n",nptracks);
1048 //printf("cat,ich,ix,iy,q %d %d %d %d %d \n",
1049 //icat,ich,digits[0],digits[1],q);
ddae0931 1050 }
1051 for (Int_t tr=0;tr<nptracks;tr++) {
237c933d 1052 TVector *ppP=(TVector*)trlist->At(tr);
1053 TVector &pp =*ppP;
ddae0931 1054 tracks[tr]=Int_t(pp(0));
1055 charges[tr]=Int_t(pp(1));
1056 } //end loop over list of tracks for one pad
1057 if (nptracks < 10 ) {
f91473f6 1058 for (Int_t t=nptracks; t<10; t++) {
1059 tracks[t]=0;
1060 charges[t]=0;
ddae0931 1061 }
1062 }
2e5f0f7b 1063 //write file
1064 if (ich==2)
1065 fprintf(points,"%4d, %4d, %4d\n",digits[0],digits[1],digits[2]);
1066
ddae0931 1067 // fill digits
237c933d 1068 pRICH->AddDigits(ich,tracks,charges,digits);
ddae0931 1069 }
ddae0931 1070 gAlice->TreeD()->Fill();
2e5f0f7b 1071
1072 list->Delete();
237c933d 1073 for(Int_t ii=0;ii<kNCH;++ii) {
1074 if (pHitMap[ii]) {
1075 hm=pHitMap[ii];
2e5f0f7b 1076 delete hm;
237c933d 1077 pHitMap[ii]=0;
2e5f0f7b 1078 }
1079 }
1080
1081 //TTree *TD=gAlice->TreeD();
1082 //Stat_t ndig=TD->GetEntries();
1083 //cout<<"number of digits "<<ndig<<endl;
ddae0931 1084 TClonesArray *fDch;
237c933d 1085 for (int k=0;k<kNCH;k++) {
1086 fDch= pRICH->DigitsAddress(k);
c90dd3e2 1087 int ndigit=fDch->GetEntriesFast();
2e5f0f7b 1088 printf ("Chamber %d digits %d \n",k,ndigit);
ddae0931 1089 }
237c933d 1090 pRICH->ResetDigits();
ddae0931 1091 } //end loop over cathodes
1092 char hname[30];
1093 sprintf(hname,"TreeD%d",nev);
1094 gAlice->TreeD()->Write(hname);
ddae0931 1095
2e5f0f7b 1096// reset tree
1097// gAlice->TreeD()->Reset();
1098 delete list;
237c933d 1099 pAddress->Clear();
2e5f0f7b 1100// gObjectTable->Print();
1101}
ddae0931 1102
237c933d 1103AliRICH& AliRICH::operator=(const AliRICH& rhs)
1104{
1105// Assignment operator
1106 return *this;
1107
1108}
ddae0931 1109
237c933d 1110Int_t AliRICH::MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
1111{
1112//
1113// Calls the charge disintegration method of the current chamber and adds
1114// the simulated cluster to the root treee
1115//
1116 Int_t clhits[kNCH];
1117 Float_t newclust[6][500];
1118 Int_t nnew;
1119
1120//
1121// Integrated pulse height on chamber
1122
1123 clhits[0]=fNhits+1;
1124
1125 ((AliRICHChamber*) (*fChambers)[idvol])->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
1126 Int_t ic=0;
1127
1128//
1129// Add new clusters
1130 for (Int_t i=0; i<nnew; i++) {
1131 if (Int_t(newclust[3][i]) > 0) {
1132 ic++;
1133// Cathode plane
1134 clhits[1] = Int_t(newclust[5][i]);
1135// Cluster Charge
1136 clhits[2] = Int_t(newclust[0][i]);
1137// Pad: ix
1138 clhits[3] = Int_t(newclust[1][i]);
1139// Pad: iy
1140 clhits[4] = Int_t(newclust[2][i]);
1141// Pad: charge
1142 clhits[5] = Int_t(newclust[3][i]);
1143// Pad: chamber sector
1144 clhits[6] = Int_t(newclust[4][i]);
1145
1146 AddPadHit(clhits);
1147 }
1148 }
1149return nnew;
1150}
ddae0931 1151