]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITS.cxx
Improved cuts for the reconstruction of V0s (M.Ivanov)
[u/mrichter/AliRoot.git] / ITS / AliITS.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18
19 ///////////////////////////////////////////////////////////////////////////////
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 /*
25 <img src="picts/ITS/ITS_Analysis_schema.gif">
26 </pre>
27 <br clear=left>
28 <font size=+2 color=red>
29 <p>Roberto Barbera is in charge of the ITS Offline code (1999).
30 <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
31 </font>
32 <pre>
33 */
34 //End_Html
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 /*
41 <img src="picts/ITS/AliITS_Class_Diagram.gif">
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
46 the 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 //
59 // Version: 2
60 // Modified and documented by A. Bologna
61 // October 18 1999
62 //
63 // AliITS is the general base class for the ITS. Also see AliDetector for
64 // futher information.
65 //
66 ///////////////////////////////////////////////////////////////////////////////
67
68 #include <Riostream.h>
69 #include <stdlib.h>
70
71 #include <TBranch.h>
72 #include <TClonesArray.h>
73 #include <TFile.h>
74 #include <TMath.h>
75 #include <TObjectTable.h>
76 #include <TROOT.h>
77 #include <TRandom.h>
78 #include <TString.h>
79 #include <TTree.h>
80 #include <TVector.h>
81 #include <TVirtualMC.h>
82
83 #include "AliConfig.h"
84 #include "AliHeader.h"
85 #include "AliITS.h"
86 #include "AliITSClusterFinderSDD.h"
87 #include "AliITSClusterFinderSPD.h"
88 #include "AliITSClusterFinderSSD.h"
89 #include "AliITSDetType.h"
90 #include "AliITSLoader.h"
91 #include "AliITSRawClusterSPD.h"
92 #include "AliITSRawClusterSDD.h"
93 #include "AliITSRawClusterSSD.h"
94 #include "AliITSRecPoint.h"
95 #include "AliITSdigitSPD.h"
96 #include "AliITSdigitSDD.h"
97 #include "AliITSdigitSSD.h"
98 #include "AliITSgeom.h"
99 #include "AliITShit.h"
100 #include "AliITSmodule.h"
101 #include "AliITSpList.h"
102 #include "AliITSresponseSDD.h"
103 #include "AliITSresponseSPD.h"
104 #include "AliITSresponseSSD.h"
105 #include "AliITSsegmentationSDD.h"
106 #include "AliITSsegmentationSPD.h"
107 #include "AliITSsegmentationSSD.h"
108 #include "AliITSsimulationSDD.h"
109 #include "AliITSsimulationSPD.h"
110 #include "AliITSsimulationSSD.h"
111 #include "AliMC.h"
112 #include "AliITSDigitizer.h"
113 #include "AliITSclustererV2.h"
114 #include "AliITStrackerV2.h"
115 #include "AliITStrackerSA.h"
116 #include "AliITSpidESD.h"
117 #include "AliV0vertexer.h"
118 #include "AliITSVertexerPPZ.h"
119 #include "AliITSVertexerFast.h"
120 #include "AliITSVertexerZ.h"
121 #include "AliITSVertexerIons.h"
122 #include "AliCascadeVertexer.h"
123 #include "AliESD.h"
124 #include "AliRun.h"
125
126 ClassImp(AliITS)
127
128 //______________________________________________________________________
129 AliITS::AliITS() : AliDetector() {
130     // Default initializer for ITS
131     //      The default constructor of the AliITS class. In addition to
132     // creating the AliITS class it zeros the variables fIshunt (a member
133     // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers
134     // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor
135     // is also called.
136     // Inputs:
137     //      none.
138     // Outputs:
139     //      none.
140     // Return:
141     //      Blank ITS class.
142
143     fIshunt     = 0;   // not zeroed in AliDetector.
144
145     // AliITS variables.
146     fEuclidOut  = 0;
147     fITSgeom    = 0;
148     fITSmodules = 0;
149     fOpt        = "All";
150 //    SetDetectors(); // default to fOpt="All". This variable not written out.
151
152     fIdN        = 0;
153     fIdName     = 0;
154     fIdSens     = 0;
155
156     fNDetTypes  = kNTYPES;
157     fDetTypes   = 0;
158
159     fSDigits    = 0;
160     fNSDigits   = 0;
161
162     fNdtype     = 0;
163     fDtype      = 0;
164
165     fCtype      = 0;
166     fNctype     = 0;
167
168     fRecPoints  = 0;
169     fNRecPoints = 0;
170
171     SetMarkerColor(kRed);
172     SelectVertexer(" ");
173 }
174 //______________________________________________________________________
175 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
176     //     The standard Constructor for the ITS class. In addition to 
177     // creating the AliITS class, it allocates memory for the TClonesArrays 
178     // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype 
179     // (clusters). It also zeros the variables
180     // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros
181     // the pointers fIdSens and fIdName. To help in displaying hits via the
182     // ROOT macro display.C AliITS also sets the marker color to red. The
183     // variables passes with this constructor, const char *name and *title,
184     // are used by the constructor of AliDetector class. See AliDetector
185     // class for a description of these parameters and its constructor
186     // functions.
187     // Inputs:
188     //      const char *name      Detector name. Should always be "ITS"
189     //      const char *title     Detector title.
190     // Outputs:
191     //      none.
192     // Return:
193     //      An ITS class.
194
195     fIshunt     = 0;  // not zeroed in AliDetector
196     fHits       = new TClonesArray("AliITShit", 1560);//not done in AliDetector
197     if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
198
199     fEuclidOut  = 0;
200     fITSgeom    = 0;
201     fITSmodules = 0;
202     SetDetectors(); // default to fOpt="All". This variable not written out.
203
204     fIdN        = 0;
205     fIdName     = 0;
206     fIdSens     = 0;
207
208     fNDetTypes  = kNTYPES;
209     fDetTypes   = new TObjArray(fNDetTypes);
210
211     fSDigits    = new TClonesArray("AliITSpListItem",1000);
212     fNSDigits   = 0;
213
214     fNdtype     = new Int_t[fNDetTypes];
215     fDtype      = new TObjArray(fNDetTypes);
216
217     fCtype      = new TObjArray(fNDetTypes);
218     fNctype     = new Int_t[fNDetTypes];
219
220     fRecPoints  = new TClonesArray("AliITSRecPoint",1000);
221     fNRecPoints = 0;
222
223     Int_t i;
224     for(i=0;i<fNDetTypes;i++) {
225         fDetTypes->AddAt(new AliITSDetType(),i); 
226         fNdtype[i] = 0;
227         fNctype[i] = 0;
228     } // end for i
229
230     SetMarkerColor(kRed);
231     SelectVertexer(" ");
232 }
233 //______________________________________________________________________
234 AliITS::~AliITS(){
235     // Default destructor for ITS.
236     //     The default destructor of the AliITS class. In addition to deleting
237     // the AliITS class it deletes the memory pointed to by the fHits, fDigits,
238     // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName, 
239     // fITSpoints, fDetType and it's contents.
240     // Inputs:
241     //      none.
242     // Outputs:
243     //      none.
244     // Return:
245     //      none.
246
247     if (fHits) {
248       fHits->Delete();
249       delete fHits;
250       fHits=0;
251     }
252     if (fSDigits) {
253       fSDigits->Delete();
254       delete fSDigits;
255       fSDigits=0;
256     }
257     if (fDigits) {
258       fDigits->Delete();
259       delete fDigits;
260       fDigits=0;
261     }
262     if (fRecPoints) {
263       fRecPoints->Delete();
264       delete fRecPoints;
265       fRecPoints=0;
266     }
267     delete[] fIdName;  // Array of TStrings
268     delete[] fIdSens;
269     if(fITSmodules) {
270         this->ClearModules();
271         delete fITSmodules;
272         fITSmodules = 0;
273     }// end if fITSmodules!=0
274
275     if(fDtype) {
276         fDtype->Delete();
277         delete fDtype;
278     } // end if fDtype
279     delete [] fNdtype;
280     if (fCtype) {
281         fCtype->Delete();
282         delete fCtype;
283         fCtype = 0;
284     } // end if fCtype
285     delete [] fNctype;
286
287     if (fDetTypes) {
288         fDetTypes->Delete();
289         delete fDetTypes;
290         fDetTypes = 0;
291     } // end if fDetTypes
292
293
294     if (fITSgeom) delete fITSgeom;
295 }
296 //______________________________________________________________________
297 AliITS::AliITS(const AliITS &source) : AliDetector(source){
298     // Copy constructor. This is a function which is not allowed to be
299     // done to the ITS. It exits with an error.
300     // Inputs:
301     //      AliITS &source  An AliITS class.
302     // Outputs:
303     //      none.
304     // Return:
305     //      none.
306
307     if(this==&source) return;
308     Error("Copy constructor",
309           "You are not allowed to make a copy of the AliITS");
310     exit(1);
311 }
312 //______________________________________________________________________
313 AliITS& AliITS::operator=(AliITS &source){
314     // Assignment operator. This is a function which is not allowed to be
315     // done to the ITS. It exits with an error.
316     // Inputs:
317     //      AliITS &source  An AliITS class.
318     // Outputs:
319     //      none.
320     // Return:
321     //      none.
322
323     if(this==&source) return *this;
324     Error("operator=","You are not allowed to make a copy of the AliITS");
325     exit(1);
326     return *this; //fake return
327 }
328 //______________________________________________________________________
329 Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{
330     // Distance from mouse to ITS on the screen. Dummy routine
331     //     A dummy routine used by the ROOT macro display.C to allow for the
332     // use of the mouse (pointing device) in the macro. In general this should
333     // never be called. If it is it returns the number 9999 for any value of
334     // x and y.
335     // Inputs:
336     //      Int_t     Dummy screen coordinate.
337     //      Int_t     Dummy screen coordinate.
338     // Outputs:
339     //      none.
340     // Return:
341     //      Int_t     Dummy = 9999 distance to ITS.
342
343     return 9999;
344 }
345 //______________________________________________________________________
346 void AliITS::Init(){
347     // Initializer ITS after it has been built
348     //     This routine initializes the AliITS class. It is intended to be
349     // called from the Init function in AliITSv?. Besides displaying a banner
350     // indicating that it has been called it initializes the array fIdSens
351     // and sets the default segmentation, response, digit and raw cluster
352     // classes therefore it should be called after a call to CreateGeometry.
353     // Inputs:
354     //      none.
355     // Outputs:
356     //      none.
357     // Return:
358     //      none.
359     Int_t i;
360
361     SetDefaults();
362     // Array of TStrings
363     if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
364 }
365 //______________________________________________________________________
366 void AliITS::SetDefaults(){
367     // sets the default segmentation, response, digit and raw cluster classes.
368     // Inputs:
369     //      none.
370     // Outputs:
371     //      none.
372     // Return:
373     //      none.
374
375     if(fDebug) printf("%s: SetDefaults\n",ClassName());
376
377     AliITSDetType *iDetType;
378
379     //SPD
380     iDetType=DetType(0); 
381     if (!iDetType->GetSegmentationModel()) {
382         AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
383         SetSegmentationModel(0,seg0); 
384     } // end if
385     if (!iDetType->GetResponseModel()) {
386         SetResponseModel(0,new AliITSresponseSPD()); 
387     } // end if
388     // set digit and raw cluster classes to be used
389
390     const char *kData0=(iDetType->GetResponseModel())->DataType();
391     if (strstr(kData0,"real")) {
392         iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
393     } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
394
395     // SDD
396     iDetType=DetType(1); 
397     if (!iDetType->GetResponseModel()) {
398         SetResponseModel(1,new AliITSresponseSDD("simulated")); 
399     } // end if
400     AliITSresponse *resp1=iDetType->GetResponseModel();
401     if (!iDetType->GetSegmentationModel()) {
402         AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
403         SetSegmentationModel(1,seg1); 
404     } // end if
405     const char *kData1=(iDetType->GetResponseModel())->DataType();
406     const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
407     if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
408         iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
409     } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
410
411     // SSD
412     iDetType=DetType(2); 
413     if (!iDetType->GetSegmentationModel()) {
414         AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
415         SetSegmentationModel(2,seg2); 
416     } // end if
417     if (!iDetType->GetResponseModel()) {
418         SetResponseModel(2,new AliITSresponseSSD("simulated"));
419     } // end if
420     const char *kData2=(iDetType->GetResponseModel())->DataType();
421     if (strstr(kData2,"real")) {
422         iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
423     } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
424
425     if (kNTYPES>3) {
426         Warning("SetDefaults",
427                 "Only the three basic detector types are initialized!");
428     }  // end if
429 }
430 //______________________________________________________________________
431 void AliITS::SetDefaultSimulation(){
432     // sets the default simulation.
433     // Inputs:
434     //      none.
435     // Outputs:
436     //      none.
437     // Return:
438     //      none.
439
440     AliITSDetType *iDetType;
441     AliITSsimulation *sim;
442     iDetType=DetType(0);
443     sim = iDetType->GetSimulationModel();
444     if (!sim) {
445         AliITSsegmentation *seg0=
446             (AliITSsegmentation*)iDetType->GetSegmentationModel();
447         AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
448         AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
449         SetSimulationModel(0,sim0);
450     }else{ // simulation exists, make sure it is set up properly.
451         ((AliITSsimulationSPD*)sim)->Init(
452             (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
453             (AliITSresponseSPD*) iDetType->GetResponseModel());
454 //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
455 //            (AliITSresponse*)iDetType->GetResponseModel());
456 //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
457 //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
458     } // end if
459     iDetType=DetType(1);
460     sim = iDetType->GetSimulationModel();
461     if (!sim) {
462         AliITSsegmentation *seg1=
463             (AliITSsegmentation*)iDetType->GetSegmentationModel();
464         AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
465         AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
466         SetSimulationModel(1,sim1);
467     }else{ // simulation exists, make sure it is set up properly.
468         ((AliITSsimulationSDD*)sim)->Init(
469             (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
470             (AliITSresponseSDD*) iDetType->GetResponseModel());
471 //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
472 //            (AliITSresponse*)iDetType->GetResponseModel());
473 //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
474 //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
475     } //end if
476     iDetType=DetType(2);
477     sim = iDetType->GetSimulationModel();
478     if (!sim) {
479         AliITSsegmentation *seg2=
480             (AliITSsegmentation*)iDetType->GetSegmentationModel();
481         AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
482         AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
483         SetSimulationModel(2,sim2);
484     }else{ // simulation exists, make sure it is set up properly.
485         ((AliITSsimulationSSD*)sim)->Init(
486             (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
487             (AliITSresponseSSD*) iDetType->GetResponseModel());
488 //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
489 //            (AliITSresponse*)iDetType->GetResponseModel());
490 //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
491 //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
492     } // end if
493 }
494 //______________________________________________________________________
495 void AliITS::SetDefaultClusterFinders(){
496     // Sets the default cluster finders. Used in finding RecPoints.
497     // Inputs:
498     //      none.
499     // Outputs:
500     //      none.
501     // Return:
502     //      none.
503
504     MakeTreeC();
505     AliITSDetType *iDetType;
506
507     // SPD
508     iDetType=DetType(0);
509     if (!iDetType->GetReconstructionModel()) {
510         AliITSsegmentation *seg0 =
511             (AliITSsegmentation*)iDetType->GetSegmentationModel();
512         TClonesArray *dig0=DigitsAddress(0);
513         TClonesArray *recp0=ClustersAddress(0);
514         AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0,
515                                                                   recp0);
516         SetReconstructionModel(0,rec0);
517     } // end if
518
519     // SDD
520     iDetType=DetType(1);
521     if (!iDetType->GetReconstructionModel()) {
522         AliITSsegmentation *seg1 =
523             (AliITSsegmentation*)iDetType->GetSegmentationModel();
524         AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
525         TClonesArray *dig1=DigitsAddress(1);
526         TClonesArray *recp1=ClustersAddress(1);
527         AliITSClusterFinderSDD *rec1 =
528             new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
529       SetReconstructionModel(1,rec1);
530     } // end if
531
532     // SSD
533     iDetType=DetType(2);
534     if (!iDetType->GetReconstructionModel()) {
535         AliITSsegmentation *seg2=
536             (AliITSsegmentation*)iDetType->GetSegmentationModel();
537         TClonesArray *dig2=DigitsAddress(2);
538         AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2);
539         SetReconstructionModel(2,rec2);
540     } // end if
541 }
542 //______________________________________________________________________
543 void AliITS::MakeBranch(Option_t* option){
544     // Creates Tree branches for the ITS.
545     // Inputs:
546     //      Option_t *option    String of Tree types S,D, and/or R.
547     //      const char *file    String of the file name where these branches
548     //                          are to be stored. If blank then these branches
549     //                          are written to the same tree as the Hits were
550     //                          read from.
551     // Outputs:
552     //      none.
553     // Return:
554     //      none.
555     Bool_t cH = (strstr(option,"H")!=0);
556     Bool_t cS = (strstr(option,"S")!=0);
557     Bool_t cD = (strstr(option,"D")!=0);
558     Bool_t cR = (strstr(option,"R")!=0);
559     Bool_t cRF = (strstr(option,"RF")!=0);
560     
561     if(cRF)cR = kFALSE;
562     if(cH && (fHits == 0x0)) fHits  = new TClonesArray("AliITShit", 1560);
563     
564     AliDetector::MakeBranch(option);
565
566     if(cS) MakeBranchS(0);
567     if(cD) MakeBranchD(0);
568     if(cR) MakeBranchR(0);
569     if(cRF) MakeBranchRF(0);
570 }
571 //______________________________________________________________________
572 void AliITS::SetTreeAddress(){
573     // Set branch address for the Trees.
574     // Inputs:
575     //      none.
576     // Outputs:
577     //      none.
578     // Return:
579     //      none.
580     TTree *treeS = fLoader->TreeS();
581     TTree *treeD = fLoader->TreeD();
582     TTree *treeR = fLoader->TreeR();
583     if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
584       
585     AliDetector::SetTreeAddress();
586
587     SetTreeAddressS(treeS);
588     SetTreeAddressD(treeD);
589     SetTreeAddressR(treeR);
590 }
591 //______________________________________________________________________
592 AliITSDetType* AliITS::DetType(Int_t id){
593     // Return pointer to id detector type.
594     // Inputs:
595     //      Int_t id   detector id number.
596     // Outputs:
597     //      none.
598     // Return:
599     //      returned, a pointer to a AliITSDetType.
600
601     return ((AliITSDetType*) fDetTypes->At(id));
602 }
603 //______________________________________________________________________
604 void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
605     // Set the response model for the id detector type.
606     // Inputs:
607     //      Int_t id        detector id number.
608     //      AliITSresponse* a pointer containing an instance of AliITSresponse
609     //                      to be stored/owned b y AliITSDetType.
610     // Outputs:
611     //      none.
612     // Return:
613     //      none.
614
615     ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
616 }
617 //______________________________________________________________________
618 void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
619     // Set the segmentation model for the id detector type.
620     // Inputs:
621     //      Int_t id            detector id number.
622     //      AliITSsegmentation* a pointer containing an instance of 
623     //                          AliITSsegmentation to be stored/owned b y 
624     //                          AliITSDetType.
625     // Outputs:
626     //      none.
627     // Return:
628     //      none.
629
630     ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
631 }
632 //______________________________________________________________________
633 void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
634     // Set the simulation model for the id detector type.
635     // Inputs:
636     //      Int_t id        detector id number.
637     //      AliITSresponse* a pointer containing an instance of AliITSresponse
638     //                      to be stored/owned b y AliITSDetType.
639     // Outputs:
640     //      none.
641     // Return:
642     //      none.
643
644    ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
645
646 }
647 //______________________________________________________________________
648 void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
649     // Set the cluster finder model for the id detector type.
650     // Inputs:
651     //      Int_t id             detector id number.
652     //      AliITSClusterFinder* a pointer containing an instance of 
653     //                           AliITSClusterFinder to be stored/owned b y 
654     //                           AliITSDetType.
655     // Outputs:
656     //      none.
657     // Return:
658     //      none.
659
660     ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
661 }
662 //______________________________________________________________________
663 void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
664     // Set the digit and cluster classes name to be used for the id detector
665     // type.
666     // Inputs:
667     //      Int_t id            detector id number.
668     //      const char *digit   Digit class name for detector id.
669     //      const char *cluster Cluster class name for detector id.
670     // Outputs:
671     //      none.
672     // Return:
673     //      none.
674
675     ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
676 }
677 //______________________________________________________________________
678 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
679     // Add an ITS hit
680     //     The function to add information to the AliITShit class. See the
681     // AliITShit class for a full description. This function allocates the
682     // necessary new space for the hit information and passes the variable
683     // track, and the pointers *vol and *hits to the AliITShit constructor
684     // function.
685     // Inputs:
686     //      Int_t   track   Track number which produced this hit.
687     //      Int_t   *vol    Array of Integer Hit information. See AliITShit.h
688     //      Float_t *hits   Array of Floating Hit information.  see AliITShit.h
689     // Outputs:
690     //      none.
691     // Return:
692     //      none.
693
694     TClonesArray &lhits = *fHits;
695     new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
696 }
697 //______________________________________________________________________
698 void AliITS::InitModules(Int_t size,Int_t &nmodules){
699     // Initialize the modules array.
700     // Inputs:
701     //      Int_t size  Size of array of the number of modules to be
702     //                  created. If size <=0 then the number of modules
703     //                  is gotten from AliITSgeom class kept in fITSgeom.
704     // Outputs:
705     //      Int_t &nmodules The number of modules existing.
706     // Return:
707     //      none.
708
709     if(fITSmodules){ 
710         fITSmodules->Delete();
711         delete fITSmodules;
712     } // end fir fITSmoudles
713
714     Int_t nl,indexMAX,index;
715
716     if(size<=0){ // default to using data stored in AliITSgeom
717         if(fITSgeom==0) {
718             Error("InitModules","fITSgeom not defined");
719             return;
720         } // end if fITSgeom==0
721         nl = fITSgeom->GetNlayers();
722         indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl),
723                                             fITSgeom->GetNdetectors(nl))+1;
724         nmodules = indexMAX;
725         fITSmodules = new TObjArray(indexMAX);
726         for(index=0;index<indexMAX;index++){
727             fITSmodules->AddAt( new AliITSmodule(index),index);
728         } // end for index
729     }else{
730         fITSmodules = new TObjArray(size);
731         for(index=0;index<size;index++) {
732             fITSmodules->AddAt( new AliITSmodule(index),index);
733         } // end for index
734
735         nmodules = size;
736     } // end i size<=0
737 }
738 //______________________________________________________________________
739 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
740                          Option_t *option, const char *filename){
741     // fill the modules with the sorted by module hits; add hits from
742     // background if option=Add.
743     // Inputs:
744     //      Int_t evnt       Event to be processed.
745     //      Int_t bgrev      Background Hit tree number.
746     //      Int_t nmodules   Not used.
747     //      Option_t *option String indicating if merging hits or not. To
748     //                       merge hits set equal to "Add". Otherwise no
749     //                       background hits are considered.
750     //      Test_t *filename File name containing the background hits..
751     // Outputs:
752     //      none.
753     // Return:
754     //      none.
755     static TTree *trH1;                 //Tree with background hits
756     static Bool_t first=kTRUE;
757     static TFile *file;
758     const char *addBgr = strstr(option,"Add");
759
760     evnt = nmodules; // Dummy use of variables to remove warnings
761     if (addBgr ) {
762         if(first) {
763             file=new TFile(filename);
764         } // end if first
765         first=kFALSE;
766         file->cd();
767         file->ls();
768         // Get Hits Tree header from file
769         if(trH1) delete trH1;
770         trH1=0;
771
772         char treeName[20];
773         sprintf(treeName,"TreeH%d",bgrev);
774         trH1 = (TTree*)gDirectory->Get(treeName);
775         if (!trH1) {
776             Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
777         } // end if !trH1
778         // Set branch addresses
779     } // end if addBgr
780
781     FillModules(fLoader->TreeH(),0); // fill from this file's tree.
782     
783     if (addBgr ) {
784         FillModules(trH1,10000000); // Default mask 10M.
785         TTree *fAli=fLoader->GetRunLoader()->TreeK();
786         TFile *fileAli=0;
787         if (fAli) fileAli =fAli->GetCurrentFile();
788         fileAli->cd();
789     } // end if add
790 }
791 //______________________________________________________________________
792 void AliITS::FillModules(TTree *treeH, Int_t mask) {
793     // fill the modules with the sorted by module hits; 
794     // can be called many times to do a merging
795     // Inputs:
796     //      TTree *treeH  The tree containing the hits to be copied into
797     //                    the modules.
798     //      Int_t mask    The track number mask to indecate which file
799     //                    this hits came from.
800     // Outputs:
801     //      none.
802     // Return:
803     //      none.
804
805     if (treeH == 0x0)
806      {
807        Error("FillModules","Tree is NULL");
808      }
809     Int_t lay,lad,det,index;
810     AliITShit *itsHit=0;
811     AliITSmodule *mod=0;
812     char branchname[20];
813     sprintf(branchname,"%s",GetName());
814     TBranch *branch = treeH->GetBranch(branchname);
815     if (!branch) {
816         Error("FillModules","%s branch in TreeH not found",branchname);
817         return;
818     } // end if !branch
819     branch->SetAddress(&fHits);
820     Int_t nTracks =(Int_t) treeH->GetEntries();
821     Int_t iPrimTrack,h;
822     for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){
823         ResetHits();
824         Int_t nBytes = treeH->GetEvent(iPrimTrack);
825         if (nBytes <= 0) continue;
826         Int_t nHits = fHits->GetEntriesFast();
827         for(h=0; h<nHits; h++){
828             itsHit = (AliITShit *)fHits->UncheckedAt(h);
829             itsHit->GetDetectorID(lay,lad,det);
830             if (fITSgeom) {
831                 index = fITSgeom->GetModuleIndex(lay,lad,det);
832             } else {
833                 index=det-1; // This should not be used.
834             } // end if [You must have fITSgeom for this to work!]
835             mod = GetModule(index);
836             itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask.
837             mod->AddHit(itsHit,iPrimTrack,h);
838         } // end loop over hits 
839     } // end loop over tracks
840 }
841 //______________________________________________________________________
842 void AliITS::ClearModules(){
843     // Clear the modules TObjArray.
844     // Inputs:
845     //      none.
846     // Outputs:
847     //      none.
848
849     if(fITSmodules) fITSmodules->Delete();
850 }
851 //______________________________________________________________________
852 void AliITS::MakeBranchS(const char *fl){
853     // Creates Tree Branch for the ITS summable digits.
854     // Inputs:
855     //      cont char *fl  File name where SDigits branch is to be written
856     //                     to. If blank it write the SDigits to the same
857     //                     file in which the Hits were found.
858     // Outputs:
859     //      none.
860     // Return:
861     //      none.
862     Int_t buffersize = 4000;
863     char branchname[30];
864
865     // only one branch for SDigits.
866     sprintf(branchname,"%s",GetName());
867     
868
869     if(fLoader->TreeS()){
870         if (fSDigits == 0x0)  fSDigits  = new TClonesArray("AliITSpListItem",1000);
871         MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl);
872     } // end if
873 }
874 //______________________________________________________________________
875 void AliITS::SetTreeAddressS(TTree *treeS){
876     // Set branch address for the ITS summable digits Trees.
877     // Inputs:
878     //      TTree *treeS   Tree containing the SDigits.
879     // Outputs:
880     //      none.
881     // Return:
882     //      none.
883     char branchname[30];
884
885     if(!treeS) return;
886     if (fSDigits == 0x0)  fSDigits = new TClonesArray("AliITSpListItem",1000);
887     TBranch *branch;
888     sprintf(branchname,"%s",GetName());
889     branch = treeS->GetBranch(branchname);
890     if (branch) branch->SetAddress(&fSDigits);
891 }
892 //______________________________________________________________________
893 void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
894     // Creates Tree branches for the ITS.
895     // Inputs:
896     //      TTree     *treeD Pointer to the Digits Tree.
897     //      cont char *file  File name where Digits branch is to be written
898     //                       to. If blank it write the SDigits to the same
899     //                       file in which the Hits were found.
900     // Outputs:
901     //      none.
902     // Return:
903     //      none.
904     Int_t buffersize = 4000;
905     char branchname[30];
906
907     sprintf(branchname,"%s",GetName());
908     // one branch for digits per type of detector
909     const char *det[3] = {"SPD","SDD","SSD"};
910     char digclass[40];
911     char clclass[40];
912     Int_t i;
913     for (i=0; i<kNTYPES ;i++) {
914         DetType(i)->GetClassNames(digclass,clclass);
915         // digits
916         if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
917         if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
918         else ResetDigits(i);
919     } // end for i
920     for (i=0; i<kNTYPES ;i++) {
921         if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
922         else  sprintf(branchname,"%sDigits%d",GetName(),i+1);      
923         if (fDtype && treeD) {
924             MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file);
925         } // end if
926     } // end for i
927 }
928 //______________________________________________________________________
929 void AliITS::SetTreeAddressD(TTree *treeD){
930     // Set branch address for the Trees.
931     // Inputs:
932     //      TTree *treeD   Tree containing the Digits.
933     // Outputs:
934     //      none.
935     // Return:
936     //      none.
937     char branchname[30];
938     const char *det[3] = {"SPD","SDD","SSD"};
939     TBranch *branch;
940     char digclass[40];
941     char clclass[40];
942     Int_t i;
943
944     if(!treeD) return;
945     for (i=0; i<kNTYPES; i++) {
946         DetType(i)->GetClassNames(digclass,clclass);
947         // digits
948         if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
949         if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
950         else ResetDigits(i);
951         if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
952         else  sprintf(branchname,"%sDigits%d",GetName(),i+1);
953         if (fDtype) {
954             branch = treeD->GetBranch(branchname);
955             if (branch) branch->SetAddress(&((*fDtype)[i]));
956         } // end if fDtype
957     } // end for i
958 }
959 //______________________________________________________________________
960 void AliITS::Hits2SDigits(){
961     // Standard Hits to summable Digits function.
962     // Inputs:
963     //      none.
964     // Outputs:
965     //      none.
966
967 //    return; // Using Hits in place of the larger sDigits.
968     fLoader->LoadHits("read");
969     fLoader->LoadSDigits("recreate");
970     AliRunLoader* rl = fLoader->GetRunLoader(); 
971
972     for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
973     // Do the Hits to Digits operation. Use Standard input values.
974     // Event number from file, no background hit merging , use size from
975     // AliITSgeom class, option="All", input from this file only.
976       rl->GetEvent(iEvent);
977       if (!fLoader->TreeS()) fLoader->MakeTree("S");
978       MakeBranch("S");
979       SetTreeAddress();
980       HitsToSDigits(iEvent,0,-1," ",fOpt," ");
981     }
982     
983     fLoader->UnloadHits();
984     fLoader->UnloadSDigits();
985 }
986 //______________________________________________________________________
987 void AliITS::Hits2PreDigits(){
988     // Standard Hits to summable Digits function.
989     // Inputs:
990     //      none.
991     // Outputs:
992     //      none.
993
994     AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
995     // Do the Hits to Digits operation. Use Standard input values.
996     // Event number from file, no background hit merging , use size from
997     // AliITSgeom class, option="All", input from this file only.
998     HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
999 }
1000 //______________________________________________________________________
1001 AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
1002 {
1003   return new AliITSDigitizer(manager);
1004 }
1005 //______________________________________________________________________
1006 void AliITS::SDigitsToDigits(Option_t *opt){
1007     // Standard Summable digits to Digits function.
1008     // Inputs:
1009     //      none.
1010     // Outputs:
1011     //      none.
1012     char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1013
1014     if(!GetITSgeom()) return; // need transformations to do digitization.
1015     AliITSgeom *geom = GetITSgeom();
1016
1017     const char *all = strstr(opt,"All");
1018     const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1019                           strstr(opt,"SSD")};
1020     if( !det[0] && !det[1] && !det[2] ) all = "All";
1021     else all = 0;
1022     static Bool_t setDef=kTRUE;
1023     if (setDef) SetDefaultSimulation();
1024     setDef=kFALSE;
1025
1026     AliITSsimulation *sim      = 0;
1027     AliITSDetType    *iDetType = 0;
1028     TTree            *trees    = fLoader->TreeS();
1029     if( !(trees && this->GetSDigits()) ){
1030         Error("SDigits2Digits","Error: No trees or SDigits. Returning.");
1031         return;
1032     } // end if
1033     sprintf( name, "%s", this->GetName() );
1034     TBranch *brchSDigits = trees->GetBranch( name );
1035     
1036     Int_t id,module;
1037     for(module=0;module<geom->GetIndexMax();module++){
1038         id       = geom->GetModuleType(module);
1039         if (!all && !det[id]) continue;
1040         iDetType = DetType(id);
1041         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
1042         if (!sim) {
1043             Error("SDigit2Digits",
1044                   "The simulation class was not instanciated!");
1045             exit(1);
1046         } // end if !sim
1047         sim->InitSimulationModule(module,gAlice->GetEvNumber());
1048 //
1049         // add summable digits to module
1050         this->GetSDigits()->Clear();
1051         brchSDigits->GetEvent(module);
1052         sim->AddSDigitsToModule(GetSDigits(),0);
1053 //
1054         // Digitise current module sum(SDigits)->Digits
1055         sim->FinishSDigitiseModule();
1056
1057         // fills all branches - wasted disk space
1058         fLoader->TreeD()->Fill();
1059         this->ResetDigits();
1060     } // end for module
1061
1062     fLoader->TreeD()->GetEntries();
1063
1064     fLoader->TreeD()->AutoSave();
1065     // reset tree
1066     fLoader->TreeD()->Reset();
1067     
1068 }
1069 //______________________________________________________________________
1070 void AliITS::Hits2Digits(){
1071     // Standard Hits to Digits function.
1072     // Inputs:
1073     //      none.
1074     // Outputs:
1075     //      none.
1076
1077     fLoader->LoadHits("read");
1078     fLoader->LoadDigits("recreate");
1079     AliRunLoader* rl = fLoader->GetRunLoader(); 
1080
1081     for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
1082     // Do the Hits to Digits operation. Use Standard input values.
1083     // Event number from file, no background hit merging , use size from
1084     // AliITSgeom class, option="All", input from this file only.
1085       rl->GetEvent(iEvent);
1086       if (!fLoader->TreeD()) fLoader->MakeTree("D");
1087       MakeBranch("D");
1088       SetTreeAddress();   
1089       HitsToDigits(iEvent,0,-1," ",fOpt," ");
1090     }
1091
1092     fLoader->UnloadHits();
1093     fLoader->UnloadDigits();
1094 }
1095 //______________________________________________________________________
1096 void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1097                           Option_t *option, Option_t *opt, const char *filename){
1098     // keep galice.root for signal and name differently the file for 
1099     // background when add! otherwise the track info for signal will be lost !
1100     // the condition below will disappear when the geom class will be
1101     // initialized for all versions - for the moment it is only for v5 !
1102     // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable
1103     // Digits.
1104     // Inputs:
1105     //      Int_t evnt       Event to be processed.
1106     //      Int_t bgrev      Background Hit tree number.
1107     //      Int_t nmodules   Not used.
1108     //      Option_t *option String indicating if merging hits or not. To
1109     //                       merge hits set equal to "Add". Otherwise no
1110     //                       background hits are considered.
1111     //      Test_t *filename File name containing the background hits..
1112     // Outputs:
1113     //      none.
1114     // Return:
1115     //      none.
1116 //    return; // using Hits instead of the larger sdigits.
1117
1118     HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
1119 }
1120 //______________________________________________________________________
1121 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1122                           Option_t *option, Option_t *opt, const char *filename){
1123     //   Keep galice.root for signal and name differently the file for 
1124     // background when add! otherwise the track info for signal will be lost !
1125     // the condition below will disappear when the geom class will be
1126     // initialized for all versions - for the moment it is only for v5 !
1127     // 7 is the SDD beam test version.
1128     // Inputs:
1129     //      Int_t evnt       Event to be processed.
1130     //      Int_t bgrev      Background Hit tree number.
1131     //      Int_t nmodules   Not used.
1132     //      Option_t *option String indicating if merging hits or not. To
1133     //                       merge hits set equal to "Add". Otherwise no
1134     //                       background hits are considered.
1135     //      Test_t *filename File name containing the background hits..
1136     // Outputs:
1137     //      none.
1138     // Return:
1139     //      none.
1140
1141     if(!GetITSgeom()) return; // need transformations to do digitization.
1142     AliITSgeom *geom = GetITSgeom();
1143
1144     const char *all = strstr(opt,"All");
1145     const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1146                           strstr(opt,"SSD")};
1147     static Bool_t setDef=kTRUE;
1148     if (setDef) SetDefaultSimulation();
1149     setDef=kFALSE;
1150
1151     Int_t nmodules;
1152     InitModules(size,nmodules);
1153     FillModules(evNumber,bgrev,nmodules,option,filename);
1154
1155     AliITSsimulation *sim      = 0;
1156     AliITSDetType    *iDetType = 0;
1157     AliITSmodule     *mod      = 0;
1158     Int_t id,module;
1159     for(module=0;module<geom->GetIndexMax();module++){
1160         id       = geom->GetModuleType(module);
1161         if (!all && !det[id]) continue;
1162         iDetType = DetType(id);
1163         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
1164         if (!sim) {
1165             Error("HitsToSDigits",
1166                   "The simulation class was not instanciated!");
1167             exit(1);
1168         } // end if !sim
1169         mod      = (AliITSmodule *)fITSmodules->At(module);
1170         sim->SDigitiseModule(mod,module,evNumber);
1171         // fills all branches - wasted disk space
1172         fLoader->TreeS()->Fill(); 
1173         ResetSDigits();
1174     } // end for module
1175
1176     ClearModules();
1177
1178     fLoader->TreeS()->GetEntries();
1179     fLoader->TreeS()->AutoSave();
1180     fLoader->WriteSDigits("OVERWRITE");
1181     // reset tree
1182     fLoader->TreeS()->Reset();
1183 }
1184 //______________________________________________________________________
1185 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
1186                           Option_t *option, Option_t *opt, const char *filename){
1187     //   Keep galice.root for signal and name differently the file for 
1188     // background when add! otherwise the track info for signal will be lost !
1189     // the condition below will disappear when the geom class will be
1190     // initialized for all versions - for the moment it is only for v5 !
1191     // 7 is the SDD beam test version.
1192     // Inputs:
1193     //      Int_t evnt       Event to be processed.
1194     //      Int_t bgrev      Background Hit tree number.
1195     //      Int_t nmodules   Not used.
1196     //      Option_t *option String indicating if merging hits or not. To
1197     //                       merge hits set equal to "Add". Otherwise no
1198     //                       background hits are considered.
1199     //      Test_t *filename File name containing the background hits..
1200     // Outputs:
1201     //      none.
1202     // Return:
1203     //      none.
1204
1205     if(!GetITSgeom()) return; // need transformations to do digitization.
1206     AliITSgeom *geom = GetITSgeom();
1207
1208     const char *all = strstr(opt,"All");
1209     const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1210                           strstr(opt,"SSD")};
1211     static Bool_t setDef=kTRUE;
1212     if (setDef) SetDefaultSimulation();
1213     setDef=kFALSE;
1214
1215     Int_t nmodules;
1216     InitModules(size,nmodules);
1217     FillModules(evNumber,bgrev,nmodules,option,filename);
1218
1219     AliITSsimulation *sim      = 0;
1220     AliITSDetType    *iDetType = 0;
1221     AliITSmodule     *mod      = 0;
1222     Int_t id,module;
1223     for(module=0;module<geom->GetIndexMax();module++){
1224         id       = geom->GetModuleType(module);
1225         if (!all && !det[id]) continue;
1226         iDetType = DetType(id);
1227         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
1228         if (!sim) {
1229             Error("HitsToDigits",
1230                   "The simulation class was not instanciated!");
1231             exit(1);
1232         } // end if !sim
1233         mod      = (AliITSmodule *)fITSmodules->At(module);
1234         sim->DigitiseModule(mod,module,evNumber);
1235         // fills all branches - wasted disk space
1236         fLoader->TreeD()->Fill(); 
1237         ResetDigits();
1238     } // end for module
1239
1240     ClearModules();
1241
1242     fLoader->TreeD()->GetEntries();
1243     fLoader->TreeD()->AutoSave();
1244     // reset tree
1245     fLoader->TreeD()->Reset();
1246 }
1247 //______________________________________________________________________
1248 void AliITS::ResetSDigits(){
1249     // Reset the Summable Digits array.
1250     // Inputs:
1251     //      none.
1252     // Outputs:
1253     //      none.
1254
1255     if (fSDigits) fSDigits->Clear();
1256     fNSDigits = 0;
1257 }
1258 //______________________________________________________________________
1259 void AliITS::ResetDigits(){
1260     // Reset number of digits and the digits array for the ITS detector.
1261     // Inputs:
1262     //      none.
1263     // Outputs:
1264     //      none.
1265
1266     if (!fDtype) return;
1267
1268     Int_t i;
1269     for (i=0;i<kNTYPES;i++ ) {
1270         if (fDtype->At(i))    ((TClonesArray*)fDtype->At(i))->Clear();
1271         if (fNdtype)  fNdtype[i]=0;
1272     } // end for i
1273 }
1274 //______________________________________________________________________
1275 void AliITS::ResetDigits(Int_t i){
1276     // Reset number of digits and the digits array for this branch.
1277     // Inputs:
1278     //      none.
1279     // Outputs:
1280     //      none.
1281
1282     if (fDtype->At(i))    ((TClonesArray*)fDtype->At(i))->Clear();
1283     if (fNdtype)  fNdtype[i]=0;
1284 }
1285 //______________________________________________________________________
1286 void AliITS::AddSumDigit(AliITSpListItem &sdig){
1287     // Adds the a module full of summable digits to the summable digits tree.
1288     // Inputs:
1289     //      AliITSpListItem &sdig   SDigit to be added to SDigits tree.
1290     // Outputs:
1291     //      none.
1292     // Return:
1293     //      none.
1294
1295     TClonesArray &lsdig = *fSDigits;
1296     new(lsdig[fNSDigits++]) AliITSpListItem(sdig);
1297 }
1298 //______________________________________________________________________
1299 void AliITS::AddRealDigit(Int_t id, Int_t *digits){
1300     //   Add a real digit - as coming from data.
1301     // Inputs:
1302     //      Int_t id        Detector type number.
1303     //      Int_t *digits   Integer array containing the digits info. See 
1304     //                      AliITSdigit.h
1305     // Outputs:
1306     //      none.
1307     // Return:
1308     //      none.
1309
1310     TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1311     new(ldigits[fNdtype[id]++]) AliITSdigit(digits);
1312 }
1313 //______________________________________________________________________
1314 void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
1315     //    Add a simulated digit.
1316     // Inputs:
1317     //      Int_t id        Detector type number.
1318     //      AliITSdigit *d  Digit to be added to the Digits Tree. See 
1319     //                      AliITSdigit.h
1320     // Outputs:
1321     //      none.
1322     // Return:
1323     //      none.
1324
1325     TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1326
1327     switch(id){
1328     case 0:
1329         new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d));
1330         break;
1331     case 1:
1332         new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d));
1333         break;
1334     case 2:
1335         new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d));
1336         break;
1337     } // end switch id
1338 }
1339 //______________________________________________________________________
1340 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
1341                          Int_t *hits,Float_t *charges){
1342   //   Add a simulated digit to the list.
1343   // Inputs:
1344   //      Int_t id        Detector type number.
1345   //      Float_t phys    Physics indicator. See AliITSdigits.h
1346   //      Int_t *digits   Integer array containing the digits info. See 
1347   //                      AliITSdigit.h
1348   //      Int_t *tracks   Integer array [AliITSdigitS?D::GetNTracks()] 
1349   //                      containing the track numbers that contributed to
1350   //                      this digit.
1351   //      Int_t *hits     Integer array [AliITSdigitS?D::GetNTracks()]
1352   //                      containing the hit numbers, from AliITSmodule, that
1353   //                      contributed to this digit.
1354   //      Float_t *charge Floating point array of the signals contributed
1355   //                      to this digit by each track.
1356   // Outputs:
1357   //      none.
1358   // Return:
1359   //      none.
1360
1361   TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
1362   AliITSresponseSDD *resp = 0;
1363   switch(id){
1364   case 0:
1365     new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
1366     break;
1367   case 1:
1368     resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
1369     new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
1370                                                hits,charges,resp);
1371     break;
1372   case 2:
1373     new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
1374     break;
1375   } // end switch id
1376 }
1377 //______________________________________________________________________
1378 void AliITS::MakeTreeC(Option_t *option){
1379   //   Create a separate tree to store the clusters.
1380   // Inputs:
1381   //      Option_t *option  string which must contain "C" otherwise
1382   //                        no Cluster Tree is created.
1383   // Outputs:
1384   //      none.
1385   // Return:
1386   //      none.
1387
1388   AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;    
1389     
1390   if (pITSLoader == 0x0) {
1391     Error("MakeTreeC","fLoader == 0x0 option=%s",option);
1392     return;
1393   }
1394   if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C");
1395   MakeBranchC();
1396 }
1397
1398 void AliITS::MakeBranchC()
1399 {
1400 //Makes barnches in treeC
1401   AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;    
1402   if (pITSLoader == 0x0) 
1403    {
1404     Error("MakeTreeC","fLoader == 0x0");
1405     return;
1406    }
1407   TTree * lTC = pITSLoader->TreeC();
1408   if (lTC == 0x0)
1409    {
1410      Error("MakeTreeC","Can not get TreeC from Loader");
1411      return;
1412    }
1413
1414   Int_t buffersize = 4000;
1415   char branchname[30];
1416   const char *det[3] = {"SPD","SDD","SSD"};
1417   char digclass[40];
1418   char clclass[40];
1419
1420     // one branch for Clusters per type of detector
1421   Int_t i;   
1422   for (i=0; i<kNTYPES ;i++) 
1423     {
1424         AliITSDetType *iDetType=DetType(i); 
1425         iDetType->GetClassNames(digclass,clclass);
1426         // clusters
1427         if (fCtype == 0x0) fCtype  = new TObjArray(fNDetTypes);
1428         if(!ClustersAddress(i))
1429          {
1430           fCtype->AddAt(new TClonesArray(clclass,1000),i);
1431          }
1432         if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1433         else  sprintf(branchname,"%sClusters%d",GetName(),i+1);
1434         if (fCtype  && lTC) 
1435          {
1436            if (lTC->GetBranch(branchname))
1437             {
1438               Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname);
1439             }
1440            else
1441             {
1442               Info("MakeBranchC","Creating branch %s in TreeC",branchname);
1443               lTC->Branch(branchname,&((*fCtype)[i]), buffersize);
1444             }
1445          } // end if fCtype && lTC
1446   } // end for i
1447 }
1448
1449 //______________________________________________________________________
1450 void AliITS::GetTreeC(Int_t event){
1451   //    Get the clusters tree for this event and set the branch address.
1452   // Inputs:
1453   //      Int_t event    Event number for the cluster tree.
1454   // Outputs:
1455   //      none.
1456   // Return:
1457   //      none.
1458   char branchname[30];
1459   const char *det[3] = {"SPD","SDD","SSD"};
1460
1461   AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
1462   TTree * lTC = pITSLoader->TreeC();
1463
1464   ResetClusters();
1465   if (lTC) {
1466     pITSLoader->CleanRawClusters();
1467   } // end if TreeC()
1468
1469
1470   TBranch *branch;
1471
1472   if (lTC) {
1473     Int_t i;
1474         char digclass[40];
1475         char clclass[40];
1476         for (i=0; i<kNTYPES; i++) {
1477       AliITSDetType *iDetType=DetType(i); 
1478       iDetType->GetClassNames(digclass,clclass);
1479       // clusters
1480       if (fCtype == 0x0) fCtype  = new TObjArray(fNDetTypes);
1481       if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
1482       if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
1483       else  sprintf(branchname,"%sClusters%d",GetName(),i+1);
1484       if (fCtype) {
1485                 branch = lTC->GetBranch(branchname);
1486         if (branch) branch->SetAddress(&((*fCtype)[i]));
1487       } // end if fCtype
1488         } // end for i
1489   } else {
1490         Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
1491   } // end if lTC
1492 }
1493 //______________________________________________________________________
1494 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
1495     //   Add a cluster to the list.
1496     // Inputs:
1497     //      Int_t id             Detector type number.
1498     //      AliITSRawCluster *c  Cluster class to be added to the tree of
1499     //                           clusters.
1500     // Outputs:
1501     //      none.
1502     // Return:
1503     //      none.
1504
1505     TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
1506
1507     switch(id){
1508     case 0:
1509         new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
1510         break;
1511     case 1:
1512         new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
1513         break;
1514     case 2:
1515         new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
1516         break;
1517     } // end switch id
1518 }
1519 //______________________________________________________________________
1520 void AliITS::ResetClusters(){
1521     // Reset number of clusters and the clusters array for ITS.
1522     // Inputs:
1523     //      none.
1524     // Outputs:
1525     //      none.
1526
1527     Int_t i;
1528     for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
1529 }
1530 //______________________________________________________________________
1531 void AliITS::ResetClusters(Int_t i){
1532     //    Reset number of clusters and the clusters array for this branch.
1533     // Inputs:
1534     //      Int_t i        Detector type number.
1535     // Outputs:
1536     //      none.
1537     // Return:
1538     //      none.
1539
1540     if (fCtype->At(i))    ((TClonesArray*)fCtype->At(i))->Clear();
1541     if (fNctype)  fNctype[i]=0;
1542 }
1543 //______________________________________________________________________
1544 void AliITS::MakeBranchR(const char *file, Option_t *opt){
1545     // Creates Tree branches for the ITS Reconstructed points.
1546     // Inputs:
1547     //      cont char *file  File name where RecPoints branch is to be written
1548     //                       to. If blank it write the SDigits to the same
1549     //                       file in which the Hits were found.
1550     // Outputs:
1551     //      none.
1552     // Return:
1553     //      none.
1554     Int_t buffsz = 4000;
1555     char branchname[30];
1556
1557     // only one branch for rec points for all detector types
1558     Bool_t oFast= (strstr(opt,"Fast")!=0);
1559     if(oFast){
1560       sprintf(branchname,"%sRecPointsF",GetName());
1561     } else {
1562       sprintf(branchname,"%sRecPoints",GetName());
1563     }
1564     
1565     
1566     if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1567     if (fLoader->TreeR()) {
1568         if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1569         MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file);
1570     } // end if
1571 }
1572 //______________________________________________________________________
1573 void AliITS::SetTreeAddressR(TTree *treeR){
1574     // Set branch address for the Reconstructed points Trees.
1575     // Inputs:
1576     //      TTree *treeR   Tree containing the RecPoints.
1577     // Outputs:
1578     //      none.
1579     // Return:
1580     //      none.
1581     char branchname[30];
1582
1583     if(!treeR) return;
1584     if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
1585     TBranch *branch;
1586     sprintf(branchname,"%sRecPoints",GetName());
1587     branch = treeR->GetBranch(branchname);
1588     if (branch) {
1589       branch->SetAddress(&fRecPoints);
1590     }
1591     else {
1592       sprintf(branchname,"%sRecPointsF",GetName());
1593       branch = treeR->GetBranch(branchname);
1594       if (branch) {
1595         branch->SetAddress(&fRecPoints);
1596       }
1597     }
1598 }
1599 //______________________________________________________________________
1600 void AliITS::AddRecPoint(const AliITSRecPoint &r){
1601     // Add a reconstructed space point to the list
1602     // Inputs:
1603     //      const AliITSRecPoint &r RecPoint class to be added to the tree
1604     //                              of reconstructed points TreeR.
1605     // Outputs:
1606     //      none.
1607     // Return:
1608     //      none.
1609
1610     TClonesArray &lrecp = *fRecPoints;
1611     new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
1612 }
1613 //______________________________________________________________________
1614 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
1615                                   Option_t *opt0,Option_t *opt1, const char *flnm){
1616     // keep galice.root for signal and name differently the file for 
1617     // background when add! otherwise the track info for signal will be lost !
1618     // the condition below will disappear when the geom class will be
1619     // initialized for all versions - for the moment it is only for v5 !
1620     // Inputs:
1621     //      Int_t evnt       Event to be processed.
1622     //      Int_t bgrev      Background Hit tree number.
1623     //      Int_t size       Size used by InitModules. See InitModules.
1624     //      Option_t *opt0   Option passed to FillModules. See FillModules.
1625     //      Option_t *opt1   String indicating if merging hits or not. To
1626     //                       merge hits set equal to "Add". Otherwise no
1627     //                       background hits are considered.
1628     //      Test_t *flnm     File name containing the background hits..
1629     // Outputs:
1630     //      none.
1631     // Return:
1632     //      none.
1633
1634     if(!GetITSgeom()) return;
1635     AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1636     AliITSgeom *geom = GetITSgeom();
1637
1638     const char *all = strstr(opt1,"All");
1639     const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"),
1640                          strstr(opt1,"SSD")};
1641     Int_t nmodules;
1642     InitModules(size,nmodules);
1643     FillModules(evNumber,bgrev,nmodules,opt0,flnm);
1644
1645     AliITSsimulation *sim      = 0;
1646     AliITSDetType    *iDetType = 0;
1647     AliITSmodule     *mod      = 0;
1648     Int_t id,module;
1649
1650     //m.b. : this change is nothing but a nice way to make sure
1651     //the CPU goes up !
1652     
1653     cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
1654     
1655     for(module=0;module<geom->GetIndexMax();module++)
1656      {
1657         id       = geom->GetModuleType(module);
1658         if (!all && !det[id]) continue;
1659         iDetType = DetType(id);
1660         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
1661         if (!sim) 
1662          {
1663            Error("HitsToFastPoints","The simulation class was not instanciated!");
1664            exit(1);
1665          } // end if !sim
1666         mod      = (AliITSmodule *)fITSmodules->At(module);
1667         sim->CreateFastRecPoints(mod,module,gRandom);
1668         cout<<module<<"\r";fflush(0);
1669         //gAlice->TreeR()->Fill();
1670         TTree *lTR = pITSloader->TreeR();
1671         TBranch *br=lTR->GetBranch("ITSRecPointsF");
1672         br->Fill();
1673         ResetRecPoints();
1674     } // end for module
1675
1676     ClearModules();
1677     
1678     fLoader->WriteRecPoints("OVERWRITE");
1679 }
1680 //______________________________________________________________________
1681 void AliITS::Digits2Reco(){
1682     // Find clusters and reconstruct space points.
1683     // Inputs:
1684     //      none.
1685     // Outputs:
1686     //      none.
1687
1688     AliHeader *header=fLoader->GetRunLoader()->GetHeader();
1689     // to Digits to RecPoints for event in file, all digits in file, and
1690     // all ITS detectors.
1691     DigitsToRecPoints(header->GetEvent(),0,fOpt);
1692 }
1693 //______________________________________________________________________
1694 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
1695   // cluster finding and reconstruction of space points
1696   // the condition below will disappear when the geom class will be
1697   // initialized for all versions - for the moment it is only for v5 !
1698   // 7 is the SDD beam test version
1699   // Inputs:
1700   //      Int_t evNumber   Event number to be processed.
1701   //      Int_t lastentry  Offset for module when not all of the modules
1702   //                       are processed.
1703   //      Option_t *opt    String indicating which ITS sub-detectors should
1704   //                       be processed. If ="All" then all of the ITS
1705   //                       sub detectors are processed.
1706   // Outputs:
1707   //      none.
1708   // Return:
1709   //      none.
1710
1711   if(!GetITSgeom()) return;
1712   AliITSgeom *geom = GetITSgeom();
1713     
1714   const char *all = strstr(opt,"All");
1715   const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
1716                         strstr(opt,"SSD")};
1717   static Bool_t setRec=kTRUE;
1718   if (setRec) SetDefaultClusterFinders();
1719   setRec=kFALSE;
1720
1721   AliITSLoader *pITSloader = (AliITSLoader*)fLoader;
1722   TTree *treeC=pITSloader->TreeC();
1723   AliITSClusterFinder *rec     = 0;
1724   AliITSDetType      *iDetType = 0;
1725   Int_t id,module,first=0;
1726   for(module=0;module<geom->GetIndexMax();module++){
1727       id       = geom->GetModuleType(module);
1728       if (!all && !det[id]) continue;
1729       if(det[id]) first = geom->GetStartDet(id);
1730       iDetType = DetType(id);
1731       rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
1732       TClonesArray *itsDigits  = this->DigitsAddress(id);
1733       if (!rec) {
1734           Error("DigitsToRecPoints",
1735                 "The reconstruction class was not instanciated! event=%d",
1736                 evNumber);
1737           exit(1);
1738       } // end if !rec
1739       this->ResetDigits();
1740       TTree *lTD = pITSloader->TreeD();
1741       if (all) {
1742           lTD->GetEvent(lastentry+module);
1743       }else {
1744           lTD->GetEvent(lastentry+(module-first));
1745       }
1746       Int_t ndigits = itsDigits->GetEntriesFast();
1747       if (ndigits) rec->FindRawClusters(module);
1748       pITSloader->TreeR()->Fill(); 
1749       ResetRecPoints();
1750       treeC->Fill();
1751       ResetClusters();
1752   } // end for module
1753
1754
1755   pITSloader->WriteRecPoints("OVERWRITE");
1756   pITSloader->WriteRawClusters("OVERWRITE");
1757 }
1758 //______________________________________________________________________
1759 void AliITS::ResetRecPoints(){
1760     // Reset number of rec points and the rec points array.
1761     // Inputs:
1762     //      none.
1763     // Outputs:
1764     //      none.
1765
1766     if (fRecPoints) fRecPoints->Clear();
1767     fNRecPoints = 0;
1768 }
1769 //______________________________________________________________________
1770 AliLoader* AliITS::MakeLoader(const char* topfoldername)
1771
1772   //builds ITSgetter (AliLoader type)
1773   //if detector wants to use castomized getter, it must overload this method
1774
1775   Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername);
1776   fLoader = new AliITSLoader(GetName(),topfoldername);
1777   return fLoader;
1778 }
1779
1780
1781 //_____________________________________________________________________________
1782 void AliITS::Reconstruct() const
1783 {
1784 // reconstruct clusters
1785
1786   AliLoader* loader = GetLoader();
1787   loader->LoadRecPoints("recreate");
1788   loader->LoadDigits("read");
1789
1790   AliITSclustererV2 clusterer(GetITSgeom());
1791   AliRunLoader* runLoader = loader->GetRunLoader();
1792   Int_t nEvents = runLoader->GetNumberOfEvents();
1793   runLoader->LoadKinematics();
1794
1795   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
1796     runLoader->GetEvent(iEvent);
1797
1798     TTree* treeClusters = loader->TreeR();
1799     if (!treeClusters) {
1800       loader->MakeTree("R");
1801       treeClusters = loader->TreeR();
1802     }
1803     TTree* treeDigits = loader->TreeD();
1804     if (!treeDigits) {
1805       Error("Reconstruct", "Can't get digits tree !");
1806       return;
1807     }
1808
1809     clusterer.Digits2Clusters(treeDigits, treeClusters);
1810          
1811     loader->WriteRecPoints("OVERWRITE");
1812   }
1813
1814   loader->UnloadRecPoints();
1815   loader->UnloadDigits();
1816 }
1817
1818 //_____________________________________________________________________________
1819 AliTracker* AliITS::CreateTracker() const
1820 {
1821 // create an ITS tracker
1822
1823   return new AliITStrackerSA(GetITSgeom());
1824 }
1825 //_____________________________________________________________________________
1826 AliVertexer* AliITS::CreateVertexer() const
1827 {
1828   // create a ITS vertexer
1829
1830   if(fSelectedVertexer.Contains("ions") || fSelectedVertexer.Contains("IONS")){
1831     Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
1832     return new AliITSVertexerIons("null");
1833   }
1834   if(fSelectedVertexer.Contains("smear") || fSelectedVertexer.Contains("SMEAR")){
1835     Double_t smear[3]={0.005,0.005,0.01};
1836     Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); 
1837     return new AliITSVertexerFast(smear);
1838   }
1839   if(fSelectedVertexer.Contains("ppz") || fSelectedVertexer.Contains("PPZ")){
1840     Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
1841     return new AliITSVertexerPPZ("null");
1842   }
1843   // by default an AliITSVertexerZ object is instatiated
1844   Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
1845   return new AliITSVertexerZ("null");
1846 }
1847
1848 //_____________________________________________________________________________
1849 void AliITS::FillESD(AliESD* esd) const
1850 {
1851 // make PID, find V0s and cascades
1852
1853   Double_t parITS[] = {34., 0.15, 10.};
1854   AliITSpidESD itsPID(parITS);
1855   itsPID.MakePID(esd);
1856
1857   // V0 finding
1858   Double_t cuts[]={33,  // max. allowed chi2
1859                    0.16,// min. allowed negative daughter's impact parameter 
1860                    0.05,// min. allowed positive daughter's impact parameter 
1861                    0.080,// max. allowed DCA between the daughter tracks
1862                    0.998,// max. allowed cosine of V0's pointing angle
1863                    0.9,  // min. radius of the fiducial volume
1864                    2.9   // max. radius of the fiducial volume
1865   };
1866   AliV0vertexer vtxer(cuts);
1867   Double_t vtx[3], cvtx[6];
1868   esd->GetVertex()->GetXYZ(vtx);
1869   esd->GetVertex()->GetSigmaXYZ(cvtx);
1870   vtxer.SetVertex(vtx);
1871   vtxer.Tracks2V0vertices(esd);
1872
1873   // cascade finding
1874   Double_t cts[]={33.,    // max. allowed chi2
1875                   0.05,   // min. allowed V0 impact parameter 
1876                   0.008,  // window around the Lambda mass 
1877                   0.035,  // min. allowed bachelor's impact parameter 
1878                   0.10,   // max. allowed DCA between a V0 and a track
1879                   0.9985, //max. allowed cosine of the cascade pointing angle
1880                   0.9,    // min. radius of the fiducial volume
1881                   2.9     // max. radius of the fiducial volume
1882   };
1883   AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
1884   cvtxer.V0sTracks2CascadeVertices(esd);
1885 }
1886