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 "AliCDBEntry.h"
30 #include "AliITSClusterFinder.h"
31 #include "AliITSClusterFinderV2.h"
32 #include "AliITSClusterFinderV2SPD.h"
33 #include "AliITSClusterFinderV2SDD.h"
34 #include "AliITSClusterFinderV2SSD.h"
35 #include "AliITSClusterFinderSPD.h"
36 #include "AliITSClusterFinderSDD.h"
37 #include "AliITSClusterFinderSSD.h"
38 #include "AliITSDetTypeRec.h"
39 #include "AliITSRawCluster.h"
40 #include "AliITSRawClusterSPD.h"
41 #include "AliITSRawClusterSDD.h"
42 #include "AliITSRawClusterSSD.h"
43 #include "AliITSRecPoint.h"
44 #include "AliITSCalibrationSDD.h"
45 #include "AliITSsegmentationSPD.h"
46 #include "AliITSsegmentationSDD.h"
47 #include "AliITSsegmentationSSD.h"
51 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
52 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240;
53 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260;
54 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
56 ClassImp(AliITSDetTypeRec)
58 //________________________________________________________________
59 AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
76 // Default Constructor
82 // A properly zero-ed AliITSDetTypeRec class.
84 for(Int_t i=0; i<3; i++){
85 fClusterClassName[i]=0;
87 fRecPointClassName[i]=0;
94 //________________________________________________________________
95 AliITSDetTypeRec::AliITSDetTypeRec(AliITSLoader *loader): TObject(),
112 // Standard Constructor
120 fReconstruction = new TObjArray(fgkNdettypes);
121 fDigits = new TObjArray(fgkNdettypes);
122 for(Int_t i=0; i<3; i++){
123 fClusterClassName[i]=0;
125 fRecPointClassName[i]=0;
127 fNdtype = new Int_t[fgkNdettypes];
128 fCtype = new TObjArray(fgkNdettypes);
129 fNctype = new Int_t[fgkNdettypes];
130 fNMod = new Int_t [fgkNdettypes];
131 fNMod[0] = fgkDefaultNModulesSPD;
132 fNMod[1] = fgkDefaultNModulesSDD;
133 fNMod[2] = fgkDefaultNModulesSSD;
134 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
137 for(Int_t i=0;i<fgkNdettypes;i++){
146 //______________________________________________________________________
147 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec),
149 fReconstruction(rec.fReconstruction),
150 fSegmentation(rec.fSegmentation),
151 fCalibration(rec.fCalibration),
152 fPreProcess(rec.fPreProcess),
153 fPostProcess(rec.fPostProcess),
154 fDigits(rec.fDigits),
155 fNdtype(rec.fNdtype),
157 fNctype(rec.fNctype),
158 fRecPoints(rec.fRecPoints),
159 fNRecPoints(rec.fNRecPoints),
160 fSelectedVertexer(rec.fSelectedVertexer),
161 fLoader(rec.fLoader),
162 fRunNumber(rec.fRunNumber),
163 fFirstcall(rec.fFirstcall)
169 //______________________________________________________________________
170 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
171 // Assignment operator.
172 this->~AliITSDetTypeRec();
173 new(this) AliITSDetTypeRec(source);
178 //_____________________________________________________________________
179 AliITSDetTypeRec::~AliITSDetTypeRec(){
183 fReconstruction->Delete();
184 delete fReconstruction;
188 fSegmentation->Delete();
189 delete fSegmentation;
192 if(fCalibration && fRunNumber<0){
193 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
194 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
195 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
196 if(rspd) delete rspd;
197 if(rsdd) delete rsdd;
198 if(rssd) delete rssd;
199 fCalibration->Delete();
203 if(fPreProcess) delete fPreProcess;
204 if(fPostProcess) delete fPostProcess;
212 fRecPoints->Delete();
224 if(fLoader) delete fLoader;
228 //___________________________________________________________________
229 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
231 //Set reconstruction model for detector type
233 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
234 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
235 fReconstruction->AddAt(clf,dettype);
237 //______________________________________________________________________
238 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
240 //Get reconstruction model for detector type
241 if(fReconstruction==0) {
242 Warning("GetReconstructionModel","fReconstruction is 0!");
245 return (AliITSClusterFinder*)fReconstruction->At(dettype);
248 //______________________________________________________________________
249 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
251 //Set segmentation model for detector type
253 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
254 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
255 fSegmentation->AddAt(seg,dettype);
258 //______________________________________________________________________
259 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
261 //Get segmentation model for detector type
263 if(fSegmentation==0) {
264 Warning("GetSegmentationModel","fSegmentation is 0!");
267 return (AliITSsegmentation*)fSegmentation->At(dettype);
270 //_______________________________________________________________________
271 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
273 //Set calibration (response) for the module iMod of type dettype
274 if (fCalibration==0) {
275 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
276 fCalibration->SetOwner(kTRUE);
277 fCalibration->Clear();
280 if (fCalibration->At(iMod) != 0)
281 delete (AliITSCalibration*) fCalibration->At(iMod);
282 fCalibration->AddAt(cal,iMod);
285 //_______________________________________________________________________
286 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
288 //Get calibration model for module type
290 if(fCalibration==0) {
291 Warning("GetalibrationModel","fCalibration is 0!");
295 return (AliITSCalibration*)fCalibration->At(iMod);
298 //______________________________________________________________________
299 void AliITSDetTypeRec::SetTreeAddress(){
300 // Set branch address for the Trees.
302 TTree *treeR = fLoader->TreeR();
303 TTree *treeD = fLoader->TreeD();
305 SetTreeAddressD(treeD);
306 SetTreeAddressR(treeR);
308 //______________________________________________________________________
309 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
310 // Set branch address for the tree of digits.
312 const char *det[4] = {"SPD","SDD","SSD","ITS"};
319 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
320 for (i=0; i<fgkNdettypes; i++) {
321 digclass = GetDigitClassName(i);
322 if(!(fDigits->At(i))) {
323 fDigits->AddAt(new TClonesArray(digclass,1000),i);
327 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
328 else sprintf(branchname,"%sDigits%d",det[3],i+1);
330 branch = treeD->GetBranch(branchname);
331 if (branch) branch->SetAddress(&((*fDigits)[i]));
336 //_______________________________________________________________________
337 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
338 const char *classname,
339 void* address,Int_t size,
340 Int_t splitlevel, const char */*file*/)
343 // Makes branch in given tree and diverts them to a separate file
349 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
352 TBranch *branch = tree->GetBranch(name);
357 branch = tree->Branch(name,classname,address,size,splitlevel);
360 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
366 //____________________________________________________________________
367 void AliITSDetTypeRec::SetDefaults(){
369 //Set defaults for segmentation and response
372 Warning("SetDefaults","null pointer to AliITSgeomGeom !");
376 AliITSsegmentation* seg;
377 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
379 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
381 seg = new AliITSsegmentationSPD(GetITSgeom());
382 SetSegmentationModel(dettype,seg);
383 SetDigitClassName(dettype,"AliITSdigitSPD");
384 SetClusterClassName(dettype,"AliITSRawClusterSPD");
388 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
389 seg = new AliITSsegmentationSDD(GetITSgeom(),res);
390 SetSegmentationModel(dettype,seg);
391 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
392 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
393 else SetDigitClassName(dettype,"AliITSdigitSDD");
394 SetClusterClassName(dettype,"AliITSRawClusterSDD");
398 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(GetITSgeom());
399 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
400 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
401 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
402 SetSegmentationModel(dettype,seg2);
403 SetDigitClassName(dettype,"AliITSdigitSSD");
404 SetClusterClassName(dettype,"AliITSRawClusterSSD");
409 //______________________________________________________________________
410 Bool_t AliITSDetTypeRec::GetCalibration() {
411 // Get Default calibration if a storage is not defined.
414 AliITSCalibration* cal = GetCalibrationModel(0);
421 SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
422 Int_t run=GetRunNumber();
423 if(run<0)run=0; // if the run number is not yet set, use fake run # 0
425 Bool_t origCacheStatus = AliCDBManager::Instance()->GetCacheFlag();
426 Bool_t isCacheActive = kTRUE;
427 if(GetRunNumber()<0)isCacheActive=kFALSE;
428 if (fCalibration==0) {
429 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
430 fCalibration->SetOwner(isCacheActive);
431 fCalibration->Clear();
434 AliCDBManager::Instance()->SetCacheFlag(isCacheActive);
436 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run);
437 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
438 AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
439 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run);
440 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", run);
441 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
443 if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){
444 AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
445 AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
446 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
448 entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run);
449 entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
450 entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
451 entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run);
452 entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", run);
453 entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
455 AliCDBManager::Instance()->SetDefaultStorage(origStorage);
459 TObjArray *calSPD = (TObjArray *)entrySPD->GetObject();
460 if(!isCacheActive)entrySPD->SetObject(NULL);
461 entrySPD->SetOwner(kTRUE);
463 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
464 if(!isCacheActive)entry2SPD->SetObject(NULL);
465 entry2SPD->SetOwner(kTRUE);
467 TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
468 if(!isCacheActive)entrySDD->SetObject(NULL);
469 entrySDD->SetOwner(kTRUE);
471 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
472 if(!isCacheActive)entry2SDD->SetObject(NULL);
473 entry2SDD->SetOwner(kTRUE);
475 TObjArray *calSSD = (TObjArray *)entrySSD->GetObject();
476 if(!isCacheActive)entrySSD->SetObject(NULL);
477 entrySSD->SetOwner(kTRUE);
479 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
480 if(!isCacheActive)entry2SSD->SetObject(NULL);
481 entry2SSD->SetOwner(kTRUE);
483 // DB entries are deleted. In this way metadeta objects are deleted as well
493 AliCDBManager::Instance()->SetCacheFlag(origCacheStatus);
495 if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!calSSD)) {
496 AliWarning("Can not get calibration from calibration database !");
500 fNMod[0] = calSPD->GetEntries();
501 fNMod[1] = calSDD->GetEntries();
502 fNMod[2] = calSSD->GetEntries();
503 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
504 fNMod[0], fNMod[1], fNMod[2]));
505 AliITSCalibration* cal;
506 for (Int_t i=0; i<fNMod[0]; i++) {
507 cal = (AliITSCalibration*) calSPD->At(i);
508 cal->SetResponse((AliITSresponse*)pSPD);
509 SetCalibrationModel(i, cal);
511 for (Int_t i=0; i<fNMod[1]; i++) {
512 cal = (AliITSCalibration*) calSDD->At(i);
513 cal->SetResponse((AliITSresponse*)pSDD);
514 Int_t iMod = i + fNMod[0];
515 SetCalibrationModel(iMod, cal);
517 for (Int_t i=0; i<fNMod[2]; i++) {
518 cal = (AliITSCalibration*) calSSD->At(i);
519 cal->SetResponse((AliITSresponse*)pSSD);
520 Int_t iMod = i + fNMod[0] + fNMod[1];
521 SetCalibrationModel(iMod, cal);
528 //________________________________________________________________
529 void AliITSDetTypeRec::SetDefaultClusterFinders(){
531 //set defaults for standard cluster finder
534 Warning("SetDefaults","null pointer to AliITSgeom!");
538 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;
591 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
594 if(!GetReconstructionModel(dettype)){
595 clf = new AliITSClusterFinderV2SPD(this);
597 if(!rawdata) clf->SetDigits(DigitsAddress(0));
598 SetReconstructionModel(dettype,clf);
604 if(!GetReconstructionModel(dettype)){
605 clf = new AliITSClusterFinderV2SDD(this);
607 if(!rawdata) clf->SetDigits(DigitsAddress(1));
608 SetReconstructionModel(dettype,clf);
615 if(!GetReconstructionModel(dettype)){
616 clf = new AliITSClusterFinderV2SSD(this);
618 if(!rawdata) clf->SetDigits(DigitsAddress(2));
619 SetReconstructionModel(dettype,clf);
626 //______________________________________________________________________
627 void AliITSDetTypeRec::MakeBranch(Option_t* option){
629 //Creates branches for clusters and recpoints
630 Bool_t cR = (strstr(option,"R")!=0);
631 Bool_t cRF = (strstr(option,"RF")!=0);
635 if(cR) MakeBranchR(0);
636 if(cRF) MakeBranchRF(0);
640 //_____________________________________________________________
641 void AliITSDetTypeRec::MakeTreeC(){
643 //Create a separate tree to store the clusters
645 Warning("MakeTreeC","ITS loader is null!");
648 if(fLoader->TreeC()== 0x0) fLoader->MakeTree("C");
652 //______________________________________________________________
653 void AliITSDetTypeRec::MakeBranchC(){
655 //Make branches in the tree of clusters
658 Warning("MakeBranchC","ITS loader is null!");
661 TTree* lTC = fLoader->TreeC();
663 Error("MakeTreeC","Can not get TreeC from loader");
667 Int_t buffersize = 4000;
668 Char_t branchname[30];
670 const char *det[4]={"SPD","SDD","SSD","ITS"};
672 for(Int_t i=0;i<fgkNdettypes;i++){
673 cluclass = GetClusterClassName(i);
674 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
675 if(!ClustersAddress(i)){
676 fCtype->AddAt(new TClonesArray(cluclass,1000),i);
678 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
679 else sprintf(branchname,"%sClusters%d",det[3],i+1);
681 if(lTC->GetBranch(branchname)){
682 Warning("MakeBranchC","Branch %s already exists in TreeC",branchname);
684 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
685 lTC->Branch(branchname,&((*fCtype)[i]),buffersize);
693 //_______________________________________________________________
694 void AliITSDetTypeRec::GetTreeC(Int_t event){
696 //Get the clusters tree for this event and
697 //sets the branch address
701 Warning("GetTreeC","ITS loader is null!");
705 Char_t branchname[30];
706 const char *det[4] = {"SPD","SDD","SSD","ITS"};
707 TTree* lTC = fLoader->TreeC();
710 if(lTC) fLoader->CleanRawClusters();
715 for(Int_t i=0;i<fgkNdettypes;i++){
716 cluclass = GetClusterClassName(i);
717 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
718 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(cluclass,1000),i);
719 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
720 else sprintf(branchname,"%sClusters%d",det[3],i+1);
722 branch = lTC->GetBranch(branchname);
723 if(branch) branch->SetAddress(&((*fCtype)[i]));
727 Error("GetTreeC","cannot find clusters Tree for vent %d",event);
732 //___________________________________________________________________
733 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
735 // Adds a raw cluster to the list
736 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
739 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
742 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
745 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
749 //___________________________________________________________________
750 void AliITSDetTypeRec::ResetDigits(){
751 // Reset number of digits and the digits array for the ITS detector.
754 for(Int_t i=0;i<fgkNdettypes;i++){
758 //___________________________________________________________________
759 void AliITSDetTypeRec::ResetDigits(Int_t branch){
760 // Reset number of digits and the digits array for this branch.
762 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
763 if(fNdtype) fNdtype[branch]=0;
767 //__________________________________________________________________
768 void AliITSDetTypeRec::ResetClusters(){
770 //Resets number of clusters and the cluster array
771 for(Int_t i=0;i<fgkNdettypes;i++){
776 //__________________________________________________________________
777 void AliITSDetTypeRec::ResetClusters(Int_t i){
779 //Resets number of clusters and the cluster array for this branch
781 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
782 if (fNctype) fNctype[i]=0;
784 //__________________________________________________________________
785 void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){
787 //Creates tree branches for recpoints
789 // cont char *file File name where RecPoints branch is to be written
790 // to. If blank it write the SDigits to the same
791 // file in which the Hits were found.
794 Warning("MakeBranchR","ITS loader is null!");
801 // only one branch for rec points for all detector types
802 Bool_t oFast= (strstr(opt,"Fast")!=0);
804 Char_t detname[10] = "ITS";
808 sprintf(branchname,"%sRecPointsF",detname);
810 sprintf(branchname,"%sRecPoints",detname);
813 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
814 if (fLoader->TreeR()) {
815 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
817 MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
822 //______________________________________________________________________
823 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
824 // Set branch address for the Reconstructed points Trees.
826 // TTree *treeR Tree containing the RecPoints.
832 Char_t namedet[10]="ITS";
835 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
837 sprintf(branchname,"%sRecPoints",namedet);
838 branch = treeR->GetBranch(branchname);
840 branch->SetAddress(&fRecPoints);
842 sprintf(branchname,"%sRecPointsF",namedet);
843 branch = treeR->GetBranch(branchname);
845 branch->SetAddress(&fRecPoints);
850 //____________________________________________________________________
851 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
852 // Add a reconstructed space point to the list
854 // const AliITSRecPoint &r RecPoint class to be added to the tree
855 // of reconstructed points TreeR.
861 TClonesArray &lrecp = *fRecPoints;
862 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
865 //______________________________________________________________________
866 void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){
867 // cluster finding and reconstruction of space points
868 // the condition below will disappear when the geom class will be
869 // initialized for all versions - for the moment it is only for v5 !
870 // 7 is the SDD beam test version
872 // Int_t evNumber Event number to be processed.
873 // Int_t lastentry Offset for module when not all of the modules
875 // Option_t *opt String indicating which ITS sub-detectors should
876 // be processed. If ="All" then all of the ITS
877 // sub detectors are processed.
880 Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
884 Warning("DigitsToRecPoints","ITS loader is null!");
888 const char *all = strstr(opt,"All");
889 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
892 SetDefaultClusterFinders();
893 AliInfo("Original cluster finder has been selected\n");
896 SetDefaultClusterFindersV2();
897 AliInfo("V2 cluster finder has been selected \n");
900 TTree *treeC=fLoader->TreeC();
905 AliITSClusterFinder *rec = 0;
906 Int_t id,module,first=0;
907 for(module=0;module<GetITSgeom()->GetIndexMax();module++){
908 id = GetITSgeom()->GetModuleType(module);
909 if (!all && !det[id]) continue;
910 if(det[id]) first = GetITSgeom()->GetStartDet(id);
911 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
912 TClonesArray *itsDigits = DigitsAddress(id);
914 Error("DigitsToRecPoints",
915 "The reconstruction class was not instanciated! event=%d",
920 TTree *lTD = fLoader->TreeD();
922 lTD->GetEvent(lastentry+module);
924 lTD->GetEvent(lastentry+(module-first));
926 Int_t ndigits = itsDigits->GetEntriesFast();
928 rec->SetDetTypeRec(this);
929 rec->SetDigits(DigitsAddress(id));
930 rec->SetClusters(ClustersAddress(id));
931 rec->FindRawClusters(module);
933 fLoader->TreeR()->Fill();
939 fLoader->WriteRecPoints("OVERWRITE");
940 fLoader->WriteRawClusters("OVERWRITE");
942 //______________________________________________________________________
943 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
944 // cluster finding and reconstruction of space points
945 // the condition below will disappear when the geom class will be
946 // initialized for all versions - for the moment it is only for v5 !
947 // 7 is the SDD beam test version
949 // Int_t evNumber Event number to be processed.
950 // Int_t lastentry Offset for module when not all of the modules
952 // Option_t *opt String indicating which ITS sub-detectors should
953 // be processed. If ="All" then all of the ITS
954 // sub detectors are processed.
960 Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
964 Warning("DigitsToRecPoints","ITS loader is null!");
969 AliITSClusterFinderV2 *rec = 0;
972 if(!fLoader->TreeR()) fLoader->MakeTree("R");
973 TTree* cTree = fLoader->TreeR();
974 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
975 cTree->Branch("ITSRecPoints",&array);
978 TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
979 for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
980 clusters[iModule] = NULL;
983 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
984 rec->SetDetTypeRec(this);
986 Error("DigitsToRecPoints",
987 "The reconstruction class was not instanciated");
990 rec->RawdataToClusters(rawReader,clusters);
993 for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
994 array = clusters[iModule];
996 Error("DigitsToRecPoints","data for module %d missing!",iModule);
997 array = new TClonesArray("AliITSRecPoint");
999 cTree->SetBranchAddress("ITSRecPoints",&array);
1001 nClusters+=array->GetEntriesFast();
1004 fLoader->WriteRecPoints("OVERWRITE");
1007 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",