#include "AliMUONClusterStoreV2.h"
#include "AliMUONRawClusterV2.h"
#include "AliMUONClusterStoreV2Iterator.h"
#include "AliMUONTreeManager.h"
#include "AliMpConstants.h"
#include "AliMpExMap.h"
#include "AliLog.h"
#include <TTree.h>
#include <Riostream.h>
ClassImp(AliMUONClusterStoreV2)
AliMUONClusterStoreV2::AliMUONClusterStoreV2(TRootIOCtor* )
: AliMUONVClusterStore(),
fClusters(0x0),
fMap(0x0),
fMapped(kFALSE)
{
}
AliMUONClusterStoreV2::AliMUONClusterStoreV2()
: AliMUONVClusterStore(),
fClusters(new TClonesArray("AliMUONRawClusterV2",100)),
fMap(0x0),
fMapped(kFALSE)
{
}
AliMUONClusterStoreV2::AliMUONClusterStoreV2(const AliMUONClusterStoreV2& store)
: AliMUONVClusterStore(),
fClusters(new TClonesArray(*(store.fClusters))),
fMap(0x0),
fMapped(kFALSE)
{
if (store.fMapped) ReMap();
}
AliMUONClusterStoreV2& AliMUONClusterStoreV2::operator=(const AliMUONClusterStoreV2& store)
{
if ( this != &store )
{
fClusters = new TClonesArray(*(store.fClusters));
fMap = 0x0;
fMapped = kFALSE;
if (store.fMapped) ReMap();
}
return *this;
}
AliMUONClusterStoreV2::~AliMUONClusterStoreV2()
{
delete fClusters;
delete fMap;
}
void AliMUONClusterStoreV2::Clear(Option_t*)
{
if ( fClusters )
{
fClusters->Clear("C");
if (fMap) {
Int_t nChamber = AliMpConstants::NofTrackingChambers();
for (Int_t chamber=0; chamber<nChamber; chamber++) {
AliMpExMap *map = static_cast<AliMpExMap *>(fMap->UncheckedAt(chamber));
map->Clear("C");
}
fMapped = kFALSE;
}
}
}
Bool_t AliMUONClusterStoreV2::Connect(TTree& tree, Bool_t alone) const
{
AliMUONTreeManager tman;
if (tree.GetBranch("MUONRawClusters")) {
if (alone) tman.UpdateBranchStatuses(tree,"MUONRawClusters");
return tman.SetAddress(tree,"MUONRawClusters",
const_cast<TClonesArray**>(&fClusters));
} else {
return tman.MakeBranch(tree,ClassName(),"TClonesArray", "MUONRawClusters",
const_cast<TClonesArray**>(&fClusters));
}
}
AliMUONVCluster* AliMUONClusterStoreV2::CreateCluster(Int_t chamberId, Int_t detElemId, Int_t clusterIndex) const
{
return new AliMUONRawClusterV2(chamberId, detElemId, clusterIndex);
}
AliMUONVCluster* AliMUONClusterStoreV2::Add(const AliMUONVCluster& vCluster)
{
const AliMUONRawClusterV2* cluster = dynamic_cast<const AliMUONRawClusterV2*>(&vCluster);
if (!cluster) {
AliError(Form("Cluster is not of the expected type (%s vs AliMUONRawClusterV2)",
vCluster.ClassName()));
return 0x0;
}
Int_t chamberId = cluster->GetChamberId();
if (chamberId < 0 || chamberId >= AliMpConstants::NofTrackingChambers()) {
AliError(Form("ChamberId (%d) out of boundaries [0,%d[",chamberId,AliMpConstants::NofTrackingChambers()));
return 0x0;
}
AliMUONVCluster *c = FindObject(cluster->GetUniqueID());
if (c) {
AliError("cluster store already contains a cluster with the same ID --> add() exited:");
c->Print("FULL");
return 0x0;
}
c = new((*fClusters)[fClusters->GetLast()+1]) AliMUONRawClusterV2(*cluster);
if (c) UpdateMap(*c);
return c;
}
AliMUONVCluster* AliMUONClusterStoreV2::Add(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
{
if (chamberId < 0 || chamberId >= AliMpConstants::NofTrackingChambers()) {
AliError(Form("ChamberId (%d) out of boundaries [0,%d[",chamberId,AliMpConstants::NofTrackingChambers()));
return 0x0;
}
AliMUONVCluster *c = FindObject(AliMUONVCluster::BuildUniqueID(chamberId, detElemId, clusterIndex));
if (c) {
AliError("cluster store already contains a cluster with the same ID --> add() exited:");
c->Print("FULL");
return 0x0;
}
c = new((*fClusters)[fClusters->GetLast()+1]) AliMUONRawClusterV2(chamberId, detElemId, clusterIndex);
if (c) UpdateMap(*c);
return c;
}
AliMUONVCluster* AliMUONClusterStoreV2::Remove(AliMUONVCluster& cluster)
{
AliMUONVCluster* c = static_cast<AliMUONVCluster*>(fClusters->Remove(&cluster));
if (c)
{
fClusters->Compress();
fMapped = kFALSE;
}
else
{
AliError("Could not remove cluster from array");
}
return c;
}
void AliMUONClusterStoreV2::ReMap()
{
fMapped = kTRUE;
Int_t nChamber = AliMpConstants::NofTrackingChambers();
if (!fMap) {
fMap = new TClonesArray("AliMpExMap",nChamber);
AliMpExMap *map;
for (Int_t chamber=0; chamber<nChamber; chamber++) {
map = new((*fMap)[chamber]) AliMpExMap;
map->SetOwner(kFALSE);
}
}
else {
for (Int_t chamber=0; chamber<nChamber; chamber++) {
AliMpExMap *map = static_cast<AliMpExMap *>(fMap->UncheckedAt(chamber));
map->Clear("C");
}
}
TIter next(fClusters);
AliMUONVCluster* cluster;
while ( (cluster = static_cast<AliMUONVCluster*>(next())) ) UpdateMap(*cluster);
}
void AliMUONClusterStoreV2::UpdateMap(AliMUONVCluster& cluster)
{
if (fMapped) static_cast<AliMpExMap*>(fMap->UncheckedAt(cluster.GetChamberId()))->Add(cluster.GetUniqueID(),&cluster);
else ReMap();
}
AliMUONVCluster* AliMUONClusterStoreV2::FindObject(const TObject* object) const
{
const AliMUONVCluster* cluster = dynamic_cast<const AliMUONVCluster*>(object);
if (cluster) return FindObject(cluster->GetUniqueID());
return 0x0;
}
AliMUONVCluster* AliMUONClusterStoreV2::FindObject(UInt_t uniqueID) const
{
if (!fMapped) (const_cast<AliMUONClusterStoreV2*>(this))->ReMap();
AliMpExMap* map = static_cast<AliMpExMap*>(fMap->UncheckedAt(AliMUONVCluster::GetChamberId(uniqueID)));
return static_cast<AliMUONVCluster*>(map->GetValue(uniqueID));
}
TIterator* AliMUONClusterStoreV2::CreateIterator() const
{
return fClusters->MakeIterator();
}
TIterator* AliMUONClusterStoreV2::CreateChamberIterator(Int_t firstChamber, Int_t lastChamber) const
{
if (firstChamber < 0 || firstChamber >= AliMpConstants::NofTrackingChambers()) {
AliError(Form("First chamber out of boundaries [0,%d[", AliMpConstants::NofTrackingChambers()));
return 0x0;
}
if (lastChamber < 0 || lastChamber >= AliMpConstants::NofTrackingChambers()) {
AliError(Form("Last chamber out of boundaries [0,%d[", AliMpConstants::NofTrackingChambers()));
return 0x0;
}
if (!fMapped) (const_cast<AliMUONClusterStoreV2*>(this))->ReMap();
return new AliMUONClusterStoreV2Iterator(this,firstChamber,lastChamber);
}
AliMUONClusterStoreV2.cxx:1 AliMUONClusterStoreV2.cxx:2 AliMUONClusterStoreV2.cxx:3 AliMUONClusterStoreV2.cxx:4 AliMUONClusterStoreV2.cxx:5 AliMUONClusterStoreV2.cxx:6 AliMUONClusterStoreV2.cxx:7 AliMUONClusterStoreV2.cxx:8 AliMUONClusterStoreV2.cxx:9 AliMUONClusterStoreV2.cxx:10 AliMUONClusterStoreV2.cxx:11 AliMUONClusterStoreV2.cxx:12 AliMUONClusterStoreV2.cxx:13 AliMUONClusterStoreV2.cxx:14 AliMUONClusterStoreV2.cxx:15 AliMUONClusterStoreV2.cxx:16 AliMUONClusterStoreV2.cxx:17 AliMUONClusterStoreV2.cxx:18 AliMUONClusterStoreV2.cxx:19 AliMUONClusterStoreV2.cxx:20 AliMUONClusterStoreV2.cxx:21 AliMUONClusterStoreV2.cxx:22 AliMUONClusterStoreV2.cxx:23 AliMUONClusterStoreV2.cxx:24 AliMUONClusterStoreV2.cxx:25 AliMUONClusterStoreV2.cxx:26 AliMUONClusterStoreV2.cxx:27 AliMUONClusterStoreV2.cxx:28 AliMUONClusterStoreV2.cxx:29 AliMUONClusterStoreV2.cxx:30 AliMUONClusterStoreV2.cxx:31 AliMUONClusterStoreV2.cxx:32 AliMUONClusterStoreV2.cxx:33 AliMUONClusterStoreV2.cxx:34 AliMUONClusterStoreV2.cxx:35 AliMUONClusterStoreV2.cxx:36 AliMUONClusterStoreV2.cxx:37 AliMUONClusterStoreV2.cxx:38 AliMUONClusterStoreV2.cxx:39 AliMUONClusterStoreV2.cxx:40 AliMUONClusterStoreV2.cxx:41 AliMUONClusterStoreV2.cxx:42 AliMUONClusterStoreV2.cxx:43 AliMUONClusterStoreV2.cxx:44 AliMUONClusterStoreV2.cxx:45 AliMUONClusterStoreV2.cxx:46 AliMUONClusterStoreV2.cxx:47 AliMUONClusterStoreV2.cxx:48 AliMUONClusterStoreV2.cxx:49 AliMUONClusterStoreV2.cxx:50 AliMUONClusterStoreV2.cxx:51 AliMUONClusterStoreV2.cxx:52 AliMUONClusterStoreV2.cxx:53 AliMUONClusterStoreV2.cxx:54 AliMUONClusterStoreV2.cxx:55 AliMUONClusterStoreV2.cxx:56 AliMUONClusterStoreV2.cxx:57 AliMUONClusterStoreV2.cxx:58 AliMUONClusterStoreV2.cxx:59 AliMUONClusterStoreV2.cxx:60 AliMUONClusterStoreV2.cxx:61 AliMUONClusterStoreV2.cxx:62 AliMUONClusterStoreV2.cxx:63 AliMUONClusterStoreV2.cxx:64 AliMUONClusterStoreV2.cxx:65 AliMUONClusterStoreV2.cxx:66 AliMUONClusterStoreV2.cxx:67 AliMUONClusterStoreV2.cxx:68 AliMUONClusterStoreV2.cxx:69 AliMUONClusterStoreV2.cxx:70 AliMUONClusterStoreV2.cxx:71 AliMUONClusterStoreV2.cxx:72 AliMUONClusterStoreV2.cxx:73 AliMUONClusterStoreV2.cxx:74 AliMUONClusterStoreV2.cxx:75 AliMUONClusterStoreV2.cxx:76 AliMUONClusterStoreV2.cxx:77 AliMUONClusterStoreV2.cxx:78 AliMUONClusterStoreV2.cxx:79 AliMUONClusterStoreV2.cxx:80 AliMUONClusterStoreV2.cxx:81 AliMUONClusterStoreV2.cxx:82 AliMUONClusterStoreV2.cxx:83 AliMUONClusterStoreV2.cxx:84 AliMUONClusterStoreV2.cxx:85 AliMUONClusterStoreV2.cxx:86 AliMUONClusterStoreV2.cxx:87 AliMUONClusterStoreV2.cxx:88 AliMUONClusterStoreV2.cxx:89 AliMUONClusterStoreV2.cxx:90 AliMUONClusterStoreV2.cxx:91 AliMUONClusterStoreV2.cxx:92 AliMUONClusterStoreV2.cxx:93 AliMUONClusterStoreV2.cxx:94 AliMUONClusterStoreV2.cxx:95 AliMUONClusterStoreV2.cxx:96 AliMUONClusterStoreV2.cxx:97 AliMUONClusterStoreV2.cxx:98 AliMUONClusterStoreV2.cxx:99 AliMUONClusterStoreV2.cxx:100 AliMUONClusterStoreV2.cxx:101 AliMUONClusterStoreV2.cxx:102 AliMUONClusterStoreV2.cxx:103 AliMUONClusterStoreV2.cxx:104 AliMUONClusterStoreV2.cxx:105 AliMUONClusterStoreV2.cxx:106 AliMUONClusterStoreV2.cxx:107 AliMUONClusterStoreV2.cxx:108 AliMUONClusterStoreV2.cxx:109 AliMUONClusterStoreV2.cxx:110 AliMUONClusterStoreV2.cxx:111 AliMUONClusterStoreV2.cxx:112 AliMUONClusterStoreV2.cxx:113 AliMUONClusterStoreV2.cxx:114 AliMUONClusterStoreV2.cxx:115 AliMUONClusterStoreV2.cxx:116 AliMUONClusterStoreV2.cxx:117 AliMUONClusterStoreV2.cxx:118 AliMUONClusterStoreV2.cxx:119 AliMUONClusterStoreV2.cxx:120 AliMUONClusterStoreV2.cxx:121 AliMUONClusterStoreV2.cxx:122 AliMUONClusterStoreV2.cxx:123 AliMUONClusterStoreV2.cxx:124 AliMUONClusterStoreV2.cxx:125 AliMUONClusterStoreV2.cxx:126 AliMUONClusterStoreV2.cxx:127 AliMUONClusterStoreV2.cxx:128 AliMUONClusterStoreV2.cxx:129 AliMUONClusterStoreV2.cxx:130 AliMUONClusterStoreV2.cxx:131 AliMUONClusterStoreV2.cxx:132 AliMUONClusterStoreV2.cxx:133 AliMUONClusterStoreV2.cxx:134 AliMUONClusterStoreV2.cxx:135 AliMUONClusterStoreV2.cxx:136 AliMUONClusterStoreV2.cxx:137 AliMUONClusterStoreV2.cxx:138 AliMUONClusterStoreV2.cxx:139 AliMUONClusterStoreV2.cxx:140 AliMUONClusterStoreV2.cxx:141 AliMUONClusterStoreV2.cxx:142 AliMUONClusterStoreV2.cxx:143 AliMUONClusterStoreV2.cxx:144 AliMUONClusterStoreV2.cxx:145 AliMUONClusterStoreV2.cxx:146 AliMUONClusterStoreV2.cxx:147 AliMUONClusterStoreV2.cxx:148 AliMUONClusterStoreV2.cxx:149 AliMUONClusterStoreV2.cxx:150 AliMUONClusterStoreV2.cxx:151 AliMUONClusterStoreV2.cxx:152 AliMUONClusterStoreV2.cxx:153 AliMUONClusterStoreV2.cxx:154 AliMUONClusterStoreV2.cxx:155 AliMUONClusterStoreV2.cxx:156 AliMUONClusterStoreV2.cxx:157 AliMUONClusterStoreV2.cxx:158 AliMUONClusterStoreV2.cxx:159 AliMUONClusterStoreV2.cxx:160 AliMUONClusterStoreV2.cxx:161 AliMUONClusterStoreV2.cxx:162 AliMUONClusterStoreV2.cxx:163 AliMUONClusterStoreV2.cxx:164 AliMUONClusterStoreV2.cxx:165 AliMUONClusterStoreV2.cxx:166 AliMUONClusterStoreV2.cxx:167 AliMUONClusterStoreV2.cxx:168 AliMUONClusterStoreV2.cxx:169 AliMUONClusterStoreV2.cxx:170 AliMUONClusterStoreV2.cxx:171 AliMUONClusterStoreV2.cxx:172 AliMUONClusterStoreV2.cxx:173 AliMUONClusterStoreV2.cxx:174 AliMUONClusterStoreV2.cxx:175 AliMUONClusterStoreV2.cxx:176 AliMUONClusterStoreV2.cxx:177 AliMUONClusterStoreV2.cxx:178 AliMUONClusterStoreV2.cxx:179 AliMUONClusterStoreV2.cxx:180 AliMUONClusterStoreV2.cxx:181 AliMUONClusterStoreV2.cxx:182 AliMUONClusterStoreV2.cxx:183 AliMUONClusterStoreV2.cxx:184 AliMUONClusterStoreV2.cxx:185 AliMUONClusterStoreV2.cxx:186 AliMUONClusterStoreV2.cxx:187 AliMUONClusterStoreV2.cxx:188 AliMUONClusterStoreV2.cxx:189 AliMUONClusterStoreV2.cxx:190 AliMUONClusterStoreV2.cxx:191 AliMUONClusterStoreV2.cxx:192 AliMUONClusterStoreV2.cxx:193 AliMUONClusterStoreV2.cxx:194 AliMUONClusterStoreV2.cxx:195 AliMUONClusterStoreV2.cxx:196 AliMUONClusterStoreV2.cxx:197 AliMUONClusterStoreV2.cxx:198 AliMUONClusterStoreV2.cxx:199 AliMUONClusterStoreV2.cxx:200 AliMUONClusterStoreV2.cxx:201 AliMUONClusterStoreV2.cxx:202 AliMUONClusterStoreV2.cxx:203 AliMUONClusterStoreV2.cxx:204 AliMUONClusterStoreV2.cxx:205 AliMUONClusterStoreV2.cxx:206 AliMUONClusterStoreV2.cxx:207 AliMUONClusterStoreV2.cxx:208 AliMUONClusterStoreV2.cxx:209 AliMUONClusterStoreV2.cxx:210 AliMUONClusterStoreV2.cxx:211 AliMUONClusterStoreV2.cxx:212 AliMUONClusterStoreV2.cxx:213 AliMUONClusterStoreV2.cxx:214 AliMUONClusterStoreV2.cxx:215 AliMUONClusterStoreV2.cxx:216 AliMUONClusterStoreV2.cxx:217 AliMUONClusterStoreV2.cxx:218 AliMUONClusterStoreV2.cxx:219 AliMUONClusterStoreV2.cxx:220 AliMUONClusterStoreV2.cxx:221 AliMUONClusterStoreV2.cxx:222 AliMUONClusterStoreV2.cxx:223 AliMUONClusterStoreV2.cxx:224 AliMUONClusterStoreV2.cxx:225 AliMUONClusterStoreV2.cxx:226 AliMUONClusterStoreV2.cxx:227 AliMUONClusterStoreV2.cxx:228 AliMUONClusterStoreV2.cxx:229 AliMUONClusterStoreV2.cxx:230 AliMUONClusterStoreV2.cxx:231 AliMUONClusterStoreV2.cxx:232 AliMUONClusterStoreV2.cxx:233 AliMUONClusterStoreV2.cxx:234 AliMUONClusterStoreV2.cxx:235 AliMUONClusterStoreV2.cxx:236 AliMUONClusterStoreV2.cxx:237 AliMUONClusterStoreV2.cxx:238 AliMUONClusterStoreV2.cxx:239 AliMUONClusterStoreV2.cxx:240 AliMUONClusterStoreV2.cxx:241 AliMUONClusterStoreV2.cxx:242 AliMUONClusterStoreV2.cxx:243 AliMUONClusterStoreV2.cxx:244 AliMUONClusterStoreV2.cxx:245 AliMUONClusterStoreV2.cxx:246 AliMUONClusterStoreV2.cxx:247 AliMUONClusterStoreV2.cxx:248 AliMUONClusterStoreV2.cxx:249 AliMUONClusterStoreV2.cxx:250 AliMUONClusterStoreV2.cxx:251 AliMUONClusterStoreV2.cxx:252 AliMUONClusterStoreV2.cxx:253 AliMUONClusterStoreV2.cxx:254 AliMUONClusterStoreV2.cxx:255 AliMUONClusterStoreV2.cxx:256 AliMUONClusterStoreV2.cxx:257 AliMUONClusterStoreV2.cxx:258 AliMUONClusterStoreV2.cxx:259 AliMUONClusterStoreV2.cxx:260 AliMUONClusterStoreV2.cxx:261 AliMUONClusterStoreV2.cxx:262 AliMUONClusterStoreV2.cxx:263 AliMUONClusterStoreV2.cxx:264 AliMUONClusterStoreV2.cxx:265 AliMUONClusterStoreV2.cxx:266 AliMUONClusterStoreV2.cxx:267 AliMUONClusterStoreV2.cxx:268 AliMUONClusterStoreV2.cxx:269 AliMUONClusterStoreV2.cxx:270 AliMUONClusterStoreV2.cxx:271 AliMUONClusterStoreV2.cxx:272 AliMUONClusterStoreV2.cxx:273 AliMUONClusterStoreV2.cxx:274 AliMUONClusterStoreV2.cxx:275 AliMUONClusterStoreV2.cxx:276 AliMUONClusterStoreV2.cxx:277 AliMUONClusterStoreV2.cxx:278 AliMUONClusterStoreV2.cxx:279 AliMUONClusterStoreV2.cxx:280 AliMUONClusterStoreV2.cxx:281 AliMUONClusterStoreV2.cxx:282 AliMUONClusterStoreV2.cxx:283 AliMUONClusterStoreV2.cxx:284 AliMUONClusterStoreV2.cxx:285 AliMUONClusterStoreV2.cxx:286 AliMUONClusterStoreV2.cxx:287 AliMUONClusterStoreV2.cxx:288 AliMUONClusterStoreV2.cxx:289 AliMUONClusterStoreV2.cxx:290 AliMUONClusterStoreV2.cxx:291 AliMUONClusterStoreV2.cxx:292 AliMUONClusterStoreV2.cxx:293 AliMUONClusterStoreV2.cxx:294 AliMUONClusterStoreV2.cxx:295 AliMUONClusterStoreV2.cxx:296 AliMUONClusterStoreV2.cxx:297 AliMUONClusterStoreV2.cxx:298 AliMUONClusterStoreV2.cxx:299 AliMUONClusterStoreV2.cxx:300 AliMUONClusterStoreV2.cxx:301 AliMUONClusterStoreV2.cxx:302 AliMUONClusterStoreV2.cxx:303 AliMUONClusterStoreV2.cxx:304 AliMUONClusterStoreV2.cxx:305 AliMUONClusterStoreV2.cxx:306 AliMUONClusterStoreV2.cxx:307 AliMUONClusterStoreV2.cxx:308 AliMUONClusterStoreV2.cxx:309