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 "AliITSDriftSpeedSDD.h"
50 #include "AliITSCalibrationSSD.h"
51 #include "AliITSNoiseSSD.h"
52 #include "AliITSGainSSD.h"
53 #include "AliITSBadChannelsSSD.h"
54 #include "AliITSPedestalSSD.h"
55 #include "AliITSsegmentationSPD.h"
56 #include "AliITSsegmentationSDD.h"
57 #include "AliITSsegmentationSSD.h"
61 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
62 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240;
63 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260;
64 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
66 ClassImp(AliITSDetTypeRec)
68 //________________________________________________________________
69 AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
86 // Standard Constructor
94 fReconstruction = new TObjArray(fgkNdettypes);
95 fDigits = new TObjArray(fgkNdettypes);
96 for(Int_t i=0; i<3; i++){
97 fClusterClassName[i]=0;
99 fRecPointClassName[i]=0;
101 fDDLMapSDD=new AliITSDDLModuleMapSDD();
102 fNdtype = new Int_t[fgkNdettypes];
103 fCtype = new TObjArray(fgkNdettypes);
104 fNctype = new Int_t[fgkNdettypes];
105 fNMod = new Int_t [fgkNdettypes];
106 fNMod[0] = fgkDefaultNModulesSPD;
107 fNMod[1] = fgkDefaultNModulesSDD;
108 fNMod[2] = fgkDefaultNModulesSSD;
109 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
112 for(Int_t i=0;i<fgkNdettypes;i++){
120 //______________________________________________________________________
121 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec),
123 fITSgeom(rec.fITSgeom),
124 fReconstruction(rec.fReconstruction),
125 fSegmentation(rec.fSegmentation),
126 fCalibration(rec.fCalibration),
127 fPreProcess(rec.fPreProcess),
128 fPostProcess(rec.fPostProcess),
129 fDigits(rec.fDigits),
130 fDDLMapSDD(rec.fDDLMapSDD),
131 fNdtype(rec.fNdtype),
133 fNctype(rec.fNctype),
134 fRecPoints(rec.fRecPoints),
135 fNRecPoints(rec.fNRecPoints),
136 fSelectedVertexer(rec.fSelectedVertexer),
137 fFirstcall(rec.fFirstcall)
143 //______________________________________________________________________
144 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
145 // Assignment operator.
146 this->~AliITSDetTypeRec();
147 new(this) AliITSDetTypeRec(source);
152 //_____________________________________________________________________
153 AliITSDetTypeRec::~AliITSDetTypeRec(){
157 fReconstruction->Delete();
158 delete fReconstruction;
162 fSegmentation->Delete();
163 delete fSegmentation;
167 if(!(AliCDBManager::Instance()->GetCacheFlag())) {
168 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
169 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
170 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
171 if(rspd) delete rspd;
172 if(rsdd) delete rsdd;
173 if(rssd) delete rssd;
174 fCalibration->Delete();
179 if(fPreProcess) delete fPreProcess;
180 if(fPostProcess) delete fPostProcess;
181 if(fDDLMapSDD) delete fDDLMapSDD;
188 fRecPoints->Delete();
201 if (fITSgeom) delete fITSgeom;
205 //___________________________________________________________________
206 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
208 //Set reconstruction model for detector type
210 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
211 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
212 fReconstruction->AddAt(clf,dettype);
214 //______________________________________________________________________
215 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
217 //Get reconstruction model for detector type
218 if(fReconstruction==0) {
219 Warning("GetReconstructionModel","fReconstruction is 0!");
222 return (AliITSClusterFinder*)fReconstruction->At(dettype);
225 //______________________________________________________________________
226 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
228 //Set segmentation model for detector type
230 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
231 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
232 fSegmentation->AddAt(seg,dettype);
235 //______________________________________________________________________
236 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
238 //Get segmentation model for detector type
240 if(fSegmentation==0) {
241 Warning("GetSegmentationModel","fSegmentation is 0!");
244 return (AliITSsegmentation*)fSegmentation->At(dettype);
247 //_______________________________________________________________________
248 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
250 //Set calibration (response) for the module iMod of type dettype
251 if (fCalibration==0) {
252 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
253 fCalibration->SetOwner(kTRUE);
254 fCalibration->Clear();
257 if (fCalibration->At(iMod) != 0)
258 delete (AliITSCalibration*) fCalibration->At(iMod);
259 fCalibration->AddAt(cal,iMod);
262 //_______________________________________________________________________
263 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
265 //Get calibration model for module type
267 if(fCalibration==0) {
268 Warning("GetalibrationModel","fCalibration is 0!");
272 return (AliITSCalibration*)fCalibration->At(iMod);
275 //______________________________________________________________________
276 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
277 // Set branch address for the tree of digits.
279 const char *det[4] = {"SPD","SDD","SSD","ITS"};
286 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
287 for (i=0; i<fgkNdettypes; i++) {
288 digclass = GetDigitClassName(i);
289 if(!(fDigits->At(i))) {
290 fDigits->AddAt(new TClonesArray(digclass,1000),i);
294 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
295 else sprintf(branchname,"%sDigits%d",det[3],i+1);
297 branch = treeD->GetBranch(branchname);
298 if (branch) branch->SetAddress(&((*fDigits)[i]));
303 //_______________________________________________________________________
304 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
305 const char *classname,
306 void* address,Int_t size,
310 // Makes branch in given tree and diverts them to a separate file
316 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
319 TBranch *branch = tree->GetBranch(name);
324 branch = tree->Branch(name,classname,address,size,splitlevel);
327 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
333 //____________________________________________________________________
334 void AliITSDetTypeRec::SetDefaults(){
336 //Set defaults for segmentation and response
339 Warning("SetDefaults","null pointer to AliITSgeomGeom !");
343 AliITSsegmentation* seg;
344 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
346 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
348 seg = new AliITSsegmentationSPD();
349 SetSegmentationModel(dettype,seg);
350 SetDigitClassName(dettype,"AliITSdigitSPD");
351 SetClusterClassName(dettype,"AliITSRawClusterSPD");
355 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
356 seg = new AliITSsegmentationSDD();
357 SetSegmentationModel(dettype,seg);
358 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
359 if(!strstr(kopt,"ZS")) SetDigitClassName(dettype,"AliITSdigit");
360 else SetDigitClassName(dettype,"AliITSdigitSDD");
361 SetClusterClassName(dettype,"AliITSRawClusterSDD");
365 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD();
366 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
367 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
368 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
369 SetSegmentationModel(dettype,seg2);
370 SetDigitClassName(dettype,"AliITSdigitSSD");
371 SetClusterClassName(dettype,"AliITSRawClusterSSD");
376 //______________________________________________________________________
377 Bool_t AliITSDetTypeRec::GetCalibration() {
378 // Get Default calibration if a storage is not defined.
381 AliITSCalibration* cal = GetCalibrationModel(0);
388 // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
389 // Int_t run=GetRunNumber();
391 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
392 if (fCalibration==0) {
393 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
394 fCalibration->SetOwner(!cacheStatus);
395 fCalibration->Clear();
398 // dead pixel are not used for local reconstruction
399 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDNoisy");
400 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
402 // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD");
403 AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD");
404 AliCDBEntry *entryPedestalSSD = AliCDBManager::Instance()->Get("ITS/Calib/PedestalSSD");
405 AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD");
406 AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD");
408 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD");
409 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD");
410 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD");
411 AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD");
412 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
413 AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD");
414 AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD");
416 if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD ||
417 !entryPedestalSSD || !entryBadChannelsSSD ||
418 !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapASDD || !mapTSDD){
419 AliFatal("Calibration object retrieval failed! ");
423 TObjArray *calSPD = (TObjArray *)entrySPD->GetObject();
424 if(!cacheStatus)entrySPD->SetObject(NULL);
425 entrySPD->SetOwner(kTRUE);
427 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
428 if(!cacheStatus)entry2SPD->SetObject(NULL);
429 entry2SPD->SetOwner(kTRUE);
431 TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
432 if(!cacheStatus)entrySDD->SetObject(NULL);
433 entrySDD->SetOwner(kTRUE);
435 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
436 if(!cacheStatus)entry2SDD->SetObject(NULL);
437 entry2SDD->SetOwner(kTRUE);
439 TObjArray *drSp = (TObjArray *)drSpSDD->GetObject();
440 if(!cacheStatus)drSpSDD->SetObject(NULL);
441 drSpSDD->SetOwner(kTRUE);
443 AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
444 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
445 ddlMapSDD->SetOwner(kTRUE);
447 TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
448 if(!cacheStatus)mapASDD->SetObject(NULL);
449 mapASDD->SetOwner(kTRUE);
451 TObjArray *mapT = (TObjArray *)mapTSDD->GetObject();
452 if(!cacheStatus)mapTSDD->SetObject(NULL);
453 mapTSDD->SetOwner(kTRUE);
455 TObjArray *noiseSSD = (TObjArray *)entryNoiseSSD->GetObject();
456 if(!cacheStatus)entryNoiseSSD->SetObject(NULL);
457 entryNoiseSSD->SetOwner(kTRUE);
459 TObjArray *pedestalSSD = (TObjArray *)entryPedestalSSD->GetObject();
460 if(!cacheStatus)entryPedestalSSD->SetObject(NULL);
461 entryPedestalSSD->SetOwner(kTRUE);
463 TObjArray *gainSSD = (TObjArray *)entryGainSSD->GetObject();
464 if(!cacheStatus)entryGainSSD->SetObject(NULL);
465 entryGainSSD->SetOwner(kTRUE);
467 TObjArray *badchannelsSSD = (TObjArray *)entryBadChannelsSSD->GetObject();
468 if(!cacheStatus)entryBadChannelsSSD->SetObject(NULL);
469 entryBadChannelsSSD->SetOwner(kTRUE);
471 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
472 if(!cacheStatus)entry2SSD->SetObject(NULL);
473 entry2SSD->SetOwner(kTRUE);
475 // DB entries are deleted. In this way metadeta objects are deleted as well
479 delete entryNoiseSSD;
480 delete entryPedestalSSD;
482 delete entryBadChannelsSSD;
492 if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp) || (!ddlsdd)
493 || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
494 AliWarning("Can not get calibration from calibration database !");
498 fNMod[0] = calSPD->GetEntries();
499 fNMod[1] = calSDD->GetEntries();
500 fNMod[2] = noiseSSD->GetEntries();
501 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
502 fNMod[0], fNMod[1], fNMod[2]));
503 AliITSCalibration* cal;
504 for (Int_t i=0; i<fNMod[0]; i++) {
505 cal = (AliITSCalibration*) calSPD->At(i);
506 cal->SetResponse((AliITSresponse*)pSPD);
507 SetCalibrationModel(i, cal);
510 fDDLMapSDD->SetDDLMap(ddlsdd);
511 for(Int_t iddl=0; iddl<AliITSDDLModuleMapSDD::GetNDDLs(); iddl++){
512 for(Int_t icar=0; icar<AliITSDDLModuleMapSDD::GetNModPerDDL();icar++){
513 Int_t iMod=fDDLMapSDD->GetModuleNumber(iddl,icar);
514 if(iMod==-1) continue;
515 Int_t i=iMod - fgkDefaultNModulesSPD;
516 cal = (AliITSCalibration*) calSDD->At(i);
517 cal->SetResponse((AliITSresponse*)pSDD);
520 AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0);
521 AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0);
522 AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0);
523 AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1);
524 AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1);
525 AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1);
526 cal->SetDriftSpeed(0,arr0);
527 cal->SetDriftSpeed(1,arr1);
532 SetCalibrationModel(iMod, cal);
535 for (Int_t i=0; i<fNMod[2]; i++) {
537 AliITSCalibrationSSD *calibSSD = new AliITSCalibrationSSD();
538 calibSSD->SetResponse((AliITSresponse*)pSSD);
540 AliITSNoiseSSD *noise = (AliITSNoiseSSD*) (noiseSSD->At(i));
541 calibSSD->SetNoise(noise);
542 AliITSPedestalSSD *pedestal = (AliITSPedestalSSD*) (pedestalSSD->At(i));
543 calibSSD->SetPedestal(pedestal);
544 AliITSGainSSD *gain = (AliITSGainSSD*) (gainSSD->At(i));
545 calibSSD->SetGain(gain);
546 AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (badchannelsSSD->At(i));
547 calibSSD->SetBadChannels(bad);
549 Int_t iMod = i + fgkDefaultNModulesSPD + fgkDefaultNModulesSDD;
550 SetCalibrationModel(iMod, calibSSD);
557 //________________________________________________________________
558 void AliITSDetTypeRec::SetDefaultClusterFinders(){
560 //set defaults for standard cluster finder
563 Warning("SetDefaults","null pointer to AliITSgeom!");
567 AliITSClusterFinder *clf;
569 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
572 if(!GetReconstructionModel(dettype)){
573 TClonesArray *dig0 = DigitsAddress(0);
574 TClonesArray *rec0 = ClustersAddress(0);
575 clf = new AliITSClusterFinderSPD(this,dig0,rec0);
576 SetReconstructionModel(dettype,clf);
583 if(!GetReconstructionModel(dettype)){
584 TClonesArray *dig1 = DigitsAddress(1);
585 TClonesArray *rec1 = ClustersAddress(1);
586 clf = new AliITSClusterFinderSDD(this,dig1,rec1);
587 SetReconstructionModel(dettype,clf);
593 if(!GetReconstructionModel(dettype)){
594 TClonesArray* dig2 = DigitsAddress(2);
595 clf = new AliITSClusterFinderSSD(this,dig2);
596 SetReconstructionModel(dettype,clf);
605 //________________________________________________________________
606 void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
608 //Set defaults for cluster finder V2
611 Warning("SetDefaults","Null pointer to AliITSgeom !");
615 AliITSClusterFinder *clf;
617 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
620 if(!GetReconstructionModel(dettype)){
621 clf = new AliITSClusterFinderV2SPD(this);
623 if(!rawdata) clf->SetDigits(DigitsAddress(0));
624 SetReconstructionModel(dettype,clf);
630 if(!GetReconstructionModel(dettype)){
631 clf = new AliITSClusterFinderV2SDD(this);
633 if(!rawdata) clf->SetDigits(DigitsAddress(1));
634 SetReconstructionModel(dettype,clf);
641 if(!GetReconstructionModel(dettype)){
642 clf = new AliITSClusterFinderV2SSD(this);
644 if(!rawdata) clf->SetDigits(DigitsAddress(2));
645 SetReconstructionModel(dettype,clf);
652 //______________________________________________________________________
653 void AliITSDetTypeRec::MakeBranch(TTree* tree, Option_t* option){
655 //Creates branches for clusters and recpoints
656 Bool_t cR = (strstr(option,"R")!=0);
657 Bool_t cRF = (strstr(option,"RF")!=0);
661 if(cR) MakeBranchR(tree);
662 if(cRF) MakeBranchRF(tree);
666 //___________________________________________________________________
667 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
669 // Adds a raw cluster to the list
670 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
673 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
676 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
679 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
683 //___________________________________________________________________
684 void AliITSDetTypeRec::ResetDigits(){
685 // Reset number of digits and the digits array for the ITS detector.
688 for(Int_t i=0;i<fgkNdettypes;i++){
692 //___________________________________________________________________
693 void AliITSDetTypeRec::ResetDigits(Int_t branch){
694 // Reset number of digits and the digits array for this branch.
696 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
697 if(fNdtype) fNdtype[branch]=0;
701 //__________________________________________________________________
702 void AliITSDetTypeRec::ResetClusters(){
704 //Resets number of clusters and the cluster array
705 for(Int_t i=0;i<fgkNdettypes;i++){
710 //__________________________________________________________________
711 void AliITSDetTypeRec::ResetClusters(Int_t i){
713 //Resets number of clusters and the cluster array for this branch
715 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
716 if (fNctype) fNctype[i]=0;
718 //__________________________________________________________________
719 void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){
721 //Creates tree branches for recpoints
723 // cont char *file File name where RecPoints branch is to be written
724 // to. If blank it write the SDigits to the same
725 // file in which the Hits were found.
730 // only one branch for rec points for all detector types
731 Bool_t oFast= (strstr(opt,"Fast")!=0);
733 Char_t detname[10] = "ITS";
737 sprintf(branchname,"%sRecPointsF",detname);
739 sprintf(branchname,"%sRecPoints",detname);
742 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
744 MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99);
746 //______________________________________________________________________
747 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
748 // Set branch address for the Reconstructed points Trees.
750 // TTree *treeR Tree containing the RecPoints.
756 Char_t namedet[10]="ITS";
759 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
761 sprintf(branchname,"%sRecPoints",namedet);
762 branch = treeR->GetBranch(branchname);
764 branch->SetAddress(&fRecPoints);
766 sprintf(branchname,"%sRecPointsF",namedet);
767 branch = treeR->GetBranch(branchname);
769 branch->SetAddress(&fRecPoints);
774 //____________________________________________________________________
775 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
776 // Add a reconstructed space point to the list
778 // const AliITSRecPoint &r RecPoint class to be added to the tree
779 // of reconstructed points TreeR.
785 TClonesArray &lrecp = *fRecPoints;
786 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
789 //______________________________________________________________________
790 void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Bool_t v2){
791 // cluster finding and reconstruction of space points
792 // the condition below will disappear when the geom class will be
793 // initialized for all versions - for the moment it is only for v5 !
794 // 7 is the SDD beam test version
796 // TTree *treeD Digits tree
797 // TTree *treeR Clusters tree
798 // Int_t lastentry Offset for module when not all of the modules
800 // Option_t *opt String indicating which ITS sub-detectors should
801 // be processed. If ="All" then all of the ITS
802 // sub detectors are processed.
804 const char *all = strstr(opt,"All");
805 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
808 SetDefaultClusterFinders();
809 AliInfo("Original cluster finder has been selected\n");
812 SetDefaultClusterFindersV2();
813 AliInfo("V2 cluster finder has been selected \n");
816 AliITSClusterFinder *rec = 0;
817 Int_t id,module,first=0;
818 for(module=0;module<GetITSgeom()->GetIndexMax();module++){
819 id = GetITSgeom()->GetModuleType(module);
820 if (!all && !det[id]) continue;
821 if(det[id]) first = GetITSgeom()->GetStartDet(id);
822 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
823 TClonesArray *itsDigits = DigitsAddress(id);
825 AliFatal("The reconstruction class was not instanciated!");
826 ResetDigits(); // MvL: Not sure we neeed this when rereading anyways
828 treeD->GetEvent(lastentry+module);
830 treeD->GetEvent(lastentry+(module-first));
832 Int_t ndigits = itsDigits->GetEntriesFast();
834 rec->SetDetTypeRec(this);
835 rec->SetDigits(DigitsAddress(id));
836 // rec->SetClusters(ClustersAddress(id));
837 rec->FindRawClusters(module);
844 //______________________________________________________________________
845 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){
846 // cluster finding and reconstruction of space points
847 // the condition below will disappear when the geom class will be
848 // initialized for all versions - for the moment it is only for v5 !
849 // 7 is the SDD beam test version
851 // AliRawReader *rawReader Pointer to the raw-data reader
852 // TTree *treeR Clusters tree
857 const char *all = strstr(opt,"All");
858 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
860 AliITSClusterFinderV2 *rec = 0;
863 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
864 TBranch *branch = treeR->Branch("ITSRecPoints",&array);
867 TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
868 for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
869 clusters[iModule] = NULL;
872 if (!all && !det[id]) continue;
873 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
875 AliFatal("The reconstruction class was not instanciated");
876 rec->SetDetTypeRec(this);
877 rec->RawdataToClusters(rawReader,clusters);
880 TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
881 for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
882 id = GetITSgeom()->GetModuleType(iModule);
883 if (!all && !det[id]) continue;
884 array = clusters[iModule];
886 AliDebug(1,Form("data for module %d missing!",iModule));
889 branch->SetAddress(&array);
891 nClusters+=array->GetEntriesFast();
893 if (array != emptyArray) {
901 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",