]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITS.cxx
Bug fix
[u/mrichter/AliRoot.git] / ITS / AliITS.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
88cb7938 16/* $Id$ */
2ab0c725 17
4c039060 18
fe4da5cc 19///////////////////////////////////////////////////////////////////////////////
04366a57 20// //
21// An overview of the basic philosophy of the ITS code development //
22// and analysis is show in the figure below. //
23//Begin_Html //
24/*
a92b2b7d 25<img src="picts/ITS/ITS_Analysis_schema.gif">
fe4da5cc 26</pre>
27<br clear=left>
28<font size=+2 color=red>
58005f18 29<p>Roberto Barbera is in charge of the ITS Offline code (1999).
fe4da5cc 30<a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
31</font>
32<pre>
33*/
34//End_Html
58005f18 35//
36// AliITS. Inner Traking System base class.
37// This class contains the base procedures for the Inner Tracking System
38//
39//Begin_Html
40/*
a92b2b7d 41<img src="picts/ITS/AliITS_Class_Diagram.gif">
58005f18 42</pre>
43<br clear=left>
44<font size=+2 color=red>
45<p>This show the class diagram of the different elements that are part of
46the AliITS class.
47</font>
48<pre>
49*/
50//End_Html
51//
52// Version: 0
53// Written by Rene Brun, Federico Carminati, and Roberto Barbera
54//
55// Version: 1
56// Modified and documented by Bjorn S. Nilsen
57// July 11 1999
58//
3bd79107 59// Version: 2
60// Modified and documented by A. Bologna
61// October 18 1999
62//
58005f18 63// AliITS is the general base class for the ITS. Also see AliDetector for
64// futher information.
65//
fe4da5cc 66///////////////////////////////////////////////////////////////////////////////
88cb7938 67
143d1056 68#include <stdlib.h>
caf37aec 69#include <TClonesArray.h>
9c74c52b 70#include <TFile.h>
7d62fb64 71#include <TParticle.h>
d5da1ecf 72#include <TString.h>
88cb7938 73#include <TTree.h>
88cb7938 74#include <TVirtualMC.h>
7d62fb64 75#include "AliDetector.h"
3bd79107 76#include "AliITS.h"
7d62fb64 77#include "AliITSDetTypeSim.h"
f77f13c8 78#include "AliITSDDLRawData.h"
88cb7938 79#include "AliITSLoader.h"
88cb7938 80#include "AliITShit.h"
81#include "AliITSmodule.h"
7d62fb64 82#include "AliITSpListItem.h"
83#include "AliITSsimulation.h"
84#include "AliITSsimulationFastPoints.h"
5d12ce38 85#include "AliMC.h"
7d62fb64 86#include "AliITSDigitizer.h"
87#include "AliITSRecPoint.h"
0b5bf101 88#include "AliITSsegmentationSPD.h"
89#include "AliITSsegmentationSDD.h"
90#include "AliITSsegmentationSSD.h"
91#include "AliITSRawStreamSPD.h"
92#include "AliITSRawStreamSSD.h"
93#include "AliITSRawStreamSDD.h"
94#include "AliITSresponseSDD.h"
95#include "AliRawReader.h"
f77f13c8 96#include "AliRun.h"
7d62fb64 97#include "AliLog.h"
ef7ff1f9 98#include "AliITSInitGeometry.h"
828e06c7 99
3bd79107 100ClassImp(AliITS)
3bd79107 101
2aea926d 102//______________________________________________________________________
ed9289c8 103AliITS::AliITS() : AliDetector(),
104fDetTypeSim(0),
105fEuclidOut(0),
106fOpt("All"),
107fIdN(0),
108fIdSens(0),
109fIdName(0),
012f0f4c 110fITSmodules(0),
111fTiming(kFALSE)
ed9289c8 112{
7d62fb64 113 // Default initializer for ITS
114 // The default constructor of the AliITS class. In addition to
115 // creating the AliITS class it zeros the variables fIshunt (a member
116 // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
117 // fIdSens, and fIdName. The AliDetector default constructor
118 // is also called.
119
aa044888 120// SetDetectors(); // default to fOpt="All". This variable not written out.
e939a978 121//PH SetMarkerColor(kRed);
fe4da5cc 122}
2aea926d 123//______________________________________________________________________
012f0f4c 124AliITS::AliITS(const Char_t *title):AliDetector("ITS",title),
125fDetTypeSim(0),
126fEuclidOut(0),
127fOpt("All"),
128fIdN(0),
129fIdSens(0),
130fIdName(0),
131fITSmodules(0),
132fTiming(kFALSE)
133{
134 // The standard Constructor for the ITS class.
135 // It also zeros the variables
136 // fIshunt (a member of AliDetector class), fEuclidOut, and zeros
137 // the pointers fIdSens and fIdName. To help in displaying hits via the
138 // ROOT macro display.C AliITS also sets the marker color to red. The
139 // variables passes with this constructor, const char *name and *title,
140 // are used by the constructor of AliDetector class. See AliDetector
141 // class for a description of these parameters and its constructor
142 // functions.
143 // Inputs:
144 // Char_t *title Simulation title for the ITS
145 // Outputs:
146 // none.
147 // Return:
148 // none.
149
150 fHits = new TClonesArray("AliITShit",1560); // from AliDetector
151 if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);
152 //fNhits=0; //done in AliDetector(name,title)
153 SetDetectors(); // default to fOpt="All". This variable not written out.
154 fDetTypeSim = new AliITSDetTypeSim();
155 //PH SetMarkerColor(kRed);
156 if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
157 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
158}
159//______________________________________________________________________
ed9289c8 160AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
161fDetTypeSim(0),
162fEuclidOut(0),
163fOpt("All"),
164fIdN(0),
165fIdSens(0),
166fIdName(0),
012f0f4c 167fITSmodules(0),
168fTiming(kFALSE)
ed9289c8 169{
7d62fb64 170 // The standard Constructor for the ITS class.
171 // It also zeros the variables
172 // fIshunt (a member of AliDetector class), fEuclidOut, and zeros
173 // the pointers fIdSens and fIdName. To help in displaying hits via the
174 // ROOT macro display.C AliITS also sets the marker color to red. The
175 // variables passes with this constructor, const char *name and *title,
176 // are used by the constructor of AliDetector class. See AliDetector
177 // class for a description of these parameters and its constructor
178 // functions.
179
7d62fb64 180 fHits = new TClonesArray("AliITShit",1560);
181 if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);
ed9289c8 182 //fNhits=0; //done in AliDetector(name,title)
7d62fb64 183
7d62fb64 184 SetDetectors(); // default to fOpt="All". This variable not written out.
ed9289c8 185
7d62fb64 186 fDetTypeSim = new AliITSDetTypeSim();
187
e939a978 188 //PH SetMarkerColor(kRed);
023ae34b 189 if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
190 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
fe4da5cc 191
3bd79107 192}
2aea926d 193//______________________________________________________________________
58005f18 194AliITS::~AliITS(){
4a5bebc2 195 // Default destructor for ITS.
2aea926d 196 // The default destructor of the AliITS class. In addition to deleting
7d62fb64 197 // the AliITS class it deletes the memory pointed to by
198 // fIdSens, fIdName, fDetTypeSim and it's contents.
4a5bebc2 199 // Inputs:
200 // none.
201 // Outputs:
202 // none.
203 // Return:
204 // none.
023ae34b 205
88cb7938 206 if (fHits) {
207 fHits->Delete();
208 delete fHits;
209 fHits=0;
210 }
88cb7938 211 if(fITSmodules) {
212 this->ClearModules();
213 delete fITSmodules;
279a35d7 214 fITSmodules = 0;
88cb7938 215 }// end if fITSmodules!=0
216
7d62fb64 217 delete[] fIdName; // Array of TStrings
218 delete[] fIdSens;
219
220 if (fDetTypeSim){
221 delete fDetTypeSim;
222 fDetTypeSim = 0;
223 }
3bd79107 224}
2aea926d 225//______________________________________________________________________
aacedc3e 226AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager)const{
227 // Creates the AliITSDigitizer in a standard way for use via AliModule.
228 // This function can not be included in the .h file because of problems
229 // with the order of inclusion (recursive).
4a5bebc2 230 // Inputs:
aacedc3e 231 // AliRunDigitizer *manager The Manger class for Digitization
232 // Output:
233 // none.
4a5bebc2 234 // Return:
aacedc3e 235 // A new AliITSRunDigitizer (cast as a AliDigitizer).
3bd79107 236
aacedc3e 237 return new AliITSDigitizer(manager);
3bd79107 238}
2aea926d 239//______________________________________________________________________
240void AliITS::Init(){
4a5bebc2 241 // Initializer ITS after it has been built
2aea926d 242 // This routine initializes the AliITS class. It is intended to be
243 // called from the Init function in AliITSv?. Besides displaying a banner
244 // indicating that it has been called it initializes the array fIdSens
245 // and sets the default segmentation, response, digit and raw cluster
246 // classes therefore it should be called after a call to CreateGeometry.
4a5bebc2 247 // Inputs:
248 // none.
249 // Outputs:
250 // none.
251 // Return:
252 // none.
3bd79107 253 Int_t i;
2aea926d 254 // Array of TStrings
0e73d04c 255 if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
7d62fb64 256
7d62fb64 257}
258
7d62fb64 259
2aea926d 260//______________________________________________________________________
261void AliITS::SetDefaults(){
4a5bebc2 262 // sets the default segmentation, response, digit and raw cluster classes.
263 // Inputs:
264 // none.
265 // Outputs:
266 // none.
267 // Return:
268 // none.
023ae34b 269 AliInfoClass("AliITS::Setting Defaults");
7d62fb64 270 if(!fDetTypeSim) {
271 Error("SetDefaults()","fDetTypeSim is 0!");
272 return;
273 }
274
275 fDetTypeSim->SetDefaults();
276
277
3bd79107 278}
2aea926d 279//______________________________________________________________________
280void AliITS::SetDefaultSimulation(){
4a5bebc2 281 // sets the default simulation.
282 // Inputs:
283 // none.
284 // Outputs:
285 // none.
286 // Return:
287 // none.
7d62fb64 288 if(!fDetTypeSim) {
289 Error("SetDefaultSimulation()","fDetTypeSim is 0!");
290 return;
291 }
292
293 fDetTypeSim->SetDefaultSimulation();
04366a57 294
04366a57 295}
296
297
2aea926d 298//______________________________________________________________________
88cb7938 299void AliITS::MakeBranch(Option_t* option){
2aea926d 300 // Creates Tree branches for the ITS.
4a5bebc2 301 // Inputs:
302 // Option_t *option String of Tree types S,D, and/or R.
303 // const char *file String of the file name where these branches
304 // are to be stored. If blank then these branches
305 // are written to the same tree as the Hits were
306 // read from.
307 // Outputs:
308 // none.
309 // Return:
310 // none.
7d62fb64 311 if(!fDetTypeSim) {
312 Error("MakeBranch","fDetTypeSim is 0!");
313 return;
314 }
04366a57 315
7d62fb64 316 Bool_t cH = (strstr(option,"H")!=0);
317 Bool_t cS = (strstr(option,"S")!=0);
318 Bool_t cD = (strstr(option,"D")!=0);
319
320 if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
321 AliDetector::MakeBranch(option);
322
323 if(cS) MakeBranchS(0);
324 if(cD) MakeBranchD(0);
325
326
327}
328//___________________________________________________________________
329void AliITS::MakeBranchS(const char* fl){
330
331 // Creates Tree Branch for the ITS summable digits.
332 // Inputs:
333 // cont char *fl File name where SDigits branch is to be written
334 // to. If blank it write the SDigits to the same
335 // file in which the Hits were found.
336
337
338 if(!fDetTypeSim){
339 Error("MakeBranchS","fDetTypeSim is 0!");
340 }
341 Int_t buffersize = 4000;
342 char branchname[30];
343
344 // only one branch for SDigits.
345 sprintf(branchname,"%s",GetName());
346
347 if(fLoader->TreeS()){
348 if(fDetTypeSim->GetSDigits()==0x0) fDetTypeSim->SetSDigits(new TClonesArray("AliITSpListItem",1000));
349 TClonesArray* sdig = (TClonesArray*)fDetTypeSim->GetSDigits();
350 MakeBranchInTree(fLoader->TreeS(),branchname,&sdig,buffersize,fl);
351 }
352}
353//______________________________________________________________________
354void AliITS::MakeBranchD(const char* file){
355
356 //Make branch for digits
357 if(!fDetTypeSim) {
358 Warning("MakeBranchD","fDetTypeSim is 0!");
359 return;
360 }
023ae34b 361 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 362 MakeBranchInTreeD(fLoader->TreeD(),file);
363}
364
365//___________________________________________________________________
366void AliITS:: MakeBranchInTreeD(TTree* treeD, const char* file){
367 // Creates Tree branches for the ITS.
368
369 if(!fDetTypeSim){
370 Error("MakeBranchS","fDetTypeSim is 0!");
371 }
023ae34b 372 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 373
374 const Char_t *det[3] = {"SPD","SDD","SSD"};
375 Char_t* digclass;
376 Int_t buffersize = 4000;
377 Char_t branchname[30];
378
379 if(!fDetTypeSim->GetDigits()){
380 fDetTypeSim->SetDigits(new TObjArray(fgkNTYPES));
381 }
382 for(Int_t i=0;i<fgkNTYPES;i++){
383 digclass = fDetTypeSim->GetDigitClassName(i);
384 TString classn = digclass;
385 if(!((fDetTypeSim->GetDigits())->At(i))){
386 (fDetTypeSim->GetDigits())->AddAt(new TClonesArray(classn.Data(),1000),i);
387 }
388 else ResetDigits(i);
389 if(fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
390 else sprintf(branchname,"%sDigits%d",GetName(),i+1);
391 TObjArray* dig = DigitsAddress(i);
392 if(GetDigits() && treeD) AliDetector::MakeBranchInTree(treeD,branchname, &dig,buffersize,file);
393 }
2aea926d 394
fe4da5cc 395}
2aea926d 396//______________________________________________________________________
397void AliITS::SetTreeAddress(){
398 // Set branch address for the Trees.
4a5bebc2 399 // Inputs:
400 // none.
401 // Outputs:
402 // none.
403 // Return:
404 // none.
023ae34b 405
7d62fb64 406 if(!fDetTypeSim) {
407 Error("SetTreeAddress","fDetTypeSim is 0!");
408 return;
409 }
410
023ae34b 411 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 412
413 TTree *treeS = fLoader->TreeS();
414 TTree *treeD = fLoader->TreeD();
415 if (fLoader->TreeH() && (fHits == 0x0)) {
416 fHits = new TClonesArray("AliITShit", 1560);
417 }
418 AliDetector::SetTreeAddress();
419
420 fDetTypeSim->SetTreeAddressS(treeS, (Char_t*)GetName());
421 fDetTypeSim->SetTreeAddressD(treeD, (Char_t*)GetName());
fe4da5cc 422}
2aea926d 423//______________________________________________________________________
2aea926d 424void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
425 // Add an ITS hit
426 // The function to add information to the AliITShit class. See the
427 // AliITShit class for a full description. This function allocates the
428 // necessary new space for the hit information and passes the variable
429 // track, and the pointers *vol and *hits to the AliITShit constructor
430 // function.
4a5bebc2 431 // Inputs:
432 // Int_t track Track number which produced this hit.
433 // Int_t *vol Array of Integer Hit information. See AliITShit.h
434 // Float_t *hits Array of Floating Hit information. see AliITShit.h
435 // Outputs:
436 // none.
437 // Return:
438 // none.
7d62fb64 439 TClonesArray &lhits = *fHits;
440 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
3bd79107 441}
9c74c52b 442
2aea926d 443//______________________________________________________________________
444void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
8e8eae84 445 Option_t *option, const char *filename){
7d62fb64 446 // fill the modules with the sorted by module hits; add hits from
447 // background if option=Add.
448
449 static TTree *trH1; //Tree with background hits
450 static Bool_t first=kTRUE;
451 static TFile *file;
452 const char *addBgr = strstr(option,"Add");
453
454 evnt = nmodules; // Dummy use of variables to remove warnings
455 if (addBgr ) {
456 if(first) {
457 file=new TFile(filename);
458 } // end if first
459 first=kFALSE;
460 file->cd();
461 file->ls();
462 // Get Hits Tree header from file
463 if(trH1) delete trH1;
464 trH1=0;
465
466 char treeName[20];
467 sprintf(treeName,"TreeH%d",bgrev);
468 trH1 = (TTree*)gDirectory->Get(treeName);
469 if (!trH1) {
470 Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
471 } // end if !trH1
472 // Set branch addresses
473 } // end if addBgr
474
475 FillModules(fLoader->TreeH(),0); // fill from this file's tree.
3bd79107 476
7d62fb64 477 if (addBgr ) {
478 FillModules(trH1,10000000); // Default mask 10M.
479 TTree *fAli=fLoader->GetRunLoader()->TreeK();
480 TFile *fileAli=0;
481 if (fAli) fileAli =fAli->GetCurrentFile();
482 fileAli->cd();
483 } // end if add
484
485
3bd79107 486}
7d62fb64 487
488
2aea926d 489//______________________________________________________________________
b4012daf 490void AliITS::FillModules(TTree *treeH, Int_t mask) {
491 // fill the modules with the sorted by module hits;
492 // can be called many times to do a merging
493 // Inputs:
494 // TTree *treeH The tree containing the hits to be copied into
495 // the modules.
496 // Int_t mask The track number mask to indecate which file
497 // this hits came from.
498 // Outputs:
499 // none.
500 // Return:
501 // none.
502
88cb7938 503 if (treeH == 0x0)
504 {
505 Error("FillModules","Tree is NULL");
506 }
b4012daf 507 Int_t lay,lad,det,index;
508 AliITShit *itsHit=0;
509 AliITSmodule *mod=0;
510 char branchname[20];
511 sprintf(branchname,"%s",GetName());
512 TBranch *branch = treeH->GetBranch(branchname);
513 if (!branch) {
88cb7938 514 Error("FillModules","%s branch in TreeH not found",branchname);
515 return;
b4012daf 516 } // end if !branch
517 branch->SetAddress(&fHits);
518 Int_t nTracks =(Int_t) treeH->GetEntries();
519 Int_t iPrimTrack,h;
520 for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){
88cb7938 521 ResetHits();
522 Int_t nBytes = treeH->GetEvent(iPrimTrack);
523 if (nBytes <= 0) continue;
524 Int_t nHits = fHits->GetEntriesFast();
525 for(h=0; h<nHits; h++){
526 itsHit = (AliITShit *)fHits->UncheckedAt(h);
527 itsHit->GetDetectorID(lay,lad,det);
7d62fb64 528 if (GetITSgeom()) {
529 index = GetITSgeom()->GetModuleIndex(lay,lad,det);
88cb7938 530 } else {
531 index=det-1; // This should not be used.
532 } // end if [You must have fITSgeom for this to work!]
533 mod = GetModule(index);
534 itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask.
535 mod->AddHit(itsHit,iPrimTrack,h);
536 } // end loop over hits
b4012daf 537 } // end loop over tracks
538}
7d62fb64 539
b4012daf 540//______________________________________________________________________
7d62fb64 541void AliITS::InitModules(Int_t size,Int_t &nmodules){
542 // Initialize the modules array.
4a5bebc2 543 // Inputs:
7d62fb64 544 // Int_t size Size of array of the number of modules to be
545 // created. If size <=0 then the number of modules
546 // is gotten from AliITSgeom class kept in fITSgeom.
4a5bebc2 547 // Outputs:
7d62fb64 548 // Int_t &nmodules The number of modules existing.
4a5bebc2 549 // Return:
550 // none.
2ab0c725 551
7d62fb64 552 if(fITSmodules){
553 fITSmodules->Delete();
554 delete fITSmodules;
555 } // end fir fITSmoudles
88cb7938 556
7d62fb64 557 if(!fDetTypeSim) {
558 Error("InitModules","fDetTypeSim is null!");
559 return;
560 }
828e06c7 561
7d62fb64 562 Int_t nl,indexMAX,index;
563
564 if(size<=0){ // default to using data stored in AliITSgeom
565 if(fDetTypeSim->GetITSgeom()==0) {
566 Error("InitModules","fITSgeom not defined");
567 return;
568 } // end if fITSgeom==0
569 nl = fDetTypeSim->GetITSgeom()->GetNlayers();
570 indexMAX = fDetTypeSim->GetITSgeom()->GetIndexMax();
571 nmodules = indexMAX;
572 fITSmodules = new TObjArray(indexMAX);
573 for(index=0;index<indexMAX;index++){
574 fITSmodules->AddAt( new AliITSmodule(index),index);
575 } // end for index
576 }else{
577 fITSmodules = new TObjArray(size);
578 for(index=0;index<size;index++) {
579 fITSmodules->AddAt( new AliITSmodule(index),index);
580 } // end for index
581
582 nmodules = size;
583 } // end i size<=0
2aea926d 584}
585//______________________________________________________________________
586void AliITS::Hits2SDigits(){
587 // Standard Hits to summable Digits function.
4a5bebc2 588 // Inputs:
589 // none.
590 // Outputs:
591 // none.
7d62fb64 592
2aea926d 593
7d62fb64 594 if(!fDetTypeSim) {
595 Error("Hits2SDigits","fDetTypeSim is null!");
596 return;
597
598 }
599
600 SetDefaults();
601 fLoader->LoadHits("read");
602 fLoader->LoadSDigits("recreate");
603 AliRunLoader* rl = fLoader->GetRunLoader();
023ae34b 604 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 605 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
aacedc3e 606 // Do the Hits to Digits operation. Use Standard input values.
607 // Event number from file, no background hit merging , use size from
608 // AliITSgeom class, option="All", input from this file only.
7d62fb64 609 rl->GetEvent(iEvent);
610 if (!fLoader->TreeS()) fLoader->MakeTree("S");
611 MakeBranch("S");
612 SetTreeAddress();
613 HitsToPreDigits(iEvent,0,-1," ",fOpt," ");
614 } // end for iEvent
e0fc0305 615
7d62fb64 616 fLoader->UnloadHits();
617 fLoader->UnloadSDigits();
618
2aea926d 619}
620//______________________________________________________________________
621void AliITS::Hits2Digits(){
2aea926d 622
7d62fb64 623 //Conversion from hits to digits
624 if(!fDetTypeSim) {
625 Error("Hits2SDigits","fDetTypeSim is 0!");
626 return;
627 }
628
023ae34b 629 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 630 SetDefaults();
631
632 fLoader->LoadHits("read");
633 fLoader->LoadDigits("recreate");
634 AliRunLoader* rl = fLoader->GetRunLoader();
635 for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
636 rl->GetEvent(iEvent);
637 if (!fLoader->TreeD()) fLoader->MakeTree("D");
638 MakeBranch("D");
639 SetTreeAddress();
640 HitsToDigits(iEvent,0,-1," ",fOpt," ");
641 }
642
643 fLoader->UnloadHits();
644 fLoader->UnloadDigits();
645
2aea926d 646}
7d62fb64 647
2aea926d 648//______________________________________________________________________
7d62fb64 649void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
650 Option_t *option,Option_t *opt,
651 const char *filename){
4a5bebc2 652 // Keep galice.root for signal and name differently the file for
2aea926d 653 // background when add! otherwise the track info for signal will be lost !
654 // the condition below will disappear when the geom class will be
4a5bebc2 655 // initialized for all versions - for the moment it is only for v5 !
656 // 7 is the SDD beam test version.
657 // Inputs:
658 // Int_t evnt Event to be processed.
659 // Int_t bgrev Background Hit tree number.
660 // Int_t nmodules Not used.
661 // Option_t *option String indicating if merging hits or not. To
662 // merge hits set equal to "Add". Otherwise no
663 // background hits are considered.
664 // Test_t *filename File name containing the background hits..
665 // Outputs:
666 // none.
667 // Return:
668 // none.
2aea926d 669
7d62fb64 670 if(!fDetTypeSim) {
671 Error("HitsToDigits","fDetTypeSim is null!");
672 return;
673 }
023ae34b 674 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 675 if(!GetITSgeom()) return; // need transformations to do digitization.
676 AliITSgeom *geom = GetITSgeom();
677
678 const char *all = strstr(opt,"All");
679 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
680 strstr(opt,"SSD")};
681 static Bool_t setDef=kTRUE;
682 if (setDef) SetDefaultSimulation();
683 setDef=kFALSE;
684
685 Int_t nmodules;
686 InitModules(size,nmodules);
687 FillModules(evNumber,bgrev,nmodules,option,filename);
688
689 AliITSsimulation *sim = 0;
690 AliITSmodule *mod = 0;
691 Int_t id;
692 for(Int_t module=0;module<geom->GetIndexMax();module++){
693 id = geom->GetModuleType(module);
694 if (!all && !det[id]) continue;
695 sim = (AliITSsimulation*)fDetTypeSim->GetSimulationModel(id);
696 if (!sim) {
697 Error("HitsToDigits","The simulation class was not "
698 "instanciated for module %d type %s!",module,
699 geom->GetModuleTypeName(module));
700 exit(1);
701 } // end if !sim
702 mod = (AliITSmodule *)fITSmodules->At(module);
703 sim->DigitiseModule(mod,module,evNumber);
704 // fills all branches - wasted disk space
705 fLoader->TreeD()->Fill();
706 ResetDigits();
707 } // end for module
708
709 ClearModules();
710
711 fLoader->TreeD()->GetEntries();
712 fLoader->TreeD()->AutoSave();
713 // reset tree
714 fLoader->TreeD()->Reset();
2aea926d 715}
7d62fb64 716//_____________________________________________________________________
717void AliITS::Hits2PreDigits(){
718 // Turn hits into SDigits
719
720 if(!fDetTypeSim) {
721 Error("Hits2SDigits","fDetTypeSim is 0!");
722 return;
723 }
724
023ae34b 725 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 726 SetDefaults();
727
728 HitsToPreDigits(fLoader->GetRunLoader()->GetEventNumber(),
729 0,-1," ",fOpt," ");
730}
731
2aea926d 732//______________________________________________________________________
7d62fb64 733void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
734 Option_t *option,Option_t *opt,
735 const char *filename){
4a5bebc2 736 // Keep galice.root for signal and name differently the file for
2aea926d 737 // background when add! otherwise the track info for signal will be lost !
738 // the condition below will disappear when the geom class will be
4a5bebc2 739 // initialized for all versions - for the moment it is only for v5 !
740 // 7 is the SDD beam test version.
741 // Inputs:
742 // Int_t evnt Event to be processed.
743 // Int_t bgrev Background Hit tree number.
744 // Int_t nmodules Not used.
745 // Option_t *option String indicating if merging hits or not. To
746 // merge hits set equal to "Add". Otherwise no
747 // background hits are considered.
748 // Test_t *filename File name containing the background hits..
749 // Outputs:
750 // none.
751 // Return:
752 // none.
753
7d62fb64 754
755 if(!fDetTypeSim) {
756 Error("HitsToPreDigits","fDetTypeSim is null!");
757 return;
758 }
023ae34b 759 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 760
761 if(!GetITSgeom()){
762 Error("HitsToPreDigits","fGeom is null!");
763 return; // need transformations to do digitization.
764 }
765 AliITSgeom *geom = GetITSgeom();
766
767 const char *all = strstr(opt,"All");
768 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
769 strstr(opt,"SSD")};
770 static Bool_t setDef=kTRUE;
771 if (setDef) SetDefaultSimulation();
772 setDef=kFALSE;
773
774 Int_t nmodules;
775 InitModules(size,nmodules);
776 FillModules(evNumber,bgrev,nmodules,option,filename);
777
778
779 AliITSsimulation *sim = 0;
780 AliITSmodule *mod = 0;
781 Int_t id,module;
782 for(module=0;module<geom->GetIndexMax();module++){
783 id = geom->GetModuleType(module);
784 if (!all && !det[id]) continue;
785 sim = (AliITSsimulation*)GetSimulationModel(id);
786 if (!sim) {
787 Error("HitsToPreDigits","The simulation class was not "
788 "instanciated for module %d type %s!",module,
789 geom->GetModuleTypeName(module));
790 exit(1);
791 } // end if !sim
792 mod = (AliITSmodule *)fITSmodules->At(module);
793 sim->SDigitiseModule(mod,module,evNumber);
794 // fills all branches - wasted disk space
795 fLoader->TreeS()->Fill();
796 fDetTypeSim->ResetSDigits();
797 } // end for module
04366a57 798
7d62fb64 799 ClearModules();
800
801
802 fLoader->TreeS()->GetEntries();
803 fLoader->TreeS()->AutoSave();
804 fLoader->WriteSDigits("OVERWRITE");
805 // reset tree
806 fLoader->TreeS()->Reset();
2aea926d 807}
7d62fb64 808
809//_____________________________________________________________________
810void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
811 Option_t *opt0,Option_t *opt1,
812 const char *flnm){
813 // keep galice.root for signal and name differently the file for
814 // background when add! otherwise the track info for signal will be lost !
815 // the condition below will disappear when the geom class will be
816 // initialized for all versions - for the moment it is only for v5 !
817 // Inputs:
818 // Int_t evnt Event to be processed.
819 // Int_t bgrev Background Hit tree number.
820 // Int_t size Size used by InitModules. See InitModules.
821 // Option_t *opt0 Option passed to FillModules. See FillModules.
822 // Option_t *opt1 String indicating if merging hits or not. To
823 // merge hits set equal to "Add". Otherwise no
824 // background hits are considered.
825 // Test_t *flnm File name containing the background hits..
826 // Outputs:
827 // none.
828 // Return:
829 // none.
830
831
00a7cc50 832
7d62fb64 833 if(!GetITSgeom()){
834 Error("HitsToPreDigits","fGeom is null!");
835 return; // need transformations to do digitization.
836 }
837 AliITSgeom *geom = GetITSgeom();
838
839 AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
840
841 const char *all = strstr(opt1,"All");
842 const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
843 strstr(opt1,"SSD")};
844 Int_t nmodules;
845 InitModules(size,nmodules);
846 FillModules(evNumber,bgrev,nmodules,opt0,flnm);
847
848 AliITSsimulation *sim = 0;
849 AliITSmodule *mod = 0;
850 Int_t id,module;
851
852 TTree *lTR = pITSloader->TreeR();
00a7cc50 853 if(!lTR) {
854 pITSloader->MakeTree("R");
855 lTR = pITSloader->TreeR();
856 }
857
7d62fb64 858 TClonesArray* ptarray = new TClonesArray("AliITSRecPoint",1000);
00a7cc50 859 TBranch* branch = (TBranch*)lTR->Branch("ITSRecPointsF",&ptarray);
860 branch->SetAddress(&ptarray);
7d62fb64 861 //m.b. : this change is nothing but a nice way to make sure
023ae34b 862 //the CPU goes up !
7d62fb64 863 for(module=0;module<geom->GetIndexMax();module++){
864 id = geom->GetModuleType(module);
865 if (!all && !det[id]) continue;
866 sim = (AliITSsimulation*)GetSimulationModel(id);
867 if (!sim) {
868 Error("HitsToFastPoints","The simulation class was not "
869 "instanciated for module %d type %x!",module,
870 geom->GetModuleTypeName(module));
871 exit(1);
872 } // end if !sim
873 mod = (AliITSmodule *)fITSmodules->At(module);
874 sim->CreateFastRecPoints(mod,module,gRandom,ptarray);
875 lTR->Fill();
876 } // end for module
877
878 ClearModules();
879 fLoader->WriteRecPoints("OVERWRITE");
880 delete ptarray;
881}
882//_____________________________________________________________________
883Int_t AliITS::Hits2Clusters(TTree *hTree, TTree *cTree) {
884 //------------------------------------------------------------
885 // This function creates ITS clusters
886 //------------------------------------------------------------
887 if(!GetITSgeom()){
888 Error("HitsToPreDigits","fGeom is null!");
889 return 1; // need transformations to do digitization.
890 }
891 AliITSgeom *geom=GetITSgeom();
892 Int_t mmax=geom->GetIndexMax();
893
894 InitModules(-1,mmax);
895 FillModules(hTree,0);
896
7d62fb64 897 TClonesArray *points = new TClonesArray("AliITSRecPoint",1000);
00a7cc50 898 TBranch *branch=cTree->GetBranch("ITSRecPoints");
899 if (!branch) cTree->Branch("ITSRecPoints",&points);
900 else branch->SetAddress(&points);
7d62fb64 901
902 AliITSsimulationFastPoints sim;
903 Int_t ncl=0;
904 for (Int_t m=0; m<mmax; m++) {
905 AliITSmodule *mod=GetModule(m);
906 sim.CreateFastRecPoints(mod,m,gRandom,points);
00a7cc50 907 ncl+=points->GetEntriesFast();
7d62fb64 908 cTree->Fill();
7d62fb64 909 points->Clear();
910 }
911
912 Info("Hits2Clusters","Number of found fast clusters : %d",ncl);
913
914 //cTree->Write();
915
7d62fb64 916 delete points;
917 return 0;
918}
7d62fb64 919
7d62fb64 920//_____________________________________________________________________
921void AliITS::CheckLabels(Int_t lab[3]) const {
922 //------------------------------------------------------------
923 // Tries to find mother's labels
924 //------------------------------------------------------------
925
926 if(lab[0]<0 && lab[1]<0 && lab[2]<0) return; // In case of no labels just exit
927
928 Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
929 for (Int_t i=0;i<3;i++){
930 Int_t label = lab[i];
931 if (label>=0 && label<ntracks) {
932 TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
933 if (part->P() < 0.005) {
934 Int_t m=part->GetFirstMother();
935 if (m<0) {
936 continue;
937 }
938 if (part->GetStatusCode()>0) {
939 continue;
940 }
941 lab[i]=m;
942 }
943 }
944 }
945
946}
947
948//______________________________________________________________________
949void AliITS::SDigitsToDigits(Option_t *opt){
950 // Standard Summable digits to Digits function.
951 // Inputs:
952 // none.
953 // Outputs:
954 // none.
955 if(!fDetTypeSim) {
956 Error("SDigitsToSDigits","fDetTypeSim is 0!");
957 return;
958 }
959
023ae34b 960 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 961 SetDefaults();
962 fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName());
963
964}
965
2aea926d 966//______________________________________________________________________
2aea926d 967void AliITS::ResetDigits(){
4a5bebc2 968 // Reset number of digits and the digits array for the ITS detector.
969 // Inputs:
970 // none.
971 // Outputs:
972 // none.
7d62fb64 973 if(!fDetTypeSim) {
974 Error("ResetDigits","fDetTypeSim is 0!");
975 return;
976 }
977
978 fDetTypeSim->ResetDigits();
3bd79107 979
980
2aea926d 981}
982//______________________________________________________________________
7d62fb64 983void AliITS::ResetDigits(Int_t branch){
4a5bebc2 984 // Reset number of digits and the digits array for this branch.
985 // Inputs:
986 // none.
987 // Outputs:
988 // none.
828e06c7 989
7d62fb64 990 if(!fDetTypeSim) {
991 Error("ResetDigits","fDetTypeSim is 0!");
992 return;
993 }
994
995 fDetTypeSim->ResetDigits(branch);
996
2aea926d 997}
998//______________________________________________________________________
999void AliITS::AddSumDigit(AliITSpListItem &sdig){
4a5bebc2 1000 // Adds the a module full of summable digits to the summable digits tree.
1001 // Inputs:
1002 // AliITSpListItem &sdig SDigit to be added to SDigits tree.
1003 // Outputs:
1004 // none.
1005 // Return:
1006 // none.
828e06c7 1007
7d62fb64 1008 if(!fDetTypeSim) {
1009 Error("AddSumDigit","fDetTypeSim is 0!");
1010 return;
1011 }
1012 fDetTypeSim->AddSumDigit(sdig);
1013
828e06c7 1014}
2aea926d 1015//______________________________________________________________________
7d62fb64 1016void AliITS::AddRealDigit(Int_t branch, Int_t *digits){
4a5bebc2 1017 // Add a real digit - as coming from data.
1018 // Inputs:
1019 // Int_t id Detector type number.
1020 // Int_t *digits Integer array containing the digits info. See
1021 // AliITSdigit.h
1022 // Outputs:
1023 // none.
1024 // Return:
1025 // none.
9c74c52b 1026
7d62fb64 1027 if(!fDetTypeSim) {
1028 Error("AddRealDigit","fDetTypeSim is 0!");
1029 return;
1030 }
1031 fDetTypeSim->AddRealDigit(branch,digits);
1032
2aea926d 1033}
1034//______________________________________________________________________
7d62fb64 1035void AliITS::AddSimDigit(Int_t branch, AliITSdigit *d){
4a5bebc2 1036 // Add a simulated digit.
1037 // Inputs:
1038 // Int_t id Detector type number.
1039 // AliITSdigit *d Digit to be added to the Digits Tree. See
1040 // AliITSdigit.h
1041 // Outputs:
1042 // none.
1043 // Return:
1044 // none.
2aea926d 1045
7d62fb64 1046 if(!fDetTypeSim) {
1047 Error("AddSimDigit","fDetTypeSim is 0!");
1048 return;
1049 }
1050 fDetTypeSim->AddSimDigit(branch,d);
1051
2aea926d 1052}
1053//______________________________________________________________________
7d62fb64 1054void AliITS::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits,Int_t *tracks,
88cb7938 1055 Int_t *hits,Float_t *charges){
7f1a504b 1056 // Add a simulated digit to the list.
1057 // Inputs:
1058 // Int_t id Detector type number.
1059 // Float_t phys Physics indicator. See AliITSdigits.h
1060 // Int_t *digits Integer array containing the digits info. See
1061 // AliITSdigit.h
1062 // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()]
1063 // containing the track numbers that contributed to
1064 // this digit.
1065 // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()]
1066 // containing the hit numbers, from AliITSmodule, that
1067 // contributed to this digit.
1068 // Float_t *charge Floating point array of the signals contributed
1069 // to this digit by each track.
1070 // Outputs:
1071 // none.
1072 // Return:
1073 // none.
2aea926d 1074
7d62fb64 1075 if(!fDetTypeSim) {
1076 Error("AddSimDigit","fDetTypeSim is 0!");
1077 return;
1078 }
1079 fDetTypeSim->AddSimDigit(branch,phys,digits,tracks,hits,charges);
1080
2aea926d 1081}
0421c3d1 1082//______________________________________________________________________
aacedc3e 1083void AliITS::Digits2Raw(){
1084 // convert digits of the current event to raw data
0421c3d1 1085
7d62fb64 1086 if(!fDetTypeSim) {
1087 Error("Digits2Raw","fDetTypeSim is 0!");
1088 return;
1089 }
023ae34b 1090 fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
7d62fb64 1091 SetDefaults();
1092 fDetTypeSim->GetLoader()->LoadDigits();
1093 TTree* digits = fDetTypeSim->GetLoader()->TreeD();
0421c3d1 1094 if (!digits) {
aacedc3e 1095 Error("Digits2Raw", "no digits tree");
1096 return;
0421c3d1 1097 }
7d62fb64 1098 fDetTypeSim->SetTreeAddressD(digits,(Char_t*)GetName());
979b5a5f 1099 AliITSDDLModuleMapSDD* ddlsdd=fDetTypeSim->GetDDLModuleMapSDD();
0421c3d1 1100
1101 AliITSDDLRawData rawWriter;
1102 //Verbose level
1103 // 0: Silent
1104 // 1: cout messages
1105 // 2: txt files with digits
1106 //BE CAREFUL, verbose level 2 MUST be used only for debugging and
1107 //it is highly suggested to use this mode only for debugging digits files
1108 //reasonably small, because otherwise the size of the txt files can reach
1109 //quickly several MB wasting time and disk space.
1110 rawWriter.SetVerbose(0);
1111
1112 //SILICON PIXEL DETECTOR
1113 Info("Digits2Raw", "Formatting raw data for SPD");
1114 rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"));
1115
1116 //SILICON DRIFT DETECTOR
1117 Info("Digits2Raw", "Formatting raw data for SDD");
979b5a5f 1118 rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"),ddlsdd);
0421c3d1 1119
1120 //SILICON STRIP DETECTOR
1121 Info("Digits2Raw", "Formatting raw data for SSD");
1122 rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD"));
1123
1124 fLoader->UnloadDigits();
2aea926d 1125}
2aea926d 1126//______________________________________________________________________
aacedc3e 1127AliLoader* AliITS::MakeLoader(const char* topfoldername){
1128 //builds ITSgetter (AliLoader type)
1129 //if detector wants to use castomized getter, it must overload this method
1130
64f311fe 1131 AliDebug(1,Form("Creating AliITSLoader. Top folder is %s.",
1132 topfoldername));
aacedc3e 1133 fLoader = new AliITSLoader(GetName(),topfoldername);
1134 return fLoader;
2aea926d 1135}
ef7ff1f9 1136
0b5bf101 1137Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
1138{
1139 //
1140 // Converts RAW data to SDigits
1141 //
1142 // Get TreeS
1143 //
1144 Int_t last = -1;
1145 Int_t size = GetITSgeom()->GetIndexMax();
1146 TClonesArray** modA = new TClonesArray*[size];
1147 for (Int_t mod = 0; mod < size; mod++) modA[mod] = new TClonesArray("AliITSpListItem", 10000);
1148
1149 AliLoader* loader = (gAlice->GetRunLoader())->GetLoader("ITSLoader");
1150 if (!loader)
1151 {
1152 Error("Open","Can not get ITS loader from Run Loader");
1153 return kFALSE;
1154 }
1155
1156 TTree* tree = 0;
1157 tree = loader->TreeS();
1158 if (!tree)
1159 {
1160 loader->MakeTree("S");
1161 tree = loader->TreeS();
1162 }
1163 //
1164 // Array for SDigits
1165 //
1166 TClonesArray aSDigits("AliITSpListItem",10000), *itsSDigits=&aSDigits;
1167 Int_t bufsize = 32000;
1168 tree->Branch("ITS", &itsSDigits, bufsize);
1169 Int_t npx = 0;
1170 //
1171 // SPD
1172 //
1173 AliITSsegmentationSPD* segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
1174 npx = segSPD->Npx();
1175 Double_t thr, sigma;
1176
1177 AliITSRawStreamSPD inputSPD(rawReader);
1178 while(1){
1179 Bool_t next = inputSPD.Next();
1180 if (!next) break;
1181
1182 Int_t module = inputSPD.GetModuleID();
1183 Int_t column = inputSPD.GetColumn();
1184 Int_t row = inputSPD.GetRow();
1185 Int_t index = npx * column + row;
1186
1187 if (module >= size) continue;
1188
1189 last = (modA[module])->GetEntries();
1190 TClonesArray& dum = *modA[module];
1191 fDetTypeSim->GetCalibrationModel(module)->Thresholds(thr,sigma);
1192 thr += 1.;
1193 new (dum[last]) AliITSpListItem(-1, -1, module, index, thr);
1194 }
1195 rawReader->Reset();
1196
1197 //
1198 // SDD
1199 //
1200 AliITSsegmentationSDD* segSDD = (AliITSsegmentationSDD*) fDetTypeSim->GetSegmentationModel(1);
1201 npx = segSDD->Npx();
1202 AliITSRawStreamSDD inputSDD(rawReader);
979b5a5f 1203 AliITSDDLModuleMapSDD* ddlmap=fDetTypeSim->GetDDLModuleMapSDD();
1204 inputSDD.SetDDLModuleMap(ddlmap);
0b5bf101 1205 while(1){
1206 Bool_t next = inputSDD.Next();
1207 if (!next) break;
1208
1209 Int_t module = inputSDD.GetModuleID();
1210 Int_t anode = inputSDD.GetAnode();
1211 Int_t time = inputSDD.GetTime();
1212 Int_t signal = inputSDD.GetSignal();
1213 Int_t index = npx * anode + time;
1214
1215 if (module >= size) continue;
1216 // 8bit -> 10 bit
1217 AliITSresponseSDD *resSDD = (AliITSresponseSDD*) fDetTypeSim->GetResponse(1);
1218 Int_t signal10 = resSDD->Convert8to10(signal); // signal is a 8 bit value (if the compression is active)
1219
1220 last = modA[module]->GetEntries();
1221 TClonesArray& dum = *modA[module];
1222 new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal10));
1223 ((AliITSpListItem*) dum.At(last))->AddSignalAfterElect(module, index, Double_t(signal10));
1224
1225 }
1226 rawReader->Reset();
1227
1228 //
1229 // SSD
1230 //
1231 AliITSsegmentationSSD* segSSD = (AliITSsegmentationSSD*) fDetTypeSim->GetSegmentationModel(2);
1232 npx = segSSD->Npx();
1233 AliITSRawStreamSSD inputSSD(rawReader);
1234 while(1){
1235 Bool_t next = inputSSD.Next();
1236 if (!next) break;
1237
1238 Int_t module = inputSSD.GetModuleID();
1239 Int_t side = inputSSD.GetSideFlag();
1240 Int_t strip = inputSSD.GetStrip();
1241 Int_t signal = inputSSD.GetSignal();
1242 Int_t index = npx * side + strip;
1243
1244 if (module >= size) continue;
1245
1246 last = modA[module]->GetEntries();
1247 TClonesArray& dum = *modA[module];
1248 new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal));
1249 }
1250 rawReader->Reset();
1251 AliITSpListItem* sdig = 0;
1252
1253 for (Int_t mod = 0; mod < size; mod++)
1254 {
1255 Int_t nsdig = modA[mod]->GetEntries();
1256 for (Int_t ie = 0; ie < nsdig; ie++) {
1257 sdig = (AliITSpListItem*) (modA[mod]->At(ie));
1258 new (aSDigits[ie]) AliITSpListItem(-1, -1, mod, sdig->GetIndex(), sdig->GetSignal());
1259 Float_t sig = sdig->GetSignalAfterElect();
1260 if (sig > 0.) {
1261 sdig = (AliITSpListItem*)aSDigits[ie];
1262 sdig->AddSignalAfterElect(mod, sdig->GetIndex(), Double_t(sig));
1263 }
1264 }
1265
1266 tree->Fill();
1267 aSDigits.Clear();
1268 modA[mod]->Clear();
1269 }
1270 loader->WriteSDigits("OVERWRITE");
1271 delete modA;
1272 return kTRUE;
1273}
1274
1275
ef7ff1f9 1276//______________________________________________________________________
1277void AliITS::UpdateInternalGeometry(){
1278
ed9289c8 1279 //reads new geometry from TGeo
012f0f4c 1280// AliDebug(1,"Delete ITSgeom and create a new one reading TGeo");
1281
108bd0fe 1282 AliITSVersion_t version = (AliITSVersion_t)IsVersion();
1283 Int_t minor = 0;
012f0f4c 1284 if(version==kvPPRasymmFMD) minor=2; // default minor version for this geom.
1285 AliITSInitGeometry initgeom;
1286 AliITSgeom* geom = initgeom.CreateAliITSgeom(version,minor);
ef7ff1f9 1287 SetITSgeom(geom);
ef7ff1f9 1288}
0b5bf101 1289