1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Conributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 ////////////////////////////////////////////////////////////////////////
21 // This class defines the "Standard" reconstruction for the ITS //
24 ////////////////////////////////////////////////////////////////////////
25 #include "TObjArray.h"
28 #include "AliCDBManager.h"
29 #include "AliCDBStorage.h"
30 #include "AliCDBEntry.h"
31 #include "AliITSClusterFinder.h"
32 #include "AliITSClusterFinderV2.h"
33 #include "AliITSClusterFinderV2SPD.h"
34 #include "AliITSClusterFinderV2SDD.h"
35 #include "AliITSClusterFinderV2SSD.h"
36 #include "AliITSClusterFinderSPD.h"
37 #include "AliITSClusterFinderSDD.h"
38 #include "AliITSClusterFinderSSD.h"
39 #include "AliITSDetTypeRec.h"
40 #include "AliITSgeom.h"
41 #include "AliITSRawCluster.h"
42 #include "AliITSRawClusterSPD.h"
43 #include "AliITSRawClusterSDD.h"
44 #include "AliITSRawClusterSSD.h"
45 #include "AliITSRecPoint.h"
46 #include "AliITSCalibrationSDD.h"
47 #include "AliITSMapSDD.h"
48 #include "AliITSDriftSpeedArraySDD.h"
49 #include "AliITSCalibrationSSD.h"
50 #include "AliITSNoiseSSD.h"
51 #include "AliITSGainSSD.h"
52 #include "AliITSBadChannelsSSD.h"
53 #include "AliITSsegmentationSPD.h"
54 #include "AliITSsegmentationSDD.h"
55 #include "AliITSsegmentationSSD.h"
59 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
60 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240;
61 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260;
62 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
64 ClassImp(AliITSDetTypeRec)
66 //________________________________________________________________
67 AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
83 // Standard Constructor
91 fReconstruction = new TObjArray(fgkNdettypes);
92 fDigits = new TObjArray(fgkNdettypes);
93 for(Int_t i=0; i<3; i++){
94 fClusterClassName[i]=0;
96 fRecPointClassName[i]=0;
98 fNdtype = new Int_t[fgkNdettypes];
99 fCtype = new TObjArray(fgkNdettypes);
100 fNctype = new Int_t[fgkNdettypes];
101 fNMod = new Int_t [fgkNdettypes];
102 fNMod[0] = fgkDefaultNModulesSPD;
103 fNMod[1] = fgkDefaultNModulesSDD;
104 fNMod[2] = fgkDefaultNModulesSSD;
105 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
108 for(Int_t i=0;i<fgkNdettypes;i++){
116 //______________________________________________________________________
117 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec),
119 fITSgeom(rec.fITSgeom),
120 fReconstruction(rec.fReconstruction),
121 fSegmentation(rec.fSegmentation),
122 fCalibration(rec.fCalibration),
123 fPreProcess(rec.fPreProcess),
124 fPostProcess(rec.fPostProcess),
125 fDigits(rec.fDigits),
126 fNdtype(rec.fNdtype),
128 fNctype(rec.fNctype),
129 fRecPoints(rec.fRecPoints),
130 fNRecPoints(rec.fNRecPoints),
131 fSelectedVertexer(rec.fSelectedVertexer),
132 fFirstcall(rec.fFirstcall)
138 //______________________________________________________________________
139 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
140 // Assignment operator.
141 this->~AliITSDetTypeRec();
142 new(this) AliITSDetTypeRec(source);
147 //_____________________________________________________________________
148 AliITSDetTypeRec::~AliITSDetTypeRec(){
152 fReconstruction->Delete();
153 delete fReconstruction;
157 fSegmentation->Delete();
158 delete fSegmentation;
162 if(!(AliCDBManager::Instance()->GetCacheFlag())) {
163 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
164 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
165 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
166 if(rspd) delete rspd;
167 if(rsdd) delete rsdd;
168 if(rssd) delete rssd;
169 fCalibration->Delete();
174 if(fPreProcess) delete fPreProcess;
175 if(fPostProcess) delete fPostProcess;
183 fRecPoints->Delete();
196 if (fITSgeom) delete fITSgeom;
200 //___________________________________________________________________
201 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
203 //Set reconstruction model for detector type
205 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
206 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
207 fReconstruction->AddAt(clf,dettype);
209 //______________________________________________________________________
210 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
212 //Get reconstruction model for detector type
213 if(fReconstruction==0) {
214 Warning("GetReconstructionModel","fReconstruction is 0!");
217 return (AliITSClusterFinder*)fReconstruction->At(dettype);
220 //______________________________________________________________________
221 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
223 //Set segmentation model for detector type
225 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
226 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
227 fSegmentation->AddAt(seg,dettype);
230 //______________________________________________________________________
231 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
233 //Get segmentation model for detector type
235 if(fSegmentation==0) {
236 Warning("GetSegmentationModel","fSegmentation is 0!");
239 return (AliITSsegmentation*)fSegmentation->At(dettype);
242 //_______________________________________________________________________
243 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
245 //Set calibration (response) for the module iMod of type dettype
246 if (fCalibration==0) {
247 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
248 fCalibration->SetOwner(kTRUE);
249 fCalibration->Clear();
252 if (fCalibration->At(iMod) != 0)
253 delete (AliITSCalibration*) fCalibration->At(iMod);
254 fCalibration->AddAt(cal,iMod);
257 //_______________________________________________________________________
258 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
260 //Get calibration model for module type
262 if(fCalibration==0) {
263 Warning("GetalibrationModel","fCalibration is 0!");
267 return (AliITSCalibration*)fCalibration->At(iMod);
270 //______________________________________________________________________
271 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
272 // Set branch address for the tree of digits.
274 const char *det[4] = {"SPD","SDD","SSD","ITS"};
281 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
282 for (i=0; i<fgkNdettypes; i++) {
283 digclass = GetDigitClassName(i);
284 if(!(fDigits->At(i))) {
285 fDigits->AddAt(new TClonesArray(digclass,1000),i);
289 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
290 else sprintf(branchname,"%sDigits%d",det[3],i+1);
292 branch = treeD->GetBranch(branchname);
293 if (branch) branch->SetAddress(&((*fDigits)[i]));
298 //_______________________________________________________________________
299 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
300 const char *classname,
301 void* address,Int_t size,
305 // Makes branch in given tree and diverts them to a separate file
311 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
314 TBranch *branch = tree->GetBranch(name);
319 branch = tree->Branch(name,classname,address,size,splitlevel);
322 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
328 //____________________________________________________________________
329 void AliITSDetTypeRec::SetDefaults(){
331 //Set defaults for segmentation and response
334 Warning("SetDefaults","null pointer to AliITSgeomGeom !");
338 AliITSsegmentation* seg;
339 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
341 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
343 seg = new AliITSsegmentationSPD(GetITSgeom());
344 SetSegmentationModel(dettype,seg);
345 SetDigitClassName(dettype,"AliITSdigitSPD");
346 SetClusterClassName(dettype,"AliITSRawClusterSPD");
350 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
351 seg = new AliITSsegmentationSDD(GetITSgeom());
352 SetSegmentationModel(dettype,seg);
353 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
354 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
355 else SetDigitClassName(dettype,"AliITSdigitSDD");
356 SetClusterClassName(dettype,"AliITSRawClusterSDD");
360 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(GetITSgeom());
361 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
362 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
363 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
364 SetSegmentationModel(dettype,seg2);
365 SetDigitClassName(dettype,"AliITSdigitSSD");
366 SetClusterClassName(dettype,"AliITSRawClusterSSD");
371 //______________________________________________________________________
372 Bool_t AliITSDetTypeRec::GetCalibration() {
373 // Get Default calibration if a storage is not defined.
376 AliITSCalibration* cal = GetCalibrationModel(0);
383 // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
384 // Int_t run=GetRunNumber();
386 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
387 if (fCalibration==0) {
388 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
389 fCalibration->SetOwner(!cacheStatus);
390 fCalibration->Clear();
393 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead");
394 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
396 // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD");
397 AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD");
398 AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD");
399 AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD");
401 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD");
402 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD");
403 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD");
404 AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD");
405 AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD");
406 AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD");
408 if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD ||
409 !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !mapASDD || !mapTSDD){
410 AliFatal("Calibration object retrieval failed! ");
414 TObjArray *calSPD = (TObjArray *)entrySPD->GetObject();
415 if(!cacheStatus)entrySPD->SetObject(NULL);
416 entrySPD->SetOwner(kTRUE);
418 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
419 if(!cacheStatus)entry2SPD->SetObject(NULL);
420 entry2SPD->SetOwner(kTRUE);
422 TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
423 if(!cacheStatus)entrySDD->SetObject(NULL);
424 entrySDD->SetOwner(kTRUE);
426 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
427 if(!cacheStatus)entry2SDD->SetObject(NULL);
428 entry2SDD->SetOwner(kTRUE);
430 TObjArray *drSp = (TObjArray *)drSpSDD->GetObject();
431 if(!cacheStatus)drSpSDD->SetObject(NULL);
432 drSpSDD->SetOwner(kTRUE);
434 TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
435 if(!cacheStatus)mapASDD->SetObject(NULL);
436 mapASDD->SetOwner(kTRUE);
438 TObjArray *mapT = (TObjArray *)mapTSDD->GetObject();
439 if(!cacheStatus)mapTSDD->SetObject(NULL);
440 mapTSDD->SetOwner(kTRUE);
442 TObjArray *noiseSSD = (TObjArray *)entryNoiseSSD->GetObject();
443 if(!cacheStatus)entryNoiseSSD->SetObject(NULL);
444 entryNoiseSSD->SetOwner(kTRUE);
446 TObjArray *gainSSD = (TObjArray *)entryGainSSD->GetObject();
447 if(!cacheStatus)entryGainSSD->SetObject(NULL);
448 entryGainSSD->SetOwner(kTRUE);
450 TObjArray *badchannelsSSD = (TObjArray *)entryBadChannelsSSD->GetObject();
451 if(!cacheStatus)entryBadChannelsSSD->SetObject(NULL);
452 entryBadChannelsSSD->SetOwner(kTRUE);
454 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
455 if(!cacheStatus)entry2SSD->SetObject(NULL);
456 entry2SSD->SetOwner(kTRUE);
458 // DB entries are deleted. In this way metadeta objects are deleted as well
462 delete entryNoiseSSD;
464 delete entryBadChannelsSSD;
473 if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp)
474 || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
475 AliWarning("Can not get calibration from calibration database !");
479 fNMod[0] = calSPD->GetEntries();
480 fNMod[1] = calSDD->GetEntries();
481 fNMod[2] = noiseSSD->GetEntries();
482 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
483 fNMod[0], fNMod[1], fNMod[2]));
484 AliITSCalibration* cal;
485 for (Int_t i=0; i<fNMod[0]; i++) {
486 cal = (AliITSCalibration*) calSPD->At(i);
487 cal->SetResponse((AliITSresponse*)pSPD);
488 SetCalibrationModel(i, cal);
490 for (Int_t i=0; i<fNMod[1]; i++) {
491 cal = (AliITSCalibration*) calSDD->At(i);
492 cal->SetResponse((AliITSresponse*)pSDD);
495 AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0);
496 AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0);
497 AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0);
498 AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1);
499 AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1);
500 AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1);
501 cal->SetDriftSpeed(0,arr0);
502 cal->SetDriftSpeed(1,arr1);
507 Int_t iMod = i + fNMod[0];
508 SetCalibrationModel(iMod, cal);
510 for (Int_t i=0; i<fNMod[2]; i++) {
512 AliITSCalibrationSSD *calibSSD = new AliITSCalibrationSSD();
513 calibSSD->SetResponse((AliITSresponse*)pSSD);
515 AliITSNoiseSSD *noise = (AliITSNoiseSSD*) (noiseSSD->At(i));
516 calibSSD->SetNoise(noise);
517 AliITSGainSSD *gain = (AliITSGainSSD*) (gainSSD->At(i));
518 calibSSD->SetGain(gain);
519 AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (badchannelsSSD->At(i));
520 calibSSD->SetBadChannels(bad);
522 Int_t iMod = i + fNMod[0] + fNMod[1];
523 SetCalibrationModel(iMod, calibSSD);
530 //________________________________________________________________
531 void AliITSDetTypeRec::SetDefaultClusterFinders(){
533 //set defaults for standard cluster finder
536 Warning("SetDefaults","null pointer to AliITSgeom!");
540 AliITSClusterFinder *clf;
542 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
545 if(!GetReconstructionModel(dettype)){
546 TClonesArray *dig0 = DigitsAddress(0);
547 TClonesArray *rec0 = ClustersAddress(0);
548 clf = new AliITSClusterFinderSPD(this,dig0,rec0);
549 SetReconstructionModel(dettype,clf);
556 if(!GetReconstructionModel(dettype)){
557 TClonesArray *dig1 = DigitsAddress(1);
558 TClonesArray *rec1 = ClustersAddress(1);
559 clf = new AliITSClusterFinderSDD(this,dig1,rec1);
560 SetReconstructionModel(dettype,clf);
566 if(!GetReconstructionModel(dettype)){
567 TClonesArray* dig2 = DigitsAddress(2);
568 clf = new AliITSClusterFinderSSD(this,dig2);
569 SetReconstructionModel(dettype,clf);
578 //________________________________________________________________
579 void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
581 //Set defaults for cluster finder V2
584 Warning("SetDefaults","Null pointer to AliITSgeom !");
588 AliITSClusterFinder *clf;
590 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
593 if(!GetReconstructionModel(dettype)){
594 clf = new AliITSClusterFinderV2SPD(this);
596 if(!rawdata) clf->SetDigits(DigitsAddress(0));
597 SetReconstructionModel(dettype,clf);
603 if(!GetReconstructionModel(dettype)){
604 clf = new AliITSClusterFinderV2SDD(this);
606 if(!rawdata) clf->SetDigits(DigitsAddress(1));
607 SetReconstructionModel(dettype,clf);
614 if(!GetReconstructionModel(dettype)){
615 clf = new AliITSClusterFinderV2SSD(this);
617 if(!rawdata) clf->SetDigits(DigitsAddress(2));
618 SetReconstructionModel(dettype,clf);
625 //______________________________________________________________________
626 void AliITSDetTypeRec::MakeBranch(TTree* tree, Option_t* option){
628 //Creates branches for clusters and recpoints
629 Bool_t cR = (strstr(option,"R")!=0);
630 Bool_t cRF = (strstr(option,"RF")!=0);
634 if(cR) MakeBranchR(tree);
635 if(cRF) MakeBranchRF(tree);
639 //___________________________________________________________________
640 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
642 // Adds a raw cluster to the list
643 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
646 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
649 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
652 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
656 //___________________________________________________________________
657 void AliITSDetTypeRec::ResetDigits(){
658 // Reset number of digits and the digits array for the ITS detector.
661 for(Int_t i=0;i<fgkNdettypes;i++){
665 //___________________________________________________________________
666 void AliITSDetTypeRec::ResetDigits(Int_t branch){
667 // Reset number of digits and the digits array for this branch.
669 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
670 if(fNdtype) fNdtype[branch]=0;
674 //__________________________________________________________________
675 void AliITSDetTypeRec::ResetClusters(){
677 //Resets number of clusters and the cluster array
678 for(Int_t i=0;i<fgkNdettypes;i++){
683 //__________________________________________________________________
684 void AliITSDetTypeRec::ResetClusters(Int_t i){
686 //Resets number of clusters and the cluster array for this branch
688 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
689 if (fNctype) fNctype[i]=0;
691 //__________________________________________________________________
692 void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){
694 //Creates tree branches for recpoints
696 // cont char *file File name where RecPoints branch is to be written
697 // to. If blank it write the SDigits to the same
698 // file in which the Hits were found.
703 // only one branch for rec points for all detector types
704 Bool_t oFast= (strstr(opt,"Fast")!=0);
706 Char_t detname[10] = "ITS";
710 sprintf(branchname,"%sRecPointsF",detname);
712 sprintf(branchname,"%sRecPoints",detname);
715 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
717 MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99);
719 //______________________________________________________________________
720 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
721 // Set branch address for the Reconstructed points Trees.
723 // TTree *treeR Tree containing the RecPoints.
729 Char_t namedet[10]="ITS";
732 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
734 sprintf(branchname,"%sRecPoints",namedet);
735 branch = treeR->GetBranch(branchname);
737 branch->SetAddress(&fRecPoints);
739 sprintf(branchname,"%sRecPointsF",namedet);
740 branch = treeR->GetBranch(branchname);
742 branch->SetAddress(&fRecPoints);
747 //____________________________________________________________________
748 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
749 // Add a reconstructed space point to the list
751 // const AliITSRecPoint &r RecPoint class to be added to the tree
752 // of reconstructed points TreeR.
758 TClonesArray &lrecp = *fRecPoints;
759 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
762 //______________________________________________________________________
763 void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Bool_t v2){
764 // cluster finding and reconstruction of space points
765 // the condition below will disappear when the geom class will be
766 // initialized for all versions - for the moment it is only for v5 !
767 // 7 is the SDD beam test version
769 // TTree *treeD Digits tree
770 // TTree *treeR Clusters tree
771 // Int_t lastentry Offset for module when not all of the modules
773 // Option_t *opt String indicating which ITS sub-detectors should
774 // be processed. If ="All" then all of the ITS
775 // sub detectors are processed.
777 const char *all = strstr(opt,"All");
778 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
781 SetDefaultClusterFinders();
782 AliInfo("Original cluster finder has been selected\n");
785 SetDefaultClusterFindersV2();
786 AliInfo("V2 cluster finder has been selected \n");
789 AliITSClusterFinder *rec = 0;
790 Int_t id,module,first=0;
791 for(module=0;module<GetITSgeom()->GetIndexMax();module++){
792 id = GetITSgeom()->GetModuleType(module);
793 if (!all && !det[id]) continue;
794 if(det[id]) first = GetITSgeom()->GetStartDet(id);
795 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
796 TClonesArray *itsDigits = DigitsAddress(id);
798 AliFatal("The reconstruction class was not instanciated!");
799 ResetDigits(); // MvL: Not sure we neeed this when rereading anyways
801 treeD->GetEvent(lastentry+module);
803 treeD->GetEvent(lastentry+(module-first));
805 Int_t ndigits = itsDigits->GetEntriesFast();
807 rec->SetDetTypeRec(this);
808 rec->SetDigits(DigitsAddress(id));
809 // rec->SetClusters(ClustersAddress(id));
810 rec->FindRawClusters(module);
817 //______________________________________________________________________
818 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){
819 // cluster finding and reconstruction of space points
820 // the condition below will disappear when the geom class will be
821 // initialized for all versions - for the moment it is only for v5 !
822 // 7 is the SDD beam test version
824 // AliRawReader *rawReader Pointer to the raw-data reader
825 // TTree *treeR Clusters tree
830 const char *all = strstr(opt,"All");
831 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
833 AliITSClusterFinderV2 *rec = 0;
836 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
837 TBranch *branch = treeR->Branch("ITSRecPoints",&array);
840 TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
841 for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
842 clusters[iModule] = NULL;
845 if (!all && !det[id]) continue;
846 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
848 AliFatal("The reconstruction class was not instanciated");
849 rec->SetDetTypeRec(this);
850 rec->RawdataToClusters(rawReader,clusters);
853 TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
854 for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
855 id = GetITSgeom()->GetModuleType(iModule);
856 if (!all && !det[id]) continue;
857 array = clusters[iModule];
859 AliDebug(1,Form("data for module %d missing!",iModule));
862 branch->SetAddress(&array);
864 nClusters+=array->GetEntriesFast();
866 if (array != emptyArray) {
874 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",