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 "AliITSPedestalSSD.h"
54 #include "AliITSsegmentationSPD.h"
55 #include "AliITSsegmentationSDD.h"
56 #include "AliITSsegmentationSSD.h"
60 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
61 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240;
62 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260;
63 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
65 ClassImp(AliITSDetTypeRec)
67 //________________________________________________________________
68 AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
85 // Standard Constructor
93 fReconstruction = new TObjArray(fgkNdettypes);
94 fDigits = new TObjArray(fgkNdettypes);
95 for(Int_t i=0; i<3; i++){
96 fClusterClassName[i]=0;
98 fRecPointClassName[i]=0;
100 fDDLMapSDD=new AliITSDDLModuleMapSDD();
101 fNdtype = new Int_t[fgkNdettypes];
102 fCtype = new TObjArray(fgkNdettypes);
103 fNctype = new Int_t[fgkNdettypes];
104 fNMod = new Int_t [fgkNdettypes];
105 fNMod[0] = fgkDefaultNModulesSPD;
106 fNMod[1] = fgkDefaultNModulesSDD;
107 fNMod[2] = fgkDefaultNModulesSSD;
108 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
111 for(Int_t i=0;i<fgkNdettypes;i++){
119 //______________________________________________________________________
120 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec),
122 fITSgeom(rec.fITSgeom),
123 fReconstruction(rec.fReconstruction),
124 fSegmentation(rec.fSegmentation),
125 fCalibration(rec.fCalibration),
126 fPreProcess(rec.fPreProcess),
127 fPostProcess(rec.fPostProcess),
128 fDigits(rec.fDigits),
129 fDDLMapSDD(rec.fDDLMapSDD),
130 fNdtype(rec.fNdtype),
132 fNctype(rec.fNctype),
133 fRecPoints(rec.fRecPoints),
134 fNRecPoints(rec.fNRecPoints),
135 fSelectedVertexer(rec.fSelectedVertexer),
136 fFirstcall(rec.fFirstcall)
142 //______________________________________________________________________
143 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
144 // Assignment operator.
145 this->~AliITSDetTypeRec();
146 new(this) AliITSDetTypeRec(source);
151 //_____________________________________________________________________
152 AliITSDetTypeRec::~AliITSDetTypeRec(){
156 fReconstruction->Delete();
157 delete fReconstruction;
161 fSegmentation->Delete();
162 delete fSegmentation;
166 if(!(AliCDBManager::Instance()->GetCacheFlag())) {
167 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
168 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
169 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
170 if(rspd) delete rspd;
171 if(rsdd) delete rsdd;
172 if(rssd) delete rssd;
173 fCalibration->Delete();
178 if(fPreProcess) delete fPreProcess;
179 if(fPostProcess) delete fPostProcess;
180 if(fDDLMapSDD) delete fDDLMapSDD;
187 fRecPoints->Delete();
200 if (fITSgeom) delete fITSgeom;
204 //___________________________________________________________________
205 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
207 //Set reconstruction model for detector type
209 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
210 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
211 fReconstruction->AddAt(clf,dettype);
213 //______________________________________________________________________
214 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
216 //Get reconstruction model for detector type
217 if(fReconstruction==0) {
218 Warning("GetReconstructionModel","fReconstruction is 0!");
221 return (AliITSClusterFinder*)fReconstruction->At(dettype);
224 //______________________________________________________________________
225 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
227 //Set segmentation model for detector type
229 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
230 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
231 fSegmentation->AddAt(seg,dettype);
234 //______________________________________________________________________
235 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
237 //Get segmentation model for detector type
239 if(fSegmentation==0) {
240 Warning("GetSegmentationModel","fSegmentation is 0!");
243 return (AliITSsegmentation*)fSegmentation->At(dettype);
246 //_______________________________________________________________________
247 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
249 //Set calibration (response) for the module iMod of type dettype
250 if (fCalibration==0) {
251 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
252 fCalibration->SetOwner(kTRUE);
253 fCalibration->Clear();
256 if (fCalibration->At(iMod) != 0)
257 delete (AliITSCalibration*) fCalibration->At(iMod);
258 fCalibration->AddAt(cal,iMod);
261 //_______________________________________________________________________
262 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
264 //Get calibration model for module type
266 if(fCalibration==0) {
267 Warning("GetalibrationModel","fCalibration is 0!");
271 return (AliITSCalibration*)fCalibration->At(iMod);
274 //______________________________________________________________________
275 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
276 // Set branch address for the tree of digits.
278 const char *det[4] = {"SPD","SDD","SSD","ITS"};
285 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
286 for (i=0; i<fgkNdettypes; i++) {
287 digclass = GetDigitClassName(i);
288 if(!(fDigits->At(i))) {
289 fDigits->AddAt(new TClonesArray(digclass,1000),i);
293 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
294 else sprintf(branchname,"%sDigits%d",det[3],i+1);
296 branch = treeD->GetBranch(branchname);
297 if (branch) branch->SetAddress(&((*fDigits)[i]));
302 //_______________________________________________________________________
303 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
304 const char *classname,
305 void* address,Int_t size,
309 // Makes branch in given tree and diverts them to a separate file
315 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
318 TBranch *branch = tree->GetBranch(name);
323 branch = tree->Branch(name,classname,address,size,splitlevel);
326 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
332 //____________________________________________________________________
333 void AliITSDetTypeRec::SetDefaults(){
335 //Set defaults for segmentation and response
338 Warning("SetDefaults","null pointer to AliITSgeomGeom !");
342 AliITSsegmentation* seg;
343 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
345 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
347 seg = new AliITSsegmentationSPD();
348 SetSegmentationModel(dettype,seg);
349 SetDigitClassName(dettype,"AliITSdigitSPD");
350 SetClusterClassName(dettype,"AliITSRawClusterSPD");
354 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
355 seg = new AliITSsegmentationSDD();
356 SetSegmentationModel(dettype,seg);
357 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
358 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
359 else SetDigitClassName(dettype,"AliITSdigitSDD");
360 SetClusterClassName(dettype,"AliITSRawClusterSDD");
364 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD();
365 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
366 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
367 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
368 SetSegmentationModel(dettype,seg2);
369 SetDigitClassName(dettype,"AliITSdigitSSD");
370 SetClusterClassName(dettype,"AliITSRawClusterSSD");
375 //______________________________________________________________________
376 Bool_t AliITSDetTypeRec::GetCalibration() {
377 // Get Default calibration if a storage is not defined.
380 AliITSCalibration* cal = GetCalibrationModel(0);
387 // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
388 // Int_t run=GetRunNumber();
390 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
391 if (fCalibration==0) {
392 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
393 fCalibration->SetOwner(!cacheStatus);
394 fCalibration->Clear();
397 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead");
398 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
400 // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD");
401 AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD");
402 AliCDBEntry *entryPedestalSSD = AliCDBManager::Instance()->Get("ITS/Calib/PedestalSSD");
403 AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD");
404 AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD");
406 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD");
407 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD");
408 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD");
409 AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD");
410 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
411 AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD");
412 AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD");
414 if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD ||
415 !entryPedestalSSD || !entryBadChannelsSSD ||
416 !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapASDD || !mapTSDD){
417 AliFatal("Calibration object retrieval failed! ");
421 TObjArray *calSPD = (TObjArray *)entrySPD->GetObject();
422 if(!cacheStatus)entrySPD->SetObject(NULL);
423 entrySPD->SetOwner(kTRUE);
425 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
426 if(!cacheStatus)entry2SPD->SetObject(NULL);
427 entry2SPD->SetOwner(kTRUE);
429 TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
430 if(!cacheStatus)entrySDD->SetObject(NULL);
431 entrySDD->SetOwner(kTRUE);
433 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
434 if(!cacheStatus)entry2SDD->SetObject(NULL);
435 entry2SDD->SetOwner(kTRUE);
437 TObjArray *drSp = (TObjArray *)drSpSDD->GetObject();
438 if(!cacheStatus)drSpSDD->SetObject(NULL);
439 drSpSDD->SetOwner(kTRUE);
441 AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
442 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
443 ddlMapSDD->SetOwner(kTRUE);
445 TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
446 if(!cacheStatus)mapASDD->SetObject(NULL);
447 mapASDD->SetOwner(kTRUE);
449 TObjArray *mapT = (TObjArray *)mapTSDD->GetObject();
450 if(!cacheStatus)mapTSDD->SetObject(NULL);
451 mapTSDD->SetOwner(kTRUE);
453 TObjArray *noiseSSD = (TObjArray *)entryNoiseSSD->GetObject();
454 if(!cacheStatus)entryNoiseSSD->SetObject(NULL);
455 entryNoiseSSD->SetOwner(kTRUE);
457 TObjArray *pedestalSSD = (TObjArray *)entryPedestalSSD->GetObject();
458 if(!cacheStatus)entryPedestalSSD->SetObject(NULL);
459 entryPedestalSSD->SetOwner(kTRUE);
461 TObjArray *gainSSD = (TObjArray *)entryGainSSD->GetObject();
462 if(!cacheStatus)entryGainSSD->SetObject(NULL);
463 entryGainSSD->SetOwner(kTRUE);
465 TObjArray *badchannelsSSD = (TObjArray *)entryBadChannelsSSD->GetObject();
466 if(!cacheStatus)entryBadChannelsSSD->SetObject(NULL);
467 entryBadChannelsSSD->SetOwner(kTRUE);
469 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
470 if(!cacheStatus)entry2SSD->SetObject(NULL);
471 entry2SSD->SetOwner(kTRUE);
473 // DB entries are deleted. In this way metadeta objects are deleted as well
477 delete entryNoiseSSD;
478 delete entryPedestalSSD;
480 delete entryBadChannelsSSD;
490 if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp) || (!ddlsdd)
491 || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
492 AliWarning("Can not get calibration from calibration database !");
496 fNMod[0] = calSPD->GetEntries();
497 fNMod[1] = calSDD->GetEntries();
498 fNMod[2] = noiseSSD->GetEntries();
499 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
500 fNMod[0], fNMod[1], fNMod[2]));
501 AliITSCalibration* cal;
502 for (Int_t i=0; i<fNMod[0]; i++) {
503 cal = (AliITSCalibration*) calSPD->At(i);
504 cal->SetResponse((AliITSresponse*)pSPD);
505 SetCalibrationModel(i, cal);
507 for (Int_t i=0; i<fNMod[1]; i++) {
508 cal = (AliITSCalibration*) calSDD->At(i);
509 cal->SetResponse((AliITSresponse*)pSDD);
512 AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0);
513 AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0);
514 AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0);
515 AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1);
516 AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1);
517 AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1);
518 cal->SetDriftSpeed(0,arr0);
519 cal->SetDriftSpeed(1,arr1);
524 fDDLMapSDD->SetDDLMap(ddlsdd);
525 Int_t iMod = i + fNMod[0];
526 SetCalibrationModel(iMod, cal);
528 for (Int_t i=0; i<fNMod[2]; i++) {
530 AliITSCalibrationSSD *calibSSD = new AliITSCalibrationSSD();
531 calibSSD->SetResponse((AliITSresponse*)pSSD);
533 AliITSNoiseSSD *noise = (AliITSNoiseSSD*) (noiseSSD->At(i));
534 calibSSD->SetNoise(noise);
535 AliITSPedestalSSD *pedestal = (AliITSPedestalSSD*) (pedestalSSD->At(i));
536 calibSSD->SetPedestal(pedestal);
537 AliITSGainSSD *gain = (AliITSGainSSD*) (gainSSD->At(i));
538 calibSSD->SetGain(gain);
539 AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (badchannelsSSD->At(i));
540 calibSSD->SetBadChannels(bad);
542 Int_t iMod = i + fNMod[0] + fNMod[1];
543 SetCalibrationModel(iMod, calibSSD);
550 //________________________________________________________________
551 void AliITSDetTypeRec::SetDefaultClusterFinders(){
553 //set defaults for standard cluster finder
556 Warning("SetDefaults","null pointer to AliITSgeom!");
560 AliITSClusterFinder *clf;
562 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
565 if(!GetReconstructionModel(dettype)){
566 TClonesArray *dig0 = DigitsAddress(0);
567 TClonesArray *rec0 = ClustersAddress(0);
568 clf = new AliITSClusterFinderSPD(this,dig0,rec0);
569 SetReconstructionModel(dettype,clf);
576 if(!GetReconstructionModel(dettype)){
577 TClonesArray *dig1 = DigitsAddress(1);
578 TClonesArray *rec1 = ClustersAddress(1);
579 clf = new AliITSClusterFinderSDD(this,dig1,rec1);
580 SetReconstructionModel(dettype,clf);
586 if(!GetReconstructionModel(dettype)){
587 TClonesArray* dig2 = DigitsAddress(2);
588 clf = new AliITSClusterFinderSSD(this,dig2);
589 SetReconstructionModel(dettype,clf);
598 //________________________________________________________________
599 void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
601 //Set defaults for cluster finder V2
604 Warning("SetDefaults","Null pointer to AliITSgeom !");
608 AliITSClusterFinder *clf;
610 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
613 if(!GetReconstructionModel(dettype)){
614 clf = new AliITSClusterFinderV2SPD(this);
616 if(!rawdata) clf->SetDigits(DigitsAddress(0));
617 SetReconstructionModel(dettype,clf);
623 if(!GetReconstructionModel(dettype)){
624 clf = new AliITSClusterFinderV2SDD(this);
626 if(!rawdata) clf->SetDigits(DigitsAddress(1));
627 SetReconstructionModel(dettype,clf);
634 if(!GetReconstructionModel(dettype)){
635 clf = new AliITSClusterFinderV2SSD(this);
637 if(!rawdata) clf->SetDigits(DigitsAddress(2));
638 SetReconstructionModel(dettype,clf);
645 //______________________________________________________________________
646 void AliITSDetTypeRec::MakeBranch(TTree* tree, Option_t* option){
648 //Creates branches for clusters and recpoints
649 Bool_t cR = (strstr(option,"R")!=0);
650 Bool_t cRF = (strstr(option,"RF")!=0);
654 if(cR) MakeBranchR(tree);
655 if(cRF) MakeBranchRF(tree);
659 //___________________________________________________________________
660 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
662 // Adds a raw cluster to the list
663 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
666 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
669 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
672 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
676 //___________________________________________________________________
677 void AliITSDetTypeRec::ResetDigits(){
678 // Reset number of digits and the digits array for the ITS detector.
681 for(Int_t i=0;i<fgkNdettypes;i++){
685 //___________________________________________________________________
686 void AliITSDetTypeRec::ResetDigits(Int_t branch){
687 // Reset number of digits and the digits array for this branch.
689 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
690 if(fNdtype) fNdtype[branch]=0;
694 //__________________________________________________________________
695 void AliITSDetTypeRec::ResetClusters(){
697 //Resets number of clusters and the cluster array
698 for(Int_t i=0;i<fgkNdettypes;i++){
703 //__________________________________________________________________
704 void AliITSDetTypeRec::ResetClusters(Int_t i){
706 //Resets number of clusters and the cluster array for this branch
708 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
709 if (fNctype) fNctype[i]=0;
711 //__________________________________________________________________
712 void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){
714 //Creates tree branches for recpoints
716 // cont char *file File name where RecPoints branch is to be written
717 // to. If blank it write the SDigits to the same
718 // file in which the Hits were found.
723 // only one branch for rec points for all detector types
724 Bool_t oFast= (strstr(opt,"Fast")!=0);
726 Char_t detname[10] = "ITS";
730 sprintf(branchname,"%sRecPointsF",detname);
732 sprintf(branchname,"%sRecPoints",detname);
735 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
737 MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99);
739 //______________________________________________________________________
740 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
741 // Set branch address for the Reconstructed points Trees.
743 // TTree *treeR Tree containing the RecPoints.
749 Char_t namedet[10]="ITS";
752 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
754 sprintf(branchname,"%sRecPoints",namedet);
755 branch = treeR->GetBranch(branchname);
757 branch->SetAddress(&fRecPoints);
759 sprintf(branchname,"%sRecPointsF",namedet);
760 branch = treeR->GetBranch(branchname);
762 branch->SetAddress(&fRecPoints);
767 //____________________________________________________________________
768 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
769 // Add a reconstructed space point to the list
771 // const AliITSRecPoint &r RecPoint class to be added to the tree
772 // of reconstructed points TreeR.
778 TClonesArray &lrecp = *fRecPoints;
779 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
782 //______________________________________________________________________
783 void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Bool_t v2){
784 // cluster finding and reconstruction of space points
785 // the condition below will disappear when the geom class will be
786 // initialized for all versions - for the moment it is only for v5 !
787 // 7 is the SDD beam test version
789 // TTree *treeD Digits tree
790 // TTree *treeR Clusters tree
791 // Int_t lastentry Offset for module when not all of the modules
793 // Option_t *opt String indicating which ITS sub-detectors should
794 // be processed. If ="All" then all of the ITS
795 // sub detectors are processed.
797 const char *all = strstr(opt,"All");
798 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
801 SetDefaultClusterFinders();
802 AliInfo("Original cluster finder has been selected\n");
805 SetDefaultClusterFindersV2();
806 AliInfo("V2 cluster finder has been selected \n");
809 AliITSClusterFinder *rec = 0;
810 Int_t id,module,first=0;
811 for(module=0;module<GetITSgeom()->GetIndexMax();module++){
812 id = GetITSgeom()->GetModuleType(module);
813 if (!all && !det[id]) continue;
814 if(det[id]) first = GetITSgeom()->GetStartDet(id);
815 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
816 TClonesArray *itsDigits = DigitsAddress(id);
818 AliFatal("The reconstruction class was not instanciated!");
819 ResetDigits(); // MvL: Not sure we neeed this when rereading anyways
821 treeD->GetEvent(lastentry+module);
823 treeD->GetEvent(lastentry+(module-first));
825 Int_t ndigits = itsDigits->GetEntriesFast();
827 rec->SetDetTypeRec(this);
828 rec->SetDigits(DigitsAddress(id));
829 // rec->SetClusters(ClustersAddress(id));
830 rec->FindRawClusters(module);
837 //______________________________________________________________________
838 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){
839 // cluster finding and reconstruction of space points
840 // the condition below will disappear when the geom class will be
841 // initialized for all versions - for the moment it is only for v5 !
842 // 7 is the SDD beam test version
844 // AliRawReader *rawReader Pointer to the raw-data reader
845 // TTree *treeR Clusters tree
850 const char *all = strstr(opt,"All");
851 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
853 AliITSClusterFinderV2 *rec = 0;
856 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
857 TBranch *branch = treeR->Branch("ITSRecPoints",&array);
860 TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
861 for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
862 clusters[iModule] = NULL;
865 if (!all && !det[id]) continue;
866 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
868 AliFatal("The reconstruction class was not instanciated");
869 rec->SetDetTypeRec(this);
870 rec->RawdataToClusters(rawReader,clusters);
873 TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
874 for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
875 id = GetITSgeom()->GetModuleType(iModule);
876 if (!all && !det[id]) continue;
877 array = clusters[iModule];
879 AliDebug(1,Form("data for module %d missing!",iModule));
882 branch->SetAddress(&array);
884 nClusters+=array->GetEntriesFast();
886 if (array != emptyArray) {
894 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",